tizen 2.4 release accepted/tizen_2.4_mobile accepted/tizen/2.4/mobile/20151029.033117 submit/tizen_2.4/20151028.064151 tizen_2.4_mobile_release
authorjk7744.park <jk7744.park@samsung.com>
Mon, 26 Oct 2015 06:45:37 +0000 (15:45 +0900)
committerjk7744.park <jk7744.park@samsung.com>
Mon, 26 Oct 2015 06:45:37 +0000 (15:45 +0900)
73 files changed:
CMakeLists.txt [new file with mode: 0644]
COREGL.pc.in [new file with mode: 0644]
LICENSE [new file with mode: 0644]
LICENSE.MIT [new file with mode: 0644]
LICENSE.SGI-B-2.0 [new file with mode: 0644]
LICENSE.Zlib [new file with mode: 0644]
LICENSE.libpng [new file with mode: 0644]
Makefile [new file with mode: 0644]
include_KHR/EGL/egl.h [new file with mode: 0644]
include_KHR/EGL/eglext.h [new file with mode: 0644]
include_KHR/EGL/eglplatform.h [new file with mode: 0644]
include_KHR/GLES/egl.h [new file with mode: 0644]
include_KHR/GLES/gl.h [new file with mode: 0644]
include_KHR/GLES/glext.h [new file with mode: 0644]
include_KHR/GLES/glplatform.h [new file with mode: 0644]
include_KHR/GLES2/gl2.h [new file with mode: 0644]
include_KHR/GLES2/gl2ext.h [new file with mode: 0644]
include_KHR/GLES2/gl2platform.h [new file with mode: 0644]
include_KHR/GLES3/README [new file with mode: 0644]
include_KHR/GLES3/gl3.h [new file with mode: 0644]
include_KHR/GLES3/gl31.h [new file with mode: 0644]
include_KHR/GLES3/gl3platform.h [new file with mode: 0644]
include_KHR/KHR/khrplatform.h [new file with mode: 0644]
packaging/coregl.manifest [new file with mode: 0644]
packaging/coregl.spec [new file with mode: 0644]
pkgconfig/egl.pc [new file with mode: 0644]
pkgconfig/gles11.pc [new file with mode: 0644]
pkgconfig/gles20.pc [new file with mode: 0644]
pkgconfig/glesv1.pc [new file with mode: 0644]
pkgconfig/glesv1_cm.pc [new file with mode: 0644]
pkgconfig/glesv2.pc [new file with mode: 0644]
pkgconfig/opengl-es-11.pc [new file with mode: 0644]
pkgconfig/opengl-es-20.pc [new file with mode: 0644]
src/coregl.c [new file with mode: 0644]
src/coregl.h [new file with mode: 0644]
src/coregl_export.c [new file with mode: 0644]
src/coregl_export.h [new file with mode: 0644]
src/coregl_export_egl.c [new file with mode: 0644]
src/coregl_export_gl.c [new file with mode: 0644]
src/coregl_internal.h [new file with mode: 0644]
src/coregl_override.c [new file with mode: 0644]
src/coregl_thread_pthread.c [new file with mode: 0644]
src/coregl_thread_pthread.h [new file with mode: 0644]
src/coregl_thread_pthread_and_gcc_tlv.c [new file with mode: 0644]
src/coregl_trace.c [new file with mode: 0644]
src/headers/egl.h [new file with mode: 0644]
src/headers/gl.h [new file with mode: 0644]
src/headers/glx.h [new file with mode: 0644]
src/headers/sym.h [new file with mode: 0644]
src/headers/sym_egl.h [new file with mode: 0644]
src/headers/sym_gl.h [new file with mode: 0644]
src/headers/sym_glx.h [new file with mode: 0644]
src/modules/appopt/coregl_appopt.c [new file with mode: 0644]
src/modules/appopt/coregl_appopt.h [new file with mode: 0644]
src/modules/appopt/coregl_appopt_egl.c [new file with mode: 0644]
src/modules/appopt/coregl_appopt_gl.c [new file with mode: 0644]
src/modules/coregl_module.c [new file with mode: 0644]
src/modules/coregl_module.h [new file with mode: 0644]
src/modules/fastpath/coregl_fastpath.c [new file with mode: 0644]
src/modules/fastpath/coregl_fastpath.h [new file with mode: 0644]
src/modules/fastpath/coregl_fastpath_egl.c [new file with mode: 0644]
src/modules/fastpath/coregl_fastpath_gl.c [new file with mode: 0644]
src/modules/fastpath/coregl_fastpath_state.h [new file with mode: 0644]
src/modules/tracepath/coregl_tracepath.c [new file with mode: 0644]
src/modules/tracepath/coregl_tracepath.h [new file with mode: 0644]
src/modules/tracepath/coregl_tracepath_egl.c [new file with mode: 0644]
src/modules/tracepath/coregl_tracepath_gl.c [new file with mode: 0644]
src/modules/tracepath/png.h [new file with mode: 0644]
src/modules/tracepath/pngconf.h [new file with mode: 0644]
src/modules/tracepath/zconf.h [new file with mode: 0644]
src/modules/tracepath/zlib.h [new file with mode: 0644]
src/wraps/coregl_egl.c [new file with mode: 0644]
src/wraps/coregl_gl.c [new file with mode: 0644]

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..b1dbd18
--- /dev/null
@@ -0,0 +1,117 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(coregl C)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "\${prefix}")
+SET(LIBDIR "\${prefix}/lib")
+SET(INCLUDEDIR "\${prefix}/include_KHR")
+SET(COREGL_VERSION_MAJOR 4)
+SET(COREGL_VERSION_MINOR 0)
+SET(EGL_VERSION_MAJOR 1)
+SET(EGL_VERSION_MINOR 4)
+SET(GLES2_VERSION_MAJOR 2)
+SET(GLES2_VERSION_MINOR 0)
+SET(COREGL_VERSION "${COREGL_VERSION_MAJOR}.${COREGL_VERSION_MINOR}")
+SET(EGL_VERSION "${EGL_VERSION_MAJOR}.${EGL_VERSION_MINOR}")
+SET(GLES2_VERSION "${GLES2_VERSION_MAJOR}.${GLES2_VERSION_MINOR}")
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include_KHR)
+
+ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
+
+EXEC_PROGRAM(date OUTPUT_VARIABLE COMPILE_DATE)
+ADD_DEFINITIONS("-D_COREGL_COMPILE_DATE=\"${COMPILE_DATE}\"")
+
+IF(USE_ADRENO)
+ADD_DEFINITIONS("-D_COREGL_VENDOR_EGL_LIB_PATH=\"/usr/lib/egl/libEGL.so\"")
+ADD_DEFINITIONS("-D_COREGL_VENDOR_GL_LIB_PATH=\"/usr/lib/egl/libGLESv2.so\"")
+ENDIF(USE_ADRENO)
+
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -g -O2 -fPIC -Wall -std=c99 -D_COREGL_EMBEDDED_GL")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+SET(CMAKE_SKIP_BUILD_RPATH TRUE)
+
+#################################################################
+# Build coregl Library
+# ------------------------------
+SET(COREGL "COREGL")
+SET(SRCS_common
+               src/coregl.c
+               src/coregl_thread_pthread.c
+               src/coregl_trace.c
+               src/coregl_export.c
+               src/coregl_export_egl.c
+               src/coregl_export_gl.c
+               src/modules/coregl_module.c
+               src/modules/tracepath/coregl_tracepath.c
+               src/modules/tracepath/coregl_tracepath_egl.c
+               src/modules/tracepath/coregl_tracepath_gl.c
+
+               src/modules/fastpath/coregl_fastpath.c
+               src/modules/fastpath/coregl_fastpath_egl.c
+               src/modules/fastpath/coregl_fastpath_gl.c
+
+               src/modules/appopt/coregl_appopt.c
+               src/modules/appopt/coregl_appopt_egl.c
+               src/modules/appopt/coregl_appopt_gl.c
+)
+#################################################################
+# Build egl Library
+# ------------------------------
+SET(EGL "COREGL_EGL")
+SET(EGL_SRCS_common
+               src/wraps/coregl_egl.c
+)
+#################################################################
+# Build gles2 Library
+# ------------------------------
+SET(GLES2 "COREGL_GLESv2")
+SET(GLES2_SRCS_common
+               src/wraps/coregl_gl.c
+)
+
+
+
+#SET(HEADERS_common src/coregl_export.h src/coregl_fastpath.h src/coregl_fastpath_state.h src/coregl.h src/coregl_internal.h src/coregl_thread_pthread.h src/coregl_wrappath.h)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(dlog REQUIRED dlog)
+
+INCLUDE_DIRECTORIES(${dlog_INCLUDE_DIRS})
+INCLUDE_DIRECTORIES(${dlog_INCLUDEDIR})
+
+FOREACH(flag ${pkg_common_CFLAGS})
+       SET(EXTRA_CFLAGS_common "${EXTRA_CFLAGS_common} ${flag} -lGLESv2_drv -lEGL_drv")
+ENDFOREACH(flag)
+
+ADD_LIBRARY(${COREGL} SHARED ${SRCS_common})
+SET_TARGET_PROPERTIES(${COREGL} PROPERTIES SOVERSION ${COREGL_VERSION_MAJOR})
+SET_TARGET_PROPERTIES(${COREGL} PROPERTIES VERSION ${COREGL_VERSION})
+#SET_TARGET_PROPERTIES(${COREGL} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_common})
+TARGET_LINK_LIBRARIES(${COREGL} ${pkg_common_LDFLAGS} ${dlog_LIBRARIES} "-ldl -g -O2 -fvisibility=hidden -Wall -std=c99 -lpthread")
+
+ADD_LIBRARY(${EGL} SHARED ${EGL_SRCS_common})
+SET_TARGET_PROPERTIES(${EGL} PROPERTIES VERSION ${EGL_VERSION})
+#SET_TARGET_PROPERTIES(${COREGL} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_common})
+TARGET_LINK_LIBRARIES(${EGL} ${pkg_common_LDFLAGS} ${dlog_LIBRARIES} "-ldl -g -O2 -fvisibility=hidden -Wall -std=c99 -lpthread")
+
+ADD_LIBRARY(${GLES2} SHARED ${GLES2_SRCS_common})
+SET_TARGET_PROPERTIES(${GLES2} PROPERTIES VERSION ${GLES2_VERSION})
+#SET_TARGET_PROPERTIES(${COREGL} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_common})
+TARGET_LINK_LIBRARIES(${GLES2} ${pkg_common_LDFLAGS} ${dlog_LIBRARIES} "-ldl -g -O2 -fvisibility=hidden -Wall -std=c99 -lpthread")
+
+CONFIGURE_FILE(${COREGL}.pc.in ${COREGL}.pc @ONLY)
+
+INSTALL(TARGETS ${COREGL} DESTINATION lib COMPONENT RuntimeLibraries)
+INSTALL(TARGETS ${EGL} DESTINATION lib COMPONENT RuntimeLibraries)
+INSTALL(TARGETS ${GLES2} DESTINATION lib COMPONENT RuntimeLibraries)
+
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${COREGL}.pc DESTINATION lib/pkgconfig)
+
+#FOREACH(hfile ${HEADERS_common})
+#      INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/${hfile} DESTINATION include/coregl)
+#ENDFOREACH(hfile)
+#INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/coregl.h DESTINATION include)
+
diff --git a/COREGL.pc.in b/COREGL.pc.in
new file mode 100644 (file)
index 0000000..ca32f1b
--- /dev/null
@@ -0,0 +1,13 @@
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: coregl
+Description: SAMSUNG Linux platform application library
+Version: @VERSION@
+Requires: x11 dlog
+Libs: -L${libdir} -lcoregl
+Cflags: -I${includedir} -I${includedir}/coregl
diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..9c13a9b
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,204 @@
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+\r
+                                 Apache License\r
+                           Version 2.0, January 2004\r
+                        http://www.apache.org/licenses/\r
+\r
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r
+\r
+   1. Definitions.\r
+\r
+      "License" shall mean the terms and conditions for use, reproduction,\r
+      and distribution as defined by Sections 1 through 9 of this document.\r
+\r
+      "Licensor" shall mean the copyright owner or entity authorized by\r
+      the copyright owner that is granting the License.\r
+\r
+      "Legal Entity" shall mean the union of the acting entity and all\r
+      other entities that control, are controlled by, or are under common\r
+      control with that entity. For the purposes of this definition,\r
+      "control" means (i) the power, direct or indirect, to cause the\r
+      direction or management of such entity, whether by contract or\r
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the\r
+      outstanding shares, or (iii) beneficial ownership of such entity.\r
+\r
+      "You" (or "Your") shall mean an individual or Legal Entity\r
+      exercising permissions granted by this License.\r
+\r
+      "Source" form shall mean the preferred form for making modifications,\r
+      including but not limited to software source code, documentation\r
+      source, and configuration files.\r
+\r
+      "Object" form shall mean any form resulting from mechanical\r
+      transformation or translation of a Source form, including but\r
+      not limited to compiled object code, generated documentation,\r
+      and conversions to other media types.\r
+\r
+      "Work" shall mean the work of authorship, whether in Source or\r
+      Object form, made available under the License, as indicated by a\r
+      copyright notice that is included in or attached to the work\r
+      (an example is provided in the Appendix below).\r
+\r
+      "Derivative Works" shall mean any work, whether in Source or Object\r
+      form, that is based on (or derived from) the Work and for which the\r
+      editorial revisions, annotations, elaborations, or other modifications\r
+      represent, as a whole, an original work of authorship. For the purposes\r
+      of this License, Derivative Works shall not include works that remain\r
+      separable from, or merely link (or bind by name) to the interfaces of,\r
+      the Work and Derivative Works thereof.\r
+\r
+      "Contribution" shall mean any work of authorship, including\r
+      the original version of the Work and any modifications or additions\r
+      to that Work or Derivative Works thereof, that is intentionally\r
+      submitted to Licensor for inclusion in the Work by the copyright owner\r
+      or by an individual or Legal Entity authorized to submit on behalf of\r
+      the copyright owner. For the purposes of this definition, "submitted"\r
+      means any form of electronic, verbal, or written communication sent\r
+      to the Licensor or its representatives, including but not limited to\r
+      communication on electronic mailing lists, source code control systems,\r
+      and issue tracking systems that are managed by, or on behalf of, the\r
+      Licensor for the purpose of discussing and improving the Work, but\r
+      excluding communication that is conspicuously marked or otherwise\r
+      designated in writing by the copyright owner as "Not a Contribution."\r
+\r
+      "Contributor" shall mean Licensor and any individual or Legal Entity\r
+      on behalf of whom a Contribution has been received by Licensor and\r
+      subsequently incorporated within the Work.\r
+\r
+   2. Grant of Copyright License. Subject to the terms and conditions of\r
+      this License, each Contributor hereby grants to You a perpetual,\r
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+      copyright license to reproduce, prepare Derivative Works of,\r
+      publicly display, publicly perform, sublicense, and distribute the\r
+      Work and such Derivative Works in Source or Object form.\r
+\r
+   3. Grant of Patent License. Subject to the terms and conditions of\r
+      this License, each Contributor hereby grants to You a perpetual,\r
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+      (except as stated in this section) patent license to make, have made,\r
+      use, offer to sell, sell, import, and otherwise transfer the Work,\r
+      where such license applies only to those patent claims licensable\r
+      by such Contributor that are necessarily infringed by their\r
+      Contribution(s) alone or by combination of their Contribution(s)\r
+      with the Work to which such Contribution(s) was submitted. If You\r
+      institute patent litigation against any entity (including a\r
+      cross-claim or counterclaim in a lawsuit) alleging that the Work\r
+      or a Contribution incorporated within the Work constitutes direct\r
+      or contributory patent infringement, then any patent licenses\r
+      granted to You under this License for that Work shall terminate\r
+      as of the date such litigation is filed.\r
+\r
+   4. Redistribution. You may reproduce and distribute copies of the\r
+      Work or Derivative Works thereof in any medium, with or without\r
+      modifications, and in Source or Object form, provided that You\r
+      meet the following conditions:\r
+\r
+      (a) You must give any other recipients of the Work or\r
+          Derivative Works a copy of this License; and\r
+\r
+      (b) You must cause any modified files to carry prominent notices\r
+          stating that You changed the files; and\r
+\r
+      (c) You must retain, in the Source form of any Derivative Works\r
+          that You distribute, all copyright, patent, trademark, and\r
+          attribution notices from the Source form of the Work,\r
+          excluding those notices that do not pertain to any part of\r
+          the Derivative Works; and\r
+\r
+      (d) If the Work includes a "NOTICE" text file as part of its\r
+          distribution, then any Derivative Works that You distribute must\r
+          include a readable copy of the attribution notices contained\r
+          within such NOTICE file, excluding those notices that do not\r
+          pertain to any part of the Derivative Works, in at least one\r
+          of the following places: within a NOTICE text file distributed\r
+          as part of the Derivative Works; within the Source form or\r
+          documentation, if provided along with the Derivative Works; or,\r
+          within a display generated by the Derivative Works, if and\r
+          wherever such third-party notices normally appear. The contents\r
+          of the NOTICE file are for informational purposes only and\r
+          do not modify the License. You may add Your own attribution\r
+          notices within Derivative Works that You distribute, alongside\r
+          or as an addendum to the NOTICE text from the Work, provided\r
+          that such additional attribution notices cannot be construed\r
+          as modifying the License.\r
+\r
+      You may add Your own copyright statement to Your modifications and\r
+      may provide additional or different license terms and conditions\r
+      for use, reproduction, or distribution of Your modifications, or\r
+      for any such Derivative Works as a whole, provided Your use,\r
+      reproduction, and distribution of the Work otherwise complies with\r
+      the conditions stated in this License.\r
+\r
+   5. Submission of Contributions. Unless You explicitly state otherwise,\r
+      any Contribution intentionally submitted for inclusion in the Work\r
+      by You to the Licensor shall be under the terms and conditions of\r
+      this License, without any additional terms or conditions.\r
+      Notwithstanding the above, nothing herein shall supersede or modify\r
+      the terms of any separate license agreement you may have executed\r
+      with Licensor regarding such Contributions.\r
+\r
+   6. Trademarks. This License does not grant permission to use the trade\r
+      names, trademarks, service marks, or product names of the Licensor,\r
+      except as required for reasonable and customary use in describing the\r
+      origin of the Work and reproducing the content of the NOTICE file.\r
+\r
+   7. Disclaimer of Warranty. Unless required by applicable law or\r
+      agreed to in writing, Licensor provides the Work (and each\r
+      Contributor provides its Contributions) on an "AS IS" BASIS,\r
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\r
+      implied, including, without limitation, any warranties or conditions\r
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\r
+      PARTICULAR PURPOSE. You are solely responsible for determining the\r
+      appropriateness of using or redistributing the Work and assume any\r
+      risks associated with Your exercise of permissions under this License.\r
+\r
+   8. Limitation of Liability. In no event and under no legal theory,\r
+      whether in tort (including negligence), contract, or otherwise,\r
+      unless required by applicable law (such as deliberate and grossly\r
+      negligent acts) or agreed to in writing, shall any Contributor be\r
+      liable to You for damages, including any direct, indirect, special,\r
+      incidental, or consequential damages of any character arising as a\r
+      result of this License or out of the use or inability to use the\r
+      Work (including but not limited to damages for loss of goodwill,\r
+      work stoppage, computer failure or malfunction, or any and all\r
+      other commercial damages or losses), even if such Contributor\r
+      has been advised of the possibility of such damages.\r
+\r
+   9. Accepting Warranty or Additional Liability. While redistributing\r
+      the Work or Derivative Works thereof, You may choose to offer,\r
+      and charge a fee for, acceptance of support, warranty, indemnity,\r
+      or other liability obligations and/or rights consistent with this\r
+      License. However, in accepting such obligations, You may act only\r
+      on Your own behalf and on Your sole responsibility, not on behalf\r
+      of any other Contributor, and only if You agree to indemnify,\r
+      defend, and hold each Contributor harmless for any liability\r
+      incurred by, or claims asserted against, such Contributor by reason\r
+      of your accepting any such warranty or additional liability.\r
+\r
+   END OF TERMS AND CONDITIONS\r
+\r
+   APPENDIX: How to apply the Apache License to your work.\r
+\r
+      To apply the Apache License to your work, attach the following\r
+      boilerplate notice, with the fields enclosed by brackets "[]"\r
+      replaced with your own identifying information. (Don't include\r
+      the brackets!)  The text should be enclosed in the appropriate\r
+      comment syntax for the file format. We also recommend that a\r
+      file or class name and description of purpose be included on the\r
+      same "printed page" as the copyright notice for easier\r
+      identification within third-party archives.\r
+\r
+   Copyright [yyyy] [name of copyright owner]\r
+\r
+   Licensed under the Apache License, Version 2.0 (the "License");\r
+   you may not use this file except in compliance with the License.\r
+   You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+\r
diff --git a/LICENSE.MIT b/LICENSE.MIT
new file mode 100644 (file)
index 0000000..7a94373
--- /dev/null
@@ -0,0 +1,20 @@
+Copyright (c) 2013-2015 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.
diff --git a/LICENSE.SGI-B-2.0 b/LICENSE.SGI-B-2.0
new file mode 100644 (file)
index 0000000..8cb591d
--- /dev/null
@@ -0,0 +1,27 @@
+SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+Copyright (C) [dates of first publication] Silicon Graphics, Inc.
+All Rights Reserved.
+
+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 including the dates of first publication and either
+this permission notice or a reference to http://oss.sgi.com/projects/FreeB/
+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
+SILICON GRAPHICS, INC. 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.
+
+Except as contained in this notice, the name of Silicon Graphics, Inc.
+shall not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from
+Silicon Graphics, Inc.
+
diff --git a/LICENSE.Zlib b/LICENSE.Zlib
new file mode 100644 (file)
index 0000000..d23aa14
--- /dev/null
@@ -0,0 +1,25 @@
+Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler
+
+This software is provided 'as-is', without any express or implied
+warranty.  In no event will the authors be held liable for any damages
+arising from the use of this software.
+
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it
+freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must not
+   claim that you wrote the original software. If you use this software
+   in a product, an acknowledgment in the product documentation would be
+   appreciated but is not required.
+2. Altered source versions must be plainly marked as such, and must not be
+   misrepresented as being the original software.
+3. This notice may not be removed or altered from any source distribution.
+
+Jean-loup Gailly        Mark Adler
+jloup@gzip.org          madler@alumni.caltech.edu
+
+
+The data format used by the zlib library is described by RFCs (Request for
+Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt
+(zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
diff --git a/LICENSE.libpng b/LICENSE.libpng
new file mode 100644 (file)
index 0000000..ee59acc
--- /dev/null
@@ -0,0 +1,112 @@
+libpng version 1.2.50 - July 10, 2012
+Copyright (c) 1998-2012 Glenn Randers-Pehrson
+(Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
+(Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
+
+COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
+
+If you modify libpng you may insert additional notices immediately following
+this sentence.
+
+This code is released under the libpng license.
+
+libpng versions 1.2.6, August 15, 2004, through 1.2.50, July 10, 2012, are
+Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
+distributed according to the same disclaimer and license as libpng-1.2.5
+with the following individual added to the list of Contributing Authors:
+
+   Cosmin Truta
+
+libpng versions 1.0.7, July 1, 2000, through 1.2.5, October 3, 2002, are
+Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
+distributed according to the same disclaimer and license as libpng-1.0.6
+with the following individuals added to the list of Contributing Authors:
+
+   Simon-Pierre Cadieux
+   Eric S. Raymond
+   Gilles Vollant
+
+and with the following additions to the disclaimer:
+
+   There is no warranty against interference with your enjoyment of the
+   library or against infringement.  There is no warranty that our
+   efforts or the library will fulfill any of your particular purposes
+   or needs.  This library is provided with all faults, and the entire
+   risk of satisfactory quality, performance, accuracy, and effort is with
+   the user.
+
+libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
+Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson, and are
+distributed according to the same disclaimer and license as libpng-0.96,
+with the following individuals added to the list of Contributing Authors:
+
+   Tom Lane
+   Glenn Randers-Pehrson
+   Willem van Schaik
+
+libpng versions 0.89, June 1996, through 0.96, May 1997, are
+Copyright (c) 1996, 1997 Andreas Dilger
+Distributed according to the same disclaimer and license as libpng-0.88,
+with the following individuals added to the list of Contributing Authors:
+
+   John Bowler
+   Kevin Bracey
+   Sam Bushell
+   Magnus Holmgren
+   Greg Roelofs
+   Tom Tanner
+
+libpng versions 0.5, May 1995, through 0.88, January 1996, are
+Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
+
+For the purposes of this copyright and license, "Contributing Authors"
+is defined as the following set of individuals:
+
+   Andreas Dilger
+   Dave Martindale
+   Guy Eric Schalnat
+   Paul Schmidt
+   Tim Wegner
+
+The PNG Reference Library is supplied "AS IS".  The Contributing Authors
+and Group 42, Inc. disclaim all warranties, expressed or implied,
+including, without limitation, the warranties of merchantability and of
+fitness for any purpose.  The Contributing Authors and Group 42, Inc.
+assume no liability for direct, indirect, incidental, special, exemplary,
+or consequential damages, which may result from the use of the PNG
+Reference Library, even if advised of the possibility of such damage.
+
+Permission is hereby granted to use, copy, modify, and distribute this
+source code, or portions hereof, for any purpose, without fee, subject
+to the following restrictions:
+
+1. The origin of this source code must not be misrepresented.
+
+2. Altered versions must be plainly marked as such and
+must not be misrepresented as being the original source.
+
+3. This Copyright notice may not be removed or altered from
+   any source or altered source distribution.
+
+The Contributing Authors and Group 42, Inc. specifically permit, without
+fee, and encourage the use of this source code as a component to
+supporting the PNG file format in commercial products.  If you use this
+source code in a product, acknowledgment is not required but would be
+appreciated.
+
+A "png_get_copyright" function is available, for convenient use in "about"
+boxes and the like:
+
+printf("%s",png_get_copyright(NULL));
+
+Also, the PNG logo (in PNG format, of course) is supplied in the
+files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
+
+Libpng is OSI Certified Open Source Software.  OSI Certified is a
+certification mark of the Open Source Initiative.
+
+The contributing authors would like to thank all those who helped
+with testing, bug fixes, and patience.  This wouldn't have been
+possible without all of you.
+
+Thanks to Frank J. T. Wojcik for helping with the documentation.
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..6139784
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,84 @@
+CC = gcc
+
+COMPILE_DATE = "\"`git log -1 --pretty=format:%ci`\""
+
+VENDOR_EGL_LIB_PATH = "\"/usr/lib/driver/libEGL.so\""
+VENDOR_GL_LIB_PATH = "\"/usr/lib/driver/libGLESv2.so\""
+
+CFLAGS = -g -O2 -fvisibility=hidden -fPIC -fno-strict-aliasing -Wall -std=c99 -D_COREGL_COMPILE_DATE=$(COMPILE_DATE)
+CFLAGS += -I./include_KHR
+CFLAGS += -D_COREGL_VENDOR_EGL_LIB_PATH=$(VENDOR_EGL_LIB_PATH)
+CFLAGS += -D_COREGL_VENDOR_GL_LIB_PATH=$(VENDOR_GL_LIB_PATH)
+CFLAGS += `pkg-config --cflags dlog`
+
+LDFLAGS = -g -O2 -fvisibility=hidden -Wall -std=c99 -ldl -lpthread
+LDFLAGS += `pkg-config --libs dlog`
+
+
+SOURCES = \
+               src/coregl.c \
+               src/coregl_thread_pthread.c \
+               src/coregl_trace.c \
+               src/coregl_export.c \
+               src/coregl_export_egl.c \
+               src/coregl_export_gl.c \
+               src/modules/coregl_module.c \
+               \
+               src/modules/tracepath/coregl_tracepath.c \
+               src/modules/tracepath/coregl_tracepath_egl.c \
+               src/modules/tracepath/coregl_tracepath_gl.c \
+               \
+               src/modules/fastpath/coregl_fastpath.c \
+               src/modules/fastpath/coregl_fastpath_egl.c \
+               src/modules/fastpath/coregl_fastpath_gl.c \
+               \
+               src/modules/appopt/coregl_appopt.c \
+               src/modules/appopt/coregl_appopt_egl.c \
+               src/modules/appopt/coregl_appopt_gl.c
+
+BIN = libCOREGL.so
+
+COREGL_MAJOR = 4
+COREGL_MINOR = 0
+
+EGL_MAJOR = 1
+EGL_MINOR = 4
+
+GLESv2_MAJOR = 2
+GLESv2_MINOR = 0
+
+WRAP_EGL = libCOREGL_EGL.so
+WRAP_GLES2 = libCOREGL_GLESv2.so
+
+OUTPUT_BIN = $(BIN).$(COREGL_MAJOR).$(COREGL_MINOR)
+OUTPUT_WRAP_EGL = $(WRAP_EGL).$(EGL_MAJOR).$(EGL_MINOR)
+OUTPUT_WRAP_GLES2 = $(WRAP_GLES2).$(GLESv2_MAJOR).$(GLESv2_MINOR)
+
+OBJECTS = $(SOURCES:.c=.o)
+
+all : $(OUTPUT_BIN) $(OUTPUT_WRAP_EGL) $(OUTPUT_WRAP_GLES2)
+       cp src/headers/egl.h include/EGL/def_egl.h
+       cp src/headers/gl.h include/GLES3/def_gl.h
+       cp src/headers/sym_egl.h include/EGL/sym_egl.h
+       cp src/headers/sym_gl.h include/GLES3/sym_gl.h
+
+$(OUTPUT_BIN) : $(OBJECTS)
+       @mkdir -p lib
+       $(CC) -shared -o lib/$(OUTPUT_BIN) $(OBJECTS) $(LDFLAGS)
+       ln -sf $(OUTPUT_BIN) lib/$(BIN).$(COREGL_MAJOR)
+       ln -sf $(BIN).$(COREGL_MAJOR) lib/$(BIN)
+
+$(OUTPUT_WRAP_EGL) :
+       @mkdir -p lib
+       $(CC) -shared -o lib/$(OUTPUT_WRAP_EGL) src/wraps/coregl_egl.c $(CFLAGS) $(LDFLAGS)
+
+$(OUTPUT_WRAP_GLES2) :
+       @mkdir -p lib
+       $(CC) -shared -o lib/$(OUTPUT_WRAP_GLES2) src/wraps/coregl_gl.c $(CFLAGS) $(LDFLAGS)
+
+%.o : %.c
+       $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
+
+clean :
+       rm -f $(OBJECTS) lib/*
+
diff --git a/include_KHR/EGL/egl.h b/include_KHR/EGL/egl.h
new file mode 100644 (file)
index 0000000..f7df2b6
--- /dev/null
@@ -0,0 +1,303 @@
+#ifndef __egl_h_
+#define __egl_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2013-2014 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.
+*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+**   http://www.opengl.org/registry/
+**
+** Khronos $Revision: 27930 $ on $Date: 2014-09-03 21:17:58 -0700 (Wed, 03 Sep 2014) $
+*/
+
+#include <EGL/eglplatform.h>
+
+/* Generated on date 20140903 */
+
+/* Generated C header for:
+ * API: egl
+ * Versions considered: .*
+ * Versions emitted: .*
+ * Default extensions included: None
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef EGL_VERSION_1_0
+#define EGL_VERSION_1_0 1
+typedef unsigned int EGLBoolean;
+typedef void *EGLDisplay;
+#include <KHR/khrplatform.h>
+#include <EGL/eglplatform.h>
+typedef void *EGLConfig;
+typedef void *EGLSurface;
+typedef void *EGLContext;
+typedef void (*__eglMustCastToProperFunctionPointerType)(void);
+#define EGL_ALPHA_SIZE                    0x3021
+#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_BLUE_SIZE                     0x3022
+#define EGL_BUFFER_SIZE                   0x3020
+#define EGL_CONFIG_CAVEAT                 0x3027
+#define EGL_CONFIG_ID                     0x3028
+#define EGL_CORE_NATIVE_ENGINE            0x305B
+#define EGL_DEPTH_SIZE                    0x3025
+#define EGL_DONT_CARE                     ((EGLint)-1)
+#define EGL_DRAW                          0x3059
+#define EGL_EXTENSIONS                    0x3055
+#define EGL_FALSE                         0
+#define EGL_GREEN_SIZE                    0x3023
+#define EGL_HEIGHT                        0x3056
+#define EGL_LARGEST_PBUFFER               0x3058
+#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_NONE                          0x3038
+#define EGL_NON_CONFORMANT_CONFIG         0x3051
+#define EGL_NOT_INITIALIZED               0x3001
+#define EGL_NO_CONTEXT                    ((EGLContext)0)
+#define EGL_NO_DISPLAY                    ((EGLDisplay)0)
+#define EGL_NO_SURFACE                    ((EGLSurface)0)
+#define EGL_PBUFFER_BIT                   0x0001
+#define EGL_PIXMAP_BIT                    0x0002
+#define EGL_READ                          0x305A
+#define EGL_RED_SIZE                      0x3024
+#define EGL_SAMPLES                       0x3031
+#define EGL_SAMPLE_BUFFERS                0x3032
+#define EGL_SLOW_CONFIG                   0x3050
+#define EGL_STENCIL_SIZE                  0x3026
+#define EGL_SUCCESS                       0x3000
+#define EGL_SURFACE_TYPE                  0x3033
+#define EGL_TRANSPARENT_BLUE_VALUE        0x3035
+#define EGL_TRANSPARENT_GREEN_VALUE       0x3036
+#define EGL_TRANSPARENT_RED_VALUE         0x3037
+#define EGL_TRANSPARENT_RGB               0x3052
+#define EGL_TRANSPARENT_TYPE              0x3034
+#define EGL_TRUE                          1
+#define EGL_VENDOR                        0x3053
+#define EGL_VERSION                       0x3054
+#define EGL_WIDTH                         0x3057
+#define EGL_WINDOW_BIT                    0x0004
+EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
+EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
+EGLAPI EGLContext EGLAPIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_context, 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 EGLSurface EGLAPIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
+EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay (void);
+EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface (EGLint readdraw);
+EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay (EGLNativeDisplayType display_id);
+EGLAPI EGLint EGLAPIENTRY eglGetError (void);
+EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress (const char *procname);
+EGLAPI EGLBoolean EGLAPIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor);
+EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
+EGLAPI const char *EGLAPIENTRY eglQueryString (EGLDisplay dpy, EGLint name);
+EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface surface);
+EGLAPI EGLBoolean EGLAPIENTRY eglTerminate (EGLDisplay dpy);
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL (void);
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative (EGLint engine);
+#endif /* EGL_VERSION_1_0 */
+
+#ifndef EGL_VERSION_1_1
+#define EGL_VERSION_1_1 1
+#define EGL_BACK_BUFFER                   0x3084
+#define EGL_BIND_TO_TEXTURE_RGB           0x3039
+#define EGL_BIND_TO_TEXTURE_RGBA          0x303A
+#define EGL_CONTEXT_LOST                  0x300E
+#define EGL_MIN_SWAP_INTERVAL             0x303B
+#define EGL_MAX_SWAP_INTERVAL             0x303C
+#define EGL_MIPMAP_TEXTURE                0x3082
+#define EGL_MIPMAP_LEVEL                  0x3083
+#define EGL_NO_TEXTURE                    0x305C
+#define EGL_TEXTURE_2D                    0x305F
+#define EGL_TEXTURE_FORMAT                0x3080
+#define EGL_TEXTURE_RGB                   0x305D
+#define EGL_TEXTURE_RGBA                  0x305E
+#define EGL_TEXTURE_TARGET                0x3081
+EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval (EGLDisplay dpy, EGLint interval);
+#endif /* EGL_VERSION_1_1 */
+
+#ifndef EGL_VERSION_1_2
+#define EGL_VERSION_1_2 1
+typedef unsigned int EGLenum;
+typedef void *EGLClientBuffer;
+#define EGL_ALPHA_FORMAT                  0x3088
+#define EGL_ALPHA_FORMAT_NONPRE           0x308B
+#define EGL_ALPHA_FORMAT_PRE              0x308C
+#define EGL_ALPHA_MASK_SIZE               0x303E
+#define EGL_BUFFER_PRESERVED              0x3094
+#define EGL_BUFFER_DESTROYED              0x3095
+#define EGL_CLIENT_APIS                   0x308D
+#define EGL_COLORSPACE                    0x3087
+#define EGL_COLORSPACE_sRGB               0x3089
+#define EGL_COLORSPACE_LINEAR             0x308A
+#define EGL_COLOR_BUFFER_TYPE             0x303F
+#define EGL_CONTEXT_CLIENT_TYPE           0x3097
+#define EGL_DISPLAY_SCALING               10000
+#define EGL_HORIZONTAL_RESOLUTION         0x3090
+#define EGL_LUMINANCE_BUFFER              0x308F
+#define EGL_LUMINANCE_SIZE                0x303D
+#define EGL_OPENGL_ES_BIT                 0x0001
+#define EGL_OPENVG_BIT                    0x0002
+#define EGL_OPENGL_ES_API                 0x30A0
+#define EGL_OPENVG_API                    0x30A1
+#define EGL_OPENVG_IMAGE                  0x3096
+#define EGL_PIXEL_ASPECT_RATIO            0x3092
+#define EGL_RENDERABLE_TYPE               0x3040
+#define EGL_RENDER_BUFFER                 0x3086
+#define EGL_RGB_BUFFER                    0x308E
+#define EGL_SINGLE_BUFFER                 0x3085
+#define EGL_SWAP_BEHAVIOR                 0x3093
+#define EGL_UNKNOWN                       ((EGLint)-1)
+#define EGL_VERTICAL_RESOLUTION           0x3091
+EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI (EGLenum api);
+EGLAPI EGLenum EGLAPIENTRY eglQueryAPI (void);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread (void);
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient (void);
+#endif /* EGL_VERSION_1_2 */
+
+#ifndef EGL_VERSION_1_3
+#define EGL_VERSION_1_3 1
+#define EGL_CONFORMANT                    0x3042
+#define EGL_CONTEXT_CLIENT_VERSION        0x3098
+#define EGL_MATCH_NATIVE_PIXMAP           0x3041
+#define EGL_OPENGL_ES2_BIT                0x0004
+#define EGL_VG_ALPHA_FORMAT               0x3088
+#define EGL_VG_ALPHA_FORMAT_NONPRE        0x308B
+#define EGL_VG_ALPHA_FORMAT_PRE           0x308C
+#define EGL_VG_ALPHA_FORMAT_PRE_BIT       0x0040
+#define EGL_VG_COLORSPACE                 0x3087
+#define EGL_VG_COLORSPACE_sRGB            0x3089
+#define EGL_VG_COLORSPACE_LINEAR          0x308A
+#define EGL_VG_COLORSPACE_LINEAR_BIT      0x0020
+#endif /* EGL_VERSION_1_3 */
+
+#ifndef EGL_VERSION_1_4
+#define EGL_VERSION_1_4 1
+#define EGL_DEFAULT_DISPLAY               ((EGLNativeDisplayType)0)
+#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT   0x0200
+#define EGL_MULTISAMPLE_RESOLVE           0x3099
+#define EGL_MULTISAMPLE_RESOLVE_DEFAULT   0x309A
+#define EGL_MULTISAMPLE_RESOLVE_BOX       0x309B
+#define EGL_OPENGL_API                    0x30A2
+#define EGL_OPENGL_BIT                    0x0008
+#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT   0x0400
+EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext (void);
+#endif /* EGL_VERSION_1_4 */
+
+#ifndef EGL_VERSION_1_5
+#define EGL_VERSION_1_5 1
+typedef void *EGLSync;
+typedef intptr_t EGLAttrib;
+typedef khronos_utime_nanoseconds_t EGLTime;
+typedef void *EGLImage;
+#define EGL_CONTEXT_MAJOR_VERSION         0x3098
+#define EGL_CONTEXT_MINOR_VERSION         0x30FB
+#define EGL_CONTEXT_OPENGL_PROFILE_MASK   0x30FD
+#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY 0x31BD
+#define EGL_NO_RESET_NOTIFICATION         0x31BE
+#define EGL_LOSE_CONTEXT_ON_RESET         0x31BF
+#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT 0x00000001
+#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT 0x00000002
+#define EGL_CONTEXT_OPENGL_DEBUG          0x31B0
+#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE 0x31B1
+#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS  0x31B2
+#define EGL_OPENGL_ES3_BIT                0x00000040
+#define EGL_CL_EVENT_HANDLE               0x309C
+#define EGL_SYNC_CL_EVENT                 0x30FE
+#define EGL_SYNC_CL_EVENT_COMPLETE        0x30FF
+#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE  0x30F0
+#define EGL_SYNC_TYPE                     0x30F7
+#define EGL_SYNC_STATUS                   0x30F1
+#define EGL_SYNC_CONDITION                0x30F8
+#define EGL_SIGNALED                      0x30F2
+#define EGL_UNSIGNALED                    0x30F3
+#define EGL_SYNC_FLUSH_COMMANDS_BIT       0x0001
+#define EGL_FOREVER                       0xFFFFFFFFFFFFFFFFull
+#define EGL_TIMEOUT_EXPIRED               0x30F5
+#define EGL_CONDITION_SATISFIED           0x30F6
+#define EGL_NO_SYNC                       ((EGLSync)0)
+#define EGL_SYNC_FENCE                    0x30F9
+#define EGL_GL_COLORSPACE                 0x309D
+#define EGL_GL_COLORSPACE_SRGB            0x3089
+#define EGL_GL_COLORSPACE_LINEAR          0x308A
+#define EGL_GL_RENDERBUFFER               0x30B9
+#define EGL_GL_TEXTURE_2D                 0x30B1
+#define EGL_GL_TEXTURE_LEVEL              0x30BC
+#define EGL_GL_TEXTURE_3D                 0x30B2
+#define EGL_GL_TEXTURE_ZOFFSET            0x30BD
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x30B3
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x30B4
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x30B5
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x30B6
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8
+#define EGL_IMAGE_PRESERVED               0x30D2
+#define EGL_NO_IMAGE                      ((EGLImage)0)
+EGLAPI EGLSync EGLAPIENTRY eglCreateSync (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySync (EGLDisplay dpy, EGLSync sync);
+EGLAPI EGLint EGLAPIENTRY eglClientWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttrib (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value);
+EGLAPI EGLImage EGLAPIENTRY eglCreateImage (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImage (EGLDisplay dpy, EGLImage image);
+EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplay (EGLenum platform, void *native_display, const EGLAttrib *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags);
+#endif /* EGL_VERSION_1_5 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include_KHR/EGL/eglext.h b/include_KHR/EGL/eglext.h
new file mode 100644 (file)
index 0000000..07ddcbf
--- /dev/null
@@ -0,0 +1,852 @@
+#ifndef __eglext_h_
+#define __eglext_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2013-2014 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.
+*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+**   http://www.opengl.org/registry/
+**
+** Khronos $Revision: 27930 $ on $Date: 2014-09-03 21:17:58 -0700 (Wed, 03 Sep 2014) $
+*/
+
+#include <EGL/eglplatform.h>
+
+#define EGL_EGLEXT_VERSION 20140903
+
+/* Generated C header for:
+ * API: egl
+ * Versions considered: .*
+ * Versions emitted: _nomatch_^
+ * Default extensions included: egl
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef EGL_KHR_cl_event
+#define EGL_KHR_cl_event 1
+#define EGL_CL_EVENT_HANDLE_KHR           0x309C
+#define EGL_SYNC_CL_EVENT_KHR             0x30FE
+#define EGL_SYNC_CL_EVENT_COMPLETE_KHR    0x30FF
+#endif /* EGL_KHR_cl_event */
+
+#ifndef EGL_KHR_cl_event2
+#define EGL_KHR_cl_event2 1
+typedef void *EGLSyncKHR;
+typedef intptr_t EGLAttribKHR;
+typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNC64KHRPROC) (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list);
+#endif
+#endif /* EGL_KHR_cl_event2 */
+
+#ifndef EGL_KHR_client_get_all_proc_addresses
+#define EGL_KHR_client_get_all_proc_addresses 1
+#endif /* EGL_KHR_client_get_all_proc_addresses */
+
+#ifndef EGL_KHR_config_attribs
+#define EGL_KHR_config_attribs 1
+#define EGL_CONFORMANT_KHR                0x3042
+#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR  0x0020
+#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR   0x0040
+#endif /* EGL_KHR_config_attribs */
+
+#ifndef EGL_KHR_create_context
+#define EGL_KHR_create_context 1
+#define EGL_CONTEXT_MAJOR_VERSION_KHR     0x3098
+#define EGL_CONTEXT_MINOR_VERSION_KHR     0x30FB
+#define EGL_CONTEXT_FLAGS_KHR             0x30FC
+#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD
+#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD
+#define EGL_NO_RESET_NOTIFICATION_KHR     0x31BE
+#define EGL_LOSE_CONTEXT_ON_RESET_KHR     0x31BF
+#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR  0x00000001
+#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
+#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
+#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
+#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
+#define EGL_OPENGL_ES3_BIT_KHR            0x00000040
+#endif /* EGL_KHR_create_context */
+
+#ifndef EGL_KHR_fence_sync
+#define EGL_KHR_fence_sync 1
+#ifdef KHRONOS_SUPPORT_INT64
+#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
+#define EGL_SYNC_CONDITION_KHR            0x30F8
+#define EGL_SYNC_FENCE_KHR                0x30F9
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_KHR_fence_sync */
+
+#ifndef EGL_KHR_get_all_proc_addresses
+#define EGL_KHR_get_all_proc_addresses 1
+#endif /* EGL_KHR_get_all_proc_addresses */
+
+#ifndef EGL_KHR_gl_colorspace
+#define EGL_KHR_gl_colorspace 1
+#define EGL_GL_COLORSPACE_KHR             0x309D
+#define EGL_GL_COLORSPACE_SRGB_KHR        0x3089
+#define EGL_GL_COLORSPACE_LINEAR_KHR      0x308A
+#endif /* EGL_KHR_gl_colorspace */
+
+#ifndef EGL_KHR_gl_renderbuffer_image
+#define EGL_KHR_gl_renderbuffer_image 1
+#define EGL_GL_RENDERBUFFER_KHR           0x30B9
+#endif /* EGL_KHR_gl_renderbuffer_image */
+
+#ifndef EGL_KHR_gl_texture_2D_image
+#define EGL_KHR_gl_texture_2D_image 1
+#define EGL_GL_TEXTURE_2D_KHR             0x30B1
+#define EGL_GL_TEXTURE_LEVEL_KHR          0x30BC
+#endif /* EGL_KHR_gl_texture_2D_image */
+
+#ifndef EGL_KHR_gl_texture_3D_image
+#define EGL_KHR_gl_texture_3D_image 1
+#define EGL_GL_TEXTURE_3D_KHR             0x30B2
+#define EGL_GL_TEXTURE_ZOFFSET_KHR        0x30BD
+#endif /* EGL_KHR_gl_texture_3D_image */
+
+#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
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8
+#endif /* EGL_KHR_gl_texture_cubemap_image */
+
+#ifndef EGL_KHR_image
+#define EGL_KHR_image 1
+typedef void *EGLImageKHR;
+#define EGL_NATIVE_PIXMAP_KHR             0x30B0
+#define EGL_NO_IMAGE_KHR                  ((EGLImageKHR)0)
+typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
+#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
+#endif /* EGL_KHR_image */
+
+#ifndef EGL_KHR_image_base
+#define EGL_KHR_image_base 1
+#define EGL_IMAGE_PRESERVED_KHR           0x30D2
+#endif /* EGL_KHR_image_base */
+
+#ifndef EGL_KHR_image_pixmap
+#define EGL_KHR_image_pixmap 1
+#endif /* EGL_KHR_image_pixmap */
+
+#ifndef EGL_KHR_lock_surface
+#define EGL_KHR_lock_surface 1
+#define EGL_READ_SURFACE_BIT_KHR          0x0001
+#define EGL_WRITE_SURFACE_BIT_KHR         0x0002
+#define EGL_LOCK_SURFACE_BIT_KHR          0x0080
+#define EGL_OPTIMAL_FORMAT_BIT_KHR        0x0100
+#define EGL_MATCH_FORMAT_KHR              0x3043
+#define EGL_FORMAT_RGB_565_EXACT_KHR      0x30C0
+#define EGL_FORMAT_RGB_565_KHR            0x30C1
+#define EGL_FORMAT_RGBA_8888_EXACT_KHR    0x30C2
+#define EGL_FORMAT_RGBA_8888_KHR          0x30C3
+#define EGL_MAP_PRESERVE_PIXELS_KHR       0x30C4
+#define EGL_LOCK_USAGE_HINT_KHR           0x30C5
+#define EGL_BITMAP_POINTER_KHR            0x30C6
+#define EGL_BITMAP_PITCH_KHR              0x30C7
+#define EGL_BITMAP_ORIGIN_KHR             0x30C8
+#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR   0x30C9
+#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA
+#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR  0x30CB
+#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC
+#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD
+#define EGL_LOWER_LEFT_KHR                0x30CE
+#define EGL_UPPER_LEFT_KHR                0x30CF
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay dpy, EGLSurface surface);
+#endif
+#endif /* EGL_KHR_lock_surface */
+
+#ifndef EGL_KHR_lock_surface2
+#define EGL_KHR_lock_surface2 1
+#define EGL_BITMAP_PIXEL_SIZE_KHR         0x3110
+#endif /* EGL_KHR_lock_surface2 */
+
+#ifndef EGL_KHR_lock_surface3
+#define EGL_KHR_lock_surface3 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACE64KHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface64KHR (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value);
+#endif
+#endif /* EGL_KHR_lock_surface3 */
+
+#ifndef EGL_KHR_platform_android
+#define EGL_KHR_platform_android 1
+#define EGL_PLATFORM_ANDROID_KHR          0x3141
+#endif /* EGL_KHR_platform_android */
+
+#ifndef EGL_KHR_platform_gbm
+#define EGL_KHR_platform_gbm 1
+#define EGL_PLATFORM_GBM_KHR              0x31D7
+#endif /* EGL_KHR_platform_gbm */
+
+#ifndef EGL_KHR_platform_wayland
+#define EGL_KHR_platform_wayland 1
+#define EGL_PLATFORM_WAYLAND_KHR          0x31D8
+#endif /* EGL_KHR_platform_wayland */
+
+#ifndef EGL_KHR_platform_x11
+#define EGL_KHR_platform_x11 1
+#define EGL_PLATFORM_X11_KHR              0x31D5
+#define EGL_PLATFORM_X11_SCREEN_KHR       0x31D6
+#endif /* EGL_KHR_platform_x11 */
+
+#ifndef EGL_KHR_reusable_sync
+#define EGL_KHR_reusable_sync 1
+typedef khronos_utime_nanoseconds_t EGLTimeKHR;
+#ifdef KHRONOS_SUPPORT_INT64
+#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
+#define EGL_FOREVER_KHR                   0xFFFFFFFFFFFFFFFFull
+#define EGL_NO_SYNC_KHR                   ((EGLSyncKHR)0)
+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);
+#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
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_KHR_reusable_sync */
+
+#ifndef EGL_KHR_stream
+#define EGL_KHR_stream 1
+typedef void *EGLStreamKHR;
+typedef khronos_uint64_t EGLuint64KHR;
+#ifdef KHRONOS_SUPPORT_INT64
+#define EGL_NO_STREAM_KHR                 ((EGLStreamKHR)0)
+#define EGL_CONSUMER_LATENCY_USEC_KHR     0x3210
+#define EGL_PRODUCER_FRAME_KHR            0x3212
+#define EGL_CONSUMER_FRAME_KHR            0x3213
+#define EGL_STREAM_STATE_KHR              0x3214
+#define EGL_STREAM_STATE_CREATED_KHR      0x3215
+#define EGL_STREAM_STATE_CONNECTING_KHR   0x3216
+#define EGL_STREAM_STATE_EMPTY_KHR        0x3217
+#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218
+#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219
+#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A
+#define EGL_BAD_STREAM_KHR                0x321B
+#define EGL_BAD_STATE_KHR                 0x321C
+typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR (EGLDisplay dpy, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR (EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
+#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_KHR_stream */
+
+#ifndef EGL_KHR_stream_consumer_gltexture
+#define EGL_KHR_stream_consumer_gltexture 1
+#ifdef EGL_KHR_stream
+#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR (EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR (EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR (EGLDisplay dpy, EGLStreamKHR stream);
+#endif
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_consumer_gltexture */
+
+#ifndef EGL_KHR_stream_cross_process_fd
+#define EGL_KHR_stream_cross_process_fd 1
+typedef int EGLNativeFileDescriptorKHR;
+#ifdef EGL_KHR_stream
+#define EGL_NO_FILE_DESCRIPTOR_KHR        ((EGLNativeFileDescriptorKHR)(-1))
+typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR (EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
+#endif
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_cross_process_fd */
+
+#ifndef EGL_KHR_stream_fifo
+#define EGL_KHR_stream_fifo 1
+#ifdef EGL_KHR_stream
+#define EGL_STREAM_FIFO_LENGTH_KHR        0x31FC
+#define EGL_STREAM_TIME_NOW_KHR           0x31FD
+#define EGL_STREAM_TIME_CONSUMER_KHR      0x31FE
+#define EGL_STREAM_TIME_PRODUCER_KHR      0x31FF
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
+#endif
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_fifo */
+
+#ifndef EGL_KHR_stream_producer_aldatalocator
+#define EGL_KHR_stream_producer_aldatalocator 1
+#ifdef EGL_KHR_stream
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_producer_aldatalocator */
+
+#ifndef EGL_KHR_stream_producer_eglsurface
+#define EGL_KHR_stream_producer_eglsurface 1
+#ifdef EGL_KHR_stream
+#define EGL_STREAM_BIT_KHR                0x0800
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
+#endif
+#endif /* EGL_KHR_stream */
+#endif /* EGL_KHR_stream_producer_eglsurface */
+
+#ifndef EGL_KHR_surfaceless_context
+#define EGL_KHR_surfaceless_context 1
+#endif /* EGL_KHR_surfaceless_context */
+
+#ifndef EGL_KHR_vg_parent_image
+#define EGL_KHR_vg_parent_image 1
+#define EGL_VG_PARENT_IMAGE_KHR           0x30BA
+#endif /* EGL_KHR_vg_parent_image */
+
+#ifndef EGL_KHR_wait_sync
+#define EGL_KHR_wait_sync 1
+typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
+#endif
+#endif /* EGL_KHR_wait_sync */
+
+#ifndef EGL_ANDROID_blob_cache
+#define EGL_ANDROID_blob_cache 1
+typedef khronos_ssize_t EGLsizeiANDROID;
+typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize);
+typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize);
+typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
+#endif
+#endif /* EGL_ANDROID_blob_cache */
+
+#ifndef EGL_ANDROID_framebuffer_target
+#define EGL_ANDROID_framebuffer_target 1
+#define EGL_FRAMEBUFFER_TARGET_ANDROID    0x3147
+#endif /* EGL_ANDROID_framebuffer_target */
+
+#ifndef EGL_ANDROID_image_native_buffer
+#define EGL_ANDROID_image_native_buffer 1
+#define EGL_NATIVE_BUFFER_ANDROID         0x3140
+#endif /* EGL_ANDROID_image_native_buffer */
+
+#ifndef EGL_ANDROID_native_fence_sync
+#define EGL_ANDROID_native_fence_sync 1
+#define EGL_SYNC_NATIVE_FENCE_ANDROID     0x3144
+#define EGL_SYNC_NATIVE_FENCE_FD_ANDROID  0x3145
+#define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146
+#define EGL_NO_NATIVE_FENCE_FD_ANDROID    -1
+typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy, EGLSyncKHR sync);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID (EGLDisplay dpy, EGLSyncKHR sync);
+#endif
+#endif /* EGL_ANDROID_native_fence_sync */
+
+#ifndef EGL_ANDROID_recordable
+#define EGL_ANDROID_recordable 1
+#define EGL_RECORDABLE_ANDROID            0x3142
+#endif /* EGL_ANDROID_recordable */
+
+#ifndef EGL_ANGLE_d3d_share_handle_client_buffer
+#define EGL_ANGLE_d3d_share_handle_client_buffer 1
+#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200
+#endif /* EGL_ANGLE_d3d_share_handle_client_buffer */
+
+#ifndef EGL_ANGLE_query_surface_pointer
+#define EGL_ANGLE_query_surface_pointer 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
+#endif
+#endif /* EGL_ANGLE_query_surface_pointer */
+
+#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle
+#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1
+#endif /* EGL_ANGLE_surface_d3d_texture_2d_share_handle */
+
+#ifndef EGL_ARM_pixmap_multisample_discard
+#define EGL_ARM_pixmap_multisample_discard 1
+#define EGL_DISCARD_SAMPLES_ARM           0x3286
+#endif /* EGL_ARM_pixmap_multisample_discard */
+
+#ifndef EGL_EXT_buffer_age
+#define EGL_EXT_buffer_age 1
+#define EGL_BUFFER_AGE_EXT                0x313D
+#endif /* EGL_EXT_buffer_age */
+
+#ifndef EGL_EXT_client_extensions
+#define EGL_EXT_client_extensions 1
+#endif /* EGL_EXT_client_extensions */
+
+#ifndef EGL_EXT_create_context_robustness
+#define EGL_EXT_create_context_robustness 1
+#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF
+#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138
+#define EGL_NO_RESET_NOTIFICATION_EXT     0x31BE
+#define EGL_LOSE_CONTEXT_ON_RESET_EXT     0x31BF
+#endif /* EGL_EXT_create_context_robustness */
+
+#ifndef EGL_EXT_device_base
+#define EGL_EXT_device_base 1
+typedef void *EGLDeviceEXT;
+#define EGL_NO_DEVICE_EXT                 ((EGLDeviceEXT)(0))
+#define EGL_BAD_DEVICE_EXT                0x322B
+#define EGL_DEVICE_EXT                    0x322C
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICEATTRIBEXTPROC) (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value);
+typedef const char *(EGLAPIENTRYP PFNEGLQUERYDEVICESTRINGEXTPROC) (EGLDeviceEXT device, EGLint name);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBEXTPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDeviceAttribEXT (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value);
+EGLAPI const char *EGLAPIENTRY eglQueryDeviceStringEXT (EGLDeviceEXT device, EGLint name);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDevicesEXT (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
+#endif
+#endif /* EGL_EXT_device_base */
+
+#ifndef EGL_EXT_device_drm
+#define EGL_EXT_device_drm 1
+#define EGL_DRM_DEVICE_FILE_EXT           0x3233
+#endif /* EGL_EXT_device_drm */
+
+#ifndef EGL_EXT_device_openwf
+#define EGL_EXT_device_openwf 1
+#define EGL_OPENWF_DEVICE_ID_EXT          0x3237
+#endif /* EGL_EXT_device_openwf */
+
+#ifndef EGL_EXT_image_dma_buf_import
+#define EGL_EXT_image_dma_buf_import 1
+#define EGL_LINUX_DMA_BUF_EXT             0x3270
+#define EGL_LINUX_DRM_FOURCC_EXT          0x3271
+#define EGL_DMA_BUF_PLANE0_FD_EXT         0x3272
+#define EGL_DMA_BUF_PLANE0_OFFSET_EXT     0x3273
+#define EGL_DMA_BUF_PLANE0_PITCH_EXT      0x3274
+#define EGL_DMA_BUF_PLANE1_FD_EXT         0x3275
+#define EGL_DMA_BUF_PLANE1_OFFSET_EXT     0x3276
+#define EGL_DMA_BUF_PLANE1_PITCH_EXT      0x3277
+#define EGL_DMA_BUF_PLANE2_FD_EXT         0x3278
+#define EGL_DMA_BUF_PLANE2_OFFSET_EXT     0x3279
+#define EGL_DMA_BUF_PLANE2_PITCH_EXT      0x327A
+#define EGL_YUV_COLOR_SPACE_HINT_EXT      0x327B
+#define EGL_SAMPLE_RANGE_HINT_EXT         0x327C
+#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D
+#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E
+#define EGL_ITU_REC601_EXT                0x327F
+#define EGL_ITU_REC709_EXT                0x3280
+#define EGL_ITU_REC2020_EXT               0x3281
+#define EGL_YUV_FULL_RANGE_EXT            0x3282
+#define EGL_YUV_NARROW_RANGE_EXT          0x3283
+#define EGL_YUV_CHROMA_SITING_0_EXT       0x3284
+#define EGL_YUV_CHROMA_SITING_0_5_EXT     0x3285
+#endif /* EGL_EXT_image_dma_buf_import */
+
+#ifndef EGL_EXT_multiview_window
+#define EGL_EXT_multiview_window 1
+#define EGL_MULTIVIEW_VIEW_COUNT_EXT      0x3134
+#endif /* EGL_EXT_multiview_window */
+
+#ifndef EGL_EXT_output_base
+#define EGL_EXT_output_base 1
+typedef void *EGLOutputLayerEXT;
+typedef void *EGLOutputPortEXT;
+#define EGL_NO_OUTPUT_LAYER_EXT           ((EGLOutputLayerEXT)0)
+#define EGL_NO_OUTPUT_PORT_EXT            ((EGLOutputPortEXT)0)
+#define EGL_BAD_OUTPUT_LAYER_EXT          0x322D
+#define EGL_BAD_OUTPUT_PORT_EXT           0x322E
+#define EGL_SWAP_INTERVAL_EXT             0x322F
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTLAYERSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTPORTSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value);
+typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value);
+typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputLayersEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputPortsEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports);
+EGLAPI EGLBoolean EGLAPIENTRY eglOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value);
+EGLAPI const char *EGLAPIENTRY eglQueryOutputLayerStringEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name);
+EGLAPI EGLBoolean EGLAPIENTRY eglOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value);
+EGLAPI const char *EGLAPIENTRY eglQueryOutputPortStringEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name);
+#endif
+#endif /* EGL_EXT_output_base */
+
+#ifndef EGL_EXT_output_drm
+#define EGL_EXT_output_drm 1
+#define EGL_DRM_CRTC_EXT                  0x3234
+#define EGL_DRM_PLANE_EXT                 0x3235
+#define EGL_DRM_CONNECTOR_EXT             0x3236
+#endif /* EGL_EXT_output_drm */
+
+#ifndef EGL_EXT_output_openwf
+#define EGL_EXT_output_openwf 1
+#define EGL_OPENWF_PIPELINE_ID_EXT        0x3238
+#define EGL_OPENWF_PORT_ID_EXT            0x3239
+#endif /* EGL_EXT_output_openwf */
+
+#ifndef EGL_EXT_platform_base
+#define EGL_EXT_platform_base 1
+typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list);
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT (EGLenum platform, void *native_display, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
+#endif
+#endif /* EGL_EXT_platform_base */
+
+#ifndef EGL_EXT_platform_device
+#define EGL_EXT_platform_device 1
+#define EGL_PLATFORM_DEVICE_EXT           0x313F
+#endif /* EGL_EXT_platform_device */
+
+#ifndef EGL_EXT_platform_wayland
+#define EGL_EXT_platform_wayland 1
+#define EGL_PLATFORM_WAYLAND_EXT          0x31D8
+#endif /* EGL_EXT_platform_wayland */
+
+#ifndef EGL_EXT_platform_x11
+#define EGL_EXT_platform_x11 1
+#define EGL_PLATFORM_X11_EXT              0x31D5
+#define EGL_PLATFORM_X11_SCREEN_EXT       0x31D6
+#endif /* EGL_EXT_platform_x11 */
+
+#ifndef EGL_EXT_protected_surface
+#define EGL_EXT_protected_surface 1
+#define EGL_PROTECTED_CONTENT_EXT         0x32C0
+#endif /* EGL_EXT_protected_surface */
+
+#ifndef EGL_EXT_stream_consumer_egloutput
+#define EGL_EXT_stream_consumer_egloutput 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerOutputEXT (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer);
+#endif
+#endif /* EGL_EXT_stream_consumer_egloutput */
+
+#ifndef EGL_EXT_swap_buffers_with_damage
+#define EGL_EXT_swap_buffers_with_damage 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
+#endif
+#endif /* EGL_EXT_swap_buffers_with_damage */
+
+#ifndef EGL_HI_clientpixmap
+#define EGL_HI_clientpixmap 1
+struct EGLClientPixmapHI {
+    void  *pData;
+    EGLint iWidth;
+    EGLint iHeight;
+    EGLint iStride;
+};
+#define EGL_CLIENT_PIXMAP_POINTER_HI      0x8F74
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap);
+#endif
+#endif /* EGL_HI_clientpixmap */
+
+#ifndef EGL_HI_colorformats
+#define EGL_HI_colorformats 1
+#define EGL_COLOR_FORMAT_HI               0x8F70
+#define EGL_COLOR_RGB_HI                  0x8F71
+#define EGL_COLOR_RGBA_HI                 0x8F72
+#define EGL_COLOR_ARGB_HI                 0x8F73
+#endif /* EGL_HI_colorformats */
+
+#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 /* EGL_IMG_context_priority */
+
+#ifndef EGL_MESA_drm_image
+#define EGL_MESA_drm_image 1
+#define EGL_DRM_BUFFER_FORMAT_MESA        0x31D0
+#define EGL_DRM_BUFFER_USE_MESA           0x31D1
+#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2
+#define EGL_DRM_BUFFER_MESA               0x31D3
+#define EGL_DRM_BUFFER_STRIDE_MESA        0x31D4
+#define EGL_DRM_BUFFER_USE_SCANOUT_MESA   0x00000001
+#define EGL_DRM_BUFFER_USE_SHARE_MESA     0x00000002
+typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
+#endif
+#endif /* EGL_MESA_drm_image */
+
+#ifndef EGL_MESA_platform_gbm
+#define EGL_MESA_platform_gbm 1
+#define EGL_PLATFORM_GBM_MESA             0x31D7
+#endif /* EGL_MESA_platform_gbm */
+
+#ifndef EGL_NOK_swap_region
+#define EGL_NOK_swap_region 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegionNOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
+#endif
+#endif /* EGL_NOK_swap_region */
+
+#ifndef EGL_NOK_swap_region2
+#define EGL_NOK_swap_region2 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGION2NOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegion2NOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
+#endif
+#endif /* EGL_NOK_swap_region2 */
+
+#ifndef EGL_NOK_texture_from_pixmap
+#define EGL_NOK_texture_from_pixmap 1
+#define EGL_Y_INVERTED_NOK                0x307F
+#endif /* EGL_NOK_texture_from_pixmap */
+
+#ifndef EGL_NV_3dvision_surface
+#define EGL_NV_3dvision_surface 1
+#define EGL_AUTO_STEREO_NV                0x3136
+#endif /* EGL_NV_3dvision_surface */
+
+#ifndef EGL_NV_coverage_sample
+#define EGL_NV_coverage_sample 1
+#define EGL_COVERAGE_BUFFERS_NV           0x30E0
+#define EGL_COVERAGE_SAMPLES_NV           0x30E1
+#endif /* EGL_NV_coverage_sample */
+
+#ifndef EGL_NV_coverage_sample_resolve
+#define EGL_NV_coverage_sample_resolve 1
+#define EGL_COVERAGE_SAMPLE_RESOLVE_NV    0x3131
+#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132
+#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133
+#endif /* EGL_NV_coverage_sample_resolve */
+
+#ifndef EGL_NV_cuda_event
+#define EGL_NV_cuda_event 1
+#define EGL_CUDA_EVENT_HANDLE_NV          0x323B
+#define EGL_SYNC_CUDA_EVENT_NV            0x323C
+#define EGL_SYNC_CUDA_EVENT_COMPLETE_NV   0x323D
+#endif /* EGL_NV_cuda_event */
+
+#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 /* EGL_NV_depth_nonlinear */
+
+#ifndef EGL_NV_device_cuda
+#define EGL_NV_device_cuda 1
+#define EGL_CUDA_DEVICE_NV                0x323A
+#endif /* EGL_NV_device_cuda */
+
+#ifndef EGL_NV_native_query
+#define EGL_NV_native_query 1
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC) (EGLDisplay dpy, EGLNativeDisplayType *display_id);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeDisplayNV (EGLDisplay dpy, EGLNativeDisplayType *display_id);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeWindowNV (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativePixmapNV (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
+#endif
+#endif /* EGL_NV_native_query */
+
+#ifndef EGL_NV_post_convert_rounding
+#define EGL_NV_post_convert_rounding 1
+#endif /* EGL_NV_post_convert_rounding */
+
+#ifndef EGL_NV_post_sub_buffer
+#define EGL_NV_post_sub_buffer 1
+#define EGL_POST_SUB_BUFFER_SUPPORTED_NV  0x30BE
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
+#endif
+#endif /* EGL_NV_post_sub_buffer */
+
+#ifndef EGL_NV_stream_sync
+#define EGL_NV_stream_sync 1
+#define EGL_SYNC_NEW_FRAME_NV             0x321F
+typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESTREAMSYNCNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateStreamSyncNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list);
+#endif
+#endif /* EGL_NV_stream_sync */
+
+#ifndef EGL_NV_sync
+#define EGL_NV_sync 1
+typedef void *EGLSyncNV;
+typedef khronos_utime_nanoseconds_t EGLTimeNV;
+#ifdef KHRONOS_SUPPORT_INT64
+#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 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);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync);
+EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync);
+EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
+EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
+#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_NV_sync */
+
+#ifndef EGL_NV_system_time
+#define EGL_NV_system_time 1
+typedef khronos_utime_nanoseconds_t EGLuint64NV;
+#ifdef KHRONOS_SUPPORT_INT64
+typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void);
+typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV (void);
+EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void);
+#endif
+#endif /* KHRONOS_SUPPORT_INT64 */
+#endif /* EGL_NV_system_time */
+
+#ifndef EGL_TIZEN_image_native_buffer
+#define EGL_TIZEN_image_native_buffer 1
+#define EGL_NATIVE_BUFFER_TIZEN           0x32A0
+#endif /* EGL_TIZEN_image_native_buffer */
+
+#ifndef EGL_TIZEN_image_native_surface
+#define EGL_TIZEN_image_native_surface 1
+#define EGL_NATIVE_SURFACE_TIZEN          0x32A1
+#endif /* EGL_TIZEN_image_native_surface */
+
+/******************************************************************************/
+/* 20140709-sw815.ha: SEC proprietary specs                                   */
+#ifndef EGL_SEC_client_pixmap
+#define EGL_SEC_client_pixmap 1
+#define EGL_CLINET_MEM_PIXMAP_SEC              0x3200 /* eglCreateClientPixmapFromClientBufferSEC buftype */
+#define EGL_CLIENT_PIXMAP_SEC                  0x3210 /* eglCreateImageKHR target */
+#define EGL_CLIENT_PIXMAP_HEIGHT_SEC           0x3211 /* eglCreateImageKHR attribute */
+#define EGL_CLIENT_PIXMAP_WIDTH_SEC            0x3212 /* eglCreateImageKHR attribute */
+
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSurface eglCreateClientPixmapFromClientBufferSEC (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATECLIENTPIXMAPFROMCLIENTBUFFERSECPROC) (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
+#endif
+
+#ifndef EGL_SEC_image_map
+#define EGL_SEC_image_map 1
+#define EGL_MAP_GL_TEXTURE_2D_SEC              0x3201  /* eglCreateImageKHR target */
+#define EGL_MAP_GL_TEXTURE_HEIGHT_SEC          0x3202  /* eglCreateImageKHR attribute */
+#define EGL_MAP_GL_TEXTURE_WIDTH_SEC           0x3203  /* eglCreateImageKHR attribute */
+#define EGL_MAP_GL_TEXTURE_FORMAT_SEC          0x3204  /* eglCreateImageKHR attribute, Specifies the number of color components in the mapped texture. */
+#define EGL_MAP_GL_TEXTURE_RGB_SEC             0x3205  /* More config attribute value, for EGL_MAP_GL_TEXTURE_FORMAT_SEC */
+#define EGL_MAP_GL_TEXTURE_RGBA_SEC            0x3206  /* More config attribute value, for EGL_MAP_GL_TEXTURE_FORMAT_SEC */
+#define EGL_MAP_GL_TEXTURE_BGRA_SEC            0x3207  /* More config attribute value, for EGL_MAP_GL_TEXTURE_FORMAT_SEC */
+#define EGL_MAP_GL_TEXTURE_LUMINANCE_SEC       0x3208  /* More config attribute value, for EGL_MAP_GL_TEXTURE_FORMAT_SEC */
+#define EGL_MAP_GL_TEXTURE_LUMINANCE_ALPHA_SEC         0x3209  /* More config attribute value, for EGL_MAP_GL_TEXTURE_FORMAT_SEC */
+#define EGL_MAP_GL_TEXTURE_PIXEL_TYPE_SEC      0x320a  /* eglCreateImageKHR attribute, Specifies the data type of the pixel data. */
+#define EGL_MAP_GL_TEXTURE_UNSIGNED_BYTE_SEC   0x320b  /* More config attribute value, for EGL_MAP_GL_TEXTURE_PIXEL_TYPE_SEC */
+#define EGL_MAP_GL_TEXTURE_STRIDE_IN_BYTES_SEC  0x320c /* GetImageAttribSEC target */
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI void * EGLAPIENTRY eglMapImageSEC (EGLDisplay dpy, EGLImageKHR image);
+EGLAPI EGLBoolean EGLAPIENTRY eglUnmapImageSEC (EGLDisplay dpy, EGLImageKHR image);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetImageAttribSEC (EGLDisplay dpy, EGLImageKHR image, EGLint attribute, EGLint *value);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+#endif /* EGL_SEC_image_map */
+
+#ifndef EGL_ANDROID_PIXMAP_image
+#define EGL_ANDROID_PIXMAP_image 1
+#define EGL_IMAGE_ANDROID_PIXMAP_IMAGE_KHR     0x3301 /* eglCreateImageKHR attribute */
+#endif /*EGL_ANDROID_PIXMAP_image */
+
+#ifndef EGL_EXT_native_surface_tizen
+#define EGL_EXT_native_surface_tizen 1
+#define EGL_NATIVE_SURFACE_TIZEN  0x32A1
+#endif
+
+/******************************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include_KHR/EGL/eglplatform.h b/include_KHR/EGL/eglplatform.h
new file mode 100644 (file)
index 0000000..eb69422
--- /dev/null
@@ -0,0 +1,135 @@
+#ifndef __eglplatform_h_
+#define __eglplatform_h_
+
+/*
+** Copyright (c) 2007-2013 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: 23432 $ on $Date: 2013-10-09 00:57:24 -0700 (Wed, 09 Oct 2013) $
+ *
+ * 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 <KHR/khrplatform.h>
+
+/* 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".
+ *
+ * Khronos STRONGLY RECOMMENDS that you use the default definitions
+ * provided below, since these changes affect both binary and source
+ * portability of applications using EGL running on different EGL
+ * implementations.
+ */
+
+#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 <windows.h>
+
+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(__ANDROID__) || defined(ANDROID)
+
+#include <android/native_window.h>
+
+struct egl_native_pixmap_t;
+
+typedef struct ANativeWindow*           EGLNativeWindowType;
+typedef struct egl_native_pixmap_t*     EGLNativePixmapType;
+typedef void*                           EGLNativeDisplayType;
+
+/* 20140708-sw815.ha: add additional macro checking to verify X11 window system */
+/* #elif defined(__unix__) */
+#elif defined(__unix__) && defined(SUPPORT_X11)
+
+/* X11 (tentative)  */
+//#include <X11/Xlib.h>
+//#include <X11/Xutil.h>
+
+//typedef Display *EGLNativeDisplayType;
+//typedef Pixmap   EGLNativePixmapType;
+//typedef Window   EGLNativeWindowType;
+typedef int   EGLNativeDisplayType;
+typedef void *EGLNativeWindowType;
+typedef void *EGLNativePixmapType;
+
+#else
+/* 20140708-sw815.ha: enable compilation even for unsupported platforms */
+/* #error "Platform not recognized" */
+typedef int   EGLNativeDisplayType;
+typedef void *EGLNativeWindowType;
+typedef void *EGLNativePixmapType;
+
+#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 --git a/include_KHR/GLES/egl.h b/include_KHR/GLES/egl.h
new file mode 100644 (file)
index 0000000..5778e00
--- /dev/null
@@ -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 <EGL/egl.h>
+#include <GLES/gl.h>
+
+#endif /* __legacy_egl_h_ */
diff --git a/include_KHR/GLES/gl.h b/include_KHR/GLES/gl.h
new file mode 100644 (file)
index 0000000..5b8d85a
--- /dev/null
@@ -0,0 +1,770 @@
+#ifndef __gl_h_
+#define __gl_h_
+
+/* $Revision: 10601 $ on $Date:: 2010-03-04 22:15:27 -0800 #$ */
+
+#include <GLES/glplatform.h>
+
+#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 --git a/include_KHR/GLES/glext.h b/include_KHR/GLES/glext.h
new file mode 100644 (file)
index 0000000..0373451
--- /dev/null
@@ -0,0 +1,1284 @@
+#ifndef __glext_h_
+#define __glext_h_
+
+/* $Revision: 20798 $ on $Date:: 2013-03-07 01:19:34 -0800 #$ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This document is licensed under the SGI Free Software B License Version
+ * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
+ */
+
+#ifndef GL_APIENTRYP
+#   define GL_APIENTRYP GL_APIENTRY*
+#endif
+
+/*------------------------------------------------------------------------*
+ * OES extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_OES_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_EGL_image_external */
+#ifndef GL_OES_EGL_image_external
+/* GLeglImageOES defined in GL_OES_EGL_image already. */
+#define GL_TEXTURE_EXTERNAL_OES                                 0x8D65
+#define GL_TEXTURE_BINDING_EXTERNAL_OES                         0x8D67
+#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES                     0x8D68
+#endif
+
+/* GL_OES_element_index_uint */
+#ifndef GL_OES_element_index_uint
+#define GL_UNSIGNED_INT                                         0x1405
+#endif
+
+/* GL_OES_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_required_internalformat */
+/* No new tokens introduced by this extension. */
+
+/* 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_copy_texture_levels */
+/* No new tokens introduced by this extension. */
+
+/* GL_APPLE_framebuffer_multisample */
+#ifndef GL_APPLE_framebuffer_multisample
+#define GL_RENDERBUFFER_SAMPLES_APPLE                           0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE             0x8D56
+#define GL_MAX_SAMPLES_APPLE                                    0x8D57
+#define GL_READ_FRAMEBUFFER_APPLE                               0x8CA8
+#define GL_DRAW_FRAMEBUFFER_APPLE                               0x8CA9
+#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE                       0x8CA6
+#define GL_READ_FRAMEBUFFER_BINDING_APPLE                       0x8CAA
+#endif
+
+/* GL_APPLE_sync */
+#ifndef GL_APPLE_sync
+
+/* These types are defined with reference to <inttypes.h>
+ * in the Apple extension spec, but here we use the Khronos
+ * portable types in khrplatform.h, and assume those types
+ * are always defined.
+ * If any other extensions using these types are defined,
+ * the typedefs must move out of this block and be shared.
+ */
+typedef khronos_int64_t GLint64;
+typedef khronos_uint64_t GLuint64;
+typedef struct __GLsync *GLsync;
+
+#define GL_SYNC_OBJECT_APPLE                                    0x8A53
+#define GL_MAX_SERVER_WAIT_TIMEOUT_APPLE                        0x9111
+#define GL_OBJECT_TYPE_APPLE                                    0x9112
+#define GL_SYNC_CONDITION_APPLE                                 0x9113
+#define GL_SYNC_STATUS_APPLE                                    0x9114
+#define GL_SYNC_FLAGS_APPLE                                     0x9115
+#define GL_SYNC_FENCE_APPLE                                     0x9116
+#define GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE                     0x9117
+#define GL_UNSIGNALED_APPLE                                     0x9118
+#define GL_SIGNALED_APPLE                                       0x9119
+#define GL_ALREADY_SIGNALED_APPLE                               0x911A
+#define GL_TIMEOUT_EXPIRED_APPLE                                0x911B
+#define GL_CONDITION_SATISFIED_APPLE                            0x911C
+#define GL_WAIT_FAILED_APPLE                                    0x911D
+#define GL_SYNC_FLUSH_COMMANDS_BIT_APPLE                        0x00000001
+#define GL_TIMEOUT_IGNORED_APPLE                                0xFFFFFFFFFFFFFFFFull
+#endif
+
+/* GL_APPLE_texture_2D_limited_npot */
+/* No new tokens introduced by this extension. */
+
+/* GL_APPLE_texture_format_BGRA8888 */
+#ifndef GL_APPLE_texture_format_BGRA8888
+#define GL_BGRA_EXT                                             0x80E1
+#endif
+
+/* GL_APPLE_texture_max_level */
+#ifndef GL_APPLE_texture_max_level
+#define GL_TEXTURE_MAX_LEVEL_APPLE                              0x813D
+#endif
+
+/*------------------------------------------------------------------------*
+ * ARM extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_ARM_rgba8 */
+/* No new tokens introduced by this extension. */
+
+/*------------------------------------------------------------------------*
+ * EXT extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_EXT_blend_minmax */
+#ifndef GL_EXT_blend_minmax
+#define GL_MIN_EXT                                              0x8007
+#define GL_MAX_EXT                                              0x8008
+#endif
+
+/* GL_EXT_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_map_buffer_range */
+#ifndef GL_EXT_map_buffer_range
+#define GL_MAP_READ_BIT_EXT                                     0x0001
+#define GL_MAP_WRITE_BIT_EXT                                    0x0002
+#define GL_MAP_INVALIDATE_RANGE_BIT_EXT                         0x0004
+#define GL_MAP_INVALIDATE_BUFFER_BIT_EXT                        0x0008
+#define GL_MAP_FLUSH_EXPLICIT_BIT_EXT                           0x0010
+#define GL_MAP_UNSYNCHRONIZED_BIT_EXT                           0x0020
+#endif
+
+/* GL_EXT_multisampled_render_to_texture */
+#ifndef GL_EXT_multisampled_render_to_texture
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT           0x8D6C
+/* reuse values from GL_EXT_framebuffer_multisample (desktop extension) */
+#define GL_RENDERBUFFER_SAMPLES_EXT                             0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT               0x8D56
+#define GL_MAX_SAMPLES_EXT                                      0x8D57
+#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_robustness */
+#ifndef GL_EXT_robustness
+/* reuse GL_NO_ERROR */
+#define GL_GUILTY_CONTEXT_RESET_EXT                             0x8253
+#define GL_INNOCENT_CONTEXT_RESET_EXT                           0x8254
+#define GL_UNKNOWN_CONTEXT_RESET_EXT                            0x8255
+#define GL_CONTEXT_ROBUST_ACCESS_EXT                            0x90F3
+#define GL_RESET_NOTIFICATION_STRATEGY_EXT                      0x8256
+#define GL_LOSE_CONTEXT_ON_RESET_EXT                            0x8252
+#define GL_NO_RESET_NOTIFICATION_EXT                            0x8261
+#endif
+
+/* GL_EXT_sRGB */
+#ifndef GL_EXT_sRGB
+#define GL_SRGB_EXT                                             0x8C40
+#define GL_SRGB_ALPHA_EXT                                       0x8C42
+#define GL_SRGB8_ALPHA8_EXT                                     0x8C43
+#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT            0x8210
+#endif
+
+/* GL_EXT_texture_compression_dxt1 */
+#ifndef GL_EXT_texture_compression_dxt1
+#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT                         0x83F0
+#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT                        0x83F1
+#endif
+
+/* GL_EXT_texture_filter_anisotropic */
+#ifndef GL_EXT_texture_filter_anisotropic
+#define GL_TEXTURE_MAX_ANISOTROPY_EXT                           0x84FE
+#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT                       0x84FF
+#endif
+
+/* GL_EXT_texture_format_BGRA8888 */
+#ifndef GL_EXT_texture_format_BGRA8888
+#define GL_BGRA_EXT                                             0x80E1
+#endif
+
+/* GL_EXT_texture_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
+
+/* GL_EXT_texture_storage */
+#ifndef GL_EXT_texture_storage
+#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT                         0x912F
+#define GL_ALPHA8_EXT                                           0x803C
+#define GL_LUMINANCE8_EXT                                       0x8040
+#define GL_LUMINANCE8_ALPHA8_EXT                                0x8045
+#define GL_RGBA32F_EXT                                          0x8814
+#define GL_RGB32F_EXT                                           0x8815
+#define GL_ALPHA32F_EXT                                         0x8816
+#define GL_LUMINANCE32F_EXT                                     0x8818
+#define GL_LUMINANCE_ALPHA32F_EXT                               0x8819
+/* reuse GL_RGBA16F_EXT */
+#define GL_RGB16F_EXT                                           0x881B
+#define GL_ALPHA16F_EXT                                         0x881C
+#define GL_LUMINANCE16F_EXT                                     0x881E
+#define GL_LUMINANCE_ALPHA16F_EXT                               0x881F
+#define GL_RGB10_A2_EXT                                         0x8059
+#define GL_RGB10_EXT                                            0x8052
+#define GL_BGRA8_EXT                                            0x93A1
+#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
+
+/* GL_IMG_multisampled_render_to_texture */
+#ifndef GL_IMG_multisampled_render_to_texture
+#define GL_RENDERBUFFER_SAMPLES_IMG                             0x9133
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG               0x9134
+#define GL_MAX_SAMPLES_IMG                                      0x9135
+#define GL_TEXTURE_SAMPLES_IMG                                  0x9136
+#endif
+
+/*------------------------------------------------------------------------*
+ * NV extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_NV_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_draw_texture */
+#ifndef GL_OES_draw_texture
+#define GL_OES_draw_texture 1
+#ifdef GL_GLEXT_PROTOTYPES
+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);
+GL_API void GL_APIENTRY glDrawTexfvOES (const GLfloat *coords);
+#endif
+typedef void (GL_APIENTRYP PFNGLDRAWTEXSOESPROC) (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXIOESPROC) (GLint x, GLint y, GLint z, GLint width, GLint height);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXXOESPROC) (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXSVOESPROC) (const GLshort *coords);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXIVOESPROC) (const GLint *coords);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXXVOESPROC) (const GLfixed *coords);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXFOESPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXFVOESPROC) (const GLfloat *coords);
+#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_EGL_image_external */
+#ifndef GL_OES_EGL_image_external
+#define GL_OES_EGL_image_external 1
+/* glEGLImageTargetTexture2DOES defined in GL_OES_EGL_image already. */
+#endif
+
+/* GL_OES_element_index_uint */
+#ifndef GL_OES_element_index_uint
+#define GL_OES_element_index_uint 1
+#endif
+
+/* GL_OES_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_matrix_palette */
+#ifndef GL_OES_matrix_palette
+#define GL_OES_matrix_palette 1
+#ifdef GL_GLEXT_PROTOTYPES
+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);
+#endif
+typedef void (GL_APIENTRYP PFNGLCURRENTPALETTEMATRIXOESPROC) (GLuint matrixpaletteindex);
+typedef void (GL_APIENTRYP PFNGLLOADPALETTEFROMMODELVIEWMATRIXOESPROC) (void);
+typedef void (GL_APIENTRYP PFNGLMATRIXINDEXPOINTEROESPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+typedef void (GL_APIENTRYP PFNGLWEIGHTPOINTEROESPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+#endif
+
+/* GL_OES_packed_depth_stencil */
+#ifndef GL_OES_packed_depth_stencil
+#define GL_OES_packed_depth_stencil 1
+#endif
+
+/* GL_OES_required_internalformat */
+#ifndef GL_OES_required_internalformat
+#define GL_OES_required_internalformat 1
+#endif
+
+/* GL_OES_query_matrix */
+#ifndef GL_OES_query_matrix
+#define GL_OES_query_matrix 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API GLbitfield GL_APIENTRY glQueryMatrixxOES (GLfixed mantissa[16], GLint exponent[16]);
+#endif
+typedef GLbitfield (GL_APIENTRYP PFNGLQUERYMATRIXXOESPROC) (GLfixed mantissa[16], GLint exponent[16]);
+#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_copy_texture_levels */
+#ifndef GL_APPLE_copy_texture_levels
+#define GL_APPLE_copy_texture_levels 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glCopyTextureLevelsAPPLE (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
+#endif
+typedef void (GL_APIENTRYP PFNGLCOPYTEXTURELEVELSAPPLEPROC) (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
+#endif
+
+/* GL_APPLE_framebuffer_multisample */
+#ifndef GL_APPLE_framebuffer_multisample
+#define GL_APPLE_framebuffer_multisample 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
+GL_API void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void);
+#endif
+
+/* GL_APPLE_sync */
+#ifndef GL_APPLE_sync
+#define GL_APPLE_sync 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API GLsync GL_APIENTRY glFenceSyncAPPLE (GLenum condition, GLbitfield flags);
+GL_API GLboolean GL_APIENTRY glIsSyncAPPLE (GLsync sync);
+GL_API void GL_APIENTRY glDeleteSyncAPPLE (GLsync sync);
+GL_API GLenum GL_APIENTRY glClientWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_API void GL_APIENTRY glWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_API void GL_APIENTRY glGetInteger64vAPPLE (GLenum pname, GLint64 *params);
+GL_API void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+#endif
+typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCAPPLEPROC) (GLenum condition, GLbitfield flags);
+typedef GLboolean (GL_APIENTRYP PFNGLISSYNCAPPLEPROC) (GLsync sync);
+typedef void (GL_APIENTRYP PFNGLDELETESYNCAPPLEPROC) (GLsync sync);
+typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+typedef void (GL_APIENTRYP PFNGLWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+typedef void (GL_APIENTRYP PFNGLGETINTEGER64VAPPLEPROC) (GLenum pname, GLint64 *params);
+typedef void (GL_APIENTRYP PFNGLGETSYNCIVAPPLEPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+#endif
+
+/* GL_APPLE_texture_2D_limited_npot */
+#ifndef GL_APPLE_texture_2D_limited_npot
+#define GL_APPLE_texture_2D_limited_npot 1
+#endif
+
+/* GL_APPLE_texture_format_BGRA8888 */
+#ifndef GL_APPLE_texture_format_BGRA8888
+#define GL_APPLE_texture_format_BGRA8888 1
+#endif
+
+/* GL_APPLE_texture_max_level */
+#ifndef GL_APPLE_texture_max_level
+#define GL_APPLE_texture_max_level 1
+#endif
+
+/*------------------------------------------------------------------------*
+ * ARM extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_ARM_rgba8 */
+#ifndef GL_ARM_rgba8
+#define GL_ARM_rgba8 1
+#endif
+
+/*------------------------------------------------------------------------*
+ * EXT extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_EXT_blend_minmax */
+#ifndef GL_EXT_blend_minmax
+#define GL_EXT_blend_minmax 1
+#endif
+
+/* GL_EXT_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_map_buffer_range */
+#ifndef GL_EXT_map_buffer_range
+#define GL_EXT_map_buffer_range 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY *glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+GL_API void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length);
+#endif
+typedef void* (GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
+#endif
+
+/* GL_EXT_multisampled_render_to_texture */
+#ifndef GL_EXT_multisampled_render_to_texture
+#define GL_EXT_multisampled_render_to_texture 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
+GL_API void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei);
+#endif
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
+#endif
+
+/* 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, const GLint *, const 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, const GLint *first, const 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_robustness */
+#ifndef GL_EXT_robustness
+#define GL_EXT_robustness 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void);
+GL_API void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+GL_API void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, float *params);
+GL_API void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+#endif
+typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void);
+typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, float *params);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+#endif
+
+/* GL_EXT_sRGB */
+#ifndef GL_EXT_sRGB
+#define GL_EXT_sRGB 1
+#endif
+
+/* GL_EXT_texture_compression_dxt1 */
+#ifndef GL_EXT_texture_compression_dxt1
+#define GL_EXT_texture_compression_dxt1 1
+#endif
+
+/* GL_EXT_texture_filter_anisotropic */
+#ifndef GL_EXT_texture_filter_anisotropic
+#define GL_EXT_texture_filter_anisotropic 1
+#endif
+
+/* GL_EXT_texture_format_BGRA8888 */
+#ifndef GL_EXT_texture_format_BGRA8888
+#define GL_EXT_texture_format_BGRA8888 1
+#endif
+
+/* GL_EXT_texture_lod_bias */
+#ifndef GL_EXT_texture_lod_bias
+#define GL_EXT_texture_lod_bias 1
+#endif
+
+/* GL_EXT_texture_storage */
+#ifndef GL_EXT_texture_storage
+#define GL_EXT_texture_storage 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+GL_API void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GL_API void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+GL_API void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+GL_API void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GL_API void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+#endif
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+#endif
+
+/*------------------------------------------------------------------------*
+ * 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
+
+/* GL_IMG_multisampled_render_to_texture */
+#ifndef GL_IMG_multisampled_render_to_texture
+#define GL_IMG_multisampled_render_to_texture 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
+GL_API void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei);
+#endif
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
+#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
+
+/******************************************************************************/
+/* 20140930-sw815.ha : SEC proprietary specs                                  */
+#ifndef GL_EXT_multisampled_render_to_texture
+#define GL_TEXTURE_SAMPLES_EXT                     0x9136
+#endif
+/******************************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __glext_h_ */
\ No newline at end of file
diff --git a/include_KHR/GLES/glplatform.h b/include_KHR/GLES/glplatform.h
new file mode 100644 (file)
index 0000000..2db6ee2
--- /dev/null
@@ -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 <KHR/khrplatform.h>
+
+#ifndef GL_API
+#define GL_API      KHRONOS_APICALL
+#endif
+
+#ifndef GL_APIENTRY
+#define GL_APIENTRY KHRONOS_APIENTRY
+#endif
+
+#endif /* __glplatform_h_ */
diff --git a/include_KHR/GLES2/gl2.h b/include_KHR/GLES2/gl2.h
new file mode 100644 (file)
index 0000000..2f776c1
--- /dev/null
@@ -0,0 +1,530 @@
+#ifndef __gl2_h_
+#define __gl2_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2013-2014 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.
+*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+**   http://www.opengl.org/registry/
+**
+** Khronos $Revision: 28335 $ on $Date: 2014-09-26 18:55:45 -0700 (Fri, 26 Sep 2014) $
+*/
+
+#include <GLES2/gl2platform.h>
+
+/* Generated on date 20140926 */
+
+/* Generated C header for:
+ * API: gles2
+ * Profile: common
+ * Versions considered: 2\.[0-9]
+ * Versions emitted: .*
+ * Default extensions included: None
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef GL_ES_VERSION_2_0
+#define GL_ES_VERSION_2_0 1
+#include <KHR/khrplatform.h>
+typedef khronos_int8_t GLbyte;
+typedef khronos_float_t GLclampf;
+typedef khronos_int32_t GLfixed;
+typedef short GLshort;
+typedef unsigned short GLushort;
+typedef void GLvoid;
+typedef struct __GLsync *GLsync;
+typedef khronos_int64_t GLint64;
+typedef khronos_uint64_t GLuint64;
+typedef unsigned int GLenum;
+typedef unsigned int GLuint;
+typedef char GLchar;
+typedef khronos_float_t GLfloat;
+typedef khronos_ssize_t GLsizeiptr;
+typedef khronos_intptr_t GLintptr;
+typedef unsigned int GLbitfield;
+typedef int GLint;
+typedef unsigned char GLboolean;
+typedef int GLsizei;
+typedef khronos_uint8_t GLubyte;
+#define GL_DEPTH_BUFFER_BIT               0x00000100
+#define GL_STENCIL_BUFFER_BIT             0x00000400
+#define GL_COLOR_BUFFER_BIT               0x00004000
+#define GL_FALSE                          0
+#define GL_TRUE                           1
+#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
+#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
+#define GL_DST_COLOR                      0x0306
+#define GL_ONE_MINUS_DST_COLOR            0x0307
+#define GL_SRC_ALPHA_SATURATE             0x0308
+#define GL_FUNC_ADD                       0x8006
+#define GL_BLEND_EQUATION                 0x8009
+#define GL_BLEND_EQUATION_RGB             0x8009
+#define GL_BLEND_EQUATION_ALPHA           0x883D
+#define GL_FUNC_SUBTRACT                  0x800A
+#define GL_FUNC_REVERSE_SUBTRACT          0x800B
+#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
+#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
+#define GL_FRONT                          0x0404
+#define GL_BACK                           0x0405
+#define GL_FRONT_AND_BACK                 0x0408
+#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
+#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
+#define GL_CW                             0x0900
+#define GL_CCW                            0x0901
+#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
+#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
+#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
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS     0x86A3
+#define GL_DONT_CARE                      0x1100
+#define GL_FASTEST                        0x1101
+#define GL_NICEST                         0x1102
+#define GL_GENERATE_MIPMAP_HINT           0x8192
+#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
+#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
+#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
+#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
+#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
+#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
+#define GL_VENDOR                         0x1F00
+#define GL_RENDERER                       0x1F01
+#define GL_VERSION                        0x1F02
+#define GL_EXTENSIONS                     0x1F03
+#define GL_NEAREST                        0x2600
+#define GL_LINEAR                         0x2601
+#define GL_NEAREST_MIPMAP_NEAREST         0x2700
+#define GL_LINEAR_MIPMAP_NEAREST          0x2701
+#define GL_NEAREST_MIPMAP_LINEAR          0x2702
+#define GL_LINEAR_MIPMAP_LINEAR           0x2703
+#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_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
+#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_REPEAT                         0x2901
+#define GL_CLAMP_TO_EDGE                  0x812F
+#define GL_MIRRORED_REPEAT                0x8370
+#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
+#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
+#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
+#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
+#define GL_COMPILE_STATUS                 0x8B81
+#define GL_INFO_LOG_LENGTH                0x8B84
+#define GL_SHADER_SOURCE_LENGTH           0x8B88
+#define GL_SHADER_COMPILER                0x8DFA
+#define GL_SHADER_BINARY_FORMATS          0x8DF8
+#define GL_NUM_SHADER_BINARY_FORMATS      0x8DF9
+#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
+#define GL_FRAMEBUFFER                    0x8D40
+#define GL_RENDERBUFFER                   0x8D41
+#define GL_RGBA4                          0x8056
+#define GL_RGB5_A1                        0x8057
+#define GL_RGB565                         0x8D62
+#define GL_DEPTH_COMPONENT16              0x81A5
+#define GL_STENCIL_INDEX8                 0x8D48
+#define GL_RENDERBUFFER_WIDTH             0x8D42
+#define GL_RENDERBUFFER_HEIGHT            0x8D43
+#define GL_RENDERBUFFER_INTERNAL_FORMAT   0x8D44
+#define GL_RENDERBUFFER_RED_SIZE          0x8D50
+#define GL_RENDERBUFFER_GREEN_SIZE        0x8D51
+#define GL_RENDERBUFFER_BLUE_SIZE         0x8D52
+#define GL_RENDERBUFFER_ALPHA_SIZE        0x8D53
+#define GL_RENDERBUFFER_DEPTH_SIZE        0x8D54
+#define GL_RENDERBUFFER_STENCIL_SIZE      0x8D55
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
+#define GL_COLOR_ATTACHMENT0              0x8CE0
+#define GL_DEPTH_ATTACHMENT               0x8D00
+#define GL_STENCIL_ATTACHMENT             0x8D20
+#define GL_NONE                           0
+#define GL_FRAMEBUFFER_COMPLETE           0x8CD5
+#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
+#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
+#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
+#define GL_FRAMEBUFFER_UNSUPPORTED        0x8CDD
+#define GL_FRAMEBUFFER_BINDING            0x8CA6
+#define GL_RENDERBUFFER_BINDING           0x8CA7
+#define GL_MAX_RENDERBUFFER_SIZE          0x84E8
+#define GL_INVALID_FRAMEBUFFER_OPERATION  0x0506
+GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
+GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
+GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name);
+GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
+GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
+GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
+GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
+GL_APICALL void GL_APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat 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 sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+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 (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat d);
+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 (GLfloat n, GLfloat f);
+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, GLchar *name);
+GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
+GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar *name);
+GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *data);
+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 *data);
+GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data);
+GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
+GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
+GL_APICALL const GLubyte *GL_APIENTRY glGetString (GLenum name);
+GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params);
+GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
+GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, 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 (GLfloat value, GLboolean invert);
+GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
+GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
+GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
+GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
+GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint 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 v0);
+GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0);
+GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1);
+GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1);
+GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);
+GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value);
+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 index, GLfloat x);
+GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y);
+GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
+GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
+#endif /* GL_ES_VERSION_2_0 */
+
+/******************************************************************************/
+/* 20140709 joonbum.ko@samsung.com: Add GL_STENCIL_INDEX                      */
+#define GL_STENCIL_INDEX                                    0x1901
+/******************************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
\ No newline at end of file
diff --git a/include_KHR/GLES2/gl2ext.h b/include_KHR/GLES2/gl2ext.h
new file mode 100644 (file)
index 0000000..e004151
--- /dev/null
@@ -0,0 +1,2051 @@
+#ifndef __gl2ext_h_
+#define __gl2ext_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2013-2014 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.
+*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+**   http://www.opengl.org/registry/
+**
+** Khronos $Revision: 28335 $ on $Date: 2014-09-26 18:55:45 -0700 (Fri, 26 Sep 2014) $
+*/
+
+#ifndef GL_APIENTRYP
+#define GL_APIENTRYP GL_APIENTRY*
+#endif
+
+/* Generated on date 20140926 */
+
+/* Generated C header for:
+ * API: gles2
+ * Profile: common
+ * Versions considered: 2\.[0-9]
+ * Versions emitted: _nomatch_^
+ * Default extensions included: gles2
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef GL_KHR_blend_equation_advanced
+#define GL_KHR_blend_equation_advanced 1
+#define GL_MULTIPLY_KHR                   0x9294
+#define GL_SCREEN_KHR                     0x9295
+#define GL_OVERLAY_KHR                    0x9296
+#define GL_DARKEN_KHR                     0x9297
+#define GL_LIGHTEN_KHR                    0x9298
+#define GL_COLORDODGE_KHR                 0x9299
+#define GL_COLORBURN_KHR                  0x929A
+#define GL_HARDLIGHT_KHR                  0x929B
+#define GL_SOFTLIGHT_KHR                  0x929C
+#define GL_DIFFERENCE_KHR                 0x929E
+#define GL_EXCLUSION_KHR                  0x92A0
+#define GL_HSL_HUE_KHR                    0x92AD
+#define GL_HSL_SATURATION_KHR             0x92AE
+#define GL_HSL_COLOR_KHR                  0x92AF
+#define GL_HSL_LUMINOSITY_KHR             0x92B0
+typedef void (GL_APIENTRYP PFNGLBLENDBARRIERKHRPROC) (void);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBlendBarrierKHR (void);
+#endif
+#endif /* GL_KHR_blend_equation_advanced */
+
+#ifndef GL_KHR_blend_equation_advanced_coherent
+#define GL_KHR_blend_equation_advanced_coherent 1
+#define GL_BLEND_ADVANCED_COHERENT_KHR    0x9285
+#endif /* GL_KHR_blend_equation_advanced_coherent */
+
+#ifndef GL_KHR_context_flush_control
+#define GL_KHR_context_flush_control 1
+#define GL_CONTEXT_RELEASE_BEHAVIOR_KHR   0x82FB
+#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x82FC
+#endif /* GL_KHR_context_flush_control */
+
+#ifndef GL_KHR_debug
+#define GL_KHR_debug 1
+typedef void (GL_APIENTRY  *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
+#define GL_SAMPLER                        0x82E6
+#define GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR   0x8242
+#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_KHR 0x8243
+#define GL_DEBUG_CALLBACK_FUNCTION_KHR    0x8244
+#define GL_DEBUG_CALLBACK_USER_PARAM_KHR  0x8245
+#define GL_DEBUG_SOURCE_API_KHR           0x8246
+#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR 0x8247
+#define GL_DEBUG_SOURCE_SHADER_COMPILER_KHR 0x8248
+#define GL_DEBUG_SOURCE_THIRD_PARTY_KHR   0x8249
+#define GL_DEBUG_SOURCE_APPLICATION_KHR   0x824A
+#define GL_DEBUG_SOURCE_OTHER_KHR         0x824B
+#define GL_DEBUG_TYPE_ERROR_KHR           0x824C
+#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR 0x824D
+#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR 0x824E
+#define GL_DEBUG_TYPE_PORTABILITY_KHR     0x824F
+#define GL_DEBUG_TYPE_PERFORMANCE_KHR     0x8250
+#define GL_DEBUG_TYPE_OTHER_KHR           0x8251
+#define GL_DEBUG_TYPE_MARKER_KHR          0x8268
+#define GL_DEBUG_TYPE_PUSH_GROUP_KHR      0x8269
+#define GL_DEBUG_TYPE_POP_GROUP_KHR       0x826A
+#define GL_DEBUG_SEVERITY_NOTIFICATION_KHR 0x826B
+#define GL_MAX_DEBUG_GROUP_STACK_DEPTH_KHR 0x826C
+#define GL_DEBUG_GROUP_STACK_DEPTH_KHR    0x826D
+#define GL_BUFFER_KHR                     0x82E0
+#define GL_SHADER_KHR                     0x82E1
+#define GL_PROGRAM_KHR                    0x82E2
+#define GL_VERTEX_ARRAY_KHR               0x8074
+#define GL_QUERY_KHR                      0x82E3
+#define GL_SAMPLER_KHR                    0x82E6
+#define GL_MAX_LABEL_LENGTH_KHR           0x82E8
+#define GL_MAX_DEBUG_MESSAGE_LENGTH_KHR   0x9143
+#define GL_MAX_DEBUG_LOGGED_MESSAGES_KHR  0x9144
+#define GL_DEBUG_LOGGED_MESSAGES_KHR      0x9145
+#define GL_DEBUG_SEVERITY_HIGH_KHR        0x9146
+#define GL_DEBUG_SEVERITY_MEDIUM_KHR      0x9147
+#define GL_DEBUG_SEVERITY_LOW_KHR         0x9148
+#define GL_DEBUG_OUTPUT_KHR               0x92E0
+#define GL_CONTEXT_FLAG_DEBUG_BIT_KHR     0x00000002
+#define GL_STACK_OVERFLOW_KHR             0x0503
+#define GL_STACK_UNDERFLOW_KHR            0x0504
+typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECONTROLKHRPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
+typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGEINSERTKHRPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
+typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECALLBACKKHRPROC) (GLDEBUGPROCKHR callback, const void *userParam);
+typedef GLuint (GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
+typedef void (GL_APIENTRYP PFNGLPUSHDEBUGGROUPKHRPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message);
+typedef void (GL_APIENTRYP PFNGLPOPDEBUGGROUPKHRPROC) (void);
+typedef void (GL_APIENTRYP PFNGLOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
+typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
+typedef void (GL_APIENTRYP PFNGLOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei length, const GLchar *label);
+typedef void (GL_APIENTRYP PFNGLGETOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
+typedef void (GL_APIENTRYP PFNGLGETPOINTERVKHRPROC) (GLenum pname, void **params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDebugMessageControlKHR (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
+GL_APICALL void GL_APIENTRY glDebugMessageInsertKHR (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
+GL_APICALL void GL_APIENTRY glDebugMessageCallbackKHR (GLDEBUGPROCKHR callback, const void *userParam);
+GL_APICALL GLuint GL_APIENTRY glGetDebugMessageLogKHR (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
+GL_APICALL void GL_APIENTRY glPushDebugGroupKHR (GLenum source, GLuint id, GLsizei length, const GLchar *message);
+GL_APICALL void GL_APIENTRY glPopDebugGroupKHR (void);
+GL_APICALL void GL_APIENTRY glObjectLabelKHR (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
+GL_APICALL void GL_APIENTRY glGetObjectLabelKHR (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
+GL_APICALL void GL_APIENTRY glObjectPtrLabelKHR (const void *ptr, GLsizei length, const GLchar *label);
+GL_APICALL void GL_APIENTRY glGetObjectPtrLabelKHR (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
+GL_APICALL void GL_APIENTRY glGetPointervKHR (GLenum pname, void **params);
+#endif
+#endif /* GL_KHR_debug */
+
+#ifndef GL_KHR_robust_buffer_access_behavior
+#define GL_KHR_robust_buffer_access_behavior 1
+#endif /* GL_KHR_robust_buffer_access_behavior */
+
+#ifndef GL_KHR_robustness
+#define GL_KHR_robustness 1
+#define GL_CONTEXT_ROBUST_ACCESS_KHR      0x90F3
+#define GL_LOSE_CONTEXT_ON_RESET_KHR      0x8252
+#define GL_GUILTY_CONTEXT_RESET_KHR       0x8253
+#define GL_INNOCENT_CONTEXT_RESET_KHR     0x8254
+#define GL_UNKNOWN_CONTEXT_RESET_KHR      0x8255
+#define GL_RESET_NOTIFICATION_STRATEGY_KHR 0x8256
+#define GL_NO_RESET_NOTIFICATION_KHR      0x8261
+#define GL_CONTEXT_LOST_KHR               0x0507
+typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSKHRPROC) (void);
+typedef void (GL_APIENTRYP PFNGLREADNPIXELSKHRPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMUIVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusKHR (void);
+GL_APICALL void GL_APIENTRY glReadnPixelsKHR (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+GL_APICALL void GL_APIENTRY glGetnUniformfvKHR (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetnUniformivKHR (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+GL_APICALL void GL_APIENTRY glGetnUniformuivKHR (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
+#endif
+#endif /* GL_KHR_robustness */
+
+#ifndef GL_KHR_texture_compression_astc_hdr
+#define GL_KHR_texture_compression_astc_hdr 1
+#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR   0x93B0
+#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR   0x93B1
+#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR   0x93B2
+#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR   0x93B3
+#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR   0x93B4
+#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR   0x93B5
+#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR   0x93B6
+#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR   0x93B7
+#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR  0x93B8
+#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR  0x93B9
+#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR  0x93BA
+#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB
+#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC
+#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD
+#endif /* GL_KHR_texture_compression_astc_hdr */
+
+#ifndef GL_KHR_texture_compression_astc_ldr
+#define GL_KHR_texture_compression_astc_ldr 1
+#endif /* GL_KHR_texture_compression_astc_ldr */
+
+#ifndef GL_OES_EGL_image
+#define GL_OES_EGL_image 1
+typedef void *GLeglImageOES;
+typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
+typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
+#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
+#endif /* GL_OES_EGL_image */
+
+#ifndef GL_OES_EGL_image_external
+#define GL_OES_EGL_image_external 1
+#define GL_TEXTURE_EXTERNAL_OES           0x8D65
+#define GL_TEXTURE_BINDING_EXTERNAL_OES   0x8D67
+#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68
+#define GL_SAMPLER_EXTERNAL_OES           0x8D66
+#endif /* GL_OES_EGL_image_external */
+
+#ifndef GL_OES_compressed_ETC1_RGB8_sub_texture
+#define GL_OES_compressed_ETC1_RGB8_sub_texture 1
+#endif /* GL_OES_compressed_ETC1_RGB8_sub_texture */
+
+#ifndef GL_OES_compressed_ETC1_RGB8_texture
+#define GL_OES_compressed_ETC1_RGB8_texture 1
+#define GL_ETC1_RGB8_OES                  0x8D64
+#endif /* GL_OES_compressed_ETC1_RGB8_texture */
+
+#ifndef GL_OES_compressed_paletted_texture
+#define GL_OES_compressed_paletted_texture 1
+#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_compressed_paletted_texture */
+
+#ifndef GL_OES_depth24
+#define GL_OES_depth24 1
+#define GL_DEPTH_COMPONENT24_OES          0x81A6
+#endif /* GL_OES_depth24 */
+
+#ifndef GL_OES_depth32
+#define GL_OES_depth32 1
+#define GL_DEPTH_COMPONENT32_OES          0x81A7
+#endif /* GL_OES_depth32 */
+
+#ifndef GL_OES_depth_texture
+#define GL_OES_depth_texture 1
+#endif /* GL_OES_depth_texture */
+
+#ifndef GL_OES_element_index_uint
+#define GL_OES_element_index_uint 1
+#endif /* GL_OES_element_index_uint */
+
+#ifndef GL_OES_fbo_render_mipmap
+#define GL_OES_fbo_render_mipmap 1
+#endif /* GL_OES_fbo_render_mipmap */
+
+#ifndef GL_OES_fragment_precision_high
+#define GL_OES_fragment_precision_high 1
+#endif /* GL_OES_fragment_precision_high */
+
+#ifndef GL_OES_get_program_binary
+#define GL_OES_get_program_binary 1
+#define GL_PROGRAM_BINARY_LENGTH_OES      0x8741
+#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE
+#define GL_PROGRAM_BINARY_FORMATS_OES     0x87FF
+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);
+#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
+#endif /* GL_OES_get_program_binary */
+
+#ifndef GL_OES_mapbuffer
+#define GL_OES_mapbuffer 1
+#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
+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);
+#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
+#endif /* GL_OES_mapbuffer */
+
+#ifndef GL_OES_packed_depth_stencil
+#define GL_OES_packed_depth_stencil 1
+#define GL_DEPTH_STENCIL_OES              0x84F9
+#define GL_UNSIGNED_INT_24_8_OES          0x84FA
+#define GL_DEPTH24_STENCIL8_OES           0x88F0
+#endif /* GL_OES_packed_depth_stencil */
+
+#ifndef GL_OES_required_internalformat
+#define GL_OES_required_internalformat 1
+#define GL_ALPHA8_OES                     0x803C
+#define GL_DEPTH_COMPONENT16_OES          0x81A5
+#define GL_LUMINANCE4_ALPHA4_OES          0x8043
+#define GL_LUMINANCE8_ALPHA8_OES          0x8045
+#define GL_LUMINANCE8_OES                 0x8040
+#define GL_RGBA4_OES                      0x8056
+#define GL_RGB5_A1_OES                    0x8057
+#define GL_RGB565_OES                     0x8D62
+#define GL_RGB8_OES                       0x8051
+#define GL_RGBA8_OES                      0x8058
+#define GL_RGB10_EXT                      0x8052
+#define GL_RGB10_A2_EXT                   0x8059
+#endif /* GL_OES_required_internalformat */
+
+#ifndef GL_OES_rgb8_rgba8
+#define GL_OES_rgb8_rgba8 1
+#endif /* GL_OES_rgb8_rgba8 */
+
+#ifndef GL_OES_sample_shading
+#define GL_OES_sample_shading 1
+#define GL_SAMPLE_SHADING_OES             0x8C36
+#define GL_MIN_SAMPLE_SHADING_VALUE_OES   0x8C37
+typedef void (GL_APIENTRYP PFNGLMINSAMPLESHADINGOESPROC) (GLfloat value);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glMinSampleShadingOES (GLfloat value);
+#endif
+#endif /* GL_OES_sample_shading */
+
+#ifndef GL_OES_sample_variables
+#define GL_OES_sample_variables 1
+#endif /* GL_OES_sample_variables */
+
+#ifndef GL_OES_shader_image_atomic
+#define GL_OES_shader_image_atomic 1
+#endif /* GL_OES_shader_image_atomic */
+
+#ifndef GL_OES_shader_multisample_interpolation
+#define GL_OES_shader_multisample_interpolation 1
+#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5B
+#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5C
+#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS_OES 0x8E5D
+#endif /* GL_OES_shader_multisample_interpolation */
+
+#ifndef GL_OES_standard_derivatives
+#define GL_OES_standard_derivatives 1
+#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B
+#endif /* GL_OES_standard_derivatives */
+
+#ifndef GL_OES_stencil1
+#define GL_OES_stencil1 1
+#define GL_STENCIL_INDEX1_OES             0x8D46
+#endif /* GL_OES_stencil1 */
+
+#ifndef GL_OES_stencil4
+#define GL_OES_stencil4 1
+#define GL_STENCIL_INDEX4_OES             0x8D47
+#endif /* GL_OES_stencil4 */
+
+#ifndef GL_OES_surfaceless_context
+#define GL_OES_surfaceless_context 1
+#define GL_FRAMEBUFFER_UNDEFINED_OES      0x8219
+#endif /* GL_OES_surfaceless_context */
+
+#ifndef GL_OES_texture_3D
+#define GL_OES_texture_3D 1
+#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
+typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *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 PFNGLFRAMEBUFFERTEXTURE3DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+#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
+#endif /* GL_OES_texture_3D */
+
+#ifndef GL_OES_texture_compression_astc
+#define GL_OES_texture_compression_astc 1
+#define GL_COMPRESSED_RGBA_ASTC_3x3x3_OES 0x93C0
+#define GL_COMPRESSED_RGBA_ASTC_4x3x3_OES 0x93C1
+#define GL_COMPRESSED_RGBA_ASTC_4x4x3_OES 0x93C2
+#define GL_COMPRESSED_RGBA_ASTC_4x4x4_OES 0x93C3
+#define GL_COMPRESSED_RGBA_ASTC_5x4x4_OES 0x93C4
+#define GL_COMPRESSED_RGBA_ASTC_5x5x4_OES 0x93C5
+#define GL_COMPRESSED_RGBA_ASTC_5x5x5_OES 0x93C6
+#define GL_COMPRESSED_RGBA_ASTC_6x5x5_OES 0x93C7
+#define GL_COMPRESSED_RGBA_ASTC_6x6x5_OES 0x93C8
+#define GL_COMPRESSED_RGBA_ASTC_6x6x6_OES 0x93C9
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES 0x93E0
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES 0x93E1
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES 0x93E2
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES 0x93E3
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES 0x93E4
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES 0x93E5
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES 0x93E6
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES 0x93E7
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES 0x93E8
+#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES 0x93E9
+#endif /* GL_OES_texture_compression_astc */
+
+#ifndef GL_OES_texture_float
+#define GL_OES_texture_float 1
+#endif /* GL_OES_texture_float */
+
+#ifndef GL_OES_texture_float_linear
+#define GL_OES_texture_float_linear 1
+#endif /* GL_OES_texture_float_linear */
+
+#ifndef GL_OES_texture_half_float
+#define GL_OES_texture_half_float 1
+#define GL_HALF_FLOAT_OES                 0x8D61
+#endif /* GL_OES_texture_half_float */
+
+#ifndef GL_OES_texture_half_float_linear
+#define GL_OES_texture_half_float_linear 1
+#endif /* GL_OES_texture_half_float_linear */
+
+#ifndef GL_OES_texture_npot
+#define GL_OES_texture_npot 1
+#endif /* GL_OES_texture_npot */
+
+#ifndef GL_OES_texture_stencil8
+#define GL_OES_texture_stencil8 1
+#define GL_STENCIL_INDEX_OES              0x1901
+#define GL_STENCIL_INDEX8_OES             0x8D48
+#endif /* GL_OES_texture_stencil8 */
+
+#ifndef GL_OES_texture_storage_multisample_2d_array
+#define GL_OES_texture_storage_multisample_2d_array 1
+#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES 0x9102
+#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY_OES 0x9105
+#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910B
+#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910C
+#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910D
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEOESPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexStorage3DMultisampleOES (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
+#endif
+#endif /* GL_OES_texture_storage_multisample_2d_array */
+
+#ifndef GL_OES_vertex_array_object
+#define GL_OES_vertex_array_object 1
+#define GL_VERTEX_ARRAY_BINDING_OES       0x85B5
+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);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBindVertexArrayOES (GLuint array);
+GL_APICALL void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays);
+GL_APICALL void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays);
+GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array);
+#endif
+#endif /* GL_OES_vertex_array_object */
+
+#ifndef GL_OES_vertex_half_float
+#define GL_OES_vertex_half_float 1
+#endif /* GL_OES_vertex_half_float */
+
+#ifndef GL_OES_vertex_type_10_10_10_2
+#define GL_OES_vertex_type_10_10_10_2 1
+#define GL_UNSIGNED_INT_10_10_10_2_OES    0x8DF6
+#define GL_INT_10_10_10_2_OES             0x8DF7
+#endif /* GL_OES_vertex_type_10_10_10_2 */
+
+#ifndef GL_AMD_compressed_3DC_texture
+#define GL_AMD_compressed_3DC_texture 1
+#define GL_3DC_X_AMD                      0x87F9
+#define GL_3DC_XY_AMD                     0x87FA
+#endif /* GL_AMD_compressed_3DC_texture */
+
+#ifndef GL_AMD_compressed_ATC_texture
+#define GL_AMD_compressed_ATC_texture 1
+#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_compressed_ATC_texture */
+
+#ifndef GL_AMD_performance_monitor
+#define GL_AMD_performance_monitor 1
+#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
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, 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 *counterList);
+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);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, 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 *counterList);
+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
+#endif /* GL_AMD_performance_monitor */
+
+#ifndef GL_AMD_program_binary_Z400
+#define GL_AMD_program_binary_Z400 1
+#define GL_Z400_BINARY_AMD                0x8740
+#endif /* GL_AMD_program_binary_Z400 */
+
+#ifndef GL_ANDROID_extension_pack_es31a
+#define GL_ANDROID_extension_pack_es31a 1
+#endif /* GL_ANDROID_extension_pack_es31a */
+
+#ifndef GL_ANGLE_depth_texture
+#define GL_ANGLE_depth_texture 1
+#endif /* GL_ANGLE_depth_texture */
+
+#ifndef GL_ANGLE_framebuffer_blit
+#define GL_ANGLE_framebuffer_blit 1
+#define GL_READ_FRAMEBUFFER_ANGLE         0x8CA8
+#define GL_DRAW_FRAMEBUFFER_ANGLE         0x8CA9
+#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6
+#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA
+typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBlitFramebufferANGLE (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#endif
+#endif /* GL_ANGLE_framebuffer_blit */
+
+#ifndef GL_ANGLE_framebuffer_multisample
+#define GL_ANGLE_framebuffer_multisample 1
+#define GL_RENDERBUFFER_SAMPLES_ANGLE     0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56
+#define GL_MAX_SAMPLES_ANGLE              0x8D57
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+#endif
+#endif /* GL_ANGLE_framebuffer_multisample */
+
+#ifndef GL_ANGLE_instanced_arrays
+#define GL_ANGLE_instanced_arrays 1
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE (GLuint index, GLuint divisor);
+#endif
+#endif /* GL_ANGLE_instanced_arrays */
+
+#ifndef GL_ANGLE_pack_reverse_row_order
+#define GL_ANGLE_pack_reverse_row_order 1
+#define GL_PACK_REVERSE_ROW_ORDER_ANGLE   0x93A4
+#endif /* GL_ANGLE_pack_reverse_row_order */
+
+#ifndef GL_ANGLE_program_binary
+#define GL_ANGLE_program_binary 1
+#define GL_PROGRAM_BINARY_ANGLE           0x93A6
+#endif /* GL_ANGLE_program_binary */
+
+#ifndef GL_ANGLE_texture_compression_dxt3
+#define GL_ANGLE_texture_compression_dxt3 1
+#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2
+#endif /* GL_ANGLE_texture_compression_dxt3 */
+
+#ifndef GL_ANGLE_texture_compression_dxt5
+#define GL_ANGLE_texture_compression_dxt5 1
+#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3
+#endif /* GL_ANGLE_texture_compression_dxt5 */
+
+#ifndef GL_ANGLE_texture_usage
+#define GL_ANGLE_texture_usage 1
+#define GL_TEXTURE_USAGE_ANGLE            0x93A2
+#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE   0x93A3
+#endif /* GL_ANGLE_texture_usage */
+
+#ifndef GL_ANGLE_translated_shader_source
+#define GL_ANGLE_translated_shader_source 1
+#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0
+typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
+#endif
+#endif /* GL_ANGLE_translated_shader_source */
+
+#ifndef GL_APPLE_clip_distance
+#define GL_APPLE_clip_distance 1
+#define GL_MAX_CLIP_DISTANCES_APPLE       0x0D32
+#define GL_CLIP_DISTANCE0_APPLE           0x3000
+#define GL_CLIP_DISTANCE1_APPLE           0x3001
+#define GL_CLIP_DISTANCE2_APPLE           0x3002
+#define GL_CLIP_DISTANCE3_APPLE           0x3003
+#define GL_CLIP_DISTANCE4_APPLE           0x3004
+#define GL_CLIP_DISTANCE5_APPLE           0x3005
+#define GL_CLIP_DISTANCE6_APPLE           0x3006
+#define GL_CLIP_DISTANCE7_APPLE           0x3007
+#endif /* GL_APPLE_clip_distance */
+
+#ifndef GL_APPLE_color_buffer_packed_float
+#define GL_APPLE_color_buffer_packed_float 1
+#endif /* GL_APPLE_color_buffer_packed_float */
+
+#ifndef GL_APPLE_copy_texture_levels
+#define GL_APPLE_copy_texture_levels 1
+typedef void (GL_APIENTRYP PFNGLCOPYTEXTURELEVELSAPPLEPROC) (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCopyTextureLevelsAPPLE (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
+#endif
+#endif /* GL_APPLE_copy_texture_levels */
+
+#ifndef GL_APPLE_framebuffer_multisample
+#define GL_APPLE_framebuffer_multisample 1
+#define GL_RENDERBUFFER_SAMPLES_APPLE     0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56
+#define GL_MAX_SAMPLES_APPLE              0x8D57
+#define GL_READ_FRAMEBUFFER_APPLE         0x8CA8
+#define GL_DRAW_FRAMEBUFFER_APPLE         0x8CA9
+#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6
+#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void);
+#endif
+#endif /* GL_APPLE_framebuffer_multisample */
+
+#ifndef GL_APPLE_rgb_422
+#define GL_APPLE_rgb_422 1
+#define GL_RGB_422_APPLE                  0x8A1F
+#define GL_UNSIGNED_SHORT_8_8_APPLE       0x85BA
+#define GL_UNSIGNED_SHORT_8_8_REV_APPLE   0x85BB
+#define GL_RGB_RAW_422_APPLE              0x8A51
+#endif /* GL_APPLE_rgb_422 */
+
+#ifndef GL_APPLE_sync
+#define GL_APPLE_sync 1
+#define GL_SYNC_OBJECT_APPLE              0x8A53
+#define GL_MAX_SERVER_WAIT_TIMEOUT_APPLE  0x9111
+#define GL_OBJECT_TYPE_APPLE              0x9112
+#define GL_SYNC_CONDITION_APPLE           0x9113
+#define GL_SYNC_STATUS_APPLE              0x9114
+#define GL_SYNC_FLAGS_APPLE               0x9115
+#define GL_SYNC_FENCE_APPLE               0x9116
+#define GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE 0x9117
+#define GL_UNSIGNALED_APPLE               0x9118
+#define GL_SIGNALED_APPLE                 0x9119
+#define GL_ALREADY_SIGNALED_APPLE         0x911A
+#define GL_TIMEOUT_EXPIRED_APPLE          0x911B
+#define GL_CONDITION_SATISFIED_APPLE      0x911C
+#define GL_WAIT_FAILED_APPLE              0x911D
+#define GL_SYNC_FLUSH_COMMANDS_BIT_APPLE  0x00000001
+#define GL_TIMEOUT_IGNORED_APPLE          0xFFFFFFFFFFFFFFFFull
+typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCAPPLEPROC) (GLenum condition, GLbitfield flags);
+typedef GLboolean (GL_APIENTRYP PFNGLISSYNCAPPLEPROC) (GLsync sync);
+typedef void (GL_APIENTRYP PFNGLDELETESYNCAPPLEPROC) (GLsync sync);
+typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+typedef void (GL_APIENTRYP PFNGLWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+typedef void (GL_APIENTRYP PFNGLGETINTEGER64VAPPLEPROC) (GLenum pname, GLint64 *params);
+typedef void (GL_APIENTRYP PFNGLGETSYNCIVAPPLEPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL GLsync GL_APIENTRY glFenceSyncAPPLE (GLenum condition, GLbitfield flags);
+GL_APICALL GLboolean GL_APIENTRY glIsSyncAPPLE (GLsync sync);
+GL_APICALL void GL_APIENTRY glDeleteSyncAPPLE (GLsync sync);
+GL_APICALL GLenum GL_APIENTRY glClientWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_APICALL void GL_APIENTRY glWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_APICALL void GL_APIENTRY glGetInteger64vAPPLE (GLenum pname, GLint64 *params);
+GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+#endif
+#endif /* GL_APPLE_sync */
+
+#ifndef GL_APPLE_texture_format_BGRA8888
+#define GL_APPLE_texture_format_BGRA8888 1
+#define GL_BGRA_EXT                       0x80E1
+#define GL_BGRA8_EXT                      0x93A1
+#endif /* GL_APPLE_texture_format_BGRA8888 */
+
+#ifndef GL_APPLE_texture_max_level
+#define GL_APPLE_texture_max_level 1
+#define GL_TEXTURE_MAX_LEVEL_APPLE        0x813D
+#endif /* GL_APPLE_texture_max_level */
+
+#ifndef GL_APPLE_texture_packed_float
+#define GL_APPLE_texture_packed_float 1
+#define GL_UNSIGNED_INT_10F_11F_11F_REV_APPLE 0x8C3B
+#define GL_UNSIGNED_INT_5_9_9_9_REV_APPLE 0x8C3E
+#define GL_R11F_G11F_B10F_APPLE           0x8C3A
+#define GL_RGB9_E5_APPLE                  0x8C3D
+#endif /* GL_APPLE_texture_packed_float */
+
+#ifndef GL_ARM_mali_program_binary
+#define GL_ARM_mali_program_binary 1
+#define GL_MALI_PROGRAM_BINARY_ARM        0x8F61
+#endif /* GL_ARM_mali_program_binary */
+
+#ifndef GL_ARM_mali_shader_binary
+#define GL_ARM_mali_shader_binary 1
+#define GL_MALI_SHADER_BINARY_ARM         0x8F60
+#endif /* GL_ARM_mali_shader_binary */
+
+#ifndef GL_ARM_rgba8
+#define GL_ARM_rgba8 1
+#endif /* GL_ARM_rgba8 */
+
+#ifndef GL_ARM_shader_framebuffer_fetch
+#define GL_ARM_shader_framebuffer_fetch 1
+#define GL_FETCH_PER_SAMPLE_ARM           0x8F65
+#define GL_FRAGMENT_SHADER_FRAMEBUFFER_FETCH_MRT_ARM 0x8F66
+#endif /* GL_ARM_shader_framebuffer_fetch */
+
+#ifndef GL_ARM_shader_framebuffer_fetch_depth_stencil
+#define GL_ARM_shader_framebuffer_fetch_depth_stencil 1
+#endif /* GL_ARM_shader_framebuffer_fetch_depth_stencil */
+
+#ifndef GL_DMP_program_binary
+#define GL_DMP_program_binary 1
+#define GL_SMAPHS30_PROGRAM_BINARY_DMP    0x9251
+#define GL_SMAPHS_PROGRAM_BINARY_DMP      0x9252
+#define GL_DMP_PROGRAM_BINARY_DMP         0x9253
+#endif /* GL_DMP_program_binary */
+
+#ifndef GL_DMP_shader_binary
+#define GL_DMP_shader_binary 1
+#define GL_SHADER_BINARY_DMP              0x9250
+#endif /* GL_DMP_shader_binary */
+
+#ifndef GL_EXT_blend_minmax
+#define GL_EXT_blend_minmax 1
+#define GL_MIN_EXT                        0x8007
+#define GL_MAX_EXT                        0x8008
+#endif /* GL_EXT_blend_minmax */
+
+#ifndef GL_EXT_color_buffer_half_float
+#define GL_EXT_color_buffer_half_float 1
+#define GL_RGBA16F_EXT                    0x881A
+#define GL_RGB16F_EXT                     0x881B
+#define GL_RG16F_EXT                      0x822F
+#define GL_R16F_EXT                       0x822D
+#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT 0x8211
+#define GL_UNSIGNED_NORMALIZED_EXT        0x8C17
+#endif /* GL_EXT_color_buffer_half_float */
+
+#ifndef GL_EXT_copy_image
+#define GL_EXT_copy_image 1
+typedef void (GL_APIENTRYP PFNGLCOPYIMAGESUBDATAEXTPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCopyImageSubDataEXT (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
+#endif
+#endif /* GL_EXT_copy_image */
+
+#ifndef GL_EXT_debug_label
+#define GL_EXT_debug_label 1
+#define GL_PROGRAM_PIPELINE_OBJECT_EXT    0x8A4F
+#define GL_PROGRAM_OBJECT_EXT             0x8B40
+#define GL_SHADER_OBJECT_EXT              0x8B48
+#define GL_BUFFER_OBJECT_EXT              0x9151
+#define GL_QUERY_OBJECT_EXT               0x9153
+#define GL_VERTEX_ARRAY_OBJECT_EXT        0x9154
+#define GL_TRANSFORM_FEEDBACK             0x8E22
+typedef void (GL_APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label);
+typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label);
+GL_APICALL void GL_APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
+#endif
+#endif /* GL_EXT_debug_label */
+
+#ifndef GL_EXT_debug_marker
+#define GL_EXT_debug_marker 1
+typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker);
+typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker);
+typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker);
+GL_APICALL void GL_APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker);
+GL_APICALL void GL_APIENTRY glPopGroupMarkerEXT (void);
+#endif
+#endif /* GL_EXT_debug_marker */
+
+#ifndef GL_EXT_discard_framebuffer
+#define GL_EXT_discard_framebuffer 1
+#define GL_COLOR_EXT                      0x1800
+#define GL_DEPTH_EXT                      0x1801
+#define GL_STENCIL_EXT                    0x1802
+typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments);
+#endif
+#endif /* GL_EXT_discard_framebuffer */
+
+#ifndef GL_EXT_disjoint_timer_query
+#define GL_EXT_disjoint_timer_query 1
+#define GL_QUERY_COUNTER_BITS_EXT         0x8864
+#define GL_CURRENT_QUERY_EXT              0x8865
+#define GL_QUERY_RESULT_EXT               0x8866
+#define GL_QUERY_RESULT_AVAILABLE_EXT     0x8867
+#define GL_TIME_ELAPSED_EXT               0x88BF
+#define GL_TIMESTAMP_EXT                  0x8E28
+#define GL_GPU_DISJOINT_EXT               0x8FBB
+typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids);
+typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids);
+typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id);
+typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id);
+typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLQUERYCOUNTEREXTPROC) (GLuint id, GLenum target);
+typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTIVEXTPROC) (GLuint id, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64 *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64 *params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids);
+GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids);
+GL_APICALL GLboolean GL_APIENTRY glIsQueryEXT (GLuint id);
+GL_APICALL void GL_APIENTRY glBeginQueryEXT (GLenum target, GLuint id);
+GL_APICALL void GL_APIENTRY glEndQueryEXT (GLenum target);
+GL_APICALL void GL_APIENTRY glQueryCounterEXT (GLuint id, GLenum target);
+GL_APICALL void GL_APIENTRY glGetQueryivEXT (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectivEXT (GLuint id, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params);
+GL_APICALL void GL_APIENTRY glGetQueryObjecti64vEXT (GLuint id, GLenum pname, GLint64 *params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectui64vEXT (GLuint id, GLenum pname, GLuint64 *params);
+#endif
+#endif /* GL_EXT_disjoint_timer_query */
+
+#ifndef GL_EXT_draw_buffers
+#define GL_EXT_draw_buffers 1
+#define GL_MAX_COLOR_ATTACHMENTS_EXT      0x8CDF
+#define GL_MAX_DRAW_BUFFERS_EXT           0x8824
+#define GL_DRAW_BUFFER0_EXT               0x8825
+#define GL_DRAW_BUFFER1_EXT               0x8826
+#define GL_DRAW_BUFFER2_EXT               0x8827
+#define GL_DRAW_BUFFER3_EXT               0x8828
+#define GL_DRAW_BUFFER4_EXT               0x8829
+#define GL_DRAW_BUFFER5_EXT               0x882A
+#define GL_DRAW_BUFFER6_EXT               0x882B
+#define GL_DRAW_BUFFER7_EXT               0x882C
+#define GL_DRAW_BUFFER8_EXT               0x882D
+#define GL_DRAW_BUFFER9_EXT               0x882E
+#define GL_DRAW_BUFFER10_EXT              0x882F
+#define GL_DRAW_BUFFER11_EXT              0x8830
+#define GL_DRAW_BUFFER12_EXT              0x8831
+#define GL_DRAW_BUFFER13_EXT              0x8832
+#define GL_DRAW_BUFFER14_EXT              0x8833
+#define GL_DRAW_BUFFER15_EXT              0x8834
+#define GL_COLOR_ATTACHMENT0_EXT          0x8CE0
+#define GL_COLOR_ATTACHMENT1_EXT          0x8CE1
+#define GL_COLOR_ATTACHMENT2_EXT          0x8CE2
+#define GL_COLOR_ATTACHMENT3_EXT          0x8CE3
+#define GL_COLOR_ATTACHMENT4_EXT          0x8CE4
+#define GL_COLOR_ATTACHMENT5_EXT          0x8CE5
+#define GL_COLOR_ATTACHMENT6_EXT          0x8CE6
+#define GL_COLOR_ATTACHMENT7_EXT          0x8CE7
+#define GL_COLOR_ATTACHMENT8_EXT          0x8CE8
+#define GL_COLOR_ATTACHMENT9_EXT          0x8CE9
+#define GL_COLOR_ATTACHMENT10_EXT         0x8CEA
+#define GL_COLOR_ATTACHMENT11_EXT         0x8CEB
+#define GL_COLOR_ATTACHMENT12_EXT         0x8CEC
+#define GL_COLOR_ATTACHMENT13_EXT         0x8CED
+#define GL_COLOR_ATTACHMENT14_EXT         0x8CEE
+#define GL_COLOR_ATTACHMENT15_EXT         0x8CEF
+typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSEXTPROC) (GLsizei n, const GLenum *bufs);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawBuffersEXT (GLsizei n, const GLenum *bufs);
+#endif
+#endif /* GL_EXT_draw_buffers */
+
+#ifndef GL_EXT_draw_buffers_indexed
+#define GL_EXT_draw_buffers_indexed 1
+#define GL_MIN                            0x8007
+#define GL_MAX                            0x8008
+typedef void (GL_APIENTRYP PFNGLENABLEIEXTPROC) (GLenum target, GLuint index);
+typedef void (GL_APIENTRYP PFNGLDISABLEIEXTPROC) (GLenum target, GLuint index);
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONIEXTPROC) (GLuint buf, GLenum mode);
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEIEXTPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCIEXTPROC) (GLuint buf, GLenum src, GLenum dst);
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEIEXTPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+typedef void (GL_APIENTRYP PFNGLCOLORMASKIEXTPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
+typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDIEXTPROC) (GLenum target, GLuint index);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glEnableiEXT (GLenum target, GLuint index);
+GL_APICALL void GL_APIENTRY glDisableiEXT (GLenum target, GLuint index);
+GL_APICALL void GL_APIENTRY glBlendEquationiEXT (GLuint buf, GLenum mode);
+GL_APICALL void GL_APIENTRY glBlendEquationSeparateiEXT (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+GL_APICALL void GL_APIENTRY glBlendFunciEXT (GLuint buf, GLenum src, GLenum dst);
+GL_APICALL void GL_APIENTRY glBlendFuncSeparateiEXT (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+GL_APICALL void GL_APIENTRY glColorMaskiEXT (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
+GL_APICALL GLboolean GL_APIENTRY glIsEnablediEXT (GLenum target, GLuint index);
+#endif
+#endif /* GL_EXT_draw_buffers_indexed */
+
+#ifndef GL_EXT_draw_instanced
+#define GL_EXT_draw_instanced 1
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawArraysInstancedEXT (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glDrawElementsInstancedEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+#endif
+#endif /* GL_EXT_draw_instanced */
+
+#ifndef GL_EXT_geometry_point_size
+#define GL_EXT_geometry_point_size 1
+#endif /* GL_EXT_geometry_point_size */
+
+#ifndef GL_EXT_geometry_shader
+#define GL_EXT_geometry_shader 1
+#define GL_GEOMETRY_SHADER_EXT            0x8DD9
+#define GL_GEOMETRY_SHADER_BIT_EXT        0x00000004
+#define GL_GEOMETRY_LINKED_VERTICES_OUT_EXT 0x8916
+#define GL_GEOMETRY_LINKED_INPUT_TYPE_EXT 0x8917
+#define GL_GEOMETRY_LINKED_OUTPUT_TYPE_EXT 0x8918
+#define GL_GEOMETRY_SHADER_INVOCATIONS_EXT 0x887F
+#define GL_LAYER_PROVOKING_VERTEX_EXT     0x825E
+#define GL_LINES_ADJACENCY_EXT            0x000A
+#define GL_LINE_STRIP_ADJACENCY_EXT       0x000B
+#define GL_TRIANGLES_ADJACENCY_EXT        0x000C
+#define GL_TRIANGLE_STRIP_ADJACENCY_EXT   0x000D
+#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF
+#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT 0x8A2C
+#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8A32
+#define GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT 0x9123
+#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT 0x9124
+#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0
+#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1
+#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT 0x8E5A
+#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29
+#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT 0x92CF
+#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT 0x92D5
+#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT 0x90CD
+#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT 0x90D7
+#define GL_FIRST_VERTEX_CONVENTION_EXT    0x8E4D
+#define GL_LAST_VERTEX_CONVENTION_EXT     0x8E4E
+#define GL_UNDEFINED_VERTEX_EXT           0x8260
+#define GL_PRIMITIVES_GENERATED_EXT       0x8C87
+#define GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT 0x9312
+#define GL_MAX_FRAMEBUFFER_LAYERS_EXT     0x9317
+#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8
+#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7
+#define GL_REFERENCED_BY_GEOMETRY_SHADER_EXT 0x9309
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glFramebufferTextureEXT (GLenum target, GLenum attachment, GLuint texture, GLint level);
+#endif
+#endif /* GL_EXT_geometry_shader */
+
+#ifndef GL_EXT_gpu_shader5
+#define GL_EXT_gpu_shader5 1
+#endif /* GL_EXT_gpu_shader5 */
+
+#ifndef GL_EXT_instanced_arrays
+#define GL_EXT_instanced_arrays 1
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_EXT 0x88FE
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISOREXTPROC) (GLuint index, GLuint divisor);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glVertexAttribDivisorEXT (GLuint index, GLuint divisor);
+#endif
+#endif /* GL_EXT_instanced_arrays */
+
+#ifndef GL_EXT_map_buffer_range
+#define GL_EXT_map_buffer_range 1
+#define GL_MAP_READ_BIT_EXT               0x0001
+#define GL_MAP_WRITE_BIT_EXT              0x0002
+#define GL_MAP_INVALIDATE_RANGE_BIT_EXT   0x0004
+#define GL_MAP_INVALIDATE_BUFFER_BIT_EXT  0x0008
+#define GL_MAP_FLUSH_EXPLICIT_BIT_EXT     0x0010
+#define GL_MAP_UNSYNCHRONIZED_BIT_EXT     0x0020
+typedef void *(GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void *GL_APIENTRY glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+GL_APICALL void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length);
+#endif
+#endif /* GL_EXT_map_buffer_range */
+
+#ifndef GL_EXT_multi_draw_arrays
+#define GL_EXT_multi_draw_arrays 1
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount);
+#endif
+#endif /* GL_EXT_multi_draw_arrays */
+
+#ifndef GL_EXT_multisampled_render_to_texture
+#define GL_EXT_multisampled_render_to_texture 1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C
+#define GL_RENDERBUFFER_SAMPLES_EXT       0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
+#define GL_MAX_SAMPLES_EXT                0x8D57
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
+#endif
+#endif /* GL_EXT_multisampled_render_to_texture */
+
+#ifndef GL_EXT_multiview_draw_buffers
+#define GL_EXT_multiview_draw_buffers 1
+#define GL_COLOR_ATTACHMENT_EXT           0x90F0
+#define GL_MULTIVIEW_EXT                  0x90F1
+#define GL_DRAW_BUFFER_EXT                0x0C01
+#define GL_READ_BUFFER_EXT                0x0C02
+#define GL_MAX_MULTIVIEW_BUFFERS_EXT      0x90F2
+typedef void (GL_APIENTRYP PFNGLREADBUFFERINDEXEDEXTPROC) (GLenum src, GLint index);
+typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSINDEXEDEXTPROC) (GLint n, const GLenum *location, const GLint *indices);
+typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VEXTPROC) (GLenum target, GLuint index, GLint *data);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glReadBufferIndexedEXT (GLenum src, GLint index);
+GL_APICALL void GL_APIENTRY glDrawBuffersIndexedEXT (GLint n, const GLenum *location, const GLint *indices);
+GL_APICALL void GL_APIENTRY glGetIntegeri_vEXT (GLenum target, GLuint index, GLint *data);
+#endif
+#endif /* GL_EXT_multiview_draw_buffers */
+
+#ifndef GL_EXT_occlusion_query_boolean
+#define GL_EXT_occlusion_query_boolean 1
+#define GL_ANY_SAMPLES_PASSED_EXT         0x8C2F
+#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A
+#endif /* GL_EXT_occlusion_query_boolean */
+
+#ifndef GL_EXT_primitive_bounding_box
+#define GL_EXT_primitive_bounding_box 1
+#define GL_PRIMITIVE_BOUNDING_BOX_EXT     0x92BE
+typedef void (GL_APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXEXTPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glPrimitiveBoundingBoxEXT (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
+#endif
+#endif /* GL_EXT_primitive_bounding_box */
+
+#ifndef GL_EXT_pvrtc_sRGB
+#define GL_EXT_pvrtc_sRGB 1
+#define GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT 0x8A54
+#define GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT 0x8A55
+#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT 0x8A56
+#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT 0x8A57
+#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG 0x93F0
+#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2_IMG 0x93F1
+#endif /* GL_EXT_pvrtc_sRGB */
+
+#ifndef GL_EXT_read_format_bgra
+#define GL_EXT_read_format_bgra 1
+#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_read_format_bgra */
+
+#ifndef GL_EXT_robustness
+#define GL_EXT_robustness 1
+#define GL_GUILTY_CONTEXT_RESET_EXT       0x8253
+#define GL_INNOCENT_CONTEXT_RESET_EXT     0x8254
+#define GL_UNKNOWN_CONTEXT_RESET_EXT      0x8255
+#define GL_CONTEXT_ROBUST_ACCESS_EXT      0x90F3
+#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256
+#define GL_LOSE_CONTEXT_ON_RESET_EXT      0x8252
+#define GL_NO_RESET_NOTIFICATION_EXT      0x8261
+typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void);
+typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void);
+GL_APICALL void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+GL_APICALL void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+#endif
+#endif /* GL_EXT_robustness */
+
+#ifndef GL_EXT_sRGB
+#define GL_EXT_sRGB 1
+#define GL_SRGB_EXT                       0x8C40
+#define GL_SRGB_ALPHA_EXT                 0x8C42
+#define GL_SRGB8_ALPHA8_EXT               0x8C43
+#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210
+#endif /* GL_EXT_sRGB */
+
+#ifndef GL_EXT_sRGB_write_control
+#define GL_EXT_sRGB_write_control 1
+#define GL_FRAMEBUFFER_SRGB_EXT           0x8DB9
+#endif /* GL_EXT_sRGB_write_control */
+
+#ifndef GL_EXT_separate_shader_objects
+#define GL_EXT_separate_shader_objects 1
+#define GL_ACTIVE_PROGRAM_EXT             0x8259
+#define GL_VERTEX_SHADER_BIT_EXT          0x00000001
+#define GL_FRAGMENT_SHADER_BIT_EXT        0x00000002
+#define GL_ALL_SHADER_BITS_EXT            0xFFFFFFFF
+#define GL_PROGRAM_SEPARABLE_EXT          0x8258
+#define GL_PROGRAM_PIPELINE_BINDING_EXT   0x825A
+typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program);
+typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
+typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings);
+typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines);
+typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params);
+typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
+typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program);
+typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glActiveShaderProgramEXT (GLuint pipeline, GLuint program);
+GL_APICALL void GL_APIENTRY glBindProgramPipelineEXT (GLuint pipeline);
+GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvEXT (GLenum type, GLsizei count, const GLchar **strings);
+GL_APICALL void GL_APIENTRY glDeleteProgramPipelinesEXT (GLsizei n, const GLuint *pipelines);
+GL_APICALL void GL_APIENTRY glGenProgramPipelinesEXT (GLsizei n, GLuint *pipelines);
+GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogEXT (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GL_APICALL void GL_APIENTRY glGetProgramPipelineivEXT (GLuint pipeline, GLenum pname, GLint *params);
+GL_APICALL GLboolean GL_APIENTRY glIsProgramPipelineEXT (GLuint pipeline);
+GL_APICALL void GL_APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value);
+GL_APICALL void GL_APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat v0);
+GL_APICALL void GL_APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint v0);
+GL_APICALL void GL_APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1);
+GL_APICALL void GL_APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint v0, GLint v1);
+GL_APICALL void GL_APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+GL_APICALL void GL_APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
+GL_APICALL void GL_APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+GL_APICALL void GL_APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+GL_APICALL void GL_APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUseProgramStagesEXT (GLuint pipeline, GLbitfield stages, GLuint program);
+GL_APICALL void GL_APIENTRY glValidateProgramPipelineEXT (GLuint pipeline);
+GL_APICALL void GL_APIENTRY glProgramUniform1uiEXT (GLuint program, GLint location, GLuint v0);
+GL_APICALL void GL_APIENTRY glProgramUniform2uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1);
+GL_APICALL void GL_APIENTRY glProgramUniform3uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
+GL_APICALL void GL_APIENTRY glProgramUniform4uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+GL_APICALL void GL_APIENTRY glProgramUniform1uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+#endif
+#endif /* GL_EXT_separate_shader_objects */
+
+#ifndef GL_EXT_shader_framebuffer_fetch
+#define GL_EXT_shader_framebuffer_fetch 1
+#define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52
+#endif /* GL_EXT_shader_framebuffer_fetch */
+
+#ifndef GL_EXT_shader_implicit_conversions
+#define GL_EXT_shader_implicit_conversions 1
+#endif /* GL_EXT_shader_implicit_conversions */
+
+#ifndef GL_EXT_shader_integer_mix
+#define GL_EXT_shader_integer_mix 1
+#endif /* GL_EXT_shader_integer_mix */
+
+#ifndef GL_EXT_shader_io_blocks
+#define GL_EXT_shader_io_blocks 1
+#endif /* GL_EXT_shader_io_blocks */
+
+#ifndef GL_EXT_shader_pixel_local_storage
+#define GL_EXT_shader_pixel_local_storage 1
+#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_FAST_SIZE_EXT 0x8F63
+#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_SIZE_EXT 0x8F67
+#define GL_SHADER_PIXEL_LOCAL_STORAGE_EXT 0x8F64
+#endif /* GL_EXT_shader_pixel_local_storage */
+
+#ifndef GL_EXT_shader_texture_lod
+#define GL_EXT_shader_texture_lod 1
+#endif /* GL_EXT_shader_texture_lod */
+
+#ifndef GL_EXT_shadow_samplers
+#define GL_EXT_shadow_samplers 1
+#define GL_TEXTURE_COMPARE_MODE_EXT       0x884C
+#define GL_TEXTURE_COMPARE_FUNC_EXT       0x884D
+#define GL_COMPARE_REF_TO_TEXTURE_EXT     0x884E
+#define GL_SAMPLER_2D_SHADOW_EXT          0x8B62
+#endif /* GL_EXT_shadow_samplers */
+
+#ifndef GL_EXT_tessellation_point_size
+#define GL_EXT_tessellation_point_size 1
+#endif /* GL_EXT_tessellation_point_size */
+
+#ifndef GL_EXT_tessellation_shader
+#define GL_EXT_tessellation_shader 1
+#define GL_PATCHES_EXT                    0x000E
+#define GL_PATCH_VERTICES_EXT             0x8E72
+#define GL_TESS_CONTROL_OUTPUT_VERTICES_EXT 0x8E75
+#define GL_TESS_GEN_MODE_EXT              0x8E76
+#define GL_TESS_GEN_SPACING_EXT           0x8E77
+#define GL_TESS_GEN_VERTEX_ORDER_EXT      0x8E78
+#define GL_TESS_GEN_POINT_MODE_EXT        0x8E79
+#define GL_ISOLINES_EXT                   0x8E7A
+#define GL_QUADS_EXT                      0x0007
+#define GL_FRACTIONAL_ODD_EXT             0x8E7B
+#define GL_FRACTIONAL_EVEN_EXT            0x8E7C
+#define GL_MAX_PATCH_VERTICES_EXT         0x8E7D
+#define GL_MAX_TESS_GEN_LEVEL_EXT         0x8E7E
+#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E7F
+#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E80
+#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_EXT 0x8E81
+#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_EXT 0x8E82
+#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_EXT 0x8E83
+#define GL_MAX_TESS_PATCH_COMPONENTS_EXT  0x8E84
+#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_EXT 0x8E85
+#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_EXT 0x8E86
+#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_EXT 0x8E89
+#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_EXT 0x8E8A
+#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_EXT 0x886C
+#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_EXT 0x886D
+#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E1E
+#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E1F
+#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_EXT 0x92CD
+#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_EXT 0x92CE
+#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_EXT 0x92D3
+#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_EXT 0x92D4
+#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_EXT 0x90CB
+#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_EXT 0x90CC
+#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_EXT 0x90D8
+#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_EXT 0x90D9
+#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221
+#define GL_IS_PER_PATCH_EXT               0x92E7
+#define GL_REFERENCED_BY_TESS_CONTROL_SHADER_EXT 0x9307
+#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER_EXT 0x9308
+#define GL_TESS_CONTROL_SHADER_EXT        0x8E88
+#define GL_TESS_EVALUATION_SHADER_EXT     0x8E87
+#define GL_TESS_CONTROL_SHADER_BIT_EXT    0x00000008
+#define GL_TESS_EVALUATION_SHADER_BIT_EXT 0x00000010
+typedef void (GL_APIENTRYP PFNGLPATCHPARAMETERIEXTPROC) (GLenum pname, GLint value);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glPatchParameteriEXT (GLenum pname, GLint value);
+#endif
+#endif /* GL_EXT_tessellation_shader */
+
+#ifndef GL_EXT_texture_border_clamp
+#define GL_EXT_texture_border_clamp 1
+#define GL_TEXTURE_BORDER_COLOR_EXT       0x1004
+#define GL_CLAMP_TO_BORDER_EXT            0x812D
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVEXTPROC) (GLuint sampler, GLenum pname, const GLint *param);
+typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVEXTPROC) (GLuint sampler, GLenum pname, const GLuint *param);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVEXTPROC) (GLuint sampler, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVEXTPROC) (GLuint sampler, GLenum pname, GLuint *params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexParameterIivEXT (GLenum target, GLenum pname, const GLint *params);
+GL_APICALL void GL_APIENTRY glTexParameterIuivEXT (GLenum target, GLenum pname, const GLuint *params);
+GL_APICALL void GL_APIENTRY glGetTexParameterIivEXT (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetTexParameterIuivEXT (GLenum target, GLenum pname, GLuint *params);
+GL_APICALL void GL_APIENTRY glSamplerParameterIivEXT (GLuint sampler, GLenum pname, const GLint *param);
+GL_APICALL void GL_APIENTRY glSamplerParameterIuivEXT (GLuint sampler, GLenum pname, const GLuint *param);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterIivEXT (GLuint sampler, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterIuivEXT (GLuint sampler, GLenum pname, GLuint *params);
+#endif
+#endif /* GL_EXT_texture_border_clamp */
+
+#ifndef GL_EXT_texture_buffer
+#define GL_EXT_texture_buffer 1
+#define GL_TEXTURE_BUFFER_EXT             0x8C2A
+#define GL_TEXTURE_BUFFER_BINDING_EXT     0x8C2A
+#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT    0x8C2B
+#define GL_TEXTURE_BINDING_BUFFER_EXT     0x8C2C
+#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D
+#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_EXT 0x919F
+#define GL_SAMPLER_BUFFER_EXT             0x8DC2
+#define GL_INT_SAMPLER_BUFFER_EXT         0x8DD0
+#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8
+#define GL_IMAGE_BUFFER_EXT               0x9051
+#define GL_INT_IMAGE_BUFFER_EXT           0x905C
+#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT  0x9067
+#define GL_TEXTURE_BUFFER_OFFSET_EXT      0x919D
+#define GL_TEXTURE_BUFFER_SIZE_EXT        0x919E
+typedef void (GL_APIENTRYP PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer);
+typedef void (GL_APIENTRYP PFNGLTEXBUFFERRANGEEXTPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexBufferEXT (GLenum target, GLenum internalformat, GLuint buffer);
+GL_APICALL void GL_APIENTRY glTexBufferRangeEXT (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
+#endif
+#endif /* GL_EXT_texture_buffer */
+
+#ifndef GL_EXT_texture_compression_dxt1
+#define GL_EXT_texture_compression_dxt1 1
+#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT   0x83F0
+#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT  0x83F1
+#endif /* GL_EXT_texture_compression_dxt1 */
+
+#ifndef GL_EXT_texture_compression_s3tc
+#define GL_EXT_texture_compression_s3tc 1
+#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT  0x83F2
+#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT  0x83F3
+#endif /* GL_EXT_texture_compression_s3tc */
+
+#ifndef GL_EXT_texture_cube_map_array
+#define GL_EXT_texture_cube_map_array 1
+#define GL_TEXTURE_CUBE_MAP_ARRAY_EXT     0x9009
+#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_EXT 0x900A
+#define GL_SAMPLER_CUBE_MAP_ARRAY_EXT     0x900C
+#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_EXT 0x900D
+#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900E
+#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900F
+#define GL_IMAGE_CUBE_MAP_ARRAY_EXT       0x9054
+#define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT   0x905F
+#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A
+#endif /* GL_EXT_texture_cube_map_array */
+
+#ifndef GL_EXT_texture_filter_anisotropic
+#define GL_EXT_texture_filter_anisotropic 1
+#define GL_TEXTURE_MAX_ANISOTROPY_EXT     0x84FE
+#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
+#endif /* GL_EXT_texture_filter_anisotropic */
+
+#ifndef GL_EXT_texture_format_BGRA8888
+#define GL_EXT_texture_format_BGRA8888 1
+#endif /* GL_EXT_texture_format_BGRA8888 */
+
+#ifndef GL_EXT_texture_rg
+#define GL_EXT_texture_rg 1
+#define GL_RED_EXT                        0x1903
+#define GL_RG_EXT                         0x8227
+#define GL_R8_EXT                         0x8229
+#define GL_RG8_EXT                        0x822B
+#endif /* GL_EXT_texture_rg */
+
+#ifndef GL_EXT_texture_sRGB_decode
+#define GL_EXT_texture_sRGB_decode 1
+#define GL_TEXTURE_SRGB_DECODE_EXT        0x8A48
+#define GL_DECODE_EXT                     0x8A49
+#define GL_SKIP_DECODE_EXT                0x8A4A
+#endif /* GL_EXT_texture_sRGB_decode */
+
+#ifndef GL_EXT_texture_storage
+#define GL_EXT_texture_storage 1
+#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT   0x912F
+#define GL_ALPHA8_EXT                     0x803C
+#define GL_LUMINANCE8_EXT                 0x8040
+#define GL_LUMINANCE8_ALPHA8_EXT          0x8045
+#define GL_RGBA32F_EXT                    0x8814
+#define GL_RGB32F_EXT                     0x8815
+#define GL_ALPHA32F_EXT                   0x8816
+#define GL_LUMINANCE32F_EXT               0x8818
+#define GL_LUMINANCE_ALPHA32F_EXT         0x8819
+#define GL_ALPHA16F_EXT                   0x881C
+#define GL_LUMINANCE16F_EXT               0x881E
+#define GL_LUMINANCE_ALPHA16F_EXT         0x881F
+#define GL_R32F_EXT                       0x822E
+#define GL_RG32F_EXT                      0x8230
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+GL_APICALL void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+GL_APICALL void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+GL_APICALL void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+#endif
+#endif /* GL_EXT_texture_storage */
+
+#ifndef GL_EXT_texture_type_2_10_10_10_REV
+#define GL_EXT_texture_type_2_10_10_10_REV 1
+#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368
+#endif /* GL_EXT_texture_type_2_10_10_10_REV */
+
+#ifndef GL_EXT_texture_view
+#define GL_EXT_texture_view 1
+#define GL_TEXTURE_VIEW_MIN_LEVEL_EXT     0x82DB
+#define GL_TEXTURE_VIEW_NUM_LEVELS_EXT    0x82DC
+#define GL_TEXTURE_VIEW_MIN_LAYER_EXT     0x82DD
+#define GL_TEXTURE_VIEW_NUM_LAYERS_EXT    0x82DE
+#define GL_TEXTURE_IMMUTABLE_LEVELS       0x82DF
+typedef void (GL_APIENTRYP PFNGLTEXTUREVIEWEXTPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTextureViewEXT (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
+#endif
+#endif /* GL_EXT_texture_view */
+
+#ifndef GL_EXT_unpack_subimage
+#define GL_EXT_unpack_subimage 1
+#define GL_UNPACK_ROW_LENGTH_EXT          0x0CF2
+#define GL_UNPACK_SKIP_ROWS_EXT           0x0CF3
+#define GL_UNPACK_SKIP_PIXELS_EXT         0x0CF4
+#endif /* GL_EXT_unpack_subimage */
+
+#ifndef GL_FJ_shader_binary_GCCSO
+#define GL_FJ_shader_binary_GCCSO 1
+#define GL_GCCSO_SHADER_BINARY_FJ         0x9260
+#endif /* GL_FJ_shader_binary_GCCSO */
+
+#ifndef GL_IMG_multisampled_render_to_texture
+#define GL_IMG_multisampled_render_to_texture 1
+#define GL_RENDERBUFFER_SAMPLES_IMG       0x9133
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134
+#define GL_MAX_SAMPLES_IMG                0x9135
+#define GL_TEXTURE_SAMPLES_IMG            0x9136
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
+#endif
+#endif /* GL_IMG_multisampled_render_to_texture */
+
+#ifndef GL_IMG_program_binary
+#define GL_IMG_program_binary 1
+#define GL_SGX_PROGRAM_BINARY_IMG         0x9130
+#endif /* GL_IMG_program_binary */
+
+#ifndef GL_IMG_read_format
+#define GL_IMG_read_format 1
+#define GL_BGRA_IMG                       0x80E1
+#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365
+#endif /* GL_IMG_read_format */
+
+#ifndef GL_IMG_shader_binary
+#define GL_IMG_shader_binary 1
+#define GL_SGX_BINARY_IMG                 0x8C0A
+#endif /* GL_IMG_shader_binary */
+
+#ifndef GL_IMG_texture_compression_pvrtc
+#define GL_IMG_texture_compression_pvrtc 1
+#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_compression_pvrtc */
+
+#ifndef GL_IMG_texture_compression_pvrtc2
+#define GL_IMG_texture_compression_pvrtc2 1
+#define GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG 0x9137
+#define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138
+#endif /* GL_IMG_texture_compression_pvrtc2 */
+
+#ifndef GL_INTEL_performance_query
+#define GL_INTEL_performance_query 1
+#define GL_PERFQUERY_SINGLE_CONTEXT_INTEL 0x00000000
+#define GL_PERFQUERY_GLOBAL_CONTEXT_INTEL 0x00000001
+#define GL_PERFQUERY_WAIT_INTEL           0x83FB
+#define GL_PERFQUERY_FLUSH_INTEL          0x83FA
+#define GL_PERFQUERY_DONOT_FLUSH_INTEL    0x83F9
+#define GL_PERFQUERY_COUNTER_EVENT_INTEL  0x94F0
+#define GL_PERFQUERY_COUNTER_DURATION_NORM_INTEL 0x94F1
+#define GL_PERFQUERY_COUNTER_DURATION_RAW_INTEL 0x94F2
+#define GL_PERFQUERY_COUNTER_THROUGHPUT_INTEL 0x94F3
+#define GL_PERFQUERY_COUNTER_RAW_INTEL    0x94F4
+#define GL_PERFQUERY_COUNTER_TIMESTAMP_INTEL 0x94F5
+#define GL_PERFQUERY_COUNTER_DATA_UINT32_INTEL 0x94F8
+#define GL_PERFQUERY_COUNTER_DATA_UINT64_INTEL 0x94F9
+#define GL_PERFQUERY_COUNTER_DATA_FLOAT_INTEL 0x94FA
+#define GL_PERFQUERY_COUNTER_DATA_DOUBLE_INTEL 0x94FB
+#define GL_PERFQUERY_COUNTER_DATA_BOOL32_INTEL 0x94FC
+#define GL_PERFQUERY_QUERY_NAME_LENGTH_MAX_INTEL 0x94FD
+#define GL_PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL 0x94FE
+#define GL_PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL 0x94FF
+#define GL_PERFQUERY_GPA_EXTENDED_COUNTERS_INTEL 0x9500
+typedef void (GL_APIENTRYP PFNGLBEGINPERFQUERYINTELPROC) (GLuint queryHandle);
+typedef void (GL_APIENTRYP PFNGLCREATEPERFQUERYINTELPROC) (GLuint queryId, GLuint *queryHandle);
+typedef void (GL_APIENTRYP PFNGLDELETEPERFQUERYINTELPROC) (GLuint queryHandle);
+typedef void (GL_APIENTRYP PFNGLENDPERFQUERYINTELPROC) (GLuint queryHandle);
+typedef void (GL_APIENTRYP PFNGLGETFIRSTPERFQUERYIDINTELPROC) (GLuint *queryId);
+typedef void (GL_APIENTRYP PFNGLGETNEXTPERFQUERYIDINTELPROC) (GLuint queryId, GLuint *nextQueryId);
+typedef void (GL_APIENTRYP PFNGLGETPERFCOUNTERINFOINTELPROC) (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue);
+typedef void (GL_APIENTRYP PFNGLGETPERFQUERYDATAINTELPROC) (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten);
+typedef void (GL_APIENTRYP PFNGLGETPERFQUERYIDBYNAMEINTELPROC) (GLchar *queryName, GLuint *queryId);
+typedef void (GL_APIENTRYP PFNGLGETPERFQUERYINFOINTELPROC) (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBeginPerfQueryINTEL (GLuint queryHandle);
+GL_APICALL void GL_APIENTRY glCreatePerfQueryINTEL (GLuint queryId, GLuint *queryHandle);
+GL_APICALL void GL_APIENTRY glDeletePerfQueryINTEL (GLuint queryHandle);
+GL_APICALL void GL_APIENTRY glEndPerfQueryINTEL (GLuint queryHandle);
+GL_APICALL void GL_APIENTRY glGetFirstPerfQueryIdINTEL (GLuint *queryId);
+GL_APICALL void GL_APIENTRY glGetNextPerfQueryIdINTEL (GLuint queryId, GLuint *nextQueryId);
+GL_APICALL void GL_APIENTRY glGetPerfCounterInfoINTEL (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue);
+GL_APICALL void GL_APIENTRY glGetPerfQueryDataINTEL (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten);
+GL_APICALL void GL_APIENTRY glGetPerfQueryIdByNameINTEL (GLchar *queryName, GLuint *queryId);
+GL_APICALL void GL_APIENTRY glGetPerfQueryInfoINTEL (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask);
+#endif
+#endif /* GL_INTEL_performance_query */
+
+#ifndef GL_NV_blend_equation_advanced
+#define GL_NV_blend_equation_advanced 1
+#define GL_BLEND_OVERLAP_NV               0x9281
+#define GL_BLEND_PREMULTIPLIED_SRC_NV     0x9280
+#define GL_BLUE_NV                        0x1905
+#define GL_COLORBURN_NV                   0x929A
+#define GL_COLORDODGE_NV                  0x9299
+#define GL_CONJOINT_NV                    0x9284
+#define GL_CONTRAST_NV                    0x92A1
+#define GL_DARKEN_NV                      0x9297
+#define GL_DIFFERENCE_NV                  0x929E
+#define GL_DISJOINT_NV                    0x9283
+#define GL_DST_ATOP_NV                    0x928F
+#define GL_DST_IN_NV                      0x928B
+#define GL_DST_NV                         0x9287
+#define GL_DST_OUT_NV                     0x928D
+#define GL_DST_OVER_NV                    0x9289
+#define GL_EXCLUSION_NV                   0x92A0
+#define GL_GREEN_NV                       0x1904
+#define GL_HARDLIGHT_NV                   0x929B
+#define GL_HARDMIX_NV                     0x92A9
+#define GL_HSL_COLOR_NV                   0x92AF
+#define GL_HSL_HUE_NV                     0x92AD
+#define GL_HSL_LUMINOSITY_NV              0x92B0
+#define GL_HSL_SATURATION_NV              0x92AE
+#define GL_INVERT_OVG_NV                  0x92B4
+#define GL_INVERT_RGB_NV                  0x92A3
+#define GL_LIGHTEN_NV                     0x9298
+#define GL_LINEARBURN_NV                  0x92A5
+#define GL_LINEARDODGE_NV                 0x92A4
+#define GL_LINEARLIGHT_NV                 0x92A7
+#define GL_MINUS_CLAMPED_NV               0x92B3
+#define GL_MINUS_NV                       0x929F
+#define GL_MULTIPLY_NV                    0x9294
+#define GL_OVERLAY_NV                     0x9296
+#define GL_PINLIGHT_NV                    0x92A8
+#define GL_PLUS_CLAMPED_ALPHA_NV          0x92B2
+#define GL_PLUS_CLAMPED_NV                0x92B1
+#define GL_PLUS_DARKER_NV                 0x9292
+#define GL_PLUS_NV                        0x9291
+#define GL_RED_NV                         0x1903
+#define GL_SCREEN_NV                      0x9295
+#define GL_SOFTLIGHT_NV                   0x929C
+#define GL_SRC_ATOP_NV                    0x928E
+#define GL_SRC_IN_NV                      0x928A
+#define GL_SRC_NV                         0x9286
+#define GL_SRC_OUT_NV                     0x928C
+#define GL_SRC_OVER_NV                    0x9288
+#define GL_UNCORRELATED_NV                0x9282
+#define GL_VIVIDLIGHT_NV                  0x92A6
+#define GL_XOR_NV                         0x1506
+typedef void (GL_APIENTRYP PFNGLBLENDPARAMETERINVPROC) (GLenum pname, GLint value);
+typedef void (GL_APIENTRYP PFNGLBLENDBARRIERNVPROC) (void);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBlendParameteriNV (GLenum pname, GLint value);
+GL_APICALL void GL_APIENTRY glBlendBarrierNV (void);
+#endif
+#endif /* GL_NV_blend_equation_advanced */
+
+#ifndef GL_NV_blend_equation_advanced_coherent
+#define GL_NV_blend_equation_advanced_coherent 1
+#define GL_BLEND_ADVANCED_COHERENT_NV     0x9285
+#endif /* GL_NV_blend_equation_advanced_coherent */
+
+#ifndef GL_NV_copy_buffer
+#define GL_NV_copy_buffer 1
+#define GL_COPY_READ_BUFFER_NV            0x8F36
+#define GL_COPY_WRITE_BUFFER_NV           0x8F37
+typedef void (GL_APIENTRYP PFNGLCOPYBUFFERSUBDATANVPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCopyBufferSubDataNV (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+#endif
+#endif /* GL_NV_copy_buffer */
+
+#ifndef GL_NV_coverage_sample
+#define GL_NV_coverage_sample 1
+#define GL_COVERAGE_COMPONENT_NV          0x8ED0
+#define GL_COVERAGE_COMPONENT4_NV         0x8ED1
+#define GL_COVERAGE_ATTACHMENT_NV         0x8ED2
+#define GL_COVERAGE_BUFFERS_NV            0x8ED3
+#define GL_COVERAGE_SAMPLES_NV            0x8ED4
+#define GL_COVERAGE_ALL_FRAGMENTS_NV      0x8ED5
+#define GL_COVERAGE_EDGE_FRAGMENTS_NV     0x8ED6
+#define GL_COVERAGE_AUTOMATIC_NV          0x8ED7
+#define GL_COVERAGE_BUFFER_BIT_NV         0x00008000
+typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask);
+typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask);
+GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation);
+#endif
+#endif /* GL_NV_coverage_sample */
+
+#ifndef GL_NV_depth_nonlinear
+#define GL_NV_depth_nonlinear 1
+#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C
+#endif /* GL_NV_depth_nonlinear */
+
+#ifndef GL_NV_draw_buffers
+#define GL_NV_draw_buffers 1
+#define GL_MAX_DRAW_BUFFERS_NV            0x8824
+#define GL_DRAW_BUFFER0_NV                0x8825
+#define GL_DRAW_BUFFER1_NV                0x8826
+#define GL_DRAW_BUFFER2_NV                0x8827
+#define GL_DRAW_BUFFER3_NV                0x8828
+#define GL_DRAW_BUFFER4_NV                0x8829
+#define GL_DRAW_BUFFER5_NV                0x882A
+#define GL_DRAW_BUFFER6_NV                0x882B
+#define GL_DRAW_BUFFER7_NV                0x882C
+#define GL_DRAW_BUFFER8_NV                0x882D
+#define GL_DRAW_BUFFER9_NV                0x882E
+#define GL_DRAW_BUFFER10_NV               0x882F
+#define GL_DRAW_BUFFER11_NV               0x8830
+#define GL_DRAW_BUFFER12_NV               0x8831
+#define GL_DRAW_BUFFER13_NV               0x8832
+#define GL_DRAW_BUFFER14_NV               0x8833
+#define GL_DRAW_BUFFER15_NV               0x8834
+#define GL_COLOR_ATTACHMENT0_NV           0x8CE0
+#define GL_COLOR_ATTACHMENT1_NV           0x8CE1
+#define GL_COLOR_ATTACHMENT2_NV           0x8CE2
+#define GL_COLOR_ATTACHMENT3_NV           0x8CE3
+#define GL_COLOR_ATTACHMENT4_NV           0x8CE4
+#define GL_COLOR_ATTACHMENT5_NV           0x8CE5
+#define GL_COLOR_ATTACHMENT6_NV           0x8CE6
+#define GL_COLOR_ATTACHMENT7_NV           0x8CE7
+#define GL_COLOR_ATTACHMENT8_NV           0x8CE8
+#define GL_COLOR_ATTACHMENT9_NV           0x8CE9
+#define GL_COLOR_ATTACHMENT10_NV          0x8CEA
+#define GL_COLOR_ATTACHMENT11_NV          0x8CEB
+#define GL_COLOR_ATTACHMENT12_NV          0x8CEC
+#define GL_COLOR_ATTACHMENT13_NV          0x8CED
+#define GL_COLOR_ATTACHMENT14_NV          0x8CEE
+#define GL_COLOR_ATTACHMENT15_NV          0x8CEF
+typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawBuffersNV (GLsizei n, const GLenum *bufs);
+#endif
+#endif /* GL_NV_draw_buffers */
+
+#ifndef GL_NV_draw_instanced
+#define GL_NV_draw_instanced 1
+typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDNVPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDNVPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawArraysInstancedNV (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glDrawElementsInstancedNV (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+#endif
+#endif /* GL_NV_draw_instanced */
+
+#ifndef GL_NV_explicit_attrib_location
+#define GL_NV_explicit_attrib_location 1
+#endif /* GL_NV_explicit_attrib_location */
+
+#ifndef GL_NV_fbo_color_attachments
+#define GL_NV_fbo_color_attachments 1
+#define GL_MAX_COLOR_ATTACHMENTS_NV       0x8CDF
+#endif /* GL_NV_fbo_color_attachments */
+
+#ifndef GL_NV_fence
+#define GL_NV_fence 1
+#define GL_ALL_COMPLETED_NV               0x84F2
+#define GL_FENCE_STATUS_NV                0x84F3
+#define GL_FENCE_CONDITION_NV             0x84F4
+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);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences);
+GL_APICALL void GL_APIENTRY glGenFencesNV (GLsizei n, GLuint *fences);
+GL_APICALL GLboolean GL_APIENTRY glIsFenceNV (GLuint fence);
+GL_APICALL GLboolean GL_APIENTRY glTestFenceNV (GLuint fence);
+GL_APICALL void GL_APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glFinishFenceNV (GLuint fence);
+GL_APICALL void GL_APIENTRY glSetFenceNV (GLuint fence, GLenum condition);
+#endif
+#endif /* GL_NV_fence */
+
+#ifndef GL_NV_framebuffer_blit
+#define GL_NV_framebuffer_blit 1
+#define GL_READ_FRAMEBUFFER_NV            0x8CA8
+#define GL_DRAW_FRAMEBUFFER_NV            0x8CA9
+#define GL_DRAW_FRAMEBUFFER_BINDING_NV    0x8CA6
+#define GL_READ_FRAMEBUFFER_BINDING_NV    0x8CAA
+typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERNVPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBlitFramebufferNV (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#endif
+#endif /* GL_NV_framebuffer_blit */
+
+#ifndef GL_NV_framebuffer_multisample
+#define GL_NV_framebuffer_multisample 1
+#define GL_RENDERBUFFER_SAMPLES_NV        0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_NV 0x8D56
+#define GL_MAX_SAMPLES_NV                 0x8D57
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLENVPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleNV (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+#endif
+#endif /* GL_NV_framebuffer_multisample */
+
+#ifndef GL_NV_generate_mipmap_sRGB
+#define GL_NV_generate_mipmap_sRGB 1
+#endif /* GL_NV_generate_mipmap_sRGB */
+
+#ifndef GL_NV_instanced_arrays
+#define GL_NV_instanced_arrays 1
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_NV 0x88FE
+typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORNVPROC) (GLuint index, GLuint divisor);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glVertexAttribDivisorNV (GLuint index, GLuint divisor);
+#endif
+#endif /* GL_NV_instanced_arrays */
+
+#ifndef GL_NV_non_square_matrices
+#define GL_NV_non_square_matrices 1
+#define GL_FLOAT_MAT2x3_NV                0x8B65
+#define GL_FLOAT_MAT2x4_NV                0x8B66
+#define GL_FLOAT_MAT3x2_NV                0x8B67
+#define GL_FLOAT_MAT3x4_NV                0x8B68
+#define GL_FLOAT_MAT4x2_NV                0x8B69
+#define GL_FLOAT_MAT4x3_NV                0x8B6A
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X3FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X2FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X4FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X2FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X4FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X3FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glUniformMatrix2x3fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3x2fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix2x4fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4x2fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3x4fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4x3fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+#endif
+#endif /* GL_NV_non_square_matrices */
+
+#ifndef GL_NV_read_buffer
+#define GL_NV_read_buffer 1
+#define GL_READ_BUFFER_NV                 0x0C02
+typedef void (GL_APIENTRYP PFNGLREADBUFFERNVPROC) (GLenum mode);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glReadBufferNV (GLenum mode);
+#endif
+#endif /* GL_NV_read_buffer */
+
+#ifndef GL_NV_read_buffer_front
+#define GL_NV_read_buffer_front 1
+#endif /* GL_NV_read_buffer_front */
+
+#ifndef GL_NV_read_depth
+#define GL_NV_read_depth 1
+#endif /* GL_NV_read_depth */
+
+#ifndef GL_NV_read_depth_stencil
+#define GL_NV_read_depth_stencil 1
+#endif /* GL_NV_read_depth_stencil */
+
+#ifndef GL_NV_read_stencil
+#define GL_NV_read_stencil 1
+#endif /* GL_NV_read_stencil */
+
+#ifndef GL_NV_sRGB_formats
+#define GL_NV_sRGB_formats 1
+#define GL_SLUMINANCE_NV                  0x8C46
+#define GL_SLUMINANCE_ALPHA_NV            0x8C44
+#define GL_SRGB8_NV                       0x8C41
+#define GL_SLUMINANCE8_NV                 0x8C47
+#define GL_SLUMINANCE8_ALPHA8_NV          0x8C45
+#define GL_COMPRESSED_SRGB_S3TC_DXT1_NV   0x8C4C
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV 0x8C4D
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV 0x8C4E
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV 0x8C4F
+#define GL_ETC1_SRGB8_NV                  0x88EE
+#endif /* GL_NV_sRGB_formats */
+
+#ifndef GL_NV_shadow_samplers_array
+#define GL_NV_shadow_samplers_array 1
+#define GL_SAMPLER_2D_ARRAY_SHADOW_NV     0x8DC4
+#endif /* GL_NV_shadow_samplers_array */
+
+#ifndef GL_NV_shadow_samplers_cube
+#define GL_NV_shadow_samplers_cube 1
+#define GL_SAMPLER_CUBE_SHADOW_NV         0x8DC5
+#endif /* GL_NV_shadow_samplers_cube */
+
+#ifndef GL_NV_texture_border_clamp
+#define GL_NV_texture_border_clamp 1
+#define GL_TEXTURE_BORDER_COLOR_NV        0x1004
+#define GL_CLAMP_TO_BORDER_NV             0x812D
+#endif /* GL_NV_texture_border_clamp */
+
+#ifndef GL_NV_texture_compression_s3tc_update
+#define GL_NV_texture_compression_s3tc_update 1
+#endif /* GL_NV_texture_compression_s3tc_update */
+
+#ifndef GL_NV_texture_npot_2D_mipmap
+#define GL_NV_texture_npot_2D_mipmap 1
+#endif /* GL_NV_texture_npot_2D_mipmap */
+
+#ifndef GL_QCOM_alpha_test
+#define GL_QCOM_alpha_test 1
+#define GL_ALPHA_TEST_QCOM                0x0BC0
+#define GL_ALPHA_TEST_FUNC_QCOM           0x0BC1
+#define GL_ALPHA_TEST_REF_QCOM            0x0BC2
+typedef void (GL_APIENTRYP PFNGLALPHAFUNCQCOMPROC) (GLenum func, GLclampf ref);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glAlphaFuncQCOM (GLenum func, GLclampf ref);
+#endif
+#endif /* GL_QCOM_alpha_test */
+
+#ifndef GL_QCOM_binning_control
+#define GL_QCOM_binning_control 1
+#define GL_BINNING_CONTROL_HINT_QCOM      0x8FB0
+#define GL_CPU_OPTIMIZED_QCOM             0x8FB1
+#define GL_GPU_OPTIMIZED_QCOM             0x8FB2
+#define GL_RENDER_DIRECT_TO_FRAMEBUFFER_QCOM 0x8FB3
+#endif /* GL_QCOM_binning_control */
+
+#ifndef GL_QCOM_driver_control
+#define GL_QCOM_driver_control 1
+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);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls);
+GL_APICALL void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
+GL_APICALL void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl);
+GL_APICALL void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl);
+#endif
+#endif /* GL_QCOM_driver_control */
+
+#ifndef GL_QCOM_extended_get
+#define GL_QCOM_extended_get 1
+#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
+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);
+#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
+#endif /* GL_QCOM_extended_get */
+
+#ifndef GL_QCOM_extended_get2
+#define GL_QCOM_extended_get2 1
+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);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders);
+GL_APICALL void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
+GL_APICALL GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program);
+GL_APICALL void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
+#endif
+#endif /* GL_QCOM_extended_get2 */
+
+#ifndef GL_QCOM_perfmon_global_mode
+#define GL_QCOM_perfmon_global_mode 1
+#define GL_PERFMON_GLOBAL_MODE_QCOM       0x8FA0
+#endif /* GL_QCOM_perfmon_global_mode */
+
+#ifndef GL_QCOM_tiled_rendering
+#define GL_QCOM_tiled_rendering 1
+#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
+typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
+typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
+GL_APICALL void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask);
+#endif
+#endif /* GL_QCOM_tiled_rendering */
+
+#ifndef GL_QCOM_writeonly_rendering
+#define GL_QCOM_writeonly_rendering 1
+#define GL_WRITEONLY_RENDERING_QCOM       0x8823
+#endif /* GL_QCOM_writeonly_rendering */
+
+#ifndef GL_VIV_shader_binary
+#define GL_VIV_shader_binary 1
+#define GL_SHADER_BINARY_VIV              0x8FC4
+#endif /* GL_VIV_shader_binary */
+
+/******************************************************************************/
+/* 20140709-joonbum.ko: add definition                                        */
+#define GL_UNSIGNED_INT                        0x1405
+
+#ifndef GL_IMG_texture_stream
+#define GL_TEXTURE_STREAM_IMG                            0x8C0D
+#define GL_TEXTURE_NUM_STREAM_DEVICES_IMG                0x8C0E
+#define GL_TEXTURE_STREAM_DEVICE_WIDTH_IMG               0x8C0F
+#define GL_TEXTURE_STREAM_DEVICE_HEIGHT_IMG              0x8EA0
+#define GL_TEXTURE_STREAM_DEVICE_FORMAT_IMG              0x8EA1
+#define GL_TEXTURE_STREAM_DEVICE_NUM_BUFFERS_IMG         0x8EA2
+#define GL_TEXTURE_BINDING_STREAM_IMG                    0x9131
+#define GL_SAMPLER_STREAM_IMG                            0x9132
+#endif /* GL_IMG_texture_stream */
+
+#ifndef GL_IMG_texture_stream2
+#define GL_IMG_texture_stream2 1
+typedef void (GL_APIENTRYP PFNGLTEXBINDSTREAMIMGPROC) (GLint device, GLint deviceoffset);
+typedef const GLubyte *(GL_APIENTRYP PFNGLGETTEXSTREAMDEVICENAMEIMGPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLGETTEXSTREAMDEVICEATTRIBUTEIVIMGPROC) (GLenum target, GLenum pname, GLint *params);
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexBindStreamIMG(GLint device, GLint deviceoffset);
+GL_APICALL void GL_APIENTRY glGetTexStreamDeviceAttributeivIMG(GLint device, GLenum pname, GLint *params);
+GL_APICALL const GLubyte * GL_APIENTRY glGetTexStreamDeviceNameIMG(GLint device);
+#endif
+#endif /* GL_IMG_texture_stream2 */
+
+/* 20140930-sw815.ha: SEC proprietary specs                                   */
+#ifndef GL_EXT_multisampled_render_to_texture
+#define GL_TEXTURE_SAMPLES_EXT                                 0x9136
+#endif
+/******************************************************************************/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
\ No newline at end of file
diff --git a/include_KHR/GLES2/gl2platform.h b/include_KHR/GLES2/gl2platform.h
new file mode 100644 (file)
index 0000000..89d4d44
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef __gl2platform_h_
+#define __gl2platform_h_
+
+/* $Revision: 23328 $ on $Date:: 2013-10-02 02:28:28 -0700 #$ */
+
+/*
+ * This document is licensed under the SGI Free Software B License Version
+ * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
+ */
+
+/* Platform-specific types and definitions for OpenGL ES 2.X  gl2.h
+ *
+ * Adopters may modify khrplatform.h and this file to suit their platform.
+ * You are encouraged to submit all modifications to the Khronos group so that
+ * they can be included in future versions of this file.  Please submit changes
+ * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
+ * by filing a bug against product "OpenGL-ES" component "Registry".
+ */
+
+#include <KHR/khrplatform.h>
+
+#ifndef GL_APICALL
+#define GL_APICALL  KHRONOS_APICALL
+#endif
+
+#ifndef GL_APIENTRY
+#define GL_APIENTRY KHRONOS_APIENTRY
+#endif
+
+#endif /* __gl2platform_h_ */
diff --git a/include_KHR/GLES3/README b/include_KHR/GLES3/README
new file mode 100644 (file)
index 0000000..0f3821a
--- /dev/null
@@ -0,0 +1,3 @@
+Note:
+       - OpenGL ES v3.x does not have a dedicated OpenGL ES extension headerfile.
+         In it's place, OpenGL ES v3.x refers to gl2ext.h in GLES/ directory.
diff --git a/include_KHR/GLES3/gl3.h b/include_KHR/GLES3/gl3.h
new file mode 100644 (file)
index 0000000..e3a52f8
--- /dev/null
@@ -0,0 +1,939 @@
+#ifndef __gl3_h_
+#define __gl3_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2013-2014 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.
+*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+**   http://www.opengl.org/registry/
+**
+** Khronos $Revision: 28335 $ on $Date: 2014-09-26 18:55:45 -0700 (Fri, 26 Sep 2014) $
+*/
+
+#include <GLES3/gl3platform.h>
+
+/* Generated on date 20140926 */
+
+/* Generated C header for:
+ * API: gles2
+ * Profile: common
+ * Versions considered: 2\.[0-9]|3.0
+ * Versions emitted: .*
+ * Default extensions included: None
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef GL_ES_VERSION_2_0
+#define GL_ES_VERSION_2_0 1
+#include <KHR/khrplatform.h>
+typedef khronos_int8_t GLbyte;
+typedef khronos_float_t GLclampf;
+typedef khronos_int32_t GLfixed;
+typedef short GLshort;
+typedef unsigned short GLushort;
+typedef void GLvoid;
+typedef struct __GLsync *GLsync;
+typedef khronos_int64_t GLint64;
+typedef khronos_uint64_t GLuint64;
+typedef unsigned int GLenum;
+typedef unsigned int GLuint;
+typedef char GLchar;
+typedef khronos_float_t GLfloat;
+typedef khronos_ssize_t GLsizeiptr;
+typedef khronos_intptr_t GLintptr;
+typedef unsigned int GLbitfield;
+typedef int GLint;
+typedef unsigned char GLboolean;
+typedef int GLsizei;
+typedef khronos_uint8_t GLubyte;
+#define GL_DEPTH_BUFFER_BIT               0x00000100
+#define GL_STENCIL_BUFFER_BIT             0x00000400
+#define GL_COLOR_BUFFER_BIT               0x00004000
+#define GL_FALSE                          0
+#define GL_TRUE                           1
+#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
+#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
+#define GL_DST_COLOR                      0x0306
+#define GL_ONE_MINUS_DST_COLOR            0x0307
+#define GL_SRC_ALPHA_SATURATE             0x0308
+#define GL_FUNC_ADD                       0x8006
+#define GL_BLEND_EQUATION                 0x8009
+#define GL_BLEND_EQUATION_RGB             0x8009
+#define GL_BLEND_EQUATION_ALPHA           0x883D
+#define GL_FUNC_SUBTRACT                  0x800A
+#define GL_FUNC_REVERSE_SUBTRACT          0x800B
+#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
+#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
+#define GL_FRONT                          0x0404
+#define GL_BACK                           0x0405
+#define GL_FRONT_AND_BACK                 0x0408
+#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
+#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
+#define GL_CW                             0x0900
+#define GL_CCW                            0x0901
+#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
+#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
+#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
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS     0x86A3
+#define GL_DONT_CARE                      0x1100
+#define GL_FASTEST                        0x1101
+#define GL_NICEST                         0x1102
+#define GL_GENERATE_MIPMAP_HINT           0x8192
+#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
+#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
+#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
+#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
+#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
+#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
+#define GL_VENDOR                         0x1F00
+#define GL_RENDERER                       0x1F01
+#define GL_VERSION                        0x1F02
+#define GL_EXTENSIONS                     0x1F03
+#define GL_NEAREST                        0x2600
+#define GL_LINEAR                         0x2601
+#define GL_NEAREST_MIPMAP_NEAREST         0x2700
+#define GL_LINEAR_MIPMAP_NEAREST          0x2701
+#define GL_NEAREST_MIPMAP_LINEAR          0x2702
+#define GL_LINEAR_MIPMAP_LINEAR           0x2703
+#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_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
+#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_REPEAT                         0x2901
+#define GL_CLAMP_TO_EDGE                  0x812F
+#define GL_MIRRORED_REPEAT                0x8370
+#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
+#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
+#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
+#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
+#define GL_COMPILE_STATUS                 0x8B81
+#define GL_INFO_LOG_LENGTH                0x8B84
+#define GL_SHADER_SOURCE_LENGTH           0x8B88
+#define GL_SHADER_COMPILER                0x8DFA
+#define GL_SHADER_BINARY_FORMATS          0x8DF8
+#define GL_NUM_SHADER_BINARY_FORMATS      0x8DF9
+#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
+#define GL_FRAMEBUFFER                    0x8D40
+#define GL_RENDERBUFFER                   0x8D41
+#define GL_RGBA4                          0x8056
+#define GL_RGB5_A1                        0x8057
+#define GL_RGB565                         0x8D62
+#define GL_DEPTH_COMPONENT16              0x81A5
+#define GL_STENCIL_INDEX8                 0x8D48
+#define GL_RENDERBUFFER_WIDTH             0x8D42
+#define GL_RENDERBUFFER_HEIGHT            0x8D43
+#define GL_RENDERBUFFER_INTERNAL_FORMAT   0x8D44
+#define GL_RENDERBUFFER_RED_SIZE          0x8D50
+#define GL_RENDERBUFFER_GREEN_SIZE        0x8D51
+#define GL_RENDERBUFFER_BLUE_SIZE         0x8D52
+#define GL_RENDERBUFFER_ALPHA_SIZE        0x8D53
+#define GL_RENDERBUFFER_DEPTH_SIZE        0x8D54
+#define GL_RENDERBUFFER_STENCIL_SIZE      0x8D55
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
+#define GL_COLOR_ATTACHMENT0              0x8CE0
+#define GL_DEPTH_ATTACHMENT               0x8D00
+#define GL_STENCIL_ATTACHMENT             0x8D20
+#define GL_NONE                           0
+#define GL_FRAMEBUFFER_COMPLETE           0x8CD5
+#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
+#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
+#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
+#define GL_FRAMEBUFFER_UNSUPPORTED        0x8CDD
+#define GL_FRAMEBUFFER_BINDING            0x8CA6
+#define GL_RENDERBUFFER_BINDING           0x8CA7
+#define GL_MAX_RENDERBUFFER_SIZE          0x84E8
+#define GL_INVALID_FRAMEBUFFER_OPERATION  0x0506
+GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
+GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
+GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name);
+GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
+GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
+GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
+GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
+GL_APICALL void GL_APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat 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 sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+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 (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat d);
+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 (GLfloat n, GLfloat f);
+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, GLchar *name);
+GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
+GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar *name);
+GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *data);
+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 *data);
+GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data);
+GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
+GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
+GL_APICALL const GLubyte *GL_APIENTRY glGetString (GLenum name);
+GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params);
+GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
+GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, 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 (GLfloat value, GLboolean invert);
+GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
+GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
+GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
+GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
+GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint 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 v0);
+GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0);
+GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1);
+GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1);
+GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);
+GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value);
+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 index, GLfloat x);
+GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y);
+GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
+GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
+#endif /* GL_ES_VERSION_2_0 */
+
+#ifndef GL_ES_VERSION_3_0
+#define GL_ES_VERSION_3_0 1
+typedef unsigned short GLhalf;
+#define GL_READ_BUFFER                    0x0C02
+#define GL_UNPACK_ROW_LENGTH              0x0CF2
+#define GL_UNPACK_SKIP_ROWS               0x0CF3
+#define GL_UNPACK_SKIP_PIXELS             0x0CF4
+#define GL_PACK_ROW_LENGTH                0x0D02
+#define GL_PACK_SKIP_ROWS                 0x0D03
+#define GL_PACK_SKIP_PIXELS               0x0D04
+#define GL_COLOR                          0x1800
+#define GL_DEPTH                          0x1801
+#define GL_STENCIL                        0x1802
+#define GL_RED                            0x1903
+#define GL_RGB8                           0x8051
+#define GL_RGBA8                          0x8058
+#define GL_RGB10_A2                       0x8059
+#define GL_TEXTURE_BINDING_3D             0x806A
+#define GL_UNPACK_SKIP_IMAGES             0x806D
+#define GL_UNPACK_IMAGE_HEIGHT            0x806E
+#define GL_TEXTURE_3D                     0x806F
+#define GL_TEXTURE_WRAP_R                 0x8072
+#define GL_MAX_3D_TEXTURE_SIZE            0x8073
+#define GL_UNSIGNED_INT_2_10_10_10_REV    0x8368
+#define GL_MAX_ELEMENTS_VERTICES          0x80E8
+#define GL_MAX_ELEMENTS_INDICES           0x80E9
+#define GL_TEXTURE_MIN_LOD                0x813A
+#define GL_TEXTURE_MAX_LOD                0x813B
+#define GL_TEXTURE_BASE_LEVEL             0x813C
+#define GL_TEXTURE_MAX_LEVEL              0x813D
+#define GL_MIN                            0x8007
+#define GL_MAX                            0x8008
+#define GL_DEPTH_COMPONENT24              0x81A6
+#define GL_MAX_TEXTURE_LOD_BIAS           0x84FD
+#define GL_TEXTURE_COMPARE_MODE           0x884C
+#define GL_TEXTURE_COMPARE_FUNC           0x884D
+#define GL_CURRENT_QUERY                  0x8865
+#define GL_QUERY_RESULT                   0x8866
+#define GL_QUERY_RESULT_AVAILABLE         0x8867
+#define GL_BUFFER_MAPPED                  0x88BC
+#define GL_BUFFER_MAP_POINTER             0x88BD
+#define GL_STREAM_READ                    0x88E1
+#define GL_STREAM_COPY                    0x88E2
+#define GL_STATIC_READ                    0x88E5
+#define GL_STATIC_COPY                    0x88E6
+#define GL_DYNAMIC_READ                   0x88E9
+#define GL_DYNAMIC_COPY                   0x88EA
+#define GL_MAX_DRAW_BUFFERS               0x8824
+#define GL_DRAW_BUFFER0                   0x8825
+#define GL_DRAW_BUFFER1                   0x8826
+#define GL_DRAW_BUFFER2                   0x8827
+#define GL_DRAW_BUFFER3                   0x8828
+#define GL_DRAW_BUFFER4                   0x8829
+#define GL_DRAW_BUFFER5                   0x882A
+#define GL_DRAW_BUFFER6                   0x882B
+#define GL_DRAW_BUFFER7                   0x882C
+#define GL_DRAW_BUFFER8                   0x882D
+#define GL_DRAW_BUFFER9                   0x882E
+#define GL_DRAW_BUFFER10                  0x882F
+#define GL_DRAW_BUFFER11                  0x8830
+#define GL_DRAW_BUFFER12                  0x8831
+#define GL_DRAW_BUFFER13                  0x8832
+#define GL_DRAW_BUFFER14                  0x8833
+#define GL_DRAW_BUFFER15                  0x8834
+#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49
+#define GL_MAX_VERTEX_UNIFORM_COMPONENTS  0x8B4A
+#define GL_SAMPLER_3D                     0x8B5F
+#define GL_SAMPLER_2D_SHADOW              0x8B62
+#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B
+#define GL_PIXEL_PACK_BUFFER              0x88EB
+#define GL_PIXEL_UNPACK_BUFFER            0x88EC
+#define GL_PIXEL_PACK_BUFFER_BINDING      0x88ED
+#define GL_PIXEL_UNPACK_BUFFER_BINDING    0x88EF
+#define GL_FLOAT_MAT2x3                   0x8B65
+#define GL_FLOAT_MAT2x4                   0x8B66
+#define GL_FLOAT_MAT3x2                   0x8B67
+#define GL_FLOAT_MAT3x4                   0x8B68
+#define GL_FLOAT_MAT4x2                   0x8B69
+#define GL_FLOAT_MAT4x3                   0x8B6A
+#define GL_SRGB                           0x8C40
+#define GL_SRGB8                          0x8C41
+#define GL_SRGB8_ALPHA8                   0x8C43
+#define GL_COMPARE_REF_TO_TEXTURE         0x884E
+#define GL_MAJOR_VERSION                  0x821B
+#define GL_MINOR_VERSION                  0x821C
+#define GL_NUM_EXTENSIONS                 0x821D
+#define GL_RGBA32F                        0x8814
+#define GL_RGB32F                         0x8815
+#define GL_RGBA16F                        0x881A
+#define GL_RGB16F                         0x881B
+#define GL_VERTEX_ATTRIB_ARRAY_INTEGER    0x88FD
+#define GL_MAX_ARRAY_TEXTURE_LAYERS       0x88FF
+#define GL_MIN_PROGRAM_TEXEL_OFFSET       0x8904
+#define GL_MAX_PROGRAM_TEXEL_OFFSET       0x8905
+#define GL_MAX_VARYING_COMPONENTS         0x8B4B
+#define GL_TEXTURE_2D_ARRAY               0x8C1A
+#define GL_TEXTURE_BINDING_2D_ARRAY       0x8C1D
+#define GL_R11F_G11F_B10F                 0x8C3A
+#define GL_UNSIGNED_INT_10F_11F_11F_REV   0x8C3B
+#define GL_RGB9_E5                        0x8C3D
+#define GL_UNSIGNED_INT_5_9_9_9_REV       0x8C3E
+#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76
+#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80
+#define GL_TRANSFORM_FEEDBACK_VARYINGS    0x8C83
+#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84
+#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85
+#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88
+#define GL_RASTERIZER_DISCARD             0x8C89
+#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B
+#define GL_INTERLEAVED_ATTRIBS            0x8C8C
+#define GL_SEPARATE_ATTRIBS               0x8C8D
+#define GL_TRANSFORM_FEEDBACK_BUFFER      0x8C8E
+#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F
+#define GL_RGBA32UI                       0x8D70
+#define GL_RGB32UI                        0x8D71
+#define GL_RGBA16UI                       0x8D76
+#define GL_RGB16UI                        0x8D77
+#define GL_RGBA8UI                        0x8D7C
+#define GL_RGB8UI                         0x8D7D
+#define GL_RGBA32I                        0x8D82
+#define GL_RGB32I                         0x8D83
+#define GL_RGBA16I                        0x8D88
+#define GL_RGB16I                         0x8D89
+#define GL_RGBA8I                         0x8D8E
+#define GL_RGB8I                          0x8D8F
+#define GL_RED_INTEGER                    0x8D94
+#define GL_RGB_INTEGER                    0x8D98
+#define GL_RGBA_INTEGER                   0x8D99
+#define GL_SAMPLER_2D_ARRAY               0x8DC1
+#define GL_SAMPLER_2D_ARRAY_SHADOW        0x8DC4
+#define GL_SAMPLER_CUBE_SHADOW            0x8DC5
+#define GL_UNSIGNED_INT_VEC2              0x8DC6
+#define GL_UNSIGNED_INT_VEC3              0x8DC7
+#define GL_UNSIGNED_INT_VEC4              0x8DC8
+#define GL_INT_SAMPLER_2D                 0x8DCA
+#define GL_INT_SAMPLER_3D                 0x8DCB
+#define GL_INT_SAMPLER_CUBE               0x8DCC
+#define GL_INT_SAMPLER_2D_ARRAY           0x8DCF
+#define GL_UNSIGNED_INT_SAMPLER_2D        0x8DD2
+#define GL_UNSIGNED_INT_SAMPLER_3D        0x8DD3
+#define GL_UNSIGNED_INT_SAMPLER_CUBE      0x8DD4
+#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY  0x8DD7
+#define GL_BUFFER_ACCESS_FLAGS            0x911F
+#define GL_BUFFER_MAP_LENGTH              0x9120
+#define GL_BUFFER_MAP_OFFSET              0x9121
+#define GL_DEPTH_COMPONENT32F             0x8CAC
+#define GL_DEPTH32F_STENCIL8              0x8CAD
+#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD
+#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210
+#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211
+#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212
+#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213
+#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214
+#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215
+#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216
+#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217
+#define GL_FRAMEBUFFER_DEFAULT            0x8218
+#define GL_FRAMEBUFFER_UNDEFINED          0x8219
+#define GL_DEPTH_STENCIL_ATTACHMENT       0x821A
+#define GL_DEPTH_STENCIL                  0x84F9
+#define GL_UNSIGNED_INT_24_8              0x84FA
+#define GL_DEPTH24_STENCIL8               0x88F0
+#define GL_UNSIGNED_NORMALIZED            0x8C17
+#define GL_DRAW_FRAMEBUFFER_BINDING       0x8CA6
+#define GL_READ_FRAMEBUFFER               0x8CA8
+#define GL_DRAW_FRAMEBUFFER               0x8CA9
+#define GL_READ_FRAMEBUFFER_BINDING       0x8CAA
+#define GL_RENDERBUFFER_SAMPLES           0x8CAB
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4
+#define GL_MAX_COLOR_ATTACHMENTS          0x8CDF
+#define GL_COLOR_ATTACHMENT1              0x8CE1
+#define GL_COLOR_ATTACHMENT2              0x8CE2
+#define GL_COLOR_ATTACHMENT3              0x8CE3
+#define GL_COLOR_ATTACHMENT4              0x8CE4
+#define GL_COLOR_ATTACHMENT5              0x8CE5
+#define GL_COLOR_ATTACHMENT6              0x8CE6
+#define GL_COLOR_ATTACHMENT7              0x8CE7
+#define GL_COLOR_ATTACHMENT8              0x8CE8
+#define GL_COLOR_ATTACHMENT9              0x8CE9
+#define GL_COLOR_ATTACHMENT10             0x8CEA
+#define GL_COLOR_ATTACHMENT11             0x8CEB
+#define GL_COLOR_ATTACHMENT12             0x8CEC
+#define GL_COLOR_ATTACHMENT13             0x8CED
+#define GL_COLOR_ATTACHMENT14             0x8CEE
+#define GL_COLOR_ATTACHMENT15             0x8CEF
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56
+#define GL_MAX_SAMPLES                    0x8D57
+#define GL_HALF_FLOAT                     0x140B
+#define GL_MAP_READ_BIT                   0x0001
+#define GL_MAP_WRITE_BIT                  0x0002
+#define GL_MAP_INVALIDATE_RANGE_BIT       0x0004
+#define GL_MAP_INVALIDATE_BUFFER_BIT      0x0008
+#define GL_MAP_FLUSH_EXPLICIT_BIT         0x0010
+#define GL_MAP_UNSYNCHRONIZED_BIT         0x0020
+#define GL_RG                             0x8227
+#define GL_RG_INTEGER                     0x8228
+#define GL_R8                             0x8229
+#define GL_RG8                            0x822B
+#define GL_R16F                           0x822D
+#define GL_R32F                           0x822E
+#define GL_RG16F                          0x822F
+#define GL_RG32F                          0x8230
+#define GL_R8I                            0x8231
+#define GL_R8UI                           0x8232
+#define GL_R16I                           0x8233
+#define GL_R16UI                          0x8234
+#define GL_R32I                           0x8235
+#define GL_R32UI                          0x8236
+#define GL_RG8I                           0x8237
+#define GL_RG8UI                          0x8238
+#define GL_RG16I                          0x8239
+#define GL_RG16UI                         0x823A
+#define GL_RG32I                          0x823B
+#define GL_RG32UI                         0x823C
+#define GL_VERTEX_ARRAY_BINDING           0x85B5
+#define GL_R8_SNORM                       0x8F94
+#define GL_RG8_SNORM                      0x8F95
+#define GL_RGB8_SNORM                     0x8F96
+#define GL_RGBA8_SNORM                    0x8F97
+#define GL_SIGNED_NORMALIZED              0x8F9C
+#define GL_PRIMITIVE_RESTART_FIXED_INDEX  0x8D69
+#define GL_COPY_READ_BUFFER               0x8F36
+#define GL_COPY_WRITE_BUFFER              0x8F37
+#define GL_COPY_READ_BUFFER_BINDING       0x8F36
+#define GL_COPY_WRITE_BUFFER_BINDING      0x8F37
+#define GL_UNIFORM_BUFFER                 0x8A11
+#define GL_UNIFORM_BUFFER_BINDING         0x8A28
+#define GL_UNIFORM_BUFFER_START           0x8A29
+#define GL_UNIFORM_BUFFER_SIZE            0x8A2A
+#define GL_MAX_VERTEX_UNIFORM_BLOCKS      0x8A2B
+#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS    0x8A2D
+#define GL_MAX_COMBINED_UNIFORM_BLOCKS    0x8A2E
+#define GL_MAX_UNIFORM_BUFFER_BINDINGS    0x8A2F
+#define GL_MAX_UNIFORM_BLOCK_SIZE         0x8A30
+#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31
+#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33
+#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34
+#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35
+#define GL_ACTIVE_UNIFORM_BLOCKS          0x8A36
+#define GL_UNIFORM_TYPE                   0x8A37
+#define GL_UNIFORM_SIZE                   0x8A38
+#define GL_UNIFORM_NAME_LENGTH            0x8A39
+#define GL_UNIFORM_BLOCK_INDEX            0x8A3A
+#define GL_UNIFORM_OFFSET                 0x8A3B
+#define GL_UNIFORM_ARRAY_STRIDE           0x8A3C
+#define GL_UNIFORM_MATRIX_STRIDE          0x8A3D
+#define GL_UNIFORM_IS_ROW_MAJOR           0x8A3E
+#define GL_UNIFORM_BLOCK_BINDING          0x8A3F
+#define GL_UNIFORM_BLOCK_DATA_SIZE        0x8A40
+#define GL_UNIFORM_BLOCK_NAME_LENGTH      0x8A41
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS  0x8A42
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46
+#define GL_INVALID_INDEX                  0xFFFFFFFFu
+#define GL_MAX_VERTEX_OUTPUT_COMPONENTS   0x9122
+#define GL_MAX_FRAGMENT_INPUT_COMPONENTS  0x9125
+#define GL_MAX_SERVER_WAIT_TIMEOUT        0x9111
+#define GL_OBJECT_TYPE                    0x9112
+#define GL_SYNC_CONDITION                 0x9113
+#define GL_SYNC_STATUS                    0x9114
+#define GL_SYNC_FLAGS                     0x9115
+#define GL_SYNC_FENCE                     0x9116
+#define GL_SYNC_GPU_COMMANDS_COMPLETE     0x9117
+#define GL_UNSIGNALED                     0x9118
+#define GL_SIGNALED                       0x9119
+#define GL_ALREADY_SIGNALED               0x911A
+#define GL_TIMEOUT_EXPIRED                0x911B
+#define GL_CONDITION_SATISFIED            0x911C
+#define GL_WAIT_FAILED                    0x911D
+#define GL_SYNC_FLUSH_COMMANDS_BIT        0x00000001
+#define GL_TIMEOUT_IGNORED                0xFFFFFFFFFFFFFFFFull
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR    0x88FE
+#define GL_ANY_SAMPLES_PASSED             0x8C2F
+#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A
+#define GL_SAMPLER_BINDING                0x8919
+#define GL_RGB10_A2UI                     0x906F
+#define GL_TEXTURE_SWIZZLE_R              0x8E42
+#define GL_TEXTURE_SWIZZLE_G              0x8E43
+#define GL_TEXTURE_SWIZZLE_B              0x8E44
+#define GL_TEXTURE_SWIZZLE_A              0x8E45
+#define GL_GREEN                          0x1904
+#define GL_BLUE                           0x1905
+#define GL_INT_2_10_10_10_REV             0x8D9F
+#define GL_TRANSFORM_FEEDBACK             0x8E22
+#define GL_TRANSFORM_FEEDBACK_PAUSED      0x8E23
+#define GL_TRANSFORM_FEEDBACK_ACTIVE      0x8E24
+#define GL_TRANSFORM_FEEDBACK_BINDING     0x8E25
+#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257
+#define GL_PROGRAM_BINARY_LENGTH          0x8741
+#define GL_NUM_PROGRAM_BINARY_FORMATS     0x87FE
+#define GL_PROGRAM_BINARY_FORMATS         0x87FF
+#define GL_COMPRESSED_R11_EAC             0x9270
+#define GL_COMPRESSED_SIGNED_R11_EAC      0x9271
+#define GL_COMPRESSED_RG11_EAC            0x9272
+#define GL_COMPRESSED_SIGNED_RG11_EAC     0x9273
+#define GL_COMPRESSED_RGB8_ETC2           0x9274
+#define GL_COMPRESSED_SRGB8_ETC2          0x9275
+#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276
+#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277
+#define GL_COMPRESSED_RGBA8_ETC2_EAC      0x9278
+#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279
+#define GL_TEXTURE_IMMUTABLE_FORMAT       0x912F
+#define GL_MAX_ELEMENT_INDEX              0x8D6B
+#define GL_NUM_SAMPLE_COUNTS              0x9380
+#define GL_TEXTURE_IMMUTABLE_LEVELS       0x82DF
+GL_APICALL void GL_APIENTRY glReadBuffer (GLenum src);
+GL_APICALL void GL_APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
+GL_APICALL void GL_APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
+GL_APICALL void GL_APIENTRY glTexSubImage3D (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 glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage3D (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 glGenQueries (GLsizei n, GLuint *ids);
+GL_APICALL void GL_APIENTRY glDeleteQueries (GLsizei n, const GLuint *ids);
+GL_APICALL GLboolean GL_APIENTRY glIsQuery (GLuint id);
+GL_APICALL void GL_APIENTRY glBeginQuery (GLenum target, GLuint id);
+GL_APICALL void GL_APIENTRY glEndQuery (GLenum target);
+GL_APICALL void GL_APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params);
+GL_APICALL GLboolean GL_APIENTRY glUnmapBuffer (GLenum target);
+GL_APICALL void GL_APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, void **params);
+GL_APICALL void GL_APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs);
+GL_APICALL void GL_APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+GL_APICALL void *GL_APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+GL_APICALL void GL_APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length);
+GL_APICALL void GL_APIENTRY glBindVertexArray (GLuint array);
+GL_APICALL void GL_APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays);
+GL_APICALL void GL_APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays);
+GL_APICALL GLboolean GL_APIENTRY glIsVertexArray (GLuint array);
+GL_APICALL void GL_APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint *data);
+GL_APICALL void GL_APIENTRY glBeginTransformFeedback (GLenum primitiveMode);
+GL_APICALL void GL_APIENTRY glEndTransformFeedback (void);
+GL_APICALL void GL_APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+GL_APICALL void GL_APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer);
+GL_APICALL void GL_APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
+GL_APICALL void GL_APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
+GL_APICALL void GL_APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
+GL_APICALL void GL_APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params);
+GL_APICALL void GL_APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w);
+GL_APICALL void GL_APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+GL_APICALL void GL_APIENTRY glVertexAttribI4iv (GLuint index, const GLint *v);
+GL_APICALL void GL_APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint *v);
+GL_APICALL void GL_APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint *params);
+GL_APICALL GLint GL_APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name);
+GL_APICALL void GL_APIENTRY glUniform1ui (GLint location, GLuint v0);
+GL_APICALL void GL_APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1);
+GL_APICALL void GL_APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2);
+GL_APICALL void GL_APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+GL_APICALL void GL_APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value);
+GL_APICALL void GL_APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value);
+GL_APICALL void GL_APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
+GL_APICALL const GLubyte *GL_APIENTRY glGetStringi (GLenum name, GLuint index);
+GL_APICALL void GL_APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+GL_APICALL void GL_APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices);
+GL_APICALL void GL_APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
+GL_APICALL GLuint GL_APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName);
+GL_APICALL void GL_APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
+GL_APICALL void GL_APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+GL_APICALL void GL_APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
+GL_APICALL void GL_APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
+GL_APICALL GLsync GL_APIENTRY glFenceSync (GLenum condition, GLbitfield flags);
+GL_APICALL GLboolean GL_APIENTRY glIsSync (GLsync sync);
+GL_APICALL void GL_APIENTRY glDeleteSync (GLsync sync);
+GL_APICALL GLenum GL_APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_APICALL void GL_APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_APICALL void GL_APIENTRY glGetInteger64v (GLenum pname, GLint64 *data);
+GL_APICALL void GL_APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+GL_APICALL void GL_APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data);
+GL_APICALL void GL_APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params);
+GL_APICALL void GL_APIENTRY glGenSamplers (GLsizei count, GLuint *samplers);
+GL_APICALL void GL_APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers);
+GL_APICALL GLboolean GL_APIENTRY glIsSampler (GLuint sampler);
+GL_APICALL void GL_APIENTRY glBindSampler (GLuint unit, GLuint sampler);
+GL_APICALL void GL_APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param);
+GL_APICALL void GL_APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param);
+GL_APICALL void GL_APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param);
+GL_APICALL void GL_APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params);
+GL_APICALL void GL_APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor);
+GL_APICALL void GL_APIENTRY glBindTransformFeedback (GLenum target, GLuint id);
+GL_APICALL void GL_APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint *ids);
+GL_APICALL void GL_APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint *ids);
+GL_APICALL GLboolean GL_APIENTRY glIsTransformFeedback (GLuint id);
+GL_APICALL void GL_APIENTRY glPauseTransformFeedback (void);
+GL_APICALL void GL_APIENTRY glResumeTransformFeedback (void);
+GL_APICALL void GL_APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
+GL_APICALL void GL_APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
+GL_APICALL void GL_APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value);
+GL_APICALL void GL_APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments);
+GL_APICALL void GL_APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+GL_APICALL void GL_APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
+#endif /* GL_ES_VERSION_3_0 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include_KHR/GLES3/gl31.h b/include_KHR/GLES3/gl31.h
new file mode 100644 (file)
index 0000000..ca811ec
--- /dev/null
@@ -0,0 +1,1184 @@
+#ifndef __gl31_h_
+#define __gl31_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2013-2014 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.
+*/
+/*
+** This header is generated from the Khronos OpenGL / OpenGL ES XML
+** API Registry. The current version of the Registry, generator scripts
+** used to make the header, and the header can be found at
+**   http://www.opengl.org/registry/
+**
+** Khronos $Revision$ on $Date$
+*/
+
+#include <GLES3/gl3platform.h>
+
+/* Generated on date 20140926 */
+
+/* Generated C header for:
+ * API: gles2
+ * Profile: common
+ * Versions considered: 2.[0-9]|3.[01]
+ * Versions emitted: .*
+ * Default extensions included: None
+ * Additional extensions included: _nomatch_^
+ * Extensions removed: _nomatch_^
+ */
+
+#ifndef GL_ES_VERSION_2_0
+#define GL_ES_VERSION_2_0 1
+#include <KHR/khrplatform.h>
+typedef khronos_int8_t GLbyte;
+typedef khronos_float_t GLclampf;
+typedef khronos_int32_t GLfixed;
+typedef short GLshort;
+typedef unsigned short GLushort;
+typedef void GLvoid;
+typedef struct __GLsync *GLsync;
+typedef khronos_int64_t GLint64;
+typedef khronos_uint64_t GLuint64;
+typedef unsigned int GLenum;
+typedef unsigned int GLuint;
+typedef char GLchar;
+typedef khronos_float_t GLfloat;
+typedef khronos_ssize_t GLsizeiptr;
+typedef khronos_intptr_t GLintptr;
+typedef unsigned int GLbitfield;
+typedef int GLint;
+typedef unsigned char GLboolean;
+typedef int GLsizei;
+typedef khronos_uint8_t GLubyte;
+#define GL_DEPTH_BUFFER_BIT               0x00000100
+#define GL_STENCIL_BUFFER_BIT             0x00000400
+#define GL_COLOR_BUFFER_BIT               0x00004000
+#define GL_FALSE                          0
+#define GL_TRUE                           1
+#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
+#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
+#define GL_DST_COLOR                      0x0306
+#define GL_ONE_MINUS_DST_COLOR            0x0307
+#define GL_SRC_ALPHA_SATURATE             0x0308
+#define GL_FUNC_ADD                       0x8006
+#define GL_BLEND_EQUATION                 0x8009
+#define GL_BLEND_EQUATION_RGB             0x8009
+#define GL_BLEND_EQUATION_ALPHA           0x883D
+#define GL_FUNC_SUBTRACT                  0x800A
+#define GL_FUNC_REVERSE_SUBTRACT          0x800B
+#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
+#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
+#define GL_FRONT                          0x0404
+#define GL_BACK                           0x0405
+#define GL_FRONT_AND_BACK                 0x0408
+#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
+#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
+#define GL_CW                             0x0900
+#define GL_CCW                            0x0901
+#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
+#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
+#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
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS     0x86A3
+#define GL_DONT_CARE                      0x1100
+#define GL_FASTEST                        0x1101
+#define GL_NICEST                         0x1102
+#define GL_GENERATE_MIPMAP_HINT           0x8192
+#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
+#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
+#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
+#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
+#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
+#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
+#define GL_VENDOR                         0x1F00
+#define GL_RENDERER                       0x1F01
+#define GL_VERSION                        0x1F02
+#define GL_EXTENSIONS                     0x1F03
+#define GL_NEAREST                        0x2600
+#define GL_LINEAR                         0x2601
+#define GL_NEAREST_MIPMAP_NEAREST         0x2700
+#define GL_LINEAR_MIPMAP_NEAREST          0x2701
+#define GL_NEAREST_MIPMAP_LINEAR          0x2702
+#define GL_LINEAR_MIPMAP_LINEAR           0x2703
+#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_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
+#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_REPEAT                         0x2901
+#define GL_CLAMP_TO_EDGE                  0x812F
+#define GL_MIRRORED_REPEAT                0x8370
+#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
+#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
+#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
+#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
+#define GL_COMPILE_STATUS                 0x8B81
+#define GL_INFO_LOG_LENGTH                0x8B84
+#define GL_SHADER_SOURCE_LENGTH           0x8B88
+#define GL_SHADER_COMPILER                0x8DFA
+#define GL_SHADER_BINARY_FORMATS          0x8DF8
+#define GL_NUM_SHADER_BINARY_FORMATS      0x8DF9
+#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
+#define GL_FRAMEBUFFER                    0x8D40
+#define GL_RENDERBUFFER                   0x8D41
+#define GL_RGBA4                          0x8056
+#define GL_RGB5_A1                        0x8057
+#define GL_RGB565                         0x8D62
+#define GL_DEPTH_COMPONENT16              0x81A5
+#define GL_STENCIL_INDEX8                 0x8D48
+#define GL_RENDERBUFFER_WIDTH             0x8D42
+#define GL_RENDERBUFFER_HEIGHT            0x8D43
+#define GL_RENDERBUFFER_INTERNAL_FORMAT   0x8D44
+#define GL_RENDERBUFFER_RED_SIZE          0x8D50
+#define GL_RENDERBUFFER_GREEN_SIZE        0x8D51
+#define GL_RENDERBUFFER_BLUE_SIZE         0x8D52
+#define GL_RENDERBUFFER_ALPHA_SIZE        0x8D53
+#define GL_RENDERBUFFER_DEPTH_SIZE        0x8D54
+#define GL_RENDERBUFFER_STENCIL_SIZE      0x8D55
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
+#define GL_COLOR_ATTACHMENT0              0x8CE0
+#define GL_DEPTH_ATTACHMENT               0x8D00
+#define GL_STENCIL_ATTACHMENT             0x8D20
+#define GL_NONE                           0
+#define GL_FRAMEBUFFER_COMPLETE           0x8CD5
+#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
+#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
+#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
+#define GL_FRAMEBUFFER_UNSUPPORTED        0x8CDD
+#define GL_FRAMEBUFFER_BINDING            0x8CA6
+#define GL_RENDERBUFFER_BINDING           0x8CA7
+#define GL_MAX_RENDERBUFFER_SIZE          0x84E8
+#define GL_INVALID_FRAMEBUFFER_OPERATION  0x0506
+GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
+GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
+GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name);
+GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
+GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
+GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
+GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
+GL_APICALL void GL_APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat 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 sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+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 (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat d);
+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 (GLfloat n, GLfloat f);
+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, GLchar *name);
+GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
+GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar *name);
+GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *data);
+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 *data);
+GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data);
+GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
+GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
+GL_APICALL const GLubyte *GL_APIENTRY glGetString (GLenum name);
+GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params);
+GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
+GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, 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 (GLfloat value, GLboolean invert);
+GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
+GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
+GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
+GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
+GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint 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 v0);
+GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0);
+GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1);
+GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1);
+GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);
+GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value);
+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 index, GLfloat x);
+GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y);
+GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v);
+GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
+GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
+#endif /* GL_ES_VERSION_2_0 */
+
+#ifndef GL_ES_VERSION_3_0
+#define GL_ES_VERSION_3_0 1
+typedef unsigned short GLhalf;
+#define GL_READ_BUFFER                    0x0C02
+#define GL_UNPACK_ROW_LENGTH              0x0CF2
+#define GL_UNPACK_SKIP_ROWS               0x0CF3
+#define GL_UNPACK_SKIP_PIXELS             0x0CF4
+#define GL_PACK_ROW_LENGTH                0x0D02
+#define GL_PACK_SKIP_ROWS                 0x0D03
+#define GL_PACK_SKIP_PIXELS               0x0D04
+#define GL_COLOR                          0x1800
+#define GL_DEPTH                          0x1801
+#define GL_STENCIL                        0x1802
+#define GL_RED                            0x1903
+#define GL_RGB8                           0x8051
+#define GL_RGBA8                          0x8058
+#define GL_RGB10_A2                       0x8059
+#define GL_TEXTURE_BINDING_3D             0x806A
+#define GL_UNPACK_SKIP_IMAGES             0x806D
+#define GL_UNPACK_IMAGE_HEIGHT            0x806E
+#define GL_TEXTURE_3D                     0x806F
+#define GL_TEXTURE_WRAP_R                 0x8072
+#define GL_MAX_3D_TEXTURE_SIZE            0x8073
+#define GL_UNSIGNED_INT_2_10_10_10_REV    0x8368
+#define GL_MAX_ELEMENTS_VERTICES          0x80E8
+#define GL_MAX_ELEMENTS_INDICES           0x80E9
+#define GL_TEXTURE_MIN_LOD                0x813A
+#define GL_TEXTURE_MAX_LOD                0x813B
+#define GL_TEXTURE_BASE_LEVEL             0x813C
+#define GL_TEXTURE_MAX_LEVEL              0x813D
+#define GL_MIN                            0x8007
+#define GL_MAX                            0x8008
+#define GL_DEPTH_COMPONENT24              0x81A6
+#define GL_MAX_TEXTURE_LOD_BIAS           0x84FD
+#define GL_TEXTURE_COMPARE_MODE           0x884C
+#define GL_TEXTURE_COMPARE_FUNC           0x884D
+#define GL_CURRENT_QUERY                  0x8865
+#define GL_QUERY_RESULT                   0x8866
+#define GL_QUERY_RESULT_AVAILABLE         0x8867
+#define GL_BUFFER_MAPPED                  0x88BC
+#define GL_BUFFER_MAP_POINTER             0x88BD
+#define GL_STREAM_READ                    0x88E1
+#define GL_STREAM_COPY                    0x88E2
+#define GL_STATIC_READ                    0x88E5
+#define GL_STATIC_COPY                    0x88E6
+#define GL_DYNAMIC_READ                   0x88E9
+#define GL_DYNAMIC_COPY                   0x88EA
+#define GL_MAX_DRAW_BUFFERS               0x8824
+#define GL_DRAW_BUFFER0                   0x8825
+#define GL_DRAW_BUFFER1                   0x8826
+#define GL_DRAW_BUFFER2                   0x8827
+#define GL_DRAW_BUFFER3                   0x8828
+#define GL_DRAW_BUFFER4                   0x8829
+#define GL_DRAW_BUFFER5                   0x882A
+#define GL_DRAW_BUFFER6                   0x882B
+#define GL_DRAW_BUFFER7                   0x882C
+#define GL_DRAW_BUFFER8                   0x882D
+#define GL_DRAW_BUFFER9                   0x882E
+#define GL_DRAW_BUFFER10                  0x882F
+#define GL_DRAW_BUFFER11                  0x8830
+#define GL_DRAW_BUFFER12                  0x8831
+#define GL_DRAW_BUFFER13                  0x8832
+#define GL_DRAW_BUFFER14                  0x8833
+#define GL_DRAW_BUFFER15                  0x8834
+#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49
+#define GL_MAX_VERTEX_UNIFORM_COMPONENTS  0x8B4A
+#define GL_SAMPLER_3D                     0x8B5F
+#define GL_SAMPLER_2D_SHADOW              0x8B62
+#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B
+#define GL_PIXEL_PACK_BUFFER              0x88EB
+#define GL_PIXEL_UNPACK_BUFFER            0x88EC
+#define GL_PIXEL_PACK_BUFFER_BINDING      0x88ED
+#define GL_PIXEL_UNPACK_BUFFER_BINDING    0x88EF
+#define GL_FLOAT_MAT2x3                   0x8B65
+#define GL_FLOAT_MAT2x4                   0x8B66
+#define GL_FLOAT_MAT3x2                   0x8B67
+#define GL_FLOAT_MAT3x4                   0x8B68
+#define GL_FLOAT_MAT4x2                   0x8B69
+#define GL_FLOAT_MAT4x3                   0x8B6A
+#define GL_SRGB                           0x8C40
+#define GL_SRGB8                          0x8C41
+#define GL_SRGB8_ALPHA8                   0x8C43
+#define GL_COMPARE_REF_TO_TEXTURE         0x884E
+#define GL_MAJOR_VERSION                  0x821B
+#define GL_MINOR_VERSION                  0x821C
+#define GL_NUM_EXTENSIONS                 0x821D
+#define GL_RGBA32F                        0x8814
+#define GL_RGB32F                         0x8815
+#define GL_RGBA16F                        0x881A
+#define GL_RGB16F                         0x881B
+#define GL_VERTEX_ATTRIB_ARRAY_INTEGER    0x88FD
+#define GL_MAX_ARRAY_TEXTURE_LAYERS       0x88FF
+#define GL_MIN_PROGRAM_TEXEL_OFFSET       0x8904
+#define GL_MAX_PROGRAM_TEXEL_OFFSET       0x8905
+#define GL_MAX_VARYING_COMPONENTS         0x8B4B
+#define GL_TEXTURE_2D_ARRAY               0x8C1A
+#define GL_TEXTURE_BINDING_2D_ARRAY       0x8C1D
+#define GL_R11F_G11F_B10F                 0x8C3A
+#define GL_UNSIGNED_INT_10F_11F_11F_REV   0x8C3B
+#define GL_RGB9_E5                        0x8C3D
+#define GL_UNSIGNED_INT_5_9_9_9_REV       0x8C3E
+#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76
+#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80
+#define GL_TRANSFORM_FEEDBACK_VARYINGS    0x8C83
+#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84
+#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85
+#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88
+#define GL_RASTERIZER_DISCARD             0x8C89
+#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B
+#define GL_INTERLEAVED_ATTRIBS            0x8C8C
+#define GL_SEPARATE_ATTRIBS               0x8C8D
+#define GL_TRANSFORM_FEEDBACK_BUFFER      0x8C8E
+#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F
+#define GL_RGBA32UI                       0x8D70
+#define GL_RGB32UI                        0x8D71
+#define GL_RGBA16UI                       0x8D76
+#define GL_RGB16UI                        0x8D77
+#define GL_RGBA8UI                        0x8D7C
+#define GL_RGB8UI                         0x8D7D
+#define GL_RGBA32I                        0x8D82
+#define GL_RGB32I                         0x8D83
+#define GL_RGBA16I                        0x8D88
+#define GL_RGB16I                         0x8D89
+#define GL_RGBA8I                         0x8D8E
+#define GL_RGB8I                          0x8D8F
+#define GL_RED_INTEGER                    0x8D94
+#define GL_RGB_INTEGER                    0x8D98
+#define GL_RGBA_INTEGER                   0x8D99
+#define GL_SAMPLER_2D_ARRAY               0x8DC1
+#define GL_SAMPLER_2D_ARRAY_SHADOW        0x8DC4
+#define GL_SAMPLER_CUBE_SHADOW            0x8DC5
+#define GL_UNSIGNED_INT_VEC2              0x8DC6
+#define GL_UNSIGNED_INT_VEC3              0x8DC7
+#define GL_UNSIGNED_INT_VEC4              0x8DC8
+#define GL_INT_SAMPLER_2D                 0x8DCA
+#define GL_INT_SAMPLER_3D                 0x8DCB
+#define GL_INT_SAMPLER_CUBE               0x8DCC
+#define GL_INT_SAMPLER_2D_ARRAY           0x8DCF
+#define GL_UNSIGNED_INT_SAMPLER_2D        0x8DD2
+#define GL_UNSIGNED_INT_SAMPLER_3D        0x8DD3
+#define GL_UNSIGNED_INT_SAMPLER_CUBE      0x8DD4
+#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY  0x8DD7
+#define GL_BUFFER_ACCESS_FLAGS            0x911F
+#define GL_BUFFER_MAP_LENGTH              0x9120
+#define GL_BUFFER_MAP_OFFSET              0x9121
+#define GL_DEPTH_COMPONENT32F             0x8CAC
+#define GL_DEPTH32F_STENCIL8              0x8CAD
+#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD
+#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210
+#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211
+#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212
+#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213
+#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214
+#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215
+#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216
+#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217
+#define GL_FRAMEBUFFER_DEFAULT            0x8218
+#define GL_FRAMEBUFFER_UNDEFINED          0x8219
+#define GL_DEPTH_STENCIL_ATTACHMENT       0x821A
+#define GL_DEPTH_STENCIL                  0x84F9
+#define GL_UNSIGNED_INT_24_8              0x84FA
+#define GL_DEPTH24_STENCIL8               0x88F0
+#define GL_UNSIGNED_NORMALIZED            0x8C17
+#define GL_DRAW_FRAMEBUFFER_BINDING       0x8CA6
+#define GL_READ_FRAMEBUFFER               0x8CA8
+#define GL_DRAW_FRAMEBUFFER               0x8CA9
+#define GL_READ_FRAMEBUFFER_BINDING       0x8CAA
+#define GL_RENDERBUFFER_SAMPLES           0x8CAB
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4
+#define GL_MAX_COLOR_ATTACHMENTS          0x8CDF
+#define GL_COLOR_ATTACHMENT1              0x8CE1
+#define GL_COLOR_ATTACHMENT2              0x8CE2
+#define GL_COLOR_ATTACHMENT3              0x8CE3
+#define GL_COLOR_ATTACHMENT4              0x8CE4
+#define GL_COLOR_ATTACHMENT5              0x8CE5
+#define GL_COLOR_ATTACHMENT6              0x8CE6
+#define GL_COLOR_ATTACHMENT7              0x8CE7
+#define GL_COLOR_ATTACHMENT8              0x8CE8
+#define GL_COLOR_ATTACHMENT9              0x8CE9
+#define GL_COLOR_ATTACHMENT10             0x8CEA
+#define GL_COLOR_ATTACHMENT11             0x8CEB
+#define GL_COLOR_ATTACHMENT12             0x8CEC
+#define GL_COLOR_ATTACHMENT13             0x8CED
+#define GL_COLOR_ATTACHMENT14             0x8CEE
+#define GL_COLOR_ATTACHMENT15             0x8CEF
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56
+#define GL_MAX_SAMPLES                    0x8D57
+#define GL_HALF_FLOAT                     0x140B
+#define GL_MAP_READ_BIT                   0x0001
+#define GL_MAP_WRITE_BIT                  0x0002
+#define GL_MAP_INVALIDATE_RANGE_BIT       0x0004
+#define GL_MAP_INVALIDATE_BUFFER_BIT      0x0008
+#define GL_MAP_FLUSH_EXPLICIT_BIT         0x0010
+#define GL_MAP_UNSYNCHRONIZED_BIT         0x0020
+#define GL_RG                             0x8227
+#define GL_RG_INTEGER                     0x8228
+#define GL_R8                             0x8229
+#define GL_RG8                            0x822B
+#define GL_R16F                           0x822D
+#define GL_R32F                           0x822E
+#define GL_RG16F                          0x822F
+#define GL_RG32F                          0x8230
+#define GL_R8I                            0x8231
+#define GL_R8UI                           0x8232
+#define GL_R16I                           0x8233
+#define GL_R16UI                          0x8234
+#define GL_R32I                           0x8235
+#define GL_R32UI                          0x8236
+#define GL_RG8I                           0x8237
+#define GL_RG8UI                          0x8238
+#define GL_RG16I                          0x8239
+#define GL_RG16UI                         0x823A
+#define GL_RG32I                          0x823B
+#define GL_RG32UI                         0x823C
+#define GL_VERTEX_ARRAY_BINDING           0x85B5
+#define GL_R8_SNORM                       0x8F94
+#define GL_RG8_SNORM                      0x8F95
+#define GL_RGB8_SNORM                     0x8F96
+#define GL_RGBA8_SNORM                    0x8F97
+#define GL_SIGNED_NORMALIZED              0x8F9C
+#define GL_PRIMITIVE_RESTART_FIXED_INDEX  0x8D69
+#define GL_COPY_READ_BUFFER               0x8F36
+#define GL_COPY_WRITE_BUFFER              0x8F37
+#define GL_COPY_READ_BUFFER_BINDING       0x8F36
+#define GL_COPY_WRITE_BUFFER_BINDING      0x8F37
+#define GL_UNIFORM_BUFFER                 0x8A11
+#define GL_UNIFORM_BUFFER_BINDING         0x8A28
+#define GL_UNIFORM_BUFFER_START           0x8A29
+#define GL_UNIFORM_BUFFER_SIZE            0x8A2A
+#define GL_MAX_VERTEX_UNIFORM_BLOCKS      0x8A2B
+#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS    0x8A2D
+#define GL_MAX_COMBINED_UNIFORM_BLOCKS    0x8A2E
+#define GL_MAX_UNIFORM_BUFFER_BINDINGS    0x8A2F
+#define GL_MAX_UNIFORM_BLOCK_SIZE         0x8A30
+#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31
+#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33
+#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34
+#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35
+#define GL_ACTIVE_UNIFORM_BLOCKS          0x8A36
+#define GL_UNIFORM_TYPE                   0x8A37
+#define GL_UNIFORM_SIZE                   0x8A38
+#define GL_UNIFORM_NAME_LENGTH            0x8A39
+#define GL_UNIFORM_BLOCK_INDEX            0x8A3A
+#define GL_UNIFORM_OFFSET                 0x8A3B
+#define GL_UNIFORM_ARRAY_STRIDE           0x8A3C
+#define GL_UNIFORM_MATRIX_STRIDE          0x8A3D
+#define GL_UNIFORM_IS_ROW_MAJOR           0x8A3E
+#define GL_UNIFORM_BLOCK_BINDING          0x8A3F
+#define GL_UNIFORM_BLOCK_DATA_SIZE        0x8A40
+#define GL_UNIFORM_BLOCK_NAME_LENGTH      0x8A41
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS  0x8A42
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46
+#define GL_INVALID_INDEX                  0xFFFFFFFFu
+#define GL_MAX_VERTEX_OUTPUT_COMPONENTS   0x9122
+#define GL_MAX_FRAGMENT_INPUT_COMPONENTS  0x9125
+#define GL_MAX_SERVER_WAIT_TIMEOUT        0x9111
+#define GL_OBJECT_TYPE                    0x9112
+#define GL_SYNC_CONDITION                 0x9113
+#define GL_SYNC_STATUS                    0x9114
+#define GL_SYNC_FLAGS                     0x9115
+#define GL_SYNC_FENCE                     0x9116
+#define GL_SYNC_GPU_COMMANDS_COMPLETE     0x9117
+#define GL_UNSIGNALED                     0x9118
+#define GL_SIGNALED                       0x9119
+#define GL_ALREADY_SIGNALED               0x911A
+#define GL_TIMEOUT_EXPIRED                0x911B
+#define GL_CONDITION_SATISFIED            0x911C
+#define GL_WAIT_FAILED                    0x911D
+#define GL_SYNC_FLUSH_COMMANDS_BIT        0x00000001
+#define GL_TIMEOUT_IGNORED                0xFFFFFFFFFFFFFFFFull
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR    0x88FE
+#define GL_ANY_SAMPLES_PASSED             0x8C2F
+#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A
+#define GL_SAMPLER_BINDING                0x8919
+#define GL_RGB10_A2UI                     0x906F
+#define GL_TEXTURE_SWIZZLE_R              0x8E42
+#define GL_TEXTURE_SWIZZLE_G              0x8E43
+#define GL_TEXTURE_SWIZZLE_B              0x8E44
+#define GL_TEXTURE_SWIZZLE_A              0x8E45
+#define GL_GREEN                          0x1904
+#define GL_BLUE                           0x1905
+#define GL_INT_2_10_10_10_REV             0x8D9F
+#define GL_TRANSFORM_FEEDBACK             0x8E22
+#define GL_TRANSFORM_FEEDBACK_PAUSED      0x8E23
+#define GL_TRANSFORM_FEEDBACK_ACTIVE      0x8E24
+#define GL_TRANSFORM_FEEDBACK_BINDING     0x8E25
+#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257
+#define GL_PROGRAM_BINARY_LENGTH          0x8741
+#define GL_NUM_PROGRAM_BINARY_FORMATS     0x87FE
+#define GL_PROGRAM_BINARY_FORMATS         0x87FF
+#define GL_COMPRESSED_R11_EAC             0x9270
+#define GL_COMPRESSED_SIGNED_R11_EAC      0x9271
+#define GL_COMPRESSED_RG11_EAC            0x9272
+#define GL_COMPRESSED_SIGNED_RG11_EAC     0x9273
+#define GL_COMPRESSED_RGB8_ETC2           0x9274
+#define GL_COMPRESSED_SRGB8_ETC2          0x9275
+#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276
+#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277
+#define GL_COMPRESSED_RGBA8_ETC2_EAC      0x9278
+#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279
+#define GL_TEXTURE_IMMUTABLE_FORMAT       0x912F
+#define GL_MAX_ELEMENT_INDEX              0x8D6B
+#define GL_NUM_SAMPLE_COUNTS              0x9380
+#define GL_TEXTURE_IMMUTABLE_LEVELS       0x82DF
+GL_APICALL void GL_APIENTRY glReadBuffer (GLenum src);
+GL_APICALL void GL_APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
+GL_APICALL void GL_APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
+GL_APICALL void GL_APIENTRY glTexSubImage3D (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 glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage3D (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 glGenQueries (GLsizei n, GLuint *ids);
+GL_APICALL void GL_APIENTRY glDeleteQueries (GLsizei n, const GLuint *ids);
+GL_APICALL GLboolean GL_APIENTRY glIsQuery (GLuint id);
+GL_APICALL void GL_APIENTRY glBeginQuery (GLenum target, GLuint id);
+GL_APICALL void GL_APIENTRY glEndQuery (GLenum target);
+GL_APICALL void GL_APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params);
+GL_APICALL GLboolean GL_APIENTRY glUnmapBuffer (GLenum target);
+GL_APICALL void GL_APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, void **params);
+GL_APICALL void GL_APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs);
+GL_APICALL void GL_APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+GL_APICALL void *GL_APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+GL_APICALL void GL_APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length);
+GL_APICALL void GL_APIENTRY glBindVertexArray (GLuint array);
+GL_APICALL void GL_APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays);
+GL_APICALL void GL_APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays);
+GL_APICALL GLboolean GL_APIENTRY glIsVertexArray (GLuint array);
+GL_APICALL void GL_APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint *data);
+GL_APICALL void GL_APIENTRY glBeginTransformFeedback (GLenum primitiveMode);
+GL_APICALL void GL_APIENTRY glEndTransformFeedback (void);
+GL_APICALL void GL_APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+GL_APICALL void GL_APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer);
+GL_APICALL void GL_APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
+GL_APICALL void GL_APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
+GL_APICALL void GL_APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
+GL_APICALL void GL_APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params);
+GL_APICALL void GL_APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w);
+GL_APICALL void GL_APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+GL_APICALL void GL_APIENTRY glVertexAttribI4iv (GLuint index, const GLint *v);
+GL_APICALL void GL_APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint *v);
+GL_APICALL void GL_APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint *params);
+GL_APICALL GLint GL_APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name);
+GL_APICALL void GL_APIENTRY glUniform1ui (GLint location, GLuint v0);
+GL_APICALL void GL_APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1);
+GL_APICALL void GL_APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2);
+GL_APICALL void GL_APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+GL_APICALL void GL_APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value);
+GL_APICALL void GL_APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value);
+GL_APICALL void GL_APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
+GL_APICALL const GLubyte *GL_APIENTRY glGetStringi (GLenum name, GLuint index);
+GL_APICALL void GL_APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+GL_APICALL void GL_APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices);
+GL_APICALL void GL_APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
+GL_APICALL GLuint GL_APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName);
+GL_APICALL void GL_APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
+GL_APICALL void GL_APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+GL_APICALL void GL_APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
+GL_APICALL void GL_APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
+GL_APICALL GLsync GL_APIENTRY glFenceSync (GLenum condition, GLbitfield flags);
+GL_APICALL GLboolean GL_APIENTRY glIsSync (GLsync sync);
+GL_APICALL void GL_APIENTRY glDeleteSync (GLsync sync);
+GL_APICALL GLenum GL_APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_APICALL void GL_APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GL_APICALL void GL_APIENTRY glGetInteger64v (GLenum pname, GLint64 *data);
+GL_APICALL void GL_APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+GL_APICALL void GL_APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data);
+GL_APICALL void GL_APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params);
+GL_APICALL void GL_APIENTRY glGenSamplers (GLsizei count, GLuint *samplers);
+GL_APICALL void GL_APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers);
+GL_APICALL GLboolean GL_APIENTRY glIsSampler (GLuint sampler);
+GL_APICALL void GL_APIENTRY glBindSampler (GLuint unit, GLuint sampler);
+GL_APICALL void GL_APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param);
+GL_APICALL void GL_APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param);
+GL_APICALL void GL_APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param);
+GL_APICALL void GL_APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params);
+GL_APICALL void GL_APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor);
+GL_APICALL void GL_APIENTRY glBindTransformFeedback (GLenum target, GLuint id);
+GL_APICALL void GL_APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint *ids);
+GL_APICALL void GL_APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint *ids);
+GL_APICALL GLboolean GL_APIENTRY glIsTransformFeedback (GLuint id);
+GL_APICALL void GL_APIENTRY glPauseTransformFeedback (void);
+GL_APICALL void GL_APIENTRY glResumeTransformFeedback (void);
+GL_APICALL void GL_APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
+GL_APICALL void GL_APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
+GL_APICALL void GL_APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value);
+GL_APICALL void GL_APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments);
+GL_APICALL void GL_APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+GL_APICALL void GL_APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
+#endif /* GL_ES_VERSION_3_0 */
+
+#ifndef GL_ES_VERSION_3_1
+#define GL_ES_VERSION_3_1 1
+#define GL_COMPUTE_SHADER                 0x91B9
+#define GL_MAX_COMPUTE_UNIFORM_BLOCKS     0x91BB
+#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC
+#define GL_MAX_COMPUTE_IMAGE_UNIFORMS     0x91BD
+#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262
+#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263
+#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264
+#define GL_MAX_COMPUTE_ATOMIC_COUNTERS    0x8265
+#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266
+#define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB
+#define GL_MAX_COMPUTE_WORK_GROUP_COUNT   0x91BE
+#define GL_MAX_COMPUTE_WORK_GROUP_SIZE    0x91BF
+#define GL_COMPUTE_WORK_GROUP_SIZE        0x8267
+#define GL_DISPATCH_INDIRECT_BUFFER       0x90EE
+#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF
+#define GL_COMPUTE_SHADER_BIT             0x00000020
+#define GL_DRAW_INDIRECT_BUFFER           0x8F3F
+#define GL_DRAW_INDIRECT_BUFFER_BINDING   0x8F43
+#define GL_MAX_UNIFORM_LOCATIONS          0x826E
+#define GL_FRAMEBUFFER_DEFAULT_WIDTH      0x9310
+#define GL_FRAMEBUFFER_DEFAULT_HEIGHT     0x9311
+#define GL_FRAMEBUFFER_DEFAULT_SAMPLES    0x9313
+#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314
+#define GL_MAX_FRAMEBUFFER_WIDTH          0x9315
+#define GL_MAX_FRAMEBUFFER_HEIGHT         0x9316
+#define GL_MAX_FRAMEBUFFER_SAMPLES        0x9318
+#define GL_UNIFORM                        0x92E1
+#define GL_UNIFORM_BLOCK                  0x92E2
+#define GL_PROGRAM_INPUT                  0x92E3
+#define GL_PROGRAM_OUTPUT                 0x92E4
+#define GL_BUFFER_VARIABLE                0x92E5
+#define GL_SHADER_STORAGE_BLOCK           0x92E6
+#define GL_ATOMIC_COUNTER_BUFFER          0x92C0
+#define GL_TRANSFORM_FEEDBACK_VARYING     0x92F4
+#define GL_ACTIVE_RESOURCES               0x92F5
+#define GL_MAX_NAME_LENGTH                0x92F6
+#define GL_MAX_NUM_ACTIVE_VARIABLES       0x92F7
+#define GL_NAME_LENGTH                    0x92F9
+#define GL_TYPE                           0x92FA
+#define GL_ARRAY_SIZE                     0x92FB
+#define GL_OFFSET                         0x92FC
+#define GL_BLOCK_INDEX                    0x92FD
+#define GL_ARRAY_STRIDE                   0x92FE
+#define GL_MATRIX_STRIDE                  0x92FF
+#define GL_IS_ROW_MAJOR                   0x9300
+#define GL_ATOMIC_COUNTER_BUFFER_INDEX    0x9301
+#define GL_BUFFER_BINDING                 0x9302
+#define GL_BUFFER_DATA_SIZE               0x9303
+#define GL_NUM_ACTIVE_VARIABLES           0x9304
+#define GL_ACTIVE_VARIABLES               0x9305
+#define GL_REFERENCED_BY_VERTEX_SHADER    0x9306
+#define GL_REFERENCED_BY_FRAGMENT_SHADER  0x930A
+#define GL_REFERENCED_BY_COMPUTE_SHADER   0x930B
+#define GL_TOP_LEVEL_ARRAY_SIZE           0x930C
+#define GL_TOP_LEVEL_ARRAY_STRIDE         0x930D
+#define GL_LOCATION                       0x930E
+#define GL_VERTEX_SHADER_BIT              0x00000001
+#define GL_FRAGMENT_SHADER_BIT            0x00000002
+#define GL_ALL_SHADER_BITS                0xFFFFFFFF
+#define GL_PROGRAM_SEPARABLE              0x8258
+#define GL_ACTIVE_PROGRAM                 0x8259
+#define GL_PROGRAM_PIPELINE_BINDING       0x825A
+#define GL_ATOMIC_COUNTER_BUFFER_BINDING  0x92C1
+#define GL_ATOMIC_COUNTER_BUFFER_START    0x92C2
+#define GL_ATOMIC_COUNTER_BUFFER_SIZE     0x92C3
+#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC
+#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0
+#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1
+#define GL_MAX_VERTEX_ATOMIC_COUNTERS     0x92D2
+#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS   0x92D6
+#define GL_MAX_COMBINED_ATOMIC_COUNTERS   0x92D7
+#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8
+#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC
+#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS  0x92D9
+#define GL_UNSIGNED_INT_ATOMIC_COUNTER    0x92DB
+#define GL_MAX_IMAGE_UNITS                0x8F38
+#define GL_MAX_VERTEX_IMAGE_UNIFORMS      0x90CA
+#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS    0x90CE
+#define GL_MAX_COMBINED_IMAGE_UNIFORMS    0x90CF
+#define GL_IMAGE_BINDING_NAME             0x8F3A
+#define GL_IMAGE_BINDING_LEVEL            0x8F3B
+#define GL_IMAGE_BINDING_LAYERED          0x8F3C
+#define GL_IMAGE_BINDING_LAYER            0x8F3D
+#define GL_IMAGE_BINDING_ACCESS           0x8F3E
+#define GL_IMAGE_BINDING_FORMAT           0x906E
+#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001
+#define GL_ELEMENT_ARRAY_BARRIER_BIT      0x00000002
+#define GL_UNIFORM_BARRIER_BIT            0x00000004
+#define GL_TEXTURE_FETCH_BARRIER_BIT      0x00000008
+#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020
+#define GL_COMMAND_BARRIER_BIT            0x00000040
+#define GL_PIXEL_BUFFER_BARRIER_BIT       0x00000080
+#define GL_TEXTURE_UPDATE_BARRIER_BIT     0x00000100
+#define GL_BUFFER_UPDATE_BARRIER_BIT      0x00000200
+#define GL_FRAMEBUFFER_BARRIER_BIT        0x00000400
+#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800
+#define GL_ATOMIC_COUNTER_BARRIER_BIT     0x00001000
+#define GL_ALL_BARRIER_BITS               0xFFFFFFFF
+#define GL_IMAGE_2D                       0x904D
+#define GL_IMAGE_3D                       0x904E
+#define GL_IMAGE_CUBE                     0x9050
+#define GL_IMAGE_2D_ARRAY                 0x9053
+#define GL_INT_IMAGE_2D                   0x9058
+#define GL_INT_IMAGE_3D                   0x9059
+#define GL_INT_IMAGE_CUBE                 0x905B
+#define GL_INT_IMAGE_2D_ARRAY             0x905E
+#define GL_UNSIGNED_INT_IMAGE_2D          0x9063
+#define GL_UNSIGNED_INT_IMAGE_3D          0x9064
+#define GL_UNSIGNED_INT_IMAGE_CUBE        0x9066
+#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY    0x9069
+#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7
+#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8
+#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9
+#define GL_READ_ONLY                      0x88B8
+#define GL_WRITE_ONLY                     0x88B9
+#define GL_READ_WRITE                     0x88BA
+#define GL_SHADER_STORAGE_BUFFER          0x90D2
+#define GL_SHADER_STORAGE_BUFFER_BINDING  0x90D3
+#define GL_SHADER_STORAGE_BUFFER_START    0x90D4
+#define GL_SHADER_STORAGE_BUFFER_SIZE     0x90D5
+#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6
+#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA
+#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB
+#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC
+#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD
+#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE  0x90DE
+#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF
+#define GL_SHADER_STORAGE_BARRIER_BIT     0x00002000
+#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39
+#define GL_DEPTH_STENCIL_TEXTURE_MODE     0x90EA
+#define GL_STENCIL_INDEX                  0x1901
+#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E
+#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F
+#define GL_SAMPLE_POSITION                0x8E50
+#define GL_SAMPLE_MASK                    0x8E51
+#define GL_SAMPLE_MASK_VALUE              0x8E52
+#define GL_TEXTURE_2D_MULTISAMPLE         0x9100
+#define GL_MAX_SAMPLE_MASK_WORDS          0x8E59
+#define GL_MAX_COLOR_TEXTURE_SAMPLES      0x910E
+#define GL_MAX_DEPTH_TEXTURE_SAMPLES      0x910F
+#define GL_MAX_INTEGER_SAMPLES            0x9110
+#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104
+#define GL_TEXTURE_SAMPLES                0x9106
+#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107
+#define GL_TEXTURE_WIDTH                  0x1000
+#define GL_TEXTURE_HEIGHT                 0x1001
+#define GL_TEXTURE_DEPTH                  0x8071
+#define GL_TEXTURE_INTERNAL_FORMAT        0x1003
+#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_DEPTH_SIZE             0x884A
+#define GL_TEXTURE_STENCIL_SIZE           0x88F1
+#define GL_TEXTURE_SHARED_SIZE            0x8C3F
+#define GL_TEXTURE_RED_TYPE               0x8C10
+#define GL_TEXTURE_GREEN_TYPE             0x8C11
+#define GL_TEXTURE_BLUE_TYPE              0x8C12
+#define GL_TEXTURE_ALPHA_TYPE             0x8C13
+#define GL_TEXTURE_DEPTH_TYPE             0x8C16
+#define GL_TEXTURE_COMPRESSED             0x86A1
+#define GL_SAMPLER_2D_MULTISAMPLE         0x9108
+#define GL_INT_SAMPLER_2D_MULTISAMPLE     0x9109
+#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A
+#define GL_VERTEX_ATTRIB_BINDING          0x82D4
+#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET  0x82D5
+#define GL_VERTEX_BINDING_DIVISOR         0x82D6
+#define GL_VERTEX_BINDING_OFFSET          0x82D7
+#define GL_VERTEX_BINDING_STRIDE          0x82D8
+#define GL_VERTEX_BINDING_BUFFER          0x8F4F
+#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9
+#define GL_MAX_VERTEX_ATTRIB_BINDINGS     0x82DA
+#define GL_MAX_VERTEX_ATTRIB_STRIDE       0x82E5
+GL_APICALL void GL_APIENTRY glDispatchCompute (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
+GL_APICALL void GL_APIENTRY glDispatchComputeIndirect (GLintptr indirect);
+GL_APICALL void GL_APIENTRY glDrawArraysIndirect (GLenum mode, const void *indirect);
+GL_APICALL void GL_APIENTRY glDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect);
+GL_APICALL void GL_APIENTRY glFramebufferParameteri (GLenum target, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glGetFramebufferParameteriv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetProgramInterfaceiv (GLuint program, GLenum programInterface, GLenum pname, GLint *params);
+GL_APICALL GLuint GL_APIENTRY glGetProgramResourceIndex (GLuint program, GLenum programInterface, const GLchar *name);
+GL_APICALL void GL_APIENTRY glGetProgramResourceName (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
+GL_APICALL void GL_APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
+GL_APICALL GLint GL_APIENTRY glGetProgramResourceLocation (GLuint program, GLenum programInterface, const GLchar *name);
+GL_APICALL void GL_APIENTRY glUseProgramStages (GLuint pipeline, GLbitfield stages, GLuint program);
+GL_APICALL void GL_APIENTRY glActiveShaderProgram (GLuint pipeline, GLuint program);
+GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramv (GLenum type, GLsizei count, const GLchar *const*strings);
+GL_APICALL void GL_APIENTRY glBindProgramPipeline (GLuint pipeline);
+GL_APICALL void GL_APIENTRY glDeleteProgramPipelines (GLsizei n, const GLuint *pipelines);
+GL_APICALL void GL_APIENTRY glGenProgramPipelines (GLsizei n, GLuint *pipelines);
+GL_APICALL GLboolean GL_APIENTRY glIsProgramPipeline (GLuint pipeline);
+GL_APICALL void GL_APIENTRY glGetProgramPipelineiv (GLuint pipeline, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glProgramUniform1i (GLuint program, GLint location, GLint v0);
+GL_APICALL void GL_APIENTRY glProgramUniform2i (GLuint program, GLint location, GLint v0, GLint v1);
+GL_APICALL void GL_APIENTRY glProgramUniform3i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
+GL_APICALL void GL_APIENTRY glProgramUniform4i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+GL_APICALL void GL_APIENTRY glProgramUniform1ui (GLuint program, GLint location, GLuint v0);
+GL_APICALL void GL_APIENTRY glProgramUniform2ui (GLuint program, GLint location, GLuint v0, GLuint v1);
+GL_APICALL void GL_APIENTRY glProgramUniform3ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
+GL_APICALL void GL_APIENTRY glProgramUniform4ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+GL_APICALL void GL_APIENTRY glProgramUniform1f (GLuint program, GLint location, GLfloat v0);
+GL_APICALL void GL_APIENTRY glProgramUniform2f (GLuint program, GLint location, GLfloat v0, GLfloat v1);
+GL_APICALL void GL_APIENTRY glProgramUniform3f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+GL_APICALL void GL_APIENTRY glProgramUniform4f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+GL_APICALL void GL_APIENTRY glProgramUniform1iv (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2iv (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3iv (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4iv (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform1uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform1fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glValidateProgramPipeline (GLuint pipeline);
+GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLog (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GL_APICALL void GL_APIENTRY glBindImageTexture (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
+GL_APICALL void GL_APIENTRY glGetBooleani_v (GLenum target, GLuint index, GLboolean *data);
+GL_APICALL void GL_APIENTRY glMemoryBarrier (GLbitfield barriers);
+GL_APICALL void GL_APIENTRY glMemoryBarrierByRegion (GLbitfield barriers);
+GL_APICALL void GL_APIENTRY glTexStorage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
+GL_APICALL void GL_APIENTRY glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val);
+GL_APICALL void GL_APIENTRY glSampleMaski (GLuint maskNumber, GLbitfield mask);
+GL_APICALL void GL_APIENTRY glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params);
+GL_APICALL void GL_APIENTRY glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
+GL_APICALL void GL_APIENTRY glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
+GL_APICALL void GL_APIENTRY glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
+GL_APICALL void GL_APIENTRY glVertexAttribBinding (GLuint attribindex, GLuint bindingindex);
+GL_APICALL void GL_APIENTRY glVertexBindingDivisor (GLuint bindingindex, GLuint divisor);
+#endif /* GL_ES_VERSION_3_1 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include_KHR/GLES3/gl3platform.h b/include_KHR/GLES3/gl3platform.h
new file mode 100644 (file)
index 0000000..b1e869d
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef __gl3platform_h_
+#define __gl3platform_h_
+
+/* $Revision: 23328 $ on $Date:: 2013-10-02 02:28:28 -0700 #$ */
+
+/*
+ * 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 3.X  gl3.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 <KHR/khrplatform.h>
+
+#ifndef GL_APICALL
+#define GL_APICALL  KHRONOS_APICALL
+#endif
+
+#ifndef GL_APIENTRY
+#define GL_APIENTRY KHRONOS_APIENTRY
+#endif
+
+#endif /* __gl3platform_h_ */
diff --git a/include_KHR/KHR/khrplatform.h b/include_KHR/KHR/khrplatform.h
new file mode 100644 (file)
index 0000000..c9e6f17
--- /dev/null
@@ -0,0 +1,282 @@
+#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: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $
+ *
+ * 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 <KHR/khrplatform.h>
+ * 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__)
+#   define KHRONOS_APICALL __declspec(dllimport)
+#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 <stdint.h>
+ */
+#include <stdint.h>
+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 <inttypes.h>
+ */
+#include <inttypes.h>
+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 <stdint.h>
+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;
+
+/*
+ * Types that differ between LLP64 and LP64 architectures - in LLP64, 
+ * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
+ * to be the only LLP64 architecture in current use.
+ */
+#ifdef _WIN64
+typedef signed   long long int khronos_intptr_t;
+typedef unsigned long long int khronos_uintptr_t;
+typedef signed   long long int khronos_ssize_t;
+typedef unsigned long long int khronos_usize_t;
+#else
+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;
+#endif
+
+#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 --git a/packaging/coregl.manifest b/packaging/coregl.manifest
new file mode 100644 (file)
index 0000000..97e8c31
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+       <request>
+               <domain name="_"/>
+       </request>
+</manifest>
diff --git a/packaging/coregl.spec b/packaging/coregl.spec
new file mode 100644 (file)
index 0000000..d03832a
--- /dev/null
@@ -0,0 +1,93 @@
+%define BYPASS_COREGL 0
+
+Name:          coregl
+Summary:       CoreGL FastPath Optimization
+Version:       4.0
+Release:       02
+ExclusiveArch: %arm
+Group:         Graphics
+License:       Apache-2.0 and MIT and SGI-B-2.0 and Zlib and Libpng
+URL:           http://www.tizen.org
+Source:                %{name}-%{version}.tar.gz
+
+BuildRequires:  cmake
+BuildRequires:  pkgconfig(dlog)
+
+%description
+CoreGL provides the following capabilities:
+- Support for driver-independent optimization (FastPath)
+- EGL/OpenGL ES debugging
+- Performance logging
+
+Supported versions:
+- EGL 1.4
+- OpenGL ES 2.0, 3.0
+
+%package devel
+Summary:               Development files for EGL 1.4 and OpenGL ES 1.1 and 2.0
+Group:                 Graphics
+Requires:              %{name} = %{version}-%{release}
+
+%description devel
+This package contains the development libraries and header files needed by
+packages that requires OpenGL ES 1.1 or 2.0 acceleration.
+
+
+%prep
+%setup -q -n %{name}-%{version}
+
+%build
+cmake . -DCMAKE_INSTALL_PREFIX=/usr %{?extra_option}
+make %{?jobs:-j%jobs}
+
+%install
+# release pkg
+mkdir -p %{buildroot}/usr/share/license
+mkdir -p %{buildroot}%{_libdir}/pkgconfig
+
+cat LICENSE > %{buildroot}/usr/share/license/%{name}
+
+cp libCOREGL.so.4.0                            %{buildroot}%{_libdir}/
+ln -sf libCOREGL.so.4.0                                %{buildroot}%{_libdir}/libCOREGL.so.4
+ln -sf libCOREGL.so.4                          %{buildroot}%{_libdir}/libCOREGL.so
+cp libCOREGL_EGL.so.1.4                                %{buildroot}%{_libdir}/
+ln -sf libCOREGL_EGL.so.1.4                    %{buildroot}%{_libdir}/libEGL.so.1.4
+ln -sf libCOREGL_EGL.so.1.4                    %{buildroot}%{_libdir}/libEGL.so.1
+ln -sf libEGL.so.1                             %{buildroot}%{_libdir}/libEGL.so
+cp libCOREGL_GLESv2.so.2.0                     %{buildroot}%{_libdir}/
+ln -sf libCOREGL_GLESv2.so.2.0                 %{buildroot}%{_libdir}/libGLESv2.so.2.0
+ln -sf libCOREGL_GLESv2.so.2.0                 %{buildroot}%{_libdir}/libGLESv2.so.2
+ln -sf libGLESv2.so.2                          %{buildroot}%{_libdir}/libGLESv2.so
+
+# devel pkg
+mkdir -p %{buildroot}%{_includedir}
+cp -a include_KHR/EGL                  %{buildroot}%{_includedir}
+cp -a include_KHR/GLES                 %{buildroot}%{_includedir}
+cp -a include_KHR/GLES2                        %{buildroot}%{_includedir}
+cp -a include_KHR/KHR                  %{buildroot}%{_includedir}
+cp -a pkgconfig/*.pc                   %{buildroot}%{_libdir}/pkgconfig/
+
+%clean
+rm -rf %{buildroot}
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files
+%manifest packaging/coregl.manifest
+%defattr(-,root,root,-)
+/usr/share/license/%{name}
+%{_libdir}/libCOREGL.so*
+%{_libdir}/libCOREGL_EGL.so.1.4
+%{_libdir}/libCOREGL_GLESv2.so.2.0
+
+%files devel
+%defattr(-,root,root,-)
+%{_includedir}/EGL/*
+%{_includedir}/GLES/*
+%{_includedir}/GLES2/*
+%{_includedir}/KHR/*
+%{_libdir}/pkgconfig/*.pc
+%{_libdir}/libEGL.so*
+%{_libdir}/libGLESv2.so*
diff --git a/pkgconfig/egl.pc b/pkgconfig/egl.pc
new file mode 100644 (file)
index 0000000..c4da1d1
--- /dev/null
@@ -0,0 +1,12 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: egl
+Description: EGL 1.4 Library for CoreGL
+Requires.private:
+Version: 4.0
+Libs: -L${libdir} -lEGL
+Libs.private:
+Cflags: -I${includedir}
diff --git a/pkgconfig/gles11.pc b/pkgconfig/gles11.pc
new file mode 100644 (file)
index 0000000..9306e86
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: gles11
+Description: OpenGL-ES 1.1 Library for ARM Mali 400MP
+Version: 0.1
+Requires:
+Libs: -L${libdir} -lGLESv1_CM -lEGL
+Cflags: -I${includedir}
diff --git a/pkgconfig/gles20.pc b/pkgconfig/gles20.pc
new file mode 100644 (file)
index 0000000..2b99820
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: gles20
+Description: OpenGL-ES 2.0 Library for ARM Mali 400MP
+Version: 0.1
+Requires:
+Libs: -L${libdir} -lGLESv2 -lEGL
+Cflags: -I${includedir}
diff --git a/pkgconfig/glesv1.pc b/pkgconfig/glesv1.pc
new file mode 100644 (file)
index 0000000..da7cf0e
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: glesv1
+Description: OpenGL-ES 1.1 Library for ARM Mali 400MP
+Version: 0.1
+Requires:
+Libs: -L${libdir} -lGLESv1_CM -lEGL
+Cflags: -I${includedir}
diff --git a/pkgconfig/glesv1_cm.pc b/pkgconfig/glesv1_cm.pc
new file mode 100644 (file)
index 0000000..153fd3b
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: glesv1_cm
+Description: OpenGL-ES 1.1 Library for ARM Mali 400MP
+Version: 0.1
+Requires:
+Libs: -L${libdir} -lGLESv1_CM -lEGL
+Cflags: -I${includedir}
diff --git a/pkgconfig/glesv2.pc b/pkgconfig/glesv2.pc
new file mode 100644 (file)
index 0000000..a73e902
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: glesv2
+Description: OpenGL-ES 2.0 Library for ARM Mali 400MP
+Version: 0.1
+Requires:
+Libs: -L${libdir} -lGLESv2 -lEGL
+Cflags: -I${includedir}
diff --git a/pkgconfig/opengl-es-11.pc b/pkgconfig/opengl-es-11.pc
new file mode 100644 (file)
index 0000000..0b9b9b9
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: opengl-es-11
+Description: OpenGL-ES 1.1 Library for Virtual Driver
+Version: 0.1
+Requires:
+Libs: -L${libdir} -lGLESv1_CM -lEGL
+Cflags: -I${includedir}
diff --git a/pkgconfig/opengl-es-20.pc b/pkgconfig/opengl-es-20.pc
new file mode 100644 (file)
index 0000000..1ddc544
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: opengl-es-20
+Description: OpenGL-ES 2.0 Library for Virtual Driver
+Version: 0.1
+Requires:
+Libs: -L${libdir} -lGLESv2 -lEGL
+Cflags: -I${includedir}
diff --git a/src/coregl.c b/src/coregl.c
new file mode 100644 (file)
index 0000000..9ded135
--- /dev/null
@@ -0,0 +1,238 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <dlfcn.h>
+#include <string.h>
+
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "coregl_internal.h"
+#include "coregl_export.h"
+
+void               *egl_lib_handle;
+void               *gl_lib_handle;
+int                 driver_gl_version=COREGL_GLAPI_2;
+static int          api_gl_version=COREGL_GLAPI_2;
+
+#ifndef _COREGL_VENDOR_EGL_LIB_PATH
+#define _COREGL_VENDOR_EGL_LIB_PATH "/usr/lib/driver/libEGL.so" /* DEFAULT EGL PATH */
+#endif
+
+#ifndef _COREGL_VENDOR_GL_LIB_PATH
+#define _COREGL_VENDOR_GL_LIB_PATH "/usr/lib/driver/libGLESv2.so" /* DEFAULT GL PATH */
+#endif
+
+// Symbol definition for real
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     RET_TYPE (*_sym_##FUNC_NAME) PARAM_LIST;
+#include "headers/sym.h"
+#undef _COREGL_SYMBOL
+
+const char *
+get_env_setting(const char *name)
+{
+       char *fp_env = NULL;
+       static char *fp_default = "\0";
+       fp_env = secure_getenv(name);
+       if (fp_env == NULL) fp_env = fp_default;
+       return fp_env;
+}
+
+void
+cleanup_current_thread_state()
+{
+       GLThreadState *tstate = NULL;
+
+       tstate = get_current_thread_state();
+
+       if (tstate != NULL)
+       {
+               COREGL_LOG("[COREGL] de-init thread state \n");
+               deinit_modules_tstate(tstate);
+               remove_from_general_trace_list(&thread_trace_list, tstate);
+               free(tstate);
+               tstate = NULL;
+       }
+
+       set_current_thread_state(NULL);
+}
+
+int
+init_new_thread_state()
+{
+       int ret = 0;
+       GLThreadState *tstate = NULL;
+
+       tstate = get_current_thread_state();
+       AST(tstate == NULL);
+
+       tstate = (GLThreadState *)calloc(1, sizeof(GLThreadState));
+        /* Prevent CID : 395855 */
+        if (tstate == NULL) goto finish;
+       tstate->thread_id = get_current_thread();
+       add_to_general_trace_list(&thread_trace_list, tstate);
+
+       init_modules_tstate(tstate);
+       set_current_thread_state(tstate);
+
+       ret = 1;
+       goto finish;
+
+finish:
+       return ret;
+}
+
+static void
+_sym_missing()
+{
+       COREGL_ERR("GL symbol missing! Check client version!\n");
+}
+
+#define FINDSYM(libhandle, getproc, dst, sym) \
+   if(api_gl_version <= driver_gl_version) { \
+      if (!dst || (void *)dst == (void *)_sym_missing) \
+                 if (getproc) dst = (__typeof__(dst))getproc(sym); \
+      if (!dst || (void *)dst == (void *)_sym_missing) \
+                 dst = (__typeof__(dst))dlsym(libhandle, sym); \
+         if (!dst) dst = (__typeof__(dst))_sym_missing;\
+   }
+
+static int
+_glue_sym_init(void)
+{
+
+#define _COREGL_START_API(version)             api_gl_version = version;
+#define _COREGL_END_API(version)               api_gl_version = COREGL_GLAPI_2;
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST) \
+    FINDSYM(egl_lib_handle, _sym_eglGetProcAddress, _sym_##FUNC_NAME, #FUNC_NAME);
+#define _COREGL_EXT_SYMBOL_ALIAS(FUNC_NAME, ALIAS_NAME) \
+    FINDSYM(egl_lib_handle, _sym_eglGetProcAddress, _sym_##ALIAS_NAME, #FUNC_NAME);
+
+#include "headers/sym_egl.h"
+
+#undef _COREGL_EXT_SYMBOL_ALIAS
+#undef _COREGL_SYMBOL
+#undef _COREGL_START_API
+#undef _COREGL_END_API
+
+       return 1;
+}
+
+static int
+_gl_sym_init(void)
+{
+
+#define _COREGL_START_API(version)             api_gl_version = version;
+#define _COREGL_END_API(version)               api_gl_version = COREGL_GLAPI_2;
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST) \
+    FINDSYM(gl_lib_handle, _sym_eglGetProcAddress, _sym_##FUNC_NAME, #FUNC_NAME);
+#define _COREGL_EXT_SYMBOL_ALIAS(FUNC_NAME, ALIAS_NAME) \
+    FINDSYM(gl_lib_handle, _sym_eglGetProcAddress, _sym_##ALIAS_NAME, #FUNC_NAME);
+
+#include "headers/sym_gl.h"
+
+#undef _COREGL_EXT_SYMBOL_ALIAS
+#undef _COREGL_SYMBOL
+#undef _COREGL_START_API
+#undef _COREGL_END_API
+
+       return 1;
+}
+
+#undef FINDSYM
+
+
+COREGL_API void coregl_symbol_exported()
+{
+       COREGL_ERR("\E[40;31;1mInvalid library link! (Check linkage of libCOREGL)\E[0m\n");
+}
+
+static int
+_gl_lib_init(void)
+{
+       //------------------------------------------------//
+       // Open EGL Library as EGL is separate
+       egl_lib_handle = dlopen(_COREGL_VENDOR_EGL_LIB_PATH, RTLD_LAZY | RTLD_LOCAL);
+       if (!egl_lib_handle)
+       {
+               COREGL_ERR("\E[40;31;1m%s\E[0m\n\n", dlerror());
+               COREGL_ERR("\E[40;31;1mInvalid library link! (Check linkage of libCOREGL -> %s)\E[0m\n", _COREGL_VENDOR_EGL_LIB_PATH);
+               return 0;
+       }
+
+       // test for invalid linking egl
+       if (dlsym(egl_lib_handle, "coregl_symbol_exported"))
+       {
+               COREGL_ERR("\E[40;31;1mInvalid library link! (Check linkage of libCOREGL -> %s)\E[0m\n", _COREGL_VENDOR_EGL_LIB_PATH);
+               return 0;
+       }
+
+       // use gl_lib handle for GL symbols
+       gl_lib_handle = dlopen(_COREGL_VENDOR_GL_LIB_PATH, RTLD_LAZY | RTLD_LOCAL);
+       if (!gl_lib_handle)
+       {
+               COREGL_ERR("\E[40;31;1m%s\E[0m\n\n", dlerror());
+               COREGL_ERR("\E[40;31;1mInvalid library link! (Check linkage of libCOREGL -> %s)\E[0m\n", _COREGL_VENDOR_GL_LIB_PATH);
+               return 0;
+       }
+
+       // test for invalid linking gl
+       if (dlsym(gl_lib_handle, "coregl_symbol_exported"))
+       {
+               COREGL_ERR("\E[40;31;1mInvalid library link! (Check linkage of libCOREGL -> %s)\E[0m\n", _COREGL_VENDOR_GL_LIB_PATH);
+               return 0;
+       }
+
+       // test for a GLES 3.0 symbol
+       if (dlsym(gl_lib_handle, "glReadBuffer"))
+       {
+               COREGL_LOG("[CoreGL] Driver GL version 3.0 \n");
+               driver_gl_version = COREGL_GLAPI_3;
+       }else {
+               COREGL_LOG("[CoreGL] Driver GL version 2.0 \n");
+       }
+
+       //------------------------------------------------//
+
+       if (!_glue_sym_init()) return 0;
+       if (!_gl_sym_init()) return 0;
+
+       return 1;
+}
+
+static int
+_gl_lib_deinit(void)
+{
+       if (egl_lib_handle) dlclose(egl_lib_handle);
+       if (gl_lib_handle) dlclose(gl_lib_handle);
+
+       return 1;
+}
+
+int
+coregl_initialize()
+{
+       COREGL_LOG("[CoreGL] <%d> (%s) Library initializing...", getpid(), _COREGL_COMPILE_DATE);
+
+       if (!_gl_lib_init()) return 0;
+
+       init_export();
+
+       COREGL_LOG(" -> Completed\n");
+
+       init_modules();
+
+       return 1;
+}
+
+__attribute__((destructor))
+void
+coregl_terminate()
+{
+       if (export_initialized != 0)
+       {
+               deinit_modules();
+
+               _gl_lib_deinit();
+       }
+}
+
diff --git a/src/coregl.h b/src/coregl.h
new file mode 100644 (file)
index 0000000..c94c0e3
--- /dev/null
@@ -0,0 +1,24 @@
+#ifndef COREGL_H
+#define COREGL_H
+
+#define COREGL_API           __attribute__((visibility("default")))
+
+// Include GL/EGL/GLX types
+# include <GLES/glplatform.h>
+# include <EGL/eglplatform.h>
+# include "headers/egl.h"
+# include "headers/gl.h"
+
+typedef void (*_eng_fn) (void);
+
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     COREGL_API extern RET_TYPE coregl_api_##FUNC_NAME PARAM_LIST;
+#define _COREGL_EXT_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)
+#include "headers/sym.h"
+#undef _COREGL_EXT_SYMBOL
+#undef _COREGL_SYMBOL
+
+extern int  coregl_initialize();
+extern void coregl_terminate();
+
+#endif // COREGL_H
+
diff --git a/src/coregl_export.c b/src/coregl_export.c
new file mode 100644 (file)
index 0000000..a2082a0
--- /dev/null
@@ -0,0 +1,41 @@
+#include "coregl_export.h"
+
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     RET_TYPE (*ovr_##FUNC_NAME) PARAM_LIST = NULL;
+#include "headers/sym.h"
+#undef _COREGL_SYMBOL
+
+#include "coregl_internal.h"
+#include "coregl_export.h"
+
+#include <stdlib.h>
+
+int export_initialized = 0;
+static int api_gl_version;
+
+static void
+_clean_overrides()
+{
+#define _COREGL_START_API(version) api_gl_version = version;
+#define _COREGL_END_API(version) api_gl_version = COREGL_GLAPI_2;
+#define OVERRIDE(f) \
+       if(api_gl_version<=driver_gl_version) COREGL_OVERRIDE_API(ovr_, f, _sym_)
+
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     OVERRIDE(FUNC_NAME);
+# include "headers/sym_egl.h"
+#undef _COREGL_SYMBOL
+
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     OVERRIDE(FUNC_NAME);
+# include "headers/sym_gl.h"
+#undef _COREGL_SYMBOL
+
+#undef OVERRIDE
+#undef _COREGL_START_API
+#undef _COREGL_END_API
+}
+
+void
+init_export()
+{
+       _clean_overrides();
+}
+
diff --git a/src/coregl_export.h b/src/coregl_export.h
new file mode 100644 (file)
index 0000000..537a313
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef COREGL_EXPORT_H
+#define COREGL_EXPORT_H
+
+#include "coregl_internal.h"
+
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     extern RET_TYPE (*ovr_##FUNC_NAME) PARAM_LIST;
+# include "headers/sym.h"
+#undef _COREGL_SYMBOL
+
+extern int export_initialized;
+extern int driver_gl_version;
+
+extern void     init_export();
+extern void     clean_overrides();
+
+#endif // COREGL_EXPORT_H
+
diff --git a/src/coregl_export_egl.c b/src/coregl_export_egl.c
new file mode 100644 (file)
index 0000000..f0e5244
--- /dev/null
@@ -0,0 +1,266 @@
+#include "coregl_export.h"
+
+Mutex init_export_mutex = MUTEX_INITIALIZER;
+
+#define INIT_EXPORT() \
+       if (unlikely(export_initialized == 0)) \
+       { \
+               mutex_lock(&init_export_mutex); \
+               if (export_initialized == 0) \
+               { \
+                       if (coregl_initialize() != 0) \
+                       { \
+                               export_initialized = 1; \
+                       } \
+               } \
+               mutex_unlock(&init_export_mutex); \
+       }
+
+EGLint
+coregl_api_eglGetError(void)
+{
+       INIT_EXPORT();
+       if (!export_initialized)
+               return EGL_NOT_INITIALIZED;
+       else
+               return ovr_eglGetError();
+}
+
+EGLDisplay
+coregl_api_eglGetDisplay(EGLNativeDisplayType display_id)
+{
+       INIT_EXPORT();
+       if (!export_initialized)
+               return NULL;
+       else
+               return ovr_eglGetDisplay(display_id);
+}
+
+EGLBoolean
+coregl_api_eglInitialize(EGLDisplay dpy, EGLint* major, EGLint* minor)
+{
+       INIT_EXPORT();
+       if (!export_initialized)
+               return EGL_FALSE;
+       else
+               return ovr_eglInitialize(dpy, major, minor);
+}
+
+EGLBoolean
+coregl_api_eglTerminate(EGLDisplay dpy)
+{
+       INIT_EXPORT();
+       return ovr_eglTerminate(dpy);
+}
+
+EGLBoolean
+coregl_api_eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
+{
+       INIT_EXPORT();
+       return ovr_eglGetConfigs(dpy, configs, config_size, num_config);
+}
+
+EGLBoolean
+coregl_api_eglChooseConfig(EGLDisplay dpy, const EGLint* attrib_list, EGLConfig* configs, EGLint config_size, EGLint* num_config)
+{
+       INIT_EXPORT();
+       return ovr_eglChooseConfig(dpy, attrib_list, configs, config_size, num_config);
+}
+
+EGLBoolean
+coregl_api_eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
+{
+       INIT_EXPORT();
+       return ovr_eglGetConfigAttrib(dpy, config, attribute, value);
+}
+
+
+EGLSurface
+coregl_api_eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint* attrib_list)
+{
+       INIT_EXPORT();
+       return ovr_eglCreateWindowSurface(dpy, config, win, attrib_list);
+}
+
+EGLSurface
+coregl_api_eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
+{
+       INIT_EXPORT();
+       return ovr_eglCreatePbufferSurface(dpy, config, attrib_list);
+}
+
+EGLSurface
+coregl_api_eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint* attrib_list)
+{
+       INIT_EXPORT();
+       return ovr_eglCreatePixmapSurface(dpy, config, pixmap, attrib_list);
+}
+
+EGLBoolean
+coregl_api_eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
+{
+       INIT_EXPORT();
+       return ovr_eglDestroySurface(dpy, surface);
+}
+
+EGLBoolean
+coregl_api_eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
+{
+       INIT_EXPORT();
+       return ovr_eglQuerySurface(dpy, surface, attribute, value);
+}
+
+EGLBoolean
+coregl_api_eglBindAPI(EGLenum api)
+{
+       INIT_EXPORT();
+       return ovr_eglBindAPI(api);
+}
+
+EGLenum
+coregl_api_eglQueryAPI(void)
+{
+       INIT_EXPORT();
+       return ovr_eglQueryAPI();
+}
+
+EGLBoolean
+coregl_api_eglWaitClient(void)
+{
+       INIT_EXPORT();
+       return ovr_eglWaitClient();
+}
+
+EGLBoolean
+coregl_api_eglReleaseThread(void)
+{
+       INIT_EXPORT();
+       return ovr_eglReleaseThread();
+}
+
+EGLSurface
+coregl_api_eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list)
+{
+       INIT_EXPORT();
+       return ovr_eglCreatePbufferFromClientBuffer(dpy, buftype, buffer, config, attrib_list);
+}
+
+EGLBoolean
+coregl_api_eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
+{
+       INIT_EXPORT();
+       return ovr_eglSurfaceAttrib(dpy, surface, attribute, value);
+}
+
+EGLBoolean
+coregl_api_eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
+{
+       INIT_EXPORT();
+       return ovr_eglBindTexImage(dpy, surface, buffer);
+}
+
+EGLBoolean
+coregl_api_eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
+{
+       INIT_EXPORT();
+       return ovr_eglReleaseTexImage(dpy, surface, buffer);
+}
+
+EGLBoolean
+coregl_api_eglSwapInterval(EGLDisplay dpy, EGLint interval)
+{
+       INIT_EXPORT();
+       return ovr_eglSwapInterval(dpy, interval);
+}
+
+EGLContext
+coregl_api_eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint* attrib_list)
+{
+       INIT_EXPORT();
+       return ovr_eglCreateContext(dpy, config, share_context, attrib_list);
+}
+
+EGLBoolean
+coregl_api_eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
+{
+       INIT_EXPORT();
+       return ovr_eglDestroyContext(dpy, ctx);
+}
+
+EGLBoolean
+coregl_api_eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
+{
+       INIT_EXPORT();
+       return ovr_eglMakeCurrent(dpy, draw, read, ctx);
+}
+
+EGLContext
+coregl_api_eglGetCurrentContext(void)
+{
+       INIT_EXPORT();
+       return ovr_eglGetCurrentContext();
+}
+
+EGLSurface
+coregl_api_eglGetCurrentSurface(EGLint readdraw)
+{
+       INIT_EXPORT();
+       return ovr_eglGetCurrentSurface(readdraw);
+}
+
+EGLDisplay
+coregl_api_eglGetCurrentDisplay(void)
+{
+       INIT_EXPORT();
+       return ovr_eglGetCurrentDisplay();
+}
+
+EGLBoolean
+coregl_api_eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
+{
+       INIT_EXPORT();
+       return ovr_eglQueryContext(dpy, ctx, attribute, value);
+}
+
+EGLBoolean
+coregl_api_eglWaitGL(void)
+{
+       INIT_EXPORT();
+       return ovr_eglWaitGL();
+}
+
+EGLBoolean
+coregl_api_eglWaitNative(EGLint engine)
+{
+       INIT_EXPORT();
+       return ovr_eglWaitNative(engine);
+}
+
+EGLBoolean
+coregl_api_eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
+{
+       INIT_EXPORT();
+       return ovr_eglSwapBuffers(dpy, surface);
+}
+
+EGLBoolean
+coregl_api_eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
+{
+       INIT_EXPORT();
+       return ovr_eglCopyBuffers(dpy, surface, target);
+}
+
+_eng_fn
+coregl_api_eglGetProcAddress(const char* procname)
+{
+       INIT_EXPORT();
+       return ovr_eglGetProcAddress(procname);
+}
+
+const char *
+coregl_api_eglQueryString(EGLDisplay dpy, EGLint name)
+{
+       INIT_EXPORT();
+       return ovr_eglQueryString(dpy, name);
+}
+
diff --git a/src/coregl_export_gl.c b/src/coregl_export_gl.c
new file mode 100644 (file)
index 0000000..0c19820
--- /dev/null
@@ -0,0 +1,1480 @@
+#include "coregl_export.h"
+
+void
+coregl_api_glActiveTexture(GLenum texture)
+{
+       ovr_glActiveTexture(texture);
+}
+
+void
+coregl_api_glAttachShader(GLuint program, GLuint shader)
+{
+       ovr_glAttachShader(program, shader);
+}
+
+void
+coregl_api_glBindAttribLocation(GLuint program, GLuint index, const char* name)
+{
+       ovr_glBindAttribLocation(program, index, name);
+}
+
+void
+coregl_api_glBindBuffer(GLenum target, GLuint buffer)
+{
+       ovr_glBindBuffer(target, buffer);
+}
+
+void
+coregl_api_glBindFramebuffer(GLenum target, GLuint framebuffer)
+{
+       ovr_glBindFramebuffer(target, framebuffer);
+}
+
+void
+coregl_api_glBindRenderbuffer(GLenum target, GLuint renderbuffer)
+{
+       ovr_glBindRenderbuffer(target, renderbuffer);
+}
+
+void
+coregl_api_glBindTexture(GLenum target, GLuint texture)
+{
+       ovr_glBindTexture(target, texture);
+}
+
+void
+coregl_api_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+{
+       ovr_glBlendColor(red, green, blue, alpha);
+}
+
+void
+coregl_api_glBlendEquation(GLenum mode)
+{
+       ovr_glBlendEquation(mode);
+}
+
+void
+coregl_api_glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
+{
+       ovr_glBlendEquationSeparate(modeRGB, modeAlpha);
+}
+
+void
+coregl_api_glBlendFunc(GLenum sfactor, GLenum dfactor)
+{
+       ovr_glBlendFunc(sfactor, dfactor);
+}
+
+void
+coregl_api_glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
+{
+       ovr_glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
+}
+
+void
+coregl_api_glBufferData(GLenum target, GLsizeiptr size, const void* data, GLenum usage)
+{
+       ovr_glBufferData(target, size, data, usage);
+}
+
+void
+coregl_api_glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void* data)
+{
+       ovr_glBufferSubData(target, offset, size, data);
+}
+
+GLenum
+coregl_api_glCheckFramebufferStatus(GLenum target)
+{
+       return ovr_glCheckFramebufferStatus(target);
+}
+
+void
+coregl_api_glClear(GLbitfield mask)
+{
+       ovr_glClear(mask);
+}
+
+void
+coregl_api_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+{
+       ovr_glClearColor(red, green, blue, alpha);
+}
+
+void
+coregl_api_glClearDepthf(GLclampf depth)
+{
+       ovr_glClearDepthf(depth);
+}
+
+void
+coregl_api_glClearStencil(GLint s)
+{
+       ovr_glClearStencil(s);
+}
+
+void
+coregl_api_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
+{
+       ovr_glColorMask(red, green, blue, alpha);
+}
+
+void
+coregl_api_glCompileShader(GLuint shader)
+{
+       ovr_glCompileShader(shader);
+}
+
+void
+coregl_api_glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data)
+{
+       ovr_glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
+}
+
+void
+coregl_api_glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data)
+{
+       ovr_glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
+}
+
+void
+coregl_api_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
+{
+       ovr_glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
+}
+
+void
+coregl_api_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+       ovr_glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
+}
+
+GLuint
+coregl_api_glCreateProgram(void)
+{
+       return ovr_glCreateProgram();
+}
+
+GLuint
+coregl_api_glCreateShader(GLenum type)
+{
+       return ovr_glCreateShader(type);
+}
+
+void
+coregl_api_glCullFace(GLenum mode)
+{
+       ovr_glCullFace(mode);
+}
+
+void
+coregl_api_glDeleteBuffers(GLsizei n, const GLuint* buffers)
+{
+       ovr_glDeleteBuffers(n, buffers);
+}
+
+void
+coregl_api_glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
+{
+       ovr_glDeleteFramebuffers(n, framebuffers);
+}
+
+void
+coregl_api_glDeleteProgram(GLuint program)
+{
+       ovr_glDeleteProgram(program);
+}
+
+void
+coregl_api_glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
+{
+       ovr_glDeleteRenderbuffers(n, renderbuffers);
+}
+
+void
+coregl_api_glDeleteShader(GLuint shader)
+{
+       ovr_glDeleteShader(shader);
+}
+
+void
+coregl_api_glDeleteTextures(GLsizei n, const GLuint* textures)
+{
+       ovr_glDeleteTextures(n, textures);
+}
+
+void
+coregl_api_glDepthFunc(GLenum func)
+{
+       ovr_glDepthFunc(func);
+}
+
+void
+coregl_api_glDepthMask(GLboolean flag)
+{
+       ovr_glDepthMask(flag);
+}
+
+void
+coregl_api_glDepthRangef(GLclampf zNear, GLclampf zFar)
+{
+       ovr_glDepthRangef(zNear, zFar);
+}
+
+void
+coregl_api_glDetachShader(GLuint program, GLuint shader)
+{
+       ovr_glDetachShader(program, shader);
+}
+
+void
+coregl_api_glDisable(GLenum cap)
+{
+       ovr_glDisable(cap);
+}
+
+void
+coregl_api_glDisableVertexAttribArray(GLuint index)
+{
+       ovr_glDisableVertexAttribArray(index);
+}
+
+void
+coregl_api_glDrawArrays(GLenum mode, GLint first, GLsizei count)
+{
+       ovr_glDrawArrays(mode, first, count);
+}
+
+void
+coregl_api_glDrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices)
+{
+       ovr_glDrawElements(mode, count, type, indices);
+}
+
+void
+coregl_api_glEnable(GLenum cap)
+{
+       ovr_glEnable(cap);
+}
+
+void
+coregl_api_glEnableVertexAttribArray(GLuint index)
+{
+       ovr_glEnableVertexAttribArray(index);
+}
+
+void
+coregl_api_glFinish(void)
+{
+       ovr_glFinish();
+}
+
+void
+coregl_api_glFlush(void)
+{
+       ovr_glFlush();
+}
+
+void
+coregl_api_glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
+{
+       ovr_glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
+}
+
+void
+coregl_api_glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
+{
+       ovr_glFramebufferTexture2D(target, attachment, textarget, texture, level);
+}
+
+void
+coregl_api_glFrontFace(GLenum mode)
+{
+       ovr_glFrontFace(mode);
+}
+
+void
+coregl_api_glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
+{
+       ovr_glGetVertexAttribfv(index, pname, params);
+}
+
+void
+coregl_api_glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
+{
+       ovr_glGetVertexAttribiv(index, pname, params);
+}
+
+void
+coregl_api_glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer)
+{
+       ovr_glGetVertexAttribPointerv(index, pname, pointer);
+}
+
+void
+coregl_api_glHint(GLenum target, GLenum mode)
+{
+       ovr_glHint(target, mode);
+}
+
+void
+coregl_api_glGenBuffers(GLsizei n, GLuint* buffers)
+{
+       ovr_glGenBuffers(n, buffers);
+}
+
+void
+coregl_api_glGenerateMipmap(GLenum target)
+{
+       ovr_glGenerateMipmap(target);
+}
+
+void
+coregl_api_glGenFramebuffers(GLsizei n, GLuint* framebuffers)
+{
+       ovr_glGenFramebuffers(n, framebuffers);
+}
+
+void
+coregl_api_glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
+{
+       ovr_glGenRenderbuffers(n, renderbuffers);
+}
+
+void
+coregl_api_glGenTextures(GLsizei n, GLuint* textures)
+{
+       ovr_glGenTextures(n, textures);
+}
+
+void
+coregl_api_glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
+{
+       ovr_glGetActiveAttrib(program, index, bufsize, length, size, type, name);
+}
+
+void
+coregl_api_glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
+{
+       ovr_glGetActiveUniform(program, index, bufsize, length, size, type, name);
+}
+
+void
+coregl_api_glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
+{
+       ovr_glGetAttachedShaders(program, maxcount, count, shaders);
+}
+
+int
+coregl_api_glGetAttribLocation(GLuint program, const char* name)
+{
+       return ovr_glGetAttribLocation(program, name);
+}
+
+void
+coregl_api_glGetBooleanv(GLenum pname, GLboolean* params)
+{
+       ovr_glGetBooleanv(pname, params);
+}
+
+void
+coregl_api_glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
+{
+       ovr_glGetBufferParameteriv(target, pname, params);
+}
+
+GLenum
+coregl_api_glGetError(void)
+{
+       return ovr_glGetError();
+}
+
+void
+coregl_api_glGetFloatv(GLenum pname, GLfloat* params)
+{
+       ovr_glGetFloatv(pname, params);
+}
+
+void
+coregl_api_glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
+{
+       ovr_glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
+}
+
+void
+coregl_api_glGetIntegerv(GLenum pname, GLint* params)
+{
+       ovr_glGetIntegerv(pname, params);
+}
+
+void
+coregl_api_glGetProgramiv(GLuint program, GLenum pname, GLint* params)
+{
+       ovr_glGetProgramiv(program, pname, params);
+}
+
+void
+coregl_api_glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)
+{
+       ovr_glGetProgramInfoLog(program, bufsize, length, infolog);
+}
+
+void
+coregl_api_glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
+{
+       ovr_glGetRenderbufferParameteriv(target, pname, params);
+}
+
+void
+coregl_api_glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
+{
+       ovr_glGetShaderiv(shader, pname, params);
+}
+
+void
+coregl_api_glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)
+{
+       ovr_glGetShaderInfoLog(shader, bufsize, length, infolog);
+}
+
+void
+coregl_api_glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
+{
+       ovr_glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
+}
+
+void
+coregl_api_glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source)
+{
+       ovr_glGetShaderSource(shader, bufsize, length, source);
+}
+
+const GLubyte *
+coregl_api_glGetString(GLenum name)
+{
+       return ovr_glGetString(name);
+}
+
+void
+coregl_api_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
+{
+       ovr_glGetTexParameterfv(target, pname, params);
+}
+
+void
+coregl_api_glGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
+{
+       ovr_glGetTexParameteriv(target, pname, params);
+}
+
+void
+coregl_api_glGetUniformfv(GLuint program, GLint location, GLfloat* params)
+{
+       ovr_glGetUniformfv(program, location, params);
+}
+
+void
+coregl_api_glGetUniformiv(GLuint program, GLint location, GLint* params)
+{
+       ovr_glGetUniformiv(program, location, params);
+}
+
+int
+coregl_api_glGetUniformLocation(GLuint program, const char* name)
+{
+       return ovr_glGetUniformLocation(program, name);
+}
+
+GLboolean
+coregl_api_glIsBuffer(GLuint buffer)
+{
+       return ovr_glIsBuffer(buffer);
+}
+
+GLboolean
+coregl_api_glIsEnabled(GLenum cap)
+{
+       return ovr_glIsEnabled(cap);
+}
+
+GLboolean
+coregl_api_glIsFramebuffer(GLuint framebuffer)
+{
+       return ovr_glIsFramebuffer(framebuffer);
+}
+
+GLboolean
+coregl_api_glIsProgram(GLuint program)
+{
+       return ovr_glIsProgram(program);
+}
+
+GLboolean
+coregl_api_glIsRenderbuffer(GLuint renderbuffer)
+{
+       return ovr_glIsRenderbuffer(renderbuffer);
+}
+
+GLboolean
+coregl_api_glIsShader(GLuint shader)
+{
+       return ovr_glIsShader(shader);
+}
+
+GLboolean
+coregl_api_glIsTexture(GLuint texture)
+{
+       return ovr_glIsTexture(texture);
+}
+
+void
+coregl_api_glLineWidth(GLfloat width)
+{
+       ovr_glLineWidth(width);
+}
+
+void
+coregl_api_glLinkProgram(GLuint program)
+{
+       ovr_glLinkProgram(program);
+}
+
+void
+coregl_api_glPixelStorei(GLenum pname, GLint param)
+{
+       ovr_glPixelStorei(pname, param);
+}
+
+void
+coregl_api_glPolygonOffset(GLfloat factor, GLfloat units)
+{
+       ovr_glPolygonOffset(factor, units);
+}
+
+void
+coregl_api_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels)
+{
+       ovr_glReadPixels(x, y, width, height, format, type, pixels);
+}
+
+void
+coregl_api_glReleaseShaderCompiler(void)
+{
+       ovr_glReleaseShaderCompiler();
+}
+
+void
+coregl_api_glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
+{
+       ovr_glRenderbufferStorage(target, internalformat, width, height);
+}
+
+void
+coregl_api_glSampleCoverage(GLclampf value, GLboolean invert)
+{
+       ovr_glSampleCoverage(value, invert);
+}
+
+void
+coregl_api_glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+       ovr_glScissor(x, y, width, height);
+}
+
+void
+coregl_api_glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length)
+{
+       ovr_glShaderBinary(n, shaders, binaryformat, binary, length);
+}
+
+void
+coregl_api_glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length)
+{
+       ovr_glShaderSource(shader, count, string, length);
+}
+
+void
+coregl_api_glStencilFunc(GLenum func, GLint ref, GLuint mask)
+{
+       ovr_glStencilFunc(func, ref, mask);
+}
+
+void
+coregl_api_glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
+{
+       ovr_glStencilFuncSeparate(face, func, ref, mask);
+}
+
+void
+coregl_api_glStencilMask(GLuint mask)
+{
+       ovr_glStencilMask(mask);
+}
+
+void
+coregl_api_glStencilMaskSeparate(GLenum face, GLuint mask)
+{
+       ovr_glStencilMaskSeparate(face, mask);
+}
+
+void
+coregl_api_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
+{
+       ovr_glStencilOp(fail, zfail, zpass);
+}
+
+void
+coregl_api_glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
+{
+       ovr_glStencilOpSeparate(face, fail, zfail, zpass);
+}
+
+void
+coregl_api_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels)
+{
+       ovr_glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
+}
+
+void
+coregl_api_glTexParameterf(GLenum target, GLenum pname, GLfloat param)
+{
+       ovr_glTexParameterf(target, pname, param);
+}
+
+void
+coregl_api_glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
+{
+       ovr_glTexParameterfv(target, pname, params);
+}
+
+void
+coregl_api_glTexParameteri(GLenum target, GLenum pname, GLint param)
+{
+       ovr_glTexParameteri(target, pname, param);
+}
+
+void
+coregl_api_glTexParameteriv(GLenum target, GLenum pname, const GLint* params)
+{
+       ovr_glTexParameteriv(target, pname, params);
+}
+
+void
+coregl_api_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels)
+{
+       ovr_glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
+}
+
+void
+coregl_api_glUniform1f(GLint location, GLfloat x)
+{
+       ovr_glUniform1f(location, x);
+}
+
+void
+coregl_api_glUniform1fv(GLint location, GLsizei count, const GLfloat* v)
+{
+       ovr_glUniform1fv(location, count, v);
+}
+
+void
+coregl_api_glUniform1i(GLint location, GLint x)
+{
+       ovr_glUniform1i(location, x);
+}
+
+void
+coregl_api_glUniform1iv(GLint location, GLsizei count, const GLint* v)
+{
+       ovr_glUniform1iv(location, count, v);
+}
+
+void
+coregl_api_glUniform2f(GLint location, GLfloat x, GLfloat y)
+{
+       ovr_glUniform2f(location, x, y);
+}
+
+void
+coregl_api_glUniform2fv(GLint location, GLsizei count, const GLfloat* v)
+{
+       ovr_glUniform2fv(location, count, v);
+}
+
+void
+coregl_api_glUniform2i(GLint location, GLint x, GLint y)
+{
+       ovr_glUniform2i(location, x, y);
+}
+
+void
+coregl_api_glUniform2iv(GLint location, GLsizei count, const GLint* v)
+{
+       ovr_glUniform2iv(location, count, v);
+}
+
+void
+coregl_api_glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
+{
+       ovr_glUniform3f(location, x, y, z);
+}
+
+void
+coregl_api_glUniform3fv(GLint location, GLsizei count, const GLfloat* v)
+{
+       ovr_glUniform3fv(location, count, v);
+}
+
+void
+coregl_api_glUniform3i(GLint location, GLint x, GLint y, GLint z)
+{
+       ovr_glUniform3i(location, x, y, z);
+}
+
+void
+coregl_api_glUniform3iv(GLint location, GLsizei count, const GLint* v)
+{
+       ovr_glUniform3iv(location, count, v);
+}
+
+void
+coregl_api_glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+       ovr_glUniform4f(location, x, y, z, w);
+}
+
+void
+coregl_api_glUniform4fv(GLint location, GLsizei count, const GLfloat* v)
+{
+       ovr_glUniform4fv(location, count, v);
+}
+
+void
+coregl_api_glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
+{
+       ovr_glUniform4i(location, x, y, z, w);
+}
+
+void
+coregl_api_glUniform4iv(GLint location, GLsizei count, const GLint* v)
+{
+       ovr_glUniform4iv(location, count, v);
+}
+
+void
+coregl_api_glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+       ovr_glUniformMatrix2fv(location, count, transpose, value);
+}
+
+void
+coregl_api_glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+       ovr_glUniformMatrix3fv(location, count, transpose, value);
+}
+
+void
+coregl_api_glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+       ovr_glUniformMatrix4fv(location, count, transpose, value);
+}
+
+void
+coregl_api_glUseProgram(GLuint program)
+{
+       ovr_glUseProgram(program);
+}
+
+void
+coregl_api_glValidateProgram(GLuint program)
+{
+       ovr_glValidateProgram(program);
+}
+
+void
+coregl_api_glVertexAttrib1f(GLuint index, GLfloat x)
+{
+       ovr_glVertexAttrib1f(index, x);
+}
+
+void
+coregl_api_glVertexAttrib1fv(GLuint index, const GLfloat* values)
+{
+       ovr_glVertexAttrib1fv(index, values);
+}
+
+void
+coregl_api_glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
+{
+       ovr_glVertexAttrib2f(index, x, y);
+}
+
+void
+coregl_api_glVertexAttrib2fv(GLuint index, const GLfloat* values)
+{
+       ovr_glVertexAttrib2fv(index, values);
+}
+
+void
+coregl_api_glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
+{
+       ovr_glVertexAttrib3f(index, x, y, z);
+}
+
+void
+coregl_api_glVertexAttrib3fv(GLuint index, const GLfloat* values)
+{
+       ovr_glVertexAttrib3fv(index, values);
+}
+
+void
+coregl_api_glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+       ovr_glVertexAttrib4f(index, x, y, z, w);
+}
+
+void
+coregl_api_glVertexAttrib4fv(GLuint index, const GLfloat* values)
+{
+       ovr_glVertexAttrib4fv(index, values);
+}
+
+void
+coregl_api_glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* pointer)
+{
+       ovr_glVertexAttribPointer(index, size, type, normalized, stride, pointer);
+}
+
+void
+coregl_api_glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+       ovr_glViewport(x, y, width, height);
+}
+
+/* OpenGL ES 3.0 */
+void
+coregl_api_glReadBuffer(GLenum mode)
+{
+       ovr_glReadBuffer(mode);
+}
+
+void
+coregl_api_glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices)
+{
+       ovr_glDrawRangeElements(mode, start, end, count, type, indices);
+}
+
+void
+coregl_api_glTexImage3D(GLenum target, GLint level, GLint GLinternalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
+{
+       ovr_glTexImage3D(target, level, GLinternalFormat, width, height, depth, border, format, type, pixels);
+}
+
+void
+coregl_api_glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
+{
+       ovr_glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
+}
+
+void
+coregl_api_glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+       ovr_glCopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
+}
+
+void
+coregl_api_glCompressedTexImage3D(GLenum target, GLint level, GLenum GLinternalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)
+{
+       ovr_glCompressedTexImage3D(target, level, GLinternalformat, width, height, depth, border, imageSize, data);
+}
+
+void
+coregl_api_glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)
+{
+       ovr_glCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
+}
+
+void
+coregl_api_glGenQueries(GLsizei n, GLuint* ids)
+{
+       ovr_glGenQueries(n, ids);
+}
+
+void
+coregl_api_glDeleteQueries(GLsizei n, const GLuint* ids)
+{
+       ovr_glDeleteQueries(n, ids);
+}
+
+GLboolean
+coregl_api_glIsQuery(GLuint id)
+{
+       return ovr_glIsQuery(id);
+}
+
+void
+coregl_api_glBeginQuery(GLenum target, GLuint id)
+{
+       ovr_glBeginQuery(target, id);
+}
+
+void
+coregl_api_glEndQuery(GLenum target)
+{
+       ovr_glEndQuery(target);
+}
+
+void
+coregl_api_glGetQueryiv(GLenum target, GLenum pname, GLint* params)
+{
+       ovr_glGetQueryiv(target, pname, params);
+}
+
+void
+coregl_api_glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params)
+{
+       ovr_glGetQueryObjectuiv(id, pname, params);
+}
+
+GLboolean
+coregl_api_glUnmapBuffer(GLenum target)
+{
+       return ovr_glUnmapBuffer(target);
+}
+
+void
+coregl_api_glGetBufferPointerv(GLenum target, GLenum pname, GLvoid** params)
+{
+       ovr_glGetBufferPointerv(target, pname, params);
+}
+
+void
+coregl_api_glDrawBuffers(GLsizei n, const GLenum* bufs)
+{
+       ovr_glDrawBuffers(n, bufs);
+}
+
+void
+coregl_api_glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+       ovr_glUniformMatrix2x3fv(location, count, transpose, value);
+}
+
+void
+coregl_api_glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+       ovr_glUniformMatrix3x2fv(location, count, transpose, value);
+}
+
+void
+coregl_api_glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+       ovr_glUniformMatrix2x4fv(location, count, transpose, value);
+}
+
+void
+coregl_api_glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+       ovr_glUniformMatrix4x2fv(location, count, transpose, value);
+}
+
+void
+coregl_api_glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+       ovr_glUniformMatrix3x4fv(location, count, transpose, value);
+}
+
+void
+coregl_api_glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+       ovr_glUniformMatrix4x3fv(location, count, transpose, value);
+}
+
+void
+coregl_api_glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
+{
+       ovr_glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
+}
+
+void
+coregl_api_glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
+{
+       ovr_glRenderbufferStorageMultisample(target, samples, internalformat, width, height);
+}
+
+void
+coregl_api_glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
+{
+       ovr_glFramebufferTextureLayer(target, attachment, texture, level, layer);
+}
+
+GLvoid*
+coregl_api_glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
+{
+       return ovr_glMapBufferRange(target, offset, length, access);
+}
+
+void
+coregl_api_glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
+{
+       ovr_glFlushMappedBufferRange(target, offset, length);
+}
+
+void
+coregl_api_glBindVertexArray(GLuint array)
+{
+       ovr_glBindVertexArray(array);
+}
+
+void
+coregl_api_glDeleteVertexArrays(GLsizei n, const GLuint* arrays)
+{
+       ovr_glDeleteVertexArrays(n, arrays);
+}
+
+void
+coregl_api_glGenVertexArrays(GLsizei n, GLuint* arrays)
+{
+       ovr_glGenVertexArrays(n, arrays);
+}
+
+GLboolean
+coregl_api_glIsVertexArray(GLuint array)
+{
+       return ovr_glIsVertexArray(array);
+}
+
+void
+coregl_api_glGetIntegeri_v(GLenum target, GLuint index, GLint* data)
+{
+       ovr_glGetIntegeri_v(target, index, data);
+}
+
+void
+coregl_api_glBeginTransformFeedback(GLenum primitiveMode)
+{
+       ovr_glBeginTransformFeedback(primitiveMode);
+}
+
+void
+coregl_api_glEndTransformFeedback()
+{
+       ovr_glEndTransformFeedback();
+}
+
+void
+coregl_api_glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
+{
+       ovr_glBindBufferRange(target, index, buffer, offset, size);
+}
+
+void
+coregl_api_glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
+{
+       ovr_glBindBufferBase(target, index, buffer);
+}
+
+void
+coregl_api_glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode)
+{
+       ovr_glTransformFeedbackVaryings(program, count, varyings, bufferMode);
+}
+
+void
+coregl_api_glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name)
+{
+       ovr_glGetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
+}
+
+void
+coregl_api_glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
+{
+       ovr_glVertexAttribIPointer(index, size, type, stride, pointer);
+}
+
+void
+coregl_api_glGetVertexAttribIiv(GLuint index, GLenum pname, GLint* params)
+{
+       ovr_glGetVertexAttribIiv(index, pname, params);
+}
+
+void
+coregl_api_glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params)
+{
+       ovr_glGetVertexAttribIuiv(index, pname, params);
+}
+
+void
+coregl_api_glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
+{
+       ovr_glVertexAttribI4i(index, x, y, z, w);
+}
+
+void
+coregl_api_glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
+{
+       ovr_glVertexAttribI4ui(index, x, y, z, w);
+}
+
+void
+coregl_api_glVertexAttribI4iv(GLuint index, const GLint* v)
+{
+       ovr_glVertexAttribI4iv(index, v);
+}
+
+void
+coregl_api_glVertexAttribI4uiv(GLuint index, const GLuint* v)
+{
+       ovr_glVertexAttribI4uiv(index, v);
+}
+
+void
+coregl_api_glGetUniformuiv(GLuint program, GLint location, GLuint* params)
+{
+       ovr_glGetUniformuiv(program, location, params);
+}
+
+GLint
+coregl_api_glGetFragDataLocation(GLuint program, const GLchar *name)
+{
+       return ovr_glGetFragDataLocation(program, name);
+}
+
+void
+coregl_api_glUniform1ui(GLint location, GLuint v0)
+{
+       ovr_glUniform1ui(location, v0);
+}
+
+void
+coregl_api_glUniform2ui(GLint location, GLuint v0, GLuint v1)
+{
+       ovr_glUniform2ui(location, v0, v1);
+}
+
+void
+coregl_api_glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
+{
+       ovr_glUniform3ui(location, v0, v1, v2);
+}
+
+void
+coregl_api_glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
+{
+       ovr_glUniform4ui(location, v0, v1, v2, v3);
+}
+
+void
+coregl_api_glUniform1uiv(GLint location, GLsizei count, const GLuint* value)
+{
+       ovr_glUniform1uiv(location, count, value);
+}
+
+void
+coregl_api_glUniform2uiv(GLint location, GLsizei count, const GLuint* value)
+{
+       ovr_glUniform2uiv(location, count, value);
+}
+
+void
+coregl_api_glUniform3uiv(GLint location, GLsizei count, const GLuint* value)
+{
+       ovr_glUniform3uiv(location, count, value);
+}
+
+void
+coregl_api_glUniform4uiv(GLint location, GLsizei count, const GLuint* value)
+{
+       ovr_glUniform4uiv(location, count, value);
+}
+
+void
+coregl_api_glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value)
+{
+       ovr_glClearBufferiv(buffer, drawbuffer, value);
+}
+
+void
+coregl_api_glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value)
+{
+       ovr_glClearBufferuiv(buffer, drawbuffer, value);
+}
+
+void
+coregl_api_glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat* value)
+{
+       ovr_glClearBufferfv(buffer, drawbuffer, value);
+}
+
+void
+coregl_api_glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
+{
+       ovr_glClearBufferfi(buffer, drawbuffer, depth, stencil);
+}
+
+const GLubyte*
+coregl_api_glGetStringi(GLenum name, GLuint index)
+{
+       return ovr_glGetStringi(name, index);
+}
+
+void
+coregl_api_glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
+{
+       ovr_glCopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
+}
+
+void
+coregl_api_glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices)
+{
+       ovr_glGetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
+}
+
+void
+coregl_api_glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params)
+{
+       ovr_glGetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
+}
+
+GLuint
+coregl_api_glGetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName)
+{
+       return ovr_glGetUniformBlockIndex(program, uniformBlockName);
+}
+
+void
+coregl_api_glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params)
+{
+       ovr_glGetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
+}
+
+void
+coregl_api_glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName)
+{
+       ovr_glGetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName);
+}
+
+void
+coregl_api_glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
+{
+       ovr_glUniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
+}
+
+void
+coregl_api_glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount)
+{
+       ovr_glDrawArraysInstanced(mode, first, count, instanceCount);
+}
+
+void
+coregl_api_glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount)
+{
+       ovr_glDrawElementsInstanced(mode, count, type, indices, instanceCount);
+}
+
+GLsync
+coregl_api_glFenceSync(GLenum condition, GLbitfield flags)
+{
+       return ovr_glFenceSync(condition, flags);
+}
+
+GLboolean
+coregl_api_glIsSync(GLsync sync)
+{
+       return ovr_glIsSync(sync);
+}
+
+void
+coregl_api_glDeleteSync(GLsync sync)
+{
+       ovr_glDeleteSync(sync);
+}
+
+GLenum
+coregl_api_glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
+{
+       return ovr_glClientWaitSync(sync, flags, timeout);
+}
+
+void
+coregl_api_glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
+{
+       ovr_glWaitSync(sync, flags, timeout);
+}
+
+void
+coregl_api_glGetInteger64v(GLenum pname, GLint64* params)
+{
+       ovr_glGetInteger64v(pname, params);
+}
+
+void
+coregl_api_glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values)
+{
+       ovr_glGetSynciv(sync, pname, bufSize, length, values);
+}
+
+void
+coregl_api_glGetInteger64i_v(GLenum target, GLuint index, GLint64* data)
+{
+       ovr_glGetInteger64i_v(target, index, data);
+}
+
+void
+coregl_api_glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params)
+{
+       ovr_glGetBufferParameteri64v(target, pname, params);
+}
+
+void
+coregl_api_glGenSamplers(GLsizei n, GLuint* samplers)
+{
+       ovr_glGenSamplers(n, samplers);
+}
+
+void
+coregl_api_glDeleteSamplers(GLsizei n, const GLuint* samplers)
+{
+       ovr_glDeleteSamplers(n, samplers);
+}
+
+GLboolean
+coregl_api_glIsSampler(GLuint sampler)
+{
+       return ovr_glIsSampler(sampler);
+}
+
+void
+coregl_api_glBindSampler(GLuint unit, GLuint sampler)
+{
+       ovr_glBindSampler(unit, sampler);
+}
+
+void
+coregl_api_glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
+{
+       ovr_glSamplerParameteri(sampler, pname, param);
+}
+
+void
+coregl_api_glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param)
+{
+       ovr_glSamplerParameteriv(sampler, pname, param);
+}
+
+void
+coregl_api_glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
+{
+       ovr_glSamplerParameterf(sampler, pname, param);
+}
+
+void
+coregl_api_glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param)
+{
+       ovr_glSamplerParameterfv(sampler, pname, param);
+}
+
+void
+coregl_api_glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params)
+{
+       ovr_glGetSamplerParameteriv(sampler, pname, params);
+}
+
+void
+coregl_api_glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params)
+{
+       ovr_glGetSamplerParameterfv(sampler, pname, params);
+}
+
+void
+coregl_api_glVertexAttribDivisor(GLuint index, GLuint divisor)
+{
+       ovr_glVertexAttribDivisor(index, divisor);
+}
+
+void
+coregl_api_glBindTransformFeedback(GLenum target, GLuint id)
+{
+       ovr_glBindTransformFeedback(target, id);
+}
+
+void
+coregl_api_glDeleteTransformFeedbacks(GLsizei n, const GLuint* ids)
+{
+       ovr_glDeleteTransformFeedbacks(n, ids);
+}
+
+void
+coregl_api_glGenTransformFeedbacks(GLsizei n, GLuint* ids)
+{
+       ovr_glGenTransformFeedbacks(n, ids);
+}
+
+GLboolean
+coregl_api_glIsTransformFeedback(GLuint id)
+{
+       return ovr_glIsTransformFeedback(id);
+}
+
+void
+coregl_api_glPauseTransformFeedback()
+{
+       ovr_glPauseTransformFeedback();
+}
+
+void
+coregl_api_glResumeTransformFeedback()
+{
+       ovr_glResumeTransformFeedback();
+}
+
+void
+coregl_api_glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary)
+{
+       ovr_glGetProgramBinary(program, bufSize, length, binaryFormat, binary);
+}
+
+void
+coregl_api_glProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length)
+{
+       ovr_glProgramBinary(program, binaryFormat, binary, length);
+}
+
+void
+coregl_api_glProgramParameteri(GLuint program, GLenum pname, GLint value)
+{
+       ovr_glProgramParameteri(program, pname, value);
+}
+
+void
+coregl_api_glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments)
+{
+       ovr_glInvalidateFramebuffer(target, numAttachments, attachments);
+}
+
+void
+coregl_api_glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+       ovr_glInvalidateSubFramebuffer(target, numAttachments, attachments, x, y, width, height);
+}
+
+void
+coregl_api_glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
+{
+       ovr_glTexStorage2D(target, levels, internalformat, width, height);
+}
+
+void
+coregl_api_glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
+{
+       ovr_glTexStorage3D(target, levels, internalformat, width, height, depth);
+}
+
+void
+coregl_api_glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params)
+{
+       ovr_glGetInternalformativ(target, internalformat, pname, bufSize, params);
+}
+
+
diff --git a/src/coregl_internal.h b/src/coregl_internal.h
new file mode 100644 (file)
index 0000000..b62ce46
--- /dev/null
@@ -0,0 +1,159 @@
+#ifndef COREGL_INTERNAL_H
+#define COREGL_INTERNAL_H
+
+#include <stdio.h>
+
+#include "coregl.h"
+
+#include "modules/coregl_module.h"
+
+#define unlikely(x) __builtin_expect(x, 0)
+
+// Symbol definition for real
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     extern RET_TYPE (*_sym_##FUNC_NAME) PARAM_LIST;
+# include "headers/sym.h"
+#undef _COREGL_SYMBOL
+
+#define COREGL_DEBUG
+
+///////////////////////////////////////
+// Disable dlog for debugging urgent issues //
+#ifdef COREGL_DEBUG
+//# define LOG_TAG "CoreGL"
+//# include <dlog.h>
+# define LOGE(...) fprintf(stderr, __VA_ARGS__)
+# define LOGW(...) fprintf(stderr, __VA_ARGS__)
+# define LOGD(...) fprintf(stderr, __VA_ARGS__)
+#endif
+///////////////////////////////////////
+
+# define COREGL_ERR(...) \
+     LOGE(" "__VA_ARGS__)
+# define COREGL_WRN(...) \
+     LOGW(" "__VA_ARGS__)
+# ifdef COREGL_DEBUG
+#  define COREGL_DBG(...) \
+     LOGD(" "__VA_ARGS__)
+# else
+#  define COREGL_DBG(...)
+# endif
+
+# define COREGL_LOG(...) \
+     LOGD(" "__VA_ARGS__)
+
+
+# define TRACE(...) \
+     if (trace_fp != NULL) \
+       fprintf(trace_fp, __VA_ARGS__); \
+     else \
+       LOGD(" "__VA_ARGS__)
+
+# define TRACE_END() \
+     if (trace_fp != NULL) \
+       fflush(trace_fp)
+#define _COREGL_TRACE_OUTPUT_INTERVAL_SEC 5
+
+static inline GLint GET_INT_FROM_FLOAT(GLfloat value) { return (GLint)value; }
+static inline GLuint GET_UINT_FROM_FLOAT(GLfloat value) { return (GLuint)value; }
+
+
+#ifdef COREGL_DEBUG
+# define AST(expr) \
+     if (!(expr)) { LOGE("\E[40;31;1m%s(%d) error. '"#expr"'\E[0m\n", __func__, __LINE__); }
+#else
+# define AST(expr) \
+     if (expr)
+#endif
+
+typedef GLvoid *     GLvoidptr;
+typedef GLuint       GLuintmask;
+
+#define COREGL_GLAPI_3 3
+#define COREGL_GLAPI_2 2
+
+#define _COREGL_INT_INIT_VALUE -3
+
+#define COREGL_OVERRIDE_API(mangle, func, prefix) \
+       mangle##func = prefix##func
+
+typedef EGLSurface     GLSurface;
+typedef EGLDisplay     GLDisplay;
+typedef EGLContext     GLContext;
+
+#define COREGL_GL_NO_CONTEXT EGL_NO_CONTEXT
+
+typedef struct _GLThreadState
+{
+       int                      thread_id;
+       void                    *module_data[COREGL_MAX_MODULES];
+} GLThreadState;
+
+extern void                *glue_lib_handle;
+extern void                *egl_lib_handle;
+
+#include "coregl_thread_pthread.h"
+
+typedef struct _General_Trace_List
+{
+       void                          *value;
+       struct _General_Trace_List    *next;
+} General_Trace_List;
+
+extern General_Trace_List  *thread_trace_list;
+extern Mutex                general_trace_lists_access_mutex;
+
+extern FILE               *trace_fp;
+
+extern int                 trace_api_flag;
+extern int                 trace_api_all_flag;
+extern int                 trace_api_frame_flag;
+extern int                 trace_mem_flag;
+extern int                 trace_mem_all_flag;
+extern int                 trace_ctx_flag;
+extern int                 trace_ctx_force_flag;
+extern int                 trace_state_flag;
+extern int                 trace_surface_flag;
+extern int                 trace_surface_sequence_sort_flag;
+extern int                 trace_surface_filter_period_begin;
+extern int                 trace_surface_filter_period_end;
+extern int                 trace_surface_filter_type;
+extern int                 trace_surface_filter_handle;
+extern int                 trace_surface_filter_size_w;
+extern int                 trace_surface_filter_size_h;
+extern int                 trace_surface_print_only_flag;
+
+#define USE_TRACEPATH          (trace_api_flag == 1 || trace_ctx_flag == 1 || trace_state_flag == 1 || trace_mem_flag == 1 || trace_surface_flag == 1)
+
+// Environment functions
+extern const char         *get_env_setting(const char *name);
+
+// Main utility functions
+extern int                 init_new_thread_state();
+
+// Thread functions
+extern int                 mutex_init(Mutex *mt);
+extern int                 mutex_lock(Mutex *mt);
+extern int                 mutex_unlock(Mutex *mt);
+extern int                 get_current_thread();
+extern int                 set_current_thread_state(GLThreadState *tstate);
+extern GLThreadState      *get_current_thread_state();
+
+
+// Override functions
+extern void                init_export();
+extern void                deinit_export();
+
+// Module interfaces
+extern void                init_modules();
+extern void                deinit_modules();
+extern void                reset_modules_override();
+extern void                init_modules_tstate(GLThreadState *tstate);
+extern void                deinit_modules_tstate(GLThreadState *tstate);
+
+
+// Debug & Trace functions
+extern int                 add_to_general_trace_list(General_Trace_List **gtl, void *value);
+extern int                 remove_from_general_trace_list(General_Trace_List **gtl, void *value);
+
+#endif // COREGL_INTERNAL_H
+
diff --git a/src/coregl_override.c b/src/coregl_override.c
new file mode 100644 (file)
index 0000000..3355b65
--- /dev/null
@@ -0,0 +1,21 @@
+#include "coregl_internal.h"
+#include "coregl_export.h"
+
+#include <stdlib.h>
+
+void
+init_overrides()
+{
+#define C_ORD(f) COREGL_OVERRIDE_API(ovr_, f, _sym_)
+
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     C_ORD(FUNC_NAME);
+# include "headers/sym_egl.h"
+#undef _COREGL_SYMBOL
+
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     C_ORD(FUNC_NAME);
+# include "headers/sym_gl.h"
+#undef _COREGL_SYMBOL
+
+#undef C_ORD
+}
+
diff --git a/src/coregl_thread_pthread.c b/src/coregl_thread_pthread.c
new file mode 100644 (file)
index 0000000..70ff145
--- /dev/null
@@ -0,0 +1,110 @@
+#include "coregl_internal.h"
+
+//////////////////////////////////////////////////////////////////////////
+// Need implement this
+int mutex_init(Mutex *mt);
+int mutex_lock(Mutex *mt);
+int mutex_unlock(Mutex *mt);
+int get_current_thread();
+int set_current_thread_state(GLThreadState *tstate);
+GLThreadState * get_current_thread_state();
+//////////////////////////////////////////////////////////////////////////
+
+static Mutex            thread_key_mutex = MUTEX_INITIALIZER;
+static int              thread_key_inited = 0;
+static pthread_key_t    thread_key = 0;
+
+int
+mutex_init(Mutex *mt)
+{
+       int ret = 0;
+
+       if (pthread_mutex_init(mt, NULL) == 0)
+               ret = 1;
+       else
+               ret = 0;
+
+       return ret;
+}
+
+int
+mutex_lock(Mutex *mt)
+{
+       int ret = 0;
+
+       if (pthread_mutex_lock(mt) == 0)
+               ret = 1;
+       else
+               ret = 0;
+
+       return ret;
+}
+
+int
+mutex_unlock(Mutex *mt)
+{
+       int ret = 0;
+
+       if (pthread_mutex_unlock(mt) == 0)
+               ret = 1;
+       else
+               ret = 0;
+
+       return ret;
+}
+
+int
+get_current_thread()
+{
+       return pthread_self();
+}
+
+int
+set_current_thread_state(GLThreadState *tstate)
+{
+       int ret = 0;
+
+       AST(mutex_lock(&thread_key_mutex) == 1);
+
+       if (thread_key_inited == 0)
+       {
+               if (pthread_key_create(&thread_key, NULL) != 0)
+               {
+                       COREGL_ERR("Failed to create thread key.\n");
+                       ret = 0;
+                       goto finish;
+               }
+               thread_key_inited = 1;
+       }
+
+       if (pthread_setspecific(thread_key, (void *)tstate) != 0)
+       {
+               COREGL_ERR("Failed to set thread data.\n");
+               ret = 0;
+               goto finish;
+       }
+
+       ret = 1;
+       goto finish;
+
+finish:
+       AST(mutex_unlock(&thread_key_mutex) == 1);
+
+       return ret;
+}
+
+GLThreadState *
+get_current_thread_state()
+{
+       GLThreadState *ret = NULL;
+
+       if (thread_key_inited)
+       {
+               ret = (GLThreadState *)pthread_getspecific(thread_key);
+       }
+       goto finish;
+
+finish:
+       return ret;
+}
+
diff --git a/src/coregl_thread_pthread.h b/src/coregl_thread_pthread.h
new file mode 100644 (file)
index 0000000..4a84f13
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef COREGL_THREAD_PTHREAD_H
+#define COREGL_THREAD_PTHREAD_H
+
+#include <pthread.h>
+
+//////////////////////////////////////////////////////////////////////////
+// Need define this
+typedef pthread_mutex_t Mutex;
+
+#define MUTEX_INITIALIZER  PTHREAD_MUTEX_INITIALIZER
+//////////////////////////////////////////////////////////////////////////
+
+#endif // COREGL_THREAD_PTHREAD_H
+
diff --git a/src/coregl_thread_pthread_and_gcc_tlv.c b/src/coregl_thread_pthread_and_gcc_tlv.c
new file mode 100644 (file)
index 0000000..d759263
--- /dev/null
@@ -0,0 +1,74 @@
+#include "coregl_internal.h"
+
+//////////////////////////////////////////////////////////////////////////
+// Need implement this
+int mutex_init(Mutex *mt);
+int mutex_lock(Mutex *mt);
+int mutex_unlock(Mutex *mt);
+int get_current_thread();
+int set_current_thread_state(GLThreadState *tstate);
+GLThreadState * get_current_thread_state();
+//////////////////////////////////////////////////////////////////////////
+
+static __thread GLThreadState *per_thread_state = NULL;
+
+int
+mutex_init(Mutex *mt)
+{
+       int ret = 0;
+
+       if (pthread_mutex_init(mt, NULL) == 0)
+               ret = 1;
+       else
+               ret = 0;
+
+       return ret;
+}
+
+
+int
+mutex_lock(Mutex *mt)
+{
+       int ret = 0;
+
+       if (pthread_mutex_lock(mt) == 0)
+               ret = 1;
+       else
+               ret = 0;
+
+       return ret;
+}
+
+int
+mutex_unlock(Mutex *mt)
+{
+       int ret = 0;
+
+       if (pthread_mutex_unlock(mt) == 0)
+               ret = 1;
+       else
+               ret = 0;
+
+       return ret;
+}
+
+int
+get_current_thread()
+{
+       return pthread_self();
+}
+
+int
+set_current_thread_state(GLThreadState *tstate)
+{
+       per_thread_state = tstate;
+       return 1;
+}
+
+GLThreadState *
+get_current_thread_state()
+{
+       return per_thread_state;
+}
+
+
diff --git a/src/coregl_trace.c b/src/coregl_trace.c
new file mode 100644 (file)
index 0000000..6a8596c
--- /dev/null
@@ -0,0 +1,86 @@
+#include "coregl_internal.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+
+int                 trace_api_flag = 0;
+int                 trace_api_all_flag = 0;
+int                 trace_api_frame_flag = 0;
+int                 trace_ctx_flag = 0;
+int                 trace_ctx_force_flag = 0;
+int                 trace_mem_flag = 0;
+int                 trace_mem_all_flag = 0;
+int                 trace_state_flag = 0;
+int                 trace_surface_flag = 0;
+int                 trace_surface_all_flag = 0;
+int                 trace_surface_sequence_sort_flag = 0;
+int                 trace_surface_filter_period_begin = 0;
+int                 trace_surface_filter_period_end = 0;
+int                 trace_surface_filter_type = 0;
+int                 trace_surface_filter_handle = 0;
+int                 trace_surface_filter_size_w = 0;
+int                 trace_surface_filter_size_h = 0;
+int                 trace_surface_print_only_flag = 0;
+
+General_Trace_List *thread_trace_list = NULL;
+Mutex               general_trace_lists_access_mutex = MUTEX_INITIALIZER;
+
+
+int
+add_to_general_trace_list(General_Trace_List **gtl, void *value)
+{
+       int ret = 0;
+       General_Trace_List *newitm = NULL;
+
+       AST(mutex_lock(&general_trace_lists_access_mutex) == 1);
+
+       newitm = (General_Trace_List *)calloc(1, sizeof(General_Trace_List));
+        /* Prevent CID : 395957 */
+        if (newitm == NULL) goto finish;
+       newitm->value = value;
+       newitm->next = *gtl;
+       *gtl = newitm;
+       ret = 1;
+       goto finish;
+
+finish:
+       AST(mutex_unlock(&general_trace_lists_access_mutex) == 1);
+       return ret;
+}
+
+int
+remove_from_general_trace_list(General_Trace_List **gtl, void *value)
+{
+       int ret = 0;
+       General_Trace_List *current = NULL;
+       General_Trace_List *priv = NULL;
+
+       AST(mutex_lock(&general_trace_lists_access_mutex) == 1);
+
+       current = *gtl;
+
+       while (current != NULL)
+       {
+               if (current->value == value)
+               {
+                       if (priv == NULL)
+                               *gtl = current->next;
+                       else
+                               priv->next = current->next;
+
+                       free(current);
+                       ret = 1;
+                       goto finish;
+               }
+               priv = current;
+               current = current->next;
+       }
+       goto finish;
+
+finish:
+       AST(mutex_unlock(&general_trace_lists_access_mutex) == 1);
+
+       return ret;
+}
+
diff --git a/src/headers/egl.h b/src/headers/egl.h
new file mode 100644 (file)
index 0000000..c7d779c
--- /dev/null
@@ -0,0 +1,239 @@
+//------------------------------------------------------//
+//                         EGL
+//------------------------------------------------------//
+
+/* 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_PRESERVED_RESOURCES                0x3030
+#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
+#define EGL_GL_TEXTURE_2D_KHR   0x30B1
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8
+#define EGL_GL_TEXTURE_3D_KHR  0x30B2
+#define EGL_GL_RENDERBUFFER_KHR        0x30B9
+
+/* 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
+
+
+// KHR Extention
+#ifndef EGL_KHR_image
+#define EGL_KHR_image 1
+typedef void *EGLImageKHR;
+#define EGL_NATIVE_PIXMAP_KHR             0x30B0
+#define EGL_NO_IMAGE_KHR                  ((EGLImageKHR)0)
+#endif /* EGL_KHR_image */
+
+#ifndef EGL_KHR_create_context
+#define EGL_KHR_create_context 1
+#define EGL_CONTEXT_MAJOR_VERSION_KHR     0x3098
+#define EGL_CONTEXT_MINOR_VERSION_KHR     0x30FB
+#define EGL_CONTEXT_FLAGS_KHR             0x30FC
+#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD
+#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD
+#define EGL_NO_RESET_NOTIFICATION_KHR     0x31BE
+#define EGL_LOSE_CONTEXT_ON_RESET_KHR     0x31BF
+#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR  0x00000001
+#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
+#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
+#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
+#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
+#define EGL_OPENGL_ES3_BIT_KHR            0x00000040
+#endif /* EGL_KHR_create_context */
+
diff --git a/src/headers/gl.h b/src/headers/gl.h
new file mode 100644 (file)
index 0000000..3ceab22
--- /dev/null
@@ -0,0 +1,822 @@
+/*
+ * gl3.h last updated on $Date: 2013-02-12 14:37:24 -0800 (Tue, 12 Feb 2013) $
+ */
+
+/*-------------------------------------------------------------------------
+ * Data type definitions
+ *-----------------------------------------------------------------------*/
+
+/* OpenGL ES 2.0 */
+
+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_intptr_t GLintptr;
+typedef khronos_ssize_t  GLsizeiptr;
+
+/* OpenGL ES 3.0 */
+
+typedef unsigned short   GLhalf;
+typedef khronos_int64_t  GLint64;
+typedef khronos_uint64_t GLuint64;
+typedef struct __GLsync *GLsync;
+
+/*-------------------------------------------------------------------------
+ * Token definitions
+ *-----------------------------------------------------------------------*/
+
+/* OpenGL ES core versions */
+#define GL_ES_VERSION_3_0                                1
+#define GL_ES_VERSION_2_0                                1
+
+/* OpenGL ES 2.0 */
+
+/* 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
+
+/* BlendingFactorDest */
+#define GL_ZERO                                          0
+#define GL_ONE                                           1
+#define GL_SRC_COLOR                                     0x0300
+#define GL_ONE_MINUS_SRC_COLOR                           0x0301
+#define GL_SRC_ALPHA                                     0x0302
+#define GL_ONE_MINUS_SRC_ALPHA                           0x0303
+#define GL_DST_ALPHA                                     0x0304
+#define GL_ONE_MINUS_DST_ALPHA                           0x0305
+
+/* BlendingFactorSrc */
+/*      GL_ZERO */
+/*      GL_ONE */
+#define GL_DST_COLOR                                     0x0306
+#define GL_ONE_MINUS_DST_COLOR                           0x0307
+#define GL_SRC_ALPHA_SATURATE                            0x0308
+/*      GL_SRC_ALPHA */
+/*      GL_ONE_MINUS_SRC_ALPHA */
+/*      GL_DST_ALPHA */
+/*      GL_ONE_MINUS_DST_ALPHA */
+
+/* BlendEquationSeparate */
+#define GL_FUNC_ADD                                      0x8006
+#define GL_BLEND_EQUATION                                0x8009
+#define GL_BLEND_EQUATION_RGB                            0x8009    /* same as BLEND_EQUATION */
+#define GL_BLEND_EQUATION_ALPHA                          0x883D
+
+/* BlendSubtract */
+#define GL_FUNC_SUBTRACT                                 0x800A
+#define GL_FUNC_REVERSE_SUBTRACT                         0x800B
+
+/* Separate Blend Functions */
+#define GL_BLEND_DST_RGB                                 0x80C8
+#define GL_BLEND_SRC_RGB                                 0x80C9
+#define GL_BLEND_DST_ALPHA                               0x80CA
+#define GL_BLEND_SRC_ALPHA                               0x80CB
+#define GL_CONSTANT_COLOR                                0x8001
+#define GL_ONE_MINUS_CONSTANT_COLOR                      0x8002
+#define GL_CONSTANT_ALPHA                                0x8003
+#define GL_ONE_MINUS_CONSTANT_ALPHA                      0x8004
+#define GL_BLEND_COLOR                                   0x8005
+
+/* Buffer Objects */
+#define GL_ARRAY_BUFFER                                  0x8892
+#define GL_ELEMENT_ARRAY_BUFFER                          0x8893
+#define GL_ARRAY_BUFFER_BINDING                          0x8894
+#define GL_ELEMENT_ARRAY_BUFFER_BINDING                  0x8895
+
+#define GL_STREAM_DRAW                                   0x88E0
+#define GL_STATIC_DRAW                                   0x88E4
+#define GL_DYNAMIC_DRAW                                  0x88E8
+
+#define GL_BUFFER_SIZE                                   0x8764
+#define GL_BUFFER_USAGE                                  0x8765
+
+#define GL_CURRENT_VERTEX_ATTRIB                         0x8626
+
+/* CullFaceMode */
+#define GL_FRONT                                         0x0404
+#define GL_BACK                                          0x0405
+#define GL_FRONT_AND_BACK                                0x0408
+
+/* DepthFunction */
+/*      GL_NEVER */
+/*      GL_LESS */
+/*      GL_EQUAL */
+/*      GL_LEQUAL */
+/*      GL_GREATER */
+/*      GL_NOTEQUAL */
+/*      GL_GEQUAL */
+/*      GL_ALWAYS */
+
+/* EnableCap */
+#define GL_TEXTURE_2D                                    0x0DE1
+#define GL_CULL_FACE                                     0x0B44
+#define GL_BLEND                                         0x0BE2
+#define GL_DITHER                                        0x0BD0
+#define GL_STENCIL_TEST                                  0x0B90
+#define GL_DEPTH_TEST                                    0x0B71
+#define GL_SCISSOR_TEST                                  0x0C11
+#define GL_POLYGON_OFFSET_FILL                           0x8037
+#define GL_SAMPLE_ALPHA_TO_COVERAGE                      0x809E
+#define GL_SAMPLE_COVERAGE                               0x80A0
+
+/* ErrorCode */
+#define GL_NO_ERROR                                      0
+#define GL_INVALID_ENUM                                  0x0500
+#define GL_INVALID_VALUE                                 0x0501
+#define GL_INVALID_OPERATION                             0x0502
+#define GL_OUT_OF_MEMORY                                 0x0505
+
+/* FrontFaceDirection */
+#define GL_CW                                            0x0900
+#define GL_CCW                                           0x0901
+
+/* GetPName */
+#define GL_LINE_WIDTH                                    0x0B21
+#define GL_ALIASED_POINT_SIZE_RANGE                      0x846D
+#define GL_ALIASED_LINE_WIDTH_RANGE                      0x846E
+#define GL_CULL_FACE_MODE                                0x0B45
+#define GL_FRONT_FACE                                    0x0B46
+#define GL_DEPTH_RANGE                                   0x0B70
+#define GL_DEPTH_WRITEMASK                               0x0B72
+#define GL_DEPTH_CLEAR_VALUE                             0x0B73
+#define GL_DEPTH_FUNC                                    0x0B74
+#define GL_STENCIL_CLEAR_VALUE                           0x0B91
+#define GL_STENCIL_FUNC                                  0x0B92
+#define GL_STENCIL_FAIL                                  0x0B94
+#define GL_STENCIL_PASS_DEPTH_FAIL                       0x0B95
+#define GL_STENCIL_PASS_DEPTH_PASS                       0x0B96
+#define GL_STENCIL_REF                                   0x0B97
+#define GL_STENCIL_VALUE_MASK                            0x0B93
+#define GL_STENCIL_WRITEMASK                             0x0B98
+#define GL_STENCIL_BACK_FUNC                             0x8800
+#define GL_STENCIL_BACK_FAIL                             0x8801
+#define GL_STENCIL_BACK_PASS_DEPTH_FAIL                  0x8802
+#define GL_STENCIL_BACK_PASS_DEPTH_PASS                  0x8803
+#define GL_STENCIL_BACK_REF                              0x8CA3
+#define GL_STENCIL_BACK_VALUE_MASK                       0x8CA4
+#define GL_STENCIL_BACK_WRITEMASK                        0x8CA5
+#define GL_VIEWPORT                                      0x0BA2
+#define GL_SCISSOR_BOX                                   0x0C10
+/*      GL_SCISSOR_TEST */
+#define GL_COLOR_CLEAR_VALUE                             0x0C22
+#define GL_COLOR_WRITEMASK                               0x0C23
+#define GL_UNPACK_ALIGNMENT                              0x0CF5
+#define GL_PACK_ALIGNMENT                                0x0D05
+#define GL_MAX_TEXTURE_SIZE                              0x0D33
+#define GL_MAX_VIEWPORT_DIMS                             0x0D3A
+#define GL_SUBPIXEL_BITS                                 0x0D50
+#define GL_RED_BITS                                      0x0D52
+#define GL_GREEN_BITS                                    0x0D53
+#define GL_BLUE_BITS                                     0x0D54
+#define GL_ALPHA_BITS                                    0x0D55
+#define GL_DEPTH_BITS                                    0x0D56
+#define GL_STENCIL_BITS                                  0x0D57
+#define GL_POLYGON_OFFSET_UNITS                          0x2A00
+/*      GL_POLYGON_OFFSET_FILL */
+#define GL_POLYGON_OFFSET_FACTOR                         0x8038
+#define GL_TEXTURE_BINDING_2D                            0x8069
+#define GL_SAMPLE_BUFFERS                                0x80A8
+#define GL_SAMPLES                                       0x80A9
+#define GL_SAMPLE_COVERAGE_VALUE                         0x80AA
+#define GL_SAMPLE_COVERAGE_INVERT                        0x80AB
+
+/* GetTextureParameter */
+/*      GL_TEXTURE_MAG_FILTER */
+/*      GL_TEXTURE_MIN_FILTER */
+/*      GL_TEXTURE_WRAP_S */
+/*      GL_TEXTURE_WRAP_T */
+
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS                0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS                    0x86A3
+
+/* HintMode */
+#define GL_DONT_CARE                                     0x1100
+#define GL_FASTEST                                       0x1101
+#define GL_NICEST                                        0x1102
+
+/* HintTarget */
+#define GL_GENERATE_MIPMAP_HINT                          0x8192
+
+/* DataType */
+#define GL_BYTE                                          0x1400
+#define GL_UNSIGNED_BYTE                                 0x1401
+#define GL_SHORT                                         0x1402
+#define GL_UNSIGNED_SHORT                                0x1403
+#define GL_INT                                           0x1404
+#define GL_UNSIGNED_INT                                  0x1405
+#define GL_FLOAT                                         0x1406
+#define GL_FIXED                                         0x140C
+
+/* PixelFormat */
+#define GL_DEPTH_COMPONENT                               0x1902
+#define GL_ALPHA                                         0x1906
+#define GL_RGB                                           0x1907
+#define GL_RGBA                                          0x1908
+#define GL_LUMINANCE                                     0x1909
+#define GL_LUMINANCE_ALPHA                               0x190A
+
+/* PixelType */
+/*      GL_UNSIGNED_BYTE */
+#define GL_UNSIGNED_SHORT_4_4_4_4                        0x8033
+#define GL_UNSIGNED_SHORT_5_5_5_1                        0x8034
+#define GL_UNSIGNED_SHORT_5_6_5                          0x8363
+
+/* Shaders */
+#define GL_FRAGMENT_SHADER                               0x8B30
+#define GL_VERTEX_SHADER                                 0x8B31
+#define GL_MAX_VERTEX_ATTRIBS                            0x8869
+#define GL_MAX_VERTEX_UNIFORM_VECTORS                    0x8DFB
+#define GL_MAX_VARYING_VECTORS                           0x8DFC
+#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS              0x8B4D
+#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS                0x8B4C
+#define GL_MAX_TEXTURE_IMAGE_UNITS                       0x8872
+#define GL_MAX_FRAGMENT_UNIFORM_VECTORS                  0x8DFD
+#define GL_SHADER_TYPE                                   0x8B4F
+#define GL_DELETE_STATUS                                 0x8B80
+#define GL_LINK_STATUS                                   0x8B82
+#define GL_VALIDATE_STATUS                               0x8B83
+#define GL_ATTACHED_SHADERS                              0x8B85
+#define GL_ACTIVE_UNIFORMS                               0x8B86
+#define GL_ACTIVE_UNIFORM_MAX_LENGTH                     0x8B87
+#define GL_ACTIVE_ATTRIBUTES                             0x8B89
+#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH                   0x8B8A
+#define GL_SHADING_LANGUAGE_VERSION                      0x8B8C
+#define GL_CURRENT_PROGRAM                               0x8B8D
+
+/* StencilFunction */
+#define GL_NEVER                                         0x0200
+#define GL_LESS                                          0x0201
+#define GL_EQUAL                                         0x0202
+#define GL_LEQUAL                                        0x0203
+#define GL_GREATER                                       0x0204
+#define GL_NOTEQUAL                                      0x0205
+#define GL_GEQUAL                                        0x0206
+#define GL_ALWAYS                                        0x0207
+
+/* StencilOp */
+/*      GL_ZERO */
+#define GL_KEEP                                          0x1E00
+#define GL_REPLACE                                       0x1E01
+#define GL_INCR                                          0x1E02
+#define GL_DECR                                          0x1E03
+#define GL_INVERT                                        0x150A
+#define GL_INCR_WRAP                                     0x8507
+#define GL_DECR_WRAP                                     0x8508
+
+/* StringName */
+#define GL_VENDOR                                        0x1F00
+#define GL_RENDERER                                      0x1F01
+#define GL_VERSION                                       0x1F02
+#define GL_EXTENSIONS                                    0x1F03
+
+/* TextureMagFilter */
+#define GL_NEAREST                                       0x2600
+#define GL_LINEAR                                        0x2601
+
+/* TextureMinFilter */
+/*      GL_NEAREST */
+/*      GL_LINEAR */
+#define GL_NEAREST_MIPMAP_NEAREST                        0x2700
+#define GL_LINEAR_MIPMAP_NEAREST                         0x2701
+#define GL_NEAREST_MIPMAP_LINEAR                         0x2702
+#define GL_LINEAR_MIPMAP_LINEAR                          0x2703
+
+/* TextureParameterName */
+#define GL_TEXTURE_MAG_FILTER                            0x2800
+#define GL_TEXTURE_MIN_FILTER                            0x2801
+#define GL_TEXTURE_WRAP_S                                0x2802
+#define GL_TEXTURE_WRAP_T                                0x2803
+
+/* TextureTarget */
+/*      GL_TEXTURE_2D */
+#define GL_TEXTURE                                       0x1702
+
+#define GL_TEXTURE_CUBE_MAP                              0x8513
+#define GL_TEXTURE_BINDING_CUBE_MAP                      0x8514
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_X                   0x8515
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X                   0x8516
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y                   0x8517
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y                   0x8518
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z                   0x8519
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z                   0x851A
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE                     0x851C
+
+/* TextureUnit */
+#define GL_TEXTURE0                                      0x84C0
+#define GL_TEXTURE1                                      0x84C1
+#define GL_TEXTURE2                                      0x84C2
+#define GL_TEXTURE3                                      0x84C3
+#define GL_TEXTURE4                                      0x84C4
+#define GL_TEXTURE5                                      0x84C5
+#define GL_TEXTURE6                                      0x84C6
+#define GL_TEXTURE7                                      0x84C7
+#define GL_TEXTURE8                                      0x84C8
+#define GL_TEXTURE9                                      0x84C9
+#define GL_TEXTURE10                                     0x84CA
+#define GL_TEXTURE11                                     0x84CB
+#define GL_TEXTURE12                                     0x84CC
+#define GL_TEXTURE13                                     0x84CD
+#define GL_TEXTURE14                                     0x84CE
+#define GL_TEXTURE15                                     0x84CF
+#define GL_TEXTURE16                                     0x84D0
+#define GL_TEXTURE17                                     0x84D1
+#define GL_TEXTURE18                                     0x84D2
+#define GL_TEXTURE19                                     0x84D3
+#define GL_TEXTURE20                                     0x84D4
+#define GL_TEXTURE21                                     0x84D5
+#define GL_TEXTURE22                                     0x84D6
+#define GL_TEXTURE23                                     0x84D7
+#define GL_TEXTURE24                                     0x84D8
+#define GL_TEXTURE25                                     0x84D9
+#define GL_TEXTURE26                                     0x84DA
+#define GL_TEXTURE27                                     0x84DB
+#define GL_TEXTURE28                                     0x84DC
+#define GL_TEXTURE29                                     0x84DD
+#define GL_TEXTURE30                                     0x84DE
+#define GL_TEXTURE31                                     0x84DF
+#define GL_ACTIVE_TEXTURE                                0x84E0
+
+/* TextureWrapMode */
+#define GL_REPEAT                                        0x2901
+#define GL_CLAMP_TO_EDGE                                 0x812F
+#define GL_MIRRORED_REPEAT                               0x8370
+
+/* Uniform Types */
+#define GL_FLOAT_VEC2                                    0x8B50
+#define GL_FLOAT_VEC3                                    0x8B51
+#define GL_FLOAT_VEC4                                    0x8B52
+#define GL_INT_VEC2                                      0x8B53
+#define GL_INT_VEC3                                      0x8B54
+#define GL_INT_VEC4                                      0x8B55
+#define GL_BOOL                                          0x8B56
+#define GL_BOOL_VEC2                                     0x8B57
+#define GL_BOOL_VEC3                                     0x8B58
+#define GL_BOOL_VEC4                                     0x8B59
+#define GL_FLOAT_MAT2                                    0x8B5A
+#define GL_FLOAT_MAT3                                    0x8B5B
+#define GL_FLOAT_MAT4                                    0x8B5C
+#define GL_SAMPLER_2D                                    0x8B5E
+#define GL_SAMPLER_CUBE                                  0x8B60
+
+/* Vertex Arrays */
+#define GL_VERTEX_ATTRIB_ARRAY_ENABLED                   0x8622
+#define GL_VERTEX_ATTRIB_ARRAY_SIZE                      0x8623
+#define GL_VERTEX_ATTRIB_ARRAY_STRIDE                    0x8624
+#define GL_VERTEX_ATTRIB_ARRAY_TYPE                      0x8625
+#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED                0x886A
+#define GL_VERTEX_ATTRIB_ARRAY_POINTER                   0x8645
+#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING            0x889F
+
+/* Read Format */
+#define GL_IMPLEMENTATION_COLOR_READ_TYPE                0x8B9A
+#define GL_IMPLEMENTATION_COLOR_READ_FORMAT              0x8B9B
+
+/* Shader Source */
+#define GL_COMPILE_STATUS                                0x8B81
+#define GL_INFO_LOG_LENGTH                               0x8B84
+#define GL_SHADER_SOURCE_LENGTH                          0x8B88
+#define GL_SHADER_COMPILER                               0x8DFA
+
+/* Shader Binary */
+#define GL_SHADER_BINARY_FORMATS                         0x8DF8
+#define GL_NUM_SHADER_BINARY_FORMATS                     0x8DF9
+
+/* Shader Precision-Specified Types */
+#define GL_LOW_FLOAT                                     0x8DF0
+#define GL_MEDIUM_FLOAT                                  0x8DF1
+#define GL_HIGH_FLOAT                                    0x8DF2
+#define GL_LOW_INT                                       0x8DF3
+#define GL_MEDIUM_INT                                    0x8DF4
+#define GL_HIGH_INT                                      0x8DF5
+
+/* Framebuffer Object. */
+#define GL_FRAMEBUFFER                                   0x8D40
+#define GL_RENDERBUFFER                                  0x8D41
+
+#define GL_RGBA4                                         0x8056
+#define GL_RGB5_A1                                       0x8057
+#define GL_RGB565                                        0x8D62
+#define GL_DEPTH_COMPONENT16                             0x81A5
+#define GL_STENCIL_INDEX8                                0x8D48
+
+#define GL_RENDERBUFFER_WIDTH                            0x8D42
+#define GL_RENDERBUFFER_HEIGHT                           0x8D43
+#define GL_RENDERBUFFER_INTERNAL_FORMAT                  0x8D44
+#define GL_RENDERBUFFER_RED_SIZE                         0x8D50
+#define GL_RENDERBUFFER_GREEN_SIZE                       0x8D51
+#define GL_RENDERBUFFER_BLUE_SIZE                        0x8D52
+#define GL_RENDERBUFFER_ALPHA_SIZE                       0x8D53
+#define GL_RENDERBUFFER_DEPTH_SIZE                       0x8D54
+#define GL_RENDERBUFFER_STENCIL_SIZE                     0x8D55
+
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE            0x8CD0
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME            0x8CD1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL          0x8CD2
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE  0x8CD3
+
+#define GL_COLOR_ATTACHMENT0                             0x8CE0
+#define GL_DEPTH_ATTACHMENT                              0x8D00
+#define GL_STENCIL_ATTACHMENT                            0x8D20
+
+#define GL_NONE                                          0
+
+#define GL_FRAMEBUFFER_COMPLETE                          0x8CD5
+#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT             0x8CD6
+#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT     0x8CD7
+#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS             0x8CD9
+#define GL_FRAMEBUFFER_UNSUPPORTED                       0x8CDD
+
+#define GL_FRAMEBUFFER_BINDING                           0x8CA6
+#define GL_RENDERBUFFER_BINDING                          0x8CA7
+#define GL_MAX_RENDERBUFFER_SIZE                         0x84E8
+
+#define GL_INVALID_FRAMEBUFFER_OPERATION                 0x0506
+
+/* OpenGL ES 3.0 */
+
+#define GL_READ_BUFFER                                   0x0C02
+#define GL_UNPACK_ROW_LENGTH                             0x0CF2
+#define GL_UNPACK_SKIP_ROWS                              0x0CF3
+#define GL_UNPACK_SKIP_PIXELS                            0x0CF4
+#define GL_PACK_ROW_LENGTH                               0x0D02
+#define GL_PACK_SKIP_ROWS                                0x0D03
+#define GL_PACK_SKIP_PIXELS                              0x0D04
+#define GL_COLOR                                         0x1800
+#define GL_DEPTH                                         0x1801
+#define GL_STENCIL                                       0x1802
+#define GL_RED                                           0x1903
+#define GL_RGB8                                          0x8051
+#define GL_RGBA8                                         0x8058
+#define GL_RGB10_A2                                      0x8059
+#define GL_TEXTURE_BINDING_3D                            0x806A
+#define GL_UNPACK_SKIP_IMAGES                            0x806D
+#define GL_UNPACK_IMAGE_HEIGHT                           0x806E
+#define GL_TEXTURE_3D                                    0x806F
+#define GL_TEXTURE_WRAP_R                                0x8072
+#define GL_MAX_3D_TEXTURE_SIZE                           0x8073
+#define GL_UNSIGNED_INT_2_10_10_10_REV                   0x8368
+#define GL_MAX_ELEMENTS_VERTICES                         0x80E8
+#define GL_MAX_ELEMENTS_INDICES                          0x80E9
+#define GL_TEXTURE_MIN_LOD                               0x813A
+#define GL_TEXTURE_MAX_LOD                               0x813B
+#define GL_TEXTURE_BASE_LEVEL                            0x813C
+#define GL_TEXTURE_MAX_LEVEL                             0x813D
+#define GL_MIN                                           0x8007
+#define GL_MAX                                           0x8008
+#define GL_DEPTH_COMPONENT24                             0x81A6
+#define GL_MAX_TEXTURE_LOD_BIAS                          0x84FD
+#define GL_TEXTURE_COMPARE_MODE                          0x884C
+#define GL_TEXTURE_COMPARE_FUNC                          0x884D
+#define GL_CURRENT_QUERY                                 0x8865
+#define GL_QUERY_RESULT                                  0x8866
+#define GL_QUERY_RESULT_AVAILABLE                        0x8867
+#define GL_BUFFER_MAPPED                                 0x88BC
+#define GL_BUFFER_MAP_POINTER                            0x88BD
+#define GL_STREAM_READ                                   0x88E1
+#define GL_STREAM_COPY                                   0x88E2
+#define GL_STATIC_READ                                   0x88E5
+#define GL_STATIC_COPY                                   0x88E6
+#define GL_DYNAMIC_READ                                  0x88E9
+#define GL_DYNAMIC_COPY                                  0x88EA
+#define GL_MAX_DRAW_BUFFERS                              0x8824
+#define GL_DRAW_BUFFER0                                  0x8825
+#define GL_DRAW_BUFFER1                                  0x8826
+#define GL_DRAW_BUFFER2                                  0x8827
+#define GL_DRAW_BUFFER3                                  0x8828
+#define GL_DRAW_BUFFER4                                  0x8829
+#define GL_DRAW_BUFFER5                                  0x882A
+#define GL_DRAW_BUFFER6                                  0x882B
+#define GL_DRAW_BUFFER7                                  0x882C
+#define GL_DRAW_BUFFER8                                  0x882D
+#define GL_DRAW_BUFFER9                                  0x882E
+#define GL_DRAW_BUFFER10                                 0x882F
+#define GL_DRAW_BUFFER11                                 0x8830
+#define GL_DRAW_BUFFER12                                 0x8831
+#define GL_DRAW_BUFFER13                                 0x8832
+#define GL_DRAW_BUFFER14                                 0x8833
+#define GL_DRAW_BUFFER15                                 0x8834
+#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS               0x8B49
+#define GL_MAX_VERTEX_UNIFORM_COMPONENTS                 0x8B4A
+#define GL_SAMPLER_3D                                    0x8B5F
+#define GL_SAMPLER_2D_SHADOW                             0x8B62
+#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT               0x8B8B
+#define GL_PIXEL_PACK_BUFFER                             0x88EB
+#define GL_PIXEL_UNPACK_BUFFER                           0x88EC
+#define GL_PIXEL_PACK_BUFFER_BINDING                     0x88ED
+#define GL_PIXEL_UNPACK_BUFFER_BINDING                   0x88EF
+#define GL_FLOAT_MAT2x3                                  0x8B65
+#define GL_FLOAT_MAT2x4                                  0x8B66
+#define GL_FLOAT_MAT3x2                                  0x8B67
+#define GL_FLOAT_MAT3x4                                  0x8B68
+#define GL_FLOAT_MAT4x2                                  0x8B69
+#define GL_FLOAT_MAT4x3                                  0x8B6A
+#define GL_SRGB                                          0x8C40
+#define GL_SRGB8                                         0x8C41
+#define GL_SRGB8_ALPHA8                                  0x8C43
+#define GL_COMPARE_REF_TO_TEXTURE                        0x884E
+#define GL_MAJOR_VERSION                                 0x821B
+#define GL_MINOR_VERSION                                 0x821C
+#define GL_NUM_EXTENSIONS                                0x821D
+#define GL_RGBA32F                                       0x8814
+#define GL_RGB32F                                        0x8815
+#define GL_RGBA16F                                       0x881A
+#define GL_RGB16F                                        0x881B
+#define GL_VERTEX_ATTRIB_ARRAY_INTEGER                   0x88FD
+#define GL_MAX_ARRAY_TEXTURE_LAYERS                      0x88FF
+#define GL_MIN_PROGRAM_TEXEL_OFFSET                      0x8904
+#define GL_MAX_PROGRAM_TEXEL_OFFSET                      0x8905
+#define GL_MAX_VARYING_COMPONENTS                        0x8B4B
+#define GL_TEXTURE_2D_ARRAY                              0x8C1A
+#define GL_TEXTURE_BINDING_2D_ARRAY                      0x8C1D
+#define GL_R11F_G11F_B10F                                0x8C3A
+#define GL_UNSIGNED_INT_10F_11F_11F_REV                  0x8C3B
+#define GL_RGB9_E5                                       0x8C3D
+#define GL_UNSIGNED_INT_5_9_9_9_REV                      0x8C3E
+#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH         0x8C76
+#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE                0x8C7F
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS    0x8C80
+#define GL_TRANSFORM_FEEDBACK_VARYINGS                   0x8C83
+#define GL_TRANSFORM_FEEDBACK_BUFFER_START               0x8C84
+#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE                0x8C85
+#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN         0x8C88
+#define GL_RASTERIZER_DISCARD                            0x8C89
+#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS       0x8C8B
+#define GL_INTERLEAVED_ATTRIBS                           0x8C8C
+#define GL_SEPARATE_ATTRIBS                              0x8C8D
+#define GL_TRANSFORM_FEEDBACK_BUFFER                     0x8C8E
+#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING             0x8C8F
+#define GL_RGBA32UI                                      0x8D70
+#define GL_RGB32UI                                       0x8D71
+#define GL_RGBA16UI                                      0x8D76
+#define GL_RGB16UI                                       0x8D77
+#define GL_RGBA8UI                                       0x8D7C
+#define GL_RGB8UI                                        0x8D7D
+#define GL_RGBA32I                                       0x8D82
+#define GL_RGB32I                                        0x8D83
+#define GL_RGBA16I                                       0x8D88
+#define GL_RGB16I                                        0x8D89
+#define GL_RGBA8I                                        0x8D8E
+#define GL_RGB8I                                         0x8D8F
+#define GL_RED_INTEGER                                   0x8D94
+#define GL_RGB_INTEGER                                   0x8D98
+#define GL_RGBA_INTEGER                                  0x8D99
+#define GL_SAMPLER_2D_ARRAY                              0x8DC1
+#define GL_SAMPLER_2D_ARRAY_SHADOW                       0x8DC4
+#define GL_SAMPLER_CUBE_SHADOW                           0x8DC5
+#define GL_UNSIGNED_INT_VEC2                             0x8DC6
+#define GL_UNSIGNED_INT_VEC3                             0x8DC7
+#define GL_UNSIGNED_INT_VEC4                             0x8DC8
+#define GL_INT_SAMPLER_2D                                0x8DCA
+#define GL_INT_SAMPLER_3D                                0x8DCB
+#define GL_INT_SAMPLER_CUBE                              0x8DCC
+#define GL_INT_SAMPLER_2D_ARRAY                          0x8DCF
+#define GL_UNSIGNED_INT_SAMPLER_2D                       0x8DD2
+#define GL_UNSIGNED_INT_SAMPLER_3D                       0x8DD3
+#define GL_UNSIGNED_INT_SAMPLER_CUBE                     0x8DD4
+#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY                 0x8DD7
+#define GL_BUFFER_ACCESS_FLAGS                           0x911F
+#define GL_BUFFER_MAP_LENGTH                             0x9120
+#define GL_BUFFER_MAP_OFFSET                             0x9121
+#define GL_DEPTH_COMPONENT32F                            0x8CAC
+#define GL_DEPTH32F_STENCIL8                             0x8CAD
+#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV                0x8DAD
+#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING         0x8210
+#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE         0x8211
+#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE               0x8212
+#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE             0x8213
+#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE              0x8214
+#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE             0x8215
+#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE             0x8216
+#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE           0x8217
+#define GL_FRAMEBUFFER_DEFAULT                           0x8218
+#define GL_FRAMEBUFFER_UNDEFINED                         0x8219
+#define GL_DEPTH_STENCIL_ATTACHMENT                      0x821A
+#define GL_DEPTH_STENCIL                                 0x84F9
+#define GL_UNSIGNED_INT_24_8                             0x84FA
+#define GL_DEPTH24_STENCIL8                              0x88F0
+#define GL_UNSIGNED_NORMALIZED                           0x8C17
+#define GL_DRAW_FRAMEBUFFER_BINDING                      GL_FRAMEBUFFER_BINDING
+#define GL_READ_FRAMEBUFFER                              0x8CA8
+#define GL_DRAW_FRAMEBUFFER                              0x8CA9
+#define GL_READ_FRAMEBUFFER_BINDING                      0x8CAA
+#define GL_RENDERBUFFER_SAMPLES                          0x8CAB
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER          0x8CD4
+#define GL_MAX_COLOR_ATTACHMENTS                         0x8CDF
+#define GL_COLOR_ATTACHMENT1                             0x8CE1
+#define GL_COLOR_ATTACHMENT2                             0x8CE2
+#define GL_COLOR_ATTACHMENT3                             0x8CE3
+#define GL_COLOR_ATTACHMENT4                             0x8CE4
+#define GL_COLOR_ATTACHMENT5                             0x8CE5
+#define GL_COLOR_ATTACHMENT6                             0x8CE6
+#define GL_COLOR_ATTACHMENT7                             0x8CE7
+#define GL_COLOR_ATTACHMENT8                             0x8CE8
+#define GL_COLOR_ATTACHMENT9                             0x8CE9
+#define GL_COLOR_ATTACHMENT10                            0x8CEA
+#define GL_COLOR_ATTACHMENT11                            0x8CEB
+#define GL_COLOR_ATTACHMENT12                            0x8CEC
+#define GL_COLOR_ATTACHMENT13                            0x8CED
+#define GL_COLOR_ATTACHMENT14                            0x8CEE
+#define GL_COLOR_ATTACHMENT15                            0x8CEF
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE            0x8D56
+#define GL_MAX_SAMPLES                                   0x8D57
+#define GL_HALF_FLOAT                                    0x140B
+#define GL_MAP_READ_BIT                                  0x0001
+#define GL_MAP_WRITE_BIT                                 0x0002
+#define GL_MAP_INVALIDATE_RANGE_BIT                      0x0004
+#define GL_MAP_INVALIDATE_BUFFER_BIT                     0x0008
+#define GL_MAP_FLUSH_EXPLICIT_BIT                        0x0010
+#define GL_MAP_UNSYNCHRONIZED_BIT                        0x0020
+#define GL_RG                                            0x8227
+#define GL_RG_INTEGER                                    0x8228
+#define GL_R8                                            0x8229
+#define GL_RG8                                           0x822B
+#define GL_R16F                                          0x822D
+#define GL_R32F                                          0x822E
+#define GL_RG16F                                         0x822F
+#define GL_RG32F                                         0x8230
+#define GL_R8I                                           0x8231
+#define GL_R8UI                                          0x8232
+#define GL_R16I                                          0x8233
+#define GL_R16UI                                         0x8234
+#define GL_R32I                                          0x8235
+#define GL_R32UI                                         0x8236
+#define GL_RG8I                                          0x8237
+#define GL_RG8UI                                         0x8238
+#define GL_RG16I                                         0x8239
+#define GL_RG16UI                                        0x823A
+#define GL_RG32I                                         0x823B
+#define GL_RG32UI                                        0x823C
+#define GL_VERTEX_ARRAY_BINDING                          0x85B5
+#define GL_R8_SNORM                                      0x8F94
+#define GL_RG8_SNORM                                     0x8F95
+#define GL_RGB8_SNORM                                    0x8F96
+#define GL_RGBA8_SNORM                                   0x8F97
+#define GL_SIGNED_NORMALIZED                             0x8F9C
+#define GL_PRIMITIVE_RESTART_FIXED_INDEX                 0x8D69
+#define GL_COPY_READ_BUFFER                              0x8F36
+#define GL_COPY_WRITE_BUFFER                             0x8F37
+#define GL_COPY_READ_BUFFER_BINDING                      GL_COPY_READ_BUFFER
+#define GL_COPY_WRITE_BUFFER_BINDING                     GL_COPY_WRITE_BUFFER
+#define GL_UNIFORM_BUFFER                                0x8A11
+#define GL_UNIFORM_BUFFER_BINDING                        0x8A28
+#define GL_UNIFORM_BUFFER_START                          0x8A29
+#define GL_UNIFORM_BUFFER_SIZE                           0x8A2A
+#define GL_MAX_VERTEX_UNIFORM_BLOCKS                     0x8A2B
+#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS                   0x8A2D
+#define GL_MAX_COMBINED_UNIFORM_BLOCKS                   0x8A2E
+#define GL_MAX_UNIFORM_BUFFER_BINDINGS                   0x8A2F
+#define GL_MAX_UNIFORM_BLOCK_SIZE                        0x8A30
+#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS        0x8A31
+#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS      0x8A33
+#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT               0x8A34
+#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH          0x8A35
+#define GL_ACTIVE_UNIFORM_BLOCKS                         0x8A36
+#define GL_UNIFORM_TYPE                                  0x8A37
+#define GL_UNIFORM_SIZE                                  0x8A38
+#define GL_UNIFORM_NAME_LENGTH                           0x8A39
+#define GL_UNIFORM_BLOCK_INDEX                           0x8A3A
+#define GL_UNIFORM_OFFSET                                0x8A3B
+#define GL_UNIFORM_ARRAY_STRIDE                          0x8A3C
+#define GL_UNIFORM_MATRIX_STRIDE                         0x8A3D
+#define GL_UNIFORM_IS_ROW_MAJOR                          0x8A3E
+#define GL_UNIFORM_BLOCK_BINDING                         0x8A3F
+#define GL_UNIFORM_BLOCK_DATA_SIZE                       0x8A40
+#define GL_UNIFORM_BLOCK_NAME_LENGTH                     0x8A41
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS                 0x8A42
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES          0x8A43
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER     0x8A44
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER   0x8A46
+#define GL_INVALID_INDEX                                 0xFFFFFFFFu
+#define GL_MAX_VERTEX_OUTPUT_COMPONENTS                  0x9122
+#define GL_MAX_FRAGMENT_INPUT_COMPONENTS                 0x9125
+#define GL_MAX_SERVER_WAIT_TIMEOUT                       0x9111
+#define GL_OBJECT_TYPE                                   0x9112
+#define GL_SYNC_CONDITION                                0x9113
+#define GL_SYNC_STATUS                                   0x9114
+#define GL_SYNC_FLAGS                                    0x9115
+#define GL_SYNC_FENCE                                    0x9116
+#define GL_SYNC_GPU_COMMANDS_COMPLETE                    0x9117
+#define GL_UNSIGNALED                                    0x9118
+#define GL_SIGNALED                                      0x9119
+#define GL_ALREADY_SIGNALED                              0x911A
+#define GL_TIMEOUT_EXPIRED                               0x911B
+#define GL_CONDITION_SATISFIED                           0x911C
+#define GL_WAIT_FAILED                                   0x911D
+#define GL_SYNC_FLUSH_COMMANDS_BIT                       0x00000001
+#define GL_TIMEOUT_IGNORED                               0xFFFFFFFFFFFFFFFFull
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR                   0x88FE
+#define GL_ANY_SAMPLES_PASSED                            0x8C2F
+#define GL_TEXTURE_EXTERNAL_OES                          0x8D65
+#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE               0x8D6A
+#define GL_SAMPLER_BINDING                               0x8919
+#define GL_RGB10_A2UI                                    0x906F
+#define GL_TEXTURE_SWIZZLE_R                             0x8E42
+#define GL_TEXTURE_SWIZZLE_G                             0x8E43
+#define GL_TEXTURE_SWIZZLE_B                             0x8E44
+#define GL_TEXTURE_SWIZZLE_A                             0x8E45
+#define GL_GREEN                                         0x1904
+#define GL_BLUE                                          0x1905
+#define GL_INT_2_10_10_10_REV                            0x8D9F
+#define GL_TRANSFORM_FEEDBACK                            0x8E22
+#define GL_TRANSFORM_FEEDBACK_PAUSED                     0x8E23
+#define GL_TRANSFORM_FEEDBACK_ACTIVE                     0x8E24
+#define GL_TRANSFORM_FEEDBACK_BINDING                    0x8E25
+#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT               0x8257
+#define GL_PROGRAM_BINARY_LENGTH                         0x8741
+#define GL_NUM_PROGRAM_BINARY_FORMATS                    0x87FE
+#define GL_PROGRAM_BINARY_FORMATS                        0x87FF
+#define GL_COMPRESSED_R11_EAC                            0x9270
+#define GL_COMPRESSED_SIGNED_R11_EAC                     0x9271
+#define GL_COMPRESSED_RG11_EAC                           0x9272
+#define GL_COMPRESSED_SIGNED_RG11_EAC                    0x9273
+#define GL_COMPRESSED_RGB8_ETC2                          0x9274
+#define GL_COMPRESSED_SRGB8_ETC2                         0x9275
+#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2      0x9276
+#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2     0x9277
+#define GL_COMPRESSED_RGBA8_ETC2_EAC                     0x9278
+#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC              0x9279
+#define GL_TEXTURE_IMMUTABLE_FORMAT                      0x912F
+#define GL_MAX_ELEMENT_INDEX                             0x8D6B
+#define GL_NUM_SAMPLE_COUNTS                             0x9380
+#define GL_TEXTURE_IMMUTABLE_LEVELS                      0x82DF
+
+//---------------------------//
+// GLES extension defines
+/* GL_OES_EGL_image */
+#ifndef GL_OES_EGL_image
+typedef void* GLeglImageOES;
+#endif
+
+#ifndef EGL_SEC_image_map
+#define EGL_SEC_image_map 1
+#define EGL_MAP_GL_TEXTURE_2D_SEC                              0x3201  /* eglCreateImageKHR target */
+#define EGL_MAP_GL_TEXTURE_HEIGHT_SEC                  0x3202  /* eglCreateImageKHR attribute */
+#define EGL_MAP_GL_TEXTURE_WIDTH_SEC                   0x3203  /* eglCreateImageKHR attribute */
+#define EGL_MAP_GL_TEXTURE_FORMAT_SEC                  0x3204  /* eglCreateImageKHR attribute, Specifies the number of color components in the mapped texture. */
+#define EGL_MAP_GL_TEXTURE_RGB_SEC                             0x3205  /* More config attribute value, for EGL_MAP_GL_TEXTURE_FORMAT_SEC */
+#define EGL_MAP_GL_TEXTURE_RGBA_SEC                            0x3206  /* More config attribute value, for EGL_MAP_GL_TEXTURE_FORMAT_SEC */
+#define EGL_MAP_GL_TEXTURE_BGRA_SEC                            0x3207  /* More config attribute value, for EGL_MAP_GL_TEXTURE_FORMAT_SEC */
+#define EGL_MAP_GL_TEXTURE_LUMINANCE_SEC               0x3208  /* More config attribute value, for EGL_MAP_GL_TEXTURE_FORMAT_SEC */
+#define EGL_MAP_GL_TEXTURE_LUMINANCE_ALPHA_SEC         0x3209  /* More config attribute value, for EGL_MAP_GL_TEXTURE_FORMAT_SEC */
+#define EGL_MAP_GL_TEXTURE_PIXEL_TYPE_SEC              0x320a  /* eglCreateImageKHR attribute, Specifies the data type of the pixel data. */
+#define EGL_MAP_GL_TEXTURE_UNSIGNED_BYTE_SEC   0x320b  /* More config attribute value, for EGL_MAP_GL_TEXTURE_PIXEL_TYPE_SEC */
+#define EGL_MAP_GL_TEXTURE_STRIDE_IN_BYTES_SEC  0x320c /* GetImageAttribSEC target */
+#endif
+
+
+/* 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
+
+/* 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
+
+/* GL_EXT_texture_filter_anisotropic */
+#define GL_TEXTURE_MAX_ANISOTROPY_EXT                           0x84FE
+#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT                       0x84FF
+
+/* GL_EXT_texture_format_BGRA8888 */
+#define GL_BGRA_EXT                                             0x80E1
+
+/* GL_OES_standard_derivatives */
+#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES               0x8B8B
+
+/* GL_ANGLE_framebuffer_blit */
+#ifndef GL_ANGLE_framebuffer_blit
+#define GL_READ_FRAMEBUFFER_ANGLE                0x8CA8
+#define GL_DRAW_FRAMEBUFFER_ANGLE                0x8CA9
+
+#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE        0x8CA6
+#define GL_READ_FRAMEBUFFER_BINDING_ANGLE        0x8CAA
+#endif
+
diff --git a/src/headers/glx.h b/src/headers/glx.h
new file mode 100644 (file)
index 0000000..b88fa7e
--- /dev/null
@@ -0,0 +1,183 @@
+//------------------------------------------------------//
+//                         GLX
+//------------------------------------------------------//
+
+#define GLX_VERSION_1_1                1
+#define GLX_VERSION_1_2                1
+#define GLX_VERSION_1_3                1
+#define GLX_VERSION_1_4                1
+
+#define GLX_EXTENSION_NAME   "GLX"
+
+/*
+ * Tokens for glXChooseVisual and glXGetConfig:
+ */
+#define GLX_USE_GL             1
+#define GLX_BUFFER_SIZE                2
+#define GLX_LEVEL              3
+#define GLX_RGBA               4
+#define GLX_DOUBLEBUFFER       5
+#define GLX_STEREO             6
+#define GLX_AUX_BUFFERS                7
+#define GLX_RED_SIZE           8
+#define GLX_GREEN_SIZE         9
+#define GLX_BLUE_SIZE          10
+#define GLX_ALPHA_SIZE         11
+#define GLX_DEPTH_SIZE         12
+#define GLX_STENCIL_SIZE       13
+#define GLX_ACCUM_RED_SIZE     14
+#define GLX_ACCUM_GREEN_SIZE   15
+#define GLX_ACCUM_BLUE_SIZE    16
+#define GLX_ACCUM_ALPHA_SIZE   17
+
+
+/*
+ * Error codes returned by glXGetConfig:
+ */
+#define GLX_BAD_SCREEN         1
+#define GLX_BAD_ATTRIBUTE      2
+#define GLX_NO_EXTENSION       3
+#define GLX_BAD_VISUAL         4
+#define GLX_BAD_CONTEXT                5
+#define GLX_BAD_VALUE          6
+#define GLX_BAD_ENUM           7
+
+
+/*
+ * GLX 1.1 and later:
+ */
+#define GLX_VENDOR             1
+#define GLX_VERSION            2
+#define GLX_EXTENSIONS                 3
+
+
+/*
+ * GLX 1.3 and later:
+ */
+#define GLX_CONFIG_CAVEAT              0x20
+#define GLX_DONT_CARE                  0xFFFFFFFF
+#define GLX_X_VISUAL_TYPE              0x22
+#define GLX_TRANSPARENT_TYPE           0x23
+#define GLX_TRANSPARENT_INDEX_VALUE    0x24
+#define GLX_TRANSPARENT_RED_VALUE      0x25
+#define GLX_TRANSPARENT_GREEN_VALUE    0x26
+#define GLX_TRANSPARENT_BLUE_VALUE     0x27
+#define GLX_TRANSPARENT_ALPHA_VALUE    0x28
+#define GLX_WINDOW_BIT                 0x00000001
+#define GLX_PIXMAP_BIT                 0x00000002
+#define GLX_PBUFFER_BIT                        0x00000004
+#define GLX_AUX_BUFFERS_BIT            0x00000010
+#define GLX_FRONT_LEFT_BUFFER_BIT      0x00000001
+#define GLX_FRONT_RIGHT_BUFFER_BIT     0x00000002
+#define GLX_BACK_LEFT_BUFFER_BIT       0x00000004
+#define GLX_BACK_RIGHT_BUFFER_BIT      0x00000008
+#define GLX_DEPTH_BUFFER_BIT           0x00000020
+#define GLX_STENCIL_BUFFER_BIT         0x00000040
+#define GLX_ACCUM_BUFFER_BIT           0x00000080
+#define GLX_NONE                       0x8000
+#define GLX_SLOW_CONFIG                        0x8001
+#define GLX_TRUE_COLOR                 0x8002
+#define GLX_DIRECT_COLOR               0x8003
+#define GLX_PSEUDO_COLOR               0x8004
+#define GLX_STATIC_COLOR               0x8005
+#define GLX_GRAY_SCALE                 0x8006
+#define GLX_STATIC_GRAY                        0x8007
+#define GLX_TRANSPARENT_RGB            0x8008
+#define GLX_TRANSPARENT_INDEX          0x8009
+#define GLX_VISUAL_ID                  0x800B
+#define GLX_SCREEN                     0x800C
+#define GLX_NON_CONFORMANT_CONFIG      0x800D
+#define GLX_DRAWABLE_TYPE              0x8010
+#define GLX_RENDER_TYPE                        0x8011
+#define GLX_X_RENDERABLE               0x8012
+#define GLX_FBCONFIG_ID                        0x8013
+#define GLX_RGBA_TYPE                  0x8014
+#define GLX_COLOR_INDEX_TYPE           0x8015
+#define GLX_MAX_PBUFFER_WIDTH          0x8016
+#define GLX_MAX_PBUFFER_HEIGHT         0x8017
+#define GLX_MAX_PBUFFER_PIXELS         0x8018
+#define GLX_PRESERVED_CONTENTS         0x801B
+#define GLX_LARGEST_PBUFFER            0x801C
+#define GLX_WIDTH                      0x801D
+#define GLX_HEIGHT                     0x801E
+#define GLX_EVENT_MASK                 0x801F
+#define GLX_DAMAGED                    0x8020
+#define GLX_SAVED                      0x8021
+#define GLX_WINDOW                     0x8022
+#define GLX_PBUFFER                    0x8023
+#define GLX_PBUFFER_HEIGHT              0x8040
+#define GLX_PBUFFER_WIDTH               0x8041
+#define GLX_RGBA_BIT                   0x00000001
+#define GLX_COLOR_INDEX_BIT            0x00000002
+#define GLX_PBUFFER_CLOBBER_MASK       0x08000000
+
+
+/*
+ * GLX 1.4 and later:
+ */
+#define GLX_SAMPLE_BUFFERS              0x186a0 /*100000*/
+#define GLX_SAMPLES                     0x186a1 /*100001*/
+
+
+
+typedef struct __GLXcontextRec *GLXContext;
+typedef XID GLXPixmap;
+typedef XID GLXDrawable;
+/* GLX 1.3 and later */
+typedef struct __GLXFBConfigRec *GLXFBConfig;
+typedef XID GLXFBConfigID;
+typedef XID GLXContextID;
+typedef XID GLXWindow;
+typedef XID GLXPbuffer;
+
+
+
+/*
+ * #?. GLX_EXT_texture_from_pixmap
+ * XXX not finished?
+ */
+#ifndef GLX_EXT_texture_from_pixmap
+#define GLX_EXT_texture_from_pixmap 1
+
+#define GLX_BIND_TO_TEXTURE_RGB_EXT        0x20D0
+#define GLX_BIND_TO_TEXTURE_RGBA_EXT       0x20D1
+#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT     0x20D2
+#define GLX_BIND_TO_TEXTURE_TARGETS_EXT    0x20D3
+#define GLX_Y_INVERTED_EXT                 0x20D4
+
+#define GLX_TEXTURE_FORMAT_EXT             0x20D5
+#define GLX_TEXTURE_TARGET_EXT             0x20D6
+#define GLX_MIPMAP_TEXTURE_EXT             0x20D7
+
+#define GLX_TEXTURE_FORMAT_NONE_EXT        0x20D8
+#define GLX_TEXTURE_FORMAT_RGB_EXT         0x20D9
+#define GLX_TEXTURE_FORMAT_RGBA_EXT        0x20DA
+
+#define GLX_TEXTURE_1D_BIT_EXT             0x00000001
+#define GLX_TEXTURE_2D_BIT_EXT             0x00000002
+#define GLX_TEXTURE_RECTANGLE_BIT_EXT      0x00000004
+
+#define GLX_TEXTURE_1D_EXT                 0x20DB
+#define GLX_TEXTURE_2D_EXT                 0x20DC
+#define GLX_TEXTURE_RECTANGLE_EXT          0x20DD
+
+#define GLX_FRONT_LEFT_EXT                 0x20DE
+#define GLX_FRONT_RIGHT_EXT                0x20DF
+#define GLX_BACK_LEFT_EXT                  0x20E0
+#define GLX_BACK_RIGHT_EXT                 0x20E1
+#define GLX_FRONT_EXT                      GLX_FRONT_LEFT_EXT
+#define GLX_BACK_EXT                       GLX_BACK_LEFT_EXT
+#define GLX_AUX0_EXT                       0x20E2
+#define GLX_AUX1_EXT                       0x20E3
+#define GLX_AUX2_EXT                       0x20E4
+#define GLX_AUX3_EXT                       0x20E5
+#define GLX_AUX4_EXT                       0x20E6
+#define GLX_AUX5_EXT                       0x20E7
+#define GLX_AUX6_EXT                       0x20E8
+#define GLX_AUX7_EXT                       0x20E9
+#define GLX_AUX8_EXT                       0x20EA
+#define GLX_AUX9_EXT                       0x20EB
+
+#endif //GLX_EXT_texture_from_pixmap
+
+
diff --git a/src/headers/sym.h b/src/headers/sym.h
new file mode 100644 (file)
index 0000000..886087b
--- /dev/null
@@ -0,0 +1,6 @@
+// Include all symbols\r
+\r
+#include "sym_gl.h"\r
+\r
+#include "sym_egl.h"\r
+\r
diff --git a/src/headers/sym_egl.h b/src/headers/sym_egl.h
new file mode 100644 (file)
index 0000000..27c858c
--- /dev/null
@@ -0,0 +1,119 @@
+// Defult use-case for exporting symbols
+#ifndef _COREGL_SYMBOL
+#define _COREGL_SYMBOL_NOT_DEFINED
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     COREGL_API extern RET_TYPE FUNC_NAME PARAM_LIST;
+#endif
+#ifndef _COREGL_EXT_SYMBOL
+#define _COREGL_EXT_SYMBOL_NOT_DEFINED
+#define _COREGL_EXT_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)   _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)
+#endif
+#ifndef _COREGL_EXT_SYMBOL_ALIAS
+#define _COREGL_EXT_SYMBOL_ALIAS_NOT_DEFINED
+#define _COREGL_EXT_SYMBOL_ALIAS(FUNC_NAME, ALIAS_NAME)
+#endif
+#ifndef _COREGL_EXT_SYMBOL_FASTPATH_PASS
+#define _COREGL_EXT_SYMBOL_FASTPATH_PASS_NOT_DEFINED
+#define _COREGL_EXT_SYMBOL_FASTPATH_PASS(FUNC_NAME)
+#endif
+#ifndef _COREGL_EXT_SYMBOL_FASTPATH_BLOCK
+#define _COREGL_EXT_SYMBOL_FASTPATH_BLOCK_NOT_DEFINED
+#define _COREGL_EXT_SYMBOL_FASTPATH_BLOCK(FUNC_NAME)
+#endif
+
+// Standard EGL APIs
+
+_COREGL_SYMBOL(EGLint, eglGetError, (void))
+_COREGL_SYMBOL(EGLDisplay, eglGetDisplay, (EGLNativeDisplayType display_id))
+_COREGL_SYMBOL(EGLBoolean, eglInitialize, (EGLDisplay dpy, EGLint* major, EGLint *minor))
+_COREGL_SYMBOL(EGLBoolean, eglTerminate, (EGLDisplay dpy))
+_COREGL_SYMBOL(const char*, eglQueryString, (EGLDisplay dpy, EGLint name))
+
+_COREGL_SYMBOL(EGLBoolean, eglGetConfigs, (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config))
+_COREGL_SYMBOL(EGLBoolean, eglChooseConfig, (EGLDisplay dpy, const EGLint* attrib_list, EGLConfig* configs, EGLint config_size, EGLint* num_config))
+_COREGL_SYMBOL(EGLBoolean, eglGetConfigAttrib, (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value))
+
+_COREGL_SYMBOL(EGLSurface, eglCreateWindowSurface, (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint* attrib_list))
+_COREGL_SYMBOL(EGLSurface, eglCreatePbufferSurface, (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list))
+_COREGL_SYMBOL(EGLSurface, eglCreatePixmapSurface, (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint* attrib_list))
+_COREGL_SYMBOL(EGLBoolean, eglDestroySurface, (EGLDisplay dpy, EGLSurface surface))
+_COREGL_SYMBOL(EGLBoolean, eglQuerySurface, (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value))
+
+_COREGL_SYMBOL(EGLBoolean, eglBindAPI, (EGLenum api))
+_COREGL_SYMBOL(EGLenum, eglQueryAPI, (void))
+_COREGL_SYMBOL(EGLBoolean, eglWaitClient, (void))
+_COREGL_SYMBOL(EGLBoolean, eglReleaseThread, (void))
+_COREGL_SYMBOL(EGLSurface, eglCreatePbufferFromClientBuffer, (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list))
+
+_COREGL_SYMBOL(EGLBoolean, eglSurfaceAttrib, (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value))
+_COREGL_SYMBOL(EGLBoolean, eglBindTexImage, (EGLDisplay dpy, EGLSurface surface, EGLint buffer))
+_COREGL_SYMBOL(EGLBoolean, eglReleaseTexImage, (EGLDisplay dpy, EGLSurface surface, EGLint buffer))
+_COREGL_SYMBOL(EGLBoolean, eglSwapInterval, (EGLDisplay dpy, EGLint interval))
+_COREGL_SYMBOL(EGLContext, eglCreateContext, (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint* attrib_list))
+_COREGL_SYMBOL(EGLBoolean, eglDestroyContext, (EGLDisplay dpy, EGLContext ctx))
+_COREGL_SYMBOL(EGLBoolean, eglMakeCurrent, (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx))
+_COREGL_SYMBOL(EGLContext, eglGetCurrentContext, (void))
+_COREGL_SYMBOL(EGLSurface, eglGetCurrentSurface, (EGLint readdraw))
+_COREGL_SYMBOL(EGLDisplay, eglGetCurrentDisplay, (void))
+
+_COREGL_SYMBOL(EGLBoolean, eglQueryContext, (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value))
+_COREGL_SYMBOL(EGLBoolean, eglWaitGL, (void))
+_COREGL_SYMBOL(EGLBoolean, eglWaitNative, (EGLint engine))
+_COREGL_SYMBOL(EGLBoolean, eglSwapBuffers, (EGLDisplay dpy, EGLSurface surface))
+_COREGL_SYMBOL(EGLBoolean, eglCopyBuffers, (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target))
+
+_COREGL_SYMBOL(_eng_fn, eglGetProcAddress, (const char* procname))
+
+
+// Extensions
+_COREGL_EXT_SYMBOL(EGLImageKHR, eglCreateImageKHR, (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list))
+_COREGL_EXT_SYMBOL(EGLBoolean, eglDestroyImageKHR, (EGLDisplay dpy, EGLImageKHR image))
+
+_COREGL_EXT_SYMBOL(void*, eglMapImageSEC, (EGLDisplay dpy, EGLImageKHR image, EGLint device_type, EGLint access_option))
+_COREGL_EXT_SYMBOL(EGLBoolean, eglUnmapImageSEC, (EGLDisplay dpy, EGLImageKHR image, EGLint device_type))
+_COREGL_EXT_SYMBOL(EGLBoolean, eglGetImageAttribSEC, (EGLDisplay dpy, EGLImageKHR image, EGLint attribute, EGLint *value))
+
+_COREGL_EXT_SYMBOL(EGLBoolean, eglLockSurfaceKHR, (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list))
+_COREGL_EXT_SYMBOL(EGLBoolean, eglUnlockSurfaceKHR, (EGLDisplay display, EGLSurface surface))
+
+_COREGL_EXT_SYMBOL(EGLBoolean, eglSwapBuffersWithDamageEXT, (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects))
+
+_COREGL_EXT_SYMBOL(EGLBoolean, eglSwapBuffersRegionEXT, (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects))
+
+/* Fastpath Verified extensions */
+//_COREGL_EXT_SYMBOL_FASTPATH_PASS(eglSwapBuffersRegionSEC)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(eglCreateSyncKHR)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(eglDestroySyncKHR)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(eglClientWaitSyncKHR)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(eglSignalSyncKHR)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(eglGetSyncAttribKHR)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(eglWaitSyncKHR)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(eglPostSubBufferNV)
+
+/* Fastpath Blocked extensions */
+//_COREGL_EXT_SYMBOL_FASTPATH_BLOCK()
+
+#ifdef _COREGL_EXT_SYMBOL_NOT_DEFINED
+#undef _COREGL_EXT_SYMBOL_NOT_DEFINED
+#undef _COREGL_EXT_SYMBOL
+#endif
+
+#ifdef _COREGL_SYMBOL_NOT_DEFINED
+#undef _COREGL_SYMBOL_NOT_DEFINED
+#undef _COREGL_SYMBOL
+#endif
+
+#ifdef _COREGL_EXT_SYMBOL_ALIAS_NOT_DEFINED
+#undef _COREGL_EXT_SYMBOL_ALIAS_NOT_DEFINED
+#undef _COREGL_EXT_SYMBOL_ALIAS
+#endif
+
+#ifdef _COREGL_EXT_SYMBOL_FASTPATH_PASS_NOT_DEFINED
+#undef _COREGL_EXT_SYMBOL_FASTPATH_PASS_NOT_DEFINED
+#undef _COREGL_EXT_SYMBOL_FASTPATH_PASS
+#endif
+
+#ifdef _COREGL_EXT_SYMBOL_FASTPATH_BLOCK_NOT_DEFINED
+#undef _COREGL_EXT_SYMBOL_FASTPATH_BLOCK_NOT_DEFINED
+#undef _COREGL_EXT_SYMBOL_FASTPATH_BLOCK
+#endif
+
diff --git a/src/headers/sym_gl.h b/src/headers/sym_gl.h
new file mode 100644 (file)
index 0000000..c31468e
--- /dev/null
@@ -0,0 +1,565 @@
+
+/*
+ * gl3.h last updated on $Date: 2013-02-12 14:37:24 -0800 (Tue, 12 Feb 2013) $
+ */
+
+// Defult use-case for exporting symbols
+#ifndef _COREGL_SYMBOL
+#define _COREGL_SYMBOL_NOT_DEFINED
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST) COREGL_API extern RET_TYPE FUNC_NAME PARAM_LIST;
+#endif
+#ifndef _COREGL_EXT_SYMBOL
+#define _COREGL_EXT_SYMBOL_NOT_DEFINED
+#define _COREGL_EXT_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST) _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)
+#endif
+#ifndef _COREGL_EXT_SYMBOL_ALIAS
+#define _COREGL_EXT_SYMBOL_ALIAS_NOT_DEFINED
+#define _COREGL_EXT_SYMBOL_ALIAS(FUNC_NAME, ALIAS_NAME)
+#endif
+#ifndef _COREGL_FASTPATH_SUPPORTED_EXTENSION
+#define _COREGL_FASTPATH_SUPPORTED_EXTENSION_NOT_DEFINED
+#define _COREGL_FASTPATH_SUPPORTED_EXTENSION(NAME, MINVER, MAXVER)
+#endif
+#ifndef _COREGL_EXT_SYMBOL_FASTPATH_PASS
+#define _COREGL_EXT_SYMBOL_FASTPATH_PASS_NOT_DEFINED
+#define _COREGL_EXT_SYMBOL_FASTPATH_PASS(FUNC_NAME)
+#endif
+#ifndef _COREGL_EXT_SYMBOL_FASTPATH_BLOCK
+#define _COREGL_EXT_SYMBOL_FASTPATH_BLOCK_NOT_DEFINED
+#define _COREGL_EXT_SYMBOL_FASTPATH_BLOCK(FUNC_NAME)
+#endif
+
+#ifndef _COREGL_START_API
+#define _COREGL_START_API(VERSION)
+#endif
+
+#ifndef _COREGL_END_API
+#define _COREGL_END_API(VERSION)
+#endif
+/* OpenGL ES 2.0 */
+_COREGL_SYMBOL(void, glActiveTexture, (GLenum texture))
+_COREGL_SYMBOL(void, glAttachShader, (GLuint program, GLuint shader))
+_COREGL_SYMBOL(void, glBindAttribLocation, (GLuint program, GLuint index, const char* name))
+_COREGL_SYMBOL(void, glBindBuffer, (GLenum target, GLuint buffer))
+_COREGL_SYMBOL(void, glBindFramebuffer, (GLenum target, GLuint framebuffer))
+_COREGL_SYMBOL(void, glBindRenderbuffer, (GLenum target, GLuint renderbuffer))
+_COREGL_SYMBOL(void, glBindTexture, (GLenum target, GLuint texture))
+_COREGL_SYMBOL(void, glBlendColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha))
+_COREGL_SYMBOL(void, glBlendEquation, ( GLenum mode ))
+_COREGL_SYMBOL(void, glBlendEquationSeparate, (GLenum modeRGB, GLenum modeAlpha))
+_COREGL_SYMBOL(void, glBlendFunc, (GLenum sfactor, GLenum dfactor))
+_COREGL_SYMBOL(void, glBlendFuncSeparate, (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha))
+_COREGL_SYMBOL(void, glBufferData, (GLenum target, GLsizeiptr size, const void* data, GLenum usage))
+_COREGL_SYMBOL(void, glBufferSubData, (GLenum target, GLintptr offset, GLsizeiptr size, const void* data))
+_COREGL_SYMBOL(GLenum, glCheckFramebufferStatus, (GLenum target))
+_COREGL_SYMBOL(void, glClear, (GLbitfield mask))
+_COREGL_SYMBOL(void, glClearColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha))
+_COREGL_SYMBOL(void, glClearDepthf, (GLclampf depth))
+_COREGL_SYMBOL(void, glClearStencil, (GLint s))
+_COREGL_SYMBOL(void, glColorMask, (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha))
+_COREGL_SYMBOL(void, glCompileShader, (GLuint shader))
+_COREGL_SYMBOL(void, glCompressedTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data))
+_COREGL_SYMBOL(void, glCompressedTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data))
+_COREGL_SYMBOL(void, glCopyTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border))
+_COREGL_SYMBOL(void, glCopyTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height))
+_COREGL_SYMBOL(GLuint, glCreateProgram, (void))
+_COREGL_SYMBOL(GLuint, glCreateShader, (GLenum type))
+_COREGL_SYMBOL(void, glCullFace, (GLenum mode))
+_COREGL_SYMBOL(void, glDeleteBuffers, (GLsizei n, const GLuint* buffers))
+_COREGL_SYMBOL(void, glDeleteFramebuffers, (GLsizei n, const GLuint* framebuffers))
+_COREGL_SYMBOL(void, glDeleteProgram, (GLuint program))
+_COREGL_SYMBOL(void, glDeleteRenderbuffers, (GLsizei n, const GLuint* renderbuffers))
+_COREGL_SYMBOL(void, glDeleteShader, (GLuint shader))
+_COREGL_SYMBOL(void, glDeleteTextures, (GLsizei n, const GLuint* textures))
+_COREGL_SYMBOL(void, glDepthFunc, (GLenum func))
+_COREGL_SYMBOL(void, glDepthMask, (GLboolean flag))
+_COREGL_SYMBOL(void, glDepthRangef, (GLclampf zNear, GLclampf zFar))
+_COREGL_SYMBOL(void, glDetachShader, (GLuint program, GLuint shader))
+_COREGL_SYMBOL(void, glDisable, (GLenum cap))
+_COREGL_SYMBOL(void, glDisableVertexAttribArray, (GLuint index))
+_COREGL_SYMBOL(void, glDrawArrays, (GLenum mode, GLint first, GLsizei count))
+_COREGL_SYMBOL(void, glDrawElements, (GLenum mode, GLsizei count, GLenum type, const void* indices))
+_COREGL_SYMBOL(void, glEnable, (GLenum cap))
+_COREGL_SYMBOL(void, glEnableVertexAttribArray, (GLuint index))
+_COREGL_SYMBOL(void, glFinish, (void))
+_COREGL_SYMBOL(void, glFlush, (void))
+_COREGL_SYMBOL(void, glFramebufferRenderbuffer, (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer))
+_COREGL_SYMBOL(void, glFramebufferTexture2D, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level))
+_COREGL_SYMBOL(void, glFrontFace, (GLenum mode))
+_COREGL_SYMBOL(void, glGenBuffers, (GLsizei n, GLuint* buffers))
+_COREGL_SYMBOL(void, glGenerateMipmap, (GLenum target))
+_COREGL_SYMBOL(void, glGenFramebuffers, (GLsizei n, GLuint* framebuffers))
+_COREGL_SYMBOL(void, glGenRenderbuffers, (GLsizei n, GLuint* renderbuffers))
+_COREGL_SYMBOL(void, glGenTextures, (GLsizei n, GLuint* textures))
+_COREGL_SYMBOL(void, glGetActiveAttrib, (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name))
+_COREGL_SYMBOL(void, glGetActiveUniform, (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name))
+_COREGL_SYMBOL(void, glGetAttachedShaders, (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders))
+_COREGL_SYMBOL(int, glGetAttribLocation, (GLuint program, const char* name))
+_COREGL_SYMBOL(void, glGetBooleanv, (GLenum pname, GLboolean* params))
+_COREGL_SYMBOL(void, glGetBufferParameteriv, (GLenum target, GLenum pname, GLint* params))
+_COREGL_SYMBOL(GLenum, glGetError, (void))
+_COREGL_SYMBOL(void, glGetFloatv, (GLenum pname, GLfloat* params))
+_COREGL_SYMBOL(void, glGetFramebufferAttachmentParameteriv, (GLenum target, GLenum attachment, GLenum pname, GLint* params))
+_COREGL_SYMBOL(void, glGetIntegerv, (GLenum pname, GLint* params))
+_COREGL_SYMBOL(void, glGetProgramiv, (GLuint program, GLenum pname, GLint* params))
+_COREGL_SYMBOL(void, glGetProgramInfoLog, (GLuint program, GLsizei bufsize, GLsizei* length, char* infolog))
+_COREGL_SYMBOL(void, glGetRenderbufferParameteriv, (GLenum target, GLenum pname, GLint* params))
+_COREGL_SYMBOL(void, glGetShaderiv, (GLuint shader, GLenum pname, GLint* params))
+_COREGL_SYMBOL(void, glGetShaderInfoLog, (GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog))
+_COREGL_SYMBOL(void, glGetShaderPrecisionFormat, (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision))
+_COREGL_SYMBOL(void, glGetShaderSource, (GLuint shader, GLsizei bufsize, GLsizei* length, char* source))
+_COREGL_SYMBOL(const GLubyte *, glGetString, (GLenum name))
+_COREGL_SYMBOL(void, glGetTexParameterfv, (GLenum target, GLenum pname, GLfloat* params))
+_COREGL_SYMBOL(void, glGetTexParameteriv, (GLenum target, GLenum pname, GLint* params))
+_COREGL_SYMBOL(void, glGetUniformfv, (GLuint program, GLint location, GLfloat* params))
+_COREGL_SYMBOL(void, glGetUniformiv, (GLuint program, GLint location, GLint* params))
+_COREGL_SYMBOL(int, glGetUniformLocation, (GLuint program, const char* name))
+_COREGL_SYMBOL(void, glGetVertexAttribfv, (GLuint index, GLenum pname, GLfloat* params))
+_COREGL_SYMBOL(void, glGetVertexAttribiv, (GLuint index, GLenum pname, GLint* params))
+_COREGL_SYMBOL(void, glGetVertexAttribPointerv, (GLuint index, GLenum pname, void** pointer))
+_COREGL_SYMBOL(void, glHint, (GLenum target, GLenum mode))
+_COREGL_SYMBOL(GLboolean, glIsBuffer, (GLuint buffer))
+_COREGL_SYMBOL(GLboolean, glIsEnabled, (GLenum cap))
+_COREGL_SYMBOL(GLboolean, glIsFramebuffer, (GLuint framebuffer))
+_COREGL_SYMBOL(GLboolean, glIsProgram, (GLuint program))
+_COREGL_SYMBOL(GLboolean, glIsRenderbuffer, (GLuint renderbuffer))
+_COREGL_SYMBOL(GLboolean, glIsShader, (GLuint shader))
+_COREGL_SYMBOL(GLboolean, glIsTexture, (GLuint texture))
+_COREGL_SYMBOL(void, glLineWidth, (GLfloat width))
+_COREGL_SYMBOL(void, glLinkProgram, (GLuint program))
+_COREGL_SYMBOL(void, glPixelStorei, (GLenum pname, GLint param))
+_COREGL_SYMBOL(void, glPolygonOffset, (GLfloat factor, GLfloat units))
+_COREGL_SYMBOL(void, glReadPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels))
+_COREGL_SYMBOL(void, glReleaseShaderCompiler, (void))
+_COREGL_SYMBOL(void, glRenderbufferStorage, (GLenum target, GLenum internalformat, GLsizei width, GLsizei height))
+_COREGL_SYMBOL(void, glSampleCoverage, (GLclampf value, GLboolean invert))
+_COREGL_SYMBOL(void, glScissor, (GLint x, GLint y, GLsizei width, GLsizei height))
+_COREGL_SYMBOL(void, glShaderBinary, (GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length))
+_COREGL_SYMBOL(void, glShaderSource, (GLuint shader, GLsizei count, const char** string, const GLint* length))
+_COREGL_SYMBOL(void, glStencilFunc, (GLenum func, GLint ref, GLuint mask))
+_COREGL_SYMBOL(void, glStencilFuncSeparate, (GLenum face, GLenum func, GLint ref, GLuint mask))
+_COREGL_SYMBOL(void, glStencilMask, (GLuint mask))
+_COREGL_SYMBOL(void, glStencilMaskSeparate, (GLenum face, GLuint mask))
+_COREGL_SYMBOL(void, glStencilOp, (GLenum fail, GLenum zfail, GLenum zpass))
+_COREGL_SYMBOL(void, glStencilOpSeparate, (GLenum face, GLenum fail, GLenum zfail, GLenum zpass))
+_COREGL_SYMBOL(void, glTexImage2D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels))
+_COREGL_SYMBOL(void, glTexParameterf, (GLenum target, GLenum pname, GLfloat param))
+_COREGL_SYMBOL(void, glTexParameterfv, (GLenum target, GLenum pname, const GLfloat* params))
+_COREGL_SYMBOL(void, glTexParameteri, (GLenum target, GLenum pname, GLint param))
+_COREGL_SYMBOL(void, glTexParameteriv, (GLenum target, GLenum pname, const GLint* params))
+_COREGL_SYMBOL(void, glTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels))
+_COREGL_SYMBOL(void, glUniform1f, (GLint location, GLfloat x))
+_COREGL_SYMBOL(void, glUniform1fv, (GLint location, GLsizei count, const GLfloat* v))
+_COREGL_SYMBOL(void, glUniform1i, (GLint location, GLint x))
+_COREGL_SYMBOL(void, glUniform1iv, (GLint location, GLsizei count, const GLint* v))
+_COREGL_SYMBOL(void, glUniform2f, (GLint location, GLfloat x, GLfloat y))
+_COREGL_SYMBOL(void, glUniform2fv, (GLint location, GLsizei count, const GLfloat* v))
+_COREGL_SYMBOL(void, glUniform2i, (GLint location, GLint x, GLint y))
+_COREGL_SYMBOL(void, glUniform2iv, (GLint location, GLsizei count, const GLint* v))
+_COREGL_SYMBOL(void, glUniform3f, (GLint location, GLfloat x, GLfloat y, GLfloat z))
+_COREGL_SYMBOL(void, glUniform3fv, (GLint location, GLsizei count, const GLfloat* v))
+_COREGL_SYMBOL(void, glUniform3i, (GLint location, GLint x, GLint y, GLint z))
+_COREGL_SYMBOL(void, glUniform3iv, (GLint location, GLsizei count, const GLint* v))
+_COREGL_SYMBOL(void, glUniform4f, (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w))
+_COREGL_SYMBOL(void, glUniform4fv, (GLint location, GLsizei count, const GLfloat* v))
+_COREGL_SYMBOL(void, glUniform4i, (GLint location, GLint x, GLint y, GLint z, GLint w))
+_COREGL_SYMBOL(void, glUniform4iv, (GLint location, GLsizei count, const GLint* v))
+_COREGL_SYMBOL(void, glUniformMatrix2fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value))
+_COREGL_SYMBOL(void, glUniformMatrix3fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value))
+_COREGL_SYMBOL(void, glUniformMatrix4fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value))
+_COREGL_SYMBOL(void, glUseProgram, (GLuint program))
+_COREGL_SYMBOL(void, glValidateProgram, (GLuint program))
+_COREGL_SYMBOL(void, glVertexAttrib1f, (GLuint index, GLfloat x))
+_COREGL_SYMBOL(void, glVertexAttrib1fv, (GLuint index, const GLfloat* values))
+_COREGL_SYMBOL(void, glVertexAttrib2f, (GLuint index, GLfloat x, GLfloat y))
+_COREGL_SYMBOL(void, glVertexAttrib2fv, (GLuint index, const GLfloat* values))
+_COREGL_SYMBOL(void, glVertexAttrib3f, (GLuint index, GLfloat x, GLfloat y, GLfloat z))
+_COREGL_SYMBOL(void, glVertexAttrib3fv, (GLuint index, const GLfloat* values))
+_COREGL_SYMBOL(void, glVertexAttrib4f, (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w))
+_COREGL_SYMBOL(void, glVertexAttrib4fv, (GLuint index, const GLfloat* values))
+_COREGL_SYMBOL(void, glVertexAttribPointer, (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* pointer))
+_COREGL_SYMBOL(void, glViewport, (GLint x, GLint y, GLsizei width, GLsizei height))
+
+/* OpenGL ES 3.0 */
+_COREGL_START_API(COREGL_GLAPI_3)
+_COREGL_SYMBOL(void, glReadBuffer, (GLenum mode))
+_COREGL_SYMBOL(void, glDrawRangeElements, (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices))
+_COREGL_SYMBOL(void, glTexImage3D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels))
+_COREGL_SYMBOL(void, glTexSubImage3D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels))
+_COREGL_SYMBOL(void, glCopyTexSubImage3D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height))
+_COREGL_SYMBOL(void, glCompressedTexImage3D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data))
+_COREGL_SYMBOL(void, glCompressedTexSubImage3D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data))
+_COREGL_SYMBOL(void, glGenQueries, (GLsizei n, GLuint* ids))
+_COREGL_SYMBOL(void, glDeleteQueries, (GLsizei n, const GLuint* ids))
+_COREGL_SYMBOL(GLboolean, glIsQuery, (GLuint id))
+_COREGL_SYMBOL(void, glBeginQuery, (GLenum target, GLuint id))
+_COREGL_SYMBOL(void, glEndQuery, (GLenum target))
+_COREGL_SYMBOL(void, glGetQueryiv, (GLenum target, GLenum pname, GLint* params))
+_COREGL_SYMBOL(void, glGetQueryObjectuiv, (GLuint id, GLenum pname, GLuint* params))
+_COREGL_SYMBOL(GLboolean, glUnmapBuffer, (GLenum target))
+_COREGL_SYMBOL(void, glGetBufferPointerv, (GLenum target, GLenum pname, GLvoid** params))
+_COREGL_SYMBOL(void, glDrawBuffers, (GLsizei n, const GLenum* bufs))
+_COREGL_SYMBOL(void, glUniformMatrix2x3fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value))
+_COREGL_SYMBOL(void, glUniformMatrix3x2fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value))
+_COREGL_SYMBOL(void, glUniformMatrix2x4fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value))
+_COREGL_SYMBOL(void, glUniformMatrix4x2fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value))
+_COREGL_SYMBOL(void, glUniformMatrix3x4fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value))
+_COREGL_SYMBOL(void, glUniformMatrix4x3fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value))
+_COREGL_SYMBOL(void, glBlitFramebuffer, (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter))
+_COREGL_SYMBOL(void, glRenderbufferStorageMultisample, (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height))
+_COREGL_SYMBOL(void, glFramebufferTextureLayer, (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer))
+_COREGL_SYMBOL(GLvoid*, glMapBufferRange, (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access))
+_COREGL_SYMBOL(void, glFlushMappedBufferRange, (GLenum target, GLintptr offset, GLsizeiptr length))
+_COREGL_SYMBOL(void, glBindVertexArray, (GLuint array))
+_COREGL_SYMBOL(void, glDeleteVertexArrays, (GLsizei n, const GLuint* arrays))
+_COREGL_SYMBOL(void, glGenVertexArrays, (GLsizei n, GLuint* arrays))
+_COREGL_SYMBOL(GLboolean, glIsVertexArray, (GLuint array))
+_COREGL_SYMBOL(void, glGetIntegeri_v, (GLenum target, GLuint index, GLint* data))
+_COREGL_SYMBOL(void, glBeginTransformFeedback, (GLenum primitiveMode))
+_COREGL_SYMBOL(void, glEndTransformFeedback, (void))
+_COREGL_SYMBOL(void, glBindBufferRange, (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size))
+_COREGL_SYMBOL(void, glBindBufferBase, (GLenum target, GLuint index, GLuint buffer))
+_COREGL_SYMBOL(void, glTransformFeedbackVaryings, (GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode))
+_COREGL_SYMBOL(void, glGetTransformFeedbackVarying, (GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name))
+_COREGL_SYMBOL(void, glVertexAttribIPointer, (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer))
+_COREGL_SYMBOL(void, glGetVertexAttribIiv, (GLuint index, GLenum pname, GLint* params))
+_COREGL_SYMBOL(void, glGetVertexAttribIuiv, (GLuint index, GLenum pname, GLuint* params))
+_COREGL_SYMBOL(void, glVertexAttribI4i, (GLuint index, GLint x, GLint y, GLint z, GLint w))
+_COREGL_SYMBOL(void, glVertexAttribI4ui, (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w))
+_COREGL_SYMBOL(void, glVertexAttribI4iv, (GLuint index, const GLint* v))
+_COREGL_SYMBOL(void, glVertexAttribI4uiv, (GLuint index, const GLuint* v))
+_COREGL_SYMBOL(void, glGetUniformuiv, (GLuint program, GLint location, GLuint* params))
+_COREGL_SYMBOL(GLint, glGetFragDataLocation, (GLuint program, const GLchar *name))
+_COREGL_SYMBOL(void, glUniform1ui, (GLint location, GLuint v0))
+_COREGL_SYMBOL(void, glUniform2ui, (GLint location, GLuint v0, GLuint v1))
+_COREGL_SYMBOL(void, glUniform3ui, (GLint location, GLuint v0, GLuint v1, GLuint v2))
+_COREGL_SYMBOL(void, glUniform4ui, (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3))
+_COREGL_SYMBOL(void, glUniform1uiv, (GLint location, GLsizei count, const GLuint* value))
+_COREGL_SYMBOL(void, glUniform2uiv, (GLint location, GLsizei count, const GLuint* value))
+_COREGL_SYMBOL(void, glUniform3uiv, (GLint location, GLsizei count, const GLuint* value))
+_COREGL_SYMBOL(void, glUniform4uiv, (GLint location, GLsizei count, const GLuint* value))
+_COREGL_SYMBOL(void, glClearBufferiv, (GLenum buffer, GLint drawbuffer, const GLint* value))
+_COREGL_SYMBOL(void, glClearBufferuiv, (GLenum buffer, GLint drawbuffer, const GLuint* value))
+_COREGL_SYMBOL(void, glClearBufferfv, (GLenum buffer, GLint drawbuffer, const GLfloat* value))
+_COREGL_SYMBOL(void, glClearBufferfi, (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil))
+_COREGL_SYMBOL(const GLubyte*, glGetStringi, (GLenum name, GLuint index))
+_COREGL_SYMBOL(void, glCopyBufferSubData, (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size))
+_COREGL_SYMBOL(void, glGetUniformIndices, (GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices))
+_COREGL_SYMBOL(void, glGetActiveUniformsiv, (GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params))
+_COREGL_SYMBOL(GLuint, glGetUniformBlockIndex, (GLuint program, const GLchar* uniformBlockName))
+_COREGL_SYMBOL(void, glGetActiveUniformBlockiv, (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params))
+_COREGL_SYMBOL(void, glGetActiveUniformBlockName, (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName))
+_COREGL_SYMBOL(void, glUniformBlockBinding, (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding))
+_COREGL_SYMBOL(void, glDrawArraysInstanced, (GLenum mode, GLint first, GLsizei count, GLsizei instanceCount))
+_COREGL_SYMBOL(void, glDrawElementsInstanced, (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount))
+_COREGL_SYMBOL(GLsync, glFenceSync, (GLenum condition, GLbitfield flags))
+_COREGL_SYMBOL(GLboolean, glIsSync, (GLsync sync))
+_COREGL_SYMBOL(void, glDeleteSync, (GLsync sync))
+_COREGL_SYMBOL(GLenum, glClientWaitSync, (GLsync sync, GLbitfield flags, GLuint64 timeout))
+_COREGL_SYMBOL(void, glWaitSync, (GLsync sync, GLbitfield flags, GLuint64 timeout))
+_COREGL_SYMBOL(void, glGetInteger64v, (GLenum pname, GLint64* params))
+_COREGL_SYMBOL(void, glGetSynciv, (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values))
+_COREGL_SYMBOL(void, glGetInteger64i_v, (GLenum target, GLuint index, GLint64* data))
+_COREGL_SYMBOL(void, glGetBufferParameteri64v, (GLenum target, GLenum pname, GLint64* params))
+_COREGL_SYMBOL(void, glGenSamplers, (GLsizei n, GLuint* samplers))
+_COREGL_SYMBOL(void, glDeleteSamplers, (GLsizei n, const GLuint* samplers))
+_COREGL_SYMBOL(GLboolean, glIsSampler, (GLuint sampler))
+_COREGL_SYMBOL(void, glBindSampler, (GLuint unit, GLuint sampler))
+_COREGL_SYMBOL(void, glSamplerParameteri, (GLuint sampler, GLenum pname, GLint param))
+_COREGL_SYMBOL(void, glSamplerParameteriv, (GLuint sampler, GLenum pname, const GLint* param))
+_COREGL_SYMBOL(void, glSamplerParameterf, (GLuint sampler, GLenum pname, GLfloat param))
+_COREGL_SYMBOL(void, glSamplerParameterfv, (GLuint sampler, GLenum pname, const GLfloat* param))
+_COREGL_SYMBOL(void, glGetSamplerParameteriv, (GLuint sampler, GLenum pname, GLint* params))
+_COREGL_SYMBOL(void, glGetSamplerParameterfv, (GLuint sampler, GLenum pname, GLfloat* params))
+_COREGL_SYMBOL(void, glVertexAttribDivisor, (GLuint index, GLuint divisor))
+_COREGL_SYMBOL(void, glBindTransformFeedback, (GLenum target, GLuint id))
+_COREGL_SYMBOL(void, glDeleteTransformFeedbacks, (GLsizei n, const GLuint* ids))
+_COREGL_SYMBOL(void, glGenTransformFeedbacks, (GLsizei n, GLuint* ids))
+_COREGL_SYMBOL(GLboolean, glIsTransformFeedback, (GLuint id))
+_COREGL_SYMBOL(void, glPauseTransformFeedback, (void))
+_COREGL_SYMBOL(void, glResumeTransformFeedback, (void))
+_COREGL_SYMBOL(void, glGetProgramBinary, (GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary))
+_COREGL_SYMBOL(void, glProgramBinary, (GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length))
+_COREGL_SYMBOL(void, glProgramParameteri, (GLuint program, GLenum pname, GLint value))
+_COREGL_SYMBOL(void, glInvalidateFramebuffer, (GLenum target, GLsizei numAttachments, const GLenum* attachments))
+_COREGL_SYMBOL(void, glInvalidateSubFramebuffer, (GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height))
+_COREGL_SYMBOL(void, glTexStorage2D, (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height))
+_COREGL_SYMBOL(void, glTexStorage3D, (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth))
+_COREGL_SYMBOL(void, glGetInternalformativ, (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params))
+_COREGL_END_API(COREGL_GLAPI_3)
+
+
+/* Extensions */
+
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_OES_EGL_image", 1.1, -1)
+_COREGL_EXT_SYMBOL(void, glEGLImageTargetTexture2DOES, (GLenum target, GLeglImageOES image))
+_COREGL_EXT_SYMBOL(void, glEGLImageTargetRenderbufferStorageOES, (GLenum target, GLeglImageOES image))
+//_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_OES_EGL_image_external", 1.1, -1)
+
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_OES_get_program_binary", 2.0, -1)
+_COREGL_EXT_SYMBOL(void, glGetProgramBinaryOES, (GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary))
+_COREGL_EXT_SYMBOL(void, glProgramBinaryOES, (GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length))
+
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_AMD_program_binary_Z400", 2.0, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_IMG_program_binary ", 2.0, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_ARM_mali_program_binary", 2.0, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_ANGLE_program_binary", 2.0, -1)
+
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_EXT_separate_shader_objects", 2.0, -1)
+_COREGL_EXT_SYMBOL(void, glUseProgramStagesEXT, (GLuint pipeline, GLbitfield stages, GLuint program))
+_COREGL_EXT_SYMBOL(void, glActiveShaderProgramEXT, (GLuint pipeline, GLuint program))
+_COREGL_EXT_SYMBOL(GLuint, glCreateShaderProgramvEXT, (GLenum type, GLsizei count, const char **strings))
+_COREGL_EXT_SYMBOL(void, glBindProgramPipelineEXT, (GLuint pipeline))
+_COREGL_EXT_SYMBOL(void, glDeleteProgramPipelinesEXT, (GLsizei n, const GLuint *pipelines))
+_COREGL_EXT_SYMBOL(void, glGenProgramPipelinesEXT, (GLsizei n, GLuint *pipelines))
+_COREGL_EXT_SYMBOL(GLboolean, glIsProgramPipelineEXT, (GLuint pipeline))
+_COREGL_EXT_SYMBOL(void, glProgramParameteriEXT, (GLuint program, GLenum pname, GLint value))
+_COREGL_EXT_SYMBOL(void, glGetProgramPipelineivEXT, (GLuint pipeline, GLenum pname, GLint *params))
+_COREGL_EXT_SYMBOL(void, glProgramUniform1iEXT, (GLuint program, GLint location, GLint x))
+_COREGL_EXT_SYMBOL(void, glProgramUniform2iEXT, (GLuint program, GLint location, GLint x, GLint y))
+_COREGL_EXT_SYMBOL(void, glProgramUniform3iEXT, (GLuint program, GLint location, GLint x, GLint y, GLint z))
+_COREGL_EXT_SYMBOL(void, glProgramUniform4iEXT, (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w))
+_COREGL_EXT_SYMBOL(void, glProgramUniform1fEXT, (GLuint program, GLint location, GLfloat x))
+_COREGL_EXT_SYMBOL(void, glProgramUniform2fEXT, (GLuint program, GLint location, GLfloat x, GLfloat y))
+_COREGL_EXT_SYMBOL(void, glProgramUniform3fEXT, (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z))
+_COREGL_EXT_SYMBOL(void, glProgramUniform4fEXT, (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w))
+_COREGL_EXT_SYMBOL(void, glProgramUniform1ivEXT, (GLuint program, GLint location, GLsizei count, const GLint *value))
+_COREGL_EXT_SYMBOL(void, glProgramUniform2ivEXT, (GLuint program, GLint location, GLsizei count, const GLint *value))
+_COREGL_EXT_SYMBOL(void, glProgramUniform3ivEXT, (GLuint program, GLint location, GLsizei count, const GLint *value))
+_COREGL_EXT_SYMBOL(void, glProgramUniform4ivEXT, (GLuint program, GLint location, GLsizei count, const GLint *value))
+_COREGL_EXT_SYMBOL(void, glProgramUniform1fvEXT, (GLuint program, GLint location, GLsizei count, const GLfloat *value))
+_COREGL_EXT_SYMBOL(void, glProgramUniform2fvEXT, (GLuint program, GLint location, GLsizei count, const GLfloat *value))
+_COREGL_EXT_SYMBOL(void, glProgramUniform3fvEXT, (GLuint program, GLint location, GLsizei count, const GLfloat *value))
+_COREGL_EXT_SYMBOL(void, glProgramUniform4fvEXT, (GLuint program, GLint location, GLsizei count, const GLfloat *value))
+_COREGL_EXT_SYMBOL(void, glProgramUniformMatrix2fvEXT, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
+_COREGL_EXT_SYMBOL(void, glProgramUniformMatrix3fvEXT, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
+_COREGL_EXT_SYMBOL(void, glProgramUniformMatrix4fvEXT, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value))
+_COREGL_EXT_SYMBOL(void, glValidateProgramPipelineEXT, (GLuint pipeline))
+_COREGL_EXT_SYMBOL(void, glGetProgramPipelineInfoLogEXT, (GLuint pipeline, GLsizei bufSize, GLsizei *length, char *infoLog))
+
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_EXT_multisampled_render_to_texture", 2.0, -1)
+_COREGL_EXT_SYMBOL(void, glRenderbufferStorageMultisampleEXT, (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height))
+_COREGL_EXT_SYMBOL(void, glFramebufferTexture2DMultisampleEXT, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples))
+
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_EXT_discard_framebuffer", 1.0, -1)
+_COREGL_EXT_SYMBOL(void, glDiscardFramebufferEXT, (GLenum target, GLsizei numAttachments, const GLenum* attachments))
+
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_OES_texture_3D", 2.0, -1)
+_COREGL_EXT_SYMBOL(void, glTexImage3DOES, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels))
+_COREGL_EXT_SYMBOL(void, glTexSubImage3DOES, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels))
+_COREGL_EXT_SYMBOL(void, glCopyTexSubImage3DOES, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height))
+_COREGL_EXT_SYMBOL(void, glCompressedTexImage3DOES, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data))
+_COREGL_EXT_SYMBOL(void, glCompressedTexSubImage3DOES, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data))
+_COREGL_EXT_SYMBOL(void, glFramebufferTexture3DOES, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset))
+
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_OES_mapbuffer", 1.1, -1)
+_COREGL_EXT_SYMBOL(void, glGetBufferPointervOES, (GLenum target, GLenum pname, GLvoid** params))
+_COREGL_EXT_SYMBOL(void *, glMapBufferOES, (GLenum target, GLenum access))
+_COREGL_EXT_SYMBOL(GLboolean, glUnmapBufferOES, (GLenum target))
+
+
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_ANGLE_framebuffer_blit", 1.1, -1)
+_COREGL_EXT_SYMBOL(void, glBlitFramebufferANGLE, (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter))
+
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_ANGLE_framebuffer_multisample", 1.1, -1)
+_COREGL_EXT_SYMBOL(void, glRenderbufferStorageMultisampleANGLE, (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height))
+
+
+
+/* Fastpath Verified extensions */
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_IMG_shader_binary", -1, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_ARM_mali_shader_binary", -1, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_VIV_shader_binary", -1, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_DMP_shader_binary", -1, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_FJ_shader_binary_GCCSO", -1, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_ARM_mali_shader_binary", -1, -1)
+
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_OES_compressed_ETC1_RGB8_texture", -1, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_OES_compressed_paletted_texture", -1, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_AMD_compressed_3DC_texture", -1, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_AMD_compressed_ATC_texture", -1, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_EXT_texture_compression_dxt1", -1, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_IMG_texture_compression_pvrtc", -1, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_NV_texture_compression_s3tc_update", -1, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_ANGLE_texture_compression_dxt3", -1, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_ANGLE_texture_compression_dxt5", -1, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_KHR_texture_compression_astc_ldr", -1, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_NV_texture_compression_s3tc", -1, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_NV_texture_compression_latc", -1, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_IMG_texture_compression_pvrtc2", -1, -1)
+
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_EXT_texture_type_2_10_10_10_REV", -1, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_EXT_texture_format_BGRA8888", -1, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_APPLE_texture_format_BGRA8888", 1.0, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_OES_texture_half_float_linear", 2.0, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_OES_texture_float_linear", 2.0, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_OES_texture_half_float", 2.0, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_OES_texture_float", 2.0, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_OES_texture_npot", 1.0, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_IMG_texture_env_enhanced_fixed_function", 1.0, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_APPLE_texture_max_level", 1.0, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_NV_texture_npot_2D_mipmap", 2.0, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_ANGLE_texture_usage", 2.0, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_EXT_texture_rg", 2.0, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_EXT_sRGB", 1.0, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_EXT_texture_sRGB_decode", 2.0, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_EXT_texture_filter_anisotropic", 1.2, -1)
+
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_OES_standard_derivatives", 2.0, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_OES_depth24", 1.0, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_ARM_rgba8", 1.1, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_OES_depth_texture", 2.0, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_OES_packed_depth_stencil", 1.0, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_EXT_texture_format_BGRA8888", 1.0, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_EXT_blend_minmax", -1, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_OES_EGL_sync", -1, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_OES_rgb8_rgba8", 1.0, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_EXT_shader_texture_lod", 2.0, -1)
+
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_OES_element_index_uint", 1.0, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_OES_fbo_render_mipmap", 1.0, -1)
+
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_OES_depth_texture_cube_map", 2.0, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_OES_vertex_half_float", 2.0, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_OES_vertex_type_10_10_10_2", 2.0, -1)
+
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_EXT_color_buffer_half_float", 2.0, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_EXT_color_buffer_float", 3.0, -1)
+
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_OES_element_index_uint", 1.0, -1)
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_OES_element_index_uint", 1.0, -1)
+
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_EXT_debug_marker", 1.1, -1)
+
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_AMD_performance_monitor", -1, -1)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(glGetPerfMonitorGroupsAMD)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(glGetPerfMonitorCountersAMD)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(glGetPerfMonitorGroupStringAMD)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(glGetPerfMonitorCounterStringAMD)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(glGetPerfMonitorCounterInfoAMD)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(glGenPerfMonitorsAMD)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(glDeletePerfMonitorsAMD)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(glSelectPerfMonitorCountersAMD)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(glBeginPerfMonitorAMD)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(glEndPerfMonitorAMD)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(glGetPerfMonitorCounterDataAMD)
+
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_NV_fence", -1, -1)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(glSetFenceNV)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(glTestFenceNV)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(glFinishFenceNV)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(glGenFencesNV)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(glDeleteFencesNV)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(glIsFenceNV)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(glGetFenceivNV)
+
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_QCOM_driver_control", 1.0, -1)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(glGetDriverControlsQCOM)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(glGetDriverControlStringQCOM)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(glEnableDriverControlQCOM)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(glDisableDriverControlQCOM)
+
+_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_QCOM_tiled_rendering", 1.0, -1)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(glStartTilingQCOM)
+_COREGL_EXT_SYMBOL_FASTPATH_PASS(glEndTilingQCOM)
+
+
+/* Fastpath Blocked extensions */
+
+//_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_EXT_robustness", 1.1, -1)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glGetGraphicsResetStatusEXT)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glReadnPixelsEXT)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glGetnUniformfvEXT)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glGetnUniformivEXT)
+
+//_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_EXT_debug_label", 1.1, -1)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glLabelObjectEXT)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glGetObjectLabelEXT)
+
+//_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_EXT_disjoint_timer_query", 2.0, -1)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glGenQueriesEXT)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glDeleteQueriesEXT)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glIsQueryEXT)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glBeginQueryEXT)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glEndQueryEXT)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glQueryCounterEXT)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glGetQueryivEXT)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glGetQueryObjectivEXT)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glGetQueryObjectuivEXT)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glGetQueryObjecti64vEXT)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glGetQueryObjectui64vEXT)
+
+//_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_OES_vertex_array_object", 1.1, -1)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glBindVertexArrayOES)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glDeleteVertexArraysOES)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glGenVertexArraysOES)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glIsVertexArrayOES)
+
+//_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_QCOM_alpha_test", 2.0, -1)
+
+//_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_QCOM_binning_control", 1.0, -1)
+
+//_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_QCOM_perfmon_global_mode", -1, -1)
+
+//_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_QCOM_writeonly_rendering", 1.0, -1)
+
+// QCOM_extended_get
+//_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_QCOM_extended_get", 1.0, -1)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glExtGetTexturesQCOM)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glExtGetBuffersQCOM)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glExtGetRenderbuffersQCOM)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glExtGetFramebuffersQCOM)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glExtGetTexLevelParameterivQCOM)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glExtTexObjectStateOverrideiQCOM)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glExtGetTexSubImageQCOM)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glExtGetBufferPointervQCOM)
+
+// QCOM_extended_get2
+//_COREGL_FASTPATH_SUPPORTED_EXTENSION("GL_QCOM_extended_get2", 1.0, -1)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glExtGetShadersQCOM)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glExtGetProgramsQCOM)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glExtIsProgramBinaryQCOM)
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glExtGetProgramBinarySourceQCOM)
+
+// ES3 Invalid usages
+_COREGL_EXT_SYMBOL_FASTPATH_BLOCK(glBlitFramebuffer)
+
+
+
+#ifdef _COREGL_EXT_SYMBOL_NOT_DEFINED
+#undef _COREGL_EXT_SYMBOL_NOT_DEFINED
+#undef _COREGL_EXT_SYMBOL
+#endif
+
+#ifdef _COREGL_SYMBOL_NOT_DEFINED
+#undef _COREGL_SYMBOL_NOT_DEFINED
+#undef _COREGL_SYMBOL
+#endif
+
+#ifdef _COREGL_EXT_SYMBOL_ALIAS_NOT_DEFINED
+#undef _COREGL_EXT_SYMBOL_ALIAS_NOT_DEFINED
+#undef _COREGL_EXT_SYMBOL_ALIAS
+#endif
+
+#ifdef _COREGL_FASTPATH_SUPPORTED_EXTENSION_NOT_DEFINED
+#undef _COREGL_FASTPATH_SUPPORTED_EXTENSION_NOT_DEFINED
+#undef _COREGL_FASTPATH_SUPPORTED_EXTENSION
+#endif
+
+#ifdef _COREGL_EXT_SYMBOL_FASTPATH_PASS_NOT_DEFINED
+#undef _COREGL_EXT_SYMBOL_FASTPATH_PASS_NOT_DEFINED
+#undef _COREGL_EXT_SYMBOL_FASTPATH_PASS
+#endif
+
+#ifdef _COREGL_EXT_SYMBOL_FASTPATH_BLOCK_NOT_DEFINED
+#undef _COREGL_EXT_SYMBOL_FASTPATH_BLOCK_NOT_DEFINED
+#undef _COREGL_EXT_SYMBOL_FASTPATH_BLOCK
+#endif
+
+#ifdef _COREGL_START_API
+#undef _COREGL_START_API
+#endif
+
+#ifdef _COREGL_END_API
+#undef _COREGL_END_API
+#endif
diff --git a/src/headers/sym_glx.h b/src/headers/sym_glx.h
new file mode 100644 (file)
index 0000000..a12015d
--- /dev/null
@@ -0,0 +1,52 @@
+// Defult use-case for exporting symbols
+#ifndef _COREGL_SYMBOL
+#define _COREGL_SYMBOL_NOT_DEFINED
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     extern RET_TYPE (*_COREGL_NAME_MANGLE(FUNC_NAME)) PARAM_LIST;
+#endif
+#ifndef _COREGL_EXT_SYMBOL
+#define _COREGL_EXT_SYMBOL_NOT_DEFINED
+#define _COREGL_EXT_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)  _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)
+#endif
+
+_COREGL_SYMBOL(_eng_fn, glXGetProcAddress, (const char* procName))
+
+// Standard GL(glX) functions
+_COREGL_SYMBOL(XVisualInfo*, glXChooseVisual, (Display* dpy, int screen, int* attribList))
+_COREGL_SYMBOL(GLXContext, glXCreateContext, (Display* dpy, XVisualInfo* vis, GLXContext shareList, Bool direct))
+_COREGL_SYMBOL(void, glXDestroyContext, (Display* dpy, GLXContext ctx))
+_COREGL_SYMBOL(GLXContext, glXGetCurrentContext, (void))
+_COREGL_SYMBOL(GLXDrawable, glXGetCurrentDrawable, (void))
+_COREGL_SYMBOL(Bool, glXMakeCurrent, (Display* dpy, GLXDrawable draw, GLXContext ctx))
+_COREGL_SYMBOL(void, glXSwapBuffers, (Display* dpy, GLXDrawable draw))
+_COREGL_SYMBOL(void, glXWaitX, (void))
+_COREGL_SYMBOL(void, glXWaitGL, (void))
+_COREGL_SYMBOL(Bool, glXQueryExtension, (Display* dpy, int* errorb, int* event))
+_COREGL_SYMBOL(const char*, glXQueryExtensionsString, (Display *dpy, int screen))
+
+_COREGL_SYMBOL(GLXFBConfig*, glXChooseFBConfig, (Display* dpy, int screen, const int* attribList, int* nitems))
+_COREGL_SYMBOL(GLXFBConfig*, glXGetFBConfigs, (Display* dpy, int screen, int* nelements))
+_COREGL_SYMBOL(int, glXGetFBConfigAttrib, (Display* dpy, GLXFBConfig config, int attribute, int* value))
+_COREGL_SYMBOL(XVisualInfo*, glXGetVisualFromFBConfig, (Display* dpy, GLXFBConfig config))
+_COREGL_SYMBOL(void, glXDestroyWindow, (Display* dpy, GLXWindow window))
+_COREGL_SYMBOL(Bool, glXMakeContextCurrent, (Display* dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx))
+
+_COREGL_SYMBOL(void, glXBindTexImage, (Display* dpy, GLXDrawable draw, int buffer, int* attribList))
+_COREGL_SYMBOL(void, glXReleaseTexImage, (Display* dpy, GLXDrawable draw, int buffer))
+_COREGL_SYMBOL(int, glXGetVideoSync, (unsigned int* count))
+_COREGL_SYMBOL(int, glXWaitVideoSync, (int divisor, int remainder, unsigned int* count))
+_COREGL_SYMBOL(XID, glXCreatePixmap, (Display* dpy, void* config, Pixmap pixmap, const int* attribList))
+_COREGL_SYMBOL(void, glXDestroyPixmap, (Display* dpy, XID pixmap))
+_COREGL_SYMBOL(void, glXQueryDrawable, (Display* dpy, XID draw, int attribute, unsigned int* value))
+_COREGL_SYMBOL(int, glXSwapIntervalSGI, (int interval))
+_COREGL_SYMBOL(void, glXSwapIntervalEXT, (Display* dpy, GLXDrawable draw, int interval))
+
+#ifdef _COREGL_EXT_SYMBOL_NOT_DEFINED
+#undef _COREGL_EXT_SYMBOL_NOT_DEFINED
+#undef _COREGL_EXT_SYMBOL
+#endif
+
+#ifdef _COREGL_SYMBOL_NOT_DEFINED
+#undef _COREGL_SYMBOL_NOT_DEFINED
+#undef _COREGL_SYMBOL
+#endif
+
diff --git a/src/modules/appopt/coregl_appopt.c b/src/modules/appopt/coregl_appopt.c
new file mode 100644 (file)
index 0000000..ae582f3
--- /dev/null
@@ -0,0 +1,75 @@
+#include "coregl_appopt.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     RET_TYPE (*_orig_appopt_##FUNC_NAME) PARAM_LIST = NULL;
+#define _COREGL_EXT_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST) _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)
+# include "../../headers/sym.h"
+#undef _COREGL_EXT_SYMBOL
+#undef _COREGL_SYMBOL
+
+void
+init_modules_appopt()
+{
+//     COREGL_LOG("[CoreGL] <Appopt> : ");
+
+//     COREGL_LOG("Not yet implemented\n");
+}
+
+void
+deinit_modules_appopt()
+{
+}
+
+void
+init_modules_tstate_appopt(GLThreadState *tstate)
+{
+       MY_MODULE_TSTATE *tstate_mt = NULL;
+
+       tstate_mt = (MY_MODULE_TSTATE *)calloc(1, sizeof(MY_MODULE_TSTATE));
+
+
+       tstate->module_data[MY_MODULE_ID] = tstate_mt;
+}
+
+void
+deinit_modules_tstate_appopt(GLThreadState *tstate)
+{
+       if (tstate->module_data[MY_MODULE_ID] != NULL)
+       {
+               free(tstate->module_data[MY_MODULE_ID]);
+               tstate->module_data[MY_MODULE_ID] = NULL;
+       }
+}
+
+void
+appopt_apply_overrides()
+{
+       //appopt_apply_overrides_egl(1);
+       //appopt_apply_overrides_gl(1);
+}
+
+void
+appopt_apply_overrides_egl(int enable)
+{
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     COREGL_INIT_ORIGINAL(_orig_appopt_, FUNC_NAME);
+#define _COREGL_EXT_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST) _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)
+# include "../../headers/sym_egl.h"
+#undef _COREGL_EXT_SYMBOL
+#undef _COREGL_SYMBOL
+}
+
+void
+appopt_apply_overrides_gl(int enable)
+{
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     COREGL_INIT_ORIGINAL(_orig_appopt_, FUNC_NAME);
+#define _COREGL_EXT_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST) _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)
+# include "../../headers/sym_gl.h"
+#undef _COREGL_EXT_SYMBOL
+#undef _COREGL_SYMBOL
+}
+
+#undef A_ORD
+
diff --git a/src/modules/appopt/coregl_appopt.h b/src/modules/appopt/coregl_appopt.h
new file mode 100644 (file)
index 0000000..b9f3368
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef COREGL_APPOPT_H
+#define COREGL_APPOPT_H
+
+#include "../coregl_module.h"
+
+#ifndef COREGL_USE_MODULE_APPOPT
+#error "COREGL_USE_MODULE_APPOPT must defined!!!"
+#endif
+
+#define MY_MODULE_ID              COREGL_MODULE_APPOPT
+#define MY_MODULE_TSTATE         Appopt_ThreadState
+
+#include "../../coregl_internal.h"
+#include "../../coregl_export.h"
+
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     extern RET_TYPE (*_orig_appopt_##FUNC_NAME) PARAM_LIST;
+# include "../../headers/sym.h"
+#undef _COREGL_SYMBOL
+
+// Symbol definition for appopt
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     extern RET_TYPE (appopt_##FUNC_NAME) PARAM_LIST;
+# include "../../headers/sym.h"
+#undef _COREGL_SYMBOL
+
+typedef struct _Appopt_ThreadState
+{
+       void                            *_notusedyet;
+} Appopt_ThreadState;
+
+
+#define _COREGL_APPOPT_FUNC_BEGIN()
+
+#define _COREGL_APPOPT_FUNC_END()
+
+
+extern void     init_modules_appopt();
+extern void     deinit_modules_appopt();
+extern void     init_modules_tstate_appopt(GLThreadState *tstate);
+extern void     deinit_modules_tstate_appopt(GLThreadState *tstate);
+
+extern void     appopt_apply_overrides();
+extern void     appopt_apply_overrides_egl(int enable);
+extern void     appopt_apply_overrides_gl(int enable);
+
+
+#endif // COREGL_APPOPT_H
+
diff --git a/src/modules/appopt/coregl_appopt_egl.c b/src/modules/appopt/coregl_appopt_egl.c
new file mode 100644 (file)
index 0000000..4d42637
--- /dev/null
@@ -0,0 +1,3 @@
+#include "coregl_appopt.h"
+
+
diff --git a/src/modules/appopt/coregl_appopt_gl.c b/src/modules/appopt/coregl_appopt_gl.c
new file mode 100644 (file)
index 0000000..4d42637
--- /dev/null
@@ -0,0 +1,3 @@
+#include "coregl_appopt.h"
+
+
diff --git a/src/modules/coregl_module.c b/src/modules/coregl_module.c
new file mode 100644 (file)
index 0000000..87bb58d
--- /dev/null
@@ -0,0 +1,67 @@
+#include "../coregl_internal.h"
+
+// TRACEPATH module
+#include "tracepath/coregl_tracepath.h"
+#undef MY_MODULE_ID
+#undef MY_MODULE_TSTATE
+
+// FASTPATH module
+#include "fastpath/coregl_fastpath.h"
+#undef MY_MODULE_ID
+#undef MY_MODULE_TSTATE
+
+// APIOPT module
+#include "appopt/coregl_appopt.h"
+#undef MY_MODULE_ID
+#undef MY_MODULE_TSTATE
+
+void
+init_modules()
+{
+       init_modules_fastpath();
+       init_modules_appopt();
+       init_modules_tracepath();
+
+       reset_modules_override();
+}
+
+void
+deinit_modules()
+{
+       deinit_modules_tracepath();
+       deinit_modules_appopt();
+       deinit_modules_fastpath();
+}
+
+void
+reset_modules_override()
+{
+       // Step 1 : Initialization
+       init_export();
+
+       // Step 2 : User Define Modules : Sequence is important! (Last module's API is called first)
+       fastpath_apply_overrides();
+       appopt_apply_overrides();
+
+       // Step 3 : Common Wrapping Modules
+       tracepath_apply_overrides();
+}
+
+void
+init_modules_tstate(GLThreadState *tstate)
+{
+       // Initialization for each thread state : Sequence is important!
+       init_modules_tstate_tracepath(tstate);
+       init_modules_tstate_fastpath(tstate);
+       init_modules_tstate_appopt(tstate);
+}
+
+void
+deinit_modules_tstate(GLThreadState *tstate)
+{
+       // De-Initialization for each thread state(rollback) : Sequence is important!
+       deinit_modules_tstate_appopt(tstate);
+       deinit_modules_tstate_fastpath(tstate);
+       deinit_modules_tstate_tracepath(tstate);
+}
+
diff --git a/src/modules/coregl_module.h b/src/modules/coregl_module.h
new file mode 100644 (file)
index 0000000..b72749f
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef COREGL_MODULE_H
+#define COREGL_MODULE_H
+
+#define COREGL_USE_MODULE_TRACEPATH
+#define COREGL_USE_MODULE_FASTPATH
+#define COREGL_USE_MODULE_APPOPT
+
+
+typedef enum
+{
+       COREGL_MODULE_TRACEPATH = 0,
+       COREGL_MODULE_FASTPATH = 1,
+       COREGL_MODULE_APPOPT = 2
+} CoreGL_Modules;
+
+#define COREGL_MAX_MODULES             5
+
+#define GET_MY_TSTATE(val, stmt) \
+       if (stmt != NULL) \
+               val = ((MY_MODULE_TSTATE *)(stmt)->module_data[MY_MODULE_ID]);
+
+#define COREGL_INIT_ORIGINAL(orig_prefix, f) \
+{ \
+       if (enable == 1) \
+       { \
+               AST(orig_prefix##f == NULL); \
+               if (ovr_##f != NULL) COREGL_OVERRIDE_API(orig_prefix, f, ovr_); \
+       } \
+       else \
+       { \
+               AST(ovr_##f != NULL); \
+               COREGL_OVERRIDE_API(ovr_, f, orig_prefix); \
+               orig_prefix##f = NULL; \
+       } \
+}
+
+#define COREGL_OVERRIDE(prefix, f) \
+       if (enable == 1) \
+       { \
+               COREGL_OVERRIDE_API(ovr_, f, prefix); \
+       }
+
+#endif // COREGL_MODULE_H
+
diff --git a/src/modules/fastpath/coregl_fastpath.c b/src/modules/fastpath/coregl_fastpath.c
new file mode 100644 (file)
index 0000000..76602bf
--- /dev/null
@@ -0,0 +1,2198 @@
+#include "coregl_fastpath.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+
+#include <sys/types.h>
+#include <unistd.h>
+
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     RET_TYPE (*_orig_fastpath_##FUNC_NAME) PARAM_LIST = NULL;
+#include "../../headers/sym.h"
+#undef _COREGL_SYMBOL
+
+Fastpath_Opt_Flag   fp_opt = FP_UNKNOWN_PATH;
+
+int                 debug_nofp = 0;
+FILE               *trace_fp = NULL;
+
+GLenum              FPGL_Error = GL_NO_ERROR;
+
+GLGlueContext_List *gctx_list = NULL;
+
+Mutex               init_context_mutex = MUTEX_INITIALIZER;
+GLGlueContext      *initial_ctx = NULL;
+
+Mutex               ctx_list_access_mutex = MUTEX_INITIALIZER;
+
+GLContext_List     *glctx_list = NULL;
+static int          api_gl_version=COREGL_GLAPI_2;
+
+static void
+_state_get_texture_states(GLenum pname, GLint *params)
+{
+       GLuint cur_active_tex = 0;
+
+       AST(initial_ctx != NULL);
+
+       _orig_fastpath_glGetIntegerv(GL_ACTIVE_TEXTURE, (GLint *)&cur_active_tex);
+       int i;
+       for (i = 0; i < initial_ctx->gl_num_tex_units[0]; i++)
+       {
+               _orig_fastpath_glActiveTexture(GL_TEXTURE0 + i);
+               _orig_fastpath_glGetIntegerv(pname, (GLint *)&params[i]);
+       }
+       _orig_fastpath_glActiveTexture(cur_active_tex);
+}
+
+static void
+_state_get_draw_buffers(GLenum *params)
+{
+       AST(initial_ctx != NULL);
+
+       int i;
+       for (i = 0; i < initial_ctx->gl_num_draw_buffers[0]; i++)
+       {
+               _orig_fastpath_glGetIntegerv(GL_DRAW_BUFFER0 + i, (GLint *)&params[i]);
+       }
+}
+
+static void
+_state_get_transform_feedback_buffer_bindings(GLuint *params)
+{
+       AST(initial_ctx != NULL);
+
+       int i;
+       for (i = 0; i < initial_ctx->gl_num_transform_feedback_separate_attribs[0]; i++)
+       {
+               _orig_fastpath_glGetIntegeri_v(GL_TRANSFORM_FEEDBACK_BUFFER_BINDING, i, (GLint *)&params[i]);
+       }
+}
+
+static void
+_state_get_transform_feedback_buffer_bindings_offset(GLintptr *params)
+{
+       AST(initial_ctx != NULL);
+
+       int i;
+       for (i = 0; i < initial_ctx->gl_num_transform_feedback_separate_attribs[0]; i++)
+       {
+               _orig_fastpath_glGetIntegeri_v(GL_TRANSFORM_FEEDBACK_BUFFER_START, i, (GLint *)&params[i]);
+       }
+}
+
+static void
+_state_get_transform_feedback_buffer_bindings_size(GLsizeiptr *params)
+{
+       AST(initial_ctx != NULL);
+
+       int i;
+       for (i = 0; i < initial_ctx->gl_num_transform_feedback_separate_attribs[0]; i++)
+       {
+               _orig_fastpath_glGetIntegeri_v(GL_TRANSFORM_FEEDBACK_BUFFER_SIZE, i, (GLint *)&params[i]);
+       }
+}
+
+static void
+_state_get_uniform_buffer_bindings(GLuint *params)
+{
+       AST(initial_ctx != NULL);
+
+       int i;
+       for (i = 0; i < initial_ctx->gl_num_uniform_buffer_bindings[0]; i++)
+       {
+/////////////////////////////////////////////////////////////////////////////////
+// XXXX : AVOID SEGFAULT in ADRENO
+               ((GLint *)params)[i] = 0;
+//             _orig_fastpath_glGetIntegeri_v(GL_UNIFORM_BUFFER_BINDING, i, (GLint *)&params[i]);
+/////////////////////////////////////////////////////////////////////////////////
+       }
+}
+
+static void
+_state_get_uniform_buffer_bindings_offset(GLintptr *params)
+{
+       AST(initial_ctx != NULL);
+
+       int i;
+       for (i = 0; i < initial_ctx->gl_num_uniform_buffer_bindings[0]; i++)
+       {
+               _orig_fastpath_glGetIntegeri_v(GL_UNIFORM_BUFFER_START, i, (GLint *)&params[i]);
+       }
+}
+
+static void
+_state_get_uniform_buffer_bindings_size(GLsizeiptr *params)
+{
+       AST(initial_ctx != NULL);
+
+       int i;
+       for (i = 0; i < initial_ctx->gl_num_uniform_buffer_bindings[0]; i++)
+       {
+               _orig_fastpath_glGetIntegeri_v(GL_UNIFORM_BUFFER_SIZE, i, (GLint *)&params[i]);
+       }
+}
+
+void
+fastpath_state_get_draw_buffers(GLenum *params)
+{
+       _state_get_draw_buffers(params);
+}
+
+void
+init_modules_fastpath()
+{
+       int fastpath_opt = 0;
+       int fastpath_force_off_opt = 0;
+
+       COREGL_LOG("[CoreGL] <Fastpath> : ");
+
+       fastpath_opt = atoi(get_env_setting("COREGL_FASTPATH"));
+       fastpath_force_off_opt = atoi(get_env_setting("COREGL_FASTPATH_FORCE_OFF"));
+
+       if (fastpath_force_off_opt == 1)
+       {
+               COREGL_LOG("\E[40;31;1m(DISABLED by force option)\E[0m ");
+               fastpath_opt = 0;
+       }
+
+       switch (fastpath_opt)
+       {
+               case 1:
+                       COREGL_LOG("(%d) Fastpath enabled...\n", fastpath_opt);
+                       fp_opt = FP_FAST_PATH;
+                       break;
+               default:
+                       COREGL_LOG("(%d) Default API path enabled...\n", fastpath_opt);
+                       fp_opt = FP_NORMAL_PATH;
+                       break;
+       }
+
+       debug_nofp = atoi(get_env_setting("COREGL_DEBUG_NOFP"));
+
+}
+
+void
+deinit_modules_fastpath()
+{
+       GLContext_List *current = NULL;
+
+       AST(mutex_lock(&ctx_list_access_mutex) == 1);
+
+       // Destroy remained context & Detect leaks
+       int retry_destroy = 0;
+
+       while (1)
+       {
+               retry_destroy = 0;
+               current = glctx_list;
+               while (current)
+               {
+                       if (current->cstate != NULL)
+                       {
+                               COREGL_WRN("\E[40;31;1mContext attached to [dpy=%p|rctx=%p] has not been completely destroyed.(leak)\E[0m\n", current->cstate->rdpy, current->cstate->rctx);
+
+                               _orig_fastpath_eglMakeCurrent(current->cstate->rdpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+                               _orig_fastpath_eglDestroyContext(current->cstate->rdpy, current->cstate->rctx);
+
+                               fastpath_remove_context_states_from_list(current->cstate, NULL);
+                               retry_destroy = 1;
+                               break;
+                       }
+
+                       glctx_list = current->next;
+                       free(current);
+                       current = glctx_list;
+               }
+               if (retry_destroy == 0) break;
+       }
+       goto finish;
+
+finish:
+       AST(mutex_unlock(&ctx_list_access_mutex) == 1);
+}
+
+void
+init_modules_tstate_fastpath(GLThreadState *tstate)
+{
+       MY_MODULE_TSTATE *tstate_mt = NULL;
+
+       tstate_mt = (MY_MODULE_TSTATE *)calloc(1, sizeof(MY_MODULE_TSTATE));
+
+        /* Prevent CID : 403055 */
+        if (tstate_mt != NULL)
+        {
+               tstate_mt->binded_api = EGL_OPENGL_ES_API;
+
+               tstate->module_data[MY_MODULE_ID] = tstate_mt;
+        }
+}
+
+void
+deinit_modules_tstate_fastpath(GLThreadState *tstate)
+{
+       if (tstate->module_data[MY_MODULE_ID] != NULL)
+       {
+               free(tstate->module_data[MY_MODULE_ID]);
+               tstate->module_data[MY_MODULE_ID] = NULL;
+       }
+}
+
+void
+fastpath_apply_overrides()
+{
+       switch(fp_opt)
+       {
+               case FP_FAST_PATH:
+                       fastpath_apply_overrides_egl(1);
+                       fastpath_apply_overrides_gl(1);
+                       break;
+               case FP_NORMAL_PATH:
+                       break;
+               default:
+                       COREGL_ERR("Invalide GL Override Option!!!\n");
+                       break;
+       }
+}
+
+
+void
+fastpath_apply_overrides_egl(int enable)
+{
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     COREGL_INIT_ORIGINAL(_orig_fastpath_, FUNC_NAME);
+# include "../../headers/sym_egl.h"
+#undef _COREGL_SYMBOL
+
+       COREGL_OVERRIDE(fastpath_, eglGetProcAddress);
+
+       COREGL_OVERRIDE(fastpath_, eglBindAPI);
+       COREGL_OVERRIDE(fastpath_, eglQueryAPI);
+
+       COREGL_OVERRIDE(fastpath_, eglCreateContext);
+       COREGL_OVERRIDE(fastpath_, eglCreateImageKHR);
+       COREGL_OVERRIDE(fastpath_, eglMakeCurrent);
+       COREGL_OVERRIDE(fastpath_, eglDestroyContext);
+       COREGL_OVERRIDE(fastpath_, eglQueryContext);
+       COREGL_OVERRIDE(fastpath_, eglGetCurrentContext);
+       COREGL_OVERRIDE(fastpath_, eglReleaseThread);
+       COREGL_OVERRIDE(fastpath_, eglGetCurrentSurface);
+       COREGL_OVERRIDE(fastpath_, eglTerminate);
+       COREGL_OVERRIDE(fastpath_, eglGetCurrentDisplay);
+
+}
+
+void
+fastpath_apply_overrides_gl(int enable)
+{
+#define _COREGL_START_API(version) api_gl_version = version;
+#define _COREGL_END_API(version) api_gl_version = COREGL_GLAPI_2;
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     \
+   if(api_gl_version <= driver_gl_version) COREGL_INIT_ORIGINAL(_orig_fastpath_, FUNC_NAME);
+
+# include "../../headers/sym_gl.h"
+#undef _COREGL_SYMBOL
+#undef _COREGL_START_API
+#undef _COREGL_END_API
+
+       if (debug_nofp != 1)
+       {
+               COREGL_OVERRIDE(fastpath_, glGetError);
+               COREGL_OVERRIDE(fastpath_, glGetString);
+
+               COREGL_OVERRIDE(fastpath_, glGetIntegerv);
+               COREGL_OVERRIDE(fastpath_, glGetFloatv);
+               COREGL_OVERRIDE(fastpath_, glGetBooleanv);
+
+               COREGL_OVERRIDE(fastpath_, glActiveTexture);
+               COREGL_OVERRIDE(fastpath_, glGenTextures);
+               COREGL_OVERRIDE(fastpath_, glBindTexture);
+               COREGL_OVERRIDE(fastpath_, glIsTexture);
+               COREGL_OVERRIDE(fastpath_, glDeleteTextures);
+               COREGL_OVERRIDE(fastpath_, glFramebufferTexture2D);
+
+               COREGL_OVERRIDE(fastpath_, glGenBuffers);
+               COREGL_OVERRIDE(fastpath_, glBindBuffer);
+               COREGL_OVERRIDE(fastpath_, glIsBuffer);
+               COREGL_OVERRIDE(fastpath_, glDeleteBuffers);
+
+               COREGL_OVERRIDE(fastpath_, glGenFramebuffers);
+               COREGL_OVERRIDE(fastpath_, glBindFramebuffer);
+               COREGL_OVERRIDE(fastpath_, glIsFramebuffer);
+               COREGL_OVERRIDE(fastpath_, glDeleteFramebuffers);
+               COREGL_OVERRIDE(fastpath_, glGetFramebufferAttachmentParameteriv);
+
+               COREGL_OVERRIDE(fastpath_, glGenRenderbuffers);
+               COREGL_OVERRIDE(fastpath_, glBindRenderbuffer);
+               COREGL_OVERRIDE(fastpath_, glFramebufferRenderbuffer);
+               COREGL_OVERRIDE(fastpath_, glIsRenderbuffer);
+               COREGL_OVERRIDE(fastpath_, glDeleteRenderbuffers);
+
+               COREGL_OVERRIDE(fastpath_, glCreateShader);
+               COREGL_OVERRIDE(fastpath_, glCreateProgram);
+               COREGL_OVERRIDE(fastpath_, glAttachShader);
+               COREGL_OVERRIDE(fastpath_, glCompileShader);
+               COREGL_OVERRIDE(fastpath_, glShaderBinary);
+               COREGL_OVERRIDE(fastpath_, glDeleteShader);
+               COREGL_OVERRIDE(fastpath_, glDetachShader);
+               COREGL_OVERRIDE(fastpath_, glGetShaderiv);
+               COREGL_OVERRIDE(fastpath_, glGetShaderInfoLog);
+               COREGL_OVERRIDE(fastpath_, glGetShaderSource);
+               COREGL_OVERRIDE(fastpath_, glIsShader);
+               COREGL_OVERRIDE(fastpath_, glShaderSource);
+               COREGL_OVERRIDE(fastpath_, glBindAttribLocation);
+               COREGL_OVERRIDE(fastpath_, glDeleteProgram);
+               COREGL_OVERRIDE(fastpath_, glGetActiveAttrib);
+               COREGL_OVERRIDE(fastpath_, glGetActiveUniform);
+               COREGL_OVERRIDE(fastpath_, glGetAttachedShaders);
+               COREGL_OVERRIDE(fastpath_, glGetAttribLocation);
+               COREGL_OVERRIDE(fastpath_, glGetProgramiv);
+               COREGL_OVERRIDE(fastpath_, glGetProgramInfoLog);
+               COREGL_OVERRIDE(fastpath_, glGetUniformfv);
+               COREGL_OVERRIDE(fastpath_, glGetUniformiv);
+               COREGL_OVERRIDE(fastpath_, glGetUniformLocation);
+               COREGL_OVERRIDE(fastpath_, glIsProgram);
+               COREGL_OVERRIDE(fastpath_, glLinkProgram);
+               COREGL_OVERRIDE(fastpath_, glUseProgram);
+               COREGL_OVERRIDE(fastpath_, glValidateProgram);
+
+               COREGL_OVERRIDE(fastpath_, glBlendColor);
+               COREGL_OVERRIDE(fastpath_, glBlendEquation);
+               COREGL_OVERRIDE(fastpath_, glBlendEquationSeparate);
+               COREGL_OVERRIDE(fastpath_, glBlendFunc);
+               COREGL_OVERRIDE(fastpath_, glBlendFuncSeparate);
+               COREGL_OVERRIDE(fastpath_, glClearColor);
+               COREGL_OVERRIDE(fastpath_, glClearDepthf);
+               COREGL_OVERRIDE(fastpath_, glClearStencil);
+               COREGL_OVERRIDE(fastpath_, glColorMask);
+               COREGL_OVERRIDE(fastpath_, glCullFace);
+               COREGL_OVERRIDE(fastpath_, glDepthFunc);
+               COREGL_OVERRIDE(fastpath_, glDepthMask);
+               COREGL_OVERRIDE(fastpath_, glDepthRangef);
+               COREGL_OVERRIDE(fastpath_, glDisable);
+               COREGL_OVERRIDE(fastpath_, glDisableVertexAttribArray);
+               COREGL_OVERRIDE(fastpath_, glEnable);
+               COREGL_OVERRIDE(fastpath_, glEnableVertexAttribArray);
+               COREGL_OVERRIDE(fastpath_, glFrontFace);
+               COREGL_OVERRIDE(fastpath_, glHint);
+               COREGL_OVERRIDE(fastpath_, glLineWidth);
+               COREGL_OVERRIDE(fastpath_, glPixelStorei);
+               COREGL_OVERRIDE(fastpath_, glPolygonOffset);
+               COREGL_OVERRIDE(fastpath_, glSampleCoverage);
+               COREGL_OVERRIDE(fastpath_, glScissor);
+               COREGL_OVERRIDE(fastpath_, glStencilFunc);
+               COREGL_OVERRIDE(fastpath_, glStencilFuncSeparate);
+               COREGL_OVERRIDE(fastpath_, glStencilMask);
+               COREGL_OVERRIDE(fastpath_, glStencilMaskSeparate);
+               COREGL_OVERRIDE(fastpath_, glStencilOp);
+               COREGL_OVERRIDE(fastpath_, glStencilOpSeparate);
+               COREGL_OVERRIDE(fastpath_, glVertexAttrib1f);
+               COREGL_OVERRIDE(fastpath_, glVertexAttrib1fv);
+               COREGL_OVERRIDE(fastpath_, glVertexAttrib2f);
+               COREGL_OVERRIDE(fastpath_, glVertexAttrib2fv);
+               COREGL_OVERRIDE(fastpath_, glVertexAttrib3f);
+               COREGL_OVERRIDE(fastpath_, glVertexAttrib3fv);
+               COREGL_OVERRIDE(fastpath_, glVertexAttrib4f);
+               COREGL_OVERRIDE(fastpath_, glVertexAttrib4fv);
+               COREGL_OVERRIDE(fastpath_, glVertexAttribPointer);
+               COREGL_OVERRIDE(fastpath_, glViewport);
+
+               COREGL_OVERRIDE(fastpath_, glGetProgramBinaryOES);
+               COREGL_OVERRIDE(fastpath_, glProgramBinaryOES);
+
+               COREGL_OVERRIDE(fastpath_, glUseProgramStagesEXT);
+               COREGL_OVERRIDE(fastpath_, glActiveShaderProgramEXT);
+               COREGL_OVERRIDE(fastpath_, glProgramParameteriEXT);
+               COREGL_OVERRIDE(fastpath_, glProgramUniform1iEXT);
+               COREGL_OVERRIDE(fastpath_, glProgramUniform2iEXT);
+               COREGL_OVERRIDE(fastpath_, glProgramUniform3iEXT);
+               COREGL_OVERRIDE(fastpath_, glProgramUniform4iEXT);
+               COREGL_OVERRIDE(fastpath_, glProgramUniform1fEXT);
+               COREGL_OVERRIDE(fastpath_, glProgramUniform2fEXT);
+               COREGL_OVERRIDE(fastpath_, glProgramUniform3fEXT);
+               COREGL_OVERRIDE(fastpath_, glProgramUniform4fEXT);
+               COREGL_OVERRIDE(fastpath_, glProgramUniform1ivEXT);
+               COREGL_OVERRIDE(fastpath_, glProgramUniform2ivEXT);
+               COREGL_OVERRIDE(fastpath_, glProgramUniform3ivEXT);
+               COREGL_OVERRIDE(fastpath_, glProgramUniform4ivEXT);
+               COREGL_OVERRIDE(fastpath_, glProgramUniform1fvEXT);
+               COREGL_OVERRIDE(fastpath_, glProgramUniform2fvEXT);
+               COREGL_OVERRIDE(fastpath_, glProgramUniform3fvEXT);
+               COREGL_OVERRIDE(fastpath_, glProgramUniform4fvEXT);
+               COREGL_OVERRIDE(fastpath_, glProgramUniformMatrix2fvEXT);
+               COREGL_OVERRIDE(fastpath_, glProgramUniformMatrix3fvEXT);
+               COREGL_OVERRIDE(fastpath_, glProgramUniformMatrix4fvEXT);
+               COREGL_OVERRIDE(fastpath_, glProgramParameteriEXT);
+               COREGL_OVERRIDE(fastpath_, glProgramParameteriEXT);
+               COREGL_OVERRIDE(fastpath_, glProgramParameteriEXT);
+               COREGL_OVERRIDE(fastpath_, glProgramParameteriEXT);
+               COREGL_OVERRIDE(fastpath_, glProgramParameteriEXT);
+
+               COREGL_OVERRIDE(fastpath_, glFramebufferTexture2DMultisampleEXT);
+               COREGL_OVERRIDE(fastpath_, glFramebufferTexture3DOES);
+
+               /* Start overriding GLES 3.0 */
+               if(driver_gl_version >= COREGL_GLAPI_3) {
+                       COREGL_OVERRIDE(fastpath_, glReadBuffer);
+
+                       COREGL_OVERRIDE(fastpath_, glGenQueries);
+                       COREGL_OVERRIDE(fastpath_, glDeleteQueries);
+                       COREGL_OVERRIDE(fastpath_, glIsQuery);
+                       COREGL_OVERRIDE(fastpath_, glBeginQuery);
+                       COREGL_OVERRIDE(fastpath_, glGetQueryiv);
+                       COREGL_OVERRIDE(fastpath_, glGetQueryObjectuiv);
+                       COREGL_OVERRIDE(fastpath_, glDrawBuffers);
+                       COREGL_OVERRIDE(fastpath_, glFramebufferTextureLayer);
+
+                       COREGL_OVERRIDE(fastpath_, glBindVertexArray);
+                       COREGL_OVERRIDE(fastpath_, glDeleteVertexArrays);
+                       COREGL_OVERRIDE(fastpath_, glGenVertexArrays);
+                       COREGL_OVERRIDE(fastpath_, glIsVertexArray);
+
+                       COREGL_OVERRIDE(fastpath_, glGetIntegeri_v);
+
+                       COREGL_OVERRIDE(fastpath_, glBindTransformFeedback);
+                       COREGL_OVERRIDE(fastpath_, glDeleteTransformFeedbacks);
+                       COREGL_OVERRIDE(fastpath_, glGenTransformFeedbacks);
+                       COREGL_OVERRIDE(fastpath_, glIsTransformFeedback);
+
+                       COREGL_OVERRIDE(fastpath_, glBindBufferRange);
+                       COREGL_OVERRIDE(fastpath_, glBindBufferBase);
+                       COREGL_OVERRIDE(fastpath_, glTransformFeedbackVaryings);
+                       COREGL_OVERRIDE(fastpath_, glGetTransformFeedbackVarying);
+                       COREGL_OVERRIDE(fastpath_, glVertexAttribIPointer);
+                       COREGL_OVERRIDE(fastpath_, glVertexAttribI4i);
+                       COREGL_OVERRIDE(fastpath_, glVertexAttribI4ui);
+                       COREGL_OVERRIDE(fastpath_, glVertexAttribI4iv);
+                       COREGL_OVERRIDE(fastpath_, glVertexAttribI4uiv);
+                       COREGL_OVERRIDE(fastpath_, glGetUniformuiv);
+                       COREGL_OVERRIDE(fastpath_, glGetFragDataLocation);
+                       COREGL_OVERRIDE(fastpath_, glGetStringi);
+                       COREGL_OVERRIDE(fastpath_, glGetUniformIndices);
+                       COREGL_OVERRIDE(fastpath_, glGetActiveUniformsiv);
+                       COREGL_OVERRIDE(fastpath_, glGetUniformBlockIndex);
+                       COREGL_OVERRIDE(fastpath_, glGetActiveUniformBlockiv);
+                       COREGL_OVERRIDE(fastpath_, glGetActiveUniformBlockName);
+                       COREGL_OVERRIDE(fastpath_, glUniformBlockBinding);
+                       COREGL_OVERRIDE(fastpath_, glGetInteger64v);
+                       COREGL_OVERRIDE(fastpath_, glGetInteger64i_v);
+                       COREGL_OVERRIDE(fastpath_, glGenSamplers);
+                       COREGL_OVERRIDE(fastpath_, glDeleteSamplers);
+                       COREGL_OVERRIDE(fastpath_, glIsSampler);
+                       COREGL_OVERRIDE(fastpath_, glBindSampler);
+                       COREGL_OVERRIDE(fastpath_, glSamplerParameteri);
+                       COREGL_OVERRIDE(fastpath_, glSamplerParameteriv);
+                       COREGL_OVERRIDE(fastpath_, glSamplerParameterf);
+                       COREGL_OVERRIDE(fastpath_, glSamplerParameterfv);
+                       COREGL_OVERRIDE(fastpath_, glGetSamplerParameteriv);
+                       COREGL_OVERRIDE(fastpath_, glGetSamplerParameterfv);
+                       COREGL_OVERRIDE(fastpath_, glVertexAttribDivisor);
+                       COREGL_OVERRIDE(fastpath_, glGetProgramBinary);
+                       COREGL_OVERRIDE(fastpath_, glProgramBinary);
+                       COREGL_OVERRIDE(fastpath_, glProgramParameteri);
+               } // End of GLES 3.0
+
+       }
+       else
+       {
+               COREGL_LOG("\E[40;35;1m[CoreGL] SKIP GL FASTPATH...\E[0m\n");
+       }
+}
+
+#undef OVERRIDE
+
+static inline GL_Object_Hash_Base *
+_lock_gl_object_hash(GL_Object_State *ostate, GL_Object_Type type)
+{
+       switch (type)
+       {
+               case GL_OBJECT_TYPE_QUERY:
+                       return &ostate->query;
+               case GL_OBJECT_TYPE_TEXTURE:
+                       AST(mutex_lock(&ostate->shared->access_mutex) == 1);
+                       return &ostate->shared->texture;
+               case GL_OBJECT_TYPE_BUFFER:
+                       AST(mutex_lock(&ostate->shared->access_mutex) == 1);
+                       return &ostate->shared->buffer;
+               case GL_OBJECT_TYPE_FRAMEBUFFER:
+                       return &ostate->framebuffer;
+               case GL_OBJECT_TYPE_RENDERBUFFER:
+                       AST(mutex_lock(&ostate->shared->access_mutex) == 1);
+                       return &ostate->shared->renderbuffer;
+               case GL_OBJECT_TYPE_PROGRAM:
+                       AST(mutex_lock(&ostate->shared->access_mutex) == 1);
+                       return &ostate->shared->program;
+               case GL_OBJECT_TYPE_VERTEXARRAY:
+                       return &ostate->vertexarray;
+               case GL_OBJECT_TYPE_SAMPLER:
+                       AST(mutex_lock(&ostate->shared->access_mutex) == 1);
+                       return &ostate->shared->sampler;
+               case GL_OBJECT_TYPE_TRANSFORMFEEDBACK:
+                       return &ostate->transformfeedback;
+               default:
+                       return NULL;
+       }
+}
+
+static inline void
+_unlock_gl_object_hash(GL_Object_State *ostate, GL_Object_Type type)
+{
+       switch (type)
+       {
+               case GL_OBJECT_TYPE_TEXTURE:
+               case GL_OBJECT_TYPE_BUFFER:
+               case GL_OBJECT_TYPE_RENDERBUFFER:
+               case GL_OBJECT_TYPE_PROGRAM:
+               case GL_OBJECT_TYPE_SAMPLER:
+                       AST(mutex_unlock(&ostate->shared->access_mutex) == 1);
+               default:
+                       break;
+       }
+}
+
+static inline GL_Object_Hash_Base *
+_lock_gl_object_hash_real(GL_Object_State *ostate, GL_Object_Type type)
+{
+       switch (type)
+       {
+               case GL_OBJECT_TYPE_QUERY:
+                       return &ostate->query_real;
+               case GL_OBJECT_TYPE_TEXTURE:
+                       AST(mutex_lock(&ostate->shared->real_access_mutex) == 1);
+                       return &ostate->shared->texture_real;
+               case GL_OBJECT_TYPE_BUFFER:
+                       AST(mutex_lock(&ostate->shared->real_access_mutex) == 1);
+                       return &ostate->shared->buffer_real;
+               case GL_OBJECT_TYPE_FRAMEBUFFER:
+                       return &ostate->framebuffer_real;
+               case GL_OBJECT_TYPE_RENDERBUFFER:
+                       AST(mutex_lock(&ostate->shared->real_access_mutex) == 1);
+                       return &ostate->shared->renderbuffer_real;
+               case GL_OBJECT_TYPE_PROGRAM:
+                       AST(mutex_lock(&ostate->shared->real_access_mutex) == 1);
+                       return &ostate->shared->program_real;
+               case GL_OBJECT_TYPE_VERTEXARRAY:
+                       return &ostate->vertexarray_real;
+               case GL_OBJECT_TYPE_SAMPLER:
+                       AST(mutex_lock(&ostate->shared->real_access_mutex) == 1);
+                       return &ostate->shared->sampler_real;
+               case GL_OBJECT_TYPE_TRANSFORMFEEDBACK:
+                       return &ostate->transformfeedback_real;
+               default:
+                       return NULL;
+       }
+}
+
+static inline void
+_unlock_gl_object_hash_real(GL_Object_State *ostate, GL_Object_Type type)
+{
+       switch (type)
+       {
+               case GL_OBJECT_TYPE_TEXTURE:
+               case GL_OBJECT_TYPE_BUFFER:
+               case GL_OBJECT_TYPE_RENDERBUFFER:
+               case GL_OBJECT_TYPE_PROGRAM:
+               case GL_OBJECT_TYPE_SAMPLER:
+                       AST(mutex_unlock(&ostate->shared->real_access_mutex) == 1);
+                       break;
+               default:
+                       break;
+       }
+}
+
+int
+fastpath_add_context_state_to_list(const void *option, const int option_len, GLContextState *cstate, Mutex *mtx)
+{
+       int ret = 0;
+       int tid = 0;
+       GLContext_List *current = NULL;
+       GLContext_List *newitm = NULL;
+
+       if (mtx != NULL) AST(mutex_lock(mtx) == 1);
+
+       AST(cstate != NULL);
+
+       tid = get_current_thread();
+
+       current = glctx_list;
+       while (current != NULL)
+       {
+               if (current->option_len == option_len &&
+                   memcmp(current->option, option, option_len) == 0 &&
+                   current->thread_id == tid)
+               {
+                       AST(current->cstate == cstate);
+                       goto finish;
+               }
+               current = current->next;
+       }
+
+       newitm = (GLContext_List *)calloc(1, sizeof(GLContext_List));
+       if (newitm == NULL)
+       {
+               COREGL_ERR("Failed to create context list.\n");
+               goto finish;
+       }
+
+       newitm->cstate = cstate;
+       newitm->thread_id = tid;
+       newitm->option_len = option_len;
+       newitm->option = (void *)malloc(option_len);
+       memcpy(newitm->option, option, option_len);
+
+       if (glctx_list != NULL)
+               newitm->next = glctx_list;
+
+       glctx_list = newitm;
+
+       ret = 1;
+       goto finish;
+
+finish:
+       if (ret != 1)
+       {
+                /* Prevent CID : 394333 - delete dead code */
+               if (cstate != NULL)
+               {
+                       free(cstate);
+                       cstate = NULL;
+               }
+       }
+       if (mtx != NULL) AST(mutex_unlock(mtx) == 1);
+
+       return ret;
+}
+
+GLContextState *
+fastpath_get_context_state_from_list(const void *option, const int option_len, Mutex *mtx)
+{
+       GLContextState *ret = NULL;
+       GLContext_List *current = NULL;
+       int tid = 0;
+
+       if (mtx != NULL) AST(mutex_lock(mtx) == 1);
+
+       tid = get_current_thread();
+
+       current = glctx_list;
+       while (current != NULL)
+       {
+               if (current->option_len == option_len &&
+                   memcmp(current->option, option, option_len) == 0 &&
+                   current->thread_id == tid)
+               {
+                       ret = current->cstate;
+                       goto finish;
+               }
+               current = current->next;
+       }
+       goto finish;
+
+finish:
+       if (mtx != NULL) AST(mutex_unlock(mtx) == 1);
+       return ret;
+}
+
+int
+fastpath_remove_context_states_from_list(GLContextState *cstate, Mutex *mtx)
+{
+       int ret = 0;
+       GLContext_List *olditm = NULL;
+       GLContext_List *current = NULL;
+
+       if (mtx != NULL) AST(mutex_lock(mtx) == 1);
+
+       AST(cstate != NULL);
+
+       current = glctx_list;
+
+       while (current != NULL)
+       {
+               if (current->cstate == cstate)
+               {
+                       GLContext_List *nextitm = NULL;
+                       if (olditm != NULL)
+                       {
+                               olditm->next = current->next;
+                               nextitm = olditm->next;
+                       }
+                       else
+                       {
+                               glctx_list = current->next;
+                               nextitm = glctx_list;
+                       }
+                       if (current->option != NULL)
+                       {
+                               AST(current->option_len > 0);
+                               free(current->option);
+                               current->option = NULL;
+                               current->option_len = 0;
+                       }
+                       free(current);
+                       ret = 1;
+                       current = nextitm;
+                       continue;
+               }
+               olditm = current;
+               current = current->next;
+       }
+       goto finish;
+
+finish:
+       if (mtx != NULL) AST(mutex_unlock(mtx) == 1);
+       return ret;
+}
+
+
+
+#define HASH_INIT(hash_base) \
+       hash_base.hash_field = (GL_Object_Hash **)calloc(1, sizeof(GL_Object_Hash *) * GL_OBJECT_HASH_BASE); \
+       hash_base.hash_size = GL_OBJECT_HASH_BASE;
+
+void
+fastpath_ostate_init(GL_Object_State *ostate)
+{
+       HASH_INIT(ostate->query);
+       HASH_INIT(ostate->framebuffer);
+       HASH_INIT(ostate->vertexarray);
+       HASH_INIT(ostate->transformfeedback);
+
+       HASH_INIT(ostate->query_real);
+       HASH_INIT(ostate->framebuffer_real);
+       HASH_INIT(ostate->vertexarray_real);
+       HASH_INIT(ostate->transformfeedback_real);
+}
+
+void
+fastpath_sostate_init(GL_Shared_Object_State *sostate)
+{
+       mutex_init(&sostate->access_mutex);
+
+       HASH_INIT(sostate->texture);
+       HASH_INIT(sostate->buffer);
+       HASH_INIT(sostate->renderbuffer);
+       HASH_INIT(sostate->program);
+       HASH_INIT(sostate->sampler);
+
+       HASH_INIT(sostate->texture_real);
+       HASH_INIT(sostate->buffer_real);
+       HASH_INIT(sostate->renderbuffer_real);
+       HASH_INIT(sostate->program_real);
+       HASH_INIT(sostate->sampler_real);
+}
+
+#undef HASH_INIT
+
+
+static void
+_add_hash(GL_Object_Hash_Base *hash_base, GL_Object_Hash *data)
+{
+       int array_idx = data->hash_key & (hash_base->hash_size - 1);
+       if (hash_base->hash_field[array_idx] == NULL)
+       {
+               hash_base->hash_field[array_idx] = data;
+       }
+       else
+       {
+               GL_Object_Hash *current = hash_base->hash_field[array_idx];
+               while(current->next)
+               {
+                       AST(current->hash_key != data->hash_key);
+                       current = current->next;
+               }
+               current->next = data;
+       }
+       data->next = NULL;
+       hash_base->item_size++;
+}
+
+static int
+_remove_hash(GL_Object_Hash_Base *hash_base, GLuint hash)
+{
+       int ret = 0;
+       int array_idx = hash & (hash_base->hash_size - 1);
+
+       GL_Object_Hash *current = hash_base->hash_field[array_idx];
+       GL_Object_Hash *prev = NULL;
+
+       while(current)
+       {
+               if (current->hash_key == hash)
+               {
+                       if (prev != NULL)
+                               prev->next = current->next;
+                       else
+                               hash_base->hash_field[array_idx] = current->next;
+                       hash_base->item_size--;
+                       ret = 1;
+                       break;
+               }
+               prev = current;
+               current = current->next;
+       }
+
+       return ret;
+}
+
+static void
+_free_hash_list(GL_Object_Hash_Base *hash_base, int free_data)
+{
+       if (hash_base->item_size == 0) return;
+
+       for (int i = 0; i < hash_base->hash_size; i++)
+       {
+               if (hash_base->hash_field[i] != NULL)
+               {
+                       GL_Object_Hash *current = hash_base->hash_field[i];
+
+                       while (current != NULL)
+                       {
+                               GL_Object_Hash *current_next = current->next;
+
+                               if (free_data == 1 && current->item != NULL)
+                               {
+                                       free(current->item);
+                               }
+
+                               free(current);
+                               hash_base->item_size--;
+                               current = current_next;
+                       }
+               }
+       }
+}
+
+
+
+#define HASH_DEINIT(hash_base, free_data) \
+       _free_hash_list(&hash_base, free_data); \
+       free(hash_base.hash_field); \
+       hash_base.hash_size = 0;
+
+void
+fastpath_ostate_deinit(GL_Object_State *ostate)
+{
+       HASH_DEINIT(ostate->query, 1);
+       HASH_DEINIT(ostate->framebuffer, 1);
+       HASH_DEINIT(ostate->vertexarray, 1);
+       HASH_DEINIT(ostate->transformfeedback, 1);
+
+       HASH_DEINIT(ostate->query_real, 0);
+       HASH_DEINIT(ostate->framebuffer_real, 0);
+       HASH_DEINIT(ostate->vertexarray_real, 0);
+       HASH_DEINIT(ostate->transformfeedback_real, 0);
+}
+
+void
+fastpath_sostate_deinit(GL_Shared_Object_State *sostate)
+{
+       HASH_DEINIT(sostate->texture, 1);
+       HASH_DEINIT(sostate->buffer, 1);
+       HASH_DEINIT(sostate->renderbuffer, 1);
+       HASH_DEINIT(sostate->program, 1);
+       HASH_DEINIT(sostate->sampler, 1);
+
+       HASH_DEINIT(sostate->texture_real, 0);
+       HASH_DEINIT(sostate->buffer_real, 0);
+       HASH_DEINIT(sostate->renderbuffer_real, 0);
+       HASH_DEINIT(sostate->program_real, 0);
+       HASH_DEINIT(sostate->sampler_real, 0);
+}
+
+#undef HASH_DEINIT
+
+
+
+#define FIND_HASH(hash_base, key, ret) \
+{ \
+       GL_Object_Hash *fh_current = hash_base->hash_field[(key) & (hash_base->hash_size - 1)]; \
+       while(fh_current) \
+       { \
+               if (fh_current->hash_key == (key)) \
+               { \
+                       ret = fh_current; \
+                       break; \
+               } \
+               fh_current = fh_current->next; \
+       } \
+}
+
+void
+_ostate_hash_check(GL_Object_Hash_Base *hash_base)
+{
+       if (hash_base->item_size + 1 < hash_base->hash_size)
+               return;
+
+       int oldsize = hash_base->hash_size;
+       GL_Object_Hash **oldfield = hash_base->hash_field;
+
+       hash_base->hash_size = oldsize << 1;
+       hash_base->hash_field = (GL_Object_Hash **)calloc(1, sizeof(GL_Object_Hash *) * hash_base->hash_size);
+       AST(hash_base->hash_field != NULL);
+
+       for (int i = 0; i < oldsize; i++)
+       {
+               if (oldfield[i] != NULL)
+               {
+                       GL_Object_Hash *current = oldfield[i];
+
+                       while (current != NULL)
+                       {
+                               GL_Object_Hash *current_next = current->next;
+                               _add_hash(hash_base, current);
+                               hash_base->item_size--;
+                               current = current_next;
+                       }
+               }
+       }
+       free(oldfield);
+
+}
+
+GLuint
+fastpath_ostate_create_object(GL_Object_State *ostate, GL_Object_Type type, GLuint real_name)
+{
+       GLuint ret = _COREGL_INT_INIT_VALUE;
+
+       GL_Object_Hash_Base *hash_base = NULL;
+       GL_Object_Hash_Base *hash_base_real = NULL;
+       int newid = _COREGL_INT_INIT_VALUE;
+
+       hash_base = _lock_gl_object_hash(ostate, type);
+       hash_base_real = _lock_gl_object_hash_real(ostate, type);
+
+        /* Prevent CID : 393638 */
+        /* Prevent CID : 393538 */
+        if (hash_base == NULL || hash_base_real == NULL)
+                goto finish;
+
+       newid = hash_base->last_id + 1;
+       if (newid >= hash_base->hash_size)
+       {
+               hash_base->is_looped = 1;
+               newid = 1;
+               hash_base->last_id = 1;
+       }
+
+       if (hash_base->is_looped != 0)
+       {
+               int i;
+               int findingid = newid;
+               newid = -1;
+               for (i = 0; i < hash_base->hash_size; i++)
+               {
+                       GL_Object_Hash *exist_hash = NULL;
+                       FIND_HASH(hash_base, findingid, exist_hash);
+                       if (exist_hash == NULL)
+                       {
+                               newid = findingid;
+                               break;
+                       }
+                       findingid++;
+                       if (findingid >= hash_base->hash_size) findingid = 1;
+               }
+               AST(newid != -1);
+       }
+       hash_base->last_id = newid;
+
+       {
+               GL_Object *newobj = (GL_Object *)calloc(1, sizeof(GL_Object));
+               AST(newobj != NULL);
+               newobj->id = (int)type + newid;
+               newobj->real_id = real_name;
+               newobj->ref_count = 1;
+               ret = newobj->id;
+
+               GL_Object_Hash *newobj_hash = (GL_Object_Hash *)calloc(1, sizeof(GL_Object_Hash));
+               AST(newobj_hash != NULL);
+               newobj_hash->item = newobj;
+               newobj_hash->hash_key = newid;
+               _add_hash(hash_base, newobj_hash);
+
+               GL_Object_Hash *newobj_hash_real = (GL_Object_Hash *)calloc(1, sizeof(GL_Object_Hash));
+               AST(newobj_hash_real != NULL);
+               newobj_hash_real->item = newobj;
+               newobj_hash_real->hash_key = real_name;
+               _add_hash(hash_base_real, newobj_hash_real);
+       }
+
+       _ostate_hash_check(hash_base);
+       _ostate_hash_check(hash_base_real);
+
+       goto finish;
+
+finish:
+       _unlock_gl_object_hash(ostate, type);
+       _unlock_gl_object_hash_real(ostate, type);
+       return ret;
+}
+
+#define FIND_OBJ_FROM_HASH_WITH_VERIFY(hash_base, hash, object) \
+       if (((int)(hash)) < 0) { ret = 0; goto finish; } \
+       { \
+               GL_Object_Hash *object_hash = NULL; \
+               FIND_HASH((hash_base), (int)(hash), object_hash); \
+               if (object_hash == NULL) { ret = 0; goto finish; } \
+               (object) = object_hash->item; \
+               if ((object) == NULL) { ret = 0; goto finish; } \
+       }
+
+GLuint
+fastpath_ostate_remove_object(GL_Object_State *ostate, GL_Object_Type type, GLuint glue_name)
+{
+       GLuint ret = _COREGL_INT_INIT_VALUE;
+
+       GL_Object_Hash_Base *hash_base = NULL;
+       GL_Object_Hash_Base *hash_base_real = NULL;
+       GL_Object *object = NULL;
+
+       hash_base = _lock_gl_object_hash(ostate, type);
+       hash_base_real = _lock_gl_object_hash_real(ostate, type);
+
+        /* Prevent CID : 400742 */
+        if (hash_base == NULL || hash_base_real == NULL)
+            goto finish;
+
+       FIND_OBJ_FROM_HASH_WITH_VERIFY(hash_base, glue_name - (int)type, object);
+
+       object->ref_count--;
+
+       if (object->ref_count <= 0)
+       {
+               GL_Object_Hash *object_hash = NULL;
+
+               FIND_HASH(hash_base, object->id - (int)type, object_hash);
+               AST(object_hash != NULL);
+               _remove_hash(hash_base, object->id - (int)type);
+               free(object_hash);
+               object_hash = NULL;
+
+               FIND_HASH(hash_base_real, object->real_id, object_hash);
+               AST(object_hash != NULL);
+               _remove_hash(hash_base_real, object->real_id);
+               free(object_hash);
+               object_hash = NULL;
+
+               free(object);
+               object = NULL;
+       }
+
+       ret = 1;
+       goto finish;
+
+finish:
+       _unlock_gl_object_hash(ostate, type);
+       _unlock_gl_object_hash_real(ostate, type);
+       return ret;
+}
+
+GLuint
+fastpath_ostate_get_object(GL_Object_State *ostate, GL_Object_Type type, GLuint glue_name)
+{
+       GLuint ret = _COREGL_INT_INIT_VALUE;
+
+       GL_Object_Hash_Base *hash_base = NULL;
+       GL_Object *object = NULL;
+
+       hash_base = _lock_gl_object_hash(ostate, type);
+
+        /* Prvent CID : 387143 */
+        if (hash_base == NULL) goto finish;
+
+       FIND_OBJ_FROM_HASH_WITH_VERIFY(hash_base, glue_name - (int)type, object);
+
+       ret = object->real_id;
+       goto finish;
+
+finish:
+       _unlock_gl_object_hash(ostate, type);
+       return ret;
+}
+
+
+/* Check if the context's state contains object of a given type */
+GLuint
+fastpath_ostate_has_object_type(GL_Object_State *ostate, GL_Object_Type type)
+{
+       GLuint ret = _COREGL_INT_INIT_VALUE;
+
+       GL_Object_Hash_Base *hash_base = NULL;
+       GL_Object *object = NULL;
+       hash_base = _lock_gl_object_hash(ostate, type);
+        /* Prevent CID : 398319 */
+       if(hash_base == NULL || hash_base->hash_field == 0)
+       {
+               ret = 0;
+               goto finish;
+       }
+
+       FIND_OBJ_FROM_HASH_WITH_VERIFY(hash_base, 1, object);
+
+       ret = object->real_id;
+       goto finish;
+
+finish:
+       _unlock_gl_object_hash(ostate, type);
+       return ret;
+}
+
+
+GLint
+fastpath_ostate_set_object_tag(GL_Object_State *ostate, GL_Object_Type type, GLuint glue_name, GLvoid *tag)
+{
+       GLint ret = _COREGL_INT_INIT_VALUE;
+
+       GL_Object_Hash_Base *hash_base = NULL;
+       GL_Object *object = NULL;
+       int hash = _COREGL_INT_INIT_VALUE;
+
+       hash_base = _lock_gl_object_hash(ostate, type);
+        /* Prevent CID : 392281 */
+        if (hash_base == NULL) goto finish;
+
+       hash = glue_name - (int)type;
+
+       FIND_OBJ_FROM_HASH_WITH_VERIFY(hash_base, hash, object);
+
+       AST(object->tag == NULL);
+       object->tag = tag;
+       ret = 1;
+       goto finish;
+
+finish:
+       _unlock_gl_object_hash(ostate, type);
+       return ret;
+}
+
+GLvoid *
+fastpath_ostate_get_object_tag(GL_Object_State *ostate, GL_Object_Type type, GLuint glue_name)
+{
+       GLvoid *ret = NULL;
+
+       GL_Object_Hash_Base *hash_base = NULL;
+       GL_Object *object = NULL;
+
+        hash_base = _lock_gl_object_hash(ostate, type);
+
+        /* Prevent CID : 389752 */
+        if (hash_base == NULL) goto finish;
+
+       FIND_OBJ_FROM_HASH_WITH_VERIFY(hash_base, glue_name - (int)type, object);
+
+       ret = object->tag;
+       goto finish;
+
+finish:
+       _unlock_gl_object_hash(ostate, type);
+       return ret;
+}
+
+GLuint
+fastpath_ostate_find_object(GL_Object_State *ostate, GL_Object_Type type, GLuint real_name)
+{
+       GLuint ret = _COREGL_INT_INIT_VALUE;
+
+       GL_Object_Hash_Base *hash_base_real = NULL;
+       GL_Object *object = NULL;
+
+       hash_base_real = _lock_gl_object_hash_real(ostate, type);
+        /* Prevent CID : 398100 */
+        if (hash_base_real == NULL) goto finish;
+
+       FIND_OBJ_FROM_HASH_WITH_VERIFY(hash_base_real, real_name, object);
+
+       ret = object->id;
+       goto finish;
+
+finish:
+       _unlock_gl_object_hash_real(ostate, type);
+       return ret;
+}
+
+GLint
+fastpath_ostate_use_object(GL_Object_State *ostate, GL_Object_Type type, GLuint glue_name)
+{
+       GLint ret = _COREGL_INT_INIT_VALUE;
+
+       GL_Object_Hash_Base *hash_base = NULL;
+       GL_Object *object = NULL;
+
+       hash_base = _lock_gl_object_hash(ostate, type);
+
+        /* Prevent CID : 390897 */
+        if (hash_base == NULL) goto finish;
+
+       FIND_OBJ_FROM_HASH_WITH_VERIFY(hash_base, glue_name - (int)type, object);
+
+       object->ref_count++;
+       ret = 1;
+       goto finish;
+
+finish:
+       _unlock_gl_object_hash(ostate, type);
+       return ret;
+}
+
+void
+fastpath_dump_context_states(GLGlueContext *ctx, int force_output)
+{
+       static struct timeval tv_last = { 0, 0 };
+
+       if (unlikely(trace_state_flag != 1)) return;
+
+       if (!force_output)
+       {
+               struct timeval tv_now = { 0, 0 };
+               AST(gettimeofday(&tv_now, NULL) == 0);
+               if (tv_now.tv_sec - tv_last.tv_sec < _COREGL_TRACE_OUTPUT_INTERVAL_SEC)
+               {
+                       goto finish;
+               }
+               tv_last = tv_now;
+       }
+
+       TRACE("\n");
+       TRACE("\E[0;40;34m========================================================================================================================\E[0m\n");
+       TRACE("\E[40;32;1m  State info \E[1;37;1m: <PID = %d> GlueCTX = %p\E[0m\n", getpid(), ctx);
+       TRACE("\E[0;40;34m========================================================================================================================\E[0m\n");
+
+#define PRINTF_CHAR_GLenum "0x%8X"
+#define PRINTF_CHAR_GLboolean "%10d"
+#define PRINTF_CHAR_GLint "%10d"
+#define PRINTF_CHAR_GLsizei "%10u"
+#define PRINTF_CHAR_GLuint "%10u"
+#define PRINTF_CHAR_GLuintmask "0x%8X"
+#define PRINTF_CHAR_GLintptr "%10ld"
+#define PRINTF_CHAR_GLsizeiptr "%10ld"
+
+#define PRINTF_CHAR_GLclampf "%10.6f"
+#define PRINTF_CHAR_GLfloat "%10.6f"
+
+#define PRINTF_CHAR_GLvoidptr "%10p"
+
+#define PRINTF_CHAR(type) PRINTF_CHAR_##type
+
+#define _COREGL_START_API(version) api_gl_version = version;
+#define _COREGL_END_API(version) api_gl_version = COREGL_GLAPI_2;
+#define INITIAL_CTX initial_ctx
+#define GLUE_STATE(TYPE, NAME, SIZE, ARRAY_SIZE, DEFAULT_STMT, GET_STMT)  \
+   { \
+      TYPE valuedata[SIZE]; \
+      TYPE *value = NULL; \
+      if(api_gl_version <= driver_gl_version) { \
+         value = valuedata; GET_STMT; value = valuedata; \
+         TRACE("\E[40;37;1m %-30.30s : (\E[0m ", #NAME); \
+         for (int i = 0; i < SIZE; i++) \
+         { \
+            if (i > 0) { \
+               if (i % 4 == 0) \
+                  TRACE("\n %-30.30s     ", "");\
+               else \
+                  TRACE(", "); \
+            } \
+            if (ctx->NAME[i] != value[i]) { TRACE("\E[40;31;1m"); } \
+               TRACE(PRINTF_CHAR(TYPE), ctx->NAME[i]); \
+               TRACE("["PRINTF_CHAR(TYPE)"]", value[i]); \
+            if (ctx->NAME[i] != value[i]) { TRACE("\E[0m"); } \
+         } \
+         TRACE(" \E[40;37;1m)\E[0m\n"); \
+      } \
+   }
+# include "coregl_fastpath_state.h"
+#undef GLUE_STATE
+#undef INITIAL_CTX
+#undef _COREGL_START_API
+#undef _COREGL_END_API
+
+       TRACE("\E[0;40;34m========================================================================================================================\E[0m\n");
+       TRACE("\n");
+
+       TRACE_END();
+
+finish:
+       return;
+}
+
+int
+fastpath_init_context_states(GLGlueContext *ctx)
+{
+       int ret = 0;
+
+       AST(mutex_lock(&init_context_mutex) == 1);
+
+       if (ctx == NULL)
+       {
+               COREGL_ERR("Context NULL\n");
+               ret = 0;
+               goto finish;
+       }
+
+       AST(ctx->initialized == 0);
+       AST(ctx->ostate.shared != NULL);
+
+       if (initial_ctx == NULL)
+       {
+               initial_ctx = (GLGlueContext *)calloc(1, sizeof(GLGlueContext));
+               AST(initial_ctx != NULL);
+
+//#define FORCE_DEFAULT_VALUE
+#define _COREGL_START_API(version) api_gl_version = version;
+#define _COREGL_END_API(version) api_gl_version = COREGL_GLAPI_2;
+#ifdef FORCE_DEFAULT_VALUE
+# define INITIAL_CTX initial_ctx
+# define GLUE_STATE(TYPE, NAME, SIZE, ARRAY_SIZE, DEFAULT_STMT, GET_STMT)  \
+      { \
+         int i; \
+         TYPE valuedata[SIZE]; \
+         TYPE *value = NULL; \
+         memset(valuedata, 0xcc, sizeof(TYPE) * SIZE); \
+         if(api_gl_version <= driver_gl_version) { \
+            value = valuedata; DEFAULT_STMT; value = valuedata; \
+            for (i = 0; i < SIZE; i++) \
+            { \
+               if (*((char *)(&value[i])) == 0xcc) \
+               { \
+                  memset(&value[i], 0xaa, sizeof(TYPE)); \
+                  value = valuedata; DEFAULT_STMT; value = valuedata; \
+                  if (*((char *)(&value[i])) == 0xaa) \
+                  { \
+                     COREGL_WRN("\E[40;31;1mGL-state '"#NAME"' cannot be retrieved\E[0m\n"); \
+                     break; \
+                  } \
+               } \
+               initial_ctx->NAME[i] = value[i]; \
+            } \
+        }\
+      }
+#  include "coregl_fastpath_state.h"
+# undef GLUE_STATE
+# undef INITIAL_CTX
+#else
+# define INITIAL_CTX initial_ctx
+# define SET_GLUE_VALUE(DEFAULT_STMT, FALLBACK_STMT) \
+      if (try_step == 1) \
+      { \
+         value = valuedata; DEFAULT_STMT; value = valuedata; \
+      } \
+      else \
+      { \
+         value = valuedata; FALLBACK_STMT; value = valuedata; \
+      }
+
+# define GLUE_STATE(TYPE, NAME, SIZE, ARRAY_SIZE, DEFAULT_STMT, GET_STMT)  \
+      { \
+         int i; \
+         int try_step = 0;\
+         TYPE valuedata[SIZE]; \
+         TYPE *value = NULL; \
+         _sym_glGetError(); \
+         memset(valuedata, 0xcc, sizeof(TYPE) * SIZE); \
+         if(api_gl_version <= driver_gl_version) { \
+            do { \
+               try_step++; \
+               SET_GLUE_VALUE(GET_STMT, DEFAULT_STMT); \
+               if (_sym_glGetError() == GL_INVALID_ENUM) \
+               { \
+                  initial_ctx->NAME##_used = 0; \
+                  value = valuedata; DEFAULT_STMT; value = valuedata; \
+                  break; \
+               } \
+               initial_ctx->NAME##_used = 1; \
+               for (i = 0; i < SIZE; i++) \
+               { \
+                  if (*((char *)(&value[i])) == 0xcc) \
+                  { \
+                     memset(&value[i], 0xaa, sizeof(TYPE)); \
+                     SET_GLUE_VALUE(GET_STMT, DEFAULT_STMT); \
+                     if (*((char *)(&value[i])) == 0xaa) \
+                     { \
+                        try_step++; \
+                        if (try_step == 2) \
+                        { \
+                           COREGL_WRN("\E[40;31;1mGL-state '"#NAME"' cannot be retrieved\E[0m\n"); \
+                        } \
+                        break; \
+                     } \
+                  } \
+                  initial_ctx->NAME[i] = value[i]; \
+               } \
+               if (try_step != 2) \
+               { \
+                  value = valuedata; DEFAULT_STMT; value = valuedata; \
+                  for (i = 0; i < SIZE; i++) \
+                  { \
+                     if (initial_ctx->NAME[i] != value[i]) \
+                     { \
+                        COREGL_WRN("GL-state '"#NAME"'[%d] value ["PRINTF_CHAR(TYPE)"] is different from SPEC-DEFAULT ["PRINTF_CHAR(TYPE)"]\n", i, initial_ctx->NAME[i], value[i]); \
+                     } \
+                  } \
+               } \
+            } \
+            while (try_step == 2); \
+         }\
+      }
+#  include "coregl_fastpath_state.h"
+# undef SET_GLUE_VALUE
+# undef GLUE_STATE
+# undef INITIAL_CTX
+#endif
+# undef _COREGL_END_API
+# undef _COREGL_START_API
+
+               if (initial_ctx->gl_num_vertex_attribs[0] > MAX_VERTEX_ATTRIBS)
+               {
+                       COREGL_WRN("\E[40;31;1mNumber of vertex attrib is too big! (%d-%d)\E[0m\n", MAX_VERTEX_ATTRIBS, initial_ctx->gl_num_vertex_attribs[0]);
+               }
+               if (initial_ctx->gl_num_tex_units[0] > MAX_TEXTURE_UNITS)
+               {
+                       COREGL_WRN("\E[40;31;1mNumber of texture unit is too big! (%d-%d)\E[0m\n", MAX_TEXTURE_UNITS, initial_ctx->gl_num_tex_units[0]);
+               }
+               if (initial_ctx->gl_num_transform_feedback_separate_attribs[0] > MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS)
+               {
+                       COREGL_WRN("\E[40;31;1mNumber of transform feedback separate attrib is too big! (%d-%d)\E[0m\n", MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, initial_ctx->gl_num_transform_feedback_separate_attribs[0]);
+               }
+               if (initial_ctx->gl_num_uniform_buffer_bindings[0] > MAX_UNIFORM_BUFFER_BINDINGS)
+               {
+                       COREGL_WRN("\E[40;31;1mNumber of uniform buffer binding is too big! (%d-%d)\E[0m\n", MAX_UNIFORM_BUFFER_BINDINGS, initial_ctx->gl_num_uniform_buffer_bindings[0]);
+               }
+       }
+
+       {
+               int i;
+#define _COREGL_START_API(version) api_gl_version = version;
+#define _COREGL_END_API(version) api_gl_version = COREGL_GLAPI_2;
+#define INITIAL_CTX initial_ctx
+#define GLUE_STATE(TYPE, NAME, SIZE, ARRAY_SIZE, DEFAULT_STMT, GET_STMT)  \
+      if(api_gl_version <= driver_gl_version) { \
+         for (i = 0; i < SIZE; i++) \
+         { \
+            ctx->NAME[i] = initial_ctx->NAME[i]; \
+            ctx->NAME##_used = initial_ctx->NAME##_used; \
+         }\
+      }
+# include "coregl_fastpath_state.h"
+#undef GLUE_STATE
+#undef INITIAL_CTX
+#undef _COREGL_START_API
+#undef _COREGL_END_API
+       }
+
+       ctx->initialized = 1;
+       ret = 1;
+       goto finish;
+
+finish:
+       AST(mutex_unlock(&init_context_mutex) == 1);
+
+       return ret;
+}
+
+#ifdef COREGL_USE_MODULE_TRACEPATH
+extern void *tracepath_api_trace_begin(const char *name, void *hint, int trace_total_time);
+extern void *tracepath_api_trace_end(const char *name, void *hint, int trace_total_time);
+#endif
+
+#define CHECK_GL_ERROR(func) \
+       { \
+               func; \
+               int err = _orig_fastpath_glGetError(); \
+               if (err != GL_NO_ERROR) \
+               { \
+                       COREGL_ERR("\E[40;31;1m(GL %p) : %s returns GL error 0x%X\E[0m\n", oldctx->cstate, #func, err); \
+                       goto finish; \
+               } \
+       }
+
+int
+fastpath_make_context_current(GLGlueContext *oldctx, GLGlueContext *newctx)
+{
+       int ret = 0;
+       unsigned char flag = 0;
+       int i = 0;
+
+       if (debug_nofp == 1)
+       {
+               ret = 1;
+               goto finish;
+       }
+
+       // Return if they're the same
+       if (oldctx == newctx)
+       {
+               ret = 1;
+               goto finish;
+       }
+
+#define STATE_COMPARE(state) \
+   if ((oldctx->state) != (newctx->state))
+
+#define STATES_COMPARE(state_ptr, bytes) \
+   if ((memcmp((oldctx->state_ptr), (newctx->state_ptr), (bytes))) != 0)
+
+
+#ifdef COREGL_USE_MODULE_TRACEPATH
+       static void *trace_hint_glfinish = NULL;
+       trace_hint_glfinish = tracepath_api_trace_begin("eglMakeCurrent(FP glFinish)", trace_hint_glfinish, 0);
+#endif // COREGL_USE_MODULE_TRACEPATH
+
+       {
+               int err = _orig_fastpath_glGetError();
+               if (err != GL_NO_ERROR && oldctx->gl_error == GL_NO_ERROR)
+                       oldctx->gl_error = err;
+       }
+
+       CHECK_GL_ERROR(_orig_fastpath_glFlush())
+
+#ifdef COREGL_USE_MODULE_TRACEPATH
+       tracepath_api_trace_end("eglMakeCurrent(FP glFinish)", trace_hint_glfinish, 0);
+#endif // COREGL_USE_MODULE_TRACEPATH
+
+       // _varray_flag
+#ifdef COREGL_USE_MODULE_TRACEPATH
+       static void *trace_hint_vertex_attrib = NULL;
+       trace_hint_vertex_attrib = tracepath_api_trace_begin("eglMakeCurrent(FP vertex attrib)", trace_hint_vertex_attrib, 0);
+#endif // COREGL_USE_MODULE_TRACEPATH
+
+       flag = oldctx->_vattrib_flag | newctx->_vattrib_flag;
+       if (flag)
+       {
+               for (i = 0; i < oldctx->gl_num_vertex_attribs[0]; i++)
+               {
+                       if (newctx->gl_vertex_array_buf_id[i] != oldctx->gl_vertex_array_buf_id[i])
+                       {
+                               CHECK_GL_ERROR(_orig_fastpath_glBindBuffer(GL_ARRAY_BUFFER, newctx->gl_vertex_array_buf_id[i]))
+                       }
+                       else
+                       {
+                               CHECK_GL_ERROR(_orig_fastpath_glBindBuffer(GL_ARRAY_BUFFER, 0))
+                       }
+
+                       STATE_COMPARE(gl_vertex_array_divisor[i])
+                       {
+                               CHECK_GL_ERROR(_orig_fastpath_glVertexAttribDivisor(i, newctx->gl_vertex_array_divisor[i]))
+                       }
+
+                       if (newctx->gl_vertex_array_size[i] != 0)
+                       {
+                               CHECK_GL_ERROR(_orig_fastpath_glVertexAttribPointer(i,
+                                              newctx->gl_vertex_array_size[i],
+                                              newctx->gl_vertex_array_type[i],
+                                              newctx->gl_vertex_array_normalized[i],
+                                              newctx->gl_vertex_array_stride[i],
+                                              newctx->gl_vertex_array_pointer[i]))
+                       }
+                       else
+                       {
+                               if (newctx->gl_vertex_array_integer[0] == GL_TRUE)
+                               {
+                                       if (newctx->gl_vertex_array_type[0] == GL_UNSIGNED_INT)
+                                       {
+                                               CHECK_GL_ERROR(_orig_fastpath_glVertexAttribI4uiv(i, &newctx->gl_vertex_attrib_value_unsigned_integer[4 * i]))
+                                       }
+                                       else
+                                       {
+                                               CHECK_GL_ERROR(_orig_fastpath_glVertexAttribI4iv(i, &newctx->gl_vertex_attrib_value_integer[4 * i]))
+                                       }
+                               }
+                               else
+                               {
+                                       CHECK_GL_ERROR(_orig_fastpath_glVertexAttrib4fv(i, &newctx->gl_vertex_attrib_value[4 * i]))
+                               }
+                       }
+
+                       if (newctx->gl_vertex_array_enabled[i] == GL_TRUE)
+                       {
+                               CHECK_GL_ERROR(_orig_fastpath_glEnableVertexAttribArray(i))
+                       }
+                       else
+                       {
+                               CHECK_GL_ERROR(_orig_fastpath_glDisableVertexAttribArray(i))
+                       }
+               }
+
+       }
+
+#ifdef COREGL_USE_MODULE_TRACEPATH
+       tracepath_api_trace_end("eglMakeCurrent(FP vertex attrib)", trace_hint_vertex_attrib, 0);
+#endif // COREGL_USE_MODULE_TRACEPATH
+
+
+#ifdef COREGL_USE_MODULE_TRACEPATH
+       static void *trace_hint_bindbuffers = NULL;
+       trace_hint_bindbuffers = tracepath_api_trace_begin("eglMakeCurrent(FP bind buffers)", trace_hint_bindbuffers, 0);
+#endif // COREGL_USE_MODULE_TRACEPATH
+
+       //------------------//
+       // _bind_flag1
+       flag = oldctx->_bind_flag1 | newctx->_bind_flag1;
+       if (flag)
+       {
+               STATE_COMPARE(gl_array_buffer_binding[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glBindBuffer(GL_ARRAY_BUFFER, newctx->gl_array_buffer_binding[0]))
+               }
+               STATE_COMPARE(gl_element_array_buffer_binding[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, newctx->gl_element_array_buffer_binding[0]))
+               }
+
+               if (newctx->gl_framebuffer_binding_read_used == 1)
+               {
+                       STATE_COMPARE(gl_framebuffer_binding_read[0])
+                       {
+                               CHECK_GL_ERROR(_orig_fastpath_glBindFramebuffer(GL_READ_FRAMEBUFFER, newctx->gl_framebuffer_binding_read[0]))
+                       }
+                       STATE_COMPARE(gl_framebuffer_binding_draw[0])
+                       {
+                               CHECK_GL_ERROR(_orig_fastpath_glBindFramebuffer(GL_DRAW_FRAMEBUFFER, newctx->gl_framebuffer_binding_draw[0]))
+                       }
+               }
+               else
+               {
+                       STATE_COMPARE(gl_framebuffer_binding[0])
+                       {
+                               CHECK_GL_ERROR(_orig_fastpath_glBindFramebuffer(GL_FRAMEBUFFER, newctx->gl_framebuffer_binding[0]))
+                       }
+               }
+               STATE_COMPARE(gl_renderbuffer_binding[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glBindRenderbuffer(GL_RENDERBUFFER, newctx->gl_renderbuffer_binding[0]))
+               }
+       }
+
+       //------------------//
+       // _bind_flag2
+       flag = oldctx->_bind_flag2 | newctx->_bind_flag2;
+       if (flag)
+       {
+               STATE_COMPARE(gl_copy_read_buffer_binding[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glBindBuffer(GL_COPY_READ_BUFFER, newctx->gl_copy_read_buffer_binding[0]))
+               }
+               STATE_COMPARE(gl_copy_write_buffer_binding[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glBindBuffer(GL_COPY_WRITE_BUFFER, newctx->gl_copy_write_buffer_binding[0]))
+               }
+               STATE_COMPARE(gl_pixel_pack_buffer_binding[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glBindBuffer(GL_PIXEL_PACK_BUFFER, newctx->gl_pixel_pack_buffer_binding[0]))
+               }
+               STATE_COMPARE(gl_pixel_unpack_buffer_binding[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glBindBuffer(GL_PIXEL_UNPACK_BUFFER, newctx->gl_pixel_unpack_buffer_binding[0]))
+               }
+               STATE_COMPARE(gl_transform_feedback_buffer_binding[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, newctx->gl_transform_feedback_buffer_binding[0]))
+               }
+               STATE_COMPARE(gl_uniform_buffer_binding[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glBindBuffer(GL_UNIFORM_BUFFER, newctx->gl_uniform_buffer_binding[0]))
+               }
+       }
+#ifdef COREGL_USE_MODULE_TRACEPATH
+       tracepath_api_trace_end("eglMakeCurrent(FP bind buffers)", trace_hint_bindbuffers, 0);
+#endif // COREGL_USE_MODULE_TRACEPATH
+
+
+       //------------------//
+       // Enable States
+       // _enable_flag1
+#ifdef COREGL_USE_MODULE_TRACEPATH
+       static void *trace_hint_enable_states = NULL;
+       trace_hint_enable_states = tracepath_api_trace_begin("eglMakeCurrent(FP enable states)", trace_hint_enable_states, 0);
+#endif // COREGL_USE_MODULE_TRACEPATH
+
+       flag = oldctx->_enable_flag1 | newctx->_enable_flag1;
+       if (flag)
+       {
+               STATE_COMPARE(gl_blend[0])
+               {
+                       if (newctx->gl_blend[0])
+                       {
+                               CHECK_GL_ERROR(_orig_fastpath_glEnable(GL_BLEND))
+                       }
+                       else
+                               CHECK_GL_ERROR(_orig_fastpath_glDisable(GL_BLEND))
+               }
+               STATE_COMPARE(gl_cull_face[0])
+               {
+                       if (newctx->gl_cull_face[0])
+                       {
+                               CHECK_GL_ERROR(_orig_fastpath_glEnable(GL_CULL_FACE))
+                       }
+                       else
+                               CHECK_GL_ERROR(_orig_fastpath_glDisable(GL_CULL_FACE))
+               }
+               STATE_COMPARE(gl_depth_test[0])
+               {
+                       if (newctx->gl_depth_test[0])
+                       {
+                               CHECK_GL_ERROR(_orig_fastpath_glEnable(GL_DEPTH_TEST))
+                       }
+                       else
+                               CHECK_GL_ERROR(_orig_fastpath_glDisable(GL_DEPTH_TEST))
+               }
+               STATE_COMPARE(gl_dither[0])
+               {
+                       if (newctx->gl_dither[0])
+                       {
+                               CHECK_GL_ERROR(_orig_fastpath_glEnable(GL_DITHER))
+                       }
+                       else
+                               CHECK_GL_ERROR(_orig_fastpath_glDisable(GL_DITHER))
+               }
+       }
+
+       // _enable_flag2
+       flag = oldctx->_enable_flag2 | newctx->_enable_flag2;
+       if (flag)
+       {
+               STATE_COMPARE(gl_polygon_offset_fill[0])
+               {
+                       if (newctx->gl_polygon_offset_fill[0])
+                       {
+                               CHECK_GL_ERROR(_orig_fastpath_glEnable(GL_POLYGON_OFFSET_FILL))
+                       }
+                       else
+                               CHECK_GL_ERROR(_orig_fastpath_glDisable(GL_POLYGON_OFFSET_FILL))
+               }
+               STATE_COMPARE(gl_sample_alpha_to_coverage[0])
+               {
+                       if (newctx->gl_sample_alpha_to_coverage[0])
+                       {
+                               CHECK_GL_ERROR(_orig_fastpath_glEnable(GL_SAMPLE_ALPHA_TO_COVERAGE))
+                       }
+                       else
+                               CHECK_GL_ERROR(_orig_fastpath_glDisable(GL_SAMPLE_ALPHA_TO_COVERAGE))
+               }
+               STATE_COMPARE(gl_sample_coverage[0])
+               {
+                       if (newctx->gl_sample_coverage[0])
+                       {
+                               CHECK_GL_ERROR(_orig_fastpath_glEnable(GL_SAMPLE_COVERAGE))
+                       }
+                       else
+                               CHECK_GL_ERROR(_orig_fastpath_glDisable(GL_SAMPLE_COVERAGE))
+               }
+               STATE_COMPARE(gl_scissor_test[0])
+               {
+                       if (newctx->gl_scissor_test[0])
+                       {
+                               CHECK_GL_ERROR(_orig_fastpath_glEnable(GL_SCISSOR_TEST))
+                       }
+                       else
+                               CHECK_GL_ERROR(_orig_fastpath_glDisable(GL_SCISSOR_TEST))
+               }
+               STATE_COMPARE(gl_stencil_test[0])
+               {
+                       if (newctx->gl_stencil_test[0])
+                       {
+                               CHECK_GL_ERROR(_orig_fastpath_glEnable(GL_STENCIL_TEST))
+                       }
+                       else
+                               CHECK_GL_ERROR(_orig_fastpath_glDisable(GL_STENCIL_TEST))
+               }
+       }
+
+       // _enable_flag3
+       flag = oldctx->_enable_flag3 | newctx->_enable_flag3;
+       if (flag)
+       {
+               STATE_COMPARE(gl_primitive_restart_fixed_index[0])
+               {
+                       if (newctx->gl_primitive_restart_fixed_index[0])
+                       {
+                               CHECK_GL_ERROR(_orig_fastpath_glEnable(GL_PRIMITIVE_RESTART_FIXED_INDEX))
+                       }
+                       else
+                               CHECK_GL_ERROR(_orig_fastpath_glDisable(GL_PRIMITIVE_RESTART_FIXED_INDEX))
+               }
+               STATE_COMPARE(gl_rasterizer_discard[0])
+               {
+                       if (newctx->gl_rasterizer_discard[0])
+                       {
+                               CHECK_GL_ERROR(_orig_fastpath_glEnable(GL_RASTERIZER_DISCARD))
+                       }
+                       else
+                               CHECK_GL_ERROR(_orig_fastpath_glDisable(GL_RASTERIZER_DISCARD))
+               }
+       }
+
+#ifdef COREGL_USE_MODULE_TRACEPATH
+       tracepath_api_trace_end("eglMakeCurrent(FP enable states)", trace_hint_enable_states, 0);
+#endif // COREGL_USE_MODULE_TRACEPATH
+
+       //------------------//
+       // _clear_flag1
+#ifdef COREGL_USE_MODULE_TRACEPATH
+       static void *trace_hint_clear_viewport = NULL;
+       trace_hint_clear_viewport = tracepath_api_trace_begin("eglMakeCurrent(FP clear/viewport)", trace_hint_clear_viewport, 0);
+#endif // COREGL_USE_MODULE_TRACEPATH
+
+       flag = oldctx->_clear_flag1 | newctx->_clear_flag1;
+       if (flag)
+       {
+               // Viewport.
+               STATES_COMPARE(gl_viewport, 4 * sizeof(GLint))
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glViewport(newctx->gl_viewport[0],
+                                      newctx->gl_viewport[1],
+                                      newctx->gl_viewport[2],
+                                      newctx->gl_viewport[3]))
+               }
+
+               STATE_COMPARE(gl_current_program[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glUseProgram(newctx->gl_current_program[0]))
+               }
+               STATES_COMPARE(gl_color_clear_value, 4 * sizeof(GLclampf))
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glClearColor(newctx->gl_color_clear_value[0],
+                                      newctx->gl_color_clear_value[1],
+                                      newctx->gl_color_clear_value[2],
+                                      newctx->gl_color_clear_value[3]))
+               }
+       }
+
+
+       // _clear_flag2
+       flag = oldctx->_clear_flag2 | newctx->_clear_flag2;
+       if (flag)
+       {
+               STATES_COMPARE(gl_color_writemask, 4 * sizeof(GLboolean))
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glColorMask(newctx->gl_color_writemask[0],
+                                      newctx->gl_color_writemask[1],
+                                      newctx->gl_color_writemask[2],
+                                      newctx->gl_color_writemask[3]))
+               }
+               STATES_COMPARE(gl_depth_range, 2 * sizeof(GLclampf))
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glDepthRangef(newctx->gl_depth_range[0],
+                                      newctx->gl_depth_range[1]))
+               }
+               STATE_COMPARE(gl_depth_clear_value[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glClearDepthf(newctx->gl_depth_clear_value[0]))
+               }
+               STATE_COMPARE(gl_depth_func[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glDepthFunc(newctx->gl_depth_func[0]))
+               }
+               STATE_COMPARE(gl_depth_writemask[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glDepthMask(newctx->gl_depth_writemask[0]))
+               }
+               STATE_COMPARE(gl_cull_face_mode[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glCullFace(newctx->gl_cull_face_mode[0]))
+               }
+
+       }
+
+#ifdef COREGL_USE_MODULE_TRACEPATH
+       tracepath_api_trace_end("eglMakeCurrent(FP clear/viewport)", trace_hint_clear_viewport, 0);
+#endif // COREGL_USE_MODULE_TRACEPATH
+
+       //------------------//
+       // Texture here...
+#ifdef COREGL_USE_MODULE_TRACEPATH
+       static void *trace_hint_bind_textures = NULL;
+       trace_hint_bind_textures = tracepath_api_trace_begin("eglMakeCurrent(FP bind textures)", trace_hint_bind_textures, 0);
+#endif // COREGL_USE_MODULE_TRACEPATH
+
+       flag = oldctx->_tex_flag1 | newctx->_tex_flag1;
+       if (flag)
+       {
+
+               for (i = 0; i < oldctx->gl_num_tex_units[0]; i++)
+               {
+                       STATE_COMPARE(gl_tex_2d_state[i])
+                       {
+                               CHECK_GL_ERROR(_orig_fastpath_glActiveTexture(GL_TEXTURE0 + i))
+                               CHECK_GL_ERROR(_orig_fastpath_glBindTexture(GL_TEXTURE_2D, newctx->gl_tex_2d_state[i]))
+                       }
+                       STATE_COMPARE(gl_tex_3d_state[i])
+                       {
+                               CHECK_GL_ERROR(_orig_fastpath_glActiveTexture(GL_TEXTURE0 + i))
+                               CHECK_GL_ERROR(_orig_fastpath_glBindTexture(GL_TEXTURE_3D, newctx->gl_tex_3d_state[i]))
+                       }
+                       STATE_COMPARE(gl_tex_2d_array_state[i])
+                       {
+                               CHECK_GL_ERROR(_orig_fastpath_glActiveTexture(GL_TEXTURE0 + i))
+                               CHECK_GL_ERROR(_orig_fastpath_glBindTexture(GL_TEXTURE_2D_ARRAY, newctx->gl_tex_2d_array_state[i]))
+                       }
+                       STATE_COMPARE(gl_tex_cube_state[i])
+                       {
+                               CHECK_GL_ERROR(_orig_fastpath_glActiveTexture(GL_TEXTURE0 + i))
+                               CHECK_GL_ERROR(_orig_fastpath_glBindTexture(GL_TEXTURE_CUBE_MAP, newctx->gl_tex_cube_state[i]))
+                       }
+                       STATE_COMPARE(gl_tex_external_oes_state[i])
+                       {
+                               CHECK_GL_ERROR(_orig_fastpath_glActiveTexture(GL_TEXTURE0 + i))
+                               CHECK_GL_ERROR(_orig_fastpath_glBindTexture(GL_TEXTURE_EXTERNAL_OES, newctx->gl_tex_external_oes_state[i]))
+                       }
+               }
+
+               // Restore active texture
+               CHECK_GL_ERROR(_orig_fastpath_glActiveTexture(newctx->gl_active_texture[0]))
+
+               STATE_COMPARE(gl_generate_mipmap_hint[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glHint(GL_GENERATE_MIPMAP_HINT, newctx->gl_generate_mipmap_hint[0]))
+               }
+       }
+#ifdef COREGL_USE_MODULE_TRACEPATH
+       tracepath_api_trace_end("eglMakeCurrent(FP bind textures)", trace_hint_bind_textures, 0);
+#endif // COREGL_USE_MODULE_TRACEPATH
+
+       //------------------//
+#ifdef COREGL_USE_MODULE_TRACEPATH
+       static void *trace_hint_etc = NULL;
+       trace_hint_etc = tracepath_api_trace_begin("eglMakeCurrent(FP etc.)", trace_hint_etc, 0);
+#endif // COREGL_USE_MODULE_TRACEPATH
+
+       flag = oldctx->_blend_flag | newctx->_blend_flag;
+       if (flag)
+       {
+               STATES_COMPARE(gl_blend_color, 4 * sizeof(GLclampf))
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glBlendColor(newctx->gl_blend_color[0],
+                                      newctx->gl_blend_color[1],
+                                      newctx->gl_blend_color[2],
+                                      newctx->gl_blend_color[3]))
+               }
+               if ((oldctx->gl_blend_src_rgb[0] != newctx->gl_blend_src_rgb[0]) ||
+                   (oldctx->gl_blend_dst_rgb[0] != newctx->gl_blend_dst_rgb[0]) ||
+                   (oldctx->gl_blend_src_alpha[0] != newctx->gl_blend_src_alpha[0]) ||
+                   (oldctx->gl_blend_dst_alpha[0] != newctx->gl_blend_dst_alpha[0]))
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glBlendFuncSeparate(newctx->gl_blend_src_rgb[0],
+                                      newctx->gl_blend_dst_rgb[0],
+                                      newctx->gl_blend_src_alpha[0],
+                                      newctx->gl_blend_dst_alpha[0]))
+               }
+               if ((oldctx->gl_blend_equation_rgb[0] != newctx->gl_blend_equation_rgb[0]) ||
+                   (oldctx->gl_blend_equation_alpha[0] != newctx->gl_blend_equation_alpha[0]))
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glBlendEquationSeparate(newctx->gl_blend_equation_rgb[0], newctx->gl_blend_equation_alpha[0]))
+               }
+
+       }
+
+       //------------------//
+       // _stencil_flag1
+       flag = oldctx->_stencil_flag1 | newctx->_stencil_flag1;
+       if (flag)
+       {
+               if ((oldctx->gl_stencil_func[0] != newctx->gl_stencil_func[0]) ||
+                   (oldctx->gl_stencil_ref[0]  != newctx->gl_stencil_ref[0])  ||
+                   (oldctx->gl_stencil_value_mask[0] != newctx->gl_stencil_value_mask[0]))
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glStencilFuncSeparate(GL_FRONT,
+                                      newctx->gl_stencil_func[0],
+                                      newctx->gl_stencil_ref[0],
+                                      newctx->gl_stencil_value_mask[0]))
+               }
+               if ((oldctx->gl_stencil_fail[0] != newctx->gl_stencil_fail[0]) ||
+                   (oldctx->gl_stencil_pass_depth_fail[0] != newctx->gl_stencil_pass_depth_fail[0]) ||
+                   (oldctx->gl_stencil_pass_depth_pass[0] != newctx->gl_stencil_pass_depth_pass[0]))
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glStencilOpSeparate(GL_FRONT,
+                                      newctx->gl_stencil_fail[0],
+                                      newctx->gl_stencil_pass_depth_fail[0],
+                                      newctx->gl_stencil_pass_depth_pass[0]))
+               }
+
+               STATE_COMPARE(gl_stencil_writemask[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glStencilMaskSeparate(GL_FRONT, newctx->gl_stencil_writemask[0]))
+               }
+       }
+
+
+       // _stencil_flag1
+       flag = oldctx->_stencil_flag2 | newctx->_stencil_flag2;
+       if (flag)
+       {
+               if ((oldctx->gl_stencil_back_func[0] != newctx->gl_stencil_back_func[0]) ||
+                   (oldctx->gl_stencil_back_ref[0]  != newctx->gl_stencil_back_ref[0])  ||
+                   (oldctx->gl_stencil_back_value_mask[0] != newctx->gl_stencil_back_value_mask[0]))
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glStencilFuncSeparate(GL_BACK,
+                                      newctx->gl_stencil_back_func[0],
+                                      newctx->gl_stencil_back_ref[0],
+                                      newctx->gl_stencil_back_value_mask[0]))
+               }
+               if ((oldctx->gl_stencil_back_fail[0] != newctx->gl_stencil_back_fail[0]) ||
+                   (oldctx->gl_stencil_back_pass_depth_fail[0] != newctx->gl_stencil_back_pass_depth_fail[0]) ||
+                   (oldctx->gl_stencil_back_pass_depth_pass[0] != newctx->gl_stencil_back_pass_depth_pass[0]))
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glStencilOpSeparate(GL_BACK,
+                                      newctx->gl_stencil_back_fail[0],
+                                      newctx->gl_stencil_back_pass_depth_fail[0],
+                                      newctx->gl_stencil_back_pass_depth_pass[0]))
+               }
+
+               STATE_COMPARE(gl_stencil_back_writemask[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glStencilMaskSeparate(GL_BACK, newctx->gl_stencil_back_writemask[0]))
+               }
+               STATE_COMPARE(gl_stencil_clear_value[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glClearStencil(newctx->gl_stencil_clear_value[0]))
+               }
+       }
+
+       //------------------//
+       // _pixel_flag1
+       flag = oldctx->_pixel_flag1 | newctx->_pixel_flag1;
+       if (flag)
+       {
+               STATE_COMPARE(gl_pack_row_length[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glPixelStorei(GL_PACK_ROW_LENGTH, newctx->gl_pack_row_length[0]))
+               }
+               STATE_COMPARE(gl_pack_skip_rows[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glPixelStorei(GL_PACK_SKIP_ROWS, newctx->gl_pack_skip_rows[0]))
+               }
+               STATE_COMPARE(gl_pack_skip_pixels[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glPixelStorei(GL_PACK_SKIP_PIXELS, newctx->gl_pack_skip_pixels[0]))
+               }
+               STATE_COMPARE(gl_pack_alignment[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glPixelStorei(GL_PACK_ALIGNMENT, newctx->gl_pack_alignment[0]))
+               }
+       }
+
+       // _pixel_flag2
+       flag = oldctx->_pixel_flag2 | newctx->_pixel_flag2;
+       if (flag)
+       {
+               STATE_COMPARE(gl_unpack_row_length[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glPixelStorei(GL_UNPACK_ROW_LENGTH, newctx->gl_unpack_row_length[0]))
+               }
+               STATE_COMPARE(gl_unpack_skip_rows[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glPixelStorei(GL_UNPACK_SKIP_ROWS, newctx->gl_unpack_skip_rows[0]))
+               }
+               STATE_COMPARE(gl_unpack_skip_pixels[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glPixelStorei(GL_UNPACK_SKIP_PIXELS, newctx->gl_unpack_skip_pixels[0]))
+               }
+               STATE_COMPARE(gl_unpack_alignment[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glPixelStorei(GL_UNPACK_ALIGNMENT, newctx->gl_unpack_alignment[0]))
+               }
+               STATE_COMPARE(gl_unpack_image_height[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, newctx->gl_unpack_image_height[0]))
+               }
+               STATE_COMPARE(gl_unpack_skip_images[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glPixelStorei(GL_UNPACK_SKIP_IMAGES, newctx->gl_unpack_skip_images[0]))
+               }
+       }
+
+       //------------------//
+       // _misc_flag1
+       flag = oldctx->_misc_flag1 | newctx->_misc_flag1;
+       if (flag)
+       {
+               STATE_COMPARE(gl_front_face[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glFrontFace(newctx->gl_front_face[0]))
+               }
+               STATE_COMPARE(gl_line_width[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glLineWidth(newctx->gl_line_width[0]))
+               }
+               if ((oldctx->gl_polygon_offset_factor[0] != newctx->gl_polygon_offset_factor[0]) ||
+                   (oldctx->gl_polygon_offset_units[0]  != newctx->gl_polygon_offset_units[0]))
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glPolygonOffset(newctx->gl_polygon_offset_factor[0],
+                                      newctx->gl_polygon_offset_units[0]))
+               }
+               if ((oldctx->gl_sample_coverage_value[0]  != newctx->gl_sample_coverage_value[0]) ||
+                   (oldctx->gl_sample_coverage_invert[0] != newctx->gl_sample_coverage_invert[0]))
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glSampleCoverage(newctx->gl_sample_coverage_value[0],
+                                      newctx->gl_sample_coverage_invert[0]))
+               }
+               STATE_COMPARE(gl_fragment_shader_derivative_hint[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glHint(GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES, newctx->gl_fragment_shader_derivative_hint[0]))
+               }
+       }
+
+       // _misc_flag2
+       flag = oldctx->_misc_flag2 | newctx->_misc_flag2;
+       if (flag)
+       {
+               STATES_COMPARE(gl_scissor_box, 4 * sizeof(GLint))
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glScissor(newctx->gl_scissor_box[0],
+                                                               newctx->gl_scissor_box[1],
+                                                               newctx->gl_scissor_box[2],
+                                                               newctx->gl_scissor_box[3]))
+               }
+       }
+
+       // _misc_flag3
+       flag = oldctx->_misc_flag3 | newctx->_misc_flag3;
+       if (flag)
+       {
+               STATE_COMPARE(gl_read_buffer[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glReadBuffer(newctx->gl_read_buffer[0]))
+               }
+               STATES_COMPARE(gl_draw_buffers, 16 * sizeof(GLenum))
+               {
+                       int drawBuffSize = 16;
+                       /* If the  context has only default framebuffer, then size of glDrawBuffers can only be 1 */
+                       if(fastpath_ostate_has_object_type(&newctx->ostate, GL_OBJECT_TYPE_FRAMEBUFFER) == 0) {
+                               drawBuffSize = 1;
+                       }
+
+                       CHECK_GL_ERROR(_orig_fastpath_glDrawBuffers(drawBuffSize, newctx->gl_draw_buffers))
+               }
+               STATE_COMPARE(gl_vertex_array_binding[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glBindVertexArray(newctx->gl_vertex_array_binding[0]))
+               }
+
+               if (oldctx->gl_transform_feedback_active[0] == GL_TRUE && oldctx->gl_transform_feedback_paused[0] == GL_FALSE)
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glPauseTransformFeedback())
+               }
+               STATE_COMPARE(gl_transform_feedback_binding[0])
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, newctx->gl_transform_feedback_binding[0]))
+               }
+               if (newctx->gl_transform_feedback_active[0] == GL_TRUE && newctx->gl_transform_feedback_paused[0] == GL_FALSE)
+               {
+                       CHECK_GL_ERROR(_orig_fastpath_glResumeTransformFeedback())
+               }
+       }
+
+#ifdef COREGL_USE_MODULE_TRACEPATH
+       tracepath_api_trace_end("eglMakeCurrent(FP etc.)", trace_hint_etc, 0);
+#endif // COREGL_USE_MODULE_TRACEPATH
+
+       ret = 1;
+       goto finish;
+
+finish:
+
+#ifdef COREGL_FASTPATH_TRACE_STATE_INFO
+       if (unlikely(trace_state_flag == 1))
+               fastpath_dump_context_states(newctx, 0);
+#endif // COREGL_FASTPATH_TRACE_STATE_INFO
+       return ret;
+#undef STATE_COMPARE
+#undef STATES_COMPARE
+}
+
diff --git a/src/modules/fastpath/coregl_fastpath.h b/src/modules/fastpath/coregl_fastpath.h
new file mode 100644 (file)
index 0000000..dbc902b
--- /dev/null
@@ -0,0 +1,405 @@
+#ifndef COREGL_FASTPATH_H
+#define COREGL_FASTPATH_H
+
+#include "../coregl_module.h"
+
+#ifndef COREGL_USE_MODULE_FASTPATH
+#error "COREGL_USE_MODULE_FASTPATH must defined!!!"
+#endif
+
+#define MY_MODULE_ID              COREGL_MODULE_FASTPATH
+#define MY_MODULE_TSTATE         Fastpath_ThreadState
+
+#include "../../coregl_internal.h"
+#include "../../coregl_export.h"
+
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     extern RET_TYPE (*_orig_fastpath_##FUNC_NAME) PARAM_LIST;
+# include "../../headers/sym.h"
+#undef _COREGL_SYMBOL
+
+// Symbol definition for fastpath
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     extern RET_TYPE (fastpath_##FUNC_NAME) PARAM_LIST;
+# include "../../headers/sym.h"
+#undef _COREGL_SYMBOL
+
+#define COREGL_FASTPATH_TRACE_ALL
+
+#ifdef COREGL_FASTPATH_TRACE_ALL
+#define COREGL_FASTPATH_TRACE_CONTEXT_INFO   // Context state & thread state & Glue-context info
+#define COREGL_FASTPATH_TRACE_STATE_INFO     // Glue-context state info
+#endif
+
+
+#define _COREGL_FASTPATH_FUNC_BEGIN()
+
+#define _COREGL_FASTPATH_FUNC_END()
+
+
+#define FLAG_BIT_0      0x01
+#define FLAG_BIT_1      0x02
+#define FLAG_BIT_2      0x04
+#define FLAG_BIT_3      0x08
+#define FLAG_BIT_4      0x10
+#define FLAG_BIT_5      0x20
+#define FLAG_BIT_6      0x40
+#define FLAG_BIT_7      0x80
+
+#define MAX_TEXTURE_UNITS 32
+#define MAX_VERTEX_ATTRIBS 64
+#define MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 64
+#define MAX_UNIFORM_BUFFER_BINDINGS 64
+
+typedef enum _Fastpath_Opt_Flag
+{
+    FP_UNKNOWN_PATH,
+    FP_NORMAL_PATH,
+    FP_FAST_PATH
+} Fastpath_Opt_Flag;
+
+extern Fastpath_Opt_Flag   fp_opt;
+extern int                 debug_nofp;
+
+typedef struct _GLContextState
+{
+       int                      ref_count;
+       GLContext               *rctx;
+       GLDisplay               *rdpy;
+       void                    *data;
+} GLContextState;
+
+typedef struct _Fastpath_ThreadState
+{
+       EGLenum                  binded_api;
+       GLContextState          *cstate;
+       GLSurface               *rsurf_draw;
+       GLSurface               *rsurf_read;
+} Fastpath_ThreadState;
+
+typedef struct _GLContext_List
+{
+       void                    *option;
+       int                      option_len;
+       int                      thread_id;
+       GLContextState          *cstate;
+       struct _GLContext_List *next;
+} GLContext_List;
+
+extern GLContext_List      *glctx_list;
+
+extern Mutex                ctx_list_access_mutex;
+
+typedef struct
+{
+       GLuint   tex_id;
+} GL_Texture_State;
+
+typedef struct
+{
+       GLboolean    modified;
+       GLboolean    enabled;
+       GLuint       buf_id;
+       GLint        size;
+       GLenum       type;
+       GLboolean    normalized;
+       GLsizei      stride;
+       const void  *pointer;
+} GL_Vertex_Array_State;
+
+typedef struct
+{
+       GLboolean   modified;
+       GLfloat     value[4];
+} GL_Vertex_Attrib;
+
+
+#define MAGIC_GLFAST                0x73777770
+#define GL_OBJECT_HASH_BASE        (1 << 10)
+
+#define GL_OBJECT_ID_LIMIT         0xFFFFFF
+
+#define GL_Object_Type                     int
+#define GL_OBJECT_TYPE_QUERY               0x0
+#define GL_OBJECT_TYPE_TEXTURE             0x1000000
+#define GL_OBJECT_TYPE_BUFFER              0x2000000
+#define GL_OBJECT_TYPE_FRAMEBUFFER         0x3000000
+#define GL_OBJECT_TYPE_RENDERBUFFER        0x4000000
+#define GL_OBJECT_TYPE_PROGRAM             0x5000000
+#define GL_OBJECT_TYPE_VERTEXARRAY         0x6000000
+#define GL_OBJECT_TYPE_SAMPLER             0x7000000
+#define GL_OBJECT_TYPE_TRANSFORMFEEDBACK   0x8000000
+#define GL_OBJECT_TYPE_UNKNOWN             0xFFFFFFF
+
+typedef struct _GL_Object
+{
+       GLuint                            id;
+       GLuint                            real_id;
+       GLint                             ref_count;
+       GLvoid                            *tag;
+
+       struct _GL_Shared_Object_State  *parent;
+} GL_Object;
+
+typedef struct _GL_Object_Hash
+{
+       GLuint                           hash_key;
+       GL_Object                        *item;
+       struct _GL_Object_Hash          *next;
+} GL_Object_Hash;
+
+typedef struct _GL_Object_Hash_Base
+{
+       GLuint                            hash_size;
+       GLuint                            item_size;
+       GLuint                            last_id;
+       GLuint                            is_looped;
+       GL_Object_Hash                  **hash_field;
+} GL_Object_Hash_Base;
+
+typedef struct _GL_Shared_Object_State
+{
+       Mutex                    access_mutex;
+       Mutex                    real_access_mutex;
+       int                      ref_count;
+       General_Trace_List      *using_gctxs;
+
+       GL_Object_Hash_Base      texture;
+       GL_Object_Hash_Base      buffer;
+       GL_Object_Hash_Base      renderbuffer;
+       GL_Object_Hash_Base      program;
+       GL_Object_Hash_Base      sampler;
+
+       GL_Object_Hash_Base      texture_real;
+       GL_Object_Hash_Base      buffer_real;
+       GL_Object_Hash_Base      renderbuffer_real;
+       GL_Object_Hash_Base      program_real;
+       GL_Object_Hash_Base      sampler_real;
+} GL_Shared_Object_State;
+
+typedef struct _GL_Object_State
+{
+       GL_Shared_Object_State  *shared;
+
+       GL_Object_Hash_Base      query;
+       GL_Object_Hash_Base      framebuffer;
+       GL_Object_Hash_Base      vertexarray;
+       GL_Object_Hash_Base      transformfeedback;
+
+       GL_Object_Hash_Base      query_real;
+       GL_Object_Hash_Base      framebuffer_real;
+       GL_Object_Hash_Base      vertexarray_real;
+       GL_Object_Hash_Base      transformfeedback_real;
+} GL_Object_State;
+
+typedef struct _GLGlueContext
+{
+       int                     magic;
+       int                     initialized;
+       int                     surface_attached;
+
+       int                                                     ref_count;
+       int                                                     is_destroyed;
+
+       double                  glversion;
+
+       int                                                     used_count;
+
+       GLDisplay              *rdpy;
+       GLContextState         *cstate;
+       int                     thread_id;
+
+       void                   *real_ctx_option;
+       int                     real_ctx_option_len;
+
+       void                   *real_ctx_sharable_option;
+       int                     real_ctx_sharable_option_len;
+
+
+
+
+   unsigned char           _bind_flag1;
+#define _BIND_FLAG1_BIT_gl_array_buffer_binding               FLAG_BIT_0
+#define _BIND_FLAG1_BIT_gl_element_array_buffer_binding       FLAG_BIT_1
+#define _BIND_FLAG1_BIT_gl_framebuffer_binding                FLAG_BIT_2
+#define _BIND_FLAG1_BIT_gl_renderbuffer_binding               FLAG_BIT_3
+#define _BIND_FLAG1_BIT_gl_framebuffer_binding_read           FLAG_BIT_4
+#define _BIND_FLAG1_BIT_gl_framebuffer_binding_draw           FLAG_BIT_5
+
+       unsigned char           _bind_flag2;
+#define _BIND_FLAG2_BIT_gl_copy_read_buffer_binding           FLAG_BIT_0
+#define _BIND_FLAG2_BIT_gl_copy_write_buffer_binding          FLAG_BIT_1
+#define _BIND_FLAG2_BIT_gl_pixel_pack_buffer_binding          FLAG_BIT_2
+#define _BIND_FLAG2_BIT_gl_pixel_unpack_buffer_binding        FLAG_BIT_3
+#define _BIND_FLAG2_BIT_gl_transform_feedback_buffer_binding  FLAG_BIT_4
+#define _BIND_FLAG2_BIT_gl_uniform_buffer_binding             FLAG_BIT_5
+
+       unsigned char           _enable_flag1;
+#define _ENABLE_FLAG1_BIT_gl_blend        FLAG_BIT_0
+#define _ENABLE_FLAG1_BIT_gl_cull_face    FLAG_BIT_1
+#define _ENABLE_FLAG1_BIT_gl_depth_test   FLAG_BIT_2
+#define _ENABLE_FLAG1_BIT_gl_dither       FLAG_BIT_3
+
+       unsigned char           _enable_flag2;
+#define _ENABLE_FLAG2_BIT_gl_polygon_offset_fill       FLAG_BIT_0
+#define _ENABLE_FLAG2_BIT_gl_sample_alpha_to_coverage  FLAG_BIT_1
+#define _ENABLE_FLAG2_BIT_gl_sample_coverage           FLAG_BIT_2
+#define _ENABLE_FLAG2_BIT_gl_scissor_test              FLAG_BIT_3
+#define _ENABLE_FLAG2_BIT_gl_stencil_test              FLAG_BIT_4
+
+       unsigned char           _enable_flag3;
+#define _ENABLE_FLAG3_BIT_gl_primitive_restart_fixed_index  FLAG_BIT_0
+#define _ENABLE_FLAG3_BIT_gl_rasterizer_discard             FLAG_BIT_1
+
+       unsigned char           _clear_flag1;
+#define _CLEAR_FLAG1_BIT_gl_viewport            FLAG_BIT_0
+#define _CLEAR_FLAG1_BIT_gl_current_program     FLAG_BIT_1
+#define _CLEAR_FLAG1_BIT_gl_color_clear_value   FLAG_BIT_2
+
+       unsigned char           _clear_flag2;
+#define _CLEAR_FLAG2_BIT_gl_color_writemask     FLAG_BIT_0
+#define _CLEAR_FLAG2_BIT_gl_depth_range         FLAG_BIT_1
+#define _CLEAR_FLAG2_BIT_gl_depth_clear_value   FLAG_BIT_2
+#define _CLEAR_FLAG2_BIT_gl_depth_func          FLAG_BIT_3
+#define _CLEAR_FLAG2_BIT_gl_depth_writemask     FLAG_BIT_4
+#define _CLEAR_FLAG2_BIT_gl_cull_face_mode      FLAG_BIT_5
+
+       unsigned char           _tex_flag1;
+#define _TEX_FLAG1_BIT_gl_active_texture         FLAG_BIT_0
+#define _TEX_FLAG1_BIT_gl_generate_mipmap_hint   FLAG_BIT_1
+#define _TEX_FLAG1_BIT_gl_tex_2d_state           FLAG_BIT_2
+#define _TEX_FLAG1_BIT_gl_tex_3d_state           FLAG_BIT_3
+#define _TEX_FLAG1_BIT_gl_tex_2d_array_state     FLAG_BIT_4
+#define _TEX_FLAG1_BIT_gl_tex_cube_state         FLAG_BIT_5
+#define _TEX_FLAG1_BIT_gl_tex_external_oes_state FLAG_BIT_6
+
+       unsigned char           _blend_flag;
+#define _BLEND_FLAG_BIT_gl_blend_color           FLAG_BIT_0
+#define _BLEND_FLAG_BIT_gl_blend_src_rgb         FLAG_BIT_1
+#define _BLEND_FLAG_BIT_gl_blend_src_alpha       FLAG_BIT_2
+#define _BLEND_FLAG_BIT_gl_blend_dst_rgb         FLAG_BIT_3
+#define _BLEND_FLAG_BIT_gl_blend_dst_alpha       FLAG_BIT_4
+#define _BLEND_FLAG_BIT_gl_blend_equation_rgb    FLAG_BIT_5
+#define _BLEND_FLAG_BIT_gl_blend_equation_alpha  FLAG_BIT_6
+
+       unsigned char           _stencil_flag1;
+#define _STENCIL_FLAG1_BIT_gl_stencil_func              FLAG_BIT_0
+#define _STENCIL_FLAG1_BIT_gl_stencil_ref               FLAG_BIT_1
+#define _STENCIL_FLAG1_BIT_gl_stencil_value_mask        FLAG_BIT_2
+#define _STENCIL_FLAG1_BIT_gl_stencil_fail              FLAG_BIT_3
+#define _STENCIL_FLAG1_BIT_gl_stencil_pass_depth_fail   FLAG_BIT_4
+#define _STENCIL_FLAG1_BIT_gl_stencil_pass_depth_pass   FLAG_BIT_5
+#define _STENCIL_FLAG1_BIT_gl_stencil_writemask         FLAG_BIT_6
+
+       unsigned char           _stencil_flag2;
+#define _STENCIL_FLAG2_BIT_gl_stencil_back_func              FLAG_BIT_0
+#define _STENCIL_FLAG2_BIT_gl_stencil_back_ref               FLAG_BIT_1
+#define _STENCIL_FLAG2_BIT_gl_stencil_back_value_mask        FLAG_BIT_2
+#define _STENCIL_FLAG2_BIT_gl_stencil_back_fail              FLAG_BIT_3
+#define _STENCIL_FLAG2_BIT_gl_stencil_back_pass_depth_fail   FLAG_BIT_4
+#define _STENCIL_FLAG2_BIT_gl_stencil_back_pass_depth_pass   FLAG_BIT_5
+#define _STENCIL_FLAG2_BIT_gl_stencil_back_writemask         FLAG_BIT_6
+#define _STENCIL_FLAG2_BIT_gl_stencil_clear_value            FLAG_BIT_7
+
+       unsigned char           _pixel_flag1;
+#define _PIXEL_FLAG1_BIT_gl_pack_row_length      FLAG_BIT_0
+#define _PIXEL_FLAG1_BIT_gl_pack_skip_rows       FLAG_BIT_1
+#define _PIXEL_FLAG1_BIT_gl_pack_skip_pixels     FLAG_BIT_2
+#define _PIXEL_FLAG1_BIT_gl_pack_alignment       FLAG_BIT_3
+
+       unsigned char           _pixel_flag2;
+#define _PIXEL_FLAG2_BIT_gl_unpack_row_length      FLAG_BIT_0
+#define _PIXEL_FLAG2_BIT_gl_unpack_skip_rows       FLAG_BIT_1
+#define _PIXEL_FLAG2_BIT_gl_unpack_skip_pixels     FLAG_BIT_2
+#define _PIXEL_FLAG2_BIT_gl_unpack_alignment       FLAG_BIT_3
+#define _PIXEL_FLAG2_BIT_gl_unpack_image_height    FLAG_BIT_4
+#define _PIXEL_FLAG2_BIT_gl_unpack_skip_images     FLAG_BIT_5
+
+       unsigned char           _misc_flag1;
+#define _MISC_FLAG1_BIT_gl_front_face                        FLAG_BIT_0
+#define _MISC_FLAG1_BIT_gl_line_width                        FLAG_BIT_1
+#define _MISC_FLAG1_BIT_gl_polygon_offset_factor             FLAG_BIT_2
+#define _MISC_FLAG1_BIT_gl_polygon_offset_units              FLAG_BIT_3
+#define _MISC_FLAG1_BIT_gl_sample_coverage_value             FLAG_BIT_4
+#define _MISC_FLAG1_BIT_gl_sample_coverage_invert            FLAG_BIT_5
+#define _MISC_FLAG1_BIT_gl_fragment_shader_derivative_hint   FLAG_BIT_6
+
+       unsigned char           _misc_flag2;
+#define _MISC_FLAG2_BIT_gl_scissor_box                       FLAG_BIT_0
+
+       unsigned char           _misc_flag3;
+#define _MISC_FLAG3_BIT_gl_read_buffer                       FLAG_BIT_0
+#define _MISC_FLAG3_BIT_gl_draw_buffers                      FLAG_BIT_1
+#define _MISC_FLAG3_BIT_gl_vertex_array_binding              FLAG_BIT_2
+#define _MISC_FLAG3_BIT_gl_transform_feedback_binding        FLAG_BIT_3
+#define _MISC_FLAG3_BIT_gl_transform_feedback                FLAG_BIT_4
+
+       unsigned char           _vattrib_flag;
+#define _VATTRIB_FLAG_BIT_gl_vertex_attrib_value             FLAG_BIT_0
+#define _VATTRIB_FLAG_BIT_gl_vertex_array                    FLAG_BIT_1
+
+       GL_Object_State         ostate;
+
+       GLenum                  gl_error;
+
+       // General state
+#define GLUE_STATE(TYPE, NAME, SIZE, ARRAY_SIZE, DEFAULT_STMT, GET_STMT)     TYPE NAME[ARRAY_SIZE];
+# include "coregl_fastpath_state.h"
+#undef GLUE_STATE
+#define GLUE_STATE(TYPE, NAME, SIZE, ARRAY_SIZE, DEFAULT_STMT, GET_STMT)     unsigned char NAME##_used;
+# include "coregl_fastpath_state.h"
+#undef GLUE_STATE
+
+} GLGlueContext;
+
+typedef struct _GLGlueContext_List
+{
+       GLGlueContext              *gctx;
+       struct _GLGlueContext_List *prev;
+       struct _GLGlueContext_List *next;
+} GLGlueContext_List;
+
+extern GLGlueContext_List *gctx_list;
+
+extern GLGlueContext *initial_ctx;
+
+extern void                init_modules_fastpath();
+extern void                deinit_modules_fastpath();
+extern void                init_modules_tstate_fastpath(GLThreadState *tstate);
+extern void                deinit_modules_tstate_fastpath(GLThreadState *tstate);
+
+extern void                fastpath_apply_overrides();
+extern void                fastpath_apply_overrides_egl(int enable);
+extern void                fastpath_apply_overrides_gl(int enable);
+
+extern int                 fastpath_init_context_states(GLGlueContext *ctx);
+extern int                 fastpath_make_context_current(GLGlueContext *oldctx, GLGlueContext *newctx);
+
+#ifdef COREGL_FASTPATH_TRACE_STATE_INFO
+extern void                fastpath_dump_context_states(GLGlueContext *ctx, int force_output);
+#endif // COREGL_FASTPATH_TRACE_STATE_INFO
+
+// Context state functions
+extern int                 fastpath_add_context_state_to_list(const void *data, const int datalen, GLContextState *cstate, Mutex *mtx);
+extern int                 fastpath_remove_context_states_from_list(GLContextState *cstate, Mutex *mtx);
+extern GLContextState     *fastpath_get_context_state_from_list(const void *data, const int datalen, Mutex *mtx);
+
+// Shared object state functions
+extern void                fastpath_ostate_init(GL_Object_State *ostate);
+extern void                fastpath_sostate_init(GL_Shared_Object_State *ostate);
+extern void                fastpath_ostate_deinit(GL_Object_State *ostate);
+extern void                fastpath_sostate_deinit(GL_Shared_Object_State *ostate);
+extern GLuint              fastpath_ostate_create_object(GL_Object_State *ostate, GL_Object_Type type, GLuint name);
+extern GLuint              fastpath_ostate_remove_object(GL_Object_State *ostate, GL_Object_Type type, GLuint glue_name);
+extern GLuint              fastpath_ostate_get_object(GL_Object_State *ostate, GL_Object_Type type, GLuint name);
+extern GLuint              fastpath_ostate_find_object(GL_Object_State *ostate, GL_Object_Type type, GLuint real_name);
+extern GLint               fastpath_ostate_use_object(GL_Object_State *ostate, GL_Object_Type type, GLuint glue_name);
+extern GLint               fastpath_ostate_set_object_tag(GL_Object_State *ostate, GL_Object_Type type, GLuint glue_name, GLvoid *tag);
+extern GLvoid             *fastpath_ostate_get_object_tag(GL_Object_State *ostate, GL_Object_Type type, GLuint glue_name);
+
+// GL context management functions
+extern void                fastpath_release_gl_context(GLGlueContext *gctx);
+
+// State query functions
+extern void                fastpath_state_get_draw_buffers(GLenum *params);
+
+#endif // COREGL_FASTPATH_H
+
diff --git a/src/modules/fastpath/coregl_fastpath_egl.c b/src/modules/fastpath/coregl_fastpath_egl.c
new file mode 100644 (file)
index 0000000..6b3ebab
--- /dev/null
@@ -0,0 +1,1565 @@
+#include "coregl_fastpath.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <execinfo.h>
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <signal.h>
+#include <assert.h>
+
+#ifdef COREGL_FASTPATH_TRACE_CONTEXT_INFO
+
+General_Trace_List *glue_ctx_trace_list = NULL;
+General_Trace_List *context_state_trace_list = NULL;
+
+static void
+_dump_context_info(const char *ment, int force_output)
+{
+       MY_MODULE_TSTATE *tstate = NULL;
+       static struct timeval tv_last = { 0, 0 };
+
+       if (trace_ctx_flag != 1) return;
+
+       AST(mutex_lock(&ctx_list_access_mutex) == 1);
+       AST(mutex_lock(&general_trace_lists_access_mutex) == 1);
+
+       if (!force_output && !trace_ctx_force_flag)
+       {
+               struct timeval tv_now = { 0, 0 };
+               AST(gettimeofday(&tv_now, NULL) == 0);
+               if (tv_now.tv_sec - tv_last.tv_sec < _COREGL_TRACE_OUTPUT_INTERVAL_SEC)
+               {
+                       goto finish;
+               }
+               tv_last = tv_now;
+       }
+
+       GET_MY_TSTATE(tstate, get_current_thread_state());
+
+       TRACE("\n");
+       TRACE("\E[40;34m========================================================================================================================\E[0m\n");
+       TRACE("\E[40;32;1m  Context info \E[1;37;1m: <PID = %d> %s\E[0m\n", getpid(), ment);
+       TRACE("\E[40;34m========================================================================================================================\E[0m\n");
+
+
+       // Thread State List
+       {
+               General_Trace_List *current = NULL;
+               current = thread_trace_list;
+
+               while (current != NULL)
+               {
+                       GLThreadState *cur_tstate = (GLThreadState *)current->value;
+                       MY_MODULE_TSTATE *cur_tstate_tm = NULL;
+
+                       GET_MY_TSTATE(cur_tstate_tm, cur_tstate);
+                       AST(cur_tstate_tm != NULL);
+
+                       TRACE(" %c Thread  [0x%12x] : Surf <D=[%12p] R=[%12p]>",
+                             (tstate == cur_tstate_tm) ? '*' : ' ',
+                             cur_tstate->thread_id,
+                             cur_tstate_tm->rsurf_draw,
+                             cur_tstate_tm->rsurf_read);
+
+                       if (cur_tstate_tm->cstate != NULL)
+                       {
+                               TRACE(" GlueCTX=[%12p] RealCTX=[%12p]\E[0m\n",
+                                     cur_tstate_tm->cstate->data,
+                                     cur_tstate_tm->cstate);
+                       }
+                       else
+                       {
+                               TRACE(" (NOT BINDED TO THREAD)\E[0m\n");
+                       }
+
+                       // Binded Context State List
+                       {
+                               General_Trace_List *current = NULL;
+                               current = context_state_trace_list;
+
+                               while (current != NULL)
+                               {
+                                       GLContextState *cur_cstate = (GLContextState *)current->value;
+                                       MY_MODULE_TSTATE *cur_tstate_tm = NULL;
+
+                                       GET_MY_TSTATE(cur_tstate_tm, cur_tstate);
+                                       AST(cur_tstate_tm != NULL);
+
+                                       if (cur_tstate_tm->cstate == cur_cstate)
+                                       {
+                                               TRACE("   -> RealCTX [%12p] : EGLDPY=[%12p] EGLCTX=[%12p] <[%2d] GlueCTXs>\E[0m\n",
+                                                     cur_cstate,
+                                                     cur_cstate->rdpy,
+                                                     cur_cstate->rctx,
+                                                     cur_cstate->ref_count);
+
+                                               // Binded Glue Context List
+                                               {
+                                                       General_Trace_List *current = NULL;
+                                                       current = glue_ctx_trace_list;
+
+                                                       while (current != NULL)
+                                                       {
+                                                               GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
+
+                                                               if (cur_gctx->cstate == cur_cstate)
+                                                               {
+                                                                       TRACE("    -%c GlueCTX [%12p] : EGLDPY=[%12p] TID=[%12d] <MC count [%10d]>",
+                                                                             (cur_cstate->data == cur_gctx) ? '>' : '-',
+                                                                             cur_gctx,
+                                                                             cur_gctx->rdpy,
+                                                                             cur_gctx->thread_id,
+                                                                             cur_gctx->used_count);
+
+                                                                       TRACE(" <Ref [%2d]>\E[0m\n", cur_gctx->ref_count);
+                                                               }
+
+                                                               current = current->next;
+                                                       }
+                                               }
+                                       }
+
+                                       current = current->next;
+                               }
+
+                       }
+
+
+                       current = current->next;
+               }
+       }
+
+       TRACE("\E[40;33m........................................................................................................................\E[0m\n");
+
+       // Not-binded Context State List
+       {
+               General_Trace_List *current = NULL;
+               current = context_state_trace_list;
+
+               while (current != NULL)
+               {
+                       GLContextState *cur_cstate = (GLContextState *)current->value;
+
+                       int isbinded = 0;
+
+                       if (cur_cstate->data != NULL)
+                       {
+                               General_Trace_List *current_t = NULL;
+                               current_t = thread_trace_list;
+
+                               while (current_t != NULL)
+                               {
+                                       GLThreadState *cur_tstate = (GLThreadState *)current_t->value;
+                                       MY_MODULE_TSTATE *cur_tstate_tm = NULL;
+
+                                       GET_MY_TSTATE(cur_tstate_tm, cur_tstate);
+                                       AST(cur_tstate_tm != NULL);
+
+                                       if (cur_tstate->thread_id == ((GLGlueContext *)cur_cstate->data)->thread_id)
+                                       {
+                                               if (cur_tstate_tm->cstate == cur_cstate)
+                                                       isbinded = 1;
+                                               break;
+                                       }
+                                       current_t = current_t->next;
+                               }
+                       }
+
+                       if (isbinded == 0)
+                       {
+                               TRACE("   RealCTX   [%12p] : EGLDPY=[%12p] EGLCTX=[%12p] <[%2d] GlueCTXs>\E[0m\n",
+                                     cur_cstate,
+                                     cur_cstate->rdpy,
+                                     cur_cstate->rctx,
+                                     cur_cstate->ref_count);
+
+                               // Binded Glue Context List
+                               {
+                                       General_Trace_List *current = NULL;
+                                       current = glue_ctx_trace_list;
+
+                                       while (current != NULL)
+                                       {
+                                               GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
+
+                                               if (cur_gctx->cstate == cur_cstate)
+                                               {
+                                                       TRACE("    -%c GlueCTX [%12p] : EGLDPY=[%12p] TID=[%12d] <MC count [%10d]>",
+                                                             (cur_cstate->data == cur_gctx) ? '>' : '-',
+                                                             cur_gctx,
+                                                             cur_gctx->rdpy,
+                                                             cur_gctx->thread_id,
+                                                             cur_gctx->used_count);
+
+                                                       TRACE(" <Ref [%2d]>\E[0m\n", cur_gctx->ref_count);
+                                               }
+
+                                               current = current->next;
+                                       }
+                               }
+                       }
+
+                       current = current->next;
+               }
+
+       }
+
+       TRACE("\E[40;33m........................................................................................................................\E[0m\n");
+
+       // Not-binded Glue Context List
+       {
+               General_Trace_List *current = NULL;
+               current = glue_ctx_trace_list;
+
+               while (current != NULL)
+               {
+                       GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
+
+                       if (cur_gctx->cstate == NULL)
+                       {
+                               TRACE("   GlueCTX [%12p]   : EGLDPY=[%12p] TID=[%12d] <MC count [%10d]>",
+                                     cur_gctx,
+                                     cur_gctx->rdpy,
+                                     cur_gctx->thread_id,
+                                     cur_gctx->used_count);
+
+                               TRACE(" <Ref [%2d]>\E[0m\n", cur_gctx->ref_count);
+                       }
+
+                       current = current->next;
+               }
+       }
+
+       TRACE("\E[40;34m========================================================================================================================\E[0m\n");
+       TRACE("\n");
+
+       TRACE_END();
+
+       goto finish;
+
+finish:
+
+       AST(mutex_unlock(&general_trace_lists_access_mutex) == 1);
+       AST(mutex_unlock(&ctx_list_access_mutex) == 1);
+
+}
+
+#endif // COREGL_FASTPATH_TRACE_CONTEXT_INFO
+
+
+typedef struct
+{
+       EGLint                        context_major_version;
+       EGLint                        context_minor_version;
+       EGLint                        context_flags;
+       EGLint                        context_opengl_profile_mask;
+       EGLint                        opengl_reset_notification_strategy;
+} EGL_packed_attrib_list;
+
+typedef struct
+{
+       EGLDisplay                    dpy;
+       EGLConfig                     cfg;
+       EGL_packed_attrib_list        attrib_list;
+       EGLint                                                          force_unique;
+} EGL_packed_option;
+
+typedef struct
+{
+       EGLContext                    share_context;
+} EGL_packed_sharable_option;
+
+
+static int
+_pack_egl_context_option(EGL_packed_option *pack_data, EGLDisplay dpy, EGLConfig cfg, EGLint force_unique, const EGLint *attrib_list)
+{
+       static int force_unique_free_id = 0;
+       int ret = 0;
+
+       pack_data->dpy = dpy;
+       pack_data->cfg = cfg;
+       if (force_unique != 0)
+               pack_data->force_unique = force_unique_free_id++;
+
+       // Default context attributes
+       pack_data->attrib_list.context_major_version = EGL_DONT_CARE;
+       pack_data->attrib_list.context_minor_version = EGL_DONT_CARE;
+       pack_data->attrib_list.context_flags = EGL_DONT_CARE;
+       pack_data->attrib_list.context_opengl_profile_mask = EGL_DONT_CARE;
+       pack_data->attrib_list.opengl_reset_notification_strategy = EGL_DONT_CARE;
+
+       // Apply specified attributes
+       EGLint *attrib = (EGLint *)attrib_list;
+       while(attrib[0] != EGL_NONE)
+       {
+               switch(attrib[0])
+               {
+                       case EGL_CONTEXT_MAJOR_VERSION_KHR: // EGL_CONTEXT_CLIENT_VERSION
+                               pack_data->attrib_list.context_major_version = attrib[1];
+                               break;
+                       case EGL_CONTEXT_MINOR_VERSION_KHR:
+                               pack_data->attrib_list.context_minor_version = attrib[1];
+                               break;
+                       case EGL_CONTEXT_FLAGS_KHR:
+                               pack_data->attrib_list.context_flags = attrib[1];
+                               break;
+                       case EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR:
+                               pack_data->attrib_list.context_opengl_profile_mask = attrib[1];
+                               break;
+                       case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR:
+                               pack_data->attrib_list.opengl_reset_notification_strategy = attrib[1];
+                               break;
+                       default:
+                               COREGL_WRN("\E[40;31;1mInvalid context attribute.\E[0m\n");
+                               goto finish;
+               }
+               attrib += 2;
+       }
+
+       // Eject condition for context version
+       if (pack_data->attrib_list.context_major_version != 2)
+       {
+               pack_data->force_unique = force_unique_free_id;
+       }
+
+       ret = 1;
+       goto finish;
+
+finish:
+       return ret;
+}
+
+static int
+_unpack_egl_context_option(EGL_packed_option *pack_data, EGLDisplay *dpy, EGLConfig *cfg, EGLint *force_unique, EGLint *attrib_list, const int attrib_list_size)
+{
+       int ret = 0;
+
+       if (dpy != NULL) *dpy = pack_data->dpy;
+       if (cfg != NULL) *cfg = pack_data->cfg;
+       if (force_unique != NULL) *force_unique = pack_data->force_unique;
+
+       if (attrib_list != NULL && attrib_list_size > 0)
+       {
+               int attrib_list_index = 0;
+
+               memset(attrib_list, 0x00, sizeof(int) * attrib_list_size);
+
+               if (pack_data->attrib_list.context_major_version != EGL_DONT_CARE)
+               {
+                       AST(attrib_list_index + 2 < attrib_list_size);
+                       attrib_list[attrib_list_index] = EGL_CONTEXT_MAJOR_VERSION_KHR;
+                       attrib_list[attrib_list_index + 1] = pack_data->attrib_list.context_major_version;
+                       attrib_list_index += 2;
+               }
+               if (pack_data->attrib_list.context_minor_version != EGL_DONT_CARE)
+               {
+                       AST(attrib_list_index + 2 < attrib_list_size);
+                       attrib_list[attrib_list_index] = EGL_CONTEXT_MINOR_VERSION_KHR;
+                       attrib_list[attrib_list_index + 1] = pack_data->attrib_list.context_minor_version;
+                       attrib_list_index += 2;
+               }
+               if (pack_data->attrib_list.context_flags != EGL_DONT_CARE)
+               {
+                       AST(attrib_list_index + 2 < attrib_list_size);
+                       attrib_list[attrib_list_index] = EGL_CONTEXT_FLAGS_KHR;
+                       attrib_list[attrib_list_index + 1] = pack_data->attrib_list.context_flags;
+                       attrib_list_index += 2;
+               }
+               if (pack_data->attrib_list.context_opengl_profile_mask != EGL_DONT_CARE)
+               {
+                       AST(attrib_list_index + 2 < attrib_list_size);
+                       attrib_list[attrib_list_index] = EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR;
+                       attrib_list[attrib_list_index + 1] = pack_data->attrib_list.context_opengl_profile_mask;
+                       attrib_list_index += 2;
+               }
+               if (pack_data->attrib_list.opengl_reset_notification_strategy != EGL_DONT_CARE)
+               {
+                       AST(attrib_list_index + 2 < attrib_list_size);
+                       attrib_list[attrib_list_index] = EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR;
+                       attrib_list[attrib_list_index + 1] = pack_data->attrib_list.opengl_reset_notification_strategy;
+                       attrib_list_index += 2;
+               }
+
+               attrib_list[attrib_list_index] = EGL_NONE;
+       }
+       ret = 1;
+       goto finish;
+
+finish:
+       return ret;
+}
+
+static int
+_pack_egl_context_sharable_option(EGL_packed_sharable_option *pack_data, EGLContext share_context)
+{
+       int ret = 0;
+
+       pack_data->share_context = share_context;
+
+       ret = 1;
+       goto finish;
+
+finish:
+       return ret;
+}
+
+#if 0
+static int
+_unpack_egl_context_sharable_option(EGL_packed_sharable_option *pack_data, EGLContext *share_context)
+{
+       int ret = 0;
+
+       if (share_context != NULL) *share_context = pack_data->share_context;
+
+       ret = 1;
+       goto finish;
+
+finish:
+       return ret;
+}
+#endif
+
+static void
+_link_context_state(GLGlueContext *gctx, GLContextState *cstate)
+{
+       AST(gctx->cstate == NULL);
+       cstate->ref_count++;
+       gctx->cstate = cstate;
+}
+
+static void
+_unlink_context_state(GLGlueContext *gctx, Mutex *ctx_list_mtx)
+{
+       GLContextState *cstate = NULL;
+
+       cstate = gctx->cstate;
+       AST(cstate != NULL);
+
+       cstate->ref_count--;
+       AST(cstate->ref_count >= 0);
+
+       if (cstate->ref_count == 0)
+       {
+               MY_MODULE_TSTATE *tstate = NULL;
+
+               AST(cstate->data == NULL || cstate->data == initial_ctx);
+
+#ifdef COREGL_FASTPATH_TRACE_CONTEXT_INFO
+               if (unlikely(trace_ctx_flag == 1))
+                       remove_from_general_trace_list(&context_state_trace_list, cstate);
+#endif // COREGL_FASTPATH_TRACE_CONTEXT_INFO
+
+               AST(fastpath_remove_context_states_from_list(cstate, ctx_list_mtx) == 1);
+
+               GET_MY_TSTATE(tstate, get_current_thread_state());
+               if (tstate != NULL)
+               {
+                       if (tstate->cstate == cstate)
+                       {
+                               _orig_fastpath_eglMakeCurrent(cstate->rdpy, tstate->rsurf_draw, tstate->rsurf_read, EGL_NO_CONTEXT);
+                               tstate->cstate = NULL;
+                       }
+               }
+               _orig_fastpath_eglDestroyContext(cstate->rdpy, cstate->rctx);
+               free(cstate);
+               cstate = NULL;
+       }
+}
+
+static void
+_add_shared_obj_state_ref(GLGlueContext *gctx, GL_Shared_Object_State *sostate)
+{
+       AST(sostate->ref_count >= 0);
+       sostate->ref_count++;
+       add_to_general_trace_list(&sostate->using_gctxs, gctx);
+}
+
+static void
+_remove_shared_obj_state_ref(GLGlueContext *gctx, GL_Shared_Object_State *sostate)
+{
+       remove_from_general_trace_list(&sostate->using_gctxs, gctx);
+
+       // Restore attached states
+       fastpath_release_gl_context(gctx);
+
+       AST(sostate->ref_count > 0);
+       sostate->ref_count--;
+       if (sostate->ref_count == 0)
+       {
+               fastpath_sostate_deinit(sostate);
+               free(sostate);
+       }
+}
+
+static void
+_add_context_ref(GLGlueContext *gctx)
+{
+       if (gctx == initial_ctx) return;
+
+       AST(gctx->ref_count >= 0);
+       gctx->ref_count++;
+}
+
+static void
+_remove_context_ref(GLGlueContext *gctx, Mutex *ctx_list_mtx)
+{
+       if (gctx == initial_ctx) return;
+
+       AST(gctx->ref_count > 0);
+       gctx->ref_count--;
+       if (gctx->ref_count == 0)
+       {
+#ifdef COREGL_FASTPATH_TRACE_CONTEXT_INFO
+               if (unlikely(trace_ctx_flag == 1))
+                       remove_from_general_trace_list(&glue_ctx_trace_list, gctx);
+#endif // COREGL_FASTPATH_TRACE_CONTEXT_INFO
+
+               AST(gctx->cstate != NULL);
+               if (gctx->cstate->data == gctx)
+                       gctx->cstate->data = NULL;
+
+               _unlink_context_state(gctx, ctx_list_mtx);
+
+               AST(gctx->ostate.shared != NULL);
+               _remove_shared_obj_state_ref(gctx, gctx->ostate.shared);
+               gctx->ostate.shared = NULL;
+
+               fastpath_ostate_deinit(&gctx->ostate);
+
+               if (gctx->real_ctx_option != NULL)
+               {
+                       free(gctx->real_ctx_option);
+                       gctx->real_ctx_option = NULL;
+               }
+               if (gctx->real_ctx_sharable_option != NULL)
+               {
+                       free(gctx->real_ctx_sharable_option);
+                       gctx->real_ctx_sharable_option = NULL;
+               }
+               free(gctx);
+
+               {
+                       GLGlueContext_List *current = NULL;
+
+                       AST(mutex_lock(&ctx_list_access_mutex) == 1);
+
+                       current = gctx_list;
+
+                       while (current != NULL)
+                       {
+                               if (current->gctx == gctx)
+                               {
+                                       if (current->next != NULL)
+                                               current->next->prev = current->prev;
+
+                                       if (current->prev != NULL)
+                                               current->prev->next = current->next;
+                                       else
+                                               gctx_list = current->next;
+
+                                       free(current);
+
+                                       break;
+                               }
+                               current = current->next;
+                       }
+
+                       AST(mutex_unlock(&ctx_list_access_mutex) == 1);
+               }
+       }
+}
+
+static int
+_bind_context_state(GLGlueContext *gctx, GLContextState *cstate, Mutex *ctx_list_mtx)
+{
+       if (gctx != NULL)
+       {
+               AST(gctx->cstate == cstate);
+       }
+
+       if (cstate->data != gctx)
+       {
+               GLGlueContext *curctx = (GLGlueContext *)cstate->data;
+               GLGlueContext *newctx = gctx;
+
+               if (newctx == NULL)
+                       newctx = initial_ctx;
+
+               if (curctx == NULL)
+                       curctx = initial_ctx;
+
+               AST(newctx != NULL);
+               AST(curctx != NULL);
+
+               if (!fastpath_make_context_current(curctx, newctx))
+                       return 0;
+
+               cstate->data = (void *)newctx;
+               _remove_context_ref(curctx, ctx_list_mtx);
+               _add_context_ref(newctx);
+       }
+
+       return 1;
+
+}
+
+GLContextState *
+_egl_create_context(EGL_packed_option *real_ctx_option, GLContextState **cstate_new, EGLContext *ctx,
+                    EGLDisplay dpy, EGLConfig config, const EGLint* attrib_list)
+{
+       GLContextState *cstate = NULL;
+
+       AST(real_ctx_option != NULL);
+       AST(cstate_new != NULL);
+       AST(ctx != NULL);
+
+       // Pack context option
+       AST(_pack_egl_context_option(real_ctx_option, dpy, config, 0, attrib_list) == 1);
+
+       if (debug_nofp == 1)
+       {
+               AST(_pack_egl_context_option(real_ctx_option, dpy, config, 1, attrib_list) == 1);
+       }
+
+       // Find context state
+       if (real_ctx_option->force_unique == 0)
+       {
+               cstate = fastpath_get_context_state_from_list(real_ctx_option, sizeof(EGL_packed_option), &ctx_list_access_mutex);
+       }
+
+       // Create a real context if it hasn't been created
+       if (cstate == NULL)
+       {
+               EGLContext *real_share_context = EGL_NO_CONTEXT;
+
+               AST(mutex_lock(&ctx_list_access_mutex) == 1);
+               {
+                       GLContext_List *current = NULL;
+
+                       current = glctx_list;
+                       while (current != NULL)
+                       {
+                               EGLDisplay cur_dpy = EGL_NO_DISPLAY;
+                               AST(_unpack_egl_context_option(current->option, &cur_dpy, NULL, NULL, NULL, 0) == 1);
+                               if (cur_dpy == dpy)
+                               {
+                                       AST(current->cstate != NULL);
+                                       real_share_context = current->cstate->rctx;
+                                       break;
+                               }
+                               current = current->next;
+                       }
+               }
+               AST(mutex_unlock(&ctx_list_access_mutex) == 1);
+
+               *ctx = _orig_fastpath_eglCreateContext(dpy, config, real_share_context, attrib_list);
+
+               if (*ctx == EGL_NO_CONTEXT)
+               {
+                       COREGL_WRN("\E[40;31;1mFailed creating a egl real context for Fastpath. (Invalid config?)\E[0m\n");
+                       goto finish;
+               }
+
+               *cstate_new = (GLContextState *)calloc(1, sizeof(GLContextState));
+               if (*cstate_new == NULL)
+               {
+                       COREGL_ERR("\E[40;31;1mError creating a new context state. (Memory full)\E[0m\n");
+                       goto finish;
+               }
+               (*cstate_new)->rctx = *ctx;
+               (*cstate_new)->rdpy = dpy;
+               (*cstate_new)->data = NULL;
+
+               AST(fastpath_add_context_state_to_list(real_ctx_option, sizeof(EGL_packed_option), *cstate_new, &ctx_list_access_mutex) == 1);
+
+#ifdef COREGL_FASTPATH_TRACE_CONTEXT_INFO
+               if (unlikely(trace_ctx_flag == 1))
+                       add_to_general_trace_list(&context_state_trace_list, *cstate_new);
+#endif // COREGL_FASTPATH_TRACE_CONTEXT_INFO
+
+               cstate = *cstate_new;
+       }
+
+       goto finish;
+
+finish:
+       return cstate;
+
+}
+
+
+extern EGLBoolean (*ovr_eglBindAPI)(EGLenum api);
+extern EGLenum (*ovr_eglQueryAPI)(void);
+
+EGLBoolean
+fastpath_eglBindAPI(EGLenum api)
+{
+       EGLBoolean ret = EGL_FALSE;
+       MY_MODULE_TSTATE *tstate = NULL;
+
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       if (fp_opt == FP_UNKNOWN_PATH)
+       {
+               COREGL_ERR("\E[40;31;1mInvalid library link! (CoreGL path option is invalid)\E[0m\n");
+               goto finish;
+       }
+
+       ret = _orig_fastpath_eglBindAPI(api);
+
+       GET_MY_TSTATE(tstate, get_current_thread_state());
+       if (tstate == NULL)
+       {
+               AST(init_new_thread_state() == 1);
+
+               GET_MY_TSTATE(tstate, get_current_thread_state());
+               AST(tstate != NULL);
+       }
+
+        /* Prevent CID : 403951 */
+        if (tstate != NULL)
+       {
+               EGLenum newapi = _orig_fastpath_eglQueryAPI();
+               if (tstate->binded_api != EGL_OPENGL_ES_API)
+               {
+                       tstate->binded_api = newapi;
+               }
+       }
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+       return ret;
+}
+
+EGLenum
+fastpath_eglQueryAPI(void)
+{
+       EGLenum ret = 0;
+       MY_MODULE_TSTATE *tstate = NULL;
+
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       if (fp_opt == FP_UNKNOWN_PATH)
+       {
+               COREGL_ERR("\E[40;31;1mInvalid library link! (CoreGL path option is invalid)\E[0m\n");
+               goto finish;
+       }
+
+       ret = _orig_fastpath_eglQueryAPI();
+
+       GET_MY_TSTATE(tstate, get_current_thread_state());
+       if (tstate != NULL)
+       {
+               AST(tstate->binded_api == ret);
+       }
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+       return ret;
+}
+
+EGLContext
+fastpath_eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint* attrib_list)
+{
+       GLGlueContext *gctx = NULL, *newgctx = NULL;
+       GLGlueContext_List *gctx_list_new = NULL;
+       MY_MODULE_TSTATE *tstate = NULL;
+       GLContextState *cstate = NULL;
+       GLContextState *cstate_new = NULL;
+       GL_Shared_Object_State *sostate_new = NULL;
+       GLContext ctx = NULL;
+
+       EGL_packed_option *real_ctx_option = NULL;
+       EGL_packed_sharable_option *real_ctx_sharable_option = NULL;
+
+       // Special eject condition for binding API
+       GET_MY_TSTATE(tstate, get_current_thread_state());
+       if (tstate != NULL && tstate->binded_api != EGL_OPENGL_ES_API)
+       {
+               return _orig_fastpath_eglCreateContext(dpy, config, share_context, attrib_list);
+       }
+
+       _COREGL_FASTPATH_FUNC_BEGIN();
+
+       real_ctx_option = (EGL_packed_option *)calloc(1, sizeof(EGL_packed_option));
+       if (real_ctx_option == NULL)
+       {
+               COREGL_ERR("\E[40;31;1mError creating a new GLGlueContext(Memory full 1)\E[0m\n");
+               goto finish;
+       }
+       cstate = _egl_create_context(real_ctx_option, &cstate_new, &ctx, dpy, config, attrib_list);
+       AST(cstate != NULL);
+
+       // Pack shared context options
+       real_ctx_sharable_option = (EGL_packed_sharable_option *)calloc(1, sizeof(EGL_packed_sharable_option));
+       if (real_ctx_sharable_option == NULL)
+       {
+               COREGL_ERR("\E[40;31;1mError creating a new GLGlueContext(Memory full 2)\E[0m\n");
+               goto finish;
+       }
+       AST(_pack_egl_context_sharable_option(real_ctx_sharable_option, share_context) == 1);
+
+       // Allocate a new context
+       newgctx = (GLGlueContext *)calloc(1, sizeof(GLGlueContext));
+       if (newgctx == NULL)
+       {
+               COREGL_ERR("\E[40;31;1mError creating a new GLGlueContext(Memory full 3)\E[0m\n");
+               goto finish;
+       }
+
+       newgctx->magic = MAGIC_GLFAST;
+       newgctx->initialized = 0;
+       newgctx->rdpy = dpy;
+       newgctx->thread_id = get_current_thread();
+
+       fastpath_ostate_init(&newgctx->ostate);
+
+       if (share_context != EGL_NO_CONTEXT)
+       {
+               GLGlueContext *shared_gctx = (GLGlueContext *)share_context;
+               AST(shared_gctx->magic == MAGIC_GLFAST);
+               AST(shared_gctx->ostate.shared != NULL);
+               newgctx->ostate.shared = shared_gctx->ostate.shared;
+       }
+       else
+       {
+               sostate_new = (GL_Shared_Object_State *)calloc(1, sizeof(GL_Shared_Object_State));
+               if (sostate_new == NULL)
+               {
+                       COREGL_ERR("\E[40;31;1mError creating a new GLGlueContext(Memory full 4)\E[0m\n");
+                       goto finish;
+               }
+               fastpath_sostate_init(sostate_new);
+               newgctx->ostate.shared = sostate_new;
+       }
+       _add_shared_obj_state_ref(newgctx, newgctx->ostate.shared);
+       newgctx->real_ctx_option = real_ctx_option;
+       newgctx->real_ctx_option_len = sizeof(EGL_packed_option);
+       newgctx->real_ctx_sharable_option = real_ctx_sharable_option;
+       newgctx->real_ctx_sharable_option_len = sizeof(EGL_packed_sharable_option);
+
+       _link_context_state(newgctx, cstate);
+       _add_context_ref(newgctx);
+
+       newgctx->cstate = cstate;
+
+       { // Add glue context to list
+               gctx_list_new = (GLGlueContext_List *)calloc(1, sizeof(GLGlueContext_List));
+               if (gctx_list_new == NULL)
+               {
+                       COREGL_ERR("\E[40;31;1mError creating a new GlGlueContext(Memory full 5)\E[0m\n");
+                       goto finish;
+               }
+
+               AST(mutex_lock(&ctx_list_access_mutex) == 1);
+
+               gctx_list_new->gctx = newgctx;
+
+               gctx_list_new->prev = NULL;
+               gctx_list_new->next = gctx_list;
+               if (gctx_list != NULL)
+                       gctx_list->prev = gctx_list_new;
+
+               gctx_list = gctx_list_new;
+
+               AST(mutex_unlock(&ctx_list_access_mutex) == 1);
+       }
+
+       gctx = newgctx;
+
+#ifdef COREGL_FASTPATH_TRACE_CONTEXT_INFO
+       if (unlikely(trace_ctx_flag == 1))
+       {
+               char ment[256];
+               add_to_general_trace_list(&glue_ctx_trace_list, newgctx);
+
+               snprintf(ment,sizeof(ment), "eglCreateContext completed (GlueCTX=[%12p])", newgctx);
+               _dump_context_info(ment, 1);
+       }
+#endif // COREGL_FASTPATH_TRACE_CONTEXT_INFO
+
+       goto finish;
+
+finish:
+       if (gctx == NULL)
+       {
+               if (ctx != NULL)
+               {
+                       _orig_fastpath_eglDestroyContext(dpy, ctx);
+                       ctx = NULL;
+               }
+               if (sostate_new != NULL)
+               {
+                       free(sostate_new);
+                       sostate_new = NULL;
+               }
+               if (real_ctx_option != NULL)
+               {
+                       free(real_ctx_option);
+                       real_ctx_option = NULL;
+               }
+               if (real_ctx_sharable_option != NULL)
+               {
+                       free(real_ctx_sharable_option);
+                       real_ctx_sharable_option = NULL;
+               }
+               if (cstate_new != NULL)
+               {
+#ifdef COREGL_FASTPATH_TRACE_CONTEXT_INFO
+                       if (unlikely(trace_ctx_flag == 1))
+                               remove_from_general_trace_list(&context_state_trace_list, cstate_new);
+#endif // COREGL_FASTPATH_TRACE_CONTEXT_INFO
+
+                       fastpath_remove_context_states_from_list(cstate_new, &ctx_list_access_mutex);
+                       free(cstate_new);
+                       cstate_new = NULL;
+               }
+               if (gctx_list_new != NULL)
+               {
+                       AST(mutex_lock(&ctx_list_access_mutex) == 1);
+
+                       if (gctx_list_new->next != NULL)
+                               gctx_list_new->next->prev = gctx_list_new->prev;
+
+                       if (gctx_list_new->prev != NULL)
+                               gctx_list_new->prev->next = gctx_list_new->next;
+                       else
+                               gctx_list = gctx_list_new->next;
+
+                       AST(mutex_unlock(&ctx_list_access_mutex) == 1);
+
+                       free(gctx_list_new);
+               }
+               if (newgctx != NULL)
+               {
+                       _remove_context_ref(newgctx, &ctx_list_access_mutex);
+                       free(newgctx);
+                       newgctx = NULL;
+               }
+       }
+
+       _COREGL_FASTPATH_FUNC_END();
+       return (EGLContext)gctx;
+}
+
+EGLBoolean
+fastpath_eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
+{
+       EGLBoolean ret = EGL_FALSE;
+       GLGlueContext *gctx = NULL;
+
+       _COREGL_FASTPATH_FUNC_BEGIN();
+
+       gctx = (GLGlueContext *)ctx;
+
+       if (gctx != NULL && gctx != EGL_NO_CONTEXT)
+       {
+               GLContextState *cstate = NULL;
+
+               if (gctx->magic != MAGIC_GLFAST)
+               {
+                       ret = _orig_fastpath_eglDestroyContext(dpy, ctx);
+                       goto finish;
+               }
+
+               cstate = gctx->cstate;
+               AST(cstate != NULL);
+
+               if (gctx->is_destroyed != 1)
+               {
+                       gctx->is_destroyed = 1;
+                       _remove_context_ref(gctx, &ctx_list_access_mutex);
+               }
+       }
+       else
+       {
+               COREGL_WRN("\E[40;31;1mInvalid destroying context. (no exists)\E[0m\n");
+               ret = EGL_FALSE;
+               goto finish;
+       }
+
+       ret = EGL_TRUE;
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+
+#ifdef COREGL_FASTPATH_TRACE_CONTEXT_INFO
+       if (unlikely(trace_ctx_flag == 1))
+       {
+               char ment[256];
+               snprintf(ment,sizeof(ment), "eglDestroyContext completed (GlueCTX=[%12p])", ctx);
+               _dump_context_info(ment, 1);
+       }
+#endif // COREGL_FASTPATH_TRACE_CONTEXT_INFO
+
+       return ret;
+}
+
+EGLBoolean
+fastpath_eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
+{
+       EGLBoolean ret = EGL_FALSE;
+       EGLContext real_ctx = EGL_NO_CONTEXT;
+
+       _COREGL_FASTPATH_FUNC_BEGIN();
+
+       if (ctx != EGL_NO_CONTEXT)
+       {
+               GLGlueContext *gctx = NULL;
+               gctx = (GLGlueContext *)ctx;
+
+               if (gctx->magic != MAGIC_GLFAST)
+               {
+                       real_ctx = ctx;
+               }
+               else
+               {
+                       AST(gctx->cstate != NULL);
+                       real_ctx = gctx->cstate->rctx;
+               }
+       }
+
+       ret = _orig_fastpath_eglQueryContext(dpy, real_ctx, attribute, value);
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+       return ret;
+}
+
+
+
+EGLBoolean
+fastpath_eglReleaseThread(void)
+{
+       EGLBoolean ret = EGL_FALSE;
+       EGLDisplay dpy = EGL_NO_DISPLAY;
+       MY_MODULE_TSTATE *tstate = NULL;
+
+       GET_MY_TSTATE(tstate, get_current_thread_state());
+
+       // Special eject condition for binding API
+       if (tstate != NULL && tstate->binded_api != EGL_OPENGL_ES_API)
+       {
+               return _orig_fastpath_eglReleaseThread();
+       }
+
+       _COREGL_FASTPATH_FUNC_BEGIN();
+
+       dpy = _orig_fastpath_eglGetCurrentDisplay();
+       AST(dpy != EGL_NO_DISPLAY);
+       fastpath_eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+       ret = _orig_fastpath_eglReleaseThread();
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+       return ret;
+}
+
+EGLDisplay
+fastpath_eglGetCurrentDisplay(void)
+{
+       MY_MODULE_TSTATE *tstate = NULL;
+       EGLDisplay dpy = EGL_NO_DISPLAY;
+
+       GET_MY_TSTATE(tstate, get_current_thread_state());
+
+       if (tstate != NULL)
+       {
+               // Special eject condition for binding API
+               if(tstate->binded_api != EGL_OPENGL_ES_API)
+               {
+                       return _orig_fastpath_eglGetCurrentDisplay();
+               }
+
+               _COREGL_FASTPATH_FUNC_BEGIN();
+
+               if (tstate->cstate != NULL)
+               {
+                       dpy = tstate->cstate->rdpy;
+
+               }
+
+               _COREGL_FASTPATH_FUNC_END();
+
+       }
+
+       goto finish;
+
+finish:
+
+       return dpy;
+}
+
+EGLBoolean
+fastpath_eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
+{
+       EGLBoolean ret = EGL_FALSE;
+       EGLBoolean need_mc = EGL_FALSE;
+       GLGlueContext *gctx = NULL;
+
+       MY_MODULE_TSTATE *tstate = NULL;
+
+       GET_MY_TSTATE(tstate, get_current_thread_state());
+
+       // Special eject condition for binding API
+       if (tstate != NULL && tstate->binded_api != EGL_OPENGL_ES_API)
+       {
+               return _orig_fastpath_eglMakeCurrent(dpy, draw, read, ctx);
+       }
+
+       _COREGL_FASTPATH_FUNC_BEGIN();
+
+       gctx = (GLGlueContext *)ctx;
+
+       if (tstate == NULL)
+       {
+               AST(init_new_thread_state() == 1);
+
+               GET_MY_TSTATE(tstate, get_current_thread_state());
+               AST(tstate != NULL);
+                /* Prevent CID : 395199 */
+                if (tstate == NULL) goto finish;
+       }
+
+       // Special path for context deletion
+       if (ctx == EGL_NO_CONTEXT)
+       {
+               AST(gctx == NULL);
+
+               if (tstate->cstate != NULL)
+               {
+                       if (_bind_context_state(NULL, tstate->cstate, &ctx_list_access_mutex) != 1)
+                       {
+                               COREGL_WRN("\E[40;31;1mError soft-makecurrent for context deletion\E[0m\n");
+                       }
+                       tstate->cstate = NULL;
+               }
+               if (_orig_fastpath_eglMakeCurrent(dpy, draw, read, ctx) != EGL_TRUE)
+               {
+                       COREGL_WRN("Error making context [%p] current. (invalid EGL display [%p] or EGL surface [D:%p/R:%p])\n", ctx, dpy, draw, read);
+                       ret = EGL_FALSE;
+                       goto finish;
+               }
+
+               tstate->rsurf_draw = draw;
+               tstate->rsurf_read = read;
+
+               ret = EGL_TRUE;
+               goto finish;
+       }
+
+       AST(gctx != NULL);
+       AST(gctx->cstate != NULL);
+
+       if (gctx->rdpy != dpy)
+       {
+               COREGL_WRN("\E[40;31;1mInvalid context (or invalid EGL display)\E[0m\n");
+               ret = EGL_FALSE;
+               goto finish;
+       }
+
+       AST(gctx->real_ctx_option != NULL);
+       AST(gctx->real_ctx_sharable_option != NULL);
+
+       // Handle cross threading of context (when used by two or more gctx)
+       if (gctx->thread_id != get_current_thread() && gctx->cstate->ref_count > 1)
+       {
+#define ATTRIB_LIST_BUFFER_SIZE 8
+
+               GLContextState *cstate_new = NULL;
+               EGLContext new_real_ctx = EGL_NO_CONTEXT;
+
+               EGLDisplay dpy = EGL_NO_DISPLAY;
+               EGLConfig config = NULL;
+               int attrib_list[ATTRIB_LIST_BUFFER_SIZE];
+
+               AST(_unpack_egl_context_option(gctx->real_ctx_option, &dpy, &config, NULL, attrib_list, ATTRIB_LIST_BUFFER_SIZE) == 1);
+               AST(dpy == gctx->rdpy);
+
+               _egl_create_context(gctx->real_ctx_option, &cstate_new, &new_real_ctx, dpy, config, attrib_list);
+
+               AST(cstate_new != NULL);
+
+               if (_bind_context_state(gctx, cstate_new, &ctx_list_access_mutex) != 1)
+               {
+                       COREGL_WRN("\E[40;31;1mError soft-makecurrent in Cross-thread usage!\E[0m\n");
+                       free(cstate_new);
+                       _orig_fastpath_eglDestroyContext(dpy, new_real_ctx);
+                       ret = EGL_FALSE;
+                       goto finish;
+               }
+
+               // TODO : Setup context state for new real ctx
+               COREGL_WRN("\E[40;31;1mCross-thread usage(makecurrent) can cause a state-broken situation!\E[0m\n");
+
+               _unlink_context_state(gctx, &ctx_list_access_mutex);
+               _link_context_state(gctx, cstate_new);
+
+               // Apply to new thread
+               gctx->thread_id = get_current_thread();
+
+       }
+
+       // Check if the object is correct
+       if (gctx->magic != MAGIC_GLFAST)
+       {
+               COREGL_ERR("\E[40;31;1mGlue-CTX Magic Check Failed!!! (Memory broken?)\E[0m\n");
+               ret = EGL_FALSE;
+               goto finish;
+
+       }
+
+       // If drawable changed, do a make current
+       if ((tstate->rsurf_draw != draw) ||
+           (tstate->rsurf_read != read))
+               need_mc = EGL_TRUE;
+
+       AST(gctx->cstate != NULL);
+
+       // If binded real context changed, do a make current
+       if (tstate->cstate == NULL || tstate->cstate != gctx->cstate)
+               need_mc = EGL_TRUE;
+
+       if (need_mc == EGL_TRUE)
+       {
+               AST(dpy == gctx->cstate->rdpy);
+
+               // BB : full makecurrent
+               if (_orig_fastpath_eglMakeCurrent(dpy, draw, read, gctx->cstate->rctx) != EGL_TRUE)
+               {
+                       COREGL_WRN("\E[40;31;1mError making context current with the drawable. (Bad match?)\E[0m\n");
+                       ret = EGL_FALSE;
+                       goto finish;
+               }
+
+               // Update references only when the contexts are different
+               if(tstate->cstate != gctx->cstate)  {
+                       if (tstate->cstate != NULL && tstate->cstate->data != NULL)
+                               _remove_context_ref((GLGlueContext *)tstate->cstate->data, &ctx_list_access_mutex);
+
+                       tstate->cstate = gctx->cstate;
+
+                       if (tstate->cstate->data != NULL)
+                               _add_context_ref((GLGlueContext *)tstate->cstate->data);
+               }
+
+               tstate->rsurf_draw = draw;
+               tstate->rsurf_read = read;
+       }
+
+       // Initialize context states
+       if (gctx->initialized == 0)
+       {
+               if (fastpath_init_context_states(gctx) != 1)
+               {
+                       COREGL_ERR("\E[40;31;1mError intializing context. (Check driver specification)\E[0m\n");
+                       goto finish;
+               }
+       }
+
+       // Setup initial Viewport & Scissor
+       if (gctx->surface_attached == 0 && draw != EGL_NO_SURFACE)
+       {
+               EGLint box_buffer[4];
+               EGLint width = 0;
+               EGLint height = 0;
+
+               _orig_fastpath_glGetIntegerv(GL_VIEWPORT, box_buffer);
+               width = box_buffer[2];
+               height = box_buffer[3];
+
+               gctx->_clear_flag1 |= _CLEAR_FLAG1_BIT_gl_viewport;
+               gctx->gl_viewport[0] = 0;
+               gctx->gl_viewport[1] = 0;
+               gctx->gl_viewport[2] = width;
+               gctx->gl_viewport[3] = height;
+
+               _orig_fastpath_glGetIntegerv(GL_SCISSOR_BOX, box_buffer);
+               width = box_buffer[2];
+               height = box_buffer[3];
+
+               gctx->_misc_flag2 |= _MISC_FLAG2_BIT_gl_scissor_box;
+               gctx->gl_scissor_box[0] = 0;
+               gctx->gl_scissor_box[1] = 0;
+               gctx->gl_scissor_box[2] = width;
+               gctx->gl_scissor_box[3] = height;
+
+               gctx->surface_attached = 1;
+       }
+
+       if (_bind_context_state(gctx, tstate->cstate, &ctx_list_access_mutex) != 1)
+       {
+               ret = EGL_FALSE;
+               goto finish;
+       }
+       gctx->used_count++;
+
+       ret = EGL_TRUE;
+       goto finish;
+
+finish:
+
+       _COREGL_FASTPATH_FUNC_END();
+
+#ifdef COREGL_FASTPATH_TRACE_CONTEXT_INFO
+       if (unlikely(trace_ctx_flag == 1))
+       {
+               char ment[256];
+               snprintf(ment,sizeof(ment), "eglMakeCurrent finished (GlueCTX=[%12p] Surf=[D:%12p R:%12p])", ctx, draw, read);
+               _dump_context_info(ment, 0);
+       }
+#endif // COREGL_FASTPATH_TRACE_CONTEXT_INFO
+
+       return ret;
+}
+
+
+EGLContext
+fastpath_eglGetCurrentContext(void)
+{
+       GLGlueContext *ret = NULL;
+       MY_MODULE_TSTATE *tstate = NULL;
+
+       GET_MY_TSTATE(tstate, get_current_thread_state());
+
+       // Special eject condition for binding API
+       if (tstate != NULL && tstate->binded_api != EGL_OPENGL_ES_API)
+       {
+               return _orig_fastpath_eglGetCurrentContext();
+       }
+
+       _COREGL_FASTPATH_FUNC_BEGIN();
+
+       if (tstate != NULL)
+       {
+               if (tstate->cstate != NULL)
+               {
+                       ret = (GLGlueContext *)tstate->cstate->data;
+                       AST(ret->magic == MAGIC_GLFAST);
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+       return (EGLContext)ret;
+}
+
+
+EGLSurface
+fastpath_eglGetCurrentSurface(EGLint readdraw)
+{
+       EGLSurface ret = EGL_NO_SURFACE;
+       MY_MODULE_TSTATE *tstate = NULL;
+
+       GET_MY_TSTATE(tstate, get_current_thread_state());
+
+       // Special eject condition for binding API
+       if (tstate != NULL && tstate->binded_api != EGL_OPENGL_ES_API)
+       {
+               return _orig_fastpath_eglGetCurrentSurface(readdraw);
+       }
+
+       _COREGL_FASTPATH_FUNC_BEGIN();
+
+       if (tstate != NULL)
+       {
+               switch (readdraw)
+               {
+                       case EGL_DRAW :
+                               ret = (GLGlueContext *)tstate->rsurf_draw;
+                               break;
+                       case EGL_READ :
+                               ret = (GLGlueContext *)tstate->rsurf_read;
+                               break;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+       return ret;
+}
+
+EGLImageKHR
+fastpath_eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list)
+{
+       void *ret = NULL;
+       EGLContext real_ctx = EGL_NO_CONTEXT;
+       GLuint real_obj = 0;
+
+       _COREGL_FASTPATH_FUNC_BEGIN();
+
+       if (ctx != NULL && ctx != EGL_NO_CONTEXT)
+       {
+               GLGlueContext *gctx = (GLGlueContext *)ctx;
+
+               if (gctx->magic != MAGIC_GLFAST)
+               {
+                       real_ctx = ctx;
+               }
+               else
+               {
+                       AST(gctx->cstate != NULL);
+                       real_ctx = gctx->cstate->rctx;
+               }
+
+               switch(target)
+               {
+                       case EGL_GL_TEXTURE_2D_KHR:
+                       case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR:
+                       case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR:
+                       case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR:
+                       case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR:
+                       case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR:
+                       case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR:
+                       case EGL_GL_TEXTURE_3D_KHR:
+                       case EGL_GL_RENDERBUFFER_KHR:
+                               if((GLuint )buffer == 0)
+                               {
+                                       COREGL_ERR("\E[40;31;1m fastpath_eglCreateImageKHR buffer object NULL \E[0m\n");
+                                       real_obj = 0;
+                               } else {
+                                       real_obj = fastpath_ostate_get_object(&gctx->ostate, GL_OBJECT_TYPE_TEXTURE, (GLuint )buffer);
+                               }
+                               break;
+                       default:
+                               COREGL_ERR("\E[40;31;1mError Not supported target NULL client buffer\E[0m\n");
+                           goto finish;
+               }
+
+       } else  {
+               real_obj = (GLuint )buffer;
+       }
+
+       ret = _orig_fastpath_eglCreateImageKHR(dpy, real_ctx, target, (EGLClientBuffer)real_obj, attrib_list);
+
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+       return ret;
+}
+
+_eng_fn
+fastpath_eglGetProcAddress(const char* procname)
+{
+       _eng_fn ret = NULL;
+
+       _COREGL_FASTPATH_FUNC_BEGIN();
+
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST) \
+       if (strcmp(procname, #FUNC_NAME) == 0) \
+       { \
+               _eng_fn ret_orig = NULL; \
+               ret_orig = _orig_fastpath_eglGetProcAddress(procname); \
+               if (ret_orig != NULL) \
+                       ret = (_eng_fn)ovr_##FUNC_NAME; \
+               goto finish; \
+       }
+
+#define _COREGL_EXT_SYMBOL_ALIAS(ALIAS_NAME, FUNC_NAME) \
+       if (strcmp(procname, #ALIAS_NAME) == 0) \
+       { \
+               _eng_fn ret_orig = NULL; \
+               ret_orig = _orig_fastpath_eglGetProcAddress(#ALIAS_NAME); \
+               if (ret_orig != NULL) \
+                       ret = (_eng_fn)ovr_##FUNC_NAME; \
+               goto finish; \
+       }
+
+#include "../../headers/sym_egl.h"
+#include "../../headers/sym_gl.h"
+#undef _COREGL_SYMBOL
+#undef _COREGL_EXT_SYMBOL_ALIAS
+
+       ret = _orig_fastpath_eglGetProcAddress(procname);
+       if (ret != NULL)
+       {
+
+#define _COREGL_EXT_SYMBOL_FASTPATH_PASS(FUNC_NAME) \
+               if (strcmp(procname, #FUNC_NAME) == 0) \
+                       goto finish;
+
+#define _COREGL_EXT_SYMBOL_FASTPATH_BLOCK(FUNC_NAME) \
+               if (strcmp(procname, #FUNC_NAME) == 0) \
+               { \
+                       ret = NULL; \
+                       goto finish; \
+               }
+
+#include "../../headers/sym_egl.h"
+#include "../../headers/sym_gl.h"
+#undef _COREGL_EXT_SYMBOL_FASTPATH_PASS
+#undef _COREGL_EXT_SYMBOL_FASTPATH_BLOCK
+
+               COREGL_ERR("\E[40;31;1mFASTPATH does NOT support '%s'!! Returning NULL...\E[0m\n", procname);
+               ret = NULL;
+       }
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+       return ret;
+}
+
+EGLBoolean
+fastpath_eglTerminate(EGLDisplay dpy)
+{
+       EGLBoolean ret = EGL_FALSE;
+       GLGlueContext_List *current = NULL;
+       GLGlueContext_List *remove_list = NULL;
+
+       _COREGL_FASTPATH_FUNC_BEGIN();
+
+       AST(mutex_lock(&ctx_list_access_mutex) == 1);
+       current = gctx_list;
+       while (current != NULL)
+       {
+               if (current->gctx->cstate->rdpy == dpy)
+               {
+                       GLGlueContext_List *rm_newitm = NULL;
+                       rm_newitm = (GLGlueContext_List *)calloc(1, sizeof(GLGlueContext_List));
+
+                       /* Prevent CID : 390950 */
+                       /* Prevent CID : 451104 */
+                       if (rm_newitm != NULL)
+                       {
+                               rm_newitm->gctx = current->gctx;
+
+                               /* insert at HEAD of dbl. linked list (ignoring upwards link) */
+                               rm_newitm->next = remove_list;
+                               remove_list = rm_newitm;
+                       }
+               }
+               current = current->next;
+       }
+       AST(mutex_unlock(&ctx_list_access_mutex) == 1);
+
+       current = remove_list;
+       while (current != NULL)
+       {
+               fastpath_eglDestroyContext(dpy, current->gctx);
+               remove_list = current->next;
+               free(current);
+               current = remove_list;
+       }
+
+       ret = _orig_fastpath_eglTerminate(dpy);
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+       return ret;
+}
+
diff --git a/src/modules/fastpath/coregl_fastpath_gl.c b/src/modules/fastpath/coregl_fastpath_gl.c
new file mode 100644 (file)
index 0000000..aff39f4
--- /dev/null
@@ -0,0 +1,5907 @@
+#include "coregl_fastpath.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <execinfo.h>
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <signal.h>
+
+
+#define CURR_STATE_COMPARE(curr_state, state ) \
+   if ((current_ctx->curr_state[0]) != (state))
+
+#define STATE_PROC_WITH_CHECK(gl_state, flagid, flagbit) \
+       if (current_ctx->gl_state##_used == 1) \
+       { \
+               STATE_PROC(gl_state, flagid, flagbit) \
+       } \
+       else \
+               _set_gl_error(GL_INVALID_ENUM);
+
+#define IF_GL_SUCCESS(orig_gl_func) \
+       _get_gl_error(); \
+       orig_gl_func; \
+       if (_get_gl_error() == GL_NO_ERROR)
+
+#define DEFINE_FASTPAH_GL_FUNC() \
+   MY_MODULE_TSTATE *tstate = NULL; \
+   GLGlueContext *current_ctx = NULL;
+
+#define INIT_FASTPATH_GL_FUNC() \
+   GET_MY_TSTATE(tstate, get_current_thread_state()); \
+   if (tstate == NULL || tstate->cstate == NULL) \
+   { \
+               COREGL_WRN("\E[40;31;1m'%s' called when GLES context is not binded (Check MakeCurrent)!\E[0m\n", __func__); \
+               goto finish; \
+   } \
+   current_ctx = (GLGlueContext *)tstate->cstate->data; \
+   AST(current_ctx != NULL);
+
+#define GET_REAL_OBJ(type, glue_handle, real_handle) \
+       _get_real_obj(&current_ctx->ostate, type, glue_handle, real_handle)
+#define GET_GLUE_OBJ(type, real_handle, glue_handle) \
+       _get_glue_obj(&current_ctx->ostate, type, real_handle, glue_handle)
+
+static inline int
+_get_real_obj(GL_Object_State *ostate, GL_Object_Type type, GLuint glue_handle, GLuint *real_handle)
+{
+       if (glue_handle == 0)
+       {
+               *real_handle = 0;
+       }
+       else
+       {
+               AST(ostate != NULL);
+               *real_handle = fastpath_ostate_get_object(ostate, type, glue_handle);
+               if (*real_handle == 0)
+                       return 0;
+       }
+       return 1;
+}
+
+static inline int
+_get_glue_obj(GL_Object_State *ostate, GL_Object_Type type, GLuint real_handle, GLuint *glue_handle)
+{
+       if (real_handle == 0)
+       {
+               *glue_handle = 0;
+       }
+       else
+       {
+               AST(ostate != NULL);
+               *glue_handle = fastpath_ostate_find_object(ostate, type, real_handle);
+               if (*glue_handle == 0)
+                       return 0;
+       }
+       return 1;
+}
+
+static inline GLenum
+_get_gl_error()
+{
+       GLenum glerror = GL_NONE;
+       DEFINE_FASTPAH_GL_FUNC();
+       INIT_FASTPATH_GL_FUNC();
+
+       glerror = _orig_fastpath_glGetError();
+
+       if (current_ctx->gl_error == GL_NO_ERROR && glerror != GL_NO_ERROR)
+       {
+               current_ctx->gl_error = glerror;
+       }
+       goto finish;
+
+finish:
+       return glerror;
+}
+
+static inline void
+_set_gl_error(GLenum error)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       INIT_FASTPATH_GL_FUNC();
+
+       _get_gl_error();
+
+       if (current_ctx->gl_error == GL_NO_ERROR && error != GL_NO_ERROR)
+       {
+               current_ctx->gl_error = error;
+       }
+       goto finish;
+
+finish:
+       return;
+}
+
+typedef struct
+{
+       GLsizei shader_count;
+       GLuint shaders[10];
+       GLuint is_deleting;
+} Program_object_attached_tag;
+
+GLuint
+_create_program_object(GL_Object_State *ostate, int is_program, GLenum shader_type)
+{
+       GLuint ret = 0;
+       GLuint real_obj = 0;
+
+       if (is_program == 1)
+               real_obj = _orig_fastpath_glCreateProgram();
+       else
+               real_obj = _orig_fastpath_glCreateShader(shader_type);
+
+       if (real_obj != 0)
+       {
+               ret = fastpath_ostate_create_object(ostate, GL_OBJECT_TYPE_PROGRAM, real_obj);
+
+               Program_object_attached_tag *poat = NULL;
+               poat = (Program_object_attached_tag *)calloc(1, sizeof(Program_object_attached_tag));
+               AST(poat != NULL);
+
+               poat->is_deleting = 0;
+               poat->shader_count = 0;
+
+               fastpath_ostate_set_object_tag(ostate, GL_OBJECT_TYPE_PROGRAM, ret, poat);
+       }
+
+       return ret;
+}
+
+static void
+_update_program_attach_info(GL_Object_State *ostate, GLuint program)
+{
+       Program_object_attached_tag *poat = NULL;
+       GLuint real_program = _COREGL_INT_INIT_VALUE;
+
+       poat = (Program_object_attached_tag *)fastpath_ostate_get_object_tag(ostate, GL_OBJECT_TYPE_PROGRAM, program);
+       AST(poat != NULL);
+
+       real_program = fastpath_ostate_get_object(ostate, GL_OBJECT_TYPE_PROGRAM, program);
+       AST(real_program > 0);
+
+       _orig_fastpath_glGetAttachedShaders(real_program, 10, &poat->shader_count, poat->shaders);
+}
+
+static void
+_attach_program_object(GL_Object_State *ostate, GLuint object)
+{
+       if (object != 0)
+       {
+               fastpath_ostate_use_object(ostate, GL_OBJECT_TYPE_PROGRAM, object);
+       }
+}
+
+static int
+_is_deleted_program_object(GL_Object_State *ostate, GLuint glue_object)
+{
+       Program_object_attached_tag *poat = NULL;
+       poat = (Program_object_attached_tag *)fastpath_ostate_get_object_tag(ostate, GL_OBJECT_TYPE_PROGRAM, glue_object);
+       AST(poat != NULL);
+       return poat->is_deleting;
+}
+
+static void
+_detach_program_object(GL_Object_State *ostate, GLuint real_object, int is_program, int is_deleting)
+{
+       if (real_object != 0)
+       {
+               GLuint object = _COREGL_INT_INIT_VALUE;
+               Program_object_attached_tag *poat = NULL;
+
+               object = fastpath_ostate_find_object(ostate, GL_OBJECT_TYPE_PROGRAM, real_object);
+               AST(object != 0);
+
+               poat = (Program_object_attached_tag *)fastpath_ostate_get_object_tag(ostate, GL_OBJECT_TYPE_PROGRAM, object);
+               AST(poat != NULL);
+
+               if (is_deleting == 1)
+               {
+                       if (poat->is_deleting == 0)
+                       {
+                               poat->is_deleting = 1;
+                               fastpath_ostate_remove_object(ostate, GL_OBJECT_TYPE_PROGRAM, object);
+                       }
+               }
+               else
+               {
+                       fastpath_ostate_remove_object(ostate, GL_OBJECT_TYPE_PROGRAM, object);
+               }
+
+               if (fastpath_ostate_get_object(ostate, GL_OBJECT_TYPE_PROGRAM, object) == 0)
+               {
+                       // Is completely removed. De-referencing attached shader objects
+                       int i;
+                       for (i = 0; i < poat->shader_count; i++)
+                       {
+                               AST(is_program == 1);
+                               _detach_program_object(ostate, poat->shaders[i], 0, 0);
+                       }
+
+                       free(poat);
+                       poat = NULL;
+
+                       if (is_program == 1)
+                               _orig_fastpath_glDeleteProgram(real_object);
+                       else
+                               _orig_fastpath_glDeleteShader(real_object);
+               }
+       }
+}
+
+
+void
+fastpath_release_gl_context(GLGlueContext *gctx)
+{
+       // Release program
+       if (gctx->gl_current_program[0] != 0)
+       {
+               _detach_program_object(&gctx->ostate, gctx->gl_current_program[0], 1, 0);
+               gctx->gl_current_program[0] = 0;
+       }
+}
+
+
+static float
+_get_gl_version()
+{
+       float GLver = 0.0;
+       const char *vret;
+       int vlen = _COREGL_INT_INIT_VALUE;
+       int i = _COREGL_INT_INIT_VALUE;
+       char vret_tmp[80 + 1] = { 0 };
+       IF_GL_SUCCESS(vret = (const char *)_orig_fastpath_glGetString(GL_VERSION))
+       {
+               vlen = (int)strlen(vret);
+               if (!strncmp(vret, "OpenGL ES", 9) && vlen >= 11)
+               {
+                       int stp = 10;
+                       if (vret[9] == '-')
+                       {
+                               if (vlen < 14) return 0.0f;
+                               stp = 13;
+                       }
+
+                       for (i = stp; ; i++)
+                       {
+                               if (vret[i] == ' ' || vret[i] == 0x00 || i >= 80)
+                               {
+                                       strncpy(vret_tmp, &vret[stp], i - stp);
+                                       vret_tmp[i - stp] = 0x00;
+                                       break;
+                               }
+                       }
+                       if (vret_tmp[0] != 0x00)
+                               GLver = atof(vret_tmp);
+               }
+       }
+       return GLver;
+}
+
+
+Mutex extension_check_mutex = MUTEX_INITIALIZER;
+char string_extensions[16384] = { 0x00 };
+/* Prevent CID : 405393 */
+char string_each_extensions[256][64];
+int gl_extension_count = 0;
+
+
+static void
+_valid_extension_string()
+{
+       char string_tmpbuf[2048];
+       const char *res = NULL;
+
+       AST(mutex_lock(&extension_check_mutex) == 1);
+
+       if (gl_extension_count == 0)
+       {
+               IF_GL_SUCCESS(res = (const char *)_orig_fastpath_glGetString(GL_EXTENSIONS))
+               {
+                       if (string_extensions[0] == 0x00)
+                       {
+                               double GLver = _get_gl_version();
+
+                                /* Prevent CID : 388174 */
+                               strncpy(string_tmpbuf, res, strlen(res)%2048);
+                               char *fstr = &string_tmpbuf[0], *estr = NULL;
+                               for (estr = fstr; ; estr++)
+                               {
+                                       if (*estr == 0x00) break;
+                                       if (*estr == ' ')
+                                       {
+                                               *estr = 0x00;
+
+                                                /* Prevent CID : 388174 */
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)
+#define _COREGL_FASTPATH_SUPPORTED_EXTENSION(NAME, MINVER, MAXVER) \
+                                               if (!strcmp(fstr, NAME) && (strlen(fstr) < 64 - 1) && (MINVER < 0 || GLver >= MINVER) && (MAXVER < 0 || GLver <= MAXVER)) \
+                                               { \
+                                                       strncpy(string_each_extensions[gl_extension_count], fstr, strlen(fstr)); \
+                                                       strncat(string_extensions, fstr, strlen(fstr)); \
+                                                       strncat(string_extensions,  " ", strlen(" ")); \
+                                                       gl_extension_count++; \
+                                               }
+
+# include "../../headers/sym_gl.h"
+
+#undef _COREGL_FASTPATH_SUPPORTED_EXTENSION
+#undef _COREGL_SYMBOL
+
+                                               fstr = estr + 1;
+                                       }
+                               }
+                       }
+               }
+       }
+
+       AST(mutex_unlock(&extension_check_mutex) == 1);
+}
+
+
+GLenum
+fastpath_glGetError(void)
+{
+       GLenum ret = GL_NONE;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (current_ctx->gl_error != GL_NO_ERROR)
+       {
+               ret = current_ctx->gl_error;
+               current_ctx->gl_error = GL_NO_ERROR;
+               _orig_fastpath_glGetError();
+       }
+       else
+       {
+               ret = _orig_fastpath_glGetError();
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+       return ret;
+}
+
+
+const GLubyte *
+fastpath_glGetString(GLenum name)
+{
+       const char *ret = NULL;
+       static const char *string_gles20 = "OpenGL ES 2.0";
+       static const char *string_gles30 = "OpenGL ES 3.0";
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       switch (name)
+       {
+               case GL_VERSION:
+                       IF_GL_SUCCESS(ret = (const char *)_orig_fastpath_glGetString(name))
+                       {
+                               double GLver = _get_gl_version();
+                               if (GLver > 3.0)
+                               {
+                                       COREGL_WRN("\E[40;31;1mFastpath can't support %s (Fixed to %s)\E[0m\n", ret, string_gles30);
+                                       ret = string_gles30;
+                               }
+                               if (GLver < 2.0)
+                               {
+                                       COREGL_WRN("\E[40;31;1mFastpath can't support %s (Fixed to %s)\E[0m\n", ret, string_gles20);
+                                       ret = string_gles20;
+                               }
+                       }
+                       break;
+               case GL_EXTENSIONS:
+                       _valid_extension_string();
+                       ret = string_extensions;
+                       break;
+               default:
+                       IF_GL_SUCCESS(ret = (const char *)_orig_fastpath_glGetString(name))
+                       {
+                       }
+                       else
+                       {
+                               ret = NULL;
+                       }
+                       break;
+       }
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+       return (const GLubyte *)ret;
+}
+
+////////////////////////////////////////////////////////////////////////
+
+void
+fastpath_glActiveTexture(GLenum texture)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       CURR_STATE_COMPARE(gl_active_texture, texture)
+       {
+               IF_GL_SUCCESS(_orig_fastpath_glActiveTexture(texture))
+               {
+                       current_ctx->_tex_flag1 |= _TEX_FLAG1_BIT_gl_active_texture;
+                       current_ctx->gl_active_texture[0] = texture;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glGenTextures(GLsizei n, GLuint* textures)
+{
+       int i;
+       GLuint *objid_array = NULL;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (n < 0)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+       if (n == 0) goto finish;
+       if (textures == NULL) goto finish;
+
+       AST(current_ctx->ostate.shared != NULL);
+
+       objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+
+        /* Prevent CID : 395709 */
+        if (objid_array == NULL) goto finish;
+
+       IF_GL_SUCCESS(_orig_fastpath_glGenTextures(n, objid_array))
+       {
+               for (i = 0; i < n; i++)
+               {
+                       textures[i] = fastpath_ostate_create_object(&current_ctx->ostate, GL_OBJECT_TYPE_TEXTURE, objid_array[i]);
+               }
+       }
+
+       goto finish;
+
+finish:
+       if (objid_array != NULL)
+       {
+               free(objid_array);
+               objid_array = NULL;
+       }
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glBindTexture(GLenum target, GLuint texture)
+{
+       int active_idx;
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       active_idx = current_ctx->gl_active_texture[0] - GL_TEXTURE0;
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_TEXTURE, texture, &real_obj) != 1)
+       {
+               _set_gl_error(GL_OUT_OF_MEMORY);
+               goto finish;
+       }
+
+
+#define STATE_PROC(gl_state, flagid, flagbit) \
+       if (current_ctx->gl_state[active_idx] != real_obj) \
+       { \
+               IF_GL_SUCCESS(_orig_fastpath_glBindTexture(target, real_obj)) \
+               { \
+                       current_ctx->flagid |= flagbit##_##gl_state; \
+                       current_ctx->gl_state[active_idx] = real_obj; \
+               } \
+       }
+
+       switch (target)
+       {
+               case GL_TEXTURE_2D:
+                       STATE_PROC(gl_tex_2d_state, _tex_flag1, _TEX_FLAG1_BIT);
+                       break;
+               case GL_TEXTURE_3D:
+                       STATE_PROC_WITH_CHECK(gl_tex_3d_state, _tex_flag1, _TEX_FLAG1_BIT);
+                       break;
+               case GL_TEXTURE_2D_ARRAY:
+                       STATE_PROC_WITH_CHECK(gl_tex_2d_array_state, _tex_flag1, _TEX_FLAG1_BIT);
+                       break;
+               case GL_TEXTURE_CUBE_MAP:
+                       STATE_PROC(gl_tex_cube_state, _tex_flag1, _TEX_FLAG1_BIT);
+                       break;
+               case GL_TEXTURE_EXTERNAL_OES:
+                       STATE_PROC(gl_tex_external_oes_state, _tex_flag1, _TEX_FLAG1_BIT);
+                       break;
+               default:
+                       _set_gl_error(GL_INVALID_ENUM);
+                       break;
+       }
+
+
+#undef STATE_PROC
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_TEXTURE, texture, &real_obj) != 1)
+       {
+               _set_gl_error(GL_OUT_OF_MEMORY);
+               goto finish;
+       }
+
+       _orig_fastpath_glFramebufferTexture2D(target, attachment, textarget, real_obj, level);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glFramebufferTexture3DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_TEXTURE, texture, &real_obj) != 1)
+       {
+               _set_gl_error(GL_OUT_OF_MEMORY);
+               goto finish;
+       }
+
+       _orig_fastpath_glFramebufferTexture3DOES(target, attachment, textarget, real_obj, level, zoffset);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glFramebufferTexture2DMultisampleEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_TEXTURE, texture, &real_obj) != 1)
+       {
+               _set_gl_error(GL_OUT_OF_MEMORY);
+               goto finish;
+       }
+
+       _orig_fastpath_glFramebufferTexture2DMultisampleEXT(target, attachment, textarget, real_obj, level, samples);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params)
+{
+       GLint real_obj, fa_type;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       switch (pname)
+       {
+               case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
+                       params[0] = 0;
+                       _orig_fastpath_glGetFramebufferAttachmentParameteriv(target, attachment, pname, &real_obj);
+                       _orig_fastpath_glGetFramebufferAttachmentParameteriv(target, attachment, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &fa_type);
+                       switch (fa_type)
+                       {
+                               case GL_TEXTURE:
+                                       if (GET_GLUE_OBJ(GL_OBJECT_TYPE_TEXTURE, real_obj, (GLuint *)params) != 1)
+                                       {
+                                               params[0] = 0;
+                                               goto finish;
+                                       }
+                                       break;
+                               case GL_RENDERBUFFER:
+                                       if (GET_GLUE_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, real_obj, (GLuint *)params) != 1)
+                                       {
+                                               params[0] = 0;
+                                               goto finish;
+                                       }
+                                       break;
+                       }
+                       break;
+               default:
+                       _orig_fastpath_glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
+                       break;
+       }
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+GLboolean
+fastpath_glIsTexture(GLuint texture)
+{
+       GLboolean ret = GL_FALSE;
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_TEXTURE, texture, &real_obj) != 1)
+       {
+               ret = GL_FALSE;
+               goto finish;
+       }
+
+       ret = _orig_fastpath_glIsTexture(real_obj);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+       return ret;
+}
+
+
+void
+fastpath_glDeleteTextures(GLsizei n, const GLuint* textures)
+{
+       int i, j;
+       GLuint *objid_array = NULL;
+       int real_n = 0;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (n < 0)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+       if (n == 0) goto finish;
+       if (textures == NULL) goto finish;
+
+       AST(current_ctx->ostate.shared != NULL);
+
+       objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+       /* Prevent CID : 451151 */
+       if (objid_array == NULL) goto finish;
+
+       for (i = 0; i < n; i++)
+       {
+               int real_objid = _COREGL_INT_INIT_VALUE;
+               if (textures[i] == 0) continue;
+
+               real_objid = fastpath_ostate_get_object(&current_ctx->ostate, GL_OBJECT_TYPE_TEXTURE, textures[i]);
+               if (real_objid == 0) continue;
+
+               AST(fastpath_ostate_remove_object(&current_ctx->ostate, GL_OBJECT_TYPE_TEXTURE, textures[i]) == 1);
+               objid_array[real_n++] = real_objid;
+       }
+
+       IF_GL_SUCCESS(_orig_fastpath_glDeleteTextures(real_n, objid_array))
+       {
+               for (i = 0; i < real_n; i++)
+               {
+                       General_Trace_List *current = NULL;
+                       current = current_ctx->ostate.shared->using_gctxs;
+
+                       while (current != NULL)
+                       {
+                               GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
+
+                               for (j = 0; j < cur_gctx->gl_num_tex_units[0]; j++)
+                               {
+                                       if (cur_gctx->gl_tex_2d_state[j] == objid_array[i])
+                                               cur_gctx->gl_tex_2d_state[j] = 0;
+                                       if (cur_gctx->gl_tex_3d_state[j] == objid_array[i])
+                                               cur_gctx->gl_tex_3d_state[j] = 0;
+                                       if (cur_gctx->gl_tex_2d_array_state[j] == objid_array[i])
+                                               cur_gctx->gl_tex_2d_array_state[j] = 0;
+                                       if (cur_gctx->gl_tex_cube_state[j] == objid_array[i])
+                                               cur_gctx->gl_tex_cube_state[j] = 0;
+                                       if (cur_gctx->gl_tex_external_oes_state[j] == objid_array[i])
+                                               cur_gctx->gl_tex_external_oes_state[j] = 0;
+                               }
+
+                               current = current->next;
+                       }
+               }
+       }
+
+       goto finish;
+
+finish:
+       if (objid_array != NULL)
+       {
+               free(objid_array);
+               objid_array = NULL;
+       }
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+////////////////////////////////////////////////////////////////////////
+
+void
+fastpath_glGenBuffers(GLsizei n, GLuint* buffers)
+{
+       int i;
+       GLuint *objid_array = NULL;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (n < 0)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+       if (n == 0) goto finish;
+       if (buffers == NULL) goto finish;
+
+       AST(current_ctx->ostate.shared != NULL);
+
+       objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+
+        /* Prevent CID : 402158 */
+        if (objid_array == NULL) goto finish;
+
+       IF_GL_SUCCESS(_orig_fastpath_glGenBuffers(n, objid_array))
+       {
+               for (i = 0; i < n; i++)
+               {
+                       buffers[i] = fastpath_ostate_create_object(&current_ctx->ostate, GL_OBJECT_TYPE_BUFFER, objid_array[i]);
+               }
+       }
+
+       goto finish;
+
+finish:
+       if (objid_array != NULL)
+       {
+               free(objid_array);
+               objid_array = NULL;
+       }
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glBindBuffer(GLenum target, GLuint buffer)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_BUFFER, buffer, &real_obj) != 1)
+       {
+               _set_gl_error(GL_OUT_OF_MEMORY);
+               goto finish;
+       }
+
+
+#define STATE_PROC(gl_state, flagid, flagbit) \
+       CURR_STATE_COMPARE(gl_state, real_obj) \
+       { \
+               IF_GL_SUCCESS(_orig_fastpath_glBindBuffer(target, real_obj)) \
+               { \
+                       if (real_obj == 0) \
+                               current_ctx->flagid &= (~flagbit##_##gl_state); \
+                       else \
+                               current_ctx->flagid |= flagbit##_##gl_state; \
+ \
+                       current_ctx->gl_state[0] = real_obj; \
+               } \
+       }
+
+
+       switch (target)
+       {
+               case GL_ARRAY_BUFFER:
+                       STATE_PROC(gl_array_buffer_binding, _bind_flag1, _BIND_FLAG1_BIT);
+                       break;
+               case GL_COPY_READ_BUFFER:
+                       STATE_PROC_WITH_CHECK(gl_copy_read_buffer_binding, _bind_flag2, _BIND_FLAG2_BIT);
+                       break;
+               case GL_COPY_WRITE_BUFFER:
+                       STATE_PROC_WITH_CHECK(gl_copy_write_buffer_binding, _bind_flag2, _BIND_FLAG2_BIT);
+                       break;
+               case GL_ELEMENT_ARRAY_BUFFER:
+                       STATE_PROC(gl_element_array_buffer_binding, _bind_flag1, _BIND_FLAG1_BIT);
+                       break;
+               case GL_PIXEL_PACK_BUFFER:
+                       STATE_PROC_WITH_CHECK(gl_pixel_pack_buffer_binding, _bind_flag2, _BIND_FLAG2_BIT);
+                       break;
+               case GL_PIXEL_UNPACK_BUFFER:
+                       STATE_PROC_WITH_CHECK(gl_pixel_unpack_buffer_binding, _bind_flag2, _BIND_FLAG2_BIT);
+                       break;
+               case GL_TRANSFORM_FEEDBACK_BUFFER:
+                       STATE_PROC_WITH_CHECK(gl_transform_feedback_buffer_binding, _bind_flag2, _BIND_FLAG2_BIT);
+                       break;
+               case GL_UNIFORM_BUFFER:
+                       STATE_PROC_WITH_CHECK(gl_uniform_buffer_binding, _bind_flag2, _BIND_FLAG2_BIT);
+                       break;
+               default:
+                       _set_gl_error(GL_INVALID_ENUM);
+                       break;
+       }
+
+
+#undef STATE_PROC
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+GLboolean
+fastpath_glIsBuffer(GLuint buffer)
+{
+       GLboolean ret = GL_FALSE;
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_BUFFER, buffer, &real_obj) != 1)
+       {
+               ret = GL_FALSE;
+               goto finish;
+       }
+
+       ret = _orig_fastpath_glIsBuffer(real_obj);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+       return ret;
+}
+
+
+void
+fastpath_glDeleteBuffers(GLsizei n, const GLuint* buffers)
+{
+       int i;
+       GLuint *objid_array = NULL;
+       int real_n = 0;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (n < 0)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+       if (n == 0) goto finish;
+       if (buffers == NULL) goto finish;
+
+       AST(current_ctx->ostate.shared != NULL);
+
+       objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+       /* Prevent CID : 451158 */
+       if (objid_array == NULL) goto finish;
+
+       for (i = 0; i < n; i++)
+       {
+               int real_objid = _COREGL_INT_INIT_VALUE;
+               if (buffers[i] == 0) continue;
+
+               real_objid = fastpath_ostate_get_object(&current_ctx->ostate, GL_OBJECT_TYPE_BUFFER, buffers[i]);
+               if (real_objid == 0) continue;
+
+               AST(fastpath_ostate_remove_object(&current_ctx->ostate, GL_OBJECT_TYPE_BUFFER, buffers[i]) == 1);
+               objid_array[real_n++] = real_objid;
+       }
+
+       IF_GL_SUCCESS(_orig_fastpath_glDeleteBuffers(real_n, objid_array))
+       {
+               for (i = 0; i < real_n; i++)
+               {
+                       General_Trace_List *current = NULL;
+                       current = current_ctx->ostate.shared->using_gctxs;
+
+                       while (current != NULL)
+                       {
+                               GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
+
+                               if (cur_gctx->gl_array_buffer_binding[0] == objid_array[i])
+                               {
+                                       cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_array_buffer_binding);
+                                       cur_gctx->gl_array_buffer_binding[0] = 0;
+                               }
+                               if (cur_gctx->gl_copy_read_buffer_binding[0] == objid_array[i])
+                               {
+                                       cur_gctx->_bind_flag2 &= (~_BIND_FLAG2_BIT_gl_copy_read_buffer_binding);
+                                       cur_gctx->gl_copy_read_buffer_binding[0] = 0;
+                               }
+                               if (cur_gctx->gl_copy_write_buffer_binding[0] == objid_array[i])
+                               {
+                                       cur_gctx->_bind_flag2 &= (~_BIND_FLAG2_BIT_gl_copy_write_buffer_binding);
+                                       cur_gctx->gl_copy_write_buffer_binding[0] = 0;
+                               }
+                               if (cur_gctx->gl_element_array_buffer_binding[0] == objid_array[i])
+                               {
+                                       cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_element_array_buffer_binding);
+                                       cur_gctx->gl_element_array_buffer_binding[0] = 0;
+                               }
+                               if (cur_gctx->gl_pixel_pack_buffer_binding[0] == objid_array[i])
+                               {
+                                       cur_gctx->_bind_flag2 &= (~_BIND_FLAG2_BIT_gl_pixel_pack_buffer_binding);
+                                       cur_gctx->gl_pixel_pack_buffer_binding[0] = 0;
+                               }
+                               if (cur_gctx->gl_pixel_unpack_buffer_binding[0] == objid_array[i])
+                               {
+                                       cur_gctx->_bind_flag2 &= (~_BIND_FLAG2_BIT_gl_pixel_unpack_buffer_binding);
+                                       cur_gctx->gl_pixel_unpack_buffer_binding[0] = 0;
+                               }
+                               if (cur_gctx->gl_transform_feedback_buffer_binding[0] == objid_array[i])
+                               {
+                                       cur_gctx->_bind_flag2 &= (~_BIND_FLAG2_BIT_gl_transform_feedback_buffer_binding);
+                                       cur_gctx->gl_transform_feedback_buffer_binding[0] = 0;
+                               }
+                               if (cur_gctx->gl_uniform_buffer_binding[0] == objid_array[i])
+                               {
+                                       cur_gctx->_bind_flag2 &= (~_BIND_FLAG2_BIT_gl_uniform_buffer_binding);
+                                       cur_gctx->gl_uniform_buffer_binding[0] = 0;
+                               }
+
+                               current = current->next;
+                       }
+               }
+       }
+
+       goto finish;
+
+finish:
+       if (objid_array != NULL)
+       {
+               free(objid_array);
+               objid_array = NULL;
+       }
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+//////////////////////////////////////////////////////////////////////////////////
+
+void
+fastpath_glGenFramebuffers(GLsizei n, GLuint* framebuffers)
+{
+       int i;
+       GLuint *objid_array = NULL;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (n < 0)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+       if (n == 0) goto finish;
+       if (framebuffers == NULL) goto finish;
+
+       AST(current_ctx->ostate.shared != NULL);
+
+       objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+
+        /* Prevent CID : 389727 */
+        if (objid_array == NULL) goto finish;
+
+       IF_GL_SUCCESS(_orig_fastpath_glGenFramebuffers(n, objid_array))
+       {
+               for (i = 0; i < n; i++)
+               {
+                       framebuffers[i] = fastpath_ostate_create_object(&current_ctx->ostate, GL_OBJECT_TYPE_FRAMEBUFFER, objid_array[i]);
+               }
+       }
+
+       goto finish;
+
+finish:
+       if (objid_array != NULL)
+       {
+               free(objid_array);
+               objid_array = NULL;
+       }
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glBindFramebuffer(GLenum target, GLuint framebuffer)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_FRAMEBUFFER, framebuffer, &real_obj) != 1)
+       {
+               _set_gl_error(GL_OUT_OF_MEMORY);
+               goto finish;
+       }
+
+       if (target == GL_FRAMEBUFFER)
+       {
+               if (current_ctx->gl_framebuffer_binding_read_used == 1)
+               {
+                       CURR_STATE_COMPARE(gl_framebuffer_binding_read, real_obj)
+                       {
+                               IF_GL_SUCCESS(_orig_fastpath_glBindFramebuffer(target, real_obj))
+                               {
+                                       if (real_obj == 0)
+                                               current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_read);
+                                       else
+                                               current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding_read;
+                                       current_ctx->gl_framebuffer_binding_read[0] = real_obj;
+                               }
+                       }
+                       CURR_STATE_COMPARE(gl_framebuffer_binding_draw, real_obj)
+                       {
+                               IF_GL_SUCCESS(_orig_fastpath_glBindFramebuffer(target, real_obj))
+                               {
+                                       if (real_obj == 0)
+                                               current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_draw);
+                                       else
+                                               current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding_draw;
+                                       current_ctx->gl_framebuffer_binding_draw[0] = real_obj;
+                               }
+                       }
+               }
+               else
+               {
+                       CURR_STATE_COMPARE(gl_framebuffer_binding, real_obj)
+                       {
+                               IF_GL_SUCCESS(_orig_fastpath_glBindFramebuffer(target, real_obj))
+                               {
+                                       if (real_obj == 0)
+                                               current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding);
+                                       else
+                                               current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding;
+                                       current_ctx->gl_framebuffer_binding[0] = real_obj;
+                               }
+                       }
+               }
+       }
+       else if (target == GL_READ_FRAMEBUFFER && current_ctx->gl_framebuffer_binding_read_used)
+       {
+               CURR_STATE_COMPARE(gl_framebuffer_binding_read, real_obj)
+               {
+                       IF_GL_SUCCESS(_orig_fastpath_glBindFramebuffer(target, real_obj))
+                       {
+                               if (real_obj == 0)
+                                       current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_read);
+                               else
+                                       current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding_read;
+                               current_ctx->gl_framebuffer_binding_read[0] = real_obj;
+                       }
+               }
+       }
+       else if (target == GL_DRAW_FRAMEBUFFER && current_ctx->gl_framebuffer_binding_draw_used)
+       {
+               CURR_STATE_COMPARE(gl_framebuffer_binding_draw, real_obj)
+               {
+                       IF_GL_SUCCESS(_orig_fastpath_glBindFramebuffer(target, real_obj))
+                       {
+                               if (real_obj == 0)
+                                       current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_draw);
+                               else
+                                       current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_framebuffer_binding_draw;
+                               current_ctx->gl_framebuffer_binding_draw[0] = real_obj;
+                       }
+               }
+       }
+       else
+       {
+               _set_gl_error(GL_INVALID_ENUM);
+               goto finish;
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+GLboolean
+fastpath_glIsFramebuffer(GLuint framebuffer)
+{
+       GLboolean ret = GL_FALSE;
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_FRAMEBUFFER, framebuffer, &real_obj) != 1)
+       {
+               ret = GL_FALSE;
+               goto finish;
+       }
+
+       ret = _orig_fastpath_glIsFramebuffer(real_obj);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+       return ret;
+}
+
+
+void
+fastpath_glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
+{
+       int i;
+       GLuint *objid_array = NULL;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (n < 0)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+       if (n == 0) goto finish;
+       if (framebuffers == NULL) goto finish;
+
+       AST(current_ctx->ostate.shared != NULL);
+
+       objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+
+        /* Prevent CID : 405830 */
+        if (objid_array == NULL)
+                goto finish;
+
+        {
+               int real_n = 0;
+
+               for (i = 0; i < n; i++)
+               {
+                       int real_objid = _COREGL_INT_INIT_VALUE;
+                       if (framebuffers[i] == 0) continue;
+
+                       real_objid = fastpath_ostate_get_object(&current_ctx->ostate, GL_OBJECT_TYPE_FRAMEBUFFER, framebuffers[i]);
+                       if (real_objid == 0) continue;
+
+                       AST(fastpath_ostate_remove_object(&current_ctx->ostate, GL_OBJECT_TYPE_FRAMEBUFFER, framebuffers[i]) == 1);
+                       objid_array[real_n++] = real_objid;
+               }
+
+               IF_GL_SUCCESS(_orig_fastpath_glDeleteFramebuffers(real_n, objid_array))
+               {
+                       for (i = 0; i < real_n; i++)
+                       {
+                               General_Trace_List *current = NULL;
+                               current = current_ctx->ostate.shared->using_gctxs;
+
+                               while (current != NULL)
+                               {
+                                       GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
+
+                                       if (cur_gctx->gl_framebuffer_binding[0] == objid_array[i])
+                                       {
+                                               cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding);
+                                               cur_gctx->gl_framebuffer_binding[0] = 0;
+                                       }
+                                       if (cur_gctx->gl_framebuffer_binding_read[0] == objid_array[i])
+                                       {
+                                               cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_read);
+                                               cur_gctx->gl_framebuffer_binding_read[0] = 0;
+                                       }
+                                       if (cur_gctx->gl_framebuffer_binding_draw[0] == objid_array[i])
+                                       {
+                                               cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_framebuffer_binding_draw);
+                                               cur_gctx->gl_framebuffer_binding_draw[0] = 0;
+                                       }
+
+                                       current = current->next;
+                               }
+                       }
+               }
+       }
+
+       goto finish;
+
+finish:
+       if (objid_array != NULL)
+       {
+               free(objid_array);
+               objid_array = NULL;
+       }
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+//////////////////////////////////////////////////////////////////////////////////
+
+void
+fastpath_glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
+{
+       int i;
+       GLuint *objid_array = NULL;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (n < 0)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+       if (n == 0) goto finish;
+       if (renderbuffers == NULL) goto finish;
+
+       AST(current_ctx->ostate.shared != NULL);
+
+       objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+
+        /* Prevent CID : 387214 */
+        if (objid_array == NULL) goto finish;
+
+       IF_GL_SUCCESS(_orig_fastpath_glGenRenderbuffers(n, objid_array))
+       {
+               for (i = 0; i < n; i++)
+               {
+                       renderbuffers[i] = fastpath_ostate_create_object(&current_ctx->ostate, GL_OBJECT_TYPE_RENDERBUFFER, objid_array[i]);
+               }
+       }
+
+       goto finish;
+
+finish:
+       if (objid_array != NULL)
+       {
+               free(objid_array);
+               objid_array = NULL;
+       }
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glBindRenderbuffer(GLenum target, GLuint renderbuffer)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, renderbuffer, &real_obj) != 1)
+       {
+               _set_gl_error(GL_OUT_OF_MEMORY);
+               goto finish;
+       }
+
+       if (target == GL_RENDERBUFFER)
+       {
+               CURR_STATE_COMPARE(gl_renderbuffer_binding, real_obj)
+               {
+                       IF_GL_SUCCESS(_orig_fastpath_glBindRenderbuffer(target, real_obj))
+                       {
+                               if (real_obj == 0)
+                                       current_ctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_renderbuffer_binding);
+                               else
+                                       current_ctx->_bind_flag1 |= _BIND_FLAG1_BIT_gl_renderbuffer_binding;
+                               current_ctx->gl_renderbuffer_binding[0] = real_obj;
+                       }
+               }
+       }
+       else
+       {
+               _set_gl_error(GL_INVALID_ENUM);
+               goto finish;
+       }
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, renderbuffer, &real_obj) != 1)
+       {
+               _set_gl_error(GL_OUT_OF_MEMORY);
+               goto finish;
+       }
+
+       _orig_fastpath_glFramebufferRenderbuffer(target, attachment, renderbuffertarget, real_obj);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+GLboolean
+fastpath_glIsRenderbuffer(GLuint renderbuffer)
+{
+       GLboolean ret = GL_FALSE;
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_RENDERBUFFER, renderbuffer, &real_obj) != 1)
+       {
+               ret = GL_FALSE;
+               goto finish;
+       }
+
+       ret = _orig_fastpath_glIsRenderbuffer(real_obj);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+       return ret;
+}
+
+
+void
+fastpath_glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
+{
+       int i;
+       GLuint *objid_array = NULL;
+       int real_n = 0;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (n < 0)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+       if (n == 0) goto finish;
+       if (renderbuffers == NULL) goto finish;
+
+       AST(current_ctx->ostate.shared != NULL);
+
+       objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+       /* Prevent CID : 451150 */
+       if (objid_array == NULL) goto finish;
+
+       for (i = 0; i < n; i++)
+       {
+               int real_objid = _COREGL_INT_INIT_VALUE;
+               if (renderbuffers[i] == 0) continue;
+
+               real_objid = fastpath_ostate_get_object(&current_ctx->ostate, GL_OBJECT_TYPE_RENDERBUFFER, renderbuffers[i]);
+               if (real_objid == 0) continue;
+
+               AST(fastpath_ostate_remove_object(&current_ctx->ostate, GL_OBJECT_TYPE_RENDERBUFFER, renderbuffers[i]) == 1);
+               objid_array[real_n++] = real_objid;
+       }
+
+       IF_GL_SUCCESS(_orig_fastpath_glDeleteRenderbuffers(real_n, objid_array))
+       {
+               for (i = 0; i < real_n; i++)
+               {
+                       General_Trace_List *current = NULL;
+                       current = current_ctx->ostate.shared->using_gctxs;
+
+                       while (current != NULL)
+                       {
+                               GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
+
+                               if (cur_gctx->gl_renderbuffer_binding[0] == objid_array[i])
+                               {
+                                       cur_gctx->_bind_flag1 &= (~_BIND_FLAG1_BIT_gl_renderbuffer_binding);
+                                       cur_gctx->gl_renderbuffer_binding[0] = 0;
+                               }
+
+                               current = current->next;
+                       }
+               }
+       }
+
+       goto finish;
+
+finish:
+       if (objid_array != NULL)
+       {
+               free(objid_array);
+               objid_array = NULL;
+       }
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+//////////////////////////////////////////////////////////////////////////////////
+
+GLuint
+fastpath_glCreateProgram(void)
+{
+       GLuint ret = 0;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       AST(current_ctx->ostate.shared != NULL);
+
+       ret = _create_program_object(&current_ctx->ostate, 1, GL_NONE);
+
+       _attach_program_object(&current_ctx->ostate, ret);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+       return ret;
+}
+
+
+GLuint
+fastpath_glCreateShader(GLenum type)
+{
+       GLuint ret = 0;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       AST(current_ctx->ostate.shared != NULL);
+
+       ret = _create_program_object(&current_ctx->ostate, 0, type);
+
+       _attach_program_object(&current_ctx->ostate, ret);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+       return ret;
+}
+
+
+void
+fastpath_glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+       _orig_fastpath_glShaderSource(real_obj, count, string, length);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length)
+{
+       int i;
+       GLuint *objid_array = NULL;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (n < 0)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+       if (n == 0) goto finish;
+       if (shaders == NULL) goto finish;
+
+       AST(current_ctx->ostate.shared != NULL);
+
+       objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+
+        /* Prevent CID : 405225 */
+        if (objid_array == NULL) goto finish;
+
+       for (i = 0; i < n; i++)
+       {
+               if (shaders[i] == 0) continue;
+               objid_array[i] = fastpath_ostate_get_object(&current_ctx->ostate, GL_OBJECT_TYPE_PROGRAM, shaders[i]);
+       }
+
+       _orig_fastpath_glShaderBinary(n, objid_array, binaryformat, binary, length);
+
+       goto finish;
+
+finish:
+       if (objid_array != NULL)
+       {
+               free(objid_array);
+               objid_array = NULL;
+       }
+
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glCompileShader(GLuint shader)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glCompileShader(real_obj);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glBindAttribLocation(GLuint program, GLuint index, const char* name)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glBindAttribLocation(real_obj, index, name);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glAttachShader(GLuint program, GLuint shader)
+{
+       GLuint real_obj_program;
+       GLuint real_obj_shader;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj_program) != 1 ||
+           GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj_shader) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       IF_GL_SUCCESS(_orig_fastpath_glAttachShader(real_obj_program, real_obj_shader))
+       {
+               _update_program_attach_info(&current_ctx->ostate, program);
+               _attach_program_object(&current_ctx->ostate, shader);
+       }
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glDetachShader(GLuint program, GLuint shader)
+{
+       GLuint real_obj_program;
+       GLuint real_obj_shader;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj_program) != 1 ||
+           GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj_shader) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       IF_GL_SUCCESS(_orig_fastpath_glDetachShader(real_obj_program, real_obj_shader))
+       {
+               _update_program_attach_info(&current_ctx->ostate, program);
+               _detach_program_object(&current_ctx->ostate, real_obj_shader, 0, 0);
+       }
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+GLboolean
+fastpath_glIsShader(GLuint shader)
+{
+       GLboolean ret = GL_FALSE;
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj) != 1)
+       {
+               ret = GL_FALSE;
+               goto finish;
+       }
+
+       ret = _orig_fastpath_glIsShader(real_obj);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+       return ret;
+}
+
+
+GLboolean
+fastpath_glIsProgram(GLuint program)
+{
+       GLboolean ret = GL_FALSE;
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               ret = GL_FALSE;
+               goto finish;
+       }
+
+       ret = _orig_fastpath_glIsProgram(real_obj);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+       return ret;
+}
+
+
+void
+fastpath_glLinkProgram(GLuint program)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glLinkProgram(real_obj);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glValidateProgram(GLuint program)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glValidateProgram(real_obj);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glUseProgram(GLuint program)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       CURR_STATE_COMPARE(gl_current_program, real_obj)
+       {
+               IF_GL_SUCCESS(_orig_fastpath_glUseProgram(real_obj))
+               {
+                       _attach_program_object(&current_ctx->ostate, program);
+                       _detach_program_object(&current_ctx->ostate, current_ctx->gl_current_program[0], 1, 0);
+
+                       current_ctx->_clear_flag1 |= _CLEAR_FLAG1_BIT_gl_current_program;
+                       current_ctx->gl_current_program[0] = real_obj;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glGetActiveAttrib(real_obj, index, bufsize, length, size, type, name);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glGetActiveUniform(real_obj, index, bufsize, length, size, type, name);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
+{
+       int i;
+       GLsizei real_count = _COREGL_INT_INIT_VALUE;
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       IF_GL_SUCCESS(_orig_fastpath_glGetAttachedShaders(real_obj, maxcount, &real_count, shaders))
+       {
+               for (i = 0; i < real_count; i++)
+               {
+                       if (shaders[i] != 0)
+                               shaders[i] = fastpath_ostate_find_object(&current_ctx->ostate, GL_OBJECT_TYPE_PROGRAM, shaders[i]);
+               }
+               if (count != NULL) *count = real_count;
+       }
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+int
+fastpath_glGetAttribLocation(GLuint program, const char* name)
+{
+       int ret = _COREGL_INT_INIT_VALUE;
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       ret = _orig_fastpath_glGetAttribLocation(real_obj, name);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+       return ret;
+}
+
+
+void
+fastpath_glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       switch (pname)
+       {
+               case GL_DELETE_STATUS:
+                       *params = GL_FALSE;
+                       if (_is_deleted_program_object(&current_ctx->ostate, shader) == 1)
+                               *params = GL_TRUE;
+                       break;
+               default:
+                       _orig_fastpath_glGetShaderiv(real_obj, pname, params);
+                       break;
+       }
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glGetShaderInfoLog(real_obj, bufsize, length, infolog);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glGetProgramiv(GLuint program, GLenum pname, GLint* params)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       switch (pname)
+       {
+               case GL_DELETE_STATUS:
+                       *params = GL_FALSE;
+                       if (_is_deleted_program_object(&current_ctx->ostate, program) == 1)
+                               *params = GL_TRUE;
+                       break;
+               default:
+                       _orig_fastpath_glGetProgramiv(real_obj, pname, params);
+                       break;
+       }
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glGetProgramInfoLog(real_obj, bufsize, length, infolog);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glGetShaderSource(real_obj, bufsize, length, source);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glGetUniformfv(GLuint program, GLint location, GLfloat* params)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glGetUniformfv(real_obj, location, params);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glGetUniformiv(GLuint program, GLint location, GLint* params)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glGetUniformiv(real_obj, location, params);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glUseProgramStagesEXT(GLuint pipeline, GLbitfield stages, GLuint program)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glUseProgramStagesEXT(pipeline, stages, real_obj);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glActiveShaderProgramEXT(GLuint pipeline, GLuint program)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glActiveShaderProgramEXT(pipeline, real_obj);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glProgramParameteriEXT(GLuint program, GLenum pname, GLint value)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glProgramParameteriEXT(real_obj, pname, value);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glProgramUniform1iEXT(GLuint program, GLint location, GLint x)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glProgramUniform1iEXT(real_obj, location, x);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glProgramUniform2iEXT(GLuint program, GLint location, GLint x, GLint y)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glProgramUniform2iEXT(real_obj, location, x, y);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glProgramUniform3iEXT(GLuint program, GLint location, GLint x, GLint y, GLint z)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glProgramUniform3iEXT(real_obj, location, x, y, z);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glProgramUniform4iEXT(GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glProgramUniform4iEXT(real_obj, location, x, y, z, w);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glProgramUniform1fEXT(GLuint program, GLint location, GLfloat x)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glProgramUniform1fEXT(real_obj, location, x);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glProgramUniform2fEXT(GLuint program, GLint location, GLfloat x, GLfloat y)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glProgramUniform2fEXT(real_obj, location, x, y);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glProgramUniform3fEXT(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glProgramUniform3fEXT(real_obj, location, x, y, z);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glProgramUniform4fEXT(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glProgramUniform4fEXT(real_obj, location, x, y, z, w);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glProgramUniform1ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glProgramUniform1ivEXT(real_obj, location, count, value);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glProgramUniform2ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glProgramUniform2ivEXT(real_obj, location, count, value);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glProgramUniform3ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glProgramUniform3ivEXT(real_obj, location, count, value);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glProgramUniform4ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glProgramUniform4ivEXT(real_obj, location, count, value);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glProgramUniform1fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glProgramUniform1fvEXT(real_obj, location, count, value);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glProgramUniform2fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glProgramUniform2fvEXT(real_obj, location, count, value);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glProgramUniform3fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glProgramUniform3fvEXT(real_obj, location, count, value);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glProgramUniform4fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glProgramUniform4fvEXT(real_obj, location, count, value);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glProgramUniformMatrix2fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glProgramUniformMatrix2fvEXT(real_obj, location, count, transpose, value);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glProgramUniformMatrix3fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glProgramUniformMatrix3fvEXT(real_obj, location, count, transpose, value);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glProgramUniformMatrix4fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glProgramUniformMatrix4fvEXT(real_obj, location, count, transpose, value);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+int
+fastpath_glGetUniformLocation(GLuint program, const char* name)
+{
+       int ret = _COREGL_INT_INIT_VALUE;
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               ret = -1;
+               goto finish;
+       }
+
+       ret = _orig_fastpath_glGetUniformLocation(real_obj, name);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+       return ret;
+}
+
+void
+fastpath_glDeleteShader(GLuint shader)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, shader, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _detach_program_object(&current_ctx->ostate, real_obj, 0, 1);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+void
+fastpath_glDeleteProgram(GLuint program)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _detach_program_object(&current_ctx->ostate, real_obj, 1, 1);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+
+//////////////////////////////////////////////////////////////////////////////////
+
+void
+fastpath_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if ((current_ctx->gl_blend_color[0] != red) ||
+           (current_ctx->gl_blend_color[1] != green) ||
+           (current_ctx->gl_blend_color[2] != blue) ||
+           (current_ctx->gl_blend_color[3] != alpha))
+       {
+               IF_GL_SUCCESS(_orig_fastpath_glBlendColor(red, green, blue, alpha))
+               {
+                       current_ctx->_blend_flag |= _BLEND_FLAG_BIT_gl_blend_color;
+                       current_ctx->gl_blend_color[0] = red;
+                       current_ctx->gl_blend_color[1] = green;
+                       current_ctx->gl_blend_color[2] = blue;
+                       current_ctx->gl_blend_color[3] = alpha;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glBlendEquation(GLenum mode)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glBlendEquation(mode))
+       {
+               current_ctx->_blend_flag |=
+                       _BLEND_FLAG_BIT_gl_blend_equation_rgb |
+                       _BLEND_FLAG_BIT_gl_blend_equation_alpha;
+
+               _orig_fastpath_glGetIntegerv(GL_BLEND_EQUATION_RGB, (GLint*) & (current_ctx->gl_blend_equation_rgb));
+               _orig_fastpath_glGetIntegerv(GL_BLEND_EQUATION_ALPHA, (GLint*) & (current_ctx->gl_blend_equation_alpha));
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if ((current_ctx->gl_blend_equation_rgb[0] != modeRGB) ||
+           (current_ctx->gl_blend_equation_alpha[0] != modeAlpha))
+       {
+               IF_GL_SUCCESS(_orig_fastpath_glBlendEquationSeparate(modeRGB, modeAlpha))
+               {
+                       current_ctx->_blend_flag |=
+                               _BLEND_FLAG_BIT_gl_blend_equation_rgb |
+                               _BLEND_FLAG_BIT_gl_blend_equation_alpha;
+
+                       current_ctx->gl_blend_equation_rgb[0]    = modeRGB;
+                       current_ctx->gl_blend_equation_alpha[0]  = modeAlpha;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glBlendFunc(GLenum sfactor, GLenum dfactor)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glBlendFunc(sfactor, dfactor))
+       {
+               current_ctx->_blend_flag |=
+                       _BLEND_FLAG_BIT_gl_blend_src_rgb |
+                       _BLEND_FLAG_BIT_gl_blend_src_alpha |
+                       _BLEND_FLAG_BIT_gl_blend_dst_rgb |
+                       _BLEND_FLAG_BIT_gl_blend_dst_alpha;
+
+               _orig_fastpath_glGetIntegerv(GL_BLEND_SRC_RGB, (GLint*) & (current_ctx->gl_blend_src_rgb));
+               _orig_fastpath_glGetIntegerv(GL_BLEND_SRC_ALPHA, (GLint*) & (current_ctx->gl_blend_src_alpha));
+               _orig_fastpath_glGetIntegerv(GL_BLEND_DST_RGB, (GLint*) & (current_ctx->gl_blend_dst_rgb));
+               _orig_fastpath_glGetIntegerv(GL_BLEND_DST_ALPHA, (GLint*) & (current_ctx->gl_blend_dst_alpha));
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if ((current_ctx->gl_blend_src_rgb[0] != srcRGB) ||
+           (current_ctx->gl_blend_dst_rgb[0] != dstRGB) ||
+           (current_ctx->gl_blend_src_alpha[0] != srcAlpha) ||
+           (current_ctx->gl_blend_dst_alpha[0] != dstAlpha))
+       {
+               IF_GL_SUCCESS(_orig_fastpath_glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha))
+               {
+                       current_ctx->_blend_flag |=
+                       _BLEND_FLAG_BIT_gl_blend_src_rgb |
+                       _BLEND_FLAG_BIT_gl_blend_src_alpha |
+                       _BLEND_FLAG_BIT_gl_blend_dst_rgb |
+                       _BLEND_FLAG_BIT_gl_blend_dst_alpha;
+
+                       current_ctx->gl_blend_src_rgb[0]   = srcRGB;
+                       current_ctx->gl_blend_dst_rgb[0]   = dstRGB;
+                       current_ctx->gl_blend_src_alpha[0] = srcAlpha;
+                       current_ctx->gl_blend_dst_alpha[0] = dstAlpha;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if ((current_ctx->gl_color_clear_value[0] != red) ||
+           (current_ctx->gl_color_clear_value[1] != green) ||
+           (current_ctx->gl_color_clear_value[2] != blue) ||
+           (current_ctx->gl_color_clear_value[3] != alpha))
+       {
+               IF_GL_SUCCESS(_orig_fastpath_glClearColor(red, green, blue, alpha))
+               {
+                       current_ctx->_clear_flag1 |= _CLEAR_FLAG1_BIT_gl_color_clear_value;
+                       current_ctx->gl_color_clear_value[0] = red;
+                       current_ctx->gl_color_clear_value[1] = green;
+                       current_ctx->gl_color_clear_value[2] = blue;
+                       current_ctx->gl_color_clear_value[3] = alpha;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glClearDepthf(GLclampf depth)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       CURR_STATE_COMPARE(gl_depth_clear_value, depth)
+       {
+               IF_GL_SUCCESS(_orig_fastpath_glClearDepthf(depth))
+               {
+                       current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_depth_clear_value;
+                       current_ctx->gl_depth_clear_value[0] = depth;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glClearStencil(GLint s)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       CURR_STATE_COMPARE(gl_stencil_clear_value, s)
+       {
+               IF_GL_SUCCESS(_orig_fastpath_glClearStencil(s))
+               {
+                       current_ctx->_stencil_flag2 |= _STENCIL_FLAG2_BIT_gl_stencil_clear_value;
+                       current_ctx->gl_stencil_clear_value[0] = s;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if ((current_ctx->gl_color_writemask[0] != red) ||
+           (current_ctx->gl_color_writemask[1] != green) ||
+           (current_ctx->gl_color_writemask[2] != blue) ||
+           (current_ctx->gl_color_writemask[3] != alpha))
+       {
+               IF_GL_SUCCESS(_orig_fastpath_glColorMask(red, green, blue, alpha))
+               {
+                       current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_color_writemask;
+                       current_ctx->gl_color_writemask[0] = red;
+                       current_ctx->gl_color_writemask[1] = green;
+                       current_ctx->gl_color_writemask[2] = blue;
+                       current_ctx->gl_color_writemask[3] = alpha;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glCullFace(GLenum mode)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       CURR_STATE_COMPARE(gl_cull_face_mode, mode)
+       {
+               IF_GL_SUCCESS(_orig_fastpath_glCullFace(mode))
+               {
+                       current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_cull_face_mode;
+                       current_ctx->gl_cull_face_mode[0] = mode;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glDepthFunc(GLenum func)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       CURR_STATE_COMPARE(gl_depth_func, func)
+       {
+               IF_GL_SUCCESS(_orig_fastpath_glDepthFunc(func))
+               {
+                       current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_depth_func;
+                       current_ctx->gl_depth_func[0] = func;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glDepthMask(GLboolean flag)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       CURR_STATE_COMPARE(gl_depth_writemask, flag)
+       {
+               IF_GL_SUCCESS(_orig_fastpath_glDepthMask(flag))
+               {
+                       current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_depth_writemask;
+                       current_ctx->gl_depth_writemask[0] = flag;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glDepthRangef(GLclampf zNear, GLclampf zFar)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if ((current_ctx->gl_depth_range[0] != zNear) ||
+           (current_ctx->gl_depth_range[1] != zFar))
+       {
+               IF_GL_SUCCESS(_orig_fastpath_glDepthRangef(zNear, zFar))
+               {
+                       current_ctx->_clear_flag2 |= _CLEAR_FLAG2_BIT_gl_depth_range;
+                       current_ctx->gl_depth_range[0] = zNear;
+                       current_ctx->gl_depth_range[1] = zFar;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glDisable(GLenum cap)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+#define STATE_PROC(gl_state, flagid, flagbit) \
+       CURR_STATE_COMPARE(gl_state, GL_FALSE) \
+       { \
+               _orig_fastpath_glDisable(cap); \
+               current_ctx->flagid &= (~flagbit##_##gl_state); \
+               current_ctx->gl_state[0] = GL_FALSE; \
+       }
+
+
+       switch (cap)
+       {
+               case GL_BLEND:
+                       STATE_PROC(gl_blend, _enable_flag1, _ENABLE_FLAG1_BIT);
+                       break;
+               case GL_CULL_FACE:
+                       STATE_PROC(gl_cull_face, _enable_flag1, _ENABLE_FLAG1_BIT);
+                       break;
+               case GL_DEPTH_TEST:
+                       STATE_PROC(gl_depth_test, _enable_flag1, _ENABLE_FLAG1_BIT);
+                       break;
+               case GL_DITHER:
+                       STATE_PROC(gl_dither, _enable_flag1, _ENABLE_FLAG1_BIT);
+                       break;
+               case GL_POLYGON_OFFSET_FILL:
+                       STATE_PROC(gl_polygon_offset_fill, _enable_flag2, _ENABLE_FLAG2_BIT);
+                       break;
+               case GL_PRIMITIVE_RESTART_FIXED_INDEX:
+                       STATE_PROC_WITH_CHECK(gl_primitive_restart_fixed_index, _enable_flag3, _ENABLE_FLAG3_BIT);
+                       break;
+               case GL_RASTERIZER_DISCARD:
+                       STATE_PROC_WITH_CHECK(gl_rasterizer_discard, _enable_flag3, _ENABLE_FLAG3_BIT);
+                       break;
+               case GL_SAMPLE_ALPHA_TO_COVERAGE:
+                       STATE_PROC(gl_sample_alpha_to_coverage, _enable_flag2, _ENABLE_FLAG2_BIT);
+                       break;
+               case GL_SAMPLE_COVERAGE:
+                       STATE_PROC(gl_sample_coverage, _enable_flag2, _ENABLE_FLAG2_BIT);
+                       break;
+               case GL_SCISSOR_TEST:
+                       STATE_PROC(gl_scissor_test, _enable_flag2, _ENABLE_FLAG2_BIT);
+                       break;
+               case GL_STENCIL_TEST:
+                       STATE_PROC(gl_stencil_test, _enable_flag2, _ENABLE_FLAG2_BIT);
+                       break;
+               default:
+                       _set_gl_error(GL_INVALID_ENUM);
+                       break;
+       }
+       goto finish;
+
+
+#undef STATE_PROC
+        /* Prevent CID : 406942 (delete dead code)*/
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glDisableVertexAttribArray(GLuint index)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glDisableVertexAttribArray(index))
+       {
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
+               {
+                       current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_array;
+                       current_ctx->gl_vertex_array_enabled[index] = GL_FALSE;
+               }
+       }
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+void
+fastpath_glEnable(GLenum cap)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+#define STATE_PROC(gl_state, flagid, flagbit) \
+       CURR_STATE_COMPARE(gl_state, GL_TRUE) \
+       { \
+               _orig_fastpath_glEnable(cap); \
+               current_ctx->flagid |= flagbit##_##gl_state; \
+               current_ctx->gl_state[0] = GL_TRUE; \
+       }
+
+
+       switch (cap)
+       {
+               case GL_BLEND:
+                       STATE_PROC(gl_blend, _enable_flag1, _ENABLE_FLAG1_BIT);
+                       break;
+               case GL_CULL_FACE:
+                       STATE_PROC(gl_cull_face, _enable_flag1, _ENABLE_FLAG1_BIT);
+                       break;
+               case GL_DEPTH_TEST:
+                       STATE_PROC(gl_depth_test, _enable_flag1, _ENABLE_FLAG1_BIT);
+                       break;
+               case GL_DITHER:
+                       STATE_PROC(gl_dither, _enable_flag1, _ENABLE_FLAG1_BIT);
+                       break;
+               case GL_POLYGON_OFFSET_FILL:
+                       STATE_PROC(gl_polygon_offset_fill, _enable_flag2, _ENABLE_FLAG2_BIT);
+                       break;
+               case GL_PRIMITIVE_RESTART_FIXED_INDEX:
+                       STATE_PROC_WITH_CHECK(gl_primitive_restart_fixed_index, _enable_flag3, _ENABLE_FLAG3_BIT);
+                       break;
+               case GL_RASTERIZER_DISCARD:
+                       STATE_PROC_WITH_CHECK(gl_rasterizer_discard, _enable_flag3, _ENABLE_FLAG3_BIT);
+                       break;
+               case GL_SAMPLE_ALPHA_TO_COVERAGE:
+                       STATE_PROC(gl_sample_alpha_to_coverage, _enable_flag2, _ENABLE_FLAG2_BIT);
+                       break;
+               case GL_SAMPLE_COVERAGE:
+                       STATE_PROC(gl_sample_coverage, _enable_flag2, _ENABLE_FLAG2_BIT);
+                       break;
+               case GL_SCISSOR_TEST:
+                       STATE_PROC(gl_scissor_test, _enable_flag2, _ENABLE_FLAG2_BIT);
+                       break;
+               case GL_STENCIL_TEST:
+                       STATE_PROC(gl_stencil_test, _enable_flag2, _ENABLE_FLAG2_BIT);
+                       break;
+               default:
+                       _set_gl_error(GL_INVALID_ENUM);
+                       break;
+       }
+       goto finish;
+
+
+#undef STATE_PROC
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glEnableVertexAttribArray(GLuint index)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glEnableVertexAttribArray(index))
+       {
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
+               {
+                       current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_array;
+                       current_ctx->gl_vertex_array_enabled[index] = GL_TRUE;
+               }
+       }
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glFrontFace(GLenum mode)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       CURR_STATE_COMPARE(gl_front_face, mode)
+       {
+               IF_GL_SUCCESS(_orig_fastpath_glFrontFace(mode))
+               {
+                       current_ctx->_misc_flag1 |= _MISC_FLAG1_BIT_gl_front_face;
+                       current_ctx->gl_front_face[0] = mode;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+void
+fastpath_glHint(GLenum target, GLenum mode)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+
+#define STATE_PROC(gl_state, flagid, flagbit) \
+       CURR_STATE_COMPARE(gl_state, mode) \
+       { \
+               IF_GL_SUCCESS(_orig_fastpath_glHint(target, mode)) \
+               { \
+                       current_ctx->flagid |= flagbit##_##gl_state; \
+                       current_ctx->gl_state[0] = mode; \
+               } \
+       }
+
+
+       switch (target)
+       {
+               case GL_FRAGMENT_SHADER_DERIVATIVE_HINT:
+                       STATE_PROC_WITH_CHECK(gl_fragment_shader_derivative_hint, _misc_flag1, _MISC_FLAG1_BIT);
+                       break;
+               case GL_GENERATE_MIPMAP_HINT:
+                       STATE_PROC(gl_generate_mipmap_hint, _tex_flag1, _TEX_FLAG1_BIT);
+                       break;
+               default:
+                       _set_gl_error(GL_INVALID_ENUM);
+                       break;
+       }
+       goto finish;
+
+
+#undef STATE_PROC
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glLineWidth(GLfloat width)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       CURR_STATE_COMPARE(gl_line_width, width)
+       {
+               IF_GL_SUCCESS(_orig_fastpath_glLineWidth(width))
+               {
+                       current_ctx->_misc_flag1 |= _MISC_FLAG1_BIT_gl_line_width;
+                       current_ctx->gl_line_width[0] = width;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glPixelStorei(GLenum pname, GLint param)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+#define STATE_PROC(gl_state, flagid, flagbit) \
+       CURR_STATE_COMPARE(gl_state, param) \
+       { \
+               IF_GL_SUCCESS(_orig_fastpath_glPixelStorei(pname, param)) \
+               { \
+                       current_ctx->flagid |= flagbit##_##gl_state; \
+                       current_ctx->gl_state[0] = param; \
+               } \
+       }
+
+
+       switch (pname)
+       {
+               case GL_PACK_ROW_LENGTH:
+                       STATE_PROC_WITH_CHECK(gl_pack_row_length, _pixel_flag1, _PIXEL_FLAG1_BIT);
+                       break;
+               case GL_PACK_SKIP_PIXELS:
+                       STATE_PROC_WITH_CHECK(gl_pack_skip_pixels, _pixel_flag1, _PIXEL_FLAG1_BIT);
+                       break;
+               case GL_PACK_SKIP_ROWS:
+                       STATE_PROC_WITH_CHECK(gl_pack_skip_rows, _pixel_flag1, _PIXEL_FLAG1_BIT);
+                       break;
+               case GL_PACK_ALIGNMENT:
+                       STATE_PROC(gl_pack_alignment, _pixel_flag1, _PIXEL_FLAG1_BIT);
+                       break;
+               case GL_UNPACK_ROW_LENGTH:
+                       STATE_PROC_WITH_CHECK(gl_unpack_row_length, _pixel_flag2, _PIXEL_FLAG2_BIT);
+                       break;
+               case GL_UNPACK_IMAGE_HEIGHT:
+                       STATE_PROC_WITH_CHECK(gl_unpack_image_height, _pixel_flag2, _PIXEL_FLAG2_BIT);
+                       break;
+               case GL_UNPACK_SKIP_PIXELS:
+                       STATE_PROC_WITH_CHECK(gl_unpack_skip_pixels, _pixel_flag2, _PIXEL_FLAG2_BIT);
+                       break;
+               case GL_UNPACK_SKIP_IMAGES:
+                       STATE_PROC_WITH_CHECK(gl_unpack_skip_images, _pixel_flag2, _PIXEL_FLAG2_BIT);
+                       break;
+               case GL_UNPACK_ALIGNMENT:
+                       STATE_PROC(gl_unpack_alignment, _pixel_flag2, _PIXEL_FLAG2_BIT);
+                       break;
+               default:
+                       _set_gl_error(GL_INVALID_ENUM);
+                       break;
+       }
+
+
+#undef STATE_PROC
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glPolygonOffset(GLfloat factor, GLfloat units)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if ((current_ctx->gl_polygon_offset_factor[0] != factor) ||
+           (current_ctx->gl_polygon_offset_units[0] != units))
+       {
+               IF_GL_SUCCESS(_orig_fastpath_glPolygonOffset(factor, units))
+               {
+                       current_ctx->_misc_flag1 |=
+                               _MISC_FLAG1_BIT_gl_polygon_offset_factor |
+                               _MISC_FLAG1_BIT_gl_polygon_offset_units;
+
+                       current_ctx->gl_polygon_offset_factor[0] = factor;
+                       current_ctx->gl_polygon_offset_units[0]  = units;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glSampleCoverage(GLclampf value, GLboolean invert)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if ((current_ctx->gl_sample_coverage_value[0] != value) ||
+           (current_ctx->gl_sample_coverage_invert[0] != invert))
+       {
+               IF_GL_SUCCESS(_orig_fastpath_glSampleCoverage(value, invert))
+               {
+                       current_ctx->_misc_flag1 |=
+                               _MISC_FLAG1_BIT_gl_sample_coverage_value |
+                               _MISC_FLAG1_BIT_gl_sample_coverage_invert;
+
+                       current_ctx->gl_sample_coverage_value[0]  = value;
+                       current_ctx->gl_sample_coverage_invert[0] = invert;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if ((current_ctx->gl_scissor_box[0] != x) ||
+           (current_ctx->gl_scissor_box[1] != y) ||
+           (current_ctx->gl_scissor_box[2] != width) ||
+           (current_ctx->gl_scissor_box[3] != height))
+       {
+               IF_GL_SUCCESS(_orig_fastpath_glScissor(x, y, width, height))
+               {
+                       current_ctx->_misc_flag2 |= _MISC_FLAG2_BIT_gl_scissor_box;
+                       current_ctx->gl_scissor_box[0] = x;
+                       current_ctx->gl_scissor_box[1] = y;
+                       current_ctx->gl_scissor_box[2] = width;
+                       current_ctx->gl_scissor_box[3] = height;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glStencilFunc(GLenum func, GLint ref, GLuint mask)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if ((current_ctx->gl_stencil_func[0] != func) ||
+           (current_ctx->gl_stencil_ref[0] != ref) ||
+           (current_ctx->gl_stencil_value_mask[0] != mask) ||
+           (current_ctx->gl_stencil_back_func[0] != func) ||
+           (current_ctx->gl_stencil_back_ref[0] != ref) ||
+           (current_ctx->gl_stencil_back_value_mask[0] != mask))
+       {
+               IF_GL_SUCCESS(_orig_fastpath_glStencilFunc(func, ref, mask))
+               {
+                       current_ctx->_stencil_flag1 |=
+                               _STENCIL_FLAG1_BIT_gl_stencil_func |
+                               _STENCIL_FLAG1_BIT_gl_stencil_ref |
+                               _STENCIL_FLAG1_BIT_gl_stencil_value_mask;
+
+                       current_ctx->gl_stencil_func[0]             = func;
+                       current_ctx->gl_stencil_ref[0]              = ref;
+                       current_ctx->gl_stencil_value_mask[0]       = mask;
+
+                       current_ctx->_stencil_flag2 |=
+                               _STENCIL_FLAG2_BIT_gl_stencil_back_func |
+                               _STENCIL_FLAG2_BIT_gl_stencil_back_ref |
+                               _STENCIL_FLAG2_BIT_gl_stencil_back_value_mask;
+
+                       current_ctx->gl_stencil_back_func[0]        = func;
+                       current_ctx->gl_stencil_back_ref[0]         = ref;
+                       current_ctx->gl_stencil_back_value_mask[0]  = mask;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if ((face == GL_FRONT) || (face == GL_FRONT_AND_BACK))
+       {
+               if ((current_ctx->gl_stencil_func[0] != func) ||
+                   (current_ctx->gl_stencil_ref[0] != ref) ||
+                   (current_ctx->gl_stencil_value_mask[0] != mask))
+               {
+                       IF_GL_SUCCESS(_orig_fastpath_glStencilFuncSeparate(face, func, ref, mask))
+                       {
+                               current_ctx->_stencil_flag1 |=
+                                       _STENCIL_FLAG1_BIT_gl_stencil_func |
+                                       _STENCIL_FLAG1_BIT_gl_stencil_ref |
+                                       _STENCIL_FLAG1_BIT_gl_stencil_value_mask;
+
+                               current_ctx->gl_stencil_func[0]             = func;
+                               current_ctx->gl_stencil_ref[0]              = ref;
+                               current_ctx->gl_stencil_value_mask[0]       = mask;
+                       }
+               }
+       }
+       else if ((face == GL_BACK) || (face == GL_FRONT_AND_BACK))
+       {
+               if ((current_ctx->gl_stencil_back_func[0] != func) ||
+                   (current_ctx->gl_stencil_back_ref[0] != ref) ||
+                   (current_ctx->gl_stencil_back_value_mask[0] != mask))
+               {
+                       IF_GL_SUCCESS(_orig_fastpath_glStencilFuncSeparate(face, func, ref, mask))
+                       {
+                               current_ctx->_stencil_flag2 |=
+                                       _STENCIL_FLAG2_BIT_gl_stencil_back_func |
+                                       _STENCIL_FLAG2_BIT_gl_stencil_back_ref |
+                                       _STENCIL_FLAG2_BIT_gl_stencil_back_value_mask;
+
+                               current_ctx->gl_stencil_back_func[0]        = func;
+                               current_ctx->gl_stencil_back_ref[0]         = ref;
+                               current_ctx->gl_stencil_back_value_mask[0]  = mask;
+                       }
+               }
+       }
+       else
+       {
+               _set_gl_error(GL_INVALID_ENUM);
+               goto finish;
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glStencilMask(GLuint mask)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if ((current_ctx->gl_stencil_writemask[0] != mask) ||
+           (current_ctx->gl_stencil_back_writemask[0] != mask))
+       {
+               IF_GL_SUCCESS(_orig_fastpath_glStencilMask(mask))
+               {
+                       current_ctx->_stencil_flag1 |= _STENCIL_FLAG1_BIT_gl_stencil_writemask;
+                       current_ctx->_stencil_flag2 |= _STENCIL_FLAG2_BIT_gl_stencil_back_writemask;
+
+                       current_ctx->gl_stencil_writemask[0]        = mask;
+                       current_ctx->gl_stencil_back_writemask[0]   = mask;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glStencilMaskSeparate(GLenum face, GLuint mask)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if ((face == GL_FRONT) || (face == GL_FRONT_AND_BACK))
+       {
+               if (current_ctx->gl_stencil_writemask[0] != mask)
+               {
+                       IF_GL_SUCCESS(_orig_fastpath_glStencilMaskSeparate(face, mask))
+                       {
+                               current_ctx->_stencil_flag1 |= _STENCIL_FLAG1_BIT_gl_stencil_writemask;
+                               current_ctx->gl_stencil_writemask[0] = mask;
+                       }
+               }
+       }
+       else if ((face == GL_BACK) || (face == GL_FRONT_AND_BACK))
+       {
+               if (current_ctx->gl_stencil_back_writemask[0] != mask)
+               {
+                       IF_GL_SUCCESS(_orig_fastpath_glStencilMaskSeparate(face, mask))
+                       {
+                               current_ctx->_stencil_flag2 |= _STENCIL_FLAG2_BIT_gl_stencil_back_writemask;
+                               current_ctx->gl_stencil_back_writemask[0]   = mask;
+                       }
+               }
+       }
+       else
+       {
+               _set_gl_error(GL_INVALID_ENUM);
+               goto finish;
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if ((current_ctx->gl_stencil_fail[0] != fail) ||
+           (current_ctx->gl_stencil_pass_depth_fail[0] != zfail) ||
+           (current_ctx->gl_stencil_pass_depth_pass[0] != zpass) ||
+           (current_ctx->gl_stencil_back_fail[0] != fail) ||
+           (current_ctx->gl_stencil_back_pass_depth_fail[0] != zfail) ||
+           (current_ctx->gl_stencil_back_pass_depth_pass[0] != zpass))
+       {
+               IF_GL_SUCCESS(_orig_fastpath_glStencilOp(fail, zfail, zpass))
+               {
+                       current_ctx->_stencil_flag1 |=
+                               _STENCIL_FLAG1_BIT_gl_stencil_fail |
+                               _STENCIL_FLAG1_BIT_gl_stencil_pass_depth_fail |
+                               _STENCIL_FLAG1_BIT_gl_stencil_pass_depth_pass;
+
+                       current_ctx->gl_stencil_fail[0]              = fail;
+                       current_ctx->gl_stencil_pass_depth_fail[0]   = zfail;
+                       current_ctx->gl_stencil_pass_depth_pass[0]   = zpass;
+
+                       current_ctx->_stencil_flag2 |=
+                               _STENCIL_FLAG2_BIT_gl_stencil_back_fail |
+                               _STENCIL_FLAG2_BIT_gl_stencil_back_pass_depth_fail |
+                               _STENCIL_FLAG2_BIT_gl_stencil_back_pass_depth_pass;
+
+                       current_ctx->gl_stencil_back_fail[0]         = fail;
+                       current_ctx->gl_stencil_back_pass_depth_fail[0]   = zfail;
+                       current_ctx->gl_stencil_back_pass_depth_pass[0]   = zpass;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if ((face == GL_FRONT) || (face == GL_FRONT_AND_BACK))
+       {
+               if ((current_ctx->gl_stencil_fail[0] != fail) ||
+                   (current_ctx->gl_stencil_pass_depth_fail[0] != zfail) ||
+                   (current_ctx->gl_stencil_pass_depth_pass[0] != zpass))
+               {
+                       IF_GL_SUCCESS(_orig_fastpath_glStencilOpSeparate(face, fail, zfail, zpass))
+                       {
+                               current_ctx->_stencil_flag1 |=
+                               _STENCIL_FLAG1_BIT_gl_stencil_fail |
+                               _STENCIL_FLAG1_BIT_gl_stencil_pass_depth_fail |
+                               _STENCIL_FLAG1_BIT_gl_stencil_pass_depth_pass;
+
+                               current_ctx->gl_stencil_fail[0]              = fail;
+                               current_ctx->gl_stencil_pass_depth_fail[0]   = zfail;
+                               current_ctx->gl_stencil_pass_depth_pass[0]   = zpass;
+                       }
+               }
+       }
+       else if ((face == GL_BACK) || (face == GL_FRONT_AND_BACK))
+       {
+               if ((current_ctx->gl_stencil_back_fail[0] != fail) ||
+                   (current_ctx->gl_stencil_back_pass_depth_fail[0] != zfail) ||
+                   (current_ctx->gl_stencil_back_pass_depth_pass[0] != zpass))
+               {
+                       IF_GL_SUCCESS(_orig_fastpath_glStencilOpSeparate(face, fail, zfail, zpass))
+                       {
+                               current_ctx->_stencil_flag2 |=
+                               _STENCIL_FLAG2_BIT_gl_stencil_back_fail |
+                               _STENCIL_FLAG2_BIT_gl_stencil_back_pass_depth_fail |
+                               _STENCIL_FLAG2_BIT_gl_stencil_back_pass_depth_pass;
+
+                               current_ctx->gl_stencil_back_fail[0]              = fail;
+                               current_ctx->gl_stencil_back_pass_depth_fail[0]   = zfail;
+                               current_ctx->gl_stencil_back_pass_depth_pass[0]   = zpass;
+                       }
+               }
+       }
+       else
+       {
+               _set_gl_error(GL_INVALID_ENUM);
+               goto finish;
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glVertexAttrib1f(GLuint index, GLfloat x)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib1f(index, x))
+       {
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
+               {
+                       current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
+                       current_ctx->gl_vertex_array_size[index] = 0;
+                       current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
+
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 0] = x;
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 1] = 0;
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 2] = 0;
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glVertexAttrib1fv(GLuint index, const GLfloat* values)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib1fv(index, values))
+       {
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
+               {
+                       current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
+                       current_ctx->gl_vertex_array_size[index] = 0;
+                       current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
+
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 0] = values[0];
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 1] = 0;
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 2] = 0;
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib2f(index, x, y))
+       {
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
+               {
+                       current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
+                       current_ctx->gl_vertex_array_size[index] = 0;
+                       current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
+
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 0] = x;
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 1] = y;
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 2] = 0;
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glVertexAttrib2fv(GLuint index, const GLfloat* values)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib2fv(index, values))
+       {
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
+               {
+                       current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
+                       current_ctx->gl_vertex_array_size[index] = 0;
+                       current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
+
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 0] = values[0];
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 1] = values[1];
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 2] = 0;
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib3f(index, x, y, z))
+       {
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
+               {
+                       current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
+                       current_ctx->gl_vertex_array_size[index] = 0;
+                       current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
+
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 0] = x;
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 1] = y;
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 2] = z;
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glVertexAttrib3fv(GLuint index, const GLfloat* values)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib3fv(index, values))
+       {
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
+               {
+                       current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
+                       current_ctx->gl_vertex_array_size[index] = 0;
+                       current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
+
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 0] = values[0];
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 1] = values[1];
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 2] = values[2];
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 3] = 1;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib4f(index, x, y, z, w))
+       {
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
+               {
+                       current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
+                       current_ctx->gl_vertex_array_size[index] = 0;
+                       current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
+
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 0] = x;
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 1] = y;
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 2] = z;
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 3] = w;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glVertexAttrib4fv(GLuint index, const GLfloat* values)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glVertexAttrib4fv(index, values))
+       {
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
+               {
+                       current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
+                       current_ctx->gl_vertex_array_size[index] = 0;
+                       current_ctx->gl_vertex_array_integer[index] = GL_FALSE;
+
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 0] = values[0];
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 1] = values[1];
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 2] = values[2];
+                       current_ctx->gl_vertex_attrib_value[index * 4 + 3] = values[3];
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* pointer)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glVertexAttribPointer(index, size, type, normalized, stride, pointer))
+       {
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
+               {
+                       current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_array;
+
+                       current_ctx->gl_vertex_array_buf_id[index]       = current_ctx->gl_array_buffer_binding[0];
+                       current_ctx->gl_vertex_array_size[index]         = size;
+                       current_ctx->gl_vertex_array_type[index]         = type;
+                       current_ctx->gl_vertex_array_normalized[index]   = normalized;
+                       current_ctx->gl_vertex_array_integer[index]      = GL_FALSE;
+                       current_ctx->gl_vertex_array_stride[index]       = stride;
+                       current_ctx->gl_vertex_array_pointer[index]      = (GLvoid *)pointer;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if ((current_ctx->gl_viewport[0] != x) ||
+           (current_ctx->gl_viewport[1] != y) ||
+           (current_ctx->gl_viewport[2] != width) ||
+           (current_ctx->gl_viewport[3] != height))
+       {
+               IF_GL_SUCCESS(_orig_fastpath_glViewport(x, y, width, height))
+               {
+                       current_ctx->_clear_flag1 |= _CLEAR_FLAG1_BIT_gl_viewport;
+                       current_ctx->gl_viewport[0] = x;
+                       current_ctx->gl_viewport[1] = y;
+                       current_ctx->gl_viewport[2] = width;
+                       current_ctx->gl_viewport[3] = height;
+               }
+       }
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+#define TRANS_VALUE(index, value) \
+{ \
+       switch (get_type) \
+       { \
+               case GL_INT: if (!is64) ((GLint *)ptr)[index] = value; else ((GLint64 *)ptr)[index] = value; break; \
+               case GL_FLOAT: ((GLfloat *)ptr)[index] = (GLfloat)value; break; \
+               case GL_BOOL: ((GLboolean *)ptr)[index] = (value == 0) ? GL_FALSE : GL_TRUE; break; \
+       } \
+}
+
+#define EXTRACT_VALUE(index, value) \
+{ \
+       switch (get_type) \
+       { \
+               case GL_INT: if (!is64) value = ((GLint *)ptr)[index]; else value = ((GLint64 *)ptr)[index]; break; \
+               case GL_FLOAT: value = ((GLfloat *)ptr)[index]; break; \
+               case GL_BOOL: value = ((GLboolean *)ptr)[index]; break; \
+       } \
+}
+
+static GLboolean
+_modify_get_value(GLenum pname, GLvoid *ptr, GLenum get_type, GLboolean is64)
+{
+       GLboolean ret = GL_FALSE;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       INIT_FASTPATH_GL_FUNC();
+
+       switch (pname)
+       {
+               case GL_NUM_EXTENSIONS:
+                       _valid_extension_string();
+                       TRANS_VALUE(0, gl_extension_count);
+                       break;
+
+               case GL_TEXTURE_BINDING_2D:
+               case GL_TEXTURE_BINDING_CUBE_MAP:
+               case GL_ARRAY_BUFFER_BINDING:
+               case GL_ELEMENT_ARRAY_BUFFER_BINDING:
+               case GL_COPY_READ_BUFFER_BINDING:
+               case GL_COPY_WRITE_BUFFER_BINDING:
+               case GL_PIXEL_PACK_BUFFER_BINDING:
+               case GL_PIXEL_UNPACK_BUFFER_BINDING:
+               case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
+               case GL_UNIFORM_BUFFER_BINDING:
+               case GL_DRAW_FRAMEBUFFER_BINDING:
+               case GL_READ_FRAMEBUFFER_BINDING:
+               case GL_RENDERBUFFER_BINDING:
+               case GL_CURRENT_PROGRAM:
+               case GL_VERTEX_ARRAY_BINDING:
+               case GL_SAMPLER_BINDING:
+               case GL_TRANSFORM_FEEDBACK_BINDING:
+               {
+                       GLint real_obj_id = _COREGL_INT_INIT_VALUE;
+                       GLuint glue_obj_id = _COREGL_INT_INIT_VALUE;
+                       GL_Object_Type obj_type = GL_OBJECT_TYPE_UNKNOWN;
+                       EXTRACT_VALUE(0, real_obj_id);
+
+                       switch (pname)
+                       {
+                               case GL_TEXTURE_BINDING_2D:
+                               case GL_TEXTURE_BINDING_CUBE_MAP:
+                                       obj_type = GL_OBJECT_TYPE_TEXTURE;
+                                       break;
+                               case GL_ARRAY_BUFFER_BINDING:
+                               case GL_ELEMENT_ARRAY_BUFFER_BINDING:
+                               case GL_COPY_READ_BUFFER_BINDING:
+                               case GL_COPY_WRITE_BUFFER_BINDING:
+                               case GL_PIXEL_PACK_BUFFER_BINDING:
+                               case GL_PIXEL_UNPACK_BUFFER_BINDING:
+                               case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
+                               case GL_UNIFORM_BUFFER_BINDING:
+                                       obj_type = GL_OBJECT_TYPE_BUFFER;
+                                       break;
+                               case GL_DRAW_FRAMEBUFFER_BINDING:
+                               case GL_READ_FRAMEBUFFER_BINDING:
+                                       obj_type = GL_OBJECT_TYPE_FRAMEBUFFER;
+                                       break;
+                               case GL_RENDERBUFFER_BINDING:
+                                       obj_type = GL_OBJECT_TYPE_RENDERBUFFER;
+                                       break;
+                               case GL_CURRENT_PROGRAM:
+                                       obj_type = GL_OBJECT_TYPE_PROGRAM;
+                                       break;
+                               case GL_VERTEX_ARRAY_BINDING:
+                                       obj_type = GL_OBJECT_TYPE_VERTEXARRAY;
+                                       break;
+                               case GL_SAMPLER_BINDING:
+                                       obj_type = GL_OBJECT_TYPE_SAMPLER;
+                                       break;
+                               case GL_TRANSFORM_FEEDBACK_BINDING:
+                                       obj_type = GL_OBJECT_TYPE_TRANSFORMFEEDBACK;
+                                       break;
+                       }
+                       AST(obj_type != GL_OBJECT_TYPE_UNKNOWN);
+                       AST(GET_GLUE_OBJ(obj_type, real_obj_id, &glue_obj_id) == 1);
+                       TRANS_VALUE(0, glue_obj_id);
+
+                       ret = GL_TRUE;
+                       break;
+               }
+       }
+       goto finish;
+
+finish:
+       return ret;
+}
+
+void
+fastpath_glGetBooleanv(GLenum pname, GLboolean* params)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glGetBooleanv(pname, params))
+       {
+               _modify_get_value(pname, params, GL_BOOL, GL_FALSE);
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+void
+fastpath_glGetFloatv(GLenum pname, GLfloat* params)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glGetFloatv(pname, params))
+       {
+               _modify_get_value(pname, params, GL_FLOAT, GL_FALSE);
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+void
+fastpath_glGetIntegerv(GLenum pname, GLint* params)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glGetIntegerv(pname, params))
+       {
+               _modify_get_value(pname, params, GL_INT, GL_FALSE);
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+
+/* ES 3.0 PASS (SUPPORT) */
+void
+fastpath_glGetProgramBinary(GLuint program, GLsizei bufsize, GLsizei* length, GLenum* binaryFormat, void* binary)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glGetProgramBinary(real_obj, bufsize, length, binaryFormat, binary);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glGetProgramBinaryOES(GLuint program, GLsizei bufsize, GLsizei* length, GLenum* binaryFormat, void* binary)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glGetProgramBinaryOES(real_obj, bufsize, length, binaryFormat, binary);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glProgramBinary(GLuint program, GLenum binaryFormat, const void* binary, GLint length)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glProgramBinary(real_obj, binaryFormat, binary, length);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glProgramBinaryOES(GLuint program, GLenum binaryFormat, const void* binary, GLint length)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glProgramBinaryOES(real_obj, binaryFormat, binary, length);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glReadBuffer(GLenum mode)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       CURR_STATE_COMPARE(gl_read_buffer, mode)
+       {
+               IF_GL_SUCCESS(_orig_fastpath_glReadBuffer(mode))
+               {
+                       current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_read_buffer;
+                       current_ctx->gl_read_buffer[0] = mode;
+               }
+       }
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glGenQueries(GLsizei n, GLuint* ids)
+{
+       int i;
+       GLuint *objid_array = NULL;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (n < 0)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+       if (n == 0) goto finish;
+       if (ids == NULL) goto finish;
+
+       AST(current_ctx->ostate.shared != NULL);
+
+       objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+
+        /* Prevent CID : 403415 */
+        if (objid_array == NULL) goto finish;
+
+       IF_GL_SUCCESS(_orig_fastpath_glGenQueries(n, objid_array))
+       {
+               for (i = 0; i < n; i++)
+               {
+                       ids[i] = fastpath_ostate_create_object(&current_ctx->ostate, GL_OBJECT_TYPE_QUERY, objid_array[i]);
+               }
+       }
+
+       goto finish;
+
+finish:
+       if (objid_array != NULL)
+       {
+               free(objid_array);
+               objid_array = NULL;
+       }
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glDeleteQueries(GLsizei n, const GLuint* ids)
+{
+       int i;
+       GLuint *objid_array = NULL;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (n < 0)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+       if (n == 0) goto finish;
+       if (ids == NULL) goto finish;
+
+       AST(current_ctx->ostate.shared != NULL);
+
+       objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+
+        /* Prevent CID : 393004 */
+        if (objid_array == NULL)
+                goto finish;
+
+       {
+               int real_n = 0;
+
+               for (i = 0; i < n; i++)
+               {
+                       int real_objid = _COREGL_INT_INIT_VALUE;
+                       if (ids[i] == 0) continue;
+
+                       real_objid = fastpath_ostate_get_object(&current_ctx->ostate, GL_OBJECT_TYPE_QUERY, ids[i]);
+                       if (real_objid == 0) continue;
+
+                       AST(fastpath_ostate_remove_object(&current_ctx->ostate, GL_OBJECT_TYPE_QUERY, ids[i]) == 1);
+                       objid_array[real_n++] = real_objid;
+               }
+
+               _orig_fastpath_glDeleteQueries(real_n, objid_array);
+       }
+
+       goto finish;
+
+finish:
+       if (objid_array != NULL)
+       {
+               free(objid_array);
+               objid_array = NULL;
+       }
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+GLboolean
+fastpath_glIsQuery(GLuint id)
+{
+       GLboolean ret = GL_FALSE;
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_QUERY, id, &real_obj) != 1)
+       {
+               ret = GL_FALSE;
+               goto finish;
+       }
+
+       ret = _orig_fastpath_glIsQuery(real_obj);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+       return ret;
+}
+
+
+void
+fastpath_glBeginQuery(GLenum target, GLuint id)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_QUERY, id, &real_obj) != 1)
+       {
+               // TODO : Begin - Context Switch
+               _set_gl_error(GL_INVALID_OPERATION);
+               goto finish;
+       }
+
+       _orig_fastpath_glBeginQuery(target, real_obj);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glGetQueryiv(GLenum target, GLenum pname, GLint* params)
+{
+       GLuint glue_obj_id = _COREGL_INT_INIT_VALUE;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       _orig_fastpath_glGetQueryiv(target, pname, params);
+
+       switch (pname)
+       {
+               case GL_CURRENT_QUERY:
+                       if (params[0] != 0)
+                       {
+                               AST(GET_GLUE_OBJ(GL_OBJECT_TYPE_QUERY, params[0], &glue_obj_id) == 1);
+                               params[0] = glue_obj_id;
+                       }
+                       break;
+       }
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_QUERY, id, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_OPERATION);
+               goto finish;
+       }
+
+       _orig_fastpath_glGetQueryObjectuiv(real_obj, pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glDrawBuffers(GLsizei n, const GLenum* bufs)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glDrawBuffers(n, bufs))
+       {
+               current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_draw_buffers;
+               fastpath_state_get_draw_buffers(current_ctx->gl_draw_buffers);
+       }
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_TEXTURE, texture, &real_obj) != 1)
+       {
+               _set_gl_error(GL_OUT_OF_MEMORY);
+               goto finish;
+       }
+
+       _orig_fastpath_glFramebufferTextureLayer(target, attachment, texture, level, layer);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+////////////////////////////////////////////////////////////////////////
+
+void
+fastpath_glGenVertexArrays(GLsizei n, GLuint* arrays)
+{
+       int i;
+       GLuint *objid_array = NULL;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (n < 0)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+       if (n == 0) goto finish;
+       if (arrays == NULL) goto finish;
+
+       AST(current_ctx->ostate.shared != NULL);
+
+       objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+
+        /* Prevent CID : 400416 */
+        if (objid_array == NULL) goto finish;
+
+       IF_GL_SUCCESS(_orig_fastpath_glGenVertexArrays(n, objid_array))
+       {
+               for (i = 0; i < n; i++)
+               {
+                       arrays[i] = fastpath_ostate_create_object(&current_ctx->ostate, GL_OBJECT_TYPE_VERTEXARRAY, objid_array[i]);
+               }
+       }
+
+       goto finish;
+
+finish:
+       if (objid_array != NULL)
+       {
+               free(objid_array);
+               objid_array = NULL;
+       }
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glBindVertexArray(GLuint array)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_VERTEXARRAY, array, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_OPERATION);
+               goto finish;
+       }
+
+       if (current_ctx->gl_vertex_array_binding[0] != real_obj)
+       {
+               IF_GL_SUCCESS(_orig_fastpath_glBindVertexArray(real_obj))
+               {
+                       current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_vertex_array_binding;
+                       current_ctx->gl_vertex_array_binding[0] = real_obj;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+GLboolean
+fastpath_glIsVertexArray(GLuint array)
+{
+       GLboolean ret = GL_FALSE;
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_VERTEXARRAY, array, &real_obj) != 1)
+       {
+               ret = GL_FALSE;
+               goto finish;
+       }
+
+       ret = _orig_fastpath_glIsVertexArray(real_obj);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+       return ret;
+}
+
+
+void
+fastpath_glDeleteVertexArrays(GLsizei n, const GLuint* arrays)
+{
+       int i;
+       GLuint *objid_array = NULL;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (n < 0)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+       if (n == 0) goto finish;
+       if (arrays == NULL) goto finish;
+
+       AST(current_ctx->ostate.shared != NULL);
+
+       objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+
+        /* Prevent CID : 386124 */
+        if (objid_array == NULL)
+                goto finish;
+
+       {
+               int real_n = 0;
+
+               for (i = 0; i < n; i++)
+               {
+                       int real_objid = _COREGL_INT_INIT_VALUE;
+                       if (arrays[i] == 0) continue;
+
+                       real_objid = fastpath_ostate_get_object(&current_ctx->ostate, GL_OBJECT_TYPE_VERTEXARRAY, arrays[i]);
+                       if (real_objid == 0) continue;
+
+                       AST(fastpath_ostate_remove_object(&current_ctx->ostate, GL_OBJECT_TYPE_VERTEXARRAY, arrays[i]) == 1);
+                       objid_array[real_n++] = real_objid;
+               }
+
+               IF_GL_SUCCESS(_orig_fastpath_glDeleteVertexArrays(real_n, objid_array))
+               {
+                       for (i = 0; i < real_n; i++)
+                       {
+                               General_Trace_List *current = NULL;
+                               current = current_ctx->ostate.shared->using_gctxs;
+
+                               while (current != NULL)
+                               {
+                                       GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
+
+                                       if (cur_gctx->gl_vertex_array_binding[0] == objid_array[i])
+                                               cur_gctx->gl_vertex_array_binding[0] = 0;
+
+                                       current = current->next;
+                               }
+                       }
+               }
+       }
+
+       goto finish;
+
+finish:
+       if (objid_array != NULL)
+       {
+               free(objid_array);
+               objid_array = NULL;
+       }
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+////////////////////////////////////////////////////////////////////////
+
+void
+fastpath_glGetIntegeri_v(GLenum target, GLuint index, GLint* data)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glGetIntegeri_v(target, index, data))
+       {
+               _modify_get_value(target, data, GL_INT, GL_FALSE);
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+////////////////////////////////////////////////////////////////////////
+
+void
+fastpath_glGenTransformFeedbacks(GLsizei n, GLuint* ids)
+{
+       int i;
+       GLuint *objid_array = NULL;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (n < 0)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+       if (n == 0) goto finish;
+       if (ids == NULL) goto finish;
+
+       AST(current_ctx->ostate.shared != NULL);
+
+       objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+
+        /* Prevent CID : 401635 */
+        if (objid_array == NULL) goto finish;
+
+       IF_GL_SUCCESS(_orig_fastpath_glGenTransformFeedbacks(n, objid_array))
+       {
+               for (i = 0; i < n; i++)
+               {
+                       ids[i] = fastpath_ostate_create_object(&current_ctx->ostate, GL_OBJECT_TYPE_TRANSFORMFEEDBACK, objid_array[i]);
+               }
+       }
+
+       goto finish;
+
+finish:
+       if (objid_array != NULL)
+       {
+               free(objid_array);
+               objid_array = NULL;
+       }
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glBindTransformFeedback(GLenum target, GLuint id)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_TRANSFORMFEEDBACK, id, &real_obj) != 1)
+       {
+               _set_gl_error(GL_OUT_OF_MEMORY);
+               goto finish;
+       }
+
+       if (current_ctx->gl_transform_feedback_binding[0] != real_obj)
+       {
+               IF_GL_SUCCESS(_orig_fastpath_glBindTransformFeedback(target, real_obj))
+               {
+                       current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_transform_feedback_binding;
+                       current_ctx->gl_transform_feedback_binding[0] = real_obj;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glBeginTransformFeedback(GLenum primitiveMode)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glBeginTransformFeedback(primitiveMode))
+       {
+               current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_transform_feedback;
+
+               current_ctx->gl_transform_feedback_active[0] = GL_TRUE;
+               current_ctx->gl_transform_feedback_paused[0] = GL_FALSE;
+       }
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glEndTransformFeedback()
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glEndTransformFeedback())
+       {
+               current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_transform_feedback;
+
+               current_ctx->gl_transform_feedback_active[0] = GL_FALSE;
+               current_ctx->gl_transform_feedback_paused[0] = GL_FALSE;
+       }
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glPauseTransformFeedback()
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glPauseTransformFeedback())
+       {
+               current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_transform_feedback;
+
+               current_ctx->gl_transform_feedback_active[0] = GL_TRUE;
+               current_ctx->gl_transform_feedback_paused[0] = GL_TRUE;
+       }
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+void
+fastpath_glResumeTransformFeedback()
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glResumeTransformFeedback())
+       {
+               current_ctx->_misc_flag3 |= _MISC_FLAG3_BIT_gl_transform_feedback;
+
+               current_ctx->gl_transform_feedback_active[0] = GL_TRUE;
+               current_ctx->gl_transform_feedback_paused[0] = GL_FALSE;
+       }
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+GLboolean
+fastpath_glIsTransformFeedback(GLuint id)
+{
+       GLboolean ret = GL_FALSE;
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_TRANSFORMFEEDBACK, id, &real_obj) != 1)
+       {
+               ret = GL_FALSE;
+               goto finish;
+       }
+
+       ret = _orig_fastpath_glIsTransformFeedback(real_obj);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+       return ret;
+}
+
+
+void
+fastpath_glDeleteTransformFeedbacks(GLsizei n, const GLuint* ids)
+{
+       int i;
+       GLuint *objid_array = NULL;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (n < 0)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+       if (n == 0) goto finish;
+       if (ids == NULL) goto finish;
+
+       AST(current_ctx->ostate.shared != NULL);
+
+       objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+
+        /* Prevent CID : 397054 */
+        if (objid_array == NULL)
+                goto finish;
+
+       {
+               int real_n = 0;
+
+               for (i = 0; i < n; i++)
+               {
+                       int real_objid = _COREGL_INT_INIT_VALUE;
+                       if (ids[i] == 0) continue;
+
+                       real_objid = fastpath_ostate_get_object(&current_ctx->ostate, GL_OBJECT_TYPE_TRANSFORMFEEDBACK, ids[i]);
+                       if (real_objid == 0) continue;
+
+                       AST(fastpath_ostate_remove_object(&current_ctx->ostate, GL_OBJECT_TYPE_TRANSFORMFEEDBACK, ids[i]) == 1);
+                       objid_array[real_n++] = real_objid;
+               }
+
+               IF_GL_SUCCESS(_orig_fastpath_glDeleteTransformFeedbacks(real_n, objid_array))
+               {
+                       for (i = 0; i < real_n; i++)
+                       {
+                               General_Trace_List *current = NULL;
+                               current = current_ctx->ostate.shared->using_gctxs;
+
+                               while (current != NULL)
+                               {
+                                       GLGlueContext *cur_gctx = (GLGlueContext *)current->value;
+
+                                       if (cur_gctx->gl_transform_feedback_binding[0] == objid_array[i])
+                                               cur_gctx->gl_transform_feedback_binding[0] = 0;
+
+                                       current = current->next;
+                               }
+                       }
+               }
+       }
+
+       goto finish;
+
+finish:
+       if (objid_array != NULL)
+       {
+               free(objid_array);
+               objid_array = NULL;
+       }
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+////////////////////////////////////////////////////////////////////////
+
+
+void
+fastpath_glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_BUFFER, buffer, &real_obj) != 1)
+       {
+               _set_gl_error(GL_OUT_OF_MEMORY);
+               goto finish;
+       }
+
+#define STATE_PROC(gl_state, flagid, flagbit) \
+       { \
+               CURR_STATE_COMPARE(gl_state, real_obj) \
+               { \
+                       IF_GL_SUCCESS(_orig_fastpath_glBindBufferBase(target, index, real_obj)) \
+                       { \
+                               current_ctx->flagid |= flagbit##_##gl_state; \
+                               current_ctx->gl_state##_array[index] = real_obj; \
+                               current_ctx->gl_state##_array_offset[index] = 0; \
+                               current_ctx->gl_state##_array_size[index] = 0; \
+                       } \
+               } \
+               break; \
+       }
+
+
+       switch (target)
+       {
+               case GL_TRANSFORM_FEEDBACK_BUFFER:
+                       STATE_PROC(gl_transform_feedback_buffer_binding, _bind_flag2, _BIND_FLAG2_BIT);
+                       break;
+               case GL_UNIFORM_BUFFER:
+                       STATE_PROC(gl_uniform_buffer_binding, _bind_flag2, _BIND_FLAG2_BIT);
+                       break;
+               default:
+                       _set_gl_error(GL_INVALID_ENUM);
+                       break;
+       }
+
+
+#undef STATE_PROC
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+
+void
+fastpath_glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_BUFFER, buffer, &real_obj) != 1)
+       {
+               _set_gl_error(GL_OUT_OF_MEMORY);
+               goto finish;
+       }
+
+#define STATE_PROC(gl_state, flagnum) \
+       { \
+               CURR_STATE_COMPARE(gl_state, real_obj) \
+               { \
+                       IF_GL_SUCCESS(_orig_fastpath_glBindBufferRange(target, index, real_obj, offset, size)) \
+                       { \
+                               current_ctx->_bind_flag2 |= _BIND_FLAG2_BIT_##gl_state; \
+                               current_ctx->gl_state##_array[index] = real_obj; \
+                               current_ctx->gl_state##_array_offset[index] = offset; \
+                               current_ctx->gl_state##_array_size[index] = size; \
+                       } \
+               } \
+               break; \
+       }
+
+
+       switch (target)
+       {
+               case GL_TRANSFORM_FEEDBACK_BUFFER: STATE_PROC(gl_transform_feedback_buffer_binding, 0); break;
+               case GL_UNIFORM_BUFFER: STATE_PROC(gl_uniform_buffer_binding, 0); break;
+               default: _set_gl_error(GL_INVALID_ENUM); break;
+       }
+
+
+#undef STATE_PROC
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glTransformFeedbackVaryings(real_obj, count, varyings, bufferMode);
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glGetTransformFeedbackVarying(real_obj, index, bufSize, length, size, type, name);
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glVertexAttribIPointer(index, size, type, stride, pointer))
+       {
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
+               {
+                       current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_array;
+
+                       current_ctx->gl_vertex_array_buf_id[index]      = current_ctx->gl_array_buffer_binding[0];
+                       current_ctx->gl_vertex_array_size[index]        = size;
+                       current_ctx->gl_vertex_array_type[index]        = type;
+                       current_ctx->gl_vertex_array_normalized[index]  = GL_FALSE;
+                       current_ctx->gl_vertex_array_integer[index]     = GL_TRUE;
+                       current_ctx->gl_vertex_array_stride[index]      = stride;
+                       current_ctx->gl_vertex_array_pointer[index]     = (GLvoid *)pointer;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glVertexAttribI4i(index, x, y, z, w))
+       {
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
+               {
+                       current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
+                       current_ctx->gl_vertex_array_size[index] = 0;
+                       current_ctx->gl_vertex_array_integer[index] = GL_TRUE;
+
+                       current_ctx->gl_vertex_array_type[index] = GL_INT;
+                       current_ctx->gl_vertex_attrib_value_integer[index * 4 + 0] = x;
+                       current_ctx->gl_vertex_attrib_value_integer[index * 4 + 1] = y;
+                       current_ctx->gl_vertex_attrib_value_integer[index * 4 + 2] = z;
+                       current_ctx->gl_vertex_attrib_value_integer[index * 4 + 3] = w;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glVertexAttribI4ui(index, x, y, z, w))
+       {
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
+               {
+                       current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
+                       current_ctx->gl_vertex_array_size[index] = 0;
+                       current_ctx->gl_vertex_array_integer[index] = GL_TRUE;
+
+                       current_ctx->gl_vertex_array_type[index] = GL_UNSIGNED_INT;
+                       current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 0] = x;
+                       current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 1] = y;
+                       current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 2] = z;
+                       current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 3] = w;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glVertexAttribI4iv(GLuint index, const GLint* v)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glVertexAttribI4iv(index, v))
+       {
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
+               {
+                       current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
+                       current_ctx->gl_vertex_array_size[index] = 0;
+                       current_ctx->gl_vertex_array_integer[index] = GL_TRUE;
+
+                       current_ctx->gl_vertex_array_type[index] = GL_INT;
+                       current_ctx->gl_vertex_attrib_value_integer[index * 4 + 0] = v[0];
+                       current_ctx->gl_vertex_attrib_value_integer[index * 4 + 1] = v[1];
+                       current_ctx->gl_vertex_attrib_value_integer[index * 4 + 2] = v[2];
+                       current_ctx->gl_vertex_attrib_value_integer[index * 4 + 3] = v[3];
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glVertexAttribI4uiv(GLuint index, const GLuint* v)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glVertexAttribI4uiv(index, v))
+       {
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
+               {
+                       current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_attrib_value;
+                       current_ctx->gl_vertex_array_size[index] = 0;
+                       current_ctx->gl_vertex_array_integer[index] = GL_TRUE;
+
+                       current_ctx->gl_vertex_array_type[index] = GL_UNSIGNED_INT;
+                       current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 0] = v[0];
+                       current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 1] = v[1];
+                       current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 2] = v[2];
+                       current_ctx->gl_vertex_attrib_value_unsigned_integer[index * 4 + 3] = v[3];
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glGetUniformuiv(GLuint program, GLint location, GLuint* params)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glGetUniformuiv(real_obj, location, params);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+GLint
+fastpath_glGetFragDataLocation(GLuint program, const GLchar *name)
+{
+       GLint ret = _COREGL_INT_INIT_VALUE;
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       ret = _orig_fastpath_glGetFragDataLocation(real_obj, name);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+       return ret;
+}
+
+
+const GLubyte*
+fastpath_glGetStringi(GLenum name, GLuint index)
+{
+       const char *ret = NULL;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       switch (name)
+       {
+               case GL_VERSION:
+                       _set_gl_error(GL_INVALID_ENUM);
+                       goto finish;
+               case GL_EXTENSIONS:
+                       _valid_extension_string();
+                        /* Prevent CID : 397673 (delete 'index < 0' checking) */
+                       if (index >= gl_extension_count)
+                       {
+                               _set_gl_error(GL_INVALID_VALUE);
+                               goto finish;
+                       }
+                       ret = string_each_extensions[index];
+                       break;
+               default:
+                       IF_GL_SUCCESS(ret = (const char *)_orig_fastpath_glGetStringi(name, index))
+                       {
+                       }
+                       else
+                       {
+                               ret = NULL;
+                       }
+                       break;
+       }
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+       return (const GLubyte *)ret;
+}
+
+
+void
+fastpath_glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glGetUniformIndices(real_obj, uniformCount, uniformNames, uniformIndices);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glGetActiveUniformsiv(real_obj, uniformCount, uniformIndices, pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+GLuint
+fastpath_glGetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName)
+{
+       GLuint ret = _COREGL_INT_INIT_VALUE;
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       ret = _orig_fastpath_glGetUniformBlockIndex(real_obj, uniformBlockName);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+       return ret;
+}
+
+void
+fastpath_glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glGetActiveUniformBlockiv(real_obj, uniformBlockIndex, pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+void
+fastpath_glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glGetActiveUniformBlockName(real_obj, uniformBlockIndex, bufSize, length, uniformBlockName);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glUniformBlockBinding(real_obj, uniformBlockIndex, uniformBlockBinding);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glGetInteger64v(GLenum pname, GLint64* params)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glGetInteger64v(pname, params))
+       {
+               _modify_get_value(pname, params, GL_INT, GL_TRUE);
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glGetInteger64i_v(GLenum target, GLuint index, GLint64* data)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glGetInteger64i_v(target, index, data))
+       {
+               _modify_get_value(target, data, GL_INT, GL_TRUE);
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+////////////////////////////////////////////////////////////////////////
+
+void
+fastpath_glGenSamplers(GLsizei n, GLuint* samplers)
+{
+       int i;
+       GLuint *objid_array = NULL;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (n < 0)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+       if (n == 0) goto finish;
+       if (samplers == NULL) goto finish;
+
+       AST(current_ctx->ostate.shared != NULL);
+
+       objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+
+        /* Prevent CID : 385177 */
+        if (objid_array == NULL)
+                goto finish;
+
+       IF_GL_SUCCESS(_orig_fastpath_glGenSamplers(n, objid_array))
+       {
+               for (i = 0; i < n; i++)
+               {
+                       samplers[i] = fastpath_ostate_create_object(&current_ctx->ostate, GL_OBJECT_TYPE_SAMPLER, objid_array[i]);
+               }
+       }
+
+       goto finish;
+
+finish:
+       if (objid_array != NULL)
+       {
+               free(objid_array);
+               objid_array = NULL;
+       }
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glBindSampler(GLuint unit, GLuint sampler)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1)
+       {
+               _set_gl_error(GL_OUT_OF_MEMORY);
+               goto finish;
+       }
+
+       _orig_fastpath_glBindSampler(unit, real_obj);
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+GLboolean
+fastpath_glIsSampler(GLuint sampler)
+{
+       GLboolean ret = GL_FALSE;
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1)
+       {
+               ret = GL_FALSE;
+               goto finish;
+       }
+
+       ret = _orig_fastpath_glIsSampler(real_obj);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+       return ret;
+}
+
+
+void
+fastpath_glDeleteSamplers(GLsizei n, const GLuint* samplers)
+{
+       int i;
+       GLuint *objid_array = NULL;
+       int real_n = 0;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (n < 0)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+       if (n == 0) goto finish;
+       if (samplers == NULL) goto finish;
+
+       AST(current_ctx->ostate.shared != NULL);
+
+       objid_array = (GLuint *)calloc(1, sizeof(GLuint) * n);
+       /* Prevend CID : 451157 */
+       if (objid_array == NULL) goto finish;
+
+       for (i = 0; i < n; i++)
+       {
+               int real_objid = _COREGL_INT_INIT_VALUE;
+               if (samplers[i] == 0) continue;
+
+               real_objid = fastpath_ostate_get_object(&current_ctx->ostate, GL_OBJECT_TYPE_SAMPLER, samplers[i]);
+               if (real_objid == 0) continue;
+
+               AST(fastpath_ostate_remove_object(&current_ctx->ostate, GL_OBJECT_TYPE_SAMPLER, samplers[i]) == 1);
+               objid_array[real_n++] = real_objid;
+       }
+
+       _orig_fastpath_glDeleteSamplers(real_n, objid_array);
+
+       goto finish;
+
+finish:
+       if (objid_array != NULL)
+       {
+               free(objid_array);
+               objid_array = NULL;
+       }
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+////////////////////////////////////////////////////////////////////////
+
+
+void
+fastpath_glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1)
+       {
+               goto finish;
+       }
+
+       _orig_fastpath_glSamplerParameteri(real_obj, pname, param);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+void
+fastpath_glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1)
+       {
+               goto finish;
+       }
+
+       _orig_fastpath_glSamplerParameteriv(real_obj, pname, param);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+void
+fastpath_glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1)
+       {
+               goto finish;
+       }
+
+       _orig_fastpath_glSamplerParameterf(real_obj, pname, param);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+void
+fastpath_glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1)
+       {
+               goto finish;
+       }
+
+       _orig_fastpath_glSamplerParameterfv(real_obj, pname, param);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+void
+fastpath_glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1)
+       {
+               goto finish;
+       }
+
+       _orig_fastpath_glGetSamplerParameteriv(real_obj, pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+void
+fastpath_glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_SAMPLER, sampler, &real_obj) != 1)
+       {
+               goto finish;
+       }
+
+       _orig_fastpath_glGetSamplerParameterfv(real_obj, pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glVertexAttribDivisor(GLuint index, GLuint divisor)
+{
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       IF_GL_SUCCESS(_orig_fastpath_glVertexAttribDivisor(index, divisor))
+       {
+               if (current_ctx->gl_vertex_array_binding[0] == 0)
+               {
+                       current_ctx->_vattrib_flag |= _VATTRIB_FLAG_BIT_gl_vertex_array;
+                       current_ctx->gl_vertex_array_divisor[index] = divisor;
+               }
+       }
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
+void
+fastpath_glProgramParameteri(GLuint program, GLenum pname, GLint value)
+{
+       GLuint real_obj;
+
+       DEFINE_FASTPAH_GL_FUNC();
+       _COREGL_FASTPATH_FUNC_BEGIN();
+       INIT_FASTPATH_GL_FUNC();
+
+       if (GET_REAL_OBJ(GL_OBJECT_TYPE_PROGRAM, program, &real_obj) != 1)
+       {
+               _set_gl_error(GL_INVALID_VALUE);
+               goto finish;
+       }
+
+       _orig_fastpath_glProgramParameteri(real_obj, pname, value);
+
+       goto finish;
+
+finish:
+       _COREGL_FASTPATH_FUNC_END();
+}
+
+
diff --git a/src/modules/fastpath/coregl_fastpath_state.h b/src/modules/fastpath/coregl_fastpath_state.h
new file mode 100644 (file)
index 0000000..c56a410
--- /dev/null
@@ -0,0 +1,247 @@
+#ifndef GLUE_STATE
+#error GLUE_STATE_NOT_DEFINED
+#endif
+
+#ifndef _COREGL_START_API
+#define _COREGL_START_API(version)
+#endif
+
+#ifndef _COREGL_END_API
+#define _COREGL_END_API(version)
+#endif
+
+
+#define SET_1(v1)               value[0] = v1;
+#define SET_2(v1, v2)           value[0] = v1; value[1] = v2;
+#define SET_3(v1, v2, v3)       value[0] = v1; value[1] = v2; value[2] = v3;
+#define SET_4(v1, v2, v3, v4)   value[0] = v1; value[1] = v2; value[2] = v3; value[3] = v4;
+#define SET_N(n, inc, stmt) \
+   { \
+      int i; \
+      for (i = 0; i < n; i++) \
+      { \
+         stmt \
+         value += inc; \
+      } \
+   }
+
+GLUE_STATE(GLuint, gl_num_draw_buffers, 1, 1,
+           _sym_glGetIntegerv(GL_MAX_DRAW_BUFFERS, (GLint *)value); /* DEFAULT NOT EFFECT */,
+           _sym_glGetIntegerv(GL_MAX_DRAW_BUFFERS, (GLint *)value);)
+
+GLUE_STATE(GLuint, gl_num_tex_units, 1, 1,
+           _sym_glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, (GLint *)value); /* DEFAULT NOT EFFECT */,
+           _sym_glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, (GLint *)value);)
+
+GLUE_STATE(GLuint, gl_num_vertex_attribs, 1, 1,
+           _sym_glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, (GLint *)value); /* DEFAULT NOT EFFECT */,
+           _sym_glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, (GLint *)value);)
+
+GLUE_STATE(GLuint, gl_num_transform_feedback_separate_attribs, 1, 1,
+           _sym_glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, (GLint *)value); /* DEFAULT NOT EFFECT */,
+           _sym_glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, (GLint *)value);)
+
+GLUE_STATE(GLuint, gl_num_uniform_buffer_bindings, 1, 1,
+           _sym_glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, (GLint *)value); /* DEFAULT NOT EFFECT */,
+           _sym_glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, (GLint *)value);)
+
+GLUE_STATE(GLuint, gl_array_buffer_binding, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_ARRAY_BUFFER_BINDING, (GLint *)value);)
+GLUE_STATE(GLuint, gl_copy_read_buffer_binding, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_COPY_READ_BUFFER_BINDING, (GLint *)value);)
+GLUE_STATE(GLuint, gl_copy_write_buffer_binding, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_COPY_WRITE_BUFFER_BINDING, (GLint *)value);)
+GLUE_STATE(GLuint, gl_element_array_buffer_binding, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, (GLint *)value);)
+GLUE_STATE(GLuint, gl_pixel_pack_buffer_binding, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_PIXEL_PACK_BUFFER_BINDING, (GLint *)value);)
+GLUE_STATE(GLuint, gl_pixel_unpack_buffer_binding, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_PIXEL_UNPACK_BUFFER_BINDING, (GLint *)value);)
+GLUE_STATE(GLuint, gl_transform_feedback_buffer_binding, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_TRANSFORM_FEEDBACK_BUFFER_BINDING, (GLint *)value);)
+GLUE_STATE(GLuint, gl_uniform_buffer_binding, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_UNIFORM_BUFFER_BINDING, (GLint *)value);)
+
+_COREGL_START_API(COREGL_GLAPI_3)
+GLUE_STATE(GLuint, gl_transform_feedback_buffer_binding_array, INITIAL_CTX->gl_num_transform_feedback_separate_attribs[0], MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS,
+       _state_get_transform_feedback_buffer_bindings(value); /* DEFAULT NOT EFFECT */,
+       _state_get_transform_feedback_buffer_bindings(value);)
+
+GLUE_STATE(GLintptr, gl_transform_feedback_buffer_binding_array_offset, INITIAL_CTX->gl_num_transform_feedback_separate_attribs[0], MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS,
+       _state_get_transform_feedback_buffer_bindings_offset(value); /* DEFAULT NOT EFFECT */,
+       _state_get_transform_feedback_buffer_bindings_offset(value);)
+
+GLUE_STATE(GLsizeiptr, gl_transform_feedback_buffer_binding_array_size, INITIAL_CTX->gl_num_transform_feedback_separate_attribs[0], MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS,
+       _state_get_transform_feedback_buffer_bindings_size(value); /* DEFAULT NOT EFFECT */,
+       _state_get_transform_feedback_buffer_bindings_size(value);)
+
+GLUE_STATE(GLuint, gl_uniform_buffer_binding_array, INITIAL_CTX->gl_num_uniform_buffer_bindings[0], MAX_UNIFORM_BUFFER_BINDINGS,
+       _state_get_uniform_buffer_bindings(value); /* DEFAULT NOT EFFECT */,
+       _state_get_uniform_buffer_bindings(value);)
+
+GLUE_STATE(GLintptr, gl_uniform_buffer_binding_array_offset, INITIAL_CTX->gl_num_uniform_buffer_bindings[0], MAX_UNIFORM_BUFFER_BINDINGS,
+       _state_get_uniform_buffer_bindings_offset(value); /* DEFAULT NOT EFFECT */,
+       _state_get_uniform_buffer_bindings_offset(value);)
+
+GLUE_STATE(GLsizeiptr, gl_uniform_buffer_binding_array_size, INITIAL_CTX->gl_num_uniform_buffer_bindings[0], MAX_UNIFORM_BUFFER_BINDINGS,
+       _state_get_uniform_buffer_bindings_size(value); /* DEFAULT NOT EFFECT */,
+       _state_get_uniform_buffer_bindings_size(value);)
+_COREGL_END_API(COREGL_GLAPI_3)
+
+GLUE_STATE(GLuint, gl_framebuffer_binding, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint *)value);)
+GLUE_STATE(GLuint, gl_framebuffer_binding_read, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING_ANGLE, (GLint *)value);)
+GLUE_STATE(GLuint, gl_framebuffer_binding_draw, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING_ANGLE, (GLint *)value);)
+GLUE_STATE(GLuint, gl_renderbuffer_binding, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_RENDERBUFFER_BINDING, (GLint *)value);)
+
+GLUE_STATE(GLboolean, gl_blend, 1, 1, SET_1(GL_FALSE), _sym_glGetBooleanv(GL_BLEND, (GLboolean *)value);)
+GLUE_STATE(GLboolean, gl_cull_face, 1, 1, SET_1(GL_FALSE), _sym_glGetBooleanv(GL_CULL_FACE, (GLboolean *)value);)
+GLUE_STATE(GLboolean, gl_depth_test, 1, 1, SET_1(GL_FALSE), _sym_glGetBooleanv(GL_DEPTH_TEST, (GLboolean *)value);)
+GLUE_STATE(GLboolean, gl_dither, 1, 1, SET_1(GL_TRUE), _sym_glGetBooleanv(GL_DITHER, (GLboolean *)value);)
+
+GLUE_STATE(GLboolean, gl_polygon_offset_fill, 1, 1, SET_1(GL_FALSE), _sym_glGetBooleanv(GL_POLYGON_OFFSET_FILL, (GLboolean *)value);)
+GLUE_STATE(GLboolean, gl_sample_alpha_to_coverage, 1, 1, SET_1(GL_FALSE), _sym_glGetBooleanv(GL_SAMPLE_ALPHA_TO_COVERAGE, (GLboolean *)value);)
+GLUE_STATE(GLboolean, gl_sample_coverage, 1, 1, SET_1(GL_FALSE), _sym_glGetBooleanv(GL_SAMPLE_COVERAGE, (GLboolean *)value);)
+GLUE_STATE(GLboolean, gl_scissor_test, 1, 1, SET_1(GL_FALSE), _sym_glGetBooleanv(GL_SCISSOR_TEST, (GLboolean *)value);)
+GLUE_STATE(GLboolean, gl_stencil_test, 1, 1, SET_1(GL_FALSE), _sym_glGetBooleanv(GL_STENCIL_TEST, (GLboolean *)value);)
+
+GLUE_STATE(GLboolean, gl_primitive_restart_fixed_index, 1, 1, SET_1(GL_FALSE), _sym_glGetBooleanv(GL_PRIMITIVE_RESTART_FIXED_INDEX, (GLboolean *)value);)
+GLUE_STATE(GLboolean, gl_rasterizer_discard, 1, 1, SET_1(GL_FALSE), _sym_glGetBooleanv(GL_RASTERIZER_DISCARD, (GLboolean *)value);)
+
+GLUE_STATE(GLint, gl_viewport, 4, 4,
+           _sym_glGetIntegerv(GL_VIEWPORT, (GLint *)value); /* DEFAULT NOT EFFECT */,
+           _sym_glGetIntegerv(GL_VIEWPORT, (GLint *)value);)
+
+GLUE_STATE(GLuint, gl_current_program, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_CURRENT_PROGRAM, (GLint *)value);)
+GLUE_STATE(GLclampf, gl_color_clear_value, 4, 4, SET_4(0.0f, 0.0f, 0.0f, 0.0f), _sym_glGetFloatv(GL_COLOR_CLEAR_VALUE, (GLfloat *)value);)
+
+GLUE_STATE(GLboolean, gl_color_writemask, 4, 4, SET_4(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE), _sym_glGetBooleanv(GL_COLOR_WRITEMASK, (GLboolean *)value);)
+GLUE_STATE(GLclampf, gl_depth_range, 2, 2, SET_2(0.0f, 1.0f), _sym_glGetFloatv(GL_DEPTH_RANGE, (GLfloat *)value);)
+GLUE_STATE(GLclampf, gl_depth_clear_value, 1, 1, SET_1(1.0f), _sym_glGetFloatv(GL_DEPTH_CLEAR_VALUE, (GLfloat *)value);)
+GLUE_STATE(GLenum, gl_depth_func, 1, 1, SET_1(GL_LESS), _sym_glGetIntegerv(GL_DEPTH_FUNC, (GLint *)value);)
+GLUE_STATE(GLboolean, gl_depth_writemask, 1, 1, SET_1(GL_TRUE), _sym_glGetBooleanv(GL_DEPTH_WRITEMASK, (GLboolean *)value);)
+GLUE_STATE(GLenum, gl_cull_face_mode, 1, 1, SET_1(GL_BACK), _sym_glGetIntegerv(GL_CULL_FACE_MODE, (GLint *)value);)
+
+GLUE_STATE(GLuint, gl_tex_2d_state, INITIAL_CTX->gl_num_tex_units[0], MAX_TEXTURE_UNITS,
+           SET_N(INITIAL_CTX->gl_num_tex_units[0], 1, SET_1(0)),
+           _state_get_texture_states(GL_TEXTURE_BINDING_2D, (GLint *)value);)
+GLUE_STATE(GLuint, gl_tex_3d_state, INITIAL_CTX->gl_num_tex_units[0], MAX_TEXTURE_UNITS,
+           SET_N(INITIAL_CTX->gl_num_tex_units[0], 1, SET_1(0)),
+           _state_get_texture_states(GL_TEXTURE_BINDING_3D, (GLint *)value);)
+GLUE_STATE(GLuint, gl_tex_2d_array_state, INITIAL_CTX->gl_num_tex_units[0], MAX_TEXTURE_UNITS,
+           SET_N(INITIAL_CTX->gl_num_tex_units[0], 1, SET_1(0)),
+           _state_get_texture_states(GL_TEXTURE_BINDING_2D_ARRAY, (GLint *)value);)
+GLUE_STATE(GLuint, gl_tex_cube_state, INITIAL_CTX->gl_num_tex_units[0], MAX_TEXTURE_UNITS,
+           SET_N(INITIAL_CTX->gl_num_tex_units[0], 1, SET_1(0)),
+           _state_get_texture_states(GL_TEXTURE_BINDING_CUBE_MAP, (GLint *)value);)
+GLUE_STATE(GLuint, gl_tex_external_oes_state, INITIAL_CTX->gl_num_tex_units[0], MAX_TEXTURE_UNITS,
+           SET_N(INITIAL_CTX->gl_num_tex_units[0], 1, SET_1(0)),
+           _state_get_texture_states(GL_TEXTURE_EXTERNAL_OES, (GLint *)value);)
+
+GLUE_STATE(GLenum, gl_active_texture, 1, 1, SET_1(GL_TEXTURE0), _sym_glGetIntegerv(GL_ACTIVE_TEXTURE, (GLint *)value))
+GLUE_STATE(GLenum, gl_generate_mipmap_hint, 1, 1, SET_1(GL_DONT_CARE), _sym_glGetIntegerv(GL_GENERATE_MIPMAP_HINT, (GLint *)value))
+
+GLUE_STATE(GLclampf, gl_blend_color, 4, 4, SET_4(0.0f, 0.0f, 0.0f, 0.0f), _sym_glGetFloatv(GL_BLEND_COLOR, (GLfloat *)value);)
+GLUE_STATE(GLenum, gl_blend_src_rgb, 1, 1, SET_1(GL_ONE), _sym_glGetIntegerv(GL_BLEND_SRC_RGB, (GLint *)value);)
+GLUE_STATE(GLenum, gl_blend_src_alpha, 1, 1, SET_1(GL_ONE), _sym_glGetIntegerv(GL_BLEND_SRC_ALPHA, (GLint *)value);)
+GLUE_STATE(GLenum, gl_blend_dst_rgb, 1, 1, SET_1(GL_ZERO), _sym_glGetIntegerv(GL_BLEND_DST_RGB, (GLint *)value);)
+GLUE_STATE(GLenum, gl_blend_dst_alpha, 1, 1, SET_1(GL_ZERO), _sym_glGetIntegerv(GL_BLEND_DST_ALPHA, (GLint *)value);)
+GLUE_STATE(GLenum, gl_blend_equation_rgb, 1, 1, SET_1(GL_FUNC_ADD), _sym_glGetIntegerv(GL_BLEND_EQUATION_RGB, (GLint *)value);)
+GLUE_STATE(GLenum, gl_blend_equation_alpha, 1, 1, SET_1(GL_FUNC_ADD), _sym_glGetIntegerv(GL_BLEND_EQUATION_ALPHA, (GLint *)value);)
+
+
+GLUE_STATE(GLenum, gl_stencil_func, 1, 1, SET_1(GL_ALWAYS), _sym_glGetIntegerv(GL_STENCIL_FUNC, (GLint *)value);)
+GLUE_STATE(GLint, gl_stencil_ref, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_STENCIL_REF, (GLint *)value);)
+GLUE_STATE(GLuintmask, gl_stencil_value_mask, 1, 1,
+           _sym_glGetIntegerv(GL_STENCIL_VALUE_MASK, (GLint *)value); /* DEFAULT NOT EFFECT */,
+           _sym_glGetIntegerv(GL_STENCIL_VALUE_MASK, (GLint *)value);)
+GLUE_STATE(GLenum, gl_stencil_fail, 1, 1, SET_1(GL_KEEP), _sym_glGetIntegerv(GL_STENCIL_FAIL, (GLint *)value);)
+GLUE_STATE(GLenum, gl_stencil_pass_depth_fail, 1, 1, SET_1(GL_KEEP), _sym_glGetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL, (GLint *)value);)
+GLUE_STATE(GLenum, gl_stencil_pass_depth_pass, 1, 1, SET_1(GL_KEEP), _sym_glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS, (GLint *)value);)
+GLUE_STATE(GLuintmask, gl_stencil_writemask, 1, 1,
+           _sym_glGetIntegerv(GL_STENCIL_WRITEMASK, (GLint *)value); /* DEFAULT NOT EFFECT */,
+           _sym_glGetIntegerv(GL_STENCIL_WRITEMASK, (GLint *)value);)
+
+GLUE_STATE(GLenum, gl_stencil_back_func, 1, 1, SET_1(GL_ALWAYS), _sym_glGetIntegerv(GL_STENCIL_BACK_FUNC, (GLint *)value);)
+GLUE_STATE(GLint, gl_stencil_back_ref, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_STENCIL_BACK_REF, (GLint *)value);)
+GLUE_STATE(GLuintmask, gl_stencil_back_value_mask, 1, 1,
+           _sym_glGetIntegerv(GL_STENCIL_BACK_VALUE_MASK, (GLint *)value); /* DEFAULT NOT EFFECT */,
+           _sym_glGetIntegerv(GL_STENCIL_BACK_VALUE_MASK, (GLint *)value);)
+GLUE_STATE(GLenum, gl_stencil_back_fail, 1, 1, SET_1(GL_KEEP), _sym_glGetIntegerv(GL_STENCIL_BACK_FAIL, (GLint *)value);)
+GLUE_STATE(GLenum, gl_stencil_back_pass_depth_fail, 1, 1, SET_1(GL_KEEP), _sym_glGetIntegerv(GL_STENCIL_BACK_PASS_DEPTH_FAIL, (GLint *)value);)
+GLUE_STATE(GLenum, gl_stencil_back_pass_depth_pass, 1, 1, SET_1(GL_KEEP), _sym_glGetIntegerv(GL_STENCIL_BACK_PASS_DEPTH_PASS, (GLint *)value);)
+GLUE_STATE(GLuintmask, gl_stencil_back_writemask, 1, 1,
+           _sym_glGetIntegerv(GL_STENCIL_BACK_WRITEMASK, (GLint *)value); /* DEFAULT NOT EFFECT */,
+           _sym_glGetIntegerv(GL_STENCIL_BACK_WRITEMASK, (GLint *)value);)
+
+GLUE_STATE(GLint, gl_stencil_clear_value, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_STENCIL_CLEAR_VALUE, (GLint *)value);)
+
+// PIXEL FLAG 1
+GLUE_STATE(GLint, gl_pack_row_length, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_PACK_ROW_LENGTH, (GLint *)value);)
+GLUE_STATE(GLint, gl_pack_skip_rows, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_PACK_SKIP_ROWS, (GLint *)value);)
+GLUE_STATE(GLint, gl_pack_skip_pixels, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_PACK_SKIP_PIXELS, (GLint *)value);)
+GLUE_STATE(GLint, gl_pack_alignment, 1, 1, SET_1(4), _sym_glGetIntegerv(GL_PACK_ALIGNMENT, (GLint *)value);)
+
+// PIXEL FLAG 2
+GLUE_STATE(GLint, gl_unpack_row_length, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_UNPACK_ROW_LENGTH, (GLint *)value);)
+GLUE_STATE(GLint, gl_unpack_skip_rows, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_UNPACK_SKIP_ROWS, (GLint *)value);)
+GLUE_STATE(GLint, gl_unpack_skip_pixels, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_UNPACK_SKIP_PIXELS, (GLint *)value);)
+GLUE_STATE(GLint, gl_unpack_alignment, 1, 1, SET_1(4), _sym_glGetIntegerv(GL_UNPACK_ALIGNMENT, (GLint *)value);)
+GLUE_STATE(GLint, gl_unpack_image_height, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_UNPACK_IMAGE_HEIGHT, (GLint *)value);)
+GLUE_STATE(GLint, gl_unpack_skip_images, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_UNPACK_SKIP_IMAGES, (GLint *)value);)
+
+// MISC FLAG 1
+GLUE_STATE(GLenum, gl_front_face, 1, 1, SET_1(GL_CCW), _sym_glGetIntegerv(GL_FRONT_FACE, (GLint *)value);)
+GLUE_STATE(GLfloat, gl_line_width, 1, 1, SET_1(1.0f), _sym_glGetFloatv(GL_LINE_WIDTH, (GLfloat *)value);)
+GLUE_STATE(GLfloat, gl_polygon_offset_factor, 1, 1, SET_1(0.0f), _sym_glGetFloatv(GL_POLYGON_OFFSET_FACTOR, (GLfloat *)value);)
+GLUE_STATE(GLfloat, gl_polygon_offset_units, 1, 1, SET_1(0.0f), _sym_glGetFloatv(GL_POLYGON_OFFSET_UNITS, (GLfloat *)value);)
+GLUE_STATE(GLclampf, gl_sample_coverage_value, 1, 1, SET_1(1.0f), _sym_glGetFloatv(GL_SAMPLE_COVERAGE_VALUE, (GLfloat *)value);)
+GLUE_STATE(GLboolean, gl_sample_coverage_invert, 1, 1, SET_1(GL_FALSE), _sym_glGetBooleanv(GL_SAMPLE_COVERAGE_INVERT, (GLboolean *)value);)
+GLUE_STATE(GLenum, gl_fragment_shader_derivative_hint, 1, 1, SET_1(GL_DONT_CARE), _sym_glGetIntegerv(GL_FRAGMENT_SHADER_DERIVATIVE_HINT, (GLint *)value);)
+
+// MISC FLAG 2
+GLUE_STATE(GLint, gl_scissor_box, 4, 4,
+           _sym_glGetIntegerv(GL_SCISSOR_BOX, (GLint *)value); /* DEFAULT NOT EFFECT */,
+           _sym_glGetIntegerv(GL_SCISSOR_BOX, (GLint *)value);)
+
+GLUE_STATE(GLuint, gl_vertex_array_buf_id, INITIAL_CTX->gl_num_vertex_attribs[0], MAX_VERTEX_ATTRIBS,
+           SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 1, SET_1(0)),
+           SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 1, _sym_glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, (GLint *)value);))
+GLUE_STATE(GLboolean, gl_vertex_array_enabled, INITIAL_CTX->gl_num_vertex_attribs[0], MAX_VERTEX_ATTRIBS,
+           SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 1, SET_1(GL_FALSE)),
+           SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 1, _sym_glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_ENABLED, (GLint *)value);))
+GLUE_STATE(GLint, gl_vertex_array_size, INITIAL_CTX->gl_num_vertex_attribs[0], MAX_VERTEX_ATTRIBS,
+           SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 1, SET_1(4)),
+           SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 1, _sym_glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_SIZE, (GLint *)value);))
+GLUE_STATE(GLsizei, gl_vertex_array_stride, INITIAL_CTX->gl_num_vertex_attribs[0], MAX_VERTEX_ATTRIBS,
+           SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 1, SET_1(GL_FALSE)),
+           SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 1, _sym_glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_STRIDE, (GLint *)value);))
+GLUE_STATE(GLenum, gl_vertex_array_type, INITIAL_CTX->gl_num_vertex_attribs[0], MAX_VERTEX_ATTRIBS,
+           SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 1, SET_1(GL_FLOAT)),
+           SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 1, _sym_glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_TYPE, (GLint *)value);))
+GLUE_STATE(GLboolean, gl_vertex_array_normalized, INITIAL_CTX->gl_num_vertex_attribs[0], MAX_VERTEX_ATTRIBS,
+           SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 1, SET_1(GL_FALSE)),
+           SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 1, _sym_glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, (GLint *)value);))
+GLUE_STATE(GLboolean, gl_vertex_array_integer, INITIAL_CTX->gl_num_vertex_attribs[0], MAX_VERTEX_ATTRIBS,
+           SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 1, SET_1(GL_FALSE)),
+           SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 1, _sym_glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_INTEGER, (GLint *)value);))
+GLUE_STATE(GLuint, gl_vertex_array_divisor, INITIAL_CTX->gl_num_vertex_attribs[0], MAX_VERTEX_ATTRIBS,
+           SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 1, SET_1(GL_FALSE)),
+           SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 1, _sym_glGetVertexAttribiv(i, GL_VERTEX_ATTRIB_ARRAY_DIVISOR, (GLint *)value);))
+GLUE_STATE(GLvoidptr, gl_vertex_array_pointer, INITIAL_CTX->gl_num_vertex_attribs[0], MAX_VERTEX_ATTRIBS,
+           SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 1, SET_1(NULL)),
+           SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 1, _sym_glGetVertexAttribPointerv(i, GL_VERTEX_ATTRIB_ARRAY_POINTER, (GLvoidptr *)value);))
+GLUE_STATE(GLfloat, gl_vertex_attrib_value, 4 * INITIAL_CTX->gl_num_vertex_attribs[0], MAX_VERTEX_ATTRIBS,
+           SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 4, SET_4(0, 0, 0, 1)),
+           SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 4, _sym_glGetVertexAttribfv(i, GL_CURRENT_VERTEX_ATTRIB, (GLfloat *)value);))
+
+_COREGL_START_API(COREGL_GLAPI_3)
+GLUE_STATE(GLint, gl_vertex_attrib_value_integer, 4 * INITIAL_CTX->gl_num_vertex_attribs[0], MAX_VERTEX_ATTRIBS,
+           SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 4, SET_4(0, 0, 0, GET_INT_FROM_FLOAT(1.0f))),
+           SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 4, _sym_glGetVertexAttribIiv(i, GL_CURRENT_VERTEX_ATTRIB, (GLint *)value);))
+GLUE_STATE(GLuint, gl_vertex_attrib_value_unsigned_integer, 4 * INITIAL_CTX->gl_num_vertex_attribs[0], MAX_VERTEX_ATTRIBS,
+           SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 4, SET_4(0, 0, 0, GET_UINT_FROM_FLOAT(1.0f))),
+           SET_N(INITIAL_CTX->gl_num_vertex_attribs[0], 4, _sym_glGetVertexAttribIuiv(i, GL_CURRENT_VERTEX_ATTRIB, (GLuint *)value);))
+
+// MISC FLAG 3
+GLUE_STATE(GLenum, gl_read_buffer, 1, 1, SET_1(GL_BACK), _sym_glGetIntegerv(GL_READ_BUFFER, (GLint *)value);)
+GLUE_STATE(GLenum, gl_draw_buffers, INITIAL_CTX->gl_num_draw_buffers[0], 16,
+           SET_1(GL_BACK); value++; SET_N(INITIAL_CTX->gl_num_draw_buffers[0] - 1, 1, SET_1(GL_NONE)),
+           _state_get_draw_buffers(value);)
+GLUE_STATE(GLuint, gl_vertex_array_binding, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_VERTEX_ARRAY_BINDING, (GLint *)value);)
+GLUE_STATE(GLuint, gl_transform_feedback_binding, 1, 1, SET_1(0), _sym_glGetIntegerv(GL_TRANSFORM_FEEDBACK_BINDING, (GLint *)value);)
+GLUE_STATE(GLboolean, gl_transform_feedback_active, 1, 1, SET_1(0), _sym_glGetBooleanv(GL_TRANSFORM_FEEDBACK_ACTIVE, (GLboolean *)value);)
+GLUE_STATE(GLboolean, gl_transform_feedback_paused, 1, 1, SET_1(0), _sym_glGetBooleanv(GL_TRANSFORM_FEEDBACK_PAUSED, (GLboolean *)value);)
+_COREGL_END_API(COREGL_GLAPI_3)
+
diff --git a/src/modules/tracepath/coregl_tracepath.c b/src/modules/tracepath/coregl_tracepath.c
new file mode 100644 (file)
index 0000000..2ea39b8
--- /dev/null
@@ -0,0 +1,1574 @@
+#include "coregl_tracepath.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <dlfcn.h>
+static int         api_gl_version;
+
+
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     RET_TYPE (*_orig_tracepath_##FUNC_NAME) PARAM_LIST = NULL;
+#include "../../headers/sym.h"
+#undef _COREGL_SYMBOL
+
+#define TIMEVAL_INIT            { 0, 0 }
+
+struct _Trace_Data
+{
+       char                         name[MAX_TRACE_NAME_LENGTH];
+       struct _Trace_Data          *next;
+};
+
+struct _Apicall_Data
+{
+       struct _Trace_Data          trace_data;
+
+       int                          call_count;
+       int                          last_call_count;
+       struct timeval              elapsed_time;
+       struct timeval              elapsed_time_max;
+       struct timeval              last_elapsed_time;
+       struct timeval              total_elapsed_time;
+       struct timeval              last_total_elapsed_time;
+       struct timeval              last_time;
+
+       int                          traced;
+};
+
+struct _Memuse_Data
+{
+       struct _Trace_Data          trace_data;
+
+       int                          memsize;
+       int                          alloc_count;
+       int                          remove_count;
+};
+
+struct _Surface_Data
+{
+       struct _Trace_Data          trace_data;
+
+       GLDisplay                    display;
+       GLSurface                    surface;
+       GLContext                    context;
+       GLint                        fbo;
+       GLint                        tex;
+       GLint                        rb;
+       int                          dump_count;
+       GLint                        tex_w;
+       GLint                        tex_h;
+       GLint                        tex_format;
+};
+
+typedef struct _GLGlueFakeContext
+{
+       GLuint gl_num_draw_buffers[1];
+       GLuint gl_num_tex_units[1];
+       GLuint gl_num_vertex_attribs[1];
+       GLuint gl_num_transform_feedback_separate_attribs[1];
+       GLuint gl_num_uniform_buffer_bindings[1];
+} GLGlueFakeContext;
+
+GLGlueFakeContext initial_fake_ctx_real;
+GLGlueFakeContext *initial_fake_ctx = &initial_fake_ctx_real;
+
+struct timeval     initial_time = TIMEVAL_INIT;
+struct timeval     last_initial_time = TIMEVAL_INIT;
+
+struct timeval     last_trace_time = TIMEVAL_INIT;
+struct timeval     other_elapsed_time = TIMEVAL_INIT;
+struct timeval     traced_other_elapsed_time = TIMEVAL_INIT;
+
+Mutex               mtd_access_mutex = MUTEX_INITIALIZER;
+Memuse_Data       **mtd_table;
+
+Mutex               std_access_mutex = MUTEX_INITIALIZER;
+Surface_Data      **std_table;
+
+static void
+_state_get_texture_states(GLenum pname, GLint *params)
+{
+       GLuint cur_active_tex = 0;
+
+       AST(initial_fake_ctx != NULL);
+
+       _orig_tracepath_glGetIntegerv(GL_ACTIVE_TEXTURE, (GLint *)&cur_active_tex);
+       int i;
+       for (i = 0; i < initial_fake_ctx->gl_num_tex_units[0]; i++)
+       {
+               _orig_tracepath_glActiveTexture(GL_TEXTURE0 + i);
+               _orig_tracepath_glGetIntegerv(pname, (GLint *)&params[i]);
+       }
+       _orig_tracepath_glActiveTexture(cur_active_tex);
+}
+
+static void
+_state_get_draw_buffers(GLenum *params)
+{
+       AST(initial_fake_ctx != NULL);
+
+       int i;
+       for (i = 0; i < initial_fake_ctx->gl_num_draw_buffers[0]; i++)
+       {
+               _orig_tracepath_glGetIntegerv(GL_DRAW_BUFFER0 + i, (GLint *)&params[i]);
+       }
+}
+
+static void
+_state_get_transform_feedback_buffer_bindings(GLuint *params)
+{
+       AST(initial_fake_ctx != NULL);
+
+       int i;
+       for (i = 0; i < initial_fake_ctx->gl_num_transform_feedback_separate_attribs[0]; i++)
+       {
+               _orig_tracepath_glGetIntegeri_v(GL_TRANSFORM_FEEDBACK_BUFFER_BINDING, i, (GLint *)&params[i]);
+       }
+}
+
+static void
+_state_get_transform_feedback_buffer_bindings_offset(GLintptr *params)
+{
+       AST(initial_fake_ctx != NULL);
+
+       int i;
+       for (i = 0; i < initial_fake_ctx->gl_num_transform_feedback_separate_attribs[0]; i++)
+       {
+               _orig_tracepath_glGetIntegeri_v(GL_TRANSFORM_FEEDBACK_BUFFER_START, i, (GLint *)&params[i]);
+       }
+}
+
+static void
+_state_get_transform_feedback_buffer_bindings_size(GLsizeiptr *params)
+{
+       AST(initial_fake_ctx != NULL);
+
+       int i;
+       for (i = 0; i < initial_fake_ctx->gl_num_transform_feedback_separate_attribs[0]; i++)
+       {
+               _orig_tracepath_glGetIntegeri_v(GL_TRANSFORM_FEEDBACK_BUFFER_SIZE, i, (GLint *)&params[i]);
+       }
+}
+
+static void
+_state_get_uniform_buffer_bindings(GLuint *params)
+{
+       AST(initial_fake_ctx != NULL);
+
+       int i;
+       for (i = 0; i < initial_fake_ctx->gl_num_uniform_buffer_bindings[0]; i++)
+       {
+/////////////////////////////////////////////////////////////////////////////////
+// XXXX : AVOID SEGFAULT in ADRENO
+               ((GLint *)params)[i] = 0;
+//             _orig_tracepath_glGetIntegeri_v(GL_UNIFORM_BUFFER_BINDING, i, (GLint *)&params[i]);
+/////////////////////////////////////////////////////////////////////////////////
+       }
+}
+
+static void
+_state_get_uniform_buffer_bindings_offset(GLintptr *params)
+{
+       AST(initial_fake_ctx != NULL);
+
+       int i;
+       for (i = 0; i < initial_fake_ctx->gl_num_uniform_buffer_bindings[0]; i++)
+       {
+               _orig_tracepath_glGetIntegeri_v(GL_UNIFORM_BUFFER_START, i, (GLint *)&params[i]);
+       }
+}
+
+static void
+_state_get_uniform_buffer_bindings_size(GLsizeiptr *params)
+{
+       AST(initial_fake_ctx != NULL);
+
+       int i;
+       for (i = 0; i < initial_fake_ctx->gl_num_uniform_buffer_bindings[0]; i++)
+       {
+               _orig_tracepath_glGetIntegeri_v(GL_UNIFORM_BUFFER_SIZE, i, (GLint *)&params[i]);
+       }
+}
+
+void
+init_modules_tracepath()
+{
+       {
+               const char *output_file = NULL;
+               output_file = get_env_setting("COREGL_LOG_FILE");
+               if (strlen(output_file) > 0)
+               {
+                       trace_fp = fopen(output_file, "w");
+               }
+       }
+
+#ifdef COREGL_TRACEPATH_TRACE_APICALL_INFO
+       trace_api_flag = atoi(get_env_setting("COREGL_TRACE_API"));
+       trace_api_all_flag = atoi(get_env_setting("COREGL_TRACE_API_ALL"));
+       trace_api_frame_flag = atoi(get_env_setting("COREGL_TRACE_API_FRAME"));
+#endif
+#ifdef COREGL_TRACEPATH_TRACE_MEMUSE_INFO
+       trace_mem_flag = atoi(get_env_setting("COREGL_TRACE_MEM"));
+       trace_mem_all_flag = atoi(get_env_setting("COREGL_TRACE_MEM_ALL"));
+#endif
+#ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO
+       trace_surface_flag = atoi(get_env_setting("COREGL_TRACE_SURFACE"));
+       trace_surface_sequence_sort_flag = atoi(get_env_setting("COREGL_TRACE_SURFACE_SEQUENCE_SORT"));
+       trace_surface_print_only_flag = atoi(get_env_setting("COREGL_TRACE_SURFACE_PRINT_ONLY"));
+
+       { // COREGL_TRACE_SURFACE_FILTER_PERIOD=40~60
+               char tmp[64 + 1] = { 0 }, *tmpp = NULL;
+               strncpy(tmp, get_env_setting("COREGL_TRACE_SURFACE_FILTER_PERIOD"), 64);
+               for (tmpp = &tmp[0]; ; tmpp++)
+               {
+                       if (*tmpp == 0x00) break;
+                       if (*tmpp == '~')
+                       {
+                               *tmpp = 0x00;
+                               trace_surface_filter_period_begin = atoi(tmp);
+                               trace_surface_filter_period_end = atoi(tmpp + 1);
+                               break;
+                       }
+               }
+       }
+
+       { // COREGL_TRACE_SURFACE_FILTER_TYPE=EGL|FBO
+               char tmp[64 + 1] = { 0 };
+               strncpy(tmp, get_env_setting("COREGL_TRACE_SURFACE_FILTER_TYPE"), 64);
+               if (strcmp(tmp, "EGL") == 0) trace_surface_filter_type = 1;
+               if (strcmp(tmp, "FBO") == 0) trace_surface_filter_type = 2;
+       }
+
+       { // COREGL_TRACE_SURFACE_FILTER_HANDLE=0x3234
+               char tmp[64 + 1] = { 0 }, *tmpp = NULL;
+               strncpy(tmp, get_env_setting("COREGL_TRACE_SURFACE_FILTER_HANDLE"), 64);
+               if (tmp[0] == '0' && tmp[1] == 'x')
+               {
+                       for (tmpp = &tmp[2]; ; tmpp++)
+                       {
+                               if (*tmpp == 0x00) break;
+                               trace_surface_filter_handle *= 16;
+                               switch (*tmpp)
+                               {
+                                       case '1' : trace_surface_filter_handle += 1; break;
+                                       case '2' : trace_surface_filter_handle += 2; break;
+                                       case '3' : trace_surface_filter_handle += 3; break;
+                                       case '4' : trace_surface_filter_handle += 4; break;
+                                       case '5' : trace_surface_filter_handle += 5; break;
+                                       case '6' : trace_surface_filter_handle += 6; break;
+                                       case '7' : trace_surface_filter_handle += 7; break;
+                                       case '8' : trace_surface_filter_handle += 8; break;
+                                       case '9' : trace_surface_filter_handle += 9; break;
+                                       case 'A' : case 'a' : trace_surface_filter_handle += 10; break;
+                                       case 'B' : case 'b' : trace_surface_filter_handle += 11; break;
+                                       case 'C' : case 'c' : trace_surface_filter_handle += 12; break;
+                                       case 'D' : case 'd' : trace_surface_filter_handle += 13; break;
+                                       case 'E' : case 'e' : trace_surface_filter_handle += 14; break;
+                                       case 'F' : case 'f' : trace_surface_filter_handle += 15; break;
+                               }
+                       }
+               }
+               else
+               {
+                       trace_surface_filter_handle = atoi(tmp);
+               }
+       }
+
+       { // COREGL_TRACE_SURFACE_FILTER_SIZE=640x480
+               char tmp[64 + 1] = { 0 }, *tmpp = NULL;
+               strncpy(tmp, get_env_setting("COREGL_TRACE_SURFACE_FILTER_SIZE"), 64);
+               for (tmpp = &tmp[0]; ; tmpp++)
+               {
+                       if (*tmpp == 0x00) break;
+                       if (*tmpp == 'x')
+                       {
+                               *tmpp = 0x00;
+                               trace_surface_filter_size_w = atoi(tmp);
+                               trace_surface_filter_size_h = atoi(tmpp + 1);
+                               break;
+                       }
+               }
+       }
+
+#endif
+#ifdef COREGL_TRACEPATH_TRACE_CONTEXT_INFO
+       trace_ctx_flag = atoi(get_env_setting("COREGL_TRACE_CTX"));
+       trace_ctx_force_flag = atoi(get_env_setting("COREGL_TRACE_CTX_FORCE"));
+#endif
+#ifdef COREGL_TRACEPATH_TRACE_STATE_INFO
+       trace_state_flag = atoi(get_env_setting("COREGL_TRACE_STATE"));
+#endif
+
+       if (USE_TRACEPATH)
+       {
+               COREGL_LOG("[CoreGL] \E[40;32;1m<Trace> \E[40;37;1m: ");
+
+               if (trace_api_flag == 1)
+               {
+                       COREGL_LOG("\E[40;31;1m(API)\E[0m ");
+                       if (trace_api_all_flag == 1) COREGL_LOG("\E[40;31;1m(API-ALL)\E[0m ");
+                       if (trace_api_frame_flag == 1) COREGL_LOG("\E[40;31;1m(API-FRAME)\E[0m ");
+               }
+               if (trace_ctx_flag == 1) {
+                       COREGL_LOG("\E[40;33;1m(CONTEXT)\E[0m ");
+                       if (trace_ctx_force_flag == 1) COREGL_LOG("\E[40;33;1m(CONTEXT-FORCE)\E[0m ");
+               }
+               if (trace_state_flag == 1) COREGL_LOG("\E[40;36;1m(STATE)\E[0m ");
+               if (trace_mem_flag == 1)
+               {
+                       COREGL_LOG("\E[40;35;1m(MEM)\E[0m ");
+                       if (trace_mem_all_flag == 1) COREGL_LOG("\E[40;35;1m(MEM-ALL)\E[0m ");
+               }
+               if (trace_surface_flag == 1) {
+                       COREGL_LOG("\E[40;36;1m(SURFACE)\E[0m ");
+                       if (trace_surface_sequence_sort_flag == 1) COREGL_LOG("\E[40;36;1m(SURFACE-SEQUENCE SORT)\E[0m ");
+                       if (trace_surface_print_only_flag == 1) COREGL_LOG("\E[40;36;1m(PRINT ONLY)\E[0m ");
+                       if (trace_surface_filter_period_begin != 0 || trace_surface_filter_period_end != 0)
+                               COREGL_LOG("\E[40;36;1m(SURFACE-PERIOD:%d~%d)\E[0m ", trace_surface_filter_period_begin, trace_surface_filter_period_end);
+                       if (trace_surface_filter_type == 1) COREGL_LOG("\E[40;36;1m(SURFACE-TYPE:EGL)\E[0m ");
+                       if (trace_surface_filter_type == 2) COREGL_LOG("\E[40;36;1m(SURFACE-TYPE:FBO)\E[0m ");
+                       if (trace_surface_filter_handle != 0) COREGL_LOG("\E[40;36;1m(SURFACE-HANDLE:0x%x(%d))\E[0m ", trace_surface_filter_handle, trace_surface_filter_handle);
+                       if (trace_surface_filter_size_w > 0 && trace_surface_filter_size_h > 0)
+                               COREGL_LOG("\E[40;36;1m(SURFACE-SIZE:%dx%d)\E[0m ", trace_surface_filter_size_w, trace_surface_filter_size_h);
+               }
+
+               COREGL_LOG("\E[40;37;1menabled\E[0m\n");
+       }
+}
+
+void
+deinit_modules_tracepath()
+{
+}
+
+void
+init_modules_tstate_tracepath(GLThreadState *tstate)
+{
+       MY_MODULE_TSTATE *tstate_mt = NULL;
+
+       tstate_mt = (MY_MODULE_TSTATE *)calloc(1, sizeof(MY_MODULE_TSTATE));
+
+
+       tstate->module_data[MY_MODULE_ID] = tstate_mt;
+}
+
+void
+deinit_modules_tstate_tracepath(GLThreadState *tstate)
+{
+       if (tstate->module_data[MY_MODULE_ID] != NULL)
+       {
+               free(tstate->module_data[MY_MODULE_ID]);
+               tstate->module_data[MY_MODULE_ID] = NULL;
+       }
+}
+
+void
+tracepath_apply_overrides()
+{
+       if (USE_TRACEPATH)
+       {
+               tracepath_apply_overrides_egl(1);
+               tracepath_apply_overrides_gl(1);
+       }
+}
+
+void
+tracepath_apply_overrides_egl(int enable)
+{
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     COREGL_INIT_ORIGINAL(_orig_tracepath_, FUNC_NAME);
+# include "../../headers/sym_egl.h"
+#undef _COREGL_SYMBOL
+
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     COREGL_OVERRIDE(tracepath_, FUNC_NAME);
+# include "../../headers/sym_egl.h"
+#undef _COREGL_SYMBOL
+}
+
+void
+tracepath_apply_overrides_gl(int enable)
+{
+#define _COREGL_START_API(version) api_gl_version = version;
+#define _COREGL_END_API(version) api_gl_version = COREGL_GLAPI_2;
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     \
+       if(api_gl_version <= driver_gl_version) COREGL_INIT_ORIGINAL(_orig_tracepath_, FUNC_NAME);
+# include "../../headers/sym_gl.h"
+#undef _COREGL_SYMBOL
+
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST) \
+       if(api_gl_version <= driver_gl_version) COREGL_OVERRIDE(tracepath_, FUNC_NAME);
+# include "../../headers/sym_gl.h"
+#undef _COREGL_SYMBOL
+#undef _COREGL_START_API
+#undef _COREGL_END_API
+}
+
+#undef OVERRIDE
+
+void
+tracepath_dump_context_states(int force_output)
+{
+       static struct timeval tv_last = { 0, 0 };
+
+       if (unlikely(trace_state_flag != 1)) return;
+
+       _sym_glGetIntegerv(GL_MAX_DRAW_BUFFERS, (GLint *)initial_fake_ctx->gl_num_draw_buffers);
+       _sym_glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, (GLint *)initial_fake_ctx->gl_num_tex_units);
+       _sym_glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, (GLint *)initial_fake_ctx->gl_num_vertex_attribs);
+       _sym_glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, (GLint *)initial_fake_ctx->gl_num_transform_feedback_separate_attribs);
+       _sym_glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, (GLint *)initial_fake_ctx->gl_num_uniform_buffer_bindings);
+
+       if (!force_output)
+       {
+               struct timeval tv_now = { 0, 0 };
+               AST(gettimeofday(&tv_now, NULL) == 0);
+               if (tv_now.tv_sec - tv_last.tv_sec < _COREGL_TRACE_OUTPUT_INTERVAL_SEC)
+               {
+                       goto finish;
+               }
+               tv_last = tv_now;
+       }
+
+       TRACE("\n");
+       TRACE("\E[0;40;34m===================================================================================================================\E[0m\n");
+       TRACE("\E[40;32;1m  State info \E[1;37;1m: <PID = %d> (CURRENT BINDED CONTEXT)\E[0m\n", getpid());
+       TRACE("\E[0;40;34m===================================================================================================================\E[0m\n");
+
+#define PRINTF_CHAR_GLenum "0x%8X"
+#define PRINTF_CHAR_GLboolean "%10d"
+#define PRINTF_CHAR_GLint "%10d"
+#define PRINTF_CHAR_GLsizei "%10u"
+#define PRINTF_CHAR_GLuint "%10u"
+#define PRINTF_CHAR_GLuintmask "0x%8X"
+#define PRINTF_CHAR_GLintptr "%10ld"
+#define PRINTF_CHAR_GLsizeiptr "%10ld"
+
+#define PRINTF_CHAR_GLclampf "%10.6f"
+#define PRINTF_CHAR_GLfloat "%10.6f"
+
+#define PRINTF_CHAR_GLvoidptr "%10p"
+
+#define PRINTF_CHAR(type) PRINTF_CHAR_##type
+
+#define INITIAL_CTX initial_fake_ctx
+
+#define GLUE_STATE(TYPE, NAME, SIZE, ARRAY_SIZE, DEFAULT_STMT, GET_STMT)  \
+   { \
+      TYPE valuedata[SIZE]; \
+      TYPE *value = NULL; \
+      value = valuedata; GET_STMT; value = valuedata; \
+      TRACE("\E[40;37;1m %-30.30s : (\E[0m ", #NAME); \
+      for (int i = 0; i < SIZE; i++) \
+      { \
+         if (i > 0) { \
+            if (i % 4 == 0) \
+               TRACE("\n %-30.30s     ", "");\
+            else \
+               TRACE(", "); \
+         } \
+         TRACE("["PRINTF_CHAR(TYPE)"]", value[i]); \
+      } \
+      TRACE(" \E[40;37;1m)\E[0m\n"); \
+   }
+# include "../fastpath/coregl_fastpath_state.h"
+#undef GLUE_STATE
+
+       TRACE("\E[0;40;34m===================================================================================================================\E[0m\n");
+       TRACE("\n");
+
+       TRACE_END();
+
+finish:
+       return;
+}
+
+
+static inline void
+_add_timeval_period(struct timeval *tv_dst, struct timeval tv_now, struct timeval tv_old)
+{
+       tv_dst->tv_sec += tv_now.tv_sec - tv_old.tv_sec;
+       tv_dst->tv_usec += 1000000 + (tv_now.tv_usec - tv_old.tv_usec);
+       tv_dst->tv_sec += (tv_dst->tv_usec / 1000000) - 1;
+       tv_dst->tv_usec = tv_dst->tv_usec % 1000000;
+}
+
+static inline void
+_add_timeval(struct timeval *tv_dst, struct timeval tv_src)
+{
+       tv_dst->tv_sec += tv_src.tv_sec;
+       tv_dst->tv_usec += tv_src.tv_usec;
+       if (tv_dst->tv_usec > 1000000)
+       {
+               tv_dst->tv_usec -= 1000000;
+               tv_dst->tv_sec++;
+       }
+       else if (tv_dst->tv_usec < 0)
+       {
+               tv_dst->tv_usec += 1000000;
+               tv_dst->tv_sec--;
+       }
+}
+
+static inline double
+_get_timeval_period(struct timeval time_now, struct timeval time_old)
+{
+       return ((time_now.tv_sec - time_old.tv_sec) * 1000) + ((time_now.tv_usec - time_old.tv_usec) / 1000.0);
+}
+
+static inline double
+_get_timeval(struct timeval time)
+{
+       return (time.tv_sec * 1000) + (time.tv_usec / 1000.0);
+}
+
+static unsigned short
+_generate_hash_short(const char *string)
+{
+       unsigned short hash = 0;
+       int i;
+
+       for (i = 0; i < strlen(string); i++)
+       {
+               hash = 253 * hash + string[i];
+       }
+       return (hash ^ (hash >> 8)) % MAX_TRACE_TABLE_SIZE;
+}
+
+static Trace_Data *
+_get_trace_data(Trace_Data **ftd_table, size_t td_size, const char *name)
+{
+       Trace_Data *ret = NULL;
+       Trace_Data *current = NULL;
+       Trace_Data *prev = NULL;
+       unsigned short hash = 0;
+
+       AST(strlen(name) < MAX_TRACE_NAME_LENGTH);
+
+       hash = _generate_hash_short(name);
+
+       current = ftd_table[hash];
+
+       while (current != NULL && current->next != NULL)
+       {
+               if (strcmp(current->name, name) == 0)
+                       break;
+               prev = current;
+               current = current->next;
+       }
+
+       if (current != NULL)
+       {
+               ret = current;
+       }
+       else
+       {
+               Trace_Data *newitm = NULL;
+               newitm = (Trace_Data *)calloc(1, td_size);
+                /* Prevent CID : 390717 */
+                if (newitm == NULL) goto finish;
+               strncpy(newitm->name, name, strlen(name));
+               newitm->next = NULL;
+
+               if (prev != NULL)
+               {
+                       prev->next = newitm;
+               }
+               else
+               {
+                       ftd_table[hash] = newitm;
+               }
+               ret = newitm;
+       }
+
+       goto finish;
+
+finish:
+       return ret;
+}
+
+void
+tracepath_mem_trace_add(const char *desc, int alloc_size)
+{
+       Memuse_Data *mtd = NULL;
+
+       if (trace_mem_flag == 1)
+       {
+               AST(mutex_lock(&mtd_access_mutex) == 1);
+
+               if (mtd_table == NULL)
+               {
+                       mtd_table = (Memuse_Data **)calloc(1, sizeof(Memuse_Data *) * MAX_TRACE_TABLE_SIZE);
+               }
+
+               mtd = (Memuse_Data *)_get_trace_data((Trace_Data **)mtd_table, sizeof(Memuse_Data), desc);
+
+               AST(mtd != NULL);
+
+               mtd->alloc_count++;
+
+               if (mtd->memsize == 0)
+                       mtd->memsize = alloc_size;
+
+               AST(mtd->memsize == alloc_size);
+
+               AST(mutex_unlock(&mtd_access_mutex) == 1);
+
+               if (trace_mem_all_flag == 1)
+                       _COREGL_TRACE_MEM_OUTPUT(1);
+       }
+
+}
+
+void
+tracepath_mem_trace_remove(const char *desc, int alloc_size)
+{
+       Memuse_Data *mtd = NULL;
+
+       if (trace_mem_flag == 1)
+       {
+               AST(mutex_lock(&mtd_access_mutex) == 1);
+
+               if (mtd_table == NULL)
+               {
+                       mtd_table = (Memuse_Data **)calloc(1, sizeof(Memuse_Data *) * MAX_TRACE_TABLE_SIZE);
+               }
+
+               mtd = (Memuse_Data *)_get_trace_data((Trace_Data **)mtd_table, sizeof(Memuse_Data), desc);
+
+               AST(mtd != NULL);
+               AST(mtd->memsize == alloc_size);
+
+               AST(mtd->alloc_count > mtd->remove_count);
+               mtd->remove_count++;
+
+               AST(mutex_unlock(&mtd_access_mutex) == 1);
+
+               if (trace_mem_all_flag == 1)
+                       _COREGL_TRACE_MEM_OUTPUT(1);
+       }
+}
+
+void *
+tracepath_api_trace_begin(const char *funcname, void *hint, int trace_total_time)
+{
+       Apicall_Data *ftd = NULL;
+       struct timeval t = TIMEVAL_INIT;
+
+       if (trace_api_flag == 1)
+       {
+               AST(gettimeofday(&t, NULL) == 0);
+
+               ftd = (Apicall_Data *)hint;
+
+               if (ftd == NULL)
+               {
+                       MY_MODULE_TSTATE *tstate = NULL;
+                       GET_MY_TSTATE(tstate, get_current_thread_state());
+
+                       if (tstate == NULL)
+                       {
+                               init_new_thread_state();
+
+                               GET_MY_TSTATE(tstate, get_current_thread_state());
+                               AST(tstate != NULL);
+
+                                /* Prevent CID : 389488 */
+                                if (tstate == NULL) return NULL;
+                       }
+
+                       if (tstate->ftd_table == NULL)
+                       {
+                               tstate->ftd_table = (Apicall_Data **)calloc(1, sizeof(Apicall_Data *) * MAX_TRACE_TABLE_SIZE);
+                                /* Prevent CID : 393786 */
+                                if (tstate->ftd_table == NULL) return NULL;
+                       }
+
+                       ftd = (Apicall_Data *)_get_trace_data((Trace_Data **)tstate->ftd_table, sizeof(Apicall_Data), funcname);
+               }
+
+               AST(ftd != NULL);
+
+               ftd->call_count++;
+               AST(ftd->last_time.tv_sec == 0);
+
+               AST(gettimeofday(&ftd->last_time, NULL) == 0);
+
+               if (initial_time.tv_sec == 0)
+               {
+                       initial_time = ftd->last_time;
+                       last_initial_time = ftd->last_time;
+               }
+
+               if (trace_total_time == 1)
+               {
+                       if (last_trace_time.tv_sec != 0)
+                       {
+                               _add_timeval_period(&other_elapsed_time, t, last_trace_time);
+                               last_trace_time.tv_sec = 0;
+                       }
+               }
+
+       }
+
+       return ftd;
+}
+
+void *
+tracepath_api_trace_end(const char *funcname, void *hint, int trace_total_time)
+{
+       Apicall_Data *ftd = NULL;
+       struct timeval t = TIMEVAL_INIT;
+
+       if (trace_api_flag == 1)
+       {
+               MY_MODULE_TSTATE *tstate = NULL;
+               struct timeval elapsed_time = TIMEVAL_INIT;
+
+               AST(gettimeofday(&t, NULL) == 0);
+
+               ftd = (Apicall_Data *)hint;
+
+               if (ftd == NULL)
+               {
+                       GET_MY_TSTATE(tstate, get_current_thread_state());
+
+                       if (tstate == NULL)
+                       {
+                               init_new_thread_state();
+
+                               GET_MY_TSTATE(tstate, get_current_thread_state());
+                               AST(tstate != NULL);
+                                /* Prevent CID : 389595 */
+                                if (tstate == NULL) return NULL;
+                       }
+
+                       AST(tstate != NULL);
+                       AST(tstate->ftd_table != NULL);
+
+                       ftd = (Apicall_Data *)_get_trace_data((Trace_Data **)tstate->ftd_table, sizeof(Apicall_Data), funcname);
+               }
+
+               AST(ftd != NULL);
+
+               _add_timeval_period(&elapsed_time, t, ftd->last_time);
+
+               _add_timeval(&ftd->elapsed_time, elapsed_time);
+
+               if (elapsed_time.tv_sec >= ftd->elapsed_time_max.tv_sec &&
+                   elapsed_time.tv_usec > ftd->elapsed_time_max.tv_usec)
+               {
+                       ftd->elapsed_time_max.tv_sec = elapsed_time.tv_sec;
+                       ftd->elapsed_time_max.tv_usec = elapsed_time.tv_usec;
+               }
+
+               ftd->last_time.tv_sec = 0;
+
+               if (trace_total_time == 1)
+               {
+                       _add_timeval(&ftd->total_elapsed_time, elapsed_time);
+
+                       AST(gettimeofday(&last_trace_time, NULL) == 0);
+
+                       if (initial_time.tv_sec == 0)
+                       {
+                               initial_time = t;
+                               last_initial_time = t;
+                       }
+               }
+
+       }
+
+
+       return ftd;
+}
+
+void
+tracepath_api_trace_output(int force_output)
+{
+       static struct timeval tv_last = TIMEVAL_INIT;
+       struct timeval total_now = TIMEVAL_INIT;
+       GLThreadState *tstate = NULL;
+       MY_MODULE_TSTATE *tstate_tm = NULL;
+       Apicall_Data **ftd_table = NULL;
+
+       double total_elapsed_time = 0.0;
+       double total_elapsed_time_period = 0.0;
+       double total_opengl_elapsed_time = 0.0;
+       double total_opengl_elapsed_time_period = 0.0;
+       double total_other_elapsed_time = 0.0;
+       double total_other_elapsed_time_period = 0.0;
+
+       double swaps_per_sec = 0.0;
+
+       int i;
+
+       if (trace_api_flag != 1)
+       {
+               goto finish;
+       }
+
+       if (!force_output)
+       {
+               struct timeval tv_now = TIMEVAL_INIT;
+               AST(gettimeofday(&tv_now, NULL) == 0);
+               if (tv_now.tv_sec - tv_last.tv_sec < _COREGL_TRACE_OUTPUT_INTERVAL_SEC)
+               {
+                       goto finish;
+               }
+               tv_last = tv_now;
+       }
+
+       AST(gettimeofday(&total_now, NULL) == 0);
+
+       total_elapsed_time = _get_timeval_period(total_now, initial_time);
+       total_elapsed_time_period = _get_timeval_period(total_now, last_initial_time);
+       last_initial_time = total_now;
+
+       total_other_elapsed_time = _get_timeval(other_elapsed_time);
+       total_other_elapsed_time_period = _get_timeval_period(other_elapsed_time, traced_other_elapsed_time);
+       traced_other_elapsed_time = other_elapsed_time;
+
+       tstate = get_current_thread_state();
+
+       if (tstate == NULL)
+       {
+               init_new_thread_state();
+
+               tstate = get_current_thread_state();
+               AST(tstate != NULL);
+       }
+
+       GET_MY_TSTATE(tstate_tm, tstate);
+       if (tstate_tm == NULL) goto finish;
+
+       ftd_table = tstate_tm->ftd_table;
+       if (ftd_table == NULL) goto finish;
+
+       {
+               static Apicall_Data *trace_hint_swap = NULL;
+               if (trace_hint_swap == NULL)
+                       trace_hint_swap = (Apicall_Data *)_get_trace_data((Trace_Data **)ftd_table, sizeof(Apicall_Data), "tracepath_eglSwapBuffers");
+
+               if (trace_hint_swap != NULL && total_elapsed_time_period > 0)
+               {
+                       swaps_per_sec = (trace_hint_swap->call_count - trace_hint_swap->last_call_count) / (total_elapsed_time_period / 1000);
+               }
+       }
+
+
+       TRACE("\n");
+       TRACE("\E[40;34m========================================================================================================================\E[0m\n");
+       TRACE("\E[40;32;1m  API call info \E[1;37;1m: <PID = %d> Thread ID = 0x%x  [Swaps per Second(P) = %7.2f]\E[0m\n", getpid(), tstate->thread_id, swaps_per_sec);
+       TRACE("\E[40;34m========================================================================================================================\E[0m\n");
+
+       // highlighted
+       for (i = 0; i < MAX_TRACE_TABLE_SIZE; i++)
+       {
+               if (ftd_table[i] != NULL)
+               {
+                       Apicall_Data *current = ftd_table[i];
+
+                       while (current != NULL)
+                       {
+                               double elapsed_time = _get_timeval(current->elapsed_time);
+                               double elapsed_time_per_call = elapsed_time / current->call_count;
+
+                               total_opengl_elapsed_time += _get_timeval(current->total_elapsed_time);
+                               total_opengl_elapsed_time_period += _get_timeval(current->total_elapsed_time) - _get_timeval(current->last_total_elapsed_time);
+
+                               current->traced = 0;
+
+                               if (current->call_count > current->last_call_count)
+                               {
+                                       double elapsed_time_period = _get_timeval_period(current->elapsed_time, current->last_elapsed_time);
+                                       double elapsed_time_max = _get_timeval(current->elapsed_time_max);
+                                       double elapsed_time_per_call_period = elapsed_time_period / (current->call_count - current->last_call_count);
+                                       char *fname = current->trace_data.name;
+
+                                       if (!strncmp(fname, "tracepath_", 10))
+                                               fname = &current->trace_data.name[10];
+
+                                       if (elapsed_time_per_call_period >= 0.01 || current->call_count - current->last_call_count > 1000)
+                                       {
+                                               TRACE("\E[40;37;1m %-39.39s : %10d call(s), %9.3f ms/API, %9.2f ms(MAX), %9.3f ms/API(P)\E[0m\n",
+                                                     fname, current->call_count, elapsed_time_per_call, elapsed_time_max, elapsed_time_per_call_period);
+                                               current->traced = 1;
+                                       }
+                               }
+                               current = (Apicall_Data *)current->trace_data.next;
+                       }
+               }
+       }
+
+       {
+               int fp_env = 0;
+               fp_env = atoi(get_env_setting("COREGL_TRACE_API_ALL"));
+               if (fp_env == 1)
+               {
+                       // other
+                       for (i = 0; i < MAX_TRACE_TABLE_SIZE; i++)
+                       {
+                               if (ftd_table[i] != NULL)
+                               {
+                                       Apicall_Data *current = ftd_table[i];
+
+                                       while (current != NULL)
+                                       {
+                                               if (current->traced == 0 && current->call_count > 0)
+                                               {
+                                                       double elapsed_time = _get_timeval(current->elapsed_time);
+                                                       double elapsed_time_per_call = elapsed_time / current->call_count;
+                                                       double elapsed_time_max = _get_timeval(current->elapsed_time_max);
+                                                       char *fname = current->trace_data.name;
+
+                                                       if (!strncmp(fname, "tracepath_", 10))
+                                                               fname = &current->trace_data.name[10];
+
+                                                       TRACE(" %-39.39s : %10d call(s), %9.3f ms/API, %9.2f ms(MAX)\n",
+                                                             fname, current->call_count, elapsed_time_per_call, elapsed_time_max);
+                                               }
+                                               current = (Apicall_Data *)current->trace_data.next;
+                                       }
+                               }
+                       }
+               }
+       }
+
+       TRACE("\E[40;34m========================================================================================================================\E[0m\n");
+
+       if (trace_api_frame_flag == 0)
+       {
+               TRACE("\E[40;36;1m %-39.39s : %13.2f ms[%6.2f%%], %13.2f ms(P)[%6.2f%%]\E[0m\n",
+                     "TOTAL elapsed Time",
+                     total_elapsed_time,
+                     100.0,
+                     total_elapsed_time_period,
+                     100.0);
+
+
+               TRACE("\E[40;36;1m %-39.39s : %13.2f ms[%6.2f%%], %13.2f ms(P)[%6.2f%%]\E[0m\n",
+                     "OpenGL elapsed Time",
+                     total_opengl_elapsed_time,
+                     total_opengl_elapsed_time * 100.0 / total_elapsed_time,
+                     total_opengl_elapsed_time_period,
+                     total_opengl_elapsed_time_period * 100.0 / total_elapsed_time_period);
+
+               TRACE("\E[40;36;1m %-39.39s : %13.2f ms[%6.2f%%], %13.2f ms(P)[%6.2f%%]\E[0m\n",
+                     "Out of OpenGL elapsed time",
+                     total_other_elapsed_time,
+                     total_other_elapsed_time * 100.0 / total_elapsed_time,
+                     total_other_elapsed_time_period,
+                     total_other_elapsed_time_period * 100.0 / total_elapsed_time_period);
+
+               TRACE("\E[40;36;1m %-39.39s : %13.2f ms[%6.2f%%], %13.2f ms(P)[%6.2f%%]\E[0m\n",
+                     "CoreGL API tracing overhead",
+                     total_elapsed_time - total_opengl_elapsed_time - total_other_elapsed_time,
+                     (total_elapsed_time - total_opengl_elapsed_time - total_other_elapsed_time) * 100.0 / total_elapsed_time,
+                     total_elapsed_time_period - total_opengl_elapsed_time_period - total_other_elapsed_time_period,
+                     (total_elapsed_time_period - total_opengl_elapsed_time_period - total_other_elapsed_time_period) * 100.0 / total_elapsed_time_period);
+
+               TRACE("\E[40;34m========================================================================================================================\E[0m\n");
+       }
+       TRACE("\n");
+
+       for (i = 0; i < MAX_TRACE_TABLE_SIZE; i++)
+       {
+               if (ftd_table[i] != NULL)
+               {
+                       Apicall_Data *current = ftd_table[i];
+
+                       while (current != NULL)
+                       {
+                               current->last_call_count = current->call_count;
+                               current->last_elapsed_time = current->elapsed_time;
+                               current->last_total_elapsed_time = current->total_elapsed_time;
+                               current = (Apicall_Data *)current->trace_data.next;
+                       }
+               }
+       }
+
+       TRACE_END();
+
+       goto finish;
+
+finish:
+       return;
+}
+
+void
+tracepath_api_trace_reset_frame()
+{
+       GLThreadState *tstate = NULL;
+       MY_MODULE_TSTATE *tstate_tm = NULL;
+       Apicall_Data **ftd_table = NULL;
+
+       int i;
+
+       if (trace_api_flag != 1)
+       {
+               goto finish;
+       }
+
+       tstate = get_current_thread_state();
+
+       if (tstate == NULL)
+       {
+               init_new_thread_state();
+
+               tstate = get_current_thread_state();
+               AST(tstate != NULL);
+       }
+
+       GET_MY_TSTATE(tstate_tm, tstate);
+       if (tstate_tm == NULL) goto finish;
+
+       ftd_table = tstate_tm->ftd_table;
+       if (ftd_table == NULL) goto finish;
+
+       for (i = 0; i < MAX_TRACE_TABLE_SIZE; i++)
+       {
+               if (ftd_table[i] != NULL)
+               {
+                       Apicall_Data *current = ftd_table[i];
+
+                       while (current != NULL)
+                       {
+                               current->call_count = 0;
+                               current->last_call_count = 0;
+                               current->elapsed_time.tv_sec = 0;
+                               current->elapsed_time.tv_usec = 0;
+                               current->last_elapsed_time.tv_sec = 0;
+                               current->last_elapsed_time.tv_usec = 0;
+                               current->last_total_elapsed_time.tv_sec = 0;
+                               current->last_total_elapsed_time.tv_usec = 0;
+                               current->total_elapsed_time.tv_sec = 0;
+                               current->total_elapsed_time.tv_usec = 0;
+                               current = (Apicall_Data *)current->trace_data.next;
+                       }
+               }
+       }
+       AST(gettimeofday(&last_initial_time, NULL) == 0);
+
+finish:
+       return;
+
+}
+
+void
+tracepath_mem_trace_output(int force_output)
+{
+       static struct timeval tv_last = TIMEVAL_INIT;
+
+       int i;
+
+       if (trace_mem_flag != 1)
+       {
+               goto finish;
+       }
+
+       if (!force_output)
+       {
+               struct timeval tv_now = TIMEVAL_INIT;
+               AST(gettimeofday(&tv_now, NULL) == 0);
+               if (tv_now.tv_sec - tv_last.tv_sec < _COREGL_TRACE_OUTPUT_INTERVAL_SEC)
+               {
+                       goto finish;
+               }
+               tv_last = tv_now;
+       }
+
+       TRACE("\n");
+       TRACE("\E[40;34m========================================================================================================================\E[0m\n");
+       TRACE("\E[40;32;1m  Memory usage info \E[1;37;1m: <PID = %d>\E[0m\n", getpid());
+       TRACE("\E[40;34m========================================================================================================================\E[0m\n");
+
+       if (mtd_table != NULL)
+       {
+               for (i = 0; i < MAX_TRACE_TABLE_SIZE; i++)
+               {
+                       if (mtd_table[i] != NULL)
+                       {
+                               Memuse_Data *current = mtd_table[i];
+
+                               while (current != NULL)
+                               {
+                                       int obj_count = current->alloc_count - current->remove_count;
+                                       if (obj_count > 0)
+                                       {
+                                               TRACE("\E[40;37;1m %-46.46s : %12d byte(s)(E), %9d object(s) [%9d+/%9d-]\E[0m\n",
+                                                     current->trace_data.name, current->memsize, obj_count, current->alloc_count, current->remove_count);
+                                       }
+                                       current = (Memuse_Data *)current->trace_data.next;
+                               }
+                       }
+               }
+
+               for (i = 0; i < MAX_TRACE_TABLE_SIZE; i++)
+               {
+                       if (mtd_table[i] != NULL)
+                       {
+                               Memuse_Data *current = mtd_table[i];
+
+                               while (current != NULL)
+                               {
+                                       int obj_count = current->alloc_count - current->remove_count;
+                                       if (obj_count == 0)
+                                       {
+                                               TRACE(" %-46.46s : %12d byte(s)(E), %9d object(s) [%9d+/%9d-]\n",
+                                                     current->trace_data.name, current->memsize, obj_count, current->alloc_count, current->remove_count);
+                                       }
+                                       current = (Memuse_Data *)current->trace_data.next;
+                               }
+                       }
+               }
+       }
+
+       TRACE("\E[40;34m========================================================================================================================\E[0m\n");
+       TRACE("\n");
+
+       TRACE_END();
+
+       goto finish;
+
+finish:
+       return;
+}
+
+#include "png.h"
+
+void *png_lib_handle = NULL;
+
+png_structp (*dl_png_create_write_struct) (png_const_charp user_png_ver,
+                                              png_voidp error_ptr,
+                                              png_error_ptr error_fn,
+                                              png_error_ptr warn_fn);
+
+
+void (*dl_png_destroy_write_struct) (png_structpp png_ptr_ptr,
+                                        png_infopp info_ptr_ptr);
+
+
+png_infop (*dl_png_create_info_struct) (png_structp png_ptr);
+
+void (*dl_png_init_io) (png_structp png_ptr,
+                          png_FILE_p fp);
+
+
+void (*dl_png_set_IHDR) (png_structp png_ptr,
+                           png_infop info_ptr,
+                           png_uint_32 width,
+                           png_uint_32 height,
+                           int bit_depth,
+                           int color_type,
+                           int interlace_method,
+                           int compression_method,
+                           int filter_method);
+
+void (*dl_png_set_bKGD) (png_structp png_ptr,
+                           png_infop info_ptr,
+                           png_color_16p background);
+
+void (*dl_png_set_bgr) (png_structp png_ptr);
+
+void (*dl_png_write_info) (png_structp png_ptr,
+                             png_infop info_ptr);
+
+void (*dl_png_write_image) (png_structp png_ptr,
+                              png_bytepp image);
+
+void (*dl_png_write_end) (png_structp png_ptr,
+                            png_infop info_ptr);
+
+static void
+_dump_surface(int force_output, int type, const char *position, Surface_Data *sdata)
+{
+       static int alldumpcount = 0;
+       unsigned char *data = NULL;
+       EGLint width = -1, height = -1, channel = -1;
+       char name[200];
+       FILE *write_fd = NULL;
+       png_struct *png = NULL;
+       png_info *info = NULL;
+       png_byte **rows = NULL;
+
+       if (!png_lib_handle)
+       {
+               png_lib_handle = dlopen("libpng.so.3", RTLD_NOW);
+
+               dl_png_create_write_struct = dlsym(png_lib_handle, "png_create_write_struct");
+               dl_png_destroy_write_struct = dlsym(png_lib_handle, "png_destroy_write_struct");
+               dl_png_create_info_struct = dlsym(png_lib_handle, "png_create_info_struct");
+
+               dl_png_init_io = dlsym(png_lib_handle, "png_init_io");
+
+               dl_png_set_IHDR = dlsym(png_lib_handle, "png_set_IHDR");
+               dl_png_set_bKGD = dlsym(png_lib_handle, "png_set_bKGD");
+               dl_png_set_bgr = dlsym(png_lib_handle, "png_set_bgr");
+
+               dl_png_write_info = dlsym(png_lib_handle, "png_write_info");
+               dl_png_write_image = dlsym(png_lib_handle, "png_write_image");
+               dl_png_write_end = dlsym(png_lib_handle, "png_write_end");
+       }
+
+       {
+               if (!png_lib_handle ||
+                   dl_png_create_write_struct == NULL ||
+                   dl_png_destroy_write_struct == NULL ||
+                   dl_png_create_info_struct == NULL ||
+                   dl_png_init_io == NULL ||
+                   dl_png_set_IHDR == NULL ||
+                   dl_png_set_bKGD == NULL ||
+                   dl_png_set_bgr == NULL ||
+                   dl_png_write_info == NULL ||
+                   dl_png_write_image == NULL ||
+                   dl_png_write_end == NULL)
+               {
+                       COREGL_ERR("Can't trace surface : Failed to use libpng (recommend : 1.2.50-3.4)");
+                       goto finish;
+               }
+
+               if (trace_surface_sequence_sort_flag == 1)
+                       snprintf(name,sizeof(name), "[%d (%06d)%p-%p] %s %04d (%s).png", getpid(), alldumpcount, sdata->display, sdata->context, sdata->trace_data.name, sdata->dump_count, position);
+               else
+                       snprintf(name,sizeof(name), "[%d %p-%p] %s %04d (%s).png", getpid(), sdata->display, sdata->context, sdata->trace_data.name, sdata->dump_count, position);
+
+               if (!strncmp(sdata->trace_data.name, "EGL", 3) && type != 2)
+               { // EGL
+                       if (trace_surface_filter_type != 0 &&
+                           trace_surface_filter_type != 1) goto finish;;
+
+                       if (trace_surface_filter_handle != 0 &&
+                           trace_surface_filter_handle != (int)sdata->surface) goto finish;
+
+                       EGLConfig eglconfig;
+                       GLint asize, rsize, gsize, bsize;
+                       _orig_tracepath_eglQuerySurface(sdata->display, sdata->surface, EGL_WIDTH, &width);
+                       _orig_tracepath_eglQuerySurface(sdata->display, sdata->surface, EGL_HEIGHT, &height);
+                       _orig_tracepath_eglQuerySurface(sdata->display, sdata->surface, EGL_CONFIG_ID, (GLint *)&eglconfig);
+                       _orig_tracepath_eglGetConfigAttrib(sdata->display, eglconfig, EGL_ALPHA_SIZE, &asize);
+                       _orig_tracepath_eglGetConfigAttrib(sdata->display, eglconfig, EGL_RED_SIZE, &rsize);
+                       _orig_tracepath_eglGetConfigAttrib(sdata->display, eglconfig, EGL_GREEN_SIZE, &gsize);
+                       _orig_tracepath_eglGetConfigAttrib(sdata->display, eglconfig, EGL_BLUE_SIZE, &bsize);
+                       channel = 4;
+                       if (asize == 0) channel = 3;
+                       if (bsize == 0) channel = 2;
+                       if (gsize == 0) channel = 1;
+                       if (rsize == 0) channel = 0;
+
+                       if (channel == 2) channel = 3;
+                       if (width <= 0 || height <= 0 || channel <= 0) goto finish;
+                       if (trace_surface_filter_size_w > 0 && trace_surface_filter_size_h > 0 &&
+                           (trace_surface_filter_size_w != width || trace_surface_filter_size_h != height))
+                               goto finish;
+
+                       if ((trace_surface_filter_period_begin > 0 || trace_surface_filter_period_end > 0) &&
+                           (trace_surface_filter_period_begin > alldumpcount || trace_surface_filter_period_end < alldumpcount))
+                       {
+                               alldumpcount++;
+                               sdata->dump_count++;
+                               goto finish;
+                       }
+
+                       if (channel == 3) channel = 4;
+
+                       TRACE("\E[40;31;1m[[TRACE SURFACE]] : '%s' is dumped (%dx%dx%d).\E[0m\n", name, width, height, channel);
+                       if (trace_surface_print_only_flag == 1 && force_output == 0)
+                       {
+                               alldumpcount++;
+                               sdata->dump_count++;
+                               goto finish;
+                       }
+
+                       data = (unsigned char *)calloc(1, width * height * channel * sizeof(unsigned char));
+                       if (data == NULL)
+                       {
+                               COREGL_ERR("Can't trace surface : Failed to allocate memory");
+                               goto finish;
+                       }
+
+                       GLint oldfb;
+                       _orig_tracepath_glGetIntegerv(GL_FRAMEBUFFER_BINDING, &oldfb);
+                       _orig_tracepath_glBindFramebuffer(GL_FRAMEBUFFER, 0);
+
+                       switch (channel)
+                       {
+                               case 4: _orig_tracepath_glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, data); break;
+                               //case 3: _orig_tracepath_glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, data); break;
+                               case 1: _orig_tracepath_glReadPixels(0, 0, width, height, GL_ALPHA, GL_UNSIGNED_BYTE, data); break;
+                       }
+
+                       _orig_tracepath_glBindFramebuffer(GL_FRAMEBUFFER, oldfb);
+               }
+               if (!strncmp(sdata->trace_data.name, "FBO", 3) && type != 1)
+               { // FBO
+                       if (sdata->fbo == 0) goto finish;
+
+                       if (trace_surface_filter_type != 0 &&
+                           trace_surface_filter_type != 2) goto finish;
+
+                       if (trace_surface_filter_handle != 0 &&
+                           trace_surface_filter_handle != sdata->tex &&
+                           trace_surface_filter_handle != sdata->rb) goto finish;
+
+                       GLint oldfb;
+                       _orig_tracepath_glGetIntegerv(GL_FRAMEBUFFER_BINDING, &oldfb);
+                       _orig_tracepath_glBindFramebuffer(GL_FRAMEBUFFER, sdata->fbo);
+
+                       if (_orig_tracepath_glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE)
+                       {
+                               _orig_tracepath_glBindFramebuffer(GL_FRAMEBUFFER, oldfb);
+                               width = sdata->tex_w;
+                               height = sdata->tex_h;
+                               channel = sdata->tex_format;
+
+                               if (channel == 2) channel = 3;
+                               if (width <= 0 || height <= 0 || channel <= 0) goto finish;
+                               if (trace_surface_filter_size_w > 0 && trace_surface_filter_size_h > 0 &&
+                                   (trace_surface_filter_size_w != width || trace_surface_filter_size_h != height))
+                                       goto finish;
+
+                               if ((trace_surface_filter_period_begin > 0 || trace_surface_filter_period_end > 0) &&
+                                   (trace_surface_filter_period_begin > alldumpcount || trace_surface_filter_period_end < alldumpcount))
+                               {
+                                       alldumpcount++;
+                                       sdata->dump_count++;
+                                       goto finish;
+                               }
+
+                               TRACE("\E[40;31;1m[[TRACE SURFACE]] : '%s' is dumped (%dx%dx%d).\E[0m\n", name, width, height, channel);
+                               if (trace_surface_print_only_flag == 1 && force_output == 0)
+                               {
+                                       alldumpcount++;
+                                       sdata->dump_count++;
+                                       goto finish;
+                               }
+
+                               if (channel == 3) channel = 4;
+
+                               data = (unsigned char *)calloc(1, width * height * channel * sizeof(unsigned char));
+                               if (data == NULL)
+                               {
+                                       COREGL_ERR("Can't trace surface : Failed to allocate memory");
+                                       goto finish;
+                               }
+
+                               _orig_tracepath_glBindFramebuffer(GL_FRAMEBUFFER, sdata->fbo);
+                               int atttype = _COREGL_INT_INIT_VALUE;
+                          _orig_tracepath_glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &atttype);
+                               AST(atttype != sdata->tex);
+                               int attname = _COREGL_INT_INIT_VALUE;
+                          _orig_tracepath_glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &attname);
+                               switch (atttype)
+                               {
+                                       case GL_TEXTURE:
+                                               AST(attname == sdata->tex);
+                                               break;
+                                       case GL_RENDERBUFFER:
+                                               AST(attname == sdata->rb);
+                                               break;
+                               }
+
+                               switch (channel)
+                               {
+                                       case 4: _orig_tracepath_glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, data); break;
+                                       //case 3: _orig_tracepath_glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, data); break;
+                                       case 1: _orig_tracepath_glReadPixels(0, 0, width, height, GL_ALPHA, GL_UNSIGNED_BYTE, data); break;
+                               }
+                       }
+                       _orig_tracepath_glBindFramebuffer(GL_FRAMEBUFFER, oldfb);
+               }
+
+
+
+               if (data == NULL) goto finish;
+
+               unlink(name);
+               write_fd = fopen(name, "wb");
+
+               if (write_fd == NULL)
+               {
+                       COREGL_ERR("Can't trace surface : Failed to create png file");
+                       goto finish;
+               }
+
+               rows = (png_byte **)malloc(height * sizeof(png_byte *));
+               if (rows == NULL)
+               {
+                       COREGL_ERR("Can't trace surface : Failed to allocate memory");
+                       goto finish;
+               }
+
+               for (int i = 0; i < height; i++)
+               {
+                       rows[i] = data + (height - i - 1) * (width * channel);
+               }
+
+               png = dl_png_create_write_struct(PNG_LIBPNG_VER_STRING,
+                                                NULL,
+                                                NULL,
+                                                NULL);
+               if (png == NULL)
+               {
+                       COREGL_ERR("Can't trace surface : Failed to create write structure of png file");
+                       goto finish;
+               }
+
+               info = dl_png_create_info_struct(png);
+               if (info == NULL)
+               {
+                       COREGL_ERR("Can't trace surface : Failed to create info structure of png file");
+                       goto finish;
+               }
+
+               dl_png_init_io(png, write_fd);
+
+               switch (channel)
+               {
+                       case 4: dl_png_set_IHDR(png, info, width, height, 8, PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); break;
+                       //case 3: dl_png_set_IHDR(png, info, width, height, 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); break;
+                       case 1: dl_png_set_IHDR(png, info, width, height, 8, PNG_COLOR_TYPE_GRAY, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); break;
+               }
+
+               dl_png_write_info(png, info);
+
+               dl_png_write_image(png, rows);
+
+               dl_png_write_end(png, info);
+
+               dl_png_destroy_write_struct(&png, &info);
+
+               alldumpcount++;
+               sdata->dump_count++;
+       }
+
+       goto finish;
+
+finish:
+       if (data != NULL)
+       {
+               free(data);
+               data = NULL;
+       }
+       if (write_fd != NULL)
+       {
+               fclose(write_fd);
+               write_fd = NULL;
+       }
+       if (rows != NULL)
+       {
+               free(rows);
+               rows = NULL;
+       }
+       if (png != NULL)
+       {
+               if (info != NULL)
+               {
+                       dl_png_destroy_write_struct(&png, &info);
+                       info = NULL;
+               }
+               else
+                       dl_png_destroy_write_struct(&png, NULL);
+               png = NULL;
+       }
+}
+
+void
+tracepath_surface_trace_add(const char *desc, GLDisplay dpy, GLContext ctx, GLSurface surf, GLint fbo, GLint tex, GLint rb, GLint tex_w, GLint tex_h, GLint tex_format, const char *dump)
+{
+       Surface_Data *std = NULL;
+
+       if (trace_surface_flag == 1)
+       {
+               AST(mutex_lock(&std_access_mutex) == 1);
+
+               if (std_table == NULL)
+               {
+                       std_table = (Surface_Data **)calloc(1, sizeof(Surface_Data *) * MAX_TRACE_TABLE_SIZE);
+               }
+
+               std = (Surface_Data *)_get_trace_data((Trace_Data **)std_table, sizeof(Surface_Data), desc);
+
+               AST(std != NULL);
+
+               if (dump != NULL)
+               {
+                       _dump_surface(0, 0, dump, std);
+               }
+
+               std->display = dpy;
+               std->surface = surf;
+               std->context = ctx;
+               if (fbo >= 0) std->fbo = fbo;
+               std->tex = tex;
+               std->rb = rb;
+               if (tex_w >= 0) std->tex_w = tex_w;
+               if (tex_h >= 0) std->tex_h = tex_h;
+               if (tex_format >= 0) std->tex_format = tex_format;
+
+               AST(mutex_unlock(&std_access_mutex) == 1);
+
+       }
+
+}
+
+void
+tracepath_surface_trace(int force_output, int type, const char *position)
+{
+       int i;
+
+       if (trace_surface_flag != 1)
+       {
+               goto finish;
+       }
+
+       AST(mutex_lock(&std_access_mutex) == 1);
+
+       if (std_table != NULL)
+       {
+               EGLDisplay olddpy = _orig_tracepath_eglGetCurrentDisplay();
+               EGLContext oldctx = _orig_tracepath_eglGetCurrentContext();
+               EGLSurface oldsurf_read = _orig_tracepath_eglGetCurrentSurface(EGL_READ);
+               EGLSurface oldsurf_draw = _orig_tracepath_eglGetCurrentSurface(EGL_DRAW);
+
+               for (i = 0; i < MAX_TRACE_TABLE_SIZE; i++)
+               {
+                       if (std_table[i] != NULL)
+                       {
+                               Surface_Data *current = std_table[i];
+
+                               while (current != NULL)
+                               {
+                                       if (current->surface != EGL_NO_SURFACE && current->display != EGL_NO_DISPLAY && current->context != EGL_NO_CONTEXT)
+                                       {
+                                               if (_orig_tracepath_eglMakeCurrent(current->display, current->surface, current->surface, current->context) == EGL_TRUE)
+                                               {
+                                                       _dump_surface(force_output, type, position, current);
+                                               }
+                                       }
+
+                                       current = (Surface_Data *)current->trace_data.next;
+                               }
+                       }
+               }
+               _orig_tracepath_eglMakeCurrent(olddpy, oldsurf_read, oldsurf_draw, oldctx);
+
+       }
+
+       AST(mutex_unlock(&std_access_mutex) == 1);
+
+       goto finish;
+
+       finish:
+               return;
+}
+
+
+COREGL_API void
+coregl_dump_surface()
+{
+       _COREGL_TRACE_SURFACE(1, 0, "USER CALL");
+}
+
diff --git a/src/modules/tracepath/coregl_tracepath.h b/src/modules/tracepath/coregl_tracepath.h
new file mode 100644 (file)
index 0000000..e40a666
--- /dev/null
@@ -0,0 +1,150 @@
+#ifndef COREGL_TRACEPATH_H\r
+#define COREGL_TRACEPATH_H\r
+\r
+#include "../coregl_module.h"\r
+\r
+#ifndef COREGL_USE_MODULE_TRACEPATH\r
+#error "COREGL_USE_MODULE_TRACEPATH must defined!!!"\r
+#endif\r
+\r
+#define MY_MODULE_ID              COREGL_MODULE_TRACEPATH\r
+#define MY_MODULE_TSTATE         Tracepath_ThreadState\r
+\r
+#include "../../coregl_internal.h"\r
+#include "../../coregl_export.h"\r
+\r
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     extern RET_TYPE (*_orig_tracepath_##FUNC_NAME) PARAM_LIST;\r
+# include "../../headers/sym.h"\r
+#undef _COREGL_SYMBOL\r
+\r
+// Symbol definition for tracepath\r
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     extern RET_TYPE (tracepath_##FUNC_NAME) PARAM_LIST;\r
+# include "../../headers/sym.h"\r
+#undef _COREGL_SYMBOL\r
+\r
+#define MAX_TRACE_NAME_LENGTH  256
+#define MAX_TRACE_TABLE_SIZE   65536
+\r
+#define COREGL_TRACEPATH_TRACE_ALL\r
+
+#ifdef COREGL_TRACEPATH_TRACE_ALL\r
+#define COREGL_TRACEPATH_TRACE_CONTEXT_INFO   // Context state & thread state & Glue-context info\r
+#define COREGL_TRACEPATH_TRACE_STATE_INFO     // Glue-context state info\r
+#define COREGL_TRACEPATH_TRACE_APICALL_INFO   // API call frequency & each frame call info\r
+#define COREGL_TRACEPATH_TRACE_MEMUSE_INFO   // Memory usage info\r
+#define COREGL_TRACEPATH_TRACE_SURFACE_INFO  // Surface dump info\r
+#endif
+
+#ifdef COREGL_TRACEPATH_TRACE_APICALL_INFO\r
+# define _COREGL_TRACE_API_BEGIN(api, hint, trace_total_time) \
+   tracepath_api_trace_begin(api, hint, trace_total_time);\r
+# define _COREGL_TRACE_API_END(api, hint, trace_total_time) \
+   tracepath_api_trace_end(api, hint, trace_total_time);\r
+# define _COREGL_TRACE_API_OUTPUT(force_output) \
+   tracepath_api_trace_output(force_output);\r
+# define _COREGL_TRACE_API_RESET_FRAME() \\r
+   tracepath_api_trace_reset_frame();\r
+#else
+# define _COREGL_TRACE_API_BEGIN(api, hint, trace_total_time) NULL;
+# define _COREGL_TRACE_API_END(api, hint, trace_total_time)
+# define _COREGL_TRACE_API_OUTPUT(force_output)
+# define _COREGL_TRACE_API_RESET_FRAME()\r
+#endif
+\r
+#ifdef COREGL_TRACEPATH_TRACE_MEMUSE_INFO\r
+# define _COREGL_TRACE_MEM_ADD(desc, alloc_size) \\r
+   tracepath_mem_trace_add(desc, alloc_size);\r
+# define _COREGL_TRACE_MEM_REMOVE(desc, alloc_size) \\r
+   tracepath_mem_trace_remove(desc, alloc_size);\r
+# define _COREGL_TRACE_MEM_OUTPUT(force_output) \\r
+   tracepath_mem_trace_output(force_output);\r
+#else
+# define _COREGL_TRACE_MEM_ADD(desc, alloc_size)\r
+# define _COREGL_TRACE_MEM_REMOVE(desc, alloc_size)\r
+# define _COREGL_TRACE_MEM_OUTPUT(force_output)\r
+#endif
+\r
+#ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO\r
+# define _COREGL_TRACE_SURFACE(force_output, type, position) \\r
+   tracepath_surface_trace(force_output, type, position);\r
+#else
+# define _COREGL_TRACE_SURFACE(force_output, type, position)\r
+#endif
+\r
+#define _COREGL_TRACEPATH_FUNC_BEGIN() \\r
+       if (unlikely(trace_api_flag == 1)) \
+               _COREGL_TRACE_API_BEGIN(__func__, NULL, 1);
+
+#define _COREGL_TRACEPATH_FUNC_END() \\r
+       if (unlikely(trace_api_flag == 1)) \
+               _COREGL_TRACE_API_END(__func__, NULL, 1);
+\r
+typedef struct _Trace_Data Trace_Data;
+typedef struct _Apicall_Data Apicall_Data;\r
+typedef struct _Memuse_Data Memuse_Data;\r
+typedef struct _Surface_Data Surface_Data;\r
+\r
+#define MTD_GLBUF_HASH_ARRAY 10000\r
+\r
+typedef struct _Glbuf_Data Glbuf_Data;\r
+typedef struct _Sostate_Data\r
+{\r
+       int                         ref_count;\r
+\r
+       Glbuf_Data                 *glbuf_tex[MTD_GLBUF_HASH_ARRAY];\r
+       Glbuf_Data                 *glbuf_rb[MTD_GLBUF_HASH_ARRAY];\r
+} Sostate_Data;\r
+\r
+typedef struct _Ctx_Data\r
+{\r
+       GLDisplay                dpy;\r
+       GLContext                handle;\r
+       int                      ref_count;\r
+       int                      mc_count;\r
+       Sostate_Data            *sostate;\r
+\r
+       struct _Ctx_Data       *next;\r
+} Ctx_Data;\r
+\r
+extern Mutex               ctx_access_mutex;\r
+\r
+extern Mutex               access_mutex;\r
+extern Memuse_Data       **table;\r
+\r
+typedef struct _Tracepath_ThreadState\r
+{
+       Apicall_Data            **ftd_table;\r
+       Ctx_Data                 *ctx;\r
+\r
+       GLSurface                *surf_draw;\r
+       GLSurface                *surf_read;\r
+} Tracepath_ThreadState;\r
+\r
+extern void                init_modules_tracepath();\r
+extern void                deinit_modules_tracepath();\r
+extern void                init_modules_tstate_tracepath(GLThreadState *tstate);\r
+extern void                deinit_modules_tstate_tracepath(GLThreadState *tstate);\r
+\r
+\r
+extern void                tracepath_apply_overrides();\r
+extern void                tracepath_apply_overrides_egl();\r
+extern void                tracepath_apply_overrides_gl();\r
+\r
+extern void                tracepath_dump_context_states(int force_output);\r
+\r
+extern void               *tracepath_api_trace_begin(const char *name, void *hint, int trace_total_time);\r
+extern void               *tracepath_api_trace_end(const char *name, void *hint, int trace_total_time);\r
+extern void                tracepath_api_trace_output(int force_output);\r
+extern void                tracepath_api_trace_reset_frame();\r
+\r
+extern void                tracepath_mem_trace_add(const char *desc, int alloc_size);\r
+extern void                tracepath_mem_trace_remove(const char *desc, int alloc_size);\r
+extern void                tracepath_mem_trace_output(int force_output);\r
+\r
+extern void                tracepath_surface_trace_add(const char *desc, GLDisplay dpy, GLContext ctx, GLSurface surf, GLint fbo, GLint tex, GLint rb, GLint tex_w, GLint tex_h, GLint tex_format, const char *dump);\r
+extern void                tracepath_surface_trace(int force_output, int type, const char *position);\r
+\r
+extern void                tracepath_glbuf_clear(Glbuf_Data **glbuf);\r
+\r
+#endif // COREGL_TRACEPATH_H\r
+\r
diff --git a/src/modules/tracepath/coregl_tracepath_egl.c b/src/modules/tracepath/coregl_tracepath_egl.c
new file mode 100644 (file)
index 0000000..984836a
--- /dev/null
@@ -0,0 +1,1095 @@
+#include "coregl_tracepath.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+
+#include <sys/types.h>
+#include <unistd.h>
+
+Mutex ctx_access_mutex = MUTEX_INITIALIZER;
+Ctx_Data *ctx_data = NULL;
+
+static Sostate_Data *
+_get_sostate(GLContext ctx)
+{
+       Sostate_Data *ret = NULL;
+
+       Ctx_Data *current = ctx_data;
+       while (current != NULL)
+       {
+               if (current->handle == ctx)
+               {
+                       current->sostate->ref_count++;
+                       ret = current->sostate;
+                       break;
+               }
+               current = current->next;
+       }
+
+       return ret;
+}
+
+#ifdef COREGL_TRACEPATH_TRACE_CONTEXT_INFO
+
+static void
+_dump_context_info(const char *ment, int force_output)
+{
+       MY_MODULE_TSTATE *tstate = NULL;
+       static struct timeval tv_last = { 0, 0 };
+
+       if (trace_ctx_flag != 1) return;
+
+       AST(mutex_lock(&ctx_access_mutex) == 1);
+       AST(mutex_lock(&general_trace_lists_access_mutex) == 1);
+
+       if (!force_output && !trace_ctx_force_flag)
+       {
+               struct timeval tv_now = { 0, 0 };
+               AST(gettimeofday(&tv_now, NULL) == 0);
+               if (tv_now.tv_sec - tv_last.tv_sec < _COREGL_TRACE_OUTPUT_INTERVAL_SEC)
+               {
+                       goto finish;
+               }
+               tv_last = tv_now;
+       }
+
+       GET_MY_TSTATE(tstate, get_current_thread_state());
+
+       TRACE("\n");
+       TRACE("\E[40;34m========================================================================================================================\E[0m\n");
+       TRACE("\E[40;32;1m  Context info \E[1;37;1m: <PID = %d> %s\E[0m\n", getpid(), ment);
+       TRACE("\E[40;34m========================================================================================================================\E[0m\n");
+
+
+       // Thread State List
+       {
+               General_Trace_List *current = NULL;
+               current = thread_trace_list;
+
+               while (current != NULL)
+               {
+                       GLThreadState *cur_tstate = (GLThreadState *)current->value;
+                       MY_MODULE_TSTATE *cur_tstate_tm = NULL;
+
+                       GET_MY_TSTATE(cur_tstate_tm, cur_tstate);
+                       AST(cur_tstate_tm != NULL);
+
+                       TRACE(" %c Thread  [0x%12x] : Surf <D=[%12p] R=[%12p]>",
+                             (tstate == cur_tstate_tm) ? '*' : ' ',
+                             cur_tstate->thread_id,
+                             cur_tstate_tm->surf_draw,
+                             cur_tstate_tm->surf_read);
+
+                       if (cur_tstate_tm->ctx != NULL)
+                       {
+                               TRACE(" EGLCTX=[%12p]\E[0m\n",
+                                     cur_tstate_tm->ctx->handle);
+                       }
+                       else
+                       {
+                               TRACE(" (NOT BINDED TO THREAD)\E[0m\n");
+                       }
+
+                       // Binded Context State List
+                       {
+                               Ctx_Data *current = NULL;
+                               current = ctx_data;
+
+                               while (current != NULL)
+                               {
+                                       if (cur_tstate_tm->ctx == current)
+                                       {
+                                               TRACE("   -> EGLCTX [%12p] : EGLDPY=[%12p] <MC count [%10d]> <Ref [%2d]>\E[0m\n",
+                                                     current->handle,
+                                                     current->dpy,
+                                                     current->mc_count,
+                                                     current->ref_count);
+                                       }
+
+                                       current = current->next;
+                               }
+
+                       }
+
+
+                       current = current->next;
+               }
+       }
+
+       TRACE("\E[40;33m........................................................................................................................\E[0m\n");
+
+       // Not-binded Context State List
+       {
+               Ctx_Data *current = NULL;
+               current = ctx_data;
+
+               while (current != NULL)
+               {
+                       int isbinded = 0;
+
+                       General_Trace_List *current_t = NULL;
+                       current_t = thread_trace_list;
+
+                       while (current_t != NULL)
+                       {
+                               GLThreadState *cur_tstate = (GLThreadState *)current_t->value;
+                               MY_MODULE_TSTATE *cur_tstate_tm = NULL;
+
+                               GET_MY_TSTATE(cur_tstate_tm, cur_tstate);
+                               AST(cur_tstate_tm != NULL);
+
+                                /* Prevent CID : 390064 */
+                               if (cur_tstate_tm != NULL && cur_tstate_tm->ctx == current)
+                               {
+                                       isbinded = 1;
+                                       break;
+                               }
+                               current_t = current_t->next;
+                       }
+
+                       if (isbinded == 0)
+                       {
+                               TRACE("   EGLCTX    [%12p] : EGLDPY=[%12p] <MC count [%10d]> <Ref [%2d]>\E[0m\n",
+                                     current->handle,
+                                     current->dpy,
+                                     current->mc_count,
+                                     current->ref_count);
+                       }
+
+                       current = current->next;
+               }
+
+       }
+
+       TRACE("\E[40;34m========================================================================================================================\E[0m\n");
+       TRACE("\n");
+
+       TRACE_END();
+
+       goto finish;
+
+finish:
+
+       AST(mutex_unlock(&general_trace_lists_access_mutex) == 1);
+       AST(mutex_unlock(&ctx_access_mutex) == 1);
+
+}
+
+#endif // COREGL_TRACEPATH_TRACE_CONTEXT_INFO
+
+
+void
+tracepath_add_context(GLContext ctx, GLDisplay dpy, GLContext share_ctx)
+{
+       Ctx_Data *current = NULL;
+       Ctx_Data *data = NULL;
+
+       AST(mutex_lock(&ctx_access_mutex) == 1);
+
+       current = ctx_data;
+
+       while (current != NULL)
+       {
+               if (current->handle == ctx)
+               {
+                       data = current;
+                       break;
+               }
+               current = current->next;
+       }
+
+       if (data == NULL)
+       {
+               data = (Ctx_Data *)calloc(1, sizeof(Ctx_Data));
+                /* Prevent CID : 394454 */
+                if (data == NULL) goto finish;
+               data->ref_count = 1;
+               data->handle = ctx;
+               data->dpy = dpy;
+
+               data->sostate = _get_sostate(share_ctx);
+               if (data->sostate == NULL)
+               {
+                       data->sostate = (Sostate_Data *)calloc(1, sizeof(Sostate_Data));
+                        /* Prevent CID : 394454 */
+                        if (data->sostate == NULL) goto finish;
+                       data->sostate->ref_count = 1;
+               }
+
+               if (ctx_data != NULL)
+                       data->next = ctx_data;
+
+               ctx_data = data;
+       }
+       goto finish;
+
+finish:
+       AST(mutex_unlock(&ctx_access_mutex) == 1);
+       return;
+}
+
+Ctx_Data *
+tracepath_get_context(GLContext ctx)
+{
+       Ctx_Data *current = NULL;
+       Ctx_Data *data = NULL;
+
+       AST(mutex_lock(&ctx_access_mutex) == 1);
+
+       current = ctx_data;
+
+       while (current != NULL)
+       {
+               if (current->handle == ctx)
+               {
+                       data = current;
+                       break;
+               }
+               current = current->next;
+       }
+       if (data == NULL)
+       {
+               COREGL_WRN("Error making context [%p] current. (invalid EGL context)\n", ctx);
+               goto finish;
+       }
+       data->ref_count++;
+       goto finish;
+
+finish:
+       AST(mutex_unlock(&ctx_access_mutex) == 1);
+       return data;
+}
+
+void
+tracepath_remove_context(GLContext ctx)
+{
+       Ctx_Data *current = NULL;
+       Ctx_Data *prev = NULL;
+
+       AST(mutex_lock(&ctx_access_mutex) == 1);
+
+       current = ctx_data;
+
+       while (current != NULL)
+       {
+               if (current->handle == ctx)
+               {
+                       if (--current->ref_count <= 0)
+                       {
+                               if (prev != NULL)
+                                       prev->next = current->next;
+                               else
+                                       ctx_data = current->next;
+
+                               if (--current->sostate->ref_count <= 0)
+                               {
+                                       tracepath_glbuf_clear(current->sostate->glbuf_rb);
+                                       tracepath_glbuf_clear(current->sostate->glbuf_tex);
+                                       free(current->sostate);
+                                       current->sostate = NULL;
+                               }
+
+                               free(current);
+                               current = NULL;
+                       }
+                       break;
+               }
+               prev = current;
+               current = current->next;
+       }
+       goto finish;
+
+finish:
+       AST(mutex_unlock(&ctx_access_mutex) == 1);
+       return;
+}
+
+EGLint
+tracepath_eglGetError(void)
+{
+       EGLint ret = _COREGL_INT_INIT_VALUE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglGetError();
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLDisplay
+tracepath_eglGetDisplay(EGLNativeDisplayType display_id)
+{
+       EGLDisplay ret = EGL_NO_DISPLAY;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglGetDisplay(display_id);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLBoolean
+tracepath_eglInitialize(EGLDisplay dpy, EGLint* major, EGLint* minor)
+{
+       EGLBoolean ret = EGL_FALSE;
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglInitialize(dpy, major, minor);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLBoolean
+tracepath_eglTerminate(EGLDisplay dpy)
+{
+       EGLBoolean ret = EGL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglTerminate(dpy);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLBoolean
+tracepath_eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
+{
+       EGLBoolean ret = EGL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglGetConfigs(dpy, configs, config_size, num_config);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLBoolean
+tracepath_eglChooseConfig(EGLDisplay dpy, const EGLint* attrib_list, EGLConfig* configs, EGLint config_size, EGLint* num_config)
+{
+       EGLBoolean ret = EGL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglChooseConfig(dpy, attrib_list, configs, config_size, num_config);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLBoolean
+tracepath_eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
+{
+       EGLBoolean ret = EGL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglGetConfigAttrib(dpy, config, attribute, value);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+
+EGLSurface
+tracepath_eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint* attrib_list)
+{
+       EGLSurface ret = EGL_NO_SURFACE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglCreateWindowSurface(dpy, config, win, attrib_list);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLSurface
+tracepath_eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
+{
+       EGLSurface ret = EGL_NO_SURFACE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglCreatePbufferSurface(dpy, config, attrib_list);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLSurface
+tracepath_eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint* attrib_list)
+{
+       EGLSurface ret = EGL_NO_SURFACE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglCreatePixmapSurface(dpy, config, pixmap, attrib_list);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLBoolean
+tracepath_eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
+{
+       EGLBoolean ret = EGL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglDestroySurface(dpy, surface);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+#ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO
+   {
+      char name[256];
+      snprintf(name,sizeof(name), "EGLSURFACE_%p", surface);
+      tracepath_surface_trace_add(name, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL);
+   }
+#endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
+       return ret;
+}
+
+EGLBoolean
+tracepath_eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
+{
+       EGLBoolean ret = EGL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglQuerySurface(dpy, surface, attribute, value);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLBoolean
+tracepath_eglBindAPI(EGLenum api)
+{
+       EGLBoolean ret = EGL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglBindAPI(api);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLenum
+tracepath_eglQueryAPI(void)
+{
+       EGLenum ret = 0;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglQueryAPI();
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLBoolean
+tracepath_eglWaitClient(void)
+{
+       EGLBoolean ret = EGL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglWaitClient();
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLBoolean
+tracepath_eglReleaseThread(void)
+{
+       EGLBoolean ret = EGL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglReleaseThread();
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLSurface
+tracepath_eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list)
+{
+       EGLSurface ret = EGL_NO_SURFACE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglCreatePbufferFromClientBuffer(dpy, buftype, buffer, config, attrib_list);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLBoolean
+tracepath_eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
+{
+       EGLBoolean ret = EGL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglSurfaceAttrib(dpy, surface, attribute, value);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLBoolean
+tracepath_eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
+{
+       EGLBoolean ret = EGL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglBindTexImage(dpy, surface, buffer);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLBoolean
+tracepath_eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
+{
+       EGLBoolean ret = EGL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglReleaseTexImage(dpy, surface, buffer);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLBoolean
+tracepath_eglSwapInterval(EGLDisplay dpy, EGLint interval)
+{
+       EGLBoolean ret = EGL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglSwapInterval(dpy, interval);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLContext
+tracepath_eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint* attrib_list)
+{
+       EGLContext ret = EGL_NO_CONTEXT;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglCreateContext(dpy, config, share_context, attrib_list);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       {
+               if (ret != EGL_NO_CONTEXT)
+               {
+                       tracepath_add_context(ret, dpy, share_context);
+               }
+       }
+#ifdef COREGL_TRACEPATH_TRACE_CONTEXT_INFO
+       if (unlikely(trace_ctx_flag == 1))
+       {
+               if (_orig_tracepath_eglCreateContext == _sym_eglCreateContext)
+               {
+                       char ment[256];
+                       snprintf(ment,sizeof(ment), "eglCreateContext completed (EGLCTX=[%12p])", ret);
+                       _dump_context_info(ment, 1);
+               }
+       }
+#endif // COREGL_TRACEPATH_TRACE_CONTEXT_INFO
+       return ret;
+}
+
+EGLBoolean
+tracepath_eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
+{
+       EGLBoolean ret = EGL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglDestroyContext(dpy, ctx);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       {
+               AST(ctx != EGL_NO_CONTEXT);
+
+               tracepath_remove_context(ctx);
+       }
+#ifdef COREGL_TRACEPATH_TRACE_CONTEXT_INFO
+       if (unlikely(trace_ctx_flag == 1))
+       {
+               if (_orig_tracepath_eglDestroyContext == _sym_eglDestroyContext)
+               {
+                       char ment[256];
+                       snprintf(ment,sizeof(ment), "eglDestroyContext completed (EGLCTX=[%12p])", ctx);
+                       _dump_context_info(ment, 1);
+               }
+       }
+#endif // COREGL_TRACEPATH_TRACE_CONTEXT_INFO
+       return ret;
+}
+
+EGLBoolean
+tracepath_eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
+{
+       EGLBoolean ret = EGL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglMakeCurrent(dpy, draw, read, ctx);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       {
+               MY_MODULE_TSTATE *tstate = NULL;
+
+               GET_MY_TSTATE(tstate, get_current_thread_state());
+               if (tstate == NULL)
+               {
+                       init_new_thread_state();
+
+                       GET_MY_TSTATE(tstate, get_current_thread_state());
+                       AST(tstate != NULL);
+
+                        /* Prevent CID : 400057 */
+                        if (tstate == NULL) return ret;
+               }
+
+               Ctx_Data *oldctx = tstate->ctx;
+
+               if (ctx != EGL_NO_CONTEXT)
+               {
+                       tstate->ctx = tracepath_get_context(ctx);
+                       if (tstate->ctx != NULL)
+                               tstate->ctx->mc_count++;
+               }
+               else
+               {
+                       tstate->ctx = NULL;
+               }
+
+               if (oldctx != NULL)
+                       tracepath_remove_context(oldctx->handle);
+
+                tstate->surf_draw = draw;
+               tstate->surf_read = read;
+       }
+#ifdef COREGL_TRACEPATH_TRACE_STATE_INFO
+       if (unlikely(trace_state_flag == 1))
+       {
+               if (_orig_tracepath_eglMakeCurrent == _sym_eglMakeCurrent)
+                       tracepath_dump_context_states(0);
+       }
+#endif // COREGL_TRACEPATH_TRACE_STATE_INFO
+#ifdef COREGL_TRACEPATH_TRACE_CONTEXT_INFO
+       if (unlikely(trace_ctx_flag == 1))
+       {
+               if (_orig_tracepath_eglMakeCurrent == _sym_eglMakeCurrent)
+               {
+                       char ment[256];
+                       snprintf(ment,sizeof(ment), "eglMakeCurrent finished (EGLCTX=[%12p] Surf=[D:%12p R:%12p])", ctx, draw, read);
+                       _dump_context_info(ment, 0);
+               }
+       }
+#endif // COREGL_TRACEPATH_TRACE_CONTEXT_INFO
+       return ret;
+}
+
+EGLContext
+tracepath_eglGetCurrentContext(void)
+{
+       EGLContext ret = EGL_NO_CONTEXT;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglGetCurrentContext();
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLSurface
+tracepath_eglGetCurrentSurface(EGLint readdraw)
+{
+       EGLSurface ret = EGL_NO_SURFACE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglGetCurrentSurface(readdraw);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLDisplay
+tracepath_eglGetCurrentDisplay(void)
+{
+       EGLDisplay ret = EGL_NO_DISPLAY;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglGetCurrentDisplay();
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLBoolean
+tracepath_eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
+{
+       EGLBoolean ret = EGL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglQueryContext(dpy, ctx, attribute, value);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLBoolean
+tracepath_eglWaitGL(void)
+{
+       EGLBoolean ret = EGL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglWaitGL();
+
+       _COREGL_TRACE_SURFACE(0, 1, "EGLWAITGL");
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLBoolean
+tracepath_eglWaitNative(EGLint engine)
+{
+       EGLBoolean ret = EGL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglWaitNative(engine);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLBoolean
+tracepath_eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
+{
+       EGLBoolean ret = EGL_FALSE;
+
+       _COREGL_TRACE_SURFACE(0, 1, "SWAPBUFFERS");
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglSwapBuffers(dpy, surface);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       if (unlikely(trace_api_frame_flag == 1))
+       {
+               if (unlikely(trace_api_all_flag == 1))
+               {
+                       _COREGL_TRACE_API_OUTPUT(1);
+               }
+               else
+               {
+                       _COREGL_TRACE_API_OUTPUT(0);
+               }
+               _COREGL_TRACE_API_RESET_FRAME();
+       }
+       else
+       {
+               _COREGL_TRACE_API_OUTPUT(0);
+       }
+       _COREGL_TRACE_MEM_OUTPUT(0);
+       return ret;
+}
+
+EGLBoolean
+tracepath_eglSwapBuffersWithDamageEXT(EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects)
+{
+       EGLBoolean ret = EGL_FALSE;
+
+       _COREGL_TRACE_SURFACE(0, 1, "SWAPBUFFERS");
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglSwapBuffersWithDamageEXT(dpy, surface, rects, n_rects);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       if (unlikely(trace_api_frame_flag == 1))
+       {
+               if (unlikely(trace_api_all_flag == 1))
+               {
+                       _COREGL_TRACE_API_OUTPUT(1);
+               }
+               else
+               {
+                       _COREGL_TRACE_API_OUTPUT(0);
+               }
+               _COREGL_TRACE_API_RESET_FRAME();
+       }
+       else
+       {
+               _COREGL_TRACE_API_OUTPUT(0);
+       }
+       _COREGL_TRACE_MEM_OUTPUT(0);
+       return ret;
+}
+
+EGLBoolean
+tracepath_eglSwapBuffersRegionEXT(EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects)
+{
+       EGLBoolean ret = EGL_FALSE;
+
+       _COREGL_TRACE_SURFACE(0, 1, "SWAPBUFFERS");
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglSwapBuffersRegionEXT(dpy, surface, numRects, rects);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       if (unlikely(trace_api_frame_flag == 1))
+       {
+               if (unlikely(trace_api_all_flag == 1))
+               {
+                       _COREGL_TRACE_API_OUTPUT(1);
+               }
+               else
+               {
+                       _COREGL_TRACE_API_OUTPUT(0);
+               }
+               _COREGL_TRACE_API_RESET_FRAME();
+       }
+       else
+       {
+               _COREGL_TRACE_API_OUTPUT(0);
+       }
+       _COREGL_TRACE_MEM_OUTPUT(0);
+       return ret;
+}
+
+EGLBoolean
+tracepath_eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
+{
+       EGLBoolean ret = EGL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglCopyBuffers(dpy, surface, target);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+_eng_fn
+tracepath_eglGetProcAddress(const char* procname)
+{
+       _eng_fn ret = NULL;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST) \
+       if (strcmp(procname, #FUNC_NAME) == 0) \
+       { \
+               _eng_fn ret_orig = NULL; \
+               ret_orig = _orig_tracepath_eglGetProcAddress(procname); \
+               if (ret_orig != NULL) \
+                       ret = (_eng_fn)ovr_##FUNC_NAME; \
+               goto finish; \
+       }
+
+#define _COREGL_EXT_SYMBOL_ALIAS(ALIAS_NAME, FUNC_NAME) \
+   if (strcmp(procname, #ALIAS_NAME) == 0) \
+   { \
+               _eng_fn ret_orig = NULL; \
+               ret_orig = _orig_tracepath_eglGetProcAddress(#ALIAS_NAME); \
+               if (ret_orig != NULL) \
+                       ret = (_eng_fn)ovr_##FUNC_NAME; \
+               goto finish; \
+   }
+
+#include "../../headers/sym_egl.h"
+#include "../../headers/sym_gl.h"
+#undef _COREGL_SYMBOL
+#undef _COREGL_EXT_SYMBOL_ALIAS
+
+       ret = _orig_tracepath_eglGetProcAddress(procname);
+       if (ret != NULL)
+       {
+               COREGL_WRN("\E[40;31;1mTRACEPATH can't support '%s' (tracing for this function will be ignored)\E[0m\n", procname);
+       }
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+const char *
+tracepath_eglQueryString(EGLDisplay dpy, EGLint name)
+{
+       const char *ret = NULL;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglQueryString(dpy, name);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLImageKHR
+tracepath_eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list)
+{
+       void *ret = NULL;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglCreateImageKHR(dpy, ctx, target, buffer, attrib_list);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLBoolean
+tracepath_eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)
+{
+       EGLBoolean ret = EGL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglDestroyImageKHR(dpy, image);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+void *
+tracepath_eglMapImageSEC(EGLDisplay dpy, EGLImageKHR image, EGLint device_type, EGLint access_option)
+{
+       void *ret = NULL;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglMapImageSEC(dpy, image, device_type, access_option);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLBoolean
+tracepath_eglUnmapImageSEC(EGLDisplay dpy, EGLImageKHR image, EGLint device_type)
+{
+       EGLBoolean ret = EGL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglUnmapImageSEC(dpy, image, device_type);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLBoolean
+tracepath_eglGetImageAttribSEC(EGLDisplay dpy, EGLImageKHR image, EGLint attribute, EGLint *value)
+{
+       EGLBoolean ret = EGL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglGetImageAttribSEC(dpy, image, attribute, value);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLBoolean
+tracepath_eglLockSurfaceKHR(EGLDisplay display, EGLSurface surface, const EGLint *attrib_list)
+{
+       EGLBoolean ret = EGL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglLockSurfaceKHR(display, surface, attrib_list);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+EGLBoolean
+tracepath_eglUnlockSurfaceKHR(EGLDisplay display, EGLSurface surface)
+{
+       EGLBoolean ret = EGL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_eglUnlockSurfaceKHR(display, surface);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
diff --git a/src/modules/tracepath/coregl_tracepath_gl.c b/src/modules/tracepath/coregl_tracepath_gl.c
new file mode 100644 (file)
index 0000000..26193ce
--- /dev/null
@@ -0,0 +1,4517 @@
+#include "coregl_tracepath.h"
+
+#include <stdlib.h>
+
+struct _Glbuf_Data
+{
+       int obj_idx;
+       int width;
+       int height;
+       int bpp;
+       char format[80];
+
+       struct _Glbuf_Data *next;
+};
+
+static void
+__addhash_glbuf_object(Glbuf_Data **glbuf, Glbuf_Data *target)
+{
+       Glbuf_Data *data = glbuf[target->obj_idx % MTD_GLBUF_HASH_ARRAY];
+       if (data == NULL)
+       {
+               glbuf[target->obj_idx % MTD_GLBUF_HASH_ARRAY] = target;
+       }
+       else
+       {
+               while (data->next != NULL)
+               {
+                       AST(data->obj_idx != target->obj_idx);
+                       data = data->next;
+               }
+               AST(data->obj_idx != target->obj_idx);
+               data->next = target;
+       }
+       goto finish;
+
+finish:
+       return;
+}
+
+static void
+__removehash_glbuf_object(Glbuf_Data **glbuf, Glbuf_Data **target)
+{
+       Glbuf_Data *data = glbuf[(*target)->obj_idx % MTD_GLBUF_HASH_ARRAY];
+       Glbuf_Data *prev = NULL;
+       while (data != NULL)
+       {
+               if (data->obj_idx == (*target)->obj_idx)
+               {
+                       if (prev != NULL)
+                               prev->next = data->next;
+                       else
+                               glbuf[(*target)->obj_idx % MTD_GLBUF_HASH_ARRAY] = data->next;
+
+                       free(*target);
+                       *target = NULL;
+                       break;
+               }
+               prev = data;
+               data = data->next;
+       }
+       goto finish;
+
+finish:
+       return;
+}
+
+static Glbuf_Data *
+__findhash_glbuf_object(Glbuf_Data **glbuf, int obj_idx)
+{
+       Glbuf_Data *data = glbuf[obj_idx % MTD_GLBUF_HASH_ARRAY];
+       while (data != NULL)
+       {
+               if (data->obj_idx == obj_idx)
+                       break;
+               data = data->next;
+       }
+       goto finish;
+
+finish:
+       return data;
+}
+
+void
+tracepath_glbuf_clear(Glbuf_Data **glbuf)
+{
+       int i;
+
+       for (i = 0; i < MTD_GLBUF_HASH_ARRAY; i++)
+       {
+               Glbuf_Data *data = glbuf[i];
+
+               while (data)
+               {
+                       Glbuf_Data *delitm = data;
+                       data = data->next;
+                       free(delitm);
+                       delitm = NULL;
+               }
+       }
+}
+
+static void
+_add_glbuf_object(Glbuf_Data **glbuf, int obj_idx, const char *obj_type, int width, int height, int bpp, const char *format)
+{
+       Glbuf_Data *data = __findhash_glbuf_object(glbuf, obj_idx);
+       if (data == NULL)
+       {
+               data = (Glbuf_Data *)calloc(1, sizeof(Glbuf_Data));
+                /* Prevent CID : 387660 */
+                if (data == NULL) goto finish;
+               data->obj_idx = obj_idx;
+               __addhash_glbuf_object(glbuf, data);
+       }
+       else
+       {
+               // Update
+               {
+                       char ment[MAX_TRACE_NAME_LENGTH];
+                       snprintf(ment,sizeof(ment), "%s(%4dx%4d %s)", obj_type, data->width, data->height, data->format);
+                       _COREGL_TRACE_MEM_REMOVE(ment, data->width * data->height * data->bpp);
+               }
+       }
+
+       data->width = width;
+       data->height = height;
+       data->bpp = bpp;
+       snprintf(data->format,sizeof(data->format), "%s", format);
+
+       {
+               char ment[MAX_TRACE_NAME_LENGTH];
+               snprintf(ment,sizeof(ment), "%s(%4dx%4d %s)", obj_type, data->width, data->height, data->format);
+               _COREGL_TRACE_MEM_ADD(ment, data->width * data->height * data->bpp);
+       }
+       goto finish;
+
+finish:
+       return;
+}
+
+static void
+_remove_glbuf_object(Glbuf_Data **glbuf, int obj_idx, const char *obj_type)
+{
+       Glbuf_Data *data = __findhash_glbuf_object(glbuf, obj_idx);
+       if (data == NULL)
+       {
+               COREGL_WRN("\E[40;31;1mError deleting %s object %d. (is not created)\E[0m\n", obj_type, obj_idx);
+               return;
+       }
+
+       {
+               char ment[MAX_TRACE_NAME_LENGTH];
+               snprintf(ment,sizeof(ment), "%s(%4dx%4d %s)", obj_type, data->width, data->height, data->format);
+               _COREGL_TRACE_MEM_REMOVE(ment, data->width * data->height * data->bpp);
+       }
+
+       __removehash_glbuf_object(glbuf, &data);
+       goto finish;
+
+finish:
+       return;
+}
+
+
+#ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO
+void
+_surface_trace_set(int set, GLint fbname, GLenum attachment, MY_MODULE_TSTATE *tstate)
+{
+       int atttype = _COREGL_INT_INIT_VALUE;
+   _orig_tracepath_glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, attachment, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &atttype);
+       AST(atttype != _COREGL_INT_INIT_VALUE);
+       int attname = _COREGL_INT_INIT_VALUE;
+   _orig_tracepath_glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, attachment, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &attname);
+       AST(attname != _COREGL_INT_INIT_VALUE);
+       if (set == 1)
+       {
+               switch (atttype)
+               {
+                       case GL_TEXTURE:
+                               //COREGL_LOG("FBO DUMPING BEGIN = (TEX)0x%X\n", attname);
+                               {
+                                       char name[256];
+                                       snprintf(name,sizeof(name), "FBOTEX_0x%X", attname);
+                                       tracepath_surface_trace_add(name, tstate->ctx->dpy, tstate->ctx->handle, tstate->surf_draw, fbname, attname, 0, -1, -1, -1, NULL);
+                               }
+                               break;
+                       case GL_RENDERBUFFER:
+                               //COREGL_LOG("FBO DUMPING BEGIN = (RB)0x%X\n", attname);
+                               {
+                                       char name[256];
+                                       snprintf(name,sizeof(name), "FBORB_0x%X", attname);
+                                       tracepath_surface_trace_add(name, tstate->ctx->dpy, tstate->ctx->handle, tstate->surf_draw, fbname, 0, attname, -1, -1, -1, NULL);
+                               }
+                               break;
+               }
+       }
+       else
+       {
+               switch (atttype)
+               {
+                       case GL_TEXTURE:
+                               //COREGL_LOG("FBO DUMPING END = (TEX)0x%X\n", attname);
+                               {
+                                       char name[256];
+                                       snprintf(name,sizeof(name), "FBOTEX_0x%X", attname);
+                                       tracepath_surface_trace_add(name, tstate->ctx->dpy, tstate->ctx->handle, tstate->surf_draw, 0, attname, 0, -1, -1, -1, NULL);
+                               }
+                               break;
+                       case GL_RENDERBUFFER:
+                               //COREGL_LOG("FBO DUMPING END = (RB)0x%X\n", attname);
+                               {
+                                       char name[256];
+                                       snprintf(name,sizeof(name), "FBORB_0x%X", attname);
+                                       tracepath_surface_trace_add(name, tstate->ctx->dpy, tstate->ctx->handle, tstate->surf_draw, 0, 0, attname, -1, -1, -1, NULL);
+                               }
+                               break;
+               }
+       }
+}
+
+void
+tracepath_fbdump_update(GLint set)
+{
+       if (trace_surface_flag == 1)
+       {
+               GLint fbname = _COREGL_INT_INIT_VALUE;
+               _orig_tracepath_glGetIntegerv(GL_FRAMEBUFFER_BINDING, &fbname);
+               AST(fbname != _COREGL_INT_INIT_VALUE);
+               if (fbname != 0)
+               {
+                       MY_MODULE_TSTATE *tstate = NULL;
+
+                       GET_MY_TSTATE(tstate, get_current_thread_state());
+                       AST(tstate != NULL);
+                        /* Prevent CID : 399855 */
+                       if (tstate != NULL && tstate->ctx != NULL)
+                       {
+                               _surface_trace_set(set, fbname, GL_COLOR_ATTACHMENT0, tstate);
+//                             _surface_trace_set(set, fbname, GL_DEPTH_ATTACHMENT, tstate);
+//                             _surface_trace_set(set, fbname, GL_STENCIL_ATTACHMENT, tstate);
+                       }
+               }
+       }
+}
+#endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
+
+
+
+
+
+
+/* OpenGL ES 2.0 */
+
+void
+tracepath_glActiveTexture(GLenum texture)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glActiveTexture(texture);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glAttachShader(GLuint program, GLuint shader)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glAttachShader(program, shader);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glBindAttribLocation(GLuint program, GLuint index, const char* name)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glBindAttribLocation(program, index, name);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glBindBuffer(GLenum target, GLuint buffer)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glBindBuffer(target, buffer);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glBindFramebuffer(GLenum target, GLuint framebuffer)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+
+#ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO
+       if (unlikely(trace_surface_flag == 1))
+       {
+               GLint oldfb;
+               _orig_tracepath_glGetIntegerv(GL_FRAMEBUFFER_BINDING, &oldfb);
+               if (oldfb != 0)
+               {
+                       _COREGL_TRACE_SURFACE(0, 2, "GLBINDFBO");
+               }
+
+               tracepath_fbdump_update(0);
+       }
+#endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
+
+       _orig_tracepath_glBindFramebuffer(target, framebuffer);
+
+#ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO
+       if (unlikely(trace_surface_flag == 1))
+       {
+               tracepath_fbdump_update(1);
+       }
+#endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glBindRenderbuffer(GLenum target, GLuint renderbuffer)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glBindRenderbuffer(target, renderbuffer);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glBindTexture(GLenum target, GLuint texture)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glBindTexture(target, texture);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glBlendColor(red, green, blue, alpha);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glBlendEquation(GLenum mode)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glBlendEquation(mode);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glBlendEquationSeparate(modeRGB, modeAlpha);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glBlendFunc(GLenum sfactor, GLenum dfactor)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glBlendFunc(sfactor, dfactor);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glBufferData(GLenum target, GLsizeiptr size, const void* data, GLenum usage)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glBufferData(target, size, data, usage);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void* data)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glBufferSubData(target, offset, size, data);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+GLenum
+tracepath_glCheckFramebufferStatus(GLenum target)
+{
+       GLenum ret = GL_NONE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glCheckFramebufferStatus(target);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+void
+tracepath_glClear(GLbitfield mask)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glClear(mask);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glClearColor(red, green, blue, alpha);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glClearDepthf(GLclampf depth)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glClearDepthf(depth);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glClearStencil(GLint s)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glClearStencil(s);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glColorMask(red, green, blue, alpha);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glCompileShader(GLuint shader)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glCompileShader(shader);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+GLuint
+tracepath_glCreateProgram(void)
+{
+       GLuint ret = _COREGL_INT_INIT_VALUE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glCreateProgram();
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+GLuint
+tracepath_glCreateShader(GLenum type)
+{
+       GLuint ret = _COREGL_INT_INIT_VALUE;
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glCreateShader(type);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+void
+tracepath_glCullFace(GLenum mode)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glCullFace(mode);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glDeleteBuffers(GLsizei n, const GLuint* buffers)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glDeleteBuffers(n, buffers);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+
+#ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO
+       tracepath_fbdump_update(0);
+#endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
+
+       _orig_tracepath_glDeleteFramebuffers(n, framebuffers);
+
+#ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO
+       tracepath_fbdump_update(1);
+#endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glDeleteProgram(GLuint program)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glDeleteProgram(program);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+
+#ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO
+       tracepath_fbdump_update(0);
+#endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
+
+       _orig_tracepath_glDeleteRenderbuffers(n, renderbuffers);
+
+#ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO
+       tracepath_fbdump_update(1);
+#endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+#ifdef COREGL_TRACEPATH_TRACE_MEMUSE_INFO
+       if (trace_mem_flag == 1)
+       {
+               MY_MODULE_TSTATE *tstate = NULL;
+
+               GET_MY_TSTATE(tstate, get_current_thread_state());
+               AST(tstate != NULL);
+                /* Prevent CID : 402281 */
+               if (tstate != NULL && tstate->ctx != NULL)
+               {
+                       for (int i = 0; i < n; i++)
+                       {
+                               if (renderbuffers[i] == 0) continue;
+                               _remove_glbuf_object(tstate->ctx->sostate->glbuf_rb, renderbuffers[i], "Renderbuffer");
+                       }
+               }
+       }
+#endif // COREGL_TRACEPATH_TRACE_MEMUSE_INFO
+}
+
+void
+tracepath_glDeleteShader(GLuint shader)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glDeleteShader(shader);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glDeleteTextures(GLsizei n, const GLuint* textures)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+
+#ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO
+       tracepath_fbdump_update(0);
+#endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
+
+       _orig_tracepath_glDeleteTextures(n, textures);
+
+#ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO
+       tracepath_fbdump_update(1);
+#endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+#ifdef COREGL_TRACEPATH_TRACE_MEMUSE_INFO
+       if (trace_mem_flag == 1)
+       {
+               MY_MODULE_TSTATE *tstate = NULL;
+
+               GET_MY_TSTATE(tstate, get_current_thread_state());
+               AST(tstate != NULL);
+               if (tstate != NULL && tstate->ctx != NULL)
+               {
+                       for (int i = 0; i < n; i++)
+                       {
+                               if (textures[i] == 0) continue;
+                               _remove_glbuf_object(tstate->ctx->sostate->glbuf_tex, textures[i], "Texture");
+                       }
+               }
+       }
+#endif // COREGL_TRACEPATH_TRACE_MEMUSE_INFO
+}
+
+void
+tracepath_glDepthFunc(GLenum func)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glDepthFunc(func);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glDepthMask(GLboolean flag)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glDepthMask(flag);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glDepthRangef(GLclampf zNear, GLclampf zFar)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glDepthRangef(zNear, zFar);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glDetachShader(GLuint program, GLuint shader)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glDetachShader(program, shader);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glDisable(GLenum cap)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glDisable(cap);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glDisableVertexAttribArray(GLuint index)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glDisableVertexAttribArray(index);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glDrawArrays(GLenum mode, GLint first, GLsizei count)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glDrawArrays(mode, first, count);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+#ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO
+       if (trace_surface_flag == 1)
+       {
+               GLint fbname = _COREGL_INT_INIT_VALUE;
+               _orig_tracepath_glGetIntegerv(GL_FRAMEBUFFER_BINDING, &fbname);
+               AST(fbname != _COREGL_INT_INIT_VALUE);
+               if (fbname == 0)
+               {
+                       char name[256];
+                       EGLint btype;
+                       _orig_tracepath_eglQuerySurface(_orig_tracepath_eglGetCurrentDisplay(), _orig_tracepath_eglGetCurrentSurface(EGL_DRAW), EGL_RENDER_BUFFER, &btype);
+                       if (btype == EGL_SINGLE_BUFFER)
+                               snprintf(name,sizeof(name), "EGLPIXMAP_%p", _orig_tracepath_eglGetCurrentSurface(EGL_DRAW));
+                       else
+                               snprintf(name,sizeof(name), "EGLWINDOW_%p", _orig_tracepath_eglGetCurrentSurface(EGL_DRAW));
+                       tracepath_surface_trace_add(name, _orig_tracepath_eglGetCurrentDisplay(), _orig_tracepath_eglGetCurrentContext(), _orig_tracepath_eglGetCurrentSurface(EGL_DRAW), 0, 0, 0, 0, 0, 0, NULL);
+               }
+   }
+#endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
+}
+
+void
+tracepath_glDrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glDrawElements(mode, count, type, indices);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+#ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO
+       if (trace_surface_flag == 1)
+       {
+               GLint fbname = _COREGL_INT_INIT_VALUE;
+               _orig_tracepath_glGetIntegerv(GL_FRAMEBUFFER_BINDING, &fbname);
+               AST(fbname != _COREGL_INT_INIT_VALUE);
+               if (fbname == 0)
+               {
+                       char name[256];
+                       EGLint btype;
+                       _orig_tracepath_eglQuerySurface(_orig_tracepath_eglGetCurrentDisplay(), _orig_tracepath_eglGetCurrentSurface(EGL_DRAW), EGL_RENDER_BUFFER, &btype);
+                       if (btype == EGL_SINGLE_BUFFER)
+                               snprintf(name, "EGLPIXMAP_%p", _orig_tracepath_eglGetCurrentSurface(EGL_DRAW));
+                       else
+                               snprintf(name, "EGLWINDOW_%p", _orig_tracepath_eglGetCurrentSurface(EGL_DRAW));
+                       tracepath_surface_trace_add(name, _orig_tracepath_eglGetCurrentDisplay(), _orig_tracepath_eglGetCurrentContext(), _orig_tracepath_eglGetCurrentSurface(EGL_DRAW), 0, 0, 0, 0, 0, 0, NULL);
+               }
+   }
+#endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
+}
+
+void
+tracepath_glEnable(GLenum cap)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glEnable(cap);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glEnableVertexAttribArray(GLuint index)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glEnableVertexAttribArray(index);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glFinish(void)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glFinish();
+
+       _COREGL_TRACE_SURFACE(0, 0, "GLFINISH");
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       _COREGL_TRACE_API_OUTPUT(0);
+       _COREGL_TRACE_MEM_OUTPUT(0);
+}
+
+void
+tracepath_glFlush(void)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glFlush();
+
+       _COREGL_TRACE_SURFACE(0, 0, "GLFLUSH");
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       _COREGL_TRACE_API_OUTPUT(0);
+       _COREGL_TRACE_MEM_OUTPUT(0);
+}
+
+void
+tracepath_glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+
+#ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO
+       tracepath_fbdump_update(0);
+#endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
+
+       _orig_tracepath_glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
+
+#ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO
+       tracepath_fbdump_update(1);
+#endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+
+#ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO
+       tracepath_fbdump_update(0);
+#endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
+
+       _orig_tracepath_glFramebufferTexture2D(target, attachment, textarget, texture, level);
+
+#ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO
+       tracepath_fbdump_update(1);
+#endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glFrontFace(GLenum mode)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glFrontFace(mode);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetVertexAttribfv(index, pname, params);
+
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetVertexAttribiv(index, pname, params);
+
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetVertexAttribPointerv(index, pname, pointer);
+
+
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glHint(GLenum target, GLenum mode)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glHint(target, mode);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGenBuffers(GLsizei n, GLuint* buffers)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGenBuffers(n, buffers);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGenerateMipmap(GLenum target)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGenerateMipmap(target);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGenFramebuffers(GLsizei n, GLuint* framebuffers)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGenFramebuffers(n, framebuffers);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGenRenderbuffers(n, renderbuffers);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+#ifdef COREGL_TRACEPATH_TRACE_MEMUSE_INFO
+       if (trace_mem_flag == 1)
+       {
+               MY_MODULE_TSTATE *tstate = NULL;
+
+               GET_MY_TSTATE(tstate, get_current_thread_state());
+               AST(tstate != NULL);
+                /* Prevent CID : 396759 */
+               if (tstate != NULL && tstate->ctx != NULL)
+               {
+                       for (int i = 0; i < n; i++)
+                       {
+                               if (renderbuffers[i] == 0) continue;
+                               _add_glbuf_object(tstate->ctx->sostate->glbuf_rb, renderbuffers[i], "Renderbuffer", 0, 0, 0, "Unknown");
+                       }
+               }
+       }
+#endif // COREGL_TRACEPATH_TRACE_MEMUSE_INFO
+}
+
+void
+tracepath_glGenTextures(GLsizei n, GLuint* textures)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGenTextures(n, textures);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+#ifdef COREGL_TRACEPATH_TRACE_MEMUSE_INFO
+       if (trace_mem_flag == 1)
+       {
+               MY_MODULE_TSTATE *tstate = NULL;
+
+               GET_MY_TSTATE(tstate, get_current_thread_state());
+               AST(tstate != NULL);
+                /* Prevent CID : 387732 */
+               if (tstate != NULL && tstate->ctx != NULL)
+               {
+                       for (int i = 0; i < n; i++)
+                       {
+                               if (textures[i] == 0) continue;
+                               _add_glbuf_object(tstate->ctx->sostate->glbuf_tex, textures[i], "Texture", 0, 0, 0, "Unknown");
+                       }
+               }
+       }
+#endif // COREGL_TRACEPATH_TRACE_MEMUSE_INFO
+}
+
+void
+tracepath_glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetActiveAttrib(program, index, bufsize, length, size, type, name);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetActiveUniform(program, index, bufsize, length, size, type, name);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetAttachedShaders(program, maxcount, count, shaders);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+int
+tracepath_glGetAttribLocation(GLuint program, const char* name)
+{
+       int ret = _COREGL_INT_INIT_VALUE;
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glGetAttribLocation(program, name);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+void
+tracepath_glGetBooleanv(GLenum pname, GLboolean* params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetBooleanv(pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetBufferParameteriv(target, pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+GLenum
+tracepath_glGetError(void)
+{
+       GLenum ret = GL_NONE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glGetError();
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+void
+tracepath_glGetFloatv(GLenum pname, GLfloat* params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetFloatv(pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetIntegerv(GLenum pname, GLint* params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetIntegerv(pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetProgramiv(GLuint program, GLenum pname, GLint* params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetProgramiv(program, pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetProgramInfoLog(program, bufsize, length, infolog);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetRenderbufferParameteriv(target, pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetShaderiv(shader, pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetShaderInfoLog(shader, bufsize, length, infolog);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetShaderSource(shader, bufsize, length, source);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+const GLubyte *
+tracepath_glGetString(GLenum name)
+{
+       const GLubyte *ret = NULL;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glGetString(name);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+void
+tracepath_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetTexParameterfv(target, pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetTexParameteriv(target, pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetUniformfv(GLuint program, GLint location, GLfloat* params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetUniformfv(program, location, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetUniformiv(GLuint program, GLint location, GLint* params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetUniformiv(program, location, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+int
+tracepath_glGetUniformLocation(GLuint program, const char* name)
+{
+       int ret = _COREGL_INT_INIT_VALUE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glGetUniformLocation(program, name);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+GLboolean
+tracepath_glIsBuffer(GLuint buffer)
+{
+       GLboolean ret = GL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glIsBuffer(buffer);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+GLboolean
+tracepath_glIsEnabled(GLenum cap)
+{
+       GLboolean ret = GL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glIsEnabled(cap);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+GLboolean
+tracepath_glIsFramebuffer(GLuint framebuffer)
+{
+       GLboolean ret = GL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glIsFramebuffer(framebuffer);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+GLboolean
+tracepath_glIsProgram(GLuint program)
+{
+       GLboolean ret;
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glIsProgram(program);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+GLboolean
+tracepath_glIsRenderbuffer(GLuint renderbuffer)
+{
+       GLboolean ret;
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glIsRenderbuffer(renderbuffer);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+GLboolean
+tracepath_glIsShader(GLuint shader)
+{
+       GLboolean ret;
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glIsShader(shader);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+GLboolean
+tracepath_glIsTexture(GLuint texture)
+{
+       GLboolean ret;
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glIsTexture(texture);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+void
+tracepath_glLineWidth(GLfloat width)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glLineWidth(width);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glLinkProgram(GLuint program)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glLinkProgram(program);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glPixelStorei(GLenum pname, GLint param)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glPixelStorei(pname, param);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glPolygonOffset(GLfloat factor, GLfloat units)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glPolygonOffset(factor, units);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glReadPixels(x, y, width, height, format, type, pixels);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glReleaseShaderCompiler(void)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glReleaseShaderCompiler();
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+
+       _orig_tracepath_glRenderbufferStorage(target, internalformat, width, height);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+#ifdef COREGL_TRACEPATH_TRACE_MEMUSE_INFO
+       if (trace_mem_flag == 1)
+       {
+               MY_MODULE_TSTATE *tstate = NULL;
+
+               GET_MY_TSTATE(tstate, get_current_thread_state());
+               AST(tstate != NULL);
+                /* Precent CID : 406403 */
+               if (tstate != NULL && tstate->ctx != NULL)
+               {
+                       int objidx = _COREGL_INT_INIT_VALUE;
+                       _orig_tracepath_glGetIntegerv(GL_RENDERBUFFER_BINDING, &objidx);
+                       AST(objidx != _COREGL_INT_INIT_VALUE);
+
+                       // Detect byte per pixel
+                       int bpp = 0;
+                       char formatment[80];
+                       switch (internalformat)
+                       {
+                               case GL_ALPHA: snprintf(formatment,sizeof(formatment), "ALPHA"); bpp = 1; break;
+                               case GL_LUMINANCE: snprintf(formatment, sizeof(formatment), "LUMINANCE"); bpp = 1; break;
+                               case GL_LUMINANCE_ALPHA: snprintf(formatment, sizeof(formatment),"LUMINANCE_ALPHA"); bpp = 1; break;
+                               case GL_RGB: snprintf(formatment,  sizeof(formatment),"RGB"); bpp = 2; break;
+                               case GL_RGBA: snprintf(formatment,sizeof(formatment), "RGBA"); bpp = 4; break;
+                               case 0x80E1: snprintf(formatment,sizeof(formatment), "BGRA_EXT"); bpp = 4; break;
+                               case 0x84F9: snprintf(formatment,sizeof(formatment), "DEPTH_STENCIL_OES"); bpp = 4; break;
+                               case GL_DEPTH_COMPONENT : snprintf(formatment,sizeof(formatment), "DEPTH_COMPONENT"); bpp = 1; break;
+                               case 0x81A5: snprintf(formatment,sizeof(formatment), "DEPTH_COMPONENT16_ARB"); bpp = 2; break;
+                               case 0x81A6: snprintf(formatment,sizeof(formatment), "DEPTH_COMPONENT24_ARB"); bpp = 3; break;
+                               case 0x81A7: snprintf(formatment,sizeof(formatment), "DEPTH_COMPONENT32_ARB"); bpp = 4; break;
+                               case 0x8D46 : snprintf(formatment,sizeof(formatment), "STENCIL_INDEX1_OES"); bpp = 1; break;
+                               case 0x8D47 : snprintf(formatment,sizeof(formatment), "STENCIL_INDEX4_OES"); bpp = 1; break;
+                               case 0x8D48 : snprintf(formatment,sizeof(formatment), "STENCIL_INDEX8_OES"); bpp = 1; break;
+                               default: snprintf(formatment,sizeof(formatment), "0x%X", internalformat); bpp = 0; break;
+                       }
+
+                       _add_glbuf_object(tstate->ctx->sostate->glbuf_rb, objidx, "Renderbuffer", width, height, bpp, formatment);
+               }
+       }
+#endif // COREGL_TRACEPATH_TRACE_MEMUSE_INFO
+#ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO
+       if (trace_surface_flag == 1)
+       {
+               MY_MODULE_TSTATE *tstate = NULL;
+
+               GET_MY_TSTATE(tstate, get_current_thread_state());
+               AST(tstate != NULL);
+                /* Prevent CID : 406403 */
+               if (tstate != NULL && tstate->ctx != NULL)
+               {
+                       int objidx = _COREGL_INT_INIT_VALUE;
+                       _orig_tracepath_glGetIntegerv(GL_RENDERBUFFER_BINDING, &objidx);
+                       AST(objidx != _COREGL_INT_INIT_VALUE);
+
+                       {
+                               int channel = 0;
+                               switch (internalformat)
+                               {
+                                       case GL_ALPHA:
+                                       case GL_LUMINANCE:
+                                       case GL_DEPTH_COMPONENT :
+                                       case 0x81A5:
+                                       case 0x81A6:
+                                       case 0x81A7:
+                                       case 0x8D46 :
+                                       case 0x8D47 :
+                                       case 0x8D48 : channel = 1; break;
+                                       case GL_LUMINANCE_ALPHA:
+                                       case 0x84F9: channel = 2; break;
+                                       case GL_RGB: channel = 3; break;
+                                       case GL_RGBA:
+                                       case 0x80E1: channel = 4; break;
+                               }
+
+                               char name[256];
+                               snprintf(name,sizeof(name), "FBORB_%d", objidx);
+                               tracepath_surface_trace_add(name, tstate->ctx->dpy, tstate->ctx->handle, tstate->surf_draw, -1, 0, objidx, width, height, channel, NULL);
+                       }
+               }
+       }
+#endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
+}
+
+void
+tracepath_glSampleCoverage(GLclampf value, GLboolean invert)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glSampleCoverage(value, invert);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glScissor(x, y, width, height);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glShaderBinary(n, shaders, binaryformat, binary, length);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glShaderSource(shader, count, string, length);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glStencilFunc(GLenum func, GLint ref, GLuint mask)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glStencilFunc(func, ref, mask);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glStencilFuncSeparate(face, func, ref, mask);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glStencilMask(GLuint mask)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glStencilMask(mask);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glStencilMaskSeparate(GLenum face, GLuint mask)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glStencilMaskSeparate(face, mask);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glStencilOp(fail, zfail, zpass);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glStencilOpSeparate(face, fail, zfail, zpass);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+#ifdef COREGL_TRACEPATH_TRACE_MEMUSE_INFO
+       if (trace_mem_flag == 1)
+       {
+               MY_MODULE_TSTATE *tstate = NULL;
+
+               GET_MY_TSTATE(tstate, get_current_thread_state());
+               AST(tstate != NULL);
+               if (tstate != NULL && tstate->ctx != NULL)
+               {
+                       int objidx = _COREGL_INT_INIT_VALUE;
+                       _orig_tracepath_glGetIntegerv(GL_TEXTURE_BINDING_2D, &objidx);
+                       AST(objidx != _COREGL_INT_INIT_VALUE);
+
+                       // Detect byte per pixel
+                       int bpp = 0;
+                       char formatment[80];
+                       switch (internalformat)
+                       {
+                               case GL_ALPHA: snprintf(formatment,sizeof(formatment), "ALPHA"); bpp = 1; break;
+                               case GL_LUMINANCE: snprintf(formatment,sizeof(formatment), "LUMINANCE"); bpp = 1; break;
+                               case GL_LUMINANCE_ALPHA: snprintf(formatment,sizeof(formatment), "LUMINANCE_ALPHA"); bpp = 1; break;
+                               case GL_RGB: snprintf(formatment,sizeof(formatment), "RGB"); bpp = 2; break;
+                               case GL_RGBA: snprintf(formatment,sizeof(formatment), "RGBA"); bpp = 4; break;
+                               case 0x80E1: snprintf(formatment,sizeof(formatment), "BGRA_EXT"); bpp = 4; break;
+                               case 0x84F9: snprintf(formatment,sizeof(formatment), "DEPTH_STENCIL_OES"); bpp = 4; break;
+                               case GL_DEPTH_COMPONENT : snprintf(formatment,sizeof(formatment), "DEPTH_COMPONENT"); bpp = 1; break;
+                               case 0x81A5: snprintf(formatment,sizeof(formatment), "DEPTH_COMPONENT16_ARB"); bpp = 2; break;
+                               case 0x81A6: snprintf(formatment,sizeof(formatment), "DEPTH_COMPONENT24_ARB"); bpp = 3; break;
+                               case 0x81A7: snprintf(formatment,sizeof(formatment), "DEPTH_COMPONENT32_ARB"); bpp = 4; break;
+                               case 0x8D46 : snprintf(formatment,sizeof(formatment), "STENCIL_INDEX1_OES"); bpp = 1; break;
+                               case 0x8D47 : snprintf(formatment,sizeof(formatment), "STENCIL_INDEX4_OES"); bpp = 1; break;
+                               case 0x8D48 : snprintf(formatment,sizeof(formatment), "STENCIL_INDEX8_OES"); bpp = 1; break;
+                               default: snprintf(formatment, sizeof(formatment),"0x%X", internalformat); bpp = 0; break;
+                       }
+
+                       _add_glbuf_object(tstate->ctx->sostate->glbuf_tex, objidx, "Texture", width, height, bpp, formatment);
+               }
+       }
+#endif // COREGL_TRACEPATH_TRACE_MEMUSE_INFO
+#ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO
+       if (trace_surface_flag == 1)
+       {
+               MY_MODULE_TSTATE *tstate = NULL;
+
+               GET_MY_TSTATE(tstate, get_current_thread_state());
+               AST(tstate != NULL);
+
+                /* Prevent CID : 405600 */
+               if (tstate != NULL && tstate->ctx != NULL)
+               {
+                       int objidx = _COREGL_INT_INIT_VALUE;
+                       _orig_tracepath_glGetIntegerv(GL_TEXTURE_BINDING_2D, &objidx);
+                       AST(objidx != _COREGL_INT_INIT_VALUE);
+
+                       {
+                               int channel = 0;
+                               switch (internalformat)
+                               {
+                                       case GL_ALPHA:
+                                       case GL_LUMINANCE:
+                                       case GL_DEPTH_COMPONENT :
+                                       case 0x81A5:
+                                       case 0x81A6:
+                                       case 0x81A7:
+                                       case 0x8D46 :
+                                       case 0x8D47 :
+                                       case 0x8D48 : channel = 1; break;
+                                       case GL_LUMINANCE_ALPHA:
+                                       case 0x84F9: channel = 2; break;
+                                       case GL_RGB: channel = 3; break;
+                                       case GL_RGBA:
+                                       case 0x80E1: channel = 4; break;
+                               }
+
+                               char name[256];
+                               snprintf(name, sizeof(name),"FBOTEX_0x%X", objidx);
+                               tracepath_surface_trace_add(name, tstate->ctx->dpy, tstate->ctx->handle, tstate->surf_draw, -1, objidx, 0, width, height, channel, NULL);
+                       }
+               }
+       }
+#endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
+}
+
+void
+tracepath_glTexParameterf(GLenum target, GLenum pname, GLfloat param)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glTexParameterf(target, pname, param);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glTexParameterfv(target, pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glTexParameteri(GLenum target, GLenum pname, GLint param)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glTexParameteri(target, pname, param);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glTexParameteriv(GLenum target, GLenum pname, const GLint* params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glTexParameteriv(target, pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniform1f(GLint location, GLfloat x)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniform1f(location, x);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniform1fv(GLint location, GLsizei count, const GLfloat* v)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniform1fv(location, count, v);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniform1i(GLint location, GLint x)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniform1i(location, x);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniform1iv(GLint location, GLsizei count, const GLint* v)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniform1iv(location, count, v);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniform2f(GLint location, GLfloat x, GLfloat y)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniform2f(location, x, y);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniform2fv(GLint location, GLsizei count, const GLfloat* v)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniform2fv(location, count, v);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniform2i(GLint location, GLint x, GLint y)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniform2i(location, x, y);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniform2iv(GLint location, GLsizei count, const GLint* v)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniform2iv(location, count, v);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniform3f(location, x, y, z);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniform3fv(GLint location, GLsizei count, const GLfloat* v)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniform3fv(location, count, v);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniform3i(GLint location, GLint x, GLint y, GLint z)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniform3i(location, x, y, z);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniform3iv(GLint location, GLsizei count, const GLint* v)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniform3iv(location, count, v);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniform4f(location, x, y, z, w);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniform4fv(GLint location, GLsizei count, const GLfloat* v)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniform4fv(location, count, v);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniform4i(location, x, y, z, w);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniform4iv(GLint location, GLsizei count, const GLint* v)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniform4iv(location, count, v);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniformMatrix2fv(location, count, transpose, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniformMatrix3fv(location, count, transpose, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniformMatrix4fv(location, count, transpose, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUseProgram(GLuint program)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUseProgram(program);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glValidateProgram(GLuint program)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glValidateProgram(program);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glVertexAttrib1f(GLuint index, GLfloat x)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glVertexAttrib1f(index, x);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glVertexAttrib1fv(GLuint index, const GLfloat* values)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glVertexAttrib1fv(index, values);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glVertexAttrib2f(index, x, y);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glVertexAttrib2fv(GLuint index, const GLfloat* values)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glVertexAttrib2fv(index, values);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glVertexAttrib3f(index, x, y, z);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glVertexAttrib3fv(GLuint index, const GLfloat* values)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glVertexAttrib3fv(index, values);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glVertexAttrib4f(index, x, y, z, w);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glVertexAttrib4fv(GLuint index, const GLfloat* values)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glVertexAttrib4fv(index, values);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* pointer)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glVertexAttribPointer(index, size, type, normalized, stride, pointer);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glViewport(x, y, width, height);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+
+/* OpenGL ES 3.0 */
+void
+tracepath_glReadBuffer(GLenum mode)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glReadBuffer(mode);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glDrawRangeElements(mode, start, end, count, type, indices);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glTexImage3D(GLenum target, GLint level, GLint GLinternalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glTexImage3D(target, level, GLinternalFormat, width, height, depth, border, format, type, pixels);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glTexImage3DOES(GLenum target, GLint level, GLint GLinternalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glTexImage3DOES(target, level, GLinternalFormat, width, height, depth, border, format, type, pixels);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glTexSubImage3DOES(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glCopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glCopyTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glCopyTexSubImage3DOES(target, level, xoffset, yoffset, zoffset, x, y, width, height);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glCompressedTexImage3D(GLenum target, GLint level, GLenum GLinternalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glCompressedTexImage3D(target, level, GLinternalformat, width, height, depth, border, imageSize, data);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glCompressedTexImage3DOES(GLenum target, GLint level, GLenum GLinternalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glCompressedTexImage3DOES(target, level, GLinternalformat, width, height, depth, border, imageSize, data);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glCompressedTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glCompressedTexSubImage3DOES(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGenQueries(GLsizei n, GLuint* ids)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGenQueries(n, ids);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glDeleteQueries(GLsizei n, const GLuint* ids)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glDeleteQueries(n, ids);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+GLboolean
+tracepath_glIsQuery(GLuint id)
+{
+       GLboolean ret = GL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glIsQuery(id);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+void
+tracepath_glBeginQuery(GLenum target, GLuint id)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glBeginQuery(target, id);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glEndQuery(GLenum target)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glEndQuery(target);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetQueryiv(GLenum target, GLenum pname, GLint* params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetQueryiv(target, pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetQueryObjectuiv(id, pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+GLboolean
+tracepath_glUnmapBuffer(GLenum target)
+{
+       GLboolean ret = GL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glUnmapBuffer(target);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+void
+tracepath_glGetBufferPointerv(GLenum target, GLenum pname, GLvoid** params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetBufferPointerv(target, pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glDrawBuffers(GLsizei n, const GLenum* bufs)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glDrawBuffers(n, bufs);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniformMatrix2x3fv(location, count, transpose, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniformMatrix3x2fv(location, count, transpose, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniformMatrix2x4fv(location, count, transpose, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniformMatrix4x2fv(location, count, transpose, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniformMatrix3x4fv(location, count, transpose, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniformMatrix4x3fv(location, count, transpose, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glRenderbufferStorageMultisample(target, samples, internalformat, width, height);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+#ifdef COREGL_TRACEPATH_TRACE_MEMUSE_INFO
+       if (trace_mem_flag == 1)
+       {
+               MY_MODULE_TSTATE *tstate = NULL;
+
+               GET_MY_TSTATE(tstate, get_current_thread_state());
+               AST(tstate != NULL);
+                /* Prevent CID : 391397 */
+               if (tstate != NULL && tstate->ctx != NULL)
+               {
+                       int objidx = _COREGL_INT_INIT_VALUE;
+                       _orig_tracepath_glGetIntegerv(GL_RENDERBUFFER_BINDING, &objidx);
+                       AST(objidx != _COREGL_INT_INIT_VALUE);
+
+                       // Detect byte per pixel
+                       int bpp = 0;
+                       char formatment[80];
+                       switch (internalformat)
+                       {
+                               case GL_ALPHA: snprintf(formatment,sizeof(formatment), "ALPHA"); bpp = 1; break;
+                               case GL_LUMINANCE: snprintf(formatment,sizeof(formatment), "LUMINANCE"); bpp = 1; break;
+                               case GL_LUMINANCE_ALPHA: snprintf(formatment,sizeof(formatment), "LUMINANCE_ALPHA"); bpp = 1; break;
+                               case GL_RGB: snprintf(formatment,sizeof(formatment), "RGB"); bpp = 2; break;
+                               case GL_RGBA: snprintf(formatment,sizeof(formatment), "RGBA"); bpp = 4; break;
+                               case 0x80E1: snprintf(formatment,sizeof(formatment), "BGRA_EXT"); bpp = 4; break;
+                               case 0x84F9: snprintf(formatment,sizeof(formatment), "DEPTH_STENCIL_OES"); bpp = 4; break;
+                               case GL_DEPTH_COMPONENT : snprintf(formatment,sizeof(formatment), "DEPTH_COMPONENT"); bpp = 1; break;
+                               case 0x81A5: snprintf(formatment,sizeof(formatment), "DEPTH_COMPONENT16_ARB"); bpp = 2; break;
+                               case 0x81A6: snprintf(formatment,sizeof(formatment), "DEPTH_COMPONENT24_ARB"); bpp = 3; break;
+                               case 0x81A7: snprintf(formatment,sizeof(formatment), "DEPTH_COMPONENT32_ARB"); bpp = 4; break;
+                               case 0x8D46 : snprintf(formatment,sizeof(formatment), "STENCIL_INDEX1_OES"); bpp = 1; break;
+                               case 0x8D47 : snprintf(formatment,sizeof(formatment), "STENCIL_INDEX4_OES"); bpp = 1; break;
+                               case 0x8D48 : snprintf(formatment,sizeof(formatment), "STENCIL_INDEX8_OES"); bpp = 1; break;
+                               default: snprintf(formatment,sizeof(formatment), "0x%X", internalformat); bpp = 0; break;
+                       }
+
+                       _add_glbuf_object(tstate->ctx->sostate->glbuf_rb, objidx, "Renderbuffer", width, height, bpp, formatment);
+               }
+       }
+#endif // COREGL_TRACEPATH_TRACE_MEMUSE_INFO
+#ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO
+       if (trace_surface_flag == 1)
+       {
+               MY_MODULE_TSTATE *tstate = NULL;
+
+               GET_MY_TSTATE(tstate, get_current_thread_state());
+               AST(tstate != NULL);
+                /* Prevent CID : 391397 */
+               if (tstate != NULL && tstate->ctx != NULL)
+               {
+                       int objidx = _COREGL_INT_INIT_VALUE;
+                       _orig_tracepath_glGetIntegerv(GL_RENDERBUFFER_BINDING, &objidx);
+                       AST(objidx != _COREGL_INT_INIT_VALUE);
+
+                       {
+                               int channel = 0;
+                               switch (internalformat)
+                               {
+                                       case GL_ALPHA:
+                                       case GL_LUMINANCE:
+                                       case GL_DEPTH_COMPONENT :
+                                       case 0x81A5:
+                                       case 0x81A6:
+                                       case 0x81A7:
+                                       case 0x8D46 :
+                                       case 0x8D47 :
+                                       case 0x8D48 : channel = 1; break;
+                                       case GL_LUMINANCE_ALPHA:
+                                       case 0x84F9: channel = 2; break;
+                                       case GL_RGB: channel = 3; break;
+                                       case GL_RGBA:
+                                       case 0x80E1: channel = 4; break;
+                               }
+
+                               char name[256];
+                               snprintf(name,sizeof(name), "FBORB_0x%X", objidx);
+                               tracepath_surface_trace_add(name, tstate->ctx->dpy, tstate->ctx->handle, tstate->surf_draw, -1, 0, objidx, width, height, channel, NULL);
+                       }
+               }
+       }
+#endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
+}
+
+void
+tracepath_glRenderbufferStorageMultisampleEXT(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glRenderbufferStorageMultisampleEXT(target, samples, internalformat, width, height);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+#ifdef COREGL_TRACEPATH_TRACE_MEMUSE_INFO
+       if (trace_mem_flag == 1)
+       {
+               MY_MODULE_TSTATE *tstate = NULL;
+
+               GET_MY_TSTATE(tstate, get_current_thread_state());
+               AST(tstate != NULL);
+                /* Prevent CID : 388557 */
+               if (tstate != NULL && tstate->ctx != NULL)
+               {
+                       int objidx = _COREGL_INT_INIT_VALUE;
+                       _orig_tracepath_glGetIntegerv(GL_RENDERBUFFER_BINDING, &objidx);
+                       AST(objidx != _COREGL_INT_INIT_VALUE);
+
+                       // Detect byte per pixel
+                       int bpp = 0;
+                       char formatment[80];
+                       switch (internalformat)
+                       {
+                               case GL_ALPHA: snprintf(formatment,sizeof(formatment), "ALPHA"); bpp = 1; break;
+                               case GL_LUMINANCE: snprintf(formatment,sizeof(formatment), "LUMINANCE"); bpp = 1; break;
+                               case GL_LUMINANCE_ALPHA: snprintf(formatment,sizeof(formatment), "LUMINANCE_ALPHA"); bpp = 1; break;
+                               case GL_RGB: snprintf(formatment,sizeof(formatment), "RGB"); bpp = 2; break;
+                               case GL_RGBA: snprintf(formatment,sizeof(formatment), "RGBA"); bpp = 4; break;
+                               case 0x80E1: snprintf(formatment,sizeof(formatment), "BGRA_EXT"); bpp = 4; break;
+                               case 0x84F9: snprintf(formatment,sizeof(formatment), "DEPTH_STENCIL_OES"); bpp = 4; break;
+                               case GL_DEPTH_COMPONENT : snprintf(formatment,sizeof(formatment), "DEPTH_COMPONENT"); bpp = 1; break;
+                               case 0x81A5: snprintf(formatment,sizeof(formatment), "DEPTH_COMPONENT16_ARB"); bpp = 2; break;
+                               case 0x81A6: snprintf(formatment,sizeof(formatment), "DEPTH_COMPONENT24_ARB"); bpp = 3; break;
+                               case 0x81A7: snprintf(formatment,sizeof(formatment), "DEPTH_COMPONENT32_ARB"); bpp = 4; break;
+                               case 0x8D46 : snprintf(formatment,sizeof(formatment), "STENCIL_INDEX1_OES"); bpp = 1; break;
+                               case 0x8D47 : snprintf(formatment,sizeof(formatment), "STENCIL_INDEX4_OES"); bpp = 1; break;
+                               case 0x8D48 : snprintf(formatment,sizeof(formatment), "STENCIL_INDEX8_OES"); bpp = 1; break;
+                               default: snprintf(formatment,sizeof(formatment), "0x%X", internalformat); bpp = 0; break;
+                       }
+
+                       _add_glbuf_object(tstate->ctx->sostate->glbuf_rb, objidx, "Renderbuffer", width, height, bpp, formatment);
+               }
+       }
+#endif // COREGL_TRACEPATH_TRACE_MEMUSE_INFO
+#ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO
+       if (trace_surface_flag == 1)
+       {
+               MY_MODULE_TSTATE *tstate = NULL;
+
+               GET_MY_TSTATE(tstate, get_current_thread_state());
+               AST(tstate != NULL);
+                /* Prevent CID : 388557 */
+               if (tstate != NULL && tstate->ctx != NULL)
+               {
+                       int objidx = _COREGL_INT_INIT_VALUE;
+                       _orig_tracepath_glGetIntegerv(GL_RENDERBUFFER_BINDING, &objidx);
+                       AST(objidx != _COREGL_INT_INIT_VALUE);
+
+                       {
+                               int channel = 0;
+                               switch (internalformat)
+                               {
+                                       case GL_ALPHA:
+                                       case GL_LUMINANCE:
+                                       case GL_DEPTH_COMPONENT :
+                                       case 0x81A5:
+                                       case 0x81A6:
+                                       case 0x81A7:
+                                       case 0x8D46 :
+                                       case 0x8D47 :
+                                       case 0x8D48 : channel = 1; break;
+                                       case GL_LUMINANCE_ALPHA:
+                                       case 0x84F9: channel = 2; break;
+                                       case GL_RGB: channel = 3; break;
+                                       case GL_RGBA:
+                                       case 0x80E1: channel = 4; break;
+                               }
+
+                               char name[256];
+                               snprintf(name,sizeof(name), "FBORB_0x%X", objidx);
+                               tracepath_surface_trace_add(name, tstate->ctx->dpy, tstate->ctx->handle, tstate->surf_draw, -1, 0, objidx, width, height, channel, NULL);
+                       }
+               }
+       }
+#endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
+}
+
+void
+tracepath_glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+
+#ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO
+       tracepath_fbdump_update(0);
+#endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
+
+       _orig_tracepath_glFramebufferTextureLayer(target, attachment, texture, level, layer);
+
+#ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO
+       tracepath_fbdump_update(1);
+#endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+GLvoid*
+tracepath_glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
+{
+       GLvoid* ret = NULL;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glMapBufferRange(target, offset, length, access);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+void
+tracepath_glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glFlushMappedBufferRange(target, offset, length);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glBindVertexArray(GLuint array)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glBindVertexArray(array);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glDeleteVertexArrays(GLsizei n, const GLuint* arrays)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glDeleteVertexArrays(n, arrays);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGenVertexArrays(GLsizei n, GLuint* arrays)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGenVertexArrays(n, arrays);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+GLboolean
+tracepath_glIsVertexArray(GLuint array)
+{
+       GLboolean ret = GL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glIsVertexArray(array);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+void
+tracepath_glGetIntegeri_v(GLenum target, GLuint index, GLint* data)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetIntegeri_v(target, index, data);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glBeginTransformFeedback(GLenum primitiveMode)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glBeginTransformFeedback(primitiveMode);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glEndTransformFeedback()
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glEndTransformFeedback();
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glBindBufferRange(target, index, buffer, offset, size);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glBindBufferBase(target, index, buffer);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glTransformFeedbackVaryings(program, count, varyings, bufferMode);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glVertexAttribIPointer(index, size, type, stride, pointer);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetVertexAttribIiv(GLuint index, GLenum pname, GLint* params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetVertexAttribIiv(index, pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetVertexAttribIuiv(index, pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glVertexAttribI4i(index, x, y, z, w);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glVertexAttribI4ui(index, x, y, z, w);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glVertexAttribI4iv(GLuint index, const GLint* v)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glVertexAttribI4iv(index, v);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glVertexAttribI4uiv(GLuint index, const GLuint* v)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glVertexAttribI4uiv(index, v);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetUniformuiv(GLuint program, GLint location, GLuint* params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetUniformuiv(program, location, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+GLint
+tracepath_glGetFragDataLocation(GLuint program, const GLchar *name)
+{
+       GLint ret = _COREGL_INT_INIT_VALUE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glGetFragDataLocation(program, name);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+void
+tracepath_glUniform1ui(GLint location, GLuint v0)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniform1ui(location, v0);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniform2ui(GLint location, GLuint v0, GLuint v1)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniform2ui(location, v0, v1);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniform3ui(location, v0, v1, v2);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniform4ui(location, v0, v1, v2, v3);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniform1uiv(GLint location, GLsizei count, const GLuint* value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniform1uiv(location, count, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniform2uiv(GLint location, GLsizei count, const GLuint* value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniform2uiv(location, count, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniform3uiv(GLint location, GLsizei count, const GLuint* value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniform3uiv(location, count, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniform4uiv(GLint location, GLsizei count, const GLuint* value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniform4uiv(location, count, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glClearBufferiv(buffer, drawbuffer, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glClearBufferuiv(buffer, drawbuffer, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat* value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glClearBufferfv(buffer, drawbuffer, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glClearBufferfi(buffer, drawbuffer, depth, stencil);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+const GLubyte*
+tracepath_glGetStringi(GLenum name, GLuint index)
+{
+       const GLubyte* ret = NULL;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glGetStringi(name, index);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+void
+tracepath_glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glCopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+GLuint
+tracepath_glGetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName)
+{
+       GLuint ret = _COREGL_INT_INIT_VALUE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glGetUniformBlockIndex(program, uniformBlockName);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+void
+tracepath_glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glDrawArraysInstanced(mode, first, count, instanceCount);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glDrawElementsInstanced(mode, count, type, indices, instanceCount);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+GLsync
+tracepath_glFenceSync(GLenum condition, GLbitfield flags)
+{
+       GLsync ret = NULL;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glFenceSync(condition, flags);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+GLboolean
+tracepath_glIsSync(GLsync sync)
+{
+       GLboolean ret = GL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glIsSync(sync);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+void
+tracepath_glDeleteSync(GLsync sync)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glDeleteSync(sync);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+GLenum
+tracepath_glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
+{
+       GLenum ret = _COREGL_INT_INIT_VALUE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glClientWaitSync(sync, flags, timeout);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+void
+tracepath_glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glWaitSync(sync, flags, timeout);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetInteger64v(GLenum pname, GLint64* params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetInteger64v(pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetSynciv(sync, pname, bufSize, length, values);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetInteger64i_v(GLenum target, GLuint index, GLint64* data)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetInteger64i_v(target, index, data);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetBufferParameteri64v(target, pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGenSamplers(GLsizei n, GLuint* samplers)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGenSamplers(n, samplers);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glDeleteSamplers(GLsizei n, const GLuint* samplers)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glDeleteSamplers(n, samplers);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+GLboolean
+tracepath_glIsSampler(GLuint sampler)
+{
+       GLboolean ret = GL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glIsSampler(sampler);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+void
+tracepath_glBindSampler(GLuint unit, GLuint sampler)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glBindSampler(unit, sampler);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glSamplerParameteri(sampler, pname, param);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glSamplerParameteriv(sampler, pname, param);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glSamplerParameterf(sampler, pname, param);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glSamplerParameterfv(sampler, pname, param);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetSamplerParameteriv(sampler, pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetSamplerParameterfv(sampler, pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glVertexAttribDivisor(GLuint index, GLuint divisor)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glVertexAttribDivisor(index, divisor);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glBindTransformFeedback(GLenum target, GLuint id)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glBindTransformFeedback(target, id);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glDeleteTransformFeedbacks(GLsizei n, const GLuint* ids)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glDeleteTransformFeedbacks(n, ids);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGenTransformFeedbacks(GLsizei n, GLuint* ids)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGenTransformFeedbacks(n, ids);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+GLboolean
+tracepath_glIsTransformFeedback(GLuint id)
+{
+       GLboolean ret = GL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glIsTransformFeedback(id);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+       return ret;
+}
+
+void
+tracepath_glPauseTransformFeedback()
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glPauseTransformFeedback();
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glResumeTransformFeedback()
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glResumeTransformFeedback();
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetProgramBinary(program, bufSize, length, binaryFormat, binary);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetProgramBinaryOES(program, bufSize, length, binaryFormat, binary);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glProgramBinary(program, binaryFormat, binary, length);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glProgramBinaryOES(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glProgramBinaryOES(program, binaryFormat, binary, length);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glProgramParameteri(GLuint program, GLenum pname, GLint value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glProgramParameteri(program, pname, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glInvalidateFramebuffer(target, numAttachments, attachments);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum* attachments)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glDiscardFramebufferEXT(target, numAttachments, attachments);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glInvalidateSubFramebuffer(target, numAttachments, attachments, x, y, width, height);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glTexStorage2D(target, levels, internalformat, width, height);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glTexStorage3D(target, levels, internalformat, width, height, depth);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetInternalformativ(target, internalformat, pname, bufSize, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+
+/* GLES Extensions */
+void
+tracepath_glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glEGLImageTargetTexture2DOES(target, image);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+#ifdef COREGL_TRACEPATH_TRACE_MEMUSE_INFO
+       if (trace_mem_flag == 1)
+       {
+               MY_MODULE_TSTATE *tstate = NULL;
+
+               GET_MY_TSTATE(tstate, get_current_thread_state());
+               AST(tstate != NULL);
+                /* Prevent CID : 404286 */
+               if (tstate != NULL && tstate->ctx != NULL)
+               {
+                       int objidx = _COREGL_INT_INIT_VALUE;
+                       _orig_tracepath_glGetIntegerv(GL_TEXTURE_BINDING_2D, &objidx);
+                       AST(objidx != _COREGL_INT_INIT_VALUE);
+
+                       _add_glbuf_object(tstate->ctx->sostate->glbuf_tex, objidx, "Texture", 0, 0, 0, "Unknown");
+               }
+       }
+#endif // COREGL_TRACEPATH_TRACE_MEMUSE_INFO
+}
+
+void
+tracepath_glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glEGLImageTargetRenderbufferStorageOES(target, image);
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+#ifdef COREGL_TRACEPATH_TRACE_MEMUSE_INFO
+       if (trace_mem_flag == 1)
+       {
+               MY_MODULE_TSTATE *tstate = NULL;
+
+               GET_MY_TSTATE(tstate, get_current_thread_state());
+               AST(tstate != NULL);
+                /* Prevent CID : 397458 */
+               if (tstate != NULL && tstate->ctx != NULL)
+               {
+                       int objidx = _COREGL_INT_INIT_VALUE;
+                       _orig_tracepath_glGetIntegerv(GL_RENDERBUFFER_BINDING, &objidx);
+                       AST(objidx != _COREGL_INT_INIT_VALUE);
+
+                       _add_glbuf_object(tstate->ctx->sostate->glbuf_rb, objidx, "Renderbuffer", 0, 0, 0, "Unknown");
+               }
+       }
+#endif // COREGL_TRACEPATH_TRACE_MEMUSE_INFO
+}
+
+void
+tracepath_glUseProgramStagesEXT(GLuint pipeline, GLbitfield stages, GLuint program)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glUseProgramStagesEXT(pipeline, stages, program);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glActiveShaderProgramEXT(GLuint pipeline, GLuint program)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glActiveShaderProgramEXT(pipeline, program);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+GLuint
+tracepath_glCreateShaderProgramvEXT(GLenum type, GLsizei count, const char **strings)
+{
+       GLuint ret = _COREGL_INT_INIT_VALUE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glCreateShaderProgramvEXT(type, count, strings);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+   return ret;
+}
+
+void
+tracepath_glBindProgramPipelineEXT(GLuint pipeline)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glBindProgramPipelineEXT(pipeline);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glDeleteProgramPipelinesEXT(GLsizei n, const GLuint *pipelines)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glDeleteProgramPipelinesEXT(n, pipelines);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGenProgramPipelinesEXT(GLsizei n, GLuint *pipelines)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGenProgramPipelinesEXT(n, pipelines);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+GLboolean
+tracepath_glIsProgramPipelineEXT(GLuint pipeline)
+{
+       GLboolean ret = _COREGL_INT_INIT_VALUE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glIsProgramPipelineEXT(pipeline);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+   return ret;
+}
+
+void
+tracepath_glProgramParameteriEXT(GLuint program, GLenum pname, GLint value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glProgramParameteriEXT(program, pname, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetProgramPipelineivEXT(GLuint pipeline, GLenum pname, GLint *params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetProgramPipelineivEXT(pipeline, pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glProgramUniform1iEXT(GLuint program, GLint location, GLint x)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glProgramUniform1iEXT(program, location, x);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glProgramUniform2iEXT(GLuint program, GLint location, GLint x, GLint y)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glProgramUniform2iEXT(program, location, x, y);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glProgramUniform3iEXT(GLuint program, GLint location, GLint x, GLint y, GLint z)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glProgramUniform3iEXT(program, location, x, y, z);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glProgramUniform4iEXT(GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glProgramUniform4iEXT(program, location, x, y, z, w);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glProgramUniform1fEXT(GLuint program, GLint location, GLfloat x)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glProgramUniform1fEXT(program, location, x);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glProgramUniform2fEXT(GLuint program, GLint location, GLfloat x, GLfloat y)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glProgramUniform2fEXT(program, location, x, y);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glProgramUniform3fEXT(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glProgramUniform3fEXT(program, location, x, y, z);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glProgramUniform4fEXT(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glProgramUniform4fEXT(program, location, x, y, z, w);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glProgramUniform1ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glProgramUniform1ivEXT(program, location, count, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glProgramUniform2ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glProgramUniform2ivEXT(program, location, count, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glProgramUniform3ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glProgramUniform3ivEXT(program, location, count, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glProgramUniform4ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glProgramUniform4ivEXT(program, location, count, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glProgramUniform1fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glProgramUniform1fvEXT(program, location, count, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glProgramUniform2fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glProgramUniform2fvEXT(program, location, count, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glProgramUniform3fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glProgramUniform3fvEXT(program, location, count, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glProgramUniform4fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glProgramUniform4fvEXT(program, location, count, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glProgramUniformMatrix2fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glProgramUniformMatrix2fvEXT(program, location, count, transpose, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glProgramUniformMatrix3fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glProgramUniformMatrix3fvEXT(program, location, count, transpose, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glProgramUniformMatrix4fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glProgramUniformMatrix4fvEXT(program, location, count, transpose, value);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glValidateProgramPipelineEXT(GLuint pipeline)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glValidateProgramPipelineEXT(pipeline);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glGetProgramPipelineInfoLogEXT(GLuint pipeline, GLsizei bufSize, GLsizei *length, char *infoLog)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetProgramPipelineInfoLogEXT(pipeline, bufSize, length, infoLog);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+
+void
+tracepath_glFramebufferTexture2DMultisampleEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+
+#ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO
+       tracepath_fbdump_update(0);
+#endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
+
+       _orig_tracepath_glFramebufferTexture2DMultisampleEXT(target, attachment, textarget, texture, level, samples);
+
+#ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO
+       tracepath_fbdump_update(1);
+#endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glFramebufferTexture3DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glFramebufferTexture3DOES(target, attachment, textarget, texture, level, zoffset);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glBlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glBlitFramebufferANGLE(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+void
+tracepath_glRenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+
+       _orig_tracepath_glRenderbufferStorageMultisampleANGLE(target, samples, internalformat, width, height);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+#ifdef COREGL_TRACEPATH_TRACE_MEMUSE_INFO
+       if (trace_mem_flag == 1)
+       {
+               MY_MODULE_TSTATE *tstate = NULL;
+
+               GET_MY_TSTATE(tstate, get_current_thread_state());
+               AST(tstate != NULL);
+                /* Prevent CID : 394055 */
+               if (tstate != NULL && tstate->ctx != NULL)
+               {
+                       int objidx = _COREGL_INT_INIT_VALUE;
+                       _orig_tracepath_glGetIntegerv(GL_RENDERBUFFER_BINDING, &objidx);
+                       AST(objidx != _COREGL_INT_INIT_VALUE);
+
+                       // Detect byte per pixel
+                       int bpp = 0;
+                       char formatment[80];
+                       switch (internalformat)
+                       {
+                               case GL_ALPHA: snprintf(formatment,sizeof(formatment), "ALPHA"); bpp = 1; break;
+                               case GL_LUMINANCE: snprintf(formatment,sizeof(formatment), "LUMINANCE"); bpp = 1; break;
+                               case GL_LUMINANCE_ALPHA: snprintf(formatment,sizeof(formatment), "LUMINANCE_ALPHA"); bpp = 1; break;
+                               case GL_RGB: snprintf(formatment,sizeof(formatment), "RGB"); bpp = 2; break;
+                               case GL_RGBA: snprintf(formatment,sizeof(formatment), "RGBA"); bpp = 4; break;
+                               case 0x80E1: snprintf(formatment,sizeof(formatment), "BGRA_EXT"); bpp = 4; break;
+                               case 0x84F9: snprintf(formatment,sizeof(formatment), "DEPTH_STENCIL_OES"); bpp = 4; break;
+                               case GL_DEPTH_COMPONENT : snprintf(formatment,sizeof(formatment), "DEPTH_COMPONENT"); bpp = 1; break;
+                               case 0x81A5: snprintf(formatment,sizeof(formatment), "DEPTH_COMPONENT16_ARB"); bpp = 2; break;
+                               case 0x81A6: snprintf(formatment,sizeof(formatment), "DEPTH_COMPONENT24_ARB"); bpp = 3; break;
+                               case 0x81A7: snprintf(formatment,sizeof(formatment), "DEPTH_COMPONENT32_ARB"); bpp = 4; break;
+                               case 0x8D46 : snprintf(formatment,sizeof(formatment), "STENCIL_INDEX1_OES"); bpp = 1; break;
+                               case 0x8D47 : snprintf(formatment,sizeof(formatment), "STENCIL_INDEX4_OES"); bpp = 1; break;
+                               case 0x8D48 : snprintf(formatment,sizeof(formatment), "STENCIL_INDEX8_OES"); bpp = 1; break;
+                               default: snprintf(formatment,sizeof(formatment), "0x%X", internalformat); bpp = 0; break;
+                       }
+
+                       _add_glbuf_object(tstate->ctx->sostate->glbuf_rb, objidx, "Renderbuffer", width, height, bpp, formatment);
+               }
+       }
+#endif // COREGL_TRACEPATH_TRACE_MEMUSE_INFO
+#ifdef COREGL_TRACEPATH_TRACE_SURFACE_INFO
+       if (trace_surface_flag == 1)
+       {
+               MY_MODULE_TSTATE *tstate = NULL;
+
+               GET_MY_TSTATE(tstate, get_current_thread_state());
+               AST(tstate != NULL);
+                /* Prevent CID : 394055 */
+               if (tstate != NULL && tstate->ctx != NULL)
+               {
+                       int objidx = _COREGL_INT_INIT_VALUE;
+                       _orig_tracepath_glGetIntegerv(GL_RENDERBUFFER_BINDING, &objidx);
+                       AST(objidx != _COREGL_INT_INIT_VALUE);
+
+                       {
+                               int channel = 0;
+                               switch (internalformat)
+                               {
+                                       case GL_ALPHA:
+                                       case GL_LUMINANCE:
+                                       case GL_DEPTH_COMPONENT :
+                                       case 0x81A5:
+                                       case 0x81A6:
+                                       case 0x81A7:
+                                       case 0x8D46 :
+                                       case 0x8D47 :
+                                       case 0x8D48 : channel = 1; break;
+                                       case GL_LUMINANCE_ALPHA:
+                                       case 0x84F9: channel = 2; break;
+                                       case GL_RGB: channel = 3; break;
+                                       case GL_RGBA:
+                                       case 0x80E1: channel = 4; break;
+                               }
+
+                               char name[256];
+                               snprintf(name, sizeof(name),"FBORB_%d", objidx);
+                               tracepath_surface_trace_add(name, tstate->ctx->dpy, tstate->ctx->handle, tstate->surf_draw, -1, 0, objidx, width, height, channel, NULL);
+                       }
+               }
+       }
+#endif // COREGL_TRACEPATH_TRACE_SURFACE_INFO
+}
+
+
+void
+tracepath_glGetBufferPointervOES(GLenum target, GLenum pname, GLvoid** params)
+{
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       _orig_tracepath_glGetBufferPointervOES(target, pname, params);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+}
+
+
+void *
+tracepath_glMapBufferOES(GLenum target, GLenum access)
+{
+       void *ret = NULL;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glMapBufferOES(target, access);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+   return ret;
+}
+
+
+GLboolean
+tracepath_glUnmapBufferOES(GLenum target)
+{
+       GLboolean ret = GL_FALSE;
+
+       _COREGL_TRACEPATH_FUNC_BEGIN();
+       ret = _orig_tracepath_glUnmapBufferOES(target);
+
+       goto finish;
+
+finish:
+       _COREGL_TRACEPATH_FUNC_END();
+   return ret;
+}
+
diff --git a/src/modules/tracepath/png.h b/src/modules/tracepath/png.h
new file mode 100644 (file)
index 0000000..3560969
--- /dev/null
@@ -0,0 +1,3810 @@
+/* png.h - header file for PNG reference library
+ *
+ * libpng version 1.2.50 - July 10, 2012
+ * Copyright (c) 1998-2012 Glenn Randers-Pehrson
+ * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
+ * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
+ *
+ * This code is released under the libpng license (See LICENSE, below)
+ *
+ * Authors and maintainers:
+ *  libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
+ *  libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
+ *  libpng versions 0.97, January 1998, through 1.2.50 - July 10, 2012: Glenn
+ *  See also "Contributing Authors", below.
+ *
+ * Note about libpng version numbers:
+ *
+ *    Due to various miscommunications, unforeseen code incompatibilities
+ *    and occasional factors outside the authors' control, version numbering
+ *    on the library has not always been consistent and straightforward.
+ *    The following table summarizes matters since version 0.89c, which was
+ *    the first widely used release:
+ *
+ *    source                 png.h  png.h  shared-lib
+ *    version                string   int  version
+ *    -------                ------ -----  ----------
+ *    0.89c "1.0 beta 3"     0.89      89  1.0.89
+ *    0.90  "1.0 beta 4"     0.90      90  0.90  [should have been 2.0.90]
+ *    0.95  "1.0 beta 5"     0.95      95  0.95  [should have been 2.0.95]
+ *    0.96  "1.0 beta 6"     0.96      96  0.96  [should have been 2.0.96]
+ *    0.97b "1.00.97 beta 7" 1.00.97   97  1.0.1 [should have been 2.0.97]
+ *    0.97c                  0.97      97  2.0.97
+ *    0.98                   0.98      98  2.0.98
+ *    0.99                   0.99      98  2.0.99
+ *    0.99a-m                0.99      99  2.0.99
+ *    1.00                   1.00     100  2.1.0 [100 should be 10000]
+ *    1.0.0      (from here on, the   100  2.1.0 [100 should be 10000]
+ *    1.0.1       png.h string is   10001  2.1.0
+ *    1.0.1a-e    identical to the  10002  from here on, the shared library
+ *    1.0.2       source version)   10002  is 2.V where V is the source code
+ *    1.0.2a-b                      10003  version, except as noted.
+ *    1.0.3                         10003
+ *    1.0.3a-d                      10004
+ *    1.0.4                         10004
+ *    1.0.4a-f                      10005
+ *    1.0.5 (+ 2 patches)           10005
+ *    1.0.5a-d                      10006
+ *    1.0.5e-r                      10100 (not source compatible)
+ *    1.0.5s-v                      10006 (not binary compatible)
+ *    1.0.6 (+ 3 patches)           10006 (still binary incompatible)
+ *    1.0.6d-f                      10007 (still binary incompatible)
+ *    1.0.6g                        10007
+ *    1.0.6h                        10007  10.6h (testing xy.z so-numbering)
+ *    1.0.6i                        10007  10.6i
+ *    1.0.6j                        10007  2.1.0.6j (incompatible with 1.0.0)
+ *    1.0.7beta11-14        DLLNUM  10007  2.1.0.7beta11-14 (binary compatible)
+ *    1.0.7beta15-18           1    10007  2.1.0.7beta15-18 (binary compatible)
+ *    1.0.7rc1-2               1    10007  2.1.0.7rc1-2 (binary compatible)
+ *    1.0.7                    1    10007  (still compatible)
+ *    1.0.8beta1-4             1    10008  2.1.0.8beta1-4
+ *    1.0.8rc1                 1    10008  2.1.0.8rc1
+ *    1.0.8                    1    10008  2.1.0.8
+ *    1.0.9beta1-6             1    10009  2.1.0.9beta1-6
+ *    1.0.9rc1                 1    10009  2.1.0.9rc1
+ *    1.0.9beta7-10            1    10009  2.1.0.9beta7-10
+ *    1.0.9rc2                 1    10009  2.1.0.9rc2
+ *    1.0.9                    1    10009  2.1.0.9
+ *    1.0.10beta1              1    10010  2.1.0.10beta1
+ *    1.0.10rc1                1    10010  2.1.0.10rc1
+ *    1.0.10                   1    10010  2.1.0.10
+ *    1.0.11beta1-3            1    10011  2.1.0.11beta1-3
+ *    1.0.11rc1                1    10011  2.1.0.11rc1
+ *    1.0.11                   1    10011  2.1.0.11
+ *    1.0.12beta1-2            2    10012  2.1.0.12beta1-2
+ *    1.0.12rc1                2    10012  2.1.0.12rc1
+ *    1.0.12                   2    10012  2.1.0.12
+ *    1.1.0a-f                 -    10100  2.1.1.0a-f (branch abandoned)
+ *    1.2.0beta1-2             2    10200  2.1.2.0beta1-2
+ *    1.2.0beta3-5             3    10200  3.1.2.0beta3-5
+ *    1.2.0rc1                 3    10200  3.1.2.0rc1
+ *    1.2.0                    3    10200  3.1.2.0
+ *    1.2.1beta1-4             3    10201  3.1.2.1beta1-4
+ *    1.2.1rc1-2               3    10201  3.1.2.1rc1-2
+ *    1.2.1                    3    10201  3.1.2.1
+ *    1.2.2beta1-6            12    10202  12.so.0.1.2.2beta1-6
+ *    1.0.13beta1             10    10013  10.so.0.1.0.13beta1
+ *    1.0.13rc1               10    10013  10.so.0.1.0.13rc1
+ *    1.2.2rc1                12    10202  12.so.0.1.2.2rc1
+ *    1.0.13                  10    10013  10.so.0.1.0.13
+ *    1.2.2                   12    10202  12.so.0.1.2.2
+ *    1.2.3rc1-6              12    10203  12.so.0.1.2.3rc1-6
+ *    1.2.3                   12    10203  12.so.0.1.2.3
+ *    1.2.4beta1-3            13    10204  12.so.0.1.2.4beta1-3
+ *    1.0.14rc1               13    10014  10.so.0.1.0.14rc1
+ *    1.2.4rc1                13    10204  12.so.0.1.2.4rc1
+ *    1.0.14                  10    10014  10.so.0.1.0.14
+ *    1.2.4                   13    10204  12.so.0.1.2.4
+ *    1.2.5beta1-2            13    10205  12.so.0.1.2.5beta1-2
+ *    1.0.15rc1-3             10    10015  10.so.0.1.0.15rc1-3
+ *    1.2.5rc1-3              13    10205  12.so.0.1.2.5rc1-3
+ *    1.0.15                  10    10015  10.so.0.1.0.15
+ *    1.2.5                   13    10205  12.so.0.1.2.5
+ *    1.2.6beta1-4            13    10206  12.so.0.1.2.6beta1-4
+ *    1.0.16                  10    10016  10.so.0.1.0.16
+ *    1.2.6                   13    10206  12.so.0.1.2.6
+ *    1.2.7beta1-2            13    10207  12.so.0.1.2.7beta1-2
+ *    1.0.17rc1               10    10017  10.so.0.1.0.17rc1
+ *    1.2.7rc1                13    10207  12.so.0.1.2.7rc1
+ *    1.0.17                  10    10017  10.so.0.1.0.17
+ *    1.2.7                   13    10207  12.so.0.1.2.7
+ *    1.2.8beta1-5            13    10208  12.so.0.1.2.8beta1-5
+ *    1.0.18rc1-5             10    10018  10.so.0.1.0.18rc1-5
+ *    1.2.8rc1-5              13    10208  12.so.0.1.2.8rc1-5
+ *    1.0.18                  10    10018  10.so.0.1.0.18
+ *    1.2.8                   13    10208  12.so.0.1.2.8
+ *    1.2.9beta1-3            13    10209  12.so.0.1.2.9beta1-3
+ *    1.2.9beta4-11           13    10209  12.so.0.9[.0]
+ *    1.2.9rc1                13    10209  12.so.0.9[.0]
+ *    1.2.9                   13    10209  12.so.0.9[.0]
+ *    1.2.10beta1-8           13    10210  12.so.0.10[.0]
+ *    1.2.10rc1-3             13    10210  12.so.0.10[.0]
+ *    1.2.10                  13    10210  12.so.0.10[.0]
+ *    1.2.11beta1-4           13    10211  12.so.0.11[.0]
+ *    1.0.19rc1-5             10    10019  10.so.0.19[.0]
+ *    1.2.11rc1-5             13    10211  12.so.0.11[.0]
+ *    1.0.19                  10    10019  10.so.0.19[.0]
+ *    1.2.11                  13    10211  12.so.0.11[.0]
+ *    1.0.20                  10    10020  10.so.0.20[.0]
+ *    1.2.12                  13    10212  12.so.0.12[.0]
+ *    1.2.13beta1             13    10213  12.so.0.13[.0]
+ *    1.0.21                  10    10021  10.so.0.21[.0]
+ *    1.2.13                  13    10213  12.so.0.13[.0]
+ *    1.2.14beta1-2           13    10214  12.so.0.14[.0]
+ *    1.0.22rc1               10    10022  10.so.0.22[.0]
+ *    1.2.14rc1               13    10214  12.so.0.14[.0]
+ *    1.0.22                  10    10022  10.so.0.22[.0]
+ *    1.2.14                  13    10214  12.so.0.14[.0]
+ *    1.2.15beta1-6           13    10215  12.so.0.15[.0]
+ *    1.0.23rc1-5             10    10023  10.so.0.23[.0]
+ *    1.2.15rc1-5             13    10215  12.so.0.15[.0]
+ *    1.0.23                  10    10023  10.so.0.23[.0]
+ *    1.2.15                  13    10215  12.so.0.15[.0]
+ *    1.2.16beta1-2           13    10216  12.so.0.16[.0]
+ *    1.2.16rc1               13    10216  12.so.0.16[.0]
+ *    1.0.24                  10    10024  10.so.0.24[.0]
+ *    1.2.16                  13    10216  12.so.0.16[.0]
+ *    1.2.17beta1-2           13    10217  12.so.0.17[.0]
+ *    1.0.25rc1               10    10025  10.so.0.25[.0]
+ *    1.2.17rc1-3             13    10217  12.so.0.17[.0]
+ *    1.0.25                  10    10025  10.so.0.25[.0]
+ *    1.2.17                  13    10217  12.so.0.17[.0]
+ *    1.0.26                  10    10026  10.so.0.26[.0]
+ *    1.2.18                  13    10218  12.so.0.18[.0]
+ *    1.2.19beta1-31          13    10219  12.so.0.19[.0]
+ *    1.0.27rc1-6             10    10027  10.so.0.27[.0]
+ *    1.2.19rc1-6             13    10219  12.so.0.19[.0]
+ *    1.0.27                  10    10027  10.so.0.27[.0]
+ *    1.2.19                  13    10219  12.so.0.19[.0]
+ *    1.2.20beta01-04         13    10220  12.so.0.20[.0]
+ *    1.0.28rc1-6             10    10028  10.so.0.28[.0]
+ *    1.2.20rc1-6             13    10220  12.so.0.20[.0]
+ *    1.0.28                  10    10028  10.so.0.28[.0]
+ *    1.2.20                  13    10220  12.so.0.20[.0]
+ *    1.2.21beta1-2           13    10221  12.so.0.21[.0]
+ *    1.2.21rc1-3             13    10221  12.so.0.21[.0]
+ *    1.0.29                  10    10029  10.so.0.29[.0]
+ *    1.2.21                  13    10221  12.so.0.21[.0]
+ *    1.2.22beta1-4           13    10222  12.so.0.22[.0]
+ *    1.0.30rc1               10    10030  10.so.0.30[.0]
+ *    1.2.22rc1               13    10222  12.so.0.22[.0]
+ *    1.0.30                  10    10030  10.so.0.30[.0]
+ *    1.2.22                  13    10222  12.so.0.22[.0]
+ *    1.2.23beta01-05         13    10223  12.so.0.23[.0]
+ *    1.2.23rc01              13    10223  12.so.0.23[.0]
+ *    1.2.23                  13    10223  12.so.0.23[.0]
+ *    1.2.24beta01-02         13    10224  12.so.0.24[.0]
+ *    1.2.24rc01              13    10224  12.so.0.24[.0]
+ *    1.2.24                  13    10224  12.so.0.24[.0]
+ *    1.2.25beta01-06         13    10225  12.so.0.25[.0]
+ *    1.2.25rc01-02           13    10225  12.so.0.25[.0]
+ *    1.0.31                  10    10031  10.so.0.31[.0]
+ *    1.2.25                  13    10225  12.so.0.25[.0]
+ *    1.2.26beta01-06         13    10226  12.so.0.26[.0]
+ *    1.2.26rc01              13    10226  12.so.0.26[.0]
+ *    1.2.26                  13    10226  12.so.0.26[.0]
+ *    1.0.32                  10    10032  10.so.0.32[.0]
+ *    1.2.27beta01-06         13    10227  12.so.0.27[.0]
+ *    1.2.27rc01              13    10227  12.so.0.27[.0]
+ *    1.0.33                  10    10033  10.so.0.33[.0]
+ *    1.2.27                  13    10227  12.so.0.27[.0]
+ *    1.0.34                  10    10034  10.so.0.34[.0]
+ *    1.2.28                  13    10228  12.so.0.28[.0]
+ *    1.2.29beta01-03         13    10229  12.so.0.29[.0]
+ *    1.2.29rc01              13    10229  12.so.0.29[.0]
+ *    1.0.35                  10    10035  10.so.0.35[.0]
+ *    1.2.29                  13    10229  12.so.0.29[.0]
+ *    1.0.37                  10    10037  10.so.0.37[.0]
+ *    1.2.30beta01-04         13    10230  12.so.0.30[.0]
+ *    1.0.38rc01-08           10    10038  10.so.0.38[.0]
+ *    1.2.30rc01-08           13    10230  12.so.0.30[.0]
+ *    1.0.38                  10    10038  10.so.0.38[.0]
+ *    1.2.30                  13    10230  12.so.0.30[.0]
+ *    1.0.39rc01-03           10    10039  10.so.0.39[.0]
+ *    1.2.31rc01-03           13    10231  12.so.0.31[.0]
+ *    1.0.39                  10    10039  10.so.0.39[.0]
+ *    1.2.31                  13    10231  12.so.0.31[.0]
+ *    1.2.32beta01-02         13    10232  12.so.0.32[.0]
+ *    1.0.40rc01              10    10040  10.so.0.40[.0]
+ *    1.2.32rc01              13    10232  12.so.0.32[.0]
+ *    1.0.40                  10    10040  10.so.0.40[.0]
+ *    1.2.32                  13    10232  12.so.0.32[.0]
+ *    1.2.33beta01-02         13    10233  12.so.0.33[.0]
+ *    1.2.33rc01-02           13    10233  12.so.0.33[.0]
+ *    1.0.41rc01              10    10041  10.so.0.41[.0]
+ *    1.2.33                  13    10233  12.so.0.33[.0]
+ *    1.0.41                  10    10041  10.so.0.41[.0]
+ *    1.2.34beta01-07         13    10234  12.so.0.34[.0]
+ *    1.0.42rc01              10    10042  10.so.0.42[.0]
+ *    1.2.34rc01              13    10234  12.so.0.34[.0]
+ *    1.0.42                  10    10042  10.so.0.42[.0]
+ *    1.2.34                  13    10234  12.so.0.34[.0]
+ *    1.2.35beta01-03         13    10235  12.so.0.35[.0]
+ *    1.0.43rc01-02           10    10043  10.so.0.43[.0]
+ *    1.2.35rc01-02           13    10235  12.so.0.35[.0]
+ *    1.0.43                  10    10043  10.so.0.43[.0]
+ *    1.2.35                  13    10235  12.so.0.35[.0]
+ *    1.2.36beta01-05         13    10236  12.so.0.36[.0]
+ *    1.2.36rc01              13    10236  12.so.0.36[.0]
+ *    1.0.44                  10    10044  10.so.0.44[.0]
+ *    1.2.36                  13    10236  12.so.0.36[.0]
+ *    1.2.37beta01-03         13    10237  12.so.0.37[.0]
+ *    1.2.37rc01              13    10237  12.so.0.37[.0]
+ *    1.2.37                  13    10237  12.so.0.37[.0]
+ *    1.0.45                  10    10045  12.so.0.45[.0]
+ *    1.0.46                  10    10046  10.so.0.46[.0]
+ *    1.2.38beta01            13    10238  12.so.0.38[.0]
+ *    1.2.38rc01-03           13    10238  12.so.0.38[.0]
+ *    1.0.47                  10    10047  10.so.0.47[.0]
+ *    1.2.38                  13    10238  12.so.0.38[.0]
+ *    1.2.39beta01-05         13    10239  12.so.0.39[.0]
+ *    1.2.39rc01              13    10239  12.so.0.39[.0]
+ *    1.0.48                  10    10048  10.so.0.48[.0]
+ *    1.2.39                  13    10239  12.so.0.39[.0]
+ *    1.2.40beta01            13    10240  12.so.0.40[.0]
+ *    1.2.40rc01              13    10240  12.so.0.40[.0]
+ *    1.0.49                  10    10049  10.so.0.49[.0]
+ *    1.2.40                  13    10240  12.so.0.40[.0]
+ *    1.2.41beta01-18         13    10241  12.so.0.41[.0]
+ *    1.0.51rc01              10    10051  10.so.0.51[.0]
+ *    1.2.41rc01-03           13    10241  12.so.0.41[.0]
+ *    1.0.51                  10    10051  10.so.0.51[.0]
+ *    1.2.41                  13    10241  12.so.0.41[.0]
+ *    1.2.42beta01-02         13    10242  12.so.0.42[.0]
+ *    1.2.42rc01-05           13    10242  12.so.0.42[.0]
+ *    1.0.52                  10    10052  10.so.0.52[.0]
+ *    1.2.42                  13    10242  12.so.0.42[.0]
+ *    1.2.43beta01-05         13    10243  12.so.0.43[.0]
+ *    1.0.53rc01-02           10    10053  10.so.0.53[.0]
+ *    1.2.43rc01-02           13    10243  12.so.0.43[.0]
+ *    1.0.53                  10    10053  10.so.0.53[.0]
+ *    1.2.43                  13    10243  12.so.0.43[.0]
+ *    1.2.44beta01-03         13    10244  12.so.0.44[.0]
+ *    1.2.44rc01-03           13    10244  12.so.0.44[.0]
+ *    1.2.44                  13    10244  12.so.0.44[.0]
+ *    1.2.45beta01-03         13    10245  12.so.0.45[.0]
+ *    1.0.55rc01              10    10055  10.so.0.55[.0]
+ *    1.2.45rc01              13    10245  12.so.0.45[.0]
+ *    1.0.55                  10    10055  10.so.0.55[.0]
+ *    1.2.45                  13    10245  12.so.0.45[.0]
+ *    1.2.46rc01-02           13    10246  12.so.0.46[.0]
+ *    1.0.56                  10    10056  10.so.0.56[.0]
+ *    1.2.46                  13    10246  12.so.0.46[.0]
+ *    1.2.47beta01            13    10247  12.so.0.47[.0]
+ *    1.2.47rc01              13    10247  12.so.0.47[.0]
+ *    1.0.57rc01              10    10057  10.so.0.57[.0]
+ *    1.2.47                  13    10247  12.so.0.47[.0]
+ *    1.0.57                  10    10057  10.so.0.57[.0]
+ *    1.2.48beta01            13    10248  12.so.0.48[.0]
+ *    1.2.48rc01-02           13    10248  12.so.0.48[.0]
+ *    1.0.58                  10    10058  10.so.0.58[.0]
+ *    1.2.48                  13    10248  12.so.0.48[.0]
+ *    1.2.49rc01              13    10249  12.so.0.49[.0]
+ *    1.0.59                  10    10059  10.so.0.59[.0]
+ *    1.2.49                  13    10249  12.so.0.49[.0]
+ *    1.0.60                  10    10060  10.so.0.60[.0]
+ *    1.2.50                  13    10250  12.so.0.50[.0]
+ *
+ *    Henceforth the source version will match the shared-library major
+ *    and minor numbers; the shared-library major version number will be
+ *    used for changes in backward compatibility, as it is intended.  The
+ *    PNG_LIBPNG_VER macro, which is not used within libpng but is available
+ *    for applications, is an unsigned integer of the form xyyzz corresponding
+ *    to the source version x.y.z (leading zeros in y and z).  Beta versions
+ *    were given the previous public release number plus a letter, until
+ *    version 1.0.6j; from then on they were given the upcoming public
+ *    release number plus "betaNN" or "rcNN".
+ *
+ *    Binary incompatibility exists only when applications make direct access
+ *    to the info_ptr or png_ptr members through png.h, and the compiled
+ *    application is loaded with a different version of the library.
+ *
+ *    DLLNUM will change each time there are forward or backward changes
+ *    in binary compatibility (e.g., when a new feature is added).
+ *
+ * See libpng.txt or libpng.3 for more information.  The PNG specification
+ * is available as a W3C Recommendation and as an ISO Specification,
+ * <http://www.w3.org/TR/2003/REC-PNG-20031110/
+ */
+
+/*
+ * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
+ *
+ * If you modify libpng you may insert additional notices immediately following
+ * this sentence.
+ *
+ * This code is released under the libpng license.
+ *
+ * libpng versions 1.2.6, August 15, 2004, through 1.2.50, July 10, 2012, are
+ * Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
+ * distributed according to the same disclaimer and license as libpng-1.2.5
+ * with the following individual added to the list of Contributing Authors:
+ *
+ *    Cosmin Truta
+ *
+ * libpng versions 1.0.7, July 1, 2000, through 1.2.5, October 3, 2002, are
+ * Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
+ * distributed according to the same disclaimer and license as libpng-1.0.6
+ * with the following individuals added to the list of Contributing Authors:
+ *
+ *    Simon-Pierre Cadieux
+ *    Eric S. Raymond
+ *    Gilles Vollant
+ *
+ * and with the following additions to the disclaimer:
+ *
+ *    There is no warranty against interference with your enjoyment of the
+ *    library or against infringement.  There is no warranty that our
+ *    efforts or the library will fulfill any of your particular purposes
+ *    or needs.  This library is provided with all faults, and the entire
+ *    risk of satisfactory quality, performance, accuracy, and effort is with
+ *    the user.
+ *
+ * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
+ * Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson, and are
+ * distributed according to the same disclaimer and license as libpng-0.96,
+ * with the following individuals added to the list of Contributing Authors:
+ *
+ *    Tom Lane
+ *    Glenn Randers-Pehrson
+ *    Willem van Schaik
+ *
+ * libpng versions 0.89, June 1996, through 0.96, May 1997, are
+ * Copyright (c) 1996, 1997 Andreas Dilger
+ * Distributed according to the same disclaimer and license as libpng-0.88,
+ * with the following individuals added to the list of Contributing Authors:
+ *
+ *    John Bowler
+ *    Kevin Bracey
+ *    Sam Bushell
+ *    Magnus Holmgren
+ *    Greg Roelofs
+ *    Tom Tanner
+ *
+ * libpng versions 0.5, May 1995, through 0.88, January 1996, are
+ * Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
+ *
+ * For the purposes of this copyright and license, "Contributing Authors"
+ * is defined as the following set of individuals:
+ *
+ *    Andreas Dilger
+ *    Dave Martindale
+ *    Guy Eric Schalnat
+ *    Paul Schmidt
+ *    Tim Wegner
+ *
+ * The PNG Reference Library is supplied "AS IS".  The Contributing Authors
+ * and Group 42, Inc. disclaim all warranties, expressed or implied,
+ * including, without limitation, the warranties of merchantability and of
+ * fitness for any purpose.  The Contributing Authors and Group 42, Inc.
+ * assume no liability for direct, indirect, incidental, special, exemplary,
+ * or consequential damages, which may result from the use of the PNG
+ * Reference Library, even if advised of the possibility of such damage.
+ *
+ * Permission is hereby granted to use, copy, modify, and distribute this
+ * source code, or portions hereof, for any purpose, without fee, subject
+ * to the following restrictions:
+ *
+ * 1. The origin of this source code must not be misrepresented.
+ *
+ * 2. Altered versions must be plainly marked as such and
+ * must not be misrepresented as being the original source.
+ *
+ * 3. This Copyright notice may not be removed or altered from
+ *    any source or altered source distribution.
+ *
+ * The Contributing Authors and Group 42, Inc. specifically permit, without
+ * fee, and encourage the use of this source code as a component to
+ * supporting the PNG file format in commercial products.  If you use this
+ * source code in a product, acknowledgment is not required but would be
+ * appreciated.
+ */
+
+/*
+ * A "png_get_copyright" function is available, for convenient use in "about"
+ * boxes and the like:
+ *
+ * printf("%s",png_get_copyright(NULL));
+ *
+ * Also, the PNG logo (in PNG format, of course) is supplied in the
+ * files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
+ */
+
+/*
+ * Libpng is OSI Certified Open Source Software.  OSI Certified is a
+ * certification mark of the Open Source Initiative.
+ */
+
+/*
+ * The contributing authors would like to thank all those who helped
+ * with testing, bug fixes, and patience.  This wouldn't have been
+ * possible without all of you.
+ *
+ * Thanks to Frank J. T. Wojcik for helping with the documentation.
+ */
+
+/*
+ * Y2K compliance in libpng:
+ * =========================
+ *
+ *    July 10, 2012
+ *
+ *    Since the PNG Development group is an ad-hoc body, we can't make
+ *    an official declaration.
+ *
+ *    This is your unofficial assurance that libpng from version 0.71 and
+ *    upward through 1.2.50 are Y2K compliant.  It is my belief that earlier
+ *    versions were also Y2K compliant.
+ *
+ *    Libpng only has three year fields.  One is a 2-byte unsigned integer
+ *    that will hold years up to 65535.  The other two hold the date in text
+ *    format, and will hold years up to 9999.
+ *
+ *    The integer is
+ *        "png_uint_16 year" in png_time_struct.
+ *
+ *    The strings are
+ *        "png_charp time_buffer" in png_struct and
+ *        "near_time_buffer", which is a local character string in png.c.
+ *
+ *    There are seven time-related functions:
+ *        png.c: png_convert_to_rfc_1123() in png.c
+ *          (formerly png_convert_to_rfc_1152() in error)
+ *        png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c
+ *        png_convert_from_time_t() in pngwrite.c
+ *        png_get_tIME() in pngget.c
+ *        png_handle_tIME() in pngrutil.c, called in pngread.c
+ *        png_set_tIME() in pngset.c
+ *        png_write_tIME() in pngwutil.c, called in pngwrite.c
+ *
+ *    All handle dates properly in a Y2K environment.  The
+ *    png_convert_from_time_t() function calls gmtime() to convert from system
+ *    clock time, which returns (year - 1900), which we properly convert to
+ *    the full 4-digit year.  There is a possibility that applications using
+ *    libpng are not passing 4-digit years into the png_convert_to_rfc_1123()
+ *    function, or that they are incorrectly passing only a 2-digit year
+ *    instead of "year - 1900" into the png_convert_from_struct_tm() function,
+ *    but this is not under our control.  The libpng documentation has always
+ *    stated that it works with 4-digit years, and the APIs have been
+ *    documented as such.
+ *
+ *    The tIME chunk itself is also Y2K compliant.  It uses a 2-byte unsigned
+ *    integer to hold the year, and can hold years as large as 65535.
+ *
+ *    zlib, upon which libpng depends, is also Y2K compliant.  It contains
+ *    no date-related code.
+ *
+ *       Glenn Randers-Pehrson
+ *       libpng maintainer
+ *       PNG Development Group
+ */
+
+#ifndef PNG_H
+#define PNG_H
+
+/* This is not the place to learn how to use libpng.  The file libpng.txt
+ * describes how to use libpng, and the file example.c summarizes it
+ * with some code on which to build.  This file is useful for looking
+ * at the actual function definitions and structure components.
+ */
+
+/* Version information for png.h - this should match the version in png.c */
+#define PNG_LIBPNG_VER_STRING "1.2.50"
+#define PNG_HEADER_VERSION_STRING \
+   " libpng version 1.2.50 - July 10, 2012\n"
+
+#define PNG_LIBPNG_VER_SONUM   0
+#define PNG_LIBPNG_VER_DLLNUM  13
+
+/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
+#define PNG_LIBPNG_VER_MAJOR   1
+#define PNG_LIBPNG_VER_MINOR   2
+#define PNG_LIBPNG_VER_RELEASE 50
+/* This should match the numeric part of the final component of
+ * PNG_LIBPNG_VER_STRING, omitting any leading zero:
+ */
+
+#define PNG_LIBPNG_VER_BUILD  0
+
+/* Release Status */
+#define PNG_LIBPNG_BUILD_ALPHA    1
+#define PNG_LIBPNG_BUILD_BETA     2
+#define PNG_LIBPNG_BUILD_RC       3
+#define PNG_LIBPNG_BUILD_STABLE   4
+#define PNG_LIBPNG_BUILD_RELEASE_STATUS_MASK 7
+
+/* Release-Specific Flags */
+#define PNG_LIBPNG_BUILD_PATCH    8 /* Can be OR'ed with
+                                       PNG_LIBPNG_BUILD_STABLE only */
+#define PNG_LIBPNG_BUILD_PRIVATE 16 /* Cannot be OR'ed with
+                                       PNG_LIBPNG_BUILD_SPECIAL */
+#define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with
+                                       PNG_LIBPNG_BUILD_PRIVATE */
+
+#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE
+
+/* Careful here.  At one time, Guy wanted to use 082, but that would be octal.
+ * We must not include leading zeros.
+ * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
+ * version 1.0.0 was mis-numbered 100 instead of 10000).  From
+ * version 1.0.1 it's    xxyyzz, where x=major, y=minor, z=release
+ */
+#define PNG_LIBPNG_VER 10250 /* 1.2.50 */
+
+#ifndef PNG_VERSION_INFO_ONLY
+/* Include the compression library's header */
+#include "zlib.h"
+#endif
+
+/* Include all user configurable info, including optional assembler routines */
+#include "pngconf.h"
+
+/*
+ * Added at libpng-1.2.8 */
+/* Ref MSDN: Private as priority over Special
+ * VS_FF_PRIVATEBUILD File *was not* built using standard release
+ * procedures. If this value is given, the StringFileInfo block must
+ * contain a PrivateBuild string.
+ *
+ * VS_FF_SPECIALBUILD File *was* built by the original company using
+ * standard release procedures but is a variation of the standard
+ * file of the same version number. If this value is given, the
+ * StringFileInfo block must contain a SpecialBuild string.
+ */
+
+#ifdef PNG_USER_PRIVATEBUILD
+#  define PNG_LIBPNG_BUILD_TYPE \
+          (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_PRIVATE)
+#else
+#  ifdef PNG_LIBPNG_SPECIALBUILD
+#    define PNG_LIBPNG_BUILD_TYPE \
+            (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_SPECIAL)
+#  else
+#    define PNG_LIBPNG_BUILD_TYPE (PNG_LIBPNG_BUILD_BASE_TYPE)
+#  endif
+#endif
+
+#ifndef PNG_VERSION_INFO_ONLY
+
+/* Inhibit C++ name-mangling for libpng functions but not for system calls. */
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/* This file is arranged in several sections.  The first section contains
+ * structure and type definitions.  The second section contains the external
+ * library functions, while the third has the internal library functions,
+ * which applications aren't expected to use directly.
+ */
+
+#ifndef PNG_NO_TYPECAST_NULL
+#define int_p_NULL                (int *)NULL
+#define png_bytep_NULL            (png_bytep)NULL
+#define png_bytepp_NULL           (png_bytepp)NULL
+#define png_doublep_NULL          (png_doublep)NULL
+#define png_error_ptr_NULL        (png_error_ptr)NULL
+#define png_flush_ptr_NULL        (png_flush_ptr)NULL
+#define png_free_ptr_NULL         (png_free_ptr)NULL
+#define png_infopp_NULL           (png_infopp)NULL
+#define png_malloc_ptr_NULL       (png_malloc_ptr)NULL
+#define png_read_status_ptr_NULL  (png_read_status_ptr)NULL
+#define png_rw_ptr_NULL           (png_rw_ptr)NULL
+#define png_structp_NULL          (png_structp)NULL
+#define png_uint_16p_NULL         (png_uint_16p)NULL
+#define png_voidp_NULL            (png_voidp)NULL
+#define png_write_status_ptr_NULL (png_write_status_ptr)NULL
+#else
+#define int_p_NULL                NULL
+#define png_bytep_NULL            NULL
+#define png_bytepp_NULL           NULL
+#define png_doublep_NULL          NULL
+#define png_error_ptr_NULL        NULL
+#define png_flush_ptr_NULL        NULL
+#define png_free_ptr_NULL         NULL
+#define png_infopp_NULL           NULL
+#define png_malloc_ptr_NULL       NULL
+#define png_read_status_ptr_NULL  NULL
+#define png_rw_ptr_NULL           NULL
+#define png_structp_NULL          NULL
+#define png_uint_16p_NULL         NULL
+#define png_voidp_NULL            NULL
+#define png_write_status_ptr_NULL NULL
+#endif
+
+/* Variables declared in png.c - only it needs to define PNG_NO_EXTERN */
+#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
+/* Version information for C files, stored in png.c.  This had better match
+ * the version above.
+ */
+#ifdef PNG_USE_GLOBAL_ARRAYS
+PNG_EXPORT_VAR (PNG_CONST char) png_libpng_ver[18];
+  /* Need room for 99.99.99beta99z */
+#else
+#define png_libpng_ver png_get_header_ver(NULL)
+#endif
+
+#ifdef PNG_USE_GLOBAL_ARRAYS
+/* This was removed in version 1.0.5c */
+/* Structures to facilitate easy interlacing.  See png.c for more details */
+PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_start[7];
+PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_inc[7];
+PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_ystart[7];
+PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_yinc[7];
+PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_mask[7];
+PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_dsp_mask[7];
+/* This isn't currently used.  If you need it, see png.c for more details.
+PNG_EXPORT_VAR (PNG_CONST int FARDATA) png_pass_height[7];
+*/
+#endif
+
+#endif /* PNG_NO_EXTERN */
+
+/* Three color definitions.  The order of the red, green, and blue, (and the
+ * exact size) is not important, although the size of the fields need to
+ * be png_byte or png_uint_16 (as defined below).
+ */
+typedef struct png_color_struct
+{
+   png_byte red;
+   png_byte green;
+   png_byte blue;
+} png_color;
+typedef png_color FAR * png_colorp;
+typedef png_color FAR * FAR * png_colorpp;
+
+typedef struct png_color_16_struct
+{
+   png_byte index;    /* used for palette files */
+   png_uint_16 red;   /* for use in red green blue files */
+   png_uint_16 green;
+   png_uint_16 blue;
+   png_uint_16 gray;  /* for use in grayscale files */
+} png_color_16;
+typedef png_color_16 FAR * png_color_16p;
+typedef png_color_16 FAR * FAR * png_color_16pp;
+
+typedef struct png_color_8_struct
+{
+   png_byte red;   /* for use in red green blue files */
+   png_byte green;
+   png_byte blue;
+   png_byte gray;  /* for use in grayscale files */
+   png_byte alpha; /* for alpha channel files */
+} png_color_8;
+typedef png_color_8 FAR * png_color_8p;
+typedef png_color_8 FAR * FAR * png_color_8pp;
+
+/*
+ * The following two structures are used for the in-core representation
+ * of sPLT chunks.
+ */
+typedef struct png_sPLT_entry_struct
+{
+   png_uint_16 red;
+   png_uint_16 green;
+   png_uint_16 blue;
+   png_uint_16 alpha;
+   png_uint_16 frequency;
+} png_sPLT_entry;
+typedef png_sPLT_entry FAR * png_sPLT_entryp;
+typedef png_sPLT_entry FAR * FAR * png_sPLT_entrypp;
+
+/*  When the depth of the sPLT palette is 8 bits, the color and alpha samples
+ *  occupy the LSB of their respective members, and the MSB of each member
+ *  is zero-filled.  The frequency member always occupies the full 16 bits.
+ */
+
+typedef struct png_sPLT_struct
+{
+   png_charp name;           /* palette name */
+   png_byte depth;           /* depth of palette samples */
+   png_sPLT_entryp entries;  /* palette entries */
+   png_int_32 nentries;      /* number of palette entries */
+} png_sPLT_t;
+typedef png_sPLT_t FAR * png_sPLT_tp;
+typedef png_sPLT_t FAR * FAR * png_sPLT_tpp;
+
+#ifdef PNG_TEXT_SUPPORTED
+/* png_text holds the contents of a text/ztxt/itxt chunk in a PNG file,
+ * and whether that contents is compressed or not.  The "key" field
+ * points to a regular zero-terminated C string.  The "text", "lang", and
+ * "lang_key" fields can be regular C strings, empty strings, or NULL pointers.
+ * However, the * structure returned by png_get_text() will always contain
+ * regular zero-terminated C strings (possibly empty), never NULL pointers,
+ * so they can be safely used in printf() and other string-handling functions.
+ */
+typedef struct png_text_struct
+{
+   int  compression;       /* compression value:
+                             -1: tEXt, none
+                              0: zTXt, deflate
+                              1: iTXt, none
+                              2: iTXt, deflate  */
+   png_charp key;          /* keyword, 1-79 character description of "text" */
+   png_charp text;         /* comment, may be an empty string (ie "")
+                              or a NULL pointer */
+   png_size_t text_length; /* length of the text string */
+#ifdef PNG_iTXt_SUPPORTED
+   png_size_t itxt_length; /* length of the itxt string */
+   png_charp lang;         /* language code, 0-79 characters
+                              or a NULL pointer */
+   png_charp lang_key;     /* keyword translated UTF-8 string, 0 or more
+                              chars or a NULL pointer */
+#endif
+} png_text;
+typedef png_text FAR * png_textp;
+typedef png_text FAR * FAR * png_textpp;
+#endif
+
+/* Supported compression types for text in PNG files (tEXt, and zTXt).
+ * The values of the PNG_TEXT_COMPRESSION_ defines should NOT be changed.
+ */
+#define PNG_TEXT_COMPRESSION_NONE_WR -3
+#define PNG_TEXT_COMPRESSION_zTXt_WR -2
+#define PNG_TEXT_COMPRESSION_NONE    -1
+#define PNG_TEXT_COMPRESSION_zTXt     0
+#define PNG_ITXT_COMPRESSION_NONE     1
+#define PNG_ITXT_COMPRESSION_zTXt     2
+#define PNG_TEXT_COMPRESSION_LAST     3  /* Not a valid value */
+
+/* png_time is a way to hold the time in an machine independent way.
+ * Two conversions are provided, both from time_t and struct tm.  There
+ * is no portable way to convert to either of these structures, as far
+ * as I know.  If you know of a portable way, send it to me.  As a side
+ * note - PNG has always been Year 2000 compliant!
+ */
+typedef struct png_time_struct
+{
+   png_uint_16 year; /* full year, as in, 1995 */
+   png_byte month;   /* month of year, 1 - 12 */
+   png_byte day;     /* day of month, 1 - 31 */
+   png_byte hour;    /* hour of day, 0 - 23 */
+   png_byte minute;  /* minute of hour, 0 - 59 */
+   png_byte second;  /* second of minute, 0 - 60 (for leap seconds) */
+} png_time;
+typedef png_time FAR * png_timep;
+typedef png_time FAR * FAR * png_timepp;
+
+#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) || \
+ defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
+/* png_unknown_chunk is a structure to hold queued chunks for which there is
+ * no specific support.  The idea is that we can use this to queue
+ * up private chunks for output even though the library doesn't actually
+ * know about their semantics.
+ */
+#define PNG_CHUNK_NAME_LENGTH 5
+typedef struct png_unknown_chunk_t
+{
+    png_byte name[PNG_CHUNK_NAME_LENGTH];
+    png_byte *data;
+    png_size_t size;
+
+    /* libpng-using applications should NOT directly modify this byte. */
+    png_byte location; /* mode of operation at read time */
+}
+png_unknown_chunk;
+typedef png_unknown_chunk FAR * png_unknown_chunkp;
+typedef png_unknown_chunk FAR * FAR * png_unknown_chunkpp;
+#endif
+
+/* png_info is a structure that holds the information in a PNG file so
+ * that the application can find out the characteristics of the image.
+ * If you are reading the file, this structure will tell you what is
+ * in the PNG file.  If you are writing the file, fill in the information
+ * you want to put into the PNG file, then call png_write_info().
+ * The names chosen should be very close to the PNG specification, so
+ * consult that document for information about the meaning of each field.
+ *
+ * With libpng < 0.95, it was only possible to directly set and read the
+ * the values in the png_info_struct, which meant that the contents and
+ * order of the values had to remain fixed.  With libpng 0.95 and later,
+ * however, there are now functions that abstract the contents of
+ * png_info_struct from the application, so this makes it easier to use
+ * libpng with dynamic libraries, and even makes it possible to use
+ * libraries that don't have all of the libpng ancillary chunk-handing
+ * functionality.
+ *
+ * In any case, the order of the parameters in png_info_struct should NOT
+ * be changed for as long as possible to keep compatibility with applications
+ * that use the old direct-access method with png_info_struct.
+ *
+ * The following members may have allocated storage attached that should be
+ * cleaned up before the structure is discarded: palette, trans, text,
+ * pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile,
+ * splt_palettes, scal_unit, row_pointers, and unknowns.   By default, these
+ * are automatically freed when the info structure is deallocated, if they were
+ * allocated internally by libpng.  This behavior can be changed by means
+ * of the png_data_freer() function.
+ *
+ * More allocation details: all the chunk-reading functions that
+ * change these members go through the corresponding png_set_*
+ * functions.  A function to clear these members is available: see
+ * png_free_data().  The png_set_* functions do not depend on being
+ * able to point info structure members to any of the storage they are
+ * passed (they make their own copies), EXCEPT that the png_set_text
+ * functions use the same storage passed to them in the text_ptr or
+ * itxt_ptr structure argument, and the png_set_rows and png_set_unknowns
+ * functions do not make their own copies.
+ */
+typedef struct png_info_struct
+{
+   /* The following are necessary for every PNG file */
+   png_uint_32 width PNG_DEPSTRUCT;       /* width of image in pixels (from IHDR) */
+   png_uint_32 height PNG_DEPSTRUCT;      /* height of image in pixels (from IHDR) */
+   png_uint_32 valid PNG_DEPSTRUCT;       /* valid chunk data (see PNG_INFO_ below) */
+   png_uint_32 rowbytes PNG_DEPSTRUCT;    /* bytes needed to hold an untransformed row */
+   png_colorp palette PNG_DEPSTRUCT;      /* array of color values (valid & PNG_INFO_PLTE) */
+   png_uint_16 num_palette PNG_DEPSTRUCT; /* number of color entries in "palette" (PLTE) */
+   png_uint_16 num_trans PNG_DEPSTRUCT;   /* number of transparent palette color (tRNS) */
+   png_byte bit_depth PNG_DEPSTRUCT;      /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */
+   png_byte color_type PNG_DEPSTRUCT;     /* see PNG_COLOR_TYPE_ below (from IHDR) */
+   /* The following three should have been named *_method not *_type */
+   png_byte compression_type PNG_DEPSTRUCT; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */
+   png_byte filter_type PNG_DEPSTRUCT;    /* must be PNG_FILTER_TYPE_BASE (from IHDR) */
+   png_byte interlace_type PNG_DEPSTRUCT; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
+
+   /* The following is informational only on read, and not used on writes. */
+   png_byte channels PNG_DEPSTRUCT;       /* number of data channels per pixel (1, 2, 3, 4) */
+   png_byte pixel_depth PNG_DEPSTRUCT;    /* number of bits per pixel */
+   png_byte spare_byte PNG_DEPSTRUCT;     /* to align the data, and for future use */
+   png_byte signature[8] PNG_DEPSTRUCT;   /* magic bytes read by libpng from start of file */
+
+   /* The rest of the data is optional.  If you are reading, check the
+    * valid field to see if the information in these are valid.  If you
+    * are writing, set the valid field to those chunks you want written,
+    * and initialize the appropriate fields below.
+    */
+
+#if defined(PNG_gAMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED)
+   /* The gAMA chunk describes the gamma characteristics of the system
+    * on which the image was created, normally in the range [1.0, 2.5].
+    * Data is valid if (valid & PNG_INFO_gAMA) is non-zero.
+    */
+   float gamma PNG_DEPSTRUCT; /* gamma value of image, if (valid & PNG_INFO_gAMA) */
+#endif
+
+#ifdef PNG_sRGB_SUPPORTED
+    /* GR-P, 0.96a */
+    /* Data valid if (valid & PNG_INFO_sRGB) non-zero. */
+   png_byte srgb_intent PNG_DEPSTRUCT; /* sRGB rendering intent [0, 1, 2, or 3] */
+#endif
+
+#ifdef PNG_TEXT_SUPPORTED
+   /* The tEXt, and zTXt chunks contain human-readable textual data in
+    * uncompressed, compressed, and optionally compressed forms, respectively.
+    * The data in "text" is an array of pointers to uncompressed,
+    * null-terminated C strings. Each chunk has a keyword that describes the
+    * textual data contained in that chunk.  Keywords are not required to be
+    * unique, and the text string may be empty.  Any number of text chunks may
+    * be in an image.
+    */
+   int num_text PNG_DEPSTRUCT; /* number of comments read/to write */
+   int max_text PNG_DEPSTRUCT; /* current size of text array */
+   png_textp text PNG_DEPSTRUCT; /* array of comments read/to write */
+#endif /* PNG_TEXT_SUPPORTED */
+
+#ifdef PNG_tIME_SUPPORTED
+   /* The tIME chunk holds the last time the displayed image data was
+    * modified.  See the png_time struct for the contents of this struct.
+    */
+   png_time mod_time PNG_DEPSTRUCT;
+#endif
+
+#ifdef PNG_sBIT_SUPPORTED
+   /* The sBIT chunk specifies the number of significant high-order bits
+    * in the pixel data.  Values are in the range [1, bit_depth], and are
+    * only specified for the channels in the pixel data.  The contents of
+    * the low-order bits is not specified.  Data is valid if
+    * (valid & PNG_INFO_sBIT) is non-zero.
+    */
+   png_color_8 sig_bit PNG_DEPSTRUCT; /* significant bits in color channels */
+#endif
+
+#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_EXPAND_SUPPORTED) || \
+defined(PNG_READ_BACKGROUND_SUPPORTED)
+   /* The tRNS chunk supplies transparency data for paletted images and
+    * other image types that don't need a full alpha channel.  There are
+    * "num_trans" transparency values for a paletted image, stored in the
+    * same order as the palette colors, starting from index 0.  Values
+    * for the data are in the range [0, 255], ranging from fully transparent
+    * to fully opaque, respectively.  For non-paletted images, there is a
+    * single color specified that should be treated as fully transparent.
+    * Data is valid if (valid & PNG_INFO_tRNS) is non-zero.
+    */
+   png_bytep trans PNG_DEPSTRUCT; /* transparent values for paletted image */
+   png_color_16 trans_values PNG_DEPSTRUCT; /* transparent color for non-palette image */
+#endif
+
+#if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
+   /* The bKGD chunk gives the suggested image background color if the
+    * display program does not have its own background color and the image
+    * is needs to composited onto a background before display.  The colors
+    * in "background" are normally in the same color space/depth as the
+    * pixel data.  Data is valid if (valid & PNG_INFO_bKGD) is non-zero.
+    */
+   png_color_16 background PNG_DEPSTRUCT;
+#endif
+
+#ifdef PNG_oFFs_SUPPORTED
+   /* The oFFs chunk gives the offset in "offset_unit_type" units rightwards
+    * and downwards from the top-left corner of the display, page, or other
+    * application-specific co-ordinate space.  See the PNG_OFFSET_ defines
+    * below for the unit types.  Valid if (valid & PNG_INFO_oFFs) non-zero.
+    */
+   png_int_32 x_offset PNG_DEPSTRUCT; /* x offset on page */
+   png_int_32 y_offset PNG_DEPSTRUCT; /* y offset on page */
+   png_byte offset_unit_type PNG_DEPSTRUCT; /* offset units type */
+#endif
+
+#ifdef PNG_pHYs_SUPPORTED
+   /* The pHYs chunk gives the physical pixel density of the image for
+    * display or printing in "phys_unit_type" units (see PNG_RESOLUTION_
+    * defines below).  Data is valid if (valid & PNG_INFO_pHYs) is non-zero.
+    */
+   png_uint_32 x_pixels_per_unit PNG_DEPSTRUCT; /* horizontal pixel density */
+   png_uint_32 y_pixels_per_unit PNG_DEPSTRUCT; /* vertical pixel density */
+   png_byte phys_unit_type PNG_DEPSTRUCT; /* resolution type (see PNG_RESOLUTION_ below) */
+#endif
+
+#ifdef PNG_hIST_SUPPORTED
+   /* The hIST chunk contains the relative frequency or importance of the
+    * various palette entries, so that a viewer can intelligently select a
+    * reduced-color palette, if required.  Data is an array of "num_palette"
+    * values in the range [0,65535]. Data valid if (valid & PNG_INFO_hIST)
+    * is non-zero.
+    */
+   png_uint_16p hist PNG_DEPSTRUCT;
+#endif
+
+#ifdef PNG_cHRM_SUPPORTED
+   /* The cHRM chunk describes the CIE color characteristics of the monitor
+    * on which the PNG was created.  This data allows the viewer to do gamut
+    * mapping of the input image to ensure that the viewer sees the same
+    * colors in the image as the creator.  Values are in the range
+    * [0.0, 0.8].  Data valid if (valid & PNG_INFO_cHRM) non-zero.
+    */
+#ifdef PNG_FLOATING_POINT_SUPPORTED
+   float x_white PNG_DEPSTRUCT;
+   float y_white PNG_DEPSTRUCT;
+   float x_red PNG_DEPSTRUCT;
+   float y_red PNG_DEPSTRUCT;
+   float x_green PNG_DEPSTRUCT;
+   float y_green PNG_DEPSTRUCT;
+   float x_blue PNG_DEPSTRUCT;
+   float y_blue PNG_DEPSTRUCT;
+#endif
+#endif
+
+#ifdef PNG_pCAL_SUPPORTED
+   /* The pCAL chunk describes a transformation between the stored pixel
+    * values and original physical data values used to create the image.
+    * The integer range [0, 2^bit_depth - 1] maps to the floating-point
+    * range given by [pcal_X0, pcal_X1], and are further transformed by a
+    * (possibly non-linear) transformation function given by "pcal_type"
+    * and "pcal_params" into "pcal_units".  Please see the PNG_EQUATION_
+    * defines below, and the PNG-Group's PNG extensions document for a
+    * complete description of the transformations and how they should be
+    * implemented, and for a description of the ASCII parameter strings.
+    * Data values are valid if (valid & PNG_INFO_pCAL) non-zero.
+    */
+   png_charp pcal_purpose PNG_DEPSTRUCT;  /* pCAL chunk description string */
+   png_int_32 pcal_X0 PNG_DEPSTRUCT;      /* minimum value */
+   png_int_32 pcal_X1 PNG_DEPSTRUCT;      /* maximum value */
+   png_charp pcal_units PNG_DEPSTRUCT;    /* Latin-1 string giving physical units */
+   png_charpp pcal_params PNG_DEPSTRUCT;  /* ASCII strings containing parameter values */
+   png_byte pcal_type PNG_DEPSTRUCT;      /* equation type (see PNG_EQUATION_ below) */
+   png_byte pcal_nparams PNG_DEPSTRUCT;   /* number of parameters given in pcal_params */
+#endif
+
+/* New members added in libpng-1.0.6 */
+#ifdef PNG_FREE_ME_SUPPORTED
+   png_uint_32 free_me PNG_DEPSTRUCT;     /* flags items libpng is responsible for freeing */
+#endif
+
+#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) || \
+ defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
+   /* Storage for unknown chunks that the library doesn't recognize. */
+   png_unknown_chunkp unknown_chunks PNG_DEPSTRUCT;
+   png_size_t unknown_chunks_num PNG_DEPSTRUCT;
+#endif
+
+#ifdef PNG_iCCP_SUPPORTED
+   /* iCCP chunk data. */
+   png_charp iccp_name PNG_DEPSTRUCT;     /* profile name */
+   png_charp iccp_profile PNG_DEPSTRUCT;  /* International Color Consortium profile data */
+                            /* Note to maintainer: should be png_bytep */
+   png_uint_32 iccp_proflen PNG_DEPSTRUCT;  /* ICC profile data length */
+   png_byte iccp_compression PNG_DEPSTRUCT; /* Always zero */
+#endif
+
+#ifdef PNG_sPLT_SUPPORTED
+   /* Data on sPLT chunks (there may be more than one). */
+   png_sPLT_tp splt_palettes PNG_DEPSTRUCT;
+   png_uint_32 splt_palettes_num PNG_DEPSTRUCT;
+#endif
+
+#ifdef PNG_sCAL_SUPPORTED
+   /* The sCAL chunk describes the actual physical dimensions of the
+    * subject matter of the graphic.  The chunk contains a unit specification
+    * a byte value, and two ASCII strings representing floating-point
+    * values.  The values are width and height corresponsing to one pixel
+    * in the image.  This external representation is converted to double
+    * here.  Data values are valid if (valid & PNG_INFO_sCAL) is non-zero.
+    */
+   png_byte scal_unit PNG_DEPSTRUCT;         /* unit of physical scale */
+#ifdef PNG_FLOATING_POINT_SUPPORTED
+   double scal_pixel_width PNG_DEPSTRUCT;    /* width of one pixel */
+   double scal_pixel_height PNG_DEPSTRUCT;   /* height of one pixel */
+#endif
+#ifdef PNG_FIXED_POINT_SUPPORTED
+   png_charp scal_s_width PNG_DEPSTRUCT;     /* string containing height */
+   png_charp scal_s_height PNG_DEPSTRUCT;    /* string containing width */
+#endif
+#endif
+
+#ifdef PNG_INFO_IMAGE_SUPPORTED
+   /* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS) non-zero */
+   /* Data valid if (valid & PNG_INFO_IDAT) non-zero */
+   png_bytepp row_pointers PNG_DEPSTRUCT;        /* the image bits */
+#endif
+
+#if defined(PNG_FIXED_POINT_SUPPORTED) && defined(PNG_gAMA_SUPPORTED)
+   png_fixed_point int_gamma PNG_DEPSTRUCT; /* gamma of image, if (valid & PNG_INFO_gAMA) */
+#endif
+
+#if defined(PNG_cHRM_SUPPORTED) && defined(PNG_FIXED_POINT_SUPPORTED)
+   png_fixed_point int_x_white PNG_DEPSTRUCT;
+   png_fixed_point int_y_white PNG_DEPSTRUCT;
+   png_fixed_point int_x_red PNG_DEPSTRUCT;
+   png_fixed_point int_y_red PNG_DEPSTRUCT;
+   png_fixed_point int_x_green PNG_DEPSTRUCT;
+   png_fixed_point int_y_green PNG_DEPSTRUCT;
+   png_fixed_point int_x_blue PNG_DEPSTRUCT;
+   png_fixed_point int_y_blue PNG_DEPSTRUCT;
+#endif
+
+} png_info;
+
+typedef png_info FAR * png_infop;
+typedef png_info FAR * FAR * png_infopp;
+
+/* Maximum positive integer used in PNG is (2^31)-1 */
+#define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL)
+#define PNG_UINT_32_MAX ((png_uint_32)(-1))
+#define PNG_SIZE_MAX ((png_size_t)(-1))
+#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
+/* PNG_MAX_UINT is deprecated; use PNG_UINT_31_MAX instead. */
+#define PNG_MAX_UINT PNG_UINT_31_MAX
+#endif
+
+/* These describe the color_type field in png_info. */
+/* color type masks */
+#define PNG_COLOR_MASK_PALETTE    1
+#define PNG_COLOR_MASK_COLOR      2
+#define PNG_COLOR_MASK_ALPHA      4
+
+/* color types.  Note that not all combinations are legal */
+#define PNG_COLOR_TYPE_GRAY 0
+#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
+#define PNG_COLOR_TYPE_RGB        (PNG_COLOR_MASK_COLOR)
+#define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
+#define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA)
+/* aliases */
+#define PNG_COLOR_TYPE_RGBA  PNG_COLOR_TYPE_RGB_ALPHA
+#define PNG_COLOR_TYPE_GA  PNG_COLOR_TYPE_GRAY_ALPHA
+
+/* This is for compression type. PNG 1.0-1.2 only define the single type. */
+#define PNG_COMPRESSION_TYPE_BASE 0 /* Deflate method 8, 32K window */
+#define PNG_COMPRESSION_TYPE_DEFAULT PNG_COMPRESSION_TYPE_BASE
+
+/* This is for filter type. PNG 1.0-1.2 only define the single type. */
+#define PNG_FILTER_TYPE_BASE      0 /* Single row per-byte filtering */
+#define PNG_INTRAPIXEL_DIFFERENCING 64 /* Used only in MNG datastreams */
+#define PNG_FILTER_TYPE_DEFAULT   PNG_FILTER_TYPE_BASE
+
+/* These are for the interlacing type.  These values should NOT be changed. */
+#define PNG_INTERLACE_NONE        0 /* Non-interlaced image */
+#define PNG_INTERLACE_ADAM7       1 /* Adam7 interlacing */
+#define PNG_INTERLACE_LAST        2 /* Not a valid value */
+
+/* These are for the oFFs chunk.  These values should NOT be changed. */
+#define PNG_OFFSET_PIXEL          0 /* Offset in pixels */
+#define PNG_OFFSET_MICROMETER     1 /* Offset in micrometers (1/10^6 meter) */
+#define PNG_OFFSET_LAST           2 /* Not a valid value */
+
+/* These are for the pCAL chunk.  These values should NOT be changed. */
+#define PNG_EQUATION_LINEAR       0 /* Linear transformation */
+#define PNG_EQUATION_BASE_E       1 /* Exponential base e transform */
+#define PNG_EQUATION_ARBITRARY    2 /* Arbitrary base exponential transform */
+#define PNG_EQUATION_HYPERBOLIC   3 /* Hyperbolic sine transformation */
+#define PNG_EQUATION_LAST         4 /* Not a valid value */
+
+/* These are for the sCAL chunk.  These values should NOT be changed. */
+#define PNG_SCALE_UNKNOWN         0 /* unknown unit (image scale) */
+#define PNG_SCALE_METER           1 /* meters per pixel */
+#define PNG_SCALE_RADIAN          2 /* radians per pixel */
+#define PNG_SCALE_LAST            3 /* Not a valid value */
+
+/* These are for the pHYs chunk.  These values should NOT be changed. */
+#define PNG_RESOLUTION_UNKNOWN    0 /* pixels/unknown unit (aspect ratio) */
+#define PNG_RESOLUTION_METER      1 /* pixels/meter */
+#define PNG_RESOLUTION_LAST       2 /* Not a valid value */
+
+/* These are for the sRGB chunk.  These values should NOT be changed. */
+#define PNG_sRGB_INTENT_PERCEPTUAL 0
+#define PNG_sRGB_INTENT_RELATIVE   1
+#define PNG_sRGB_INTENT_SATURATION 2
+#define PNG_sRGB_INTENT_ABSOLUTE   3
+#define PNG_sRGB_INTENT_LAST       4 /* Not a valid value */
+
+/* This is for text chunks */
+#define PNG_KEYWORD_MAX_LENGTH     79
+
+/* Maximum number of entries in PLTE/sPLT/tRNS arrays */
+#define PNG_MAX_PALETTE_LENGTH    256
+
+/* These determine if an ancillary chunk's data has been successfully read
+ * from the PNG header, or if the application has filled in the corresponding
+ * data in the info_struct to be written into the output file.  The values
+ * of the PNG_INFO_<chunk> defines should NOT be changed.
+ */
+#define PNG_INFO_gAMA 0x0001
+#define PNG_INFO_sBIT 0x0002
+#define PNG_INFO_cHRM 0x0004
+#define PNG_INFO_PLTE 0x0008
+#define PNG_INFO_tRNS 0x0010
+#define PNG_INFO_bKGD 0x0020
+#define PNG_INFO_hIST 0x0040
+#define PNG_INFO_pHYs 0x0080
+#define PNG_INFO_oFFs 0x0100
+#define PNG_INFO_tIME 0x0200
+#define PNG_INFO_pCAL 0x0400
+#define PNG_INFO_sRGB 0x0800   /* GR-P, 0.96a */
+#define PNG_INFO_iCCP 0x1000   /* ESR, 1.0.6 */
+#define PNG_INFO_sPLT 0x2000   /* ESR, 1.0.6 */
+#define PNG_INFO_sCAL 0x4000   /* ESR, 1.0.6 */
+#define PNG_INFO_IDAT 0x8000L  /* ESR, 1.0.6 */
+
+/* This is used for the transformation routines, as some of them
+ * change these values for the row.  It also should enable using
+ * the routines for other purposes.
+ */
+typedef struct png_row_info_struct
+{
+   png_uint_32 width; /* width of row */
+   png_uint_32 rowbytes; /* number of bytes in row */
+   png_byte color_type; /* color type of row */
+   png_byte bit_depth; /* bit depth of row */
+   png_byte channels; /* number of channels (1, 2, 3, or 4) */
+   png_byte pixel_depth; /* bits per pixel (depth * channels) */
+} png_row_info;
+
+typedef png_row_info FAR * png_row_infop;
+typedef png_row_info FAR * FAR * png_row_infopp;
+
+/* These are the function types for the I/O functions and for the functions
+ * that allow the user to override the default I/O functions with his or her
+ * own.  The png_error_ptr type should match that of user-supplied warning
+ * and error functions, while the png_rw_ptr type should match that of the
+ * user read/write data functions.
+ */
+typedef struct png_struct_def png_struct;
+typedef png_struct FAR * png_structp;
+
+typedef void (PNGAPI *png_error_ptr) PNGARG((png_structp, png_const_charp));
+typedef void (PNGAPI *png_rw_ptr) PNGARG((png_structp, png_bytep, png_size_t));
+typedef void (PNGAPI *png_flush_ptr) PNGARG((png_structp));
+typedef void (PNGAPI *png_read_status_ptr) PNGARG((png_structp, png_uint_32,
+   int));
+typedef void (PNGAPI *png_write_status_ptr) PNGARG((png_structp, png_uint_32,
+   int));
+
+#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
+typedef void (PNGAPI *png_progressive_info_ptr) PNGARG((png_structp, png_infop));
+typedef void (PNGAPI *png_progressive_end_ptr) PNGARG((png_structp, png_infop));
+typedef void (PNGAPI *png_progressive_row_ptr) PNGARG((png_structp, png_bytep,
+   png_uint_32, int));
+#endif
+
+#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
+    defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
+    defined(PNG_LEGACY_SUPPORTED)
+typedef void (PNGAPI *png_user_transform_ptr) PNGARG((png_structp,
+    png_row_infop, png_bytep));
+#endif
+
+#ifdef PNG_USER_CHUNKS_SUPPORTED
+typedef int (PNGAPI *png_user_chunk_ptr) PNGARG((png_structp, png_unknown_chunkp));
+#endif
+#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
+typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp));
+#endif
+
+/* Transform masks for the high-level interface */
+#define PNG_TRANSFORM_IDENTITY       0x0000    /* read and write */
+#define PNG_TRANSFORM_STRIP_16       0x0001    /* read only */
+#define PNG_TRANSFORM_STRIP_ALPHA    0x0002    /* read only */
+#define PNG_TRANSFORM_PACKING        0x0004    /* read and write */
+#define PNG_TRANSFORM_PACKSWAP       0x0008    /* read and write */
+#define PNG_TRANSFORM_EXPAND         0x0010    /* read only */
+#define PNG_TRANSFORM_INVERT_MONO    0x0020    /* read and write */
+#define PNG_TRANSFORM_SHIFT          0x0040    /* read and write */
+#define PNG_TRANSFORM_BGR            0x0080    /* read and write */
+#define PNG_TRANSFORM_SWAP_ALPHA     0x0100    /* read and write */
+#define PNG_TRANSFORM_SWAP_ENDIAN    0x0200    /* read and write */
+#define PNG_TRANSFORM_INVERT_ALPHA   0x0400    /* read and write */
+#define PNG_TRANSFORM_STRIP_FILLER   0x0800    /* write only, deprecated */
+/* Added to libpng-1.2.34 */
+#define PNG_TRANSFORM_STRIP_FILLER_BEFORE 0x0800  /* write only */
+#define PNG_TRANSFORM_STRIP_FILLER_AFTER  0x1000  /* write only */
+/* Added to libpng-1.2.41 */
+#define PNG_TRANSFORM_GRAY_TO_RGB   0x2000      /* read only */
+
+/* Flags for MNG supported features */
+#define PNG_FLAG_MNG_EMPTY_PLTE     0x01
+#define PNG_FLAG_MNG_FILTER_64      0x04
+#define PNG_ALL_MNG_FEATURES        0x05
+
+typedef png_voidp (*png_malloc_ptr) PNGARG((png_structp, png_size_t));
+typedef void (*png_free_ptr) PNGARG((png_structp, png_voidp));
+
+/* The structure that holds the information to read and write PNG files.
+ * The only people who need to care about what is inside of this are the
+ * people who will be modifying the library for their own special needs.
+ * It should NOT be accessed directly by an application, except to store
+ * the jmp_buf.
+ */
+
+struct png_struct_def
+{
+#ifdef PNG_SETJMP_SUPPORTED
+   jmp_buf jmpbuf;            /* used in png_error */
+#endif
+   png_error_ptr error_fn PNG_DEPSTRUCT;    /* function for printing errors and aborting */
+   png_error_ptr warning_fn PNG_DEPSTRUCT;  /* function for printing warnings */
+   png_voidp error_ptr PNG_DEPSTRUCT;       /* user supplied struct for error functions */
+   png_rw_ptr write_data_fn PNG_DEPSTRUCT;  /* function for writing output data */
+   png_rw_ptr read_data_fn PNG_DEPSTRUCT;   /* function for reading input data */
+   png_voidp io_ptr PNG_DEPSTRUCT;          /* ptr to application struct for I/O functions */
+
+#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
+   png_user_transform_ptr read_user_transform_fn PNG_DEPSTRUCT; /* user read transform */
+#endif
+
+#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
+   png_user_transform_ptr write_user_transform_fn PNG_DEPSTRUCT; /* user write transform */
+#endif
+
+/* These were added in libpng-1.0.2 */
+#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
+#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
+    defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
+   png_voidp user_transform_ptr PNG_DEPSTRUCT; /* user supplied struct for user transform */
+   png_byte user_transform_depth PNG_DEPSTRUCT;    /* bit depth of user transformed pixels */
+   png_byte user_transform_channels PNG_DEPSTRUCT; /* channels in user transformed pixels */
+#endif
+#endif
+
+   png_uint_32 mode PNG_DEPSTRUCT;          /* tells us where we are in the PNG file */
+   png_uint_32 flags PNG_DEPSTRUCT;         /* flags indicating various things to libpng */
+   png_uint_32 transformations PNG_DEPSTRUCT; /* which transformations to perform */
+
+   z_stream zstream PNG_DEPSTRUCT;          /* pointer to decompression structure (below) */
+   png_bytep zbuf PNG_DEPSTRUCT;            /* buffer for zlib */
+   png_size_t zbuf_size PNG_DEPSTRUCT;      /* size of zbuf */
+   int zlib_level PNG_DEPSTRUCT;            /* holds zlib compression level */
+   int zlib_method PNG_DEPSTRUCT;           /* holds zlib compression method */
+   int zlib_window_bits PNG_DEPSTRUCT;      /* holds zlib compression window bits */
+   int zlib_mem_level PNG_DEPSTRUCT;        /* holds zlib compression memory level */
+   int zlib_strategy PNG_DEPSTRUCT;         /* holds zlib compression strategy */
+
+   png_uint_32 width PNG_DEPSTRUCT;         /* width of image in pixels */
+   png_uint_32 height PNG_DEPSTRUCT;        /* height of image in pixels */
+   png_uint_32 num_rows PNG_DEPSTRUCT;      /* number of rows in current pass */
+   png_uint_32 usr_width PNG_DEPSTRUCT;     /* width of row at start of write */
+   png_uint_32 rowbytes PNG_DEPSTRUCT;      /* size of row in bytes */
+#if 0 /* Replaced with the following in libpng-1.2.43 */
+   png_size_t irowbytes PNG_DEPSTRUCT;
+#endif
+/* Added in libpng-1.2.43 */
+#ifdef PNG_USER_LIMITS_SUPPORTED
+   /* Added in libpng-1.4.0: Total number of sPLT, text, and unknown
+    * chunks that can be stored (0 means unlimited).
+    */
+   png_uint_32 user_chunk_cache_max PNG_DEPSTRUCT;
+#endif
+   png_uint_32 iwidth PNG_DEPSTRUCT;        /* width of current interlaced row in pixels */
+   png_uint_32 row_number PNG_DEPSTRUCT;    /* current row in interlace pass */
+   png_bytep prev_row PNG_DEPSTRUCT;        /* buffer to save previous (unfiltered) row */
+   png_bytep row_buf PNG_DEPSTRUCT;         /* buffer to save current (unfiltered) row */
+#ifndef PNG_NO_WRITE_FILTER
+   png_bytep sub_row PNG_DEPSTRUCT;         /* buffer to save "sub" row when filtering */
+   png_bytep up_row PNG_DEPSTRUCT;          /* buffer to save "up" row when filtering */
+   png_bytep avg_row PNG_DEPSTRUCT;         /* buffer to save "avg" row when filtering */
+   png_bytep paeth_row PNG_DEPSTRUCT;       /* buffer to save "Paeth" row when filtering */
+#endif
+   png_row_info row_info PNG_DEPSTRUCT;     /* used for transformation routines */
+
+   png_uint_32 idat_size PNG_DEPSTRUCT;     /* current IDAT size for read */
+   png_uint_32 crc PNG_DEPSTRUCT;           /* current chunk CRC value */
+   png_colorp palette PNG_DEPSTRUCT;        /* palette from the input file */
+   png_uint_16 num_palette PNG_DEPSTRUCT;   /* number of color entries in palette */
+   png_uint_16 num_trans PNG_DEPSTRUCT;     /* number of transparency values */
+   png_byte chunk_name[5] PNG_DEPSTRUCT;    /* null-terminated name of current chunk */
+   png_byte compression PNG_DEPSTRUCT;      /* file compression type (always 0) */
+   png_byte filter PNG_DEPSTRUCT;           /* file filter type (always 0) */
+   png_byte interlaced PNG_DEPSTRUCT;       /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
+   png_byte pass PNG_DEPSTRUCT;             /* current interlace pass (0 - 6) */
+   png_byte do_filter PNG_DEPSTRUCT;        /* row filter flags (see PNG_FILTER_ below ) */
+   png_byte color_type PNG_DEPSTRUCT;       /* color type of file */
+   png_byte bit_depth PNG_DEPSTRUCT;        /* bit depth of file */
+   png_byte usr_bit_depth PNG_DEPSTRUCT;    /* bit depth of users row */
+   png_byte pixel_depth PNG_DEPSTRUCT;      /* number of bits per pixel */
+   png_byte channels PNG_DEPSTRUCT;         /* number of channels in file */
+   png_byte usr_channels PNG_DEPSTRUCT;     /* channels at start of write */
+   png_byte sig_bytes PNG_DEPSTRUCT;        /* magic bytes read/written from start of file */
+
+#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
+#ifdef PNG_LEGACY_SUPPORTED
+   png_byte filler PNG_DEPSTRUCT;           /* filler byte for pixel expansion */
+#else
+   png_uint_16 filler PNG_DEPSTRUCT;           /* filler bytes for pixel expansion */
+#endif
+#endif
+
+#ifdef PNG_bKGD_SUPPORTED
+   png_byte background_gamma_type PNG_DEPSTRUCT;
+#  ifdef PNG_FLOATING_POINT_SUPPORTED
+   float background_gamma PNG_DEPSTRUCT;
+#  endif
+   png_color_16 background PNG_DEPSTRUCT;   /* background color in screen gamma space */
+#ifdef PNG_READ_GAMMA_SUPPORTED
+   png_color_16 background_1 PNG_DEPSTRUCT; /* background normalized to gamma 1.0 */
+#endif
+#endif /* PNG_bKGD_SUPPORTED */
+
+#ifdef PNG_WRITE_FLUSH_SUPPORTED
+   png_flush_ptr output_flush_fn PNG_DEPSTRUCT; /* Function for flushing output */
+   png_uint_32 flush_dist PNG_DEPSTRUCT;    /* how many rows apart to flush, 0 - no flush */
+   png_uint_32 flush_rows PNG_DEPSTRUCT;    /* number of rows written since last flush */
+#endif
+
+#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
+   int gamma_shift PNG_DEPSTRUCT;      /* number of "insignificant" bits 16-bit gamma */
+#ifdef PNG_FLOATING_POINT_SUPPORTED
+   float gamma PNG_DEPSTRUCT;          /* file gamma value */
+   float screen_gamma PNG_DEPSTRUCT;   /* screen gamma value (display_exponent) */
+#endif
+#endif
+
+#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
+   png_bytep gamma_table PNG_DEPSTRUCT;     /* gamma table for 8-bit depth files */
+   png_bytep gamma_from_1 PNG_DEPSTRUCT;    /* converts from 1.0 to screen */
+   png_bytep gamma_to_1 PNG_DEPSTRUCT;      /* converts from file to 1.0 */
+   png_uint_16pp gamma_16_table PNG_DEPSTRUCT; /* gamma table for 16-bit depth files */
+   png_uint_16pp gamma_16_from_1 PNG_DEPSTRUCT; /* converts from 1.0 to screen */
+   png_uint_16pp gamma_16_to_1 PNG_DEPSTRUCT; /* converts from file to 1.0 */
+#endif
+
+#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED)
+   png_color_8 sig_bit PNG_DEPSTRUCT;       /* significant bits in each available channel */
+#endif
+
+#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
+   png_color_8 shift PNG_DEPSTRUCT;         /* shift for significant bit tranformation */
+#endif
+
+#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \
+ || defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
+   png_bytep trans PNG_DEPSTRUCT;           /* transparency values for paletted files */
+   png_color_16 trans_values PNG_DEPSTRUCT; /* transparency values for non-paletted files */
+#endif
+
+   png_read_status_ptr read_row_fn PNG_DEPSTRUCT;   /* called after each row is decoded */
+   png_write_status_ptr write_row_fn PNG_DEPSTRUCT; /* called after each row is encoded */
+#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
+   png_progressive_info_ptr info_fn PNG_DEPSTRUCT; /* called after header data fully read */
+   png_progressive_row_ptr row_fn PNG_DEPSTRUCT;   /* called after each prog. row is decoded */
+   png_progressive_end_ptr end_fn PNG_DEPSTRUCT;   /* called after image is complete */
+   png_bytep save_buffer_ptr PNG_DEPSTRUCT;        /* current location in save_buffer */
+   png_bytep save_buffer PNG_DEPSTRUCT;            /* buffer for previously read data */
+   png_bytep current_buffer_ptr PNG_DEPSTRUCT;     /* current location in current_buffer */
+   png_bytep current_buffer PNG_DEPSTRUCT;         /* buffer for recently used data */
+   png_uint_32 push_length PNG_DEPSTRUCT;          /* size of current input chunk */
+   png_uint_32 skip_length PNG_DEPSTRUCT;          /* bytes to skip in input data */
+   png_size_t save_buffer_size PNG_DEPSTRUCT;      /* amount of data now in save_buffer */
+   png_size_t save_buffer_max PNG_DEPSTRUCT;       /* total size of save_buffer */
+   png_size_t buffer_size PNG_DEPSTRUCT;           /* total amount of available input data */
+   png_size_t current_buffer_size PNG_DEPSTRUCT;   /* amount of data now in current_buffer */
+   int process_mode PNG_DEPSTRUCT;                 /* what push library is currently doing */
+   int cur_palette PNG_DEPSTRUCT;                  /* current push library palette index */
+
+#  ifdef PNG_TEXT_SUPPORTED
+     png_size_t current_text_size PNG_DEPSTRUCT;   /* current size of text input data */
+     png_size_t current_text_left PNG_DEPSTRUCT;   /* how much text left to read in input */
+     png_charp current_text PNG_DEPSTRUCT;         /* current text chunk buffer */
+     png_charp current_text_ptr PNG_DEPSTRUCT;     /* current location in current_text */
+#  endif /* PNG_TEXT_SUPPORTED */
+#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
+
+#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
+/* for the Borland special 64K segment handler */
+   png_bytepp offset_table_ptr PNG_DEPSTRUCT;
+   png_bytep offset_table PNG_DEPSTRUCT;
+   png_uint_16 offset_table_number PNG_DEPSTRUCT;
+   png_uint_16 offset_table_count PNG_DEPSTRUCT;
+   png_uint_16 offset_table_count_free PNG_DEPSTRUCT;
+#endif
+
+#ifdef PNG_READ_DITHER_SUPPORTED
+   png_bytep palette_lookup PNG_DEPSTRUCT;         /* lookup table for dithering */
+   png_bytep dither_index PNG_DEPSTRUCT;           /* index translation for palette files */
+#endif
+
+#if defined(PNG_READ_DITHER_SUPPORTED) || defined(PNG_hIST_SUPPORTED)
+   png_uint_16p hist PNG_DEPSTRUCT;                /* histogram */
+#endif
+
+#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
+   png_byte heuristic_method PNG_DEPSTRUCT;        /* heuristic for row filter selection */
+   png_byte num_prev_filters PNG_DEPSTRUCT;        /* number of weights for previous rows */
+   png_bytep prev_filters PNG_DEPSTRUCT;           /* filter type(s) of previous row(s) */
+   png_uint_16p filter_weights PNG_DEPSTRUCT;      /* weight(s) for previous line(s) */
+   png_uint_16p inv_filter_weights PNG_DEPSTRUCT;  /* 1/weight(s) for previous line(s) */
+   png_uint_16p filter_costs PNG_DEPSTRUCT;        /* relative filter calculation cost */
+   png_uint_16p inv_filter_costs PNG_DEPSTRUCT;    /* 1/relative filter calculation cost */
+#endif
+
+#ifdef PNG_TIME_RFC1123_SUPPORTED
+   png_charp time_buffer PNG_DEPSTRUCT;            /* String to hold RFC 1123 time text */
+#endif
+
+/* New members added in libpng-1.0.6 */
+
+#ifdef PNG_FREE_ME_SUPPORTED
+   png_uint_32 free_me PNG_DEPSTRUCT;   /* flags items libpng is responsible for freeing */
+#endif
+
+#ifdef PNG_USER_CHUNKS_SUPPORTED
+   png_voidp user_chunk_ptr PNG_DEPSTRUCT;
+   png_user_chunk_ptr read_user_chunk_fn PNG_DEPSTRUCT; /* user read chunk handler */
+#endif
+
+#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
+   int num_chunk_list PNG_DEPSTRUCT;
+   png_bytep chunk_list PNG_DEPSTRUCT;
+#endif
+
+/* New members added in libpng-1.0.3 */
+#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
+   png_byte rgb_to_gray_status PNG_DEPSTRUCT;
+   /* These were changed from png_byte in libpng-1.0.6 */
+   png_uint_16 rgb_to_gray_red_coeff PNG_DEPSTRUCT;
+   png_uint_16 rgb_to_gray_green_coeff PNG_DEPSTRUCT;
+   png_uint_16 rgb_to_gray_blue_coeff PNG_DEPSTRUCT;
+#endif
+
+/* New member added in libpng-1.0.4 (renamed in 1.0.9) */
+#if defined(PNG_MNG_FEATURES_SUPPORTED) || \
+    defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
+    defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
+/* Changed from png_byte to png_uint_32 at version 1.2.0 */
+#ifdef PNG_1_0_X
+   png_byte mng_features_permitted PNG_DEPSTRUCT;
+#else
+   png_uint_32 mng_features_permitted PNG_DEPSTRUCT;
+#endif /* PNG_1_0_X */
+#endif
+
+/* New member added in libpng-1.0.7 */
+#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
+   png_fixed_point int_gamma PNG_DEPSTRUCT;
+#endif
+
+/* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */
+#ifdef PNG_MNG_FEATURES_SUPPORTED
+   png_byte filter_type PNG_DEPSTRUCT;
+#endif
+
+#ifdef PNG_1_0_X
+/* New member added in libpng-1.0.10, ifdef'ed out in 1.2.0 */
+   png_uint_32 row_buf_size PNG_DEPSTRUCT;
+#endif
+
+/* New members added in libpng-1.2.0 */
+#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
+#  ifndef PNG_1_0_X
+#    ifdef PNG_MMX_CODE_SUPPORTED
+   png_byte     mmx_bitdepth_threshold PNG_DEPSTRUCT;
+   png_uint_32  mmx_rowbytes_threshold PNG_DEPSTRUCT;
+#    endif
+   png_uint_32  asm_flags PNG_DEPSTRUCT;
+#  endif
+#endif
+
+/* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */
+#ifdef PNG_USER_MEM_SUPPORTED
+   png_voidp mem_ptr PNG_DEPSTRUCT;            /* user supplied struct for mem functions */
+   png_malloc_ptr malloc_fn PNG_DEPSTRUCT;     /* function for allocating memory */
+   png_free_ptr free_fn PNG_DEPSTRUCT;         /* function for freeing memory */
+#endif
+
+/* New member added in libpng-1.0.13 and 1.2.0 */
+   png_bytep big_row_buf PNG_DEPSTRUCT;        /* buffer to save current (unfiltered) row */
+
+#ifdef PNG_READ_DITHER_SUPPORTED
+/* The following three members were added at version 1.0.14 and 1.2.4 */
+   png_bytep dither_sort PNG_DEPSTRUCT;        /* working sort array */
+   png_bytep index_to_palette PNG_DEPSTRUCT;   /* where the original index currently is */
+                                 /* in the palette */
+   png_bytep palette_to_index PNG_DEPSTRUCT;   /* which original index points to this */
+                                 /* palette color */
+#endif
+
+/* New members added in libpng-1.0.16 and 1.2.6 */
+   png_byte compression_type PNG_DEPSTRUCT;
+
+#ifdef PNG_USER_LIMITS_SUPPORTED
+   png_uint_32 user_width_max PNG_DEPSTRUCT;
+   png_uint_32 user_height_max PNG_DEPSTRUCT;
+#endif
+
+/* New member added in libpng-1.0.25 and 1.2.17 */
+#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
+   /* Storage for unknown chunk that the library doesn't recognize. */
+   png_unknown_chunk unknown_chunk PNG_DEPSTRUCT;
+#endif
+
+/* New members added in libpng-1.2.26 */
+  png_uint_32 old_big_row_buf_size PNG_DEPSTRUCT;
+  png_uint_32 old_prev_row_size PNG_DEPSTRUCT;
+
+/* New member added in libpng-1.2.30 */
+  png_charp chunkdata PNG_DEPSTRUCT;  /* buffer for reading chunk data */
+
+
+};
+
+
+/* This triggers a compiler error in png.c, if png.c and png.h
+ * do not agree upon the version number.
+ */
+typedef png_structp version_1_2_50;
+
+typedef png_struct FAR * FAR * png_structpp;
+
+/* Here are the function definitions most commonly used.  This is not
+ * the place to find out how to use libpng.  See libpng.txt for the
+ * full explanation, see example.c for the summary.  This just provides
+ * a simple one line description of the use of each function.
+ */
+
+/* Returns the version number of the library */
+extern PNG_EXPORT(png_uint_32,png_access_version_number) PNGARG((void));
+
+/* Tell lib we have already handled the first <num_bytes> magic bytes.
+ * Handling more than 8 bytes from the beginning of the file is an error.
+ */
+extern PNG_EXPORT(void,png_set_sig_bytes) PNGARG((png_structp png_ptr,
+   int num_bytes));
+
+/* Check sig[start] through sig[start + num_to_check - 1] to see if it's a
+ * PNG file.  Returns zero if the supplied bytes match the 8-byte PNG
+ * signature, and non-zero otherwise.  Having num_to_check == 0 or
+ * start > 7 will always fail (ie return non-zero).
+ */
+extern PNG_EXPORT(int,png_sig_cmp) PNGARG((png_bytep sig, png_size_t start,
+   png_size_t num_to_check));
+
+/* Simple signature checking function.  This is the same as calling
+ * png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n).
+ */
+extern PNG_EXPORT(int,png_check_sig) PNGARG((png_bytep sig, int num)) PNG_DEPRECATED;
+
+/* Allocate and initialize png_ptr struct for reading, and any other memory. */
+extern PNG_EXPORT(png_structp,png_create_read_struct)
+   PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
+   png_error_ptr error_fn, png_error_ptr warn_fn)) PNG_ALLOCATED;
+
+/* Allocate and initialize png_ptr struct for writing, and any other memory */
+extern PNG_EXPORT(png_structp,png_create_write_struct)
+   PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
+   png_error_ptr error_fn, png_error_ptr warn_fn)) PNG_ALLOCATED;
+
+#ifdef PNG_WRITE_SUPPORTED
+extern PNG_EXPORT(png_uint_32,png_get_compression_buffer_size)
+   PNGARG((png_structp png_ptr));
+#endif
+
+#ifdef PNG_WRITE_SUPPORTED
+extern PNG_EXPORT(void,png_set_compression_buffer_size)
+   PNGARG((png_structp png_ptr, png_uint_32 size));
+#endif
+
+/* Reset the compression stream */
+extern PNG_EXPORT(int,png_reset_zstream) PNGARG((png_structp png_ptr));
+
+/* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */
+#ifdef PNG_USER_MEM_SUPPORTED
+extern PNG_EXPORT(png_structp,png_create_read_struct_2)
+   PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
+   png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
+   png_malloc_ptr malloc_fn, png_free_ptr free_fn)) PNG_ALLOCATED;
+extern PNG_EXPORT(png_structp,png_create_write_struct_2)
+   PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
+   png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
+   png_malloc_ptr malloc_fn, png_free_ptr free_fn)) PNG_ALLOCATED;
+#endif
+
+/* Write a PNG chunk - size, type, (optional) data, CRC. */
+extern PNG_EXPORT(void,png_write_chunk) PNGARG((png_structp png_ptr,
+   png_bytep chunk_name, png_bytep data, png_size_t length));
+
+/* Write the start of a PNG chunk - length and chunk name. */
+extern PNG_EXPORT(void,png_write_chunk_start) PNGARG((png_structp png_ptr,
+   png_bytep chunk_name, png_uint_32 length));
+
+/* Write the data of a PNG chunk started with png_write_chunk_start(). */
+extern PNG_EXPORT(void,png_write_chunk_data) PNGARG((png_structp png_ptr,
+   png_bytep data, png_size_t length));
+
+/* Finish a chunk started with png_write_chunk_start() (includes CRC). */
+extern PNG_EXPORT(void,png_write_chunk_end) PNGARG((png_structp png_ptr));
+
+/* Allocate and initialize the info structure */
+extern PNG_EXPORT(png_infop,png_create_info_struct)
+   PNGARG((png_structp png_ptr)) PNG_ALLOCATED;
+
+#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
+/* Initialize the info structure (old interface - DEPRECATED) */
+extern PNG_EXPORT(void,png_info_init) PNGARG((png_infop info_ptr))
+    PNG_DEPRECATED;
+#undef png_info_init
+#define png_info_init(info_ptr) png_info_init_3(&info_ptr,\
+    png_sizeof(png_info));
+#endif
+
+extern PNG_EXPORT(void,png_info_init_3) PNGARG((png_infopp info_ptr,
+    png_size_t png_info_struct_size));
+
+/* Writes all the PNG information before the image. */
+extern PNG_EXPORT(void,png_write_info_before_PLTE) PNGARG((png_structp png_ptr,
+   png_infop info_ptr));
+extern PNG_EXPORT(void,png_write_info) PNGARG((png_structp png_ptr,
+   png_infop info_ptr));
+
+#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
+/* Read the information before the actual image data. */
+extern PNG_EXPORT(void,png_read_info) PNGARG((png_structp png_ptr,
+   png_infop info_ptr));
+#endif
+
+#ifdef PNG_TIME_RFC1123_SUPPORTED
+extern PNG_EXPORT(png_charp,png_convert_to_rfc1123)
+   PNGARG((png_structp png_ptr, png_timep ptime));
+#endif
+
+#ifdef PNG_CONVERT_tIME_SUPPORTED
+/* Convert from a struct tm to png_time */
+extern PNG_EXPORT(void,png_convert_from_struct_tm) PNGARG((png_timep ptime,
+   struct tm FAR * ttime));
+
+/* Convert from time_t to png_time.  Uses gmtime() */
+extern PNG_EXPORT(void,png_convert_from_time_t) PNGARG((png_timep ptime,
+   time_t ttime));
+#endif /* PNG_CONVERT_tIME_SUPPORTED */
+
+#ifdef PNG_READ_EXPAND_SUPPORTED
+/* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */
+extern PNG_EXPORT(void,png_set_expand) PNGARG((png_structp png_ptr));
+#ifndef PNG_1_0_X
+extern PNG_EXPORT(void,png_set_expand_gray_1_2_4_to_8) PNGARG((png_structp
+  png_ptr));
+#endif
+extern PNG_EXPORT(void,png_set_palette_to_rgb) PNGARG((png_structp png_ptr));
+extern PNG_EXPORT(void,png_set_tRNS_to_alpha) PNGARG((png_structp png_ptr));
+#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
+/* Deprecated */
+extern PNG_EXPORT(void,png_set_gray_1_2_4_to_8) PNGARG((png_structp
+    png_ptr)) PNG_DEPRECATED;
+#endif
+#endif
+
+#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
+/* Use blue, green, red order for pixels. */
+extern PNG_EXPORT(void,png_set_bgr) PNGARG((png_structp png_ptr));
+#endif
+
+#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
+/* Expand the grayscale to 24-bit RGB if necessary. */
+extern PNG_EXPORT(void,png_set_gray_to_rgb) PNGARG((png_structp png_ptr));
+#endif
+
+#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
+/* Reduce RGB to grayscale. */
+#ifdef PNG_FLOATING_POINT_SUPPORTED
+extern PNG_EXPORT(void,png_set_rgb_to_gray) PNGARG((png_structp png_ptr,
+   int error_action, double red, double green ));
+#endif
+extern PNG_EXPORT(void,png_set_rgb_to_gray_fixed) PNGARG((png_structp png_ptr,
+   int error_action, png_fixed_point red, png_fixed_point green ));
+extern PNG_EXPORT(png_byte,png_get_rgb_to_gray_status) PNGARG((png_structp
+   png_ptr));
+#endif
+
+extern PNG_EXPORT(void,png_build_grayscale_palette) PNGARG((int bit_depth,
+   png_colorp palette));
+
+#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
+extern PNG_EXPORT(void,png_set_strip_alpha) PNGARG((png_structp png_ptr));
+#endif
+
+#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \
+    defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
+extern PNG_EXPORT(void,png_set_swap_alpha) PNGARG((png_structp png_ptr));
+#endif
+
+#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \
+    defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
+extern PNG_EXPORT(void,png_set_invert_alpha) PNGARG((png_structp png_ptr));
+#endif
+
+#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
+/* Add a filler byte to 8-bit Gray or 24-bit RGB images. */
+extern PNG_EXPORT(void,png_set_filler) PNGARG((png_structp png_ptr,
+   png_uint_32 filler, int flags));
+/* The values of the PNG_FILLER_ defines should NOT be changed */
+#define PNG_FILLER_BEFORE 0
+#define PNG_FILLER_AFTER 1
+/* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */
+#ifndef PNG_1_0_X
+extern PNG_EXPORT(void,png_set_add_alpha) PNGARG((png_structp png_ptr,
+   png_uint_32 filler, int flags));
+#endif
+#endif /* PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED */
+
+#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
+/* Swap bytes in 16-bit depth files. */
+extern PNG_EXPORT(void,png_set_swap) PNGARG((png_structp png_ptr));
+#endif
+
+#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
+/* Use 1 byte per pixel in 1, 2, or 4-bit depth files. */
+extern PNG_EXPORT(void,png_set_packing) PNGARG((png_structp png_ptr));
+#endif
+
+#if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED)
+/* Swap packing order of pixels in bytes. */
+extern PNG_EXPORT(void,png_set_packswap) PNGARG((png_structp png_ptr));
+#endif
+
+#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
+/* Converts files to legal bit depths. */
+extern PNG_EXPORT(void,png_set_shift) PNGARG((png_structp png_ptr,
+   png_color_8p true_bits));
+#endif
+
+#if defined(PNG_READ_INTERLACING_SUPPORTED) || \
+    defined(PNG_WRITE_INTERLACING_SUPPORTED)
+/* Have the code handle the interlacing.  Returns the number of passes. */
+extern PNG_EXPORT(int,png_set_interlace_handling) PNGARG((png_structp png_ptr));
+#endif
+
+#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
+/* Invert monochrome files */
+extern PNG_EXPORT(void,png_set_invert_mono) PNGARG((png_structp png_ptr));
+#endif
+
+#ifdef PNG_READ_BACKGROUND_SUPPORTED
+/* Handle alpha and tRNS by replacing with a background color. */
+#ifdef PNG_FLOATING_POINT_SUPPORTED
+extern PNG_EXPORT(void,png_set_background) PNGARG((png_structp png_ptr,
+   png_color_16p background_color, int background_gamma_code,
+   int need_expand, double background_gamma));
+#endif
+#define PNG_BACKGROUND_GAMMA_UNKNOWN 0
+#define PNG_BACKGROUND_GAMMA_SCREEN  1
+#define PNG_BACKGROUND_GAMMA_FILE    2
+#define PNG_BACKGROUND_GAMMA_UNIQUE  3
+#endif
+
+#ifdef PNG_READ_16_TO_8_SUPPORTED
+/* Strip the second byte of information from a 16-bit depth file. */
+extern PNG_EXPORT(void,png_set_strip_16) PNGARG((png_structp png_ptr));
+#endif
+
+#ifdef PNG_READ_DITHER_SUPPORTED
+/* Turn on dithering, and reduce the palette to the number of colors available. */
+extern PNG_EXPORT(void,png_set_dither) PNGARG((png_structp png_ptr,
+   png_colorp palette, int num_palette, int maximum_colors,
+   png_uint_16p histogram, int full_dither));
+#endif
+
+#ifdef PNG_READ_GAMMA_SUPPORTED
+/* Handle gamma correction. Screen_gamma=(display_exponent) */
+#ifdef PNG_FLOATING_POINT_SUPPORTED
+extern PNG_EXPORT(void,png_set_gamma) PNGARG((png_structp png_ptr,
+   double screen_gamma, double default_file_gamma));
+#endif
+#endif
+
+#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
+#if defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
+    defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
+/* Permit or disallow empty PLTE (0: not permitted, 1: permitted) */
+/* Deprecated and will be removed.  Use png_permit_mng_features() instead. */
+extern PNG_EXPORT(void,png_permit_empty_plte) PNGARG((png_structp png_ptr,
+   int empty_plte_permitted)) PNG_DEPRECATED;
+#endif
+#endif
+
+#ifdef PNG_WRITE_FLUSH_SUPPORTED
+/* Set how many lines between output flushes - 0 for no flushing */
+extern PNG_EXPORT(void,png_set_flush) PNGARG((png_structp png_ptr, int nrows));
+/* Flush the current PNG output buffer */
+extern PNG_EXPORT(void,png_write_flush) PNGARG((png_structp png_ptr));
+#endif
+
+/* Optional update palette with requested transformations */
+extern PNG_EXPORT(void,png_start_read_image) PNGARG((png_structp png_ptr));
+
+/* Optional call to update the users info structure */
+extern PNG_EXPORT(void,png_read_update_info) PNGARG((png_structp png_ptr,
+   png_infop info_ptr));
+
+#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
+/* Read one or more rows of image data. */
+extern PNG_EXPORT(void,png_read_rows) PNGARG((png_structp png_ptr,
+   png_bytepp row, png_bytepp display_row, png_uint_32 num_rows));
+#endif
+
+#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
+/* Read a row of data. */
+extern PNG_EXPORT(void,png_read_row) PNGARG((png_structp png_ptr,
+   png_bytep row,
+   png_bytep display_row));
+#endif
+
+#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
+/* Read the whole image into memory at once. */
+extern PNG_EXPORT(void,png_read_image) PNGARG((png_structp png_ptr,
+   png_bytepp image));
+#endif
+
+/* Write a row of image data */
+extern PNG_EXPORT(void,png_write_row) PNGARG((png_structp png_ptr,
+   png_bytep row));
+
+/* Write a few rows of image data */
+extern PNG_EXPORT(void,png_write_rows) PNGARG((png_structp png_ptr,
+   png_bytepp row, png_uint_32 num_rows));
+
+/* Write the image data */
+extern PNG_EXPORT(void,png_write_image) PNGARG((png_structp png_ptr,
+   png_bytepp image));
+
+/* Writes the end of the PNG file. */
+extern PNG_EXPORT(void,png_write_end) PNGARG((png_structp png_ptr,
+   png_infop info_ptr));
+
+#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
+/* Read the end of the PNG file. */
+extern PNG_EXPORT(void,png_read_end) PNGARG((png_structp png_ptr,
+   png_infop info_ptr));
+#endif
+
+/* Free any memory associated with the png_info_struct */
+extern PNG_EXPORT(void,png_destroy_info_struct) PNGARG((png_structp png_ptr,
+   png_infopp info_ptr_ptr));
+
+/* Free any memory associated with the png_struct and the png_info_structs */
+extern PNG_EXPORT(void,png_destroy_read_struct) PNGARG((png_structpp
+   png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr));
+
+/* Free all memory used by the read (old method - NOT DLL EXPORTED) */
+extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr,
+   png_infop end_info_ptr)) PNG_DEPRECATED;
+
+/* Free any memory associated with the png_struct and the png_info_structs */
+extern PNG_EXPORT(void,png_destroy_write_struct)
+   PNGARG((png_structpp png_ptr_ptr, png_infopp info_ptr_ptr));
+
+/* Free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */
+extern void png_write_destroy PNGARG((png_structp png_ptr)) PNG_DEPRECATED;
+
+/* Set the libpng method of handling chunk CRC errors */
+extern PNG_EXPORT(void,png_set_crc_action) PNGARG((png_structp png_ptr,
+   int crit_action, int ancil_action));
+
+/* Values for png_set_crc_action() to say how to handle CRC errors in
+ * ancillary and critical chunks, and whether to use the data contained
+ * therein.  Note that it is impossible to "discard" data in a critical
+ * chunk.  For versions prior to 0.90, the action was always error/quit,
+ * whereas in version 0.90 and later, the action for CRC errors in ancillary
+ * chunks is warn/discard.  These values should NOT be changed.
+ *
+ *      value                       action:critical     action:ancillary
+ */
+#define PNG_CRC_DEFAULT       0  /* error/quit          warn/discard data */
+#define PNG_CRC_ERROR_QUIT    1  /* error/quit          error/quit        */
+#define PNG_CRC_WARN_DISCARD  2  /* (INVALID)           warn/discard data */
+#define PNG_CRC_WARN_USE      3  /* warn/use data       warn/use data     */
+#define PNG_CRC_QUIET_USE     4  /* quiet/use data      quiet/use data    */
+#define PNG_CRC_NO_CHANGE     5  /* use current value   use current value */
+
+/* These functions give the user control over the scan-line filtering in
+ * libpng and the compression methods used by zlib.  These functions are
+ * mainly useful for testing, as the defaults should work with most users.
+ * Those users who are tight on memory or want faster performance at the
+ * expense of compression can modify them.  See the compression library
+ * header file (zlib.h) for an explination of the compression functions.
+ */
+
+/* Set the filtering method(s) used by libpng.  Currently, the only valid
+ * value for "method" is 0.
+ */
+extern PNG_EXPORT(void,png_set_filter) PNGARG((png_structp png_ptr, int method,
+   int filters));
+
+/* Flags for png_set_filter() to say which filters to use.  The flags
+ * are chosen so that they don't conflict with real filter types
+ * below, in case they are supplied instead of the #defined constants.
+ * These values should NOT be changed.
+ */
+#define PNG_NO_FILTERS     0x00
+#define PNG_FILTER_NONE    0x08
+#define PNG_FILTER_SUB     0x10
+#define PNG_FILTER_UP      0x20
+#define PNG_FILTER_AVG     0x40
+#define PNG_FILTER_PAETH   0x80
+#define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \
+                         PNG_FILTER_AVG | PNG_FILTER_PAETH)
+
+/* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now.
+ * These defines should NOT be changed.
+ */
+#define PNG_FILTER_VALUE_NONE  0
+#define PNG_FILTER_VALUE_SUB   1
+#define PNG_FILTER_VALUE_UP    2
+#define PNG_FILTER_VALUE_AVG   3
+#define PNG_FILTER_VALUE_PAETH 4
+#define PNG_FILTER_VALUE_LAST  5
+
+#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) /* EXPERIMENTAL */
+/* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_
+ * defines, either the default (minimum-sum-of-absolute-differences), or
+ * the experimental method (weighted-minimum-sum-of-absolute-differences).
+ *
+ * Weights are factors >= 1.0, indicating how important it is to keep the
+ * filter type consistent between rows.  Larger numbers mean the current
+ * filter is that many times as likely to be the same as the "num_weights"
+ * previous filters.  This is cumulative for each previous row with a weight.
+ * There needs to be "num_weights" values in "filter_weights", or it can be
+ * NULL if the weights aren't being specified.  Weights have no influence on
+ * the selection of the first row filter.  Well chosen weights can (in theory)
+ * improve the compression for a given image.
+ *
+ * Costs are factors >= 1.0 indicating the relative decoding costs of a
+ * filter type.  Higher costs indicate more decoding expense, and are
+ * therefore less likely to be selected over a filter with lower computational
+ * costs.  There needs to be a value in "filter_costs" for each valid filter
+ * type (given by PNG_FILTER_VALUE_LAST), or it can be NULL if you aren't
+ * setting the costs.  Costs try to improve the speed of decompression without
+ * unduly increasing the compressed image size.
+ *
+ * A negative weight or cost indicates the default value is to be used, and
+ * values in the range [0.0, 1.0) indicate the value is to remain unchanged.
+ * The default values for both weights and costs are currently 1.0, but may
+ * change if good general weighting/cost heuristics can be found.  If both
+ * the weights and costs are set to 1.0, this degenerates the WEIGHTED method
+ * to the UNWEIGHTED method, but with added encoding time/computation.
+ */
+#ifdef PNG_FLOATING_POINT_SUPPORTED
+extern PNG_EXPORT(void,png_set_filter_heuristics) PNGARG((png_structp png_ptr,
+   int heuristic_method, int num_weights, png_doublep filter_weights,
+   png_doublep filter_costs));
+#endif
+#endif /*  PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */
+
+/* Heuristic used for row filter selection.  These defines should NOT be
+ * changed.
+ */
+#define PNG_FILTER_HEURISTIC_DEFAULT    0  /* Currently "UNWEIGHTED" */
+#define PNG_FILTER_HEURISTIC_UNWEIGHTED 1  /* Used by libpng < 0.95 */
+#define PNG_FILTER_HEURISTIC_WEIGHTED   2  /* Experimental feature */
+#define PNG_FILTER_HEURISTIC_LAST       3  /* Not a valid value */
+
+/* Set the library compression level.  Currently, valid values range from
+ * 0 - 9, corresponding directly to the zlib compression levels 0 - 9
+ * (0 - no compression, 9 - "maximal" compression).  Note that tests have
+ * shown that zlib compression levels 3-6 usually perform as well as level 9
+ * for PNG images, and do considerably fewer caclulations.  In the future,
+ * these values may not correspond directly to the zlib compression levels.
+ */
+extern PNG_EXPORT(void,png_set_compression_level) PNGARG((png_structp png_ptr,
+   int level));
+
+extern PNG_EXPORT(void,png_set_compression_mem_level)
+   PNGARG((png_structp png_ptr, int mem_level));
+
+extern PNG_EXPORT(void,png_set_compression_strategy)
+   PNGARG((png_structp png_ptr, int strategy));
+
+extern PNG_EXPORT(void,png_set_compression_window_bits)
+   PNGARG((png_structp png_ptr, int window_bits));
+
+extern PNG_EXPORT(void,png_set_compression_method) PNGARG((png_structp png_ptr,
+   int method));
+
+/* These next functions are called for input/output, memory, and error
+ * handling.  They are in the file pngrio.c, pngwio.c, and pngerror.c,
+ * and call standard C I/O routines such as fread(), fwrite(), and
+ * fprintf().  These functions can be made to use other I/O routines
+ * at run time for those applications that need to handle I/O in a
+ * different manner by calling png_set_???_fn().  See libpng.txt for
+ * more information.
+ */
+
+#ifdef PNG_STDIO_SUPPORTED
+/* Initialize the input/output for the PNG file to the default functions. */
+extern PNG_EXPORT(void,png_init_io) PNGARG((png_structp png_ptr, png_FILE_p fp));
+#endif
+
+/* Replace the (error and abort), and warning functions with user
+ * supplied functions.  If no messages are to be printed you must still
+ * write and use replacement functions. The replacement error_fn should
+ * still do a longjmp to the last setjmp location if you are using this
+ * method of error handling.  If error_fn or warning_fn is NULL, the
+ * default function will be used.
+ */
+
+extern PNG_EXPORT(void,png_set_error_fn) PNGARG((png_structp png_ptr,
+   png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn));
+
+/* Return the user pointer associated with the error functions */
+extern PNG_EXPORT(png_voidp,png_get_error_ptr) PNGARG((png_structp png_ptr));
+
+/* Replace the default data output functions with a user supplied one(s).
+ * If buffered output is not used, then output_flush_fn can be set to NULL.
+ * If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time
+ * output_flush_fn will be ignored (and thus can be NULL).
+ * It is probably a mistake to use NULL for output_flush_fn if
+ * write_data_fn is not also NULL unless you have built libpng with
+ * PNG_WRITE_FLUSH_SUPPORTED undefined, because in this case libpng's
+ * default flush function, which uses the standard *FILE structure, will
+ * be used.
+ */
+extern PNG_EXPORT(void,png_set_write_fn) PNGARG((png_structp png_ptr,
+   png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn));
+
+/* Replace the default data input function with a user supplied one. */
+extern PNG_EXPORT(void,png_set_read_fn) PNGARG((png_structp png_ptr,
+   png_voidp io_ptr, png_rw_ptr read_data_fn));
+
+/* Return the user pointer associated with the I/O functions */
+extern PNG_EXPORT(png_voidp,png_get_io_ptr) PNGARG((png_structp png_ptr));
+
+extern PNG_EXPORT(void,png_set_read_status_fn) PNGARG((png_structp png_ptr,
+   png_read_status_ptr read_row_fn));
+
+extern PNG_EXPORT(void,png_set_write_status_fn) PNGARG((png_structp png_ptr,
+   png_write_status_ptr write_row_fn));
+
+#ifdef PNG_USER_MEM_SUPPORTED
+/* Replace the default memory allocation functions with user supplied one(s). */
+extern PNG_EXPORT(void,png_set_mem_fn) PNGARG((png_structp png_ptr,
+   png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn));
+/* Return the user pointer associated with the memory functions */
+extern PNG_EXPORT(png_voidp,png_get_mem_ptr) PNGARG((png_structp png_ptr));
+#endif
+
+#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
+    defined(PNG_LEGACY_SUPPORTED)
+extern PNG_EXPORT(void,png_set_read_user_transform_fn) PNGARG((png_structp
+   png_ptr, png_user_transform_ptr read_user_transform_fn));
+#endif
+
+#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
+    defined(PNG_LEGACY_SUPPORTED)
+extern PNG_EXPORT(void,png_set_write_user_transform_fn) PNGARG((png_structp
+   png_ptr, png_user_transform_ptr write_user_transform_fn));
+#endif
+
+#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
+    defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \
+    defined(PNG_LEGACY_SUPPORTED)
+extern PNG_EXPORT(void,png_set_user_transform_info) PNGARG((png_structp
+   png_ptr, png_voidp user_transform_ptr, int user_transform_depth,
+   int user_transform_channels));
+/* Return the user pointer associated with the user transform functions */
+extern PNG_EXPORT(png_voidp,png_get_user_transform_ptr)
+   PNGARG((png_structp png_ptr));
+#endif
+
+#ifdef PNG_USER_CHUNKS_SUPPORTED
+extern PNG_EXPORT(void,png_set_read_user_chunk_fn) PNGARG((png_structp png_ptr,
+   png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn));
+extern PNG_EXPORT(png_voidp,png_get_user_chunk_ptr) PNGARG((png_structp
+   png_ptr));
+#endif
+
+#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
+/* Sets the function callbacks for the push reader, and a pointer to a
+ * user-defined structure available to the callback functions.
+ */
+extern PNG_EXPORT(void,png_set_progressive_read_fn) PNGARG((png_structp png_ptr,
+   png_voidp progressive_ptr,
+   png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
+   png_progressive_end_ptr end_fn));
+
+/* Returns the user pointer associated with the push read functions */
+extern PNG_EXPORT(png_voidp,png_get_progressive_ptr)
+   PNGARG((png_structp png_ptr));
+
+/* Function to be called when data becomes available */
+extern PNG_EXPORT(void,png_process_data) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_bytep buffer, png_size_t buffer_size));
+
+/* Function that combines rows.  Not very much different than the
+ * png_combine_row() call.  Is this even used?????
+ */
+extern PNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr,
+   png_bytep old_row, png_bytep new_row));
+#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
+
+extern PNG_EXPORT(png_voidp,png_malloc) PNGARG((png_structp png_ptr,
+   png_uint_32 size)) PNG_ALLOCATED;
+
+#ifdef PNG_1_0_X
+#  define png_malloc_warn png_malloc
+#else
+/* Added at libpng version 1.2.4 */
+extern PNG_EXPORT(png_voidp,png_malloc_warn) PNGARG((png_structp png_ptr,
+   png_uint_32 size)) PNG_ALLOCATED;
+#endif
+
+/* Frees a pointer allocated by png_malloc() */
+extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr));
+
+#ifdef PNG_1_0_X
+/* Function to allocate memory for zlib. */
+extern PNG_EXPORT(voidpf,png_zalloc) PNGARG((voidpf png_ptr, uInt items,
+   uInt size));
+
+/* Function to free memory for zlib */
+extern PNG_EXPORT(void,png_zfree) PNGARG((voidpf png_ptr, voidpf ptr));
+#endif
+
+/* Free data that was allocated internally */
+extern PNG_EXPORT(void,png_free_data) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_uint_32 free_me, int num));
+#ifdef PNG_FREE_ME_SUPPORTED
+/* Reassign responsibility for freeing existing data, whether allocated
+ * by libpng or by the application
+ */
+extern PNG_EXPORT(void,png_data_freer) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, int freer, png_uint_32 mask));
+#endif
+/* Assignments for png_data_freer */
+#define PNG_DESTROY_WILL_FREE_DATA 1
+#define PNG_SET_WILL_FREE_DATA 1
+#define PNG_USER_WILL_FREE_DATA 2
+/* Flags for png_ptr->free_me and info_ptr->free_me */
+#define PNG_FREE_HIST 0x0008
+#define PNG_FREE_ICCP 0x0010
+#define PNG_FREE_SPLT 0x0020
+#define PNG_FREE_ROWS 0x0040
+#define PNG_FREE_PCAL 0x0080
+#define PNG_FREE_SCAL 0x0100
+#define PNG_FREE_UNKN 0x0200
+#define PNG_FREE_LIST 0x0400
+#define PNG_FREE_PLTE 0x1000
+#define PNG_FREE_TRNS 0x2000
+#define PNG_FREE_TEXT 0x4000
+#define PNG_FREE_ALL  0x7fff
+#define PNG_FREE_MUL  0x4220 /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */
+
+#ifdef PNG_USER_MEM_SUPPORTED
+extern PNG_EXPORT(png_voidp,png_malloc_default) PNGARG((png_structp png_ptr,
+   png_uint_32 size)) PNG_ALLOCATED;
+extern PNG_EXPORT(void,png_free_default) PNGARG((png_structp png_ptr,
+   png_voidp ptr));
+#endif
+
+extern PNG_EXPORT(png_voidp,png_memcpy_check) PNGARG((png_structp png_ptr,
+   png_voidp s1, png_voidp s2, png_uint_32 size)) PNG_DEPRECATED;
+
+extern PNG_EXPORT(png_voidp,png_memset_check) PNGARG((png_structp png_ptr,
+   png_voidp s1, int value, png_uint_32 size)) PNG_DEPRECATED;
+
+#if defined(USE_FAR_KEYWORD)  /* memory model conversion function */
+extern void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr,
+   int check));
+#endif /* USE_FAR_KEYWORD */
+
+#ifndef PNG_NO_ERROR_TEXT
+/* Fatal error in PNG image of libpng - can't continue */
+extern PNG_EXPORT(void,png_error) PNGARG((png_structp png_ptr,
+   png_const_charp error_message)) PNG_NORETURN;
+
+/* The same, but the chunk name is prepended to the error string. */
+extern PNG_EXPORT(void,png_chunk_error) PNGARG((png_structp png_ptr,
+   png_const_charp error_message)) PNG_NORETURN;
+#else
+/* Fatal error in PNG image of libpng - can't continue */
+extern PNG_EXPORT(void,png_err) PNGARG((png_structp png_ptr)) PNG_NORETURN;
+#endif
+
+#ifndef PNG_NO_WARNINGS
+/* Non-fatal error in libpng.  Can continue, but may have a problem. */
+extern PNG_EXPORT(void,png_warning) PNGARG((png_structp png_ptr,
+   png_const_charp warning_message));
+
+#ifdef PNG_READ_SUPPORTED
+/* Non-fatal error in libpng, chunk name is prepended to message. */
+extern PNG_EXPORT(void,png_chunk_warning) PNGARG((png_structp png_ptr,
+   png_const_charp warning_message));
+#endif /* PNG_READ_SUPPORTED */
+#endif /* PNG_NO_WARNINGS */
+
+/* The png_set_<chunk> functions are for storing values in the png_info_struct.
+ * Similarly, the png_get_<chunk> calls are used to read values from the
+ * png_info_struct, either storing the parameters in the passed variables, or
+ * setting pointers into the png_info_struct where the data is stored.  The
+ * png_get_<chunk> functions return a non-zero value if the data was available
+ * in info_ptr, or return zero and do not change any of the parameters if the
+ * data was not available.
+ *
+ * These functions should be used instead of directly accessing png_info
+ * to avoid problems with future changes in the size and internal layout of
+ * png_info_struct.
+ */
+/* Returns "flag" if chunk data is valid in info_ptr. */
+extern PNG_EXPORT(png_uint_32,png_get_valid) PNGARG((png_structp png_ptr,
+png_infop info_ptr, png_uint_32 flag));
+
+/* Returns number of bytes needed to hold a transformed row. */
+extern PNG_EXPORT(png_uint_32,png_get_rowbytes) PNGARG((png_structp png_ptr,
+png_infop info_ptr));
+
+#ifdef PNG_INFO_IMAGE_SUPPORTED
+/* Returns row_pointers, which is an array of pointers to scanlines that was
+ * returned from png_read_png().
+ */
+extern PNG_EXPORT(png_bytepp,png_get_rows) PNGARG((png_structp png_ptr,
+png_infop info_ptr));
+/* Set row_pointers, which is an array of pointers to scanlines for use
+ * by png_write_png().
+ */
+extern PNG_EXPORT(void,png_set_rows) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_bytepp row_pointers));
+#endif
+
+/* Returns number of color channels in image. */
+extern PNG_EXPORT(png_byte,png_get_channels) PNGARG((png_structp png_ptr,
+png_infop info_ptr));
+
+#ifdef PNG_EASY_ACCESS_SUPPORTED
+/* Returns image width in pixels. */
+extern PNG_EXPORT(png_uint_32, png_get_image_width) PNGARG((png_structp
+png_ptr, png_infop info_ptr));
+
+/* Returns image height in pixels. */
+extern PNG_EXPORT(png_uint_32, png_get_image_height) PNGARG((png_structp
+png_ptr, png_infop info_ptr));
+
+/* Returns image bit_depth. */
+extern PNG_EXPORT(png_byte, png_get_bit_depth) PNGARG((png_structp
+png_ptr, png_infop info_ptr));
+
+/* Returns image color_type. */
+extern PNG_EXPORT(png_byte, png_get_color_type) PNGARG((png_structp
+png_ptr, png_infop info_ptr));
+
+/* Returns image filter_type. */
+extern PNG_EXPORT(png_byte, png_get_filter_type) PNGARG((png_structp
+png_ptr, png_infop info_ptr));
+
+/* Returns image interlace_type. */
+extern PNG_EXPORT(png_byte, png_get_interlace_type) PNGARG((png_structp
+png_ptr, png_infop info_ptr));
+
+/* Returns image compression_type. */
+extern PNG_EXPORT(png_byte, png_get_compression_type) PNGARG((png_structp
+png_ptr, png_infop info_ptr));
+
+/* Returns image resolution in pixels per meter, from pHYs chunk data. */
+extern PNG_EXPORT(png_uint_32, png_get_pixels_per_meter) PNGARG((png_structp
+png_ptr, png_infop info_ptr));
+extern PNG_EXPORT(png_uint_32, png_get_x_pixels_per_meter) PNGARG((png_structp
+png_ptr, png_infop info_ptr));
+extern PNG_EXPORT(png_uint_32, png_get_y_pixels_per_meter) PNGARG((png_structp
+png_ptr, png_infop info_ptr));
+
+/* Returns pixel aspect ratio, computed from pHYs chunk data.  */
+#ifdef PNG_FLOATING_POINT_SUPPORTED
+extern PNG_EXPORT(float, png_get_pixel_aspect_ratio) PNGARG((png_structp
+png_ptr, png_infop info_ptr));
+#endif
+
+/* Returns image x, y offset in pixels or microns, from oFFs chunk data. */
+extern PNG_EXPORT(png_int_32, png_get_x_offset_pixels) PNGARG((png_structp
+png_ptr, png_infop info_ptr));
+extern PNG_EXPORT(png_int_32, png_get_y_offset_pixels) PNGARG((png_structp
+png_ptr, png_infop info_ptr));
+extern PNG_EXPORT(png_int_32, png_get_x_offset_microns) PNGARG((png_structp
+png_ptr, png_infop info_ptr));
+extern PNG_EXPORT(png_int_32, png_get_y_offset_microns) PNGARG((png_structp
+png_ptr, png_infop info_ptr));
+
+#endif /* PNG_EASY_ACCESS_SUPPORTED */
+
+/* Returns pointer to signature string read from PNG header */
+extern PNG_EXPORT(png_bytep,png_get_signature) PNGARG((png_structp png_ptr,
+png_infop info_ptr));
+
+#ifdef PNG_bKGD_SUPPORTED
+extern PNG_EXPORT(png_uint_32,png_get_bKGD) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_color_16p *background));
+#endif
+
+#ifdef PNG_bKGD_SUPPORTED
+extern PNG_EXPORT(void,png_set_bKGD) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_color_16p background));
+#endif
+
+#ifdef PNG_cHRM_SUPPORTED
+#ifdef PNG_FLOATING_POINT_SUPPORTED
+extern PNG_EXPORT(png_uint_32,png_get_cHRM) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, double *white_x, double *white_y, double *red_x,
+   double *red_y, double *green_x, double *green_y, double *blue_x,
+   double *blue_y));
+#endif
+#ifdef PNG_FIXED_POINT_SUPPORTED
+extern PNG_EXPORT(png_uint_32,png_get_cHRM_fixed) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_fixed_point *int_white_x, png_fixed_point
+   *int_white_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y,
+   png_fixed_point *int_green_x, png_fixed_point *int_green_y, png_fixed_point
+   *int_blue_x, png_fixed_point *int_blue_y));
+#endif
+#endif
+
+#ifdef PNG_cHRM_SUPPORTED
+#ifdef PNG_FLOATING_POINT_SUPPORTED
+extern PNG_EXPORT(void,png_set_cHRM) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, double white_x, double white_y, double red_x,
+   double red_y, double green_x, double green_y, double blue_x, double blue_y));
+#endif
+#ifdef PNG_FIXED_POINT_SUPPORTED
+extern PNG_EXPORT(void,png_set_cHRM_fixed) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_fixed_point int_white_x, png_fixed_point int_white_y,
+   png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
+   int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
+   png_fixed_point int_blue_y));
+#endif
+#endif
+
+#ifdef PNG_gAMA_SUPPORTED
+#ifdef PNG_FLOATING_POINT_SUPPORTED
+extern PNG_EXPORT(png_uint_32,png_get_gAMA) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, double *file_gamma));
+#endif
+extern PNG_EXPORT(png_uint_32,png_get_gAMA_fixed) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_fixed_point *int_file_gamma));
+#endif
+
+#ifdef PNG_gAMA_SUPPORTED
+#ifdef PNG_FLOATING_POINT_SUPPORTED
+extern PNG_EXPORT(void,png_set_gAMA) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, double file_gamma));
+#endif
+extern PNG_EXPORT(void,png_set_gAMA_fixed) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_fixed_point int_file_gamma));
+#endif
+
+#ifdef PNG_hIST_SUPPORTED
+extern PNG_EXPORT(png_uint_32,png_get_hIST) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_uint_16p *hist));
+#endif
+
+#ifdef PNG_hIST_SUPPORTED
+extern PNG_EXPORT(void,png_set_hIST) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_uint_16p hist));
+#endif
+
+extern PNG_EXPORT(png_uint_32,png_get_IHDR) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_uint_32 *width, png_uint_32 *height,
+   int *bit_depth, int *color_type, int *interlace_method,
+   int *compression_method, int *filter_method));
+
+extern PNG_EXPORT(void,png_set_IHDR) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth,
+   int color_type, int interlace_method, int compression_method,
+   int filter_method));
+
+#ifdef PNG_oFFs_SUPPORTED
+extern PNG_EXPORT(png_uint_32,png_get_oFFs) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y,
+   int *unit_type));
+#endif
+
+#ifdef PNG_oFFs_SUPPORTED
+extern PNG_EXPORT(void,png_set_oFFs) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_int_32 offset_x, png_int_32 offset_y,
+   int unit_type));
+#endif
+
+#ifdef PNG_pCAL_SUPPORTED
+extern PNG_EXPORT(png_uint_32,png_get_pCAL) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1,
+   int *type, int *nparams, png_charp *units, png_charpp *params));
+#endif
+
+#ifdef PNG_pCAL_SUPPORTED
+extern PNG_EXPORT(void,png_set_pCAL) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_charp purpose, png_int_32 X0, png_int_32 X1,
+   int type, int nparams, png_charp units, png_charpp params));
+#endif
+
+#ifdef PNG_pHYs_SUPPORTED
+extern PNG_EXPORT(png_uint_32,png_get_pHYs) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));
+#endif
+
+#ifdef PNG_pHYs_SUPPORTED
+extern PNG_EXPORT(void,png_set_pHYs) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type));
+#endif
+
+extern PNG_EXPORT(png_uint_32,png_get_PLTE) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_colorp *palette, int *num_palette));
+
+extern PNG_EXPORT(void,png_set_PLTE) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_colorp palette, int num_palette));
+
+#ifdef PNG_sBIT_SUPPORTED
+extern PNG_EXPORT(png_uint_32,png_get_sBIT) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_color_8p *sig_bit));
+#endif
+
+#ifdef PNG_sBIT_SUPPORTED
+extern PNG_EXPORT(void,png_set_sBIT) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_color_8p sig_bit));
+#endif
+
+#ifdef PNG_sRGB_SUPPORTED
+extern PNG_EXPORT(png_uint_32,png_get_sRGB) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, int *intent));
+#endif
+
+#ifdef PNG_sRGB_SUPPORTED
+extern PNG_EXPORT(void,png_set_sRGB) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, int intent));
+extern PNG_EXPORT(void,png_set_sRGB_gAMA_and_cHRM) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, int intent));
+#endif
+
+#ifdef PNG_iCCP_SUPPORTED
+extern PNG_EXPORT(png_uint_32,png_get_iCCP) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_charpp name, int *compression_type,
+   png_charpp profile, png_uint_32 *proflen));
+   /* Note to maintainer: profile should be png_bytepp */
+#endif
+
+#ifdef PNG_iCCP_SUPPORTED
+extern PNG_EXPORT(void,png_set_iCCP) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_charp name, int compression_type,
+   png_charp profile, png_uint_32 proflen));
+   /* Note to maintainer: profile should be png_bytep */
+#endif
+
+#ifdef PNG_sPLT_SUPPORTED
+extern PNG_EXPORT(png_uint_32,png_get_sPLT) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_sPLT_tpp entries));
+#endif
+
+#ifdef PNG_sPLT_SUPPORTED
+extern PNG_EXPORT(void,png_set_sPLT) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_sPLT_tp entries, int nentries));
+#endif
+
+#ifdef PNG_TEXT_SUPPORTED
+/* png_get_text also returns the number of text chunks in *num_text */
+extern PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_textp *text_ptr, int *num_text));
+#endif
+
+/*
+ *  Note while png_set_text() will accept a structure whose text,
+ *  language, and  translated keywords are NULL pointers, the structure
+ *  returned by png_get_text will always contain regular
+ *  zero-terminated C strings.  They might be empty strings but
+ *  they will never be NULL pointers.
+ */
+
+#ifdef PNG_TEXT_SUPPORTED
+extern PNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_textp text_ptr, int num_text));
+#endif
+
+#ifdef PNG_tIME_SUPPORTED
+extern PNG_EXPORT(png_uint_32,png_get_tIME) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_timep *mod_time));
+#endif
+
+#ifdef PNG_tIME_SUPPORTED
+extern PNG_EXPORT(void,png_set_tIME) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_timep mod_time));
+#endif
+
+#ifdef PNG_tRNS_SUPPORTED
+extern PNG_EXPORT(png_uint_32,png_get_tRNS) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_bytep *trans, int *num_trans,
+   png_color_16p *trans_values));
+#endif
+
+#ifdef PNG_tRNS_SUPPORTED
+extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_bytep trans, int num_trans,
+   png_color_16p trans_values));
+#endif
+
+#ifdef PNG_tRNS_SUPPORTED
+#endif
+
+#ifdef PNG_sCAL_SUPPORTED
+#ifdef PNG_FLOATING_POINT_SUPPORTED
+extern PNG_EXPORT(png_uint_32,png_get_sCAL) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, int *unit, double *width, double *height));
+#else
+#ifdef PNG_FIXED_POINT_SUPPORTED
+extern PNG_EXPORT(png_uint_32,png_get_sCAL_s) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, int *unit, png_charpp swidth, png_charpp sheight));
+#endif
+#endif
+#endif /* PNG_sCAL_SUPPORTED */
+
+#ifdef PNG_sCAL_SUPPORTED
+#ifdef PNG_FLOATING_POINT_SUPPORTED
+extern PNG_EXPORT(void,png_set_sCAL) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, int unit, double width, double height));
+#else
+#ifdef PNG_FIXED_POINT_SUPPORTED
+extern PNG_EXPORT(void,png_set_sCAL_s) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, int unit, png_charp swidth, png_charp sheight));
+#endif
+#endif
+#endif /* PNG_sCAL_SUPPORTED || PNG_WRITE_sCAL_SUPPORTED */
+
+#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
+/* Provide a list of chunks and how they are to be handled, if the built-in
+   handling or default unknown chunk handling is not desired.  Any chunks not
+   listed will be handled in the default manner.  The IHDR and IEND chunks
+   must not be listed.
+      keep = 0: follow default behaviour
+           = 1: do not keep
+           = 2: keep only if safe-to-copy
+           = 3: keep even if unsafe-to-copy
+*/
+extern PNG_EXPORT(void, png_set_keep_unknown_chunks) PNGARG((png_structp
+   png_ptr, int keep, png_bytep chunk_list, int num_chunks));
+PNG_EXPORT(int,png_handle_as_unknown) PNGARG((png_structp png_ptr, png_bytep
+   chunk_name));
+#endif
+#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
+extern PNG_EXPORT(void, png_set_unknown_chunks) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns));
+extern PNG_EXPORT(void, png_set_unknown_chunk_location)
+   PNGARG((png_structp png_ptr, png_infop info_ptr, int chunk, int location));
+extern PNG_EXPORT(png_uint_32,png_get_unknown_chunks) PNGARG((png_structp
+   png_ptr, png_infop info_ptr, png_unknown_chunkpp entries));
+#endif
+
+/* Png_free_data() will turn off the "valid" flag for anything it frees.
+ * If you need to turn it off for a chunk that your application has freed,
+ * you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK);
+ */
+extern PNG_EXPORT(void, png_set_invalid) PNGARG((png_structp png_ptr,
+   png_infop info_ptr, int mask));
+
+#ifdef PNG_INFO_IMAGE_SUPPORTED
+/* The "params" pointer is currently not used and is for future expansion. */
+extern PNG_EXPORT(void, png_read_png) PNGARG((png_structp png_ptr,
+                        png_infop info_ptr,
+                        int transforms,
+                        png_voidp params));
+extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr,
+                        png_infop info_ptr,
+                        int transforms,
+                        png_voidp params));
+#endif
+
+/* Define PNG_DEBUG at compile time for debugging information.  Higher
+ * numbers for PNG_DEBUG mean more debugging information.  This has
+ * only been added since version 0.95 so it is not implemented throughout
+ * libpng yet, but more support will be added as needed.
+ */
+#ifdef PNG_DEBUG
+#if (PNG_DEBUG > 0)
+#if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER)
+#include <crtdbg.h>
+#if (PNG_DEBUG > 1)
+#ifndef _DEBUG
+#  define _DEBUG
+#endif
+#ifndef png_debug
+#define png_debug(l,m)  _RPT0(_CRT_WARN,m PNG_STRING_NEWLINE)
+#endif
+#ifndef png_debug1
+#define png_debug1(l,m,p1)  _RPT1(_CRT_WARN,m PNG_STRING_NEWLINE,p1)
+#endif
+#ifndef png_debug2
+#define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m PNG_STRING_NEWLINE,p1,p2)
+#endif
+#endif
+#else /* PNG_DEBUG_FILE || !_MSC_VER */
+#ifndef PNG_DEBUG_FILE
+#define PNG_DEBUG_FILE stderr
+#endif /* PNG_DEBUG_FILE */
+
+#if (PNG_DEBUG > 1)
+/* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on non-ISO
+ * compilers.
+ */
+#  ifdef __STDC__
+#    ifndef png_debug
+#      define png_debug(l,m) \
+       { \
+       int num_tabs=l; \
+       fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
+         (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
+       }
+#    endif
+#    ifndef png_debug1
+#      define png_debug1(l,m,p1) \
+       { \
+       int num_tabs=l; \
+       fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
+         (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
+       }
+#    endif
+#    ifndef png_debug2
+#      define png_debug2(l,m,p1,p2) \
+       { \
+       int num_tabs=l; \
+       fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
+         (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
+       }
+#    endif
+#  else /* __STDC __ */
+#    ifndef png_debug
+#      define png_debug(l,m) \
+       { \
+       int num_tabs=l; \
+       char format[256]; \
+       snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
+         (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
+         m,PNG_STRING_NEWLINE); \
+       fprintf(PNG_DEBUG_FILE,format); \
+       }
+#    endif
+#    ifndef png_debug1
+#      define png_debug1(l,m,p1) \
+       { \
+       int num_tabs=l; \
+       char format[256]; \
+       snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
+         (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
+         m,PNG_STRING_NEWLINE); \
+       fprintf(PNG_DEBUG_FILE,format,p1); \
+       }
+#    endif
+#    ifndef png_debug2
+#      define png_debug2(l,m,p1,p2) \
+       { \
+       int num_tabs=l; \
+       char format[256]; \
+       snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
+         (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
+         m,PNG_STRING_NEWLINE); \
+       fprintf(PNG_DEBUG_FILE,format,p1,p2); \
+       }
+#    endif
+#  endif /* __STDC __ */
+#endif /* (PNG_DEBUG > 1) */
+
+#endif /* _MSC_VER */
+#endif /* (PNG_DEBUG > 0) */
+#endif /* PNG_DEBUG */
+#ifndef png_debug
+#define png_debug(l, m)
+#endif
+#ifndef png_debug1
+#define png_debug1(l, m, p1)
+#endif
+#ifndef png_debug2
+#define png_debug2(l, m, p1, p2)
+#endif
+
+extern PNG_EXPORT(png_charp,png_get_copyright) PNGARG((png_structp png_ptr));
+extern PNG_EXPORT(png_charp,png_get_header_ver) PNGARG((png_structp png_ptr));
+extern PNG_EXPORT(png_charp,png_get_header_version) PNGARG((png_structp png_ptr));
+extern PNG_EXPORT(png_charp,png_get_libpng_ver) PNGARG((png_structp png_ptr));
+
+#ifdef PNG_MNG_FEATURES_SUPPORTED
+extern PNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp
+   png_ptr, png_uint_32 mng_features_permitted));
+#endif
+
+/* For use in png_set_keep_unknown, added to version 1.2.6 */
+#define PNG_HANDLE_CHUNK_AS_DEFAULT   0
+#define PNG_HANDLE_CHUNK_NEVER        1
+#define PNG_HANDLE_CHUNK_IF_SAFE      2
+#define PNG_HANDLE_CHUNK_ALWAYS       3
+
+/* Added to version 1.2.0 */
+#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
+#ifdef PNG_MMX_CODE_SUPPORTED
+#define PNG_ASM_FLAG_MMX_SUPPORT_COMPILED  0x01  /* not user-settable */
+#define PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU    0x02  /* not user-settable */
+#define PNG_ASM_FLAG_MMX_READ_COMBINE_ROW  0x04
+#define PNG_ASM_FLAG_MMX_READ_INTERLACE    0x08
+#define PNG_ASM_FLAG_MMX_READ_FILTER_SUB   0x10
+#define PNG_ASM_FLAG_MMX_READ_FILTER_UP    0x20
+#define PNG_ASM_FLAG_MMX_READ_FILTER_AVG   0x40
+#define PNG_ASM_FLAG_MMX_READ_FILTER_PAETH 0x80
+#define PNG_ASM_FLAGS_INITIALIZED          0x80000000  /* not user-settable */
+
+#define PNG_MMX_READ_FLAGS ( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW  \
+                           | PNG_ASM_FLAG_MMX_READ_INTERLACE    \
+                           | PNG_ASM_FLAG_MMX_READ_FILTER_SUB   \
+                           | PNG_ASM_FLAG_MMX_READ_FILTER_UP    \
+                           | PNG_ASM_FLAG_MMX_READ_FILTER_AVG   \
+                           | PNG_ASM_FLAG_MMX_READ_FILTER_PAETH )
+#define PNG_MMX_WRITE_FLAGS ( 0 )
+
+#define PNG_MMX_FLAGS ( PNG_ASM_FLAG_MMX_SUPPORT_COMPILED \
+                      | PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU   \
+                      | PNG_MMX_READ_FLAGS                \
+                      | PNG_MMX_WRITE_FLAGS )
+
+#define PNG_SELECT_READ   1
+#define PNG_SELECT_WRITE  2
+#endif /* PNG_MMX_CODE_SUPPORTED */
+
+#ifndef PNG_1_0_X
+/* pngget.c */
+extern PNG_EXPORT(png_uint_32,png_get_mmx_flagmask)
+   PNGARG((int flag_select, int *compilerID));
+
+/* pngget.c */
+extern PNG_EXPORT(png_uint_32,png_get_asm_flagmask)
+   PNGARG((int flag_select));
+
+/* pngget.c */
+extern PNG_EXPORT(png_uint_32,png_get_asm_flags)
+   PNGARG((png_structp png_ptr));
+
+/* pngget.c */
+extern PNG_EXPORT(png_byte,png_get_mmx_bitdepth_threshold)
+   PNGARG((png_structp png_ptr));
+
+/* pngget.c */
+extern PNG_EXPORT(png_uint_32,png_get_mmx_rowbytes_threshold)
+   PNGARG((png_structp png_ptr));
+
+/* pngset.c */
+extern PNG_EXPORT(void,png_set_asm_flags)
+   PNGARG((png_structp png_ptr, png_uint_32 asm_flags));
+
+/* pngset.c */
+extern PNG_EXPORT(void,png_set_mmx_thresholds)
+   PNGARG((png_structp png_ptr, png_byte mmx_bitdepth_threshold,
+   png_uint_32 mmx_rowbytes_threshold));
+
+#endif /* PNG_1_0_X */
+
+#ifndef PNG_1_0_X
+/* png.c, pnggccrd.c, or pngvcrd.c */
+extern PNG_EXPORT(int,png_mmx_support) PNGARG((void));
+#endif /* PNG_1_0_X */
+#endif /* PNG_ASSEMBLER_CODE_SUPPORTED */
+
+/* Strip the prepended error numbers ("#nnn ") from error and warning
+ * messages before passing them to the error or warning handler.
+ */
+#ifdef PNG_ERROR_NUMBERS_SUPPORTED
+extern PNG_EXPORT(void,png_set_strip_error_numbers) PNGARG((png_structp
+   png_ptr, png_uint_32 strip_mode));
+#endif
+
+/* Added at libpng-1.2.6 */
+#ifdef PNG_SET_USER_LIMITS_SUPPORTED
+extern PNG_EXPORT(void,png_set_user_limits) PNGARG((png_structp
+   png_ptr, png_uint_32 user_width_max, png_uint_32 user_height_max));
+extern PNG_EXPORT(png_uint_32,png_get_user_width_max) PNGARG((png_structp
+   png_ptr));
+extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp
+   png_ptr));
+#endif
+/* Maintainer: Put new public prototypes here ^, in libpng.3, and in
+ * project defs
+ */
+
+#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
+/* With these routines we avoid an integer divide, which will be slower on
+ * most machines.  However, it does take more operations than the corresponding
+ * divide method, so it may be slower on a few RISC systems.  There are two
+ * shifts (by 8 or 16 bits) and an addition, versus a single integer divide.
+ *
+ * Note that the rounding factors are NOT supposed to be the same!  128 and
+ * 32768 are correct for the NODIV code; 127 and 32767 are correct for the
+ * standard method.
+ *
+ * [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ]
+ */
+
+ /* fg and bg should be in `gamma 1.0' space; alpha is the opacity          */
+
+#  define png_composite(composite, fg, alpha, bg)                            \
+     { png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) * (png_uint_16)(alpha) \
+                        +        (png_uint_16)(bg)*(png_uint_16)(255 -       \
+                        (png_uint_16)(alpha)) + (png_uint_16)128);           \
+       (composite) = (png_byte)((temp + (temp >> 8)) >> 8); }
+
+#  define png_composite_16(composite, fg, alpha, bg)                         \
+     { png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) * (png_uint_32)(alpha) \
+                        + (png_uint_32)(bg)*(png_uint_32)(65535L -           \
+                        (png_uint_32)(alpha)) + (png_uint_32)32768L);        \
+       (composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); }
+
+#else  /* Standard method using integer division */
+
+#  define png_composite(composite, fg, alpha, bg)                            \
+     (composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) +    \
+       (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) +       \
+       (png_uint_16)127) / 255)
+
+#  define png_composite_16(composite, fg, alpha, bg)                         \
+     (composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \
+       (png_uint_32)(bg)*(png_uint_32)(65535L - (png_uint_32)(alpha)) +      \
+       (png_uint_32)32767) / (png_uint_32)65535L)
+
+#endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */
+
+/* Inline macros to do direct reads of bytes from the input buffer.  These
+ * require that you are using an architecture that uses PNG byte ordering
+ * (MSB first) and supports unaligned data storage.  I think that PowerPC
+ * in big-endian mode and 680x0 are the only ones that will support this.
+ * The x86 line of processors definitely do not.  The png_get_int_32()
+ * routine also assumes we are using two's complement format for negative
+ * values, which is almost certainly true.
+ */
+#ifdef PNG_READ_BIG_ENDIAN_SUPPORTED
+#  define png_get_uint_32(buf) ( *((png_uint_32p) (buf)))
+#  define png_get_uint_16(buf) ( *((png_uint_16p) (buf)))
+#  define png_get_int_32(buf)  ( *((png_int_32p)  (buf)))
+#else
+extern PNG_EXPORT(png_uint_32,png_get_uint_32) PNGARG((png_bytep buf));
+extern PNG_EXPORT(png_uint_16,png_get_uint_16) PNGARG((png_bytep buf));
+extern PNG_EXPORT(png_int_32,png_get_int_32) PNGARG((png_bytep buf));
+#endif /* !PNG_READ_BIG_ENDIAN_SUPPORTED */
+extern PNG_EXPORT(png_uint_32,png_get_uint_31)
+  PNGARG((png_structp png_ptr, png_bytep buf));
+/* No png_get_int_16 -- may be added if there's a real need for it. */
+
+/* Place a 32-bit number into a buffer in PNG byte order (big-endian).
+ */
+extern PNG_EXPORT(void,png_save_uint_32)
+   PNGARG((png_bytep buf, png_uint_32 i));
+extern PNG_EXPORT(void,png_save_int_32)
+   PNGARG((png_bytep buf, png_int_32 i));
+
+/* Place a 16-bit number into a buffer in PNG byte order.
+ * The parameter is declared unsigned int, not png_uint_16,
+ * just to avoid potential problems on pre-ANSI C compilers.
+ */
+extern PNG_EXPORT(void,png_save_uint_16)
+   PNGARG((png_bytep buf, unsigned int i));
+/* No png_save_int_16 -- may be added if there's a real need for it. */
+
+/* ************************************************************************* */
+
+/* These next functions are used internally in the code.  They generally
+ * shouldn't be used unless you are writing code to add or replace some
+ * functionality in libpng.  More information about most functions can
+ * be found in the files where the functions are located.
+ */
+
+
+/* Various modes of operation, that are visible to applications because
+ * they are used for unknown chunk location.
+ */
+#define PNG_HAVE_IHDR               0x01
+#define PNG_HAVE_PLTE               0x02
+#define PNG_HAVE_IDAT               0x04
+#define PNG_AFTER_IDAT              0x08 /* Have complete zlib datastream */
+#define PNG_HAVE_IEND               0x10
+
+#ifdef PNG_INTERNAL
+
+/* More modes of operation.  Note that after an init, mode is set to
+ * zero automatically when the structure is created.
+ */
+#define PNG_HAVE_gAMA               0x20
+#define PNG_HAVE_cHRM               0x40
+#define PNG_HAVE_sRGB               0x80
+#define PNG_HAVE_CHUNK_HEADER      0x100
+#define PNG_WROTE_tIME             0x200
+#define PNG_WROTE_INFO_BEFORE_PLTE 0x400
+#define PNG_BACKGROUND_IS_GRAY     0x800
+#define PNG_HAVE_PNG_SIGNATURE    0x1000
+#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000 /* Have another chunk after IDAT */
+
+/* Flags for the transformations the PNG library does on the image data */
+#define PNG_BGR                0x0001
+#define PNG_INTERLACE          0x0002
+#define PNG_PACK               0x0004
+#define PNG_SHIFT              0x0008
+#define PNG_SWAP_BYTES         0x0010
+#define PNG_INVERT_MONO        0x0020
+#define PNG_DITHER             0x0040
+#define PNG_BACKGROUND         0x0080
+#define PNG_BACKGROUND_EXPAND  0x0100
+                          /*   0x0200 unused */
+#define PNG_16_TO_8            0x0400
+#define PNG_RGBA               0x0800
+#define PNG_EXPAND             0x1000
+#define PNG_GAMMA              0x2000
+#define PNG_GRAY_TO_RGB        0x4000
+#define PNG_FILLER             0x8000L
+#define PNG_PACKSWAP          0x10000L
+#define PNG_SWAP_ALPHA        0x20000L
+#define PNG_STRIP_ALPHA       0x40000L
+#define PNG_INVERT_ALPHA      0x80000L
+#define PNG_USER_TRANSFORM   0x100000L
+#define PNG_RGB_TO_GRAY_ERR  0x200000L
+#define PNG_RGB_TO_GRAY_WARN 0x400000L
+#define PNG_RGB_TO_GRAY      0x600000L  /* two bits, RGB_TO_GRAY_ERR|WARN */
+                       /*    0x800000L     Unused */
+#define PNG_ADD_ALPHA       0x1000000L  /* Added to libpng-1.2.7 */
+#define PNG_EXPAND_tRNS     0x2000000L  /* Added to libpng-1.2.9 */
+#define PNG_PREMULTIPLY_ALPHA 0x4000000L  /* Added to libpng-1.2.41 */
+                                          /* by volker */
+                       /*   0x8000000L  unused */
+                       /*  0x10000000L  unused */
+                       /*  0x20000000L  unused */
+                       /*  0x40000000L  unused */
+
+/* Flags for png_create_struct */
+#define PNG_STRUCT_PNG   0x0001
+#define PNG_STRUCT_INFO  0x0002
+
+/* Scaling factor for filter heuristic weighting calculations */
+#define PNG_WEIGHT_SHIFT 8
+#define PNG_WEIGHT_FACTOR (1<<(PNG_WEIGHT_SHIFT))
+#define PNG_COST_SHIFT 3
+#define PNG_COST_FACTOR (1<<(PNG_COST_SHIFT))
+
+/* Flags for the png_ptr->flags rather than declaring a byte for each one */
+#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY     0x0001
+#define PNG_FLAG_ZLIB_CUSTOM_LEVEL        0x0002
+#define PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL    0x0004
+#define PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS  0x0008
+#define PNG_FLAG_ZLIB_CUSTOM_METHOD       0x0010
+#define PNG_FLAG_ZLIB_FINISHED            0x0020
+#define PNG_FLAG_ROW_INIT                 0x0040
+#define PNG_FLAG_FILLER_AFTER             0x0080
+#define PNG_FLAG_CRC_ANCILLARY_USE        0x0100
+#define PNG_FLAG_CRC_ANCILLARY_NOWARN     0x0200
+#define PNG_FLAG_CRC_CRITICAL_USE         0x0400
+#define PNG_FLAG_CRC_CRITICAL_IGNORE      0x0800
+#define PNG_FLAG_FREE_PLTE                0x1000
+#define PNG_FLAG_FREE_TRNS                0x2000
+#define PNG_FLAG_FREE_HIST                0x4000
+#define PNG_FLAG_KEEP_UNKNOWN_CHUNKS      0x8000L
+#define PNG_FLAG_KEEP_UNSAFE_CHUNKS       0x10000L
+#define PNG_FLAG_LIBRARY_MISMATCH         0x20000L
+#define PNG_FLAG_STRIP_ERROR_NUMBERS      0x40000L
+#define PNG_FLAG_STRIP_ERROR_TEXT         0x80000L
+#define PNG_FLAG_MALLOC_NULL_MEM_OK       0x100000L
+#define PNG_FLAG_ADD_ALPHA                0x200000L  /* Added to libpng-1.2.8 */
+#define PNG_FLAG_STRIP_ALPHA              0x400000L  /* Added to libpng-1.2.8 */
+                                  /*      0x800000L  unused */
+                                  /*     0x1000000L  unused */
+                                  /*     0x2000000L  unused */
+                                  /*     0x4000000L  unused */
+                                  /*     0x8000000L  unused */
+                                  /*    0x10000000L  unused */
+                                  /*    0x20000000L  unused */
+                                  /*    0x40000000L  unused */
+
+#define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \
+                                     PNG_FLAG_CRC_ANCILLARY_NOWARN)
+
+#define PNG_FLAG_CRC_CRITICAL_MASK  (PNG_FLAG_CRC_CRITICAL_USE | \
+                                     PNG_FLAG_CRC_CRITICAL_IGNORE)
+
+#define PNG_FLAG_CRC_MASK           (PNG_FLAG_CRC_ANCILLARY_MASK | \
+                                     PNG_FLAG_CRC_CRITICAL_MASK)
+
+/* Save typing and make code easier to understand */
+
+#define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \
+   abs((int)((c1).green) - (int)((c2).green)) + \
+   abs((int)((c1).blue) - (int)((c2).blue)))
+
+/* Added to libpng-1.2.6 JB */
+#define PNG_ROWBYTES(pixel_bits, width) \
+    ((pixel_bits) >= 8 ? \
+    ((width) * (((png_uint_32)(pixel_bits)) >> 3)) : \
+    (( ((width) * ((png_uint_32)(pixel_bits))) + 7) >> 3) )
+
+/* PNG_OUT_OF_RANGE returns true if value is outside the range
+ * ideal-delta..ideal+delta.  Each argument is evaluated twice.
+ * "ideal" and "delta" should be constants, normally simple
+ * integers, "value" a variable. Added to libpng-1.2.6 JB
+ */
+#define PNG_OUT_OF_RANGE(value, ideal, delta) \
+        ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) )
+
+/* Variables declared in png.c - only it needs to define PNG_NO_EXTERN */
+#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
+/* Place to hold the signature string for a PNG file. */
+#ifdef PNG_USE_GLOBAL_ARRAYS
+   PNG_EXPORT_VAR (PNG_CONST png_byte FARDATA) png_sig[8];
+#else
+#endif
+#endif /* PNG_NO_EXTERN */
+
+/* Constant strings for known chunk types.  If you need to add a chunk,
+ * define the name here, and add an invocation of the macro in png.c and
+ * wherever it's needed.
+ */
+#define PNG_IHDR png_byte png_IHDR[5] = { 73,  72,  68,  82, '\0'}
+#define PNG_IDAT png_byte png_IDAT[5] = { 73,  68,  65,  84, '\0'}
+#define PNG_IEND png_byte png_IEND[5] = { 73,  69,  78,  68, '\0'}
+#define PNG_PLTE png_byte png_PLTE[5] = { 80,  76,  84,  69, '\0'}
+#define PNG_bKGD png_byte png_bKGD[5] = { 98,  75,  71,  68, '\0'}
+#define PNG_cHRM png_byte png_cHRM[5] = { 99,  72,  82,  77, '\0'}
+#define PNG_gAMA png_byte png_gAMA[5] = {103,  65,  77,  65, '\0'}
+#define PNG_hIST png_byte png_hIST[5] = {104,  73,  83,  84, '\0'}
+#define PNG_iCCP png_byte png_iCCP[5] = {105,  67,  67,  80, '\0'}
+#define PNG_iTXt png_byte png_iTXt[5] = {105,  84,  88, 116, '\0'}
+#define PNG_oFFs png_byte png_oFFs[5] = {111,  70,  70, 115, '\0'}
+#define PNG_pCAL png_byte png_pCAL[5] = {112,  67,  65,  76, '\0'}
+#define PNG_sCAL png_byte png_sCAL[5] = {115,  67,  65,  76, '\0'}
+#define PNG_pHYs png_byte png_pHYs[5] = {112,  72,  89, 115, '\0'}
+#define PNG_sBIT png_byte png_sBIT[5] = {115,  66,  73,  84, '\0'}
+#define PNG_sPLT png_byte png_sPLT[5] = {115,  80,  76,  84, '\0'}
+#define PNG_sRGB png_byte png_sRGB[5] = {115,  82,  71,  66, '\0'}
+#define PNG_tEXt png_byte png_tEXt[5] = {116,  69,  88, 116, '\0'}
+#define PNG_tIME png_byte png_tIME[5] = {116,  73,  77,  69, '\0'}
+#define PNG_tRNS png_byte png_tRNS[5] = {116,  82,  78,  83, '\0'}
+#define PNG_zTXt png_byte png_zTXt[5] = {122,  84,  88, 116, '\0'}
+
+#ifdef PNG_USE_GLOBAL_ARRAYS
+PNG_EXPORT_VAR (png_byte FARDATA) png_IHDR[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_IDAT[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_IEND[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_PLTE[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_bKGD[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_cHRM[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_gAMA[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_hIST[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_iCCP[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_iTXt[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_oFFs[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_pCAL[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_sCAL[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_pHYs[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_sBIT[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_sPLT[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_sRGB[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_tEXt[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_tIME[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_tRNS[5];
+PNG_EXPORT_VAR (png_byte FARDATA) png_zTXt[5];
+#endif /* PNG_USE_GLOBAL_ARRAYS */
+
+#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
+/* Initialize png_ptr struct for reading, and allocate any other memory.
+ * (old interface - DEPRECATED - use png_create_read_struct instead).
+ */
+extern PNG_EXPORT(void,png_read_init) PNGARG((png_structp png_ptr))
+    PNG_DEPRECATED;
+#undef png_read_init
+#define png_read_init(png_ptr) png_read_init_3(&png_ptr, \
+    PNG_LIBPNG_VER_STRING,  png_sizeof(png_struct));
+#endif
+
+extern PNG_EXPORT(void,png_read_init_3) PNGARG((png_structpp ptr_ptr,
+    png_const_charp user_png_ver, png_size_t png_struct_size));
+#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
+extern PNG_EXPORT(void,png_read_init_2) PNGARG((png_structp png_ptr,
+    png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t
+    png_info_size));
+#endif
+
+#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
+/* Initialize png_ptr struct for writing, and allocate any other memory.
+ * (old interface - DEPRECATED - use png_create_write_struct instead).
+ */
+extern PNG_EXPORT(void,png_write_init) PNGARG((png_structp png_ptr))
+    PNG_DEPRECATED;
+#undef png_write_init
+#define png_write_init(png_ptr) png_write_init_3(&png_ptr, \
+    PNG_LIBPNG_VER_STRING, png_sizeof(png_struct));
+#endif
+
+extern PNG_EXPORT(void,png_write_init_3) PNGARG((png_structpp ptr_ptr,
+    png_const_charp user_png_ver, png_size_t png_struct_size));
+extern PNG_EXPORT(void,png_write_init_2) PNGARG((png_structp png_ptr,
+    png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t
+    png_info_size));
+
+/* Allocate memory for an internal libpng struct */
+PNG_EXTERN png_voidp png_create_struct PNGARG((int type)) PNG_PRIVATE;
+
+/* Free memory from internal libpng struct */
+PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr)) PNG_PRIVATE;
+
+PNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr
+  malloc_fn, png_voidp mem_ptr)) PNG_PRIVATE;
+PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr,
+   png_free_ptr free_fn, png_voidp mem_ptr)) PNG_PRIVATE;
+
+/* Free any memory that info_ptr points to and reset struct. */
+PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr,
+   png_infop info_ptr)) PNG_PRIVATE;
+
+#ifndef PNG_1_0_X
+/* Function to allocate memory for zlib. */
+PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items,
+   uInt size)) PNG_PRIVATE;
+
+/* Function to free memory for zlib */
+PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr)) PNG_PRIVATE;
+
+#ifdef PNG_SIZE_T
+/* Function to convert a sizeof an item to png_sizeof item */
+   PNG_EXTERN png_size_t PNGAPI png_convert_size PNGARG((size_t size))
+      PNG_PRIVATE;
+#endif
+
+/* Next four functions are used internally as callbacks.  PNGAPI is required
+ * but not PNG_EXPORT.  PNGAPI added at libpng version 1.2.3.
+ */
+
+PNG_EXTERN void PNGAPI png_default_read_data PNGARG((png_structp png_ptr,
+   png_bytep data, png_size_t length)) PNG_PRIVATE;
+
+#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
+PNG_EXTERN void PNGAPI png_push_fill_buffer PNGARG((png_structp png_ptr,
+   png_bytep buffer, png_size_t length)) PNG_PRIVATE;
+#endif
+
+PNG_EXTERN void PNGAPI png_default_write_data PNGARG((png_structp png_ptr,
+   png_bytep data, png_size_t length)) PNG_PRIVATE;
+
+#ifdef PNG_WRITE_FLUSH_SUPPORTED
+#ifdef PNG_STDIO_SUPPORTED
+PNG_EXTERN void PNGAPI png_default_flush PNGARG((png_structp png_ptr))
+   PNG_PRIVATE;
+#endif
+#endif
+#else /* PNG_1_0_X */
+#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
+PNG_EXTERN void png_push_fill_buffer PNGARG((png_structp png_ptr,
+   png_bytep buffer, png_size_t length)) PNG_PRIVATE;
+#endif
+#endif /* PNG_1_0_X */
+
+/* Reset the CRC variable */
+PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+
+/* Write the "data" buffer to whatever output you are using. */
+PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, png_bytep data,
+   png_size_t length)) PNG_PRIVATE;
+
+/* Read data from whatever input you are using into the "data" buffer */
+PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data,
+   png_size_t length)) PNG_PRIVATE;
+
+/* Read bytes into buf, and update png_ptr->crc */
+PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf,
+   png_size_t length)) PNG_PRIVATE;
+
+/* Decompress data in a chunk that uses compression */
+#if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \
+    defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED)
+PNG_EXTERN void png_decompress_chunk PNGARG((png_structp png_ptr,
+   int comp_type, png_size_t chunklength,
+   png_size_t prefix_length, png_size_t *data_length)) PNG_PRIVATE;
+#endif
+
+/* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */
+PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip)
+   PNG_PRIVATE);
+
+/* Read the CRC from the file and compare it to the libpng calculated CRC */
+PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+
+/* Calculate the CRC over a section of data.  Note that we are only
+ * passing a maximum of 64K on systems that have this as a memory limit,
+ * since this is the maximum buffer size we can specify.
+ */
+PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr,
+   png_size_t length)) PNG_PRIVATE;
+
+#ifdef PNG_WRITE_FLUSH_SUPPORTED
+PNG_EXTERN void png_flush PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+#endif
+
+/* Simple function to write the signature */
+PNG_EXTERN void png_write_sig PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+
+/* Write various chunks */
+
+/* Write the IHDR chunk, and update the png_struct with the necessary
+ * information.
+ */
+PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width,
+   png_uint_32 height,
+   int bit_depth, int color_type, int compression_method, int filter_method,
+   int interlace_method)) PNG_PRIVATE;
+
+PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette,
+   png_uint_32 num_pal)) PNG_PRIVATE;
+
+PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data,
+   png_size_t length)) PNG_PRIVATE;
+
+PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+
+#ifdef PNG_WRITE_gAMA_SUPPORTED
+#ifdef PNG_FLOATING_POINT_SUPPORTED
+PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma))
+    PNG_PRIVATE;
+#endif
+#ifdef PNG_FIXED_POINT_SUPPORTED
+PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr,
+    png_fixed_point file_gamma)) PNG_PRIVATE;
+#endif
+#endif
+
+#ifdef PNG_WRITE_sBIT_SUPPORTED
+PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit,
+   int color_type)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_WRITE_cHRM_SUPPORTED
+#ifdef PNG_FLOATING_POINT_SUPPORTED
+PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr,
+   double white_x, double white_y,
+   double red_x, double red_y, double green_x, double green_y,
+   double blue_x, double blue_y)) PNG_PRIVATE;
+#endif
+#ifdef PNG_FIXED_POINT_SUPPORTED
+PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr,
+   png_fixed_point int_white_x, png_fixed_point int_white_y,
+   png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
+   int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
+   png_fixed_point int_blue_y)) PNG_PRIVATE;
+#endif
+#endif
+
+#ifdef PNG_WRITE_sRGB_SUPPORTED
+PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr,
+   int intent)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_WRITE_iCCP_SUPPORTED
+PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr,
+   png_charp name, int compression_type,
+   png_charp profile, int proflen)) PNG_PRIVATE;
+   /* Note to maintainer: profile should be png_bytep */
+#endif
+
+#ifdef PNG_WRITE_sPLT_SUPPORTED
+PNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr,
+   png_sPLT_tp palette)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_WRITE_tRNS_SUPPORTED
+PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans,
+   png_color_16p values, int number, int color_type)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_WRITE_bKGD_SUPPORTED
+PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr,
+   png_color_16p values, int color_type)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_WRITE_hIST_SUPPORTED
+PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist,
+   int num_hist)) PNG_PRIVATE;
+#endif
+
+#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
+    defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
+PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr,
+   png_charp key, png_charpp new_key)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_WRITE_tEXt_SUPPORTED
+PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key,
+   png_charp text, png_size_t text_len)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_WRITE_zTXt_SUPPORTED
+PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key,
+   png_charp text, png_size_t text_len, int compression)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_WRITE_iTXt_SUPPORTED
+PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr,
+   int compression, png_charp key, png_charp lang, png_charp lang_key,
+   png_charp text)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_TEXT_SUPPORTED  /* Added at version 1.0.14 and 1.2.4 */
+PNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_textp text_ptr, int num_text)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_WRITE_oFFs_SUPPORTED
+PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr,
+   png_int_32 x_offset, png_int_32 y_offset, int unit_type)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_WRITE_pCAL_SUPPORTED
+PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose,
+   png_int_32 X0, png_int_32 X1, int type, int nparams,
+   png_charp units, png_charpp params)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_WRITE_pHYs_SUPPORTED
+PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr,
+   png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit,
+   int unit_type)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_WRITE_tIME_SUPPORTED
+PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr,
+   png_timep mod_time)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_WRITE_sCAL_SUPPORTED
+#if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO)
+PNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr,
+   int unit, double width, double height)) PNG_PRIVATE;
+#else
+#ifdef PNG_FIXED_POINT_SUPPORTED
+PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr,
+   int unit, png_charp width, png_charp height)) PNG_PRIVATE;
+#endif
+#endif
+#endif
+
+/* Called when finished processing a row of data */
+PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+
+/* Internal use only.   Called before first row of data */
+PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+
+#ifdef PNG_READ_GAMMA_SUPPORTED
+PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+#endif
+
+/* Combine a row of data, dealing with alpha, etc. if requested */
+PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row,
+   int mask)) PNG_PRIVATE;
+
+#ifdef PNG_READ_INTERLACING_SUPPORTED
+/* Expand an interlaced row */
+/* OLD pre-1.0.9 interface:
+PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info,
+   png_bytep row, int pass, png_uint_32 transformations)) PNG_PRIVATE;
+ */
+PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+#endif
+
+/* GRR TO DO (2.0 or whenever):  simplify other internal calling interfaces */
+
+#ifdef PNG_WRITE_INTERLACING_SUPPORTED
+/* Grab pixels out of a row for an interlaced pass */
+PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info,
+   png_bytep row, int pass)) PNG_PRIVATE;
+#endif
+
+/* Unfilter a row */
+PNG_EXTERN void png_read_filter_row PNGARG((png_structp png_ptr,
+   png_row_infop row_info, png_bytep row, png_bytep prev_row,
+   int filter)) PNG_PRIVATE;
+
+/* Choose the best filter to use and filter the row data */
+PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr,
+   png_row_infop row_info)) PNG_PRIVATE;
+
+/* Write out the filtered row. */
+PNG_EXTERN void png_write_filtered_row PNGARG((png_structp png_ptr,
+   png_bytep filtered_row)) PNG_PRIVATE;
+/* Finish a row while reading, dealing with interlacing passes, etc. */
+PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr));
+
+/* Initialize the row buffers, etc. */
+PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+/* Optional call to update the users info structure */
+PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr,
+   png_infop info_ptr)) PNG_PRIVATE;
+
+/* These are the functions that do the transformations */
+#ifdef PNG_READ_FILLER_SUPPORTED
+PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info,
+   png_bytep row, png_uint_32 filler, png_uint_32 flags)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
+PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info,
+   png_bytep row)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
+PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info,
+   png_bytep row)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
+PNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info,
+   png_bytep row)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
+PNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info,
+   png_bytep row)) PNG_PRIVATE;
+#endif
+
+#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
+    defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
+PNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info,
+   png_bytep row, png_uint_32 flags)) PNG_PRIVATE;
+#endif
+
+#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
+PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info,
+    png_bytep row)) PNG_PRIVATE;
+#endif
+
+#if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED)
+PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info,
+    png_bytep row)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
+PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, png_row_infop
+   row_info, png_bytep row)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
+PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info,
+   png_bytep row)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_READ_PACK_SUPPORTED
+PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info,
+    png_bytep row)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_READ_SHIFT_SUPPORTED
+PNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info, png_bytep row,
+   png_color_8p sig_bits)) PNG_PRIVATE;
+#endif
+
+#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
+PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info,
+    png_bytep row)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_READ_16_TO_8_SUPPORTED
+PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info,
+    png_bytep row)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_READ_DITHER_SUPPORTED
+PNG_EXTERN void png_do_dither PNGARG((png_row_infop row_info,
+   png_bytep row, png_bytep palette_lookup,
+    png_bytep dither_lookup)) PNG_PRIVATE;
+
+#  ifdef PNG_CORRECT_PALETTE_SUPPORTED
+PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr,
+   png_colorp palette, int num_palette)) PNG_PRIVATE;
+#  endif
+#endif
+
+#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
+PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info,
+    png_bytep row)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_WRITE_PACK_SUPPORTED
+PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info,
+   png_bytep row, png_uint_32 bit_depth)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_WRITE_SHIFT_SUPPORTED
+PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, png_bytep row,
+   png_color_8p bit_depth)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_READ_BACKGROUND_SUPPORTED
+#ifdef PNG_READ_GAMMA_SUPPORTED
+PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
+   png_color_16p trans_values, png_color_16p background,
+   png_color_16p background_1,
+   png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1,
+   png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1,
+   png_uint_16pp gamma_16_to_1, int gamma_shift)) PNG_PRIVATE;
+#else
+PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
+   png_color_16p trans_values, png_color_16p background)) PNG_PRIVATE;
+#endif
+#endif
+
+#ifdef PNG_READ_GAMMA_SUPPORTED
+PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, png_bytep row,
+   png_bytep gamma_table, png_uint_16pp gamma_16_table,
+   int gamma_shift)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_READ_EXPAND_SUPPORTED
+PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info,
+   png_bytep row, png_colorp palette, png_bytep trans,
+   int num_trans)) PNG_PRIVATE;
+PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info,
+   png_bytep row, png_color_16p trans_value)) PNG_PRIVATE;
+#endif
+
+/* The following decodes the appropriate chunks, and does error correction,
+ * then calls the appropriate callback for the chunk if it is valid.
+ */
+
+/* Decode the IHDR chunk */
+PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr,
+   png_uint_32 length)) PNG_PRIVATE;
+PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr,
+   png_uint_32 length));
+PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr,
+   png_uint_32 length));
+
+#ifdef PNG_READ_bKGD_SUPPORTED
+PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr,
+   png_uint_32 length)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_READ_cHRM_SUPPORTED
+PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr,
+   png_uint_32 length)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_READ_gAMA_SUPPORTED
+PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr,
+   png_uint_32 length)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_READ_hIST_SUPPORTED
+PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr,
+   png_uint_32 length)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_READ_iCCP_SUPPORTED
+extern void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr,
+   png_uint_32 length));
+#endif /* PNG_READ_iCCP_SUPPORTED */
+
+#ifdef PNG_READ_iTXt_SUPPORTED
+PNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
+   png_uint_32 length)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_READ_oFFs_SUPPORTED
+PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr,
+   png_uint_32 length)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_READ_pCAL_SUPPORTED
+PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
+   png_uint_32 length)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_READ_pHYs_SUPPORTED
+PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr,
+   png_uint_32 length)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_READ_sBIT_SUPPORTED
+PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr,
+   png_uint_32 length)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_READ_sCAL_SUPPORTED
+PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
+   png_uint_32 length)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_READ_sPLT_SUPPORTED
+extern void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr,
+   png_uint_32 length)) PNG_PRIVATE;
+#endif /* PNG_READ_sPLT_SUPPORTED */
+
+#ifdef PNG_READ_sRGB_SUPPORTED
+PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr,
+   png_uint_32 length)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_READ_tEXt_SUPPORTED
+PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr,
+   png_uint_32 length)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_READ_tIME_SUPPORTED
+PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr,
+   png_uint_32 length)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_READ_tRNS_SUPPORTED
+PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr,
+   png_uint_32 length)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_READ_zTXt_SUPPORTED
+PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
+   png_uint_32 length)) PNG_PRIVATE;
+#endif
+
+PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_uint_32 length)) PNG_PRIVATE;
+
+PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr,
+   png_bytep chunk_name)) PNG_PRIVATE;
+
+/* Handle the transformations for reading and writing */
+PNG_EXTERN void png_do_read_transformations
+   PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+PNG_EXTERN void png_do_write_transformations
+   PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+
+PNG_EXTERN void png_init_read_transformations
+   PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+
+#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
+PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr,
+   png_infop info_ptr)) PNG_PRIVATE;
+PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr,
+   png_infop info_ptr)) PNG_PRIVATE;
+PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr,
+   png_uint_32 length)) PNG_PRIVATE;
+PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr,
+   png_bytep buffer, png_size_t buffer_length)) PNG_PRIVATE;
+PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr,
+   png_bytep buffer, png_size_t buffer_length)) PNG_PRIVATE;
+PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_uint_32 length)) PNG_PRIVATE;
+PNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr,
+   png_infop info_ptr)) PNG_PRIVATE;
+PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr,
+   png_infop info_ptr)) PNG_PRIVATE;
+PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr,
+   png_bytep row)) PNG_PRIVATE;
+PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr,
+   png_infop info_ptr)) PNG_PRIVATE;
+PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr,
+   png_infop info_ptr)) PNG_PRIVATE;
+PNG_EXTERN void png_read_push_finish_row
+   PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+#ifdef PNG_READ_tEXt_SUPPORTED
+PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_uint_32 length)) PNG_PRIVATE;
+PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr,
+   png_infop info_ptr)) PNG_PRIVATE;
+#endif
+#ifdef PNG_READ_zTXt_SUPPORTED
+PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_uint_32 length)) PNG_PRIVATE;
+PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr,
+   png_infop info_ptr)) PNG_PRIVATE;
+#endif
+#ifdef PNG_READ_iTXt_SUPPORTED
+PNG_EXTERN void png_push_handle_iTXt PNGARG((png_structp png_ptr,
+   png_infop info_ptr, png_uint_32 length)) PNG_PRIVATE;
+PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr,
+   png_infop info_ptr)) PNG_PRIVATE;
+#endif
+
+#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
+
+#ifdef PNG_MNG_FEATURES_SUPPORTED
+PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info,
+   png_bytep row)) PNG_PRIVATE;
+PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info,
+   png_bytep row)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
+#ifdef PNG_MMX_CODE_SUPPORTED
+/* png.c */ /* PRIVATE */
+PNG_EXTERN void png_init_mmx_flags PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+#endif
+#endif
+
+
+/* The following six functions will be exported in libpng-1.4.0. */
+#if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED)
+PNG_EXTERN png_uint_32 png_get_pixels_per_inch PNGARG((png_structp png_ptr,
+png_infop info_ptr));
+
+PNG_EXTERN png_uint_32 png_get_x_pixels_per_inch PNGARG((png_structp png_ptr,
+png_infop info_ptr));
+
+PNG_EXTERN png_uint_32 png_get_y_pixels_per_inch PNGARG((png_structp png_ptr,
+png_infop info_ptr));
+
+PNG_EXTERN float png_get_x_offset_inches PNGARG((png_structp png_ptr,
+png_infop info_ptr));
+
+PNG_EXTERN float png_get_y_offset_inches PNGARG((png_structp png_ptr,
+png_infop info_ptr));
+
+#ifdef PNG_pHYs_SUPPORTED
+PNG_EXTERN png_uint_32 png_get_pHYs_dpi PNGARG((png_structp png_ptr,
+png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));
+#endif /* PNG_pHYs_SUPPORTED */
+#endif  /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */
+
+/* Read the chunk header (length + type name) */
+PNG_EXTERN png_uint_32 png_read_chunk_header
+   PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+
+/* Added at libpng version 1.2.34 */
+#ifdef PNG_cHRM_SUPPORTED
+PNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structp png_ptr,
+   png_fixed_point int_white_x, png_fixed_point int_white_y,
+   png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
+   int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
+   png_fixed_point int_blue_y)) PNG_PRIVATE;
+#endif
+
+#ifdef PNG_cHRM_SUPPORTED
+#ifdef PNG_CHECK_cHRM_SUPPORTED
+/* Added at libpng version 1.2.34 */
+PNG_EXTERN void png_64bit_product PNGARG((long v1, long v2,
+   unsigned long *hi_product, unsigned long *lo_product)) PNG_PRIVATE;
+#endif
+#endif
+
+/* Added at libpng version 1.2.41 */
+PNG_EXTERN void png_check_IHDR PNGARG((png_structp png_ptr,
+   png_uint_32 width, png_uint_32 height, int bit_depth,
+   int color_type, int interlace_type, int compression_type,
+   int filter_type)) PNG_PRIVATE;
+
+/* Added at libpng version 1.2.41 */
+PNG_EXTERN png_voidp png_calloc PNGARG((png_structp png_ptr,
+   png_uint_32 size));
+
+/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
+
+#endif /* PNG_INTERNAL */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* PNG_VERSION_INFO_ONLY */
+/* Do not put anything past this line */
+#endif /* PNG_H */
diff --git a/src/modules/tracepath/pngconf.h b/src/modules/tracepath/pngconf.h
new file mode 100644 (file)
index 0000000..042a5e9
--- /dev/null
@@ -0,0 +1,1665 @@
+
+/* pngconf.h - machine configurable file for libpng
+ *
+ * libpng version 1.2.50 - July 10, 2012
+ * Copyright (c) 1998-2012 Glenn Randers-Pehrson
+ * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
+ * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
+ *
+ * This code is released under the libpng license.
+ * For conditions of distribution and use, see the disclaimer
+ * and license in png.h
+ */
+
+/* Any machine specific code is near the front of this file, so if you
+ * are configuring libpng for a machine, you may want to read the section
+ * starting here down to where it starts to typedef png_color, png_text,
+ * and png_info.
+ */
+
+#ifndef PNGCONF_H
+#define PNGCONF_H
+
+#define PNG_1_2_X
+
+/*
+ * PNG_USER_CONFIG has to be defined on the compiler command line. This
+ * includes the resource compiler for Windows DLL configurations.
+ */
+#ifdef PNG_USER_CONFIG
+#  ifndef PNG_USER_PRIVATEBUILD
+#    define PNG_USER_PRIVATEBUILD
+#  endif
+#include "pngusr.h"
+#endif
+
+/* PNG_CONFIGURE_LIBPNG is set by the "configure" script. */
+#ifdef PNG_CONFIGURE_LIBPNG
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#endif
+
+/*
+ * Added at libpng-1.2.8
+ *
+ * If you create a private DLL you need to define in "pngusr.h" the followings:
+ * #define PNG_USER_PRIVATEBUILD <Describes by whom and why this version of
+ *        the DLL was built>
+ *  e.g. #define PNG_USER_PRIVATEBUILD "Build by MyCompany for xyz reasons."
+ * #define PNG_USER_DLLFNAME_POSTFIX <two-letter postfix that serve to
+ *        distinguish your DLL from those of the official release. These
+ *        correspond to the trailing letters that come after the version
+ *        number and must match your private DLL name>
+ *  e.g. // private DLL "libpng13gx.dll"
+ *       #define PNG_USER_DLLFNAME_POSTFIX "gx"
+ *
+ * The following macros are also at your disposal if you want to complete the
+ * DLL VERSIONINFO structure.
+ * - PNG_USER_VERSIONINFO_COMMENTS
+ * - PNG_USER_VERSIONINFO_COMPANYNAME
+ * - PNG_USER_VERSIONINFO_LEGALTRADEMARKS
+ */
+
+#ifdef __STDC__
+#ifdef SPECIALBUILD
+#  pragma message("PNG_LIBPNG_SPECIALBUILD (and deprecated SPECIALBUILD)\
+ are now LIBPNG reserved macros. Use PNG_USER_PRIVATEBUILD instead.")
+#endif
+
+#ifdef PRIVATEBUILD
+# pragma message("PRIVATEBUILD is deprecated.\
+ Use PNG_USER_PRIVATEBUILD instead.")
+# define PNG_USER_PRIVATEBUILD PRIVATEBUILD
+#endif
+#endif /* __STDC__ */
+
+#ifndef PNG_VERSION_INFO_ONLY
+
+/* End of material added to libpng-1.2.8 */
+
+/* Added at libpng-1.2.19, removed at libpng-1.2.20 because it caused trouble
+   Restored at libpng-1.2.21 */
+#if !defined(PNG_NO_WARN_UNINITIALIZED_ROW) && \
+    !defined(PNG_WARN_UNINITIALIZED_ROW)
+#  define PNG_WARN_UNINITIALIZED_ROW 1
+#endif
+/* End of material added at libpng-1.2.19/1.2.21 */
+
+/* This is the size of the compression buffer, and thus the size of
+ * an IDAT chunk.  Make this whatever size you feel is best for your
+ * machine.  One of these will be allocated per png_struct.  When this
+ * is full, it writes the data to the disk, and does some other
+ * calculations.  Making this an extremely small size will slow
+ * the library down, but you may want to experiment to determine
+ * where it becomes significant, if you are concerned with memory
+ * usage.  Note that zlib allocates at least 32Kb also.  For readers,
+ * this describes the size of the buffer available to read the data in.
+ * Unless this gets smaller than the size of a row (compressed),
+ * it should not make much difference how big this is.
+ */
+
+#ifndef PNG_ZBUF_SIZE
+#  define PNG_ZBUF_SIZE 8192
+#endif
+
+/* Enable if you want a write-only libpng */
+
+#ifndef PNG_NO_READ_SUPPORTED
+#  define PNG_READ_SUPPORTED
+#endif
+
+/* Enable if you want a read-only libpng */
+
+#ifndef PNG_NO_WRITE_SUPPORTED
+#  define PNG_WRITE_SUPPORTED
+#endif
+
+/* Enabled in 1.2.41. */
+#ifdef PNG_ALLOW_BENIGN_ERRORS
+#  define png_benign_error png_warning
+#  define png_chunk_benign_error png_chunk_warning
+#else
+#  ifndef PNG_BENIGN_ERRORS_SUPPORTED
+#    define png_benign_error png_error
+#    define png_chunk_benign_error png_chunk_error
+#  endif
+#endif
+
+/* Added in libpng-1.2.41 */
+#if !defined(PNG_NO_WARNINGS) && !defined(PNG_WARNINGS_SUPPORTED)
+#  define PNG_WARNINGS_SUPPORTED
+#endif
+
+#if !defined(PNG_NO_ERROR_TEXT) && !defined(PNG_ERROR_TEXT_SUPPORTED)
+#  define PNG_ERROR_TEXT_SUPPORTED
+#endif
+
+#if !defined(PNG_NO_CHECK_cHRM) && !defined(PNG_CHECK_cHRM_SUPPORTED)
+#  define PNG_CHECK_cHRM_SUPPORTED
+#endif
+
+/* Enabled by default in 1.2.0.  You can disable this if you don't need to
+ * support PNGs that are embedded in MNG datastreams
+ */
+#if !defined(PNG_1_0_X) && !defined(PNG_NO_MNG_FEATURES)
+#  ifndef PNG_MNG_FEATURES_SUPPORTED
+#    define PNG_MNG_FEATURES_SUPPORTED
+#  endif
+#endif
+
+#ifndef PNG_NO_FLOATING_POINT_SUPPORTED
+#  ifndef PNG_FLOATING_POINT_SUPPORTED
+#    define PNG_FLOATING_POINT_SUPPORTED
+#  endif
+#endif
+
+/* If you are running on a machine where you cannot allocate more
+ * than 64K of memory at once, uncomment this.  While libpng will not
+ * normally need that much memory in a chunk (unless you load up a very
+ * large file), zlib needs to know how big of a chunk it can use, and
+ * libpng thus makes sure to check any memory allocation to verify it
+ * will fit into memory.
+#define PNG_MAX_MALLOC_64K
+ */
+#if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K)
+#  define PNG_MAX_MALLOC_64K
+#endif
+
+/* Special munging to support doing things the 'cygwin' way:
+ * 'Normal' png-on-win32 defines/defaults:
+ *   PNG_BUILD_DLL -- building dll
+ *   PNG_USE_DLL   -- building an application, linking to dll
+ *   (no define)   -- building static library, or building an
+ *                    application and linking to the static lib
+ * 'Cygwin' defines/defaults:
+ *   PNG_BUILD_DLL -- (ignored) building the dll
+ *   (no define)   -- (ignored) building an application, linking to the dll
+ *   PNG_STATIC    -- (ignored) building the static lib, or building an
+ *                    application that links to the static lib.
+ *   ALL_STATIC    -- (ignored) building various static libs, or building an
+ *                    application that links to the static libs.
+ * Thus,
+ * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and
+ * this bit of #ifdefs will define the 'correct' config variables based on
+ * that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but
+ * unnecessary.
+ *
+ * Also, the precedence order is:
+ *   ALL_STATIC (since we can't #undef something outside our namespace)
+ *   PNG_BUILD_DLL
+ *   PNG_STATIC
+ *   (nothing) == PNG_USE_DLL
+ *
+ * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent
+ *   of auto-import in binutils, we no longer need to worry about
+ *   __declspec(dllexport) / __declspec(dllimport) and friends.  Therefore,
+ *   we don't need to worry about PNG_STATIC or ALL_STATIC when it comes
+ *   to __declspec() stuff.  However, we DO need to worry about
+ *   PNG_BUILD_DLL and PNG_STATIC because those change some defaults
+ *   such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed.
+ */
+#ifdef __CYGWIN__
+#  ifdef ALL_STATIC
+#    ifdef PNG_BUILD_DLL
+#      undef PNG_BUILD_DLL
+#    endif
+#    ifdef PNG_USE_DLL
+#      undef PNG_USE_DLL
+#    endif
+#    ifdef PNG_DLL
+#      undef PNG_DLL
+#    endif
+#    ifndef PNG_STATIC
+#      define PNG_STATIC
+#    endif
+#  else
+#    ifdef PNG_BUILD_DLL
+#      ifdef PNG_STATIC
+#        undef PNG_STATIC
+#      endif
+#      ifdef PNG_USE_DLL
+#        undef PNG_USE_DLL
+#      endif
+#      ifndef PNG_DLL
+#        define PNG_DLL
+#      endif
+#    else
+#      ifdef PNG_STATIC
+#        ifdef PNG_USE_DLL
+#          undef PNG_USE_DLL
+#        endif
+#        ifdef PNG_DLL
+#          undef PNG_DLL
+#        endif
+#      else
+#        ifndef PNG_USE_DLL
+#          define PNG_USE_DLL
+#        endif
+#        ifndef PNG_DLL
+#          define PNG_DLL
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+/* This protects us against compilers that run on a windowing system
+ * and thus don't have or would rather us not use the stdio types:
+ * stdin, stdout, and stderr.  The only one currently used is stderr
+ * in png_error() and png_warning().  #defining PNG_NO_CONSOLE_IO will
+ * prevent these from being compiled and used. #defining PNG_NO_STDIO
+ * will also prevent these, plus will prevent the entire set of stdio
+ * macros and functions (FILE *, printf, etc.) from being compiled and used,
+ * unless (PNG_DEBUG > 0) has been #defined.
+ *
+ * #define PNG_NO_CONSOLE_IO
+ * #define PNG_NO_STDIO
+ */
+
+#if !defined(PNG_NO_STDIO) && !defined(PNG_STDIO_SUPPORTED)
+#  define PNG_STDIO_SUPPORTED
+#endif
+
+#ifdef _WIN32_WCE
+#  include <windows.h>
+   /* Console I/O functions are not supported on WindowsCE */
+#  define PNG_NO_CONSOLE_IO
+   /* abort() may not be supported on some/all Windows CE platforms */
+#  define PNG_ABORT() exit(-1)
+#  ifdef PNG_DEBUG
+#    undef PNG_DEBUG
+#  endif
+#endif
+
+#ifdef PNG_BUILD_DLL
+#  ifndef PNG_CONSOLE_IO_SUPPORTED
+#    ifndef PNG_NO_CONSOLE_IO
+#      define PNG_NO_CONSOLE_IO
+#    endif
+#  endif
+#endif
+
+#  ifdef PNG_NO_STDIO
+#    ifndef PNG_NO_CONSOLE_IO
+#      define PNG_NO_CONSOLE_IO
+#    endif
+#    ifdef PNG_DEBUG
+#      if (PNG_DEBUG > 0)
+#        include <stdio.h>
+#      endif
+#    endif
+#  else
+#    ifndef _WIN32_WCE
+/* "stdio.h" functions are not supported on WindowsCE */
+#      include <stdio.h>
+#    endif
+#  endif
+
+#if !(defined PNG_NO_CONSOLE_IO) && !defined(PNG_CONSOLE_IO_SUPPORTED)
+#  define PNG_CONSOLE_IO_SUPPORTED
+#endif
+
+/* This macro protects us against machines that don't have function
+ * prototypes (ie K&R style headers).  If your compiler does not handle
+ * function prototypes, define this macro and use the included ansi2knr.
+ * I've always been able to use _NO_PROTO as the indicator, but you may
+ * need to drag the empty declaration out in front of here, or change the
+ * ifdef to suit your own needs.
+ */
+#ifndef PNGARG
+
+#ifdef OF /* zlib prototype munger */
+#  define PNGARG(arglist) OF(arglist)
+#else
+
+#ifdef _NO_PROTO
+#  define PNGARG(arglist) ()
+#  ifndef PNG_TYPECAST_NULL
+#     define PNG_TYPECAST_NULL
+#  endif
+#else
+#  define PNGARG(arglist) arglist
+#endif /* _NO_PROTO */
+
+
+#endif /* OF */
+
+#endif /* PNGARG */
+
+/* Try to determine if we are compiling on a Mac.  Note that testing for
+ * just __MWERKS__ is not good enough, because the Codewarrior is now used
+ * on non-Mac platforms.
+ */
+#ifndef MACOS
+#  if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
+      defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
+#    define MACOS
+#  endif
+#endif
+
+/* enough people need this for various reasons to include it here */
+#if !defined(MACOS) && !defined(RISCOS) && !defined(_WIN32_WCE)
+#  include <sys/types.h>
+#endif
+
+#if !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED)
+#  define PNG_SETJMP_SUPPORTED
+#endif
+
+#ifdef PNG_SETJMP_SUPPORTED
+/* This is an attempt to force a single setjmp behaviour on Linux.  If
+ * the X config stuff didn't define _BSD_SOURCE we wouldn't need this.
+ *
+ * You can bypass this test if you know that your application uses exactly
+ * the same setjmp.h that was included when libpng was built.  Only define
+ * PNG_SKIP_SETJMP_CHECK while building your application, prior to the
+ * application's '#include "png.h"'. Don't define PNG_SKIP_SETJMP_CHECK
+ * while building a separate libpng library for general use.
+ */
+
+#  ifndef PNG_SKIP_SETJMP_CHECK
+#    ifdef __linux__
+#      ifdef _BSD_SOURCE
+#        define PNG_SAVE_BSD_SOURCE
+#        undef _BSD_SOURCE
+#      endif
+#      ifdef _SETJMP_H
+       /* If you encounter a compiler error here, see the explanation
+        * near the end of INSTALL.
+        */
+           __pngconf.h__ in libpng already includes setjmp.h;
+           __dont__ include it again.;
+#      endif
+#    endif /* __linux__ */
+#  endif /* PNG_SKIP_SETJMP_CHECK */
+
+   /* include setjmp.h for error handling */
+#  include <setjmp.h>
+
+#  ifdef __linux__
+#    ifdef PNG_SAVE_BSD_SOURCE
+#      ifndef _BSD_SOURCE
+#        define _BSD_SOURCE
+#      endif
+#      undef PNG_SAVE_BSD_SOURCE
+#    endif
+#  endif /* __linux__ */
+#endif /* PNG_SETJMP_SUPPORTED */
+
+#ifdef BSD
+#  include <strings.h>
+#else
+#  include <string.h>
+#endif
+
+/* Other defines for things like memory and the like can go here.  */
+#ifdef PNG_INTERNAL
+
+#include <stdlib.h>
+
+/* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which
+ * aren't usually used outside the library (as far as I know), so it is
+ * debatable if they should be exported at all.  In the future, when it is
+ * possible to have run-time registry of chunk-handling functions, some of
+ * these will be made available again.
+#define PNG_EXTERN extern
+ */
+#define PNG_EXTERN
+
+/* Other defines specific to compilers can go here.  Try to keep
+ * them inside an appropriate ifdef/endif pair for portability.
+ */
+
+#ifdef PNG_FLOATING_POINT_SUPPORTED
+#  ifdef MACOS
+     /* We need to check that <math.h> hasn't already been included earlier
+      * as it seems it doesn't agree with <fp.h>, yet we should really use
+      * <fp.h> if possible.
+      */
+#    if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
+#      include <fp.h>
+#    endif
+#  else
+#    include <math.h>
+#  endif
+#  if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
+     /* Amiga SAS/C: We must include builtin FPU functions when compiling using
+      * MATH=68881
+      */
+#    include <m68881.h>
+#  endif
+#endif
+
+/* Codewarrior on NT has linking problems without this. */
+#if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__)
+#  define PNG_ALWAYS_EXTERN
+#endif
+
+/* This provides the non-ANSI (far) memory allocation routines. */
+#if defined(__TURBOC__) && defined(__MSDOS__)
+#  include <mem.h>
+#  include <alloc.h>
+#endif
+
+/* I have no idea why is this necessary... */
+#if defined(_MSC_VER) && (defined(WIN32) || defined(_Windows) || \
+    defined(_WINDOWS) || defined(_WIN32) || defined(__WIN32__))
+#  include <malloc.h>
+#endif
+
+/* This controls how fine the dithering gets.  As this allocates
+ * a largish chunk of memory (32K), those who are not as concerned
+ * with dithering quality can decrease some or all of these.
+ */
+#ifndef PNG_DITHER_RED_BITS
+#  define PNG_DITHER_RED_BITS 5
+#endif
+#ifndef PNG_DITHER_GREEN_BITS
+#  define PNG_DITHER_GREEN_BITS 5
+#endif
+#ifndef PNG_DITHER_BLUE_BITS
+#  define PNG_DITHER_BLUE_BITS 5
+#endif
+
+/* This controls how fine the gamma correction becomes when you
+ * are only interested in 8 bits anyway.  Increasing this value
+ * results in more memory being used, and more pow() functions
+ * being called to fill in the gamma tables.  Don't set this value
+ * less then 8, and even that may not work (I haven't tested it).
+ */
+
+#ifndef PNG_MAX_GAMMA_8
+#  define PNG_MAX_GAMMA_8 11
+#endif
+
+/* This controls how much a difference in gamma we can tolerate before
+ * we actually start doing gamma conversion.
+ */
+#ifndef PNG_GAMMA_THRESHOLD
+#  define PNG_GAMMA_THRESHOLD 0.05
+#endif
+
+#endif /* PNG_INTERNAL */
+
+/* The following uses const char * instead of char * for error
+ * and warning message functions, so some compilers won't complain.
+ * If you do not want to use const, define PNG_NO_CONST here.
+ */
+
+#ifndef PNG_NO_CONST
+#  define PNG_CONST const
+#else
+#  define PNG_CONST
+#endif
+
+/* The following defines give you the ability to remove code from the
+ * library that you will not be using.  I wish I could figure out how to
+ * automate this, but I can't do that without making it seriously hard
+ * on the users.  So if you are not using an ability, change the #define
+ * to and #undef, and that part of the library will not be compiled.  If
+ * your linker can't find a function, you may want to make sure the
+ * ability is defined here.  Some of these depend upon some others being
+ * defined.  I haven't figured out all the interactions here, so you may
+ * have to experiment awhile to get everything to compile.  If you are
+ * creating or using a shared library, you probably shouldn't touch this,
+ * as it will affect the size of the structures, and this will cause bad
+ * things to happen if the library and/or application ever change.
+ */
+
+/* Any features you will not be using can be undef'ed here */
+
+/* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
+ * to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS
+ * on the compile line, then pick and choose which ones to define without
+ * having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED
+ * if you only want to have a png-compliant reader/writer but don't need
+ * any of the extra transformations.  This saves about 80 kbytes in a
+ * typical installation of the library. (PNG_NO_* form added in version
+ * 1.0.1c, for consistency)
+ */
+
+/* The size of the png_text structure changed in libpng-1.0.6 when
+ * iTXt support was added.  iTXt support was turned off by default through
+ * libpng-1.2.x, to support old apps that malloc the png_text structure
+ * instead of calling png_set_text() and letting libpng malloc it.  It
+ * will be turned on by default in libpng-1.4.0.
+ */
+
+#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
+#  ifndef PNG_NO_iTXt_SUPPORTED
+#    define PNG_NO_iTXt_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_iTXt
+#    define PNG_NO_READ_iTXt
+#  endif
+#  ifndef PNG_NO_WRITE_iTXt
+#    define PNG_NO_WRITE_iTXt
+#  endif
+#endif
+
+#if !defined(PNG_NO_iTXt_SUPPORTED)
+#  if !defined(PNG_READ_iTXt_SUPPORTED) && !defined(PNG_NO_READ_iTXt)
+#    define PNG_READ_iTXt
+#  endif
+#  if !defined(PNG_WRITE_iTXt_SUPPORTED) && !defined(PNG_NO_WRITE_iTXt)
+#    define PNG_WRITE_iTXt
+#  endif
+#endif
+
+/* The following support, added after version 1.0.0, can be turned off here en
+ * masse by defining PNG_LEGACY_SUPPORTED in case you need binary compatibility
+ * with old applications that require the length of png_struct and png_info
+ * to remain unchanged.
+ */
+
+#ifdef PNG_LEGACY_SUPPORTED
+#  define PNG_NO_FREE_ME
+#  define PNG_NO_READ_UNKNOWN_CHUNKS
+#  define PNG_NO_WRITE_UNKNOWN_CHUNKS
+#  define PNG_NO_HANDLE_AS_UNKNOWN
+#  define PNG_NO_READ_USER_CHUNKS
+#  define PNG_NO_READ_iCCP
+#  define PNG_NO_WRITE_iCCP
+#  define PNG_NO_READ_iTXt
+#  define PNG_NO_WRITE_iTXt
+#  define PNG_NO_READ_sCAL
+#  define PNG_NO_WRITE_sCAL
+#  define PNG_NO_READ_sPLT
+#  define PNG_NO_WRITE_sPLT
+#  define PNG_NO_INFO_IMAGE
+#  define PNG_NO_READ_RGB_TO_GRAY
+#  define PNG_NO_READ_USER_TRANSFORM
+#  define PNG_NO_WRITE_USER_TRANSFORM
+#  define PNG_NO_USER_MEM
+#  define PNG_NO_READ_EMPTY_PLTE
+#  define PNG_NO_MNG_FEATURES
+#  define PNG_NO_FIXED_POINT_SUPPORTED
+#endif
+
+/* Ignore attempt to turn off both floating and fixed point support */
+#if !defined(PNG_FLOATING_POINT_SUPPORTED) || \
+    !defined(PNG_NO_FIXED_POINT_SUPPORTED)
+#  define PNG_FIXED_POINT_SUPPORTED
+#endif
+
+#ifndef PNG_NO_FREE_ME
+#  define PNG_FREE_ME_SUPPORTED
+#endif
+
+#ifdef PNG_READ_SUPPORTED
+
+#if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
+      !defined(PNG_NO_READ_TRANSFORMS)
+#  define PNG_READ_TRANSFORMS_SUPPORTED
+#endif
+
+#ifdef PNG_READ_TRANSFORMS_SUPPORTED
+#  ifndef PNG_NO_READ_EXPAND
+#    define PNG_READ_EXPAND_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_SHIFT
+#    define PNG_READ_SHIFT_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_PACK
+#    define PNG_READ_PACK_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_BGR
+#    define PNG_READ_BGR_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_SWAP
+#    define PNG_READ_SWAP_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_PACKSWAP
+#    define PNG_READ_PACKSWAP_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_INVERT
+#    define PNG_READ_INVERT_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_DITHER
+#    define PNG_READ_DITHER_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_BACKGROUND
+#    define PNG_READ_BACKGROUND_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_16_TO_8
+#    define PNG_READ_16_TO_8_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_FILLER
+#    define PNG_READ_FILLER_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_GAMMA
+#    define PNG_READ_GAMMA_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_GRAY_TO_RGB
+#    define PNG_READ_GRAY_TO_RGB_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_SWAP_ALPHA
+#    define PNG_READ_SWAP_ALPHA_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_INVERT_ALPHA
+#    define PNG_READ_INVERT_ALPHA_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_STRIP_ALPHA
+#    define PNG_READ_STRIP_ALPHA_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_USER_TRANSFORM
+#    define PNG_READ_USER_TRANSFORM_SUPPORTED
+#  endif
+#  ifndef PNG_NO_READ_RGB_TO_GRAY
+#    define PNG_READ_RGB_TO_GRAY_SUPPORTED
+#  endif
+#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
+
+/* PNG_PROGRESSIVE_READ_NOT_SUPPORTED is deprecated. */
+#if !defined(PNG_NO_PROGRESSIVE_READ) && \
+ !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED)  /* if you don't do progressive */
+#  define PNG_PROGRESSIVE_READ_SUPPORTED     /* reading.  This is not talking */
+#endif                               /* about interlacing capability!  You'll */
+            /* still have interlacing unless you change the following define: */
+#define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */
+
+/* PNG_NO_SEQUENTIAL_READ_SUPPORTED is deprecated. */
+#if !defined(PNG_NO_SEQUENTIAL_READ) && \
+    !defined(PNG_SEQUENTIAL_READ_SUPPORTED) && \
+    !defined(PNG_NO_SEQUENTIAL_READ_SUPPORTED)
+#  define PNG_SEQUENTIAL_READ_SUPPORTED
+#endif
+
+#define PNG_READ_INTERLACING_SUPPORTED /* required in PNG-compliant decoders */
+
+#ifndef PNG_NO_READ_COMPOSITE_NODIV
+#  ifndef PNG_NO_READ_COMPOSITED_NODIV  /* libpng-1.0.x misspelling */
+#    define PNG_READ_COMPOSITE_NODIV_SUPPORTED  /* well tested on Intel, SGI */
+#  endif
+#endif
+
+#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
+/* Deprecated, will be removed from version 2.0.0.
+   Use PNG_MNG_FEATURES_SUPPORTED instead. */
+#ifndef PNG_NO_READ_EMPTY_PLTE
+#  define PNG_READ_EMPTY_PLTE_SUPPORTED
+#endif
+#endif
+
+#endif /* PNG_READ_SUPPORTED */
+
+#ifdef PNG_WRITE_SUPPORTED
+
+# if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
+    !defined(PNG_NO_WRITE_TRANSFORMS)
+#  define PNG_WRITE_TRANSFORMS_SUPPORTED
+#endif
+
+#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
+#  ifndef PNG_NO_WRITE_SHIFT
+#    define PNG_WRITE_SHIFT_SUPPORTED
+#  endif
+#  ifndef PNG_NO_WRITE_PACK
+#    define PNG_WRITE_PACK_SUPPORTED
+#  endif
+#  ifndef PNG_NO_WRITE_BGR
+#    define PNG_WRITE_BGR_SUPPORTED
+#  endif
+#  ifndef PNG_NO_WRITE_SWAP
+#    define PNG_WRITE_SWAP_SUPPORTED
+#  endif
+#  ifndef PNG_NO_WRITE_PACKSWAP
+#    define PNG_WRITE_PACKSWAP_SUPPORTED
+#  endif
+#  ifndef PNG_NO_WRITE_INVERT
+#    define PNG_WRITE_INVERT_SUPPORTED
+#  endif
+#  ifndef PNG_NO_WRITE_FILLER
+#    define PNG_WRITE_FILLER_SUPPORTED   /* same as WRITE_STRIP_ALPHA */
+#  endif
+#  ifndef PNG_NO_WRITE_SWAP_ALPHA
+#    define PNG_WRITE_SWAP_ALPHA_SUPPORTED
+#  endif
+#ifndef PNG_1_0_X
+#  ifndef PNG_NO_WRITE_INVERT_ALPHA
+#    define PNG_WRITE_INVERT_ALPHA_SUPPORTED
+#  endif
+#endif
+#  ifndef PNG_NO_WRITE_USER_TRANSFORM
+#    define PNG_WRITE_USER_TRANSFORM_SUPPORTED
+#  endif
+#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
+
+#if !defined(PNG_NO_WRITE_INTERLACING_SUPPORTED) && \
+    !defined(PNG_WRITE_INTERLACING_SUPPORTED)
+#define PNG_WRITE_INTERLACING_SUPPORTED  /* not required for PNG-compliant
+                                            encoders, but can cause trouble
+                                            if left undefined */
+#endif
+
+#if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \
+    !defined(PNG_WRITE_WEIGHTED_FILTER) && \
+     defined(PNG_FLOATING_POINT_SUPPORTED)
+#  define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
+#endif
+
+#ifndef PNG_NO_WRITE_FLUSH
+#  define PNG_WRITE_FLUSH_SUPPORTED
+#endif
+
+#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
+/* Deprecated, see PNG_MNG_FEATURES_SUPPORTED, above */
+#ifndef PNG_NO_WRITE_EMPTY_PLTE
+#  define PNG_WRITE_EMPTY_PLTE_SUPPORTED
+#endif
+#endif
+
+#endif /* PNG_WRITE_SUPPORTED */
+
+#ifndef PNG_1_0_X
+#  ifndef PNG_NO_ERROR_NUMBERS
+#    define PNG_ERROR_NUMBERS_SUPPORTED
+#  endif
+#endif /* PNG_1_0_X */
+
+#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
+    defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
+#  ifndef PNG_NO_USER_TRANSFORM_PTR
+#    define PNG_USER_TRANSFORM_PTR_SUPPORTED
+#  endif
+#endif
+
+#ifndef PNG_NO_STDIO
+#  define PNG_TIME_RFC1123_SUPPORTED
+#endif
+
+/* This adds extra functions in pngget.c for accessing data from the
+ * info pointer (added in version 0.99)
+ * png_get_image_width()
+ * png_get_image_height()
+ * png_get_bit_depth()
+ * png_get_color_type()
+ * png_get_compression_type()
+ * png_get_filter_type()
+ * png_get_interlace_type()
+ * png_get_pixel_aspect_ratio()
+ * png_get_pixels_per_meter()
+ * png_get_x_offset_pixels()
+ * png_get_y_offset_pixels()
+ * png_get_x_offset_microns()
+ * png_get_y_offset_microns()
+ */
+#if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED)
+#  define PNG_EASY_ACCESS_SUPPORTED
+#endif
+
+/* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0
+ * and removed from version 1.2.20.  The following will be removed
+ * from libpng-1.4.0
+*/
+
+#if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_OPTIMIZED_CODE)
+#  ifndef PNG_OPTIMIZED_CODE_SUPPORTED
+#    define PNG_OPTIMIZED_CODE_SUPPORTED
+#  endif
+#endif
+
+#if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE)
+#  ifndef PNG_ASSEMBLER_CODE_SUPPORTED
+#    define PNG_ASSEMBLER_CODE_SUPPORTED
+#  endif
+
+#  if defined(__GNUC__) && defined(__x86_64__) && (__GNUC__ < 4)
+     /* work around 64-bit gcc compiler bugs in gcc-3.x */
+#    if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
+#      define PNG_NO_MMX_CODE
+#    endif
+#  endif
+
+#  ifdef __APPLE__
+#    if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
+#      define PNG_NO_MMX_CODE
+#    endif
+#  endif
+
+#  if (defined(__MWERKS__) && ((__MWERKS__ < 0x0900) || macintosh))
+#    if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
+#      define PNG_NO_MMX_CODE
+#    endif
+#  endif
+
+#  if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
+#    define PNG_MMX_CODE_SUPPORTED
+#  endif
+
+#endif
+/* end of obsolete code to be removed from libpng-1.4.0 */
+
+/* Added at libpng-1.2.0 */
+#ifndef PNG_1_0_X
+#if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED)
+#  define PNG_USER_MEM_SUPPORTED
+#endif
+#endif /* PNG_1_0_X */
+
+/* Added at libpng-1.2.6 */
+#ifndef PNG_1_0_X
+#  ifndef PNG_SET_USER_LIMITS_SUPPORTED
+#    ifndef PNG_NO_SET_USER_LIMITS
+#      define PNG_SET_USER_LIMITS_SUPPORTED
+#    endif
+#  endif
+#endif /* PNG_1_0_X */
+
+/* Added at libpng-1.0.53 and 1.2.43 */
+#ifndef PNG_USER_LIMITS_SUPPORTED
+#  ifndef PNG_NO_USER_LIMITS
+#    define PNG_USER_LIMITS_SUPPORTED
+#  endif
+#endif
+
+/* Added at libpng-1.0.16 and 1.2.6.  To accept all valid PNGS no matter
+ * how large, set these limits to 0x7fffffffL
+ */
+#ifndef PNG_USER_WIDTH_MAX
+#  define PNG_USER_WIDTH_MAX 1000000L
+#endif
+#ifndef PNG_USER_HEIGHT_MAX
+#  define PNG_USER_HEIGHT_MAX 1000000L
+#endif
+
+/* Added at libpng-1.2.43.  To accept all valid PNGs no matter
+ * how large, set these two limits to 0.
+ */
+#ifndef PNG_USER_CHUNK_CACHE_MAX
+#  define PNG_USER_CHUNK_CACHE_MAX 0
+#endif
+
+/* Added at libpng-1.2.43 */
+#ifndef PNG_USER_CHUNK_MALLOC_MAX
+#  define PNG_USER_CHUNK_MALLOC_MAX 0
+#endif
+
+#ifndef PNG_LITERAL_SHARP
+#  define PNG_LITERAL_SHARP 0x23
+#endif
+#ifndef PNG_LITERAL_LEFT_SQUARE_BRACKET
+#  define PNG_LITERAL_LEFT_SQUARE_BRACKET 0x5b
+#endif
+#ifndef PNG_LITERAL_RIGHT_SQUARE_BRACKET
+#  define PNG_LITERAL_RIGHT_SQUARE_BRACKET 0x5d
+#endif
+
+/* Added at libpng-1.2.34 */
+#ifndef PNG_STRING_NEWLINE
+#define PNG_STRING_NEWLINE "\n"
+#endif
+
+/* These are currently experimental features, define them if you want */
+
+/* very little testing */
+/*
+#ifdef PNG_READ_SUPPORTED
+#  ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
+#    define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
+#  endif
+#endif
+*/
+
+/* This is only for PowerPC big-endian and 680x0 systems */
+/* some testing */
+/*
+#ifndef PNG_READ_BIG_ENDIAN_SUPPORTED
+#  define PNG_READ_BIG_ENDIAN_SUPPORTED
+#endif
+*/
+
+/* Buggy compilers (e.g., gcc 2.7.2.2) need this */
+/*
+#define PNG_NO_POINTER_INDEXING
+*/
+
+#if !defined(PNG_NO_POINTER_INDEXING) && \
+    !defined(PNG_POINTER_INDEXING_SUPPORTED)
+#  define PNG_POINTER_INDEXING_SUPPORTED
+#endif
+
+/* These functions are turned off by default, as they will be phased out. */
+/*
+#define  PNG_USELESS_TESTS_SUPPORTED
+#define  PNG_CORRECT_PALETTE_SUPPORTED
+*/
+
+/* Any chunks you are not interested in, you can undef here.  The
+ * ones that allocate memory may be expecially important (hIST,
+ * tEXt, zTXt, tRNS, pCAL).  Others will just save time and make png_info
+ * a bit smaller.
+ */
+
+#if defined(PNG_READ_SUPPORTED) && \
+    !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
+    !defined(PNG_NO_READ_ANCILLARY_CHUNKS)
+#  define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
+#endif
+
+#if defined(PNG_WRITE_SUPPORTED) && \
+    !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
+    !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
+#  define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
+#endif
+
+#ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
+
+#ifdef PNG_NO_READ_TEXT
+#  define PNG_NO_READ_iTXt
+#  define PNG_NO_READ_tEXt
+#  define PNG_NO_READ_zTXt
+#endif
+#ifndef PNG_NO_READ_bKGD
+#  define PNG_READ_bKGD_SUPPORTED
+#  define PNG_bKGD_SUPPORTED
+#endif
+#ifndef PNG_NO_READ_cHRM
+#  define PNG_READ_cHRM_SUPPORTED
+#  define PNG_cHRM_SUPPORTED
+#endif
+#ifndef PNG_NO_READ_gAMA
+#  define PNG_READ_gAMA_SUPPORTED
+#  define PNG_gAMA_SUPPORTED
+#endif
+#ifndef PNG_NO_READ_hIST
+#  define PNG_READ_hIST_SUPPORTED
+#  define PNG_hIST_SUPPORTED
+#endif
+#ifndef PNG_NO_READ_iCCP
+#  define PNG_READ_iCCP_SUPPORTED
+#  define PNG_iCCP_SUPPORTED
+#endif
+#ifndef PNG_NO_READ_iTXt
+#  ifndef PNG_READ_iTXt_SUPPORTED
+#    define PNG_READ_iTXt_SUPPORTED
+#  endif
+#  ifndef PNG_iTXt_SUPPORTED
+#    define PNG_iTXt_SUPPORTED
+#  endif
+#endif
+#ifndef PNG_NO_READ_oFFs
+#  define PNG_READ_oFFs_SUPPORTED
+#  define PNG_oFFs_SUPPORTED
+#endif
+#ifndef PNG_NO_READ_pCAL
+#  define PNG_READ_pCAL_SUPPORTED
+#  define PNG_pCAL_SUPPORTED
+#endif
+#ifndef PNG_NO_READ_sCAL
+#  define PNG_READ_sCAL_SUPPORTED
+#  define PNG_sCAL_SUPPORTED
+#endif
+#ifndef PNG_NO_READ_pHYs
+#  define PNG_READ_pHYs_SUPPORTED
+#  define PNG_pHYs_SUPPORTED
+#endif
+#ifndef PNG_NO_READ_sBIT
+#  define PNG_READ_sBIT_SUPPORTED
+#  define PNG_sBIT_SUPPORTED
+#endif
+#ifndef PNG_NO_READ_sPLT
+#  define PNG_READ_sPLT_SUPPORTED
+#  define PNG_sPLT_SUPPORTED
+#endif
+#ifndef PNG_NO_READ_sRGB
+#  define PNG_READ_sRGB_SUPPORTED
+#  define PNG_sRGB_SUPPORTED
+#endif
+#ifndef PNG_NO_READ_tEXt
+#  define PNG_READ_tEXt_SUPPORTED
+#  define PNG_tEXt_SUPPORTED
+#endif
+#ifndef PNG_NO_READ_tIME
+#  define PNG_READ_tIME_SUPPORTED
+#  define PNG_tIME_SUPPORTED
+#endif
+#ifndef PNG_NO_READ_tRNS
+#  define PNG_READ_tRNS_SUPPORTED
+#  define PNG_tRNS_SUPPORTED
+#endif
+#ifndef PNG_NO_READ_zTXt
+#  define PNG_READ_zTXt_SUPPORTED
+#  define PNG_zTXt_SUPPORTED
+#endif
+#ifndef PNG_NO_READ_OPT_PLTE
+#  define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */
+#endif                      /* optional PLTE chunk in RGB and RGBA images */
+#if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \
+    defined(PNG_READ_zTXt_SUPPORTED)
+#  define PNG_READ_TEXT_SUPPORTED
+#  define PNG_TEXT_SUPPORTED
+#endif
+
+#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
+
+#ifndef PNG_NO_READ_UNKNOWN_CHUNKS
+#  define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
+#  ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
+#    define PNG_UNKNOWN_CHUNKS_SUPPORTED
+#  endif
+#endif
+#if !defined(PNG_NO_READ_USER_CHUNKS) && \
+     defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
+#  define PNG_READ_USER_CHUNKS_SUPPORTED
+#  define PNG_USER_CHUNKS_SUPPORTED
+#  ifdef PNG_NO_READ_UNKNOWN_CHUNKS
+#    undef PNG_NO_READ_UNKNOWN_CHUNKS
+#  endif
+#  ifdef PNG_NO_HANDLE_AS_UNKNOWN
+#    undef PNG_NO_HANDLE_AS_UNKNOWN
+#  endif
+#endif
+
+#ifndef PNG_NO_HANDLE_AS_UNKNOWN
+#  ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
+#    define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
+#  endif
+#endif
+
+#ifdef PNG_WRITE_SUPPORTED
+#ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
+
+#ifdef PNG_NO_WRITE_TEXT
+#  define PNG_NO_WRITE_iTXt
+#  define PNG_NO_WRITE_tEXt
+#  define PNG_NO_WRITE_zTXt
+#endif
+#ifndef PNG_NO_WRITE_bKGD
+#  define PNG_WRITE_bKGD_SUPPORTED
+#  ifndef PNG_bKGD_SUPPORTED
+#    define PNG_bKGD_SUPPORTED
+#  endif
+#endif
+#ifndef PNG_NO_WRITE_cHRM
+#  define PNG_WRITE_cHRM_SUPPORTED
+#  ifndef PNG_cHRM_SUPPORTED
+#    define PNG_cHRM_SUPPORTED
+#  endif
+#endif
+#ifndef PNG_NO_WRITE_gAMA
+#  define PNG_WRITE_gAMA_SUPPORTED
+#  ifndef PNG_gAMA_SUPPORTED
+#    define PNG_gAMA_SUPPORTED
+#  endif
+#endif
+#ifndef PNG_NO_WRITE_hIST
+#  define PNG_WRITE_hIST_SUPPORTED
+#  ifndef PNG_hIST_SUPPORTED
+#    define PNG_hIST_SUPPORTED
+#  endif
+#endif
+#ifndef PNG_NO_WRITE_iCCP
+#  define PNG_WRITE_iCCP_SUPPORTED
+#  ifndef PNG_iCCP_SUPPORTED
+#    define PNG_iCCP_SUPPORTED
+#  endif
+#endif
+#ifndef PNG_NO_WRITE_iTXt
+#  ifndef PNG_WRITE_iTXt_SUPPORTED
+#    define PNG_WRITE_iTXt_SUPPORTED
+#  endif
+#  ifndef PNG_iTXt_SUPPORTED
+#    define PNG_iTXt_SUPPORTED
+#  endif
+#endif
+#ifndef PNG_NO_WRITE_oFFs
+#  define PNG_WRITE_oFFs_SUPPORTED
+#  ifndef PNG_oFFs_SUPPORTED
+#    define PNG_oFFs_SUPPORTED
+#  endif
+#endif
+#ifndef PNG_NO_WRITE_pCAL
+#  define PNG_WRITE_pCAL_SUPPORTED
+#  ifndef PNG_pCAL_SUPPORTED
+#    define PNG_pCAL_SUPPORTED
+#  endif
+#endif
+#ifndef PNG_NO_WRITE_sCAL
+#  define PNG_WRITE_sCAL_SUPPORTED
+#  ifndef PNG_sCAL_SUPPORTED
+#    define PNG_sCAL_SUPPORTED
+#  endif
+#endif
+#ifndef PNG_NO_WRITE_pHYs
+#  define PNG_WRITE_pHYs_SUPPORTED
+#  ifndef PNG_pHYs_SUPPORTED
+#    define PNG_pHYs_SUPPORTED
+#  endif
+#endif
+#ifndef PNG_NO_WRITE_sBIT
+#  define PNG_WRITE_sBIT_SUPPORTED
+#  ifndef PNG_sBIT_SUPPORTED
+#    define PNG_sBIT_SUPPORTED
+#  endif
+#endif
+#ifndef PNG_NO_WRITE_sPLT
+#  define PNG_WRITE_sPLT_SUPPORTED
+#  ifndef PNG_sPLT_SUPPORTED
+#    define PNG_sPLT_SUPPORTED
+#  endif
+#endif
+#ifndef PNG_NO_WRITE_sRGB
+#  define PNG_WRITE_sRGB_SUPPORTED
+#  ifndef PNG_sRGB_SUPPORTED
+#    define PNG_sRGB_SUPPORTED
+#  endif
+#endif
+#ifndef PNG_NO_WRITE_tEXt
+#  define PNG_WRITE_tEXt_SUPPORTED
+#  ifndef PNG_tEXt_SUPPORTED
+#    define PNG_tEXt_SUPPORTED
+#  endif
+#endif
+#ifndef PNG_NO_WRITE_tIME
+#  define PNG_WRITE_tIME_SUPPORTED
+#  ifndef PNG_tIME_SUPPORTED
+#    define PNG_tIME_SUPPORTED
+#  endif
+#endif
+#ifndef PNG_NO_WRITE_tRNS
+#  define PNG_WRITE_tRNS_SUPPORTED
+#  ifndef PNG_tRNS_SUPPORTED
+#    define PNG_tRNS_SUPPORTED
+#  endif
+#endif
+#ifndef PNG_NO_WRITE_zTXt
+#  define PNG_WRITE_zTXt_SUPPORTED
+#  ifndef PNG_zTXt_SUPPORTED
+#    define PNG_zTXt_SUPPORTED
+#  endif
+#endif
+#if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \
+    defined(PNG_WRITE_zTXt_SUPPORTED)
+#  define PNG_WRITE_TEXT_SUPPORTED
+#  ifndef PNG_TEXT_SUPPORTED
+#    define PNG_TEXT_SUPPORTED
+#  endif
+#endif
+
+#ifdef PNG_WRITE_tIME_SUPPORTED
+#  ifndef PNG_NO_CONVERT_tIME
+#    ifndef _WIN32_WCE
+/*   The "tm" structure is not supported on WindowsCE */
+#      ifndef PNG_CONVERT_tIME_SUPPORTED
+#        define PNG_CONVERT_tIME_SUPPORTED
+#      endif
+#   endif
+#  endif
+#endif
+
+#endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
+
+#if !defined(PNG_NO_WRITE_FILTER) && !defined(PNG_WRITE_FILTER_SUPPORTED)
+#  define PNG_WRITE_FILTER_SUPPORTED
+#endif
+
+#ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
+#  define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
+#  ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
+#    define PNG_UNKNOWN_CHUNKS_SUPPORTED
+#  endif
+#endif
+
+#ifndef PNG_NO_HANDLE_AS_UNKNOWN
+#  ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
+#    define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
+#  endif
+#endif
+#endif /* PNG_WRITE_SUPPORTED */
+
+/* Turn this off to disable png_read_png() and
+ * png_write_png() and leave the row_pointers member
+ * out of the info structure.
+ */
+#ifndef PNG_NO_INFO_IMAGE
+#  define PNG_INFO_IMAGE_SUPPORTED
+#endif
+
+/* Need the time information for converting tIME chunks */
+#ifdef PNG_CONVERT_tIME_SUPPORTED
+     /* "time.h" functions are not supported on WindowsCE */
+#    include <time.h>
+#endif
+
+/* Some typedefs to get us started.  These should be safe on most of the
+ * common platforms.  The typedefs should be at least as large as the
+ * numbers suggest (a png_uint_32 must be at least 32 bits long), but they
+ * don't have to be exactly that size.  Some compilers dislike passing
+ * unsigned shorts as function parameters, so you may be better off using
+ * unsigned int for png_uint_16.  Likewise, for 64-bit systems, you may
+ * want to have unsigned int for png_uint_32 instead of unsigned long.
+ */
+
+typedef unsigned long png_uint_32;
+typedef long png_int_32;
+typedef unsigned short png_uint_16;
+typedef short png_int_16;
+typedef unsigned char png_byte;
+
+/* This is usually size_t.  It is typedef'ed just in case you need it to
+   change (I'm not sure if you will or not, so I thought I'd be safe) */
+#ifdef PNG_SIZE_T
+   typedef PNG_SIZE_T png_size_t;
+#  define png_sizeof(x) png_convert_size(sizeof(x))
+#else
+   typedef size_t png_size_t;
+#  define png_sizeof(x) sizeof(x)
+#endif
+
+/* The following is needed for medium model support.  It cannot be in the
+ * PNG_INTERNAL section.  Needs modification for other compilers besides
+ * MSC.  Model independent support declares all arrays and pointers to be
+ * large using the far keyword.  The zlib version used must also support
+ * model independent data.  As of version zlib 1.0.4, the necessary changes
+ * have been made in zlib.  The USE_FAR_KEYWORD define triggers other
+ * changes that are needed. (Tim Wegner)
+ */
+
+/* Separate compiler dependencies (problem here is that zlib.h always
+   defines FAR. (SJT) */
+#ifdef __BORLANDC__
+#  if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
+#    define LDATA 1
+#  else
+#    define LDATA 0
+#  endif
+   /* GRR:  why is Cygwin in here?  Cygwin is not Borland C... */
+#  if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)
+#    define PNG_MAX_MALLOC_64K
+#    if (LDATA != 1)
+#      ifndef FAR
+#        define FAR __far
+#      endif
+#      define USE_FAR_KEYWORD
+#    endif   /* LDATA != 1 */
+     /* Possibly useful for moving data out of default segment.
+      * Uncomment it if you want. Could also define FARDATA as
+      * const if your compiler supports it. (SJT)
+#    define FARDATA FAR
+      */
+#  endif  /* __WIN32__, __FLAT__, __CYGWIN__ */
+#endif   /* __BORLANDC__ */
+
+
+/* Suggest testing for specific compiler first before testing for
+ * FAR.  The Watcom compiler defines both __MEDIUM__ and M_I86MM,
+ * making reliance oncertain keywords suspect. (SJT)
+ */
+
+/* MSC Medium model */
+#ifdef FAR
+#  ifdef M_I86MM
+#    define USE_FAR_KEYWORD
+#    define FARDATA FAR
+#    include <dos.h>
+#  endif
+#endif
+
+/* SJT: default case */
+#ifndef FAR
+#  define FAR
+#endif
+
+/* At this point FAR is always defined */
+#ifndef FARDATA
+#  define FARDATA
+#endif
+
+/* Typedef for floating-point numbers that are converted
+   to fixed-point with a multiple of 100,000, e.g., int_gamma */
+typedef png_int_32 png_fixed_point;
+
+/* Add typedefs for pointers */
+typedef void            FAR * png_voidp;
+typedef png_byte        FAR * png_bytep;
+typedef png_uint_32     FAR * png_uint_32p;
+typedef png_int_32      FAR * png_int_32p;
+typedef png_uint_16     FAR * png_uint_16p;
+typedef png_int_16      FAR * png_int_16p;
+typedef PNG_CONST char  FAR * png_const_charp;
+typedef char            FAR * png_charp;
+typedef png_fixed_point FAR * png_fixed_point_p;
+
+#ifndef PNG_NO_STDIO
+#ifdef _WIN32_WCE
+typedef HANDLE                png_FILE_p;
+#else
+typedef FILE                * png_FILE_p;
+#endif
+#endif
+
+#ifdef PNG_FLOATING_POINT_SUPPORTED
+typedef double          FAR * png_doublep;
+#endif
+
+/* Pointers to pointers; i.e. arrays */
+typedef png_byte        FAR * FAR * png_bytepp;
+typedef png_uint_32     FAR * FAR * png_uint_32pp;
+typedef png_int_32      FAR * FAR * png_int_32pp;
+typedef png_uint_16     FAR * FAR * png_uint_16pp;
+typedef png_int_16      FAR * FAR * png_int_16pp;
+typedef PNG_CONST char  FAR * FAR * png_const_charpp;
+typedef char            FAR * FAR * png_charpp;
+typedef png_fixed_point FAR * FAR * png_fixed_point_pp;
+#ifdef PNG_FLOATING_POINT_SUPPORTED
+typedef double          FAR * FAR * png_doublepp;
+#endif
+
+/* Pointers to pointers to pointers; i.e., pointer to array */
+typedef char            FAR * FAR * FAR * png_charppp;
+
+#if defined(PNG_1_0_X) || defined(PNG_1_2_X)
+/* SPC -  Is this stuff deprecated? */
+/* It'll be removed as of libpng-1.4.0 - GR-P */
+/* libpng typedefs for types in zlib. If zlib changes
+ * or another compression library is used, then change these.
+ * Eliminates need to change all the source files.
+ */
+typedef charf *         png_zcharp;
+typedef charf * FAR *   png_zcharpp;
+typedef z_stream FAR *  png_zstreamp;
+#endif /* (PNG_1_0_X) || defined(PNG_1_2_X) */
+
+/*
+ * Define PNG_BUILD_DLL if the module being built is a Windows
+ * LIBPNG DLL.
+ *
+ * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL.
+ * It is equivalent to Microsoft predefined macro _DLL that is
+ * automatically defined when you compile using the share
+ * version of the CRT (C Run-Time library)
+ *
+ * The cygwin mods make this behavior a little different:
+ * Define PNG_BUILD_DLL if you are building a dll for use with cygwin
+ * Define PNG_STATIC if you are building a static library for use with cygwin,
+ *   -or- if you are building an application that you want to link to the
+ *   static library.
+ * PNG_USE_DLL is defined by default (no user action needed) unless one of
+ *   the other flags is defined.
+ */
+
+#if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL))
+#  define PNG_DLL
+#endif
+/* If CYGWIN, then disallow GLOBAL ARRAYS unless building a static lib.
+ * When building a static lib, default to no GLOBAL ARRAYS, but allow
+ * command-line override
+ */
+#ifdef __CYGWIN__
+#  ifndef PNG_STATIC
+#    ifdef PNG_USE_GLOBAL_ARRAYS
+#      undef PNG_USE_GLOBAL_ARRAYS
+#    endif
+#    ifndef PNG_USE_LOCAL_ARRAYS
+#      define PNG_USE_LOCAL_ARRAYS
+#    endif
+#  else
+#    if defined(PNG_USE_LOCAL_ARRAYS) || defined(PNG_NO_GLOBAL_ARRAYS)
+#      ifdef PNG_USE_GLOBAL_ARRAYS
+#        undef PNG_USE_GLOBAL_ARRAYS
+#      endif
+#    endif
+#  endif
+#  if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
+#    define PNG_USE_LOCAL_ARRAYS
+#  endif
+#endif
+
+/* Do not use global arrays (helps with building DLL's)
+ * They are no longer used in libpng itself, since version 1.0.5c,
+ * but might be required for some pre-1.0.5c applications.
+ */
+#if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
+#  if defined(PNG_NO_GLOBAL_ARRAYS) || \
+      (defined(__GNUC__) && defined(PNG_DLL)) || defined(_MSC_VER)
+#    define PNG_USE_LOCAL_ARRAYS
+#  else
+#    define PNG_USE_GLOBAL_ARRAYS
+#  endif
+#endif
+
+#ifdef __CYGWIN__
+#  undef PNGAPI
+#  define PNGAPI __cdecl
+#  undef PNG_IMPEXP
+#  define PNG_IMPEXP
+#endif
+
+/* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall",
+ * you may get warnings regarding the linkage of png_zalloc and png_zfree.
+ * Don't ignore those warnings; you must also reset the default calling
+ * convention in your compiler to match your PNGAPI, and you must build
+ * zlib and your applications the same way you build libpng.
+ */
+
+#if defined(__MINGW32__) && !defined(PNG_MODULEDEF)
+#  ifndef PNG_NO_MODULEDEF
+#    define PNG_NO_MODULEDEF
+#  endif
+#endif
+
+#if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF)
+#  define PNG_IMPEXP
+#endif
+
+#if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \
+    (( defined(_Windows) || defined(_WINDOWS) || \
+       defined(WIN32) || defined(_WIN32) || defined(__WIN32__) ))
+
+#  ifndef PNGAPI
+#     if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
+#        define PNGAPI __cdecl
+#     else
+#        define PNGAPI _cdecl
+#     endif
+#  endif
+
+#  if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \
+       0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */)
+#     define PNG_IMPEXP
+#  endif
+
+#  ifndef PNG_IMPEXP
+
+#     define PNG_EXPORT_TYPE1(type,symbol)  PNG_IMPEXP type PNGAPI symbol
+#     define PNG_EXPORT_TYPE2(type,symbol)  type PNG_IMPEXP PNGAPI symbol
+
+      /* Borland/Microsoft */
+#     if defined(_MSC_VER) || defined(__BORLANDC__)
+#        if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500)
+#           define PNG_EXPORT PNG_EXPORT_TYPE1
+#        else
+#           define PNG_EXPORT PNG_EXPORT_TYPE2
+#           ifdef PNG_BUILD_DLL
+#              define PNG_IMPEXP __export
+#           else
+#              define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in
+                                                 VC++ */
+#           endif                             /* Exists in Borland C++ for
+                                                 C++ classes (== huge) */
+#        endif
+#     endif
+
+#     ifndef PNG_IMPEXP
+#        ifdef PNG_BUILD_DLL
+#           define PNG_IMPEXP __declspec(dllexport)
+#        else
+#           define PNG_IMPEXP __declspec(dllimport)
+#        endif
+#     endif
+#  endif  /* PNG_IMPEXP */
+#else /* !(DLL || non-cygwin WINDOWS) */
+#   if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
+#      ifndef PNGAPI
+#         define PNGAPI _System
+#      endif
+#   else
+#      if 0 /* ... other platforms, with other meanings */
+#      endif
+#   endif
+#endif
+
+#ifndef PNGAPI
+#  define PNGAPI
+#endif
+#ifndef PNG_IMPEXP
+#  define PNG_IMPEXP
+#endif
+
+#ifdef PNG_BUILDSYMS
+#  ifndef PNG_EXPORT
+#    define PNG_EXPORT(type,symbol) PNG_FUNCTION_EXPORT symbol END
+#  endif
+#  ifdef PNG_USE_GLOBAL_ARRAYS
+#    ifndef PNG_EXPORT_VAR
+#      define PNG_EXPORT_VAR(type) PNG_DATA_EXPORT
+#    endif
+#  endif
+#endif
+
+#ifndef PNG_EXPORT
+#  define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol
+#endif
+
+#ifdef PNG_USE_GLOBAL_ARRAYS
+#  ifndef PNG_EXPORT_VAR
+#    define PNG_EXPORT_VAR(type) extern PNG_IMPEXP type
+#  endif
+#endif
+
+#ifdef PNG_PEDANTIC_WARNINGS
+#  ifndef PNG_PEDANTIC_WARNINGS_SUPPORTED
+#    define PNG_PEDANTIC_WARNINGS_SUPPORTED
+#  endif
+#endif
+
+#ifdef PNG_PEDANTIC_WARNINGS_SUPPORTED
+/* Support for compiler specific function attributes.  These are used
+ * so that where compiler support is available incorrect use of API
+ * functions in png.h will generate compiler warnings.  Added at libpng
+ * version 1.2.41.
+ */
+#  ifdef __GNUC__
+#    ifndef PNG_USE_RESULT
+#      define PNG_USE_RESULT __attribute__((__warn_unused_result__))
+#    endif
+#    ifndef PNG_NORETURN
+#      define PNG_NORETURN   __attribute__((__noreturn__))
+#    endif
+#    ifndef PNG_ALLOCATED
+#      define PNG_ALLOCATED  __attribute__((__malloc__))
+#    endif
+
+    /* This specifically protects structure members that should only be
+     * accessed from within the library, therefore should be empty during
+     * a library build.
+     */
+#    ifndef PNG_DEPRECATED
+#      define PNG_DEPRECATED __attribute__((__deprecated__))
+#    endif
+#    ifndef PNG_DEPSTRUCT
+#      define PNG_DEPSTRUCT  __attribute__((__deprecated__))
+#    endif
+#    ifndef PNG_PRIVATE
+#      if 0 /* Doesn't work so we use deprecated instead*/
+#        define PNG_PRIVATE \
+          __attribute__((warning("This function is not exported by libpng.")))
+#      else
+#        define PNG_PRIVATE \
+          __attribute__((__deprecated__))
+#      endif
+#    endif /* PNG_PRIVATE */
+#  endif /* __GNUC__ */
+#endif /* PNG_PEDANTIC_WARNINGS */
+
+#ifndef PNG_DEPRECATED
+#  define PNG_DEPRECATED  /* Use of this function is deprecated */
+#endif
+#ifndef PNG_USE_RESULT
+#  define PNG_USE_RESULT  /* The result of this function must be checked */
+#endif
+#ifndef PNG_NORETURN
+#  define PNG_NORETURN    /* This function does not return */
+#endif
+#ifndef PNG_ALLOCATED
+#  define PNG_ALLOCATED   /* The result of the function is new memory */
+#endif
+#ifndef PNG_DEPSTRUCT
+#  define PNG_DEPSTRUCT   /* Access to this struct member is deprecated */
+#endif
+#ifndef PNG_PRIVATE
+#  define PNG_PRIVATE     /* This is a private libpng function */
+#endif
+
+/* User may want to use these so they are not in PNG_INTERNAL. Any library
+ * functions that are passed far data must be model independent.
+ */
+
+#ifndef PNG_ABORT
+#  define PNG_ABORT() abort()
+#endif
+
+#ifdef PNG_SETJMP_SUPPORTED
+#  define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
+#else
+#  define png_jmpbuf(png_ptr) \
+   (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED)
+#endif
+
+#ifdef USE_FAR_KEYWORD  /* memory model independent fns */
+/* Use this to make far-to-near assignments */
+#  define CHECK   1
+#  define NOCHECK 0
+#  define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
+#  define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
+#  define png_snprintf _fsnprintf   /* Added to v 1.2.19 */
+#  define png_strlen  _fstrlen
+#  define png_memcmp  _fmemcmp    /* SJT: added */
+#  define png_memcpy  _fmemcpy
+#  define png_memset  _fmemset
+#else /* Use the usual functions */
+#  define CVT_PTR(ptr)         (ptr)
+#  define CVT_PTR_NOCHECK(ptr) (ptr)
+#  ifndef PNG_NO_SNPRINTF
+#    ifdef _MSC_VER
+#      define png_snprintf _snprintf   /* Added to v 1.2.19 */
+#      define png_snprintf2 _snprintf
+#      define png_snprintf6 _snprintf
+#    else
+#      define png_snprintf snprintf   /* Added to v 1.2.19 */
+#      define png_snprintf2 snprintf
+#      define png_snprintf6 snprintf
+#    endif
+#  else
+     /* You don't have or don't want to use snprintf().  Caution: Using
+      * sprintf instead of snprintf exposes your application to accidental
+      * or malevolent buffer overflows.  If you don't have snprintf()
+      * as a general rule you should provide one (you can get one from
+      * Portable OpenSSH).
+      */
+#    define png_snprintf(s1,n,fmt,x1) sprintf(s1,fmt,x1)
+#    define png_snprintf2(s1,n,fmt,x1,x2) sprintf(s1,fmt,x1,x2)
+#    define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \
+        sprintf(s1,fmt,x1,x2,x3,x4,x5,x6)
+#  endif
+#  define png_strlen  strlen
+#  define png_memcmp  memcmp      /* SJT: added */
+#  define png_memcpy  memcpy
+#  define png_memset  memset
+#endif
+/* End of memory model independent support */
+
+/* Just a little check that someone hasn't tried to define something
+ * contradictory.
+ */
+#if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K)
+#  undef PNG_ZBUF_SIZE
+#  define PNG_ZBUF_SIZE 65536L
+#endif
+
+/* Added at libpng-1.2.8 */
+#endif /* PNG_VERSION_INFO_ONLY */
+
+#endif /* PNGCONF_H */
diff --git a/src/modules/tracepath/zconf.h b/src/modules/tracepath/zconf.h
new file mode 100644 (file)
index 0000000..b234387
--- /dev/null
@@ -0,0 +1,428 @@
+/* zconf.h -- configuration of the zlib compression library
+ * Copyright (C) 1995-2010 Jean-loup Gailly.
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+/* @(#) $Id$ */
+
+#ifndef ZCONF_H
+#define ZCONF_H
+
+/*
+ * If you *really* need a unique prefix for all types and library functions,
+ * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
+ * Even better than compiling with -DZ_PREFIX would be to use configure to set
+ * this permanently in zconf.h using "./configure --zprefix".
+ */
+#ifdef Z_PREFIX     /* may be set to #if 1 by ./configure */
+
+/* all linked symbols */
+#  define _dist_code            z__dist_code
+#  define _length_code          z__length_code
+#  define _tr_align             z__tr_align
+#  define _tr_flush_block       z__tr_flush_block
+#  define _tr_init              z__tr_init
+#  define _tr_stored_block      z__tr_stored_block
+#  define _tr_tally             z__tr_tally
+#  define adler32               z_adler32
+#  define adler32_combine       z_adler32_combine
+#  define adler32_combine64     z_adler32_combine64
+#  define compress              z_compress
+#  define compress2             z_compress2
+#  define compressBound         z_compressBound
+#  define crc32                 z_crc32
+#  define crc32_combine         z_crc32_combine
+#  define crc32_combine64       z_crc32_combine64
+#  define deflate               z_deflate
+#  define deflateBound          z_deflateBound
+#  define deflateCopy           z_deflateCopy
+#  define deflateEnd            z_deflateEnd
+#  define deflateInit2_         z_deflateInit2_
+#  define deflateInit_          z_deflateInit_
+#  define deflateParams         z_deflateParams
+#  define deflatePrime          z_deflatePrime
+#  define deflateReset          z_deflateReset
+#  define deflateSetDictionary  z_deflateSetDictionary
+#  define deflateSetHeader      z_deflateSetHeader
+#  define deflateTune           z_deflateTune
+#  define deflate_copyright     z_deflate_copyright
+#  define get_crc_table         z_get_crc_table
+#  define gz_error              z_gz_error
+#  define gz_intmax             z_gz_intmax
+#  define gz_strwinerror        z_gz_strwinerror
+#  define gzbuffer              z_gzbuffer
+#  define gzclearerr            z_gzclearerr
+#  define gzclose               z_gzclose
+#  define gzclose_r             z_gzclose_r
+#  define gzclose_w             z_gzclose_w
+#  define gzdirect              z_gzdirect
+#  define gzdopen               z_gzdopen
+#  define gzeof                 z_gzeof
+#  define gzerror               z_gzerror
+#  define gzflush               z_gzflush
+#  define gzgetc                z_gzgetc
+#  define gzgets                z_gzgets
+#  define gzoffset              z_gzoffset
+#  define gzoffset64            z_gzoffset64
+#  define gzopen                z_gzopen
+#  define gzopen64              z_gzopen64
+#  define gzprintf              z_gzprintf
+#  define gzputc                z_gzputc
+#  define gzputs                z_gzputs
+#  define gzread                z_gzread
+#  define gzrewind              z_gzrewind
+#  define gzseek                z_gzseek
+#  define gzseek64              z_gzseek64
+#  define gzsetparams           z_gzsetparams
+#  define gztell                z_gztell
+#  define gztell64              z_gztell64
+#  define gzungetc              z_gzungetc
+#  define gzwrite               z_gzwrite
+#  define inflate               z_inflate
+#  define inflateBack           z_inflateBack
+#  define inflateBackEnd        z_inflateBackEnd
+#  define inflateBackInit_      z_inflateBackInit_
+#  define inflateCopy           z_inflateCopy
+#  define inflateEnd            z_inflateEnd
+#  define inflateGetHeader      z_inflateGetHeader
+#  define inflateInit2_         z_inflateInit2_
+#  define inflateInit_          z_inflateInit_
+#  define inflateMark           z_inflateMark
+#  define inflatePrime          z_inflatePrime
+#  define inflateReset          z_inflateReset
+#  define inflateReset2         z_inflateReset2
+#  define inflateSetDictionary  z_inflateSetDictionary
+#  define inflateSync           z_inflateSync
+#  define inflateSyncPoint      z_inflateSyncPoint
+#  define inflateUndermine      z_inflateUndermine
+#  define inflate_copyright     z_inflate_copyright
+#  define inflate_fast          z_inflate_fast
+#  define inflate_table         z_inflate_table
+#  define uncompress            z_uncompress
+#  define zError                z_zError
+#  define zcalloc               z_zcalloc
+#  define zcfree                z_zcfree
+#  define zlibCompileFlags      z_zlibCompileFlags
+#  define zlibVersion           z_zlibVersion
+
+/* all zlib typedefs in zlib.h and zconf.h */
+#  define Byte                  z_Byte
+#  define Bytef                 z_Bytef
+#  define alloc_func            z_alloc_func
+#  define charf                 z_charf
+#  define free_func             z_free_func
+#  define gzFile                z_gzFile
+#  define gz_header             z_gz_header
+#  define gz_headerp            z_gz_headerp
+#  define in_func               z_in_func
+#  define intf                  z_intf
+#  define out_func              z_out_func
+#  define uInt                  z_uInt
+#  define uIntf                 z_uIntf
+#  define uLong                 z_uLong
+#  define uLongf                z_uLongf
+#  define voidp                 z_voidp
+#  define voidpc                z_voidpc
+#  define voidpf                z_voidpf
+
+/* all zlib structs in zlib.h and zconf.h */
+#  define gz_header_s           z_gz_header_s
+#  define internal_state        z_internal_state
+
+#endif
+
+#if defined(__MSDOS__) && !defined(MSDOS)
+#  define MSDOS
+#endif
+#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
+#  define OS2
+#endif
+#if defined(_WINDOWS) && !defined(WINDOWS)
+#  define WINDOWS
+#endif
+#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
+#  ifndef WIN32
+#    define WIN32
+#  endif
+#endif
+#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
+#  if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
+#    ifndef SYS16BIT
+#      define SYS16BIT
+#    endif
+#  endif
+#endif
+
+/*
+ * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
+ * than 64k bytes at a time (needed on systems with 16-bit int).
+ */
+#ifdef SYS16BIT
+#  define MAXSEG_64K
+#endif
+#ifdef MSDOS
+#  define UNALIGNED_OK
+#endif
+
+#ifdef __STDC_VERSION__
+#  ifndef STDC
+#    define STDC
+#  endif
+#  if __STDC_VERSION__ >= 199901L
+#    ifndef STDC99
+#      define STDC99
+#    endif
+#  endif
+#endif
+#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
+#  define STDC
+#endif
+#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
+#  define STDC
+#endif
+#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
+#  define STDC
+#endif
+#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
+#  define STDC
+#endif
+
+#if defined(__OS400__) && !defined(STDC)    /* iSeries (formerly AS/400). */
+#  define STDC
+#endif
+
+#ifndef STDC
+#  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
+#    define const       /* note: need a more gentle solution here */
+#  endif
+#endif
+
+/* Some Mac compilers merge all .h files incorrectly: */
+#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
+#  define NO_DUMMY_DECL
+#endif
+
+/* Maximum value for memLevel in deflateInit2 */
+#ifndef MAX_MEM_LEVEL
+#  ifdef MAXSEG_64K
+#    define MAX_MEM_LEVEL 8
+#  else
+#    define MAX_MEM_LEVEL 9
+#  endif
+#endif
+
+/* Maximum value for windowBits in deflateInit2 and inflateInit2.
+ * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
+ * created by gzip. (Files created by minigzip can still be extracted by
+ * gzip.)
+ */
+#ifndef MAX_WBITS
+#  define MAX_WBITS   15 /* 32K LZ77 window */
+#endif
+
+/* The memory requirements for deflate are (in bytes):
+            (1 << (windowBits+2)) +  (1 << (memLevel+9))
+ that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
+ plus a few kilobytes for small objects. For example, if you want to reduce
+ the default memory requirements from 256K to 128K, compile with
+     make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
+ Of course this will generally degrade compression (there's no free lunch).
+
+   The memory requirements for inflate are (in bytes) 1 << windowBits
+ that is, 32K for windowBits=15 (default value) plus a few kilobytes
+ for small objects.
+*/
+
+                        /* Type declarations */
+
+#ifndef OF /* function prototypes */
+#  ifdef STDC
+#    define OF(args)  args
+#  else
+#    define OF(args)  ()
+#  endif
+#endif
+
+/* The following definitions for FAR are needed only for MSDOS mixed
+ * model programming (small or medium model with some far allocations).
+ * This was tested only with MSC; for other MSDOS compilers you may have
+ * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
+ * just define FAR to be empty.
+ */
+#ifdef SYS16BIT
+#  if defined(M_I86SM) || defined(M_I86MM)
+     /* MSC small or medium model */
+#    define SMALL_MEDIUM
+#    ifdef _MSC_VER
+#      define FAR _far
+#    else
+#      define FAR far
+#    endif
+#  endif
+#  if (defined(__SMALL__) || defined(__MEDIUM__))
+     /* Turbo C small or medium model */
+#    define SMALL_MEDIUM
+#    ifdef __BORLANDC__
+#      define FAR _far
+#    else
+#      define FAR far
+#    endif
+#  endif
+#endif
+
+#if defined(WINDOWS) || defined(WIN32)
+   /* If building or using zlib as a DLL, define ZLIB_DLL.
+    * This is not mandatory, but it offers a little performance increase.
+    */
+#  ifdef ZLIB_DLL
+#    if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
+#      ifdef ZLIB_INTERNAL
+#        define ZEXTERN extern __declspec(dllexport)
+#      else
+#        define ZEXTERN extern __declspec(dllimport)
+#      endif
+#    endif
+#  endif  /* ZLIB_DLL */
+   /* If building or using zlib with the WINAPI/WINAPIV calling convention,
+    * define ZLIB_WINAPI.
+    * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
+    */
+#  ifdef ZLIB_WINAPI
+#    ifdef FAR
+#      undef FAR
+#    endif
+#    include <windows.h>
+     /* No need for _export, use ZLIB.DEF instead. */
+     /* For complete Windows compatibility, use WINAPI, not __stdcall. */
+#    define ZEXPORT WINAPI
+#    ifdef WIN32
+#      define ZEXPORTVA WINAPIV
+#    else
+#      define ZEXPORTVA FAR CDECL
+#    endif
+#  endif
+#endif
+
+#if defined (__BEOS__)
+#  ifdef ZLIB_DLL
+#    ifdef ZLIB_INTERNAL
+#      define ZEXPORT   __declspec(dllexport)
+#      define ZEXPORTVA __declspec(dllexport)
+#    else
+#      define ZEXPORT   __declspec(dllimport)
+#      define ZEXPORTVA __declspec(dllimport)
+#    endif
+#  endif
+#endif
+
+#ifndef ZEXTERN
+#  define ZEXTERN extern
+#endif
+#ifndef ZEXPORT
+#  define ZEXPORT
+#endif
+#ifndef ZEXPORTVA
+#  define ZEXPORTVA
+#endif
+
+#ifndef FAR
+#  define FAR
+#endif
+
+#if !defined(__MACTYPES__)
+typedef unsigned char  Byte;  /* 8 bits */
+#endif
+typedef unsigned int   uInt;  /* 16 bits or more */
+typedef unsigned long  uLong; /* 32 bits or more */
+
+#ifdef SMALL_MEDIUM
+   /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
+#  define Bytef Byte FAR
+#else
+   typedef Byte  FAR Bytef;
+#endif
+typedef char  FAR charf;
+typedef int   FAR intf;
+typedef uInt  FAR uIntf;
+typedef uLong FAR uLongf;
+
+#ifdef STDC
+   typedef void const *voidpc;
+   typedef void FAR   *voidpf;
+   typedef void       *voidp;
+#else
+   typedef Byte const *voidpc;
+   typedef Byte FAR   *voidpf;
+   typedef Byte       *voidp;
+#endif
+
+#if 1    /* was set to #if 1 by ./configure */
+#  define Z_HAVE_UNISTD_H
+#endif
+
+#ifdef STDC
+#  include <sys/types.h>    /* for off_t */
+#endif
+
+/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
+ * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
+ * though the former does not conform to the LFS document), but considering
+ * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
+ * equivalently requesting no 64-bit operations
+ */
+#if -_LARGEFILE64_SOURCE - -1 == 1
+#  undef _LARGEFILE64_SOURCE
+#endif
+
+#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
+#  include <unistd.h>       /* for SEEK_* and off_t */
+#  ifdef VMS
+#    include <unixio.h>     /* for off_t */
+#  endif
+#  ifndef z_off_t
+#    define z_off_t off_t
+#  endif
+#endif
+
+#ifndef SEEK_SET
+#  define SEEK_SET        0       /* Seek from beginning of file.  */
+#  define SEEK_CUR        1       /* Seek from current position.  */
+#  define SEEK_END        2       /* Set file pointer to EOF plus "offset" */
+#endif
+
+#ifndef z_off_t
+#  define z_off_t long
+#endif
+
+#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
+#  define z_off64_t off64_t
+#else
+#  define z_off64_t z_off_t
+#endif
+
+#if defined(__OS400__)
+#  define NO_vsnprintf
+#endif
+
+#if defined(__MVS__)
+#  define NO_vsnprintf
+#endif
+
+/* MVS linker does not support external names larger than 8 bytes */
+#if defined(__MVS__)
+  #pragma map(deflateInit_,"DEIN")
+  #pragma map(deflateInit2_,"DEIN2")
+  #pragma map(deflateEnd,"DEEND")
+  #pragma map(deflateBound,"DEBND")
+  #pragma map(inflateInit_,"ININ")
+  #pragma map(inflateInit2_,"ININ2")
+  #pragma map(inflateEnd,"INEND")
+  #pragma map(inflateSync,"INSY")
+  #pragma map(inflateSetDictionary,"INSEDI")
+  #pragma map(compressBound,"CMBND")
+  #pragma map(inflate_table,"INTABL")
+  #pragma map(inflate_fast,"INFA")
+  #pragma map(inflate_copyright,"INCOPY")
+#endif
+
+#endif /* ZCONF_H */
diff --git a/src/modules/tracepath/zlib.h b/src/modules/tracepath/zlib.h
new file mode 100644 (file)
index 0000000..d3a3da8
--- /dev/null
@@ -0,0 +1,1613 @@
+/* zlib.h -- interface of the 'zlib' general purpose compression library
+  version 1.2.5, April 19th, 2010
+
+  Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+
+  Jean-loup Gailly        Mark Adler
+  jloup@gzip.org          madler@alumni.caltech.edu
+
+
+  The data format used by the zlib library is described by RFCs (Request for
+  Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt
+  (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
+*/
+
+#ifndef ZLIB_H
+#define ZLIB_H
+
+#include "zconf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ZLIB_VERSION "1.2.5"
+#define ZLIB_VERNUM 0x1250
+#define ZLIB_VER_MAJOR 1
+#define ZLIB_VER_MINOR 2
+#define ZLIB_VER_REVISION 5
+#define ZLIB_VER_SUBREVISION 0
+
+/*
+    The 'zlib' compression library provides in-memory compression and
+  decompression functions, including integrity checks of the uncompressed data.
+  This version of the library supports only one compression method (deflation)
+  but other algorithms will be added later and will have the same stream
+  interface.
+
+    Compression can be done in a single step if the buffers are large enough,
+  or can be done by repeated calls of the compression function.  In the latter
+  case, the application must provide more input and/or consume the output
+  (providing more output space) before each call.
+
+    The compressed data format used by default by the in-memory functions is
+  the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
+  around a deflate stream, which is itself documented in RFC 1951.
+
+    The library also supports reading and writing files in gzip (.gz) format
+  with an interface similar to that of stdio using the functions that start
+  with "gz".  The gzip format is different from the zlib format.  gzip is a
+  gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
+
+    This library can optionally read and write gzip streams in memory as well.
+
+    The zlib format was designed to be compact and fast for use in memory
+  and on communications channels.  The gzip format was designed for single-
+  file compression on file systems, has a larger header than zlib to maintain
+  directory information, and uses a different, slower check method than zlib.
+
+    The library does not install any signal handler.  The decoder checks
+  the consistency of the compressed data, so the library should never crash
+  even in case of corrupted input.
+*/
+
+typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
+typedef void   (*free_func)  OF((voidpf opaque, voidpf address));
+
+struct internal_state;
+
+typedef struct z_stream_s {
+    Bytef    *next_in;  /* next input byte */
+    uInt     avail_in;  /* number of bytes available at next_in */
+    uLong    total_in;  /* total nb of input bytes read so far */
+
+    Bytef    *next_out; /* next output byte should be put there */
+    uInt     avail_out; /* remaining free space at next_out */
+    uLong    total_out; /* total nb of bytes output so far */
+
+    char     *msg;      /* last error message, NULL if no error */
+    struct internal_state FAR *state; /* not visible by applications */
+
+    alloc_func zalloc;  /* used to allocate the internal state */
+    free_func  zfree;   /* used to free the internal state */
+    voidpf     opaque;  /* private data object passed to zalloc and zfree */
+
+    int     data_type;  /* best guess about the data type: binary or text */
+    uLong   adler;      /* adler32 value of the uncompressed data */
+    uLong   reserved;   /* reserved for future use */
+} z_stream;
+
+typedef z_stream FAR *z_streamp;
+
+/*
+     gzip header information passed to and from zlib routines.  See RFC 1952
+  for more details on the meanings of these fields.
+*/
+typedef struct gz_header_s {
+    int     text;       /* true if compressed data believed to be text */
+    uLong   time;       /* modification time */
+    int     xflags;     /* extra flags (not used when writing a gzip file) */
+    int     os;         /* operating system */
+    Bytef   *extra;     /* pointer to extra field or Z_NULL if none */
+    uInt    extra_len;  /* extra field length (valid if extra != Z_NULL) */
+    uInt    extra_max;  /* space at extra (only when reading header) */
+    Bytef   *name;      /* pointer to zero-terminated file name or Z_NULL */
+    uInt    name_max;   /* space at name (only when reading header) */
+    Bytef   *comment;   /* pointer to zero-terminated comment or Z_NULL */
+    uInt    comm_max;   /* space at comment (only when reading header) */
+    int     hcrc;       /* true if there was or will be a header crc */
+    int     done;       /* true when done reading gzip header (not used
+                           when writing a gzip file) */
+} gz_header;
+
+typedef gz_header FAR *gz_headerp;
+
+/*
+     The application must update next_in and avail_in when avail_in has dropped
+   to zero.  It must update next_out and avail_out when avail_out has dropped
+   to zero.  The application must initialize zalloc, zfree and opaque before
+   calling the init function.  All other fields are set by the compression
+   library and must not be updated by the application.
+
+     The opaque value provided by the application will be passed as the first
+   parameter for calls of zalloc and zfree.  This can be useful for custom
+   memory management.  The compression library attaches no meaning to the
+   opaque value.
+
+     zalloc must return Z_NULL if there is not enough memory for the object.
+   If zlib is used in a multi-threaded application, zalloc and zfree must be
+   thread safe.
+
+     On 16-bit systems, the functions zalloc and zfree must be able to allocate
+   exactly 65536 bytes, but will not be required to allocate more than this if
+   the symbol MAXSEG_64K is defined (see zconf.h).  WARNING: On MSDOS, pointers
+   returned by zalloc for objects of exactly 65536 bytes *must* have their
+   offset normalized to zero.  The default allocation function provided by this
+   library ensures this (see zutil.c).  To reduce memory requirements and avoid
+   any allocation of 64K objects, at the expense of compression ratio, compile
+   the library with -DMAX_WBITS=14 (see zconf.h).
+
+     The fields total_in and total_out can be used for statistics or progress
+   reports.  After compression, total_in holds the total size of the
+   uncompressed data and may be saved for use in the decompressor (particularly
+   if the decompressor wants to decompress everything in a single step).
+*/
+
+                        /* constants */
+
+#define Z_NO_FLUSH      0
+#define Z_PARTIAL_FLUSH 1
+#define Z_SYNC_FLUSH    2
+#define Z_FULL_FLUSH    3
+#define Z_FINISH        4
+#define Z_BLOCK         5
+#define Z_TREES         6
+/* Allowed flush values; see deflate() and inflate() below for details */
+
+#define Z_OK            0
+#define Z_STREAM_END    1
+#define Z_NEED_DICT     2
+#define Z_ERRNO        (-1)
+#define Z_STREAM_ERROR (-2)
+#define Z_DATA_ERROR   (-3)
+#define Z_MEM_ERROR    (-4)
+#define Z_BUF_ERROR    (-5)
+#define Z_VERSION_ERROR (-6)
+/* Return codes for the compression/decompression functions. Negative values
+ * are errors, positive values are used for special but normal events.
+ */
+
+#define Z_NO_COMPRESSION         0
+#define Z_BEST_SPEED             1
+#define Z_BEST_COMPRESSION       9
+#define Z_DEFAULT_COMPRESSION  (-1)
+/* compression levels */
+
+#define Z_FILTERED            1
+#define Z_HUFFMAN_ONLY        2
+#define Z_RLE                 3
+#define Z_FIXED               4
+#define Z_DEFAULT_STRATEGY    0
+/* compression strategy; see deflateInit2() below for details */
+
+#define Z_BINARY   0
+#define Z_TEXT     1
+#define Z_ASCII    Z_TEXT   /* for compatibility with 1.2.2 and earlier */
+#define Z_UNKNOWN  2
+/* Possible values of the data_type field (though see inflate()) */
+
+#define Z_DEFLATED   8
+/* The deflate compression method (the only one supported in this version) */
+
+#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
+
+#define zlib_version zlibVersion()
+/* for compatibility with versions < 1.0.2 */
+
+
+                        /* basic functions */
+
+ZEXTERN const char * ZEXPORT zlibVersion OF((void));
+/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
+   If the first character differs, the library code actually used is not
+   compatible with the zlib.h header file used by the application.  This check
+   is automatically made by deflateInit and inflateInit.
+ */
+
+/*
+ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
+
+     Initializes the internal stream state for compression.  The fields
+   zalloc, zfree and opaque must be initialized before by the caller.  If
+   zalloc and zfree are set to Z_NULL, deflateInit updates them to use default
+   allocation functions.
+
+     The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
+   1 gives best speed, 9 gives best compression, 0 gives no compression at all
+   (the input data is simply copied a block at a time).  Z_DEFAULT_COMPRESSION
+   requests a default compromise between speed and compression (currently
+   equivalent to level 6).
+
+     deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_STREAM_ERROR if level is not a valid compression level, or
+   Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
+   with the version assumed by the caller (ZLIB_VERSION).  msg is set to null
+   if there is no error message.  deflateInit does not perform any compression:
+   this will be done by deflate().
+*/
+
+
+ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
+/*
+    deflate compresses as much data as possible, and stops when the input
+  buffer becomes empty or the output buffer becomes full.  It may introduce
+  some output latency (reading input without producing any output) except when
+  forced to flush.
+
+    The detailed semantics are as follows.  deflate performs one or both of the
+  following actions:
+
+  - Compress more input starting at next_in and update next_in and avail_in
+    accordingly.  If not all input can be processed (because there is not
+    enough room in the output buffer), next_in and avail_in are updated and
+    processing will resume at this point for the next call of deflate().
+
+  - Provide more output starting at next_out and update next_out and avail_out
+    accordingly.  This action is forced if the parameter flush is non zero.
+    Forcing flush frequently degrades the compression ratio, so this parameter
+    should be set only when necessary (in interactive applications).  Some
+    output may be provided even if flush is not set.
+
+    Before the call of deflate(), the application should ensure that at least
+  one of the actions is possible, by providing more input and/or consuming more
+  output, and updating avail_in or avail_out accordingly; avail_out should
+  never be zero before the call.  The application can consume the compressed
+  output when it wants, for example when the output buffer is full (avail_out
+  == 0), or after each call of deflate().  If deflate returns Z_OK and with
+  zero avail_out, it must be called again after making room in the output
+  buffer because there might be more output pending.
+
+    Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
+  decide how much data to accumulate before producing output, in order to
+  maximize compression.
+
+    If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
+  flushed to the output buffer and the output is aligned on a byte boundary, so
+  that the decompressor can get all input data available so far.  (In
+  particular avail_in is zero after the call if enough output space has been
+  provided before the call.) Flushing may degrade compression for some
+  compression algorithms and so it should be used only when necessary.  This
+  completes the current deflate block and follows it with an empty stored block
+  that is three bits plus filler bits to the next byte, followed by four bytes
+  (00 00 ff ff).
+
+    If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the
+  output buffer, but the output is not aligned to a byte boundary.  All of the
+  input data so far will be available to the decompressor, as for Z_SYNC_FLUSH.
+  This completes the current deflate block and follows it with an empty fixed
+  codes block that is 10 bits long.  This assures that enough bytes are output
+  in order for the decompressor to finish the block before the empty fixed code
+  block.
+
+    If flush is set to Z_BLOCK, a deflate block is completed and emitted, as
+  for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to
+  seven bits of the current block are held to be written as the next byte after
+  the next deflate block is completed.  In this case, the decompressor may not
+  be provided enough bits at this point in order to complete decompression of
+  the data provided so far to the compressor.  It may need to wait for the next
+  block to be emitted.  This is for advanced applications that need to control
+  the emission of deflate blocks.
+
+    If flush is set to Z_FULL_FLUSH, all output is flushed as with
+  Z_SYNC_FLUSH, and the compression state is reset so that decompression can
+  restart from this point if previous compressed data has been damaged or if
+  random access is desired.  Using Z_FULL_FLUSH too often can seriously degrade
+  compression.
+
+    If deflate returns with avail_out == 0, this function must be called again
+  with the same value of the flush parameter and more output space (updated
+  avail_out), until the flush is complete (deflate returns with non-zero
+  avail_out).  In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
+  avail_out is greater than six to avoid repeated flush markers due to
+  avail_out == 0 on return.
+
+    If the parameter flush is set to Z_FINISH, pending input is processed,
+  pending output is flushed and deflate returns with Z_STREAM_END if there was
+  enough output space; if deflate returns with Z_OK, this function must be
+  called again with Z_FINISH and more output space (updated avail_out) but no
+  more input data, until it returns with Z_STREAM_END or an error.  After
+  deflate has returned Z_STREAM_END, the only possible operations on the stream
+  are deflateReset or deflateEnd.
+
+    Z_FINISH can be used immediately after deflateInit if all the compression
+  is to be done in a single step.  In this case, avail_out must be at least the
+  value returned by deflateBound (see below).  If deflate does not return
+  Z_STREAM_END, then it must be called again as described above.
+
+    deflate() sets strm->adler to the adler32 checksum of all input read
+  so far (that is, total_in bytes).
+
+    deflate() may update strm->data_type if it can make a good guess about
+  the input data type (Z_BINARY or Z_TEXT).  In doubt, the data is considered
+  binary.  This field is only for information purposes and does not affect the
+  compression algorithm in any manner.
+
+    deflate() returns Z_OK if some progress has been made (more input
+  processed or more output produced), Z_STREAM_END if all input has been
+  consumed and all output has been produced (only when flush is set to
+  Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
+  if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible
+  (for example avail_in or avail_out was zero).  Note that Z_BUF_ERROR is not
+  fatal, and deflate() can be called again with more input and more output
+  space to continue compressing.
+*/
+
+
+ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
+/*
+     All dynamically allocated data structures for this stream are freed.
+   This function discards any unprocessed input and does not flush any pending
+   output.
+
+     deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
+   stream state was inconsistent, Z_DATA_ERROR if the stream was freed
+   prematurely (some input or output was discarded).  In the error case, msg
+   may be set but then points to a static string (which must not be
+   deallocated).
+*/
+
+
+/*
+ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
+
+     Initializes the internal stream state for decompression.  The fields
+   next_in, avail_in, zalloc, zfree and opaque must be initialized before by
+   the caller.  If next_in is not Z_NULL and avail_in is large enough (the
+   exact value depends on the compression method), inflateInit determines the
+   compression method from the zlib header and allocates all data structures
+   accordingly; otherwise the allocation will be deferred to the first call of
+   inflate.  If zalloc and zfree are set to Z_NULL, inflateInit updates them to
+   use default allocation functions.
+
+     inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
+   version assumed by the caller, or Z_STREAM_ERROR if the parameters are
+   invalid, such as a null pointer to the structure.  msg is set to null if
+   there is no error message.  inflateInit does not perform any decompression
+   apart from possibly reading the zlib header if present: actual decompression
+   will be done by inflate().  (So next_in and avail_in may be modified, but
+   next_out and avail_out are unused and unchanged.) The current implementation
+   of inflateInit() does not process any header information -- that is deferred
+   until inflate() is called.
+*/
+
+
+ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
+/*
+    inflate decompresses as much data as possible, and stops when the input
+  buffer becomes empty or the output buffer becomes full.  It may introduce
+  some output latency (reading input without producing any output) except when
+  forced to flush.
+
+  The detailed semantics are as follows.  inflate performs one or both of the
+  following actions:
+
+  - Decompress more input starting at next_in and update next_in and avail_in
+    accordingly.  If not all input can be processed (because there is not
+    enough room in the output buffer), next_in is updated and processing will
+    resume at this point for the next call of inflate().
+
+  - Provide more output starting at next_out and update next_out and avail_out
+    accordingly.  inflate() provides as much output as possible, until there is
+    no more input data or no more space in the output buffer (see below about
+    the flush parameter).
+
+    Before the call of inflate(), the application should ensure that at least
+  one of the actions is possible, by providing more input and/or consuming more
+  output, and updating the next_* and avail_* values accordingly.  The
+  application can consume the uncompressed output when it wants, for example
+  when the output buffer is full (avail_out == 0), or after each call of
+  inflate().  If inflate returns Z_OK and with zero avail_out, it must be
+  called again after making room in the output buffer because there might be
+  more output pending.
+
+    The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH,
+  Z_BLOCK, or Z_TREES.  Z_SYNC_FLUSH requests that inflate() flush as much
+  output as possible to the output buffer.  Z_BLOCK requests that inflate()
+  stop if and when it gets to the next deflate block boundary.  When decoding
+  the zlib or gzip format, this will cause inflate() to return immediately
+  after the header and before the first block.  When doing a raw inflate,
+  inflate() will go ahead and process the first block, and will return when it
+  gets to the end of that block, or when it runs out of data.
+
+    The Z_BLOCK option assists in appending to or combining deflate streams.
+  Also to assist in this, on return inflate() will set strm->data_type to the
+  number of unused bits in the last byte taken from strm->next_in, plus 64 if
+  inflate() is currently decoding the last block in the deflate stream, plus
+  128 if inflate() returned immediately after decoding an end-of-block code or
+  decoding the complete header up to just before the first byte of the deflate
+  stream.  The end-of-block will not be indicated until all of the uncompressed
+  data from that block has been written to strm->next_out.  The number of
+  unused bits may in general be greater than seven, except when bit 7 of
+  data_type is set, in which case the number of unused bits will be less than
+  eight.  data_type is set as noted here every time inflate() returns for all
+  flush options, and so can be used to determine the amount of currently
+  consumed input in bits.
+
+    The Z_TREES option behaves as Z_BLOCK does, but it also returns when the
+  end of each deflate block header is reached, before any actual data in that
+  block is decoded.  This allows the caller to determine the length of the
+  deflate block header for later use in random access within a deflate block.
+  256 is added to the value of strm->data_type when inflate() returns
+  immediately after reaching the end of the deflate block header.
+
+    inflate() should normally be called until it returns Z_STREAM_END or an
+  error.  However if all decompression is to be performed in a single step (a
+  single call of inflate), the parameter flush should be set to Z_FINISH.  In
+  this case all pending input is processed and all pending output is flushed;
+  avail_out must be large enough to hold all the uncompressed data.  (The size
+  of the uncompressed data may have been saved by the compressor for this
+  purpose.) The next operation on this stream must be inflateEnd to deallocate
+  the decompression state.  The use of Z_FINISH is never required, but can be
+  used to inform inflate that a faster approach may be used for the single
+  inflate() call.
+
+     In this implementation, inflate() always flushes as much output as
+  possible to the output buffer, and always uses the faster approach on the
+  first call.  So the only effect of the flush parameter in this implementation
+  is on the return value of inflate(), as noted below, or when it returns early
+  because Z_BLOCK or Z_TREES is used.
+
+     If a preset dictionary is needed after this call (see inflateSetDictionary
+  below), inflate sets strm->adler to the adler32 checksum of the dictionary
+  chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
+  strm->adler to the adler32 checksum of all output produced so far (that is,
+  total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
+  below.  At the end of the stream, inflate() checks that its computed adler32
+  checksum is equal to that saved by the compressor and returns Z_STREAM_END
+  only if the checksum is correct.
+
+    inflate() can decompress and check either zlib-wrapped or gzip-wrapped
+  deflate data.  The header type is detected automatically, if requested when
+  initializing with inflateInit2().  Any information contained in the gzip
+  header is not retained, so applications that need that information should
+  instead use raw inflate, see inflateInit2() below, or inflateBack() and
+  perform their own processing of the gzip header and trailer.
+
+    inflate() returns Z_OK if some progress has been made (more input processed
+  or more output produced), Z_STREAM_END if the end of the compressed data has
+  been reached and all uncompressed output has been produced, Z_NEED_DICT if a
+  preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
+  corrupted (input stream not conforming to the zlib format or incorrect check
+  value), Z_STREAM_ERROR if the stream structure was inconsistent (for example
+  next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory,
+  Z_BUF_ERROR if no progress is possible or if there was not enough room in the
+  output buffer when Z_FINISH is used.  Note that Z_BUF_ERROR is not fatal, and
+  inflate() can be called again with more input and more output space to
+  continue decompressing.  If Z_DATA_ERROR is returned, the application may
+  then call inflateSync() to look for a good compression block if a partial
+  recovery of the data is desired.
+*/
+
+
+ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
+/*
+     All dynamically allocated data structures for this stream are freed.
+   This function discards any unprocessed input and does not flush any pending
+   output.
+
+     inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
+   was inconsistent.  In the error case, msg may be set but then points to a
+   static string (which must not be deallocated).
+*/
+
+
+                        /* Advanced functions */
+
+/*
+    The following functions are needed only in some special applications.
+*/
+
+/*
+ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
+                                     int  level,
+                                     int  method,
+                                     int  windowBits,
+                                     int  memLevel,
+                                     int  strategy));
+
+     This is another version of deflateInit with more compression options.  The
+   fields next_in, zalloc, zfree and opaque must be initialized before by the
+   caller.
+
+     The method parameter is the compression method.  It must be Z_DEFLATED in
+   this version of the library.
+
+     The windowBits parameter is the base two logarithm of the window size
+   (the size of the history buffer).  It should be in the range 8..15 for this
+   version of the library.  Larger values of this parameter result in better
+   compression at the expense of memory usage.  The default value is 15 if
+   deflateInit is used instead.
+
+     windowBits can also be -8..-15 for raw deflate.  In this case, -windowBits
+   determines the window size.  deflate() will then generate raw deflate data
+   with no zlib header or trailer, and will not compute an adler32 check value.
+
+     windowBits can also be greater than 15 for optional gzip encoding.  Add
+   16 to windowBits to write a simple gzip header and trailer around the
+   compressed data instead of a zlib wrapper.  The gzip header will have no
+   file name, no extra data, no comment, no modification time (set to zero), no
+   header crc, and the operating system will be set to 255 (unknown).  If a
+   gzip stream is being written, strm->adler is a crc32 instead of an adler32.
+
+     The memLevel parameter specifies how much memory should be allocated
+   for the internal compression state.  memLevel=1 uses minimum memory but is
+   slow and reduces compression ratio; memLevel=9 uses maximum memory for
+   optimal speed.  The default value is 8.  See zconf.h for total memory usage
+   as a function of windowBits and memLevel.
+
+     The strategy parameter is used to tune the compression algorithm.  Use the
+   value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
+   filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no
+   string match), or Z_RLE to limit match distances to one (run-length
+   encoding).  Filtered data consists mostly of small values with a somewhat
+   random distribution.  In this case, the compression algorithm is tuned to
+   compress them better.  The effect of Z_FILTERED is to force more Huffman
+   coding and less string matching; it is somewhat intermediate between
+   Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY.  Z_RLE is designed to be almost as
+   fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data.  The
+   strategy parameter only affects the compression ratio but not the
+   correctness of the compressed output even if it is not set appropriately.
+   Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler
+   decoder for special applications.
+
+     deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid
+   method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is
+   incompatible with the version assumed by the caller (ZLIB_VERSION).  msg is
+   set to null if there is no error message.  deflateInit2 does not perform any
+   compression: this will be done by deflate().
+*/
+
+ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
+                                             const Bytef *dictionary,
+                                             uInt  dictLength));
+/*
+     Initializes the compression dictionary from the given byte sequence
+   without producing any compressed output.  This function must be called
+   immediately after deflateInit, deflateInit2 or deflateReset, before any call
+   of deflate.  The compressor and decompressor must use exactly the same
+   dictionary (see inflateSetDictionary).
+
+     The dictionary should consist of strings (byte sequences) that are likely
+   to be encountered later in the data to be compressed, with the most commonly
+   used strings preferably put towards the end of the dictionary.  Using a
+   dictionary is most useful when the data to be compressed is short and can be
+   predicted with good accuracy; the data can then be compressed better than
+   with the default empty dictionary.
+
+     Depending on the size of the compression data structures selected by
+   deflateInit or deflateInit2, a part of the dictionary may in effect be
+   discarded, for example if the dictionary is larger than the window size
+   provided in deflateInit or deflateInit2.  Thus the strings most likely to be
+   useful should be put at the end of the dictionary, not at the front.  In
+   addition, the current implementation of deflate will use at most the window
+   size minus 262 bytes of the provided dictionary.
+
+     Upon return of this function, strm->adler is set to the adler32 value
+   of the dictionary; the decompressor may later use this value to determine
+   which dictionary has been used by the compressor.  (The adler32 value
+   applies to the whole dictionary even if only a subset of the dictionary is
+   actually used by the compressor.) If a raw deflate was requested, then the
+   adler32 value is not computed and strm->adler is not set.
+
+     deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
+   parameter is invalid (e.g.  dictionary being Z_NULL) or the stream state is
+   inconsistent (for example if deflate has already been called for this stream
+   or if the compression method is bsort).  deflateSetDictionary does not
+   perform any compression: this will be done by deflate().
+*/
+
+ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
+                                    z_streamp source));
+/*
+     Sets the destination stream as a complete copy of the source stream.
+
+     This function can be useful when several compression strategies will be
+   tried, for example when there are several ways of pre-processing the input
+   data with a filter.  The streams that will be discarded should then be freed
+   by calling deflateEnd.  Note that deflateCopy duplicates the internal
+   compression state which can be quite large, so this strategy is slow and can
+   consume lots of memory.
+
+     deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
+   (such as zalloc being Z_NULL).  msg is left unchanged in both source and
+   destination.
+*/
+
+ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
+/*
+     This function is equivalent to deflateEnd followed by deflateInit,
+   but does not free and reallocate all the internal compression state.  The
+   stream will keep the same compression level and any other attributes that
+   may have been set by deflateInit2.
+
+     deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent (such as zalloc or state being Z_NULL).
+*/
+
+ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
+                                      int level,
+                                      int strategy));
+/*
+     Dynamically update the compression level and compression strategy.  The
+   interpretation of level and strategy is as in deflateInit2.  This can be
+   used to switch between compression and straight copy of the input data, or
+   to switch to a different kind of input data requiring a different strategy.
+   If the compression level is changed, the input available so far is
+   compressed with the old level (and may be flushed); the new level will take
+   effect only at the next call of deflate().
+
+     Before the call of deflateParams, the stream state must be set as for
+   a call of deflate(), since the currently available input may have to be
+   compressed and flushed.  In particular, strm->avail_out must be non-zero.
+
+     deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
+   stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if
+   strm->avail_out was zero.
+*/
+
+ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
+                                    int good_length,
+                                    int max_lazy,
+                                    int nice_length,
+                                    int max_chain));
+/*
+     Fine tune deflate's internal compression parameters.  This should only be
+   used by someone who understands the algorithm used by zlib's deflate for
+   searching for the best matching string, and even then only by the most
+   fanatic optimizer trying to squeeze out the last compressed bit for their
+   specific input data.  Read the deflate.c source code for the meaning of the
+   max_lazy, good_length, nice_length, and max_chain parameters.
+
+     deflateTune() can be called after deflateInit() or deflateInit2(), and
+   returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
+ */
+
+ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
+                                       uLong sourceLen));
+/*
+     deflateBound() returns an upper bound on the compressed size after
+   deflation of sourceLen bytes.  It must be called after deflateInit() or
+   deflateInit2(), and after deflateSetHeader(), if used.  This would be used
+   to allocate an output buffer for deflation in a single pass, and so would be
+   called before deflate().
+*/
+
+ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
+                                     int bits,
+                                     int value));
+/*
+     deflatePrime() inserts bits in the deflate output stream.  The intent
+   is that this function is used to start off the deflate output with the bits
+   leftover from a previous deflate stream when appending to it.  As such, this
+   function can only be used for raw deflate, and must be used before the first
+   deflate() call after a deflateInit2() or deflateReset().  bits must be less
+   than or equal to 16, and that many of the least significant bits of value
+   will be inserted in the output.
+
+     deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent.
+*/
+
+ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
+                                         gz_headerp head));
+/*
+     deflateSetHeader() provides gzip header information for when a gzip
+   stream is requested by deflateInit2().  deflateSetHeader() may be called
+   after deflateInit2() or deflateReset() and before the first call of
+   deflate().  The text, time, os, extra field, name, and comment information
+   in the provided gz_header structure are written to the gzip header (xflag is
+   ignored -- the extra flags are set according to the compression level).  The
+   caller must assure that, if not Z_NULL, name and comment are terminated with
+   a zero byte, and that if extra is not Z_NULL, that extra_len bytes are
+   available there.  If hcrc is true, a gzip header crc is included.  Note that
+   the current versions of the command-line version of gzip (up through version
+   1.3.x) do not support header crc's, and will report that it is a "multi-part
+   gzip file" and give up.
+
+     If deflateSetHeader is not used, the default gzip header has text false,
+   the time set to zero, and os set to 255, with no extra, name, or comment
+   fields.  The gzip header is returned to the default state by deflateReset().
+
+     deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent.
+*/
+
+/*
+ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
+                                     int  windowBits));
+
+     This is another version of inflateInit with an extra parameter.  The
+   fields next_in, avail_in, zalloc, zfree and opaque must be initialized
+   before by the caller.
+
+     The windowBits parameter is the base two logarithm of the maximum window
+   size (the size of the history buffer).  It should be in the range 8..15 for
+   this version of the library.  The default value is 15 if inflateInit is used
+   instead.  windowBits must be greater than or equal to the windowBits value
+   provided to deflateInit2() while compressing, or it must be equal to 15 if
+   deflateInit2() was not used.  If a compressed stream with a larger window
+   size is given as input, inflate() will return with the error code
+   Z_DATA_ERROR instead of trying to allocate a larger window.
+
+     windowBits can also be zero to request that inflate use the window size in
+   the zlib header of the compressed stream.
+
+     windowBits can also be -8..-15 for raw inflate.  In this case, -windowBits
+   determines the window size.  inflate() will then process raw deflate data,
+   not looking for a zlib or gzip header, not generating a check value, and not
+   looking for any check values for comparison at the end of the stream.  This
+   is for use with other formats that use the deflate compressed data format
+   such as zip.  Those formats provide their own check values.  If a custom
+   format is developed using the raw deflate format for compressed data, it is
+   recommended that a check value such as an adler32 or a crc32 be applied to
+   the uncompressed data as is done in the zlib, gzip, and zip formats.  For
+   most applications, the zlib format should be used as is.  Note that comments
+   above on the use in deflateInit2() applies to the magnitude of windowBits.
+
+     windowBits can also be greater than 15 for optional gzip decoding.  Add
+   32 to windowBits to enable zlib and gzip decoding with automatic header
+   detection, or add 16 to decode only the gzip format (the zlib format will
+   return a Z_DATA_ERROR).  If a gzip stream is being decoded, strm->adler is a
+   crc32 instead of an adler32.
+
+     inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
+   version assumed by the caller, or Z_STREAM_ERROR if the parameters are
+   invalid, such as a null pointer to the structure.  msg is set to null if
+   there is no error message.  inflateInit2 does not perform any decompression
+   apart from possibly reading the zlib header if present: actual decompression
+   will be done by inflate().  (So next_in and avail_in may be modified, but
+   next_out and avail_out are unused and unchanged.) The current implementation
+   of inflateInit2() does not process any header information -- that is
+   deferred until inflate() is called.
+*/
+
+ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
+                                             const Bytef *dictionary,
+                                             uInt  dictLength));
+/*
+     Initializes the decompression dictionary from the given uncompressed byte
+   sequence.  This function must be called immediately after a call of inflate,
+   if that call returned Z_NEED_DICT.  The dictionary chosen by the compressor
+   can be determined from the adler32 value returned by that call of inflate.
+   The compressor and decompressor must use exactly the same dictionary (see
+   deflateSetDictionary).  For raw inflate, this function can be called
+   immediately after inflateInit2() or inflateReset() and before any call of
+   inflate() to set the dictionary.  The application must insure that the
+   dictionary that was used for compression is provided.
+
+     inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
+   parameter is invalid (e.g.  dictionary being Z_NULL) or the stream state is
+   inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
+   expected one (incorrect adler32 value).  inflateSetDictionary does not
+   perform any decompression: this will be done by subsequent calls of
+   inflate().
+*/
+
+ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
+/*
+     Skips invalid compressed data until a full flush point (see above the
+   description of deflate with Z_FULL_FLUSH) can be found, or until all
+   available input is skipped.  No output is provided.
+
+     inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR
+   if no more input was provided, Z_DATA_ERROR if no flush point has been
+   found, or Z_STREAM_ERROR if the stream structure was inconsistent.  In the
+   success case, the application may save the current current value of total_in
+   which indicates where valid compressed data was found.  In the error case,
+   the application may repeatedly call inflateSync, providing more input each
+   time, until success or end of the input data.
+*/
+
+ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
+                                    z_streamp source));
+/*
+     Sets the destination stream as a complete copy of the source stream.
+
+     This function can be useful when randomly accessing a large stream.  The
+   first pass through the stream can periodically record the inflate state,
+   allowing restarting inflate at those points when randomly accessing the
+   stream.
+
+     inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
+   (such as zalloc being Z_NULL).  msg is left unchanged in both source and
+   destination.
+*/
+
+ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
+/*
+     This function is equivalent to inflateEnd followed by inflateInit,
+   but does not free and reallocate all the internal decompression state.  The
+   stream will keep attributes that may have been set by inflateInit2.
+
+     inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent (such as zalloc or state being Z_NULL).
+*/
+
+ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,
+                                      int windowBits));
+/*
+     This function is the same as inflateReset, but it also permits changing
+   the wrap and window size requests.  The windowBits parameter is interpreted
+   the same as it is for inflateInit2.
+
+     inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent (such as zalloc or state being Z_NULL), or if
+   the windowBits parameter is invalid.
+*/
+
+ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
+                                     int bits,
+                                     int value));
+/*
+     This function inserts bits in the inflate input stream.  The intent is
+   that this function is used to start inflating at a bit position in the
+   middle of a byte.  The provided bits will be used before any bytes are used
+   from next_in.  This function should only be used with raw inflate, and
+   should be used before the first inflate() call after inflateInit2() or
+   inflateReset().  bits must be less than or equal to 16, and that many of the
+   least significant bits of value will be inserted in the input.
+
+     If bits is negative, then the input stream bit buffer is emptied.  Then
+   inflatePrime() can be called again to put bits in the buffer.  This is used
+   to clear out bits leftover after feeding inflate a block description prior
+   to feeding inflate codes.
+
+     inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent.
+*/
+
+ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm));
+/*
+     This function returns two values, one in the lower 16 bits of the return
+   value, and the other in the remaining upper bits, obtained by shifting the
+   return value down 16 bits.  If the upper value is -1 and the lower value is
+   zero, then inflate() is currently decoding information outside of a block.
+   If the upper value is -1 and the lower value is non-zero, then inflate is in
+   the middle of a stored block, with the lower value equaling the number of
+   bytes from the input remaining to copy.  If the upper value is not -1, then
+   it is the number of bits back from the current bit position in the input of
+   the code (literal or length/distance pair) currently being processed.  In
+   that case the lower value is the number of bytes already emitted for that
+   code.
+
+     A code is being processed if inflate is waiting for more input to complete
+   decoding of the code, or if it has completed decoding but is waiting for
+   more output space to write the literal or match data.
+
+     inflateMark() is used to mark locations in the input data for random
+   access, which may be at bit positions, and to note those cases where the
+   output of a code may span boundaries of random access blocks.  The current
+   location in the input stream can be determined from avail_in and data_type
+   as noted in the description for the Z_BLOCK flush parameter for inflate.
+
+     inflateMark returns the value noted above or -1 << 16 if the provided
+   source stream state was inconsistent.
+*/
+
+ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
+                                         gz_headerp head));
+/*
+     inflateGetHeader() requests that gzip header information be stored in the
+   provided gz_header structure.  inflateGetHeader() may be called after
+   inflateInit2() or inflateReset(), and before the first call of inflate().
+   As inflate() processes the gzip stream, head->done is zero until the header
+   is completed, at which time head->done is set to one.  If a zlib stream is
+   being decoded, then head->done is set to -1 to indicate that there will be
+   no gzip header information forthcoming.  Note that Z_BLOCK or Z_TREES can be
+   used to force inflate() to return immediately after header processing is
+   complete and before any actual data is decompressed.
+
+     The text, time, xflags, and os fields are filled in with the gzip header
+   contents.  hcrc is set to true if there is a header CRC.  (The header CRC
+   was valid if done is set to one.) If extra is not Z_NULL, then extra_max
+   contains the maximum number of bytes to write to extra.  Once done is true,
+   extra_len contains the actual extra field length, and extra contains the
+   extra field, or that field truncated if extra_max is less than extra_len.
+   If name is not Z_NULL, then up to name_max characters are written there,
+   terminated with a zero unless the length is greater than name_max.  If
+   comment is not Z_NULL, then up to comm_max characters are written there,
+   terminated with a zero unless the length is greater than comm_max.  When any
+   of extra, name, or comment are not Z_NULL and the respective field is not
+   present in the header, then that field is set to Z_NULL to signal its
+   absence.  This allows the use of deflateSetHeader() with the returned
+   structure to duplicate the header.  However if those fields are set to
+   allocated memory, then the application will need to save those pointers
+   elsewhere so that they can be eventually freed.
+
+     If inflateGetHeader is not used, then the header information is simply
+   discarded.  The header is always checked for validity, including the header
+   CRC if present.  inflateReset() will reset the process to discard the header
+   information.  The application would need to call inflateGetHeader() again to
+   retrieve the header from the next gzip stream.
+
+     inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
+   stream state was inconsistent.
+*/
+
+/*
+ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
+                                        unsigned char FAR *window));
+
+     Initialize the internal stream state for decompression using inflateBack()
+   calls.  The fields zalloc, zfree and opaque in strm must be initialized
+   before the call.  If zalloc and zfree are Z_NULL, then the default library-
+   derived memory allocation routines are used.  windowBits is the base two
+   logarithm of the window size, in the range 8..15.  window is a caller
+   supplied buffer of that size.  Except for special applications where it is
+   assured that deflate was used with small window sizes, windowBits must be 15
+   and a 32K byte window must be supplied to be able to decompress general
+   deflate streams.
+
+     See inflateBack() for the usage of these routines.
+
+     inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
+   the paramaters are invalid, Z_MEM_ERROR if the internal state could not be
+   allocated, or Z_VERSION_ERROR if the version of the library does not match
+   the version of the header file.
+*/
+
+typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));
+typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
+
+ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
+                                    in_func in, void FAR *in_desc,
+                                    out_func out, void FAR *out_desc));
+/*
+     inflateBack() does a raw inflate with a single call using a call-back
+   interface for input and output.  This is more efficient than inflate() for
+   file i/o applications in that it avoids copying between the output and the
+   sliding window by simply making the window itself the output buffer.  This
+   function trusts the application to not change the output buffer passed by
+   the output function, at least until inflateBack() returns.
+
+     inflateBackInit() must be called first to allocate the internal state
+   and to initialize the state with the user-provided window buffer.
+   inflateBack() may then be used multiple times to inflate a complete, raw
+   deflate stream with each call.  inflateBackEnd() is then called to free the
+   allocated state.
+
+     A raw deflate stream is one with no zlib or gzip header or trailer.
+   This routine would normally be used in a utility that reads zip or gzip
+   files and writes out uncompressed files.  The utility would decode the
+   header and process the trailer on its own, hence this routine expects only
+   the raw deflate stream to decompress.  This is different from the normal
+   behavior of inflate(), which expects either a zlib or gzip header and
+   trailer around the deflate stream.
+
+     inflateBack() uses two subroutines supplied by the caller that are then
+   called by inflateBack() for input and output.  inflateBack() calls those
+   routines until it reads a complete deflate stream and writes out all of the
+   uncompressed data, or until it encounters an error.  The function's
+   parameters and return types are defined above in the in_func and out_func
+   typedefs.  inflateBack() will call in(in_desc, &buf) which should return the
+   number of bytes of provided input, and a pointer to that input in buf.  If
+   there is no input available, in() must return zero--buf is ignored in that
+   case--and inflateBack() will return a buffer error.  inflateBack() will call
+   out(out_desc, buf, len) to write the uncompressed data buf[0..len-1].  out()
+   should return zero on success, or non-zero on failure.  If out() returns
+   non-zero, inflateBack() will return with an error.  Neither in() nor out()
+   are permitted to change the contents of the window provided to
+   inflateBackInit(), which is also the buffer that out() uses to write from.
+   The length written by out() will be at most the window size.  Any non-zero
+   amount of input may be provided by in().
+
+     For convenience, inflateBack() can be provided input on the first call by
+   setting strm->next_in and strm->avail_in.  If that input is exhausted, then
+   in() will be called.  Therefore strm->next_in must be initialized before
+   calling inflateBack().  If strm->next_in is Z_NULL, then in() will be called
+   immediately for input.  If strm->next_in is not Z_NULL, then strm->avail_in
+   must also be initialized, and then if strm->avail_in is not zero, input will
+   initially be taken from strm->next_in[0 ..  strm->avail_in - 1].
+
+     The in_desc and out_desc parameters of inflateBack() is passed as the
+   first parameter of in() and out() respectively when they are called.  These
+   descriptors can be optionally used to pass any information that the caller-
+   supplied in() and out() functions need to do their job.
+
+     On return, inflateBack() will set strm->next_in and strm->avail_in to
+   pass back any unused input that was provided by the last in() call.  The
+   return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR
+   if in() or out() returned an error, Z_DATA_ERROR if there was a format error
+   in the deflate stream (in which case strm->msg is set to indicate the nature
+   of the error), or Z_STREAM_ERROR if the stream was not properly initialized.
+   In the case of Z_BUF_ERROR, an input or output error can be distinguished
+   using strm->next_in which will be Z_NULL only if in() returned an error.  If
+   strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning
+   non-zero.  (in() will always be called before out(), so strm->next_in is
+   assured to be defined if out() returns non-zero.) Note that inflateBack()
+   cannot return Z_OK.
+*/
+
+ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
+/*
+     All memory allocated by inflateBackInit() is freed.
+
+     inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream
+   state was inconsistent.
+*/
+
+ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
+/* Return flags indicating compile-time options.
+
+    Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
+     1.0: size of uInt
+     3.2: size of uLong
+     5.4: size of voidpf (pointer)
+     7.6: size of z_off_t
+
+    Compiler, assembler, and debug options:
+     8: DEBUG
+     9: ASMV or ASMINF -- use ASM code
+     10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
+     11: 0 (reserved)
+
+    One-time table building (smaller code, but not thread-safe if true):
+     12: BUILDFIXED -- build static block decoding tables when needed
+     13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed
+     14,15: 0 (reserved)
+
+    Library content (indicates missing functionality):
+     16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking
+                          deflate code when not needed)
+     17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect
+                    and decode gzip streams (to avoid linking crc code)
+     18-19: 0 (reserved)
+
+    Operation variations (changes in library functionality):
+     20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate
+     21: FASTEST -- deflate algorithm with only one, lowest compression level
+     22,23: 0 (reserved)
+
+    The sprintf variant used by gzprintf (zero is best):
+     24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format
+     25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!
+     26: 0 = returns value, 1 = void -- 1 means inferred string length returned
+
+    Remainder:
+     27-31: 0 (reserved)
+ */
+
+
+                        /* utility functions */
+
+/*
+     The following utility functions are implemented on top of the basic
+   stream-oriented functions.  To simplify the interface, some default options
+   are assumed (compression level and memory usage, standard memory allocation
+   functions).  The source code of these utility functions can be modified if
+   you need special options.
+*/
+
+ZEXTERN int ZEXPORT compress OF((Bytef *dest,   uLongf *destLen,
+                                 const Bytef *source, uLong sourceLen));
+/*
+     Compresses the source buffer into the destination buffer.  sourceLen is
+   the byte length of the source buffer.  Upon entry, destLen is the total size
+   of the destination buffer, which must be at least the value returned by
+   compressBound(sourceLen).  Upon exit, destLen is the actual size of the
+   compressed buffer.
+
+     compress returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_BUF_ERROR if there was not enough room in the output
+   buffer.
+*/
+
+ZEXTERN int ZEXPORT compress2 OF((Bytef *dest,   uLongf *destLen,
+                                  const Bytef *source, uLong sourceLen,
+                                  int level));
+/*
+     Compresses the source buffer into the destination buffer.  The level
+   parameter has the same meaning as in deflateInit.  sourceLen is the byte
+   length of the source buffer.  Upon entry, destLen is the total size of the
+   destination buffer, which must be at least the value returned by
+   compressBound(sourceLen).  Upon exit, destLen is the actual size of the
+   compressed buffer.
+
+     compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
+   memory, Z_BUF_ERROR if there was not enough room in the output buffer,
+   Z_STREAM_ERROR if the level parameter is invalid.
+*/
+
+ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
+/*
+     compressBound() returns an upper bound on the compressed size after
+   compress() or compress2() on sourceLen bytes.  It would be used before a
+   compress() or compress2() call to allocate the destination buffer.
+*/
+
+ZEXTERN int ZEXPORT uncompress OF((Bytef *dest,   uLongf *destLen,
+                                   const Bytef *source, uLong sourceLen));
+/*
+     Decompresses the source buffer into the destination buffer.  sourceLen is
+   the byte length of the source buffer.  Upon entry, destLen is the total size
+   of the destination buffer, which must be large enough to hold the entire
+   uncompressed data.  (The size of the uncompressed data must have been saved
+   previously by the compressor and transmitted to the decompressor by some
+   mechanism outside the scope of this compression library.) Upon exit, destLen
+   is the actual size of the uncompressed buffer.
+
+     uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
+   enough memory, Z_BUF_ERROR if there was not enough room in the output
+   buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete.
+*/
+
+
+                        /* gzip file access functions */
+
+/*
+     This library supports reading and writing files in gzip (.gz) format with
+   an interface similar to that of stdio, using the functions that start with
+   "gz".  The gzip format is different from the zlib format.  gzip is a gzip
+   wrapper, documented in RFC 1952, wrapped around a deflate stream.
+*/
+
+typedef voidp gzFile;       /* opaque gzip file descriptor */
+
+/*
+ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
+
+     Opens a gzip (.gz) file for reading or writing.  The mode parameter is as
+   in fopen ("rb" or "wb") but can also include a compression level ("wb9") or
+   a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only
+   compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F'
+   for fixed code compression as in "wb9F".  (See the description of
+   deflateInit2 for more information about the strategy parameter.) Also "a"
+   can be used instead of "w" to request that the gzip stream that will be
+   written be appended to the file.  "+" will result in an error, since reading
+   and writing to the same gzip file is not supported.
+
+     gzopen can be used to read a file which is not in gzip format; in this
+   case gzread will directly read from the file without decompression.
+
+     gzopen returns NULL if the file could not be opened, if there was
+   insufficient memory to allocate the gzFile state, or if an invalid mode was
+   specified (an 'r', 'w', or 'a' was not provided, or '+' was provided).
+   errno can be checked to determine if the reason gzopen failed was that the
+   file could not be opened.
+*/
+
+ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
+/*
+     gzdopen associates a gzFile with the file descriptor fd.  File descriptors
+   are obtained from calls like open, dup, creat, pipe or fileno (if the file
+   has been previously opened with fopen).  The mode parameter is as in gzopen.
+
+     The next call of gzclose on the returned gzFile will also close the file
+   descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor
+   fd.  If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd,
+   mode);.  The duplicated descriptor should be saved to avoid a leak, since
+   gzdopen does not close fd if it fails.
+
+     gzdopen returns NULL if there was insufficient memory to allocate the
+   gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not
+   provided, or '+' was provided), or if fd is -1.  The file descriptor is not
+   used until the next gz* read, write, seek, or close operation, so gzdopen
+   will not detect if fd is invalid (unless fd is -1).
+*/
+
+ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
+/*
+     Set the internal buffer size used by this library's functions.  The
+   default buffer size is 8192 bytes.  This function must be called after
+   gzopen() or gzdopen(), and before any other calls that read or write the
+   file.  The buffer memory allocation is always deferred to the first read or
+   write.  Two buffers are allocated, either both of the specified size when
+   writing, or one of the specified size and the other twice that size when
+   reading.  A larger buffer size of, for example, 64K or 128K bytes will
+   noticeably increase the speed of decompression (reading).
+
+     The new buffer size also affects the maximum length for gzprintf().
+
+     gzbuffer() returns 0 on success, or -1 on failure, such as being called
+   too late.
+*/
+
+ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
+/*
+     Dynamically update the compression level or strategy.  See the description
+   of deflateInit2 for the meaning of these parameters.
+
+     gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
+   opened for writing.
+*/
+
+ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
+/*
+     Reads the given number of uncompressed bytes from the compressed file.  If
+   the input file was not in gzip format, gzread copies the given number of
+   bytes into the buffer.
+
+     After reaching the end of a gzip stream in the input, gzread will continue
+   to read, looking for another gzip stream, or failing that, reading the rest
+   of the input file directly without decompression.  The entire input file
+   will be read if gzread is called until it returns less than the requested
+   len.
+
+     gzread returns the number of uncompressed bytes actually read, less than
+   len for end of file, or -1 for error.
+*/
+
+ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
+                                voidpc buf, unsigned len));
+/*
+     Writes the given number of uncompressed bytes into the compressed file.
+   gzwrite returns the number of uncompressed bytes written or 0 in case of
+   error.
+*/
+
+ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
+/*
+     Converts, formats, and writes the arguments to the compressed file under
+   control of the format string, as in fprintf.  gzprintf returns the number of
+   uncompressed bytes actually written, or 0 in case of error.  The number of
+   uncompressed bytes written is limited to 8191, or one less than the buffer
+   size given to gzbuffer().  The caller should assure that this limit is not
+   exceeded.  If it is exceeded, then gzprintf() will return an error (0) with
+   nothing written.  In this case, there may also be a buffer overflow with
+   unpredictable consequences, which is possible only if zlib was compiled with
+   the insecure functions sprintf() or vsprintf() because the secure snprintf()
+   or vsnprintf() functions were not available.  This can be determined using
+   zlibCompileFlags().
+*/
+
+ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
+/*
+     Writes the given null-terminated string to the compressed file, excluding
+   the terminating null character.
+
+     gzputs returns the number of characters written, or -1 in case of error.
+*/
+
+ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
+/*
+     Reads bytes from the compressed file until len-1 characters are read, or a
+   newline character is read and transferred to buf, or an end-of-file
+   condition is encountered.  If any characters are read or if len == 1, the
+   string is terminated with a null character.  If no characters are read due
+   to an end-of-file or len < 1, then the buffer is left untouched.
+
+     gzgets returns buf which is a null-terminated string, or it returns NULL
+   for end-of-file or in case of error.  If there was an error, the contents at
+   buf are indeterminate.
+*/
+
+ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
+/*
+     Writes c, converted to an unsigned char, into the compressed file.  gzputc
+   returns the value that was written, or -1 in case of error.
+*/
+
+ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
+/*
+     Reads one byte from the compressed file.  gzgetc returns this byte or -1
+   in case of end of file or error.
+*/
+
+ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
+/*
+     Push one character back onto the stream to be read as the first character
+   on the next read.  At least one character of push-back is allowed.
+   gzungetc() returns the character pushed, or -1 on failure.  gzungetc() will
+   fail if c is -1, and may fail if a character has been pushed but not read
+   yet.  If gzungetc is used immediately after gzopen or gzdopen, at least the
+   output buffer size of pushed characters is allowed.  (See gzbuffer above.)
+   The pushed character will be discarded if the stream is repositioned with
+   gzseek() or gzrewind().
+*/
+
+ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
+/*
+     Flushes all pending output into the compressed file.  The parameter flush
+   is as in the deflate() function.  The return value is the zlib error number
+   (see function gzerror below).  gzflush is only permitted when writing.
+
+     If the flush parameter is Z_FINISH, the remaining data is written and the
+   gzip stream is completed in the output.  If gzwrite() is called again, a new
+   gzip stream will be started in the output.  gzread() is able to read such
+   concatented gzip streams.
+
+     gzflush should be called only when strictly necessary because it will
+   degrade compression if called too often.
+*/
+
+/*
+ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
+                                   z_off_t offset, int whence));
+
+     Sets the starting position for the next gzread or gzwrite on the given
+   compressed file.  The offset represents a number of bytes in the
+   uncompressed data stream.  The whence parameter is defined as in lseek(2);
+   the value SEEK_END is not supported.
+
+     If the file is opened for reading, this function is emulated but can be
+   extremely slow.  If the file is opened for writing, only forward seeks are
+   supported; gzseek then compresses a sequence of zeroes up to the new
+   starting position.
+
+     gzseek returns the resulting offset location as measured in bytes from
+   the beginning of the uncompressed stream, or -1 in case of error, in
+   particular if the file is opened for writing and the new starting position
+   would be before the current position.
+*/
+
+ZEXTERN int ZEXPORT    gzrewind OF((gzFile file));
+/*
+     Rewinds the given file. This function is supported only for reading.
+
+     gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
+*/
+
+/*
+ZEXTERN z_off_t ZEXPORT    gztell OF((gzFile file));
+
+     Returns the starting position for the next gzread or gzwrite on the given
+   compressed file.  This position represents a number of bytes in the
+   uncompressed data stream, and is zero when starting, even if appending or
+   reading a gzip stream from the middle of a file using gzdopen().
+
+     gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
+*/
+
+/*
+ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file));
+
+     Returns the current offset in the file being read or written.  This offset
+   includes the count of bytes that precede the gzip stream, for example when
+   appending or when using gzdopen() for reading.  When reading, the offset
+   does not include as yet unused buffered input.  This information can be used
+   for a progress indicator.  On error, gzoffset() returns -1.
+*/
+
+ZEXTERN int ZEXPORT gzeof OF((gzFile file));
+/*
+     Returns true (1) if the end-of-file indicator has been set while reading,
+   false (0) otherwise.  Note that the end-of-file indicator is set only if the
+   read tried to go past the end of the input, but came up short.  Therefore,
+   just like feof(), gzeof() may return false even if there is no more data to
+   read, in the event that the last read request was for the exact number of
+   bytes remaining in the input file.  This will happen if the input file size
+   is an exact multiple of the buffer size.
+
+     If gzeof() returns true, then the read functions will return no more data,
+   unless the end-of-file indicator is reset by gzclearerr() and the input file
+   has grown since the previous end of file was detected.
+*/
+
+ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
+/*
+     Returns true (1) if file is being copied directly while reading, or false
+   (0) if file is a gzip stream being decompressed.  This state can change from
+   false to true while reading the input file if the end of a gzip stream is
+   reached, but is followed by data that is not another gzip stream.
+
+     If the input file is empty, gzdirect() will return true, since the input
+   does not contain a gzip stream.
+
+     If gzdirect() is used immediately after gzopen() or gzdopen() it will
+   cause buffers to be allocated to allow reading the file to determine if it
+   is a gzip file.  Therefore if gzbuffer() is used, it should be called before
+   gzdirect().
+*/
+
+ZEXTERN int ZEXPORT    gzclose OF((gzFile file));
+/*
+     Flushes all pending output if necessary, closes the compressed file and
+   deallocates the (de)compression state.  Note that once file is closed, you
+   cannot call gzerror with file, since its structures have been deallocated.
+   gzclose must not be called more than once on the same file, just as free
+   must not be called more than once on the same allocation.
+
+     gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a
+   file operation error, or Z_OK on success.
+*/
+
+ZEXTERN int ZEXPORT gzclose_r OF((gzFile file));
+ZEXTERN int ZEXPORT gzclose_w OF((gzFile file));
+/*
+     Same as gzclose(), but gzclose_r() is only for use when reading, and
+   gzclose_w() is only for use when writing or appending.  The advantage to
+   using these instead of gzclose() is that they avoid linking in zlib
+   compression or decompression code that is not used when only reading or only
+   writing respectively.  If gzclose() is used, then both compression and
+   decompression code will be included the application when linking to a static
+   zlib library.
+*/
+
+ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
+/*
+     Returns the error message for the last error which occurred on the given
+   compressed file.  errnum is set to zlib error number.  If an error occurred
+   in the file system and not in the compression library, errnum is set to
+   Z_ERRNO and the application may consult errno to get the exact error code.
+
+     The application must not modify the returned string.  Future calls to
+   this function may invalidate the previously returned string.  If file is
+   closed, then the string previously returned by gzerror will no longer be
+   available.
+
+     gzerror() should be used to distinguish errors from end-of-file for those
+   functions above that do not distinguish those cases in their return values.
+*/
+
+ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
+/*
+     Clears the error and end-of-file flags for file.  This is analogous to the
+   clearerr() function in stdio.  This is useful for continuing to read a gzip
+   file that is being written concurrently.
+*/
+
+
+                        /* checksum functions */
+
+/*
+     These functions are not related to compression but are exported
+   anyway because they might be useful in applications using the compression
+   library.
+*/
+
+ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
+/*
+     Update a running Adler-32 checksum with the bytes buf[0..len-1] and
+   return the updated checksum.  If buf is Z_NULL, this function returns the
+   required initial value for the checksum.
+
+     An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
+   much faster.
+
+   Usage example:
+
+     uLong adler = adler32(0L, Z_NULL, 0);
+
+     while (read_buffer(buffer, length) != EOF) {
+       adler = adler32(adler, buffer, length);
+     }
+     if (adler != original_adler) error();
+*/
+
+/*
+ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
+                                          z_off_t len2));
+
+     Combine two Adler-32 checksums into one.  For two sequences of bytes, seq1
+   and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
+   each, adler1 and adler2.  adler32_combine() returns the Adler-32 checksum of
+   seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.
+*/
+
+ZEXTERN uLong ZEXPORT crc32   OF((uLong crc, const Bytef *buf, uInt len));
+/*
+     Update a running CRC-32 with the bytes buf[0..len-1] and return the
+   updated CRC-32.  If buf is Z_NULL, this function returns the required
+   initial value for the for the crc.  Pre- and post-conditioning (one's
+   complement) is performed within this function so it shouldn't be done by the
+   application.
+
+   Usage example:
+
+     uLong crc = crc32(0L, Z_NULL, 0);
+
+     while (read_buffer(buffer, length) != EOF) {
+       crc = crc32(crc, buffer, length);
+     }
+     if (crc != original_crc) error();
+*/
+
+/*
+ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
+
+     Combine two CRC-32 check values into one.  For two sequences of bytes,
+   seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
+   calculated for each, crc1 and crc2.  crc32_combine() returns the CRC-32
+   check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
+   len2.
+*/
+
+
+                        /* various hacks, don't look :) */
+
+/* deflateInit and inflateInit are macros to allow checking the zlib version
+ * and the compiler's view of z_stream:
+ */
+ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
+                                     const char *version, int stream_size));
+ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
+                                     const char *version, int stream_size));
+ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int  level, int  method,
+                                      int windowBits, int memLevel,
+                                      int strategy, const char *version,
+                                      int stream_size));
+ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int  windowBits,
+                                      const char *version, int stream_size));
+ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
+                                         unsigned char FAR *window,
+                                         const char *version,
+                                         int stream_size));
+#define deflateInit(strm, level) \
+        deflateInit_((strm), (level),       ZLIB_VERSION, sizeof(z_stream))
+#define inflateInit(strm) \
+        inflateInit_((strm),                ZLIB_VERSION, sizeof(z_stream))
+#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
+        deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
+                      (strategy),           ZLIB_VERSION, sizeof(z_stream))
+#define inflateInit2(strm, windowBits) \
+        inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
+#define inflateBackInit(strm, windowBits, window) \
+        inflateBackInit_((strm), (windowBits), (window), \
+                                            ZLIB_VERSION, sizeof(z_stream))
+
+/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
+ * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
+ * both are true, the application gets the *64 functions, and the regular
+ * functions are changed to 64 bits) -- in case these are set on systems
+ * without large file support, _LFS64_LARGEFILE must also be true
+ */
+#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
+   ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
+   ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
+   ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
+   ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
+   ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t));
+   ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));
+#endif
+
+#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0
+#  define gzopen gzopen64
+#  define gzseek gzseek64
+#  define gztell gztell64
+#  define gzoffset gzoffset64
+#  define adler32_combine adler32_combine64
+#  define crc32_combine crc32_combine64
+#  ifndef _LARGEFILE64_SOURCE
+     ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
+     ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
+     ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));
+     ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile));
+     ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
+     ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
+#  endif
+#else
+   ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *));
+   ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int));
+   ZEXTERN z_off_t ZEXPORT gztell OF((gzFile));
+   ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile));
+   ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
+   ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
+#endif
+
+/* hack for buggy compilers */
+#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
+    struct internal_state {int dummy;};
+#endif
+
+/* undocumented functions */
+ZEXTERN const char   * ZEXPORT zError           OF((int));
+ZEXTERN int            ZEXPORT inflateSyncPoint OF((z_streamp));
+ZEXTERN const uLongf * ZEXPORT get_crc_table    OF((void));
+ZEXTERN int            ZEXPORT inflateUndermine OF((z_streamp, int));
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ZLIB_H */
diff --git a/src/wraps/coregl_egl.c b/src/wraps/coregl_egl.c
new file mode 100644 (file)
index 0000000..18fda83
--- /dev/null
@@ -0,0 +1,303 @@
+#include <stdio.h>
+#include <dlfcn.h>
+
+# include <EGL/eglplatform.h>
+# include "../headers/egl.h"
+
+typedef void (*_eng_fn) (void);
+
+///////////////////////////////////////
+// Disable dlog for debugging urgent issues //
+//#define LOG_TAG "CoreGL_EGL"
+//#include <dlog.h>
+#define LOGE(...) fprintf(stderr, __VA_ARGS__)
+#define LOGW(...) fprintf(stderr, __VA_ARGS__)
+#define LOGD(...) fprintf(stderr, __VA_ARGS__)
+///////////////////////////////////////
+
+#define COREGL_API           __attribute__((visibility("default")))
+
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     COREGL_API extern RET_TYPE FUNC_NAME PARAM_LIST;
+#define _COREGL_EXT_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)
+# include "../headers/sym_egl.h"
+#undef _COREGL_EXT_SYMBOL
+#undef _COREGL_SYMBOL
+
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     RET_TYPE (*ovr_##FUNC_NAME) PARAM_LIST = NULL;
+#define _COREGL_EXT_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)
+# include "../headers/sym_egl.h"
+#undef _COREGL_EXT_SYMBOL
+#undef _COREGL_SYMBOL
+
+#define INIT_EXPORT()
+
+void *lib_handle = NULL;
+
+__attribute__((constructor))
+int
+coregl_glwrap_init()
+{
+       lib_handle = dlopen("libCOREGL.so", RTLD_NOW);
+       if (!lib_handle)
+       {
+               LOGE(" \E[40;31;1m%s\E[0m\n\n", dlerror());
+               LOGE(" \E[40;31;1mInvalid library link! (Check linkage of libEGL -> libCOREGL)\E[0m\n");
+               return 0;
+       }
+
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST) \
+   ovr_##FUNC_NAME = (__typeof__(ovr_##FUNC_NAME))dlsym(lib_handle, "coregl_api_"#FUNC_NAME); \
+       if (ovr_##FUNC_NAME == NULL) \
+       { \
+               LOGE("\E[40;31;1mCan't find a symbol '%s'!\E[0m\n\n", #FUNC_NAME); \
+               LOGE("\E[40;31;1mInvalid library link! (Check linkage of libEGL -> libCOREGL)\E[0m\n"); \
+       }
+
+#define _COREGL_EXT_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)
+#include "../headers/sym_egl.h"
+#undef _COREGL_EXT_SYMBOL
+#undef _COREGL_SYMBOL
+
+       return 1;
+}
+
+
+EGLint
+eglGetError(void)
+{
+       INIT_EXPORT();
+       return ovr_eglGetError();
+}
+
+EGLDisplay
+eglGetDisplay(EGLNativeDisplayType display_id)
+{
+       INIT_EXPORT();
+       return ovr_eglGetDisplay(display_id);
+}
+
+EGLBoolean
+eglInitialize(EGLDisplay dpy, EGLint* major, EGLint* minor)
+{
+       INIT_EXPORT();
+       return ovr_eglInitialize(dpy, major, minor);
+}
+
+EGLBoolean
+eglTerminate(EGLDisplay dpy)
+{
+       INIT_EXPORT();
+       return ovr_eglTerminate(dpy);
+}
+
+EGLBoolean
+eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
+{
+       INIT_EXPORT();
+       return ovr_eglGetConfigs(dpy, configs, config_size, num_config);
+}
+
+EGLBoolean
+eglChooseConfig(EGLDisplay dpy, const EGLint* attrib_list, EGLConfig* configs, EGLint config_size, EGLint* num_config)
+{
+       INIT_EXPORT();
+       return ovr_eglChooseConfig(dpy, attrib_list, configs, config_size, num_config);
+}
+
+EGLBoolean
+eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
+{
+       INIT_EXPORT();
+       return ovr_eglGetConfigAttrib(dpy, config, attribute, value);
+}
+
+
+EGLSurface
+eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint* attrib_list)
+{
+       INIT_EXPORT();
+       return ovr_eglCreateWindowSurface(dpy, config, win, attrib_list);
+}
+
+EGLSurface
+eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
+{
+       INIT_EXPORT();
+       return ovr_eglCreatePbufferSurface(dpy, config, attrib_list);
+}
+
+EGLSurface
+eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint* attrib_list)
+{
+       INIT_EXPORT();
+       return ovr_eglCreatePixmapSurface(dpy, config, pixmap, attrib_list);
+}
+
+EGLBoolean
+eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
+{
+       INIT_EXPORT();
+       return ovr_eglDestroySurface(dpy, surface);
+}
+
+EGLBoolean
+eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
+{
+       INIT_EXPORT();
+       return ovr_eglQuerySurface(dpy, surface, attribute, value);
+}
+
+EGLBoolean
+eglBindAPI(EGLenum api)
+{
+       INIT_EXPORT();
+       return ovr_eglBindAPI(api);
+}
+
+EGLenum
+eglQueryAPI(void)
+{
+       INIT_EXPORT();
+       return ovr_eglQueryAPI();
+}
+
+EGLBoolean
+eglWaitClient(void)
+{
+       INIT_EXPORT();
+       return ovr_eglWaitClient();
+}
+
+EGLBoolean
+eglReleaseThread(void)
+{
+       INIT_EXPORT();
+       return ovr_eglReleaseThread();
+}
+
+EGLSurface
+eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list)
+{
+       INIT_EXPORT();
+       return ovr_eglCreatePbufferFromClientBuffer(dpy, buftype, buffer, config, attrib_list);
+}
+
+EGLBoolean
+eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
+{
+       INIT_EXPORT();
+       return ovr_eglSurfaceAttrib(dpy, surface, attribute, value);
+}
+
+EGLBoolean
+eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
+{
+       INIT_EXPORT();
+       return ovr_eglBindTexImage(dpy, surface, buffer);
+}
+
+EGLBoolean
+eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
+{
+       INIT_EXPORT();
+       return ovr_eglReleaseTexImage(dpy, surface, buffer);
+}
+
+EGLBoolean
+eglSwapInterval(EGLDisplay dpy, EGLint interval)
+{
+       INIT_EXPORT();
+       return ovr_eglSwapInterval(dpy, interval);
+}
+
+EGLContext
+eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint* attrib_list)
+{
+       INIT_EXPORT();
+       return ovr_eglCreateContext(dpy, config, share_context, attrib_list);
+}
+
+EGLBoolean
+eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
+{
+       INIT_EXPORT();
+       return ovr_eglDestroyContext(dpy, ctx);
+}
+
+EGLBoolean
+eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
+{
+       INIT_EXPORT();
+       return ovr_eglMakeCurrent(dpy, draw, read, ctx);
+}
+
+EGLContext
+eglGetCurrentContext(void)
+{
+       INIT_EXPORT();
+       return ovr_eglGetCurrentContext();
+}
+
+EGLSurface
+eglGetCurrentSurface(EGLint readdraw)
+{
+       INIT_EXPORT();
+       return ovr_eglGetCurrentSurface(readdraw);
+}
+
+EGLDisplay
+eglGetCurrentDisplay(void)
+{
+       INIT_EXPORT();
+       return ovr_eglGetCurrentDisplay();
+}
+
+EGLBoolean
+eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
+{
+       INIT_EXPORT();
+       return ovr_eglQueryContext(dpy, ctx, attribute, value);
+}
+
+EGLBoolean
+eglWaitGL(void)
+{
+       INIT_EXPORT();
+       return ovr_eglWaitGL();
+}
+
+EGLBoolean
+eglWaitNative(EGLint engine)
+{
+       INIT_EXPORT();
+       return ovr_eglWaitNative(engine);
+}
+
+EGLBoolean
+eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
+{
+       INIT_EXPORT();
+       return ovr_eglSwapBuffers(dpy, surface);
+}
+
+EGLBoolean
+eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
+{
+       INIT_EXPORT();
+       return ovr_eglCopyBuffers(dpy, surface, target);
+}
+
+_eng_fn
+eglGetProcAddress(const char* procname)
+{
+       INIT_EXPORT();
+       return ovr_eglGetProcAddress(procname);
+}
+
+const char *
+eglQueryString(EGLDisplay dpy, EGLint name)
+{
+       INIT_EXPORT();
+       return ovr_eglQueryString(dpy, name);
+}
+
diff --git a/src/wraps/coregl_gl.c b/src/wraps/coregl_gl.c
new file mode 100644 (file)
index 0000000..ba7eda9
--- /dev/null
@@ -0,0 +1,1538 @@
+#include <stdio.h>
+#include <dlfcn.h>
+
+# include <GLES/glplatform.h>
+# include "../headers/gl.h"
+
+///////////////////////////////////////
+// Disable dlog for debugging urgent issues //
+//#define LOG_TAG "CoreGL_GLES2"
+//#include <dlog.h>
+#define LOGE(...) fprintf(stderr, __VA_ARGS__)
+#define LOGW(...) fprintf(stderr, __VA_ARGS__)
+#define LOGD(...) fprintf(stderr, __VA_ARGS__)
+///////////////////////////////////////
+
+#define COREGL_API           __attribute__((visibility("default")))
+
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     COREGL_API extern RET_TYPE FUNC_NAME PARAM_LIST;
+#define _COREGL_EXT_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)
+# include "../headers/sym_gl.h"
+#undef _COREGL_EXT_SYMBOL
+#undef _COREGL_SYMBOL
+
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)     RET_TYPE (*ovr_##FUNC_NAME) PARAM_LIST = NULL;
+#define _COREGL_EXT_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)
+# include "../headers/sym_gl.h"
+#undef _COREGL_EXT_SYMBOL
+#undef _COREGL_SYMBOL
+
+#define INIT_EXPORT()
+
+void *lib_handle = NULL;
+
+__attribute__((constructor))
+int
+coregl_glwrap_init()
+{
+       lib_handle = dlopen("libCOREGL.so", RTLD_NOW);
+       if (!lib_handle)
+       {
+               LOGE(" \E[40;31;1m%s\E[0m\n\n", dlerror());
+               LOGE(" \E[40;31;1mInvalid library link! (Check linkage of libEGL -> libCOREGL)\E[0m\n");
+               return 0;
+       }
+
+#define _COREGL_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST) \
+   ovr_##FUNC_NAME = (__typeof__(ovr_##FUNC_NAME))dlsym(lib_handle, "coregl_api_"#FUNC_NAME); \
+       if (ovr_##FUNC_NAME == NULL) \
+       { \
+               LOGE("\E[40;31;1mCan't find a symbol '%s'!\E[0m\n\n", #FUNC_NAME); \
+               LOGE("\E[40;31;1mInvalid library link! (Check linkage of libGLESv2 -> libCOREGL)\E[0m\n"); \
+       }
+
+#define _COREGL_EXT_SYMBOL(RET_TYPE, FUNC_NAME, PARAM_LIST)
+#include "../headers/sym_gl.h"
+#undef _COREGL_EXT_SYMBOL
+#undef _COREGL_SYMBOL
+
+       return 1;
+}
+
+void
+glActiveTexture(GLenum texture)
+{
+       ovr_glActiveTexture(texture);
+}
+
+void
+glAttachShader(GLuint program, GLuint shader)
+{
+       ovr_glAttachShader(program, shader);
+}
+
+void
+glBindAttribLocation(GLuint program, GLuint index, const char* name)
+{
+       ovr_glBindAttribLocation(program, index, name);
+}
+
+void
+glBindBuffer(GLenum target, GLuint buffer)
+{
+       ovr_glBindBuffer(target, buffer);
+}
+
+void
+glBindFramebuffer(GLenum target, GLuint framebuffer)
+{
+       ovr_glBindFramebuffer(target, framebuffer);
+}
+
+void
+glBindRenderbuffer(GLenum target, GLuint renderbuffer)
+{
+       ovr_glBindRenderbuffer(target, renderbuffer);
+}
+
+void
+glBindTexture(GLenum target, GLuint texture)
+{
+       ovr_glBindTexture(target, texture);
+}
+
+void
+glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+{
+       ovr_glBlendColor(red, green, blue, alpha);
+}
+
+void
+glBlendEquation(GLenum mode)
+{
+       ovr_glBlendEquation(mode);
+}
+
+void
+glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
+{
+       ovr_glBlendEquationSeparate(modeRGB, modeAlpha);
+}
+
+void
+glBlendFunc(GLenum sfactor, GLenum dfactor)
+{
+       ovr_glBlendFunc(sfactor, dfactor);
+}
+
+void
+glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
+{
+       ovr_glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
+}
+
+void
+glBufferData(GLenum target, GLsizeiptr size, const void* data, GLenum usage)
+{
+       ovr_glBufferData(target, size, data, usage);
+}
+
+void
+glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void* data)
+{
+       ovr_glBufferSubData(target, offset, size, data);
+}
+
+GLenum
+glCheckFramebufferStatus(GLenum target)
+{
+       return ovr_glCheckFramebufferStatus(target);
+}
+
+void
+glClear(GLbitfield mask)
+{
+       ovr_glClear(mask);
+}
+
+void
+glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+{
+       ovr_glClearColor(red, green, blue, alpha);
+}
+
+void
+glClearDepthf(GLclampf depth)
+{
+       ovr_glClearDepthf(depth);
+}
+
+void
+glClearStencil(GLint s)
+{
+       ovr_glClearStencil(s);
+}
+
+void
+glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
+{
+       ovr_glColorMask(red, green, blue, alpha);
+}
+
+void
+glCompileShader(GLuint shader)
+{
+       ovr_glCompileShader(shader);
+}
+
+void
+glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data)
+{
+       ovr_glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
+}
+
+void
+glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data)
+{
+       ovr_glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
+}
+
+void
+glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
+{
+       ovr_glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
+}
+
+void
+glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+       ovr_glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
+}
+
+GLuint
+glCreateProgram(void)
+{
+       return ovr_glCreateProgram();
+}
+
+GLuint
+glCreateShader(GLenum type)
+{
+       return ovr_glCreateShader(type);
+}
+
+void
+glCullFace(GLenum mode)
+{
+       ovr_glCullFace(mode);
+}
+
+void
+glDeleteBuffers(GLsizei n, const GLuint* buffers)
+{
+       ovr_glDeleteBuffers(n, buffers);
+}
+
+void
+glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
+{
+       ovr_glDeleteFramebuffers(n, framebuffers);
+}
+
+void
+glDeleteProgram(GLuint program)
+{
+       ovr_glDeleteProgram(program);
+}
+
+void
+glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
+{
+       ovr_glDeleteRenderbuffers(n, renderbuffers);
+}
+
+void
+glDeleteShader(GLuint shader)
+{
+       ovr_glDeleteShader(shader);
+}
+
+void
+glDeleteTextures(GLsizei n, const GLuint* textures)
+{
+       ovr_glDeleteTextures(n, textures);
+}
+
+void
+glDepthFunc(GLenum func)
+{
+       ovr_glDepthFunc(func);
+}
+
+void
+glDepthMask(GLboolean flag)
+{
+       ovr_glDepthMask(flag);
+}
+
+void
+glDepthRangef(GLclampf zNear, GLclampf zFar)
+{
+       ovr_glDepthRangef(zNear, zFar);
+}
+
+void
+glDetachShader(GLuint program, GLuint shader)
+{
+       ovr_glDetachShader(program, shader);
+}
+
+void
+glDisable(GLenum cap)
+{
+       ovr_glDisable(cap);
+}
+
+void
+glDisableVertexAttribArray(GLuint index)
+{
+       ovr_glDisableVertexAttribArray(index);
+}
+
+void
+glDrawArrays(GLenum mode, GLint first, GLsizei count)
+{
+       ovr_glDrawArrays(mode, first, count);
+}
+
+void
+glDrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices)
+{
+       ovr_glDrawElements(mode, count, type, indices);
+}
+
+void
+glEnable(GLenum cap)
+{
+       ovr_glEnable(cap);
+}
+
+void
+glEnableVertexAttribArray(GLuint index)
+{
+       ovr_glEnableVertexAttribArray(index);
+}
+
+void
+glFinish(void)
+{
+       ovr_glFinish();
+}
+
+void
+glFlush(void)
+{
+       ovr_glFlush();
+}
+
+void
+glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
+{
+       ovr_glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
+}
+
+void
+glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
+{
+       ovr_glFramebufferTexture2D(target, attachment, textarget, texture, level);
+}
+
+void
+glFrontFace(GLenum mode)
+{
+       ovr_glFrontFace(mode);
+}
+
+void
+glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
+{
+       ovr_glGetVertexAttribfv(index, pname, params);
+}
+
+void
+glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
+{
+       ovr_glGetVertexAttribiv(index, pname, params);
+}
+
+void
+glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer)
+{
+       ovr_glGetVertexAttribPointerv(index, pname, pointer);
+}
+
+void
+glHint(GLenum target, GLenum mode)
+{
+       ovr_glHint(target, mode);
+}
+
+void
+glGenBuffers(GLsizei n, GLuint* buffers)
+{
+       ovr_glGenBuffers(n, buffers);
+}
+
+void
+glGenerateMipmap(GLenum target)
+{
+       ovr_glGenerateMipmap(target);
+}
+
+void
+glGenFramebuffers(GLsizei n, GLuint* framebuffers)
+{
+       ovr_glGenFramebuffers(n, framebuffers);
+}
+
+void
+glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
+{
+       ovr_glGenRenderbuffers(n, renderbuffers);
+}
+
+void
+glGenTextures(GLsizei n, GLuint* textures)
+{
+       ovr_glGenTextures(n, textures);
+}
+
+void
+glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
+{
+       ovr_glGetActiveAttrib(program, index, bufsize, length, size, type, name);
+}
+
+void
+glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
+{
+       ovr_glGetActiveUniform(program, index, bufsize, length, size, type, name);
+}
+
+void
+glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
+{
+       ovr_glGetAttachedShaders(program, maxcount, count, shaders);
+}
+
+int
+glGetAttribLocation(GLuint program, const char* name)
+{
+       return ovr_glGetAttribLocation(program, name);
+}
+
+void
+glGetBooleanv(GLenum pname, GLboolean* params)
+{
+       ovr_glGetBooleanv(pname, params);
+}
+
+void
+glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
+{
+       ovr_glGetBufferParameteriv(target, pname, params);
+}
+
+GLenum
+glGetError(void)
+{
+       return ovr_glGetError();
+}
+
+void
+glGetFloatv(GLenum pname, GLfloat* params)
+{
+       ovr_glGetFloatv(pname, params);
+}
+
+void
+glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
+{
+       ovr_glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
+}
+
+void
+glGetIntegerv(GLenum pname, GLint* params)
+{
+       ovr_glGetIntegerv(pname, params);
+}
+
+void
+glGetProgramiv(GLuint program, GLenum pname, GLint* params)
+{
+       ovr_glGetProgramiv(program, pname, params);
+}
+
+void
+glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)
+{
+       ovr_glGetProgramInfoLog(program, bufsize, length, infolog);
+}
+
+void
+glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
+{
+       ovr_glGetRenderbufferParameteriv(target, pname, params);
+}
+
+void
+glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
+{
+       ovr_glGetShaderiv(shader, pname, params);
+}
+
+void
+glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)
+{
+       ovr_glGetShaderInfoLog(shader, bufsize, length, infolog);
+}
+
+void
+glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
+{
+       ovr_glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
+}
+
+void
+glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source)
+{
+       ovr_glGetShaderSource(shader, bufsize, length, source);
+}
+
+const GLubyte *
+glGetString(GLenum name)
+{
+       return ovr_glGetString(name);
+}
+
+void
+glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
+{
+       ovr_glGetTexParameterfv(target, pname, params);
+}
+
+void
+glGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
+{
+       ovr_glGetTexParameteriv(target, pname, params);
+}
+
+void
+glGetUniformfv(GLuint program, GLint location, GLfloat* params)
+{
+       ovr_glGetUniformfv(program, location, params);
+}
+
+void
+glGetUniformiv(GLuint program, GLint location, GLint* params)
+{
+       ovr_glGetUniformiv(program, location, params);
+}
+
+int
+glGetUniformLocation(GLuint program, const char* name)
+{
+       return ovr_glGetUniformLocation(program, name);
+}
+
+GLboolean
+glIsBuffer(GLuint buffer)
+{
+       return ovr_glIsBuffer(buffer);
+}
+
+GLboolean
+glIsEnabled(GLenum cap)
+{
+       return ovr_glIsEnabled(cap);
+}
+
+GLboolean
+glIsFramebuffer(GLuint framebuffer)
+{
+       return ovr_glIsFramebuffer(framebuffer);
+}
+
+GLboolean
+glIsProgram(GLuint program)
+{
+       return ovr_glIsProgram(program);
+}
+
+GLboolean
+glIsRenderbuffer(GLuint renderbuffer)
+{
+       return ovr_glIsRenderbuffer(renderbuffer);
+}
+
+GLboolean
+glIsShader(GLuint shader)
+{
+       return ovr_glIsShader(shader);
+}
+
+GLboolean
+glIsTexture(GLuint texture)
+{
+       return ovr_glIsTexture(texture);
+}
+
+void
+glLineWidth(GLfloat width)
+{
+       ovr_glLineWidth(width);
+}
+
+void
+glLinkProgram(GLuint program)
+{
+       ovr_glLinkProgram(program);
+}
+
+void
+glPixelStorei(GLenum pname, GLint param)
+{
+       ovr_glPixelStorei(pname, param);
+}
+
+void
+glPolygonOffset(GLfloat factor, GLfloat units)
+{
+       ovr_glPolygonOffset(factor, units);
+}
+
+void
+glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels)
+{
+       ovr_glReadPixels(x, y, width, height, format, type, pixels);
+}
+
+void
+glReleaseShaderCompiler(void)
+{
+       ovr_glReleaseShaderCompiler();
+}
+
+void
+glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
+{
+       ovr_glRenderbufferStorage(target, internalformat, width, height);
+}
+
+void
+glSampleCoverage(GLclampf value, GLboolean invert)
+{
+       ovr_glSampleCoverage(value, invert);
+}
+
+void
+glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+       ovr_glScissor(x, y, width, height);
+}
+
+void
+glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length)
+{
+       ovr_glShaderBinary(n, shaders, binaryformat, binary, length);
+}
+
+void
+glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length)
+{
+       ovr_glShaderSource(shader, count, string, length);
+}
+
+void
+glStencilFunc(GLenum func, GLint ref, GLuint mask)
+{
+       ovr_glStencilFunc(func, ref, mask);
+}
+
+void
+glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
+{
+       ovr_glStencilFuncSeparate(face, func, ref, mask);
+}
+
+void
+glStencilMask(GLuint mask)
+{
+       ovr_glStencilMask(mask);
+}
+
+void
+glStencilMaskSeparate(GLenum face, GLuint mask)
+{
+       ovr_glStencilMaskSeparate(face, mask);
+}
+
+void
+glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
+{
+       ovr_glStencilOp(fail, zfail, zpass);
+}
+
+void
+glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
+{
+       ovr_glStencilOpSeparate(face, fail, zfail, zpass);
+}
+
+void
+glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels)
+{
+       ovr_glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
+}
+
+void
+glTexParameterf(GLenum target, GLenum pname, GLfloat param)
+{
+       ovr_glTexParameterf(target, pname, param);
+}
+
+void
+glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
+{
+       ovr_glTexParameterfv(target, pname, params);
+}
+
+void
+glTexParameteri(GLenum target, GLenum pname, GLint param)
+{
+       ovr_glTexParameteri(target, pname, param);
+}
+
+void
+glTexParameteriv(GLenum target, GLenum pname, const GLint* params)
+{
+       ovr_glTexParameteriv(target, pname, params);
+}
+
+void
+glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels)
+{
+       ovr_glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
+}
+
+void
+glUniform1f(GLint location, GLfloat x)
+{
+       ovr_glUniform1f(location, x);
+}
+
+void
+glUniform1fv(GLint location, GLsizei count, const GLfloat* v)
+{
+       ovr_glUniform1fv(location, count, v);
+}
+
+void
+glUniform1i(GLint location, GLint x)
+{
+       ovr_glUniform1i(location, x);
+}
+
+void
+glUniform1iv(GLint location, GLsizei count, const GLint* v)
+{
+       ovr_glUniform1iv(location, count, v);
+}
+
+void
+glUniform2f(GLint location, GLfloat x, GLfloat y)
+{
+       ovr_glUniform2f(location, x, y);
+}
+
+void
+glUniform2fv(GLint location, GLsizei count, const GLfloat* v)
+{
+       ovr_glUniform2fv(location, count, v);
+}
+
+void
+glUniform2i(GLint location, GLint x, GLint y)
+{
+       ovr_glUniform2i(location, x, y);
+}
+
+void
+glUniform2iv(GLint location, GLsizei count, const GLint* v)
+{
+       ovr_glUniform2iv(location, count, v);
+}
+
+void
+glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
+{
+       ovr_glUniform3f(location, x, y, z);
+}
+
+void
+glUniform3fv(GLint location, GLsizei count, const GLfloat* v)
+{
+       ovr_glUniform3fv(location, count, v);
+}
+
+void
+glUniform3i(GLint location, GLint x, GLint y, GLint z)
+{
+       ovr_glUniform3i(location, x, y, z);
+}
+
+void
+glUniform3iv(GLint location, GLsizei count, const GLint* v)
+{
+       ovr_glUniform3iv(location, count, v);
+}
+
+void
+glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+       ovr_glUniform4f(location, x, y, z, w);
+}
+
+void
+glUniform4fv(GLint location, GLsizei count, const GLfloat* v)
+{
+       ovr_glUniform4fv(location, count, v);
+}
+
+void
+glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
+{
+       ovr_glUniform4i(location, x, y, z, w);
+}
+
+void
+glUniform4iv(GLint location, GLsizei count, const GLint* v)
+{
+       ovr_glUniform4iv(location, count, v);
+}
+
+void
+glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+       ovr_glUniformMatrix2fv(location, count, transpose, value);
+}
+
+void
+glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+       ovr_glUniformMatrix3fv(location, count, transpose, value);
+}
+
+void
+glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+       ovr_glUniformMatrix4fv(location, count, transpose, value);
+}
+
+void
+glUseProgram(GLuint program)
+{
+       ovr_glUseProgram(program);
+}
+
+void
+glValidateProgram(GLuint program)
+{
+       ovr_glValidateProgram(program);
+}
+
+void
+glVertexAttrib1f(GLuint index, GLfloat x)
+{
+       ovr_glVertexAttrib1f(index, x);
+}
+
+void
+glVertexAttrib1fv(GLuint index, const GLfloat* values)
+{
+       ovr_glVertexAttrib1fv(index, values);
+}
+
+void
+glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
+{
+       ovr_glVertexAttrib2f(index, x, y);
+}
+
+void
+glVertexAttrib2fv(GLuint index, const GLfloat* values)
+{
+       ovr_glVertexAttrib2fv(index, values);
+}
+
+void
+glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
+{
+       ovr_glVertexAttrib3f(index, x, y, z);
+}
+
+void
+glVertexAttrib3fv(GLuint index, const GLfloat* values)
+{
+       ovr_glVertexAttrib3fv(index, values);
+}
+
+void
+glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+       ovr_glVertexAttrib4f(index, x, y, z, w);
+}
+
+void
+glVertexAttrib4fv(GLuint index, const GLfloat* values)
+{
+       ovr_glVertexAttrib4fv(index, values);
+}
+
+void
+glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* pointer)
+{
+       ovr_glVertexAttribPointer(index, size, type, normalized, stride, pointer);
+}
+
+void
+glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+       ovr_glViewport(x, y, width, height);
+}
+
+/* OpenGL ES 3.0 */
+void
+glReadBuffer(GLenum mode)
+{
+       ovr_glReadBuffer(mode);
+}
+
+void
+glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices)
+{
+       ovr_glDrawRangeElements(mode, start, end, count, type, indices);
+}
+
+void
+glTexImage3D(GLenum target, GLint level, GLint GLinternalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
+{
+       ovr_glTexImage3D(target, level, GLinternalFormat, width, height, depth, border, format, type, pixels);
+}
+
+void
+glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)
+{
+       ovr_glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
+}
+
+void
+glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+       ovr_glCopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
+}
+
+void
+glCompressedTexImage3D(GLenum target, GLint level, GLenum GLinternalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)
+{
+       ovr_glCompressedTexImage3D(target, level, GLinternalformat, width, height, depth, border, imageSize, data);
+}
+
+void
+glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)
+{
+       ovr_glCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
+}
+
+void
+glGenQueries(GLsizei n, GLuint* ids)
+{
+       ovr_glGenQueries(n, ids);
+}
+
+void
+glDeleteQueries(GLsizei n, const GLuint* ids)
+{
+       ovr_glDeleteQueries(n, ids);
+}
+
+GLboolean
+glIsQuery(GLuint id)
+{
+       return ovr_glIsQuery(id);
+}
+
+void
+glBeginQuery(GLenum target, GLuint id)
+{
+       ovr_glBeginQuery(target, id);
+}
+
+void
+glEndQuery(GLenum target)
+{
+       ovr_glEndQuery(target);
+}
+
+void
+glGetQueryiv(GLenum target, GLenum pname, GLint* params)
+{
+       ovr_glGetQueryiv(target, pname, params);
+}
+
+void
+glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params)
+{
+       ovr_glGetQueryObjectuiv(id, pname, params);
+}
+
+GLboolean
+glUnmapBuffer(GLenum target)
+{
+       return ovr_glUnmapBuffer(target);
+}
+
+void
+glGetBufferPointerv(GLenum target, GLenum pname, GLvoid** params)
+{
+       ovr_glGetBufferPointerv(target, pname, params);
+}
+
+void
+glDrawBuffers(GLsizei n, const GLenum* bufs)
+{
+       ovr_glDrawBuffers(n, bufs);
+}
+
+void
+glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+       ovr_glUniformMatrix2x3fv(location, count, transpose, value);
+}
+
+void
+glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+       ovr_glUniformMatrix3x2fv(location, count, transpose, value);
+}
+
+void
+glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+       ovr_glUniformMatrix2x4fv(location, count, transpose, value);
+}
+
+void
+glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+       ovr_glUniformMatrix4x2fv(location, count, transpose, value);
+}
+
+void
+glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+       ovr_glUniformMatrix3x4fv(location, count, transpose, value);
+}
+
+void
+glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+       ovr_glUniformMatrix4x3fv(location, count, transpose, value);
+}
+
+void
+glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
+{
+       ovr_glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
+}
+
+void
+glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
+{
+       ovr_glRenderbufferStorageMultisample(target, samples, internalformat, width, height);
+}
+
+void
+glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
+{
+       ovr_glFramebufferTextureLayer(target, attachment, texture, level, layer);
+}
+
+GLvoid*
+glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
+{
+       return ovr_glMapBufferRange(target, offset, length, access);
+}
+
+void
+glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
+{
+       ovr_glFlushMappedBufferRange(target, offset, length);
+}
+
+void
+glBindVertexArray(GLuint array)
+{
+       ovr_glBindVertexArray(array);
+}
+
+void
+glDeleteVertexArrays(GLsizei n, const GLuint* arrays)
+{
+       ovr_glDeleteVertexArrays(n, arrays);
+}
+
+void
+glGenVertexArrays(GLsizei n, GLuint* arrays)
+{
+       ovr_glGenVertexArrays(n, arrays);
+}
+
+GLboolean
+glIsVertexArray(GLuint array)
+{
+       return ovr_glIsVertexArray(array);
+}
+
+void
+glGetIntegeri_v(GLenum target, GLuint index, GLint* data)
+{
+       ovr_glGetIntegeri_v(target, index, data);
+}
+
+void
+glBeginTransformFeedback(GLenum primitiveMode)
+{
+       ovr_glBeginTransformFeedback(primitiveMode);
+}
+
+void
+glEndTransformFeedback()
+{
+       ovr_glEndTransformFeedback();
+}
+
+void
+glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
+{
+       ovr_glBindBufferRange(target, index, buffer, offset, size);
+}
+
+void
+glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
+{
+       ovr_glBindBufferBase(target, index, buffer);
+}
+
+void
+glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode)
+{
+       ovr_glTransformFeedbackVaryings(program, count, varyings, bufferMode);
+}
+
+void
+glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name)
+{
+       ovr_glGetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
+}
+
+void
+glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
+{
+       ovr_glVertexAttribIPointer(index, size, type, stride, pointer);
+}
+
+void
+glGetVertexAttribIiv(GLuint index, GLenum pname, GLint* params)
+{
+       ovr_glGetVertexAttribIiv(index, pname, params);
+}
+
+void
+glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params)
+{
+       ovr_glGetVertexAttribIuiv(index, pname, params);
+}
+
+void
+glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
+{
+       ovr_glVertexAttribI4i(index, x, y, z, w);
+}
+
+void
+glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
+{
+       ovr_glVertexAttribI4ui(index, x, y, z, w);
+}
+
+void
+glVertexAttribI4iv(GLuint index, const GLint* v)
+{
+       ovr_glVertexAttribI4iv(index, v);
+}
+
+void
+glVertexAttribI4uiv(GLuint index, const GLuint* v)
+{
+       ovr_glVertexAttribI4uiv(index, v);
+}
+
+void
+glGetUniformuiv(GLuint program, GLint location, GLuint* params)
+{
+       ovr_glGetUniformuiv(program, location, params);
+}
+
+GLint
+glGetFragDataLocation(GLuint program, const GLchar *name)
+{
+       return ovr_glGetFragDataLocation(program, name);
+}
+
+void
+glUniform1ui(GLint location, GLuint v0)
+{
+       ovr_glUniform1ui(location, v0);
+}
+
+void
+glUniform2ui(GLint location, GLuint v0, GLuint v1)
+{
+       ovr_glUniform2ui(location, v0, v1);
+}
+
+void
+glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
+{
+       ovr_glUniform3ui(location, v0, v1, v2);
+}
+
+void
+glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
+{
+       ovr_glUniform4ui(location, v0, v1, v2, v3);
+}
+
+void
+glUniform1uiv(GLint location, GLsizei count, const GLuint* value)
+{
+       ovr_glUniform1uiv(location, count, value);
+}
+
+void
+glUniform2uiv(GLint location, GLsizei count, const GLuint* value)
+{
+       ovr_glUniform2uiv(location, count, value);
+}
+
+void
+glUniform3uiv(GLint location, GLsizei count, const GLuint* value)
+{
+       ovr_glUniform3uiv(location, count, value);
+}
+
+void
+glUniform4uiv(GLint location, GLsizei count, const GLuint* value)
+{
+       ovr_glUniform4uiv(location, count, value);
+}
+
+void
+glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value)
+{
+       ovr_glClearBufferiv(buffer, drawbuffer, value);
+}
+
+void
+glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value)
+{
+       ovr_glClearBufferuiv(buffer, drawbuffer, value);
+}
+
+void
+glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat* value)
+{
+       ovr_glClearBufferfv(buffer, drawbuffer, value);
+}
+
+void
+glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
+{
+       ovr_glClearBufferfi(buffer, drawbuffer, depth, stencil);
+}
+
+const GLubyte*
+glGetStringi(GLenum name, GLuint index)
+{
+       return ovr_glGetStringi(name, index);
+}
+
+void
+glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
+{
+       ovr_glCopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
+}
+
+void
+glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices)
+{
+       ovr_glGetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
+}
+
+void
+glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params)
+{
+       ovr_glGetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
+}
+
+GLuint
+glGetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName)
+{
+       return ovr_glGetUniformBlockIndex(program, uniformBlockName);
+}
+
+void
+glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params)
+{
+       ovr_glGetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
+}
+
+void
+glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName)
+{
+       ovr_glGetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName);
+}
+
+void
+glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
+{
+       ovr_glUniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
+}
+
+void
+glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount)
+{
+       ovr_glDrawArraysInstanced(mode, first, count, instanceCount);
+}
+
+void
+glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount)
+{
+       ovr_glDrawElementsInstanced(mode, count, type, indices, instanceCount);
+}
+
+GLsync
+glFenceSync(GLenum condition, GLbitfield flags)
+{
+       return ovr_glFenceSync(condition, flags);
+}
+
+GLboolean
+glIsSync(GLsync sync)
+{
+       return ovr_glIsSync(sync);
+}
+
+void
+glDeleteSync(GLsync sync)
+{
+       ovr_glDeleteSync(sync);
+}
+
+GLenum
+glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
+{
+       return ovr_glClientWaitSync(sync, flags, timeout);
+}
+
+void
+glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
+{
+       ovr_glWaitSync(sync, flags, timeout);
+}
+
+void
+glGetInteger64v(GLenum pname, GLint64* params)
+{
+       ovr_glGetInteger64v(pname, params);
+}
+
+void
+glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values)
+{
+       ovr_glGetSynciv(sync, pname, bufSize, length, values);
+}
+
+void
+glGetInteger64i_v(GLenum target, GLuint index, GLint64* data)
+{
+       ovr_glGetInteger64i_v(target, index, data);
+}
+
+void
+glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params)
+{
+       ovr_glGetBufferParameteri64v(target, pname, params);
+}
+
+void
+glGenSamplers(GLsizei n, GLuint* samplers)
+{
+       ovr_glGenSamplers(n, samplers);
+}
+
+void
+glDeleteSamplers(GLsizei n, const GLuint* samplers)
+{
+       ovr_glDeleteSamplers(n, samplers);
+}
+
+GLboolean
+glIsSampler(GLuint sampler)
+{
+       return ovr_glIsSampler(sampler);
+}
+
+void
+glBindSampler(GLuint unit, GLuint sampler)
+{
+       ovr_glBindSampler(unit, sampler);
+}
+
+void
+glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
+{
+       ovr_glSamplerParameteri(sampler, pname, param);
+}
+
+void
+glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param)
+{
+       ovr_glSamplerParameteriv(sampler, pname, param);
+}
+
+void
+glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
+{
+       ovr_glSamplerParameterf(sampler, pname, param);
+}
+
+void
+glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param)
+{
+       ovr_glSamplerParameterfv(sampler, pname, param);
+}
+
+void
+glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params)
+{
+       ovr_glGetSamplerParameteriv(sampler, pname, params);
+}
+
+void
+glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params)
+{
+       ovr_glGetSamplerParameterfv(sampler, pname, params);
+}
+
+void
+glVertexAttribDivisor(GLuint index, GLuint divisor)
+{
+       ovr_glVertexAttribDivisor(index, divisor);
+}
+
+void
+glBindTransformFeedback(GLenum target, GLuint id)
+{
+       ovr_glBindTransformFeedback(target, id);
+}
+
+void
+glDeleteTransformFeedbacks(GLsizei n, const GLuint* ids)
+{
+       ovr_glDeleteTransformFeedbacks(n, ids);
+}
+
+void
+glGenTransformFeedbacks(GLsizei n, GLuint* ids)
+{
+       ovr_glGenTransformFeedbacks(n, ids);
+}
+
+GLboolean
+glIsTransformFeedback(GLuint id)
+{
+       return ovr_glIsTransformFeedback(id);
+}
+
+void
+glPauseTransformFeedback()
+{
+       ovr_glPauseTransformFeedback();
+}
+
+void
+glResumeTransformFeedback()
+{
+       ovr_glResumeTransformFeedback();
+}
+
+void
+glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary)
+{
+       ovr_glGetProgramBinary(program, bufSize, length, binaryFormat, binary);
+}
+
+void
+glProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length)
+{
+       ovr_glProgramBinary(program, binaryFormat, binary, length);
+}
+
+void
+glProgramParameteri(GLuint program, GLenum pname, GLint value)
+{
+       ovr_glProgramParameteri(program, pname, value);
+}
+
+void
+glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments)
+{
+       ovr_glInvalidateFramebuffer(target, numAttachments, attachments);
+}
+
+void
+glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+       ovr_glInvalidateSubFramebuffer(target, numAttachments, attachments, x, y, width, height);
+}
+
+void
+glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
+{
+       ovr_glTexStorage2D(target, levels, internalformat, width, height);
+}
+
+void
+glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
+{
+       ovr_glTexStorage3D(target, levels, internalformat, width, height, depth);
+}
+
+void
+glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params)
+{
+       ovr_glGetInternalformativ(target, internalformat, pname, bufSize, params);
+}
+