--- /dev/null
+Stanislav Vorobiov <s.vorobiov@samsung.com>
+Jinhyung Jo <jinhyung.jo@samsung.com>
+Sangho Park <sangho1206.park@samsung.com>
+YeongKyoon Lee <yeongkyoon.lee@samsung.com>
--- /dev/null
+function(wp_codegen_target _TARGET _INPUT _OUT_DIR _OUT_CLIENT_HEADER_DIR _OUT_SERVER_HEADER_DIR)
+ file(MAKE_DIRECTORY ${_OUT_DIR})
+ file(MAKE_DIRECTORY ${_OUT_CLIENT_HEADER_DIR})
+ file(MAKE_DIRECTORY ${_OUT_SERVER_HEADER_DIR})
+ add_custom_command(OUTPUT ${_OUT_SERVER_HEADER_DIR}/${_TARGET}-server-protocol.h
+ COMMAND ${CMAKE_FIND_ROOT_PATH}${WAYLAND_CLIENT_PREFIX}/bin/wayland-scanner server-header < ${_INPUT} > ${_OUT_SERVER_HEADER_DIR}/${_TARGET}-server-protocol.h
+ DEPENDS ${_INPUT}
+ VERBATIM)
+ add_custom_command(OUTPUT ${_OUT_CLIENT_HEADER_DIR}/${_TARGET}-client-protocol.h
+ COMMAND ${CMAKE_FIND_ROOT_PATH}${WAYLAND_CLIENT_PREFIX}/bin/wayland-scanner client-header < ${_INPUT} > ${_OUT_CLIENT_HEADER_DIR}/${_TARGET}-client-protocol.h
+ DEPENDS ${_INPUT}
+ VERBATIM)
+ add_custom_command(OUTPUT ${_OUT_DIR}/${_TARGET}-protocol.c
+ COMMAND ${CMAKE_FIND_ROOT_PATH}${WAYLAND_CLIENT_PREFIX}/bin/wayland-scanner code < ${_INPUT} > ${_OUT_DIR}/${_TARGET}-protocol.c
+ DEPENDS ${_INPUT}
+ VERBATIM)
+endfunction ()
--- /dev/null
+cmake_minimum_required(VERSION 2.6)
+cmake_policy(SET CMP0014 NEW)
+
+option(CROSSCOMPILING "Enable cross-compiling")
+
+if (CROSSCOMPILING)
+ set(CMAKE_SYSTEM_NAME "Linux")
+ if (NOT CMAKE_FIND_ROOT_PATH_MODE_PROGRAM)
+ set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+ endif ()
+ if (NOT CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
+ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+ endif ()
+ if (NOT CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
+ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+ endif ()
+endif ()
+
+project(YAGL C)
+
+set(CMAKE_MODULE_PATH "${YAGL_SOURCE_DIR}/CMake")
+
+# USER SETTINGS
+
+if (CMAKE_BUILD_TYPE STREQUAL "")
+ set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: None (CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
+endif ()
+
+option(PLATFORM_X11 "Enable X11 platform" TRUE)
+option(PLATFORM_GBM "Enable GBM platform" FALSE)
+option(PLATFORM_WAYLAND "Enable wayland platform" FALSE)
+
+set(INSTALL_LIB_DIR "lib" CACHE STRING "Where to install library files")
+
+# END USER SETTINGS
+
+if ((NOT PLATFORM_X11) AND (NOT PLATFORM_GBM) AND (NOT PLATFORM_WAYLAND))
+ message(FATAL_ERROR "At least one platform must be supported")
+endif ()
+
+#out dir
+
+set(YAGL_OUT_DIR ${YAGL_BINARY_DIR}/out)
+
+#define stuff
+
+add_definitions(-DMESA_EGL_NO_X11_HEADERS)
+
+#set includes/libs
+
+set(YAGL_INCLUDE_DIR "${YAGL_SOURCE_DIR}/include")
+include_directories(${YAGL_INCLUDE_DIR})
+include_directories(${YAGL_OUT_DIR}/include)
+include_directories(${CMAKE_FIND_ROOT_PATH}/usr/include)
+
+#find packages
+
+find_package(Threads)
+find_package(PkgConfig)
+find_package(FLEX)
+find_package(BISON)
+
+pkg_check_modules(LIBDRM REQUIRED libdrm)
+add_definitions(${LIBDRM_CFLAGS})
+include_directories(${LIBDRM_INCLUDE_DIRS})
+link_directories(${LIBDRM_LIBRARY_DIRS})
+
+pkg_check_modules(LIBDRM_VIGS REQUIRED libdrm_vigs)
+add_definitions(${LIBDRM_VIGS_CFLAGS})
+include_directories(${LIBDRM_VIGS_INCLUDE_DIRS})
+link_directories(${LIBDRM_VIGS_LIBRARY_DIRS})
+
+if (PLATFORM_X11)
+ pkg_check_modules(X11 REQUIRED x11)
+ pkg_check_modules(XEXT REQUIRED xext)
+ pkg_check_modules(XFIXES REQUIRED xfixes)
+
+ add_definitions(${X11_CFLAGS})
+ include_directories(${X11_INCLUDE_DIRS})
+ link_directories(${X11_LIBRARY_DIRS})
+
+ add_definitions(${XEXT_CFLAGS})
+ include_directories(${XEXT_INCLUDE_DIRS})
+ link_directories(${XEXT_LIBRARY_DIRS})
+
+ add_definitions(${XFIXES_CFLAGS})
+ include_directories(${XFIXES_INCLUDE_DIRS})
+ link_directories(${XFIXES_LIBRARY_DIRS})
+endif ()
+
+if (PLATFORM_GBM)
+ pkg_check_modules(GBM REQUIRED gbm)
+
+ add_definitions(${GBM_CFLAGS})
+ include_directories(${GBM_INCLUDE_DIRS})
+
+ pkg_check_modules(LIBUDEV REQUIRED libudev)
+
+ add_definitions(${LIBUDEV_CFLAGS})
+ include_directories(${LIBUDEV_INCLUDE_DIRS})
+endif ()
+
+if (PLATFORM_WAYLAND)
+ pkg_check_modules(WAYLAND_CLIENT REQUIRED wayland-client)
+
+ add_definitions(${WAYLAND_CLIENT_CFLAGS})
+ include_directories(${WAYLAND_CLIENT_INCLUDE_DIRS})
+
+ pkg_check_modules(WAYLAND_SERVER REQUIRED wayland-server)
+
+ add_definitions(${WAYLAND_SERVER_CFLAGS})
+ include_directories(${WAYLAND_SERVER_INCLUDE_DIRS})
+endif ()
+
+#fix output directories
+
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${YAGL_OUT_DIR}/lib)
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${YAGL_OUT_DIR}/bin)
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${YAGL_OUT_DIR}/lib)
+
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -D_REENTRANT -fPIC -DPIC -DMESA_EGL_NO_X11_HEADERS")
+foreach (CONFIGURATION RELEASE MINSIZEREL RELWITHDEBINFO)
+ string(REPLACE "-O3" "-O2" CMAKE_C_FLAGS_${CONFIGURATION} "${CMAKE_C_FLAGS_${CONFIGURATION}}")
+endforeach ()
+
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
+set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-undefined")
+
+message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
+if (PLATFORM_X11)
+message(STATUS "X11 platform: yes")
+else ()
+message(STATUS "X11 platform: no")
+endif ()
+
+if (PLATFORM_GBM)
+message(STATUS "GBM platform: yes")
+else ()
+message(STATUS "GBM platform: no")
+endif ()
+
+if (PLATFORM_WAYLAND)
+message(STATUS "Wayland platform: yes")
+else ()
+message(STATUS "Wayland platform: no")
+endif ()
+
+message(STATUS "Install prefix: " ${CMAKE_INSTALL_PREFIX})
+message(STATUS "Install lib dir: " ${INSTALL_LIB_DIR})
+
+if (PLATFORM_WAYLAND)
+add_subdirectory(wayland-egl)
+add_subdirectory(wayland-drm)
+endif ()
+if (PLATFORM_GBM)
+add_subdirectory(gbm)
+endif ()
+add_subdirectory(EGL)
+add_subdirectory(GLES_common)
+add_subdirectory(GLESv1_CM)
+add_subdirectory(GLESv2)
+if (DUMMY_LIBS)
+add_subdirectory(dummy)
+endif()
--- /dev/null
+Copyright (C) 2012 Samsung Electronics co., Ltd. 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 fur-
+nished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
+NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON-
+NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
--- /dev/null
+Ben Pfaff <blp@gnu.org>
--- /dev/null
+set(SOURCES
+ yagl_avl.c
+ yagl_vector.c
+ yagl_range_list.c
+ yagl_object.c
+ yagl_namespace.c
+ yagl_sharegroup.c
+ yagl_client_image.c
+ yagl_transport.c
+ yagl_context.c
+ yagl_display.c
+ yagl_egl_calls.c
+ yagl_egl_state.c
+ yagl_egl_fence.c
+ yagl_host_egl_calls.c
+ yagl_image.c
+ yagl_log.c
+ yagl_malloc.c
+ yagl_offscreen.c
+ yagl_offscreen_image_pixmap.c
+ yagl_offscreen_surface.c
+ yagl_onscreen.c
+ yagl_onscreen_image_pixmap.c
+ yagl_onscreen_surface.c
+ yagl_onscreen_fence.c
+ yagl_onscreen_utils.c
+ yagl_ref.c
+ yagl_render.c
+ yagl_resource.c
+ yagl_state.c
+ yagl_surface.c
+ yagl_fence.c
+ yagl_utils.c
+ yagl_native_platform.c
+ yagl_native_display.c
+ yagl_native_drawable.c
+ yagl_native_image.c
+)
+
+set(LIBRARIES
+ ${CMAKE_THREAD_LIBS_INIT}
+ ${LIBDRM_LIBRARIES}
+ ${LIBDRM_VIGS_LIBRARIES}
+ dl
+)
+
+if (PLATFORM_X11)
+ set(SOURCES ${SOURCES}
+ x11/yagl_dri2.c
+ x11/yagl_x11_platform.c
+ x11/yagl_x11_display.c
+ x11/yagl_x11_drawable.c
+ x11/yagl_x11_image.c
+ )
+ set(LIBRARIES ${LIBRARIES}
+ ${X11_LIBRARIES}
+ ${XEXT_LIBRARIES}
+ ${XFIXES_LIBRARIES}
+ )
+ add_definitions(-DYAGL_PLATFORM_X11)
+endif ()
+
+if (PLATFORM_GBM)
+ set(SOURCES ${SOURCES}
+ gbm/yagl_gbm_platform.c
+ gbm/yagl_gbm_display.c
+ gbm/yagl_gbm_window.c
+ gbm/yagl_gbm_pixmap.c
+ )
+ set(LIBRARIES ${LIBRARIES}
+ gbm-yagl
+ ${LIBUDEV_LIBRARIES}
+ )
+ add_definitions(-DYAGL_PLATFORM_GBM)
+endif ()
+
+if (PLATFORM_WAYLAND)
+ set(SOURCES ${SOURCES}
+ wayland/yagl_wayland_platform.c
+ wayland/yagl_wayland_display.c
+ wayland/yagl_wayland_window.c
+ yagl_onscreen_image_wl_buffer.c
+ )
+ set(LIBRARIES ${LIBRARIES}
+ wayland-egl-yagl
+ wayland-drm
+ ${WAYLAND_CLIENT_LIBRARIES}
+ )
+ add_definitions(-DYAGL_PLATFORM_WAYLAND)
+endif ()
+
+include_directories(.)
+
+add_library(EGL SHARED ${SOURCES})
+set_target_properties(EGL PROPERTIES VERSION 1.0 SOVERSION 1)
+
+target_link_libraries(EGL ${LIBRARIES})
+
+install(
+ TARGETS EGL
+ LIBRARY DESTINATION ${INSTALL_LIB_DIR}
+)
--- /dev/null
+Installing libavl -*- text -*-
+=================
+
+libavl is not intended to be installed as a shared library. Instead,
+its source files are meant to be included in programs directly. A
+given program normally uses only one or two of libavl's tree
+structures. Only the C source and header files for those structures
+need to be included. Refer to the libavl manual for more information.
+
+As a result, there is no real "installation procedure" for libavl. If
+you like, you can install the test and demo programs in a convenient
+location, but it hard to imagine a practical use for them other than
+as tests and demonstrations.
+
+Hence, this file gives information on what the libavl distribution
+includes and how to build it. It does not furnish an actual
+installation procedure.
+
+What's here
+-----------
+
+Before we get started, here's what the source distribution of libavl
+includes:
+
+* Meta-documentation
+
+ - AUTHORS: lists libavl's authors.
+ - COPYING: the GNU General Public License, libavl's license.
+ - ChangeLog: log of changes from old versions of libavl
+ - INSTALL: this file
+ - NEWS: summary of changes between libavl versions
+ - OUTLINE: outline of libavl manual
+ - README: instructions for getting started
+ - ROADMAP: tentative plans for future libavl releases
+ - THANKS: acknowledgements of contributors to libavl
+ - TODO: incomplete list of remaining libavl tasks
+
+* Software
+
+ libavl library (generated from .w files):
+ - bst.c, bst.h: Binary search tree library.
+ - avl.c, avl.h: AVL tree library.
+ - rb.c, rb.h: Red-black tree library.
+ - tbst.c, tbst.h: Threaded binary search tree library.
+ - tavl.c, tavl.h: Threaded AVL tree library.
+ - trb.c: Threaded red-black tree library.
+ - rtbst.c, rtbst.h: Right-threaded binary search tree library.
+ - rtavl.c, rtavl.h: Right-threaded AVL tree library.
+ - rtrb.c, rtrb.h: Right-threaded red-black tree library.
+ - pbst.c, pbst.h: Binary search tree with parent pointers library.
+ - pavl.c, pavl.h: AVL tree with parent pointers library.
+ - prb.c, prb.h: Red-black tree with parent pointers library.
+
+ Test programs (generated from .w files):
+ - bst-test.c: Test for bst.c.
+ - avl-test.c: Test for avl.c.
+ - rb-test.c: Test for rb.c.
+ - tbst-test.c: Test for tbst.c.
+ - tavl-test.c: Test for tavl.c.
+ - trb-test.c: Test for trb.c.
+ - rtbst-test.c: Test for rtbst.c.
+ - rtavl-test.c: Test for rtavl.c.
+ - rtrb-test.c: Test for rtrb.c.
+ - pbst-test.c: Test for pbst.c.
+ - pavl-test.c: Test for pavl.c.
+ - prb-test.c: Test for prb.c.
+
+ - bin-ary-test.c: Test for binary search in arrays.
+ - bsts.c: Test for binary search with sentinel.
+ - seq-test.c: Basic test for sequential search.
+ - srch-test.c: Comprehensive test for search within array.
+ - test.c, test.h: Generic library for testing.
+
+ Preprocessors:
+ - slr.c: SLR parser-generator used to produce part of texiweb.c.
+ - texiweb.c: translates TexiWEB to C and Texinfo.
+ - texitree.c: translates tree descriptions to PostScript and text.
+ - eps2png: script that uses GhostScript to translate .eps to .png
+
+* Documentation
+
+ Compiled:
+ - libavl.info*: Documentation in Info format.
+
+ Available (not distributed, but you can make them yourself; see below):
+ - libavl.dvi: Documentation in DVI format.
+ - libavl.ps: Documentation in PostScript format.
+ - libavl.pdf: Documentation in PDF.
+ - libavl.text: Documentation in plain text format.
+ - libavl.html: Documentation in HTML format.
+
+ Source:
+ - libavl.w: Top-level TexiWEB source for libavl.
+ - preface.w: Source for preface.
+ - intro.w: Source for introduction.
+ - table.w: Source for table ADT chapter.
+ - search-alg.w: Source for search algorithms chapter.
+ - bst.w: Source for binary search trees chapter.
+ - avl.w: Source for AVL trees chapter.
+ - rb.w: Source for red-black trees chapter.
+ - tbst.w: Source for threaded binary search trees chapter.
+ - tavl.w: Source for threaded AVL trees chapter.
+ - trb.w: Source for threaded red-black trees chapter.
+ - rtbst.w: Source for right-threaded binary search trees chapter.
+ - rtavl.w: Source for right-threaded AVL trees chapter.
+ - rtrb.w: Sources for right-threaded red-black trees chapter.
+ - pbst.w: Sources for binary search trees with parent pointers chapter.
+ - pavl.w: Sources for AVL trees with parent pointers chapter.
+ - prb.w: Sources for red-black trees with parent pointers chapter.
+ - references.w: Sources for references appendix.
+ - glossary.w: Source for glossary appendix.
+ - catalogue.w: Source for catalogue of algorithms appendix.
+ - *.tree: Binary tree figures in `texitree' source form.
+ - *.png: Binary tree figures as bitmap graphics.
+ - *.pdf: Binary tree figures in PDF format.
+ - *.eps: Binary tree figures (generated, not distributed).
+ - *.txt: Binary tree figures (generated, not distributed).
+ - texinfo.tex: TeX macros for Texinfo.
+
+Prerequisites
+-------------
+
+You need the following software to fully build this version of libavl:
+
+ * GNU make (ftp://ftp.gnu.org/pub/gnu/make).
+
+ Other make programs will not work.
+
+ * TeX (http://www.tug.org).
+
+ You should install "e-TeX" extended TeX if possible, but
+ Knuth's TeX will also work, albeit more slowly. You may
+ need to increase the pool size for your copy of TeX. This
+ can sometimes be done by editing a file named texmf.cnf in
+ TeX's configuration directory. Values of at least 250000
+ are known to work.
+
+ * dvips.
+
+ dvips, often distributed with TeX, is needed to build a
+ PostScript version of the libavl manual.
+
+ * GNU makeinfo (ftp://ftp.gnu.org/pub/gnu/texinfo).
+
+ makeinfo is needed to build text, Info, and HTML versions of
+ the libavl manual. Version 4.1 or later is required to
+ build the HTML version of the manual, but version 4.8 is
+ recommended, and this version or later is recommended in any
+ case.
+
+ * GNU Ghostscript (ftp://ftp.gnu.org/pub/gnu/ghostscript) and
+ Imagemagick (http://www.imagemagick.org/).
+
+ You should only need these tools if you modify the .tree
+ files in the source distribution and want to build a custom
+ HTML or PDF version of libavl. Ghostscript is used to render
+ PostScript to oversized PNGs and Imagemagick does
+ antialiased scaling to reasonable sizes. Ghostscript is
+ also used in the process of converting PostScript to PDF
+ format.
+
+Building
+--------
+
+You can build all of libavl or just one part. Here are the commands
+to build a few interesting subsets:
+
+ * Everything: `make'.
+
+ * All versions of the manual: `make docs'.
+
+ - Manual in DVI format: `make libavl.dvi'.
+ - Manual in PostScript format: `make libavl.ps'.
+ - Manual in PDF format: `make libavl.pdf'.
+ - Manual in Info format: `make libavl.info'.
+ - Manual in plain text format: `make libavl.text'.
+ - Manual in HTML format: `make libavl.html'.
+
+ * All the test and demo programs: `make programs'.
+
+For a fairly comprehensive battery of tests, run `make check'. This
+may take several minutes.
--- /dev/null
+Welcome to libavl version 2.0.3, a library in ANSI/ISO C for the
+manipulation of binary trees and balanced binary trees. libavl is
+written using a literate programming system called TexiWEB. By way of
+TexiWEB, libavl is as much a textbook on binary trees and balanced
+binary trees as it is a collection of code.
+
+Version 2.0 is a complete rewrite of earlier versions. It is not
+binary or source compatible with libavl 1.x. However, if libavl 2.0's
+new features are unnecessary, there is no need to upgrade. libavl
+1.4.1 does not contain any bugs known to cause incorrect behavior. It
+is still supported in the sense that if any such bugs are reported,
+they will be fixed.
+
+The assistance of the community is requested in debugging and
+improving libavl. Your suggestions and bug reports are appreciated,
+whether related to code or prose. Exposition, style, spelling,
+punctuation, and grammar are all fair game. All the code in this
+release has been carefully tested, but unknown bugs may still exist.
+Please check out and proofread libavl and report any bugs by email to
+<bug-avl@gnu.org>.
+
+This release supports the following kinds of trees:
+
+ Plain binary trees:
+ * Binary search trees
+ * AVL trees
+ * Red-black trees
+
+ Threaded binary trees:
+ * Threaded binary search trees
+ * Threaded AVL trees
+ * Threaded red-black trees
+
+ Right-threaded binary trees:
+ * Right-threaded binary search trees
+ * Right-threaded AVL trees
+ * Right-threaded red-black trees
+
+ Binary trees with parent pointers:
+ * Binary search trees with parent pointers
+ * AVL trees with parent pointers
+ * Red-black trees with parent pointers
+
+See INSTALL for advice on where to go from here. Take a look at NEWS
+for a list of new features. For features tentatively planned for
+inclusion in future releases of libavl, see ROADMAP.
+
+Components of this distribution are licensed as follows:
+
+ * The manual is covered by the GNU Free Documentation License.
+ The manual includes complete source code for the libavl
+ libraries and related programs, so these are also released
+ under the GNU Free Documentation License.
+
+ * The libavl libraries are also released under the GNU Lesser
+ General Public License. The GNU GPL often makes sense for
+ libraries, but because so many other libraries provide
+ balanced search trees, the LGPL is a better fit for libavl.
+ See <http://www.gnu.org/licenses/why-not-lgpl.html> for more
+ information.
+
+ * Programs are also released under the GNU General Public
+ License.
+
+Please send bug reports and enhancement requests for libavl to
+<bug-avl@gnu.org>.
+
+Local variables:
+mode: text
+End:
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_gbm_display.h"
+#include "yagl_gbm_window.h"
+#include "yagl_gbm_pixmap.h"
+#include "yagl_native_display.h"
+#include "yagl_log.h"
+#include "yagl_malloc.h"
+#include "yagl_gbm.h"
+#include "vigs.h"
+#include <xf86drm.h>
+#include <libudev.h>
+#include <string.h>
+#include <stdlib.h>
+
+static struct udev_device *udev_device_new_from_fd(struct udev *udev, int fd)
+{
+ struct udev_device *device;
+ struct stat buf;
+
+ if (fstat(fd, &buf) < 0) {
+ return NULL;
+ }
+
+ device = udev_device_new_from_devnum(udev, 'c', buf.st_rdev);
+
+ if (!device) {
+ return NULL;
+ }
+
+ return device;
+}
+
+static char *get_device_name_for_fd(int fd)
+{
+ struct udev *udev;
+ struct udev_device *device;
+ const char *const_device_name;
+ char *device_name = NULL;
+
+ udev = udev_new();
+
+ device = udev_device_new_from_fd(udev, fd);
+
+ if (!device) {
+ return NULL;
+ }
+
+ const_device_name = udev_device_get_devnode(device);
+
+ if (!const_device_name) {
+ goto out;
+ }
+
+ device_name = strdup(const_device_name);
+
+out:
+ udev_device_unref(device);
+ udev_unref(udev);
+
+ return device_name;
+}
+
+static int yagl_gbm_display_authenticate(struct yagl_native_display *dpy,
+ uint32_t id)
+{
+ struct gbm_device *gbm_dpy = YAGL_GBM_DPY(dpy->os_dpy);
+
+ return drmAuthMagic(gbm_dpy->drm_dev->fd, id);
+}
+
+static struct yagl_native_drawable
+ *yagl_gbm_display_wrap_window(struct yagl_native_display *dpy,
+ yagl_os_window os_window)
+{
+ return yagl_gbm_window_create(dpy, os_window);
+}
+
+static struct yagl_native_drawable
+ *yagl_gbm_display_wrap_pixmap(struct yagl_native_display *dpy,
+ yagl_os_pixmap os_pixmap)
+{
+ return yagl_gbm_pixmap_create(dpy, os_pixmap);
+}
+
+static struct yagl_native_drawable
+ *yagl_gbm_display_create_pixmap(struct yagl_native_display *dpy,
+ uint32_t width,
+ uint32_t height,
+ uint32_t depth)
+{
+ return NULL;
+}
+
+static struct yagl_native_image
+ *yagl_gbm_display_create_image(struct yagl_native_display *dpy,
+ uint32_t width,
+ uint32_t height,
+ uint32_t depth)
+{
+ return NULL;
+}
+
+static int yagl_gbm_display_get_visual(struct yagl_native_display *dpy,
+ int *visual_id,
+ int *visual_type)
+{
+ *visual_id = 0;
+ *visual_type = 0;
+
+ return 1;
+}
+
+static void yagl_gbm_display_destroy(struct yagl_native_display *dpy)
+{
+ yagl_native_display_cleanup(dpy);
+
+ yagl_free(dpy);
+}
+
+struct yagl_native_display
+ *yagl_gbm_display_create(struct yagl_native_platform *platform,
+ yagl_os_display os_dpy)
+{
+ struct gbm_device *gbm_dpy = YAGL_GBM_DPY(os_dpy);
+ struct yagl_native_display *dpy;
+ char *device_name = get_device_name_for_fd(gbm_dpy->drm_dev->fd);
+
+ if (!device_name) {
+ return NULL;
+ }
+
+ dpy = yagl_malloc0(sizeof(*dpy));
+
+ yagl_native_display_init(dpy,
+ platform,
+ os_dpy,
+ gbm_dpy->drm_dev,
+ device_name);
+
+ dpy->authenticate = &yagl_gbm_display_authenticate;
+ dpy->wrap_window = &yagl_gbm_display_wrap_window;
+ dpy->wrap_pixmap = &yagl_gbm_display_wrap_pixmap;
+ dpy->create_pixmap = &yagl_gbm_display_create_pixmap;
+ dpy->create_image = &yagl_gbm_display_create_image;
+ dpy->get_visual = &yagl_gbm_display_get_visual;
+ dpy->destroy = &yagl_gbm_display_destroy;
+
+ free(device_name);
+
+ return dpy;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GBM_DISPLAY_H_
+#define _YAGL_GBM_DISPLAY_H_
+
+#include "yagl_export.h"
+#include "yagl_native_types.h"
+
+#define YAGL_GBM_DPY(os_dpy) ((struct gbm_device*)(os_dpy))
+
+struct yagl_native_platform;
+struct yagl_native_display;
+
+struct yagl_native_display
+ *yagl_gbm_display_create(struct yagl_native_platform *platform,
+ yagl_os_display os_dpy);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_gbm_pixmap.h"
+#include "yagl_native_drawable.h"
+#include "yagl_log.h"
+#include "yagl_malloc.h"
+#include "yagl_gbm.h"
+#include "vigs.h"
+
+static int yagl_gbm_pixmap_get_buffer(struct yagl_native_drawable *drawable,
+ yagl_native_attachment attachment,
+ uint32_t *buffer_name,
+ struct vigs_drm_surface **buffer_sfc)
+{
+ struct gbm_bo *bo = YAGL_GBM_PIXMAP(drawable->os_drawable);
+
+ YAGL_LOG_FUNC_SET(yagl_gbm_pixmap_get_buffer);
+
+ switch (attachment) {
+ case yagl_native_attachment_front:
+ break;
+ case yagl_native_attachment_back:
+ default:
+ YAGL_LOG_ERROR("Bad attachment %u", attachment);
+ return 0;
+ }
+
+ vigs_drm_gem_ref(&bo->drm_sfc->gem);
+
+ *buffer_sfc = bo->drm_sfc;
+
+ return 1;
+}
+
+static int yagl_gbm_pixmap_get_buffer_age(struct yagl_native_drawable *drawable)
+{
+ return 0;
+}
+
+static void yagl_gbm_pixmap_swap_buffers(struct yagl_native_drawable *drawable)
+{
+}
+
+static void yagl_gbm_pixmap_wait(struct yagl_native_drawable *drawable,
+ uint32_t width,
+ uint32_t height)
+{
+}
+
+static void yagl_gbm_pixmap_copy_to_pixmap(struct yagl_native_drawable *drawable,
+ yagl_os_pixmap os_pixmap,
+ uint32_t from_x,
+ uint32_t from_y,
+ uint32_t to_x,
+ uint32_t to_y,
+ uint32_t width,
+ uint32_t height)
+{
+}
+
+static void yagl_gbm_pixmap_set_swap_interval(struct yagl_native_drawable *drawable,
+ int interval)
+{
+}
+
+static void yagl_gbm_pixmap_get_geometry(struct yagl_native_drawable *drawable,
+ uint32_t *width,
+ uint32_t *height,
+ uint32_t *depth)
+{
+ struct gbm_bo *bo = YAGL_GBM_PIXMAP(drawable->os_drawable);
+
+ *width = bo->drm_sfc->width;
+ *height = bo->drm_sfc->height;
+ *depth = bo->depth;
+}
+
+static struct yagl_native_image
+ *yagl_gbm_pixmap_get_image(struct yagl_native_drawable *drawable,
+ uint32_t width,
+ uint32_t height)
+{
+ return NULL;
+}
+
+static void yagl_gbm_pixmap_destroy(struct yagl_native_drawable *drawable)
+{
+ yagl_native_drawable_cleanup(drawable);
+
+ yagl_free(drawable);
+}
+
+struct yagl_native_drawable
+ *yagl_gbm_pixmap_create(struct yagl_native_display *dpy,
+ yagl_os_pixmap os_pixmap)
+{
+ struct yagl_native_drawable *pixmap;
+
+ pixmap = yagl_malloc0(sizeof(*pixmap));
+
+ yagl_native_drawable_init(pixmap, dpy, os_pixmap);
+
+ pixmap->get_buffer = &yagl_gbm_pixmap_get_buffer;
+ pixmap->get_buffer_age = &yagl_gbm_pixmap_get_buffer_age;
+ pixmap->swap_buffers = &yagl_gbm_pixmap_swap_buffers;
+ pixmap->wait = &yagl_gbm_pixmap_wait;
+ pixmap->copy_to_pixmap = &yagl_gbm_pixmap_copy_to_pixmap;
+ pixmap->set_swap_interval = &yagl_gbm_pixmap_set_swap_interval;
+ pixmap->get_geometry = &yagl_gbm_pixmap_get_geometry;
+ pixmap->get_image = &yagl_gbm_pixmap_get_image;
+ pixmap->destroy = &yagl_gbm_pixmap_destroy;
+
+ return pixmap;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GBM_PIXMAP_H_
+#define _YAGL_GBM_PIXMAP_H_
+
+#include "yagl_export.h"
+#include "yagl_native_types.h"
+
+#define YAGL_GBM_PIXMAP(os_pixmap) ((struct gbm_bo*)(os_pixmap))
+
+struct yagl_native_display;
+struct yagl_native_drawable;
+
+struct yagl_native_drawable
+ *yagl_gbm_pixmap_create(struct yagl_native_display *dpy,
+ yagl_os_pixmap os_pixmap);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_gbm_platform.h"
+#include "yagl_gbm_display.h"
+#include "yagl_gbm.h"
+#include "yagl_native_platform.h"
+#include "yagl_log.h"
+#include "EGL/egl.h"
+
+static int yagl_gbm_platform_probe(yagl_os_display os_dpy)
+{
+ void *first_pointer;
+
+ if (os_dpy == (yagl_os_display)EGL_DEFAULT_DISPLAY) {
+ return 0;
+ }
+
+ first_pointer = *(void**)os_dpy;
+
+ return (first_pointer == &gbm_create_device);
+}
+
+static struct yagl_native_display
+ *yagl_gbm_wrap_display(yagl_os_display os_dpy,
+ int enable_drm)
+{
+ YAGL_LOG_FUNC_SET(eglGetDisplay);
+
+ if (os_dpy != (yagl_os_display)EGL_DEFAULT_DISPLAY) {
+ return yagl_gbm_display_create(&yagl_gbm_platform, os_dpy);
+ } else {
+ YAGL_LOG_ERROR("Default display not supported on GBM");
+ return NULL;
+ }
+}
+
+struct yagl_native_platform yagl_gbm_platform =
+{
+ .pixmaps_supported = 1,
+ .buffer_age_supported = 1,
+ .probe = yagl_gbm_platform_probe,
+ .wrap_display = yagl_gbm_wrap_display
+};
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GBM_PLATFORM_H_
+#define _YAGL_GBM_PLATFORM_H_
+
+#include "yagl_export.h"
+
+struct yagl_native_platform;
+
+extern struct yagl_native_platform yagl_gbm_platform;
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_gbm_window.h"
+#include "yagl_native_drawable.h"
+#include "yagl_log.h"
+#include "yagl_malloc.h"
+#include "yagl_gbm.h"
+
+static int yagl_gbm_window_get_buffer(struct yagl_native_drawable *drawable,
+ yagl_native_attachment attachment,
+ uint32_t *buffer_name,
+ struct vigs_drm_surface **buffer_sfc)
+{
+ struct gbm_surface *sfc = YAGL_GBM_WINDOW(drawable->os_drawable);
+
+ YAGL_LOG_FUNC_SET(yagl_gbm_window_get_buffer);
+
+ switch (attachment) {
+ case yagl_native_attachment_back:
+ break;
+ case yagl_native_attachment_front:
+ default:
+ YAGL_LOG_ERROR("Bad attachment %u", attachment);
+ return 0;
+ }
+
+ *buffer_sfc = sfc->acquire_back(sfc);
+
+ if (!*buffer_sfc) {
+ YAGL_LOG_ERROR("Cannot get back for drawable %p",
+ drawable->os_drawable);
+ return 0;
+ }
+
+ return 1;
+}
+
+static int yagl_gbm_window_get_buffer_age(struct yagl_native_drawable *drawable)
+{
+ struct gbm_surface *sfc = YAGL_GBM_WINDOW(drawable->os_drawable);
+
+ return sfc->get_buffer_age(sfc);
+}
+
+static void yagl_gbm_window_swap_buffers(struct yagl_native_drawable *drawable)
+{
+ struct gbm_surface *sfc = YAGL_GBM_WINDOW(drawable->os_drawable);
+
+ sfc->swap_buffers(sfc);
+
+ ++drawable->stamp;
+}
+
+static void yagl_gbm_window_wait(struct yagl_native_drawable *drawable,
+ uint32_t width,
+ uint32_t height)
+{
+}
+
+static void yagl_gbm_window_copy_to_pixmap(struct yagl_native_drawable *drawable,
+ yagl_os_pixmap os_pixmap,
+ uint32_t from_x,
+ uint32_t from_y,
+ uint32_t to_x,
+ uint32_t to_y,
+ uint32_t width,
+ uint32_t height)
+{
+}
+
+static void yagl_gbm_window_set_swap_interval(struct yagl_native_drawable *drawable,
+ int interval)
+{
+}
+
+static void yagl_gbm_window_get_geometry(struct yagl_native_drawable *drawable,
+ uint32_t *width,
+ uint32_t *height,
+ uint32_t *depth)
+{
+ struct gbm_surface *sfc = YAGL_GBM_WINDOW(drawable->os_drawable);
+
+ *width = sfc->width;
+ *height = sfc->height;
+ *depth = sfc->depth;
+}
+
+static struct yagl_native_image
+ *yagl_gbm_window_get_image(struct yagl_native_drawable *drawable,
+ uint32_t width,
+ uint32_t height)
+{
+ return NULL;
+}
+
+static void yagl_gbm_window_destroy(struct yagl_native_drawable *drawable)
+{
+ yagl_native_drawable_cleanup(drawable);
+
+ yagl_free(drawable);
+}
+
+struct yagl_native_drawable
+ *yagl_gbm_window_create(struct yagl_native_display *dpy,
+ yagl_os_window os_window)
+{
+ struct yagl_native_drawable *window;
+
+ window = yagl_malloc0(sizeof(*window));
+
+ yagl_native_drawable_init(window, dpy, os_window);
+
+ window->get_buffer = &yagl_gbm_window_get_buffer;
+ window->get_buffer_age = &yagl_gbm_window_get_buffer_age;
+ window->swap_buffers = &yagl_gbm_window_swap_buffers;
+ window->wait = &yagl_gbm_window_wait;
+ window->copy_to_pixmap = &yagl_gbm_window_copy_to_pixmap;
+ window->set_swap_interval = &yagl_gbm_window_set_swap_interval;
+ window->get_geometry = &yagl_gbm_window_get_geometry;
+ window->get_image = &yagl_gbm_window_get_image;
+ window->destroy = &yagl_gbm_window_destroy;
+
+ return window;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GBM_WINDOW_H_
+#define _YAGL_GBM_WINDOW_H_
+
+#include "yagl_export.h"
+#include "yagl_native_types.h"
+
+#define YAGL_GBM_WINDOW(os_window) ((struct gbm_surface*)(os_window))
+
+struct yagl_native_display;
+struct yagl_native_drawable;
+
+struct yagl_native_drawable
+ *yagl_gbm_window_create(struct yagl_native_display *dpy,
+ yagl_os_window os_window);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_wayland_display.h"
+#include "yagl_wayland_window.h"
+#include "yagl_log.h"
+#include "yagl_malloc.h"
+#include "wayland-drm-client-protocol.h"
+#include "vigs.h"
+#include <xf86drm.h>
+#include <sys/fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+static void yagl_wayland_display_roundtrip_done(void *data,
+ struct wl_callback *callback,
+ uint32_t serial)
+{
+ int *done = data;
+
+ *done = 1;
+
+ wl_callback_destroy(callback);
+}
+
+static struct wl_callback_listener yagl_wayland_display_roundtrip_listener =
+{
+ yagl_wayland_display_roundtrip_done
+};
+
+static int yagl_wayland_display_roundtrip(struct wl_display *dpy,
+ struct wl_event_queue *queue)
+{
+ struct wl_callback *callback;
+ int done = 0, ret = 0;
+
+ callback = wl_display_sync(dpy);
+ wl_callback_add_listener(callback,
+ &yagl_wayland_display_roundtrip_listener,
+ &done);
+ wl_proxy_set_queue((struct wl_proxy*)callback, queue);
+
+ while ((ret != -1) && !done) {
+ ret = wl_display_dispatch_queue(dpy, queue);
+ }
+
+ if (!done) {
+ wl_callback_destroy(callback);
+ }
+
+ return ret >= 0;
+}
+
+static void yagl_wayland_display_drm_device(void *data,
+ struct wl_drm *wl_drm,
+ const char *name)
+{
+ struct yagl_wayland_display *dpy = data;
+ drm_magic_t magic;
+ int ret;
+
+ YAGL_LOG_FUNC_ENTER(yagl_wayland_display_drm_device,
+ "dpy = %p, wl_drm = %p, name = %s",
+ dpy, wl_drm, name);
+
+ if (dpy->drm_dev_name) {
+ YAGL_LOG_FUNC_EXIT(NULL);
+ return;
+ }
+
+ dpy->drm_dev_name = strdup(name);
+
+ dpy->drm_fd = open(dpy->drm_dev_name, O_RDWR);
+
+ if (dpy->drm_fd < 0) {
+ fprintf(stderr, "Critical error! Failed to open(\"%s\"): %s\n",
+ dpy->drm_dev_name, strerror(errno));
+ goto fail;
+ }
+
+ memset(&magic, 0, sizeof(magic));
+
+ ret = drmGetMagic(dpy->drm_fd, &magic);
+
+ if (ret != 0) {
+ fprintf(stderr, "Critical error! drmGetMagic failed: %s\n", strerror(-ret));
+ goto fail;
+ }
+
+ wl_drm_authenticate(dpy->wl_drm, magic);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return;
+
+fail:
+ if (dpy->drm_fd >= 0) {
+ close(dpy->drm_fd);
+ dpy->drm_fd = -1;
+ }
+ free(dpy->drm_dev_name);
+ dpy->drm_dev_name = NULL;
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+static void yagl_wayland_display_drm_format(void *data,
+ struct wl_drm *wl_drm,
+ uint32_t format)
+{
+ YAGL_LOG_FUNC_ENTER(yagl_wayland_display_drm_format,
+ "dpy = %p, wl_drm = %p, format = %u",
+ data, wl_drm, format);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+static void yagl_wayland_display_drm_authenticated(void *data,
+ struct wl_drm *wl_drm)
+{
+ struct yagl_wayland_display *dpy = data;
+
+ YAGL_LOG_FUNC_ENTER(yagl_wayland_display_drm_authenticated,
+ "dpy = %p, wl_drm = %p",
+ dpy, wl_drm);
+
+ dpy->authenticated = 1;
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+static struct wl_drm_listener yagl_wayland_display_drm_listener =
+{
+ yagl_wayland_display_drm_device,
+ yagl_wayland_display_drm_format,
+ yagl_wayland_display_drm_authenticated
+};
+
+static void yagl_wayland_display_registry_global(void *data,
+ struct wl_registry *registry,
+ uint32_t name,
+ const char* interface,
+ uint32_t version)
+{
+ struct yagl_wayland_display *dpy = data;
+
+ if (dpy->wl_drm) {
+ return;
+ }
+
+ if (strcmp(interface, "wl_drm") == 0) {
+ dpy->wl_drm = wl_registry_bind(registry,
+ name,
+ &wl_drm_interface,
+ 1);
+ wl_drm_add_listener(dpy->wl_drm,
+ &yagl_wayland_display_drm_listener,
+ dpy);
+ }
+}
+
+static void
+ yagl_wayland_display_registry_global_remove(void *data,
+ struct wl_registry *registry,
+ uint32_t name)
+{
+}
+
+static struct wl_registry_listener yagl_wayland_display_registry_listener =
+{
+ yagl_wayland_display_registry_global,
+ yagl_wayland_display_registry_global_remove
+};
+
+static int yagl_wayland_display_authenticate(struct yagl_native_display *dpy,
+ uint32_t id)
+{
+ struct yagl_wayland_display *wayland_dpy = (struct yagl_wayland_display*)dpy;
+ struct wl_display *wl_dpy = YAGL_WAYLAND_DPY(dpy->os_dpy);
+ int ret;
+
+ /*
+ * Set 'authenticated' temporary to 0, send
+ * an authenticate request, wait for the reply to set
+ * 'authenticated' to 1, in this case we're authenticated,
+ * otherwise an error has occurred and 'authenticated'
+ * will remain 0. Restore 'authenticated' to 1 afterwards.
+ */
+
+ wayland_dpy->authenticated = 0;
+
+ wl_drm_authenticate(wayland_dpy->wl_drm, id);
+ yagl_wayland_display_roundtrip(wl_dpy, wayland_dpy->queue);
+
+ ret = wayland_dpy->authenticated;
+
+ wayland_dpy->authenticated = 1;
+
+ return ret;
+}
+
+static struct yagl_native_drawable
+ *yagl_wayland_display_wrap_window(struct yagl_native_display *dpy,
+ yagl_os_window os_window)
+{
+ return yagl_wayland_window_create(dpy, os_window);
+}
+
+static struct yagl_native_drawable
+ *yagl_wayland_display_wrap_pixmap(struct yagl_native_display *dpy,
+ yagl_os_pixmap os_pixmap)
+{
+ return NULL;
+}
+
+static struct yagl_native_drawable
+ *yagl_wayland_display_create_pixmap(struct yagl_native_display *dpy,
+ uint32_t width,
+ uint32_t height,
+ uint32_t depth)
+{
+ return NULL;
+}
+
+static struct yagl_native_image
+ *yagl_wayland_display_create_image(struct yagl_native_display *dpy,
+ uint32_t width,
+ uint32_t height,
+ uint32_t depth)
+{
+ return NULL;
+}
+
+static int yagl_wayland_display_get_visual(struct yagl_native_display *dpy,
+ int *visual_id,
+ int *visual_type)
+{
+ *visual_id = 0;
+ *visual_type = 0;
+
+ return 1;
+}
+
+static void yagl_wayland_display_destroy(struct yagl_native_display *dpy)
+{
+ struct yagl_wayland_display *wayland_dpy = (struct yagl_wayland_display*)dpy;
+ struct wl_display *wl_dpy = YAGL_WAYLAND_DPY(dpy->os_dpy);
+
+ free(wayland_dpy->drm_dev_name);
+ wayland_dpy->drm_dev_name = NULL;
+
+ close(wayland_dpy->drm_fd);
+ wayland_dpy->drm_fd = -1;
+
+ wl_drm_destroy(wayland_dpy->wl_drm);
+ wayland_dpy->wl_drm = NULL;
+
+ wl_event_queue_destroy(wayland_dpy->queue);
+ wayland_dpy->queue = NULL;
+
+ yagl_native_display_cleanup(dpy);
+
+ if (wayland_dpy->own_dpy) {
+ wl_display_disconnect(wl_dpy);
+ }
+
+ yagl_free(wayland_dpy);
+}
+
+struct yagl_native_display
+ *yagl_wayland_display_create(struct yagl_native_platform *platform,
+ yagl_os_display os_dpy,
+ int own_dpy)
+{
+ struct wl_display *wl_dpy = YAGL_WAYLAND_DPY(os_dpy);
+ struct yagl_wayland_display *dpy;
+ int ret;
+ struct vigs_drm_device *drm_dev = NULL;
+
+ YAGL_LOG_FUNC_ENTER(yagl_wayland_display_create,
+ "os_dpy = %p", os_dpy);
+
+ dpy = yagl_malloc0(sizeof(*dpy));
+
+ dpy->own_dpy = own_dpy;
+
+ dpy->drm_fd = -1;
+
+ dpy->queue = wl_display_create_queue(wl_dpy);
+
+ if (!dpy->queue) {
+ YAGL_LOG_ERROR("Unable to create event queue");
+ goto fail;
+ }
+
+ if (own_dpy) {
+ wl_display_dispatch_pending(wl_dpy);
+ }
+
+ dpy->registry = wl_display_get_registry(wl_dpy);
+
+ wl_proxy_set_queue((struct wl_proxy*)dpy->registry, dpy->queue);
+
+ wl_registry_add_listener(dpy->registry,
+ &yagl_wayland_display_registry_listener,
+ dpy);
+
+ if (!yagl_wayland_display_roundtrip(wl_dpy, dpy->queue) ||
+ !dpy->wl_drm) {
+ YAGL_LOG_ERROR("Unable to obtain wl_drm interface");
+ goto fail;
+ }
+
+ if (!yagl_wayland_display_roundtrip(wl_dpy, dpy->queue) ||
+ (dpy->drm_fd == -1)) {
+ YAGL_LOG_ERROR("Unable to open wl_drm device");
+ goto fail;
+ }
+
+ if (!yagl_wayland_display_roundtrip(wl_dpy, dpy->queue) ||
+ !dpy->authenticated) {
+ YAGL_LOG_ERROR("Unable to authenticate on wl_drm interface");
+ goto fail;
+ }
+
+ ret = vigs_drm_device_create(dpy->drm_fd, &drm_dev);
+
+ if (ret != 0) {
+ fprintf(stderr,
+ "Critical error! vigs_drm_device_create failed: %s\n",
+ strerror(-ret));
+ goto fail;
+ }
+
+ yagl_native_display_init(&dpy->base,
+ platform,
+ os_dpy,
+ drm_dev,
+ dpy->drm_dev_name);
+
+ dpy->base.authenticate = &yagl_wayland_display_authenticate;
+ dpy->base.wrap_window = &yagl_wayland_display_wrap_window;
+ dpy->base.wrap_pixmap = &yagl_wayland_display_wrap_pixmap;
+ dpy->base.create_pixmap = &yagl_wayland_display_create_pixmap;
+ dpy->base.create_image = &yagl_wayland_display_create_image;
+ dpy->base.get_visual = &yagl_wayland_display_get_visual;
+ dpy->base.destroy = &yagl_wayland_display_destroy;
+
+ YAGL_LOG_FUNC_EXIT("display %p created", dpy);
+
+ return &dpy->base;
+
+fail:
+ free(dpy->drm_dev_name);
+ dpy->drm_dev_name = NULL;
+
+ if (dpy->drm_fd >= 0) {
+ close(dpy->drm_fd);
+ dpy->drm_fd = -1;
+ }
+
+ if (dpy->wl_drm) {
+ wl_drm_destroy(dpy->wl_drm);
+ dpy->wl_drm = NULL;
+ }
+
+ if (dpy->queue) {
+ wl_event_queue_destroy(dpy->queue);
+ dpy->queue = NULL;
+ }
+
+ yagl_free(dpy);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return NULL;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_WAYLAND_DISPLAY_H_
+#define _YAGL_WAYLAND_DISPLAY_H_
+
+#include "yagl_export.h"
+#include "yagl_native_display.h"
+#include <wayland-client.h>
+
+#define YAGL_WAYLAND_DPY(os_dpy) ((struct wl_display*)(os_dpy))
+
+struct wl_drm;
+
+struct yagl_wayland_display
+{
+ struct yagl_native_display base;
+
+ int own_dpy;
+
+ struct wl_event_queue *queue;
+
+ struct wl_registry *registry;
+
+ struct wl_drm *wl_drm;
+
+ char *drm_dev_name;
+
+ int drm_fd;
+
+ int authenticated;
+};
+
+struct yagl_native_display
+ *yagl_wayland_display_create(struct yagl_native_platform *platform,
+ yagl_os_display os_dpy,
+ int own_dpy);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_wayland_platform.h"
+#include "yagl_wayland_display.h"
+#include "yagl_native_platform.h"
+#include "yagl_log.h"
+#include "EGL/egl.h"
+#include <wayland-client.h>
+
+static int yagl_wayland_platform_probe(yagl_os_display os_dpy)
+{
+ void *first_pointer;
+
+ if (os_dpy == (yagl_os_display)EGL_DEFAULT_DISPLAY) {
+ return 0;
+ }
+
+ first_pointer = *(void**)os_dpy;
+
+ return (first_pointer == &wl_display_interface);
+}
+
+static struct yagl_native_display
+ *yagl_wayland_wrap_display(yagl_os_display os_dpy,
+ int enable_drm)
+{
+ struct yagl_native_display *dpy = NULL;
+
+ YAGL_LOG_FUNC_SET(eglGetDisplay);
+
+ if (os_dpy == (yagl_os_display)EGL_DEFAULT_DISPLAY) {
+ struct wl_display *wl_dpy;
+
+ wl_dpy = wl_display_connect(NULL);
+
+ if (!wl_dpy) {
+ YAGL_LOG_ERROR("Unable to connect to default display");
+ return NULL;
+ }
+
+ dpy = yagl_wayland_display_create(&yagl_wayland_platform,
+ (yagl_os_display)wl_dpy,
+ 1);
+
+ if (!dpy) {
+ wl_display_disconnect(wl_dpy);
+ }
+ } else {
+ dpy = yagl_wayland_display_create(&yagl_wayland_platform, os_dpy, 0);
+ }
+
+ return dpy;
+}
+
+struct yagl_native_platform yagl_wayland_platform =
+{
+ .pixmaps_supported = 0,
+ .buffer_age_supported = 1,
+ .probe = yagl_wayland_platform_probe,
+ .wrap_display = yagl_wayland_wrap_display
+};
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_WAYLAND_PLATFORM_H_
+#define _YAGL_WAYLAND_PLATFORM_H_
+
+#include "yagl_export.h"
+
+struct yagl_native_platform;
+
+extern struct yagl_native_platform yagl_wayland_platform;
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_wayland_window.h"
+#include "yagl_wayland_display.h"
+#include "yagl_log.h"
+#include "yagl_malloc.h"
+#include "yagl_wayland_egl.h"
+#include "wayland-drm.h"
+#include "wayland-drm-client-protocol.h"
+#include "vigs.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+static void yagl_wayland_window_buffer_release(void *data,
+ struct wl_buffer *buffer)
+{
+ struct yagl_wayland_window *window = data;
+ int i;
+
+ YAGL_LOG_FUNC_SET(yagl_wayland_window_buffer_release);
+
+ for (i = 0;
+ i < sizeof(window->color_buffers)/sizeof(window->color_buffers[0]);
+ ++i) {
+ if (window->color_buffers[i].wl_buffer == buffer) {
+ if ((window->color_buffers[i].drm_sfc->width != window->width) ||
+ (window->color_buffers[i].drm_sfc->height != window->height)) {
+ /*
+ * Window was resized, destroy the buffer.
+ */
+ wl_buffer_destroy(window->color_buffers[i].wl_buffer);
+ vigs_drm_gem_unref(&window->color_buffers[i].drm_sfc->gem);
+ window->color_buffers[i].wl_buffer = NULL;
+ window->color_buffers[i].drm_sfc = NULL;
+ }
+
+ /*
+ * Unlock the buffer.
+ */
+ window->color_buffers[i].locked = 0;
+ return;
+ }
+ }
+
+ /*
+ * Buffer is not in the pool, can't be!
+ */
+ YAGL_LOG_ERROR("Buffer is not in the pool, logic error!");
+}
+
+static struct wl_buffer_listener yagl_wayland_window_buffer_listener =
+{
+ yagl_wayland_window_buffer_release
+};
+
+static void yagl_wayland_window_frame_done(void *data,
+ struct wl_callback *callback,
+ uint32_t time)
+{
+ struct yagl_wayland_window *window = data;
+
+ window->frame_callback = NULL;
+ wl_callback_destroy(callback);
+}
+
+static struct wl_callback_listener yagl_wayland_window_frame_listener =
+{
+ yagl_wayland_window_frame_done
+};
+
+static int yagl_wayland_window_lock_back(struct yagl_wayland_window *window)
+{
+ struct yagl_wayland_display *dpy = (struct yagl_wayland_display*)window->base.dpy;
+ struct wl_display *wl_dpy = YAGL_WAYLAND_DPY(dpy->base.os_dpy);
+ int i, ret;
+
+ /*
+ * There might be a buffer release already queued that wasn't processed.
+ */
+ wl_display_dispatch_queue_pending(wl_dpy, dpy->queue);
+
+ if (!window->back) {
+ for (i = 0;
+ i < sizeof(window->color_buffers)/sizeof(window->color_buffers[0]);
+ ++i) {
+ if (window->color_buffers[i].locked) {
+ continue;
+ }
+ if (!window->back) {
+ window->back = &window->color_buffers[i];
+ } else if (!window->back->drm_sfc) {
+ /*
+ * Prefer buffers with DRM surfaces allocated.
+ */
+ window->back = &window->color_buffers[i];
+ }
+ }
+ }
+
+ if (!window->back) {
+ return 0;
+ }
+
+ if (!window->back->drm_sfc) {
+ ret = vigs_drm_surface_create(dpy->base.drm_dev,
+ window->width,
+ window->height,
+ (window->width * 4),
+ vigs_drm_surface_bgrx8888,
+ 0,
+ &window->back->drm_sfc);
+
+ if (ret != 0) {
+ fprintf(stderr,
+ "wayland: Unable to create DRM surface(%ux%u): %s\n",
+ window->width, window->height,
+ strerror(-ret));
+ window->back->drm_sfc = NULL;
+ }
+ window->back->age = 0;
+ }
+
+ if (!window->back->drm_sfc) {
+ window->back = NULL;
+ return 0;
+ }
+
+ window->back->locked = 1;
+
+ return 1;
+}
+
+static void yagl_wayland_window_resize(struct wl_egl_window *egl_window,
+ void *user_data)
+{
+ struct yagl_wayland_window *window = user_data;
+
+ YAGL_LOG_FUNC_SET(yagl_wayland_window_resize);
+
+ ++window->base.stamp;
+
+ YAGL_LOG_DEBUG("window %p resized to %dx%d, stamp = %u",
+ egl_window, window->width, window->height,
+ window->base.stamp);
+}
+
+static int yagl_wayland_window_get_buffer(struct yagl_native_drawable *drawable,
+ yagl_native_attachment attachment,
+ uint32_t *buffer_name,
+ struct vigs_drm_surface **buffer_sfc)
+{
+ struct yagl_wayland_window *window = (struct yagl_wayland_window*)drawable;
+ struct wl_egl_window *egl_window = YAGL_WAYLAND_WINDOW(drawable->os_drawable);
+ int i;
+
+ YAGL_LOG_FUNC_SET(yagl_wayland_window_get_buffer);
+
+ switch (attachment) {
+ case yagl_native_attachment_back:
+ break;
+ case yagl_native_attachment_front:
+ default:
+ YAGL_LOG_ERROR("Bad attachment %u", attachment);
+ return 0;
+ }
+
+ if ((window->width != egl_window->width) ||
+ (window->height != egl_window->height)) {
+ for (i = 0;
+ i < sizeof(window->color_buffers)/sizeof(window->color_buffers[0]);
+ ++i) {
+ if (window->color_buffers[i].locked &&
+ (window->back != &window->color_buffers[i])) {
+ /*
+ * Buffer is locked and it's not a back buffer.
+ */
+ continue;
+ }
+ if (window->color_buffers[i].wl_buffer) {
+ wl_buffer_destroy(window->color_buffers[i].wl_buffer);
+ }
+ if (window->color_buffers[i].drm_sfc) {
+ vigs_drm_gem_unref(&window->color_buffers[i].drm_sfc->gem);
+ }
+
+ window->color_buffers[i].wl_buffer = NULL;
+ window->color_buffers[i].drm_sfc = NULL;
+
+ if (window->back == &window->color_buffers[i]) {
+ /*
+ * If it's a back buffer and the window was resized
+ * then we MUST destroy it and create a new one
+ * later in 'yagl_wayland_window_lock_back'.
+ *
+ * Otherwise, we'll get very obscure resizing bugs.
+ */
+ window->color_buffers[i].locked = 0;
+ window->back = NULL;
+ }
+ }
+
+ window->width = egl_window->width;
+ window->height = egl_window->height;
+ window->dx = egl_window->dx;
+ window->dy = egl_window->dy;
+ }
+
+ if (!yagl_wayland_window_lock_back(window)) {
+ YAGL_LOG_ERROR("Cannot lock back for egl_window %p", egl_window);
+ return 0;
+ }
+
+ vigs_drm_gem_ref(&window->back->drm_sfc->gem);
+
+ *buffer_sfc = window->back->drm_sfc;
+
+ return 1;
+}
+
+static int yagl_wayland_window_get_buffer_age(struct yagl_native_drawable *drawable)
+{
+ struct yagl_wayland_window *window = (struct yagl_wayland_window*)drawable;
+
+ YAGL_LOG_FUNC_SET(yagl_wayland_window_get_buffer_age);
+
+ if (!yagl_wayland_window_lock_back(window)) {
+ YAGL_LOG_ERROR("Cannot lock back for egl_window %p",
+ YAGL_WAYLAND_WINDOW(drawable->os_drawable));
+ return 0;
+ }
+
+ return window->back->age;
+}
+
+static void yagl_wayland_window_swap_buffers(struct yagl_native_drawable *drawable)
+{
+ struct yagl_wayland_window *window = (struct yagl_wayland_window*)drawable;
+ struct yagl_wayland_display *dpy = (struct yagl_wayland_display*)drawable->dpy;
+ struct wl_display *wl_dpy = YAGL_WAYLAND_DPY(drawable->dpy->os_dpy);
+ struct wl_egl_window *egl_window = YAGL_WAYLAND_WINDOW(drawable->os_drawable);
+ int i, ret = 0;
+
+ YAGL_LOG_FUNC_SET(yagl_wayland_window_swap_buffers);
+
+ /*
+ * Throttle.
+ */
+ while (window->frame_callback && (ret != -1)) {
+ ret = wl_display_dispatch_queue(wl_dpy, dpy->queue);
+ }
+
+ if (ret < 0) {
+ YAGL_LOG_ERROR("wl_display_dispatch_queue failed for egl_window %p: %d", egl_window, ret);
+ return;
+ }
+
+ window->frame_callback = wl_surface_frame(egl_window->surface);
+ wl_callback_add_listener(window->frame_callback,
+ &yagl_wayland_window_frame_listener,
+ window);
+ wl_proxy_set_queue((struct wl_proxy*)window->frame_callback, dpy->queue);
+
+ for (i = 0;
+ i < sizeof(window->color_buffers)/sizeof(window->color_buffers[0]);
+ ++i) {
+ if (window->color_buffers[i].age > 0) {
+ ++window->color_buffers[i].age;
+ }
+ }
+
+ /*
+ * Make sure we have a back buffer in case we're swapping without ever
+ * rendering.
+ */
+ if (!yagl_wayland_window_lock_back(window)) {
+ YAGL_LOG_ERROR("Cannot lock back for egl_window %p", egl_window);
+ return;
+ }
+
+ window->front = window->back;
+ window->front->age = 1;
+ window->back = NULL;
+
+ if (!window->front->wl_buffer) {
+ ret = vigs_drm_gem_get_name(&window->front->drm_sfc->gem);
+
+ if (ret != 0) {
+ fprintf(stderr,
+ "wayland: Unable to get GEM name: %s\n", strerror(-ret));
+ }
+
+ window->front->wl_buffer =
+ wl_drm_create_buffer(dpy->wl_drm,
+ window->front->drm_sfc->gem.name,
+ window->width,
+ window->height,
+ window->front->drm_sfc->stride,
+ WL_DRM_FORMAT_XRGB8888);
+ wl_proxy_set_queue((struct wl_proxy*)window->front->wl_buffer,
+ dpy->queue);
+ wl_buffer_add_listener(window->front->wl_buffer,
+ &yagl_wayland_window_buffer_listener,
+ window);
+ }
+
+ wl_surface_attach(egl_window->surface,
+ window->front->wl_buffer,
+ window->dx,
+ window->dy);
+
+ egl_window->attached_width = window->width;
+ egl_window->attached_height = window->height;
+
+ /*
+ * Reset resize growing parameters.
+ */
+ window->dx = 0;
+ window->dy = 0;
+
+ wl_surface_damage(egl_window->surface, 0, 0,
+ window->width,
+ window->height);
+
+ wl_surface_commit(egl_window->surface);
+
+ ++drawable->stamp;
+}
+
+static void yagl_wayland_window_wait(struct yagl_native_drawable *drawable,
+ uint32_t width,
+ uint32_t height)
+{
+}
+
+static void yagl_wayland_window_copy_to_pixmap(struct yagl_native_drawable *drawable,
+ yagl_os_pixmap os_pixmap,
+ uint32_t from_x,
+ uint32_t from_y,
+ uint32_t to_x,
+ uint32_t to_y,
+ uint32_t width,
+ uint32_t height)
+{
+}
+
+static void yagl_wayland_window_set_swap_interval(struct yagl_native_drawable *drawable,
+ int interval)
+{
+}
+
+static void yagl_wayland_window_get_geometry(struct yagl_native_drawable *drawable,
+ uint32_t *width,
+ uint32_t *height,
+ uint32_t *depth)
+{
+}
+
+static struct yagl_native_image
+ *yagl_wayland_window_get_image(struct yagl_native_drawable *drawable,
+ uint32_t width,
+ uint32_t height)
+{
+ return NULL;
+}
+
+static void yagl_wayland_window_destroy(struct yagl_native_drawable *drawable)
+{
+ struct yagl_wayland_window *window = (struct yagl_wayland_window*)drawable;
+ struct wl_egl_window *egl_window = YAGL_WAYLAND_WINDOW(drawable->os_drawable);
+ int i;
+
+ for (i = 0;
+ i < sizeof(window->color_buffers)/sizeof(window->color_buffers[0]);
+ ++i) {
+ if (window->color_buffers[i].wl_buffer) {
+ wl_buffer_destroy(window->color_buffers[i].wl_buffer);
+ }
+ if (window->color_buffers[i].drm_sfc) {
+ vigs_drm_gem_unref(&window->color_buffers[i].drm_sfc->gem);
+ }
+ window->color_buffers[i].wl_buffer = NULL;
+ window->color_buffers[i].drm_sfc = NULL;
+ window->color_buffers[i].locked = 0;
+ }
+
+ if (window->frame_callback) {
+ wl_callback_destroy(window->frame_callback);
+ window->frame_callback = NULL;
+ }
+
+ yagl_native_drawable_cleanup(drawable);
+
+ egl_window->resize_callback = NULL;
+ egl_window->user_data = NULL;
+
+ yagl_free(drawable);
+}
+
+struct yagl_native_drawable
+ *yagl_wayland_window_create(struct yagl_native_display *dpy,
+ yagl_os_window os_window)
+{
+ struct wl_egl_window *egl_window = YAGL_WAYLAND_WINDOW(os_window);
+ struct yagl_wayland_window *window;
+
+ YAGL_LOG_FUNC_SET(yagl_wayland_window_create);
+
+ if (egl_window->resize_callback || egl_window->user_data) {
+ YAGL_LOG_ERROR("wl_egl_window %p already wrapped", egl_window);
+ return NULL;
+ }
+
+ window = yagl_malloc0(sizeof(*window));
+
+ yagl_native_drawable_init(&window->base, dpy, os_window);
+
+ window->base.get_buffer = &yagl_wayland_window_get_buffer;
+ window->base.get_buffer_age = &yagl_wayland_window_get_buffer_age;
+ window->base.swap_buffers = &yagl_wayland_window_swap_buffers;
+ window->base.wait = &yagl_wayland_window_wait;
+ window->base.copy_to_pixmap = &yagl_wayland_window_copy_to_pixmap;
+ window->base.set_swap_interval = &yagl_wayland_window_set_swap_interval;
+ window->base.get_geometry = &yagl_wayland_window_get_geometry;
+ window->base.get_image = &yagl_wayland_window_get_image;
+ window->base.destroy = &yagl_wayland_window_destroy;
+
+ /*
+ * First comparison against real window
+ * dimensions must always fail.
+ */
+ window->width = -1;
+ window->height = -1;
+
+ egl_window->resize_callback = &yagl_wayland_window_resize;
+ egl_window->user_data = window;
+
+ return &window->base;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_WAYLAND_WINDOW_H_
+#define _YAGL_WAYLAND_WINDOW_H_
+
+#include "yagl_export.h"
+#include "yagl_native_drawable.h"
+#include <wayland-client.h>
+
+#define YAGL_WAYLAND_WINDOW(os_window) ((struct wl_egl_window*)(os_window))
+
+struct vigs_drm_surface;
+
+struct yagl_wayland_window
+{
+ struct yagl_native_drawable base;
+
+ struct
+ {
+ struct vigs_drm_surface *drm_sfc;
+ struct wl_buffer *wl_buffer;
+ int locked;
+ int age;
+ } color_buffers[3], *back, *front;
+
+ int width;
+ int height;
+
+ int dx;
+ int dy;
+
+ struct wl_callback *frame_callback;
+};
+
+struct yagl_native_drawable
+ *yagl_wayland_window_create(struct yagl_native_display *dpy,
+ yagl_os_drawable os_drawable);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_dri2.h"
+#include "yagl_display.h"
+#include "yagl_surface.h"
+#include "yagl_log.h"
+#include "yagl_native_drawable.h"
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include <X11/extensions/dri2proto.h>
+
+/*
+ * Allow the build to work with an older versions of dri2proto.h and
+ * dri2tokens.h.
+ */
+#if DRI2_MINOR < 1
+#undef DRI2_MINOR
+#define DRI2_MINOR 1
+#define X_DRI2GetBuffersWithFormat 7
+#endif
+
+static char dri2ExtensionName[] = DRI2_NAME;
+static XExtensionInfo *dri2Info;
+static XEXT_GENERATE_CLOSE_DISPLAY(DRI2CloseDisplay, dri2Info)
+
+static Bool DRI2WireToEvent(Display *x_dpy, XEvent *event, xEvent *wire);
+static Status DRI2EventToWire(Display *dpy, XEvent *event, xEvent *wire);
+static int DRI2Error(Display *display, xError *err,
+ XExtCodes *codes, int *ret_code);
+
+static XExtensionHooks dri2ExtensionHooks =
+{
+ NULL, /* create_gc */
+ NULL, /* copy_gc */
+ NULL, /* flush_gc */
+ NULL, /* free_gc */
+ NULL, /* create_font */
+ NULL, /* free_font */
+ DRI2CloseDisplay, /* close_display */
+ DRI2WireToEvent, /* wire_to_event */
+ DRI2EventToWire, /* event_to_wire */
+ DRI2Error, /* error */
+ NULL, /* error_string */
+};
+
+static XEXT_GENERATE_FIND_DISPLAY(DRI2FindDisplay,
+ dri2Info,
+ dri2ExtensionName,
+ &dri2ExtensionHooks,
+ 0, NULL)
+
+static Bool DRI2WireToEvent(Display *x_dpy, XEvent *event, xEvent *wire)
+{
+ XExtDisplayInfo *info = DRI2FindDisplay(x_dpy);
+ xDRI2InvalidateBuffers *awire;
+ struct yagl_display *dpy;
+ struct yagl_surface *sfc;
+
+ YAGL_LOG_FUNC_SET(DRI2WireToEvent);
+
+ XextCheckExtension(x_dpy, info, dri2ExtensionName, False);
+
+ switch ((wire->u.u.type & 0x7f) - info->codes->first_event) {
+#ifdef X_DRI2SwapBuffers
+ case DRI2_BufferSwapComplete:
+ return False;
+#endif
+#ifdef DRI2_InvalidateBuffers
+ case DRI2_InvalidateBuffers:
+ awire = (xDRI2InvalidateBuffers*)wire;
+ dpy = yagl_display_get_os((yagl_os_display)x_dpy);
+
+ if (!dpy) {
+ YAGL_LOG_ERROR("EGL display not found for X display 0x%X", x_dpy);
+ return False;
+ }
+
+ sfc = yagl_display_surface_acquire(dpy, (EGLSurface)awire->drawable);
+
+ if (sfc) {
+ if (sfc->type == EGL_WINDOW_BIT) {
+ ++sfc->native_drawable->stamp;
+ YAGL_LOG_TRACE("EGL surface 0x%X invalidated, stamp = %u",
+ awire->drawable,
+ sfc->native_drawable->stamp);
+ } else {
+ YAGL_LOG_ERROR("EGL surface 0x%X is not a window surface",
+ awire->drawable);
+ }
+ } else {
+ YAGL_LOG_ERROR("EGL surface not found for X drawable 0x%X",
+ awire->drawable);
+ }
+
+ yagl_surface_release(sfc);
+
+ return False;
+#endif
+ default:
+ break;
+ }
+
+ return False;
+}
+
+/*
+ * We don't actually support this. It doesn't make sense for clients to
+ * send each other DRI2 events.
+ */
+static Status DRI2EventToWire(Display *dpy, XEvent *event, xEvent *wire)
+{
+ XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+
+ XextCheckExtension(dpy, info, dri2ExtensionName, False);
+
+ switch (event->type) {
+ default:
+ /* client doesn't support server event */
+ break;
+ }
+
+ return Success;
+}
+
+static int DRI2Error(Display *display, xError *err, XExtCodes *codes,
+ int *ret_code)
+{
+ if ((err->majorCode == codes->major_opcode) &&
+ (err->errorCode == BadDrawable) &&
+ (err->minorCode == X_DRI2CopyRegion)) {
+ return True;
+ }
+
+ /*
+ * If the X drawable was destroyed before the GLX drawable, the
+ * DRI2 drawble will be gone by the time we call
+ * DRI2DestroyDrawable. So just ignore BadDrawable here.
+ */
+ if ((err->majorCode == codes->major_opcode) &&
+ (err->errorCode == BadDrawable) &&
+ (err->minorCode == X_DRI2DestroyDrawable)) {
+ return True;
+ }
+
+ /*
+ * If the server is non-local DRI2Connect will raise BadRequest.
+ * Swallow this so that DRI2Connect can signal this in its return code
+ */
+ if ((err->majorCode == codes->major_opcode) &&
+ (err->minorCode == X_DRI2Connect) &&
+ (err->errorCode == BadRequest)) {
+ *ret_code = False;
+ return True;
+ }
+
+ return False;
+}
+
+Bool yagl_DRI2QueryExtension(Display *dpy, int *eventBase, int *errorBase)
+{
+ XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+
+ if (XextHasExtension(info)) {
+ *eventBase = info->codes->first_event;
+ *errorBase = info->codes->first_error;
+ return True;
+ }
+
+ return False;
+}
+
+Bool yagl_DRI2QueryVersion(Display *dpy, int *major, int *minor)
+{
+ XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+ xDRI2QueryVersionReply rep;
+ xDRI2QueryVersionReq *req;
+ int i, nevents;
+
+ XextCheckExtension(dpy, info, dri2ExtensionName, False);
+
+ LockDisplay(dpy);
+ GetReq(DRI2QueryVersion, req);
+ req->reqType = info->codes->major_opcode;
+ req->dri2ReqType = X_DRI2QueryVersion;
+ req->majorVersion = DRI2_MAJOR;
+ req->minorVersion = DRI2_MINOR;
+ if (!_XReply(dpy, (xReply*)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+ *major = rep.majorVersion;
+ *minor = rep.minorVersion;
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ switch (rep.minorVersion) {
+ case 1:
+ nevents = 0;
+ break;
+ case 2:
+ nevents = 1;
+ break;
+ case 3:
+ default:
+ nevents = 2;
+ break;
+ }
+
+ for (i = 0; i < nevents; i++) {
+ XESetWireToEvent(dpy, info->codes->first_event + i, DRI2WireToEvent);
+ XESetEventToWire(dpy, info->codes->first_event + i, DRI2EventToWire);
+ }
+
+ return True;
+}
+
+Bool yagl_DRI2Connect(Display *dpy, XID window,
+ char **driverName, char **deviceName)
+{
+ XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+ xDRI2ConnectReply rep;
+ xDRI2ConnectReq *req;
+#ifdef DRI2DriverPrimeShift
+ char *prime;
+#endif
+
+ XextCheckExtension(dpy, info, dri2ExtensionName, False);
+
+ LockDisplay(dpy);
+ GetReq(DRI2Connect, req);
+ req->reqType = info->codes->major_opcode;
+ req->dri2ReqType = X_DRI2Connect;
+ req->window = window;
+
+ req->driverType = DRI2DriverDRI;
+#ifdef DRI2DriverPrimeShift
+ prime = getenv("DRI_PRIME");
+ if (prime) {
+ uint32_t primeid;
+ errno = 0;
+ primeid = strtoul(prime, NULL, 0);
+ if (errno == 0) {
+ req->driverType |= ((primeid & DRI2DriverPrimeMask) << DRI2DriverPrimeShift);
+ }
+ }
+#endif
+
+ if (!_XReply(dpy, (xReply*)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+
+ if (rep.driverNameLength == 0 && rep.deviceNameLength == 0) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+
+ *driverName = Xmalloc(rep.driverNameLength + 1);
+ if (*driverName == NULL) {
+ _XEatData(dpy,
+ ((rep.driverNameLength + 3) & ~3) +
+ ((rep.deviceNameLength + 3) & ~3));
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+ _XReadPad(dpy, *driverName, rep.driverNameLength);
+ (*driverName)[rep.driverNameLength] = '\0';
+
+ *deviceName = Xmalloc(rep.deviceNameLength + 1);
+ if (*deviceName == NULL) {
+ Xfree(*driverName);
+ _XEatData(dpy, ((rep.deviceNameLength + 3) & ~3));
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+ _XReadPad(dpy, *deviceName, rep.deviceNameLength);
+ (*deviceName)[rep.deviceNameLength] = '\0';
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return True;
+}
+
+Bool yagl_DRI2Authenticate(Display *dpy, XID window, drm_magic_t magic)
+{
+ XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+ xDRI2AuthenticateReq *req;
+ xDRI2AuthenticateReply rep;
+
+ XextCheckExtension(dpy, info, dri2ExtensionName, False);
+
+ LockDisplay(dpy);
+ GetReq(DRI2Authenticate, req);
+ req->reqType = info->codes->major_opcode;
+ req->dri2ReqType = X_DRI2Authenticate;
+ req->window = window;
+ req->magic = magic;
+
+ if (!_XReply(dpy, (xReply*)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return rep.authenticated;
+}
+
+void yagl_DRI2CreateDrawable(Display *dpy, XID drawable)
+{
+ XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+ xDRI2CreateDrawableReq *req;
+
+ XextSimpleCheckExtension(dpy, info, dri2ExtensionName);
+
+ LockDisplay(dpy);
+ GetReq(DRI2CreateDrawable, req);
+ req->reqType = info->codes->major_opcode;
+ req->dri2ReqType = X_DRI2CreateDrawable;
+ req->drawable = drawable;
+ UnlockDisplay(dpy);
+ SyncHandle();
+}
+
+void yagl_DRI2DestroyDrawable(Display *dpy, XID drawable)
+{
+ XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+ xDRI2DestroyDrawableReq *req;
+
+ XextSimpleCheckExtension(dpy, info, dri2ExtensionName);
+
+ XSync(dpy, False);
+
+ LockDisplay(dpy);
+ GetReq(DRI2DestroyDrawable, req);
+ req->reqType = info->codes->major_opcode;
+ req->dri2ReqType = X_DRI2DestroyDrawable;
+ req->drawable = drawable;
+ UnlockDisplay(dpy);
+ SyncHandle();
+}
+
+yagl_DRI2Buffer *yagl_DRI2GetBuffers(Display *dpy, XID drawable,
+ int *width, int *height,
+ unsigned int *attachments, int count,
+ int *outCount)
+{
+ XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+ xDRI2GetBuffersReply rep;
+ xDRI2GetBuffersReq *req;
+ yagl_DRI2Buffer *buffers;
+ xDRI2Buffer repBuffer;
+ CARD32 *p;
+ int i;
+
+ XextCheckExtension(dpy, info, dri2ExtensionName, False);
+
+ LockDisplay(dpy);
+ GetReqExtra(DRI2GetBuffers, count * 4, req);
+ req->reqType = info->codes->major_opcode;
+ req->dri2ReqType = X_DRI2GetBuffers;
+ req->drawable = drawable;
+ req->count = count;
+ p = (CARD32*)&req[1];
+ for (i = 0; i < count; i++) {
+ p[i] = attachments[i];
+ }
+
+ if (!_XReply(dpy, (xReply*)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ *width = rep.width;
+ *height = rep.height;
+ *outCount = rep.count;
+
+ buffers = Xmalloc(rep.count * sizeof buffers[0]);
+ if (buffers == NULL) {
+ _XEatData(dpy, rep.count * sizeof repBuffer);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ for (i = 0; i < (int)rep.count; i++) {
+ _XReadPad(dpy, (char*)&repBuffer, sizeof repBuffer);
+ buffers[i].attachment = repBuffer.attachment;
+ buffers[i].name = repBuffer.name;
+ buffers[i].pitch = repBuffer.pitch;
+ buffers[i].cpp = repBuffer.cpp;
+ buffers[i].flags = repBuffer.flags;
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return buffers;
+}
+
+
+yagl_DRI2Buffer
+ *yagl_DRI2GetBuffersWithFormat(Display *dpy, XID drawable,
+ int *width, int *height,
+ unsigned int *attachments, int count,
+ int *outCount)
+{
+ XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+ xDRI2GetBuffersReply rep;
+ xDRI2GetBuffersReq *req;
+ yagl_DRI2Buffer *buffers;
+ xDRI2Buffer repBuffer;
+ CARD32 *p;
+ int i;
+
+ XextCheckExtension(dpy, info, dri2ExtensionName, False);
+
+ LockDisplay(dpy);
+ GetReqExtra(DRI2GetBuffers, count * (4 * 2), req);
+ req->reqType = info->codes->major_opcode;
+ req->dri2ReqType = X_DRI2GetBuffersWithFormat;
+ req->drawable = drawable;
+ req->count = count;
+ p = (CARD32*)&req[1];
+ for (i = 0; i < (count * 2); i++) {
+ p[i] = attachments[i];
+ }
+
+ if (!_XReply(dpy, (xReply*)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ *width = rep.width;
+ *height = rep.height;
+ *outCount = rep.count;
+
+ buffers = Xmalloc(rep.count * sizeof buffers[0]);
+ if (buffers == NULL) {
+ _XEatData(dpy, rep.count * sizeof repBuffer);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return NULL;
+ }
+
+ for (i = 0; i < (int)rep.count; i++) {
+ _XReadPad(dpy, (char *) &repBuffer, sizeof repBuffer);
+ buffers[i].attachment = repBuffer.attachment;
+ buffers[i].name = repBuffer.name;
+ buffers[i].pitch = repBuffer.pitch;
+ buffers[i].cpp = repBuffer.cpp;
+ buffers[i].flags = repBuffer.flags;
+ }
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return buffers;
+}
+
+void yagl_DRI2CopyRegion(Display *dpy, XID drawable, XserverRegion region,
+ CARD32 dest, CARD32 src)
+{
+ XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+ xDRI2CopyRegionReq *req;
+ xDRI2CopyRegionReply rep;
+
+ XextSimpleCheckExtension(dpy, info, dri2ExtensionName);
+
+ LockDisplay(dpy);
+ GetReq(DRI2CopyRegion, req);
+ req->reqType = info->codes->major_opcode;
+ req->dri2ReqType = X_DRI2CopyRegion;
+ req->drawable = drawable;
+ req->region = region;
+ req->dest = dest;
+ req->src = src;
+
+ _XReply(dpy, (xReply *) & rep, 0, xFalse);
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+}
+
+#ifdef X_DRI2SwapBuffers
+static void load_swap_req(xDRI2SwapBuffersReq *req,
+ CARD64 target, CARD64 divisor,
+ CARD64 remainder)
+{
+ req->target_msc_hi = target >> 32;
+ req->target_msc_lo = target & 0xffffffff;
+ req->divisor_hi = divisor >> 32;
+ req->divisor_lo = divisor & 0xffffffff;
+ req->remainder_hi = remainder >> 32;
+ req->remainder_lo = remainder & 0xffffffff;
+}
+
+static CARD64 vals_to_card64(CARD32 lo, CARD32 hi)
+{
+ return (CARD64)hi << 32 | lo;
+}
+
+void yagl_DRI2SwapBuffers(Display *dpy, XID drawable, CARD64 target_msc,
+ CARD64 divisor, CARD64 remainder, CARD64 *count)
+{
+ XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+ xDRI2SwapBuffersReq *req;
+ xDRI2SwapBuffersReply rep;
+
+ XextSimpleCheckExtension (dpy, info, dri2ExtensionName);
+
+ LockDisplay(dpy);
+ GetReq(DRI2SwapBuffers, req);
+ req->reqType = info->codes->major_opcode;
+ req->dri2ReqType = X_DRI2SwapBuffers;
+ req->drawable = drawable;
+ load_swap_req(req, target_msc, divisor, remainder);
+
+ _XReply(dpy, (xReply*)&rep, 0, xFalse);
+
+ *count = vals_to_card64(rep.swap_lo, rep.swap_hi);
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+}
+#endif
+
+#ifdef X_DRI2GetMSC
+Bool yagl_DRI2GetMSC(Display *dpy, XID drawable, CARD64 *ust, CARD64 *msc,
+ CARD64 *sbc)
+{
+ XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+ xDRI2GetMSCReq *req;
+ xDRI2MSCReply rep;
+
+ XextCheckExtension (dpy, info, dri2ExtensionName, False);
+
+ LockDisplay(dpy);
+ GetReq(DRI2GetMSC, req);
+ req->reqType = info->codes->major_opcode;
+ req->dri2ReqType = X_DRI2GetMSC;
+ req->drawable = drawable;
+
+ if (!_XReply(dpy, (xReply*)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+
+ *ust = vals_to_card64(rep.ust_lo, rep.ust_hi);
+ *msc = vals_to_card64(rep.msc_lo, rep.msc_hi);
+ *sbc = vals_to_card64(rep.sbc_lo, rep.sbc_hi);
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return True;
+}
+#endif
+
+#ifdef X_DRI2WaitMSC
+static void load_msc_req(xDRI2WaitMSCReq *req, CARD64 target, CARD64 divisor,
+ CARD64 remainder)
+{
+ req->target_msc_hi = target >> 32;
+ req->target_msc_lo = target & 0xffffffff;
+ req->divisor_hi = divisor >> 32;
+ req->divisor_lo = divisor & 0xffffffff;
+ req->remainder_hi = remainder >> 32;
+ req->remainder_lo = remainder & 0xffffffff;
+}
+
+Bool yagl_DRI2WaitMSC(Display *dpy, XID drawable,
+ CARD64 target_msc, CARD64 divisor,
+ CARD64 remainder, CARD64 *ust, CARD64 *msc, CARD64 *sbc)
+{
+ XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+ xDRI2WaitMSCReq *req;
+ xDRI2MSCReply rep;
+
+ XextCheckExtension (dpy, info, dri2ExtensionName, False);
+
+ LockDisplay(dpy);
+ GetReq(DRI2WaitMSC, req);
+ req->reqType = info->codes->major_opcode;
+ req->dri2ReqType = X_DRI2WaitMSC;
+ req->drawable = drawable;
+ load_msc_req(req, target_msc, divisor, remainder);
+
+ if (!_XReply(dpy, (xReply*)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+
+ *ust = ((CARD64)rep.ust_hi << 32) | (CARD64)rep.ust_lo;
+ *msc = ((CARD64)rep.msc_hi << 32) | (CARD64)rep.msc_lo;
+ *sbc = ((CARD64)rep.sbc_hi << 32) | (CARD64)rep.sbc_lo;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return True;
+}
+#endif
+
+#ifdef X_DRI2WaitSBC
+static void load_sbc_req(xDRI2WaitSBCReq *req, CARD64 target)
+{
+ req->target_sbc_hi = target >> 32;
+ req->target_sbc_lo = target & 0xffffffff;
+}
+
+Bool yagl_DRI2WaitSBC(Display *dpy, XID drawable, CARD64 target_sbc, CARD64 *ust,
+ CARD64 *msc, CARD64 *sbc)
+{
+ XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+ xDRI2WaitSBCReq *req;
+ xDRI2MSCReply rep;
+
+ XextCheckExtension (dpy, info, dri2ExtensionName, False);
+
+ LockDisplay(dpy);
+ GetReq(DRI2WaitSBC, req);
+ req->reqType = info->codes->major_opcode;
+ req->dri2ReqType = X_DRI2WaitSBC;
+ req->drawable = drawable;
+ load_sbc_req(req, target_sbc);
+
+ if (!_XReply(dpy, (xReply*)&rep, 0, xFalse)) {
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return False;
+ }
+
+ *ust = ((CARD64)rep.ust_hi << 32) | rep.ust_lo;
+ *msc = ((CARD64)rep.msc_hi << 32) | rep.msc_lo;
+ *sbc = ((CARD64)rep.sbc_hi << 32) | rep.sbc_lo;
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ return True;
+}
+#endif
+
+#ifdef X_DRI2SwapInterval
+void yagl_DRI2SwapInterval(Display *dpy, XID drawable, int interval)
+{
+ XExtDisplayInfo *info = DRI2FindDisplay(dpy);
+ xDRI2SwapIntervalReq *req;
+
+ XextSimpleCheckExtension (dpy, info, dri2ExtensionName);
+
+ LockDisplay(dpy);
+ GetReq(DRI2SwapInterval, req);
+ req->reqType = info->codes->major_opcode;
+ req->dri2ReqType = X_DRI2SwapInterval;
+ req->drawable = drawable;
+ req->interval = interval;
+ UnlockDisplay(dpy);
+ SyncHandle();
+}
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_DRI2_H_
+#define _YAGL_DRI2_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+#include <X11/extensions/Xfixes.h>
+#include <X11/extensions/dri2tokens.h>
+#include <X11/Xmd.h>
+#include <X11/Xlibint.h>
+#include <xf86drm.h>
+
+typedef struct
+{
+ unsigned int attachment;
+ unsigned int name;
+ unsigned int pitch;
+ unsigned int cpp;
+ unsigned int flags;
+} yagl_DRI2Buffer;
+
+Bool yagl_DRI2QueryExtension(Display *display,
+ int *eventBase,
+ int *errorBase);
+
+Bool yagl_DRI2QueryVersion(Display *display,
+ int *major,
+ int *minor);
+
+Bool yagl_DRI2Connect(Display *display,
+ XID window,
+ char **driverName,
+ char **deviceName);
+
+Bool yagl_DRI2Authenticate(Display *display,
+ XID window,
+ drm_magic_t magic);
+
+void yagl_DRI2CreateDrawable(Display *display, XID drawable);
+
+void yagl_DRI2DestroyDrawable(Display *display, XID handle);
+
+yagl_DRI2Buffer *yagl_DRI2GetBuffers(Display *dpy, XID drawable,
+ int *width, int *height,
+ unsigned int *attachments, int count,
+ int *outCount);
+
+yagl_DRI2Buffer *yagl_DRI2GetBuffersWithFormat(Display *dpy,
+ XID drawable,
+ int *width, int *height,
+ unsigned int *attachments,
+ int count, int *outCount);
+
+void yagl_DRI2CopyRegion(Display *dpy,
+ XID drawable,
+ XserverRegion region,
+ CARD32 dest, CARD32 src);
+
+void yagl_DRI2SwapBuffers(Display *dpy, XID drawable,
+ CARD64 target_msc, CARD64 divisor,
+ CARD64 remainder, CARD64 *count);
+
+Bool yagl_DRI2GetMSC(Display *dpy, XID drawable,
+ CARD64 *ust, CARD64 *msc, CARD64 *sbc);
+
+Bool yagl_DRI2WaitMSC(Display *dpy, XID drawable,
+ CARD64 target_msc, CARD64 divisor,
+ CARD64 remainder, CARD64 *ust, CARD64 *msc, CARD64 *sbc);
+
+Bool yagl_DRI2WaitSBC(Display *dpy, XID drawable,
+ CARD64 target_sbc, CARD64 *ust,
+ CARD64 *msc, CARD64 *sbc);
+
+void yagl_DRI2SwapInterval(Display *dpy, XID drawable, int interval);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_x11_display.h"
+#include "yagl_x11_drawable.h"
+#include "yagl_x11_image.h"
+#include "yagl_log.h"
+#include "yagl_malloc.h"
+#include "yagl_dri2.h"
+#include "vigs.h"
+#include <X11/Xutil.h>
+#include <X11/extensions/XShm.h>
+#include <sys/fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+static int yagl_x11_display_dri2_authenticate(Display *x_dpy, uint32_t id)
+{
+ if (!yagl_DRI2Authenticate(x_dpy,
+ RootWindow(x_dpy, DefaultScreen(x_dpy)),
+ id)) {
+ fprintf(stderr, "Critical error! Failed to DRI2Authenticate on YaGL display, DRI2 not enabled ?\n");
+ return 0;
+ }
+
+ return 1;
+}
+
+static int yagl_x11_display_dri2_init(Display *x_dpy, char **dri_device)
+{
+ int ret;
+ int event_base, error_base;
+ int dri_major, dri_minor;
+ char *dri_driver = NULL;
+ int drm_fd = -1;
+ drm_magic_t magic;
+
+ YAGL_LOG_FUNC_SET(eglGetDisplay);
+
+ *dri_device = NULL;
+
+ if (!yagl_DRI2QueryExtension(x_dpy, &event_base, &error_base)) {
+ fprintf(stderr, "Critical error! Failed to DRI2QueryExtension on YaGL display, DRI2 not enabled ?\n");
+ goto fail;
+ }
+
+ YAGL_LOG_TRACE("DRI2QueryExtension returned %d %d",
+ event_base, error_base);
+
+ if (!yagl_DRI2QueryVersion(x_dpy, &dri_major, &dri_minor)) {
+ fprintf(stderr, "Critical error! Failed to DRI2QueryVersion on YaGL display, DRI2 not enabled ?\n");
+ goto fail;
+ }
+
+ YAGL_LOG_TRACE("DRI2QueryVersion returned %d %d",
+ dri_major, dri_minor);
+
+ if (!yagl_DRI2Connect(x_dpy,
+ RootWindow(x_dpy, DefaultScreen(x_dpy)),
+ &dri_driver,
+ dri_device)) {
+ fprintf(stderr, "Critical error! Failed to DRI2Connect on YaGL display, DRI2 not enabled ?\n");
+ goto fail;
+ }
+
+ YAGL_LOG_TRACE("DRI2Connect returned %s %s",
+ dri_driver, *dri_device);
+
+ drm_fd = open(*dri_device, O_RDWR);
+
+ if (drm_fd < 0) {
+ fprintf(stderr, "Critical error! Failed to open(\"%s\"): %s\n", *dri_device, strerror(errno));
+ goto fail;
+ }
+
+ memset(&magic, 0, sizeof(magic));
+
+ ret = drmGetMagic(drm_fd, &magic);
+
+ if (ret != 0) {
+ fprintf(stderr, "Critical error! drmGetMagic failed: %s\n", strerror(-ret));
+ goto fail;
+ }
+
+ if (!yagl_x11_display_dri2_authenticate(x_dpy, magic)) {
+ goto fail;
+ }
+
+ goto out;
+
+fail:
+ if (drm_fd >= 0) {
+ close(drm_fd);
+ drm_fd = -1;
+ }
+ if (*dri_device) {
+ Xfree(*dri_device);
+ }
+out:
+ if (dri_driver) {
+ Xfree(dri_driver);
+ }
+
+ return drm_fd;
+}
+
+static int yagl_x11_display_authenticate(struct yagl_native_display *dpy,
+ uint32_t id)
+{
+ Display *x_dpy = YAGL_X11_DPY(dpy->os_dpy);
+
+ return yagl_x11_display_dri2_authenticate(x_dpy, id);
+}
+
+static struct yagl_native_drawable
+ *yagl_x11_display_wrap_window(struct yagl_native_display *dpy,
+ yagl_os_window os_window)
+{
+ return yagl_x11_drawable_create(dpy, os_window, 0, 0);
+}
+
+static struct yagl_native_drawable
+ *yagl_x11_display_wrap_pixmap(struct yagl_native_display *dpy,
+ yagl_os_pixmap os_pixmap)
+{
+ return yagl_x11_drawable_create(dpy, os_pixmap, 0, 1);
+}
+
+static struct yagl_native_drawable
+ *yagl_x11_display_create_pixmap(struct yagl_native_display *dpy,
+ uint32_t width,
+ uint32_t height,
+ uint32_t depth)
+{
+ struct yagl_native_drawable *drawable;
+ Display *x_dpy = YAGL_X11_DPY(dpy->os_dpy);
+ Pixmap x_pixmap = XCreatePixmap(x_dpy,
+ RootWindow(x_dpy, DefaultScreen(x_dpy)),
+ width, height, depth);
+
+ if (!x_pixmap) {
+ return NULL;
+ }
+
+ drawable = yagl_x11_drawable_create(dpy, (yagl_os_pixmap)x_pixmap, 1, 1);
+
+ if (!drawable) {
+ XFreePixmap(x_dpy, x_pixmap);
+ return NULL;
+ }
+
+ return drawable;
+}
+
+static struct yagl_native_image
+ *yagl_x11_display_create_image(struct yagl_native_display *dpy,
+ uint32_t width,
+ uint32_t height,
+ uint32_t depth)
+{
+ return yagl_x11_image_create(dpy, width, height, depth);
+}
+
+static int yagl_x11_display_get_visual(struct yagl_native_display *dpy,
+ int *visual_id,
+ int *visual_type)
+{
+ Display *x_dpy = YAGL_X11_DPY(dpy->os_dpy);
+ int screen;
+ XVisualInfo vi;
+
+ screen = XScreenNumberOfScreen(XDefaultScreenOfDisplay(x_dpy));
+
+ /*
+ * 24-bit is the highest supported by soft framebuffer.
+ */
+ if (!XMatchVisualInfo(x_dpy, screen, 24, TrueColor, &vi)) {
+ return 0;
+ }
+
+ *visual_id = XVisualIDFromVisual(vi.visual);
+ *visual_type = TrueColor;
+
+ return 1;
+}
+
+static void yagl_x11_display_destroy(struct yagl_native_display *dpy)
+{
+ struct yagl_x11_display *x11_dpy = (struct yagl_x11_display*)dpy;
+ Display *x_dpy = YAGL_X11_DPY(dpy->os_dpy);
+
+ if (dpy->drm_dev) {
+ int fd = dpy->drm_dev->fd;
+ vigs_drm_device_destroy(dpy->drm_dev);
+ close(fd);
+ }
+
+ yagl_native_display_cleanup(dpy);
+
+ if (x11_dpy->own_dpy) {
+ XCloseDisplay(x_dpy);
+ }
+
+ yagl_free(x11_dpy);
+}
+
+struct yagl_native_display *yagl_x11_display_create(struct yagl_native_platform *platform,
+ yagl_os_display os_dpy,
+ int own_dpy,
+ int enable_drm)
+{
+ Display *x_dpy = YAGL_X11_DPY(os_dpy);
+ struct yagl_x11_display *dpy;
+ int xmajor;
+ int xminor;
+ Bool pixmaps;
+ struct vigs_drm_device *drm_dev = NULL;
+ char *dri_device = NULL;
+ int ret;
+
+ YAGL_LOG_FUNC_SET(eglGetDisplay);
+
+ dpy = yagl_malloc0(sizeof(*dpy));
+
+ dpy->own_dpy = own_dpy;
+
+ dpy->xshm_images_supported = XShmQueryVersion(x_dpy,
+ &xmajor,
+ &xminor,
+ &pixmaps);
+ dpy->xshm_pixmaps_supported = pixmaps;
+
+ YAGL_LOG_DEBUG("XShm images are%s supported, version %d, %d (pixmaps = %d)",
+ (dpy->xshm_images_supported ? "" : " NOT"),
+ xmajor,
+ xminor,
+ pixmaps);
+
+ if (enable_drm) {
+ int drm_fd = yagl_x11_display_dri2_init(x_dpy, &dri_device);
+
+ if (drm_fd < 0) {
+ yagl_free(dpy);
+ return NULL;
+ }
+
+ ret = vigs_drm_device_create(drm_fd, &drm_dev);
+
+ if (ret != 0) {
+ fprintf(stderr,
+ "Critical error! vigs_drm_device_create failed: %s\n",
+ strerror(-ret));
+ close(drm_fd);
+ Xfree(dri_device);
+ yagl_free(dpy);
+ return NULL;
+ }
+ }
+
+ yagl_native_display_init(&dpy->base,
+ platform,
+ os_dpy,
+ drm_dev,
+ dri_device);
+
+ dpy->base.authenticate = &yagl_x11_display_authenticate;
+ dpy->base.wrap_window = &yagl_x11_display_wrap_window;
+ dpy->base.wrap_pixmap = &yagl_x11_display_wrap_pixmap;
+ dpy->base.create_pixmap = &yagl_x11_display_create_pixmap;
+ dpy->base.create_image = &yagl_x11_display_create_image;
+ dpy->base.get_visual = &yagl_x11_display_get_visual;
+ dpy->base.destroy = &yagl_x11_display_destroy;
+
+ if (dri_device) {
+ Xfree(dri_device);
+ }
+
+ return &dpy->base;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_X11_DISPLAY_H_
+#define _YAGL_X11_DISPLAY_H_
+
+#include "yagl_export.h"
+#include "yagl_native_display.h"
+
+#define YAGL_X11_DPY(os_dpy) ((Display*)(os_dpy))
+
+struct yagl_x11_display
+{
+ struct yagl_native_display base;
+
+ int own_dpy;
+
+ int xshm_images_supported;
+
+ int xshm_pixmaps_supported;
+};
+
+struct yagl_native_display *yagl_x11_display_create(struct yagl_native_platform *platform,
+ yagl_os_display os_dpy,
+ int own_dpy,
+ int enable_drm);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_x11_drawable.h"
+#include "yagl_x11_display.h"
+#include "yagl_x11_image.h"
+#include "yagl_malloc.h"
+#include "yagl_dri2.h"
+#include "yagl_utils.h"
+#include "yagl_log.h"
+#include <X11/Xutil.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+static int yagl_x11_drawable_get_buffer(struct yagl_native_drawable *drawable,
+ yagl_native_attachment attachment,
+ uint32_t *buffer_name,
+ struct vigs_drm_surface **buffer_sfc)
+{
+ Display *x_dpy = YAGL_X11_DPY(drawable->dpy->os_dpy);
+ Drawable x_drawable = YAGL_X11_DRAWABLE(drawable->os_drawable);
+ unsigned int attachments[1];
+ yagl_DRI2Buffer *buffer;
+ int tmp_width, tmp_height, num_buffers;
+
+ YAGL_LOG_FUNC_SET(yagl_x11_drawable_get_buffer);
+
+ if (!drawable->dpy->drm_dev) {
+ fprintf(stderr, "Asking for DRI2 buffer when DRI2 not enabled!\n");
+ return 0;
+ }
+
+ switch (attachment) {
+ case yagl_native_attachment_front:
+ attachments[0] = DRI2BufferFrontLeft;
+ break;
+ case yagl_native_attachment_back:
+ attachments[0] = DRI2BufferBackLeft;
+ break;
+ default:
+ YAGL_LOG_ERROR("Bad attachment %u", attachment);
+ return 0;
+ }
+
+ buffer = yagl_DRI2GetBuffers(x_dpy, x_drawable,
+ &tmp_width, &tmp_height,
+ &attachments[0],
+ sizeof(attachments)/sizeof(attachments[0]),
+ &num_buffers);
+
+ if (!buffer) {
+ YAGL_LOG_ERROR("Cannot get buffer for drawable %p",
+ drawable->os_drawable);
+ return 0;
+ }
+
+ *buffer_name = buffer->name;
+
+ Xfree(buffer);
+
+ return 1;
+}
+
+static int yagl_x11_drawable_get_buffer_age(struct yagl_native_drawable *drawable)
+{
+ return 0;
+}
+
+static void yagl_x11_drawable_swap_buffers(struct yagl_native_drawable *drawable)
+{
+ Display *x_dpy = YAGL_X11_DPY(drawable->dpy->os_dpy);
+ Drawable x_drawable = YAGL_X11_DRAWABLE(drawable->os_drawable);
+ CARD64 count = 0;
+
+ if (!drawable->dpy->drm_dev) {
+ return;
+ }
+
+ yagl_DRI2SwapBuffers(x_dpy,
+ x_drawable, 0, 0, 0,
+ &count);
+}
+
+static void yagl_x11_drawable_wait(struct yagl_native_drawable *drawable,
+ uint32_t width,
+ uint32_t height)
+{
+ struct yagl_x11_drawable *x11_drawable = (struct yagl_x11_drawable*)drawable;
+ Display *x_dpy = YAGL_X11_DPY(drawable->dpy->os_dpy);
+ Drawable x_drawable = YAGL_X11_DRAWABLE(drawable->os_drawable);
+ XRectangle xrect;
+ XserverRegion region;
+
+ if (!x11_drawable->is_pixmap || !drawable->dpy->drm_dev) {
+ return;
+ }
+
+ xrect.x = 0;
+ xrect.y = 0;
+ xrect.width = width;
+ xrect.height = height;
+
+ region = XFixesCreateRegion(x_dpy, &xrect, 1);
+ yagl_DRI2CopyRegion(x_dpy,
+ x_drawable,
+ region,
+ DRI2BufferFakeFrontLeft,
+ DRI2BufferFrontLeft);
+ XFixesDestroyRegion(x_dpy, region);
+}
+
+static void yagl_x11_drawable_copy_to_pixmap(struct yagl_native_drawable *drawable,
+ yagl_os_pixmap os_pixmap,
+ uint32_t from_x,
+ uint32_t from_y,
+ uint32_t to_x,
+ uint32_t to_y,
+ uint32_t width,
+ uint32_t height)
+{
+ Display *x_dpy = YAGL_X11_DPY(drawable->dpy->os_dpy);
+ Drawable x_drawable = YAGL_X11_DRAWABLE(drawable->os_drawable);
+ Pixmap x_pixmap = YAGL_X11_DRAWABLE(os_pixmap);
+ GC x_gc;
+
+ x_gc = XCreateGC(x_dpy, x_pixmap, 0, NULL);
+
+ if (x_gc) {
+ XCopyArea(x_dpy,
+ x_drawable,
+ x_pixmap,
+ x_gc,
+ from_x, from_y,
+ width,
+ height,
+ to_x, to_y);
+
+ XFreeGC(x_dpy, x_gc);
+
+ XSync(x_dpy, 0);
+ }
+}
+
+static void yagl_x11_drawable_set_swap_interval(struct yagl_native_drawable *drawable,
+ int interval)
+{
+ struct yagl_x11_drawable *x11_drawable = (struct yagl_x11_drawable*)drawable;
+ Display *x_dpy = YAGL_X11_DPY(drawable->dpy->os_dpy);
+ Drawable x_drawable = YAGL_X11_DRAWABLE(drawable->os_drawable);
+
+ if (x11_drawable->is_pixmap || !drawable->dpy->drm_dev) {
+ return;
+ }
+
+ yagl_DRI2SwapInterval(x_dpy, x_drawable, interval);
+}
+
+static void yagl_x11_drawable_get_geometry(struct yagl_native_drawable *drawable,
+ uint32_t *width,
+ uint32_t *height,
+ uint32_t *depth)
+{
+ struct yagl_x11_drawable *x11_drawable = (struct yagl_x11_drawable*)drawable;
+ Display *x_dpy = YAGL_X11_DPY(drawable->dpy->os_dpy);
+ Drawable x_drawable = YAGL_X11_DRAWABLE(drawable->os_drawable);
+ union { Window w; int i; unsigned int ui; } tmp_geom;
+
+ if (x11_drawable->is_pixmap) {
+ pthread_mutex_lock(&x11_drawable->mtx);
+
+ if (!x11_drawable->is_geom_acquired) {
+ XGetGeometry(x_dpy,
+ x_drawable,
+ &tmp_geom.w,
+ &tmp_geom.i,
+ &tmp_geom.i,
+ &x11_drawable->width,
+ &x11_drawable->height,
+ &tmp_geom.ui,
+ &x11_drawable->depth);
+
+ x11_drawable->is_geom_acquired = 1;
+ }
+
+ pthread_mutex_unlock(&x11_drawable->mtx);
+
+ *width = x11_drawable->width;
+ *height = x11_drawable->height;
+ *depth = x11_drawable->depth;
+ } else {
+ XGetGeometry(x_dpy,
+ x_drawable,
+ &tmp_geom.w,
+ &tmp_geom.i,
+ &tmp_geom.i,
+ width,
+ height,
+ &tmp_geom.ui,
+ depth);
+ }
+}
+
+static struct yagl_native_image
+ *yagl_x11_drawable_get_image(struct yagl_native_drawable *drawable,
+ uint32_t width,
+ uint32_t height)
+{
+ Display *x_dpy = YAGL_X11_DPY(drawable->dpy->os_dpy);
+ Drawable x_drawable = YAGL_X11_DRAWABLE(drawable->os_drawable);
+ XImage *x_image;
+ struct yagl_native_image *image;
+
+ YAGL_LOG_FUNC_SET(yagl_x11_drawable_get_image);
+
+ x_image = XGetImage(x_dpy,
+ x_drawable,
+ 0,
+ 0,
+ width,
+ height,
+ AllPlanes,
+ ZPixmap);
+
+ if (!x_image) {
+ YAGL_LOG_ERROR("XGetImage failed for drawable %p",
+ drawable->os_drawable);
+ return NULL;
+ }
+
+ image = yagl_x11_image_wrap(drawable->dpy, x_image);
+
+ if (!image) {
+ YAGL_LOG_ERROR("yagl_x11_image_wrap failed for drawable %p",
+ drawable->os_drawable);
+ XDestroyImage(x_image);
+ return NULL;
+ }
+
+ return image;
+}
+
+static void yagl_x11_drawable_destroy(struct yagl_native_drawable *drawable)
+{
+ struct yagl_x11_drawable *x11_drawable = (struct yagl_x11_drawable*)drawable;
+ Display *x_dpy = YAGL_X11_DPY(drawable->dpy->os_dpy);
+ Drawable x_drawable = YAGL_X11_DRAWABLE(drawable->os_drawable);
+
+ if (x11_drawable->x_gc) {
+ XFreeGC(x_dpy, x11_drawable->x_gc);
+ }
+
+ if (drawable->dpy->drm_dev) {
+ yagl_DRI2DestroyDrawable(x_dpy, x_drawable);
+ }
+
+ pthread_mutex_destroy(&x11_drawable->mtx);
+
+ if (x11_drawable->own_drawable) {
+ if (x11_drawable->is_pixmap) {
+ XFreePixmap(x_dpy, x_drawable);
+ } else {
+ XDestroyWindow(x_dpy, x_drawable);
+ }
+ }
+
+ yagl_native_drawable_cleanup(drawable);
+
+ yagl_free(x11_drawable);
+}
+
+struct yagl_native_drawable *yagl_x11_drawable_create(struct yagl_native_display *dpy,
+ yagl_os_drawable os_drawable,
+ int own_drawable,
+ int is_pixmap)
+{
+ Display *x_dpy = YAGL_X11_DPY(dpy->os_dpy);
+ Drawable x_drawable = YAGL_X11_DRAWABLE(os_drawable);
+ struct yagl_x11_drawable *drawable;
+
+ drawable = yagl_malloc0(sizeof(*drawable));
+
+ yagl_native_drawable_init(&drawable->base,
+ dpy,
+ os_drawable);
+
+ drawable->base.get_buffer = &yagl_x11_drawable_get_buffer;
+ drawable->base.get_buffer_age = &yagl_x11_drawable_get_buffer_age;
+ drawable->base.swap_buffers = &yagl_x11_drawable_swap_buffers;
+ drawable->base.wait = &yagl_x11_drawable_wait;
+ drawable->base.copy_to_pixmap = &yagl_x11_drawable_copy_to_pixmap;
+ drawable->base.set_swap_interval = &yagl_x11_drawable_set_swap_interval;
+ drawable->base.get_geometry = &yagl_x11_drawable_get_geometry;
+ drawable->base.get_image = &yagl_x11_drawable_get_image;
+ drawable->base.destroy = &yagl_x11_drawable_destroy;
+
+ drawable->own_drawable = own_drawable;
+ drawable->is_pixmap = is_pixmap;
+ yagl_mutex_init(&drawable->mtx);
+
+ if (dpy->drm_dev) {
+ yagl_DRI2CreateDrawable(x_dpy, x_drawable);
+ }
+
+ return &drawable->base;
+}
+
+GC yagl_x11_drawable_get_gc(struct yagl_x11_drawable *drawable)
+{
+ pthread_mutex_lock(&drawable->mtx);
+
+ if (!drawable->x_gc) {
+ Display *x_dpy = YAGL_X11_DPY(drawable->base.dpy->os_dpy);
+ Drawable x_drawable = YAGL_X11_DRAWABLE(drawable->base.os_drawable);
+
+ drawable->x_gc = XCreateGC(x_dpy, x_drawable, 0, NULL);
+ }
+
+ pthread_mutex_unlock(&drawable->mtx);
+
+ return drawable->x_gc;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_X11_DRAWABLE_H_
+#define _YAGL_X11_DRAWABLE_H_
+
+#include "yagl_export.h"
+#include "yagl_native_drawable.h"
+#include <X11/Xlib.h>
+#include <pthread.h>
+
+#define YAGL_X11_DRAWABLE(os_drawable) ((Drawable)(os_drawable))
+
+struct yagl_x11_drawable
+{
+ struct yagl_native_drawable base;
+
+ int own_drawable;
+
+ int is_pixmap;
+
+ pthread_mutex_t mtx;
+
+ /*
+ * Allocated on first request.
+ */
+ GC x_gc;
+
+ /*
+ * For pixmaps only, filled on first request.
+ * @{
+ */
+ int is_geom_acquired;
+ uint32_t width;
+ uint32_t height;
+ uint32_t depth;
+ /*
+ * @}
+ */
+};
+
+struct yagl_native_drawable
+ *yagl_x11_drawable_create(struct yagl_native_display *dpy,
+ yagl_os_drawable os_drawable,
+ int own_drawable,
+ int is_pixmap);
+
+GC yagl_x11_drawable_get_gc(struct yagl_x11_drawable *drawable);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_x11_image.h"
+#include "yagl_x11_display.h"
+#include "yagl_x11_drawable.h"
+#include "yagl_malloc.h"
+#include "yagl_log.h"
+#include <X11/Xutil.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#include <sys/time.h>
+#include <sys/mman.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+static void yagl_x11_image_draw_internal(struct yagl_x11_image *image,
+ Drawable target,
+ GC x_gc)
+{
+ Display *x_dpy = YAGL_X11_DPY(image->base.dpy->os_dpy);
+
+ if (image->x_shm.shmid != -1) {
+ XShmPutImage(x_dpy, target, x_gc, image->x_image,
+ 0, 0, 0, 0, image->base.width, image->base.height, 0);
+ } else {
+ XPutImage(x_dpy, target, x_gc, image->x_image,
+ 0, 0, 0, 0, image->base.width, image->base.height);
+ }
+
+ XFlush(x_dpy);
+}
+
+static void yagl_x11_image_draw(struct yagl_native_image *image,
+ struct yagl_native_drawable *drawable)
+{
+ struct yagl_x11_image *x11_image = (struct yagl_x11_image*)image;
+ struct yagl_x11_drawable *x11_drawable = (struct yagl_x11_drawable*)drawable;
+ Drawable x_drawable = YAGL_X11_DRAWABLE(drawable->os_drawable);
+ GC x_gc = yagl_x11_drawable_get_gc(x11_drawable);
+
+ if (x_gc) {
+ yagl_x11_image_draw_internal(x11_image, x_drawable, x_gc);
+ }
+}
+
+static void yagl_x11_image_draw_to_pixmap(struct yagl_native_image *image,
+ yagl_os_pixmap os_pixmap)
+{
+ struct yagl_x11_image *x11_image = (struct yagl_x11_image*)image;
+ Display *x_dpy = YAGL_X11_DPY(image->dpy->os_dpy);
+ Pixmap x_pixmap = YAGL_X11_DRAWABLE(os_pixmap);
+ GC x_gc = XCreateGC(x_dpy, x_pixmap, 0, NULL);
+
+ if (x_gc) {
+ yagl_x11_image_draw_internal(x11_image, x_pixmap, x_gc);
+ XFreeGC(x_dpy, x_gc);
+ }
+}
+
+static void yagl_x11_image_destroy(struct yagl_native_image *image)
+{
+ struct yagl_x11_image *x11_image = (struct yagl_x11_image*)image;
+
+ if (x11_image->is_wrapped) {
+ XDestroyImage(x11_image->x_image);
+ x11_image->x_image = NULL;
+ } else {
+ Display *x_dpy = YAGL_X11_DPY(image->dpy->os_dpy);
+
+ if (x11_image->x_shm.shmid != -1) {
+ XShmDetach(x_dpy, &x11_image->x_shm);
+
+ shmdt(x11_image->x_shm.shmaddr);
+ x11_image->x_shm.shmaddr = (char*)-1;
+
+ shmctl(x11_image->x_shm.shmid, IPC_RMID, 0);
+ x11_image->x_shm.shmid = -1;
+
+ XDestroyImage(x11_image->x_image);
+ x11_image->x_image = NULL;
+ } else {
+ yagl_free(x11_image->x_image);
+ x11_image->x_image = NULL;
+
+ yagl_free(image->pixels);
+ }
+ }
+
+ yagl_native_image_cleanup(image);
+
+ yagl_free(x11_image);
+}
+
+struct yagl_native_image
+ *yagl_x11_image_create(struct yagl_native_display *dpy,
+ uint32_t width,
+ uint32_t height,
+ uint32_t depth)
+{
+ struct yagl_x11_display *x11_dpy = (struct yagl_x11_display*)dpy;
+ Display *x_dpy = YAGL_X11_DPY(dpy->os_dpy);
+ struct yagl_x11_image *image;
+ XPixmapFormatValues *pfs;
+ int i, num_formats;
+ Visual visual;
+ unsigned int image_bytes = 0;
+ void *pixels = NULL;
+ uint32_t bpp = 0;
+
+ YAGL_LOG_FUNC_ENTER(yagl_x11_image_create,
+ "width = %u, height = %u, depth = %u",
+ width, height, depth);
+
+ image = yagl_malloc0(sizeof(*image));
+
+ pfs = XListPixmapFormats(x_dpy, &num_formats);
+
+ if (!pfs) {
+ YAGL_LOG_ERROR("XListPixmapFormats failed");
+
+ goto fail;
+ }
+
+ for (i = 0; i < num_formats; ++i) {
+ if (pfs[i].depth == (int)depth) {
+ bpp = (pfs[i].bits_per_pixel / 8);
+ break;
+ }
+ }
+
+ XFree(pfs);
+ pfs = NULL;
+
+ if (i == num_formats) {
+ YAGL_LOG_ERROR("No suitable pixmap format found for depth %u", depth);
+
+ goto fail;
+ }
+
+ if (x11_dpy->xshm_images_supported) {
+ image->x_image = XShmCreateImage(x_dpy,
+ &visual,
+ depth,
+ ZPixmap,
+ NULL,
+ &image->x_shm,
+ width,
+ height);
+ if (image->x_image) {
+ image_bytes = image->x_image->bytes_per_line * image->x_image->height;
+
+ image->x_shm.shmid = shmget(IPC_PRIVATE,
+ image_bytes,
+ IPC_CREAT | 0777);
+
+ if (image->x_shm.shmid != -1) {
+ image->x_shm.shmaddr = shmat(image->x_shm.shmid, 0, 0);
+
+ if (image->x_shm.shmaddr != (char*)-1) {
+ if (XShmAttach(x_dpy, &image->x_shm)) {
+ pixels = image->x_image->data = image->x_shm.shmaddr;
+
+ goto allocated;
+ } else {
+ YAGL_LOG_ERROR("XShmAttach failed");
+ }
+
+ shmdt(image->x_shm.shmaddr);
+ image->x_shm.shmaddr = (char*)-1;
+ } else {
+ YAGL_LOG_ERROR("shmat failed");
+ }
+
+ shmctl(image->x_shm.shmid, IPC_RMID, 0);
+ image->x_shm.shmid = -1;
+ } else {
+ YAGL_LOG_ERROR("shmget failed");
+ }
+
+ XDestroyImage(image->x_image);
+ image->x_image = NULL;
+ } else {
+ YAGL_LOG_ERROR("XShmCreateImage failed");
+ }
+ }
+
+allocated:
+ if (!image->x_image) {
+ image->x_shm.shmid = -1;
+
+ image_bytes = width * height * bpp;
+
+ pixels = yagl_malloc(image_bytes);
+
+ image->x_image = yagl_malloc0(sizeof(*image->x_image));
+
+ image->x_image->width = width;
+ image->x_image->height = height;
+ image->x_image->xoffset = 0;
+ image->x_image->format = ZPixmap;
+ image->x_image->data = pixels;
+ image->x_image->byte_order = LSBFirst;
+ image->x_image->bitmap_unit = bpp * 8;
+ image->x_image->bitmap_pad = 8;
+ image->x_image->depth = depth;
+ image->x_image->bytes_per_line = width * bpp;
+ image->x_image->bits_per_pixel = bpp * 8;
+
+ if (!XInitImage(image->x_image)) {
+ YAGL_LOG_ERROR("XInitImage failed");
+
+ yagl_free(image->x_image);
+ image->x_image = NULL;
+
+ yagl_free(pixels);
+ pixels = NULL;
+
+ goto fail;
+ }
+ }
+
+ XSync(x_dpy, 0);
+
+ yagl_native_image_init(&image->base,
+ dpy,
+ width,
+ height,
+ depth,
+ bpp,
+ pixels);
+
+ image->base.draw = &yagl_x11_image_draw;
+ image->base.draw_to_pixmap = &yagl_x11_image_draw_to_pixmap;
+ image->base.destroy = &yagl_x11_image_destroy;
+
+ image->is_wrapped = 0;
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return &image->base;
+
+fail:
+ yagl_free(image);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return NULL;
+}
+
+struct yagl_native_image
+ *yagl_x11_image_wrap(struct yagl_native_display *dpy,
+ XImage *x_image)
+{
+ struct yagl_x11_image *image;
+
+ image = yagl_malloc0(sizeof(*image));
+
+ yagl_native_image_init(&image->base,
+ dpy,
+ x_image->width,
+ x_image->height,
+ x_image->depth,
+ (x_image->bits_per_pixel / 8),
+ x_image->data);
+
+ image->base.draw = &yagl_x11_image_draw;
+ image->base.draw_to_pixmap = &yagl_x11_image_draw_to_pixmap;
+ image->base.destroy = &yagl_x11_image_destroy;
+
+ image->x_image = x_image;
+ image->x_shm.shmid = -1;
+ image->is_wrapped = 1;
+
+ return &image->base;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_X11_IMAGE_H_
+#define _YAGL_X11_IMAGE_H_
+
+#include "yagl_export.h"
+#include "yagl_native_image.h"
+#include <X11/Xlib.h>
+#include <X11/extensions/XShm.h>
+
+struct yagl_x11_image
+{
+ struct yagl_native_image base;
+
+ XImage *x_image; /* X11 image */
+ XShmSegmentInfo x_shm; /* X11 shared memory segment */
+
+ int is_wrapped;
+};
+
+struct yagl_native_image
+ *yagl_x11_image_create(struct yagl_native_display *dpy,
+ uint32_t width,
+ uint32_t height,
+ uint32_t depth);
+
+/*
+ * Takes ownership of 'x_image'.
+ */
+struct yagl_native_image
+ *yagl_x11_image_wrap(struct yagl_native_display *dpy,
+ XImage *x_image);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_x11_platform.h"
+#include "yagl_x11_display.h"
+#include "yagl_native_platform.h"
+#include "yagl_log.h"
+#include "EGL/egl.h"
+#include <X11/Xlib.h>
+
+static int yagl_x11_platform_probe(yagl_os_display os_dpy)
+{
+ /*
+ * Can't probe for X11, so assume probe passed.
+ */
+
+ return 1;
+}
+
+static struct yagl_native_display
+ *yagl_x11_wrap_display(yagl_os_display os_dpy,
+ int enable_drm)
+{
+ struct yagl_native_display *dpy;
+
+ YAGL_LOG_FUNC_SET(eglGetDisplay);
+
+ if (os_dpy == (yagl_os_display)EGL_DEFAULT_DISPLAY) {
+ Display *x_dpy = XOpenDisplay(0);
+
+ if (!x_dpy) {
+ YAGL_LOG_ERROR("unable to open display 0");
+ return NULL;
+ }
+
+ dpy = yagl_x11_display_create(&yagl_x11_platform,
+ (yagl_os_display)x_dpy,
+ 1,
+ enable_drm);
+
+ if (!dpy) {
+ XCloseDisplay(x_dpy);
+ }
+ } else {
+ dpy = yagl_x11_display_create(&yagl_x11_platform,
+ os_dpy,
+ 0,
+ enable_drm);
+ }
+
+ return dpy;
+}
+
+struct yagl_native_platform yagl_x11_platform =
+{
+ .pixmaps_supported = 1,
+ .buffer_age_supported = 0,
+ .probe = yagl_x11_platform_probe,
+ .wrap_display = yagl_x11_wrap_display
+};
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_X11_PLATFORM_H_
+#define _YAGL_X11_PLATFORM_H_
+
+#include "yagl_export.h"
+
+struct yagl_native_platform;
+
+extern struct yagl_native_platform yagl_x11_platform;
+
+#endif
--- /dev/null
+/*
+ * AVL tree implementation from libavl project.
+ */
+
+/* libavl - library for manipulation of binary trees.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Free Software
+ Foundation, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 3 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+*/
+
+#include "yagl_avl.h"
+#include "yagl_malloc.h"
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/*
+ * Creates and returns a new table
+ * with comparison function |compare| using parameter |param|
+ * and memory allocator |allocator|.
+ * Returns |NULL| if memory allocation failed.
+ */
+struct yagl_avl_table *yagl_avl_create(yagl_avl_comparison_func *compare,
+ void *param,
+ struct yagl_libavl_allocator *allocator)
+{
+ struct yagl_avl_table *tree;
+
+ assert(compare != NULL);
+
+ if (allocator == NULL) {
+ allocator = &yagl_avl_allocator_default;
+ }
+
+ tree = allocator->libavl_malloc(allocator, sizeof(*tree));
+ if (tree == NULL) {
+ return NULL;
+ }
+
+ tree->avl_root = NULL;
+ tree->avl_compare = compare;
+ tree->avl_param = param;
+ tree->avl_alloc = allocator;
+ tree->avl_count = 0;
+ tree->avl_generation = 0;
+
+ return tree;
+}
+
+/*
+ * Search |tree| for an item matching |item|, and return it if found.
+ * Otherwise return |NULL|.
+ */
+void *yagl_avl_find(const struct yagl_avl_table *tree, const void *item)
+{
+ const struct yagl_avl_node *p;
+
+ assert(tree != NULL && item != NULL);
+ for (p = tree->avl_root; p != NULL;) {
+ int cmp = tree->avl_compare(item, p->avl_data, tree->avl_param);
+
+ if (cmp < 0) {
+ p = p->avl_link[0];
+ } else if (cmp > 0) {
+ p = p->avl_link[1];
+ } else {
+ return p->avl_data;
+ }
+ }
+
+ return NULL;
+}
+
+/*
+ * Inserts |item| into |tree| and returns a pointer to |item|'s address.
+ * If a duplicate item is found in the tree,
+ * returns a pointer to the duplicate without inserting |item|.
+ * Returns |NULL| in case of memory allocation failure.
+ */
+void **yagl_avl_probe(struct yagl_avl_table *tree, void *item)
+{
+ struct yagl_avl_node *y, *z; /* Top node to update balance factor, and parent. */
+ struct yagl_avl_node *p, *q; /* Iterator, and parent. */
+ struct yagl_avl_node *n; /* Newly inserted node. */
+ struct yagl_avl_node *w; /* New root of rebalanced subtree. */
+ int dir; /* Direction to descend. */
+
+ unsigned char da[YAGL_AVL_MAX_HEIGHT]; /* Cached comparison results. */
+ int k = 0; /* Number of cached results. */
+
+ assert(tree != NULL && item != NULL);
+
+ z = (struct yagl_avl_node *) &tree->avl_root;
+ y = tree->avl_root;
+ dir = 0;
+ for (q = z, p = y; p != NULL; q = p, p = p->avl_link[dir]) {
+ int cmp = tree->avl_compare(item, p->avl_data, tree->avl_param);
+ if (cmp == 0) {
+ return &p->avl_data;
+ }
+
+ if (p->avl_balance != 0) {
+ z = q, y = p, k = 0;
+ }
+ da[k++] = dir = cmp > 0;
+ }
+
+ n = q->avl_link[dir] = tree->avl_alloc->libavl_malloc(tree->avl_alloc,
+ sizeof(*n));
+ if (n == NULL) {
+ return NULL;
+ }
+
+ tree->avl_count++;
+ n->avl_data = item;
+ n->avl_link[0] = n->avl_link[1] = NULL;
+ n->avl_balance = 0;
+ if (y == NULL) {
+ return &n->avl_data;
+ }
+
+ for (p = y, k = 0; p != n; p = p->avl_link[da[k]], k++) {
+ if (da[k] == 0) {
+ p->avl_balance--;
+ } else {
+ p->avl_balance++;
+ }
+ }
+
+ if (y->avl_balance == -2) {
+ struct yagl_avl_node *x = y->avl_link[0];
+ if (x->avl_balance == -1) {
+ w = x;
+ y->avl_link[0] = x->avl_link[1];
+ x->avl_link[1] = y;
+ x->avl_balance = y->avl_balance = 0;
+ } else {
+ assert(x->avl_balance == 1);
+ w = x->avl_link[1];
+ x->avl_link[1] = w->avl_link[0];
+ w->avl_link[0] = x;
+ y->avl_link[0] = w->avl_link[1];
+ w->avl_link[1] = y;
+ if (w->avl_balance == -1) {
+ x->avl_balance = 0, y->avl_balance = 1;
+ } else if (w->avl_balance == 0) {
+ x->avl_balance = y->avl_balance = 0;
+ } else {
+ x->avl_balance = -1, y->avl_balance = 0;
+ }
+ w->avl_balance = 0;
+ }
+ } else if (y->avl_balance == 2) {
+ struct yagl_avl_node *x = y->avl_link[1];
+ if (x->avl_balance == 1) {
+ w = x;
+ y->avl_link[1] = x->avl_link[0];
+ x->avl_link[0] = y;
+ x->avl_balance = y->avl_balance = 0;
+ } else {
+ assert(x->avl_balance == -1);
+ w = x->avl_link[0];
+ x->avl_link[0] = w->avl_link[1];
+ w->avl_link[1] = x;
+ y->avl_link[1] = w->avl_link[0];
+ w->avl_link[0] = y;
+ if (w->avl_balance == 1) {
+ x->avl_balance = 0, y->avl_balance = -1;
+ } else if (w->avl_balance == 0) {
+ x->avl_balance = y->avl_balance = 0;
+ } else {
+ x->avl_balance = 1, y->avl_balance = 0;
+ }
+ w->avl_balance = 0;
+ }
+ } else {
+ return &n->avl_data;
+ }
+ z->avl_link[y != z->avl_link[0]] = w;
+
+ tree->avl_generation++;
+ return &n->avl_data;
+}
+
+/*
+ * Inserts |item| into |table|.
+ * Returns |NULL| if |item| was successfully inserted
+ * or if a memory allocation error occurred.
+ * Otherwise, returns the duplicate item.
+ */
+void *yagl_avl_insert(struct yagl_avl_table *table, void *item)
+{
+ void **p = yagl_avl_probe(table, item);
+ return p == NULL || *p == item ? NULL : *p;
+}
+
+/*
+ * Inserts |item| into |table|, replacing any duplicate item.
+ * Returns |NULL| if |item| was inserted without replacing a duplicate,
+ * or if a memory allocation error occurred.
+ * Otherwise, returns the item that was replaced.
+ */
+void *yagl_avl_replace(struct yagl_avl_table *table, void *item)
+{
+ void **p = yagl_avl_probe(table, item);
+ if (p == NULL || *p == item) {
+ return NULL;
+ } else {
+ void *r = *p;
+ *p = item;
+ return r;
+ }
+}
+
+/*
+ * Deletes from |tree| and returns an item matching |item|.
+ * Returns a null pointer if no matching item found.
+ */
+void *yagl_avl_delete(struct yagl_avl_table *tree, const void *item)
+{
+ /* Stack of nodes. */
+ struct yagl_avl_node *pa[YAGL_AVL_MAX_HEIGHT]; /* Nodes. */
+ unsigned char da[YAGL_AVL_MAX_HEIGHT]; /* |avl_link[]| indexes. */
+ int k; /* Stack pointer. */
+
+ struct yagl_avl_node *p; /* Traverses tree to find node to delete. */
+ int cmp; /* Result of comparison between |item| and |p|. */
+
+ assert(tree != NULL && item != NULL);
+
+ k = 0;
+ p = (struct yagl_avl_node *) &tree->avl_root;
+ for (cmp = -1; cmp != 0;
+ cmp = tree->avl_compare(item, p->avl_data, tree->avl_param)) {
+ int dir = cmp > 0;
+
+ pa[k] = p;
+ da[k++] = dir;
+
+ p = p->avl_link[dir];
+ if (p == NULL) {
+ return NULL;
+ }
+ }
+ item = p->avl_data;
+
+ if (p->avl_link[1] == NULL) {
+ pa[k - 1]->avl_link[da[k - 1]] = p->avl_link[0];
+ } else {
+ struct yagl_avl_node *r = p->avl_link[1];
+ if (r->avl_link[0] == NULL) {
+ r->avl_link[0] = p->avl_link[0];
+ r->avl_balance = p->avl_balance;
+ pa[k - 1]->avl_link[da[k - 1]] = r;
+ da[k] = 1;
+ pa[k++] = r;
+ } else {
+ struct yagl_avl_node *s;
+ int j = k++;
+
+ for (;;) {
+ da[k] = 0;
+ pa[k++] = r;
+ s = r->avl_link[0];
+ if (s->avl_link[0] == NULL) {
+ break;
+ }
+
+ r = s;
+ }
+
+ s->avl_link[0] = p->avl_link[0];
+ r->avl_link[0] = s->avl_link[1];
+ s->avl_link[1] = p->avl_link[1];
+ s->avl_balance = p->avl_balance;
+
+ pa[j - 1]->avl_link[da[j - 1]] = s;
+ da[j] = 1;
+ pa[j] = s;
+ }
+ }
+
+ tree->avl_alloc->libavl_free(tree->avl_alloc, p);
+
+ assert(k > 0);
+ while (--k > 0) {
+ struct yagl_avl_node *y = pa[k];
+
+ if (da[k] == 0) {
+ y->avl_balance++;
+ if (y->avl_balance == 1) {
+ break;
+ } else if (y->avl_balance == 2) {
+ struct yagl_avl_node *x = y->avl_link[1];
+ if (x->avl_balance == -1) {
+ struct yagl_avl_node *w;
+ assert(x->avl_balance == -1);
+ w = x->avl_link[0];
+ x->avl_link[0] = w->avl_link[1];
+ w->avl_link[1] = x;
+ y->avl_link[1] = w->avl_link[0];
+ w->avl_link[0] = y;
+ if (w->avl_balance == 1) {
+ x->avl_balance = 0, y->avl_balance = -1;
+ } else if (w->avl_balance == 0) {
+ x->avl_balance = y->avl_balance = 0;
+ } else {
+ x->avl_balance = 1, y->avl_balance = 0;
+ }
+ w->avl_balance = 0;
+ pa[k - 1]->avl_link[da[k - 1]] = w;
+ } else {
+ y->avl_link[1] = x->avl_link[0];
+ x->avl_link[0] = y;
+ pa[k - 1]->avl_link[da[k - 1]] = x;
+ if (x->avl_balance == 0) {
+ x->avl_balance = -1;
+ y->avl_balance = 1;
+ break;
+ } else {
+ x->avl_balance = y->avl_balance = 0;
+ }
+ }
+ }
+ } else {
+ y->avl_balance--;
+ if (y->avl_balance == -1) {
+ break;
+ } else if (y->avl_balance == -2) {
+ struct yagl_avl_node *x = y->avl_link[0];
+ if (x->avl_balance == 1) {
+ struct yagl_avl_node *w;
+ assert(x->avl_balance == 1);
+ w = x->avl_link[1];
+ x->avl_link[1] = w->avl_link[0];
+ w->avl_link[0] = x;
+ y->avl_link[0] = w->avl_link[1];
+ w->avl_link[1] = y;
+ if (w->avl_balance == -1) {
+ x->avl_balance = 0, y->avl_balance = 1;
+ } else if (w->avl_balance == 0) {
+ x->avl_balance = y->avl_balance = 0;
+ } else {
+ x->avl_balance = -1, y->avl_balance = 0;
+ }
+ w->avl_balance = 0;
+ pa[k - 1]->avl_link[da[k - 1]] = w;
+ } else {
+ y->avl_link[0] = x->avl_link[1];
+ x->avl_link[1] = y;
+ pa[k - 1]->avl_link[da[k - 1]] = x;
+ if (x->avl_balance == 0) {
+ x->avl_balance = 1;
+ y->avl_balance = -1;
+ break;
+ } else {
+ x->avl_balance = y->avl_balance = 0;
+ }
+ }
+ }
+ }
+ }
+
+ tree->avl_count--;
+ tree->avl_generation++;
+ return (void *) item;
+}
+
+/*
+ * Refreshes the stack of parent pointers in |trav|
+ * and updates its generation number.
+ */
+static void yagl_trav_refresh(struct yagl_avl_traverser *trav)
+{
+ assert(trav != NULL);
+
+ trav->avl_generation = trav->avl_table->avl_generation;
+
+ if (trav->avl_node != NULL) {
+ yagl_avl_comparison_func *cmp = trav->avl_table->avl_compare;
+ void *param = trav->avl_table->avl_param;
+ struct yagl_avl_node *node = trav->avl_node;
+ struct yagl_avl_node *i;
+
+ trav->avl_height = 0;
+ for (i = trav->avl_table->avl_root; i != node;) {
+ assert(trav->avl_height < YAGL_AVL_MAX_HEIGHT);
+ assert(i != NULL);
+
+ trav->avl_stack[trav->avl_height++] = i;
+ i = i->avl_link[cmp(node->avl_data, i->avl_data, param) > 0];
+ }
+ }
+}
+
+/*
+ * Initializes |trav| for use with |tree|
+ * and selects the null node.
+ */
+void yagl_avl_t_init(struct yagl_avl_traverser *trav,
+ struct yagl_avl_table *tree)
+{
+ trav->avl_table = tree;
+ trav->avl_node = NULL;
+ trav->avl_height = 0;
+ trav->avl_generation = tree->avl_generation;
+}
+
+/*
+ * Initializes |trav| for |tree|
+ * and selects and returns a pointer to its least-valued item.
+ * Returns |NULL| if |tree| contains no nodes.
+ */
+void *yagl_avl_t_first(struct yagl_avl_traverser *trav,
+ struct yagl_avl_table *tree)
+{
+ struct yagl_avl_node *x;
+
+ assert(tree != NULL && trav != NULL);
+
+ trav->avl_table = tree;
+ trav->avl_height = 0;
+ trav->avl_generation = tree->avl_generation;
+
+ x = tree->avl_root;
+ if (x != NULL) {
+ while (x->avl_link[0] != NULL) {
+ assert(trav->avl_height < YAGL_AVL_MAX_HEIGHT);
+ trav->avl_stack[trav->avl_height++] = x;
+ x = x->avl_link[0];
+ }
+ }
+ trav->avl_node = x;
+
+ return x != NULL ? x->avl_data : NULL;
+}
+
+/*
+ * Initializes |trav| for |tree|
+ * and selects and returns a pointer to its greatest-valued item.
+ * Returns |NULL| if |tree| contains no nodes.
+ */
+void *yagl_avl_t_last(struct yagl_avl_traverser *trav,
+ struct yagl_avl_table *tree)
+{
+ struct yagl_avl_node *x;
+
+ assert(tree != NULL && trav != NULL);
+
+ trav->avl_table = tree;
+ trav->avl_height = 0;
+ trav->avl_generation = tree->avl_generation;
+
+ x = tree->avl_root;
+ if (x != NULL) {
+ while (x->avl_link[1] != NULL) {
+ assert(trav->avl_height < YAGL_AVL_MAX_HEIGHT);
+ trav->avl_stack[trav->avl_height++] = x;
+ x = x->avl_link[1];
+ }
+ }
+ trav->avl_node = x;
+
+ return x != NULL ? x->avl_data : NULL;
+}
+
+/*
+ * Searches for |item| in |tree|.
+ * If found, initializes |trav| to the item found and returns the item
+ * as well.
+ * If there is no matching item, initializes |trav| to the null item
+ * and returns |NULL|.
+ */
+void *yagl_avl_t_find(struct yagl_avl_traverser *trav,
+ struct yagl_avl_table *tree, void *item)
+{
+ struct yagl_avl_node *p, *q;
+
+ assert(trav != NULL && tree != NULL && item != NULL);
+ trav->avl_table = tree;
+ trav->avl_height = 0;
+ trav->avl_generation = tree->avl_generation;
+ for (p = tree->avl_root; p != NULL; p = q) {
+ int cmp = tree->avl_compare(item, p->avl_data, tree->avl_param);
+
+ if (cmp < 0) {
+ q = p->avl_link[0];
+ } else if (cmp > 0) {
+ q = p->avl_link[1];
+ } else {
+ trav->avl_node = p;
+ return p->avl_data;
+ }
+
+ assert(trav->avl_height < YAGL_AVL_MAX_HEIGHT);
+ trav->avl_stack[trav->avl_height++] = p;
+ }
+
+ trav->avl_height = 0;
+ trav->avl_node = NULL;
+ return NULL;
+}
+
+/*
+ * Attempts to insert |item| into |tree|.
+ * If |item| is inserted successfully, it is returned and |trav| is
+ * initialized to its location.
+ * If a duplicate is found, it is returned and |trav| is initialized to
+ * its location. No replacement of the item occurs.
+ * If a memory allocation failure occurs, |NULL| is returned and |trav|
+ * is initialized to the null item.
+ */
+void
+*yagl_avl_t_insert(struct yagl_avl_traverser *trav,
+ struct yagl_avl_table *tree, void *item)
+{
+ void **p;
+
+ assert(trav != NULL && tree != NULL && item != NULL);
+
+ p = yagl_avl_probe(tree, item);
+ if (p != NULL) {
+ trav->avl_table = tree;
+ trav->avl_node = ((struct yagl_avl_node *) ((char *) p
+ - offsetof(struct yagl_avl_node, avl_data)));
+ trav->avl_generation = tree->avl_generation - 1;
+ return *p;
+ } else {
+ yagl_avl_t_init(trav, tree);
+ return NULL;
+ }
+}
+
+/* Initializes |trav| to have the same current node as |src|. */
+void *yagl_avl_t_copy(struct yagl_avl_traverser *trav,
+ const struct yagl_avl_traverser *src)
+{
+ assert(trav != NULL && src != NULL);
+
+ if (trav != src) {
+ trav->avl_table = src->avl_table;
+ trav->avl_node = src->avl_node;
+ trav->avl_generation = src->avl_generation;
+ if (trav->avl_generation == trav->avl_table->avl_generation) {
+ trav->avl_height = src->avl_height;
+ memcpy(trav->avl_stack, (const void *) src->avl_stack,
+ sizeof(*trav->avl_stack) * trav->avl_height);
+ }
+ }
+
+ return trav->avl_node != NULL ? trav->avl_node->avl_data : NULL;
+}
+
+/*
+ * Returns the next data item in inorder
+ * within the tree being traversed with |trav|,
+ * or if there are no more data items returns |NULL|.
+ */
+void *yagl_avl_t_next(struct yagl_avl_traverser *trav)
+{
+ struct yagl_avl_node *x;
+
+ assert(trav != NULL);
+
+ if (trav->avl_generation != trav->avl_table->avl_generation) {
+ yagl_trav_refresh(trav);
+ }
+
+ x = trav->avl_node;
+ if (x == NULL) {
+ return yagl_avl_t_first(trav, trav->avl_table);
+ } else if (x->avl_link[1] != NULL) {
+ assert(trav->avl_height < YAGL_AVL_MAX_HEIGHT);
+ trav->avl_stack[trav->avl_height++] = x;
+ x = x->avl_link[1];
+
+ while (x->avl_link[0] != NULL) {
+ assert(trav->avl_height < YAGL_AVL_MAX_HEIGHT);
+ trav->avl_stack[trav->avl_height++] = x;
+ x = x->avl_link[0];
+ }
+ } else {
+ struct yagl_avl_node *y;
+
+ do {
+ if (trav->avl_height == 0) {
+ trav->avl_node = NULL;
+ return NULL;
+ }
+
+ y = x;
+ x = trav->avl_stack[--trav->avl_height];
+ } while (y == x->avl_link[1]);
+ }
+ trav->avl_node = x;
+
+ return x->avl_data;
+}
+
+/*
+ * Returns the previous data item in inorder
+ * within the tree being traversed with |trav|,
+ * or if there are no more data items returns |NULL|.
+ */
+void *yagl_avl_t_prev(struct yagl_avl_traverser *trav)
+{
+ struct yagl_avl_node *x;
+
+ assert(trav != NULL);
+
+ if (trav->avl_generation != trav->avl_table->avl_generation) {
+ yagl_trav_refresh(trav);
+ }
+
+ x = trav->avl_node;
+ if (x == NULL) {
+ return yagl_avl_t_last(trav, trav->avl_table);
+ } else if (x->avl_link[0] != NULL) {
+ assert(trav->avl_height < YAGL_AVL_MAX_HEIGHT);
+ trav->avl_stack[trav->avl_height++] = x;
+ x = x->avl_link[0];
+
+ while (x->avl_link[1] != NULL) {
+ assert(trav->avl_height < YAGL_AVL_MAX_HEIGHT);
+ trav->avl_stack[trav->avl_height++] = x;
+ x = x->avl_link[1];
+ }
+ } else {
+ struct yagl_avl_node *y;
+
+ do {
+ if (trav->avl_height == 0) {
+ trav->avl_node = NULL;
+ return NULL;
+ }
+
+ y = x;
+ x = trav->avl_stack[--trav->avl_height];
+ } while (y == x->avl_link[0]);
+ }
+ trav->avl_node = x;
+
+ return x->avl_data;
+}
+
+/* Returns |trav|'s current item. */
+void *yagl_avl_t_cur(struct yagl_avl_traverser *trav)
+{
+ assert(trav != NULL);
+
+ return trav->avl_node != NULL ? trav->avl_node->avl_data : NULL;
+}
+
+/*
+ * Replaces the current item in |trav| by |new| and returns the item replaced.
+ * |trav| must not have the null item selected.
+ * The new item must not upset the ordering of the tree.
+ */
+void *yagl_avl_t_replace(struct yagl_avl_traverser *trav, void *new)
+{
+ void *old;
+
+ assert(trav != NULL && trav->avl_node != NULL && new != NULL);
+ old = trav->avl_node->avl_data;
+ trav->avl_node->avl_data = new;
+ return old;
+}
+
+/*
+ * Destroys |new| with |avl_destroy (new, destroy)|,
+ * first setting right links of nodes in |stack| within |new|
+ * to null pointers to avoid touching uninitialized data.
+ */
+static void yagl_copy_error_recovery(struct yagl_avl_node **stack, int height,
+ struct yagl_avl_table *new, yagl_avl_item_func *destroy)
+{
+ assert(stack != NULL && height >= 0 && new != NULL);
+
+ for (; height > 2; height -= 2) {
+ stack[height - 1]->avl_link[1] = NULL;
+ }
+ yagl_avl_destroy(new, destroy);
+}
+
+/*
+ * Copies |org| to a newly created tree, which is returned.
+ * If |copy != NULL|, each data item in |org| is first passed to |copy|,
+ * and the return values are inserted into the tree,
+ * with |NULL| return values taken as indications of failure.
+ * On failure, destroys the partially created new tree,
+ * applying |destroy|, if non-null, to each item in the new tree so far,
+ * and returns |NULL|.
+ * If |allocator != NULL|, it is used for allocation in the new tree.
+ * Otherwise, the same allocator used for |org| is used.
+ */
+struct yagl_avl_table *yagl_avl_copy(const struct yagl_avl_table *org,
+ yagl_avl_copy_func *copy,
+ yagl_avl_item_func *destroy,
+ struct yagl_libavl_allocator *allocator)
+{
+ struct yagl_avl_node *stack[2 * (YAGL_AVL_MAX_HEIGHT + 1)];
+ int height = 0;
+
+ struct yagl_avl_table *new;
+ const struct yagl_avl_node *x;
+ struct yagl_avl_node *y;
+
+ assert(org != NULL);
+ new = yagl_avl_create(org->avl_compare, org->avl_param,
+ allocator != NULL ? allocator : org->avl_alloc);
+ if (new == NULL) {
+ return NULL;
+ }
+ new->avl_count = org->avl_count;
+ if (new->avl_count == 0) {
+ return new;
+ }
+
+ x = (const struct yagl_avl_node *) &org->avl_root;
+ y = (struct yagl_avl_node *) &new->avl_root;
+ for (;;) {
+ while (x->avl_link[0] != NULL) {
+ assert(height < 2 * (YAGL_AVL_MAX_HEIGHT + 1));
+
+ y->avl_link[0] = new->avl_alloc->libavl_malloc(new->avl_alloc,
+ sizeof(*y->avl_link[0]));
+ if (y->avl_link[0] == NULL) {
+ if (y != (struct yagl_avl_node *) &new->avl_root) {
+ y->avl_data = NULL;
+ y->avl_link[1] = NULL;
+ }
+
+ yagl_copy_error_recovery(stack, height, new, destroy);
+ return NULL;
+ }
+
+ stack[height++] = (struct yagl_avl_node *) x;
+ stack[height++] = y;
+ x = x->avl_link[0];
+ y = y->avl_link[0];
+ }
+ y->avl_link[0] = NULL;
+
+ for (;;) {
+ y->avl_balance = x->avl_balance;
+ if (copy == NULL) {
+ y->avl_data = x->avl_data;
+ } else {
+ y->avl_data = copy(x->avl_data, org->avl_param);
+ if (y->avl_data == NULL) {
+ y->avl_link[1] = NULL;
+ yagl_copy_error_recovery(stack, height, new, destroy);
+ return NULL;
+ }
+ }
+
+ if (x->avl_link[1] != NULL) {
+ y->avl_link[1] = new->avl_alloc->libavl_malloc(new->avl_alloc,
+ sizeof(*y->avl_link[1]));
+ if (y->avl_link[1] == NULL) {
+ yagl_copy_error_recovery(stack, height, new, destroy);
+ return NULL;
+ }
+
+ x = x->avl_link[1];
+ y = y->avl_link[1];
+ break;
+ } else {
+ y->avl_link[1] = NULL;
+ }
+
+ if (height <= 2) {
+ return new;
+ }
+
+ y = stack[--height];
+ x = stack[--height];
+ }
+ }
+}
+
+/*
+ * Frees storage allocated for |tree|.
+ * If |destroy != NULL|, applies it to each data item in inorder.
+ */
+void yagl_avl_destroy(struct yagl_avl_table *tree, yagl_avl_item_func *destroy)
+{
+ struct yagl_avl_node *p, *q;
+
+ assert(tree != NULL);
+
+ for (p = tree->avl_root; p != NULL; p = q) {
+ if (p->avl_link[0] == NULL) {
+ q = p->avl_link[1];
+ if (destroy != NULL && p->avl_data != NULL) {
+ destroy(p->avl_data, tree->avl_param);
+ }
+ tree->avl_alloc->libavl_free(tree->avl_alloc, p);
+ } else {
+ q = p->avl_link[0];
+ p->avl_link[0] = q->avl_link[1];
+ q->avl_link[1] = p;
+ }
+ }
+
+ tree->avl_alloc->libavl_free(tree->avl_alloc, tree);
+}
+
+/*
+ * Allocates |size| bytes of space using |malloc()|.
+ * Returns a null pointer if allocation fails.
+ */
+void *yagl_avl_malloc(struct yagl_libavl_allocator *allocator, size_t size)
+{
+ assert(allocator != NULL && size > 0);
+ return yagl_malloc(size);
+}
+
+/* Frees |block|. */
+void yagl_avl_free(struct yagl_libavl_allocator *allocator, void *block)
+{
+ assert(allocator != NULL && block != NULL);
+ yagl_free(block);
+}
+
+/* Default memory allocator that uses |g_malloc()| and |g_free()|. */
+struct yagl_libavl_allocator yagl_avl_allocator_default = {
+ yagl_avl_malloc, yagl_avl_free
+};
+
+#undef NDEBUG
+#include <assert.h>
+
+/* Asserts that |avl_insert()| succeeds at inserting |item| into |table|. */
+void (yagl_avl_assert_insert)(struct yagl_avl_table *table, void *item)
+{
+ void **p = yagl_avl_probe(table, item);
+ assert(p != NULL && *p == item);
+}
+
+/*
+ * Asserts that |avl_delete()| really removes |item| from |table|,
+ * and returns the removed item.
+ */
+void *(yagl_avl_assert_delete)(struct yagl_avl_table *table, void *item)
+{
+ void *p = yagl_avl_delete(table, item);
+ assert(p != NULL);
+ return p;
+}
--- /dev/null
+/*
+ * AVL tree implementation from libavl project.
+ */
+
+/* libavl - library for manipulation of binary trees.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Free Software
+ Foundation, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 3 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+*/
+
+#ifndef _YAGL_AVL_H_
+#define _YAGL_AVL_H_
+
+#include "yagl_types.h"
+
+/* Function types. */
+typedef int yagl_avl_comparison_func(const void */*avl_a*/, const void */*avl_b*/,
+ void */*avl_param*/);
+typedef void yagl_avl_item_func(void */*avl_item*/, void */*avl_param*/);
+typedef void *yagl_avl_copy_func(void */*avl_item*/, void */*avl_param*/);
+
+/* Memory allocator. */
+struct yagl_libavl_allocator
+{
+ void *(*libavl_malloc)(struct yagl_libavl_allocator */*allocator*/,
+ size_t /*libavl_size*/);
+ void (*libavl_free)(struct yagl_libavl_allocator */*allocator*/,
+ void */*libavl_block*/);
+};
+
+/* Default memory allocator. */
+extern struct yagl_libavl_allocator yagl_avl_allocator_default;
+void *yagl_avl_malloc(struct yagl_libavl_allocator *allocator, size_t libavl_size);
+void yagl_avl_free(struct yagl_libavl_allocator *allocator, void *libavl_block);
+
+/* Maximum AVL tree height. */
+#define YAGL_AVL_MAX_HEIGHT 92
+
+/* Tree data structure. */
+struct yagl_avl_table
+{
+ struct yagl_avl_node *avl_root; /* Tree's root. */
+ yagl_avl_comparison_func *avl_compare; /* Comparison function. */
+ void *avl_param; /* Extra argument to |avl_compare|. */
+ struct yagl_libavl_allocator *avl_alloc; /* Memory allocator. */
+ size_t avl_count; /* Number of items in tree. */
+ unsigned long avl_generation; /* Generation number. */
+};
+
+/* An AVL tree node. */
+struct yagl_avl_node
+{
+ struct yagl_avl_node *avl_link[2]; /* Subtrees. */
+ void *avl_data; /* Pointer to data. */
+ signed char avl_balance; /* Balance factor. */
+};
+
+/* AVL traverser structure. */
+struct yagl_avl_traverser
+{
+ struct yagl_avl_table *avl_table; /* Tree being traversed. */
+ struct yagl_avl_node *avl_node; /* Current node in tree. */
+ struct yagl_avl_node *avl_stack[YAGL_AVL_MAX_HEIGHT];
+ /* All the nodes above |avl_node|. */
+ size_t avl_height; /* Number of nodes in |avl_parent|. */
+ unsigned long avl_generation; /* Generation number. */
+};
+
+/* Table functions. */
+struct yagl_avl_table *yagl_avl_create(yagl_avl_comparison_func *compare,
+ void *param,
+ struct yagl_libavl_allocator *allocator);
+struct yagl_avl_table *yagl_avl_copy(const struct yagl_avl_table *org,
+ yagl_avl_copy_func *copy,
+ yagl_avl_item_func *destroy, struct yagl_libavl_allocator *allocator);
+void yagl_avl_destroy(struct yagl_avl_table *tree, yagl_avl_item_func *destroy);
+void **yagl_avl_probe(struct yagl_avl_table *tree, void *item);
+void *yagl_avl_insert(struct yagl_avl_table *table, void *item);
+void *yagl_avl_replace(struct yagl_avl_table *table, void *item);
+void *yagl_avl_delete(struct yagl_avl_table *tree, const void *item);
+void *yagl_avl_find(const struct yagl_avl_table *tree, const void *item);
+void yagl_avl_assert_insert(struct yagl_avl_table *table, void *item);
+void *yagl_avl_assert_delete(struct yagl_avl_table *table, void *item);
+
+#define yagl_avl_count(table) ((size_t)(table)->avl_count)
+
+/* Table traverser functions. */
+void yagl_avl_t_init(struct yagl_avl_traverser *trav,
+ struct yagl_avl_table *tree);
+void *yagl_avl_t_first(struct yagl_avl_traverser *trav,
+ struct yagl_avl_table *tree);
+void *yagl_avl_t_last(struct yagl_avl_traverser *trav,
+ struct yagl_avl_table *tree);
+void *yagl_avl_t_find(struct yagl_avl_traverser *trav,
+ struct yagl_avl_table *tree,
+ void *item);
+void *yagl_avl_t_insert(struct yagl_avl_traverser *trav,
+ struct yagl_avl_table *tree,
+ void *item);
+void *yagl_avl_t_copy(struct yagl_avl_traverser *trav,
+ const struct yagl_avl_traverser *src);
+void *yagl_avl_t_next(struct yagl_avl_traverser *trav);
+void *yagl_avl_t_prev(struct yagl_avl_traverser *trav);
+void *yagl_avl_t_cur(struct yagl_avl_traverser *trav);
+void *yagl_avl_t_replace(struct yagl_avl_traverser *trav, void *new_item);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_BACKEND_H_
+#define _YAGL_BACKEND_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+#include "yagl_native_types.h"
+#include "EGL/egl.h"
+
+struct yagl_display;
+struct yagl_surface;
+struct yagl_image;
+struct yagl_fence;
+struct yagl_native_platform;
+struct yagl_native_drawable;
+struct yagl_client_interface;
+struct wl_resource;
+
+struct yagl_backend
+{
+ struct yagl_display *(*create_display)(struct yagl_native_platform */*platform*/,
+ yagl_os_display /*os_dpy*/);
+
+ /*
+ * Takes ownership of 'native_window'.
+ */
+ struct yagl_surface *(*create_window_surface)(struct yagl_display */*dpy*/,
+ yagl_host_handle /*host_config*/,
+ struct yagl_native_drawable */*native_window*/,
+ const EGLint */*attrib_list*/);
+
+ /*
+ * Takes ownership of 'native_pixmap'.
+ */
+ struct yagl_surface *(*create_pixmap_surface)(struct yagl_display */*dpy*/,
+ yagl_host_handle /*host_config*/,
+ struct yagl_native_drawable */*native_pixmap*/,
+ const EGLint */*attrib_list*/);
+
+ struct yagl_surface *(*create_pbuffer_surface)(struct yagl_display */*dpy*/,
+ yagl_host_handle /*host_config*/,
+ const EGLint */*attrib_list*/);
+
+ /*
+ * Takes ownership of 'native_pixmap'.
+ */
+ struct yagl_image *(*create_image_pixmap)(struct yagl_display */*dpy*/,
+ struct yagl_native_drawable */*native_pixmap*/,
+ struct yagl_client_interface */*iface*/);
+
+ struct yagl_image *(*create_image_wl_buffer)(struct yagl_display */*dpy*/,
+ struct wl_resource */*buffer*/,
+ struct yagl_client_interface */*iface*/);
+
+ struct yagl_fence *(*create_fence)(struct yagl_display */*dpy*/);
+
+ void (*destroy)(struct yagl_backend */*backend*/);
+
+ EGLint y_inverted;
+
+ int fence_supported;
+};
+
+struct yagl_backend *yagl_get_backend();
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_client_image.h"
+#include "yagl_egl_state.h"
+#include "yagl_display.h"
+#include "yagl_context.h"
+#include "yagl_image.h"
+
+void yagl_client_image_init(struct yagl_client_image *image,
+ yagl_ref_destroy_func destroy_func)
+{
+ yagl_object_init(&image->base, destroy_func);
+}
+
+void yagl_client_image_cleanup(struct yagl_client_image *image)
+{
+ yagl_object_cleanup(&image->base);
+}
+
+void yagl_client_image_acquire(struct yagl_client_image *image)
+{
+ if (image) {
+ yagl_object_acquire(&image->base);
+ }
+}
+
+void yagl_client_image_release(struct yagl_client_image *image)
+{
+ if (image) {
+ yagl_object_release(&image->base);
+ }
+}
+
+struct yagl_client_image *yagl_acquire_client_image(yagl_host_handle handle)
+{
+ struct yagl_context *ctx = yagl_get_context();
+ struct yagl_image *image;
+ struct yagl_client_image *client_image;
+
+ if (!ctx) {
+ return NULL;
+ }
+
+ image = yagl_display_image_acquire(ctx->dpy, (EGLImageKHR)handle);
+
+ if (!image) {
+ return NULL;
+ }
+
+ image->update(image);
+
+ client_image = image->client_image;
+
+ yagl_client_image_acquire(client_image);
+ yagl_image_release(image);
+
+ return client_image;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GL/gl.h"
+#include "yagl_context.h"
+#include "yagl_malloc.h"
+#include "yagl_utils.h"
+#include "yagl_display.h"
+#include "yagl_fence.h"
+#include "yagl_transport.h"
+#include "yagl_state.h"
+#include "yagl_client_context.h"
+
+static void yagl_context_destroy(struct yagl_ref *ref)
+{
+ struct yagl_context *ctx = (struct yagl_context*)ref;
+
+ yagl_fence_release(ctx->throttle_fence);
+
+ pthread_mutex_destroy(&ctx->mtx);
+
+ ctx->client_ctx->destroy(ctx->client_ctx);
+
+ yagl_resource_cleanup(&ctx->res);
+
+ yagl_free(ctx);
+}
+
+struct yagl_context
+ *yagl_context_create(yagl_host_handle handle,
+ struct yagl_display *dpy,
+ struct yagl_client_context *client_ctx)
+{
+ struct yagl_context *ctx;
+
+ ctx = yagl_malloc0(sizeof(*ctx));
+
+ yagl_resource_init(&ctx->res, &yagl_context_destroy, handle);
+
+ ctx->dpy = dpy;
+ ctx->client_ctx = client_ctx;
+
+ yagl_mutex_init(&ctx->mtx);
+
+ return ctx;
+}
+
+void yagl_context_set_need_throttle(struct yagl_context *ctx,
+ struct yagl_fence *throttle_fence)
+{
+ ctx->need_throttle = 1;
+ yagl_fence_acquire(throttle_fence);
+ yagl_fence_release(ctx->throttle_fence);
+ ctx->throttle_fence = throttle_fence;
+}
+
+void yagl_context_throttle(struct yagl_context *ctx)
+{
+ if (!ctx->need_throttle) {
+ return;
+ }
+
+ if (ctx->throttle_fence) {
+ ctx->throttle_fence->base.wait(&ctx->throttle_fence->base);
+ yagl_fence_release(ctx->throttle_fence);
+ ctx->throttle_fence = NULL;
+ } else {
+ yagl_transport_wait(yagl_get_transport());
+ }
+
+ ctx->need_throttle = 0;
+}
+
+int yagl_context_mark_current(struct yagl_context *ctx, int current)
+{
+ int ret = 1;
+
+ pthread_mutex_lock(&ctx->mtx);
+
+ if ((!current ^ !ctx->current) != 0) {
+ ctx->current = current;
+ } else {
+ ret = 0;
+ }
+
+ pthread_mutex_unlock(&ctx->mtx);
+
+ return ret;
+}
+
+void yagl_context_acquire(struct yagl_context *ctx)
+{
+ if (ctx) {
+ yagl_resource_acquire(&ctx->res);
+ }
+}
+
+void yagl_context_release(struct yagl_context *ctx)
+{
+ if (ctx) {
+ yagl_resource_release(&ctx->res);
+ }
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_CONTEXT_H_
+#define _YAGL_CONTEXT_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+#include "yagl_resource.h"
+#include "EGL/egl.h"
+
+struct yagl_display;
+struct yagl_fence;
+struct yagl_client_context;
+
+struct yagl_context
+{
+ struct yagl_resource res;
+
+ struct yagl_display *dpy;
+
+ struct yagl_client_context *client_ctx;
+
+ int need_throttle;
+ struct yagl_fence *throttle_fence;
+
+ int client_ctx_prepared;
+
+ pthread_mutex_t mtx;
+
+ int current;
+};
+
+struct yagl_context
+ *yagl_context_create(yagl_host_handle handle,
+ struct yagl_display *dpy,
+ struct yagl_client_context *client_ctx);
+
+void yagl_context_set_need_throttle(struct yagl_context *ctx,
+ struct yagl_fence *throttle_fence);
+
+void yagl_context_throttle(struct yagl_context *ctx);
+
+int yagl_context_mark_current(struct yagl_context *ctx, int current);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_context_acquire(struct yagl_context *ctx);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_context_release(struct yagl_context *ctx);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_display.h"
+#include "yagl_utils.h"
+#include "yagl_backend.h"
+#include "yagl_log.h"
+#include "yagl_surface.h"
+#include "yagl_context.h"
+#include "yagl_image.h"
+#include "yagl_malloc.h"
+#include "yagl_fence.h"
+#include "yagl_native_display.h"
+#include "yagl_native_platform.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+#define YAGL_EGL_BASE_EXTENSIONS "EGL_KHR_image_base " \
+ "EGL_KHR_lock_surface " \
+ "EGL_KHR_surfaceless_context "
+
+#define YAGL_EGL_PIXMAPS_EXTENSIONS "EGL_KHR_image " \
+ "EGL_KHR_image_pixmap " \
+ "EGL_NOK_texture_from_pixmap "
+
+#define YAGL_EGL_WL_BIND_WAYLAND_DISPLAY_EXTENSIONS "EGL_WL_bind_wayland_display "
+
+#define YAGL_EGL_BUFFER_AGE_EXTENSIONS "EGL_EXT_buffer_age "
+
+#define YAGL_EGL_FENCE_EXTENSIONS "EGL_KHR_fence_sync "
+
+void yagl_set_fence_display(struct yagl_display *fence_dpy);
+
+static pthread_once_t g_displays_init = PTHREAD_ONCE_INIT;
+static pthread_mutex_t g_displays_mutex;
+static YAGL_DECLARE_LIST(g_displays);
+
+static void yagl_displays_init_once(void)
+{
+ /*
+ * We need a recursive mutex here because in DRI2 an event can come in
+ * during any X.Org function call and we need to access displays in
+ * DRI2 event handler.
+ */
+ yagl_recursive_mutex_init(&g_displays_mutex);
+}
+
+static void yagl_displays_init(void)
+{
+ pthread_once(&g_displays_init, yagl_displays_init_once);
+}
+
+void yagl_display_init(struct yagl_display *dpy,
+ yagl_os_display display_id,
+ struct yagl_native_display *native_dpy,
+ yagl_host_handle host_dpy)
+{
+ yagl_list_init(&dpy->list);
+ dpy->display_id = display_id;
+ dpy->native_dpy = native_dpy;
+ dpy->host_dpy = host_dpy;
+ /*
+ * Need recursive mutex here,
+ * see 'g_displays_mutex' initialization for reasons.
+ */
+ yagl_recursive_mutex_init(&dpy->mutex);
+ dpy->prepared = 0;
+
+ yagl_list_init(&dpy->surfaces);
+ yagl_list_init(&dpy->contexts);
+ yagl_list_init(&dpy->images);
+ yagl_list_init(&dpy->fences);
+}
+
+void yagl_display_atfork(void)
+{
+ /*
+ * Don't actually destroy displays, just
+ * reset the list. See yagl_state.c:yagl_state_atfork.
+ */
+
+ yagl_list_init(&g_displays);
+}
+
+struct yagl_display *yagl_display_get(EGLDisplay handle)
+{
+ yagl_host_handle host_dpy = (yagl_host_handle)handle;
+ struct yagl_display *dpy;
+
+ yagl_displays_init();
+
+ pthread_mutex_lock(&g_displays_mutex);
+
+ yagl_list_for_each(struct yagl_display, dpy, &g_displays, list) {
+ if (dpy->host_dpy == host_dpy) {
+ pthread_mutex_unlock(&g_displays_mutex);
+
+ return dpy;
+ }
+ }
+
+ pthread_mutex_unlock(&g_displays_mutex);
+
+ return NULL;
+}
+
+struct yagl_display *yagl_display_get_os(yagl_os_display os_dpy)
+{
+ struct yagl_display *dpy;
+
+ yagl_displays_init();
+
+ pthread_mutex_lock(&g_displays_mutex);
+
+ yagl_list_for_each(struct yagl_display, dpy, &g_displays, list) {
+ if (dpy->native_dpy->os_dpy == os_dpy) {
+ pthread_mutex_unlock(&g_displays_mutex);
+
+ return dpy;
+ }
+ }
+
+ pthread_mutex_unlock(&g_displays_mutex);
+
+ return NULL;
+}
+
+struct yagl_display *yagl_display_add(struct yagl_native_platform *platform,
+ yagl_os_display display_id)
+{
+ struct yagl_display *dpy;
+
+ yagl_displays_init();
+
+ pthread_mutex_lock(&g_displays_mutex);
+
+ yagl_list_for_each(struct yagl_display, dpy, &g_displays, list) {
+ if (dpy->display_id == display_id) {
+ pthread_mutex_unlock(&g_displays_mutex);
+ return dpy;
+ }
+ }
+
+ dpy = yagl_get_backend()->create_display(platform, display_id);
+
+ if (!dpy) {
+ pthread_mutex_unlock(&g_displays_mutex);
+ return NULL;
+ }
+
+ yagl_list_add(&g_displays, &dpy->list);
+
+ pthread_mutex_unlock(&g_displays_mutex);
+
+ yagl_set_fence_display(dpy);
+
+ return dpy;
+}
+
+void yagl_display_prepare(struct yagl_display *dpy)
+{
+ pthread_mutex_lock(&dpy->mutex);
+ dpy->prepared = 1;
+ pthread_mutex_unlock(&dpy->mutex);
+}
+
+int yagl_display_is_prepared(struct yagl_display *dpy)
+{
+ int ret;
+
+ pthread_mutex_lock(&dpy->mutex);
+ ret = dpy->prepared;
+ pthread_mutex_unlock(&dpy->mutex);
+
+ return ret;
+}
+
+void yagl_display_terminate(struct yagl_display *dpy)
+{
+ struct yagl_list tmp_list;
+ struct yagl_resource *res, *next;
+
+ /*
+ * First, move all surfaces, contexts and images to a
+ * temporary list to release later.
+ */
+
+ yagl_list_init(&tmp_list);
+
+ pthread_mutex_lock(&dpy->mutex);
+
+ yagl_list_for_each_safe(struct yagl_resource,
+ res,
+ next,
+ &dpy->surfaces,
+ list) {
+ yagl_list_remove(&res->list);
+ yagl_list_add_tail(&tmp_list, &res->list);
+ }
+
+ yagl_list_for_each_safe(struct yagl_resource,
+ res,
+ next,
+ &dpy->contexts,
+ list) {
+ yagl_list_remove(&res->list);
+ yagl_list_add_tail(&tmp_list, &res->list);
+ }
+
+ yagl_list_for_each_safe(struct yagl_resource,
+ res,
+ next,
+ &dpy->images,
+ list) {
+ yagl_list_remove(&res->list);
+ yagl_list_add_tail(&tmp_list, &res->list);
+ }
+
+ yagl_list_for_each_safe(struct yagl_resource,
+ res,
+ next,
+ &dpy->fences,
+ list) {
+ yagl_list_remove(&res->list);
+ yagl_list_add_tail(&tmp_list, &res->list);
+ }
+
+ assert(yagl_list_empty(&dpy->surfaces));
+ assert(yagl_list_empty(&dpy->contexts));
+ assert(yagl_list_empty(&dpy->images));
+ assert(yagl_list_empty(&dpy->fences));
+
+ dpy->prepared = 0;
+
+ pthread_mutex_unlock(&dpy->mutex);
+
+ /*
+ * We release here because we don't want the resources to be released
+ * when display mutex is held.
+ */
+
+ yagl_list_for_each_safe(struct yagl_resource, res, next, &tmp_list, list) {
+ yagl_list_remove(&res->list);
+ yagl_resource_release(res);
+ }
+
+ assert(yagl_list_empty(&tmp_list));
+}
+
+const char *yagl_display_get_extensions(struct yagl_display *dpy)
+{
+ if (!dpy) {
+ return YAGL_EGL_BASE_EXTENSIONS;
+ }
+
+ pthread_mutex_lock(&dpy->mutex);
+
+ if (!dpy->extensions) {
+ uint32_t len = strlen(YAGL_EGL_BASE_EXTENSIONS);
+
+ if (dpy->native_dpy->platform->pixmaps_supported) {
+ len += strlen(YAGL_EGL_PIXMAPS_EXTENSIONS);
+ }
+
+ if (dpy->native_dpy->WL_bind_wayland_display_supported) {
+ len += strlen(YAGL_EGL_WL_BIND_WAYLAND_DISPLAY_EXTENSIONS);
+ }
+
+ if (dpy->native_dpy->platform->buffer_age_supported) {
+ len += strlen(YAGL_EGL_BUFFER_AGE_EXTENSIONS);
+ }
+
+ if (yagl_egl_fence_supported()) {
+ len += strlen(YAGL_EGL_FENCE_EXTENSIONS);
+ }
+
+ dpy->extensions = yagl_malloc(len + 1);
+
+ strcpy(dpy->extensions, YAGL_EGL_BASE_EXTENSIONS);
+
+ if (dpy->native_dpy->platform->pixmaps_supported) {
+ strcat(dpy->extensions, YAGL_EGL_PIXMAPS_EXTENSIONS);
+ }
+
+ if (dpy->native_dpy->WL_bind_wayland_display_supported) {
+ strcat(dpy->extensions, YAGL_EGL_WL_BIND_WAYLAND_DISPLAY_EXTENSIONS);
+ }
+
+ if (dpy->native_dpy->platform->buffer_age_supported) {
+ strcat(dpy->extensions, YAGL_EGL_BUFFER_AGE_EXTENSIONS);
+ }
+
+ if (yagl_egl_fence_supported()) {
+ strcat(dpy->extensions, YAGL_EGL_FENCE_EXTENSIONS);
+ }
+ }
+
+ pthread_mutex_unlock(&dpy->mutex);
+
+ return dpy->extensions;
+}
+
+int yagl_display_surface_add(struct yagl_display *dpy,
+ struct yagl_surface *sfc)
+{
+ struct yagl_resource *res = NULL;
+ EGLSurface handle = yagl_surface_get_handle(sfc);
+
+ pthread_mutex_lock(&dpy->mutex);
+
+ yagl_list_for_each(struct yagl_resource, res, &dpy->surfaces, list) {
+ if (yagl_surface_get_handle((struct yagl_surface*)res) == handle) {
+ pthread_mutex_unlock(&dpy->mutex);
+ return 0;
+ }
+ }
+
+ yagl_resource_acquire(&sfc->res);
+ yagl_list_add_tail(&dpy->surfaces, &sfc->res.list);
+
+ pthread_mutex_unlock(&dpy->mutex);
+
+ return 1;
+}
+
+struct yagl_surface *yagl_display_surface_acquire(struct yagl_display *dpy,
+ EGLSurface handle)
+{
+ struct yagl_resource *res = NULL;
+
+ pthread_mutex_lock(&dpy->mutex);
+
+ yagl_list_for_each(struct yagl_resource, res, &dpy->surfaces, list) {
+ if (yagl_surface_get_handle((struct yagl_surface*)res) == handle) {
+ yagl_resource_acquire(res);
+ pthread_mutex_unlock(&dpy->mutex);
+ return (struct yagl_surface*)res;
+ }
+ }
+
+ pthread_mutex_unlock(&dpy->mutex);
+
+ return NULL;
+}
+
+int yagl_display_surface_remove(struct yagl_display *dpy,
+ EGLSurface handle)
+{
+ struct yagl_resource *res;
+
+ pthread_mutex_lock(&dpy->mutex);
+
+ yagl_list_for_each(struct yagl_resource, res, &dpy->surfaces, list) {
+ if (yagl_surface_get_handle((struct yagl_surface*)res) == handle) {
+ yagl_list_remove(&res->list);
+ yagl_resource_release(res);
+ pthread_mutex_unlock(&dpy->mutex);
+ return 1;
+ }
+ }
+
+ pthread_mutex_unlock(&dpy->mutex);
+
+ return 0;
+}
+
+void yagl_display_context_add(struct yagl_display *dpy,
+ struct yagl_context *ctx)
+{
+ pthread_mutex_lock(&dpy->mutex);
+
+ yagl_resource_acquire(&ctx->res);
+ yagl_list_add_tail(&dpy->contexts, &ctx->res.list);
+
+ pthread_mutex_unlock(&dpy->mutex);
+}
+
+struct yagl_context *yagl_display_context_acquire(struct yagl_display *dpy,
+ EGLContext handle)
+{
+ struct yagl_resource *res = NULL;
+
+ pthread_mutex_lock(&dpy->mutex);
+
+ yagl_list_for_each(struct yagl_resource, res, &dpy->contexts, list) {
+ if (res->handle == (yagl_host_handle)handle) {
+ yagl_resource_acquire(res);
+ pthread_mutex_unlock(&dpy->mutex);
+ return (struct yagl_context*)res;
+ }
+ }
+
+ pthread_mutex_unlock(&dpy->mutex);
+
+ return NULL;
+}
+
+void yagl_display_context_remove(struct yagl_display *dpy,
+ EGLContext handle)
+{
+ struct yagl_resource *res;
+
+ pthread_mutex_lock(&dpy->mutex);
+
+ yagl_list_for_each(struct yagl_resource, res, &dpy->contexts, list) {
+ if (res->handle == (yagl_host_handle)handle) {
+ yagl_list_remove(&res->list);
+ yagl_resource_release(res);
+ break;
+ }
+ }
+
+ pthread_mutex_unlock(&dpy->mutex);
+}
+
+int yagl_display_image_add(struct yagl_display *dpy,
+ struct yagl_image *image)
+{
+ struct yagl_resource *res = NULL;
+
+ pthread_mutex_lock(&dpy->mutex);
+
+ yagl_list_for_each(struct yagl_resource, res, &dpy->images, list) {
+ if (((struct yagl_image*)res)->client_handle == image->client_handle) {
+ pthread_mutex_unlock(&dpy->mutex);
+ return 0;
+ }
+ }
+
+ yagl_resource_acquire(&image->res);
+ yagl_list_add_tail(&dpy->images, &image->res.list);
+
+ pthread_mutex_unlock(&dpy->mutex);
+
+ return 1;
+}
+
+struct yagl_image *yagl_display_image_acquire(struct yagl_display *dpy,
+ EGLImageKHR handle)
+{
+ struct yagl_resource *res = NULL;
+
+ pthread_mutex_lock(&dpy->mutex);
+
+ yagl_list_for_each(struct yagl_resource, res, &dpy->images, list) {
+ if (((struct yagl_image*)res)->client_handle == handle) {
+ yagl_resource_acquire(res);
+ pthread_mutex_unlock(&dpy->mutex);
+ return (struct yagl_image*)res;
+ }
+ }
+
+ pthread_mutex_unlock(&dpy->mutex);
+
+ return NULL;
+}
+
+int yagl_display_image_remove(struct yagl_display *dpy,
+ EGLImageKHR handle)
+{
+ struct yagl_resource *res;
+
+ pthread_mutex_lock(&dpy->mutex);
+
+ yagl_list_for_each(struct yagl_resource, res, &dpy->images, list) {
+ if (((struct yagl_image*)res)->client_handle == handle) {
+ yagl_list_remove(&res->list);
+ yagl_resource_release(res);
+ pthread_mutex_unlock(&dpy->mutex);
+ return 1;
+ }
+ }
+
+ pthread_mutex_unlock(&dpy->mutex);
+
+ return 0;
+}
+
+void yagl_display_fence_add(struct yagl_display *dpy,
+ struct yagl_fence *fence)
+{
+ pthread_mutex_lock(&dpy->mutex);
+
+ yagl_resource_acquire(&fence->base.res);
+ yagl_list_add_tail(&dpy->fences, &fence->base.res.list);
+
+ pthread_mutex_unlock(&dpy->mutex);
+}
+
+struct yagl_fence *yagl_display_fence_acquire(struct yagl_display *dpy,
+ EGLSyncKHR handle)
+{
+ struct yagl_resource *res = NULL;
+
+ pthread_mutex_lock(&dpy->mutex);
+
+ yagl_list_for_each(struct yagl_resource, res, &dpy->fences, list) {
+ if ((EGLSyncKHR)res == handle) {
+ yagl_resource_acquire(res);
+ pthread_mutex_unlock(&dpy->mutex);
+ return (struct yagl_fence*)res;
+ }
+ }
+
+ pthread_mutex_unlock(&dpy->mutex);
+
+ return NULL;
+}
+
+int yagl_display_fence_remove(struct yagl_display *dpy,
+ EGLSyncKHR handle)
+{
+ struct yagl_resource *res;
+
+ pthread_mutex_lock(&dpy->mutex);
+
+ yagl_list_for_each(struct yagl_resource, res, &dpy->fences, list) {
+ if ((EGLSyncKHR)res == handle) {
+ yagl_list_remove(&res->list);
+ yagl_resource_release(res);
+ pthread_mutex_unlock(&dpy->mutex);
+ return 1;
+ }
+ }
+
+ pthread_mutex_unlock(&dpy->mutex);
+
+ return 0;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_DISPLAY_H_
+#define _YAGL_DISPLAY_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+#include "yagl_list.h"
+#include "yagl_native_types.h"
+#include "EGL/egl.h"
+#include "EGL/eglext.h"
+#include <pthread.h>
+
+struct yagl_surface;
+struct yagl_context;
+struct yagl_image;
+struct yagl_fence;
+struct yagl_native_platform;
+struct yagl_native_display;
+
+struct yagl_display
+{
+ struct yagl_list list;
+
+ yagl_os_display display_id;
+
+ struct yagl_native_display *native_dpy;
+
+ yagl_host_handle host_dpy;
+
+ pthread_mutex_t mutex;
+
+ int prepared;
+
+ char *extensions;
+
+ struct yagl_list surfaces;
+
+ struct yagl_list contexts;
+
+ struct yagl_list images;
+
+ struct yagl_list fences;
+};
+
+/*
+ * Takes ownership of 'native_dpy'.
+ */
+void yagl_display_init(struct yagl_display *dpy,
+ yagl_os_display display_id,
+ struct yagl_native_display *native_dpy,
+ yagl_host_handle host_dpy);
+
+void yagl_display_atfork(void);
+
+struct yagl_display *yagl_display_get(EGLDisplay handle);
+
+struct yagl_display *yagl_display_get_os(yagl_os_display os_dpy);
+
+struct yagl_display *yagl_display_add(struct yagl_native_platform *platform,
+ yagl_os_display display_id);
+
+void yagl_display_prepare(struct yagl_display *dpy);
+
+int yagl_display_is_prepared(struct yagl_display *dpy);
+
+void yagl_display_terminate(struct yagl_display *dpy);
+
+/*
+ * 'dpy' can be NULL here.
+ */
+const char *yagl_display_get_extensions(struct yagl_display *dpy);
+
+/*
+ * Surfaces.
+ * @{
+ */
+
+/*
+ * This acquires 'sfc', so the caller should
+ * release 'sfc' if he doesn't want to use it and wants it to belong to the
+ * display alone.
+ */
+int yagl_display_surface_add(struct yagl_display *dpy,
+ struct yagl_surface *sfc);
+
+/*
+ * Acquires a surface by handle. Be sure to release the surface when
+ * you're done.
+ */
+struct yagl_surface *yagl_display_surface_acquire(struct yagl_display *dpy,
+ EGLSurface handle);
+
+int yagl_display_surface_remove(struct yagl_display *dpy,
+ EGLSurface handle);
+
+/*
+ * @}
+ */
+
+/*
+ * Contexts.
+ * @{
+ */
+
+/*
+ * This acquires 'ctx', so the caller should
+ * release 'ctx' if he doesn't want to use it and wants it to belong to the
+ * display alone.
+ */
+void yagl_display_context_add(struct yagl_display *dpy,
+ struct yagl_context *ctx);
+
+/*
+ * Acquires a context by handle. Be sure to release the context when
+ * you're done.
+ */
+struct yagl_context *yagl_display_context_acquire(struct yagl_display *dpy,
+ EGLContext handle);
+
+void yagl_display_context_remove(struct yagl_display *dpy,
+ EGLContext handle);
+
+/*
+ * @}
+ */
+
+/*
+ * Images.
+ * @{
+ */
+
+/*
+ * This acquires 'image', so the caller should
+ * release 'image' if he doesn't want to use it and wants it to belong to the
+ * display alone.
+ */
+int yagl_display_image_add(struct yagl_display *dpy,
+ struct yagl_image *image);
+
+/*
+ * Acquires an image by handle. Be sure to release the image when
+ * you're done.
+ */
+struct yagl_image *yagl_display_image_acquire(struct yagl_display *dpy,
+ EGLImageKHR handle);
+
+int yagl_display_image_remove(struct yagl_display *dpy,
+ EGLImageKHR handle);
+
+/*
+ * @}
+ */
+
+/*
+ * Fences.
+ * @{
+ */
+
+/*
+ * This acquires 'fence', so the caller should
+ * release 'fence' if he doesn't want to use it and wants it to belong to the
+ * display alone.
+ */
+void yagl_display_fence_add(struct yagl_display *dpy,
+ struct yagl_fence *fence);
+
+/*
+ * Acquires a fence by handle. Be sure to release the fence when
+ * you're done.
+ */
+struct yagl_fence *yagl_display_fence_acquire(struct yagl_display *dpy,
+ EGLSyncKHR handle);
+
+int yagl_display_fence_remove(struct yagl_display *dpy,
+ EGLSyncKHR handle);
+
+/*
+ * @}
+ */
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_host_egl_calls.h"
+#include "yagl_impl.h"
+#include "yagl_display.h"
+#include "yagl_log.h"
+#include "yagl_egl_state.h"
+#include "yagl_state.h"
+#include "yagl_malloc.h"
+#include "yagl_surface.h"
+#include "yagl_context.h"
+#include "yagl_image.h"
+#include "yagl_fence.h"
+#include "yagl_backend.h"
+#include "yagl_render.h"
+#include "yagl_native_platform.h"
+#include "yagl_native_display.h"
+#include "yagl_native_drawable.h"
+#include "yagl_transport_egl.h"
+#include "yagl_client_interface.h"
+#include "yagl_client_image.h"
+#include "yagl_client_context.h"
+#include "yagl_sharegroup.h"
+#include "yagl_tex_image_binding.h"
+#ifdef YAGL_PLATFORM_X11
+#include "x11/yagl_x11_platform.h"
+#endif
+#include "EGL/eglmesaext.h"
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+#include <dlfcn.h>
+#include <stdlib.h>
+
+#define YAGL_SET_ERR(err) \
+ yagl_set_error(err); \
+ YAGL_LOG_ERROR("error = 0x%X", err)
+
+#define YAGL_UNIMPLEMENTED(func, ret) \
+ YAGL_LOG_FUNC_SET(func); \
+ YAGL_LOG_WARN("NOT IMPLEMENTED!!!"); \
+ return ret;
+
+static int yagl_get_client_api(const EGLint *attrib_list, yagl_client_api *client_api)
+{
+ int i = 0;
+
+ switch (yagl_get_api()) {
+ case EGL_OPENGL_ES_API:
+ *client_api = yagl_client_api_gles1;
+ if (attrib_list) {
+ while (attrib_list[i] != EGL_NONE) {
+ switch (attrib_list[i]) {
+ case EGL_CONTEXT_CLIENT_VERSION:
+ if (attrib_list[i + 1] == 1) {
+ *client_api = yagl_client_api_gles1;
+ } else if (attrib_list[i + 1] == 2) {
+ *client_api = yagl_client_api_gles2;
+ } else if (attrib_list[i + 1] == 3) {
+ *client_api = yagl_client_api_gles3;
+ } else {
+ return 0;
+ }
+ break;
+ default:
+ return 0;
+ }
+
+ i += 2;
+ }
+ }
+ break;
+ case EGL_OPENVG_API:
+ *client_api = yagl_client_api_ovg;
+ break;
+ case EGL_OPENGL_API:
+ *client_api = yagl_client_api_ogl;
+ break;
+ default:
+ return 0;
+ }
+ return 1;
+}
+
+static __inline int yagl_validate_display(EGLDisplay dpy_,
+ struct yagl_display **dpy)
+{
+ YAGL_LOG_FUNC_SET(yagl_validate_display);
+
+ *dpy = yagl_display_get(dpy_);
+
+ if (!*dpy) {
+ YAGL_SET_ERR(EGL_BAD_DISPLAY);
+ return 0;
+ }
+
+ if (!yagl_display_is_prepared(*dpy)) {
+ YAGL_SET_ERR(EGL_NOT_INITIALIZED);
+ return 0;
+ }
+
+ return 1;
+}
+
+static __inline int yagl_validate_context(struct yagl_display *dpy,
+ EGLContext ctx_,
+ struct yagl_context **ctx)
+{
+ YAGL_LOG_FUNC_SET(yagl_validate_context);
+
+ *ctx = yagl_display_context_acquire(dpy, ctx_);
+
+ if (!*ctx) {
+ YAGL_SET_ERR(EGL_BAD_CONTEXT);
+ return 0;
+ }
+
+ return 1;
+}
+
+static __inline int yagl_validate_surface(struct yagl_display *dpy,
+ EGLSurface sfc_,
+ struct yagl_surface **sfc)
+{
+ YAGL_LOG_FUNC_SET(yagl_validate_surface);
+
+ *sfc = yagl_display_surface_acquire(dpy, sfc_);
+
+ if (!*sfc) {
+ YAGL_SET_ERR(EGL_BAD_SURFACE);
+ return 0;
+ }
+
+ return 1;
+}
+
+static __inline int yagl_validate_image(struct yagl_display *dpy,
+ EGLImageKHR image_,
+ struct yagl_image **image)
+{
+ YAGL_LOG_FUNC_SET(yagl_validate_image);
+
+ *image = yagl_display_image_acquire(dpy, image_);
+
+ if (!*image) {
+ YAGL_SET_ERR(EGL_BAD_PARAMETER);
+ return 0;
+ }
+
+ return 1;
+}
+
+static __inline int yagl_validate_fence(struct yagl_display *dpy,
+ EGLSyncKHR sync_,
+ struct yagl_fence **fence)
+{
+ YAGL_LOG_FUNC_SET(yagl_validate_fence);
+
+ *fence = yagl_display_fence_acquire(dpy, sync_);
+
+ if (!*fence) {
+ YAGL_SET_ERR(EGL_BAD_PARAMETER);
+ return 0;
+ }
+
+ return 1;
+}
+
+YAGL_API EGLint eglGetError()
+{
+ EGLint retval;
+
+ YAGL_LOG_FUNC_ENTER(eglGetError, NULL);
+
+ retval = yagl_get_error();
+
+ YAGL_LOG_FUNC_EXIT_SPLIT(EGLint, retval);
+
+ return retval;
+}
+
+YAGL_API EGLDisplay eglGetDisplay(EGLNativeDisplayType display_id)
+{
+ struct yagl_native_platform *platform;
+ struct yagl_display *dpy;
+ EGLDisplay ret = EGL_NO_DISPLAY;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(eglGetDisplay, EGLNativeDisplayType, display_id);
+
+ platform = yagl_guess_platform((yagl_os_display)display_id);
+
+ if (!platform) {
+ goto out;
+ }
+
+ dpy = yagl_display_add(platform, (yagl_os_display)display_id);
+
+ if (!dpy) {
+ YAGL_SET_ERR(EGL_BAD_DISPLAY);
+ YAGL_LOG_ERROR("unable to add display %p",
+ (yagl_os_display)display_id);
+ goto out;
+ }
+
+ ret = (EGLDisplay)dpy->host_dpy;
+
+ YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, dpy->host_dpy);
+
+ return ret;
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return ret;
+}
+
+YAGL_API EGLBoolean eglInitialize(EGLDisplay dpy_, EGLint* major, EGLint* minor)
+{
+ EGLint error = 0;
+ struct yagl_display *dpy;
+
+ YAGL_LOG_FUNC_ENTER(eglInitialize, "dpy = %u", (yagl_host_handle)dpy_);
+
+ dpy = yagl_display_get(dpy_);
+
+ if (!dpy) {
+ YAGL_SET_ERR(EGL_BAD_DISPLAY);
+ goto fail;
+ }
+
+ if (!yagl_host_eglInitialize(dpy->host_dpy, major, minor, &error)) {
+ YAGL_SET_ERR(error);
+ goto fail;
+ }
+
+ yagl_display_prepare(dpy);
+
+ YAGL_LOG_FUNC_EXIT("major = %d, minor = %d",
+ (major ? *major : -1),
+ (minor ? *minor : -1));
+
+ return EGL_TRUE;
+
+fail:
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return EGL_FALSE;
+}
+
+YAGL_API EGLBoolean eglTerminate(EGLDisplay dpy_)
+{
+ EGLint error = 0;
+ struct yagl_display *dpy;
+ EGLBoolean ret = EGL_FALSE;
+
+ YAGL_LOG_FUNC_ENTER(eglTerminate, "dpy = %u", (yagl_host_handle)dpy_);
+
+ if (!yagl_validate_display(dpy_, &dpy)) {
+ goto out;
+ }
+
+ ret = yagl_host_eglTerminate(dpy->host_dpy, &error);
+
+ if (ret) {
+ yagl_display_terminate(dpy);
+ } else {
+ YAGL_SET_ERR(error);
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return ret;
+}
+
+YAGL_API const char *eglQueryString(EGLDisplay dpy_, EGLint name)
+{
+ const char *str = NULL;
+
+ YAGL_LOG_FUNC_ENTER(eglQueryString,
+ "dpy = %u, name = %d",
+ (yagl_host_handle)dpy_,
+ name);
+
+ switch (name) {
+ case EGL_VENDOR:
+ str = "Samsung";
+ break;
+ case EGL_VERSION:
+ str = "1.4";
+ break;
+ case EGL_CLIENT_APIS:
+ if (yagl_get_host_gl_version() < yagl_gl_3_1_es3) {
+ str = "OpenGL_ES OpenGL_ES2";
+ } else {
+ str = "OpenGL_ES OpenGL_ES2 OpenGL_ES3";
+ }
+ break;
+ case EGL_EXTENSIONS:
+ str = yagl_display_get_extensions(yagl_display_get(dpy_));
+ break;
+ default:
+ YAGL_SET_ERR(EGL_BAD_PARAMETER);
+ }
+
+ YAGL_LOG_FUNC_EXIT("%s", str);
+
+ return str;
+}
+
+YAGL_API EGLBoolean eglGetConfigs(EGLDisplay dpy,
+ EGLConfig *configs,
+ EGLint config_size,
+ EGLint *num_config)
+{
+ EGLint error = 0;
+
+ YAGL_LOG_FUNC_ENTER(eglGetConfigs,
+ "dpy = %u, configs = %p, config_size = %d",
+ (yagl_host_handle)dpy,
+ configs,
+ config_size);
+
+ if (!num_config) {
+ YAGL_SET_ERR(EGL_BAD_PARAMETER);
+ goto fail;
+ }
+
+ if (!yagl_host_eglGetConfigs((yagl_host_handle)dpy,
+ (yagl_host_handle*)configs,
+ config_size,
+ num_config,
+ &error)) {
+ YAGL_SET_ERR(error);
+ goto fail;
+ }
+
+ YAGL_LOG_FUNC_EXIT("num_config = %d", *num_config);
+
+ return EGL_TRUE;
+
+fail:
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return EGL_FALSE;
+}
+
+YAGL_API EGLBoolean eglChooseConfig(EGLDisplay dpy,
+ const EGLint *attrib_list,
+ EGLConfig *configs,
+ EGLint config_size,
+ EGLint *num_config)
+{
+ EGLint error = 0;
+
+ YAGL_LOG_FUNC_ENTER(eglChooseConfig, "dpy = %u", (yagl_host_handle)dpy);
+
+ if (!num_config) {
+ YAGL_SET_ERR(EGL_BAD_PARAMETER);
+ goto fail;
+ }
+
+ if (!yagl_host_eglChooseConfig((yagl_host_handle)dpy,
+ attrib_list,
+ yagl_transport_attrib_list_count(attrib_list),
+ (yagl_host_handle*)configs,
+ config_size,
+ num_config,
+ &error)) {
+ YAGL_SET_ERR(error);
+ goto fail;
+ }
+
+ YAGL_LOG_FUNC_EXIT("num_config = %d", *num_config);
+
+ return EGL_TRUE;
+
+fail:
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return EGL_FALSE;
+}
+
+YAGL_API EGLBoolean eglGetConfigAttrib(EGLDisplay dpy_,
+ EGLConfig config,
+ EGLint attribute,
+ EGLint *value)
+{
+ EGLint error = 0;
+ struct yagl_display *dpy = NULL;
+ EGLBoolean ret = EGL_FALSE;
+ int visual_id = 0, visual_type = 0;
+
+ YAGL_LOG_FUNC_ENTER(eglGetConfigAttrib,
+ "dpy = %u, config = %u, attribute = 0x%X",
+ (yagl_host_handle)dpy_,
+ (yagl_host_handle)config,
+ attribute);
+
+ if (!yagl_validate_display(dpy_, &dpy)) {
+ goto fail;
+ }
+
+ switch (attribute) {
+ case EGL_NATIVE_VISUAL_ID:
+ case EGL_NATIVE_VISUAL_TYPE:
+ if (!dpy->native_dpy->get_visual(dpy->native_dpy,
+ &visual_id,
+ &visual_type)) {
+ YAGL_SET_ERR(EGL_BAD_CONFIG);
+ YAGL_LOG_ERROR("get_visual failed");
+ goto fail;
+ }
+
+ if (attribute == EGL_NATIVE_VISUAL_ID) {
+ *value = visual_id;
+ } else {
+ *value = visual_type;
+ }
+
+ ret = EGL_TRUE;
+
+ break;
+ case EGL_Y_INVERTED_NOK:
+ if (dpy->native_dpy->platform->pixmaps_supported) {
+ *value = yagl_get_backend()->y_inverted;
+ ret = EGL_TRUE;
+ break;
+ }
+ /* Fall through. */
+ default:
+ ret = yagl_host_eglGetConfigAttrib((yagl_host_handle)dpy_,
+ (yagl_host_handle)config,
+ attribute,
+ value,
+ &error);
+
+ if (!ret) {
+ YAGL_SET_ERR(error);
+ }
+
+ break;
+ }
+
+ if (!ret) {
+ goto fail;
+ }
+
+ YAGL_LOG_FUNC_EXIT("value = 0x%X", (value ? *value : -1));
+
+ return ret;
+
+fail:
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return ret;
+}
+
+YAGL_API EGLSurface eglCreateWindowSurface(EGLDisplay dpy_,
+ EGLConfig config,
+ EGLNativeWindowType win,
+ const EGLint *attrib_list)
+{
+ EGLint error = 0;
+ struct yagl_display *dpy = NULL;
+ struct yagl_native_drawable *native_win = NULL;
+ struct yagl_surface *surface = NULL;
+
+ YAGL_LOG_FUNC_ENTER(eglCreateWindowSurface,
+ "dpy = %u, config = %u",
+ (yagl_host_handle)dpy_,
+ (yagl_host_handle)config);
+
+ if (!yagl_validate_display(dpy_, &dpy)) {
+ goto fail;
+ }
+
+ native_win = dpy->native_dpy->wrap_window(dpy->native_dpy,
+ (yagl_os_window)win);
+
+ if (!native_win) {
+ goto fail;
+ }
+
+ surface = yagl_get_backend()->create_window_surface(dpy,
+ (yagl_host_handle)config,
+ native_win,
+ attrib_list);
+
+ if (!surface) {
+ native_win->destroy(native_win);
+ native_win = NULL;
+ goto fail;
+ }
+
+ if (!yagl_display_surface_add(dpy, surface)) {
+ yagl_host_eglDestroySurface(dpy->host_dpy, surface->res.handle, &error);
+ YAGL_SET_ERR(EGL_BAD_ALLOC);
+ goto fail;
+ }
+
+ yagl_surface_release(surface);
+
+ YAGL_LOG_FUNC_EXIT("%p", yagl_surface_get_handle(surface));
+
+ return yagl_surface_get_handle(surface);
+
+fail:
+ yagl_surface_release(surface);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return EGL_NO_SURFACE;
+}
+
+YAGL_API EGLSurface eglCreatePbufferSurface(EGLDisplay dpy_,
+ EGLConfig config,
+ const EGLint *attrib_list)
+{
+ EGLint error = 0;
+ struct yagl_display *dpy = NULL;
+ struct yagl_surface *surface = NULL;
+
+ YAGL_LOG_FUNC_ENTER(eglCreatePbufferSurface,
+ "dpy = %u, config = %u",
+ (yagl_host_handle)dpy_,
+ (yagl_host_handle)config);
+
+ if (!yagl_validate_display(dpy_, &dpy)) {
+ goto fail;
+ }
+
+ surface = yagl_get_backend()->create_pbuffer_surface(dpy,
+ (yagl_host_handle)config,
+ attrib_list);
+
+ if (!surface) {
+ goto fail;
+ }
+
+ if (!yagl_display_surface_add(dpy, surface)) {
+ yagl_host_eglDestroySurface(dpy->host_dpy, surface->res.handle, &error);
+ YAGL_SET_ERR(EGL_BAD_ALLOC);
+ goto fail;
+ }
+
+ yagl_surface_release(surface);
+
+ YAGL_LOG_FUNC_EXIT("%p", yagl_surface_get_handle(surface));
+
+ return yagl_surface_get_handle(surface);
+
+fail:
+ yagl_surface_release(surface);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return EGL_NO_SURFACE;
+}
+
+YAGL_API EGLSurface eglCreatePixmapSurface(EGLDisplay dpy_,
+ EGLConfig config,
+ EGLNativePixmapType pixmap,
+ const EGLint *attrib_list)
+{
+ EGLint error = 0;
+ struct yagl_display *dpy = NULL;
+ struct yagl_native_drawable *native_pixmap = NULL;
+ struct yagl_surface *surface = NULL;
+
+ YAGL_LOG_FUNC_ENTER(eglCreatePixmapSurface,
+ "dpy = %u, config = %u",
+ (yagl_host_handle)dpy_,
+ (yagl_host_handle)config);
+
+ if (!yagl_validate_display(dpy_, &dpy)) {
+ goto fail;
+ }
+
+ native_pixmap = dpy->native_dpy->wrap_pixmap(dpy->native_dpy,
+ (yagl_os_pixmap)pixmap);
+
+ if (!native_pixmap) {
+ goto fail;
+ }
+
+ surface = yagl_get_backend()->create_pixmap_surface(dpy,
+ (yagl_host_handle)config,
+ native_pixmap,
+ attrib_list);
+
+ if (!surface) {
+ native_pixmap->destroy(native_pixmap);
+ native_pixmap = NULL;
+ goto fail;
+ }
+
+ if (!yagl_display_surface_add(dpy, surface)) {
+ yagl_host_eglDestroySurface(dpy->host_dpy, surface->res.handle, &error);
+ YAGL_SET_ERR(EGL_BAD_ALLOC);
+ goto fail;
+ }
+
+ yagl_surface_release(surface);
+
+ YAGL_LOG_FUNC_EXIT("%p", yagl_surface_get_handle(surface));
+
+ return yagl_surface_get_handle(surface);
+
+fail:
+ yagl_surface_release(surface);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return EGL_NO_SURFACE;
+}
+
+YAGL_API EGLBoolean eglDestroySurface(EGLDisplay dpy_, EGLSurface surface_)
+{
+ EGLint error = 0;
+ EGLBoolean res = EGL_FALSE;
+ struct yagl_display *dpy = NULL;
+ struct yagl_surface *surface = NULL;
+
+ YAGL_LOG_FUNC_ENTER(eglDestroySurface,
+ "dpy = %u, surface = %p",
+ (yagl_host_handle)dpy_,
+ surface_);
+
+ if (!yagl_validate_display(dpy_, &dpy)) {
+ goto out;
+ }
+
+ if (!yagl_validate_surface(dpy, surface_, &surface)) {
+ goto out;
+ }
+
+ if (!yagl_host_eglDestroySurface(dpy->host_dpy, surface->res.handle, &error)) {
+ YAGL_SET_ERR(error);
+ goto out;
+ }
+
+ if (!yagl_display_surface_remove(dpy, surface_)) {
+ YAGL_LOG_ERROR("we're the one who destroy the surface, but surface isn't there!");
+ YAGL_SET_ERR(EGL_BAD_SURFACE);
+ goto out;
+ }
+
+ res = EGL_TRUE;
+
+out:
+ yagl_surface_release(surface);
+
+ YAGL_LOG_FUNC_EXIT("%d", ((res == EGL_TRUE) ? 1 : 0));
+
+ return res;
+}
+
+YAGL_API EGLBoolean eglQuerySurface(EGLDisplay dpy_,
+ EGLSurface surface_,
+ EGLint attribute,
+ EGLint *value)
+{
+ EGLint error = 0;
+ EGLBoolean retval = EGL_FALSE;
+ struct yagl_display *dpy = NULL;
+ struct yagl_surface *surface = NULL;
+ void *ptr;
+ uint32_t stride;
+
+ YAGL_LOG_FUNC_ENTER(eglQuerySurface,
+ "dpy = %u, surface = %p, attribute = 0x%X, value = %p",
+ (yagl_host_handle)dpy_,
+ surface_,
+ attribute,
+ value);
+
+ if (!yagl_validate_display(dpy_, &dpy)) {
+ goto out;
+ }
+
+ if (!yagl_validate_surface(dpy, surface_, &surface)) {
+ goto out;
+ }
+
+ switch (attribute) {
+ case EGL_BITMAP_POINTER_KHR:
+ ptr = yagl_surface_map(surface, &stride);
+ if (ptr) {
+ *value = (EGLint)ptr;
+ retval = EGL_TRUE;
+ } else {
+ YAGL_SET_ERR(EGL_BAD_ACCESS);
+ }
+ break;
+ case EGL_BITMAP_PITCH_KHR:
+ ptr = yagl_surface_map(surface, &stride);
+ if (ptr) {
+ *value = stride;
+ retval = EGL_TRUE;
+ } else {
+ YAGL_SET_ERR(EGL_BAD_ACCESS);
+ }
+ break;
+ case EGL_BITMAP_ORIGIN_KHR:
+ *value = EGL_UPPER_LEFT_KHR;
+ retval = EGL_TRUE;
+ break;
+ case EGL_BITMAP_PIXEL_RED_OFFSET_KHR:
+ *value = 16;
+ retval = EGL_TRUE;
+ break;
+ case EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR:
+ *value = 8;
+ retval = EGL_TRUE;
+ break;
+ case EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR:
+ *value = 0;
+ retval = EGL_TRUE;
+ break;
+ case EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR:
+ *value = 24;
+ retval = EGL_TRUE;
+ break;
+ case EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR:
+ *value = 0;
+ retval = EGL_TRUE;
+ break;
+ case EGL_BUFFER_AGE_EXT:
+ if (dpy->native_dpy->platform->buffer_age_supported &&
+ surface->native_drawable) {
+ *value = surface->native_drawable->get_buffer_age(surface->native_drawable);
+ retval = EGL_TRUE;
+ break;
+ }
+ /* Fall through. */
+ default:
+ retval = yagl_host_eglQuerySurface(dpy->host_dpy,
+ surface->res.handle,
+ attribute,
+ value,
+ &error);
+
+ if (!retval) {
+ YAGL_SET_ERR(error);
+ }
+
+ break;
+ }
+
+out:
+ yagl_surface_release(surface);
+
+ YAGL_LOG_FUNC_EXIT("%d", ((retval == EGL_TRUE) ? 1 : 0));
+
+ return retval;
+}
+
+YAGL_API EGLBoolean eglBindAPI(EGLenum api)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT1(eglBindAPI, EGLenum, api);
+
+ if (api != EGL_OPENGL_ES_API) {
+ YAGL_SET_ERR(EGL_BAD_PARAMETER);
+ return EGL_FALSE;
+ }
+
+ yagl_host_eglBindAPI(api);
+ yagl_set_api(api);
+
+ YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, EGL_TRUE);
+
+ return EGL_TRUE;
+}
+
+YAGL_API EGLenum eglQueryAPI()
+{
+ EGLenum ret;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT0(eglQueryAPI);
+
+ ret = yagl_get_api();
+
+ YAGL_LOG_FUNC_EXIT_SPLIT(EGLenum, ret);
+
+ return ret;
+}
+
+YAGL_API EGLBoolean eglWaitClient()
+{
+ struct yagl_surface *draw_sfc;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT0(eglWaitClient);
+
+ draw_sfc = yagl_get_draw_surface();
+
+ if (draw_sfc) {
+ draw_sfc->wait_gl(draw_sfc);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return EGL_TRUE;
+}
+
+YAGL_API EGLBoolean eglReleaseThread()
+{
+ EGLint error = 0;
+
+ YAGL_LOG_FUNC_ENTER(eglReleaseThread, NULL);
+
+ if (!yagl_host_eglReleaseThread(&error)) {
+ YAGL_SET_ERR(error);
+ goto fail;
+ }
+
+ yagl_reset_state();
+
+ YAGL_LOG_FUNC_EXIT("1");
+
+ return EGL_TRUE;
+
+fail:
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return EGL_FALSE;
+}
+
+YAGL_API EGLSurface eglCreatePbufferFromClientBuffer(EGLDisplay dpy,
+ EGLenum buftype,
+ EGLClientBuffer buffer,
+ EGLConfig config,
+ const EGLint *attrib_list)
+{
+ YAGL_UNIMPLEMENTED(eglCreatePbufferFromClientBuffer, EGL_NO_SURFACE);
+}
+
+YAGL_API EGLBoolean eglSurfaceAttrib(EGLDisplay dpy_,
+ EGLSurface surface_,
+ EGLint attribute,
+ EGLint value)
+{
+ EGLint error = 0;
+ EGLBoolean res = EGL_FALSE;
+ struct yagl_display *dpy = NULL;
+ struct yagl_surface *surface = NULL;
+
+ YAGL_LOG_FUNC_ENTER(eglSurfaceAttrib,
+ "dpy = %u, surface = %p, attribute = 0x%X, value = 0x%X",
+ (yagl_host_handle)dpy_,
+ surface_,
+ attribute,
+ value);
+
+ if (!yagl_validate_display(dpy_, &dpy)) {
+ goto out;
+ }
+
+ if (!yagl_validate_surface(dpy, surface_, &surface)) {
+ goto out;
+ }
+
+ if (!yagl_host_eglSurfaceAttrib(dpy->host_dpy,
+ surface->res.handle,
+ attribute,
+ value,
+ &error)) {
+ YAGL_SET_ERR(error);
+ goto out;
+ }
+
+ res = EGL_TRUE;
+
+out:
+ yagl_surface_release(surface);
+
+ YAGL_LOG_FUNC_EXIT("%d", ((res == EGL_TRUE) ? 1 : 0));
+
+ return res;
+}
+
+YAGL_API EGLBoolean eglBindTexImage(EGLDisplay dpy_,
+ EGLSurface surface_,
+ EGLint buffer)
+{
+ EGLBoolean res = EGL_FALSE;
+ struct yagl_display *dpy = NULL;
+ struct yagl_surface *surface = NULL;
+ struct yagl_context *ctx = NULL;
+ struct yagl_client_interface *iface = NULL;
+ struct yagl_client_image *image = NULL;
+ struct yagl_tex_image_binding *binding = NULL;
+
+ YAGL_LOG_FUNC_ENTER(eglBindTexImage,
+ "dpy = %u, surface = %p, buffer = 0x%X",
+ (yagl_host_handle)dpy_,
+ surface_,
+ buffer);
+
+ iface = yagl_get_any_client_interface();
+
+ if (!iface) {
+ YAGL_SET_ERR(EGL_BAD_ALLOC);
+ goto out;
+ }
+
+ ctx = yagl_get_context();
+
+ if (!ctx) {
+ YAGL_LOG_WARN("No context");
+ res = EGL_TRUE;
+ goto out;
+ }
+
+ if (!yagl_validate_display(dpy_, &dpy)) {
+ goto out;
+ }
+
+ if (!yagl_validate_surface(dpy, surface_, &surface)) {
+ goto out;
+ }
+
+ if (buffer != EGL_BACK_BUFFER) {
+ YAGL_SET_ERR(EGL_BAD_PARAMETER);
+ goto out;
+ }
+
+ if (surface->type != EGL_PBUFFER_BIT) {
+ YAGL_SET_ERR(EGL_BAD_SURFACE);
+ goto out;
+ }
+
+ image = surface->create_image(surface, iface);
+
+ if (!image) {
+ goto out;
+ }
+
+ binding = yagl_surface_create_tex_image_binding(surface, iface);
+
+ if (!ctx->client_ctx->bind_tex_image(ctx->client_ctx, image, binding)) {
+ yagl_free(binding);
+ YAGL_SET_ERR(EGL_BAD_ACCESS);
+ goto out;
+ }
+
+ if (!yagl_surface_bind_tex_image(surface, binding)) {
+ iface->release_tex_image(iface, binding->cookie);
+ yagl_free(binding);
+ YAGL_SET_ERR(EGL_BAD_ACCESS);
+ goto out;
+ }
+
+ res = EGL_TRUE;
+
+out:
+ yagl_surface_release(surface);
+ yagl_client_image_release(image);
+
+ YAGL_LOG_FUNC_EXIT("%d", ((res == EGL_TRUE) ? 1 : 0));
+
+ return res;
+}
+
+YAGL_API EGLBoolean eglReleaseTexImage(EGLDisplay dpy_,
+ EGLSurface surface_,
+ EGLint buffer)
+{
+ EGLBoolean res = EGL_FALSE;
+ struct yagl_display *dpy = NULL;
+ struct yagl_surface *surface = NULL;
+
+ YAGL_LOG_FUNC_ENTER(eglReleaseTexImage,
+ "dpy = %u, surface = %p, buffer = 0x%X",
+ (yagl_host_handle)dpy_,
+ surface_,
+ buffer);
+
+ if (!yagl_validate_display(dpy_, &dpy)) {
+ goto out;
+ }
+
+ if (!yagl_validate_surface(dpy, surface_, &surface)) {
+ goto out;
+ }
+
+ if (buffer != EGL_BACK_BUFFER) {
+ YAGL_SET_ERR(EGL_BAD_PARAMETER);
+ goto out;
+ }
+
+ if (surface->type != EGL_PBUFFER_BIT) {
+ YAGL_SET_ERR(EGL_BAD_SURFACE);
+ goto out;
+ }
+
+ yagl_surface_release_tex_image(surface);
+
+ res = EGL_TRUE;
+
+out:
+ yagl_surface_release(surface);
+
+ YAGL_LOG_FUNC_EXIT("%d", ((res == EGL_TRUE) ? 1 : 0));
+
+ return res;
+}
+
+YAGL_API EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval)
+{
+ struct yagl_surface *draw_sfc;
+
+ YAGL_LOG_FUNC_ENTER(eglSwapInterval,
+ "dpy = %u, interval = %d",
+ (yagl_host_handle)dpy,
+ interval);
+
+ draw_sfc = yagl_get_draw_surface();
+
+ if (draw_sfc && (draw_sfc->type == EGL_WINDOW_BIT)) {
+ if (interval <= 0) {
+ /*
+ * Always make sure that swap interval is at least 1. Setting
+ * to 0 makes little sense with tizen since tizen compositor
+ * will still use a value of 1 and this will cause jagged rendering
+ */
+ interval = 1;
+ }
+
+ draw_sfc->set_swap_interval(draw_sfc, interval);
+ }
+
+ YAGL_LOG_FUNC_EXIT("1");
+
+ return EGL_TRUE;
+}
+
+YAGL_API EGLContext eglCreateContext(EGLDisplay dpy_,
+ EGLConfig config,
+ EGLContext share_context_,
+ const EGLint *attrib_list)
+{
+ EGLint error = 0;
+ struct yagl_display *dpy = NULL;
+ struct yagl_context *share_context = NULL;
+ struct yagl_sharegroup *sg = NULL;
+ yagl_client_api client_api;
+ struct yagl_client_interface *iface = NULL;
+ yagl_host_handle host_context = 0;
+ struct yagl_client_context *client_ctx = NULL;
+ struct yagl_context *ctx = NULL;
+
+ YAGL_LOG_FUNC_ENTER(eglCreateContext,
+ "dpy = %u, config = %u, share_context = %u",
+ (yagl_host_handle)dpy_,
+ (yagl_host_handle)config,
+ (yagl_host_handle)share_context_);
+
+ if (!yagl_validate_display(dpy_, &dpy)) {
+ goto out;
+ }
+
+ if (share_context_) {
+ if (!yagl_validate_context(dpy, share_context_, &share_context)) {
+ goto out;
+ }
+ sg = share_context->client_ctx->sg;
+ yagl_sharegroup_acquire(sg);
+ } else {
+ sg = yagl_sharegroup_create();
+ }
+
+ if (!yagl_get_client_api(attrib_list, &client_api)) {
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+
+ if ((client_api == yagl_client_api_gles3) &&
+ (yagl_get_host_gl_version() < yagl_gl_3_1_es3)) {
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+
+ iface = yagl_get_client_interface(client_api);
+
+ if (!iface) {
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+
+ host_context =
+ yagl_host_eglCreateContext(dpy->host_dpy,
+ (yagl_host_handle)config,
+ (yagl_host_handle)share_context_,
+ attrib_list,
+ yagl_transport_attrib_list_count(attrib_list),
+ &error);
+
+ if (!host_context) {
+ YAGL_SET_ERR(error);
+ goto out;
+ }
+
+ client_ctx = iface->create_ctx(iface, client_api, sg);
+
+ ctx = yagl_context_create(host_context, dpy, client_ctx);
+ assert(ctx);
+
+ yagl_display_context_add(dpy, ctx);
+
+ yagl_context_release(ctx);
+
+out:
+ yagl_sharegroup_release(sg);
+ yagl_context_release(share_context);
+
+ YAGL_LOG_FUNC_EXIT("%u", host_context);
+
+ return (EGLContext)host_context;
+}
+
+YAGL_API EGLBoolean eglDestroyContext(EGLDisplay dpy_, EGLContext ctx)
+{
+ EGLint error = 0;
+ struct yagl_display *dpy = NULL;
+
+ YAGL_LOG_FUNC_ENTER(eglDestroyContext,
+ "dpy = %u, ctx = %u",
+ (yagl_host_handle)dpy_,
+ (yagl_host_handle)ctx);
+
+ if (!yagl_validate_display(dpy_, &dpy)) {
+ goto fail;
+ }
+
+ if (!yagl_host_eglDestroyContext(dpy->host_dpy, (yagl_host_handle)ctx, &error)) {
+ YAGL_SET_ERR(error);
+ goto fail;
+ }
+
+ yagl_display_context_remove(dpy, ctx);
+
+ YAGL_LOG_FUNC_EXIT("1");
+
+ return EGL_TRUE;
+
+fail:
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return EGL_FALSE;
+}
+
+YAGL_API EGLBoolean eglMakeCurrent(EGLDisplay dpy_,
+ EGLSurface draw_,
+ EGLSurface read_,
+ EGLContext ctx_)
+{
+ EGLBoolean res = EGL_FALSE;
+ int bad_match = ctx_ ? (!draw_ ^ !read_) : (draw_ || read_);
+ struct yagl_display *dpy = NULL;
+ struct yagl_surface *draw = NULL;
+ struct yagl_surface *read = NULL;
+ struct yagl_context *ctx = NULL;
+ struct yagl_context *prev_ctx = NULL;
+
+ YAGL_LOG_FUNC_ENTER(eglMakeCurrent,
+ "dpy = %u, draw = %p, read = %p, ctx = %u",
+ (yagl_host_handle)dpy_,
+ draw_,
+ read_,
+ (yagl_host_handle)ctx_);
+
+ if (bad_match) {
+ YAGL_SET_ERR(EGL_BAD_MATCH);
+ goto out;
+ }
+
+ prev_ctx = yagl_get_context();
+
+ if (!draw_ && !read_ && !ctx_) {
+ /*
+ * Releasing context.
+ */
+
+ if (prev_ctx) {
+ if (dpy_ == EGL_NO_DISPLAY) {
+ /*
+ * Workaround for the case when dpy
+ * passed is EGL_NO_DISPLAY and we're releasing
+ * the current context.
+ */
+
+ dpy_ = (EGLDisplay)prev_ctx->dpy->host_dpy;
+ dpy = prev_ctx->dpy;
+ } else {
+ if (!yagl_validate_display(dpy_, &dpy)) {
+ goto out;
+ }
+ }
+ } else {
+ /*
+ * No current context and we're releasing, a no-op.
+ */
+ res = EGL_TRUE;
+ goto out;
+ }
+ } else {
+ /*
+ * Making some context current.
+ */
+
+ if (!yagl_validate_display(dpy_, &dpy)) {
+ goto out;
+ }
+
+ if (draw_ && !yagl_validate_surface(dpy, draw_, &draw)) {
+ goto out;
+ }
+
+ if (read_ && !yagl_validate_surface(dpy, read_, &read)) {
+ goto out;
+ }
+
+ ctx = yagl_display_context_acquire(dpy, ctx_);
+
+ /*
+ * A workaround for EffectsApp. It incorrectly calls
+ * eglMakeCurrent(dpy, draw, read, NULL) which is not allowed
+ * according to EGL standard. i.e. non-NULL surfaces and NULL context
+ * is not allowed.
+ */
+ if (draw && read && !ctx) {
+ ctx = prev_ctx;
+ yagl_context_acquire(ctx);
+ }
+
+ if (!ctx) {
+ YAGL_SET_ERR(EGL_BAD_CONTEXT);
+ goto out;
+ }
+ }
+
+ if (ctx &&
+ (ctx == prev_ctx) &&
+ (ctx->dpy == dpy) &&
+ (draw == yagl_get_draw_surface()) &&
+ (read == yagl_get_read_surface())) {
+ /*
+ * Absolutely no change, skip.
+ */
+ res = EGL_TRUE;
+
+ goto out;
+ }
+
+ if ((draw && yagl_surface_locked(draw)) ||
+ (read && yagl_surface_locked(read))) {
+ YAGL_SET_ERR(EGL_BAD_ACCESS);
+ goto out;
+ }
+
+ if (!yagl_set_context(ctx, draw, read)) {
+ /*
+ * Context and/or surfaces are already
+ * current to some other thread.
+ */
+ YAGL_SET_ERR(EGL_BAD_ACCESS);
+ goto out;
+ }
+
+ yagl_render_invalidate(0);
+
+ yagl_host_eglMakeCurrent((yagl_host_handle)dpy_,
+ (draw ? draw->res.handle : 0),
+ (read ? read->res.handle : 0),
+ (ctx ? ctx->res.handle : 0));
+
+ if (ctx && !ctx->client_ctx_prepared) {
+ ctx->client_ctx->prepare(ctx->client_ctx);
+ ctx->client_ctx_prepared = 1;
+ }
+
+ res = EGL_TRUE;
+
+out:
+ yagl_surface_release(draw);
+ yagl_surface_release(read);
+ yagl_context_release(ctx);
+
+ YAGL_LOG_FUNC_EXIT("%d", ((res == EGL_TRUE) ? 1 : 0));
+
+ return res;
+}
+
+YAGL_API EGLContext eglGetCurrentContext(void)
+{
+ struct yagl_context *ctx;
+
+ YAGL_LOG_FUNC_ENTER(eglGetCurrentContext, NULL);
+
+ ctx = yagl_get_context();
+
+ YAGL_LOG_FUNC_EXIT("%u", (ctx ? ctx->res.handle : 0));
+
+ return (ctx ? (EGLContext)ctx->res.handle : EGL_NO_CONTEXT);
+}
+
+YAGL_API EGLSurface eglGetCurrentSurface(EGLint readdraw)
+{
+ struct yagl_surface *sfc;
+ EGLSurface ret = EGL_NO_SURFACE;
+
+ YAGL_LOG_FUNC_ENTER(eglGetCurrentSurface, NULL);
+
+ if (readdraw == EGL_READ) {
+ sfc = yagl_get_read_surface();
+ ret = (sfc ? yagl_surface_get_handle(sfc) : EGL_NO_SURFACE);
+ } else if (readdraw == EGL_DRAW) {
+ sfc = yagl_get_draw_surface();
+ ret = (sfc ? yagl_surface_get_handle(sfc) : EGL_NO_SURFACE);
+ } else {
+ YAGL_SET_ERR(EGL_BAD_PARAMETER);
+ }
+
+ YAGL_LOG_FUNC_EXIT("%p", ret);
+
+ return ret;
+}
+
+YAGL_API EGLDisplay eglGetCurrentDisplay(void)
+{
+ struct yagl_context *ctx;
+
+ YAGL_LOG_FUNC_ENTER(eglGetCurrentDisplay, NULL);
+
+ ctx = yagl_get_context();
+
+ YAGL_LOG_FUNC_EXIT("%u", (ctx ? ctx->dpy->host_dpy : 0));
+
+ return (ctx ? (EGLDisplay)ctx->dpy->host_dpy : EGL_NO_DISPLAY);
+}
+
+YAGL_API EGLBoolean eglQueryContext(EGLDisplay dpy_,
+ EGLContext ctx_,
+ EGLint attribute,
+ EGLint *value)
+{
+ EGLint error = 0;
+ EGLBoolean res = EGL_FALSE;
+ struct yagl_display *dpy = NULL;
+ struct yagl_context *ctx = NULL;
+
+ YAGL_LOG_FUNC_ENTER(eglQueryContext,
+ "dpy = %u, ctx = %u, attribute = 0x%X, value = %p",
+ (yagl_host_handle)dpy_,
+ (yagl_host_handle)ctx_,
+ attribute,
+ value);
+
+ if (!yagl_validate_display(dpy_, &dpy)) {
+ goto out;
+ }
+
+ if (!yagl_validate_context(dpy, ctx_, &ctx)) {
+ goto out;
+ }
+
+ switch (attribute) {
+ case EGL_CONTEXT_CLIENT_TYPE:
+ switch (ctx->client_ctx->client_api) {
+ case yagl_client_api_gles1:
+ case yagl_client_api_gles2:
+ case yagl_client_api_gles3:
+ if (value) {
+ *value = EGL_OPENGL_ES_API;
+ }
+ break;
+ case yagl_client_api_ogl:
+ if (value) {
+ *value = EGL_OPENGL_API;
+ }
+ break;
+ case yagl_client_api_ovg:
+ if (value) {
+ *value = EGL_OPENVG_API;
+ }
+ break;
+ default:
+ if (value) {
+ *value = EGL_NONE;
+ }
+ break;
+ }
+ break;
+ case EGL_CONTEXT_CLIENT_VERSION:
+ switch (ctx->client_ctx->client_api) {
+ case yagl_client_api_gles1:
+ if (value) {
+ *value = 1;
+ }
+ break;
+ case yagl_client_api_gles2:
+ if (value) {
+ *value = 2;
+ }
+ break;
+ case yagl_client_api_gles3:
+ if (value) {
+ *value = 3;
+ }
+ break;
+ case yagl_client_api_ogl:
+ case yagl_client_api_ovg:
+ default:
+ if (value) {
+ *value = 0;
+ }
+ break;
+ }
+ break;
+ default:
+ res = yagl_host_eglQueryContext(dpy->host_dpy,
+ (yagl_host_handle)ctx_,
+ attribute,
+ value,
+ &error);
+
+ if (!res) {
+ YAGL_SET_ERR(error);
+ }
+
+ break;
+ }
+
+out:
+ yagl_context_release(ctx);
+
+ YAGL_LOG_FUNC_EXIT("%d", ((res == EGL_TRUE) ? 1 : 0));
+
+ return res;
+}
+
+YAGL_API EGLBoolean eglWaitGL()
+{
+ EGLBoolean ret;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT0(eglWaitGL);
+
+ ret = eglWaitClient();
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return ret;
+}
+
+YAGL_API EGLBoolean eglWaitNative(EGLint engine)
+{
+ struct yagl_surface *draw_sfc;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(eglWaitNative, EGLint, engine);
+
+ draw_sfc = yagl_get_draw_surface();
+
+ if (draw_sfc) {
+ draw_sfc->wait_x(draw_sfc);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return EGL_TRUE;
+}
+
+YAGL_API EGLBoolean eglSwapBuffers(EGLDisplay dpy_, EGLSurface surface_)
+{
+ EGLBoolean res = EGL_FALSE;
+ struct yagl_display *dpy = NULL;
+ struct yagl_surface *surface = NULL;
+
+ YAGL_LOG_FUNC_ENTER(eglSwapBuffers,
+ "dpy = %u, surface = %p",
+ (yagl_host_handle)dpy_,
+ surface_);
+
+ if (!yagl_validate_display(dpy_, &dpy)) {
+ goto out;
+ }
+
+ if (!yagl_validate_surface(dpy, surface_, &surface)) {
+ goto out;
+ }
+
+ if ((yagl_get_draw_surface() != surface) &&
+ (yagl_get_read_surface() != surface)) {
+ YAGL_SET_ERR(EGL_BAD_SURFACE);
+ goto out;
+ }
+
+ if (yagl_surface_locked(surface)) {
+ YAGL_SET_ERR(EGL_BAD_ACCESS);
+ goto out;
+ }
+
+ if (surface->type != EGL_WINDOW_BIT) {
+ res = EGL_TRUE;
+ goto out;
+ }
+
+ if (!surface->swap_buffers(surface)) {
+ goto out;
+ }
+
+ res = EGL_TRUE;
+
+#ifdef YAGL_PLATFORM_X11
+ if (dpy->native_dpy->platform == &yagl_x11_platform) {
+ /*
+ * Normally one should not invalidate right after eglSwapBuffers,
+ * instead invalidate should be called on first rendering call
+ * after eglSwapBuffers (see yagl_render.h:yagl_render_invalidate).
+ * But this doesn't work on Tizen mobile, without this invalidate
+ * Tizen compositor may miss surface updates.
+ * The problem is in "efl_sync" option of the compositor, which is 0
+ * by default in upstream and 1 in Tizen. Setting it to 0 in
+ * config doesn't seem to help, one had to manually change code:
+ * e17-extra-modules/comp-tizen/src/e_mod_comp_cfdata.c:
+ * cfg->efl_sync = 1;
+ * to:
+ * cfg->efl_sync = 0;
+ * AND set efl_sync to 0 in config to make this work.
+ * When efl_sync is set to 1 the compositor acts like this:
+ * + For normal X11 windows nothing is changed
+ * + For e17 windows (created via ecore_x_window_new) it doesn't redraw
+ * the screen on damage events, but only on special SYNC_DRAW_DONE
+ * events that are sent from _ecore_evas_x_flush_post, which is called
+ * after eglSwapBuffers, that's why things work when invalidate
+ * is inside eglSwapBuffers, it finishes the swap before sending
+ * SYNC_DRAW_DONE, but once we move invalidate to first rendering call
+ * after eglSwapBuffers SYNC_DRAW_DONE starts to come before
+ * uxa copy, thus, missing last frame.
+ */
+ yagl_render_invalidate(0);
+ }
+#endif
+
+out:
+ yagl_surface_release(surface);
+
+ YAGL_LOG_FUNC_EXIT("%d", res);
+
+ return res;
+}
+
+YAGL_API EGLBoolean eglCopyBuffers(EGLDisplay dpy_,
+ EGLSurface surface_,
+ EGLNativePixmapType target)
+{
+ EGLBoolean res = EGL_FALSE;
+ struct yagl_display *dpy = NULL;
+ struct yagl_surface *surface = NULL;
+
+ YAGL_LOG_FUNC_ENTER(eglCopyBuffers,
+ "dpy = %u, surface = %p, target = %u",
+ (yagl_host_handle)dpy_,
+ surface_,
+ (uint32_t)target);
+
+ if (!yagl_validate_display(dpy_, &dpy)) {
+ goto out;
+ }
+
+ if (!yagl_validate_surface(dpy, surface_, &surface)) {
+ goto out;
+ }
+
+ if ((yagl_get_draw_surface() != surface) &&
+ (yagl_get_read_surface() != surface)) {
+ YAGL_SET_ERR(EGL_BAD_SURFACE);
+ goto out;
+ }
+
+ if (yagl_surface_locked(surface)) {
+ YAGL_SET_ERR(EGL_BAD_ACCESS);
+ goto out;
+ }
+
+ if (!surface->copy_buffers(surface, target)) {
+ goto out;
+ }
+
+ res = EGL_TRUE;
+
+out:
+ yagl_surface_release(surface);
+
+ YAGL_LOG_FUNC_EXIT("%d", res);
+
+ return res;
+}
+
+YAGL_API EGLImageKHR eglCreateImageKHR(EGLDisplay dpy_,
+ EGLContext ctx,
+ EGLenum target,
+ EGLClientBuffer buffer,
+ const EGLint *attrib_list)
+{
+ EGLImageKHR ret = EGL_NO_IMAGE_KHR;
+ struct yagl_client_interface *iface = NULL;
+ struct yagl_display *dpy = NULL;
+ struct yagl_native_drawable *native_buffer = NULL;
+ struct yagl_image *image = NULL;
+ int i = 0;
+
+ YAGL_LOG_FUNC_ENTER(eglCreateImageKHR,
+ "dpy = %u, ctx = %u, target = %u, buffer = %p",
+ (yagl_host_handle)dpy_,
+ (yagl_host_handle)ctx,
+ target,
+ buffer);
+
+ iface = yagl_get_any_client_interface();
+
+ if (!iface) {
+ YAGL_SET_ERR(EGL_BAD_ALLOC);
+ goto out;
+ }
+
+ if (!buffer) {
+ YAGL_SET_ERR(EGL_BAD_PARAMETER);
+ goto out;
+ }
+
+ if (!yagl_validate_display(dpy_, &dpy)) {
+ goto out;
+ }
+
+ switch (target) {
+ case EGL_NATIVE_PIXMAP_KHR:
+ if (!dpy->native_dpy->platform->pixmaps_supported) {
+ YAGL_SET_ERR(EGL_BAD_PARAMETER);
+ goto out;
+ }
+
+ if (attrib_list) {
+ while (attrib_list[i] != EGL_NONE) {
+ switch (attrib_list[i]) {
+ case EGL_IMAGE_PRESERVED_KHR:
+ break;
+ default:
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+
+ i += 2;
+ }
+ }
+
+ native_buffer = dpy->native_dpy->wrap_pixmap(dpy->native_dpy,
+ (yagl_os_pixmap)buffer);
+
+ if (!native_buffer) {
+ goto out;
+ }
+
+ image = yagl_get_backend()->create_image_pixmap(dpy,
+ native_buffer,
+ iface);
+
+ if (!image) {
+ native_buffer->destroy(native_buffer);
+ goto out;
+ }
+
+ break;
+ case EGL_WAYLAND_BUFFER_WL:
+ if (!dpy->native_dpy->WL_bind_wayland_display_supported) {
+ YAGL_SET_ERR(EGL_BAD_PARAMETER);
+ goto out;
+ }
+
+ if (attrib_list) {
+ while (attrib_list[i] != EGL_NONE) {
+ switch (attrib_list[i]) {
+ case EGL_IMAGE_PRESERVED_KHR:
+ case EGL_WAYLAND_PLANE_WL:
+ break;
+ default:
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+
+ i += 2;
+ }
+ }
+
+ image = yagl_get_backend()->create_image_wl_buffer(dpy,
+ (struct wl_resource*)buffer,
+ iface);
+
+ if (!image) {
+ goto out;
+ }
+
+ break;
+ default:
+ YAGL_SET_ERR(EGL_BAD_PARAMETER);
+ goto out;
+ }
+
+ if (!yagl_display_image_add(dpy, image)) {
+ YAGL_SET_ERR(EGL_BAD_PARAMETER);
+ goto out;
+ }
+
+ ret = image->client_handle;
+
+out:
+ yagl_image_release(image);
+
+ YAGL_LOG_FUNC_EXIT("%p", ret);
+
+ return ret;
+}
+
+YAGL_API EGLBoolean eglDestroyImageKHR( EGLDisplay dpy_,
+ EGLImageKHR image_ )
+{
+ EGLBoolean res = EGL_FALSE;
+ struct yagl_display *dpy = NULL;
+ struct yagl_image *image = NULL;
+
+ YAGL_LOG_FUNC_ENTER(eglDestroyImageKHR,
+ "dpy = %u, image = %p",
+ (yagl_host_handle)dpy_,
+ image_);
+
+ if (!yagl_validate_display(dpy_, &dpy)) {
+ goto out;
+ }
+
+ if (!yagl_validate_image(dpy, image_, &image)) {
+ goto out;
+ }
+
+ if (!yagl_display_image_remove(dpy, image_)) {
+ YAGL_LOG_ERROR("we're the one who destroy the image, but it isn't there!");
+ YAGL_SET_ERR(EGL_BAD_PARAMETER);
+ goto out;
+ }
+
+ res = EGL_TRUE;
+
+out:
+ yagl_image_release(image);
+
+ YAGL_LOG_FUNC_EXIT("%d", ((res == EGL_TRUE) ? 1 : 0));
+
+ return res;
+}
+
+YAGL_API EGLBoolean eglLockSurfaceKHR(EGLDisplay dpy_,
+ EGLSurface surface_,
+ const EGLint *attrib_list)
+{
+ EGLBoolean res = EGL_FALSE;
+ struct yagl_display *dpy = NULL;
+ struct yagl_surface *surface = NULL;
+ int i = 0;
+ int preserve = 0;
+ EGLint hint = 0;
+
+ YAGL_LOG_FUNC_ENTER(eglLockSurfaceKHR,
+ "dpy = %u, surface = %p",
+ (yagl_host_handle)dpy_,
+ surface_);
+
+ if (!yagl_validate_display(dpy_, &dpy)) {
+ goto out;
+ }
+
+ if (!yagl_validate_surface(dpy, surface_, &surface)) {
+ goto out;
+ }
+
+ if (attrib_list) {
+ while (attrib_list[i] != EGL_NONE) {
+ switch (attrib_list[i]) {
+ case EGL_MAP_PRESERVE_PIXELS_KHR:
+ preserve = attrib_list[i + 1];
+ break;
+ case EGL_LOCK_USAGE_HINT_KHR:
+ break;
+ default:
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+
+ i += 2;
+ }
+ }
+
+ if (preserve) {
+ hint = EGL_READ_SURFACE_BIT_KHR | EGL_WRITE_SURFACE_BIT_KHR;
+ } else {
+ hint = EGL_WRITE_SURFACE_BIT_KHR;
+ }
+
+ if (!yagl_surface_lock(surface, hint)) {
+ YAGL_SET_ERR(EGL_BAD_ACCESS);
+ goto out;
+ }
+
+ res = EGL_TRUE;
+
+out:
+ yagl_surface_release(surface);
+
+ YAGL_LOG_FUNC_EXIT("%d", res);
+
+ return res;
+}
+
+YAGL_API EGLBoolean eglUnlockSurfaceKHR(EGLDisplay dpy_,
+ EGLSurface surface_)
+{
+ EGLBoolean res = EGL_FALSE;
+ struct yagl_display *dpy = NULL;
+ struct yagl_surface *surface = NULL;
+
+ YAGL_LOG_FUNC_ENTER(eglUnlockSurfaceKHR,
+ "dpy = %u, surface = %p",
+ (yagl_host_handle)dpy_,
+ surface_);
+
+ if (!yagl_validate_display(dpy_, &dpy)) {
+ goto out;
+ }
+
+ if (!yagl_validate_surface(dpy, surface_, &surface)) {
+ goto out;
+ }
+
+ if (!yagl_surface_unlock(surface)) {
+ YAGL_SET_ERR(EGL_BAD_ACCESS);
+ goto out;
+ }
+
+ yagl_surface_invalidate(surface);
+
+ res = EGL_TRUE;
+
+out:
+ yagl_surface_release(surface);
+
+ YAGL_LOG_FUNC_EXIT("%d", res);
+
+ return res;
+}
+
+YAGL_API EGLSyncKHR eglCreateSyncKHR(EGLDisplay dpy_, EGLenum type, const EGLint *attrib_list)
+{
+ EGLSyncKHR ret = EGL_NO_SYNC_KHR;
+ struct yagl_display *dpy = NULL;
+ struct yagl_fence *fence = NULL;
+
+ YAGL_LOG_FUNC_ENTER(eglCreateSyncKHR, "dpy = %u, type = %u",
+ (yagl_host_handle)dpy_, type);
+
+ if (type != EGL_SYNC_FENCE_KHR) {
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+
+ if (attrib_list && (attrib_list[0] != EGL_NONE)) {
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+
+ if (!yagl_validate_display(dpy_, &dpy)) {
+ goto out;
+ }
+
+ fence = yagl_get_backend()->create_fence(dpy);
+
+ if (!fence) {
+ YAGL_SET_ERR(EGL_BAD_ACCESS);
+ goto out;
+ }
+
+ yagl_display_fence_add(dpy, fence);
+
+ yagl_transport_flush(yagl_get_transport(), &fence->base);
+
+ ret = fence;
+
+out:
+ yagl_fence_release(fence);
+
+ YAGL_LOG_FUNC_EXIT("%p", ret);
+
+ return ret;
+}
+
+YAGL_API EGLBoolean eglDestroySyncKHR(EGLDisplay dpy_, EGLSyncKHR sync_)
+{
+ EGLBoolean res = EGL_FALSE;
+ struct yagl_display *dpy = NULL;
+ struct yagl_fence *fence = NULL;
+
+ YAGL_LOG_FUNC_ENTER(eglDestroySyncKHR, "dpy = %u, sync = %p",
+ (yagl_host_handle)dpy_, sync_);
+
+ if (!yagl_validate_display(dpy_, &dpy)) {
+ goto out;
+ }
+
+ if (!yagl_validate_fence(dpy, sync_, &fence)) {
+ goto out;
+ }
+
+ if (!yagl_display_fence_remove(dpy, sync_)) {
+ YAGL_LOG_ERROR("we're the one who destroy the fence, but it isn't there!");
+ YAGL_SET_ERR(EGL_BAD_PARAMETER);
+ goto out;
+ }
+
+ res = EGL_TRUE;
+
+out:
+ yagl_fence_release(fence);
+
+ YAGL_LOG_FUNC_EXIT("%d", res);
+
+ return res;
+}
+
+YAGL_API EGLint eglClientWaitSyncKHR(EGLDisplay dpy_, EGLSyncKHR sync_, EGLint flags, EGLTimeKHR timeout)
+{
+ EGLint res = EGL_FALSE;
+ struct yagl_display *dpy = NULL;
+ struct yagl_fence *fence = NULL;
+
+ YAGL_LOG_FUNC_ENTER(eglClientWaitSyncKHR, "dpy = %u, sync = %p, flags = 0x%X, timeout = %u",
+ (yagl_host_handle)dpy_, sync_, flags, (uint32_t)timeout);
+
+ if (!yagl_validate_display(dpy_, &dpy)) {
+ goto out;
+ }
+
+ if (!yagl_validate_fence(dpy, sync_, &fence)) {
+ goto out;
+ }
+
+ if (timeout == 0) {
+ res = fence->base.signaled(&fence->base) ? EGL_CONDITION_SATISFIED_KHR
+ : EGL_TIMEOUT_EXPIRED_KHR;
+ } else if (fence->base.wait(&fence->base)) {
+ res = EGL_CONDITION_SATISFIED_KHR;
+ } else {
+ YAGL_SET_ERR(EGL_BAD_ACCESS);
+ }
+
+out:
+ yagl_fence_release(fence);
+
+ YAGL_LOG_FUNC_EXIT("%d", res);
+
+ return res;
+}
+
+YAGL_API EGLBoolean eglSignalSyncKHR(EGLDisplay dpy_, EGLSyncKHR sync_, EGLenum mode)
+{
+ YAGL_LOG_FUNC_ENTER(eglSignalSyncKHR, "dpy = %u, sync = %p, mode = 0x%X",
+ (yagl_host_handle)dpy_, sync_, mode);
+
+ YAGL_SET_ERR(EGL_BAD_MATCH);
+
+ YAGL_LOG_FUNC_EXIT("%d", EGL_FALSE);
+
+ return EGL_FALSE;
+}
+
+YAGL_API EGLBoolean eglGetSyncAttribKHR(EGLDisplay dpy_, EGLSyncKHR sync_, EGLint attribute, EGLint *value)
+{
+ EGLBoolean res = EGL_FALSE;
+ struct yagl_display *dpy = NULL;
+ struct yagl_fence *fence = NULL;
+
+ YAGL_LOG_FUNC_ENTER(eglGetSyncAttribKHR, "dpy = %u, sync = %p, attribute = 0x%X",
+ (yagl_host_handle)dpy_, sync_, attribute);
+
+ if (!yagl_validate_display(dpy_, &dpy)) {
+ goto out;
+ }
+
+ if (!yagl_validate_fence(dpy, sync_, &fence)) {
+ goto out;
+ }
+
+ switch (attribute) {
+ case EGL_SYNC_TYPE_KHR:
+ *value = EGL_SYNC_FENCE_KHR;
+ res = EGL_TRUE;
+ break;
+ case EGL_SYNC_STATUS_KHR:
+ *value = fence->base.signaled(&fence->base) ? EGL_SIGNALED_KHR
+ : EGL_UNSIGNALED_KHR;
+ res = EGL_TRUE;
+ break;
+ case EGL_SYNC_CONDITION_KHR:
+ *value = EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR;
+ res = EGL_TRUE;
+ break;
+ default:
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ break;
+ }
+
+out:
+ yagl_fence_release(fence);
+
+ YAGL_LOG_FUNC_EXIT("%d", res);
+
+ return res;
+}
+
+#ifdef YAGL_PLATFORM_WAYLAND
+struct wl_display;
+struct wl_resource;
+
+YAGL_API EGLBoolean eglBindWaylandDisplayWL(EGLDisplay dpy_,
+ struct wl_display *display)
+{
+ EGLBoolean res = EGL_FALSE;
+ struct yagl_display *dpy = NULL;
+
+ YAGL_LOG_FUNC_ENTER(eglBindWaylandDisplayWL,
+ "dpy = %u, display = %p",
+ (yagl_host_handle)dpy_,
+ display);
+
+ if (!yagl_validate_display(dpy_, &dpy)) {
+ goto out;
+ }
+
+ if (!display) {
+ YAGL_SET_ERR(EGL_BAD_PARAMETER);
+ goto out;
+ }
+
+ if (!dpy->native_dpy->WL_bind_wayland_display_supported) {
+ YAGL_SET_ERR(EGL_BAD_PARAMETER);
+ goto out;
+ }
+
+ res = yagl_native_display_bind_wl_display(dpy->native_dpy, display);
+
+out:
+ YAGL_LOG_FUNC_EXIT("%d", res);
+
+ return res;
+}
+
+YAGL_API EGLBoolean eglUnbindWaylandDisplayWL(EGLDisplay dpy_,
+ struct wl_display *display)
+{
+ EGLBoolean res = EGL_FALSE;
+ struct yagl_display *dpy = NULL;
+
+ YAGL_LOG_FUNC_ENTER(eglUnbindWaylandDisplayWL,
+ "dpy = %u, display = %p",
+ (yagl_host_handle)dpy_,
+ display);
+
+ if (!yagl_validate_display(dpy_, &dpy)) {
+ goto out;
+ }
+
+ if (!display) {
+ YAGL_SET_ERR(EGL_BAD_PARAMETER);
+ goto out;
+ }
+
+ if (!dpy->native_dpy->WL_bind_wayland_display_supported) {
+ YAGL_SET_ERR(EGL_BAD_PARAMETER);
+ goto out;
+ }
+
+ res = yagl_native_display_unbind_wl_display(dpy->native_dpy);
+
+out:
+ YAGL_LOG_FUNC_EXIT("%d", res);
+
+ return res;
+}
+
+YAGL_API EGLBoolean eglQueryWaylandBufferWL(EGLDisplay dpy_,
+ struct wl_resource *buffer,
+ EGLint attribute,
+ EGLint *value)
+{
+ EGLBoolean res = EGL_FALSE;
+ struct yagl_display *dpy = NULL;
+
+ YAGL_LOG_FUNC_ENTER(eglQueryWaylandBufferWL,
+ "dpy = %u, buffer = %p, attribute = 0x%X",
+ (yagl_host_handle)dpy_,
+ buffer,
+ attribute);
+
+ if (!yagl_validate_display(dpy_, &dpy)) {
+ goto out;
+ }
+
+ if (!buffer) {
+ YAGL_SET_ERR(EGL_BAD_PARAMETER);
+ goto out;
+ }
+
+ if (!dpy->native_dpy->WL_bind_wayland_display_supported) {
+ YAGL_SET_ERR(EGL_BAD_PARAMETER);
+ goto out;
+ }
+
+ res = yagl_native_display_query_wl_buffer(dpy->native_dpy,
+ buffer,
+ attribute,
+ value);
+
+out:
+ YAGL_LOG_FUNC_EXIT("%d", res);
+
+ return res;
+}
+#endif
+
+YAGL_API __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char* procname)
+{
+ __eglMustCastToProperFunctionPointerType ret = NULL;
+
+ YAGL_LOG_FUNC_ENTER(eglGetProcAddress, "procname = %s", procname);
+
+ if (procname) {
+ if (strncmp(procname, "gl", 2) == 0) {
+
+ struct yagl_context *ctx = yagl_get_context();
+
+ if (ctx) {
+ switch (ctx->client_ctx->client_api) {
+ case yagl_client_api_gles1:
+ ret = yagl_get_gles1_sym(procname);
+ break;
+ case yagl_client_api_gles2:
+ case yagl_client_api_gles3:
+ ret = yagl_get_gles2_sym(procname);
+ break;
+ default:
+ break;
+ }
+ } else {
+ /*
+ * Workaround for evas, which foolishly calls this without
+ * context being set.
+ */
+ ret = yagl_get_gles2_sym(procname);
+ }
+ } else if (strncmp(procname, "egl", 3) == 0) {
+ ret = dlsym(NULL, procname);
+ }
+ }
+
+ YAGL_LOG_FUNC_EXIT("%p", ret);
+
+ return ret;
+}
--- /dev/null
+yagl_host_handle eglGetDisplay(uint32_t display_id, EGLint &error)
+EGLBoolean eglInitialize(yagl_host_handle dpy, EGLint &major, EGLint &minor, EGLint &error)
+EGLBoolean eglTerminate(yagl_host_handle dpy, EGLint &error)
+EGLBoolean eglGetConfigs(yagl_host_handle dpy, yagl_host_handle *configs, EGLint &error)
+EGLBoolean eglChooseConfig(yagl_host_handle dpy, const EGLint *attrib_list, yagl_host_handle *configs, EGLint &error)
+EGLBoolean eglGetConfigAttrib(yagl_host_handle dpy, yagl_host_handle config, EGLint attribute, EGLint &value, EGLint &error)
+EGLBoolean eglDestroySurface(yagl_host_handle dpy, yagl_host_handle surface, EGLint &error)
+EGLBoolean eglQuerySurface(yagl_host_handle dpy, yagl_host_handle surface, EGLint attribute, EGLint &value, EGLint &error)
+void eglBindAPI(EGLenum api)
+@void eglWaitClient()
+EGLBoolean eglReleaseThread(EGLint &error)
+EGLBoolean eglSurfaceAttrib(yagl_host_handle dpy, yagl_host_handle surface, EGLint attribute, EGLint value, EGLint &error)
+yagl_host_handle eglCreateContext(yagl_host_handle dpy, yagl_host_handle config, yagl_host_handle share_context, const EGLint *attrib_list, EGLint &error)
+EGLBoolean eglDestroyContext(yagl_host_handle dpy, yagl_host_handle ctx, EGLint &error)
+void eglMakeCurrent(yagl_host_handle dpy, yagl_host_handle draw, yagl_host_handle read, yagl_host_handle ctx)
+EGLBoolean eglQueryContext(yagl_host_handle dpy, yagl_host_handle ctx, EGLint attribute, EGLint &value, EGLint &error)
+@void eglSwapBuffers(yagl_host_handle dpy, yagl_host_handle surface)
+@void eglCopyBuffers(yagl_host_handle dpy, yagl_host_handle surface)
+
+#
+# YaGL Extensions
+#
+
+yagl_host_handle eglCreateWindowSurfaceOffscreenYAGL(yagl_host_handle dpy, yagl_host_handle config, uint32_t width, uint32_t height, uint32_t bpp, void ^pixels, const EGLint *attrib_list, EGLint &error)
+yagl_host_handle eglCreatePbufferSurfaceOffscreenYAGL(yagl_host_handle dpy, yagl_host_handle config, uint32_t width, uint32_t height, uint32_t bpp, void ^pixels, const EGLint *attrib_list, EGLint &error)
+yagl_host_handle eglCreatePixmapSurfaceOffscreenYAGL(yagl_host_handle dpy, yagl_host_handle config, uint32_t width, uint32_t height, uint32_t bpp, void ^pixels, const EGLint *attrib_list, EGLint &error)
+EGLBoolean eglResizeOffscreenSurfaceYAGL(yagl_host_handle dpy, yagl_host_handle surface, uint32_t width, uint32_t height, uint32_t bpp, void ^pixels, EGLint &error)
+
+yagl_host_handle eglCreateWindowSurfaceOnscreenYAGL(yagl_host_handle dpy, yagl_host_handle config, yagl_winsys_id win, const EGLint *attrib_list, EGLint &error)
+yagl_host_handle eglCreatePbufferSurfaceOnscreenYAGL(yagl_host_handle dpy, yagl_host_handle config, yagl_winsys_id buffer, const EGLint *attrib_list, EGLint &error)
+yagl_host_handle eglCreatePixmapSurfaceOnscreenYAGL(yagl_host_handle dpy, yagl_host_handle config, yagl_winsys_id pixmap, const EGLint *attrib_list, EGLint &error)
+@void eglInvalidateOnscreenSurfaceYAGL(yagl_host_handle dpy, yagl_host_handle surface, yagl_winsys_id buffer)
+
+EGLBoolean eglCreateImageYAGL(uint32_t texture, yagl_host_handle dpy, yagl_winsys_id buffer, EGLint &error)
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_egl_fence.h"
+#include "yagl_egl_state.h"
+#include "yagl_fence.h"
+#include "yagl_context.h"
+#include "yagl_backend.h"
+
+int yagl_egl_fence_supported(void)
+{
+ return yagl_get_backend()->fence_supported;
+}
+
+void yagl_egl_fence_acquire(struct yagl_egl_fence *egl_fence)
+{
+ if (egl_fence) {
+ yagl_resource_acquire(&egl_fence->res);
+ }
+}
+
+void yagl_egl_fence_release(struct yagl_egl_fence *egl_fence)
+{
+ if (egl_fence) {
+ yagl_resource_release(&egl_fence->res);
+ }
+}
+
+struct yagl_egl_fence *yagl_create_egl_fence(void)
+{
+ struct yagl_context *ctx = yagl_get_context();
+ struct yagl_fence *fence;
+
+ if (!ctx) {
+ return NULL;
+ }
+
+ fence = yagl_get_backend()->create_fence(ctx->dpy);
+
+ if (!fence) {
+ return NULL;
+ }
+
+ return &fence->base;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_egl_state.h"
+#include "yagl_context.h"
+#include "yagl_surface.h"
+#include "yagl_log.h"
+#include "yagl_malloc.h"
+#include "yagl_client_interface.h"
+#include "yagl_client_context.h"
+#include <pthread.h>
+#include <dlfcn.h>
+
+struct yagl_egl_state
+{
+ EGLint error;
+
+ EGLenum api;
+
+ struct yagl_context *ctx;
+ struct yagl_surface *draw_sfc;
+ struct yagl_surface *read_sfc;
+
+ struct yagl_client_interface *gles1_iface;
+ struct yagl_client_interface *gles2_iface;
+};
+
+static pthread_key_t g_state_key;
+static pthread_once_t g_state_key_init = PTHREAD_ONCE_INIT;
+
+void *yagl_get_gles1_sym(const char *name)
+{
+ void *handle;
+ void *sym = dlsym(NULL, name);
+
+ if (sym) {
+ return sym;
+ }
+
+ handle = dlopen("libGLESv1_CM.so.1", RTLD_NOW|RTLD_GLOBAL);
+ if (!handle) {
+ handle = dlopen("libGLESv1_CM.so", RTLD_NOW|RTLD_GLOBAL);
+ }
+
+ if (handle) {
+ return dlsym(handle, name);
+ }
+
+ return NULL;
+}
+
+void *yagl_get_gles2_sym(const char *name)
+{
+ void *handle;
+ void *sym = dlsym(NULL, name);
+
+ if (sym) {
+ return sym;
+ }
+
+ handle = dlopen("libGLESv2.so.1", RTLD_NOW|RTLD_GLOBAL);
+ if (!handle) {
+ handle = dlopen("libGLESv2.so", RTLD_NOW|RTLD_GLOBAL);
+ }
+
+ if (handle) {
+ return dlsym(handle, name);
+ }
+
+ return NULL;
+}
+
+static void yagl_egl_state_free(void* ptr)
+{
+ struct yagl_egl_state *state = ptr;
+
+ YAGL_LOG_FUNC_ENTER(yagl_egl_state_free, "%p", ptr);
+
+ if (!ptr) {
+ return;
+ }
+
+ yagl_surface_release(state->read_sfc);
+ yagl_surface_release(state->draw_sfc);
+ yagl_context_release(state->ctx);
+
+ yagl_free(state);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+static void yagl_egl_state_key_init()
+{
+ pthread_key_create(&g_state_key, yagl_egl_state_free);
+}
+
+static void yagl_egl_state_atfork()
+{
+ struct yagl_egl_state *state;
+
+ /*
+ * See yagl_state.c:yagl_state_atfork.
+ */
+
+ pthread_once(&g_state_key_init, yagl_egl_state_key_init);
+
+ state = (struct yagl_egl_state*)pthread_getspecific(g_state_key);
+
+ if (state) {
+ yagl_free(state);
+ }
+
+ pthread_setspecific(g_state_key, NULL);
+}
+
+static void yagl_egl_state_init()
+{
+ struct yagl_egl_state *state;
+
+ pthread_once(&g_state_key_init, yagl_egl_state_key_init);
+
+ if (pthread_getspecific(g_state_key)) {
+ return;
+ }
+
+ YAGL_LOG_FUNC_ENTER(yagl_egl_state_init, NULL);
+
+ state = yagl_malloc0(sizeof(struct yagl_egl_state));
+
+ state->error = EGL_SUCCESS;
+ state->api = EGL_OPENGL_ES_API;
+
+ pthread_setspecific(g_state_key, state);
+
+ pthread_atfork(NULL, NULL, &yagl_egl_state_atfork);
+
+ YAGL_LOG_FUNC_EXIT("%p", state);
+}
+
+static struct yagl_egl_state *yagl_egl_get_state()
+{
+ yagl_egl_state_init();
+
+ return (struct yagl_egl_state*)pthread_getspecific(g_state_key);
+}
+
+EGLint yagl_get_error()
+{
+ struct yagl_egl_state *state = yagl_egl_get_state();
+
+ EGLint error = state->error;
+
+ state->error = EGL_SUCCESS;
+
+ return error;
+}
+
+void yagl_set_error(EGLint error)
+{
+ struct yagl_egl_state *state = yagl_egl_get_state();
+
+ if (state->error == EGL_SUCCESS) {
+ state->error = error;
+ }
+}
+
+EGLenum yagl_get_api()
+{
+ struct yagl_egl_state *state = yagl_egl_get_state();
+
+ return state->api;
+}
+
+void yagl_set_api(EGLenum api)
+{
+ struct yagl_egl_state *state = yagl_egl_get_state();
+
+ state->api = api;
+}
+
+struct yagl_context *yagl_get_context()
+{
+ struct yagl_egl_state *state = yagl_egl_get_state();
+
+ return state->ctx;
+}
+
+struct yagl_surface *yagl_get_draw_surface()
+{
+ struct yagl_egl_state *state = yagl_egl_get_state();
+
+ return state->draw_sfc;
+}
+
+struct yagl_surface *yagl_get_read_surface()
+{
+ struct yagl_egl_state *state = yagl_egl_get_state();
+
+ return state->read_sfc;
+}
+
+int yagl_set_context(struct yagl_context *ctx,
+ struct yagl_surface *draw_sfc,
+ struct yagl_surface *read_sfc)
+{
+ struct yagl_egl_state *state = yagl_egl_get_state();
+ int ctx_marked = 0, draw_sfc_marked = 0;
+
+ if (ctx && (state->ctx != ctx)) {
+ if (!yagl_context_mark_current(ctx, 1)) {
+ goto fail;
+ }
+ ctx_marked = 1;
+ }
+
+ if (draw_sfc && (state->draw_sfc != draw_sfc)) {
+ if (!yagl_surface_mark_current(draw_sfc, 1)) {
+ goto fail;
+ }
+ draw_sfc_marked = 1;
+ }
+
+ if (read_sfc &&
+ (state->read_sfc != read_sfc) &&
+ (read_sfc != draw_sfc) &&
+ !yagl_surface_mark_current(read_sfc, 1)) {
+ goto fail;
+ }
+
+ if (state->ctx && (state->ctx != ctx)) {
+ yagl_context_mark_current(state->ctx, 0);
+ }
+
+ if (state->draw_sfc && (state->draw_sfc != draw_sfc)) {
+ yagl_surface_mark_current(state->draw_sfc, 0);
+ }
+
+ if (state->read_sfc &&
+ (state->read_sfc != read_sfc) &&
+ (state->read_sfc != state->draw_sfc)) {
+ yagl_surface_mark_current(state->read_sfc, 0);
+ }
+
+ yagl_context_acquire(ctx);
+ yagl_surface_acquire(draw_sfc);
+ yagl_surface_acquire(read_sfc);
+
+ yagl_surface_release(state->read_sfc);
+ yagl_surface_release(state->draw_sfc);
+ yagl_context_release(state->ctx);
+
+ state->ctx = ctx;
+ state->read_sfc = read_sfc;
+ state->draw_sfc = draw_sfc;
+
+ return 1;
+
+fail:
+ if (ctx_marked) {
+ yagl_context_mark_current(ctx, 0);
+ }
+ if (draw_sfc_marked) {
+ yagl_surface_mark_current(draw_sfc, 0);
+ }
+
+ return 0;
+}
+
+void yagl_reset_state()
+{
+ struct yagl_egl_state *state = yagl_egl_get_state();
+
+ yagl_set_context(NULL, NULL, NULL);
+
+ state->error = EGL_SUCCESS;
+ state->api = EGL_OPENGL_ES_API;
+}
+
+struct yagl_client_context *yagl_get_client_context(void)
+{
+ struct yagl_egl_state *state = yagl_egl_get_state();
+
+ return state->ctx ? state->ctx->client_ctx : NULL;
+}
+
+struct yagl_client_interface *yagl_get_client_interface(yagl_client_api client_api)
+{
+ struct yagl_egl_state *state = yagl_egl_get_state();
+
+ switch (client_api) {
+ case yagl_client_api_gles1:
+ if (!state->gles1_iface) {
+ state->gles1_iface = yagl_get_gles1_sym("yagl_gles1_interface");
+ }
+ return state->gles1_iface;
+ case yagl_client_api_gles2:
+ case yagl_client_api_gles3:
+ if (!state->gles2_iface) {
+ state->gles2_iface = yagl_get_gles1_sym("yagl_gles2_interface");
+ }
+ return state->gles2_iface;
+ default:
+ return NULL;
+ }
+}
+
+struct yagl_client_interface *yagl_get_any_client_interface()
+{
+ struct yagl_client_interface *iface;
+
+ iface = yagl_get_client_interface(yagl_client_api_gles2);
+ if (!iface) {
+ iface = yagl_get_client_interface(yagl_client_api_gles1);
+ }
+
+ return iface;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_EGL_STATE_H_
+#define _YAGL_EGL_STATE_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+#include "EGL/egl.h"
+
+struct yagl_context;
+struct yagl_surface;
+
+void *yagl_get_gles1_sym(const char *name);
+void *yagl_get_gles2_sym(const char *name);
+
+/*
+ * Those return per-thread values.
+ * @{
+ */
+
+EGLint yagl_get_error();
+
+void yagl_set_error(EGLint error);
+
+EGLenum yagl_get_api();
+
+void yagl_set_api(EGLenum api);
+
+struct yagl_context *yagl_get_context();
+struct yagl_surface *yagl_get_draw_surface();
+struct yagl_surface *yagl_get_read_surface();
+
+int yagl_set_context(struct yagl_context *ctx,
+ struct yagl_surface *draw_sfc,
+ struct yagl_surface *read_sfc);
+
+void yagl_reset_state();
+
+struct yagl_client_interface *yagl_get_client_interface(yagl_client_api client_api);
+
+struct yagl_client_interface *yagl_get_any_client_interface();
+
+/*
+ * @}
+ */
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_fence.h"
+
+void yagl_fence_init(struct yagl_fence *fence,
+ yagl_ref_destroy_func destroy_func,
+ struct yagl_display *dpy,
+ uint32_t seq)
+{
+ yagl_resource_init(&fence->base.res, destroy_func, 0);
+
+ fence->dpy = dpy;
+ fence->seq = seq;
+}
+
+void yagl_fence_cleanup(struct yagl_fence *fence)
+{
+ yagl_resource_cleanup(&fence->base.res);
+}
+
+void yagl_fence_acquire(struct yagl_fence *fence)
+{
+ yagl_egl_fence_acquire(&fence->base);
+}
+
+void yagl_fence_release(struct yagl_fence *fence)
+{
+ yagl_egl_fence_release(&fence->base);
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_FENCE_H_
+#define _YAGL_FENCE_H_
+
+#include "yagl_export.h"
+#include "yagl_egl_fence.h"
+
+struct yagl_display;
+
+struct yagl_fence
+{
+ struct yagl_egl_fence base;
+
+ struct yagl_display *dpy;
+
+ uint32_t seq;
+};
+
+void yagl_fence_init(struct yagl_fence *fence,
+ yagl_ref_destroy_func destroy_func,
+ struct yagl_display *dpy,
+ uint32_t seq);
+
+void yagl_fence_cleanup(struct yagl_fence *fence);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_fence_acquire(struct yagl_fence *fence);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_fence_release(struct yagl_fence *fence);
+
+#endif
--- /dev/null
+/*
+ * Generated by gen-yagl-calls.py, do not modify!
+ */
+#include "yagl_host_egl_calls.h"
+#include "yagl_transport_egl.h"
+#include "yagl_state.h"
+#include <assert.h>
+
+/*
+ * eglGetDisplay wrapper. id = 1
+ */
+yagl_host_handle yagl_host_eglGetDisplay(uint32_t display_id, EGLint *error)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ yagl_host_handle retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_egl, 1, 5 * 8, 5 * 8);
+ yagl_transport_put_out_uint32_t(t, display_id);
+ yagl_transport_put_in_EGLint(t, error);
+ yagl_transport_put_in_yagl_host_handle(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
+
+/*
+ * eglInitialize wrapper. id = 2
+ */
+EGLBoolean yagl_host_eglInitialize(yagl_host_handle dpy, EGLint *major, EGLint *minor, EGLint *error)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ EGLBoolean retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_egl, 2, 9 * 8, 9 * 8);
+ yagl_transport_put_out_yagl_host_handle(t, dpy);
+ yagl_transport_put_in_EGLint(t, major);
+ yagl_transport_put_in_EGLint(t, minor);
+ yagl_transport_put_in_EGLint(t, error);
+ yagl_transport_put_in_EGLBoolean(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
+
+/*
+ * eglTerminate wrapper. id = 3
+ */
+EGLBoolean yagl_host_eglTerminate(yagl_host_handle dpy, EGLint *error)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ EGLBoolean retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_egl, 3, 5 * 8, 5 * 8);
+ yagl_transport_put_out_yagl_host_handle(t, dpy);
+ yagl_transport_put_in_EGLint(t, error);
+ yagl_transport_put_in_EGLBoolean(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
+
+/*
+ * eglGetConfigs wrapper. id = 4
+ */
+EGLBoolean yagl_host_eglGetConfigs(yagl_host_handle dpy, yagl_host_handle *configs, int32_t configs_maxcount, int32_t *configs_count, EGLint *error)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ EGLBoolean retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_egl, 4, 7 * 8, 5 * 8 + yagl_transport_array_size(configs, configs_maxcount, sizeof(yagl_host_handle)));
+ yagl_transport_put_out_yagl_host_handle(t, dpy);
+ yagl_transport_put_in_array(t, configs, configs_maxcount, configs_count, sizeof(yagl_host_handle));
+ yagl_transport_put_in_EGLint(t, error);
+ yagl_transport_put_in_EGLBoolean(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
+
+/*
+ * eglChooseConfig wrapper. id = 5
+ */
+EGLBoolean yagl_host_eglChooseConfig(yagl_host_handle dpy, const EGLint *attrib_list, int32_t attrib_list_count, yagl_host_handle *configs, int32_t configs_maxcount, int32_t *configs_count, EGLint *error)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ EGLBoolean retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_egl, 5, 9 * 8, 5 * 8 + yagl_transport_array_size(attrib_list, attrib_list_count, sizeof(EGLint)) + yagl_transport_array_size(configs, configs_maxcount, sizeof(yagl_host_handle)));
+ yagl_transport_put_out_yagl_host_handle(t, dpy);
+ yagl_transport_put_out_array(t, attrib_list, attrib_list_count, sizeof(EGLint));
+ yagl_transport_put_in_array(t, configs, configs_maxcount, configs_count, sizeof(yagl_host_handle));
+ yagl_transport_put_in_EGLint(t, error);
+ yagl_transport_put_in_EGLBoolean(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
+
+/*
+ * eglGetConfigAttrib wrapper. id = 6
+ */
+EGLBoolean yagl_host_eglGetConfigAttrib(yagl_host_handle dpy, yagl_host_handle config, EGLint attribute, EGLint *value, EGLint *error)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ EGLBoolean retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_egl, 6, 9 * 8, 9 * 8);
+ yagl_transport_put_out_yagl_host_handle(t, dpy);
+ yagl_transport_put_out_yagl_host_handle(t, config);
+ yagl_transport_put_out_EGLint(t, attribute);
+ yagl_transport_put_in_EGLint(t, value);
+ yagl_transport_put_in_EGLint(t, error);
+ yagl_transport_put_in_EGLBoolean(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
+
+/*
+ * eglDestroySurface wrapper. id = 7
+ */
+EGLBoolean yagl_host_eglDestroySurface(yagl_host_handle dpy, yagl_host_handle surface, EGLint *error)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ EGLBoolean retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_egl, 7, 6 * 8, 6 * 8);
+ yagl_transport_put_out_yagl_host_handle(t, dpy);
+ yagl_transport_put_out_yagl_host_handle(t, surface);
+ yagl_transport_put_in_EGLint(t, error);
+ yagl_transport_put_in_EGLBoolean(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
+
+/*
+ * eglQuerySurface wrapper. id = 8
+ */
+EGLBoolean yagl_host_eglQuerySurface(yagl_host_handle dpy, yagl_host_handle surface, EGLint attribute, EGLint *value, EGLint *error)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ EGLBoolean retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_egl, 8, 9 * 8, 9 * 8);
+ yagl_transport_put_out_yagl_host_handle(t, dpy);
+ yagl_transport_put_out_yagl_host_handle(t, surface);
+ yagl_transport_put_out_EGLint(t, attribute);
+ yagl_transport_put_in_EGLint(t, value);
+ yagl_transport_put_in_EGLint(t, error);
+ yagl_transport_put_in_EGLBoolean(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
+
+/*
+ * eglBindAPI wrapper. id = 9
+ */
+void yagl_host_eglBindAPI(EGLenum api)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_egl, 9, 1 * 8, 1 * 8);
+ yagl_transport_put_out_EGLenum(t, api);
+ yagl_transport_end(t);
+}
+
+/*
+ * eglWaitClient wrapper. id = 10
+ */
+void yagl_host_eglWaitClient()
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_egl, 10, 0 * 8, 0 * 8);
+ yagl_transport_end(t);
+ yagl_transport_flush(t, NULL);
+}
+
+/*
+ * eglReleaseThread wrapper. id = 11
+ */
+EGLBoolean yagl_host_eglReleaseThread(EGLint *error)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ EGLBoolean retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_egl, 11, 4 * 8, 4 * 8);
+ yagl_transport_put_in_EGLint(t, error);
+ yagl_transport_put_in_EGLBoolean(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
+
+/*
+ * eglSurfaceAttrib wrapper. id = 12
+ */
+EGLBoolean yagl_host_eglSurfaceAttrib(yagl_host_handle dpy, yagl_host_handle surface, EGLint attribute, EGLint value, EGLint *error)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ EGLBoolean retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_egl, 12, 8 * 8, 8 * 8);
+ yagl_transport_put_out_yagl_host_handle(t, dpy);
+ yagl_transport_put_out_yagl_host_handle(t, surface);
+ yagl_transport_put_out_EGLint(t, attribute);
+ yagl_transport_put_out_EGLint(t, value);
+ yagl_transport_put_in_EGLint(t, error);
+ yagl_transport_put_in_EGLBoolean(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
+
+/*
+ * eglCreateContext wrapper. id = 13
+ */
+yagl_host_handle yagl_host_eglCreateContext(yagl_host_handle dpy, yagl_host_handle config, yagl_host_handle share_context, const EGLint *attrib_list, int32_t attrib_list_count, EGLint *error)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ yagl_host_handle retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_egl, 13, 9 * 8, 7 * 8 + yagl_transport_array_size(attrib_list, attrib_list_count, sizeof(EGLint)));
+ yagl_transport_put_out_yagl_host_handle(t, dpy);
+ yagl_transport_put_out_yagl_host_handle(t, config);
+ yagl_transport_put_out_yagl_host_handle(t, share_context);
+ yagl_transport_put_out_array(t, attrib_list, attrib_list_count, sizeof(EGLint));
+ yagl_transport_put_in_EGLint(t, error);
+ yagl_transport_put_in_yagl_host_handle(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
+
+/*
+ * eglDestroyContext wrapper. id = 14
+ */
+EGLBoolean yagl_host_eglDestroyContext(yagl_host_handle dpy, yagl_host_handle ctx, EGLint *error)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ EGLBoolean retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_egl, 14, 6 * 8, 6 * 8);
+ yagl_transport_put_out_yagl_host_handle(t, dpy);
+ yagl_transport_put_out_yagl_host_handle(t, ctx);
+ yagl_transport_put_in_EGLint(t, error);
+ yagl_transport_put_in_EGLBoolean(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
+
+/*
+ * eglMakeCurrent wrapper. id = 15
+ */
+void yagl_host_eglMakeCurrent(yagl_host_handle dpy, yagl_host_handle draw, yagl_host_handle read, yagl_host_handle ctx)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_egl, 15, 4 * 8, 4 * 8);
+ yagl_transport_put_out_yagl_host_handle(t, dpy);
+ yagl_transport_put_out_yagl_host_handle(t, draw);
+ yagl_transport_put_out_yagl_host_handle(t, read);
+ yagl_transport_put_out_yagl_host_handle(t, ctx);
+ yagl_transport_end(t);
+}
+
+/*
+ * eglQueryContext wrapper. id = 16
+ */
+EGLBoolean yagl_host_eglQueryContext(yagl_host_handle dpy, yagl_host_handle ctx, EGLint attribute, EGLint *value, EGLint *error)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ EGLBoolean retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_egl, 16, 9 * 8, 9 * 8);
+ yagl_transport_put_out_yagl_host_handle(t, dpy);
+ yagl_transport_put_out_yagl_host_handle(t, ctx);
+ yagl_transport_put_out_EGLint(t, attribute);
+ yagl_transport_put_in_EGLint(t, value);
+ yagl_transport_put_in_EGLint(t, error);
+ yagl_transport_put_in_EGLBoolean(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
+
+/*
+ * eglSwapBuffers wrapper. id = 17
+ */
+void yagl_host_eglSwapBuffers(yagl_host_handle dpy, yagl_host_handle surface)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_egl, 17, 2 * 8, 2 * 8);
+ yagl_transport_put_out_yagl_host_handle(t, dpy);
+ yagl_transport_put_out_yagl_host_handle(t, surface);
+ yagl_transport_end(t);
+ yagl_transport_flush(t, NULL);
+}
+
+/*
+ * eglCopyBuffers wrapper. id = 18
+ */
+void yagl_host_eglCopyBuffers(yagl_host_handle dpy, yagl_host_handle surface)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_egl, 18, 2 * 8, 2 * 8);
+ yagl_transport_put_out_yagl_host_handle(t, dpy);
+ yagl_transport_put_out_yagl_host_handle(t, surface);
+ yagl_transport_end(t);
+ yagl_transport_flush(t, NULL);
+}
+
+/*
+ * eglCreateWindowSurfaceOffscreenYAGL wrapper. id = 19
+ */
+yagl_host_handle yagl_host_eglCreateWindowSurfaceOffscreenYAGL(yagl_host_handle dpy, yagl_host_handle config, uint32_t width, uint32_t height, uint32_t bpp, void *pixels, const EGLint *attrib_list, int32_t attrib_list_count, EGLint *error)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ yagl_host_handle retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_egl, 19, 12 * 8, 10 * 8 + yagl_transport_array_size(attrib_list, attrib_list_count, sizeof(EGLint)));
+ yagl_transport_put_out_yagl_host_handle(t, dpy);
+ yagl_transport_put_out_yagl_host_handle(t, config);
+ yagl_transport_put_out_uint32_t(t, width);
+ yagl_transport_put_out_uint32_t(t, height);
+ yagl_transport_put_out_uint32_t(t, bpp);
+ yagl_transport_put_out_va(t, pixels);
+ yagl_transport_put_out_array(t, attrib_list, attrib_list_count, sizeof(EGLint));
+ yagl_transport_put_in_EGLint(t, error);
+ yagl_transport_put_in_yagl_host_handle(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
+
+/*
+ * eglCreatePbufferSurfaceOffscreenYAGL wrapper. id = 20
+ */
+yagl_host_handle yagl_host_eglCreatePbufferSurfaceOffscreenYAGL(yagl_host_handle dpy, yagl_host_handle config, uint32_t width, uint32_t height, uint32_t bpp, void *pixels, const EGLint *attrib_list, int32_t attrib_list_count, EGLint *error)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ yagl_host_handle retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_egl, 20, 12 * 8, 10 * 8 + yagl_transport_array_size(attrib_list, attrib_list_count, sizeof(EGLint)));
+ yagl_transport_put_out_yagl_host_handle(t, dpy);
+ yagl_transport_put_out_yagl_host_handle(t, config);
+ yagl_transport_put_out_uint32_t(t, width);
+ yagl_transport_put_out_uint32_t(t, height);
+ yagl_transport_put_out_uint32_t(t, bpp);
+ yagl_transport_put_out_va(t, pixels);
+ yagl_transport_put_out_array(t, attrib_list, attrib_list_count, sizeof(EGLint));
+ yagl_transport_put_in_EGLint(t, error);
+ yagl_transport_put_in_yagl_host_handle(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
+
+/*
+ * eglCreatePixmapSurfaceOffscreenYAGL wrapper. id = 21
+ */
+yagl_host_handle yagl_host_eglCreatePixmapSurfaceOffscreenYAGL(yagl_host_handle dpy, yagl_host_handle config, uint32_t width, uint32_t height, uint32_t bpp, void *pixels, const EGLint *attrib_list, int32_t attrib_list_count, EGLint *error)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ yagl_host_handle retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_egl, 21, 12 * 8, 10 * 8 + yagl_transport_array_size(attrib_list, attrib_list_count, sizeof(EGLint)));
+ yagl_transport_put_out_yagl_host_handle(t, dpy);
+ yagl_transport_put_out_yagl_host_handle(t, config);
+ yagl_transport_put_out_uint32_t(t, width);
+ yagl_transport_put_out_uint32_t(t, height);
+ yagl_transport_put_out_uint32_t(t, bpp);
+ yagl_transport_put_out_va(t, pixels);
+ yagl_transport_put_out_array(t, attrib_list, attrib_list_count, sizeof(EGLint));
+ yagl_transport_put_in_EGLint(t, error);
+ yagl_transport_put_in_yagl_host_handle(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
+
+/*
+ * eglResizeOffscreenSurfaceYAGL wrapper. id = 22
+ */
+EGLBoolean yagl_host_eglResizeOffscreenSurfaceYAGL(yagl_host_handle dpy, yagl_host_handle surface, uint32_t width, uint32_t height, uint32_t bpp, void *pixels, EGLint *error)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ EGLBoolean retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_egl, 22, 10 * 8, 10 * 8);
+ yagl_transport_put_out_yagl_host_handle(t, dpy);
+ yagl_transport_put_out_yagl_host_handle(t, surface);
+ yagl_transport_put_out_uint32_t(t, width);
+ yagl_transport_put_out_uint32_t(t, height);
+ yagl_transport_put_out_uint32_t(t, bpp);
+ yagl_transport_put_out_va(t, pixels);
+ yagl_transport_put_in_EGLint(t, error);
+ yagl_transport_put_in_EGLBoolean(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
+
+/*
+ * eglCreateWindowSurfaceOnscreenYAGL wrapper. id = 23
+ */
+yagl_host_handle yagl_host_eglCreateWindowSurfaceOnscreenYAGL(yagl_host_handle dpy, yagl_host_handle config, yagl_winsys_id win, const EGLint *attrib_list, int32_t attrib_list_count, EGLint *error)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ yagl_host_handle retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_egl, 23, 9 * 8, 7 * 8 + yagl_transport_array_size(attrib_list, attrib_list_count, sizeof(EGLint)));
+ yagl_transport_put_out_yagl_host_handle(t, dpy);
+ yagl_transport_put_out_yagl_host_handle(t, config);
+ yagl_transport_put_out_yagl_winsys_id(t, win);
+ yagl_transport_put_out_array(t, attrib_list, attrib_list_count, sizeof(EGLint));
+ yagl_transport_put_in_EGLint(t, error);
+ yagl_transport_put_in_yagl_host_handle(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
+
+/*
+ * eglCreatePbufferSurfaceOnscreenYAGL wrapper. id = 24
+ */
+yagl_host_handle yagl_host_eglCreatePbufferSurfaceOnscreenYAGL(yagl_host_handle dpy, yagl_host_handle config, yagl_winsys_id buffer, const EGLint *attrib_list, int32_t attrib_list_count, EGLint *error)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ yagl_host_handle retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_egl, 24, 9 * 8, 7 * 8 + yagl_transport_array_size(attrib_list, attrib_list_count, sizeof(EGLint)));
+ yagl_transport_put_out_yagl_host_handle(t, dpy);
+ yagl_transport_put_out_yagl_host_handle(t, config);
+ yagl_transport_put_out_yagl_winsys_id(t, buffer);
+ yagl_transport_put_out_array(t, attrib_list, attrib_list_count, sizeof(EGLint));
+ yagl_transport_put_in_EGLint(t, error);
+ yagl_transport_put_in_yagl_host_handle(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
+
+/*
+ * eglCreatePixmapSurfaceOnscreenYAGL wrapper. id = 25
+ */
+yagl_host_handle yagl_host_eglCreatePixmapSurfaceOnscreenYAGL(yagl_host_handle dpy, yagl_host_handle config, yagl_winsys_id pixmap, const EGLint *attrib_list, int32_t attrib_list_count, EGLint *error)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ yagl_host_handle retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_egl, 25, 9 * 8, 7 * 8 + yagl_transport_array_size(attrib_list, attrib_list_count, sizeof(EGLint)));
+ yagl_transport_put_out_yagl_host_handle(t, dpy);
+ yagl_transport_put_out_yagl_host_handle(t, config);
+ yagl_transport_put_out_yagl_winsys_id(t, pixmap);
+ yagl_transport_put_out_array(t, attrib_list, attrib_list_count, sizeof(EGLint));
+ yagl_transport_put_in_EGLint(t, error);
+ yagl_transport_put_in_yagl_host_handle(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
+
+/*
+ * eglInvalidateOnscreenSurfaceYAGL wrapper. id = 26
+ */
+void yagl_host_eglInvalidateOnscreenSurfaceYAGL(yagl_host_handle dpy, yagl_host_handle surface, yagl_winsys_id buffer)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_egl, 26, 3 * 8, 3 * 8);
+ yagl_transport_put_out_yagl_host_handle(t, dpy);
+ yagl_transport_put_out_yagl_host_handle(t, surface);
+ yagl_transport_put_out_yagl_winsys_id(t, buffer);
+ yagl_transport_end(t);
+ yagl_transport_flush(t, NULL);
+}
+
+/*
+ * eglCreateImageYAGL wrapper. id = 27
+ */
+EGLBoolean yagl_host_eglCreateImageYAGL(uint32_t texture, yagl_host_handle dpy, yagl_winsys_id buffer, EGLint *error)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ EGLBoolean retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_egl, 27, 7 * 8, 7 * 8);
+ yagl_transport_put_out_uint32_t(t, texture);
+ yagl_transport_put_out_yagl_host_handle(t, dpy);
+ yagl_transport_put_out_yagl_winsys_id(t, buffer);
+ yagl_transport_put_in_EGLint(t, error);
+ yagl_transport_put_in_EGLBoolean(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
--- /dev/null
+/*
+ * Generated by gen-yagl-calls.py, do not modify!
+ */
+#ifndef _YAGL_HOST_EGL_CALLS_H_
+#define _YAGL_HOST_EGL_CALLS_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+#include "EGL/egl.h"
+
+/*
+ * eglGetDisplay wrapper. id = 1
+ */
+yagl_host_handle yagl_host_eglGetDisplay(uint32_t display_id, EGLint *error);
+
+/*
+ * eglInitialize wrapper. id = 2
+ */
+EGLBoolean yagl_host_eglInitialize(yagl_host_handle dpy, EGLint *major, EGLint *minor, EGLint *error);
+
+/*
+ * eglTerminate wrapper. id = 3
+ */
+EGLBoolean yagl_host_eglTerminate(yagl_host_handle dpy, EGLint *error);
+
+/*
+ * eglGetConfigs wrapper. id = 4
+ */
+EGLBoolean yagl_host_eglGetConfigs(yagl_host_handle dpy, yagl_host_handle *configs, int32_t configs_maxcount, int32_t *configs_count, EGLint *error);
+
+/*
+ * eglChooseConfig wrapper. id = 5
+ */
+EGLBoolean yagl_host_eglChooseConfig(yagl_host_handle dpy, const EGLint *attrib_list, int32_t attrib_list_count, yagl_host_handle *configs, int32_t configs_maxcount, int32_t *configs_count, EGLint *error);
+
+/*
+ * eglGetConfigAttrib wrapper. id = 6
+ */
+EGLBoolean yagl_host_eglGetConfigAttrib(yagl_host_handle dpy, yagl_host_handle config, EGLint attribute, EGLint *value, EGLint *error);
+
+/*
+ * eglDestroySurface wrapper. id = 7
+ */
+EGLBoolean yagl_host_eglDestroySurface(yagl_host_handle dpy, yagl_host_handle surface, EGLint *error);
+
+/*
+ * eglQuerySurface wrapper. id = 8
+ */
+EGLBoolean yagl_host_eglQuerySurface(yagl_host_handle dpy, yagl_host_handle surface, EGLint attribute, EGLint *value, EGLint *error);
+
+/*
+ * eglBindAPI wrapper. id = 9
+ */
+void yagl_host_eglBindAPI(EGLenum api);
+
+/*
+ * eglWaitClient wrapper. id = 10
+ */
+void yagl_host_eglWaitClient();
+
+/*
+ * eglReleaseThread wrapper. id = 11
+ */
+EGLBoolean yagl_host_eglReleaseThread(EGLint *error);
+
+/*
+ * eglSurfaceAttrib wrapper. id = 12
+ */
+EGLBoolean yagl_host_eglSurfaceAttrib(yagl_host_handle dpy, yagl_host_handle surface, EGLint attribute, EGLint value, EGLint *error);
+
+/*
+ * eglCreateContext wrapper. id = 13
+ */
+yagl_host_handle yagl_host_eglCreateContext(yagl_host_handle dpy, yagl_host_handle config, yagl_host_handle share_context, const EGLint *attrib_list, int32_t attrib_list_count, EGLint *error);
+
+/*
+ * eglDestroyContext wrapper. id = 14
+ */
+EGLBoolean yagl_host_eglDestroyContext(yagl_host_handle dpy, yagl_host_handle ctx, EGLint *error);
+
+/*
+ * eglMakeCurrent wrapper. id = 15
+ */
+void yagl_host_eglMakeCurrent(yagl_host_handle dpy, yagl_host_handle draw, yagl_host_handle read, yagl_host_handle ctx);
+
+/*
+ * eglQueryContext wrapper. id = 16
+ */
+EGLBoolean yagl_host_eglQueryContext(yagl_host_handle dpy, yagl_host_handle ctx, EGLint attribute, EGLint *value, EGLint *error);
+
+/*
+ * eglSwapBuffers wrapper. id = 17
+ */
+void yagl_host_eglSwapBuffers(yagl_host_handle dpy, yagl_host_handle surface);
+
+/*
+ * eglCopyBuffers wrapper. id = 18
+ */
+void yagl_host_eglCopyBuffers(yagl_host_handle dpy, yagl_host_handle surface);
+
+/*
+ * eglCreateWindowSurfaceOffscreenYAGL wrapper. id = 19
+ */
+yagl_host_handle yagl_host_eglCreateWindowSurfaceOffscreenYAGL(yagl_host_handle dpy, yagl_host_handle config, uint32_t width, uint32_t height, uint32_t bpp, void *pixels, const EGLint *attrib_list, int32_t attrib_list_count, EGLint *error);
+
+/*
+ * eglCreatePbufferSurfaceOffscreenYAGL wrapper. id = 20
+ */
+yagl_host_handle yagl_host_eglCreatePbufferSurfaceOffscreenYAGL(yagl_host_handle dpy, yagl_host_handle config, uint32_t width, uint32_t height, uint32_t bpp, void *pixels, const EGLint *attrib_list, int32_t attrib_list_count, EGLint *error);
+
+/*
+ * eglCreatePixmapSurfaceOffscreenYAGL wrapper. id = 21
+ */
+yagl_host_handle yagl_host_eglCreatePixmapSurfaceOffscreenYAGL(yagl_host_handle dpy, yagl_host_handle config, uint32_t width, uint32_t height, uint32_t bpp, void *pixels, const EGLint *attrib_list, int32_t attrib_list_count, EGLint *error);
+
+/*
+ * eglResizeOffscreenSurfaceYAGL wrapper. id = 22
+ */
+EGLBoolean yagl_host_eglResizeOffscreenSurfaceYAGL(yagl_host_handle dpy, yagl_host_handle surface, uint32_t width, uint32_t height, uint32_t bpp, void *pixels, EGLint *error);
+
+/*
+ * eglCreateWindowSurfaceOnscreenYAGL wrapper. id = 23
+ */
+yagl_host_handle yagl_host_eglCreateWindowSurfaceOnscreenYAGL(yagl_host_handle dpy, yagl_host_handle config, yagl_winsys_id win, const EGLint *attrib_list, int32_t attrib_list_count, EGLint *error);
+
+/*
+ * eglCreatePbufferSurfaceOnscreenYAGL wrapper. id = 24
+ */
+yagl_host_handle yagl_host_eglCreatePbufferSurfaceOnscreenYAGL(yagl_host_handle dpy, yagl_host_handle config, yagl_winsys_id buffer, const EGLint *attrib_list, int32_t attrib_list_count, EGLint *error);
+
+/*
+ * eglCreatePixmapSurfaceOnscreenYAGL wrapper. id = 25
+ */
+yagl_host_handle yagl_host_eglCreatePixmapSurfaceOnscreenYAGL(yagl_host_handle dpy, yagl_host_handle config, yagl_winsys_id pixmap, const EGLint *attrib_list, int32_t attrib_list_count, EGLint *error);
+
+/*
+ * eglInvalidateOnscreenSurfaceYAGL wrapper. id = 26
+ */
+void yagl_host_eglInvalidateOnscreenSurfaceYAGL(yagl_host_handle dpy, yagl_host_handle surface, yagl_winsys_id buffer);
+
+/*
+ * eglCreateImageYAGL wrapper. id = 27
+ */
+EGLBoolean yagl_host_eglCreateImageYAGL(uint32_t texture, yagl_host_handle dpy, yagl_winsys_id buffer, EGLint *error);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_image.h"
+#include "yagl_native_drawable.h"
+#include "yagl_client_image.h"
+
+void yagl_image_init(struct yagl_image *image,
+ yagl_ref_destroy_func destroy_func,
+ struct yagl_display *dpy,
+ EGLImageKHR client_handle,
+ struct yagl_client_image *client_image)
+{
+ yagl_resource_init(&image->res, destroy_func, 0);
+
+ image->dpy = dpy;
+ image->client_handle = client_handle;
+ image->client_image = client_image;
+
+ yagl_client_image_acquire(client_image);
+}
+
+void yagl_image_cleanup(struct yagl_image *image)
+{
+ yagl_client_image_release(image->client_image);
+
+ yagl_resource_cleanup(&image->res);
+}
+
+void yagl_image_acquire(struct yagl_image *image)
+{
+ if (image) {
+ yagl_resource_acquire(&image->res);
+ }
+}
+
+void yagl_image_release(struct yagl_image *image)
+{
+ if (image) {
+ yagl_resource_release(&image->res);
+ }
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_IMAGE_H_
+#define _YAGL_IMAGE_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+#include "yagl_resource.h"
+#include "EGL/egl.h"
+#include "EGL/eglext.h"
+#include "GLES2/gl2.h"
+#include "GLES2/gl2ext.h"
+
+struct yagl_display;
+struct yagl_client_image;
+
+struct yagl_image
+{
+ struct yagl_resource res;
+
+ struct yagl_display *dpy;
+
+ EGLImageKHR client_handle;
+
+ struct yagl_client_image *client_image;
+
+ void (*update)(struct yagl_image */*image*/);
+};
+
+void yagl_image_init(struct yagl_image *image,
+ yagl_ref_destroy_func destroy_func,
+ struct yagl_display *dpy,
+ EGLImageKHR client_handle,
+ struct yagl_client_image *client_image);
+
+void yagl_image_cleanup(struct yagl_image *image);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_image_acquire(struct yagl_image *image);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_image_release(struct yagl_image *image);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_log.h"
+#include "yagl_utils.h"
+#include "yagl_malloc.h"
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <inttypes.h>
+#include <pthread.h>
+#include <sys/time.h>
+
+static char *my_strndup(const char *str, size_t len)
+{
+ size_t n;
+ char *dst;
+
+ n = strlen(str);
+ if (len < n) {
+ n = len;
+ }
+
+ dst = yagl_malloc(n + 1);
+
+ memcpy(dst, str, n);
+ dst[n] = '\0';
+
+ return dst;
+}
+
+static const char* g_log_level_to_str[yagl_log_level_max + 1] =
+{
+ "OFF",
+ "ERROR",
+ "WARN",
+ "INFO",
+ "DEBUG",
+ "TRACE"
+};
+
+static struct
+{
+ const char* datatype;
+ const char* format;
+} g_datatype_to_format[] =
+{
+ { "EGLboolean", "%u" },
+ { "EGLenum", "%u" },
+ { "EGLint", "%d" },
+ { "EGLConfig", "%p" },
+ { "EGLContext", "%p" },
+ { "EGLDisplay", "%p" },
+ { "EGLSurface", "%p" },
+ { "EGLClientBuffer", "%p" },
+ { "EGLNativeDisplayType", "%p" },
+ { "yagl_host_handle", "%u" },
+ { "int", "%d" },
+ { "GLenum", "%u" },
+ { "GLuint", "%u" },
+ { "GLbitfield", "%u" },
+ { "GLclampf", "%f" },
+ { "GLfloat", "%f" },
+ { "GLint", "%d" },
+ { "GLsizei", "%d" },
+ { "GLclampx", "%d" },
+ { "GLfixed", "%d" },
+ { "GLboolean", "%" PRIu8 },
+ { "GLchar", "%" PRIi8 },
+ { "GLintptr", "%ld" },
+ { "GLsizeiptr", "%ld" },
+ { "GLeglImageOES", "%p" },
+ { "GLsync", "%p" }
+};
+
+static pthread_once_t g_log_init = PTHREAD_ONCE_INIT;
+static yagl_log_level g_log_level = yagl_log_level_off;
+static char** g_log_facilities_match = NULL;
+static char** g_log_facilities_no_match = NULL;
+static int g_log_func_trace = 0;
+static pthread_mutex_t g_log_mutex;
+
+static const char* yagl_log_datatype_to_format(const char* type)
+{
+ unsigned int i;
+
+ if (strchr(type, '*'))
+ {
+ return "%p";
+ }
+
+ for (i = 0; i < sizeof(g_datatype_to_format)/sizeof(g_datatype_to_format[0]); ++i)
+ {
+ if (strcmp(g_datatype_to_format[i].datatype, type) == 0)
+ {
+ return g_datatype_to_format[i].format;
+ }
+ }
+
+ return NULL;
+}
+
+static void yagl_log_print_current_time(void)
+{
+ char buff[128];
+ struct tm tm;
+ struct timeval tv = { 0, 0 };
+ time_t ti;
+
+ gettimeofday(&tv, NULL);
+
+ ti = tv.tv_sec;
+
+ localtime_r(&ti, &tm);
+ strftime(buff, sizeof(buff),
+ "%H:%M:%S", &tm);
+ fprintf(stderr, "%s", buff);
+}
+
+/*
+ * Simple asterisk pattern matcher.
+ */
+static int yagl_log_match(const char* str, const char* expr)
+{
+ while (*str && *expr)
+ {
+ /*
+ * Swallow '**'.
+ */
+
+ while ((*expr == '*') &&
+ (*(expr + 1) == '*'))
+ {
+ ++expr;
+ }
+
+ if (*expr == '*')
+ {
+ if (!*(expr + 1))
+ {
+ /*
+ * Last '*' always matches.
+ */
+
+ return 1;
+ }
+
+ /*
+ * Search for symbol after the asterisk.
+ */
+
+ while (*str && (*str != *(expr + 1)))
+ {
+ ++str;
+ }
+
+ if (!*str)
+ {
+ /*
+ * Reached the end, didn't find symbol following asterisk,
+ * no match.
+ */
+
+ return 0;
+ }
+
+ /*
+ * Jump to the symbol after the one that's after asterisk.
+ */
+
+ ++str;
+ expr += 2;
+ }
+ else
+ {
+ /*
+ * No asterisk, exact match.
+ */
+
+ if (*str != *expr)
+ {
+ return 0;
+ }
+
+ ++str;
+ ++expr;
+ }
+ }
+
+ /*
+ * Remaining '*' always match.
+ */
+
+ while (*expr == '*')
+ {
+ ++expr;
+ }
+
+ return (*str == 0) && (*expr == 0);
+}
+
+static void yagl_log_init_once(void)
+{
+ char* level_str = getenv("YAGL_DEBUG");
+ int level = level_str ? atoi(level_str) : yagl_log_level_off;
+ char* facilities;
+ char* func_trace;
+
+ yagl_mutex_init(&g_log_mutex);
+
+ if (level < 0)
+ {
+ g_log_level = yagl_log_level_off;
+ }
+ else if (level > yagl_log_level_max)
+ {
+ g_log_level = (yagl_log_level)yagl_log_level_max;
+ }
+ else
+ {
+ g_log_level = (yagl_log_level)level;
+ }
+
+ facilities = getenv("YAGL_DEBUG_FACILITIES");
+
+ if (facilities)
+ {
+ char* tmp_facilities = facilities;
+ int i = 0, num_match = 0, num_no_match = 0;
+
+ while (1)
+ {
+ char* tmp = strchr(tmp_facilities, ',');
+
+ if (!tmp)
+ {
+ break;
+ }
+
+ if (tmp - tmp_facilities > 0)
+ {
+ ++i;
+ }
+
+ tmp_facilities = tmp + 1;
+ }
+
+ if (strlen(tmp_facilities) > 0)
+ {
+ ++i;
+ }
+
+ g_log_facilities_match = yagl_malloc0((i + 1) * sizeof(char*));
+ g_log_facilities_no_match = yagl_malloc0((i + 1) * sizeof(char*));
+
+ tmp_facilities = facilities;
+
+ while (1)
+ {
+ char* tmp = strchr(tmp_facilities, ',');
+
+ if (!tmp)
+ {
+ break;
+ }
+
+ if (tmp - tmp_facilities > 0)
+ {
+ if (*tmp_facilities == '^')
+ {
+ if ((tmp - tmp_facilities - 1) > 0)
+ {
+ g_log_facilities_no_match[num_no_match] = my_strndup(tmp_facilities + 1, tmp - tmp_facilities - 1);
+ ++num_no_match;
+ }
+ }
+ else
+ {
+ g_log_facilities_match[num_match] = my_strndup(tmp_facilities, tmp - tmp_facilities);
+ ++num_match;
+ }
+ }
+
+ tmp_facilities = tmp + 1;
+ }
+
+ if (strlen(tmp_facilities) > 0)
+ {
+ if (*tmp_facilities == '^')
+ {
+ if ((strlen(tmp_facilities) - 1) > 0)
+ {
+ g_log_facilities_no_match[num_no_match] = strdup(tmp_facilities + 1);
+ ++num_no_match;
+ }
+ }
+ else
+ {
+ g_log_facilities_match[num_match] = strdup(tmp_facilities);
+ ++num_match;
+ }
+ }
+
+ g_log_facilities_no_match[num_no_match] = NULL;
+ g_log_facilities_match[num_match] = NULL;
+
+ if (!num_no_match)
+ {
+ yagl_free(g_log_facilities_no_match);
+ g_log_facilities_no_match = NULL;
+ }
+
+ if (!num_match)
+ {
+ yagl_free(g_log_facilities_match);
+ g_log_facilities_match = NULL;
+ }
+ }
+
+ func_trace = getenv("YAGL_DEBUG_FUNC_TRACE");
+
+ g_log_func_trace = func_trace ? (atoi(func_trace) > 0) : 0;
+}
+
+void yagl_log_init(void)
+{
+ pthread_once(&g_log_init, yagl_log_init_once);
+}
+
+void yagl_log_event(yagl_log_level log_level,
+ pid_t process_id,
+ pid_t thread_id,
+ const char* facility,
+ int line,
+ const char* format, ...)
+{
+ va_list args;
+
+ yagl_log_init();
+
+ pthread_mutex_lock(&g_log_mutex);
+
+ yagl_log_print_current_time();
+ fprintf(stderr,
+ " %-5s [%u/%u] %s:%d",
+ g_log_level_to_str[log_level],
+ process_id,
+ thread_id,
+ facility,
+ line);
+ if (format)
+ {
+ va_start(args, format);
+ fprintf(stderr, " - ");
+ vfprintf(stderr, format, args);
+ va_end(args);
+ }
+ fprintf(stderr, "\n");
+
+ pthread_mutex_unlock(&g_log_mutex);
+}
+
+void yagl_log_func_enter(pid_t process_id,
+ pid_t thread_id,
+ const char* func,
+ int line,
+ const char* format, ...)
+{
+ va_list args;
+
+ yagl_log_init();
+
+ pthread_mutex_lock(&g_log_mutex);
+
+ yagl_log_print_current_time();
+ fprintf(stderr,
+ " %-5s [%u/%u] {{{ %s(",
+ g_log_level_to_str[yagl_log_level_trace],
+ process_id,
+ thread_id,
+ func);
+ if (format)
+ {
+ va_start(args, format);
+ vfprintf(stderr, format, args);
+ va_end(args);
+ }
+ fprintf(stderr, "):%d\n", line);
+
+ pthread_mutex_unlock(&g_log_mutex);
+}
+
+void yagl_log_func_exit(pid_t process_id,
+ pid_t thread_id,
+ const char* func,
+ int line,
+ const char* format, ...)
+{
+ va_list args;
+
+ yagl_log_init();
+
+ pthread_mutex_lock(&g_log_mutex);
+
+ yagl_log_print_current_time();
+ fprintf(stderr,
+ " %-5s [%u/%u] }}} %s:%d",
+ g_log_level_to_str[yagl_log_level_trace],
+ process_id,
+ thread_id,
+ func,
+ line);
+ if (format)
+ {
+ va_start(args, format);
+ fprintf(stderr, " = ");
+ vfprintf(stderr, format, args);
+ va_end(args);
+ }
+ fprintf(stderr, "\n");
+
+ pthread_mutex_unlock(&g_log_mutex);
+}
+
+void yagl_log_func_enter_split(pid_t process_id,
+ pid_t thread_id,
+ const char* func,
+ int line,
+ int num_args, ...)
+{
+ char format[1025] = { '\0' };
+ va_list args;
+
+ yagl_log_init();
+
+ pthread_mutex_lock(&g_log_mutex);
+
+ yagl_log_print_current_time();
+ fprintf(stderr,
+ " %-5s [%u/%u] {{{ %s(",
+ g_log_level_to_str[yagl_log_level_trace],
+ process_id,
+ thread_id,
+ func);
+
+ if (num_args > 0)
+ {
+ int i, skip = 0;
+
+ va_start(args, num_args);
+
+ for (i = 0; i < num_args;)
+ {
+ const char* arg_format = yagl_log_datatype_to_format(va_arg(args, const char*));
+ const char* arg_name;
+
+ if (!arg_format)
+ {
+ skip = 1;
+ break;
+ }
+
+ arg_name = va_arg(args, const char*);
+
+ strcat(format, arg_name);
+ strcat(format, " = ");
+ strcat(format, arg_format);
+
+ ++i;
+
+ if (i < num_args)
+ {
+ strcat(format, ", ");
+ }
+ }
+
+ if (skip)
+ {
+ fprintf(stderr, "...");
+ }
+ else
+ {
+ vfprintf(stderr, format, args);
+ }
+
+ va_end(args);
+ }
+
+ fprintf(stderr, "):%d\n", line);
+
+ pthread_mutex_unlock(&g_log_mutex);
+}
+
+void yagl_log_func_exit_split(pid_t process_id,
+ pid_t thread_id,
+ const char* func,
+ int line,
+ const char* datatype, ...)
+{
+ va_list args;
+
+ yagl_log_init();
+
+ pthread_mutex_lock(&g_log_mutex);
+
+ yagl_log_print_current_time();
+ fprintf(stderr,
+ " %-5s [%u/%u] }}} %s:%d",
+ g_log_level_to_str[yagl_log_level_trace],
+ process_id,
+ thread_id,
+ func,
+ line);
+
+ if (datatype)
+ {
+ const char* format = yagl_log_datatype_to_format(datatype);
+ if (format)
+ {
+ fprintf(stderr, " = ");
+ va_start(args, datatype);
+ vfprintf(stderr, format, args);
+ va_end(args);
+ }
+ }
+
+ fprintf(stderr, "\n");
+
+ pthread_mutex_unlock(&g_log_mutex);
+}
+
+int yagl_log_is_enabled_for_level(yagl_log_level log_level)
+{
+ yagl_log_init();
+
+ return log_level <= g_log_level;
+}
+
+int yagl_log_is_enabled_for_facility(const char* facility)
+{
+ int i;
+ int res = 0;
+
+ yagl_log_init();
+
+ if (g_log_facilities_match)
+ {
+ for (i = 0; g_log_facilities_match[i]; ++i)
+ {
+ if (yagl_log_match(facility, g_log_facilities_match[i]))
+ {
+ res = 1;
+ break;
+ }
+ }
+ }
+ else
+ {
+ res = 1;
+ }
+
+ if (res && g_log_facilities_no_match)
+ {
+ for (i = 0; g_log_facilities_no_match[i]; ++i)
+ {
+ if (yagl_log_match(facility, g_log_facilities_no_match[i]))
+ {
+ res = 0;
+ break;
+ }
+ }
+ }
+
+ return res;
+}
+
+int yagl_log_is_enabled_for_func_tracing(void)
+{
+ yagl_log_init();
+
+ return g_log_func_trace;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_malloc.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+void *yagl_malloc(size_t size)
+{
+ void *tmp = malloc(size);
+ if (!tmp) {
+ assert(0);
+ fprintf( stderr,
+ "Critical error! Unable to allocate %u bytes!\n",
+ (unsigned int)size );
+ exit(1);
+ return 0;
+ }
+ return tmp;
+}
+
+void *yagl_malloc0(size_t size)
+{
+ void *tmp = yagl_malloc(size);
+ memset(tmp, 0, size);
+ return tmp;
+}
+
+void *yagl_realloc(void *ptr, size_t size)
+{
+ return realloc(ptr, size);
+}
+
+void yagl_free(void* ptr)
+{
+ free(ptr);
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_namespace.h"
+#include "yagl_avl.h"
+#include "yagl_object.h"
+#include <assert.h>
+
+static int yagl_namespace_entry_comparison_func(const void *avl_a,
+ const void *avl_b,
+ void *avl_param)
+{
+ const struct yagl_object *a = avl_a;
+ const struct yagl_object *b = avl_b;
+
+ if (a->local_name < b->local_name) {
+ return -1;
+ } else if (a->local_name > b->local_name) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+static void yagl_namespace_entry_destroy_func(void *avl_item, void *avl_param)
+{
+ struct yagl_object *item = avl_item;
+
+ yagl_object_release(item);
+}
+
+void yagl_namespace_init(struct yagl_namespace *ns)
+{
+ ns->entries = yagl_avl_create(&yagl_namespace_entry_comparison_func,
+ ns,
+ NULL);
+ assert(ns->entries);
+ ns->next_local_name = 1;
+}
+
+void yagl_namespace_cleanup(struct yagl_namespace *ns)
+{
+ yagl_avl_destroy(ns->entries, &yagl_namespace_entry_destroy_func);
+ ns->entries = NULL;
+ ns->next_local_name = 0;
+}
+
+void yagl_namespace_add(struct yagl_namespace *ns,
+ struct yagl_object *obj)
+{
+ yagl_object_acquire(obj);
+
+ do {
+ if (!ns->next_local_name) {
+ /*
+ * 0 names are invalid.
+ */
+
+ ++ns->next_local_name;
+ }
+
+ obj->local_name = ns->next_local_name++;
+
+ /*
+ * Find a free local name.
+ */
+ } while (yagl_avl_insert(ns->entries, obj));
+}
+
+struct yagl_object *yagl_namespace_add_named(struct yagl_namespace *ns,
+ yagl_object_name local_name,
+ struct yagl_object *obj)
+{
+ struct yagl_object *dup_item;
+
+ obj->local_name = local_name;
+
+ dup_item = yagl_avl_insert(ns->entries, obj);
+
+ if (dup_item) {
+ obj->local_name = 0;
+
+ yagl_namespace_entry_destroy_func(obj, ns->entries->avl_param);
+
+ yagl_object_acquire(dup_item);
+
+ return dup_item;
+ } else {
+ yagl_object_acquire(obj);
+
+ return obj;
+ }
+}
+
+void yagl_namespace_remove(struct yagl_namespace *ns,
+ yagl_object_name local_name)
+{
+ void *item;
+ struct yagl_object dummy;
+
+ dummy.local_name = local_name;
+
+ item = yagl_avl_delete(ns->entries, &dummy);
+
+ if (item) {
+ yagl_namespace_entry_destroy_func(item, ns->entries->avl_param);
+ }
+}
+
+struct yagl_object *yagl_namespace_acquire(struct yagl_namespace *ns,
+ yagl_object_name local_name)
+{
+ struct yagl_object *item;
+ struct yagl_object dummy;
+
+ dummy.local_name = local_name;
+
+ item = yagl_avl_find(ns->entries, &dummy);
+
+ if (item) {
+ yagl_object_acquire(item);
+ return item;
+ } else {
+ return NULL;
+ }
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_native_display.h"
+#include "yagl_log.h"
+#include "yagl_backend.h"
+#ifdef YAGL_PLATFORM_WAYLAND
+#include "wayland-drm.h"
+#endif
+#include "vigs.h"
+#include "EGL/eglmesaext.h"
+#include <string.h>
+#include <stdlib.h>
+
+void yagl_native_display_init(struct yagl_native_display *dpy,
+ struct yagl_native_platform *platform,
+ yagl_os_display os_dpy,
+ struct vigs_drm_device *drm_dev,
+ const char *drm_dev_name)
+{
+ dpy->platform = platform;
+ dpy->os_dpy = os_dpy;
+ dpy->drm_dev = drm_dev;
+ if (drm_dev) {
+ dpy->drm_dev_name = strdup(drm_dev_name);
+ } else {
+ dpy->drm_dev_name = NULL;
+ }
+#ifdef YAGL_PLATFORM_WAYLAND
+ dpy->WL_bind_wayland_display_supported = (drm_dev ? 1 : 0);
+#else
+ dpy->WL_bind_wayland_display_supported = 0;
+#endif
+}
+
+void yagl_native_display_cleanup(struct yagl_native_display *dpy)
+{
+ dpy->drm_dev = NULL;
+ free(dpy->drm_dev_name);
+ dpy->drm_dev_name = NULL;
+}
+
+#ifdef YAGL_PLATFORM_WAYLAND
+static int yagl_native_display_wl_authenticate(void *user_data,
+ uint32_t id)
+{
+ struct yagl_native_display *dpy = user_data;
+
+ return dpy->authenticate(dpy, id);
+}
+
+static struct vigs_drm_surface
+ *yagl_native_display_wl_acquire_buffer(void *user_data, uint32_t name)
+{
+ struct yagl_native_display *dpy = user_data;
+ struct vigs_drm_surface *drm_sfc;
+ int ret;
+
+ YAGL_LOG_FUNC_SET(yagl_native_display_wl_acquire_buffer);
+
+ ret = vigs_drm_surface_open(dpy->drm_dev, name, &drm_sfc);
+
+ if (ret != 0) {
+ YAGL_LOG_ERROR("vigs_drm_surface_open failed for name %u: %s",
+ name,
+ strerror(-ret));
+ return NULL;
+ }
+
+ return drm_sfc;
+}
+
+static struct wayland_drm_callbacks wl_drm_callbacks =
+{
+ .authenticate = yagl_native_display_wl_authenticate,
+ .acquire_buffer = yagl_native_display_wl_acquire_buffer,
+};
+
+int yagl_native_display_bind_wl_display(struct yagl_native_display *dpy,
+ struct wl_display *wl_dpy)
+{
+ if (dpy->wl_server_drm) {
+ return 0;
+ }
+
+ dpy->wl_server_drm = wayland_drm_create(wl_dpy,
+ dpy->drm_dev_name,
+ &wl_drm_callbacks,
+ dpy);
+
+ return dpy->wl_server_drm ? 1 : 0;
+}
+
+int yagl_native_display_unbind_wl_display(struct yagl_native_display *dpy)
+{
+ if (!dpy->wl_server_drm) {
+ return 0;
+ }
+
+ wayland_drm_destroy(dpy->wl_server_drm);
+ dpy->wl_server_drm = NULL;
+
+ return 1;
+}
+
+int yagl_native_display_query_wl_buffer(struct yagl_native_display *dpy,
+ struct wl_resource *buffer,
+ EGLint attribute,
+ EGLint *value)
+{
+ struct wl_drm_buffer *drm_buffer = wayland_drm_get_buffer(buffer);
+ struct vigs_drm_surface *drm_sfc;
+
+ if (!drm_buffer) {
+ return 0;
+ }
+
+ drm_sfc = wayland_drm_buffer_get_sfc(drm_buffer);
+
+ switch (attribute) {
+ case EGL_TEXTURE_FORMAT:
+ switch (drm_sfc->format) {
+ case vigs_drm_surface_bgrx8888:
+ *value = EGL_TEXTURE_RGB;
+ break;
+ case vigs_drm_surface_bgra8888:
+ *value = EGL_TEXTURE_RGBA;
+ break;
+ default:
+ return 0;
+ }
+ break;
+ case EGL_WIDTH:
+ *value = drm_sfc->width;
+ break;
+ case EGL_HEIGHT:
+ *value = drm_sfc->height;
+ break;
+ case EGL_WAYLAND_Y_INVERTED_WL:
+ *value = yagl_get_backend()->y_inverted;
+ break;
+ default:
+ return 0;
+ }
+
+ return 1;
+}
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_NATIVE_DISPLAY_H_
+#define _YAGL_NATIVE_DISPLAY_H_
+
+#include "yagl_export.h"
+#include "yagl_native_types.h"
+#include "EGL/egl.h"
+
+struct yagl_native_platform;
+struct yagl_native_drawable;
+struct yagl_native_image;
+struct vigs_drm_device;
+
+#ifdef YAGL_PLATFORM_WAYLAND
+struct wl_display;
+struct wl_resource;
+struct wl_drm;
+#endif
+
+struct yagl_native_display
+{
+ struct yagl_native_platform *platform;
+
+ yagl_os_display os_dpy;
+
+ struct vigs_drm_device *drm_dev;
+ char *drm_dev_name;
+
+ int WL_bind_wayland_display_supported;
+
+#ifdef YAGL_PLATFORM_WAYLAND
+ struct wl_drm *wl_server_drm;
+#endif
+
+ int (*authenticate)(struct yagl_native_display */*dpy*/, uint32_t /*id*/);
+
+ struct yagl_native_drawable *(*wrap_window)(struct yagl_native_display */*dpy*/,
+ yagl_os_window /*os_window*/);
+
+ struct yagl_native_drawable *(*wrap_pixmap)(struct yagl_native_display */*dpy*/,
+ yagl_os_pixmap /*os_pixmap*/);
+
+ struct yagl_native_drawable *(*create_pixmap)(struct yagl_native_display */*dpy*/,
+ uint32_t /*width*/,
+ uint32_t /*height*/,
+ uint32_t /*depth*/);
+
+ struct yagl_native_image *(*create_image)(struct yagl_native_display */*dpy*/,
+ uint32_t /*width*/,
+ uint32_t /*height*/,
+ uint32_t /*depth*/);
+
+ int (*get_visual)(struct yagl_native_display */*dpy*/,
+ int */*visual_id*/,
+ int */*visual_type*/);
+
+ void (*destroy)(struct yagl_native_display */*dpy*/);
+};
+
+void yagl_native_display_init(struct yagl_native_display *dpy,
+ struct yagl_native_platform *platform,
+ yagl_os_display os_dpy,
+ struct vigs_drm_device *drm_dev,
+ const char *drm_dev_name);
+
+void yagl_native_display_cleanup(struct yagl_native_display *dpy);
+
+#ifdef YAGL_PLATFORM_WAYLAND
+int yagl_native_display_bind_wl_display(struct yagl_native_display *dpy,
+ struct wl_display *wl_dpy);
+
+int yagl_native_display_unbind_wl_display(struct yagl_native_display *dpy);
+
+int yagl_native_display_query_wl_buffer(struct yagl_native_display *dpy,
+ struct wl_resource *buffer,
+ EGLint attribute,
+ EGLint *value);
+#endif
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_native_drawable.h"
+
+void yagl_native_drawable_init(struct yagl_native_drawable *drawable,
+ struct yagl_native_display *dpy,
+ yagl_os_drawable os_drawable)
+{
+ drawable->dpy = dpy;
+ drawable->os_drawable = os_drawable;
+ drawable->stamp = 0;
+}
+
+void yagl_native_drawable_cleanup(struct yagl_native_drawable *drawable)
+{
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_NATIVE_DRAWABLE_H_
+#define _YAGL_NATIVE_DRAWABLE_H_
+
+#include "yagl_export.h"
+#include "yagl_native_types.h"
+
+struct yagl_native_image;
+struct vigs_drm_surface;
+
+struct yagl_native_drawable
+{
+ struct yagl_native_display *dpy;
+
+ yagl_os_drawable os_drawable;
+
+ /*
+ * This gets incremented in drawable invalidate handler.
+ */
+ uint32_t stamp;
+
+ int (*get_buffer)(struct yagl_native_drawable */*drawable*/,
+ yagl_native_attachment /*attachment*/,
+ uint32_t */*buffer_name*/,
+ struct vigs_drm_surface **/*buffer_sfc*/);
+
+ int (*get_buffer_age)(struct yagl_native_drawable */*drawable*/);
+
+ void (*swap_buffers)(struct yagl_native_drawable */*drawable*/);
+
+ /*
+ * 'width' and 'height' are here only because of DRI2.
+ * DRI2 requires width and height to be passed to DRI2CopyRegion.
+ */
+ void (*wait)(struct yagl_native_drawable */*drawable*/,
+ uint32_t /*width*/,
+ uint32_t /*height*/);
+
+ void (*copy_to_pixmap)(struct yagl_native_drawable */*drawable*/,
+ yagl_os_pixmap /*os_pixmap*/,
+ uint32_t /*from_x*/,
+ uint32_t /*from_y*/,
+ uint32_t /*to_x*/,
+ uint32_t /*to_y*/,
+ uint32_t /*width*/,
+ uint32_t /*height*/);
+
+ void (*set_swap_interval)(struct yagl_native_drawable */*drawable*/,
+ int /*interval*/);
+
+ void (*get_geometry)(struct yagl_native_drawable */*drawable*/,
+ uint32_t */*width*/,
+ uint32_t */*height*/,
+ uint32_t */*depth*/);
+
+ struct yagl_native_image *(*get_image)(struct yagl_native_drawable */*drawable*/,
+ uint32_t /*width*/,
+ uint32_t /*height*/);
+
+ void (*destroy)(struct yagl_native_drawable */*drawable*/);
+};
+
+void yagl_native_drawable_init(struct yagl_native_drawable *drawable,
+ struct yagl_native_display *dpy,
+ yagl_os_drawable os_drawable);
+
+void yagl_native_drawable_cleanup(struct yagl_native_drawable *drawable);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_native_image.h"
+
+void yagl_native_image_init(struct yagl_native_image *image,
+ struct yagl_native_display *dpy,
+ uint32_t width,
+ uint32_t height,
+ uint32_t depth,
+ uint32_t bpp,
+ void *pixels)
+{
+ image->dpy = dpy;
+ image->width = width;
+ image->height = height;
+ image->depth = depth;
+ image->bpp = bpp;
+ image->pixels = pixels;
+}
+
+void yagl_native_image_cleanup(struct yagl_native_image *image)
+{
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_NATIVE_IMAGE_H_
+#define _YAGL_NATIVE_IMAGE_H_
+
+#include "yagl_export.h"
+#include "yagl_native_types.h"
+
+struct yagl_native_drawable;
+
+struct yagl_native_image
+{
+ struct yagl_native_display *dpy;
+
+ uint32_t width;
+ uint32_t height;
+ uint32_t depth; /* bit-depth. e.g.: 24 */
+
+ uint32_t bpp; /* bytes-per-pixel. e.g.: 3 */
+ void *pixels; /* pixel data */
+
+ void (*draw)(struct yagl_native_image */*image*/,
+ struct yagl_native_drawable */*drawable*/);
+
+ void (*draw_to_pixmap)(struct yagl_native_image */*image*/,
+ yagl_os_pixmap /*os_pixmap*/);
+
+ void (*destroy)(struct yagl_native_image */*image*/);
+};
+
+void yagl_native_image_init(struct yagl_native_image *image,
+ struct yagl_native_display *dpy,
+ uint32_t width,
+ uint32_t height,
+ uint32_t depth,
+ uint32_t bpp,
+ void *pixels);
+
+void yagl_native_image_cleanup(struct yagl_native_image *image);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_native_platform.h"
+#ifdef YAGL_PLATFORM_X11
+#include "x11/yagl_x11_platform.h"
+#endif
+#ifdef YAGL_PLATFORM_GBM
+#include "gbm/yagl_gbm_platform.h"
+#endif
+#ifdef YAGL_PLATFORM_WAYLAND
+#include "wayland/yagl_wayland_platform.h"
+#endif
+#include "yagl_log.h"
+#include <stdlib.h>
+#include <string.h>
+
+static struct
+{
+ struct yagl_native_platform *platform;
+ const char *name;
+} g_platforms[] =
+{
+#ifdef YAGL_PLATFORM_WAYLAND
+ {&yagl_wayland_platform, "wayland"},
+#endif
+#ifdef YAGL_PLATFORM_GBM
+ {&yagl_gbm_platform, "gbm"},
+#endif
+#ifdef YAGL_PLATFORM_X11
+ {&yagl_x11_platform, "x11"},
+#endif
+};
+
+struct yagl_native_platform *yagl_guess_platform(yagl_os_display os_dpy)
+{
+ const char *platform_name = NULL;
+ uint32_t i;
+
+ YAGL_LOG_FUNC_SET(yagl_guess_platform);
+
+ platform_name = getenv("EGL_PLATFORM");
+
+ if (!platform_name || !platform_name[0]) {
+ platform_name = getenv("EGL_DISPLAY");
+ }
+
+ if (platform_name && platform_name[0]) {
+ for (i = 0; i < sizeof(g_platforms)/sizeof(g_platforms[0]); ++i) {
+ if (strcmp(g_platforms[i].name, platform_name) == 0) {
+ YAGL_LOG_INFO("EGL platform %s chosen by environment variable",
+ g_platforms[i].name);
+ return g_platforms[i].platform;
+ }
+ }
+ }
+
+ for (i = 0; i < sizeof(g_platforms)/sizeof(g_platforms[0]); ++i) {
+ if (g_platforms[i].platform->probe(os_dpy)) {
+ YAGL_LOG_INFO("EGL platform %s chosen by probing",
+ g_platforms[i].name);
+ return g_platforms[i].platform;
+ }
+ }
+
+ YAGL_LOG_ERROR("No EGL platform chosen");
+
+ return NULL;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_NATIVE_PLATFORM_H_
+#define _YAGL_NATIVE_PLATFORM_H_
+
+#include "yagl_export.h"
+#include "yagl_native_types.h"
+
+struct yagl_native_display;
+
+struct yagl_native_platform
+{
+ int pixmaps_supported;
+
+ int buffer_age_supported;
+
+ int (*probe)(yagl_os_display /*os_dpy*/);
+
+ struct yagl_native_display *(*wrap_display)(yagl_os_display /*os_dpy*/,
+ int /*enable_drm*/);
+};
+
+/*
+ * Attempts to guess the platform based on 'os_dpy'.
+ * Returns NULL if unsuccessful.
+ */
+struct yagl_native_platform *yagl_guess_platform(yagl_os_display os_dpy);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_NATIVE_TYPES_H_
+#define _YAGL_NATIVE_TYPES_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+
+typedef uintptr_t yagl_os_display;
+typedef uintptr_t yagl_os_drawable;
+typedef uintptr_t yagl_os_window;
+typedef uintptr_t yagl_os_pixmap;
+
+typedef enum
+{
+ yagl_native_attachment_front,
+ yagl_native_attachment_back,
+} yagl_native_attachment;
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_object.h"
+
+void yagl_object_init(struct yagl_object *obj,
+ yagl_ref_destroy_func destroy)
+{
+ yagl_ref_init(&obj->ref, destroy);
+ obj->local_name = 0;
+}
+
+void yagl_object_cleanup(struct yagl_object *obj)
+{
+ yagl_ref_cleanup(&obj->ref);
+}
+
+void yagl_object_acquire(struct yagl_object *obj)
+{
+ if (obj) {
+ yagl_ref_acquire(&obj->ref);
+ }
+}
+
+void yagl_object_release(struct yagl_object *obj)
+{
+ if (obj) {
+ yagl_ref_release(&obj->ref);
+ }
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_offscreen.h"
+#include "yagl_offscreen_surface.h"
+#include "yagl_offscreen_image_pixmap.h"
+#include "yagl_display.h"
+#include "yagl_native_display.h"
+#include "yagl_backend.h"
+#include "yagl_malloc.h"
+#include "yagl_native_platform.h"
+#include "yagl_egl_state.h"
+#include "yagl_host_egl_calls.h"
+
+static struct yagl_display
+ *yagl_offscreen_create_display(struct yagl_native_platform *platform,
+ yagl_os_display os_dpy)
+{
+ EGLint error = 0;
+ struct yagl_display *dpy;
+ yagl_host_handle host_dpy;
+ struct yagl_native_display *native_dpy;
+
+ native_dpy = platform->wrap_display(os_dpy, 0);
+
+ if (!native_dpy) {
+ return NULL;
+ }
+
+ host_dpy = yagl_host_eglGetDisplay((uint32_t)os_dpy, &error);
+
+ if (!host_dpy) {
+ yagl_set_error(error);
+ native_dpy->destroy(native_dpy);
+ return NULL;
+ }
+
+ dpy = yagl_malloc0(sizeof(*dpy));
+
+ yagl_display_init(dpy, os_dpy, native_dpy, host_dpy);
+
+ return dpy;
+}
+
+static struct yagl_surface
+ *yagl_offscreen_create_window_surface(struct yagl_display *dpy,
+ yagl_host_handle host_config,
+ struct yagl_native_drawable *native_window,
+ const EGLint* attrib_list)
+{
+ struct yagl_offscreen_surface *sfc =
+ yagl_offscreen_surface_create_window(dpy,
+ host_config,
+ native_window,
+ attrib_list);
+
+ return sfc ? &sfc->base : NULL;
+}
+
+static struct yagl_surface
+ *yagl_offscreen_create_pixmap_surface(struct yagl_display *dpy,
+ yagl_host_handle host_config,
+ struct yagl_native_drawable *native_pixmap,
+ const EGLint* attrib_list)
+{
+ struct yagl_offscreen_surface *sfc =
+ yagl_offscreen_surface_create_pixmap(dpy,
+ host_config,
+ native_pixmap,
+ attrib_list);
+
+ return sfc ? &sfc->base : NULL;
+}
+
+static struct yagl_surface
+ *yagl_offscreen_create_pbuffer_surface(struct yagl_display *dpy,
+ yagl_host_handle host_config,
+ const EGLint* attrib_list)
+{
+ struct yagl_offscreen_surface *sfc =
+ yagl_offscreen_surface_create_pbuffer(dpy, host_config, attrib_list);
+
+ return sfc ? &sfc->base : NULL;
+}
+
+static struct yagl_image
+ *yagl_offscreen_create_image_pixmap(struct yagl_display *dpy,
+ struct yagl_native_drawable *native_pixmap,
+ struct yagl_client_interface *iface)
+{
+ struct yagl_offscreen_image_pixmap *image =
+ yagl_offscreen_image_pixmap_create(dpy,
+ native_pixmap,
+ iface);
+
+ return image ? &image->base : NULL;
+}
+
+static struct yagl_image
+ *yagl_offscreen_create_image_wl_buffer(struct yagl_display *dpy,
+ struct wl_resource *buffer,
+ struct yagl_client_interface *iface)
+{
+ return NULL;
+}
+
+static struct yagl_fence
+ *yagl_offscreen_create_fence(struct yagl_display *dpy)
+{
+ return NULL;
+}
+
+static void yagl_offscreen_destroy(struct yagl_backend *backend)
+{
+ yagl_free(backend);
+}
+
+struct yagl_backend *yagl_offscreen_create()
+{
+ struct yagl_backend *backend;
+
+ backend = yagl_malloc0(sizeof(*backend));
+
+ backend->create_display = &yagl_offscreen_create_display;
+ backend->create_window_surface = &yagl_offscreen_create_window_surface;
+ backend->create_pixmap_surface = &yagl_offscreen_create_pixmap_surface;
+ backend->create_pbuffer_surface = &yagl_offscreen_create_pbuffer_surface;
+ backend->create_image_pixmap = &yagl_offscreen_create_image_pixmap;
+ backend->create_image_wl_buffer = &yagl_offscreen_create_image_wl_buffer;
+ backend->create_fence = &yagl_offscreen_create_fence;
+ backend->destroy = &yagl_offscreen_destroy;
+ backend->y_inverted = 1;
+ backend->fence_supported = 0;
+
+ return backend;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_OFFSCREEN_H_
+#define _YAGL_OFFSCREEN_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+
+struct yagl_backend;
+
+struct yagl_backend *yagl_offscreen_create();
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_offscreen_image_pixmap.h"
+#include "yagl_log.h"
+#include "yagl_malloc.h"
+#include "yagl_display.h"
+#include "yagl_state.h"
+#include "yagl_host_egl_calls.h"
+#include "yagl_native_drawable.h"
+#include "yagl_native_image.h"
+#include "yagl_transport_egl.h"
+#include "yagl_client_interface.h"
+#include "yagl_client_image.h"
+#include "yagl_egl_state.h"
+#include <string.h>
+
+static void yagl_offscreen_image_pixmap_update(struct yagl_image *image)
+{
+ struct yagl_offscreen_image_pixmap *oimage = (struct yagl_offscreen_image_pixmap*)image;
+ struct yagl_native_image *native_image = NULL;
+
+ YAGL_LOG_FUNC_SET(yagl_offscreen_image_pixmap_update);
+
+ native_image = oimage->native_pixmap->get_image(oimage->native_pixmap,
+ oimage->width,
+ oimage->height);
+
+ if (!native_image) {
+ YAGL_LOG_ERROR("get_image failed for image %u", image->res.handle);
+ return;
+ }
+
+ oimage->base.client_image->update(oimage->base.client_image,
+ native_image->width,
+ native_image->height,
+ native_image->bpp,
+ native_image->pixels);
+
+ native_image->destroy(native_image);
+}
+
+static void yagl_offscreen_image_pixmap_destroy(struct yagl_ref *ref)
+{
+ struct yagl_offscreen_image_pixmap *image = (struct yagl_offscreen_image_pixmap*)ref;
+
+ image->native_pixmap->destroy(image->native_pixmap);
+ image->native_pixmap = NULL;
+
+ yagl_image_cleanup(&image->base);
+
+ yagl_free(image);
+}
+
+struct yagl_offscreen_image_pixmap
+ *yagl_offscreen_image_pixmap_create(struct yagl_display *dpy,
+ struct yagl_native_drawable *native_pixmap,
+ struct yagl_client_interface *iface)
+{
+ EGLint error = 0;
+ yagl_object_name tex_global_name = yagl_get_global_name();
+ struct yagl_client_image *client_image;
+ struct yagl_offscreen_image_pixmap *image;
+ uint32_t depth;
+
+ if (!yagl_host_eglCreateImageYAGL(tex_global_name,
+ dpy->host_dpy,
+ 0,
+ &error)) {
+ yagl_set_error(error);
+ return NULL;
+ }
+
+ client_image = iface->create_image(iface, tex_global_name);
+
+ image = yagl_malloc0(sizeof(*image));
+
+ yagl_image_init(&image->base,
+ &yagl_offscreen_image_pixmap_destroy,
+ dpy,
+ (EGLImageKHR)native_pixmap->os_drawable,
+ client_image);
+
+ yagl_client_image_release(client_image);
+
+ image->base.update = &yagl_offscreen_image_pixmap_update;
+
+ image->native_pixmap = native_pixmap;
+
+ native_pixmap->get_geometry(native_pixmap,
+ &image->width,
+ &image->height,
+ &depth);
+
+ return image;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_OFFSCREEN_IMAGE_PIXMAP_H_
+#define _YAGL_OFFSCREEN_IMAGE_PIXMAP_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+#include "yagl_image.h"
+
+struct yagl_native_drawable;
+struct yagl_client_interface;
+
+struct yagl_offscreen_image_pixmap
+{
+ struct yagl_image base;
+
+ struct yagl_native_drawable *native_pixmap;
+
+ uint32_t width;
+ uint32_t height;
+};
+
+struct yagl_offscreen_image_pixmap
+ *yagl_offscreen_image_pixmap_create(struct yagl_display *dpy,
+ struct yagl_native_drawable *native_pixmap,
+ struct yagl_client_interface *iface);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_offscreen_surface.h"
+#include "yagl_host_egl_calls.h"
+#include "yagl_egl_state.h"
+#include "yagl_state.h"
+#include "yagl_malloc.h"
+#include "yagl_log.h"
+#include "yagl_display.h"
+#include "yagl_native_display.h"
+#include "yagl_native_drawable.h"
+#include "yagl_native_image.h"
+#include "yagl_transport_egl.h"
+#include "yagl_client_interface.h"
+#include "yagl_client_image.h"
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <stdio.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+int yagl_mlock(void *ptr, uint32_t size);
+
+int yagl_munlock(void *ptr);
+
+static struct yagl_native_image
+ *yagl_offscreen_surface_create_bi(struct yagl_native_display *dpy,
+ uint32_t width,
+ uint32_t height,
+ uint32_t depth)
+{
+ struct yagl_native_image *bi = dpy->create_image(dpy,
+ width,
+ height,
+ depth);
+
+ if (!bi) {
+ return NULL;
+ }
+
+ if (yagl_mlock(bi->pixels, bi->width * bi->height * bi->bpp) == -1) {
+ fprintf(stderr, "Critical error! Unable to lock YaGL bi memory: %s!\n", strerror(errno));
+ exit(1);
+ }
+
+ /*
+ * Probe in immediately.
+ */
+
+ yagl_transport_probe_write(bi->pixels, bi->width * bi->height * bi->bpp);
+
+ return bi;
+}
+
+static void yagl_offscreen_surface_destroy_bi(struct yagl_native_image *bi)
+{
+ if (yagl_munlock(bi->pixels) == -1) {
+ fprintf(stderr, "Critical error! Unable to unlock YaGL bi memory: %s!\n", strerror(errno));
+ exit(1);
+ }
+
+ bi->destroy(bi);
+}
+
+static int yagl_offscreen_surface_resize(struct yagl_offscreen_surface *surface)
+{
+ EGLint error = 0;
+ int res = 0;
+ uint32_t width = 0;
+ uint32_t height = 0;
+ uint32_t depth = 0;
+ struct yagl_native_image *bi = NULL;
+
+ YAGL_LOG_FUNC_SET(yagl_offscreen_surface_resize);
+
+ if (surface->base.type != EGL_WINDOW_BIT) {
+ return 1;
+ }
+
+ surface->base.native_drawable->get_geometry(surface->base.native_drawable,
+ &width,
+ &height,
+ &depth);
+
+ if ((width != surface->bi->width) ||
+ (height != surface->bi->height) ||
+ (depth != surface->bi->depth)) {
+ YAGL_LOG_DEBUG("Surface resizing from %ux%ux%u to %ux%ux%u",
+ surface->bi->width, surface->bi->height,
+ surface->bi->depth,
+ width, height, depth);
+ /*
+ * First of all, create new backing image.
+ */
+
+ bi = yagl_offscreen_surface_create_bi(surface->base.dpy->native_dpy,
+ width, height, depth);
+
+ if (!bi) {
+ YAGL_LOG_ERROR("create_bi failed");
+ yagl_set_error(EGL_BAD_ALLOC);
+ goto out;
+ }
+
+ /*
+ * Tell the host that it should use new backing image from now on.
+ */
+
+ if (!yagl_host_eglResizeOffscreenSurfaceYAGL(surface->base.dpy->host_dpy,
+ surface->base.res.handle,
+ bi->width,
+ bi->height,
+ bi->bpp,
+ bi->pixels,
+ &error)) {
+ yagl_set_error(error);
+ YAGL_LOG_ERROR("eglResizeOffscreenSurfaceYAGL failed");
+ goto out;
+ }
+
+ /*
+ * Now that the host accepted us we can be sure that 'surface' is
+ * attached to current context, so no race conditions will occur and
+ * we can safely replace surface's backing image with a new one.
+ */
+
+ yagl_offscreen_surface_destroy_bi(surface->bi);
+ surface->bi = bi;
+ bi = NULL;
+ }
+
+ res = 1;
+
+out:
+ if (bi) {
+ yagl_offscreen_surface_destroy_bi(bi);
+ }
+
+ return res;
+}
+
+static void yagl_offscreen_surface_invalidate(struct yagl_surface *sfc)
+{
+}
+
+static int yagl_offscreen_surface_swap_buffers(struct yagl_surface *sfc)
+{
+ struct yagl_offscreen_surface *osfc = (struct yagl_offscreen_surface*)sfc;
+
+ if (!yagl_offscreen_surface_resize(osfc)) {
+ return 0;
+ }
+
+ yagl_host_eglSwapBuffers(sfc->dpy->host_dpy,
+ sfc->res.handle);
+
+ yagl_transport_wait(yagl_get_transport());
+
+ /*
+ * Host has updated our image, update the window.
+ */
+
+ if (sfc->native_drawable) {
+ osfc->bi->draw(osfc->bi, sfc->native_drawable);
+ }
+
+ return 1;
+}
+
+static int yagl_offscreen_surface_copy_buffers(struct yagl_surface *sfc,
+ yagl_os_pixmap target)
+{
+ struct yagl_offscreen_surface *osfc = (struct yagl_offscreen_surface*)sfc;
+
+ YAGL_LOG_FUNC_SET(eglCopyBuffers);
+
+ if (sfc->type == EGL_WINDOW_BIT) {
+ uint32_t width = 0;
+ uint32_t height = 0;
+ uint32_t depth = 0;
+
+ sfc->native_drawable->get_geometry(sfc->native_drawable,
+ &width,
+ &height,
+ &depth);
+
+ if ((width != osfc->bi->width) ||
+ (height != osfc->bi->height) ||
+ (depth != osfc->bi->depth)) {
+ /*
+ * Don't allow copying from window surfaces that
+ * just changed their size, user must first update
+ * the surface with eglSwapBuffers.
+ */
+
+ YAGL_LOG_ERROR("Not allowed");
+ yagl_set_error(EGL_BAD_MATCH);
+ return 0;
+ }
+ }
+
+ yagl_host_eglCopyBuffers(sfc->dpy->host_dpy,
+ sfc->res.handle);
+
+ yagl_transport_wait(yagl_get_transport());
+
+ /*
+ * Host has updated our image, update the target.
+ */
+
+ osfc->bi->draw_to_pixmap(osfc->bi, target);
+
+ return 1;
+}
+
+static void yagl_offscreen_surface_wait_x(struct yagl_surface *sfc)
+{
+}
+
+static void yagl_offscreen_surface_wait_gl(struct yagl_surface *sfc)
+{
+}
+
+static void yagl_offscreen_surface_map(struct yagl_surface *sfc)
+{
+ struct yagl_offscreen_surface *osfc = (struct yagl_offscreen_surface*)sfc;
+
+ sfc->lock_ptr = osfc->bi->pixels;
+ sfc->lock_stride = osfc->bi->width * osfc->bi->bpp;
+}
+
+static void yagl_offscreen_surface_unmap(struct yagl_surface *sfc)
+{
+ struct yagl_offscreen_surface *osfc = (struct yagl_offscreen_surface*)sfc;
+
+ switch (sfc->type) {
+ case EGL_PBUFFER_BIT:
+ break;
+ case EGL_WINDOW_BIT:
+ case EGL_PIXMAP_BIT:
+ osfc->bi->draw(osfc->bi, sfc->native_drawable);
+ break;
+ default:
+ assert(0);
+ break;
+ }
+}
+
+static void yagl_offscreen_surface_set_swap_interval(struct yagl_surface *sfc,
+ int interval)
+{
+}
+
+static struct yagl_client_image
+ *yagl_offscreen_surface_create_image(struct yagl_surface *sfc,
+ struct yagl_client_interface *iface)
+{
+ EGLint error = 0;
+ yagl_object_name tex_global_name = yagl_get_global_name();
+
+ if (!yagl_host_eglCreateImageYAGL(tex_global_name,
+ sfc->dpy->host_dpy,
+ 0,
+ &error)) {
+ yagl_set_error(error);
+ return NULL;
+ }
+
+ return iface->create_image(iface, tex_global_name);
+}
+
+static void yagl_offscreen_surface_destroy(struct yagl_ref *ref)
+{
+ struct yagl_offscreen_surface *sfc = (struct yagl_offscreen_surface*)ref;
+
+ yagl_offscreen_surface_destroy_bi(sfc->bi);
+ sfc->bi = NULL;
+
+ yagl_surface_cleanup(&sfc->base);
+
+ yagl_free(sfc);
+}
+
+struct yagl_offscreen_surface
+ *yagl_offscreen_surface_create_window(struct yagl_display *dpy,
+ yagl_host_handle host_config,
+ struct yagl_native_drawable *native_window,
+ const EGLint* attrib_list)
+{
+ EGLint error = 0;
+ struct yagl_offscreen_surface *sfc;
+ uint32_t width = 0;
+ uint32_t height = 0;
+ uint32_t depth = 0;
+ yagl_host_handle host_surface = 0;
+ struct yagl_native_image *bi = NULL;
+
+ YAGL_LOG_FUNC_SET(eglCreateWindowSurface);
+
+ sfc = yagl_malloc0(sizeof(*sfc));
+
+ native_window->get_geometry(native_window,
+ &width,
+ &height,
+ &depth);
+
+ bi = yagl_offscreen_surface_create_bi(dpy->native_dpy, width, height, depth);
+
+ if (!bi) {
+ YAGL_LOG_ERROR("create_bi failed");
+ yagl_set_error(EGL_BAD_ALLOC);
+ goto fail;
+ }
+
+ host_surface = yagl_host_eglCreateWindowSurfaceOffscreenYAGL(dpy->host_dpy,
+ host_config,
+ bi->width,
+ bi->height,
+ bi->bpp,
+ bi->pixels,
+ attrib_list,
+ yagl_transport_attrib_list_count(attrib_list),
+ &error);
+
+ if (!host_surface) {
+ yagl_set_error(error);
+ goto fail;
+ }
+
+ yagl_surface_init_window(&sfc->base,
+ &yagl_offscreen_surface_destroy,
+ host_surface,
+ dpy,
+ native_window);
+
+ sfc->base.invalidate = &yagl_offscreen_surface_invalidate;
+ sfc->base.swap_buffers = &yagl_offscreen_surface_swap_buffers;
+ sfc->base.copy_buffers = &yagl_offscreen_surface_copy_buffers;
+ sfc->base.wait_x = &yagl_offscreen_surface_wait_x;
+ sfc->base.wait_gl = &yagl_offscreen_surface_wait_gl;
+ sfc->base.map = &yagl_offscreen_surface_map;
+ sfc->base.unmap = &yagl_offscreen_surface_unmap;
+ sfc->base.set_swap_interval = &yagl_offscreen_surface_set_swap_interval;
+ sfc->base.create_image = &yagl_offscreen_surface_create_image;
+
+ sfc->bi = bi;
+
+ return sfc;
+
+fail:
+ if (bi) {
+ yagl_offscreen_surface_destroy_bi(bi);
+ bi = NULL;
+ }
+
+ yagl_free(sfc);
+
+ return NULL;
+}
+
+struct yagl_offscreen_surface
+ *yagl_offscreen_surface_create_pixmap(struct yagl_display *dpy,
+ yagl_host_handle host_config,
+ struct yagl_native_drawable *native_pixmap,
+ const EGLint* attrib_list)
+{
+ EGLint error = 0;
+ struct yagl_offscreen_surface *sfc;
+ uint32_t width = 0;
+ uint32_t height = 0;
+ uint32_t depth = 0;
+ yagl_host_handle host_surface = 0;
+ struct yagl_native_image *bi = NULL;
+
+ YAGL_LOG_FUNC_SET(eglCreatePixmapSurface);
+
+ sfc = yagl_malloc0(sizeof(*sfc));
+
+ native_pixmap->get_geometry(native_pixmap,
+ &width,
+ &height,
+ &depth);
+
+ bi = yagl_offscreen_surface_create_bi(dpy->native_dpy, width, height, depth);
+
+ if (!bi) {
+ YAGL_LOG_ERROR("create_bi failed");
+ yagl_set_error(EGL_BAD_ALLOC);
+ goto fail;
+ }
+
+ host_surface = yagl_host_eglCreatePixmapSurfaceOffscreenYAGL(dpy->host_dpy,
+ host_config,
+ bi->width,
+ bi->height,
+ bi->bpp,
+ bi->pixels,
+ attrib_list,
+ yagl_transport_attrib_list_count(attrib_list),
+ &error);
+
+ if (!host_surface) {
+ yagl_set_error(error);
+ goto fail;
+ }
+
+ yagl_surface_init_pixmap(&sfc->base,
+ &yagl_offscreen_surface_destroy,
+ host_surface,
+ dpy,
+ native_pixmap);
+
+ sfc->base.invalidate = &yagl_offscreen_surface_invalidate;
+ sfc->base.swap_buffers = &yagl_offscreen_surface_swap_buffers;
+ sfc->base.copy_buffers = &yagl_offscreen_surface_copy_buffers;
+ sfc->base.wait_x = &yagl_offscreen_surface_wait_x;
+ sfc->base.wait_gl = &yagl_offscreen_surface_wait_gl;
+ sfc->base.map = &yagl_offscreen_surface_map;
+ sfc->base.unmap = &yagl_offscreen_surface_unmap;
+ sfc->base.set_swap_interval = &yagl_offscreen_surface_set_swap_interval;
+ sfc->base.create_image = &yagl_offscreen_surface_create_image;
+
+ sfc->bi = bi;
+
+ return sfc;
+
+fail:
+ if (bi) {
+ yagl_offscreen_surface_destroy_bi(bi);
+ bi = NULL;
+ }
+
+ yagl_free(sfc);
+
+ return NULL;
+}
+
+struct yagl_offscreen_surface
+ *yagl_offscreen_surface_create_pbuffer(struct yagl_display *dpy,
+ yagl_host_handle host_config,
+ const EGLint* attrib_list)
+{
+ EGLint error = 0;
+ struct yagl_offscreen_surface *sfc;
+ uint32_t width = 0;
+ uint32_t height = 0;
+ yagl_host_handle host_surface = 0;
+ struct yagl_native_image *bi = NULL;
+ int i = 0;
+
+ YAGL_LOG_FUNC_SET(eglCreatePbufferSurface);
+
+ sfc = yagl_malloc0(sizeof(*sfc));
+
+ if (attrib_list) {
+ while (attrib_list[i] != EGL_NONE) {
+ switch (attrib_list[i]) {
+ case EGL_WIDTH:
+ width = attrib_list[i + 1];
+ break;
+ case EGL_HEIGHT:
+ height = attrib_list[i + 1];
+ break;
+ default:
+ break;
+ }
+
+ i += 2;
+ }
+ }
+
+ bi = yagl_offscreen_surface_create_bi(dpy->native_dpy, width, height, 24);
+
+ if (!bi) {
+ YAGL_LOG_ERROR("create_bi failed");
+ yagl_set_error(EGL_BAD_ALLOC);
+ goto fail;
+ }
+
+ host_surface = yagl_host_eglCreatePbufferSurfaceOffscreenYAGL(dpy->host_dpy,
+ host_config,
+ bi->width,
+ bi->height,
+ bi->bpp,
+ bi->pixels,
+ attrib_list,
+ yagl_transport_attrib_list_count(attrib_list),
+ &error);
+
+ if (!host_surface) {
+ yagl_set_error(error);
+ goto fail;
+ }
+
+ yagl_surface_init_pbuffer(&sfc->base,
+ &yagl_offscreen_surface_destroy,
+ host_surface,
+ dpy);
+
+ sfc->base.invalidate = &yagl_offscreen_surface_invalidate;
+ sfc->base.swap_buffers = &yagl_offscreen_surface_swap_buffers;
+ sfc->base.copy_buffers = &yagl_offscreen_surface_copy_buffers;
+ sfc->base.wait_x = &yagl_offscreen_surface_wait_x;
+ sfc->base.wait_gl = &yagl_offscreen_surface_wait_gl;
+ sfc->base.map = &yagl_offscreen_surface_map;
+ sfc->base.unmap = &yagl_offscreen_surface_unmap;
+ sfc->base.set_swap_interval = &yagl_offscreen_surface_set_swap_interval;
+ sfc->base.create_image = &yagl_offscreen_surface_create_image;
+
+ sfc->bi = bi;
+
+ return sfc;
+
+fail:
+ if (bi) {
+ yagl_offscreen_surface_destroy_bi(bi);
+ bi = NULL;
+ }
+
+ yagl_free(sfc);
+
+ return NULL;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_OFFSCREEN_SURFACE_H_
+#define _YAGL_OFFSCREEN_SURFACE_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+#include "yagl_surface.h"
+
+struct yagl_native_image;
+struct yagl_native_drawable;
+
+struct yagl_offscreen_surface
+{
+ struct yagl_surface base;
+
+ struct yagl_native_image *bi;
+};
+
+struct yagl_offscreen_surface
+ *yagl_offscreen_surface_create_window(struct yagl_display *dpy,
+ yagl_host_handle host_config,
+ struct yagl_native_drawable *native_window,
+ const EGLint* attrib_list);
+
+struct yagl_offscreen_surface
+ *yagl_offscreen_surface_create_pixmap(struct yagl_display *dpy,
+ yagl_host_handle host_config,
+ struct yagl_native_drawable *native_pixmap,
+ const EGLint* attrib_list);
+
+struct yagl_offscreen_surface
+ *yagl_offscreen_surface_create_pbuffer(struct yagl_display *dpy,
+ yagl_host_handle host_config,
+ const EGLint* attrib_list);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_onscreen.h"
+#include "yagl_onscreen_surface.h"
+#include "yagl_onscreen_image_pixmap.h"
+#ifdef YAGL_PLATFORM_WAYLAND
+#include "yagl_onscreen_image_wl_buffer.h"
+#endif
+#include "yagl_onscreen_fence.h"
+#include "yagl_backend.h"
+#include "yagl_malloc.h"
+#include "yagl_display.h"
+#include "yagl_native_platform.h"
+#include "yagl_native_display.h"
+#include "yagl_egl_state.h"
+#include "yagl_host_egl_calls.h"
+
+static struct yagl_display
+ *yagl_onscreen_create_display(struct yagl_native_platform *platform,
+ yagl_os_display os_dpy)
+{
+ EGLint error = 0;
+ struct yagl_native_display *native_dpy;
+ yagl_host_handle host_dpy;
+ struct yagl_display *dpy;
+
+ native_dpy = platform->wrap_display(os_dpy, 1);
+
+ if (!native_dpy) {
+ return NULL;
+ }
+
+ host_dpy = yagl_host_eglGetDisplay((uint32_t)os_dpy, &error);
+
+ if (!host_dpy) {
+ yagl_set_error(error);
+ native_dpy->destroy(native_dpy);
+ return NULL;
+ }
+
+ dpy = yagl_malloc0(sizeof(*dpy));
+
+ yagl_display_init(dpy, os_dpy, native_dpy, host_dpy);
+
+ return dpy;
+}
+
+static struct yagl_surface
+ *yagl_onscreen_create_window_surface(struct yagl_display *dpy,
+ yagl_host_handle host_config,
+ struct yagl_native_drawable *native_window,
+ const EGLint *attrib_list)
+{
+ struct yagl_onscreen_surface *sfc =
+ yagl_onscreen_surface_create_window(dpy,
+ host_config,
+ native_window,
+ attrib_list);
+
+ return sfc ? &sfc->base : NULL;
+}
+
+static struct yagl_surface
+ *yagl_onscreen_create_pixmap_surface(struct yagl_display *dpy,
+ yagl_host_handle host_config,
+ struct yagl_native_drawable *native_pixmap,
+ const EGLint *attrib_list)
+{
+ struct yagl_onscreen_surface *sfc =
+ yagl_onscreen_surface_create_pixmap(dpy,
+ host_config,
+ native_pixmap,
+ attrib_list);
+
+ return sfc ? &sfc->base : NULL;
+}
+
+static struct yagl_surface
+ *yagl_onscreen_create_pbuffer_surface(struct yagl_display *dpy,
+ yagl_host_handle host_config,
+ const EGLint *attrib_list)
+{
+ struct yagl_onscreen_surface *sfc =
+ yagl_onscreen_surface_create_pbuffer(dpy, host_config, attrib_list);
+
+ return sfc ? &sfc->base : NULL;
+}
+
+static struct yagl_image
+ *yagl_onscreen_create_image_pixmap(struct yagl_display *dpy,
+ struct yagl_native_drawable *native_pixmap,
+ struct yagl_client_interface *iface)
+{
+ struct yagl_onscreen_image_pixmap *image =
+ yagl_onscreen_image_pixmap_create(dpy,
+ native_pixmap,
+ iface);
+
+ return image ? &image->base : NULL;
+}
+
+static struct yagl_image
+ *yagl_onscreen_create_image_wl_buffer(struct yagl_display *dpy,
+ struct wl_resource *buffer,
+ struct yagl_client_interface *iface)
+{
+#ifdef YAGL_PLATFORM_WAYLAND
+ struct yagl_onscreen_image_wl_buffer *image =
+ yagl_onscreen_image_wl_buffer_create(dpy,
+ buffer,
+ iface);
+
+ return image ? &image->base : NULL;
+#else
+ return NULL;
+#endif
+}
+
+static struct yagl_fence
+ *yagl_onscreen_create_fence(struct yagl_display *dpy)
+{
+ struct yagl_onscreen_fence *fence = yagl_onscreen_fence_create(dpy);
+
+ return fence ? &fence->base : NULL;
+}
+
+static void yagl_onscreen_destroy(struct yagl_backend *backend)
+{
+ yagl_free(backend);
+}
+
+struct yagl_backend *yagl_onscreen_create()
+{
+ struct yagl_backend *backend;
+
+ backend = yagl_malloc0(sizeof(*backend));
+
+ backend->create_display = &yagl_onscreen_create_display;
+ backend->create_window_surface = &yagl_onscreen_create_window_surface;
+ backend->create_pixmap_surface = &yagl_onscreen_create_pixmap_surface;
+ backend->create_pbuffer_surface = &yagl_onscreen_create_pbuffer_surface;
+ backend->create_image_pixmap = &yagl_onscreen_create_image_pixmap;
+ backend->create_image_wl_buffer = &yagl_onscreen_create_image_wl_buffer;
+ backend->create_fence = &yagl_onscreen_create_fence;
+ backend->destroy = &yagl_onscreen_destroy;
+ backend->y_inverted = 0;
+ backend->fence_supported = 1;
+
+ return backend;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_ONSCREEN_H_
+#define _YAGL_ONSCREEN_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+
+struct yagl_backend;
+
+struct yagl_backend *yagl_onscreen_create();
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_onscreen_fence.h"
+#include "yagl_log.h"
+#include "yagl_malloc.h"
+#include "yagl_display.h"
+#include "yagl_native_display.h"
+#include "vigs.h"
+#include <string.h>
+
+static int yagl_onscreen_fence_wait(struct yagl_egl_fence *egl_fence)
+{
+ struct yagl_onscreen_fence *ofence = (struct yagl_onscreen_fence*)egl_fence;
+ int ret;
+
+ YAGL_LOG_FUNC_SET(eglClientWaitSyncKHR);
+
+ ret = vigs_drm_fence_wait(ofence->drm_fence);
+
+ if (ret == 0) {
+ ofence->signaled = 1;
+ } else {
+ YAGL_LOG_ERROR("vigs_drm_fence_wait failed: %s",
+ strerror(-ret));
+ }
+
+ return (ret == 0);
+}
+
+static int yagl_onscreen_fence_signaled(struct yagl_egl_fence *egl_fence)
+{
+ struct yagl_onscreen_fence *ofence = (struct yagl_onscreen_fence*)egl_fence;
+ int ret;
+
+ YAGL_LOG_FUNC_SET(eglGetSyncAttribKHR);
+
+ if (ofence->signaled) {
+ return 1;
+ }
+
+ ret = vigs_drm_fence_check(ofence->drm_fence);
+
+ if (ret != 0) {
+ YAGL_LOG_ERROR("vigs_drm_fence_check failed: %s",
+ strerror(-ret));
+ }
+
+ ofence->signaled = ofence->drm_fence->signaled;
+
+ return ofence->signaled;
+}
+
+static void yagl_onscreen_fence_destroy(struct yagl_ref *ref)
+{
+ struct yagl_onscreen_fence *fence = (struct yagl_onscreen_fence*)ref;
+
+ vigs_drm_fence_unref(fence->drm_fence);
+
+ yagl_fence_cleanup(&fence->base);
+
+ yagl_free(fence);
+}
+
+struct yagl_onscreen_fence
+ *yagl_onscreen_fence_create(struct yagl_display *dpy)
+{
+ struct yagl_onscreen_fence *fence;
+ int ret;
+
+ YAGL_LOG_FUNC_SET(eglCreateSyncKHR);
+
+ fence = yagl_malloc0(sizeof(*fence));
+
+ ret = vigs_drm_fence_create(dpy->native_dpy->drm_dev, 0, &fence->drm_fence);
+
+ if (ret != 0) {
+ YAGL_LOG_ERROR("vigs_drm_fence_create failed: %s",
+ strerror(-ret));
+ goto fail;
+ }
+
+ yagl_fence_init(&fence->base,
+ &yagl_onscreen_fence_destroy,
+ dpy,
+ fence->drm_fence->seq);
+
+ fence->base.base.wait = &yagl_onscreen_fence_wait;
+ fence->base.base.signaled = &yagl_onscreen_fence_signaled;
+
+ return fence;
+
+fail:
+ yagl_free(fence);
+
+ return NULL;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_ONSCREEN_FENCE_H_
+#define _YAGL_ONSCREEN_FENCE_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+#include "yagl_fence.h"
+
+struct vigs_drm_fence;
+
+struct yagl_onscreen_fence
+{
+ struct yagl_fence base;
+
+ struct vigs_drm_fence *drm_fence;
+
+ int signaled;
+};
+
+struct yagl_onscreen_fence
+ *yagl_onscreen_fence_create(struct yagl_display *dpy);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_onscreen_image_pixmap.h"
+#include "yagl_onscreen_utils.h"
+#include "yagl_display.h"
+#include "yagl_log.h"
+#include "yagl_malloc.h"
+#include "yagl_host_egl_calls.h"
+#include "yagl_egl_state.h"
+#include "yagl_state.h"
+#include "yagl_native_drawable.h"
+#include "yagl_transport_egl.h"
+#include "yagl_client_interface.h"
+#include "yagl_client_image.h"
+#include "vigs.h"
+
+static void yagl_onscreen_image_pixmap_update(struct yagl_image *image)
+{
+}
+
+static void yagl_onscreen_image_pixmap_destroy(struct yagl_ref *ref)
+{
+ struct yagl_onscreen_image_pixmap *image = (struct yagl_onscreen_image_pixmap*)ref;
+
+ vigs_drm_gem_unref(&image->drm_sfc->gem);
+
+ image->native_pixmap->destroy(image->native_pixmap);
+ image->native_pixmap = NULL;
+
+ yagl_image_cleanup(&image->base);
+
+ yagl_free(image);
+}
+
+struct yagl_onscreen_image_pixmap
+ *yagl_onscreen_image_pixmap_create(struct yagl_display *dpy,
+ struct yagl_native_drawable *native_pixmap,
+ struct yagl_client_interface *iface)
+{
+ EGLint error = 0;
+ yagl_object_name tex_global_name = yagl_get_global_name();
+ struct yagl_client_image *client_image;
+ struct yagl_onscreen_image_pixmap *image;
+ struct vigs_drm_surface *drm_sfc = NULL;
+
+ image = yagl_malloc0(sizeof(*image));
+
+ drm_sfc = yagl_onscreen_buffer_create(native_pixmap,
+ yagl_native_attachment_front,
+ NULL);
+
+ if (!drm_sfc) {
+ yagl_set_error(EGL_BAD_NATIVE_PIXMAP);
+ goto fail;
+ }
+
+ if (!yagl_host_eglCreateImageYAGL(tex_global_name,
+ dpy->host_dpy,
+ drm_sfc->id,
+ &error)) {
+ yagl_set_error(error);
+ goto fail;
+ }
+
+ client_image = iface->create_image(iface, tex_global_name);
+
+ yagl_image_init(&image->base,
+ &yagl_onscreen_image_pixmap_destroy,
+ dpy,
+ (EGLImageKHR)native_pixmap->os_drawable,
+ client_image);
+
+ yagl_client_image_release(client_image);
+
+ image->base.update = &yagl_onscreen_image_pixmap_update;
+
+ image->native_pixmap = native_pixmap;
+ image->drm_sfc = drm_sfc;
+
+ return image;
+
+fail:
+ if (drm_sfc) {
+ vigs_drm_gem_unref(&drm_sfc->gem);
+ }
+ yagl_free(image);
+
+ return NULL;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_ONSCREEN_IMAGE_PIXMAP_H_
+#define _YAGL_ONSCREEN_IMAGE_PIXMAP_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+#include "yagl_image.h"
+
+struct yagl_native_drawable;
+struct vigs_drm_surface;
+struct yagl_client_interface;
+
+struct yagl_onscreen_image_pixmap
+{
+ struct yagl_image base;
+
+ struct yagl_native_drawable *native_pixmap;
+
+ struct vigs_drm_surface *drm_sfc;
+};
+
+struct yagl_onscreen_image_pixmap
+ *yagl_onscreen_image_pixmap_create(struct yagl_display *dpy,
+ struct yagl_native_drawable *native_pixmap,
+ struct yagl_client_interface *iface);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_onscreen_image_wl_buffer.h"
+#include "yagl_display.h"
+#include "yagl_malloc.h"
+#include "yagl_host_egl_calls.h"
+#include "yagl_egl_state.h"
+#include "yagl_state.h"
+#include "yagl_transport_egl.h"
+#include "wayland-drm.h"
+#include "yagl_client_interface.h"
+#include "yagl_client_image.h"
+#include "vigs.h"
+
+static void yagl_onscreen_image_wl_buffer_update(struct yagl_image *image)
+{
+}
+
+static void yagl_onscreen_image_wl_buffer_destroy(struct yagl_ref *ref)
+{
+ struct yagl_onscreen_image_wl_buffer *image = (struct yagl_onscreen_image_wl_buffer*)ref;
+
+ yagl_image_cleanup(&image->base);
+
+ yagl_free(image);
+}
+
+struct yagl_onscreen_image_wl_buffer
+ *yagl_onscreen_image_wl_buffer_create(struct yagl_display *dpy,
+ struct wl_resource *buffer,
+ struct yagl_client_interface *iface)
+{
+ EGLint error = 0;
+ yagl_object_name tex_global_name = yagl_get_global_name();
+ struct yagl_client_image *client_image;
+ struct yagl_onscreen_image_wl_buffer *image;
+ struct wl_drm_buffer *drm_buffer;
+ struct vigs_drm_surface *drm_sfc;
+
+ image = yagl_malloc0(sizeof(*image));
+
+ drm_buffer = wayland_drm_get_buffer(buffer);
+
+ if (!drm_buffer) {
+ /*
+ * Or is it some other error ?
+ */
+ yagl_set_error(EGL_BAD_NATIVE_PIXMAP);
+ goto fail;
+ }
+
+ drm_sfc = wayland_drm_buffer_get_sfc(drm_buffer);
+
+ if (!yagl_host_eglCreateImageYAGL(tex_global_name,
+ dpy->host_dpy,
+ drm_sfc->id,
+ &error)) {
+ yagl_set_error(error);
+ goto fail;
+ }
+
+ client_image = iface->create_image(iface, tex_global_name);
+
+ yagl_image_init(&image->base,
+ &yagl_onscreen_image_wl_buffer_destroy,
+ dpy,
+ (EGLImageKHR)drm_sfc->gem.name,
+ client_image);
+
+ yagl_client_image_release(client_image);
+
+ image->base.update = &yagl_onscreen_image_wl_buffer_update;
+
+ image->buffer = drm_buffer;
+
+ return image;
+
+fail:
+ yagl_free(image);
+
+ return NULL;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_ONSCREEN_IMAGE_WL_BUFFER_H_
+#define _YAGL_ONSCREEN_IMAGE_WL_BUFFER_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+#include "yagl_image.h"
+
+struct wl_resource;
+struct wl_drm_buffer;
+struct vigs_drm_surface;
+struct yagl_client_interface;
+
+struct yagl_onscreen_image_wl_buffer
+{
+ struct yagl_image base;
+
+ struct wl_drm_buffer *buffer;
+};
+
+struct yagl_onscreen_image_wl_buffer
+ *yagl_onscreen_image_wl_buffer_create(struct yagl_display *dpy,
+ struct wl_resource *buffer,
+ struct yagl_client_interface *iface);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_onscreen_surface.h"
+#include "yagl_onscreen_utils.h"
+#include "yagl_host_egl_calls.h"
+#include "yagl_egl_state.h"
+#include "yagl_state.h"
+#include "yagl_log.h"
+#include "yagl_utils.h"
+#include "yagl_malloc.h"
+#include "yagl_display.h"
+#include "yagl_native_display.h"
+#include "yagl_native_drawable.h"
+#include "yagl_transport_egl.h"
+#include "yagl_client_interface.h"
+#include "vigs.h"
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+static struct yagl_native_drawable
+ *native_drawable(struct yagl_onscreen_surface *osfc)
+{
+ return osfc->tmp_pixmap ? osfc->tmp_pixmap : osfc->base.native_drawable;
+}
+
+static void yagl_onscreen_surface_invalidate(struct yagl_surface *sfc)
+{
+ struct yagl_onscreen_surface *osfc = (struct yagl_onscreen_surface*)sfc;
+ struct yagl_native_drawable *drawable = native_drawable(osfc);
+ struct vigs_drm_surface *new_drm_sfc;
+
+ if (osfc->last_stamp == drawable->stamp) {
+ return;
+ }
+
+ assert(sfc->type == EGL_WINDOW_BIT);
+
+ osfc->last_stamp = drawable->stamp;
+
+ /*
+ * We only process new buffer if it's different from
+ * the current one.
+ */
+ new_drm_sfc = yagl_onscreen_buffer_create(drawable,
+ yagl_native_attachment_back,
+ osfc->drm_sfc);
+
+ if (!new_drm_sfc) {
+ return;
+ }
+
+ vigs_drm_gem_unref(&osfc->drm_sfc->gem);
+ osfc->drm_sfc = new_drm_sfc;
+
+ yagl_host_eglInvalidateOnscreenSurfaceYAGL(sfc->dpy->host_dpy,
+ sfc->res.handle,
+ new_drm_sfc->id);
+}
+
+static int yagl_onscreen_surface_swap_buffers(struct yagl_surface *sfc)
+{
+ struct yagl_onscreen_surface *osfc = (struct yagl_onscreen_surface*)sfc;
+ struct yagl_native_drawable *drawable = native_drawable(osfc);
+ int ret;
+
+ YAGL_LOG_FUNC_SET(eglSwapBuffers);
+
+ yagl_host_eglSwapBuffers(sfc->dpy->host_dpy,
+ sfc->res.handle);
+
+ ret = vigs_drm_surface_set_gpu_dirty(osfc->drm_sfc);
+
+ if (ret != 0) {
+ YAGL_LOG_ERROR("vigs_drm_surface_set_gpu_dirty failed: %s",
+ strerror(-ret));
+ }
+
+ drawable->swap_buffers(drawable);
+
+ return 1;
+}
+
+static int yagl_onscreen_surface_copy_buffers(struct yagl_surface *sfc,
+ yagl_os_pixmap target)
+{
+ struct yagl_onscreen_surface *osfc = (struct yagl_onscreen_surface*)sfc;
+ struct yagl_native_drawable *drawable = native_drawable(osfc);
+ int ret;
+
+ YAGL_LOG_FUNC_SET(eglCopyBuffers);
+
+ yagl_host_eglCopyBuffers(sfc->dpy->host_dpy,
+ sfc->res.handle);
+
+ ret = vigs_drm_surface_set_gpu_dirty(osfc->drm_sfc);
+
+ if (ret != 0) {
+ YAGL_LOG_ERROR("vigs_drm_surface_set_gpu_dirty failed: %s",
+ strerror(-ret));
+ }
+
+ drawable->copy_to_pixmap(drawable,
+ target, 0, 0, 0, 0,
+ osfc->drm_sfc->width,
+ osfc->drm_sfc->height);
+
+ return 1;
+}
+
+static void yagl_onscreen_surface_wait_x(struct yagl_surface *sfc)
+{
+ struct yagl_onscreen_surface *osfc = (struct yagl_onscreen_surface*)sfc;
+
+ switch (sfc->type) {
+ case EGL_PBUFFER_BIT:
+ case EGL_WINDOW_BIT:
+ /*
+ * Currently our window surfaces are always double-buffered, so
+ * this is a no-op.
+ */
+ break;
+ case EGL_PIXMAP_BIT:
+ sfc->native_drawable->wait(sfc->native_drawable,
+ osfc->drm_sfc->width,
+ osfc->drm_sfc->height);
+ break;
+ default:
+ assert(0);
+ break;
+ }
+}
+
+static void yagl_onscreen_surface_wait_gl(struct yagl_surface *sfc)
+{
+ struct yagl_onscreen_surface *osfc = (struct yagl_onscreen_surface*)sfc;
+ int ret;
+
+ YAGL_LOG_FUNC_SET(yagl_onscreen_surface_wait_gl);
+
+ yagl_host_eglWaitClient();
+
+ ret = vigs_drm_surface_set_gpu_dirty(osfc->drm_sfc);
+
+ if (ret != 0) {
+ YAGL_LOG_ERROR("vigs_drm_surface_set_gpu_dirty failed: %s",
+ strerror(-ret));
+ }
+}
+
+static void yagl_onscreen_surface_map(struct yagl_surface *sfc)
+{
+ struct yagl_onscreen_surface *osfc = (struct yagl_onscreen_surface*)sfc;
+ int ret;
+ uint32_t saf = 0;
+
+ YAGL_LOG_FUNC_SET(eglQuerySurface);
+
+ ret = vigs_drm_gem_map(&osfc->drm_sfc->gem, 1);
+
+ if (ret != 0) {
+ YAGL_LOG_ERROR("vigs_drm_gem_map failed: %s",
+ strerror(-ret));
+ return;
+ }
+
+ if ((sfc->lock_hint & EGL_READ_SURFACE_BIT_KHR) != 0) {
+ saf |= VIGS_DRM_SAF_READ;
+ }
+
+ if ((sfc->lock_hint & EGL_WRITE_SURFACE_BIT_KHR) != 0) {
+ saf |= VIGS_DRM_SAF_WRITE;
+ }
+
+ ret = vigs_drm_surface_start_access(osfc->drm_sfc, saf);
+ if (ret != 0) {
+ YAGL_LOG_ERROR("vigs_drm_surface_start_access failed: %s",
+ strerror(-ret));
+ }
+
+ sfc->lock_ptr = osfc->drm_sfc->gem.vaddr;
+ sfc->lock_stride = osfc->drm_sfc->stride;
+}
+
+static void yagl_onscreen_surface_unmap(struct yagl_surface *sfc)
+{
+ struct yagl_onscreen_surface *osfc = (struct yagl_onscreen_surface*)sfc;
+ int ret;
+
+ YAGL_LOG_FUNC_SET(eglUnlockSurfaceKHR);
+
+ ret = vigs_drm_surface_end_access(osfc->drm_sfc, 1);
+ if (ret != 0) {
+ YAGL_LOG_ERROR("vigs_drm_surface_end_access failed: %s",
+ strerror(-ret));
+ }
+}
+
+static void yagl_onscreen_surface_set_swap_interval(struct yagl_surface *sfc,
+ int interval)
+{
+ struct yagl_onscreen_surface *osfc = (struct yagl_onscreen_surface*)sfc;
+ struct yagl_native_drawable *drawable = native_drawable(osfc);
+
+ assert(sfc->type == EGL_WINDOW_BIT);
+
+ drawable->set_swap_interval(drawable, interval);
+}
+
+static struct yagl_client_image
+ *yagl_onscreen_surface_create_image(struct yagl_surface *sfc,
+ struct yagl_client_interface *iface)
+{
+ struct yagl_onscreen_surface *osfc = (struct yagl_onscreen_surface*)sfc;
+ EGLint error = 0;
+ yagl_object_name tex_global_name = yagl_get_global_name();
+
+ if (!yagl_host_eglCreateImageYAGL(tex_global_name,
+ sfc->dpy->host_dpy,
+ osfc->drm_sfc->id,
+ &error)) {
+ yagl_set_error(error);
+ return NULL;
+ }
+
+ return iface->create_image(iface, tex_global_name);
+}
+
+static void yagl_onscreen_surface_destroy(struct yagl_ref *ref)
+{
+ struct yagl_onscreen_surface *sfc = (struct yagl_onscreen_surface*)ref;
+
+ vigs_drm_gem_unref(&sfc->drm_sfc->gem);
+
+ if (sfc->tmp_pixmap) {
+ sfc->tmp_pixmap->destroy(sfc->tmp_pixmap);
+ sfc->tmp_pixmap = NULL;
+ }
+
+ yagl_surface_cleanup(&sfc->base);
+
+ yagl_free(sfc);
+}
+
+struct yagl_onscreen_surface
+ *yagl_onscreen_surface_create_window(struct yagl_display *dpy,
+ yagl_host_handle host_config,
+ struct yagl_native_drawable *native_window,
+ const EGLint* attrib_list)
+{
+ EGLint error = 0;
+ struct yagl_onscreen_surface *sfc;
+ struct vigs_drm_surface *drm_sfc = NULL;
+ yagl_host_handle host_surface = 0;
+
+ sfc = yagl_malloc0(sizeof(*sfc));
+
+ drm_sfc = yagl_onscreen_buffer_create(native_window,
+ yagl_native_attachment_back,
+ NULL);
+
+ if (!drm_sfc) {
+ yagl_set_error(EGL_BAD_NATIVE_WINDOW);
+ goto fail;
+ }
+
+ host_surface = yagl_host_eglCreateWindowSurfaceOnscreenYAGL(dpy->host_dpy,
+ host_config,
+ drm_sfc->id,
+ attrib_list,
+ yagl_transport_attrib_list_count(attrib_list),
+ &error);
+
+ if (!host_surface) {
+ yagl_set_error(error);
+ goto fail;
+ }
+
+ yagl_surface_init_window(&sfc->base,
+ &yagl_onscreen_surface_destroy,
+ host_surface,
+ dpy,
+ native_window);
+
+ sfc->base.invalidate = &yagl_onscreen_surface_invalidate;
+ sfc->base.swap_buffers = &yagl_onscreen_surface_swap_buffers;
+ sfc->base.copy_buffers = &yagl_onscreen_surface_copy_buffers;
+ sfc->base.wait_x = &yagl_onscreen_surface_wait_x;
+ sfc->base.wait_gl = &yagl_onscreen_surface_wait_gl;
+ sfc->base.map = &yagl_onscreen_surface_map;
+ sfc->base.unmap = &yagl_onscreen_surface_unmap;
+ sfc->base.set_swap_interval = &yagl_onscreen_surface_set_swap_interval;
+ sfc->base.create_image = &yagl_onscreen_surface_create_image;
+
+ sfc->drm_sfc = drm_sfc;
+
+ return sfc;
+
+fail:
+ if (drm_sfc) {
+ vigs_drm_gem_unref(&drm_sfc->gem);
+ }
+ yagl_free(sfc);
+
+ return NULL;
+}
+
+struct yagl_onscreen_surface
+ *yagl_onscreen_surface_create_pixmap(struct yagl_display *dpy,
+ yagl_host_handle host_config,
+ struct yagl_native_drawable *native_pixmap,
+ const EGLint* attrib_list)
+{
+ EGLint error = 0;
+ struct yagl_onscreen_surface *sfc;
+ struct vigs_drm_surface *drm_sfc = NULL;
+ yagl_host_handle host_surface = 0;
+
+ sfc = yagl_malloc0(sizeof(*sfc));
+
+ drm_sfc = yagl_onscreen_buffer_create(native_pixmap,
+ yagl_native_attachment_front,
+ NULL);
+
+ if (!drm_sfc) {
+ yagl_set_error(EGL_BAD_NATIVE_PIXMAP);
+ goto fail;
+ }
+
+ host_surface = yagl_host_eglCreatePixmapSurfaceOnscreenYAGL(dpy->host_dpy,
+ host_config,
+ drm_sfc->id,
+ attrib_list,
+ yagl_transport_attrib_list_count(attrib_list),
+ &error);
+
+ if (!host_surface) {
+ yagl_set_error(error);
+ goto fail;
+ }
+
+ yagl_surface_init_pixmap(&sfc->base,
+ &yagl_onscreen_surface_destroy,
+ host_surface,
+ dpy,
+ native_pixmap);
+
+ sfc->base.invalidate = &yagl_onscreen_surface_invalidate;
+ sfc->base.swap_buffers = &yagl_onscreen_surface_swap_buffers;
+ sfc->base.copy_buffers = &yagl_onscreen_surface_copy_buffers;
+ sfc->base.wait_x = &yagl_onscreen_surface_wait_x;
+ sfc->base.wait_gl = &yagl_onscreen_surface_wait_gl;
+ sfc->base.map = &yagl_onscreen_surface_map;
+ sfc->base.unmap = &yagl_onscreen_surface_unmap;
+ sfc->base.set_swap_interval = &yagl_onscreen_surface_set_swap_interval;
+ sfc->base.create_image = &yagl_onscreen_surface_create_image;
+
+ sfc->drm_sfc = drm_sfc;
+
+ return sfc;
+
+fail:
+ if (drm_sfc) {
+ vigs_drm_gem_unref(&drm_sfc->gem);
+ }
+ yagl_free(sfc);
+
+ return NULL;
+}
+
+struct yagl_onscreen_surface
+ *yagl_onscreen_surface_create_pbuffer(struct yagl_display *dpy,
+ yagl_host_handle host_config,
+ const EGLint* attrib_list)
+{
+ EGLint error = 0;
+ struct yagl_onscreen_surface *sfc;
+ uint32_t width = 0;
+ uint32_t height = 0;
+ int i = 0;
+ struct vigs_drm_surface *drm_sfc = NULL;
+ yagl_host_handle host_surface = 0;
+
+ YAGL_LOG_FUNC_SET(eglCreatePbufferSurface);
+
+ sfc = yagl_malloc0(sizeof(*sfc));
+
+ if (attrib_list) {
+ while (attrib_list[i] != EGL_NONE) {
+ switch (attrib_list[i]) {
+ case EGL_WIDTH:
+ width = attrib_list[i + 1];
+ break;
+ case EGL_HEIGHT:
+ height = attrib_list[i + 1];
+ break;
+ default:
+ break;
+ }
+
+ i += 2;
+ }
+ }
+
+ sfc->tmp_pixmap = dpy->native_dpy->create_pixmap(dpy->native_dpy,
+ width,
+ height,
+ 24);
+
+ if (!sfc->tmp_pixmap) {
+ YAGL_LOG_ERROR("create_pixmap(%u,%u) failed", width, height);
+ yagl_set_error(EGL_BAD_ALLOC);
+ goto fail;
+ }
+
+ drm_sfc = yagl_onscreen_buffer_create(sfc->tmp_pixmap,
+ yagl_native_attachment_front,
+ NULL);
+
+ if (!drm_sfc) {
+ yagl_set_error(EGL_BAD_ALLOC);
+ goto fail;
+ }
+
+ host_surface = yagl_host_eglCreatePbufferSurfaceOnscreenYAGL(dpy->host_dpy,
+ host_config,
+ drm_sfc->id,
+ attrib_list,
+ yagl_transport_attrib_list_count(attrib_list),
+ &error);
+
+ if (!host_surface) {
+ yagl_set_error(error);
+ goto fail;
+ }
+
+ yagl_surface_init_pbuffer(&sfc->base,
+ &yagl_onscreen_surface_destroy,
+ host_surface,
+ dpy);
+
+ sfc->base.invalidate = &yagl_onscreen_surface_invalidate;
+ sfc->base.swap_buffers = &yagl_onscreen_surface_swap_buffers;
+ sfc->base.copy_buffers = &yagl_onscreen_surface_copy_buffers;
+ sfc->base.wait_x = &yagl_onscreen_surface_wait_x;
+ sfc->base.wait_gl = &yagl_onscreen_surface_wait_gl;
+ sfc->base.map = &yagl_onscreen_surface_map;
+ sfc->base.unmap = &yagl_onscreen_surface_unmap;
+ sfc->base.set_swap_interval = &yagl_onscreen_surface_set_swap_interval;
+ sfc->base.create_image = &yagl_onscreen_surface_create_image;
+
+ sfc->drm_sfc = drm_sfc;
+
+ return sfc;
+
+fail:
+ if (sfc) {
+ if (sfc->tmp_pixmap) {
+ if (drm_sfc) {
+ vigs_drm_gem_unref(&drm_sfc->gem);
+ }
+ sfc->tmp_pixmap->destroy(sfc->tmp_pixmap);
+ sfc->tmp_pixmap = NULL;
+ }
+ yagl_free(sfc);
+ }
+
+ return NULL;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_ONSCREEN_SURFACE_H_
+#define _YAGL_ONSCREEN_SURFACE_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+#include "yagl_surface.h"
+
+struct vigs_drm_surface;
+
+struct yagl_onscreen_surface
+{
+ struct yagl_surface base;
+
+ /*
+ * Backing pixmap for PBuffer surfaces. NULL otherwise.
+ */
+ struct yagl_native_drawable *tmp_pixmap;
+
+ /*
+ * For widow surfaces this is yagl_native_attachment_back.
+ * For pixmap surfaces this is yagl_native_attachment_front.
+ * For pbuffer surfaces this is yagl_native_attachment_front of 'tmp_pixmap'.
+ *
+ * TODO: For window surfaces we also need to support
+ * yagl_native_attachment_front.
+ */
+ struct vigs_drm_surface *drm_sfc;
+
+ /*
+ * Last value of 'base.native_drawable->stamp'.
+ */
+ uint32_t last_stamp;
+};
+
+struct yagl_onscreen_surface
+ *yagl_onscreen_surface_create_window(struct yagl_display *dpy,
+ yagl_host_handle host_config,
+ struct yagl_native_drawable *native_window,
+ const EGLint *attrib_list);
+
+struct yagl_onscreen_surface
+ *yagl_onscreen_surface_create_pixmap(struct yagl_display *dpy,
+ yagl_host_handle host_config,
+ struct yagl_native_drawable *native_pixmap,
+ const EGLint *attrib_list);
+
+struct yagl_onscreen_surface
+ *yagl_onscreen_surface_create_pbuffer(struct yagl_display *dpy,
+ yagl_host_handle host_config,
+ const EGLint *attrib_list);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_onscreen_utils.h"
+#include "yagl_log.h"
+#include "yagl_native_display.h"
+#include "yagl_native_drawable.h"
+#include "vigs.h"
+#include <string.h>
+
+struct vigs_drm_surface
+ *yagl_onscreen_buffer_create(struct yagl_native_drawable *native_drawable,
+ yagl_native_attachment attachment,
+ struct vigs_drm_surface *check_sfc)
+{
+ int ret;
+ uint32_t buffer_name = 0;
+ struct vigs_drm_surface *buffer_sfc = NULL;
+
+ YAGL_LOG_FUNC_ENTER(yagl_onscreen_buffer_create,
+ "dpy = %p, d = %p, attachment = %u, check_sfc = %u",
+ native_drawable->dpy->os_dpy,
+ native_drawable->os_drawable,
+ attachment,
+ (check_sfc ? check_sfc->id : 0));
+
+ if (!native_drawable->get_buffer(native_drawable,
+ attachment,
+ &buffer_name,
+ &buffer_sfc)) {
+ goto fail;
+ }
+
+ if (check_sfc) {
+ if (buffer_name && (buffer_name == check_sfc->gem.name)) {
+ /*
+ * Buffer matches check_sfc, fail.
+ */
+ goto fail;
+ }
+
+ if (buffer_sfc && (buffer_sfc->id == check_sfc->id)) {
+ /*
+ * Buffer matches check_sfc, fail.
+ */
+ goto fail;
+ }
+ }
+
+ if (buffer_sfc) {
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return buffer_sfc;
+ }
+
+ ret = vigs_drm_surface_open(native_drawable->dpy->drm_dev,
+ buffer_name,
+ &buffer_sfc);
+
+ if (ret != 0) {
+ YAGL_LOG_ERROR("vigs_drm_surface_open failed for drawable %p: %s",
+ native_drawable->os_drawable,
+ strerror(-ret));
+ goto fail;
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return buffer_sfc;
+
+fail:
+ if (buffer_sfc) {
+ vigs_drm_gem_unref(&buffer_sfc->gem);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return NULL;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_ONSCREEN_UTILS_H_
+#define _YAGL_ONSCREEN_UTILS_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+#include "yagl_native_types.h"
+
+struct vigs_drm_surface;
+struct yagl_native_drawable;
+
+struct vigs_drm_surface
+ *yagl_onscreen_buffer_create(struct yagl_native_drawable *native_drawable,
+ yagl_native_attachment attachment,
+ struct vigs_drm_surface *check_sfc);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_range_list.h"
+#include <string.h>
+
+struct yagl_range
+{
+ int start;
+ int size;
+};
+
+void yagl_range_list_init(struct yagl_range_list *range_list)
+{
+ yagl_vector_init(&range_list->ranges, sizeof(struct yagl_range), 0);
+}
+
+void yagl_range_list_cleanup(struct yagl_range_list *range_list)
+{
+ yagl_vector_cleanup(&range_list->ranges);
+}
+
+void yagl_range_list_add(struct yagl_range_list *range_list,
+ int start,
+ int size)
+{
+ int actual_start = start, actual_end = start + size;
+ int remove_first = -1, remove_last = -1;
+ int i;
+ struct yagl_range *ranges = yagl_vector_data(&range_list->ranges);
+ int num_ranges = yagl_vector_size(&range_list->ranges);
+
+ for (i = 0; i < num_ranges; ++i) {
+ if ((remove_first == -1) &&
+ ((ranges[i].start + ranges[i].size) >= start)) {
+ if (ranges[i].start < actual_start) {
+ actual_start = ranges[i].start;
+ }
+ remove_first = i;
+ remove_last = i;
+ }
+ if (remove_first != -1) {
+ if ((ranges[i].start <= actual_end)) {
+ if ((ranges[i].start + ranges[i].size) > actual_end) {
+ actual_end = (ranges[i].start + ranges[i].size);
+ }
+ remove_last = i + 1;
+ } else {
+ break;
+ }
+ }
+ }
+
+ if (remove_first == -1) {
+ remove_first = 0;
+ remove_last = 0;
+ }
+
+ if (remove_first == remove_last) {
+ yagl_vector_resize(&range_list->ranges, num_ranges + 1);
+ ranges = yagl_vector_data(&range_list->ranges);
+ memmove(ranges + remove_first + 1,
+ ranges + remove_first,
+ (num_ranges - remove_first) * sizeof(*ranges));
+ } else {
+ memmove(ranges + remove_first + 1,
+ ranges + remove_last,
+ (num_ranges - remove_last) * sizeof(*ranges));
+ yagl_vector_resize(&range_list->ranges,
+ num_ranges + 1 - (remove_last - remove_first));
+ ranges = yagl_vector_data(&range_list->ranges);
+ }
+
+ ranges[remove_first].start = actual_start;
+ ranges[remove_first].size = (actual_end - actual_start);
+}
+
+int yagl_range_list_size(struct yagl_range_list *range_list)
+{
+ return yagl_vector_size(&range_list->ranges);
+}
+
+void yagl_range_list_get(struct yagl_range_list *range_list,
+ int i,
+ int *start,
+ int *size)
+{
+ struct yagl_range *ranges =
+ yagl_vector_data(&range_list->ranges);
+
+ *start = ranges[i].start;
+ *size = ranges[i].size;
+}
+
+void yagl_range_list_clear(struct yagl_range_list *range_list)
+{
+ yagl_vector_resize(&range_list->ranges, 0);
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_ref.h"
+#include "yagl_utils.h"
+#include <stdio.h>
+#include <assert.h>
+#include <string.h>
+#include <stdlib.h>
+
+void yagl_ref_init(struct yagl_ref *ref, yagl_ref_destroy_func destroy)
+{
+ assert(ref);
+ assert(destroy);
+
+ memset(ref, 0, sizeof(*ref));
+
+ ref->destroy = destroy;
+ yagl_mutex_init(&ref->mutex);
+ ref->count = 1;
+}
+
+void yagl_ref_cleanup(struct yagl_ref *ref)
+{
+ assert(ref);
+ assert(!ref->count);
+
+ ref->destroy = NULL;
+ pthread_mutex_destroy(&ref->mutex);
+}
+
+void yagl_ref_acquire(struct yagl_ref *ref)
+{
+ assert(ref);
+ assert(ref->count > 0);
+
+ pthread_mutex_lock(&ref->mutex);
+ ++ref->count;
+ pthread_mutex_unlock(&ref->mutex);
+}
+
+void yagl_ref_release(struct yagl_ref *ref)
+{
+ int call_destroy = 0;
+
+ assert(ref);
+ assert(ref->count > 0);
+
+ pthread_mutex_lock(&ref->mutex);
+ call_destroy = (--ref->count == 0);
+ pthread_mutex_unlock(&ref->mutex);
+
+ if (call_destroy)
+ {
+ assert(ref->destroy);
+ ref->destroy(ref);
+ }
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_render.h"
+#include "yagl_egl_state.h"
+#include "yagl_surface.h"
+#include "yagl_context.h"
+
+void yagl_render_invalidate(int throttle)
+{
+ struct yagl_surface *draw_sfc = yagl_get_draw_surface();
+ struct yagl_surface *read_sfc = yagl_get_read_surface();
+
+ if (throttle) {
+ struct yagl_context *ctx = yagl_get_context();
+ if (ctx) {
+ yagl_context_throttle(ctx);
+ }
+ }
+
+ if (draw_sfc) {
+ yagl_surface_invalidate(draw_sfc);
+ }
+
+ if (read_sfc && (draw_sfc != read_sfc)) {
+ yagl_surface_invalidate(read_sfc);
+ }
+}
+
+void yagl_render_finish()
+{
+ struct yagl_surface *draw_sfc = yagl_get_draw_surface();
+
+ if (draw_sfc) {
+ draw_sfc->wait_gl(draw_sfc);
+ }
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_resource.h"
+
+void yagl_resource_init(struct yagl_resource *res,
+ yagl_ref_destroy_func destroy,
+ yagl_host_handle handle)
+{
+ yagl_ref_init(&res->ref, destroy);
+ yagl_list_init(&res->list);
+ res->handle = handle;
+}
+
+void yagl_resource_cleanup(struct yagl_resource *res)
+{
+ res->handle = 0;
+ yagl_ref_cleanup(&res->ref);
+}
+
+void yagl_resource_acquire(struct yagl_resource *res)
+{
+ if (res) {
+ yagl_ref_acquire(&res->ref);
+ }
+}
+
+void yagl_resource_release(struct yagl_resource *res)
+{
+ if (res) {
+ yagl_ref_release(&res->ref);
+ }
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_sharegroup.h"
+#include "yagl_object.h"
+#include "yagl_malloc.h"
+
+static void yagl_sharegroup_destroy(struct yagl_ref *ref)
+{
+ struct yagl_sharegroup *sg = (struct yagl_sharegroup*)ref;
+ int i;
+
+ for (i = 0; i < YAGL_NUM_NAMESPACES; ++i) {
+ yagl_namespace_cleanup(&sg->namespaces[i]);
+ }
+
+ for (i = 0; i < YAGL_NUM_TEXTURE_TARGETS; ++i) {
+ yagl_object_release(sg->texture_zero[i]);
+ }
+
+ yagl_ref_cleanup(&sg->ref);
+
+ yagl_free(sg);
+}
+
+struct yagl_sharegroup *yagl_sharegroup_create(void)
+{
+ struct yagl_sharegroup *sg = yagl_malloc0(sizeof(struct yagl_sharegroup));
+ int i;
+
+ yagl_ref_init(&sg->ref, &yagl_sharegroup_destroy);
+
+ for (i = 0; i < YAGL_NUM_NAMESPACES; ++i) {
+ yagl_namespace_init(&sg->namespaces[i]);
+ }
+
+ return sg;
+}
+
+void yagl_sharegroup_acquire(struct yagl_sharegroup *sg)
+{
+ if (sg) {
+ yagl_ref_acquire(&sg->ref);
+ }
+}
+
+void yagl_sharegroup_release(struct yagl_sharegroup *sg)
+{
+ if (sg) {
+ yagl_ref_release(&sg->ref);
+ }
+}
+
+void yagl_sharegroup_add(struct yagl_sharegroup *sg,
+ int ns,
+ struct yagl_object *obj)
+{
+ yagl_namespace_add(&sg->namespaces[ns], obj);
+}
+
+struct yagl_object *yagl_sharegroup_add_named(struct yagl_sharegroup *sg,
+ int ns,
+ yagl_object_name local_name,
+ struct yagl_object *obj)
+{
+ return yagl_namespace_add_named(&sg->namespaces[ns], local_name, obj);
+}
+
+void yagl_sharegroup_remove(struct yagl_sharegroup *sg,
+ int ns,
+ yagl_object_name local_name)
+{
+ yagl_namespace_remove(&sg->namespaces[ns], local_name);
+}
+
+struct yagl_object *yagl_sharegroup_acquire_object(struct yagl_sharegroup *sg,
+ int ns,
+ yagl_object_name local_name)
+{
+ return yagl_namespace_acquire(&sg->namespaces[ns], local_name);
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#define _GNU_SOURCE
+#define _XOPEN_SOURCE 600
+#include "yagl_state.h"
+#include "yagl_log.h"
+#include "yagl_ioctl.h"
+#include "yagl_malloc.h"
+#include "yagl_offscreen.h"
+#include "yagl_onscreen.h"
+#include "yagl_backend.h"
+#include "yagl_transport.h"
+#include "yagl_utils.h"
+#include "yagl_display.h"
+#include "yagl_context.h"
+#include "yagl_fence.h"
+#include "yagl_egl_state.h"
+#include <unistd.h>
+#include <pthread.h>
+#include <sys/mman.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <string.h>
+
+#define YAGL_DEFAULT_MAX_BUFF_SIZE 1048576
+#define YAGL_DEFAULT_MAX_CALL_SIZE 1048576
+
+#define YAGL_REG_BUFFPTR 0
+#define YAGL_REG_TRIGGER 4
+#define YAGL_REGS_SIZE 8
+
+#define YAGL_USER_PTR(regs, index) ((regs) + ((index) * YAGL_REGS_SIZE))
+
+struct yagl_state
+{
+ int fd;
+
+ uint8_t *regs;
+ uint32_t user_index;
+
+ uint8_t *buff;
+ uint32_t buff_size;
+
+ struct yagl_transport *t;
+
+ struct yagl_backend *backend;
+
+ yagl_gl_version gl_version;
+
+ uint8_t *tmp_buff;
+ uint32_t tmp_buff_size;
+
+ uint8_t *tmp_buff2;
+ uint32_t tmp_buff2_size;
+
+ uint8_t *tmp_buff3;
+ uint32_t tmp_buff3_size;
+
+ struct yagl_display *fence_dpy;
+};
+
+static pthread_key_t g_state_key;
+static pthread_once_t g_state_key_init = PTHREAD_ONCE_INIT;
+
+static pthread_mutex_t g_name_gen_mutex;
+static uint32_t g_name_gen_next = 0;
+
+static void *yagl_state_transport_resize(void *ops_data, uint32_t size)
+{
+ struct yagl_state *state = ops_data;
+ void *buff = mmap(NULL,
+ size,
+ PROT_READ|PROT_WRITE,
+ MAP_SHARED,
+ state->fd,
+ sysconf(_SC_PAGE_SIZE));
+
+ if (buff == MAP_FAILED) {
+ fprintf(stderr, "Unable to resize YaGL buffer to %u: %s!\n",
+ size,
+ strerror(errno));
+ return NULL;
+ }
+
+ munmap(state->buff, state->buff_size);
+
+ state->buff = buff;
+ state->buff_size = size;
+
+ return buff;
+}
+
+static void yagl_state_transport_commit(void *ops_data, int sync)
+{
+ struct yagl_state *state = ops_data;
+ volatile uint32_t *trigger =
+ (uint32_t*)(YAGL_USER_PTR(state->regs, state->user_index) +
+ YAGL_REG_TRIGGER);
+
+ *trigger = sync;
+}
+
+static uint32_t yagl_state_transport_flush(void *ops_data, struct yagl_egl_fence **fence)
+{
+ struct yagl_state *state = ops_data;
+ struct yagl_fence *fence_obj = NULL;
+ struct yagl_context *ctx = yagl_get_context();
+
+ if ((!ctx || ctx->need_throttle) && !fence) {
+ /*
+ * Throttle already set up and caller
+ * doesn't want a fence reference - no-op.
+ */
+
+ return 0;
+ }
+
+ if (fence && *fence) {
+ fence_obj = (struct yagl_fence*)*fence;
+ } else if (state->fence_dpy) {
+ fence_obj = state->backend->create_fence(state->fence_dpy);
+ }
+
+ if (ctx && !ctx->need_throttle && (!fence || *fence)) {
+ /*
+ * Throttle haven't been set up yet and caller doesn't
+ * want a fence reference or he passed his own fence -
+ * set up throttle.
+ *
+ * Note that if the caller wants a fence reference then we
+ * don't want to set up throttle - the caller will wait for
+ * that fence anyway, so throttling is not necessary.
+ */
+ yagl_context_set_need_throttle(ctx, fence_obj);
+ }
+
+ if (!fence_obj) {
+ if (fence) {
+ *fence = NULL;
+ }
+ return 0;
+ }
+
+ if (fence) {
+ *fence = &fence_obj->base;
+ return fence_obj->seq;
+ } else {
+ uint32_t seq = fence_obj->seq;
+ yagl_fence_release(fence_obj);
+ return seq;
+ }
+}
+
+static struct yagl_transport_ops yagl_state_transport_ops =
+{
+ .resize = yagl_state_transport_resize,
+ .commit = yagl_state_transport_commit,
+ .flush = yagl_state_transport_flush
+};
+
+static void yagl_state_free(void *ptr)
+{
+ struct yagl_state *state = ptr;
+
+ YAGL_LOG_FUNC_ENTER(yagl_state_free, "%p", ptr);
+
+ if (!ptr) {
+ return;
+ }
+
+ state->backend->destroy(state->backend);
+
+ yagl_transport_destroy(state->t);
+
+ munmap(state->buff, state->buff_size);
+ munmap(state->regs, sysconf(_SC_PAGE_SIZE));
+
+ close(state->fd);
+
+ yagl_free(state->tmp_buff);
+ yagl_free(state->tmp_buff2);
+ yagl_free(state->tmp_buff3);
+
+ yagl_free(state);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+static void yagl_state_key_init()
+{
+ pthread_key_create(&g_state_key, yagl_state_free);
+
+ yagl_mutex_init(&g_name_gen_mutex);
+}
+
+static void yagl_state_atfork()
+{
+ struct yagl_state *state;
+
+ /*
+ * We're currently in forked child, this means that someone
+ * issued some GL calls and then forked!
+ * The only thing we can do here is resetting the state
+ * and make the next GL call behave as the first one.
+ */
+
+ YAGL_LOG_FUNC_SET(yagl_state_atfork);
+
+ YAGL_LOG_WARN("Forking after GL calls!");
+
+ pthread_once(&g_state_key_init, yagl_state_key_init);
+
+ state = (struct yagl_state*)pthread_getspecific(g_state_key);
+
+ if (state) {
+ /*
+ * 'fork' was called by a GL thread. Close
+ * parent resources here.
+ */
+
+ yagl_display_atfork();
+
+ munmap(state->buff, state->buff_size);
+ munmap(state->regs, sysconf(_SC_PAGE_SIZE));
+
+ close(state->fd);
+
+ yagl_free(state->tmp_buff);
+ yagl_free(state->tmp_buff2);
+ yagl_free(state->tmp_buff3);
+
+ yagl_free(state);
+ } else {
+ /*
+ * 'fork' was called by a non-GL thread. No-op.
+ */
+ }
+
+ pthread_setspecific(g_state_key, NULL);
+}
+
+static struct yagl_state *yagl_get_state()
+{
+ struct yagl_state *state;
+ unsigned int version = 0;
+ struct yagl_user_info user_info = { 0, 0 };
+ char *tmp;
+ int max_buff_size, max_call_size;
+
+ pthread_once(&g_state_key_init, yagl_state_key_init);
+
+ state = (struct yagl_state*)pthread_getspecific(g_state_key);
+
+ if (state) {
+ return state;
+ }
+
+ YAGL_LOG_FUNC_ENTER(yagl_state_init, NULL);
+
+ state = yagl_malloc0(sizeof(struct yagl_state));
+
+ state->fd = open("/dev/yagl", O_RDWR | O_SYNC | O_CLOEXEC);
+
+ if (state->fd == -1) {
+ fprintf(stderr, "Critical error! Unable to open YaGL kernel device: %s!\n",
+ strerror(errno));
+ exit(1);
+ }
+
+ if (ioctl(state->fd, YAGL_IOC_GET_VERSION, &version) == -1) {
+ fprintf(stderr, "Critical error! Unable to get YaGL version: %s!\n",
+ strerror(errno));
+ exit(1);
+ }
+
+ if (version != YAGL_VERSION) {
+ fprintf(stderr,
+ "Critical error! YaGL version mismatch: version is %u, but %u is expected!\n",
+ version,
+ YAGL_VERSION );
+ exit(1);
+ }
+
+ if (ioctl(state->fd, YAGL_IOC_GET_USER_INFO, &user_info) == -1) {
+ fprintf(stderr, "Critical error! Unable to get YaGL user info: %s!\n",
+ strerror(errno));
+ exit(1);
+ }
+
+ if ((user_info.index < 0) ||
+ (user_info.index >= (sysconf(_SC_PAGE_SIZE) / YAGL_REGS_SIZE))) {
+ fprintf(stderr, "Critical error! Bad user index: %d!\n",
+ user_info.index);
+ exit(1);
+ }
+
+ state->user_index = user_info.index;
+
+ switch (user_info.render_type) {
+ case yagl_render_type_offscreen:
+ case yagl_render_type_onscreen:
+ break;
+ default:
+ fprintf(stderr, "Critical error! Bad render type reported by kernel: %d!\n",
+ user_info.render_type);
+ exit(1);
+ }
+
+ switch (user_info.gl_version) {
+ case yagl_gl_2:
+ case yagl_gl_3_1:
+ case yagl_gl_3_1_es3:
+ case yagl_gl_3_2:
+ break;
+ default:
+ fprintf(stderr, "Critical error! Bad host OpenGL version reported by kernel: %d!\n",
+ user_info.gl_version);
+ exit(1);
+ }
+
+ state->regs = mmap(NULL,
+ sysconf(_SC_PAGE_SIZE),
+ PROT_READ|PROT_WRITE,
+ MAP_SHARED,
+ state->fd,
+ 0);
+
+ if (state->regs == MAP_FAILED) {
+ fprintf(stderr, "Critical error! Unable to map YaGL regs memory: %s!\n",
+ strerror(errno));
+ exit(1);
+ }
+
+ tmp = getenv("YAGL_MAX_BUFF_SIZE");
+ max_buff_size = tmp ? atoi(tmp) : 0;
+
+ tmp = getenv("YAGL_MAX_CALL_SIZE");
+ max_call_size = tmp ? atoi(tmp) : 0;
+
+ if (max_buff_size <= 0) {
+ max_buff_size = YAGL_DEFAULT_MAX_BUFF_SIZE;
+ }
+
+ if (max_call_size <= 0) {
+ max_call_size = YAGL_DEFAULT_MAX_CALL_SIZE;
+ }
+
+ state->t = yagl_transport_create(&yagl_state_transport_ops,
+ state,
+ max_buff_size,
+ max_call_size);
+
+ if (!state->t) {
+ fprintf(stderr, "Critical error! Unable to create YaGL transport!\n");
+ exit(1);
+ }
+
+ switch (user_info.render_type) {
+ case yagl_render_type_offscreen:
+ state->backend = yagl_offscreen_create();
+ break;
+ case yagl_render_type_onscreen:
+ state->backend = yagl_onscreen_create();
+ break;
+ default:
+ break;
+ }
+
+ state->gl_version = user_info.gl_version;
+
+ pthread_setspecific(g_state_key, state);
+
+ pthread_atfork(NULL, NULL, &yagl_state_atfork);
+
+ YAGL_LOG_FUNC_EXIT("%p", state);
+
+ return state;
+}
+
+struct yagl_transport *yagl_get_transport()
+{
+ return yagl_get_state()->t;
+}
+
+uint8_t *yagl_get_tmp_buffer(uint32_t size)
+{
+ struct yagl_state *state = yagl_get_state();
+
+ if (size <= state->tmp_buff_size) {
+ return state->tmp_buff;
+ }
+
+ yagl_free(state->tmp_buff);
+
+ state->tmp_buff_size = size;
+ state->tmp_buff = yagl_malloc(state->tmp_buff_size);
+
+ return state->tmp_buff;
+}
+
+uint8_t *yagl_get_tmp_buffer2(uint32_t size)
+{
+ struct yagl_state *state = yagl_get_state();
+
+ if (size <= state->tmp_buff2_size) {
+ return state->tmp_buff2;
+ }
+
+ yagl_free(state->tmp_buff2);
+
+ state->tmp_buff2_size = size;
+ state->tmp_buff2 = yagl_malloc(state->tmp_buff2_size);
+
+ return state->tmp_buff2;
+}
+
+uint8_t *yagl_get_tmp_buffer3(uint32_t size)
+{
+ struct yagl_state *state = yagl_get_state();
+
+ if (size <= state->tmp_buff3_size) {
+ return state->tmp_buff3;
+ }
+
+ yagl_free(state->tmp_buff3);
+
+ state->tmp_buff3_size = size;
+ state->tmp_buff3 = yagl_malloc(state->tmp_buff3_size);
+
+ return state->tmp_buff3;
+}
+
+yagl_object_name yagl_get_global_name()
+{
+ uint32_t ret;
+
+ pthread_once(&g_state_key_init, yagl_state_key_init);
+
+ pthread_mutex_lock(&g_name_gen_mutex);
+
+ if (!g_name_gen_next) {
+ /*
+ * 0 handles are invalid.
+ */
+
+ ++g_name_gen_next;
+ }
+
+ ret = g_name_gen_next++;
+
+ pthread_mutex_unlock(&g_name_gen_mutex);
+
+ return ret;
+}
+
+yagl_gl_version yagl_get_host_gl_version()
+{
+ return yagl_get_state()->gl_version;
+}
+
+struct yagl_backend *yagl_get_backend()
+{
+ return yagl_get_state()->backend;
+}
+
+int yagl_mlock(void *ptr, uint32_t size)
+{
+ struct yagl_mlock_arg arg;
+
+ arg.address = (unsigned long)ptr;
+ arg.size = size;
+
+ return ioctl(yagl_get_state()->fd, YAGL_IOC_MLOCK, &arg);
+}
+
+int yagl_munlock(void *ptr)
+{
+ unsigned long arg = (unsigned long)ptr;
+
+ return ioctl(yagl_get_state()->fd, YAGL_IOC_MUNLOCK, &arg);
+}
+
+void yagl_set_fence_display(struct yagl_display *fence_dpy)
+{
+ struct yagl_state *state = yagl_get_state();
+
+ if (!state->fence_dpy) {
+ state->fence_dpy = fence_dpy;
+ }
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_surface.h"
+#include "yagl_utils.h"
+#include "yagl_native_drawable.h"
+#include "yagl_malloc.h"
+#include "yagl_client_interface.h"
+#include "yagl_tex_image_binding.h"
+#include <assert.h>
+#include "EGL/eglext.h"
+
+struct yagl_surface_tex_image_binding
+{
+ struct yagl_tex_image_binding base;
+
+ struct yagl_client_interface *iface;
+
+ struct yagl_surface *sfc; /* Weak pointer. */
+};
+
+static void yagl_surface_tex_image_unbind(struct yagl_tex_image_binding *binding)
+{
+ struct yagl_surface_tex_image_binding *sfc_binding =
+ (struct yagl_surface_tex_image_binding*)binding;
+ struct yagl_surface *sfc = sfc_binding->sfc;
+
+ pthread_mutex_lock(&sfc->mtx);
+
+ yagl_free(sfc->binding);
+ sfc->binding = NULL;
+
+ pthread_mutex_unlock(&sfc->mtx);
+}
+
+void yagl_surface_init_window(struct yagl_surface *sfc,
+ yagl_ref_destroy_func destroy_func,
+ yagl_host_handle handle,
+ struct yagl_display *dpy,
+ struct yagl_native_drawable *native_window)
+{
+ yagl_resource_init(&sfc->res, destroy_func, handle);
+
+ sfc->dpy = dpy;
+ sfc->type = EGL_WINDOW_BIT;
+ sfc->native_drawable = native_window;
+
+ yagl_recursive_mutex_init(&sfc->mtx);
+}
+
+void yagl_surface_init_pixmap(struct yagl_surface *sfc,
+ yagl_ref_destroy_func destroy_func,
+ yagl_host_handle handle,
+ struct yagl_display *dpy,
+ struct yagl_native_drawable *native_pixmap)
+{
+ yagl_resource_init(&sfc->res, destroy_func, handle);
+
+ sfc->dpy = dpy;
+ sfc->type = EGL_PIXMAP_BIT;
+ sfc->native_drawable = native_pixmap;
+
+ yagl_recursive_mutex_init(&sfc->mtx);
+}
+
+void yagl_surface_init_pbuffer(struct yagl_surface *sfc,
+ yagl_ref_destroy_func destroy_func,
+ yagl_host_handle handle,
+ struct yagl_display *dpy)
+{
+ yagl_resource_init(&sfc->res, destroy_func, handle);
+
+ sfc->dpy = dpy;
+ sfc->type = EGL_PBUFFER_BIT;
+
+ yagl_recursive_mutex_init(&sfc->mtx);
+}
+
+void yagl_surface_cleanup(struct yagl_surface *sfc)
+{
+ yagl_surface_release_tex_image(sfc);
+
+ if (sfc->native_drawable) {
+ sfc->native_drawable->destroy(sfc->native_drawable);
+ sfc->native_drawable = NULL;
+ }
+ yagl_resource_cleanup(&sfc->res);
+ pthread_mutex_destroy(&sfc->mtx);
+}
+
+EGLSurface yagl_surface_get_handle(struct yagl_surface *sfc)
+{
+ switch (sfc->type) {
+ case EGL_PBUFFER_BIT:
+ return (EGLSurface)sfc->res.handle;
+ case EGL_PIXMAP_BIT:
+ case EGL_WINDOW_BIT:
+ return (EGLSurface)sfc->native_drawable->os_drawable;
+ default:
+ assert(0);
+ return NULL;
+ }
+}
+
+void yagl_surface_invalidate(struct yagl_surface *sfc)
+{
+ pthread_mutex_lock(&sfc->mtx);
+
+ if (sfc->lock_hint == 0) {
+ sfc->invalidate(sfc);
+ }
+
+ pthread_mutex_unlock(&sfc->mtx);
+}
+
+int yagl_surface_lock(struct yagl_surface *sfc, EGLint hint)
+{
+ int ret = 0;
+
+ pthread_mutex_lock(&sfc->mtx);
+
+ if (sfc->lock_hint == 0) {
+ sfc->lock_hint = (hint & EGL_READ_SURFACE_BIT_KHR) |
+ (hint & EGL_WRITE_SURFACE_BIT_KHR);
+ if (sfc->lock_hint == 0) {
+ sfc->lock_hint = EGL_READ_SURFACE_BIT_KHR |
+ EGL_WRITE_SURFACE_BIT_KHR;
+ }
+
+ ret = 1;
+ }
+
+ pthread_mutex_unlock(&sfc->mtx);
+
+ return ret;
+}
+
+int yagl_surface_locked(struct yagl_surface *sfc)
+{
+ int ret;
+
+ pthread_mutex_lock(&sfc->mtx);
+
+ ret = (sfc->lock_hint != 0);
+
+ pthread_mutex_unlock(&sfc->mtx);
+
+ return ret;
+}
+
+int yagl_surface_unlock(struct yagl_surface *sfc)
+{
+ int ret = 0;
+
+ pthread_mutex_lock(&sfc->mtx);
+
+ if (sfc->lock_hint != 0) {
+ if (sfc->lock_ptr) {
+ sfc->unmap(sfc);
+ }
+
+ sfc->lock_hint = 0;
+ sfc->lock_ptr = NULL;
+ sfc->lock_stride = 0;
+ ret = 1;
+ }
+
+ pthread_mutex_unlock(&sfc->mtx);
+
+ return ret;
+}
+
+void *yagl_surface_map(struct yagl_surface *sfc, uint32_t *stride)
+{
+ void *ret = NULL;
+
+ pthread_mutex_lock(&sfc->mtx);
+
+ if (sfc->lock_hint != 0) {
+ if (!sfc->lock_ptr) {
+ sfc->map(sfc);
+ }
+ if (sfc->lock_ptr) {
+ ret = sfc->lock_ptr;
+ *stride = sfc->lock_stride;
+ }
+ }
+
+ pthread_mutex_unlock(&sfc->mtx);
+
+ return ret;
+}
+
+struct yagl_tex_image_binding
+ *yagl_surface_create_tex_image_binding(struct yagl_surface *sfc,
+ struct yagl_client_interface *iface)
+{
+ struct yagl_surface_tex_image_binding *binding;
+
+ binding = yagl_malloc0(sizeof(*binding));
+
+ binding->base.unbind = &yagl_surface_tex_image_unbind;
+ binding->iface = iface;
+ binding->sfc = sfc;
+
+ return &binding->base;
+}
+
+int yagl_surface_bind_tex_image(struct yagl_surface *sfc,
+ struct yagl_tex_image_binding *binding)
+{
+ struct yagl_surface_tex_image_binding *sfc_binding =
+ (struct yagl_surface_tex_image_binding*)binding;
+ int ret = 0;
+
+ pthread_mutex_lock(&sfc->mtx);
+
+ if (sfc->binding || (sfc_binding->sfc != sfc)) {
+ goto out;
+ }
+
+ sfc->binding = binding;
+
+ ret = 1;
+
+out:
+ pthread_mutex_unlock(&sfc->mtx);
+
+ return ret;
+}
+
+void yagl_surface_release_tex_image(struct yagl_surface *sfc)
+{
+ struct yagl_surface_tex_image_binding *binding;
+
+ pthread_mutex_lock(&sfc->mtx);
+
+ if (sfc->binding) {
+ binding = (struct yagl_surface_tex_image_binding*)sfc->binding;
+
+ binding->iface->release_tex_image(binding->iface, binding->base.cookie);
+
+ yagl_free(sfc->binding);
+ sfc->binding = NULL;
+ }
+
+ pthread_mutex_unlock(&sfc->mtx);
+}
+
+int yagl_surface_mark_current(struct yagl_surface *sfc, int current)
+{
+ int ret = 1;
+
+ pthread_mutex_lock(&sfc->mtx);
+
+ if ((!current ^ !sfc->current) != 0) {
+ sfc->current = current;
+ } else {
+ ret = 0;
+ }
+
+ pthread_mutex_unlock(&sfc->mtx);
+
+ return ret;
+}
+
+void yagl_surface_acquire(struct yagl_surface *sfc)
+{
+ if (sfc) {
+ yagl_resource_acquire(&sfc->res);
+ }
+}
+
+void yagl_surface_release(struct yagl_surface *sfc)
+{
+ if (sfc) {
+ yagl_resource_release(&sfc->res);
+ }
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_SURFACE_H_
+#define _YAGL_SURFACE_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+#include "yagl_native_types.h"
+#include "yagl_resource.h"
+#include "EGL/egl.h"
+
+struct yagl_display;
+struct yagl_native_drawable;
+struct yagl_client_interface;
+struct yagl_client_image;
+struct yagl_tex_image_binding;
+
+struct yagl_surface
+{
+ struct yagl_resource res;
+
+ struct yagl_display *dpy;
+
+ EGLenum type;
+
+ /*
+ * Non-NULL only for window and pixmap surfaces.
+ */
+ struct yagl_native_drawable *native_drawable;
+
+ pthread_mutex_t mtx;
+
+ /*
+ * This is for EGL_KHR_lock_surface.
+ *
+ * 'lock_hint' is 0 when surface is not locked.
+ * 'lock_hint' is a combination of EGL_READ_SURFACE_BIT_KHR and
+ * EGL_WRITE_SURFACE_BIT_KHR when surface is locked.
+ *
+ * 'lock_ptr' is non-NULL when map has been called. This implies that the surface
+ * is locked.
+ */
+ EGLint lock_hint;
+ void *lock_ptr;
+ uint32_t lock_stride;
+
+ struct yagl_tex_image_binding *binding;
+
+ int current;
+
+ void (*invalidate)(struct yagl_surface */*sfc*/);
+
+ int (*swap_buffers)(struct yagl_surface */*sfc*/);
+
+ int (*copy_buffers)(struct yagl_surface */*sfc*/, yagl_os_pixmap /*target*/);
+
+ void (*wait_x)(struct yagl_surface */*sfc*/);
+
+ void (*wait_gl)(struct yagl_surface */*sfc*/);
+
+ void (*map)(struct yagl_surface */*sfc*/);
+
+ void (*unmap)(struct yagl_surface */*sfc*/);
+
+ void (*set_swap_interval)(struct yagl_surface */*sfc*/, int /*interval*/);
+
+ struct yagl_client_image *(*create_image)(struct yagl_surface */*sfc*/,
+ struct yagl_client_interface */*iface*/);
+};
+
+/*
+ * Takes ownership of 'native_window'.
+ */
+void yagl_surface_init_window(struct yagl_surface *sfc,
+ yagl_ref_destroy_func destroy_func,
+ yagl_host_handle handle,
+ struct yagl_display *dpy,
+ struct yagl_native_drawable *native_window);
+
+/*
+ * Takes ownership of 'native_pixmap'.
+ */
+void yagl_surface_init_pixmap(struct yagl_surface *sfc,
+ yagl_ref_destroy_func destroy_func,
+ yagl_host_handle handle,
+ struct yagl_display *dpy,
+ struct yagl_native_drawable *native_pixmap);
+
+void yagl_surface_init_pbuffer(struct yagl_surface *sfc,
+ yagl_ref_destroy_func destroy_func,
+ yagl_host_handle handle,
+ struct yagl_display *dpy);
+
+void yagl_surface_cleanup(struct yagl_surface *sfc);
+
+/*
+ * Surfaces cannot be simply referenced by 'sfc->res.handle', this is due to
+ * Evas GL, it assumes that surface handles are same for same drawables. So,
+ * in case of window and pixmap surfaces we'll use the drawable itself as
+ * a handle, in case of pbuffer surface we'll simply use 'sfc->res.handle'.
+ */
+EGLSurface yagl_surface_get_handle(struct yagl_surface *sfc);
+
+void yagl_surface_invalidate(struct yagl_surface *sfc);
+
+int yagl_surface_lock(struct yagl_surface *sfc, EGLint hint);
+
+int yagl_surface_locked(struct yagl_surface *sfc);
+
+int yagl_surface_unlock(struct yagl_surface *sfc);
+
+void *yagl_surface_map(struct yagl_surface *sfc, uint32_t *stride);
+
+/*
+ * Guaranteed to succeed.
+ */
+struct yagl_tex_image_binding
+ *yagl_surface_create_tex_image_binding(struct yagl_surface *sfc,
+ struct yagl_client_interface *iface);
+
+/*
+ * Takes ownership of 'binding'.
+ */
+int yagl_surface_bind_tex_image(struct yagl_surface *sfc,
+ struct yagl_tex_image_binding *binding);
+
+void yagl_surface_release_tex_image(struct yagl_surface *sfc);
+
+int yagl_surface_mark_current(struct yagl_surface *sfc, int current);
+
+/*
+ * Helper functions that simply acquire/release yagl_surface::res
+ * @{
+ */
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_surface_acquire(struct yagl_surface *sfc);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_surface_release(struct yagl_surface *sfc);
+
+/*
+ * @}
+ */
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_transport.h"
+#include "yagl_malloc.h"
+#include "yagl_log.h"
+#include "yagl_egl_fence.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define YAGL_MAX_RETRIES 100
+
+typedef enum
+{
+ yagl_call_result_ok = 0xA, /* Call is ok. */
+ yagl_call_result_retry = 0xB, /* Page fault on host, retry is required. */
+} yagl_call_result;
+
+static __inline void yagl_transport_ptr_reset(struct yagl_transport *t)
+{
+ /*
+ * 4 element header.
+ */
+ t->ptr = t->buff + (4 * 8);
+
+ t->direct = 0;
+
+ t->num_in_args = t->num_in_arrays = 0;
+ t->num_in_da = t->num_out_da = 0;
+}
+
+static __inline uint32_t yagl_transport_batch_size(struct yagl_transport *t)
+{
+ return t->ptr - (t->buff + (4 * 8));
+}
+
+static __inline void yagl_transport_update_header(struct yagl_transport *t,
+ uint32_t fence_seq,
+ uint32_t batch_size)
+{
+ *(uint32_t*)(t->buff + 8 * 0) = 0; /* res */
+ *(uint32_t*)(t->buff + 8 * 1) = fence_seq;
+ *(uint32_t*)(t->buff + 8 * 2) = batch_size;
+ *(uint32_t*)(t->buff + 8 * 3) = t->num_out_da;
+};
+
+static __inline int yagl_transport_check_call_result(struct yagl_transport *t,
+ uint32_t* retry_count)
+{
+ uint32_t res = *(uint32_t*)t->buff;
+ *(uint32_t*)t->buff = 0;
+
+ switch (res) {
+ case yagl_call_result_ok:
+ *retry_count = 0;
+ return 1;
+ case yagl_call_result_retry:
+ if (!t->direct) {
+ fprintf(stderr,
+ "Critical error! Retry returned by host while not in direct mode!\n");
+ exit(1);
+ }
+ if (++*retry_count >= YAGL_MAX_RETRIES) {
+ fprintf(stderr,
+ "Critical error! Max retry count %u reached!\n",
+ *retry_count);
+ exit(1);
+ }
+ return 0;
+ default:
+ fprintf(stderr, "Critical error! Bad call result - %u!\n", res);
+ exit(1);
+ return 0;
+ }
+}
+
+static int yagl_transport_resize(struct yagl_transport *t, uint32_t size)
+{
+ void *buff;
+ uint32_t offset;
+
+ size = (size + 4095U) & ~4095U;
+
+ buff = t->ops->resize(t->ops_data, size);
+
+ if (!buff) {
+ return 0;
+ }
+
+ offset = t->ptr - t->buff;
+
+ t->buff = buff;
+ t->buff_size = size;
+
+ t->ptr = t->buff + offset;
+
+ return 1;
+}
+
+static int yagl_transport_fit(struct yagl_transport *t, uint32_t size)
+{
+ uint32_t new_size;
+
+ if ((t->ptr + size) <= (t->buff + t->buff_size)) {
+ return 1;
+ }
+
+ new_size = t->ptr - t->buff + size;
+
+ if (new_size <= t->max_buff_size) {
+ return yagl_transport_resize(t, new_size);
+ }
+
+ return 0;
+}
+
+struct yagl_transport *yagl_transport_create(struct yagl_transport_ops *ops,
+ void *ops_data,
+ uint32_t max_buff_size,
+ uint32_t max_call_size)
+{
+ struct yagl_transport *t;
+
+ t = yagl_malloc0(sizeof(*t));
+
+ t->ops = ops;
+ t->ops_data = ops_data;
+
+ t->max_buff_size = max_buff_size;
+ t->max_call_size = max_call_size;
+
+ t->max_buff_size = (t->max_buff_size + 4095U) & ~4095U;
+
+ if (t->max_buff_size < 4096) {
+ t->max_buff_size = 4096;
+ }
+
+ if (t->max_call_size > t->max_buff_size) {
+ t->max_call_size = t->max_buff_size;
+ }
+
+ yagl_transport_ptr_reset(t);
+
+ if (!yagl_transport_resize(t, 4096)) {
+ yagl_free(t);
+ return NULL;
+ }
+
+ return t;
+}
+
+void yagl_transport_destroy(struct yagl_transport *t)
+{
+ yagl_free(t);
+}
+
+void yagl_transport_begin(struct yagl_transport *t,
+ yagl_api_id api,
+ uint32_t func_id,
+ uint32_t min_data_size,
+ uint32_t max_data_size)
+{
+ /*
+ * 3 element func header + data + reserve for out DAs.
+ */
+
+ uint32_t max_size = (3 * 8) + max_data_size + (8 * 2 * YAGL_TRANSPORT_MAX_OUT_DA);
+
+ if (max_size > t->max_call_size) {
+ uint32_t min_size = 3 * 8 + min_data_size + (8 * 2 * YAGL_TRANSPORT_MAX_OUT_DA);
+
+ if (!yagl_transport_fit(t, min_size)) {
+ yagl_transport_flush(t, NULL);
+ }
+
+ t->direct = 1;
+ } else {
+ t->direct = 0;
+
+ if (!yagl_transport_fit(t, max_size)) {
+ yagl_transport_flush(t, NULL);
+ if (!yagl_transport_fit(t, max_size)) {
+ t->direct = 1;
+ }
+ }
+ }
+
+ yagl_transport_put_out_uint32_t(t, api);
+ yagl_transport_put_out_uint32_t(t, func_id);
+ yagl_transport_put_out_uint32_t(t, t->direct);
+}
+
+void yagl_transport_end(struct yagl_transport *t)
+{
+ uint32_t i, retry_count = 0;
+ struct yagl_egl_fence *fence = NULL;
+ int have_ret = (t->num_in_args != 0) || (t->num_in_arrays != 0);
+
+ if (!have_ret) {
+ if (!t->direct) {
+ /*
+ * No return values and not direct, entirely async.
+ * very fast path.
+ */
+ return;
+ }
+
+ /*
+ * No return values, but is direct, needs commit.
+ * fast path.
+ */
+
+ yagl_transport_update_header(t, t->ops->flush(t->ops_data, NULL),
+ yagl_transport_batch_size(t));
+
+ for (i = 0; i < t->num_out_da; ++i) {
+ yagl_transport_put_out_va(t, t->out_da[i].data);
+ yagl_transport_put_out_uint32_t(t, t->out_da[i].size);
+ }
+
+ do {
+ for (i = 0; i < t->num_out_da; ++i) {
+ yagl_transport_probe_read(t->out_da[i].data, t->out_da[i].size);
+ }
+
+ t->ops->commit(t->ops_data, 0);
+ } while (!yagl_transport_check_call_result(t, &retry_count));
+
+ yagl_transport_ptr_reset(t);
+
+ return;
+ }
+
+ /*
+ * Have return values, sync.
+ * slow path.
+ */
+
+ yagl_transport_update_header(t, t->ops->flush(t->ops_data, &fence),
+ yagl_transport_batch_size(t));
+
+ for (i = 0; i < t->num_out_da; ++i) {
+ yagl_transport_put_out_va(t, t->out_da[i].data);
+ yagl_transport_put_out_uint32_t(t, t->out_da[i].size);
+ }
+
+ do {
+ for (i = 0; i < t->num_out_da; ++i) {
+ yagl_transport_probe_read(t->out_da[i].data, t->out_da[i].size);
+ }
+
+ t->ops->commit(t->ops_data, 0);
+ } while (!yagl_transport_check_call_result(t, &retry_count));
+
+ if (fence) {
+ fence->wait(fence);
+ yagl_egl_fence_release(fence);
+ }
+
+ do {
+ for (i = 0; i < t->num_in_da; ++i) {
+ yagl_transport_probe_write(t->in_da[i].data, t->in_da[i].size);
+ }
+
+ t->ops->commit(t->ops_data, 1);
+ } while (!yagl_transport_check_call_result(t, &retry_count));
+
+ for (i = 0; i < t->num_in_args; ++i) {
+ if (t->in_args[i].arg_ptr) {
+ memcpy(t->in_args[i].arg_ptr, t->in_args[i].buff_ptr, t->in_args[i].size);
+ }
+ }
+
+ for (i = 0; i < t->num_in_arrays; ++i) {
+ if (!t->direct &&
+ t->in_arrays[i].arg_ptr &&
+ ((*t->in_arrays[i].count) > 0)) {
+ memcpy(t->in_arrays[i].arg_ptr,
+ t->in_arrays[i].buff_ptr,
+ t->in_arrays[i].el_size * (*t->in_arrays[i].count));
+ }
+ if (t->in_arrays[i].ret_count) {
+ *t->in_arrays[i].ret_count = *t->in_arrays[i].count;
+ }
+ }
+
+ yagl_transport_ptr_reset(t);
+}
+
+void yagl_transport_flush(struct yagl_transport *t,
+ struct yagl_egl_fence *fence)
+{
+ uint32_t batch_size = yagl_transport_batch_size(t);
+
+ if ((batch_size == 0) && !fence) {
+ return;
+ }
+
+ if (fence) {
+ yagl_transport_update_header(t,
+ t->ops->flush(t->ops_data, &fence), batch_size);
+ } else {
+ yagl_transport_update_header(t,
+ t->ops->flush(t->ops_data, NULL), batch_size);
+ }
+
+ t->ops->commit(t->ops_data, 0);
+
+ yagl_transport_ptr_reset(t);
+}
+
+void yagl_transport_wait(struct yagl_transport *t)
+{
+ t->ops->commit(t->ops_data, 1);
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_TRANSPORT_EGL_H_
+#define _YAGL_TRANSPORT_EGL_H_
+
+#include "yagl_transport.h"
+#include "EGL/egl.h"
+
+static __inline int32_t yagl_transport_attrib_list_count(const EGLint *value)
+{
+ int32_t count = 0;
+
+ if (value) {
+ EGLint tmp = value[count];
+ while (tmp != EGL_NONE) {
+ count += 2;
+ tmp = value[count];
+ }
+ ++count;
+ }
+
+ return count;
+}
+
+static __inline void yagl_transport_put_out_EGLint(struct yagl_transport *t,
+ EGLint value)
+{
+ yagl_transport_put_out_uint32_t(t, value);
+}
+
+static __inline void yagl_transport_put_out_EGLenum(struct yagl_transport *t,
+ EGLenum value)
+{
+ yagl_transport_put_out_uint32_t(t, value);
+}
+
+static __inline void yagl_transport_put_in_EGLint(struct yagl_transport *t,
+ EGLint *value)
+{
+ yagl_transport_put_in_uint32_t(t, (uint32_t*)value);
+}
+
+static __inline void yagl_transport_put_in_EGLBoolean(struct yagl_transport *t,
+ EGLBoolean *value)
+{
+ yagl_transport_put_in_uint32_t(t, value);
+}
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_utils.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+void yagl_mutex_init(pthread_mutex_t* mutex)
+{
+ if (pthread_mutex_init(mutex, NULL) != 0)
+ {
+ fprintf(stderr, "Critical error! Unable to init mutex!\n");
+ exit(1);
+ }
+}
+
+void yagl_recursive_mutex_init(pthread_mutex_t* mutex)
+{
+ pthread_mutexattr_t attrs;
+
+ pthread_mutexattr_init(&attrs);
+ pthread_mutexattr_settype(&attrs, PTHREAD_MUTEX_RECURSIVE);
+
+ if (pthread_mutex_init(mutex, &attrs) != 0)
+ {
+ fprintf(stderr, "Critical error! Unable to init recursive mutex!\n");
+ exit(1);
+ }
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_vector.h"
+#include "yagl_malloc.h"
+#include <string.h>
+#include <assert.h>
+
+#define YAGL_VECTOR_DEFAULT_CAPACITY 10
+
+void yagl_vector_init(struct yagl_vector *v,
+ int elem_size,
+ int initial_capacity)
+{
+ assert(elem_size > 0);
+
+ v->elem_size = elem_size;
+ v->capacity = (initial_capacity < YAGL_VECTOR_DEFAULT_CAPACITY) ?
+ YAGL_VECTOR_DEFAULT_CAPACITY
+ : initial_capacity;
+ v->data = yagl_malloc0(v->capacity * v->elem_size);
+ v->size = 0;
+}
+
+void yagl_vector_cleanup(struct yagl_vector *v)
+{
+ yagl_free(v->data);
+ memset(v, 0, sizeof(*v));
+}
+
+void *yagl_vector_detach(struct yagl_vector *v)
+{
+ void *tmp = v->data;
+ memset(v, 0, sizeof(*v));
+ return tmp;
+}
+
+int yagl_vector_size(struct yagl_vector *v)
+{
+ return v->size;
+}
+
+int yagl_vector_capacity(struct yagl_vector *v)
+{
+ return v->capacity;
+}
+
+void yagl_vector_push_back(struct yagl_vector *v, const void *elem)
+{
+ if (v->size >= v->capacity) {
+ void *tmp;
+
+ v->capacity = (v->size * 3) / 2;
+
+ tmp = yagl_malloc(v->capacity * v->elem_size);
+ memcpy(tmp, v->data, (v->size * v->elem_size));
+
+ yagl_free(v->data);
+
+ v->data = tmp;
+ }
+
+ memcpy((char*)v->data + (v->size * v->elem_size), elem, v->elem_size);
+
+ ++v->size;
+}
+
+void yagl_vector_resize(struct yagl_vector *v, int new_size)
+{
+ if (new_size <= v->capacity) {
+ v->size = new_size;
+ } else {
+ void *tmp;
+
+ v->capacity = (new_size * 3) / 2;
+
+ tmp = yagl_malloc(v->capacity * v->elem_size);
+ memcpy(tmp, v->data, (v->size * v->elem_size));
+
+ yagl_free(v->data);
+
+ v->data = tmp;
+ v->size = new_size;
+ }
+}
+
+void *yagl_vector_data(struct yagl_vector *v)
+{
+ return v->data;
+}
--- /dev/null
+set(SOURCES
+ yagl_gles_vertex_array.c
+ yagl_gles_array.c
+ yagl_gles_buffer.c
+ yagl_gles_texture.c
+ yagl_gles_texture_unit.c
+ yagl_gles_framebuffer.c
+ yagl_gles_renderbuffer.c
+ yagl_gles_image.c
+ yagl_gles_sampler.c
+ yagl_gles_context.c
+ yagl_gles_validate.c
+ yagl_gles_calls.c
+ yagl_gles_utils.c
+ yagl_gles_pixel_formats.c
+ yagl_host_gles_calls.c
+ yagl_texcompress_etc1.c
+ yagl_pixel_format.c
+)
+
+include_directories(.)
+
+add_library(GLES_common STATIC ${SOURCES})
+
+target_link_libraries(GLES_common EGL)
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GLES2/gl2.h"
+#include "GLES2/gl2ext.h"
+#include "yagl_gles_array.h"
+#include "yagl_gles_buffer.h"
+#include "yagl_state.h"
+#include "yagl_utils.h"
+#include "yagl_host_gles_calls.h"
+#include <string.h>
+#include <assert.h>
+
+/*
+ * We can't include GL/glext.h here
+ */
+#define GL_HALF_FLOAT 0x140B
+#define GL_INT_2_10_10_10_REV 0x8D9F
+
+static __inline int yagl_get_el_size(GLenum type,
+ int integer,
+ int *el_size,
+ GLenum *actual_type)
+{
+ if (actual_type) {
+ *actual_type = type;
+ }
+
+ switch (type) {
+ case GL_BYTE:
+ *el_size = 1;
+ return 1;
+ case GL_UNSIGNED_BYTE:
+ *el_size = 1;
+ return 1;
+ case GL_SHORT:
+ *el_size = 2;
+ return 1;
+ case GL_UNSIGNED_SHORT:
+ *el_size = 2;
+ return 1;
+ case GL_INT:
+ *el_size = 4;
+ return 1;
+ case GL_UNSIGNED_INT:
+ *el_size = 4;
+ return 1;
+ default:
+ break;
+ }
+
+ if (integer) {
+ return 0;
+ }
+
+ switch (type) {
+ case GL_FLOAT:
+ *el_size = 4;
+ break;
+ case GL_HALF_FLOAT_OES:
+ case GL_HALF_FLOAT:
+ *el_size = 2;
+ if (actual_type) {
+ *actual_type = GL_HALF_FLOAT;
+ }
+ break;
+ case GL_FIXED:
+ *el_size = 4;
+ break;
+ case GL_INT_2_10_10_10_REV:
+ case GL_UNSIGNED_INT_2_10_10_10_REV_EXT:
+ *el_size = 4;
+ break;
+ default:
+ return 0;
+ }
+
+ return 1;
+}
+
+static __inline void yagl_get_actual(GLenum type,
+ GLsizei stride,
+ GLint offset,
+ int need_convert,
+ GLenum *actual_type,
+ GLsizei *actual_stride,
+ GLint *actual_offset)
+{
+ *actual_type = type;
+ *actual_stride = stride;
+
+ if (actual_offset) {
+ *actual_offset = offset;
+ }
+
+ if (!need_convert) {
+ return;
+ }
+
+ switch (type) {
+ case GL_BYTE:
+ *actual_type = GL_SHORT;
+ *actual_stride *= 2;
+ if (actual_offset) {
+ *actual_offset *= 2;
+ }
+ break;
+ case GL_FIXED:
+ *actual_type = GL_FLOAT;
+ break;
+ default:
+ break;
+ }
+}
+
+/*
+ * GLES1 could use GL_FIXED data type, which is not supported by host OpenGL.
+ * Also, GLES1 glTexCoordPointer and glVertexPointer could use GL_BYTE type
+ * for data while host OpenGL doesn't support this type for these functions.
+ * Conversion to host-acceptable data type is required for either of these
+ * cases.
+ * @{
+ */
+
+static void *yagl_gles_array_byte_to_short(struct yagl_gles_array *array,
+ uint32_t first,
+ uint32_t count)
+{
+ uint8_t *converted;
+ uint32_t i, j;
+
+ converted = yagl_get_tmp_buffer((first + count) * array->actual_stride);
+
+ for (i = first; i < (first + count); ++i) {
+ for (j = 0; j < array->size; ++j) {
+ *((GLshort*)(converted + (i * array->actual_stride)) + j) =
+ *((GLbyte*)(array->ptr + (i * array->stride)) + j);
+ }
+ }
+
+ return converted;
+}
+
+static void *yagl_gles_array_fixed_to_float(struct yagl_gles_array *array,
+ uint32_t first,
+ uint32_t count)
+{
+ uint8_t *converted;
+ uint32_t i, j;
+
+ converted = yagl_get_tmp_buffer((first + count) * array->actual_stride);
+
+ for (i = first; i < (first + count); ++i) {
+ for (j = 0; j < array->size; ++j) {
+ *((GLfloat*)(converted + (i * array->actual_stride)) + j) =
+ yagl_fixed_to_float(*((GLfixed*)(array->ptr + (i * array->stride)) + j));
+ }
+ }
+
+ return converted;
+}
+
+/*
+ * @}
+ */
+
+static void yagl_gles_array_reset(struct yagl_gles_array *array)
+{
+ if (array->vbo) {
+ yagl_gles_buffer_release(array->vbo);
+ array->vbo = NULL;
+ array->offset = 0;
+ array->actual_offset = 0;
+ } else {
+ array->ptr = NULL;
+ }
+}
+
+void yagl_gles_array_init(struct yagl_gles_array *array,
+ GLuint index,
+ yagl_gles_array_apply_func apply,
+ void *user_data)
+{
+ memset(array, 0, sizeof(*array));
+
+ array->index = index;
+ array->apply = apply;
+ array->user_data = user_data;
+}
+
+void yagl_gles_array_cleanup(struct yagl_gles_array *array)
+{
+ yagl_gles_array_reset(array);
+}
+
+void yagl_gles_array_enable(struct yagl_gles_array *array, int enable)
+{
+ array->enabled = enable;
+}
+
+int yagl_gles_array_update(struct yagl_gles_array *array,
+ GLint size,
+ GLenum type,
+ int need_convert,
+ GLboolean normalized,
+ GLsizei stride,
+ const GLvoid *ptr,
+ int integer)
+{
+ if (!yagl_get_el_size(type, integer, &array->el_size, &type)) {
+ return 0;
+ }
+
+ yagl_gles_array_reset(array);
+
+ yagl_get_actual(type, stride, 0, need_convert,
+ &array->actual_type,
+ &array->actual_stride,
+ NULL);
+
+ yagl_get_el_size(array->actual_type, integer, &array->actual_el_size, NULL);
+
+ array->size = size;
+ array->type = type;
+ array->need_convert = need_convert;
+ array->normalized = normalized;
+ array->stride = stride;
+
+ if (!array->stride) {
+ array->stride = array->size * array->el_size;
+ }
+
+ if (!array->actual_stride) {
+ array->actual_stride = array->size * array->actual_el_size;
+ }
+
+ array->integer = integer;
+
+ array->ptr = ptr;
+
+ if (need_convert) {
+ assert((type == GL_FIXED) || (type == GL_BYTE));
+ }
+
+ return 1;
+}
+
+int yagl_gles_array_update_vbo(struct yagl_gles_array *array,
+ GLint size,
+ GLenum type,
+ int need_convert,
+ GLboolean normalized,
+ GLsizei stride,
+ struct yagl_gles_buffer *vbo,
+ GLint offset,
+ int integer)
+{
+ if (!yagl_get_el_size(type, integer, &array->el_size, &type)) {
+ return 0;
+ }
+
+ yagl_gles_buffer_acquire(vbo);
+
+ yagl_gles_array_reset(array);
+
+ yagl_get_actual(type, stride, offset, need_convert,
+ &array->actual_type,
+ &array->actual_stride,
+ &array->actual_offset);
+
+ yagl_get_el_size(array->actual_type, integer, &array->actual_el_size, NULL);
+
+ array->size = size;
+ array->type = type;
+ array->need_convert = need_convert;
+ array->normalized = normalized;
+ array->stride = stride;
+
+ if (!array->stride) {
+ array->stride = array->size * array->el_size;
+ }
+
+ if (!array->actual_stride) {
+ array->actual_stride = array->size * array->actual_el_size;
+ }
+
+ array->integer = integer;
+
+ array->vbo = vbo;
+ array->offset = offset;
+
+ if (need_convert) {
+ assert(type == GL_FIXED || type == GL_BYTE);
+ }
+
+ yagl_gles_array_apply(array);
+
+ return 1;
+}
+
+void yagl_gles_array_apply(struct yagl_gles_array *array)
+{
+ if (array->vbo) {
+ yagl_gles_buffer_bind(array->vbo,
+ array->type,
+ array->need_convert,
+ GL_ARRAY_BUFFER);
+ array->apply(array, 0, 0, NULL, array->user_data);
+ yagl_host_glBindBuffer(GL_ARRAY_BUFFER, 0);
+ }
+}
+
+void yagl_gles_array_set_divisor(struct yagl_gles_array *array, GLuint divisor)
+{
+ array->divisor = divisor;
+
+ yagl_host_glVertexAttribDivisor(array->index, divisor);
+}
+
+void yagl_gles_array_transfer(struct yagl_gles_array *array,
+ uint32_t first,
+ uint32_t count,
+ GLsizei primcount)
+{
+ if (!array->enabled) {
+ return;
+ }
+
+ if (array->vbo) {
+ if (yagl_gles_buffer_is_cpu_dirty(array->vbo,
+ array->type,
+ array->need_convert)) {
+ yagl_gles_buffer_bind(array->vbo,
+ array->type,
+ array->need_convert,
+ GL_ARRAY_BUFFER);
+ yagl_gles_buffer_transfer(array->vbo,
+ array->type,
+ GL_ARRAY_BUFFER,
+ array->need_convert);
+ yagl_host_glBindBuffer(GL_ARRAY_BUFFER, 0);
+ }
+ } else if (array->ptr) {
+ const GLvoid *ptr = array->ptr;
+
+ if ((array->divisor > 0) && (primcount >= 0)) {
+ first = 0;
+ count = ((primcount - 1) / array->divisor) + 1;
+ }
+
+ if (array->need_convert) {
+ switch (array->type) {
+ case GL_BYTE:
+ ptr = yagl_gles_array_byte_to_short(array, first, count);
+ break;
+ case GL_FIXED:
+ ptr = yagl_gles_array_fixed_to_float(array, first, count);
+ break;
+ }
+ }
+
+ array->apply(array, first, count, ptr, array->user_data);
+ } else {
+ /*
+ * Transferring enabled array which has no pointer, typically we should
+ * just crash.
+ */
+
+ assert(0);
+ *((int*)NULL) = 0xDEADBEEF;
+ }
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES_ARRAY_H_
+#define _YAGL_GLES_ARRAY_H_
+
+#include "yagl_types.h"
+
+/*
+ * This structure represents GLES array, such arrays are
+ * typically set up by calls to 'glColorPointer', 'glVertexPointer',
+ * 'glVertexAttribPointer', etc.
+ *
+ * Note that we can't call host 'glVertexAttribPointer' right away
+ * when target 'glVertexAttribPointer' call is made. We can't just
+ * transfer the data from target to host and feed it to
+ * host 'glVertexAttribPointer' since the data that pointer points to
+ * may be changed later, thus, we must do the transfer right before host
+ * OpenGL will attempt to use it. Host OpenGL will attempt to use
+ * the array pointer on 'glDrawArrays' and 'glDrawElements', thus, we must
+ * do the transfer right before those calls. For this to work, we'll
+ * store 'apply' function together with an array, this function will be
+ * responsible for calling host 'glVertexAttribPointer', 'glColorPointer'
+ * or whatever.
+ */
+
+struct yagl_gles_array;
+struct yagl_gles_buffer;
+
+/*
+ * Calls the corresponding host array function.
+ */
+typedef void (*yagl_gles_array_apply_func)(struct yagl_gles_array */*array*/,
+ uint32_t /*first*/,
+ uint32_t /*count*/,
+ const GLvoid */*ptr*/,
+ void */*user_data*/);
+
+struct yagl_gles_array
+{
+ GLuint index;
+ GLint size;
+ GLenum type;
+ GLenum actual_type;
+ int el_size;
+ int actual_el_size;
+ GLboolean normalized;
+ GLsizei stride;
+ GLsizei actual_stride;
+ GLuint divisor;
+ int integer;
+
+ /*
+ * Specifies if array data needs to be converted before transferring to
+ * host OpenGL occurs.
+ * This could be used with GL_FIXED or GL_BYTE types, then data is
+ * converted to GL_FLOAT or GL_SHORT respectively. Setting this flag
+ * when yagl_gles_array::type is not either GL_FIXED or GL_FLOAT is
+ * programming error.
+ */
+ int need_convert;
+
+ /*
+ * Is array enabled by 'glEnableClientState'/'glEnableVertexAttribArray'.
+ */
+ int enabled;
+
+ struct yagl_gles_buffer *vbo;
+
+ union
+ {
+ const GLvoid *ptr;
+ struct
+ {
+ GLint offset;
+ GLint actual_offset;
+ };
+ };
+
+ yagl_gles_array_apply_func apply;
+ void *user_data;
+};
+
+void yagl_gles_array_init(struct yagl_gles_array *array,
+ GLuint index,
+ yagl_gles_array_apply_func apply,
+ void *user_data);
+
+void yagl_gles_array_cleanup(struct yagl_gles_array *array);
+
+void yagl_gles_array_enable(struct yagl_gles_array *array, int enable);
+
+int yagl_gles_array_update(struct yagl_gles_array *array,
+ GLint size,
+ GLenum type,
+ int need_convert,
+ GLboolean normalized,
+ GLsizei stride,
+ const GLvoid *ptr,
+ int integer);
+
+int yagl_gles_array_update_vbo(struct yagl_gles_array *array,
+ GLint size,
+ GLenum type,
+ int need_convert,
+ GLboolean normalized,
+ GLsizei stride,
+ struct yagl_gles_buffer *vbo,
+ GLint offset,
+ int integer);
+
+void yagl_gles_array_apply(struct yagl_gles_array *array);
+
+void yagl_gles_array_set_divisor(struct yagl_gles_array *array, GLuint divisor);
+
+void yagl_gles_array_transfer(struct yagl_gles_array *array,
+ uint32_t first,
+ uint32_t count,
+ GLsizei primcount);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GLES/gl.h"
+#include "GLES/glext.h"
+#include "yagl_state.h"
+#include "yagl_utils.h"
+#include "yagl_malloc.h"
+#include "yagl_log.h"
+#include "yagl_gles_buffer.h"
+#include "yagl_gles_validate.h"
+#include "yagl_host_gles_calls.h"
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
+
+/*
+ * We can't include GL/glext.h here
+ */
+#define GL_BUFFER_ACCESS_FLAGS 0x911F
+#define GL_BUFFER_MAP_OFFSET 0x9121
+#define GL_BUFFER_MAP_LENGTH 0x9120
+
+typedef void (*yagl_gles_buffer_transfer_func)(struct yagl_gles_buffer */*buffer*/,
+ GLenum /*target*/,
+ int /*start*/,
+ int /*size*/);
+
+static void yagl_gles_buffer_transfer_default(struct yagl_gles_buffer *buffer,
+ GLenum target,
+ int start,
+ int size)
+{
+ if ((start == 0) && (size == buffer->size)) {
+ yagl_host_glBufferData(target,
+ buffer->data,
+ size,
+ buffer->usage);
+ } else {
+ yagl_host_glBufferSubData(target,
+ start,
+ buffer->data + start,
+ size);
+ }
+}
+
+static void yagl_gles_buffer_transfer_fixed(struct yagl_gles_buffer *buffer,
+ GLenum target,
+ int start,
+ int size)
+{
+ GLfixed *data = buffer->data + start;
+ GLfloat *converted;
+ int i;
+
+ assert(sizeof(GLfixed) == sizeof(GLfloat));
+
+ converted = (GLfloat*)yagl_get_tmp_buffer(size);
+
+ for (i = 0; i < (size / sizeof(GLfloat)); ++i) {
+ converted[i] = yagl_fixed_to_float(data[i]);
+ }
+
+ if ((start == 0) && (size == buffer->size)) {
+ yagl_host_glBufferData(target,
+ converted,
+ size,
+ buffer->usage);
+ } else {
+ yagl_host_glBufferSubData(target,
+ start,
+ converted,
+ size);
+ }
+}
+
+static void yagl_gles_buffer_transfer_byte(struct yagl_gles_buffer *buffer,
+ GLenum target,
+ int start,
+ int size)
+{
+ GLbyte *data = buffer->data + start;
+ GLshort *converted;
+ int i;
+
+ converted = (GLshort*)yagl_get_tmp_buffer(size * sizeof(GLshort));
+
+ for (i = 0; i < size; ++i) {
+ converted[i] = data[i];
+ }
+
+ if ((start == 0) && (size == buffer->size)) {
+ yagl_host_glBufferData(target,
+ converted,
+ size * sizeof(GLshort),
+ buffer->usage);
+ } else {
+ yagl_host_glBufferSubData(target,
+ start * sizeof(GLshort),
+ converted,
+ size * sizeof(GLshort));
+ }
+}
+
+static void yagl_gles_buffer_transfer_internal(struct yagl_gles_buffer *buffer,
+ struct yagl_range_list *range_list,
+ GLenum target,
+ yagl_gles_buffer_transfer_func transfer_func)
+{
+ int num_ranges = yagl_range_list_size(range_list);
+ int i, start, size;
+
+ if (num_ranges <= 0) {
+ return;
+ }
+
+ if (num_ranges == 1) {
+ yagl_range_list_get(range_list,
+ 0,
+ &start,
+ &size);
+ if (size == 0) {
+ /*
+ * Buffer clear.
+ */
+ assert(start == 0);
+ yagl_host_glBufferData(target,
+ NULL,
+ 0,
+ buffer->usage);
+ yagl_range_list_clear(range_list);
+ return;
+ } else if ((start == 0) && (size == buffer->size)) {
+ /*
+ * Buffer full update.
+ */
+ transfer_func(buffer, target, 0, size);
+ yagl_range_list_clear(range_list);
+ return;
+ }
+ }
+
+ /*
+ * Buffer partial updates.
+ */
+
+ for (i = 0; i < num_ranges; ++i) {
+ yagl_range_list_get(range_list,
+ i,
+ &start,
+ &size);
+ transfer_func(buffer, target, start, size);
+ }
+ yagl_range_list_clear(range_list);
+}
+
+static void yagl_gles_buffer_transfer_from_gpu(struct yagl_gles_buffer *buffer)
+{
+ int i, num_ranges = yagl_range_list_size(&buffer->gpu_dirty_list);
+ GLuint* ranges;
+ int current = 0;
+
+ YAGL_LOG_FUNC_SET(yagl_gles_buffer_transfer_from_gpu);
+
+ if (num_ranges <= 0) {
+ return;
+ }
+
+ ranges = (GLuint*)yagl_get_tmp_buffer2(num_ranges * 2);
+
+ for (i = 0; i < num_ranges; ++i) {
+ int start, size;
+
+ yagl_range_list_get(&buffer->gpu_dirty_list,
+ i,
+ &start,
+ &size);
+
+ ranges[(i * 2) + 0] = start - current;
+ ranges[(i * 2) + 1] = size;
+
+ current = start + size;
+ }
+
+ YAGL_LOG_DEBUG("transferring %d ranges, max %d bytes",
+ num_ranges, (int32_t)(current - ranges[0]));
+
+ yagl_host_glMapBuffer(buffer->default_part.global_name,
+ ranges, num_ranges * 2,
+ buffer->data + ranges[0],
+ current - ranges[0],
+ NULL);
+
+ yagl_range_list_clear(&buffer->gpu_dirty_list);
+}
+
+static void yagl_gles_buffer_destroy(struct yagl_ref *ref)
+{
+ GLuint buffer_names[3];
+ struct yagl_gles_buffer *buffer = (struct yagl_gles_buffer*)ref;
+
+ buffer_names[0] = buffer->default_part.global_name;
+ buffer_names[1] = buffer->fixed_part.global_name;
+ buffer_names[2] = buffer->byte_part.global_name;
+
+ yagl_host_glDeleteObjects(buffer_names,
+ sizeof(buffer_names)/sizeof(buffer_names[0]));
+
+ yagl_range_list_cleanup(&buffer->gpu_dirty_list);
+
+ yagl_range_list_cleanup(&buffer->default_part.range_list);
+ yagl_range_list_cleanup(&buffer->fixed_part.range_list);
+ yagl_range_list_cleanup(&buffer->byte_part.range_list);
+
+ yagl_free(buffer->data);
+
+ yagl_object_cleanup(&buffer->base);
+
+ yagl_free(buffer);
+}
+
+struct yagl_gles_buffer *yagl_gles_buffer_create(void)
+{
+ GLuint buffer_names[3];
+ struct yagl_gles_buffer *buffer;
+
+ buffer = yagl_malloc0(sizeof(*buffer));
+
+ yagl_object_init(&buffer->base, &yagl_gles_buffer_destroy);
+
+ buffer_names[0] = buffer->default_part.global_name = yagl_get_global_name();
+ buffer_names[1] = buffer->fixed_part.global_name = yagl_get_global_name();
+ buffer_names[2] = buffer->byte_part.global_name = yagl_get_global_name();
+
+ yagl_host_glGenBuffers(buffer_names,
+ sizeof(buffer_names)/sizeof(buffer_names[0]));
+
+ yagl_range_list_init(&buffer->default_part.range_list);
+ yagl_range_list_init(&buffer->fixed_part.range_list);
+ yagl_range_list_init(&buffer->byte_part.range_list);
+
+ yagl_range_list_init(&buffer->gpu_dirty_list);
+
+ buffer->usage = GL_STATIC_DRAW;
+
+ return buffer;
+}
+
+void yagl_gles_buffer_acquire(struct yagl_gles_buffer *buffer)
+{
+ if (buffer) {
+ yagl_object_acquire(&buffer->base);
+ }
+}
+
+void yagl_gles_buffer_release(struct yagl_gles_buffer *buffer)
+{
+ if (buffer) {
+ yagl_object_release(&buffer->base);
+ }
+}
+
+void yagl_gles_buffer_set_data(struct yagl_gles_buffer *buffer,
+ GLint size,
+ const void *data,
+ GLenum usage)
+{
+ if (size > 0) {
+ if (size > buffer->size) {
+ yagl_free(buffer->data);
+ buffer->data = yagl_malloc(size);
+ }
+ buffer->size = size;
+ if (data) {
+ memcpy(buffer->data, data, buffer->size);
+ }
+ } else {
+ yagl_free(buffer->data);
+ buffer->data = NULL;
+ buffer->size = 0;
+ }
+
+ buffer->usage = usage;
+
+ buffer->map_pointer = NULL;
+ buffer->map_access = 0;
+ buffer->map_offset = 0;
+ buffer->map_length = 0;
+
+ yagl_range_list_clear(&buffer->default_part.range_list);
+ yagl_range_list_clear(&buffer->fixed_part.range_list);
+ yagl_range_list_clear(&buffer->byte_part.range_list);
+
+ /*
+ * Full data update, we don't care about GPU dirty
+ * regions anymore, just discard them.
+ */
+ yagl_range_list_clear(&buffer->gpu_dirty_list);
+
+ yagl_range_list_add(&buffer->default_part.range_list, 0, buffer->size);
+ yagl_range_list_add(&buffer->fixed_part.range_list, 0, buffer->size);
+ yagl_range_list_add(&buffer->byte_part.range_list, 0, buffer->size);
+
+ buffer->cached_minmax_idx = 0;
+}
+
+int yagl_gles_buffer_update_data(struct yagl_gles_buffer *buffer,
+ GLint offset,
+ GLint size,
+ const void *data)
+{
+ if ((offset < 0) || (size < 0) || ((offset + size) > buffer->size)) {
+ return 0;
+ }
+
+ if (size == 0) {
+ return 1;
+ }
+
+ /*
+ * We're partially updating data, the region being updated might
+ * intersect with GPU dirty region, thus, if we issue
+ * 'update_from_gpu' later we might screw things up, so do
+ * this now.
+ */
+ yagl_gles_buffer_transfer_from_gpu(buffer);
+
+ memcpy(buffer->data + offset, data, size);
+
+ yagl_range_list_add(&buffer->default_part.range_list, offset, size);
+ yagl_range_list_add(&buffer->fixed_part.range_list, offset, size);
+ yagl_range_list_add(&buffer->byte_part.range_list, offset, size);
+
+ buffer->cached_minmax_idx = 0;
+
+ return 1;
+}
+
+int yagl_gles_buffer_get_minmax_index(struct yagl_gles_buffer *buffer,
+ GLenum type,
+ GLint offset,
+ GLint count,
+ uint32_t *min_idx,
+ uint32_t *max_idx)
+{
+ int index_size, i;
+ uint32_t idx = 0;
+
+ *min_idx = UINT32_MAX;
+ *max_idx = 0;
+
+ if (!yagl_gles_get_index_size(type, &index_size)) {
+ return 0;
+ }
+
+ if ((offset < 0) || (count <= 0) || ((offset + (count * index_size)) > buffer->size)) {
+ return 0;
+ }
+
+ if (buffer->cached_minmax_idx &&
+ (buffer->cached_type == type) &&
+ (buffer->cached_offset == offset) &&
+ (buffer->cached_count == count)) {
+ *min_idx = buffer->cached_min_idx;
+ *max_idx = buffer->cached_max_idx;
+ return 1;
+ }
+
+ yagl_gles_buffer_transfer_from_gpu(buffer);
+
+ switch (type) {
+ case GL_UNSIGNED_BYTE:
+ for (i = 0; i < count; ++i) {
+ idx = *(uint8_t*)(buffer->data + offset + (i * index_size));
+ if (idx < *min_idx) {
+ *min_idx = idx;
+ }
+ if (idx > *max_idx) {
+ *max_idx = idx;
+ }
+ }
+ break;
+ case GL_UNSIGNED_SHORT:
+ for (i = 0; i < count; ++i) {
+ idx = *(uint16_t*)(buffer->data + offset + (i * index_size));
+ if (idx < *min_idx) {
+ *min_idx = idx;
+ }
+ if (idx > *max_idx) {
+ *max_idx = idx;
+ }
+ }
+ break;
+ case GL_UNSIGNED_INT:
+ for (i = 0; i < count; ++i) {
+ idx = *(uint32_t*)(buffer->data + offset + (i * index_size));
+ if (idx < *min_idx) {
+ *min_idx = idx;
+ }
+ if (idx > *max_idx) {
+ *max_idx = idx;
+ }
+ }
+ break;
+ default:
+ assert(0);
+ break;
+ }
+
+ buffer->cached_minmax_idx = 1;
+ buffer->cached_type = type;
+ buffer->cached_offset = offset;
+ buffer->cached_count = count;
+ buffer->cached_min_idx = *min_idx;
+ buffer->cached_max_idx = *max_idx;
+
+ return 1;
+}
+
+void yagl_gles_buffer_bind(struct yagl_gles_buffer *buffer,
+ GLenum type,
+ int need_convert,
+ GLenum target)
+{
+ struct yagl_gles_buffer_part *bufpart = &buffer->default_part;
+
+ if (need_convert) {
+ switch (type) {
+ case GL_BYTE:
+ bufpart = &buffer->byte_part;
+ break;
+ case GL_FIXED:
+ bufpart = &buffer->fixed_part;
+ break;
+ }
+ }
+
+ yagl_host_glBindBuffer(target, bufpart->global_name);
+}
+
+void yagl_gles_buffer_transfer(struct yagl_gles_buffer *buffer,
+ GLenum type,
+ GLenum target,
+ int need_convert)
+{
+ if (need_convert) {
+ switch (type) {
+ case GL_BYTE:
+ yagl_gles_buffer_transfer_internal(buffer,
+ &buffer->byte_part.range_list,
+ target,
+ &yagl_gles_buffer_transfer_byte);
+ break;
+ case GL_FIXED:
+ yagl_gles_buffer_transfer_internal(buffer,
+ &buffer->fixed_part.range_list,
+ target,
+ &yagl_gles_buffer_transfer_fixed);
+ break;
+ }
+ } else {
+ yagl_gles_buffer_transfer_internal(buffer,
+ &buffer->default_part.range_list,
+ target,
+ &yagl_gles_buffer_transfer_default);
+ }
+}
+
+int yagl_gles_buffer_get_parameter(struct yagl_gles_buffer *buffer,
+ GLenum pname,
+ GLint *param)
+{
+ switch (pname) {
+ case GL_BUFFER_SIZE:
+ *param = buffer->size;
+ break;
+ case GL_BUFFER_USAGE:
+ *param = buffer->usage;
+ break;
+ case GL_BUFFER_ACCESS_OES:
+ *param = GL_WRITE_ONLY_OES;
+ break;
+ case GL_BUFFER_MAPPED_OES:
+ *param = buffer->map_pointer != NULL;
+ break;
+ case GL_BUFFER_ACCESS_FLAGS:
+ *param = buffer->map_access;
+ break;
+ case GL_BUFFER_MAP_OFFSET:
+ *param = buffer->map_offset;
+ break;
+ case GL_BUFFER_MAP_LENGTH:
+ *param = buffer->map_length;
+ break;
+ default:
+ return 0;
+ }
+
+ return 1;
+}
+
+int yagl_gles_buffer_map(struct yagl_gles_buffer *buffer,
+ GLintptr offset,
+ GLsizeiptr length,
+ GLbitfield access)
+{
+ if (buffer->map_pointer) {
+ return 0;
+ }
+
+ if ((offset < 0) || (length <= 0) || ((offset + length) > buffer->size)) {
+ return 0;
+ }
+
+ if (((access & GL_MAP_INVALIDATE_BUFFER_BIT_EXT) != 0) ||
+ (((access & GL_MAP_INVALIDATE_RANGE_BIT_EXT) != 0) &&
+ (offset == 0) &&
+ (length == buffer->size))) {
+ yagl_range_list_clear(&buffer->default_part.range_list);
+ yagl_range_list_clear(&buffer->fixed_part.range_list);
+ yagl_range_list_clear(&buffer->byte_part.range_list);
+ } else {
+ yagl_gles_buffer_transfer_from_gpu(buffer);
+ }
+
+ buffer->map_pointer = buffer->data + offset;
+ buffer->map_access = access;
+ buffer->map_offset = offset;
+ buffer->map_length = length;
+
+ return 1;
+}
+
+int yagl_gles_buffer_mapped(struct yagl_gles_buffer *buffer)
+{
+ return buffer->map_pointer != NULL;
+}
+
+int yagl_gles_buffer_flush_mapped_range(struct yagl_gles_buffer *buffer,
+ GLintptr offset,
+ GLsizeiptr length)
+{
+ if (!buffer->map_pointer) {
+ return 0;
+ }
+
+ if ((offset < 0) || (length < 0) || ((offset + length) > buffer->map_length)) {
+ return 0;
+ }
+
+ if ((buffer->map_access & GL_MAP_FLUSH_EXPLICIT_BIT_EXT) == 0) {
+ return 0;
+ }
+
+ if (length == 0) {
+ return 1;
+ }
+
+ yagl_range_list_add(&buffer->default_part.range_list, buffer->map_offset + offset, length);
+ yagl_range_list_add(&buffer->fixed_part.range_list, buffer->map_offset + offset, length);
+ yagl_range_list_add(&buffer->byte_part.range_list, buffer->map_offset + offset, length);
+
+ buffer->cached_minmax_idx = 0;
+
+ return 1;
+}
+
+void yagl_gles_buffer_unmap(struct yagl_gles_buffer *buffer)
+{
+ if (!buffer->map_pointer) {
+ return;
+ }
+
+ if (((buffer->map_access & GL_MAP_WRITE_BIT_EXT) != 0) &&
+ ((buffer->map_access & GL_MAP_FLUSH_EXPLICIT_BIT_EXT) == 0)) {
+ yagl_range_list_add(&buffer->default_part.range_list, buffer->map_offset, buffer->map_length);
+ yagl_range_list_add(&buffer->fixed_part.range_list, buffer->map_offset, buffer->map_length);
+ yagl_range_list_add(&buffer->byte_part.range_list, buffer->map_offset, buffer->map_length);
+
+ buffer->cached_minmax_idx = 0;
+ }
+
+ buffer->map_pointer = NULL;
+ buffer->map_access = 0;
+ buffer->map_offset = 0;
+ buffer->map_length = 0;
+}
+
+void yagl_gles_buffer_set_bound(struct yagl_gles_buffer *buffer)
+{
+ buffer->was_bound = 1;
+}
+
+int yagl_gles_buffer_was_bound(struct yagl_gles_buffer *buffer)
+{
+ return buffer->was_bound;
+}
+
+int yagl_gles_buffer_is_cpu_dirty(struct yagl_gles_buffer *buffer,
+ GLenum type,
+ int need_convert)
+{
+ struct yagl_gles_buffer_part *bufpart = &buffer->default_part;
+
+ if (need_convert) {
+ switch (type) {
+ case GL_BYTE:
+ bufpart = &buffer->byte_part;
+ break;
+ case GL_FIXED:
+ bufpart = &buffer->fixed_part;
+ break;
+ }
+ }
+
+ return yagl_range_list_size(&bufpart->range_list) > 0;
+}
+
+void yagl_gles_buffer_set_gpu_dirty(struct yagl_gles_buffer *buffer,
+ GLint offset,
+ GLint size)
+{
+ if ((offset < 0) || (size < 0) || ((offset + size) > buffer->size)) {
+ return;
+ }
+
+ if (size == 0) {
+ return;
+ }
+
+ yagl_range_list_add(&buffer->gpu_dirty_list, offset, size);
+
+ buffer->cached_minmax_idx = 0;
+}
+
+int yagl_gles_buffer_copy_gpu(struct yagl_gles_buffer *from_buffer,
+ GLenum from_target,
+ struct yagl_gles_buffer *to_buffer,
+ GLenum to_target,
+ GLint from_offset,
+ GLint to_offset,
+ GLint size)
+{
+ if ((from_offset < 0) || (to_offset < 0) || (size < 0) ||
+ ((from_offset + size) > from_buffer->size) ||
+ ((to_offset + size) > to_buffer->size)) {
+ return 0;
+ }
+
+ if ((from_buffer == to_buffer) &&
+ (abs(to_offset - from_offset) < size)) {
+ return 0;
+ }
+
+ if (size != 0) {
+ yagl_host_glCopyBufferSubData(from_target, to_target,
+ from_offset, to_offset, size);
+ }
+
+ return 1;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES_BUFFER_H_
+#define _YAGL_GLES_BUFFER_H_
+
+#include "yagl_types.h"
+#include "yagl_object.h"
+#include "yagl_range_list.h"
+
+ /*
+ * VBO implementation is somewhat tricky because
+ * we must correctly handle GL_FIXED data type, which must be
+ * converted to GL_FLOAT, and GL_BYTE data type, which (in some cases)
+ * must be converted to GL_SHORT. Buffer objects may be bound to
+ * multiple contexts, so there may be several VBOs using the
+ * same buffer object, but having different data types. We handle this
+ * by having three 'yagl_gles_buffer_part' objects: one for GL_FIXED type,
+ * one for GL_BYTE type and the other for all other types.
+ * Each 'yagl_gles_buffer_part' object has a separate global buffer name
+ * and a range list that consists of 'glBufferData' and 'glBufferSubData'
+ * ranges which haven't been processed yet. When a VBO is used we walk
+ * the appropriate range list, make conversions, clear it and call
+ * 'glBufferData' or 'glBufferSubData' as many times as needed.
+ */
+
+#define YAGL_NS_BUFFER 0
+
+struct yagl_gles_buffer_part
+{
+ yagl_object_name global_name;
+
+ struct yagl_range_list range_list;
+};
+
+struct yagl_gles_buffer
+{
+ struct yagl_object base;
+
+ struct yagl_gles_buffer_part default_part;
+ struct yagl_gles_buffer_part fixed_part;
+ struct yagl_gles_buffer_part byte_part;
+
+ GLint size;
+ void *data;
+ GLenum usage;
+
+ void *map_pointer;
+ GLbitfield map_access;
+ GLintptr map_offset;
+ GLsizeiptr map_length;
+
+ struct yagl_range_list gpu_dirty_list;
+
+ int was_bound;
+
+ int cached_minmax_idx;
+ GLenum cached_type;
+ GLint cached_offset;
+ GLint cached_count;
+ uint32_t cached_min_idx;
+ uint32_t cached_max_idx;
+};
+
+struct yagl_gles_buffer *yagl_gles_buffer_create(void);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_gles_buffer_acquire(struct yagl_gles_buffer *buffer);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_gles_buffer_release(struct yagl_gles_buffer *buffer);
+
+void yagl_gles_buffer_set_data(struct yagl_gles_buffer *buffer,
+ GLint size,
+ const void *data,
+ GLenum usage);
+
+int yagl_gles_buffer_update_data(struct yagl_gles_buffer *buffer,
+ GLint offset,
+ GLint size,
+ const void *data);
+
+int yagl_gles_buffer_get_minmax_index(struct yagl_gles_buffer *buffer,
+ GLenum type,
+ GLint offset,
+ GLint count,
+ uint32_t *min_idx,
+ uint32_t *max_idx);
+
+void yagl_gles_buffer_bind(struct yagl_gles_buffer *buffer,
+ GLenum type,
+ int need_convert,
+ GLenum target);
+
+void yagl_gles_buffer_transfer(struct yagl_gles_buffer *buffer,
+ GLenum type,
+ GLenum target,
+ int need_convert);
+
+int yagl_gles_buffer_get_parameter(struct yagl_gles_buffer *buffer,
+ GLenum pname,
+ GLint *param);
+
+/*
+ * Assumes that 'access' has already been validated.
+ */
+int yagl_gles_buffer_map(struct yagl_gles_buffer *buffer,
+ GLintptr offset,
+ GLsizeiptr length,
+ GLbitfield access);
+
+int yagl_gles_buffer_mapped(struct yagl_gles_buffer *buffer);
+
+int yagl_gles_buffer_flush_mapped_range(struct yagl_gles_buffer *buffer,
+ GLintptr offset,
+ GLsizeiptr length);
+
+void yagl_gles_buffer_unmap(struct yagl_gles_buffer *buffer);
+
+void yagl_gles_buffer_set_bound(struct yagl_gles_buffer *buffer);
+
+int yagl_gles_buffer_was_bound(struct yagl_gles_buffer *buffer);
+
+int yagl_gles_buffer_is_cpu_dirty(struct yagl_gles_buffer *buffer,
+ GLenum type,
+ int need_convert);
+
+void yagl_gles_buffer_set_gpu_dirty(struct yagl_gles_buffer *buffer,
+ GLint offset,
+ GLint size);
+
+int yagl_gles_buffer_copy_gpu(struct yagl_gles_buffer *from_buffer,
+ GLenum from_target,
+ struct yagl_gles_buffer *to_buffer,
+ GLenum to_target,
+ GLint from_offset,
+ GLint to_offset,
+ GLint size);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GL/gl.h"
+#include "GL/glext.h"
+#include "yagl_gles_calls.h"
+#include "yagl_host_gles_calls.h"
+#include "yagl_impl.h"
+#include "yagl_malloc.h"
+#include "yagl_render.h"
+#include "yagl_utils.h"
+#include "yagl_sharegroup.h"
+#include "yagl_state.h"
+#include "yagl_pixel_format.h"
+#include "yagl_gles_context.h"
+#include "yagl_gles_vertex_array.h"
+#include "yagl_gles_buffer.h"
+#include "yagl_gles_texture.h"
+#include "yagl_gles_texture_unit.h"
+#include "yagl_gles_framebuffer.h"
+#include "yagl_gles_renderbuffer.h"
+#include "yagl_gles_image.h"
+#include "yagl_gles_array.h"
+#include "yagl_gles_validate.h"
+#include "yagl_gles_utils.h"
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+#define YAGL_SET_ERR(err) \
+ yagl_gles_context_set_error(ctx, err); \
+ YAGL_LOG_ERROR("error = 0x%X", err)
+
+#define YAGL_GET_CTX_IMPL(ret_expr) \
+ struct yagl_gles_context *ctx = \
+ (struct yagl_gles_context*)yagl_get_client_context(); \
+ if (!ctx) { \
+ YAGL_LOG_WARN("no current context"); \
+ YAGL_LOG_FUNC_EXIT(NULL); \
+ ret_expr; \
+ }
+
+#define YAGL_GET_CTX_RET(ret) YAGL_GET_CTX_IMPL(return ret)
+
+#define YAGL_GET_CTX() YAGL_GET_CTX_IMPL(return)
+
+YAGL_API void glClearStencil(GLint s)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glClearStencil, GLint, s);
+
+ YAGL_GET_CTX();
+
+ ctx->clear_stencil = s;
+
+ yagl_host_glClearStencil(s);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glHint(GLenum target, GLenum mode)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glHint, GLenum, GLenum, target, mode);
+
+ YAGL_GET_CTX();
+
+ if (yagl_gles_is_hint_mode_valid(mode)) {
+ yagl_gles_context_hint(ctx, target, mode);
+ } else {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glLineWidth(GLfloat width)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glLineWidth, GLfloat, width);
+
+ YAGL_GET_CTX();
+
+ yagl_gles_context_line_width(ctx, width);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glPolygonOffset(GLfloat factor, GLfloat units)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glPolygonOffset, GLfloat, GLfloat, factor, units);
+
+ YAGL_GET_CTX();
+
+ yagl_gles_context_polygon_offset(ctx, factor, units);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
+{
+ GLenum actual_internalformat = internalformat;
+ struct yagl_gles_renderbuffer *renderbuffer_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glRenderbufferStorage, GLenum, GLenum, GLsizei, GLsizei, target, internalformat, width, height);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles_context_validate_renderbuffer_format(ctx, &actual_internalformat)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!yagl_gles_context_acquire_binded_renderbuffer(ctx, target, &renderbuffer_obj)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!renderbuffer_obj) {
+ goto out;
+ }
+
+ yagl_gles_renderbuffer_set_internalformat(renderbuffer_obj, internalformat);
+
+ yagl_host_glRenderbufferStorage(target, actual_internalformat, width, height);
+
+out:
+ yagl_gles_renderbuffer_release(renderbuffer_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glSampleCoverage(GLclampf value, GLboolean invert)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glSampleCoverage, GLclampf, GLboolean, value, invert);
+
+ YAGL_GET_CTX();
+
+ yagl_gles_context_sample_coverage(ctx, value, invert);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glScissor, GLint, GLint, GLsizei, GLsizei, x, y, width, height);
+
+ YAGL_GET_CTX();
+
+ if ((width < 0) || (height < 0)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ yagl_render_invalidate(0);
+
+ ctx->have_scissor_box = 1;
+ ctx->scissor_box[0] = x;
+ ctx->scissor_box[1] = y;
+ ctx->scissor_box[2] = width;
+ ctx->scissor_box[3] = height;
+
+ yagl_host_glScissor(x, y, width, height);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glStencilFunc(GLenum func, GLint ref, GLuint mask)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glStencilFunc, GLenum, GLint, GLuint, func, ref, mask);
+
+ YAGL_GET_CTX();
+
+ if (yagl_gles_is_stencil_func_valid(func)) {
+ ctx->stencil_front.func = func;
+ ctx->stencil_front.ref = ref;
+ ctx->stencil_front.mask = mask;
+
+ ctx->stencil_back.func = func;
+ ctx->stencil_back.ref = ref;
+ ctx->stencil_back.mask = mask;
+
+ yagl_host_glStencilFunc(func, ref, mask);
+ } else {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glStencilMask(GLuint mask)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glStencilMask, GLuint, mask);
+
+ YAGL_GET_CTX();
+
+ ctx->stencil_front.writemask = mask;
+ ctx->stencil_back.writemask = mask;
+
+ yagl_host_glStencilMask(mask);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glStencilOp, GLenum, GLenum, GLenum, fail, zfail, zpass);
+
+ YAGL_GET_CTX();
+
+ if (yagl_gles_is_stencil_op_valid(fail) &&
+ yagl_gles_is_stencil_op_valid(zfail) &&
+ yagl_gles_is_stencil_op_valid(zpass)) {
+ ctx->stencil_front.fail = fail;
+ ctx->stencil_front.zfail = zfail;
+ ctx->stencil_front.zpass = zpass;
+
+ ctx->stencil_back.fail = fail;
+ ctx->stencil_back.zfail = zfail;
+ ctx->stencil_back.zpass = zpass;
+
+ yagl_host_glStencilOp(fail, zfail, zpass);
+ } else {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glTexParameterf(GLenum target, GLenum pname, GLfloat param)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glTexParameterf, GLenum, GLenum, GLfloat, target, pname, param);
+
+ YAGL_GET_CTX();
+
+ yagl_gles_context_tex_parameterf(ctx, target, pname, param);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glTexParameterfv, GLenum, GLenum, const GLfloat*, target, pname, params);
+
+ YAGL_GET_CTX();
+
+ yagl_gles_context_tex_parameterfv(ctx, target, pname, params);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glTexParameteri(GLenum target, GLenum pname, GLint param)
+{
+ yagl_gles_texture_target texture_target;
+ struct yagl_gles_texture_target_state *tex_target_state;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glTexParameteri, GLenum, GLenum, GLint, target, pname, param);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles_context_validate_texture_target(ctx,
+ target,
+ &texture_target)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ tex_target_state =
+ yagl_gles_context_get_active_texture_target_state(ctx, texture_target);
+
+ if (pname == GL_TEXTURE_MIN_FILTER) {
+ tex_target_state->texture->min_filter = param;
+ } else if (pname == GL_TEXTURE_MAG_FILTER) {
+ tex_target_state->texture->mag_filter = param;
+ }
+
+ yagl_host_glTexParameteri(target, pname, param);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
+{
+ yagl_gles_texture_target texture_target;
+ struct yagl_gles_texture_target_state *tex_target_state;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glTexParameteriv, GLenum, GLenum, const GLint*, target, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles_context_validate_texture_target(ctx,
+ target,
+ &texture_target)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ tex_target_state =
+ yagl_gles_context_get_active_texture_target_state(ctx, texture_target);
+
+ if (pname == GL_TEXTURE_MIN_FILTER) {
+ tex_target_state->texture->min_filter = params[0];
+ } else if (pname == GL_TEXTURE_MAG_FILTER) {
+ tex_target_state->texture->mag_filter = params[0];
+ }
+
+ yagl_host_glTexParameteriv(target, pname, params, 1);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glViewport, GLint, GLint, GLsizei, GLsizei, x, y, width, height);
+
+ YAGL_GET_CTX();
+
+ if ((width < 0) || (height < 0)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ yagl_render_invalidate(0);
+
+ ctx->have_viewport = 1;
+ ctx->viewport[0] = x;
+ ctx->viewport[1] = y;
+ ctx->viewport[2] = width;
+ ctx->viewport[3] = height;
+
+ yagl_host_glViewport(x, y, width, height);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API const GLubyte *glGetString(GLenum name)
+{
+ struct yagl_gles_context *ctx;
+ const char *str = NULL;
+
+ YAGL_LOG_FUNC_ENTER(glGetString, "name = 0x%X", name);
+
+ ctx = (struct yagl_gles_context*)yagl_get_client_context();
+
+ switch (name) {
+ case GL_VENDOR:
+ str = "Samsung";
+ break;
+ case GL_EXTENSIONS:
+ if (ctx) {
+ str = ctx->extension_string;
+ } else {
+ str = "";
+ }
+ break;
+ default:
+ if (ctx) {
+ str = ctx->get_string(ctx, name);
+ } else {
+ str = "";
+ }
+ }
+
+ YAGL_LOG_FUNC_EXIT("%s", str);
+
+ return (const GLubyte*)str;
+}
+
+YAGL_API void glActiveTexture(GLenum texture)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glActiveTexture, GLenum, texture);
+
+ YAGL_GET_CTX();
+
+ yagl_gles_context_set_active_texture(ctx, texture);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glBindBuffer(GLenum target, GLuint buffer)
+{
+ struct yagl_gles_buffer *buffer_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glBindBuffer, GLenum, GLuint, target, buffer);
+
+ YAGL_GET_CTX();
+
+ if (buffer != 0) {
+ buffer_obj = (struct yagl_gles_buffer*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_BUFFER, buffer);
+
+ if (!buffer_obj) {
+ buffer_obj = yagl_gles_buffer_create();
+
+ if (!buffer_obj) {
+ goto out;
+ }
+
+ buffer_obj = (struct yagl_gles_buffer*)yagl_sharegroup_add_named(ctx->base.sg,
+ YAGL_NS_BUFFER, buffer, &buffer_obj->base);
+ }
+ }
+
+ yagl_gles_context_bind_buffer(ctx, target, buffer_obj);
+
+out:
+ yagl_gles_buffer_release(buffer_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+void glBindFramebuffer(GLenum target, GLuint framebuffer)
+{
+ struct yagl_gles_framebuffer *framebuffer_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glBindFramebuffer, GLenum, GLuint, target, framebuffer);
+
+ YAGL_GET_CTX();
+
+ if (framebuffer != 0) {
+ framebuffer_obj = (struct yagl_gles_framebuffer*)yagl_namespace_acquire(&ctx->framebuffers,
+ framebuffer);
+
+ if (!framebuffer_obj) {
+ framebuffer_obj = yagl_gles_framebuffer_create();
+
+ if (!framebuffer_obj) {
+ goto out;
+ }
+
+ framebuffer_obj = (struct yagl_gles_framebuffer*)yagl_namespace_add_named(&ctx->framebuffers,
+ framebuffer, &framebuffer_obj->base);
+ }
+ }
+
+ yagl_gles_context_bind_framebuffer(ctx, target, framebuffer_obj);
+
+out:
+ yagl_gles_framebuffer_release(framebuffer_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+void glBindRenderbuffer(GLenum target, GLuint renderbuffer)
+{
+ struct yagl_gles_renderbuffer *renderbuffer_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glBindRenderbuffer, GLenum, GLuint, target, renderbuffer);
+
+ YAGL_GET_CTX();
+
+ if (renderbuffer != 0) {
+ renderbuffer_obj = (struct yagl_gles_renderbuffer*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_RENDERBUFFER, renderbuffer);
+
+ if (!renderbuffer_obj) {
+ renderbuffer_obj = yagl_gles_renderbuffer_create();
+
+ if (!renderbuffer_obj) {
+ goto out;
+ }
+
+ renderbuffer_obj = (struct yagl_gles_renderbuffer*)yagl_sharegroup_add_named(ctx->base.sg,
+ YAGL_NS_RENDERBUFFER, renderbuffer, &renderbuffer_obj->base);
+ }
+ }
+
+ yagl_gles_context_bind_renderbuffer(ctx, target, renderbuffer_obj);
+
+out:
+ yagl_gles_renderbuffer_release(renderbuffer_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glBindTexture(GLenum target, GLuint texture)
+{
+ struct yagl_gles_texture *texture_obj = NULL;
+ yagl_gles_texture_target texture_target;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glBindTexture, GLenum, GLuint, target, texture);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles_context_validate_texture_target(ctx, target, &texture_target)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (texture != 0) {
+ texture_obj = (struct yagl_gles_texture*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_TEXTURE, texture);
+
+ if (!texture_obj) {
+ texture_obj = yagl_gles_texture_create();
+
+ if (!texture_obj) {
+ goto out;
+ }
+
+ texture_obj = (struct yagl_gles_texture*)yagl_sharegroup_add_named(ctx->base.sg,
+ YAGL_NS_TEXTURE, texture, &texture_obj->base);
+ }
+ }
+
+ yagl_gles_context_bind_texture(ctx, target, texture_obj);
+
+out:
+ yagl_gles_texture_release(texture_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+void glBlendEquation(GLenum mode)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glBlendEquation, GLenum, mode);
+
+ YAGL_GET_CTX();
+
+ if (yagl_gles_is_blend_equation_valid(mode)) {
+ ctx->blend_equation_rgb = mode;
+ ctx->blend_equation_alpha = mode;
+
+ yagl_host_glBlendEquation(mode);
+ } else {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glBlendEquationSeparate, GLenum, GLenum, modeRGB, modeAlpha);
+
+ YAGL_GET_CTX();
+
+ if (yagl_gles_is_blend_equation_valid(modeRGB) &&
+ yagl_gles_is_blend_equation_valid(modeAlpha)) {
+ ctx->blend_equation_rgb = modeRGB;
+ ctx->blend_equation_alpha = modeAlpha;
+
+ yagl_host_glBlendEquationSeparate(modeRGB, modeAlpha);
+ } else {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glBlendFunc(GLenum sfactor, GLenum dfactor)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glBlendFunc, GLenum, GLenum, sfactor, dfactor);
+
+ YAGL_GET_CTX();
+
+ if (yagl_gles_is_blend_func_valid(sfactor) &&
+ yagl_gles_is_blend_func_valid(dfactor)) {
+ ctx->blend_src_rgb = sfactor;
+ ctx->blend_src_alpha = sfactor;
+
+ ctx->blend_dst_rgb = dfactor;
+ ctx->blend_dst_alpha = dfactor;
+
+ yagl_host_glBlendFunc(sfactor, dfactor);
+ } else {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+void glBlendFuncSeparate(GLenum srcRGB,
+ GLenum dstRGB,
+ GLenum srcAlpha,
+ GLenum dstAlpha)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glBlendFuncSeparate, GLenum, GLenum, GLenum, GLenum, srcRGB, dstRGB, srcAlpha, dstAlpha);
+
+ YAGL_GET_CTX();
+
+ if (yagl_gles_is_blend_func_valid(srcRGB) &&
+ yagl_gles_is_blend_func_valid(dstRGB) &&
+ yagl_gles_is_blend_func_valid(srcAlpha) &&
+ yagl_gles_is_blend_func_valid(dstAlpha)) {
+ ctx->blend_src_rgb = srcRGB;
+ ctx->blend_src_alpha = srcAlpha;
+
+ ctx->blend_dst_rgb = dstRGB;
+ ctx->blend_dst_alpha = dstAlpha;
+
+ yagl_host_glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
+ } else {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
+{
+ struct yagl_gles_buffer *buffer_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glBufferData, GLenum, GLsizeiptr, const GLvoid*, GLenum, target, size, data, usage);
+
+ YAGL_GET_CTX();
+
+ if (size < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (!yagl_gles_is_buffer_usage_valid(usage)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!yagl_gles_context_acquire_binded_buffer(ctx, target, &buffer_obj)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!buffer_obj) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ yagl_gles_buffer_set_data(buffer_obj, size, data, usage);
+
+out:
+ yagl_gles_buffer_release(buffer_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)
+{
+ struct yagl_gles_buffer *buffer_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glBufferSubData, GLenum, GLintptr, GLsizeiptr, const GLvoid*, target, offset, size, data);
+
+ YAGL_GET_CTX();
+
+ if ((offset < 0) || (size < 0)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (!yagl_gles_context_acquire_binded_buffer(ctx, target, &buffer_obj)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!buffer_obj) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (size == 0) {
+ goto out;
+ }
+
+ if (!yagl_gles_buffer_update_data(buffer_obj, offset, size, data)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+out:
+ yagl_gles_buffer_release(buffer_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+GLenum glCheckFramebufferStatus(GLenum target)
+{
+ GLenum res = 0;
+ struct yagl_gles_framebuffer *framebuffer_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glCheckFramebufferStatus, GLenum, target);
+
+ YAGL_GET_CTX_RET(0);
+
+ if (!yagl_gles_context_acquire_binded_framebuffer(ctx, target, &framebuffer_obj)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ res = yagl_gles_context_check_framebuffer_status(ctx, framebuffer_obj);
+
+out:
+ yagl_gles_framebuffer_release(framebuffer_obj);
+
+ YAGL_LOG_FUNC_EXIT_SPLIT(GLenum, res);
+
+ return res;
+}
+
+YAGL_API void glClear(GLbitfield mask)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glClear, GLbitfield, mask);
+
+ YAGL_GET_CTX();
+
+ yagl_render_invalidate((mask & GL_COLOR_BUFFER_BIT));
+
+ yagl_host_glClear(mask);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glClearColor(GLclampf red,
+ GLclampf green,
+ GLclampf blue,
+ GLclampf alpha)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glClearColor, GLclampf, GLclampf, GLclampf, GLclampf, red, green, blue, alpha);
+
+ YAGL_GET_CTX();
+
+ yagl_gles_context_clear_color(ctx,
+ red,
+ green,
+ blue,
+ alpha);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glClearDepthf(GLclampf depth)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glClearDepthf, GLclampf, depth);
+
+ YAGL_GET_CTX();
+
+ yagl_gles_context_clear_depthf(ctx, depth);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glColorMask(GLboolean red,
+ GLboolean green,
+ GLboolean blue,
+ GLboolean alpha)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glColorMask, GLboolean, GLboolean, GLboolean, GLboolean, red, green, blue, alpha);
+
+ YAGL_GET_CTX();
+
+ ctx->color_writemask[0] = red;
+ ctx->color_writemask[1] = green;
+ ctx->color_writemask[2] = blue;
+ ctx->color_writemask[3] = alpha;
+
+ yagl_host_glColorMask(red, green, blue, alpha);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
+{
+ GLenum squashed_target;
+ yagl_gles_texture_target texture_target;
+ struct yagl_gles_texture_target_state *tex_target_state;
+ int using_pbo = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT8(glCompressedTexImage2D, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*, target, level, internalformat, width, height, border, imageSize, data);
+
+ YAGL_GET_CTX();
+
+ if ((width < 0) || (height < 0)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (!yagl_gles_validate_texture_target_squash(target, &squashed_target)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!yagl_gles_context_validate_texture_target(ctx,
+ squashed_target,
+ &texture_target)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ tex_target_state =
+ yagl_gles_context_get_active_texture_target_state(ctx, texture_target);
+
+ if ((width == 0) || (height == 0)) {
+ width = height = 0;
+ }
+
+ if ((width != 0) && !yagl_gles_context_pre_unpack(ctx, &data, 1, &using_pbo)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ assert(!using_pbo);
+
+ if (target == GL_TEXTURE_2D) {
+ if (tex_target_state->texture != tex_target_state->texture_zero) {
+ /*
+ * This operation should orphan EGLImage according
+ * to OES_EGL_image specs.
+ *
+ * This operation should release TexImage according
+ * to eglBindTexImage spec.
+ */
+ yagl_gles_texture_unset_image(tex_target_state->texture);
+ }
+ }
+
+ ctx->compressed_tex_image_2d(ctx,
+ target,
+ tex_target_state->texture,
+ level,
+ internalformat,
+ width,
+ height,
+ border,
+ imageSize,
+ data);
+
+ if (width != 0) {
+ yagl_gles_context_post_unpack(ctx, 1);
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
+{
+ int using_pbo = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT9(glCompressedTexSubImage2D, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*, target, level, xoffset, yoffset, width, height, format, imageSize, data);
+
+ YAGL_GET_CTX();
+
+ if ((width < 0) || (height < 0)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if ((width == 0) || (height == 0)) {
+ width = height = 0;
+ }
+
+ if ((width != 0) && !yagl_gles_context_pre_unpack(ctx, &data, 1, &using_pbo)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ assert(!using_pbo);
+
+ ctx->compressed_tex_sub_image_2d(ctx,
+ target,
+ level,
+ xoffset,
+ yoffset,
+ width,
+ height,
+ format,
+ imageSize,
+ data);
+
+ if (width != 0) {
+ yagl_gles_context_post_unpack(ctx, 1);
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glCopyTexImage2D(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLint border)
+{
+ GLenum actual_internalformat = internalformat;
+ GLenum squashed_target;
+ yagl_gles_texture_target texture_target;
+ struct yagl_gles_texture_target_state *tex_target_state;
+ int is_float;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT8(glCopyTexImage2D, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, target, level, internalformat, x, y, width, height, border);
+
+ YAGL_GET_CTX();
+
+ if (border != 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (!yagl_gles_validate_texture_target_squash(target, &squashed_target)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!yagl_gles_context_validate_texture_target(ctx,
+ squashed_target,
+ &texture_target)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ tex_target_state =
+ yagl_gles_context_get_active_texture_target_state(ctx, texture_target);
+
+ if (!yagl_gles_context_validate_copyteximage_format(ctx,
+ &actual_internalformat,
+ &is_float)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ yagl_host_glCopyTexImage2D(target,
+ level,
+ actual_internalformat,
+ x,
+ y,
+ width,
+ height,
+ border);
+
+ yagl_gles_texture_set_internalformat(tex_target_state->texture,
+ internalformat,
+ (is_float ? GL_FLOAT : 0),
+ yagl_gles_context_convert_textures(ctx));
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glCopyTexSubImage2D(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT8(glCopyTexSubImage2D, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, target, level, xoffset, yoffset, x, y, width, height);
+
+ YAGL_GET_CTX();
+
+ if ((ctx->base.client_api == yagl_client_api_gles1) &&
+ (target != GL_TEXTURE_2D)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ yagl_host_glCopyTexSubImage2D(target,
+ level,
+ xoffset,
+ yoffset,
+ x,
+ y,
+ width,
+ height);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glCullFace(GLenum mode)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glCullFace, GLenum, mode);
+
+ YAGL_GET_CTX();
+
+ if (yagl_gles_is_cull_face_mode_valid(mode)) {
+ ctx->cull_face_mode = mode;
+
+ yagl_host_glCullFace(mode);
+ } else {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glDeleteBuffers(GLsizei n, const GLuint *buffers)
+{
+ GLsizei i;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glDeleteBuffers, GLsizei, const GLuint*, n, buffers);
+
+ YAGL_GET_CTX();
+
+ if (n < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (buffers) {
+ for (i = 0; i < n; ++i) {
+ yagl_gles_context_unbind_buffer(ctx, buffers[i]);
+
+ yagl_sharegroup_remove(ctx->base.sg,
+ YAGL_NS_BUFFER,
+ buffers[i]);
+ }
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+void glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers)
+{
+ GLsizei i;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glDeleteFramebuffers, GLsizei, const GLuint*, n, framebuffers);
+
+ YAGL_GET_CTX();
+
+ if (n < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (framebuffers) {
+ for (i = 0; i < n; ++i) {
+ yagl_gles_context_unbind_framebuffer(ctx, framebuffers[i]);
+
+ yagl_namespace_remove(&ctx->framebuffers,
+ framebuffers[i]);
+ }
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+void glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers)
+{
+ GLsizei i;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glDeleteRenderbuffers, GLsizei, const GLuint*, n, renderbuffers);
+
+ YAGL_GET_CTX();
+
+ if (n < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (renderbuffers) {
+ for (i = 0; i < n; ++i) {
+ yagl_gles_context_unbind_renderbuffer(ctx, renderbuffers[i]);
+
+ yagl_sharegroup_remove(ctx->base.sg,
+ YAGL_NS_RENDERBUFFER,
+ renderbuffers[i]);
+ }
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glDeleteTextures(GLsizei n, const GLuint *textures)
+{
+ GLsizei i;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glDeleteTextures, GLsizei, const GLuint*, n, textures);
+
+ YAGL_GET_CTX();
+
+ if (n < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (textures) {
+ for (i = 0; i < n; ++i) {
+ yagl_gles_context_unbind_texture(ctx, textures[i]);
+
+ yagl_sharegroup_remove(ctx->base.sg,
+ YAGL_NS_TEXTURE,
+ textures[i]);
+
+ }
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glDepthFunc(GLenum func)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glDepthFunc, GLenum, func);
+
+ YAGL_GET_CTX();
+
+ if (yagl_gles_is_depth_func_valid(func)) {
+ ctx->depth_func = func;
+
+ yagl_host_glDepthFunc(func);
+ } else {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glDepthMask(GLboolean flag)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glDepthMask, GLboolean, flag);
+
+ YAGL_GET_CTX();
+
+ ctx->depth_writemask = flag;
+
+ yagl_host_glDepthMask(flag);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glDepthRangef(GLclampf zNear, GLclampf zFar)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glDepthRangef, GLclampf, GLclampf, zNear, zFar);
+
+ YAGL_GET_CTX();
+
+ yagl_gles_context_depth_rangef(ctx, zNear, zFar);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glDisable(GLenum cap)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glDisable, GLenum, cap);
+
+ YAGL_GET_CTX();
+
+ yagl_gles_context_enable(ctx, cap, GL_FALSE);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glDrawArrays(GLenum mode, GLint first, GLsizei count)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glDrawArrays, GLenum, GLint, GLsizei, mode, first, count);
+
+ YAGL_GET_CTX();
+
+ yagl_gles_context_draw_arrays(ctx, mode, first, count, -1);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glDrawElements, GLenum, GLsizei, GLenum, const GLvoid*, mode, count, type, indices);
+
+ YAGL_GET_CTX();
+
+ yagl_gles_context_draw_elements(ctx, mode, count, type, indices, -1);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glEnable(GLenum cap)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glEnable, GLenum, cap);
+
+ YAGL_GET_CTX();
+
+ yagl_gles_context_enable(ctx, cap, GL_TRUE);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glFinish()
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT0(glFinish);
+
+ yagl_render_finish();
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_IMPLEMENT_API_NORET0(glFlush)
+
+void glFramebufferRenderbuffer(GLenum target,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer)
+{
+ struct yagl_gles_framebuffer *framebuffer_obj = NULL;
+ struct yagl_gles_renderbuffer *renderbuffer_obj = NULL;
+ yagl_gles_framebuffer_attachment framebuffer_attachment;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glFramebufferRenderbuffer, GLenum, GLenum, GLenum, GLuint, target, attachment, renderbuffertarget, renderbuffer);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles_context_acquire_binded_framebuffer(ctx, target, &framebuffer_obj)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!framebuffer_obj) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (renderbuffer) {
+ renderbuffer_obj = (struct yagl_gles_renderbuffer*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_RENDERBUFFER, renderbuffer);
+
+ if (!renderbuffer_obj) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+ }
+
+ if (renderbuffer_obj && (renderbuffertarget != GL_RENDERBUFFER)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if ((ctx->base.client_api == yagl_client_api_gles3) &&
+ (attachment == GL_DEPTH_STENCIL_ATTACHMENT)) {
+ yagl_gles_framebuffer_renderbuffer(framebuffer_obj,
+ target, GL_DEPTH_ATTACHMENT,
+ yagl_gles_framebuffer_attachment_depth,
+ renderbuffertarget,
+ renderbuffer_obj);
+ yagl_gles_framebuffer_renderbuffer(framebuffer_obj,
+ target, GL_STENCIL_ATTACHMENT,
+ yagl_gles_framebuffer_attachment_stencil,
+ renderbuffertarget,
+ renderbuffer_obj);
+ } else {
+ if (!yagl_gles_validate_framebuffer_attachment(attachment,
+ ctx->max_color_attachments,
+ &framebuffer_attachment)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ yagl_gles_framebuffer_renderbuffer(framebuffer_obj,
+ target, attachment,
+ framebuffer_attachment,
+ renderbuffertarget,
+ renderbuffer_obj);
+ }
+
+out:
+ yagl_gles_renderbuffer_release(renderbuffer_obj);
+ yagl_gles_framebuffer_release(framebuffer_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+void glFramebufferTexture2D(GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level)
+{
+ struct yagl_gles_framebuffer *framebuffer_obj = NULL;
+ struct yagl_gles_texture *texture_obj = NULL;
+ yagl_gles_framebuffer_attachment framebuffer_attachment;
+ GLenum squashed_textarget;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glFramebufferTexture2D, GLenum, GLenum, GLenum, GLuint, GLint, target, attachment, textarget, texture, level);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles_context_acquire_binded_framebuffer(ctx, target, &framebuffer_obj)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!framebuffer_obj) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (texture) {
+ texture_obj = (struct yagl_gles_texture*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_TEXTURE, texture);
+
+ if (!texture_obj) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+ }
+
+ if (texture_obj && (level != 0)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!yagl_gles_validate_texture_target_squash(textarget,
+ &squashed_textarget)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (texture_obj && (texture_obj->target != squashed_textarget)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if ((ctx->base.client_api == yagl_client_api_gles3) &&
+ (attachment == GL_DEPTH_STENCIL_ATTACHMENT)) {
+ yagl_gles_framebuffer_texture2d(framebuffer_obj,
+ target, GL_DEPTH_ATTACHMENT,
+ yagl_gles_framebuffer_attachment_depth,
+ textarget,
+ level,
+ texture_obj);
+ yagl_gles_framebuffer_texture2d(framebuffer_obj,
+ target, GL_STENCIL_ATTACHMENT,
+ yagl_gles_framebuffer_attachment_stencil,
+ textarget,
+ level,
+ texture_obj);
+ } else {
+ if (!yagl_gles_validate_framebuffer_attachment(attachment,
+ ctx->max_color_attachments,
+ &framebuffer_attachment)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ yagl_gles_framebuffer_texture2d(framebuffer_obj,
+ target, attachment,
+ framebuffer_attachment,
+ textarget,
+ level,
+ texture_obj);
+ }
+
+out:
+ yagl_gles_texture_release(texture_obj);
+ yagl_gles_framebuffer_release(framebuffer_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glFrontFace(GLenum mode)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glFrontFace, GLenum, mode);
+
+ YAGL_GET_CTX();
+
+ if (yagl_gles_is_front_face_mode_valid(mode)) {
+ ctx->front_face_mode = mode;
+
+ yagl_host_glFrontFace(mode);
+ } else {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGenBuffers(GLsizei n, GLuint *buffer_names)
+{
+ struct yagl_gles_buffer **buffers = NULL;
+ GLsizei i;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glGenBuffers, GLsizei, GLuint*, n, buffer_names);
+
+ YAGL_GET_CTX();
+
+ if (n < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ buffers = yagl_malloc0(n * sizeof(*buffers));
+
+ for (i = 0; i < n; ++i) {
+ buffers[i] = yagl_gles_buffer_create();
+
+ if (!buffers[i]) {
+ goto out;
+ }
+ }
+
+ for (i = 0; i < n; ++i) {
+ yagl_sharegroup_add(ctx->base.sg,
+ YAGL_NS_BUFFER,
+ &buffers[i]->base);
+
+ if (buffer_names) {
+ buffer_names[i] = buffers[i]->base.local_name;
+ }
+ }
+
+out:
+ for (i = 0; i < n; ++i) {
+ yagl_gles_buffer_release(buffers[i]);
+ }
+ yagl_free(buffers);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+void glGenerateMipmap(GLenum target)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glGenerateMipmap, GLenum, target);
+
+ YAGL_GET_CTX();
+
+ yagl_host_glGenerateMipmap(target);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+void glGenFramebuffers(GLsizei n, GLuint *framebuffer_names)
+{
+ struct yagl_gles_framebuffer **framebuffers = NULL;
+ GLsizei i;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glGenFramebuffers, GLsizei, GLuint*, n, framebuffer_names);
+
+ YAGL_GET_CTX();
+
+ if (n < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ framebuffers = yagl_malloc0(n * sizeof(*framebuffers));
+
+ for (i = 0; i < n; ++i) {
+ framebuffers[i] = yagl_gles_framebuffer_create();
+
+ if (!framebuffers[i]) {
+ goto out;
+ }
+ }
+
+ for (i = 0; i < n; ++i) {
+ yagl_namespace_add(&ctx->framebuffers,
+ &framebuffers[i]->base);
+
+ if (framebuffer_names) {
+ framebuffer_names[i] = framebuffers[i]->base.local_name;
+ }
+ }
+
+out:
+ for (i = 0; i < n; ++i) {
+ yagl_gles_framebuffer_release(framebuffers[i]);
+ }
+ yagl_free(framebuffers);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+void glGenRenderbuffers(GLsizei n, GLuint *renderbuffer_names)
+{
+ struct yagl_gles_renderbuffer **renderbuffers = NULL;
+ GLsizei i;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glGenRenderbuffers, GLsizei, GLuint*, n, renderbuffer_names);
+
+ YAGL_GET_CTX();
+
+ if (n < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ renderbuffers = yagl_malloc0(n * sizeof(*renderbuffers));
+
+ for (i = 0; i < n; ++i) {
+ renderbuffers[i] = yagl_gles_renderbuffer_create();
+
+ if (!renderbuffers[i]) {
+ goto out;
+ }
+ }
+
+ for (i = 0; i < n; ++i) {
+ yagl_sharegroup_add(ctx->base.sg,
+ YAGL_NS_RENDERBUFFER,
+ &renderbuffers[i]->base);
+
+ if (renderbuffer_names) {
+ renderbuffer_names[i] = renderbuffers[i]->base.local_name;
+ }
+ }
+
+out:
+ for (i = 0; i < n; ++i) {
+ yagl_gles_renderbuffer_release(renderbuffers[i]);
+ }
+ yagl_free(renderbuffers);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGenTextures(GLsizei n, GLuint *texture_names)
+{
+ struct yagl_gles_texture **textures = NULL;
+ GLsizei i;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glGenTextures, GLsizei, GLuint*, n, texture_names);
+
+ YAGL_GET_CTX();
+
+ if (n < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ textures = yagl_malloc0(n * sizeof(*textures));
+
+ for (i = 0; i < n; ++i) {
+ textures[i] = yagl_gles_texture_create();
+
+ if (!textures[i]) {
+ goto out;
+ }
+ }
+
+ for (i = 0; i < n; ++i) {
+ yagl_sharegroup_add(ctx->base.sg,
+ YAGL_NS_TEXTURE,
+ &textures[i]->base);
+
+ if (texture_names) {
+ texture_names[i] = textures[i]->base.local_name;
+ }
+ }
+
+out:
+ for (i = 0; i < n; ++i) {
+ yagl_gles_texture_release(textures[i]);
+ }
+ yagl_free(textures);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetBooleanv(GLenum pname, GLboolean *params)
+{
+ GLint ints[100]; // This fits all cases.
+ uint32_t i, num = 0;
+ int needs_map;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glGetBooleanv, GLenum, GLboolean*, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (yagl_gles_context_get_integerv(ctx, pname, ints, &num)) {
+ for (i = 0; i < num; ++i) {
+ params[i] = ints[i] ? GL_TRUE : GL_FALSE;
+ }
+ } else {
+ GLfloat floats[100]; // This fits all cases.
+ if (yagl_gles_context_get_floatv(ctx, pname, floats, &num, &needs_map)) {
+ for (i = 0; i < num; ++i) {
+ params[i] = (floats[i] == 0.0f) ? GL_FALSE : GL_TRUE;
+ }
+ } else {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
+{
+ struct yagl_gles_buffer *buffer_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetBufferParameteriv, GLenum, GLenum, GLint*, target, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles_context_acquire_binded_buffer(ctx, target, &buffer_obj)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!buffer_obj) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles_buffer_get_parameter(buffer_obj,
+ pname,
+ params)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+out:
+ yagl_gles_buffer_release(buffer_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API GLenum glGetError(void)
+{
+ GLenum ret;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT0(glGetError);
+
+ YAGL_GET_CTX_RET(GL_NO_ERROR);
+
+ ret = yagl_gles_context_get_error(ctx);
+
+ YAGL_LOG_FUNC_EXIT_SPLIT(GLenum, ret);
+
+ return ret;
+}
+
+YAGL_API void glGetFloatv(GLenum pname, GLfloat *params)
+{
+ uint32_t i, num = 0;
+ int needs_map;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glGetFloatv, GLenum, GLfloat*, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles_context_get_floatv(ctx, pname, params, &num, &needs_map)) {
+ GLint ints[100]; // This fits all cases.
+ if (yagl_gles_context_get_integerv(ctx, pname, ints, &num)) {
+ for (i = 0; i < num; ++i) {
+ params[i] = ints[i];
+ }
+ } else {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params)
+{
+ struct yagl_gles_framebuffer *framebuffer_obj = NULL;
+ yagl_gles_framebuffer_attachment framebuffer_attachment;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glGetFramebufferAttachmentParameteriv, GLenum, GLenum, GLenum, GLint*, target, attachment, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles_context_acquire_binded_framebuffer(ctx, target, &framebuffer_obj)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!framebuffer_obj) {
+ /*
+ * Default framebuffer, special handling.
+ */
+
+ switch (attachment) {
+ case GL_BACK:
+ case GL_DEPTH:
+ case GL_STENCIL:
+ break;
+ default:
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ switch (pname) {
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
+ *params = GL_FRAMEBUFFER_DEFAULT;
+ break;
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
+ *params = 0;
+ break;
+ case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
+ case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
+ case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
+ case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
+ case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
+ case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
+ case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:
+ /*
+ * TODO: implement.
+ */
+ *params = 0;
+ break;
+ case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:
+ *params = GL_LINEAR;
+ break;
+ default:
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ break;
+ }
+
+ goto out;
+ }
+
+ if ((ctx->base.client_api == yagl_client_api_gles3) &&
+ (attachment == GL_DEPTH_STENCIL_ATTACHMENT)) {
+ if (memcmp(&framebuffer_obj->attachment_states[yagl_gles_framebuffer_attachment_depth],
+ &framebuffer_obj->attachment_states[yagl_gles_framebuffer_attachment_stencil],
+ sizeof(struct yagl_gles_framebuffer_attachment_state)) != 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+ framebuffer_attachment = yagl_gles_framebuffer_attachment_depth;
+ } else if (!yagl_gles_validate_framebuffer_attachment(attachment,
+ ctx->max_color_attachments,
+ &framebuffer_attachment)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ switch (pname) {
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
+ *params = framebuffer_obj->attachment_states[framebuffer_attachment].type;
+ break;
+ case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
+ *params = framebuffer_obj->attachment_states[framebuffer_attachment].local_name;
+ break;
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
+ if (framebuffer_obj->attachment_states[framebuffer_attachment].type == GL_TEXTURE) {
+ *params = 0;
+ } else {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+ break;
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
+ if (framebuffer_obj->attachment_states[framebuffer_attachment].type == GL_TEXTURE) {
+ *params =
+ (framebuffer_obj->attachment_states[framebuffer_attachment].textarget == GL_TEXTURE_2D)
+ ? 0 : framebuffer_obj->attachment_states[framebuffer_attachment].textarget;
+ } else {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+ break;
+ case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:
+ if (framebuffer_obj->attachment_states[framebuffer_attachment].type == GL_TEXTURE) {
+ *params = framebuffer_obj->attachment_states[framebuffer_attachment].layer;
+ } else {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+ break;
+ default:
+ if (framebuffer_obj->attachment_states[framebuffer_attachment].type != GL_NONE) {
+ GLenum internalformat = 0;
+ const struct yagl_gles_format_info *format_info;
+
+ yagl_gles_framebuffer_attachment_internalformat(
+ &framebuffer_obj->attachment_states[framebuffer_attachment],
+ &internalformat);
+
+ format_info = yagl_gles_internalformat_info(internalformat);
+
+ switch (pname) {
+ case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
+ *params = format_info->red_size;
+ break;
+ case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
+ *params = format_info->green_size;
+ break;
+ case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
+ *params = format_info->blue_size;
+ break;
+ case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
+ *params = format_info->alpha_size;
+ break;
+ case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
+ *params = format_info->depth_size;
+ break;
+ case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
+ *params = format_info->stencil_size;
+ break;
+ case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:
+ if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ } else {
+ /*
+ * TODO: implement.
+ */
+ *params = 0;
+ }
+ break;
+ case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:
+ *params = ((format_info->flags & yagl_gles_format_srgb) != 0) ?
+ GL_SRGB : GL_LINEAR;
+ break;
+ default:
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ break;
+ }
+ } else {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+ break;
+ }
+
+out:
+ yagl_gles_framebuffer_release(framebuffer_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetIntegerv(GLenum pname, GLint *params)
+{
+ uint32_t i, num = 0;
+ int needs_map = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glGetIntegerv, GLenum, GLint*, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles_context_get_integerv(ctx, pname, params, &num)) {
+ GLfloat floats[100]; // This fits all cases.
+ if (yagl_gles_context_get_floatv(ctx, pname, floats, &num, &needs_map)) {
+ for (i = 0; i < num; ++i) {
+ if (needs_map) {
+ params[i] = 2147483647.0 * floats[i];
+ } else {
+ params[i] = floats[i];
+ }
+ }
+ } else {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetRenderbufferParameteriv, GLenum, GLenum, GLint*, target, pname, params);
+
+ YAGL_GET_CTX();
+
+ /*
+ * TODO: Passthrough for now.
+ */
+
+ yagl_host_glGetRenderbufferParameteriv(target, pname, params);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetTexParameterfv, GLenum, GLenum, GLfloat*, target, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles_context_get_tex_parameterfv(ctx, target, pname, params)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetTexParameteriv, GLenum, GLenum, GLint*, target, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles_context_get_tex_parameteriv(ctx, target, pname, params)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API GLboolean glIsBuffer(GLuint buffer)
+{
+ GLboolean res = GL_FALSE;
+ struct yagl_gles_buffer *buffer_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glIsBuffer, GLuint, buffer);
+
+ YAGL_GET_CTX_RET(GL_FALSE);
+
+ buffer_obj = (struct yagl_gles_buffer*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_BUFFER, buffer);
+
+ if (buffer_obj && yagl_gles_buffer_was_bound(buffer_obj)) {
+ res = GL_TRUE;
+ }
+
+ yagl_gles_buffer_release(buffer_obj);
+
+ YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, res);
+
+ return res;
+}
+
+YAGL_API GLboolean glIsEnabled(GLenum cap)
+{
+ GLboolean res;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glIsEnabled, GLenum, cap);
+
+ YAGL_GET_CTX_RET(GL_FALSE);
+
+ res = yagl_gles_context_is_enabled(ctx, cap);
+
+ YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, res);
+
+ return res;
+}
+
+GLboolean glIsFramebuffer(GLuint framebuffer)
+{
+ GLboolean res = GL_FALSE;
+ struct yagl_gles_framebuffer *framebuffer_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glIsFramebuffer, GLuint, framebuffer);
+
+ YAGL_GET_CTX_RET(GL_FALSE);
+
+ framebuffer_obj = (struct yagl_gles_framebuffer*)yagl_namespace_acquire(&ctx->framebuffers,
+ framebuffer);
+
+ if (framebuffer_obj && yagl_gles_framebuffer_was_bound(framebuffer_obj)) {
+ res = GL_TRUE;
+ }
+
+ yagl_gles_framebuffer_release(framebuffer_obj);
+
+ YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, res);
+
+ return res;
+}
+
+GLboolean glIsRenderbuffer(GLuint renderbuffer)
+{
+ GLboolean res = GL_FALSE;
+ struct yagl_gles_renderbuffer *renderbuffer_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glIsRenderbuffer, GLuint, renderbuffer);
+
+ YAGL_GET_CTX_RET(GL_FALSE);
+
+ renderbuffer_obj = (struct yagl_gles_renderbuffer*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_RENDERBUFFER, renderbuffer);
+
+ if (renderbuffer_obj && yagl_gles_renderbuffer_was_bound(renderbuffer_obj)) {
+ res = GL_TRUE;
+ }
+
+ yagl_gles_renderbuffer_release(renderbuffer_obj);
+
+ YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, res);
+
+ return res;
+}
+
+YAGL_API GLboolean glIsTexture(GLuint texture)
+{
+ GLboolean res = GL_FALSE;
+ struct yagl_gles_texture *texture_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glIsTexture, GLuint, texture);
+
+ YAGL_GET_CTX_RET(GL_FALSE);
+
+ texture_obj = (struct yagl_gles_texture*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_TEXTURE, texture);
+
+ if (texture_obj && (texture_obj->target != 0)) {
+ res = GL_TRUE;
+ }
+
+ yagl_gles_texture_release(texture_obj);
+
+ YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, res);
+
+ return res;
+}
+
+YAGL_API void glPixelStorei(GLenum pname, GLint param)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glPixelStorei, GLenum, GLint, pname, param);
+
+ YAGL_GET_CTX();
+
+ /*
+ * We don't pass GL_XXX_SKIP_YYY to host, this
+ * is intentionally so that we can pass less data later in glTexImage*
+ * and glReadPixels, i.e. we process skips ourselves and feed biased
+ * data to host.
+ */
+
+ switch (pname) {
+ case GL_PACK_ALIGNMENT:
+ if (yagl_gles_is_alignment_valid(param)) {
+ ctx->pack.alignment = param;
+ } else {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+ break;
+ case GL_PACK_ROW_LENGTH:
+ if (param >= 0) {
+ ctx->pack.row_length = param;
+ } else {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+ break;
+ case GL_PACK_IMAGE_HEIGHT:
+ if (param >= 0) {
+ ctx->pack.image_height = param;
+ } else {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+ break;
+ case GL_PACK_SKIP_PIXELS:
+ if (param >= 0) {
+ ctx->pack.skip_pixels = param;
+ } else {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ }
+ goto out;
+ break;
+ case GL_PACK_SKIP_ROWS:
+ if (param >= 0) {
+ ctx->pack.skip_rows = param;
+ } else {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ }
+ goto out;
+ break;
+ case GL_PACK_SKIP_IMAGES:
+ if (param >= 0) {
+ ctx->pack.skip_images = param;
+ } else {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ }
+ goto out;
+ break;
+ case GL_UNPACK_ALIGNMENT:
+ if (yagl_gles_is_alignment_valid(param)) {
+ ctx->unpack.alignment = param;
+ } else {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+ break;
+ case GL_UNPACK_ROW_LENGTH:
+ if (param >= 0) {
+ ctx->unpack.row_length = param;
+ } else {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+ break;
+ case GL_UNPACK_IMAGE_HEIGHT:
+ if (param >= 0) {
+ ctx->unpack.image_height = param;
+ } else {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+ break;
+ case GL_UNPACK_SKIP_PIXELS:
+ if (param >= 0) {
+ ctx->unpack.skip_pixels = param;
+ } else {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ }
+ goto out;
+ break;
+ case GL_UNPACK_SKIP_ROWS:
+ if (param >= 0) {
+ ctx->unpack.skip_rows = param;
+ } else {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ }
+ goto out;
+ break;
+ case GL_UNPACK_SKIP_IMAGES:
+ if (param >= 0) {
+ ctx->unpack.skip_images = param;
+ } else {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ }
+ goto out;
+ break;
+ default:
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ yagl_host_glPixelStorei(pname, param);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
+{
+ struct yagl_pixel_format *pf;
+ GLsizei size;
+ int using_pbo = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT7(glReadPixels, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*, x, y, width, height, format, type, pixels);
+
+ YAGL_GET_CTX();
+
+ if ((width < 0) || (height < 0)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if ((width == 0) || (height == 0)) {
+ width = height = 0;
+ }
+
+ pf = yagl_gles_context_validate_getteximage_format(ctx, format, type);
+
+ if (!pf) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ yagl_render_invalidate(0);
+
+ if ((width != 0) && !yagl_gles_context_pre_pack(ctx, &pixels, pf->need_convert, &using_pbo)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ pixels += yagl_pixel_format_get_info(pf, &ctx->pack,
+ width, height, 1, &size);
+
+ if (using_pbo) {
+ yagl_host_glReadPixelsOffset(x, y,
+ width, height,
+ pf->dst_format,
+ pf->dst_type,
+ (GLsizei)pixels);
+ } else {
+ GLvoid *pixels_from;
+
+ pixels_from = yagl_pixel_format_pack_alloc(pf, &ctx->pack,
+ width,
+ height,
+ pixels);
+
+ yagl_host_glReadPixelsData(x, y,
+ width, height,
+ pf->dst_format,
+ pf->dst_type,
+ pixels_from,
+ size,
+ NULL);
+
+ yagl_pixel_format_pack(pf, &ctx->pack,
+ width,
+ height,
+ pixels_from,
+ pixels);
+ }
+
+ if (width != 0) {
+ yagl_gles_context_post_pack(ctx, pixels, size, pf->need_convert);
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
+{
+ GLenum squashed_target;
+ yagl_gles_texture_target texture_target;
+ struct yagl_gles_texture_target_state *tex_target_state;
+ struct yagl_pixel_format *pf;
+ GLsizei size;
+ int using_pbo = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT9(glTexImage2D, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*, target, level, internalformat, width, height, border, format, type, pixels);
+
+ YAGL_GET_CTX();
+
+ if ((width < 0) || (height < 0)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (!yagl_gles_validate_texture_target_squash(target, &squashed_target)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!yagl_gles_context_validate_texture_target(ctx,
+ squashed_target,
+ &texture_target)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ tex_target_state =
+ yagl_gles_context_get_active_texture_target_state(ctx, texture_target);
+
+ if ((width == 0) || (height == 0)) {
+ width = height = 0;
+ }
+
+ pf = yagl_gles_context_validate_teximage_format(ctx, internalformat, format, type);
+
+ if (!pf) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if ((width != 0) && !yagl_gles_context_pre_unpack(ctx, &pixels, pf->need_convert, &using_pbo)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (target == GL_TEXTURE_2D) {
+ if (tex_target_state->texture != tex_target_state->texture_zero) {
+ /*
+ * This operation should orphan EGLImage according
+ * to OES_EGL_image specs.
+ *
+ * This operation should release TexImage according
+ * to eglBindTexImage spec.
+ */
+ yagl_gles_texture_unset_image(tex_target_state->texture);
+ }
+ }
+
+ if (pixels || using_pbo) {
+ pixels += yagl_pixel_format_get_info(pf, &ctx->unpack,
+ width, height, 1, &size);
+ } else {
+ yagl_pixel_format_get_info(pf, &ctx->unpack,
+ width, height, 1, &size);
+ }
+
+ if (using_pbo) {
+ yagl_host_glTexImage2DOffset(target,
+ level,
+ pf->dst_internalformat,
+ width,
+ height,
+ border,
+ pf->dst_format,
+ pf->dst_type,
+ (GLsizei)pixels);
+ } else {
+ yagl_host_glTexImage2DData(target,
+ level,
+ pf->dst_internalformat,
+ width,
+ height,
+ border,
+ pf->dst_format,
+ pf->dst_type,
+ yagl_pixel_format_unpack(pf, &ctx->unpack,
+ width,
+ height,
+ 1,
+ pixels),
+ size);
+ }
+
+ if (width != 0) {
+ yagl_gles_context_post_unpack(ctx, pf->need_convert);
+ }
+
+ yagl_gles_texture_set_internalformat(tex_target_state->texture,
+ internalformat,
+ type,
+ yagl_gles_context_convert_textures(ctx));
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
+{
+ GLenum squashed_target;
+ yagl_gles_texture_target texture_target;
+ struct yagl_gles_texture_target_state *tex_target_state;
+ struct yagl_pixel_format *pf;
+ GLsizei size;
+ int using_pbo = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT9(glTexSubImage2D, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*, target, level, xoffset, yoffset, width, height, format, type, pixels);
+
+ YAGL_GET_CTX();
+
+ if ((width < 0) || (height < 0)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (!yagl_gles_validate_texture_target_squash(target, &squashed_target)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!yagl_gles_context_validate_texture_target(ctx,
+ squashed_target,
+ &texture_target)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ tex_target_state =
+ yagl_gles_context_get_active_texture_target_state(ctx, texture_target);
+
+ if ((width == 0) || (height == 0)) {
+ width = height = 0;
+ }
+
+ pf = yagl_gles_context_validate_teximage_format(ctx,
+ tex_target_state->texture->internalformat, format, type);
+
+ if (!pf) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if ((width != 0) && !yagl_gles_context_pre_unpack(ctx, &pixels, pf->need_convert, &using_pbo)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ pixels += yagl_pixel_format_get_info(pf, &ctx->unpack,
+ width, height, 1, &size);
+
+ if (using_pbo) {
+ yagl_host_glTexSubImage2DOffset(target,
+ level,
+ xoffset,
+ yoffset,
+ width,
+ height,
+ pf->dst_format,
+ pf->dst_type,
+ (GLsizei)pixels);
+ } else {
+ yagl_host_glTexSubImage2DData(target,
+ level,
+ xoffset,
+ yoffset,
+ width,
+ height,
+ pf->dst_format,
+ pf->dst_type,
+ yagl_pixel_format_unpack(pf, &ctx->unpack,
+ width,
+ height,
+ 1,
+ pixels),
+ size);
+ }
+
+ if (width != 0) {
+ yagl_gles_context_post_unpack(ctx, pf->need_convert);
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
+{
+ struct yagl_gles_image *image_obj = NULL;
+ struct yagl_gles_texture_target_state *tex_target_state;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glEGLImageTargetTexture2DOES, GLenum, GLeglImageOES, target, image);
+
+ YAGL_GET_CTX();
+
+ if (target != GL_TEXTURE_2D) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ image_obj = (struct yagl_gles_image*)yagl_acquire_client_image((yagl_host_handle)image);
+
+ if (!image_obj) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ tex_target_state =
+ yagl_gles_context_get_active_texture_target_state(ctx,
+ yagl_gles_texture_target_2d);
+
+ if (tex_target_state->texture == tex_target_state->texture_zero) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ yagl_gles_texture_set_image(tex_target_state->texture, image_obj);
+
+out:
+ yagl_gles_image_release(image_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
+{
+ fprintf(stderr, "glEGLImageTargetRenderbufferStorageOES not supported in YaGL\n");
+}
+
+/*
+ * GL_ANGLE_framebuffer_blit.
+ * @{
+ */
+
+YAGL_API void glBlitFramebuffer(GLint srcX0, GLint srcY0,
+ GLint srcX1, GLint srcY1,
+ GLint dstX0, GLint dstY0,
+ GLint dstX1, GLint dstY1,
+ GLbitfield mask, GLenum filter)
+{
+ GLenum read_status, draw_status;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT10(glBlitFramebuffer, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
+
+ YAGL_GET_CTX();
+
+ if (mask & ~(GL_COLOR_BUFFER_BIT |
+ GL_DEPTH_BUFFER_BIT |
+ GL_STENCIL_BUFFER_BIT)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ switch (filter) {
+ case GL_NEAREST:
+ case GL_LINEAR:
+ break;
+ default:
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if ((mask & (GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)) &&
+ (filter != GL_NEAREST)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ read_status = yagl_gles_context_check_framebuffer_status(ctx,
+ ctx->fbo_read);
+
+ if (read_status != GL_FRAMEBUFFER_COMPLETE) {
+ YAGL_SET_ERR(GL_INVALID_FRAMEBUFFER_OPERATION);
+ goto out;
+ }
+
+ draw_status = yagl_gles_context_check_framebuffer_status(ctx,
+ ctx->fbo_draw);
+
+ if (draw_status != GL_FRAMEBUFFER_COMPLETE) {
+ YAGL_SET_ERR(GL_INVALID_FRAMEBUFFER_OPERATION);
+ goto out;
+ }
+
+ if (!ctx->min_mag_blits &&
+ ((abs(dstX0 - dstX1) != abs(srcX0 - srcX1)) ||
+ (abs(dstY0 - dstY1) != abs(srcY0 - srcY1)))) {
+ /*
+ * Minifying/magnifying blits cause crashes with some host OpenGL
+ * drivers, so disable them for now.
+ */
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ yagl_render_invalidate(0);
+
+ yagl_host_glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+YAGL_API YAGL_ALIAS(glBlitFramebuffer, glBlitFramebufferANGLE);
+
+/*
+ * @}
+ */
+
+/*
+ * GL_OES_vertex_array_object.
+ * @{
+ */
+
+YAGL_API void glBindVertexArray(GLuint array)
+{
+ struct yagl_gles_vertex_array *va_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glBindVertexArray, GLuint, array);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->vertex_arrays_supported) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (array != 0) {
+ va_obj = (struct yagl_gles_vertex_array*)yagl_namespace_acquire(&ctx->vertex_arrays,
+ array);
+
+ if (!va_obj) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+ }
+
+ yagl_gles_context_bind_vertex_array(ctx, va_obj);
+
+out:
+ yagl_gles_vertex_array_release(va_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+YAGL_API YAGL_ALIAS(glBindVertexArray, glBindVertexArrayOES);
+
+YAGL_API void glDeleteVertexArrays(GLsizei n, const GLuint *arrays)
+{
+ GLsizei i;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glDeleteVertexArrays, GLsizei, const GLuint*, n, arrays);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->vertex_arrays_supported) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (n < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (arrays) {
+ for (i = 0; i < n; ++i) {
+ yagl_gles_context_unbind_vertex_array(ctx, arrays[i]);
+ yagl_namespace_remove(&ctx->vertex_arrays, arrays[i]);
+ }
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+YAGL_API YAGL_ALIAS(glDeleteVertexArrays, glDeleteVertexArraysOES);
+
+YAGL_API void glGenVertexArrays(GLsizei n, GLuint *array_names)
+{
+ struct yagl_gles_vertex_array **arrays = NULL;
+ GLsizei i;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glGenVertexArrays, GLsizei, GLuint*, n, array_names);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->vertex_arrays_supported) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (n < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ arrays = yagl_malloc0(n * sizeof(*arrays));
+
+ for (i = 0; i < n; ++i) {
+ arrays[i] = yagl_gles_vertex_array_create(0,
+ ctx->create_arrays(ctx),
+ ctx->num_arrays);
+
+ if (!arrays[i]) {
+ goto out;
+ }
+ }
+
+ for (i = 0; i < n; ++i) {
+ yagl_namespace_add(&ctx->vertex_arrays,
+ &arrays[i]->base);
+
+ if (array_names) {
+ array_names[i] = arrays[i]->base.local_name;
+ }
+ }
+
+out:
+ for (i = 0; i < n; ++i) {
+ yagl_gles_vertex_array_release(arrays[i]);
+ }
+ yagl_free(arrays);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+YAGL_API YAGL_ALIAS(glGenVertexArrays, glGenVertexArraysOES);
+
+YAGL_API GLboolean glIsVertexArray(GLuint array)
+{
+ GLboolean res = GL_FALSE;
+ struct yagl_gles_vertex_array *va_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glIsVertexArray, GLuint, array);
+
+ YAGL_GET_CTX_RET(GL_FALSE);
+
+ if (!ctx->vertex_arrays_supported) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ va_obj = (struct yagl_gles_vertex_array*)yagl_namespace_acquire(&ctx->vertex_arrays,
+ array);
+
+ if (va_obj && yagl_gles_vertex_array_was_bound(va_obj)) {
+ res = GL_TRUE;
+ }
+
+ yagl_gles_vertex_array_release(va_obj);
+
+out:
+ YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, res);
+
+ return res;
+}
+YAGL_API YAGL_ALIAS(glIsVertexArray, glIsVertexArrayOES);
+
+/*
+ * @}
+ */
+
+/*
+ * GL_EXT_draw_buffers.
+ * @{
+ */
+
+YAGL_API void glDrawBuffers(GLsizei n, const GLenum *bufs)
+{
+ GLsizei i;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glDrawBuffers, GLsizei, const GLenum*, n, bufs);
+
+ YAGL_GET_CTX();
+
+ if ((n < 0) || (n > ctx->max_draw_buffers)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (ctx->fbo_draw) {
+ for (i = 0; i < n; ++i) {
+ if (bufs[i] == GL_NONE) {
+ continue;
+ }
+
+ if ((bufs[i] == GL_BACK) ||
+ (bufs[i] >= (GL_COLOR_ATTACHMENT0 + ctx->max_color_attachments))) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (bufs[i] < GL_COLOR_ATTACHMENT0) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if ((bufs[i] - GL_COLOR_ATTACHMENT0) != i) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+ }
+
+ memcpy(&ctx->fbo_draw->draw_buffers[0], bufs, n * sizeof(bufs[0]));
+
+ for (i = n; i < ctx->max_draw_buffers; ++i) {
+ ctx->fbo_draw->draw_buffers[i] = GL_NONE;
+ }
+ } else {
+ if ((n != 1) || ((bufs[0] != GL_NONE) && (bufs[0] != GL_BACK))) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ ctx->fb0_draw_buffer = bufs[0];
+ }
+
+ yagl_host_glDrawBuffers(bufs, n);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+YAGL_API YAGL_ALIAS(glDrawBuffers, glDrawBuffersEXT);
+
+/*
+ * @}
+ */
+
+/*
+ * GL_NV_read_buffer.
+ * @{
+ */
+
+YAGL_API void glReadBuffer(GLenum mode)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glReadBuffer, GLenum, mode);
+
+ YAGL_GET_CTX();
+
+ if (ctx->fbo_read) {
+ if (mode != GL_NONE) {
+ if ((mode < GL_COLOR_ATTACHMENT0) ||
+ (mode >= (GL_COLOR_ATTACHMENT0 + ctx->max_color_attachments))) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+ }
+
+ ctx->fbo_read->read_buffer = mode;
+ } else {
+ if ((mode != GL_NONE) && (mode != GL_BACK)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ ctx->fb0_read_buffer = mode;
+ }
+
+ yagl_host_glReadBuffer(mode);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+YAGL_API YAGL_ALIAS(glReadBuffer, glReadBufferNV);
+
+/*
+ * @}
+ */
+
+/*
+ * GL_OES_mapbuffer.
+ * @{
+ */
+
+YAGL_API void *glMapBuffer(GLenum target, GLenum access)
+{
+ void *ptr = NULL;
+ struct yagl_gles_buffer *buffer_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glMapBuffer, GLenum, GLenum, target, access);
+
+ YAGL_GET_CTX_RET(NULL);
+
+ if (access != GL_WRITE_ONLY) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!yagl_gles_context_acquire_binded_buffer(ctx, target, &buffer_obj)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!buffer_obj) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (yagl_gles_buffer_mapped(buffer_obj)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles_buffer_map(buffer_obj, 0, buffer_obj->size, GL_MAP_WRITE_BIT)) {
+ YAGL_SET_ERR(GL_OUT_OF_MEMORY);
+ goto out;
+ }
+
+ ptr = buffer_obj->map_pointer;
+
+out:
+ yagl_gles_buffer_release(buffer_obj);
+
+ YAGL_LOG_FUNC_EXIT("%p", ptr);
+
+ return ptr;
+}
+YAGL_API YAGL_ALIAS(glMapBuffer, glMapBufferOES);
+
+YAGL_API GLboolean glUnmapBuffer(GLenum target)
+{
+ GLboolean ret = GL_FALSE;
+ struct yagl_gles_buffer *buffer_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glUnmapBuffer, GLenum, target);
+
+ YAGL_GET_CTX_RET(GL_FALSE);
+
+ if (!yagl_gles_context_acquire_binded_buffer(ctx, target, &buffer_obj)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!buffer_obj) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles_buffer_mapped(buffer_obj)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ yagl_gles_buffer_unmap(buffer_obj);
+
+ ret = GL_TRUE;
+
+out:
+ yagl_gles_buffer_release(buffer_obj);
+
+ YAGL_LOG_FUNC_EXIT("%u", ret);
+
+ return ret;
+}
+YAGL_API YAGL_ALIAS(glUnmapBuffer, glUnmapBufferOES);
+
+YAGL_API void glGetBufferPointerv(GLenum target,
+ GLenum pname,
+ GLvoid **params)
+{
+ struct yagl_gles_buffer *buffer_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetBufferPointerv, GLenum, GLenum, GLvoid**, target, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (pname != GL_BUFFER_MAP_POINTER) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!yagl_gles_context_acquire_binded_buffer(ctx, target, &buffer_obj)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!buffer_obj) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ *params = buffer_obj->map_pointer;
+
+out:
+ yagl_gles_buffer_release(buffer_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+YAGL_API YAGL_ALIAS(glGetBufferPointerv, glGetBufferPointervOES);
+
+/*
+ * @}
+ */
+
+/*
+ * GL_EXT_map_buffer_range.
+ * @{
+ */
+
+YAGL_API void *glMapBufferRange(GLenum target, GLintptr offset,
+ GLsizeiptr length, GLbitfield access)
+{
+ void *ptr = NULL;
+ struct yagl_gles_buffer *buffer_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glMapBufferRange, GLenum, GLintptr, GLsizeiptr, GLbitfield, target, offset, length, access);
+
+ YAGL_GET_CTX_RET(NULL);
+
+ if ((offset < 0) || (length < 0)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (length == 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (access & ~(GL_MAP_READ_BIT |
+ GL_MAP_WRITE_BIT |
+ GL_MAP_INVALIDATE_RANGE_BIT |
+ GL_MAP_INVALIDATE_BUFFER_BIT |
+ GL_MAP_FLUSH_EXPLICIT_BIT |
+ GL_MAP_UNSYNCHRONIZED_BIT)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if ((access & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if ((access & GL_MAP_READ_BIT) &&
+ (access & (GL_MAP_INVALIDATE_RANGE_BIT |
+ GL_MAP_INVALIDATE_BUFFER_BIT |
+ GL_MAP_UNSYNCHRONIZED_BIT))) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if ((access & GL_MAP_FLUSH_EXPLICIT_BIT) &&
+ ((access & GL_MAP_WRITE_BIT) == 0)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles_context_acquire_binded_buffer(ctx, target, &buffer_obj)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!buffer_obj) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (yagl_gles_buffer_mapped(buffer_obj)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles_buffer_map(buffer_obj, offset, length, access)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ ptr = buffer_obj->map_pointer;
+
+out:
+ yagl_gles_buffer_release(buffer_obj);
+
+ YAGL_LOG_FUNC_EXIT("%p", ptr);
+
+ return ptr;
+}
+YAGL_API YAGL_ALIAS(glMapBufferRange, glMapBufferRangeEXT);
+
+YAGL_API void glFlushMappedBufferRange(GLenum target, GLintptr offset,
+ GLsizeiptr length)
+{
+ struct yagl_gles_buffer *buffer_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glFlushMappedBufferRange, GLenum, GLintptr, GLsizeiptr, target, offset, length);
+
+ YAGL_GET_CTX();
+
+ if ((offset < 0) || (length < 0)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (!yagl_gles_context_acquire_binded_buffer(ctx, target, &buffer_obj)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!buffer_obj) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles_buffer_mapped(buffer_obj)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if ((buffer_obj->map_access & GL_MAP_FLUSH_EXPLICIT_BIT) == 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles_buffer_flush_mapped_range(buffer_obj, offset, length)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+out:
+ yagl_gles_buffer_release(buffer_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+YAGL_API YAGL_ALIAS(glFlushMappedBufferRange, glFlushMappedBufferRangeEXT);
+
+/*
+ * @}
+ */
+
+/*
+ * GL_EXT_texture_storage.
+ * @{
+ */
+
+YAGL_API void glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
+{
+ yagl_gles_texture_target texture_target;
+ struct yagl_gles_texture_target_state *tex_target_state;
+ GLenum base_internalformat, format, type;
+ GLsizei i, j;
+ GLenum cubemap_targets[] =
+ {
+ GL_TEXTURE_CUBE_MAP_POSITIVE_X,
+ GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
+ GL_TEXTURE_CUBE_MAP_POSITIVE_Y,
+ GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
+ GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
+ GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
+ };
+
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glTexStorage2D, GLenum, GLsizei, GLenum, GLsizei, GLsizei, target, levels, internalformat, width, height);
+
+ YAGL_GET_CTX();
+
+ if ((levels <= 0) || (width <= 0) || (height <= 0)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (!yagl_gles_context_validate_texstorage_format(ctx,
+ &internalformat,
+ &base_internalformat,
+ &format,
+ &type)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!yagl_gles_context_validate_texture_target(ctx, target, &texture_target)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ tex_target_state = yagl_gles_context_get_active_texture_target_state(ctx,
+ texture_target);
+
+ if ((tex_target_state->texture == tex_target_state->texture_zero) ||
+ tex_target_state->texture->immutable) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ switch (texture_target) {
+ case yagl_gles_texture_target_2d:
+ for (i = 0; i < levels; ++i) {
+ yagl_host_glTexImage2DData(target, i, internalformat,
+ width, height, 0, format, type,
+ NULL, 0);
+
+ width >>= 1;
+ if (width == 0) {
+ width = 1;
+ }
+
+ height >>= 1;
+ if (height == 0) {
+ height = 1;
+ }
+ }
+ break;
+ case yagl_gles_texture_target_cubemap:
+ for (i = 0; i < levels; ++i) {
+ for (j = 0;
+ j < sizeof(cubemap_targets)/sizeof(cubemap_targets[0]);
+ ++j) {
+ yagl_host_glTexImage2DData(cubemap_targets[j], i, internalformat,
+ width, height, 0, format, type,
+ NULL, 0);
+ }
+
+ width >>= 1;
+ if (width == 0) {
+ width = 1;
+ }
+
+ height >>= 1;
+ if (height == 0) {
+ height = 1;
+ }
+ }
+ break;
+ default:
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ yagl_gles_texture_set_immutable(tex_target_state->texture,
+ base_internalformat,
+ type,
+ yagl_gles_context_convert_textures(ctx));
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+YAGL_API YAGL_ALIAS(glTexStorage2D, glTexStorage2DEXT);
+
+/*
+ * @}
+ */
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES_CALLS_H_
+#define _YAGL_GLES_CALLS_H_
+
+#include "yagl_export.h"
+
+YAGL_API GLboolean glIsRenderbuffer(GLuint renderbuffer);
+
+YAGL_API void glBindRenderbuffer(GLenum target, GLuint renderbuffer);
+
+YAGL_API void glDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers);
+
+YAGL_API void glGenRenderbuffers(GLsizei n, GLuint *renderbuffer_names);
+
+YAGL_API void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+
+YAGL_API void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params);
+
+YAGL_API GLboolean glIsFramebuffer(GLuint framebuffer);
+
+YAGL_API void glBindFramebuffer(GLenum target, GLuint framebuffer);
+
+YAGL_API void glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers);
+
+YAGL_API void glGenFramebuffers(GLsizei n, GLuint *framebuffer_names);
+
+YAGL_API GLenum glCheckFramebufferStatus(GLenum target);
+
+YAGL_API void glFramebufferRenderbuffer(GLenum target,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer);
+
+YAGL_API void glFramebufferTexture2D(GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level);
+
+YAGL_API void glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params);
+
+YAGL_API void glGenerateMipmap(GLenum target);
+
+YAGL_API void glBlendEquation(GLenum mode);
+
+YAGL_API void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
+
+YAGL_API void glBlendFuncSeparate(GLenum srcRGB,
+ GLenum dstRGB,
+ GLenum srcAlpha,
+ GLenum dstAlpha);
+
+#endif
--- /dev/null
+# Draw/Read
+void glDrawArrays(GLenum mode, GLint first, GLsizei count)
+void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
+void glReadPixelsData(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
+void glReadPixelsOffset(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei pixels)
+void glDrawArraysInstanced(GLenum mode, GLint start, GLsizei count, GLsizei primcount)
+void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount)
+void glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)
+# VAOs
+void glGenVertexArrays(const GLuint *arrays)
+void glBindVertexArray(GLuint array)
+# Arrays
+void glDisableVertexAttribArray(GLuint index)
+void glEnableVertexAttribArray(GLuint index)
+void glVertexAttribPointerData(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLint first, const GLvoid *data)
+void glVertexAttribPointerOffset(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLsizei offset)
+void glVertexPointerData(GLint size, GLenum type, GLsizei stride, GLint first, const GLvoid *data)
+void glVertexPointerOffset(GLint size, GLenum type, GLsizei stride, GLsizei offset)
+void glNormalPointerData(GLenum type, GLsizei stride, GLint first, const GLvoid *data)
+void glNormalPointerOffset(GLenum type, GLsizei stride, GLsizei offset)
+void glColorPointerData(GLint size, GLenum type, GLsizei stride, GLint first, const GLvoid *data)
+void glColorPointerOffset(GLint size, GLenum type, GLsizei stride, GLsizei offset)
+void glTexCoordPointerData(GLint tex_id, GLint size, GLenum type, GLsizei stride, GLint first, const GLvoid *data)
+void glTexCoordPointerOffset(GLint size, GLenum type, GLsizei stride, GLsizei offset)
+void glDisableClientState(GLenum array)
+void glEnableClientState(GLenum array)
+void glVertexAttribDivisor(GLuint index, GLuint divisor)
+void glVertexAttribIPointerData(GLuint index, GLint size, GLenum type, GLsizei stride, GLint first, const GLvoid *data)
+void glVertexAttribIPointerOffset(GLuint index, GLint size, GLenum type, GLsizei stride, GLsizei offset)
+# Buffers
+void glGenBuffers(const GLuint *buffers)
+void glBindBuffer(GLenum target, GLuint buffer)
+void glBufferData(GLenum target, const GLvoid *data, GLenum usage)
+void glBufferSubData(GLenum target, GLsizei offset, const GLvoid *data)
+void glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
+void glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLint offset, GLsizei size)
+void glMapBuffer(GLuint buffer, const GLuint *ranges, GLvoid *data)
+void glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLint readOffset, GLint writeOffset, GLsizei size)
+# Textures
+void glGenTextures(const GLuint *textures)
+void glBindTexture(GLenum target, GLuint texture)
+void glActiveTexture(GLenum texture)
+void glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
+void glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+void glGetTexParameterfv(GLenum target, GLenum pname, GLfloat ¶m)
+void glGetTexParameteriv(GLenum target, GLenum pname, GLint ¶m)
+void glTexImage2DData(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
+void glTexImage2DOffset(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLsizei pixels)
+void glTexParameterf(GLenum target, GLenum pname, GLfloat param)
+void glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
+void glTexParameteri(GLenum target, GLenum pname, GLint param)
+void glTexParameteriv(GLenum target, GLenum pname, const GLint* params)
+void glTexSubImage2DData(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
+void glTexSubImage2DOffset(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei pixels)
+void glClientActiveTexture(GLenum texture)
+void glTexEnvi(GLenum target, GLenum pname, GLint param)
+void glTexEnvf(GLenum target, GLenum pname, GLfloat param)
+void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat tt, GLfloat r, GLfloat q)
+void glTexEnviv(GLenum target, GLenum pname, const GLint *params)
+void glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
+void glGetTexEnviv(GLenum env, GLenum pname, GLint *params)
+void glGetTexEnvfv(GLenum env, GLenum pname, GLfloat *params)
+void glTexImage3DData(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels)
+void glTexImage3DOffset(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLsizei pixels)
+void glTexSubImage3DData(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels)
+void glTexSubImage3DOffset(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei pixels)
+void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+# Framebuffers
+void glGenFramebuffers(const GLuint *framebuffers)
+void glBindFramebuffer(GLenum target, GLuint framebuffer)
+void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
+void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
+void glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
+void glDrawBuffers(const GLenum *bufs)
+void glReadBuffer(GLenum mode)
+void glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
+void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
+void glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
+void glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
+void glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
+void glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
+# Renderbuffers
+void glGenRenderbuffers(const GLuint *renderbuffers)
+void glBindRenderbuffer(GLenum target, GLuint renderbuffer)
+void glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
+void glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint ¶m)
+void glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
+# Shaders
+void glCreateProgram(GLuint program)
+void glCreateShader(GLuint shader, GLenum type)
+void glShaderSource(GLuint shader, const GLchar *string)
+void glAttachShader(GLuint program, GLuint shader)
+void glDetachShader(GLuint program, GLuint shader)
+void glCompileShader(GLuint shader)
+void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name)
+void glGetActiveAttrib(GLuint program, GLuint index, GLint &size, GLenum &type, GLchar *name)
+void glGetActiveUniform(GLuint program, GLuint index, GLint &size, GLenum &type, GLchar *name)
+int glGetAttribLocation(GLuint program, const GLchar *name)
+void glGetProgramiv(GLuint program, GLenum pname, GLint ¶m)
+GLboolean glGetProgramInfoLog(GLuint program, GLchar *infolog)
+void glGetShaderiv(GLuint shader, GLenum pname, GLint ¶m)
+GLboolean glGetShaderInfoLog(GLuint shader, GLchar *infolog)
+void glGetUniformfv(GLboolean tl, GLuint program, uint32_t location, GLfloat *params)
+void glGetUniformiv(GLboolean tl, GLuint program, uint32_t location, GLint *params)
+int glGetUniformLocation(GLuint program, const GLchar *name)
+void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
+void glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
+void glLinkProgram(GLuint program, GLint *params)
+void glUniform1f(GLboolean tl, uint32_t location, GLfloat x)
+void glUniform1fv(GLboolean tl, uint32_t location, const GLfloat *v)
+void glUniform1i(GLboolean tl, uint32_t location, GLint x)
+void glUniform1iv(GLboolean tl, uint32_t location, const GLint *v)
+void glUniform2f(GLboolean tl, uint32_t location, GLfloat x, GLfloat y)
+void glUniform2fv(GLboolean tl, uint32_t location, const GLfloat *v)
+void glUniform2i(GLboolean tl, uint32_t location, GLint x, GLint y)
+void glUniform2iv(GLboolean tl, uint32_t location, const GLint *v)
+void glUniform3f(GLboolean tl, uint32_t location, GLfloat x, GLfloat y, GLfloat z)
+void glUniform3fv(GLboolean tl, uint32_t location, const GLfloat *v)
+void glUniform3i(GLboolean tl, uint32_t location, GLint x, GLint y, GLint z)
+void glUniform3iv(GLboolean tl, uint32_t location, const GLint *v)
+void glUniform4f(GLboolean tl, uint32_t location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+void glUniform4fv(GLboolean tl, uint32_t location, const GLfloat *v)
+void glUniform4i(GLboolean tl, uint32_t location, GLint x, GLint y, GLint z, GLint w)
+void glUniform4iv(GLboolean tl, uint32_t location, const GLint *v)
+void glUniformMatrix2fv(GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value)
+void glUniformMatrix3fv(GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value)
+void glUniformMatrix4fv(GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value)
+void glUseProgram(GLuint program)
+void glValidateProgram(GLuint program)
+void glVertexAttrib1f(GLuint indx, GLfloat x)
+void glVertexAttrib1fv(GLuint indx, const GLfloat *values)
+void glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
+void glVertexAttrib2fv(GLuint indx, const GLfloat *values)
+void glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
+void glVertexAttrib3fv(GLuint indx, const GLfloat *values)
+void glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+void glVertexAttrib4fv(GLuint indx, const GLfloat *values)
+void glGetActiveUniformsiv(GLuint program, const GLuint *uniformIndices, GLint *params)
+void glGetUniformIndices(GLuint program, const GLchar *uniformNames, GLuint *uniformIndices)
+GLuint glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
+void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
+void glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLchar *uniformBlockName)
+void glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params)
+void glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
+void glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
+void glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
+void glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
+void glVertexAttribI4iv(GLuint index, const GLint *v)
+void glVertexAttribI4uiv(GLuint index, const GLuint *v)
+void glGetUniformuiv(GLboolean tl, GLuint program, uint32_t location, GLuint *params)
+void glUniform1ui(GLboolean tl, uint32_t location, GLuint v0)
+void glUniform2ui(GLboolean tl, uint32_t location, GLuint v0, GLuint v1)
+void glUniform3ui(GLboolean tl, uint32_t location, GLuint v0, GLuint v1, GLuint v2)
+void glUniform4ui(GLboolean tl, uint32_t location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
+void glUniform1uiv(GLboolean tl, uint32_t location, const GLuint *v)
+void glUniform2uiv(GLboolean tl, uint32_t location, const GLuint *v)
+void glUniform3uiv(GLboolean tl, uint32_t location, const GLuint *v)
+void glUniform4uiv(GLboolean tl, uint32_t location, const GLuint *v)
+void glUniformMatrix2x3fv(GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value)
+void glUniformMatrix2x4fv(GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value)
+void glUniformMatrix3x2fv(GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value)
+void glUniformMatrix3x4fv(GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value)
+void glUniformMatrix4x2fv(GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value)
+void glUniformMatrix4x3fv(GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value)
+int glGetFragDataLocation(GLuint program, const GLchar *name)
+# State queries
+void glGetIntegerv(GLenum pname, GLint *params)
+void glGetFloatv(GLenum pname, GLfloat *params)
+void glGetString(GLenum name, GLchar* str)
+GLboolean glIsEnabled(GLenum cap)
+# Transform feedbacks
+void glGenTransformFeedbacks(const GLuint *ids)
+void glBindTransformFeedback(GLenum target, GLuint id)
+void glBeginTransformFeedback(GLenum primitiveMode)
+void glEndTransformFeedback()
+void glPauseTransformFeedback()
+void glResumeTransformFeedback()
+void glTransformFeedbackVaryings(GLuint program, const GLchar *varyings, GLenum bufferMode)
+void glGetTransformFeedbackVaryings(GLuint program, GLsizei *sizes, GLenum *types)
+# Queries
+void glGenQueries(const GLuint *ids)
+void glBeginQuery(GLenum target, GLuint id)
+void glEndQuery(GLenum target)
+GLboolean glGetQueryObjectuiv(GLuint id, GLuint &result)
+# Samplers
+void glGenSamplers(const GLuint *samplers)
+void glBindSampler(GLuint unit, GLuint sampler)
+void glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
+void glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
+void glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
+void glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
+# Misc
+void glDeleteObjects(const GLuint *objects)
+void glBlendEquation(GLenum mode)
+void glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
+void glBlendFunc(GLenum sfactor, GLenum dfactor)
+void glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
+void glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+void glClear(GLbitfield mask)
+void glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+void glClearDepthf(GLclampf depth)
+void glClearStencil(GLint s)
+void glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
+void glCullFace(GLenum mode)
+void glDepthFunc(GLenum func)
+void glDepthMask(GLboolean flag)
+void glDepthRangef(GLclampf zNear, GLclampf zFar)
+void glEnable(GLenum cap)
+void glDisable(GLenum cap)
+@void glFlush()
+void glFrontFace(GLenum mode)
+void glGenerateMipmap(GLenum target)
+void glHint(GLenum target, GLenum mode)
+void glLineWidth(GLfloat width)
+void glPixelStorei(GLenum pname, GLint param)
+void glPolygonOffset(GLfloat factor, GLfloat units)
+void glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
+void glStencilFunc(GLenum func, GLint ref, GLuint mask)
+void glStencilMask(GLuint mask)
+void glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
+void glSampleCoverage(GLclampf value, GLboolean invert)
+void glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
+void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
+void glStencilMaskSeparate(GLenum face, GLuint mask)
+void glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
+void glPointSize(GLfloat size)
+void glAlphaFunc(GLenum func, GLclampf ref)
+void glMatrixMode(GLenum mode)
+void glLoadIdentity()
+void glPopMatrix()
+void glPushMatrix()
+void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
+void glTranslatef(GLfloat x, GLfloat y, GLfloat z)
+void glScalef(GLfloat x, GLfloat y, GLfloat z)
+void glOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
+void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
+void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
+void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
+void glPointParameterf(GLenum pname, GLfloat param)
+void glPointParameterfv(GLenum pname, const GLfloat *params)
+void glFogf(GLenum pname, GLfloat param)
+void glFogfv(GLenum pname, const GLfloat *params)
+void glFrustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
+void glLightf(GLenum light, GLenum pname, GLfloat param)
+void glLightfv(GLenum light, GLenum pname, const GLfloat *params)
+void glGetLightfv(GLenum light, GLenum pname, GLfloat *params)
+void glLightModelf(GLenum pname, GLfloat param)
+void glLightModelfv(GLenum pname, const GLfloat *params)
+void glMaterialf(GLenum face, GLenum pname, GLfloat param)
+void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
+void glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
+void glShadeModel(GLenum mode)
+void glLogicOp(GLenum opcode)
+void glMultMatrixf(const GLfloat *m)
+void glLoadMatrixf(const GLfloat *m)
+void glClipPlanef(GLenum plane, const GLfloat *equation)
+void glGetClipPlanef(GLenum pname, GLfloat *eqn)
+
+#
+# YaGL Extensions
+#
+
+void glUpdateOffscreenImageYAGL(GLuint texture, uint32_t width, uint32_t height, uint32_t bpp, const void *pixels)
+void glGenUniformLocationYAGL(uint32_t location, GLuint program, const GLchar *name)
+void glDeleteUniformLocationsYAGL(const uint32_t *locations)
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GL/gl.h"
+#include "GL/glext.h"
+#include "yagl_gles_context.h"
+#include "yagl_gles_vertex_array.h"
+#include "yagl_gles_array.h"
+#include "yagl_gles_buffer.h"
+#include "yagl_gles_texture.h"
+#include "yagl_gles_texture_unit.h"
+#include "yagl_gles_framebuffer.h"
+#include "yagl_gles_renderbuffer.h"
+#include "yagl_gles_validate.h"
+#include "yagl_gles_pixel_formats.h"
+#include "yagl_gles_utils.h"
+#include "yagl_tex_image_binding.h"
+#include "yagl_sharegroup.h"
+#include "yagl_log.h"
+#include "yagl_malloc.h"
+#include "yagl_utils.h"
+#include "yagl_state.h"
+#include "yagl_render.h"
+#include "yagl_host_gles_calls.h"
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
+
+/*
+ * We can't include GLES2/gl2ext.h here
+ */
+#define GL_HALF_FLOAT_OES 0x8D61
+#define GL_RGB565_OES 0x8D62
+
+#define YAGL_SET_ERR(err) \
+ yagl_gles_context_set_error(ctx, err); \
+ YAGL_LOG_ERROR("error = 0x%X", err)
+
+static void yagl_get_minmax_index(const GLvoid *indices,
+ GLsizei count,
+ GLenum type,
+ uint32_t *min_idx,
+ uint32_t *max_idx)
+{
+ int i;
+
+ *min_idx = UINT32_MAX;
+ *max_idx = 0;
+
+ switch (type) {
+ case GL_UNSIGNED_BYTE:
+ for (i = 0; i < count; ++i) {
+ uint32_t idx = ((uint8_t*)indices)[i];
+ if (idx < *min_idx) {
+ *min_idx = idx;
+ }
+ if (idx > *max_idx) {
+ *max_idx = idx;
+ }
+ }
+ break;
+ case GL_UNSIGNED_SHORT:
+ for (i = 0; i < count; ++i) {
+ uint32_t idx = ((uint16_t*)indices)[i];
+ if (idx < *min_idx) {
+ *min_idx = idx;
+ }
+ if (idx > *max_idx) {
+ *max_idx = idx;
+ }
+ }
+ break;
+ case GL_UNSIGNED_INT:
+ for (i = 0; i < count; ++i) {
+ uint32_t idx = ((uint32_t*)indices)[i];
+ if (idx < *min_idx) {
+ *min_idx = idx;
+ }
+ if (idx > *max_idx) {
+ *max_idx = idx;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+static int yagl_gles_context_bind_tex_image(struct yagl_client_context *ctx,
+ struct yagl_client_image *image,
+ struct yagl_tex_image_binding *binding)
+{
+ struct yagl_gles_context *gles_ctx = (struct yagl_gles_context*)ctx;
+ struct yagl_gles_texture_target_state *texture_target_state =
+ yagl_gles_context_get_active_texture_target_state(gles_ctx,
+ yagl_gles_texture_target_2d);
+
+ if (texture_target_state->texture == texture_target_state->texture_zero) {
+ return 0;
+ }
+
+ yagl_gles_texture_bind_tex_image(texture_target_state->texture,
+ (struct yagl_gles_image*)image,
+ binding);
+
+ binding->cookie = texture_target_state->texture;
+
+ return 1;
+}
+
+static int yagl_gles_context_validate_readbuffer(struct yagl_gles_context *ctx,
+ GLenum *internalformat)
+{
+ if (ctx->fbo_read) {
+ struct yagl_gles_framebuffer_attachment_state *attachment_state;
+
+ if (ctx->fbo_read->read_buffer == GL_NONE) {
+ return 0;
+ }
+
+ attachment_state = &ctx->fbo_read->attachment_states[
+ yagl_gles_framebuffer_attachment_color0 +
+ ctx->fbo_read->read_buffer - GL_COLOR_ATTACHMENT0];
+
+ return yagl_gles_framebuffer_attachment_internalformat(attachment_state,
+ internalformat);
+ } else {
+ if (ctx->fb0_read_buffer == GL_NONE) {
+ return 0;
+ }
+
+ *internalformat = GL_RGBA;
+ return 1;
+ }
+}
+
+static int yagl_gles_context_validate_drawbuffer(struct yagl_gles_context *ctx,
+ GLenum *internalformat)
+{
+ GLenum fmt = 0;
+
+ if (ctx->fbo_draw) {
+ int i;
+
+ for (i = yagl_gles_framebuffer_attachment_color0;
+ i < (yagl_gles_framebuffer_attachment_color0 +
+ ctx->max_color_attachments); ++i) {
+ struct yagl_gles_framebuffer_attachment_state *attachment_state;
+ GLenum tmp;
+
+ attachment_state = &ctx->fbo_draw->attachment_states[i];
+
+ if (yagl_gles_framebuffer_attachment_internalformat(attachment_state,
+ &tmp)) {
+ if ((fmt != 0) && (tmp != fmt)) {
+ return 0;
+ }
+
+ fmt = tmp;
+ }
+ }
+
+ if (fmt != 0) {
+ *internalformat = fmt;
+ return 1;
+ } else {
+ return 0;
+ }
+ } else {
+ if (ctx->fb0_draw_buffer == GL_NONE) {
+ return 0;
+ }
+
+ *internalformat = GL_RGBA;
+ return 1;
+ }
+}
+
+void yagl_gles_context_init(struct yagl_gles_context *ctx,
+ yagl_client_api client_api,
+ struct yagl_sharegroup *sg)
+{
+ yagl_sharegroup_acquire(sg);
+
+ yagl_namespace_init(&ctx->framebuffers);
+ yagl_namespace_init(&ctx->vertex_arrays);
+
+ ctx->base.bind_tex_image = &yagl_gles_context_bind_tex_image;
+
+ ctx->base.client_api = client_api;
+ ctx->base.sg = sg;
+
+ ctx->error = GL_NO_ERROR;
+
+ ctx->pack.alignment = 4;
+ ctx->unpack.alignment = 4;
+
+ ctx->blend_equation_rgb = GL_FUNC_ADD;
+ ctx->blend_equation_alpha = GL_FUNC_ADD;
+
+ ctx->blend_src_rgb = GL_ONE;
+ ctx->blend_dst_rgb = GL_ZERO;
+
+ ctx->blend_src_alpha = GL_ONE;
+ ctx->blend_dst_alpha = GL_ZERO;
+
+ ctx->clear_depth = 1.0f;
+
+ ctx->color_writemask[0] = GL_TRUE;
+ ctx->color_writemask[1] = GL_TRUE;
+ ctx->color_writemask[2] = GL_TRUE;
+ ctx->color_writemask[3] = GL_TRUE;
+
+ ctx->cull_face_mode = GL_BACK;
+
+ ctx->depth_func = GL_LESS;
+
+ ctx->depth_writemask = GL_TRUE;
+
+ ctx->depth_range[0] = 0.0f;
+ ctx->depth_range[1] = 1.0f;
+
+ ctx->front_face_mode = GL_CCW;
+
+ ctx->fb0_draw_buffer = GL_BACK;
+ ctx->fb0_read_buffer = GL_BACK;
+
+ ctx->generate_mipmap_hint = GL_DONT_CARE;
+
+ ctx->sample_coverage_value = 1.0f;
+ ctx->sample_coverage_invert = GL_FALSE;
+
+ ctx->clear_stencil = 0;
+
+ ctx->stencil_front.func = GL_ALWAYS;
+ ctx->stencil_front.ref = 0;
+ ctx->stencil_front.mask = ~0U;
+ ctx->stencil_front.writemask = ~0U;
+ ctx->stencil_front.fail = GL_KEEP;
+ ctx->stencil_front.zfail = GL_KEEP;
+ ctx->stencil_front.zpass = GL_KEEP;
+
+ ctx->stencil_back.func = GL_ALWAYS;
+ ctx->stencil_back.ref = 0;
+ ctx->stencil_back.mask = ~0U;
+ ctx->stencil_back.writemask = ~0U;
+ ctx->stencil_back.fail = GL_KEEP;
+ ctx->stencil_back.zfail = GL_KEEP;
+ ctx->stencil_back.zpass = GL_KEEP;
+
+ ctx->line_width = 1.0f;
+ ctx->polygon_offset_factor = 0.0f;
+ ctx->polygon_offset_units = 0.0f;
+
+ ctx->dither_enabled = GL_TRUE;
+}
+
+void yagl_gles_context_prepare(struct yagl_gles_context *ctx,
+ int num_texture_units,
+ int num_arrays)
+{
+ int i;
+ int32_t size = 0;
+ char *extensions;
+ char *min_mag_blits;
+
+ if (num_texture_units < 1) {
+ num_texture_units = 1;
+ }
+
+ YAGL_LOG_FUNC_ENTER(yagl_gles_context_prepare,
+ "num_texture_units = %d",
+ num_texture_units);
+
+ /*
+ * Currently minifying and magnifying blits in
+ * glBlitFramebuffer are disabled because of host
+ * OpenGL driver problems on many GPUs, they simply crash.
+ * But we want to be able to enable this temporarily for
+ * some apps that require it.
+ */
+
+ min_mag_blits = getenv("YAGL_MIN_MAG_BLITS");
+
+ if (min_mag_blits && atoi(min_mag_blits)) {
+ ctx->min_mag_blits = 1;
+ } else {
+ ctx->min_mag_blits = 0;
+ }
+
+ ctx->num_texture_units = num_texture_units;
+ ctx->texture_units =
+ yagl_malloc(ctx->num_texture_units * sizeof(*ctx->texture_units));
+
+ for (i = 0; i < ctx->num_texture_units; ++i) {
+ yagl_gles_texture_unit_init(&ctx->texture_units[i], ctx->base.sg);
+ }
+
+ ctx->num_arrays = num_arrays;
+
+ yagl_host_glGetString(GL_EXTENSIONS, NULL, 0, &size);
+ extensions = yagl_malloc0(size);
+ yagl_host_glGetString(GL_EXTENSIONS, extensions, size, NULL);
+
+ if (yagl_get_host_gl_version() > yagl_gl_2) {
+ ctx->packed_depth_stencil = 1;
+ } else {
+ ctx->packed_depth_stencil = (strstr(extensions, "GL_EXT_packed_depth_stencil ") != NULL);
+ }
+
+ ctx->texture_npot = 1;
+
+ ctx->texture_filter_anisotropic = (strstr(extensions, "GL_EXT_texture_filter_anisotropic ") != NULL);
+
+ yagl_free(extensions);
+
+ yagl_host_glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS,
+ &ctx->max_color_attachments, 1, NULL);
+
+ if (ctx->max_color_attachments <= 0) {
+ ctx->max_color_attachments = 1;
+ }
+
+ if (ctx->max_color_attachments > YAGL_MAX_GLES_FRAMEBUFFER_COLOR_ATTACHMENTS) {
+ ctx->max_color_attachments = YAGL_MAX_GLES_FRAMEBUFFER_COLOR_ATTACHMENTS;
+ }
+
+ yagl_host_glGetIntegerv(GL_MAX_DRAW_BUFFERS,
+ &ctx->max_draw_buffers, 1, NULL);
+
+ if (ctx->max_draw_buffers <= 0) {
+ ctx->max_draw_buffers = 1;
+ }
+
+ if (ctx->max_draw_buffers > YAGL_MAX_GLES_FRAMEBUFFER_COLOR_ATTACHMENTS) {
+ ctx->max_draw_buffers = YAGL_MAX_GLES_FRAMEBUFFER_COLOR_ATTACHMENTS;
+ }
+
+ ctx->vertex_arrays_supported = (yagl_get_host_gl_version() > yagl_gl_2);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+void yagl_gles_context_prepare_end(struct yagl_gles_context *ctx,
+ const GLchar **extensions,
+ int num_extensions)
+{
+ int i, str_size = 1;
+ struct yagl_gles_array *arrays = ctx->create_arrays(ctx);
+ GLchar *ptr;
+
+ if (ctx->vertex_arrays_supported) {
+ ctx->va_zero = yagl_gles_vertex_array_create(0, arrays, ctx->num_arrays);
+
+ yagl_gles_context_bind_vertex_array(ctx, NULL);
+ } else {
+ ctx->va_zero = yagl_gles_vertex_array_create(1, arrays, ctx->num_arrays);
+
+ /*
+ * Don't bind, VAOs are not supported, just reference.
+ */
+ yagl_gles_vertex_array_acquire(ctx->va_zero);
+ ctx->vao = ctx->va_zero;
+ }
+
+ ctx->extensions = extensions;
+ ctx->num_extensions = num_extensions;
+
+ for (i = 0; i < num_extensions; ++i) {
+ str_size += strlen(extensions[i]) + 1;
+ }
+
+ ctx->extension_string = ptr = yagl_malloc(str_size);
+
+ for (i = 0; i < num_extensions; ++i) {
+ int len = strlen(extensions[i]);
+
+ memcpy(ptr, extensions[i], len);
+
+ ptr += len;
+
+ *ptr = ' ';
+ ++ptr;
+ }
+
+ ctx->extension_string[str_size - 1] = '\0';
+}
+
+void yagl_gles_context_cleanup(struct yagl_gles_context *ctx)
+{
+ int i;
+
+ yagl_gles_buffer_release(ctx->unpack.pbo);
+ yagl_gles_buffer_release(ctx->pack.pbo);
+ yagl_gles_renderbuffer_release(ctx->rbo);
+ yagl_gles_framebuffer_release(ctx->fbo_read);
+ yagl_gles_framebuffer_release(ctx->fbo_draw);
+ yagl_gles_buffer_release(ctx->vbo);
+ yagl_gles_vertex_array_release(ctx->vao);
+
+ for (i = 0; i < ctx->num_texture_units; ++i) {
+ yagl_gles_texture_unit_cleanup(&ctx->texture_units[i]);
+ }
+
+ yagl_free(ctx->texture_units);
+
+ yagl_gles_vertex_array_release(ctx->va_zero);
+
+ yagl_free(ctx->extension_string);
+ yagl_free(ctx->extensions);
+
+ yagl_namespace_cleanup(&ctx->vertex_arrays);
+ yagl_namespace_cleanup(&ctx->framebuffers);
+
+ yagl_sharegroup_release(ctx->base.sg);
+}
+
+void yagl_gles_context_set_error(struct yagl_gles_context *ctx, GLenum error)
+{
+ if (ctx->error == GL_NO_ERROR) {
+ ctx->error = error;
+ }
+}
+
+GLenum yagl_gles_context_get_error(struct yagl_gles_context *ctx)
+{
+ GLenum error = ctx->error;
+
+ ctx->error = GL_NO_ERROR;
+
+ return error;
+}
+
+void yagl_gles_context_bind_vertex_array(struct yagl_gles_context *ctx,
+ struct yagl_gles_vertex_array *va)
+{
+ if (!va) {
+ va = ctx->va_zero;
+ }
+
+ yagl_gles_vertex_array_acquire(va);
+ yagl_gles_vertex_array_release(ctx->vao);
+ ctx->vao = va;
+
+ yagl_gles_vertex_array_bind(va);
+}
+
+void yagl_gles_context_unbind_vertex_array(struct yagl_gles_context *ctx,
+ yagl_object_name va_local_name)
+{
+ if ((ctx->vao != ctx->va_zero) &&
+ (ctx->vao->base.local_name == va_local_name)) {
+ yagl_gles_vertex_array_acquire(ctx->va_zero);
+ yagl_gles_vertex_array_release(ctx->vao);
+ ctx->vao = ctx->va_zero;
+
+ /*
+ * And bind vertex array 0, otherwise we'll end up with no
+ * vertex array on host.
+ */
+ yagl_gles_vertex_array_bind(ctx->vao);
+ }
+}
+
+int yagl_gles_context_convert_textures(struct yagl_gles_context *ctx)
+{
+ /*
+ * Currently GLESv1_CM is implemented via legacy context always, so
+ * don't convert textures in this case.
+ */
+ return (ctx->base.client_api != yagl_client_api_gles1) &&
+ (yagl_get_host_gl_version() > yagl_gl_2);
+}
+
+int yagl_gles_context_validate_texture_target(struct yagl_gles_context *ctx,
+ GLenum target,
+ yagl_gles_texture_target *texture_target)
+{
+ switch (target) {
+ case GL_TEXTURE_2D:
+ *texture_target = yagl_gles_texture_target_2d;
+ break;
+ default:
+ return ctx->validate_texture_target(ctx, target, texture_target);
+ }
+
+ return 1;
+}
+
+struct yagl_pixel_format
+ *yagl_gles_context_validate_teximage_format(struct yagl_gles_context *ctx,
+ GLenum internalformat,
+ GLenum format,
+ GLenum type)
+{
+ struct yagl_pixel_format *pf;
+
+ YAGL_LOG_FUNC_SET(yagl_gles_context_validate_teximage_format);
+
+ if ((format == internalformat) || (internalformat == GL_BGRA)) {
+ switch (format) {
+ case GL_RGB:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles, GL_RGB, GL_RGB, GL_UNSIGNED_BYTE);
+ YAGL_PIXEL_FORMAT_CASE(gles, GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5);
+ YAGL_PIXEL_FORMAT_CASE(gles, GL_RGB, GL_RGB, GL_FLOAT);
+ YAGL_PIXEL_FORMAT_CASE(gles, GL_RGB, GL_RGB, GL_HALF_FLOAT_OES);
+ }
+ break;
+ case GL_RGBA:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE);
+ YAGL_PIXEL_FORMAT_CASE(gles, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4);
+ YAGL_PIXEL_FORMAT_CASE(gles, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1);
+ YAGL_PIXEL_FORMAT_CASE(gles, GL_RGBA, GL_RGBA, GL_FLOAT);
+ YAGL_PIXEL_FORMAT_CASE(gles, GL_RGBA, GL_RGBA, GL_HALF_FLOAT_OES);
+ }
+ break;
+ case GL_BGRA:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles, GL_BGRA, GL_BGRA, GL_UNSIGNED_BYTE);
+ YAGL_PIXEL_FORMAT_CASE(gles, GL_BGRA, GL_BGRA, GL_FLOAT);
+ YAGL_PIXEL_FORMAT_CASE(gles, GL_BGRA, GL_BGRA, GL_HALF_FLOAT_OES);
+ }
+ break;
+ case GL_DEPTH_COMPONENT:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT);
+ YAGL_PIXEL_FORMAT_CASE(gles, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT);
+ }
+ break;
+ case GL_DEPTH_STENCIL:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles, GL_DEPTH_STENCIL, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8);
+ }
+ break;
+ }
+
+ if (yagl_gles_context_convert_textures(ctx)) {
+ switch (format) {
+ case GL_ALPHA:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles_gl3, GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE);
+ YAGL_PIXEL_FORMAT_CASE(gles_gl3, GL_ALPHA, GL_ALPHA, GL_FLOAT);
+ YAGL_PIXEL_FORMAT_CASE(gles_gl3, GL_ALPHA, GL_ALPHA, GL_HALF_FLOAT_OES);
+ }
+ break;
+ case GL_LUMINANCE:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles_gl3, GL_LUMINANCE, GL_LUMINANCE, GL_UNSIGNED_BYTE);
+ YAGL_PIXEL_FORMAT_CASE(gles_gl3, GL_LUMINANCE, GL_LUMINANCE, GL_FLOAT);
+ YAGL_PIXEL_FORMAT_CASE(gles_gl3, GL_LUMINANCE, GL_LUMINANCE, GL_HALF_FLOAT_OES);
+ }
+ break;
+ case GL_LUMINANCE_ALPHA:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles_gl3, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE);
+ YAGL_PIXEL_FORMAT_CASE(gles_gl3, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_FLOAT);
+ YAGL_PIXEL_FORMAT_CASE(gles_gl3, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT_OES);
+ }
+ break;
+ }
+ } else {
+ switch (format) {
+ case GL_ALPHA:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles_gl2, GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE);
+ YAGL_PIXEL_FORMAT_CASE(gles_gl2, GL_ALPHA, GL_ALPHA, GL_FLOAT);
+ YAGL_PIXEL_FORMAT_CASE(gles_gl2, GL_ALPHA, GL_ALPHA, GL_HALF_FLOAT_OES);
+ }
+ break;
+ case GL_LUMINANCE:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles_gl2, GL_LUMINANCE, GL_LUMINANCE, GL_UNSIGNED_BYTE);
+ YAGL_PIXEL_FORMAT_CASE(gles_gl2, GL_LUMINANCE, GL_LUMINANCE, GL_FLOAT);
+ YAGL_PIXEL_FORMAT_CASE(gles_gl2, GL_LUMINANCE, GL_LUMINANCE, GL_HALF_FLOAT_OES);
+ }
+ break;
+ case GL_LUMINANCE_ALPHA:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles_gl2, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE);
+ YAGL_PIXEL_FORMAT_CASE(gles_gl2, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_FLOAT);
+ YAGL_PIXEL_FORMAT_CASE(gles_gl2, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT_OES);
+ }
+ break;
+ }
+ }
+ }
+
+ pf = ctx->validate_teximage_format(ctx, internalformat, format, type);
+
+ if (!pf) {
+ YAGL_LOG_ERROR("validation error: internalformat = 0x%X, format = 0x%X, type = 0x%X",
+ internalformat,
+ format,
+ type);
+ }
+
+ return pf;
+}
+
+struct yagl_pixel_format
+ *yagl_gles_context_validate_getteximage_format(struct yagl_gles_context *ctx,
+ GLenum format,
+ GLenum type)
+{
+ GLenum readbuffer_internalformat = 0;
+ const struct yagl_gles_format_info *readbuffer_format_info;
+ struct yagl_pixel_format *pf = NULL;
+
+ YAGL_LOG_FUNC_SET(yagl_gles_context_validate_getteximage_format);
+
+ if (!yagl_gles_context_validate_readbuffer(ctx,
+ &readbuffer_internalformat)) {
+ goto out;
+ }
+
+ readbuffer_format_info =
+ yagl_gles_internalformat_info(readbuffer_internalformat);
+
+ if ((readbuffer_format_info->flags & yagl_gles_format_color_renderable) == 0) {
+ goto out;
+ }
+
+ switch (format) {
+ case GL_RGBA:
+ if (((readbuffer_format_info->flags & (yagl_gles_format_unsigned_integer)) == 0) &&
+ ((readbuffer_format_info->flags & (yagl_gles_format_signed_integer)) == 0)) {
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE);
+ }
+ }
+ break;
+ }
+
+ pf = ctx->validate_getteximage_format(ctx,
+ readbuffer_internalformat,
+ format,
+ type);
+
+out:
+ if (!pf) {
+ YAGL_LOG_ERROR("validation error: readbuffer_internalformat = %u, format = 0x%X, type = 0x%X",
+ readbuffer_internalformat,
+ format,
+ type);
+ }
+
+ return pf;
+}
+
+int yagl_gles_context_validate_copyteximage_format(struct yagl_gles_context *ctx,
+ GLenum *internalformat,
+ int *is_float)
+{
+ GLenum readbuffer_internalformat = 0;
+ const struct yagl_gles_format_info *readbuffer_format_info;
+ const struct yagl_gles_format_info *internalformat_info;
+ int res = 0;
+
+ YAGL_LOG_FUNC_SET(yagl_gles_context_validate_copyteximage_format);
+
+ if (!yagl_gles_context_validate_readbuffer(ctx,
+ &readbuffer_internalformat)) {
+ goto out;
+ }
+
+ readbuffer_format_info = yagl_gles_internalformat_info(readbuffer_internalformat);
+ internalformat_info = yagl_gles_internalformat_info(*internalformat);
+
+ if ((internalformat_info->flags & yagl_gles_format_srgb) !=
+ (readbuffer_format_info->flags & yagl_gles_format_srgb)) {
+ goto out;
+ }
+
+ if (internalformat_info->num_components > readbuffer_format_info->num_components) {
+ goto out;
+ }
+
+ if (((readbuffer_format_info->flags & yagl_gles_format_unsigned_integer) == 0) &&
+ ((readbuffer_format_info->flags & yagl_gles_format_signed_integer) == 0)) {
+ switch (*internalformat) {
+ case GL_RGB:
+ res = 1;
+ goto out;
+ case GL_RGBA:
+ res = 1;
+ goto out;
+ case GL_BGRA:
+ res = 1;
+ *internalformat = GL_RGBA;
+ goto out;
+ }
+
+ if (yagl_gles_context_convert_textures(ctx)) {
+ switch (*internalformat) {
+ case GL_ALPHA:
+ case GL_LUMINANCE_ALPHA:
+ if (readbuffer_format_info->num_components == 4) {
+ *internalformat = GL_RGBA;
+ res = 1;
+ goto out;
+ }
+ break;
+ case GL_LUMINANCE:
+ res = 1;
+ *internalformat = GL_RGBA;
+ goto out;
+ }
+ } else {
+ switch (*internalformat) {
+ case GL_ALPHA:
+ case GL_LUMINANCE_ALPHA:
+ if (readbuffer_format_info->num_components == 4) {
+ res = 1;
+ goto out;
+ }
+ break;
+ case GL_LUMINANCE:
+ res = 1;
+ goto out;
+ }
+ }
+ }
+
+ res = ctx->validate_copyteximage_format(ctx,
+ readbuffer_internalformat,
+ internalformat);
+
+out:
+ if (res) {
+ *is_float = ((readbuffer_format_info->flags & yagl_gles_format_float) != 0);
+ } else {
+ YAGL_LOG_ERROR("validation error: readbuffer_internalformat = %u, internalformat = 0x%X",
+ readbuffer_internalformat,
+ *internalformat);
+ }
+
+ return res;
+}
+
+int yagl_gles_context_validate_texstorage_format(struct yagl_gles_context *ctx,
+ GLenum *internalformat,
+ GLenum *base_internalformat,
+ GLenum *any_format,
+ GLenum *any_type)
+{
+ int res = 1;
+
+ YAGL_LOG_FUNC_SET(yagl_gles_context_validate_texstorage_format);
+
+ switch (*internalformat) {
+ case GL_RGB:
+ *base_internalformat = GL_RGB;
+ *any_format = GL_RGB;
+ *any_type = GL_UNSIGNED_BYTE;
+ goto out;
+ case GL_RGBA:
+ *base_internalformat = GL_RGBA;
+ *any_format = GL_RGBA;
+ *any_type = GL_UNSIGNED_BYTE;
+ goto out;
+ case GL_BGRA:
+ *base_internalformat = GL_RGBA;
+ *internalformat = GL_RGBA;
+ *any_format = GL_BGRA;
+ *any_type = GL_UNSIGNED_BYTE;
+ goto out;
+ case GL_DEPTH_COMPONENT:
+ *base_internalformat = GL_DEPTH_COMPONENT;
+ *any_format = GL_DEPTH_COMPONENT;
+ *any_type = GL_UNSIGNED_INT;
+ goto out;
+ case GL_DEPTH_STENCIL:
+ *base_internalformat = GL_DEPTH_STENCIL;
+ *any_format = GL_DEPTH_STENCIL;
+ *any_type = GL_UNSIGNED_INT_24_8;
+ goto out;
+ }
+
+ if (yagl_gles_context_convert_textures(ctx)) {
+ switch (*internalformat) {
+ case GL_ALPHA:
+ *internalformat = GL_RGBA;
+ *base_internalformat = GL_ALPHA;
+ *any_format = GL_BGRA;
+ *any_type = GL_UNSIGNED_BYTE;
+ break;
+ case GL_LUMINANCE:
+ *internalformat = GL_RGBA;
+ *base_internalformat = GL_LUMINANCE;
+ *any_format = GL_BGRA;
+ *any_type = GL_UNSIGNED_BYTE;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ *internalformat = GL_RGBA;
+ *base_internalformat = GL_LUMINANCE_ALPHA;
+ *any_format = GL_BGRA;
+ *any_type = GL_UNSIGNED_BYTE;
+ break;
+ default:
+ res = ctx->validate_texstorage_format(ctx,
+ internalformat,
+ base_internalformat,
+ any_format,
+ any_type);
+ }
+ } else {
+ switch (*internalformat) {
+ case GL_ALPHA:
+ *base_internalformat = GL_ALPHA;
+ *any_format = GL_ALPHA;
+ *any_type = GL_UNSIGNED_BYTE;
+ break;
+ case GL_LUMINANCE:
+ *base_internalformat = GL_LUMINANCE;
+ *any_format = GL_LUMINANCE;
+ *any_type = GL_UNSIGNED_BYTE;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ *base_internalformat = GL_LUMINANCE_ALPHA;
+ *any_format = GL_LUMINANCE_ALPHA;
+ *any_type = GL_UNSIGNED_BYTE;
+ break;
+ default:
+ res = ctx->validate_texstorage_format(ctx,
+ internalformat,
+ base_internalformat,
+ any_format,
+ any_type);
+ }
+ }
+
+ if (!res) {
+ YAGL_LOG_ERROR("validation error: internalformat = 0x%X",
+ *internalformat);
+ }
+
+out:
+ return res;
+}
+
+int yagl_gles_context_validate_renderbuffer_format(struct yagl_gles_context *ctx,
+ GLenum *internalformat)
+{
+ int res = 1;
+
+ YAGL_LOG_FUNC_SET(yagl_gles_context_validate_renderbuffer_format);
+
+ switch (*internalformat) {
+ case GL_RGBA4:
+ case GL_RGB565_OES:
+ case GL_RGB5_A1:
+ case GL_DEPTH_COMPONENT16:
+ case GL_DEPTH_COMPONENT24:
+ case GL_DEPTH_COMPONENT32:
+ case GL_STENCIL_INDEX8:
+ case GL_DEPTH24_STENCIL8:
+ break;
+ default:
+ res = ctx->validate_renderbuffer_format(ctx, internalformat);
+ }
+
+ if (!res) {
+ YAGL_LOG_ERROR("validation error: internalformat = 0x%X",
+ *internalformat);
+ }
+
+ return res;
+}
+
+void yagl_gles_context_set_active_texture(struct yagl_gles_context *ctx,
+ GLenum texture)
+{
+ YAGL_LOG_FUNC_SET(glActiveTexture);
+
+ if ((texture < GL_TEXTURE0) ||
+ (texture >= (GL_TEXTURE0 + ctx->num_texture_units))) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ return;
+ }
+
+ ctx->active_texture_unit = texture - GL_TEXTURE0;
+
+ yagl_host_glActiveTexture(texture);
+}
+
+struct yagl_gles_texture_unit
+ *yagl_gles_context_get_active_texture_unit(struct yagl_gles_context *ctx)
+{
+ return &ctx->texture_units[ctx->active_texture_unit];
+}
+
+struct yagl_gles_texture_target_state
+ *yagl_gles_context_get_active_texture_target_state(struct yagl_gles_context *ctx,
+ yagl_gles_texture_target texture_target)
+{
+ return &yagl_gles_context_get_active_texture_unit(ctx)->target_states[texture_target];
+}
+
+void yagl_gles_context_active_texture_set_enabled(struct yagl_gles_context *ctx,
+ yagl_gles_texture_target texture_target, int enabled)
+{
+ struct yagl_gles_texture_target_state *texture_target_state;
+
+ texture_target_state =
+ yagl_gles_context_get_active_texture_target_state(ctx,
+ texture_target);
+ texture_target_state->enabled = enabled;
+}
+
+void yagl_gles_context_bind_texture(struct yagl_gles_context *ctx,
+ GLenum target,
+ struct yagl_gles_texture *texture)
+{
+ yagl_gles_texture_target texture_target;
+ struct yagl_gles_texture_target_state *texture_target_state;
+
+ YAGL_LOG_FUNC_SET(glBindTexture);
+
+ if (!yagl_gles_context_validate_texture_target(ctx, target, &texture_target)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ return;
+ }
+
+ texture_target_state =
+ yagl_gles_context_get_active_texture_target_state(ctx, texture_target);
+
+ if (!texture) {
+ texture = texture_target_state->texture_zero;
+ }
+
+ if (!yagl_gles_texture_bind(texture, target)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ return;
+ }
+
+ yagl_gles_texture_acquire(texture);
+ yagl_gles_texture_release(texture_target_state->texture);
+ texture_target_state->texture = texture;
+}
+
+void yagl_gles_context_unbind_texture(struct yagl_gles_context *ctx,
+ yagl_object_name texture_local_name)
+{
+ int i;
+ struct yagl_gles_texture_unit *texture_unit =
+ yagl_gles_context_get_active_texture_unit(ctx);
+
+ for (i = 0; i < YAGL_NUM_TEXTURE_TARGETS; ++i) {
+ if ((texture_unit->target_states[i].texture != texture_unit->target_states[i].texture_zero) &&
+ (texture_unit->target_states[i].texture->base.local_name == texture_local_name)) {
+ yagl_gles_texture_acquire(texture_unit->target_states[i].texture_zero);
+ yagl_gles_texture_release(texture_unit->target_states[i].texture);
+ texture_unit->target_states[i].texture =
+ texture_unit->target_states[i].texture_zero;
+
+ /*
+ * And bind texture 0, otherwise we'll end up using
+ * real texture 0 on host.
+ */
+ yagl_gles_texture_bind(texture_unit->target_states[i].texture,
+ texture_unit->target_states[i].texture->target);
+ }
+ }
+
+ if (ctx->fbo_draw) {
+ yagl_gles_framebuffer_unbind_texture(ctx->fbo_draw,
+ texture_local_name);
+ }
+
+ if (ctx->fbo_read) {
+ yagl_gles_framebuffer_unbind_texture(ctx->fbo_read,
+ texture_local_name);
+ }
+}
+
+void yagl_gles_context_bind_buffer(struct yagl_gles_context *ctx,
+ GLenum target,
+ struct yagl_gles_buffer *buffer)
+{
+ YAGL_LOG_FUNC_SET(glBindBuffer);
+
+ switch (target) {
+ case GL_ARRAY_BUFFER:
+ yagl_gles_buffer_acquire(buffer);
+ yagl_gles_buffer_release(ctx->vbo);
+ ctx->vbo = buffer;
+ break;
+ case GL_ELEMENT_ARRAY_BUFFER:
+ yagl_gles_buffer_acquire(buffer);
+ yagl_gles_buffer_release(ctx->vao->ebo);
+ ctx->vao->ebo = buffer;
+ break;
+ case GL_PIXEL_PACK_BUFFER:
+ yagl_gles_buffer_acquire(buffer);
+ yagl_gles_buffer_release(ctx->pack.pbo);
+ ctx->pack.pbo = buffer;
+ break;
+ case GL_PIXEL_UNPACK_BUFFER:
+ yagl_gles_buffer_acquire(buffer);
+ yagl_gles_buffer_release(ctx->unpack.pbo);
+ ctx->unpack.pbo = buffer;
+ break;
+ default:
+ if (!ctx->bind_buffer(ctx, target, buffer)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ return;
+ }
+ }
+
+ if (buffer) {
+ yagl_gles_buffer_set_bound(buffer);
+ }
+}
+
+void yagl_gles_context_unbind_buffer(struct yagl_gles_context *ctx,
+ yagl_object_name buffer_local_name)
+{
+ if (ctx->vbo && (ctx->vbo->base.local_name == buffer_local_name)) {
+ yagl_gles_buffer_release(ctx->vbo);
+ ctx->vbo = NULL;
+ }
+
+ if (ctx->vao->ebo && (ctx->vao->ebo->base.local_name == buffer_local_name)) {
+ yagl_gles_buffer_release(ctx->vao->ebo);
+ ctx->vao->ebo = NULL;
+ }
+
+ if (ctx->pack.pbo && (ctx->pack.pbo->base.local_name == buffer_local_name)) {
+ yagl_gles_buffer_release(ctx->pack.pbo);
+ ctx->pack.pbo = NULL;
+ }
+
+ if (ctx->unpack.pbo && (ctx->unpack.pbo->base.local_name == buffer_local_name)) {
+ yagl_gles_buffer_release(ctx->unpack.pbo);
+ ctx->unpack.pbo = NULL;
+ }
+
+ ctx->unbind_buffer(ctx, buffer_local_name);
+}
+
+void yagl_gles_context_bind_framebuffer(struct yagl_gles_context *ctx,
+ GLenum target,
+ struct yagl_gles_framebuffer *fbo)
+{
+ YAGL_LOG_FUNC_SET(glBindFramebuffer);
+
+ switch (target) {
+ case GL_FRAMEBUFFER:
+ yagl_gles_framebuffer_acquire(fbo);
+ yagl_gles_framebuffer_acquire(fbo);
+ yagl_gles_framebuffer_release(ctx->fbo_draw);
+ yagl_gles_framebuffer_release(ctx->fbo_read);
+ ctx->fbo_draw = ctx->fbo_read = fbo;
+ break;
+ case GL_DRAW_FRAMEBUFFER:
+ yagl_gles_framebuffer_acquire(fbo);
+ yagl_gles_framebuffer_release(ctx->fbo_draw);
+ ctx->fbo_draw = fbo;
+ break;
+ case GL_READ_FRAMEBUFFER:
+ yagl_gles_framebuffer_acquire(fbo);
+ yagl_gles_framebuffer_release(ctx->fbo_read);
+ ctx->fbo_read = fbo;
+ break;
+ default:
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ return;
+ }
+
+ yagl_gles_framebuffer_bind(fbo, target);
+}
+
+void yagl_gles_context_unbind_framebuffer(struct yagl_gles_context *ctx,
+ yagl_object_name fbo_local_name)
+{
+ if (ctx->fbo_draw && (ctx->fbo_draw->base.local_name == fbo_local_name)) {
+ yagl_gles_framebuffer_release(ctx->fbo_draw);
+ ctx->fbo_draw = NULL;
+ }
+
+ if (ctx->fbo_read && (ctx->fbo_read->base.local_name == fbo_local_name)) {
+ yagl_gles_framebuffer_release(ctx->fbo_read);
+ ctx->fbo_read = NULL;
+ }
+}
+
+GLenum yagl_gles_context_check_framebuffer_status(struct yagl_gles_context *ctx,
+ struct yagl_gles_framebuffer *fb)
+{
+ GLenum res = 0;
+ struct yagl_gles_texture *texture;
+ struct yagl_gles_renderbuffer *rb;
+ const struct yagl_gles_format_info *format_info;
+ int i, missing = 1;
+
+ if (!fb) {
+ res = GL_FRAMEBUFFER_COMPLETE;
+ goto out;
+ }
+
+ switch (fb->attachment_states[yagl_gles_framebuffer_attachment_depth].type) {
+ case GL_TEXTURE:
+ missing = 0;
+
+ texture = fb->attachment_states[yagl_gles_framebuffer_attachment_depth].texture;
+
+ if (!texture) {
+ res = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ goto out;
+ }
+
+ format_info = yagl_gles_internalformat_info(texture->internalformat);
+
+ if ((format_info->flags & yagl_gles_format_depth_renderable) == 0) {
+ res = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ goto out;
+ }
+
+ break;
+ case GL_RENDERBUFFER:
+ missing = 0;
+
+ rb = fb->attachment_states[yagl_gles_framebuffer_attachment_depth].rb;
+
+ if (!rb) {
+ res = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ goto out;
+ }
+
+ format_info = yagl_gles_internalformat_info(rb->internalformat);
+
+ if ((format_info->flags & yagl_gles_format_depth_renderable) == 0) {
+ res = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ goto out;
+ }
+
+ break;
+ }
+
+ switch (fb->attachment_states[yagl_gles_framebuffer_attachment_stencil].type) {
+ case GL_TEXTURE:
+ missing = 0;
+
+ texture = fb->attachment_states[yagl_gles_framebuffer_attachment_stencil].texture;
+
+ if (!texture) {
+ res = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ goto out;
+ }
+
+ format_info = yagl_gles_internalformat_info(texture->internalformat);
+
+ if ((format_info->flags & yagl_gles_format_stencil_renderable) == 0) {
+ res = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ goto out;
+ }
+
+ break;
+ case GL_RENDERBUFFER:
+ missing = 0;
+
+ rb = fb->attachment_states[yagl_gles_framebuffer_attachment_stencil].rb;
+
+ if (!rb) {
+ res = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ goto out;
+ }
+
+ format_info = yagl_gles_internalformat_info(rb->internalformat);
+
+ if ((format_info->flags & yagl_gles_format_stencil_renderable) == 0) {
+ res = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ goto out;
+ }
+
+ break;
+ }
+
+ for (i = yagl_gles_framebuffer_attachment_color0;
+ i < (yagl_gles_framebuffer_attachment_color0 +
+ ctx->max_color_attachments); ++i) {
+ switch (fb->attachment_states[i].type) {
+ case GL_TEXTURE:
+ missing = 0;
+
+ texture = fb->attachment_states[i].texture;
+
+ if (!texture) {
+ res = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ goto out;
+ }
+
+ format_info = yagl_gles_internalformat_info(texture->internalformat);
+
+ if ((format_info->flags & yagl_gles_format_color_renderable) == 0) {
+ res = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ goto out;
+ }
+
+ if (!yagl_gles_texture_color_renderable(texture)) {
+ res = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ goto out;
+ }
+
+ break;
+ case GL_RENDERBUFFER:
+ missing = 0;
+
+ rb = fb->attachment_states[i].rb;
+
+ if (!rb) {
+ res = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ goto out;
+ }
+
+ format_info = yagl_gles_internalformat_info(rb->internalformat);
+
+ if ((format_info->flags & yagl_gles_format_color_renderable) == 0) {
+ res = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
+ goto out;
+ }
+
+ break;
+ }
+ }
+
+ if (missing) {
+ res = GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT;
+ goto out;
+ }
+
+ /*
+ * According to OpenGL standard, 9.4.3 Required Framebuffer Formats:
+ * "However, when both depth and stencil attachments are
+ * present, implementations are only required to support
+ * framebuffer objects where both attachments refer to
+ * the same image."
+ */
+
+ if ((fb->attachment_states[yagl_gles_framebuffer_attachment_depth].type != GL_NONE) &&
+ (fb->attachment_states[yagl_gles_framebuffer_attachment_stencil].type != GL_NONE) &&
+ (memcmp(&fb->attachment_states[yagl_gles_framebuffer_attachment_depth],
+ &fb->attachment_states[yagl_gles_framebuffer_attachment_stencil],
+ sizeof(struct yagl_gles_framebuffer_attachment_state)) != 0)) {
+ res = GL_FRAMEBUFFER_UNSUPPORTED;
+ goto out;
+ }
+
+ res = GL_FRAMEBUFFER_COMPLETE;
+
+out:
+ return res;
+}
+
+void yagl_gles_context_bind_renderbuffer(struct yagl_gles_context *ctx,
+ GLenum target,
+ struct yagl_gles_renderbuffer *rbo)
+{
+ YAGL_LOG_FUNC_SET(glBindRenderbuffer);
+
+ switch (target) {
+ case GL_RENDERBUFFER:
+ yagl_gles_renderbuffer_acquire(rbo);
+ yagl_gles_renderbuffer_release(ctx->rbo);
+ ctx->rbo = rbo;
+ break;
+ default:
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ return;
+ }
+
+ yagl_gles_renderbuffer_bind(rbo, target);
+}
+
+void yagl_gles_context_unbind_renderbuffer(struct yagl_gles_context *ctx,
+ yagl_object_name rbo_local_name)
+{
+ if (ctx->rbo && (ctx->rbo->base.local_name == rbo_local_name)) {
+ yagl_gles_renderbuffer_release(ctx->rbo);
+ ctx->rbo = NULL;
+ }
+
+ if (ctx->fbo_draw) {
+ yagl_gles_framebuffer_unbind_renderbuffer(ctx->fbo_draw,
+ rbo_local_name);
+ }
+
+ if (ctx->fbo_read) {
+ yagl_gles_framebuffer_unbind_renderbuffer(ctx->fbo_read,
+ rbo_local_name);
+ }
+}
+
+int yagl_gles_context_acquire_binded_buffer(struct yagl_gles_context *ctx,
+ GLenum target,
+ struct yagl_gles_buffer **buffer)
+{
+ switch (target) {
+ case GL_ARRAY_BUFFER:
+ yagl_gles_buffer_acquire(ctx->vbo);
+ *buffer = ctx->vbo;
+ break;
+ case GL_ELEMENT_ARRAY_BUFFER:
+ yagl_gles_buffer_acquire(ctx->vao->ebo);
+ *buffer = ctx->vao->ebo;
+ break;
+ case GL_PIXEL_PACK_BUFFER:
+ yagl_gles_buffer_acquire(ctx->pack.pbo);
+ *buffer = ctx->pack.pbo;
+ break;
+ case GL_PIXEL_UNPACK_BUFFER:
+ yagl_gles_buffer_acquire(ctx->unpack.pbo);
+ *buffer = ctx->unpack.pbo;
+ break;
+ default:
+ return ctx->acquire_binded_buffer(ctx, target, buffer);
+ }
+
+ return 1;
+}
+
+int yagl_gles_context_acquire_binded_framebuffer(struct yagl_gles_context *ctx,
+ GLenum target,
+ struct yagl_gles_framebuffer **fb)
+{
+ switch (target) {
+ case GL_FRAMEBUFFER:
+ case GL_DRAW_FRAMEBUFFER:
+ yagl_gles_framebuffer_acquire(ctx->fbo_draw);
+ *fb = ctx->fbo_draw;
+ break;
+ case GL_READ_FRAMEBUFFER:
+ yagl_gles_framebuffer_acquire(ctx->fbo_read);
+ *fb = ctx->fbo_read;
+ break;
+ default:
+ return 0;
+ }
+
+ return 1;
+}
+
+int yagl_gles_context_acquire_binded_renderbuffer(struct yagl_gles_context *ctx,
+ GLenum target,
+ struct yagl_gles_renderbuffer **rb)
+{
+ switch (target) {
+ case GL_RENDERBUFFER:
+ yagl_gles_renderbuffer_acquire(ctx->rbo);
+ *rb = ctx->rbo;
+ break;
+ default:
+ return 0;
+ }
+
+ return 1;
+}
+
+void yagl_gles_context_enable(struct yagl_gles_context *ctx,
+ GLenum cap,
+ GLboolean enable)
+{
+ YAGL_LOG_FUNC_SET(yagl_gles_context_enable);
+
+ switch (cap) {
+ case GL_BLEND:
+ ctx->blend_enabled = enable;
+ break;
+ case GL_CULL_FACE:
+ ctx->cull_face_enabled = enable;
+ break;
+ case GL_DEPTH_TEST:
+ ctx->depth_test_enabled = enable;
+ break;
+ case GL_DITHER:
+ ctx->dither_enabled = enable;
+ break;
+ case GL_POLYGON_OFFSET_FILL:
+ ctx->polygon_offset_fill_enabled = enable;
+ break;
+ case GL_SAMPLE_ALPHA_TO_COVERAGE:
+ ctx->sample_alpha_to_coverage_enabled = enable;
+ break;
+ case GL_SAMPLE_COVERAGE:
+ ctx->sample_coverage_enabled = enable;
+ break;
+ case GL_SCISSOR_TEST:
+ ctx->scissor_test_enabled = enable;
+ break;
+ case GL_STENCIL_TEST:
+ ctx->stencil_test_enabled = enable;
+ break;
+ default:
+ if (!ctx->enable(ctx, cap, enable)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ return;
+ }
+ break;
+ }
+
+ if (enable) {
+ yagl_host_glEnable(cap);
+ } else {
+ yagl_host_glDisable(cap);
+ }
+}
+
+GLboolean yagl_gles_context_is_enabled(struct yagl_gles_context *ctx,
+ GLenum cap)
+{
+ GLboolean res = GL_FALSE;
+
+ YAGL_LOG_FUNC_SET(glIsEnabled);
+
+ switch (cap) {
+ case GL_BLEND:
+ res = ctx->blend_enabled;
+ break;
+ case GL_CULL_FACE:
+ res = ctx->cull_face_enabled;
+ break;
+ case GL_DEPTH_TEST:
+ res = ctx->depth_test_enabled;
+ break;
+ case GL_DITHER:
+ res = ctx->dither_enabled;
+ break;
+ case GL_POLYGON_OFFSET_FILL:
+ res = ctx->polygon_offset_fill_enabled;
+ break;
+ case GL_SAMPLE_ALPHA_TO_COVERAGE:
+ res = ctx->sample_alpha_to_coverage_enabled;
+ break;
+ case GL_SAMPLE_COVERAGE:
+ res = ctx->sample_coverage_enabled;
+ break;
+ case GL_SCISSOR_TEST:
+ res = ctx->scissor_test_enabled;
+ break;
+ case GL_STENCIL_TEST:
+ res = ctx->stencil_test_enabled;
+ break;
+ default:
+ if (!ctx->is_enabled(ctx, cap, &res)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ return GL_FALSE;
+ }
+ break;
+ }
+
+ return res;
+}
+
+int yagl_gles_context_get_integerv(struct yagl_gles_context *ctx,
+ GLenum pname,
+ GLint *params,
+ uint32_t *num_params)
+{
+ int processed = 1;
+ struct yagl_gles_texture_target_state *tts;
+ GLenum internalformat;
+
+ switch (pname) {
+ case GL_ACTIVE_TEXTURE:
+ *params = GL_TEXTURE0 + ctx->active_texture_unit;
+ *num_params = 1;
+ break;
+ case GL_TEXTURE_BINDING_2D:
+ tts = yagl_gles_context_get_active_texture_target_state(ctx,
+ yagl_gles_texture_target_2d);
+ *params = tts->texture->base.local_name;
+ *num_params = 1;
+ break;
+ case GL_ARRAY_BUFFER_BINDING:
+ *params = ctx->vbo ? ctx->vbo->base.local_name : 0;
+ *num_params = 1;
+ break;
+ case GL_ELEMENT_ARRAY_BUFFER_BINDING:
+ *params = ctx->vao->ebo ? ctx->vao->ebo->base.local_name : 0;
+ *num_params = 1;
+ break;
+ case GL_FRAMEBUFFER_BINDING:
+ *params = ctx->fbo_draw ? ctx->fbo_draw->base.local_name : 0;
+ *num_params = 1;
+ break;
+ case GL_READ_FRAMEBUFFER_BINDING:
+ *params = ctx->fbo_read ? ctx->fbo_read->base.local_name : 0;
+ *num_params = 1;
+ break;
+ case GL_RENDERBUFFER_BINDING:
+ *params = ctx->rbo ? ctx->rbo->base.local_name : 0;
+ *num_params = 1;
+ break;
+ case GL_BLEND_EQUATION_RGB:
+ *params = ctx->blend_equation_rgb;
+ *num_params = 1;
+ break;
+ case GL_BLEND_EQUATION_ALPHA:
+ *params = ctx->blend_equation_alpha;
+ *num_params = 1;
+ break;
+ case GL_BLEND_SRC_RGB:
+ *params = ctx->blend_src_rgb;
+ *num_params = 1;
+ break;
+ case GL_BLEND_DST_RGB:
+ *params = ctx->blend_dst_rgb;
+ *num_params = 1;
+ break;
+ case GL_BLEND_SRC_ALPHA:
+ *params = ctx->blend_src_alpha;
+ *num_params = 1;
+ break;
+ case GL_BLEND_DST_ALPHA:
+ *params = ctx->blend_dst_alpha;
+ *num_params = 1;
+ break;
+ case GL_COLOR_WRITEMASK:
+ params[0] = ctx->color_writemask[0];
+ params[1] = ctx->color_writemask[1];
+ params[2] = ctx->color_writemask[2];
+ params[3] = ctx->color_writemask[3];
+ *num_params = 4;
+ break;
+ case GL_CULL_FACE_MODE:
+ *params = ctx->cull_face_mode;
+ *num_params = 1;
+ break;
+ case GL_DEPTH_FUNC:
+ *params = ctx->depth_func;
+ *num_params = 1;
+ break;
+ case GL_DEPTH_WRITEMASK:
+ *params = ctx->depth_writemask;
+ *num_params = 1;
+ break;
+ case GL_FRONT_FACE:
+ *params = ctx->front_face_mode;
+ *num_params = 1;
+ break;
+ case GL_PACK_ALIGNMENT:
+ *params = ctx->pack.alignment;
+ *num_params = 1;
+ break;
+ case GL_PACK_IMAGE_HEIGHT:
+ *params = ctx->pack.image_height;
+ *num_params = 1;
+ break;
+ case GL_PACK_ROW_LENGTH:
+ *params = ctx->pack.row_length;
+ *num_params = 1;
+ break;
+ case GL_PACK_SKIP_IMAGES:
+ *params = ctx->pack.skip_images;
+ *num_params = 1;
+ break;
+ case GL_PACK_SKIP_PIXELS:
+ *params = ctx->pack.skip_pixels;
+ *num_params = 1;
+ break;
+ case GL_PACK_SKIP_ROWS:
+ *params = ctx->pack.skip_rows;
+ *num_params = 1;
+ break;
+ case GL_UNPACK_ALIGNMENT:
+ *params = ctx->unpack.alignment;
+ *num_params = 1;
+ break;
+ case GL_UNPACK_IMAGE_HEIGHT:
+ *params = ctx->unpack.image_height;
+ *num_params = 1;
+ break;
+ case GL_UNPACK_ROW_LENGTH:
+ *params = ctx->unpack.row_length;
+ *num_params = 1;
+ break;
+ case GL_UNPACK_SKIP_IMAGES:
+ *params = ctx->unpack.skip_images;
+ *num_params = 1;
+ break;
+ case GL_UNPACK_SKIP_PIXELS:
+ *params = ctx->unpack.skip_pixels;
+ *num_params = 1;
+ break;
+ case GL_UNPACK_SKIP_ROWS:
+ *params = ctx->unpack.skip_rows;
+ *num_params = 1;
+ break;
+ case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
+ if (yagl_gles_context_validate_readbuffer(ctx, &internalformat)) {
+ const struct yagl_gles_format_info *format_info = yagl_gles_internalformat_info(internalformat);
+
+ if (((format_info->flags & yagl_gles_format_unsigned_integer) != 0) ||
+ ((format_info->flags & yagl_gles_format_signed_integer) != 0)) {
+ *params = GL_RGBA_INTEGER;
+ *num_params = 1;
+ break;
+ }
+ }
+ *params = GL_RGBA;
+ *num_params = 1;
+ break;
+ case GL_IMPLEMENTATION_COLOR_READ_TYPE:
+ if (yagl_gles_context_validate_readbuffer(ctx, &internalformat)) {
+ const struct yagl_gles_format_info *format_info = yagl_gles_internalformat_info(internalformat);
+
+ if ((format_info->flags & yagl_gles_format_unsigned_integer) != 0) {
+ *params = GL_UNSIGNED_INT;
+ *num_params = 1;
+ break;
+ }
+
+ if ((format_info->flags & yagl_gles_format_signed_integer) != 0) {
+ *params = GL_INT;
+ *num_params = 1;
+ break;
+ }
+ }
+ *params = GL_UNSIGNED_BYTE;
+ *num_params = 1;
+ break;
+ case GL_VIEWPORT:
+ if (ctx->have_viewport) {
+ params[0] = ctx->viewport[0];
+ params[1] = ctx->viewport[1];
+ params[2] = ctx->viewport[2];
+ params[3] = ctx->viewport[3];
+ *num_params = 4;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_VERTEX_ARRAY_BINDING:
+ if (ctx->vertex_arrays_supported) {
+ *params = (ctx->vao != ctx->va_zero) ? ctx->vao->base.local_name : 0;
+ *num_params = 1;
+ } else {
+ return 0;
+ }
+ break;
+ case GL_MAX_COLOR_ATTACHMENTS:
+ *params = ctx->max_color_attachments;
+ *num_params = 1;
+ break;
+ case GL_MAX_DRAW_BUFFERS:
+ *params = ctx->max_draw_buffers;
+ *num_params = 1;
+ break;
+ case GL_PIXEL_PACK_BUFFER_BINDING:
+ *params = ctx->pack.pbo ? ctx->pack.pbo->base.local_name : 0;
+ *num_params = 1;
+ break;
+ case GL_PIXEL_UNPACK_BUFFER_BINDING:
+ *params = ctx->unpack.pbo ? ctx->unpack.pbo->base.local_name : 0;
+ *num_params = 1;
+ break;
+ case GL_READ_BUFFER:
+ *params = ctx->fbo_read ? ctx->fbo_read->read_buffer : ctx->fb0_read_buffer;
+ *num_params = 1;
+ break;
+ case GL_ALPHA_BITS:
+ if (yagl_gles_context_validate_drawbuffer(ctx, &internalformat)) {
+ const struct yagl_gles_format_info *format_info = yagl_gles_internalformat_info(internalformat);
+ *params = format_info->alpha_size;
+ } else {
+ *params = 0;
+ }
+ *num_params = 1;
+ break;
+ case GL_BLUE_BITS:
+ if (yagl_gles_context_validate_drawbuffer(ctx, &internalformat)) {
+ const struct yagl_gles_format_info *format_info = yagl_gles_internalformat_info(internalformat);
+ *params = format_info->blue_size;
+ } else {
+ *params = 0;
+ }
+ *num_params = 1;
+ break;
+ case GL_GREEN_BITS:
+ if (yagl_gles_context_validate_drawbuffer(ctx, &internalformat)) {
+ const struct yagl_gles_format_info *format_info = yagl_gles_internalformat_info(internalformat);
+ *params = format_info->green_size;
+ } else {
+ *params = 0;
+ }
+ *num_params = 1;
+ break;
+ case GL_RED_BITS:
+ if (yagl_gles_context_validate_drawbuffer(ctx, &internalformat)) {
+ const struct yagl_gles_format_info *format_info = yagl_gles_internalformat_info(internalformat);
+ *params = format_info->red_size;
+ } else {
+ *params = 0;
+ }
+ *num_params = 1;
+ break;
+ case GL_STENCIL_BITS:
+ if (ctx->fbo_draw) {
+ struct yagl_gles_framebuffer_attachment_state *attachment_state;
+
+ attachment_state = &ctx->fbo_draw->attachment_states[yagl_gles_framebuffer_attachment_stencil];
+
+ if (yagl_gles_framebuffer_attachment_internalformat(attachment_state,
+ &internalformat)) {
+ const struct yagl_gles_format_info *format_info = yagl_gles_internalformat_info(internalformat);
+ *params = format_info->stencil_size;
+ } else {
+ *params = 0;
+ }
+ } else {
+ *params = 8;
+ }
+ *num_params = 1;
+ break;
+ case GL_DEPTH_BITS:
+ if (ctx->fbo_draw) {
+ struct yagl_gles_framebuffer_attachment_state *attachment_state;
+
+ attachment_state = &ctx->fbo_draw->attachment_states[yagl_gles_framebuffer_attachment_depth];
+
+ if (yagl_gles_framebuffer_attachment_internalformat(attachment_state,
+ &internalformat)) {
+ const struct yagl_gles_format_info *format_info = yagl_gles_internalformat_info(internalformat);
+ *params = format_info->depth_size;
+ } else {
+ *params = 0;
+ }
+ } else {
+ *params = 24;
+ }
+ *num_params = 1;
+ break;
+ case GL_BLEND:
+ *params = ctx->blend_enabled;
+ *num_params = 1;
+ break;
+ case GL_CULL_FACE:
+ *params = ctx->cull_face_enabled;
+ *num_params = 1;
+ break;
+ case GL_DEPTH_TEST:
+ *params = ctx->depth_test_enabled;
+ *num_params = 1;
+ break;
+ case GL_POLYGON_OFFSET_FILL:
+ *params = ctx->polygon_offset_fill_enabled;
+ *num_params = 1;
+ break;
+ case GL_SAMPLE_ALPHA_TO_COVERAGE:
+ *params = ctx->sample_alpha_to_coverage_enabled;
+ *num_params = 1;
+ break;
+ case GL_SAMPLE_COVERAGE:
+ *params = ctx->sample_coverage_enabled;
+ *num_params = 1;
+ break;
+ case GL_SCISSOR_TEST:
+ *params = ctx->scissor_test_enabled;
+ *num_params = 1;
+ break;
+ case GL_STENCIL_TEST:
+ *params = ctx->stencil_test_enabled;
+ *num_params = 1;
+ break;
+ case GL_GENERATE_MIPMAP_HINT:
+ *params = ctx->generate_mipmap_hint;
+ *num_params = 1;
+ break;
+ case GL_SAMPLE_COVERAGE_INVERT:
+ *params = ctx->sample_coverage_invert;
+ *num_params = 1;
+ break;
+ case GL_STENCIL_CLEAR_VALUE:
+ *params = ctx->clear_stencil;
+ *num_params = 1;
+ break;
+ case GL_STENCIL_FAIL:
+ *params = ctx->stencil_front.fail;
+ *num_params = 1;
+ break;
+ case GL_STENCIL_FUNC:
+ *params = ctx->stencil_front.func;
+ *num_params = 1;
+ break;
+ case GL_STENCIL_PASS_DEPTH_FAIL:
+ *params = ctx->stencil_front.zfail;
+ *num_params = 1;
+ break;
+ case GL_STENCIL_PASS_DEPTH_PASS:
+ *params = ctx->stencil_front.zpass;
+ *num_params = 1;
+ break;
+ case GL_STENCIL_REF:
+ *params = ctx->stencil_front.ref;
+ *num_params = 1;
+ break;
+ case GL_STENCIL_VALUE_MASK:
+ *params = ctx->stencil_front.mask;
+ *num_params = 1;
+ break;
+ case GL_STENCIL_WRITEMASK:
+ *params = ctx->stencil_front.writemask;
+ *num_params = 1;
+ break;
+ case GL_MAX_RENDERBUFFER_SIZE:
+ if (ctx->have_max_renderbuffer_size) {
+ *params = ctx->max_renderbuffer_size;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_MAX_VIEWPORT_DIMS:
+ if (ctx->have_max_viewport_dims) {
+ params[0] = ctx->max_viewport_dims[0];
+ params[1] = ctx->max_viewport_dims[1];
+ *num_params = 2;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_SAMPLE_BUFFERS:
+ if (ctx->have_sample_buffers) {
+ *params = ctx->sample_buffers;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_SAMPLES:
+ if (ctx->have_samples) {
+ *params = ctx->samples;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_SCISSOR_BOX:
+ if (ctx->have_scissor_box) {
+ params[0] = ctx->scissor_box[0];
+ params[1] = ctx->scissor_box[1];
+ params[2] = ctx->scissor_box[2];
+ params[3] = ctx->scissor_box[3];
+ *num_params = 4;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_SUBPIXEL_BITS:
+ if (ctx->have_subpixel_bits) {
+ *params = ctx->subpixel_bits;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ default:
+ if ((pname >= GL_DRAW_BUFFER0) &&
+ (pname <= (GL_DRAW_BUFFER0 + ctx->max_draw_buffers - 1))) {
+ if (ctx->fbo_draw) {
+ *params = ctx->fbo_draw->draw_buffers[pname - GL_DRAW_BUFFER0];
+ *num_params = 1;
+ } else if (pname == GL_DRAW_BUFFER0) {
+ *params = ctx->fb0_draw_buffer;
+ *num_params = 1;
+ } else {
+ *params = GL_NONE;
+ *num_params = 1;
+ }
+ break;
+ }
+
+ processed = 0;
+ break;
+ }
+
+ if (processed) {
+ return 1;
+ }
+
+ switch (pname) {
+ case GL_MAX_RENDERBUFFER_SIZE:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ ctx->max_renderbuffer_size = *params;
+ ctx->have_max_renderbuffer_size = 1;
+ break;
+ case GL_MAX_VIEWPORT_DIMS:
+ *num_params = 2;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ ctx->max_viewport_dims[0] = params[0];
+ ctx->max_viewport_dims[1] = params[1];
+ ctx->have_max_viewport_dims = 1;
+ break;
+ case GL_SAMPLE_BUFFERS:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ ctx->sample_buffers = *params;
+ ctx->have_sample_buffers = 1;
+ break;
+ case GL_SAMPLES:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ ctx->samples = *params;
+ ctx->have_samples = 1;
+ break;
+ case GL_SCISSOR_BOX:
+ *num_params = 4;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ ctx->scissor_box[0] = params[0];
+ ctx->scissor_box[1] = params[1];
+ ctx->scissor_box[2] = params[2];
+ ctx->scissor_box[3] = params[3];
+ ctx->have_scissor_box = 1;
+ break;
+ case GL_SUBPIXEL_BITS:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ ctx->subpixel_bits = *params;
+ ctx->have_subpixel_bits = 1;
+ break;
+ case GL_VIEWPORT:
+ *num_params = 4;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ ctx->viewport[0] = params[0];
+ ctx->viewport[1] = params[1];
+ ctx->viewport[2] = params[2];
+ ctx->viewport[3] = params[3];
+ ctx->have_viewport = 1;
+ break;
+ default:
+ return ctx->get_integerv(ctx, pname, params, num_params);
+ }
+
+ return 1;
+}
+
+int yagl_gles_context_get_floatv(struct yagl_gles_context *ctx,
+ GLenum pname,
+ GLfloat *params,
+ uint32_t *num_params,
+ int *needs_map)
+{
+ int processed = 1;
+
+ switch (pname) {
+ case GL_COLOR_CLEAR_VALUE:
+ params[0] = ctx->clear_color[0];
+ params[1] = ctx->clear_color[1];
+ params[2] = ctx->clear_color[2];
+ params[3] = ctx->clear_color[3];
+ *num_params = 4;
+ *needs_map = 1;
+ break;
+ case GL_DEPTH_CLEAR_VALUE:
+ *params = ctx->clear_depth;
+ *num_params = 1;
+ *needs_map = 1;
+ break;
+ case GL_DEPTH_RANGE:
+ params[0] = ctx->depth_range[0];
+ params[1] = ctx->depth_range[1];
+ *num_params = 2;
+ *needs_map = 1;
+ break;
+ case GL_SAMPLE_COVERAGE_VALUE:
+ *params = ctx->sample_coverage_value;
+ *num_params = 1;
+ break;
+ case GL_LINE_WIDTH:
+ *params = ctx->line_width;
+ *num_params = 1;
+ break;
+ case GL_POLYGON_OFFSET_FACTOR:
+ *params = ctx->polygon_offset_factor;
+ *num_params = 1;
+ break;
+ case GL_POLYGON_OFFSET_UNITS:
+ *params = ctx->polygon_offset_units;
+ *num_params = 1;
+ break;
+ case GL_ALIASED_LINE_WIDTH_RANGE:
+ if (ctx->have_line_width_range) {
+ params[0] = ctx->line_width_range[0];
+ params[1] = ctx->line_width_range[1];
+ *num_params = 2;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_ALIASED_POINT_SIZE_RANGE:
+ if (ctx->have_point_size_range) {
+ params[0] = ctx->point_size_range[0];
+ params[1] = ctx->point_size_range[1];
+ *num_params = 2;
+ } else {
+ processed = 0;
+ }
+ break;
+ default:
+ processed = 0;
+ break;
+ }
+
+ if (processed) {
+ return 1;
+ }
+
+ switch (pname) {
+ case GL_ALIASED_LINE_WIDTH_RANGE:
+ *num_params = 2;
+ yagl_host_glGetFloatv(pname, params, *num_params, NULL);
+ ctx->line_width_range[0] = params[0];
+ ctx->line_width_range[1] = params[1];
+ ctx->have_line_width_range = 1;
+ break;
+ case GL_ALIASED_POINT_SIZE_RANGE:
+ *num_params = 2;
+ yagl_host_glGetFloatv(pname, params, *num_params, NULL);
+ ctx->point_size_range[0] = params[0];
+ ctx->point_size_range[1] = params[1];
+ ctx->have_point_size_range = 1;
+ break;
+ default:
+ return ctx->get_floatv(ctx, pname, params, num_params, needs_map);
+ }
+
+ return 1;
+}
+
+void yagl_gles_context_draw_arrays(struct yagl_gles_context *ctx,
+ GLenum mode, GLint first, GLsizei count,
+ GLsizei primcount)
+{
+ GLuint i;
+
+ YAGL_LOG_FUNC_SET(yagl_gles_context_draw_arrays);
+
+ if (!yagl_gles_is_draw_mode_valid(mode)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ return;
+ }
+
+ if ((first < 0) || (count < 0)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ return;
+ }
+
+ if ((count == 0) || (primcount == 0)) {
+ return;
+ }
+
+ yagl_render_invalidate(0);
+
+ for (i = 0; i < ctx->vao->num_arrays; ++i) {
+ yagl_gles_array_transfer(&ctx->vao->arrays[i],
+ first,
+ count,
+ primcount);
+ }
+
+ ctx->draw_arrays(ctx, mode, first, count, primcount);
+}
+
+void yagl_gles_context_draw_elements(struct yagl_gles_context *ctx,
+ GLenum mode, GLsizei count,
+ GLenum type, const GLvoid *indices,
+ GLsizei primcount)
+{
+ int index_size = 0;
+ int have_range = 0;
+ uint32_t min_idx = 0, max_idx = 0;
+ GLuint i;
+
+ YAGL_LOG_FUNC_SET(yagl_gles_context_draw_elements);
+
+ if (!yagl_gles_is_draw_mode_valid(mode)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ return;
+ }
+
+ if (count < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ return;
+ }
+
+ if (!yagl_gles_get_index_size(type, &index_size)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ return;
+ }
+
+ if (!ctx->vao->ebo && !indices) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ return;
+ }
+
+ if ((count == 0) || (primcount == 0)) {
+ return;
+ }
+
+ yagl_render_invalidate(0);
+
+ for (i = 0; i < ctx->vao->num_arrays; ++i) {
+ if (!ctx->vao->arrays[i].enabled) {
+ continue;
+ }
+
+ if (!have_range) {
+ if (ctx->vao->ebo) {
+ if (!yagl_gles_buffer_get_minmax_index(ctx->vao->ebo,
+ type,
+ (GLint)indices,
+ count,
+ &min_idx,
+ &max_idx)) {
+ YAGL_LOG_WARN("unable to get min/max index from ebo");
+ return;
+ }
+ } else {
+ yagl_get_minmax_index(indices, count, type,
+ &min_idx, &max_idx);
+ }
+ have_range = 1;
+ }
+
+ yagl_gles_array_transfer(&ctx->vao->arrays[i],
+ min_idx,
+ max_idx + 1 - min_idx,
+ primcount);
+ }
+
+ if (!have_range) {
+ return;
+ }
+
+ if (ctx->vao->ebo) {
+ yagl_gles_buffer_bind(ctx->vao->ebo,
+ type,
+ 0,
+ GL_ELEMENT_ARRAY_BUFFER);
+ yagl_gles_buffer_transfer(ctx->vao->ebo,
+ type,
+ GL_ELEMENT_ARRAY_BUFFER,
+ 0);
+ ctx->draw_elements(ctx, mode, count, type, NULL, (int32_t)indices, primcount, max_idx);
+ yagl_host_glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
+ } else {
+ ctx->draw_elements(ctx, mode, count, type, indices, count * index_size, primcount, max_idx);
+ }
+}
+
+int yagl_gles_context_pre_unpack(struct yagl_gles_context *ctx,
+ const GLvoid **pixels,
+ int need_convert,
+ int *using_pbo)
+{
+ *using_pbo = 0;
+
+ if (!ctx->unpack.pbo) {
+ return 1;
+ }
+
+ if (!need_convert) {
+ yagl_gles_buffer_bind(ctx->unpack.pbo,
+ 0,
+ 0,
+ GL_PIXEL_UNPACK_BUFFER);
+ yagl_gles_buffer_transfer(ctx->unpack.pbo,
+ 0,
+ GL_PIXEL_UNPACK_BUFFER,
+ 0);
+
+ *using_pbo = 1;
+
+ return 1;
+ }
+
+ if (!yagl_gles_buffer_map(ctx->unpack.pbo,
+ 0, ctx->unpack.pbo->size,
+ GL_MAP_READ_BIT)) {
+ return 0;
+ }
+
+ *pixels = ctx->unpack.pbo->map_pointer + (uint32_t)*pixels;
+
+ return 1;
+}
+
+void yagl_gles_context_post_unpack(struct yagl_gles_context *ctx,
+ int need_convert)
+{
+ if (!ctx->unpack.pbo) {
+ return;
+ }
+
+ if (need_convert) {
+ yagl_gles_buffer_unmap(ctx->unpack.pbo);
+ } else {
+ yagl_host_glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
+ }
+}
+
+int yagl_gles_context_pre_pack(struct yagl_gles_context *ctx,
+ GLvoid **pixels,
+ int need_convert,
+ int *using_pbo)
+{
+ *using_pbo = 0;
+
+ if (!ctx->pack.pbo) {
+ return 1;
+ }
+
+ if (!need_convert) {
+ yagl_gles_buffer_bind(ctx->pack.pbo,
+ 0,
+ 0,
+ GL_PIXEL_PACK_BUFFER);
+ yagl_gles_buffer_transfer(ctx->pack.pbo,
+ 0,
+ GL_PIXEL_PACK_BUFFER,
+ 0);
+
+ *using_pbo = 1;
+
+ return 1;
+ }
+
+ if (!yagl_gles_buffer_map(ctx->pack.pbo,
+ 0, ctx->pack.pbo->size,
+ GL_MAP_WRITE_BIT)) {
+ return 0;
+ }
+
+ *pixels = ctx->pack.pbo->map_pointer + (uint32_t)*pixels;
+
+ return 1;
+}
+
+void yagl_gles_context_post_pack(struct yagl_gles_context *ctx,
+ GLvoid *pixels,
+ GLsizei size,
+ int need_convert)
+{
+ if (!ctx->pack.pbo) {
+ return;
+ }
+
+ if (need_convert) {
+ yagl_gles_buffer_unmap(ctx->pack.pbo);
+ } else {
+ yagl_host_glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
+ yagl_gles_buffer_set_gpu_dirty(ctx->pack.pbo,
+ (GLint)pixels,
+ size);
+ }
+}
+
+void yagl_gles_context_line_width(struct yagl_gles_context *ctx,
+ GLfloat width)
+{
+ ctx->line_width = width;
+
+ yagl_host_glLineWidth(width);
+}
+
+void yagl_gles_context_tex_parameterf(struct yagl_gles_context *ctx,
+ GLenum target,
+ GLenum pname,
+ GLfloat param)
+{
+ yagl_gles_texture_target texture_target;
+ struct yagl_gles_texture_target_state *tex_target_state;
+
+ YAGL_LOG_FUNC_SET(glTexParameterf);
+
+ if (!yagl_gles_context_validate_texture_target(ctx,
+ target,
+ &texture_target)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ return;
+ }
+
+ tex_target_state =
+ yagl_gles_context_get_active_texture_target_state(ctx, texture_target);
+
+ if (pname == GL_TEXTURE_MIN_FILTER) {
+ tex_target_state->texture->min_filter = param;
+ } else if (pname == GL_TEXTURE_MAG_FILTER) {
+ tex_target_state->texture->mag_filter = param;
+ }
+
+ yagl_host_glTexParameterf(target, pname, param);
+}
+
+void yagl_gles_context_tex_parameterfv(struct yagl_gles_context *ctx,
+ GLenum target,
+ GLenum pname,
+ const GLfloat *params)
+{
+ yagl_gles_texture_target texture_target;
+ struct yagl_gles_texture_target_state *tex_target_state;
+
+ YAGL_LOG_FUNC_SET(glTexParameterfv);
+
+ if (!yagl_gles_context_validate_texture_target(ctx,
+ target,
+ &texture_target)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ return;
+ }
+
+ tex_target_state =
+ yagl_gles_context_get_active_texture_target_state(ctx, texture_target);
+
+ if (pname == GL_TEXTURE_MIN_FILTER) {
+ tex_target_state->texture->min_filter = params[0];
+ } else if (pname == GL_TEXTURE_MAG_FILTER) {
+ tex_target_state->texture->mag_filter = params[0];
+ }
+
+ yagl_host_glTexParameterfv(target, pname, params, 1);
+}
+
+int yagl_gles_context_get_tex_parameterfv(struct yagl_gles_context *ctx,
+ GLenum target,
+ GLenum pname,
+ GLfloat *params)
+{
+ yagl_gles_texture_target texture_target;
+ struct yagl_gles_texture *texture_obj;
+
+ if (!yagl_gles_context_validate_texture_target(ctx, target, &texture_target)) {
+ return 0;
+ }
+
+ texture_obj = yagl_gles_context_get_active_texture_target_state(ctx,
+ texture_target)->texture;
+
+ switch (pname) {
+ case GL_TEXTURE_IMMUTABLE_FORMAT:
+ params[0] = texture_obj->immutable;
+ return 1;
+ default:
+ break;
+ }
+
+ yagl_host_glGetTexParameterfv(target, pname, params);
+
+ return 1;
+}
+
+int yagl_gles_context_get_tex_parameteriv(struct yagl_gles_context *ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params)
+{
+ yagl_gles_texture_target texture_target;
+ struct yagl_gles_texture *texture_obj;
+
+ if (!yagl_gles_context_validate_texture_target(ctx, target, &texture_target)) {
+ return 0;
+ }
+
+ texture_obj = yagl_gles_context_get_active_texture_target_state(ctx,
+ texture_target)->texture;
+
+ switch (pname) {
+ case GL_TEXTURE_IMMUTABLE_FORMAT:
+ params[0] = texture_obj->immutable;
+ return 1;
+ default:
+ break;
+ }
+
+ yagl_host_glGetTexParameteriv(target, pname, params);
+
+ return 1;
+}
+
+void yagl_gles_context_clear_color(struct yagl_gles_context *ctx,
+ GLclampf red,
+ GLclampf green,
+ GLclampf blue,
+ GLclampf alpha)
+{
+ ctx->clear_color[0] = yagl_clampf(red);
+ ctx->clear_color[1] = yagl_clampf(green);
+ ctx->clear_color[2] = yagl_clampf(blue);
+ ctx->clear_color[3] = yagl_clampf(alpha);
+
+ yagl_host_glClearColor(red, green, blue, alpha);
+}
+
+void yagl_gles_context_clear_depthf(struct yagl_gles_context *ctx,
+ GLclampf depth)
+{
+ ctx->clear_depth = yagl_clampf(depth);
+
+ yagl_host_glClearDepthf(depth);
+}
+
+void yagl_gles_context_sample_coverage(struct yagl_gles_context *ctx,
+ GLclampf value,
+ GLboolean invert)
+{
+ ctx->sample_coverage_value = yagl_clampf(value);
+ ctx->sample_coverage_invert = invert;
+
+ yagl_host_glSampleCoverage(value, invert);
+}
+
+void yagl_gles_context_depth_rangef(struct yagl_gles_context *ctx,
+ GLclampf zNear,
+ GLclampf zFar)
+{
+ ctx->depth_range[0] = yagl_clampf(zNear);
+ ctx->depth_range[1] = yagl_clampf(zFar);
+
+ yagl_host_glDepthRangef(zNear, zFar);
+}
+
+void yagl_gles_context_polygon_offset(struct yagl_gles_context *ctx,
+ GLfloat factor,
+ GLfloat units)
+{
+ ctx->polygon_offset_factor = factor;
+ ctx->polygon_offset_units = units;
+
+ yagl_host_glPolygonOffset(factor, units);
+}
+
+void yagl_gles_context_hint(struct yagl_gles_context *ctx,
+ GLenum target,
+ GLenum mode)
+{
+ switch (target) {
+ case GL_GENERATE_MIPMAP_HINT:
+ ctx->generate_mipmap_hint = mode;
+ break;
+ default:
+ ctx->hint(ctx, target, mode);
+ break;
+ }
+
+ yagl_host_glHint(target, mode);
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES_CONTEXT_H_
+#define _YAGL_GLES_CONTEXT_H_
+
+#include "yagl_gles_types.h"
+#include "yagl_client_context.h"
+#include "yagl_namespace.h"
+
+struct yagl_pixel_format;
+struct yagl_gles_vertex_array;
+struct yagl_gles_array;
+struct yagl_gles_buffer;
+struct yagl_gles_texture;
+struct yagl_gles_texture_unit;
+struct yagl_gles_framebuffer;
+struct yagl_gles_renderbuffer;
+
+struct yagl_gles_context
+{
+ struct yagl_client_context base;
+
+ struct yagl_gles_array *(*create_arrays)(struct yagl_gles_context */*ctx*/);
+
+ const GLchar *(*get_string)(struct yagl_gles_context */*ctx*/,
+ GLenum /*name*/);
+
+ void (*compressed_tex_image_2d)(struct yagl_gles_context */*ctx*/,
+ GLenum /*target*/,
+ struct yagl_gles_texture */*texture*/,
+ GLint /*level*/,
+ GLenum /*internalformat*/,
+ GLsizei /*width*/,
+ GLsizei /*height*/,
+ GLint /*border*/,
+ GLsizei /*imageSize*/,
+ const GLvoid */*data*/);
+
+ void (*compressed_tex_sub_image_2d)(struct yagl_gles_context */*ctx*/,
+ GLenum /*target*/,
+ GLint /*level*/,
+ GLint /*xoffset*/,
+ GLint /*yoffset*/,
+ GLsizei /*width*/,
+ GLsizei /*height*/,
+ GLenum /*format*/,
+ GLsizei /*imageSize*/,
+ const GLvoid */*data*/);
+
+ int (*enable)(struct yagl_gles_context */*ctx*/,
+ GLenum /*cap*/,
+ GLboolean /*enable*/);
+
+ int (*is_enabled)(struct yagl_gles_context */*ctx*/,
+ GLenum /*cap*/,
+ GLboolean */*enabled*/);
+
+ int (*get_integerv)(struct yagl_gles_context */*ctx*/,
+ GLenum /*pname*/,
+ GLint */*params*/,
+ uint32_t */*num_params*/);
+
+ int (*get_floatv)(struct yagl_gles_context */*ctx*/,
+ GLenum /*pname*/,
+ GLfloat */*params*/,
+ uint32_t */*num_params*/,
+ int */*needs_map*/);
+
+ /*
+ * 'primcount' < 0 - usual draw.
+ * 'primcount' >= 0 - instanced draw.
+ */
+ void (*draw_arrays)(struct yagl_gles_context */*ctx*/,
+ GLenum /*mode*/,
+ GLint /*first*/,
+ GLsizei /*count*/,
+ GLsizei /*primcount*/);
+
+ /*
+ * 'primcount' < 0 - usual draw.
+ * 'primcount' >= 0 - instanced draw.
+ */
+ void (*draw_elements)(struct yagl_gles_context */*ctx*/,
+ GLenum /*mode*/,
+ GLsizei /*count*/,
+ GLenum /*type*/,
+ const GLvoid */*indices*/,
+ int32_t /*indices_count*/,
+ GLsizei /*primcount*/,
+ uint32_t /*max_idx*/);
+
+ int (*bind_buffer)(struct yagl_gles_context */*ctx*/,
+ GLenum /*target*/,
+ struct yagl_gles_buffer */*buffer*/);
+
+ void (*unbind_buffer)(struct yagl_gles_context */*ctx*/,
+ yagl_object_name /*buffer_local_name*/);
+
+ int (*acquire_binded_buffer)(struct yagl_gles_context */*ctx*/,
+ GLenum /*target*/,
+ struct yagl_gles_buffer **/*buffer*/);
+
+ int (*validate_texture_target)(struct yagl_gles_context */*ctx*/,
+ GLenum /*target*/,
+ yagl_gles_texture_target */*texture_target*/);
+
+ struct yagl_pixel_format *(*validate_teximage_format)(struct yagl_gles_context */*ctx*/,
+ GLenum /*internalformat*/,
+ GLenum /*format*/,
+ GLenum /*type*/);
+
+ struct yagl_pixel_format *(*validate_getteximage_format)(struct yagl_gles_context */*ctx*/,
+ GLenum /*readbuffer_internalformat*/,
+ GLenum /*format*/,
+ GLenum /*type*/);
+
+ int (*validate_copyteximage_format)(struct yagl_gles_context */*ctx*/,
+ GLenum /*readbuffer_internalformat*/,
+ GLenum */*internalformat*/);
+
+ int (*validate_texstorage_format)(struct yagl_gles_context */*ctx*/,
+ GLenum */*internalformat*/,
+ GLenum */*base_internalformat*/,
+ GLenum */*any_format*/,
+ GLenum */*any_type*/);
+
+ int (*validate_renderbuffer_format)(struct yagl_gles_context */*ctx*/,
+ GLenum */*internalformat*/);
+
+ void (*hint)(struct yagl_gles_context */*ctx*/,
+ GLenum /*target*/,
+ GLenum /*mode*/);
+
+ struct yagl_namespace framebuffers;
+
+ struct yagl_namespace vertex_arrays;
+
+ const GLchar **extensions;
+ int num_extensions;
+
+ GLchar *extension_string;
+
+ GLenum error;
+
+ struct yagl_gles_vertex_array *va_zero;
+
+ int min_mag_blits;
+
+ /*
+ * GLES texture units, the number of texture units is determined
+ * at runtime.
+ */
+ struct yagl_gles_texture_unit *texture_units;
+ int num_texture_units;
+
+ int num_arrays;
+
+ int vertex_arrays_supported;
+
+ int packed_depth_stencil;
+
+ int texture_npot;
+
+ int texture_filter_anisotropic;
+
+ int max_color_attachments;
+
+ int max_draw_buffers;
+
+ int active_texture_unit;
+
+ struct yagl_gles_vertex_array *vao;
+
+ struct yagl_gles_buffer *vbo;
+
+ struct yagl_gles_framebuffer *fbo_draw;
+ struct yagl_gles_framebuffer *fbo_read;
+
+ struct yagl_gles_renderbuffer *rbo;
+
+ struct yagl_gles_pixelstore pack;
+ struct yagl_gles_pixelstore unpack;
+
+ GLenum blend_equation_rgb;
+ GLenum blend_equation_alpha;
+
+ GLenum blend_src_rgb;
+ GLenum blend_dst_rgb;
+
+ GLenum blend_src_alpha;
+ GLenum blend_dst_alpha;
+
+ GLclampf clear_color[4];
+
+ GLclampf clear_depth;
+
+ GLboolean color_writemask[4];
+
+ GLenum cull_face_mode;
+
+ GLenum depth_func;
+
+ GLboolean depth_writemask;
+
+ GLclampf depth_range[2];
+
+ GLenum front_face_mode;
+
+ int have_viewport;
+ GLint viewport[4];
+
+ GLenum fb0_draw_buffer;
+ GLenum fb0_read_buffer;
+
+ GLenum generate_mipmap_hint;
+
+ GLclampf sample_coverage_value;
+ GLboolean sample_coverage_invert;
+
+ GLint clear_stencil;
+
+ struct
+ {
+ GLenum func;
+ GLint ref;
+ GLuint mask;
+ GLuint writemask;
+ GLenum fail;
+ GLenum zfail;
+ GLenum zpass;
+ } stencil_back, stencil_front;
+
+ GLfloat line_width;
+ GLfloat polygon_offset_factor;
+ GLfloat polygon_offset_units;
+
+ int have_max_renderbuffer_size;
+ GLint max_renderbuffer_size;
+
+ int have_max_viewport_dims;
+ GLint max_viewport_dims[2];
+
+ int have_sample_buffers;
+ GLint sample_buffers;
+
+ int have_samples;
+ GLint samples;
+
+ int have_scissor_box;
+ GLint scissor_box[4];
+
+ int have_subpixel_bits;
+ GLint subpixel_bits;
+
+ int have_line_width_range;
+ GLfloat line_width_range[2];
+
+ int have_point_size_range;
+ GLfloat point_size_range[2];
+
+ GLboolean blend_enabled;
+ GLboolean cull_face_enabled;
+ GLboolean depth_test_enabled;
+ GLboolean dither_enabled;
+ GLboolean polygon_offset_fill_enabled;
+ GLboolean sample_alpha_to_coverage_enabled;
+ GLboolean sample_coverage_enabled;
+ GLboolean scissor_test_enabled;
+ GLboolean stencil_test_enabled;
+};
+
+void yagl_gles_context_init(struct yagl_gles_context *ctx,
+ yagl_client_api client_api,
+ struct yagl_sharegroup *sg);
+
+void yagl_gles_context_prepare(struct yagl_gles_context *ctx,
+ int num_texture_units,
+ int num_arrays);
+
+/*
+ * Takes ownership of 'extensions'.
+ */
+void yagl_gles_context_prepare_end(struct yagl_gles_context *ctx,
+ const GLchar **extensions,
+ int num_extensions);
+
+void yagl_gles_context_cleanup(struct yagl_gles_context *ctx);
+
+void yagl_gles_context_set_error(struct yagl_gles_context *ctx, GLenum error);
+
+GLenum yagl_gles_context_get_error(struct yagl_gles_context *ctx);
+
+void yagl_gles_context_bind_vertex_array(struct yagl_gles_context *ctx,
+ struct yagl_gles_vertex_array *va);
+
+void yagl_gles_context_unbind_vertex_array(struct yagl_gles_context *ctx,
+ yagl_object_name va_local_name);
+
+int yagl_gles_context_convert_textures(struct yagl_gles_context *ctx);
+
+int yagl_gles_context_validate_texture_target(struct yagl_gles_context *ctx,
+ GLenum target,
+ yagl_gles_texture_target *texture_target);
+
+struct yagl_pixel_format
+ *yagl_gles_context_validate_teximage_format(struct yagl_gles_context *ctx,
+ GLenum internalformat,
+ GLenum format,
+ GLenum type);
+
+struct yagl_pixel_format
+ *yagl_gles_context_validate_getteximage_format(struct yagl_gles_context *ctx,
+ GLenum format,
+ GLenum type);
+
+int yagl_gles_context_validate_copyteximage_format(struct yagl_gles_context *ctx,
+ GLenum *internalformat,
+ int *is_float);
+
+int yagl_gles_context_validate_texstorage_format(struct yagl_gles_context *ctx,
+ GLenum *internalformat,
+ GLenum *base_internalformat,
+ GLenum *any_format,
+ GLenum *any_type);
+
+int yagl_gles_context_validate_renderbuffer_format(struct yagl_gles_context *ctx,
+ GLenum *internalformat);
+
+void yagl_gles_context_set_active_texture(struct yagl_gles_context *ctx,
+ GLenum texture);
+
+struct yagl_gles_texture_unit
+ *yagl_gles_context_get_active_texture_unit(struct yagl_gles_context *ctx);
+
+struct yagl_gles_texture_target_state
+ *yagl_gles_context_get_active_texture_target_state(struct yagl_gles_context *ctx,
+ yagl_gles_texture_target texture_target);
+
+void yagl_gles_context_active_texture_set_enabled(struct yagl_gles_context *ctx,
+ yagl_gles_texture_target texture_target, int enabled);
+
+void yagl_gles_context_bind_texture(struct yagl_gles_context *ctx,
+ GLenum target,
+ struct yagl_gles_texture *texture);
+
+void yagl_gles_context_unbind_texture(struct yagl_gles_context *ctx,
+ yagl_object_name texture_local_name);
+
+void yagl_gles_context_bind_buffer(struct yagl_gles_context *ctx,
+ GLenum target,
+ struct yagl_gles_buffer *buffer);
+
+void yagl_gles_context_unbind_buffer(struct yagl_gles_context *ctx,
+ yagl_object_name buffer_local_name);
+
+void yagl_gles_context_bind_framebuffer(struct yagl_gles_context *ctx,
+ GLenum target,
+ struct yagl_gles_framebuffer *fbo);
+
+void yagl_gles_context_unbind_framebuffer(struct yagl_gles_context *ctx,
+ yagl_object_name fbo_local_name);
+
+GLenum yagl_gles_context_check_framebuffer_status(struct yagl_gles_context *ctx,
+ struct yagl_gles_framebuffer *fb);
+
+void yagl_gles_context_bind_renderbuffer(struct yagl_gles_context *ctx,
+ GLenum target,
+ struct yagl_gles_renderbuffer *rbo);
+
+void yagl_gles_context_unbind_renderbuffer(struct yagl_gles_context *ctx,
+ yagl_object_name rbo_local_name);
+
+int yagl_gles_context_acquire_binded_buffer(struct yagl_gles_context *ctx,
+ GLenum target,
+ struct yagl_gles_buffer **buffer);
+
+int yagl_gles_context_acquire_binded_framebuffer(struct yagl_gles_context *ctx,
+ GLenum target,
+ struct yagl_gles_framebuffer **fb);
+
+int yagl_gles_context_acquire_binded_renderbuffer(struct yagl_gles_context *ctx,
+ GLenum target,
+ struct yagl_gles_renderbuffer **rb);
+
+void yagl_gles_context_enable(struct yagl_gles_context *ctx,
+ GLenum cap,
+ GLboolean enable);
+
+GLboolean yagl_gles_context_is_enabled(struct yagl_gles_context *ctx,
+ GLenum cap);
+
+int yagl_gles_context_get_integerv(struct yagl_gles_context *ctx,
+ GLenum pname,
+ GLint *params,
+ uint32_t *num_params);
+
+int yagl_gles_context_get_floatv(struct yagl_gles_context *ctx,
+ GLenum pname,
+ GLfloat *params,
+ uint32_t *num_params,
+ int *needs_map);
+
+void yagl_gles_context_draw_arrays(struct yagl_gles_context *ctx,
+ GLenum mode, GLint first, GLsizei count,
+ GLsizei primcount);
+
+void yagl_gles_context_draw_elements(struct yagl_gles_context *ctx,
+ GLenum mode, GLsizei count,
+ GLenum type, const GLvoid *indices,
+ GLsizei primcount);
+
+int yagl_gles_context_pre_unpack(struct yagl_gles_context *ctx,
+ const GLvoid **pixels,
+ int need_convert,
+ int *using_pbo);
+
+void yagl_gles_context_post_unpack(struct yagl_gles_context *ctx,
+ int need_convert);
+
+int yagl_gles_context_pre_pack(struct yagl_gles_context *ctx,
+ GLvoid **pixels,
+ int need_convert,
+ int *using_pbo);
+
+void yagl_gles_context_post_pack(struct yagl_gles_context *ctx,
+ GLvoid *pixels,
+ GLsizei size,
+ int need_convert);
+
+void yagl_gles_context_line_width(struct yagl_gles_context *ctx,
+ GLfloat width);
+
+void yagl_gles_context_tex_parameterf(struct yagl_gles_context *ctx,
+ GLenum target,
+ GLenum pname,
+ GLfloat param);
+
+void yagl_gles_context_tex_parameterfv(struct yagl_gles_context *ctx,
+ GLenum target,
+ GLenum pname,
+ const GLfloat *params);
+
+int yagl_gles_context_get_tex_parameterfv(struct yagl_gles_context *ctx,
+ GLenum target,
+ GLenum pname,
+ GLfloat *params);
+
+int yagl_gles_context_get_tex_parameteriv(struct yagl_gles_context *ctx,
+ GLenum target,
+ GLenum pname,
+ GLint *params);
+
+void yagl_gles_context_clear_color(struct yagl_gles_context *ctx,
+ GLclampf red,
+ GLclampf green,
+ GLclampf blue,
+ GLclampf alpha);
+
+void yagl_gles_context_clear_depthf(struct yagl_gles_context *ctx,
+ GLclampf depth);
+
+void yagl_gles_context_sample_coverage(struct yagl_gles_context *ctx,
+ GLclampf value,
+ GLboolean invert);
+
+void yagl_gles_context_depth_rangef(struct yagl_gles_context *ctx,
+ GLclampf zNear,
+ GLclampf zFar);
+
+void yagl_gles_context_polygon_offset(struct yagl_gles_context *ctx,
+ GLfloat factor,
+ GLfloat units);
+
+void yagl_gles_context_hint(struct yagl_gles_context *ctx,
+ GLenum target,
+ GLenum mode);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GL/gl.h"
+#include "yagl_gles_framebuffer.h"
+#include "yagl_gles_renderbuffer.h"
+#include "yagl_gles_texture.h"
+#include "yagl_gles_validate.h"
+#include "yagl_malloc.h"
+#include "yagl_state.h"
+#include "yagl_host_gles_calls.h"
+
+static void yagl_gles_framebuffer_reset_attachment(struct yagl_gles_framebuffer *fb,
+ int attachment)
+{
+ fb->attachment_states[attachment].type = GL_NONE;
+ fb->attachment_states[attachment].local_name = 0;
+ yagl_object_release(fb->attachment_states[attachment].obj);
+ fb->attachment_states[attachment].obj = NULL;
+ fb->attachment_states[attachment].textarget = 0;
+ fb->attachment_states[attachment].layer = 0;
+}
+
+static void yagl_gles_framebuffer_destroy(struct yagl_ref *ref)
+{
+ struct yagl_gles_framebuffer *fb = (struct yagl_gles_framebuffer*)ref;
+ int i;
+
+ for (i = 0;
+ i < (yagl_gles_framebuffer_attachment_color0 + YAGL_MAX_GLES_FRAMEBUFFER_COLOR_ATTACHMENTS);
+ ++i) {
+ yagl_gles_framebuffer_reset_attachment(fb, i);
+ }
+
+ yagl_host_glDeleteObjects(&fb->global_name, 1);
+
+ yagl_object_cleanup(&fb->base);
+
+ yagl_free(fb);
+}
+
+int yagl_gles_framebuffer_attachment_internalformat(struct yagl_gles_framebuffer_attachment_state *attachment_state,
+ GLenum *internalformat)
+{
+ switch (attachment_state->type) {
+ case GL_TEXTURE:
+ if (attachment_state->texture) {
+ *internalformat = attachment_state->texture->internalformat;
+ return 1;
+ }
+ break;
+ case GL_RENDERBUFFER:
+ if (attachment_state->rb) {
+ *internalformat = attachment_state->rb->internalformat;
+ return 1;
+ }
+ break;
+ }
+
+ return 0;
+}
+
+struct yagl_gles_framebuffer *yagl_gles_framebuffer_create(void)
+{
+ struct yagl_gles_framebuffer *fb;
+ int i;
+
+ fb = yagl_malloc0(sizeof(*fb));
+
+ yagl_object_init(&fb->base, &yagl_gles_framebuffer_destroy);
+
+ fb->global_name = yagl_get_global_name();
+
+ for (i = 0;
+ i < (yagl_gles_framebuffer_attachment_color0 + YAGL_MAX_GLES_FRAMEBUFFER_COLOR_ATTACHMENTS);
+ ++i) {
+ fb->attachment_states[i].type = GL_NONE;
+ }
+
+ fb->draw_buffers[0] = GL_COLOR_ATTACHMENT0;
+ for (i = 1; i < YAGL_MAX_GLES_FRAMEBUFFER_COLOR_ATTACHMENTS; ++i) {
+ fb->draw_buffers[i] = GL_NONE;
+ }
+ fb->read_buffer = GL_COLOR_ATTACHMENT0;
+
+ yagl_host_glGenFramebuffers(&fb->global_name, 1);
+
+ return fb;
+}
+
+void yagl_gles_framebuffer_acquire(struct yagl_gles_framebuffer *fb)
+{
+ if (fb) {
+ yagl_object_acquire(&fb->base);
+ }
+}
+
+void yagl_gles_framebuffer_release(struct yagl_gles_framebuffer *fb)
+{
+ if (fb) {
+ yagl_object_release(&fb->base);
+ }
+}
+
+void yagl_gles_framebuffer_renderbuffer(struct yagl_gles_framebuffer *fb,
+ GLenum target,
+ GLenum attachment,
+ yagl_gles_framebuffer_attachment framebuffer_attachment,
+ GLenum renderbuffer_target,
+ struct yagl_gles_renderbuffer *rb)
+{
+ yagl_gles_renderbuffer_acquire(rb);
+
+ yagl_gles_framebuffer_reset_attachment(fb, framebuffer_attachment);
+
+ if (rb) {
+ fb->attachment_states[framebuffer_attachment].type = GL_RENDERBUFFER;
+ fb->attachment_states[framebuffer_attachment].local_name = rb->base.local_name;
+ fb->attachment_states[framebuffer_attachment].rb = rb;
+ }
+
+ yagl_host_glFramebufferRenderbuffer(target,
+ attachment,
+ renderbuffer_target,
+ (rb ? rb->global_name : 0));
+}
+
+void yagl_gles_framebuffer_texture2d(struct yagl_gles_framebuffer *fb,
+ GLenum target,
+ GLenum attachment,
+ yagl_gles_framebuffer_attachment framebuffer_attachment,
+ GLenum textarget,
+ GLint level,
+ struct yagl_gles_texture *texture)
+{
+ yagl_gles_texture_acquire(texture);
+
+ yagl_gles_framebuffer_reset_attachment(fb, framebuffer_attachment);
+
+ if (texture) {
+ fb->attachment_states[framebuffer_attachment].type = GL_TEXTURE;
+ fb->attachment_states[framebuffer_attachment].local_name = texture->base.local_name;
+ fb->attachment_states[framebuffer_attachment].texture = texture;
+ fb->attachment_states[framebuffer_attachment].textarget = textarget;
+ }
+
+ yagl_host_glFramebufferTexture2D(target,
+ attachment,
+ textarget,
+ (texture ? texture->global_name : 0),
+ level);
+}
+
+void yagl_gles_framebuffer_texture_layer(struct yagl_gles_framebuffer *fb,
+ GLenum target,
+ GLenum attachment,
+ yagl_gles_framebuffer_attachment framebuffer_attachment,
+ struct yagl_gles_texture *texture,
+ GLint level,
+ GLint layer)
+{
+ yagl_gles_texture_acquire(texture);
+
+ yagl_gles_framebuffer_reset_attachment(fb, framebuffer_attachment);
+
+ if (texture) {
+ fb->attachment_states[framebuffer_attachment].type = GL_TEXTURE;
+ fb->attachment_states[framebuffer_attachment].local_name = texture->base.local_name;
+ fb->attachment_states[framebuffer_attachment].texture = texture;
+ fb->attachment_states[framebuffer_attachment].textarget = texture->target;
+ fb->attachment_states[framebuffer_attachment].layer = layer;
+ }
+
+ yagl_host_glFramebufferTextureLayer(target,
+ attachment,
+ (texture ? texture->global_name : 0),
+ level,
+ layer);
+}
+
+void yagl_gles_framebuffer_bind(struct yagl_gles_framebuffer *fb,
+ GLenum target)
+{
+ if (!fb) {
+ yagl_host_glBindFramebuffer(target, 0);
+ return;
+ }
+
+ yagl_host_glBindFramebuffer(target, fb->global_name);
+
+ fb->was_bound = 1;
+}
+
+int yagl_gles_framebuffer_was_bound(struct yagl_gles_framebuffer *fb)
+{
+ return fb->was_bound;
+}
+
+void yagl_gles_framebuffer_unbind_texture(struct yagl_gles_framebuffer *fb,
+ yagl_object_name texture_local_name)
+{
+ int i;
+
+ for (i = 0;
+ i < (yagl_gles_framebuffer_attachment_color0 + YAGL_MAX_GLES_FRAMEBUFFER_COLOR_ATTACHMENTS);
+ ++i) {
+ if ((fb->attachment_states[i].type == GL_TEXTURE) &&
+ fb->attachment_states[i].obj &&
+ (fb->attachment_states[i].obj->local_name == texture_local_name)) {
+ yagl_object_release(fb->attachment_states[i].obj);
+ fb->attachment_states[i].obj = NULL;
+ }
+ }
+}
+
+void yagl_gles_framebuffer_unbind_renderbuffer(struct yagl_gles_framebuffer *fb,
+ yagl_object_name rb_local_name)
+{
+ int i;
+
+ for (i = 0;
+ i < (yagl_gles_framebuffer_attachment_color0 + YAGL_MAX_GLES_FRAMEBUFFER_COLOR_ATTACHMENTS);
+ ++i) {
+ if ((fb->attachment_states[i].type == GL_RENDERBUFFER) &&
+ fb->attachment_states[i].obj &&
+ (fb->attachment_states[i].obj->local_name == rb_local_name)) {
+ yagl_object_release(fb->attachment_states[i].obj);
+ fb->attachment_states[i].obj = NULL;
+ }
+ }
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES_FRAMEBUFFER_H_
+#define _YAGL_GLES_FRAMEBUFFER_H_
+
+#include "yagl_gles_types.h"
+#include "yagl_object.h"
+
+struct yagl_gles_texture;
+struct yagl_gles_renderbuffer;
+
+struct yagl_gles_framebuffer_attachment_state
+{
+ GLenum type;
+
+ yagl_object_name local_name;
+
+ union
+ {
+ struct yagl_object *obj;
+ struct yagl_gles_texture *texture;
+ struct yagl_gles_renderbuffer *rb;
+ };
+
+ GLenum textarget;
+
+ GLint layer;
+};
+
+struct yagl_gles_framebuffer
+{
+ struct yagl_object base;
+
+ yagl_object_name global_name;
+
+ struct yagl_gles_framebuffer_attachment_state
+ attachment_states[yagl_gles_framebuffer_attachment_color0 +
+ YAGL_MAX_GLES_FRAMEBUFFER_COLOR_ATTACHMENTS];
+
+ GLenum draw_buffers[YAGL_MAX_GLES_FRAMEBUFFER_COLOR_ATTACHMENTS];
+ GLenum read_buffer;
+
+ int was_bound;
+};
+
+int yagl_gles_framebuffer_attachment_internalformat(struct yagl_gles_framebuffer_attachment_state *attachment_state,
+ GLenum *internalformat);
+
+struct yagl_gles_framebuffer *yagl_gles_framebuffer_create(void);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_gles_framebuffer_acquire(struct yagl_gles_framebuffer *fb);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_gles_framebuffer_release(struct yagl_gles_framebuffer *fb);
+
+void yagl_gles_framebuffer_renderbuffer(struct yagl_gles_framebuffer *fb,
+ GLenum target,
+ GLenum attachment,
+ yagl_gles_framebuffer_attachment framebuffer_attachment,
+ GLenum renderbuffer_target,
+ struct yagl_gles_renderbuffer *rb);
+
+void yagl_gles_framebuffer_texture2d(struct yagl_gles_framebuffer *fb,
+ GLenum target,
+ GLenum attachment,
+ yagl_gles_framebuffer_attachment framebuffer_attachment,
+ GLenum textarget,
+ GLint level,
+ struct yagl_gles_texture *texture);
+
+void yagl_gles_framebuffer_texture_layer(struct yagl_gles_framebuffer *fb,
+ GLenum target,
+ GLenum attachment,
+ yagl_gles_framebuffer_attachment framebuffer_attachment,
+ struct yagl_gles_texture *texture,
+ GLint level,
+ GLint layer);
+
+/*
+ * Assumes that 'target' is valid.
+ */
+void yagl_gles_framebuffer_bind(struct yagl_gles_framebuffer *fb,
+ GLenum target);
+
+int yagl_gles_framebuffer_was_bound(struct yagl_gles_framebuffer *fb);
+
+void yagl_gles_framebuffer_unbind_texture(struct yagl_gles_framebuffer *fb,
+ yagl_object_name texture_local_name);
+
+void yagl_gles_framebuffer_unbind_renderbuffer(struct yagl_gles_framebuffer *fb,
+ yagl_object_name rb_local_name);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GL/gl.h"
+#include "yagl_gles_image.h"
+#include "yagl_malloc.h"
+#include "yagl_host_gles_calls.h"
+
+static void yagl_gles_image_update(struct yagl_client_image *image,
+ uint32_t width,
+ uint32_t height,
+ uint32_t bpp,
+ const void *pixels)
+{
+ struct yagl_gles_image *gles_image = (struct yagl_gles_image*)image;
+
+ yagl_host_glUpdateOffscreenImageYAGL(gles_image->tex_global_name,
+ width,
+ height,
+ bpp,
+ pixels,
+ width * height * bpp);
+}
+
+static void yagl_gles_image_destroy(struct yagl_ref *ref)
+{
+ struct yagl_gles_image *image = (struct yagl_gles_image*)ref;
+
+ yagl_host_glDeleteObjects(&image->tex_global_name, 1);
+
+ yagl_client_image_cleanup(&image->base);
+
+ yagl_free(image);
+}
+
+struct yagl_gles_image *yagl_gles_image_create(yagl_object_name tex_global_name)
+{
+ struct yagl_gles_image *image;
+
+ image = yagl_malloc0(sizeof(*image));
+
+ yagl_client_image_init(&image->base, &yagl_gles_image_destroy);
+
+ image->base.update = &yagl_gles_image_update;
+
+ image->tex_global_name = tex_global_name;
+
+ return image;
+}
+
+void yagl_gles_image_acquire(struct yagl_gles_image *image)
+{
+ if (image) {
+ yagl_client_image_acquire(&image->base);
+ }
+}
+
+void yagl_gles_image_release(struct yagl_gles_image *image)
+{
+ if (image) {
+ yagl_client_image_release(&image->base);
+ }
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES_IMAGE_H_
+#define _YAGL_GLES_IMAGE_H_
+
+#include "yagl_types.h"
+#include "yagl_client_image.h"
+
+struct yagl_gles_image
+{
+ struct yagl_client_image base;
+
+ yagl_object_name tex_global_name;
+};
+
+struct yagl_gles_image *yagl_gles_image_create(yagl_object_name tex_global_name);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_gles_image_acquire(struct yagl_gles_image *image);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_gles_image_release(struct yagl_gles_image *image);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GL/gl.h"
+#include "GL/glext.h"
+#include "yagl_gles_pixel_formats.h"
+
+/*
+ * We can't include GLES2/gl2ext.h here
+ */
+#define GL_HALF_FLOAT_OES 0x8D61
+
+/*
+ * 1.0f in half-float.
+ */
+#define YAGL_HALF_FLOAT_1_0 0x3C00
+
+static void yagl_convert_alpha_ub_bgra_ub(const GLvoid *src,
+ GLsizei src_stride,
+ GLvoid *dst,
+ GLsizei dst_stride,
+ GLsizei width,
+ GLsizei height)
+{
+ GLsizei i, j;
+
+ for (i = 0; i < height; ++i) {
+ for (j = 0; j < width; ++j) {
+ *(uint32_t*)(dst + j * 4) = ((uint32_t)(*(uint8_t*)(src + j)) << 24);
+ }
+ src += src_stride;
+ dst += dst_stride;
+ }
+}
+
+static void yagl_convert_bgra_ub_alpha_ub(const GLvoid *src,
+ GLsizei src_stride,
+ GLvoid *dst,
+ GLsizei dst_stride,
+ GLsizei width,
+ GLsizei height)
+{
+ GLsizei i, j;
+
+ for (i = 0; i < height; ++i) {
+ for (j = 0; j < width; ++j) {
+ *(uint8_t*)(dst + j) = *(uint32_t*)(src + j * 4) >> 24;
+ }
+ src += src_stride;
+ dst += dst_stride;
+ }
+}
+
+static void yagl_convert_alpha_f_bgra_f(const GLvoid *src,
+ GLsizei src_stride,
+ GLvoid *dst,
+ GLsizei dst_stride,
+ GLsizei width,
+ GLsizei height)
+{
+ GLsizei i, j;
+
+ for (i = 0; i < height; ++i) {
+ for (j = 0; j < width; ++j) {
+ *(GLfloat*)(dst + j * 16 + 0) = 0.0f;
+ *(GLfloat*)(dst + j * 16 + 4) = 0.0f;
+ *(GLfloat*)(dst + j * 16 + 8) = 0.0f;
+ *(uint32_t*)(dst + j * 16 + 12) = *(uint32_t*)(src + j * 4);
+ }
+ src += src_stride;
+ dst += dst_stride;
+ }
+}
+
+static void yagl_convert_bgra_f_alpha_f(const GLvoid *src,
+ GLsizei src_stride,
+ GLvoid *dst,
+ GLsizei dst_stride,
+ GLsizei width,
+ GLsizei height)
+{
+ GLsizei i, j;
+
+ for (i = 0; i < height; ++i) {
+ for (j = 0; j < width; ++j) {
+ *(uint32_t*)(dst + j * 4) = *(uint32_t*)(src + j * 16 + 12);
+ }
+ src += src_stride;
+ dst += dst_stride;
+ }
+}
+
+static void yagl_convert_alpha_hf_bgra_hf(const GLvoid *src,
+ GLsizei src_stride,
+ GLvoid *dst,
+ GLsizei dst_stride,
+ GLsizei width,
+ GLsizei height)
+{
+ GLsizei i, j;
+
+ for (i = 0; i < height; ++i) {
+ for (j = 0; j < width; ++j) {
+ *(uint16_t*)(dst + j * 8 + 0) = 0;
+ *(uint16_t*)(dst + j * 8 + 2) = 0;
+ *(uint16_t*)(dst + j * 8 + 4) = 0;
+ *(uint16_t*)(dst + j * 8 + 6) = *(uint16_t*)(src + j * 2);
+ }
+ src += src_stride;
+ dst += dst_stride;
+ }
+}
+
+static void yagl_convert_bgra_hf_alpha_hf(const GLvoid *src,
+ GLsizei src_stride,
+ GLvoid *dst,
+ GLsizei dst_stride,
+ GLsizei width,
+ GLsizei height)
+{
+ GLsizei i, j;
+
+ for (i = 0; i < height; ++i) {
+ for (j = 0; j < width; ++j) {
+ *(uint16_t*)(dst + j * 2) = *(uint16_t*)(src + j * 8 + 6);
+ }
+ src += src_stride;
+ dst += dst_stride;
+ }
+}
+
+static void yagl_convert_luminance_ub_bgra_ub(const GLvoid *src,
+ GLsizei src_stride,
+ GLvoid *dst,
+ GLsizei dst_stride,
+ GLsizei width,
+ GLsizei height)
+{
+ GLsizei i, j;
+
+ for (i = 0; i < height; ++i) {
+ for (j = 0; j < width; ++j) {
+ uint32_t l = *(uint8_t*)(src + j);
+ *(uint32_t*)(dst + j * 4) = (l << 0) |
+ (l << 8) |
+ (l << 16) |
+ (255U << 24);
+ }
+ src += src_stride;
+ dst += dst_stride;
+ }
+}
+
+static void yagl_convert_bgra_ub_luminance_ub(const GLvoid *src,
+ GLsizei src_stride,
+ GLvoid *dst,
+ GLsizei dst_stride,
+ GLsizei width,
+ GLsizei height)
+{
+ GLsizei i, j;
+
+ for (i = 0; i < height; ++i) {
+ for (j = 0; j < width; ++j) {
+ *(uint8_t*)(dst + j) = *(uint32_t*)(src + j * 4) & 0xFF;
+ }
+ src += src_stride;
+ dst += dst_stride;
+ }
+}
+
+static void yagl_convert_luminance_f_bgra_f(const GLvoid *src,
+ GLsizei src_stride,
+ GLvoid *dst,
+ GLsizei dst_stride,
+ GLsizei width,
+ GLsizei height)
+{
+ GLsizei i, j;
+
+ for (i = 0; i < height; ++i) {
+ for (j = 0; j < width; ++j) {
+ uint32_t l = *(uint32_t*)(src + j * 4);
+ *(uint32_t*)(dst + j * 16 + 0) = l;
+ *(uint32_t*)(dst + j * 16 + 4) = l;
+ *(uint32_t*)(dst + j * 16 + 8) = l;
+ *(GLfloat*)(dst + j * 16 + 12) = 1.0f;
+ }
+ src += src_stride;
+ dst += dst_stride;
+ }
+}
+
+static void yagl_convert_bgra_f_luminance_f(const GLvoid *src,
+ GLsizei src_stride,
+ GLvoid *dst,
+ GLsizei dst_stride,
+ GLsizei width,
+ GLsizei height)
+{
+ GLsizei i, j;
+
+ for (i = 0; i < height; ++i) {
+ for (j = 0; j < width; ++j) {
+ *(uint32_t*)(dst + j * 4) = *(uint32_t*)(src + j * 16);
+ }
+ src += src_stride;
+ dst += dst_stride;
+ }
+}
+
+static void yagl_convert_luminance_hf_bgra_hf(const GLvoid *src,
+ GLsizei src_stride,
+ GLvoid *dst,
+ GLsizei dst_stride,
+ GLsizei width,
+ GLsizei height)
+{
+ GLsizei i, j;
+
+ for (i = 0; i < height; ++i) {
+ for (j = 0; j < width; ++j) {
+ uint16_t l = *(uint16_t*)(src + j * 2);
+ *(uint16_t*)(dst + j * 8 + 0) = l;
+ *(uint16_t*)(dst + j * 8 + 2) = l;
+ *(uint16_t*)(dst + j * 8 + 4) = l;
+ *(uint16_t*)(dst + j * 8 + 6) = YAGL_HALF_FLOAT_1_0;
+ }
+ src += src_stride;
+ dst += dst_stride;
+ }
+}
+
+static void yagl_convert_bgra_hf_luminance_hf(const GLvoid *src,
+ GLsizei src_stride,
+ GLvoid *dst,
+ GLsizei dst_stride,
+ GLsizei width,
+ GLsizei height)
+{
+ GLsizei i, j;
+
+ for (i = 0; i < height; ++i) {
+ for (j = 0; j < width; ++j) {
+ *(uint16_t*)(dst + j * 2) = *(uint16_t*)(src + j * 8);
+ }
+ src += src_stride;
+ dst += dst_stride;
+ }
+}
+
+static void yagl_convert_luminance_alpha_ub_bgra_ub(const GLvoid *src,
+ GLsizei src_stride,
+ GLvoid *dst,
+ GLsizei dst_stride,
+ GLsizei width,
+ GLsizei height)
+{
+ GLsizei i, j;
+
+ for (i = 0; i < height; ++i) {
+ for (j = 0; j < width; ++j) {
+ uint32_t l = *(uint8_t*)(src + j * 2 + 0);
+ uint32_t a = *(uint8_t*)(src + j * 2 + 1);
+ *(uint32_t*)(dst + j * 4) = (l << 0) |
+ (l << 8) |
+ (l << 16) |
+ (a << 24);
+ }
+ src += src_stride;
+ dst += dst_stride;
+ }
+}
+
+static void yagl_convert_bgra_ub_luminance_alpha_ub(const GLvoid *src,
+ GLsizei src_stride,
+ GLvoid *dst,
+ GLsizei dst_stride,
+ GLsizei width,
+ GLsizei height)
+{
+ GLsizei i, j;
+
+ for (i = 0; i < height; ++i) {
+ for (j = 0; j < width; ++j) {
+ *(uint8_t*)(dst + j * 2 + 0) = *(uint32_t*)(src + j * 4) & 0xFF;
+ *(uint8_t*)(dst + j * 2 + 1) = *(uint32_t*)(src + j * 4) >> 24;
+ }
+ src += src_stride;
+ dst += dst_stride;
+ }
+}
+
+static void yagl_convert_luminance_alpha_f_bgra_f(const GLvoid *src,
+ GLsizei src_stride,
+ GLvoid *dst,
+ GLsizei dst_stride,
+ GLsizei width,
+ GLsizei height)
+{
+ GLsizei i, j;
+
+ for (i = 0; i < height; ++i) {
+ for (j = 0; j < width; ++j) {
+ uint32_t l = *(uint32_t*)(src + j * 8 + 0);
+ uint32_t a = *(uint32_t*)(src + j * 8 + 4);
+ *(uint32_t*)(dst + j * 16 + 0) = l;
+ *(uint32_t*)(dst + j * 16 + 4) = l;
+ *(uint32_t*)(dst + j * 16 + 8) = l;
+ *(uint32_t*)(dst + j * 16 + 12) = a;
+ }
+ src += src_stride;
+ dst += dst_stride;
+ }
+}
+
+static void yagl_convert_bgra_f_luminance_alpha_f(const GLvoid *src,
+ GLsizei src_stride,
+ GLvoid *dst,
+ GLsizei dst_stride,
+ GLsizei width,
+ GLsizei height)
+{
+ GLsizei i, j;
+
+ for (i = 0; i < height; ++i) {
+ for (j = 0; j < width; ++j) {
+ *(uint32_t*)(dst + j * 8 + 0) = *(uint32_t*)(src + j * 16);
+ *(uint32_t*)(dst + j * 8 + 4) = *(uint32_t*)(src + j * 16 + 12);
+ }
+ src += src_stride;
+ dst += dst_stride;
+ }
+}
+
+static void yagl_convert_luminance_alpha_hf_bgra_hf(const GLvoid *src,
+ GLsizei src_stride,
+ GLvoid *dst,
+ GLsizei dst_stride,
+ GLsizei width,
+ GLsizei height)
+{
+ GLsizei i, j;
+
+ for (i = 0; i < height; ++i) {
+ for (j = 0; j < width; ++j) {
+ uint16_t l = *(uint16_t*)(src + j * 4 + 0);
+ uint16_t a = *(uint16_t*)(src + j * 4 + 2);
+ *(uint16_t*)(dst + j * 8 + 0) = l;
+ *(uint16_t*)(dst + j * 8 + 2) = l;
+ *(uint16_t*)(dst + j * 8 + 4) = l;
+ *(uint16_t*)(dst + j * 8 + 6) = a;
+ }
+ src += src_stride;
+ dst += dst_stride;
+ }
+}
+
+static void yagl_convert_bgra_hf_luminance_alpha_hf(const GLvoid *src,
+ GLsizei src_stride,
+ GLvoid *dst,
+ GLsizei dst_stride,
+ GLsizei width,
+ GLsizei height)
+{
+ GLsizei i, j;
+
+ for (i = 0; i < height; ++i) {
+ for (j = 0; j < width; ++j) {
+ *(uint16_t*)(dst + j * 4 + 0) = *(uint16_t*)(src + j * 8);
+ *(uint16_t*)(dst + j * 4 + 2) = *(uint16_t*)(src + j * 8 + 6);
+ }
+ src += src_stride;
+ dst += dst_stride;
+ }
+}
+
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles_gl2, GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE, GL_ALPHA, GL_UNSIGNED_BYTE, 1);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles_gl2, GL_ALPHA, GL_ALPHA, GL_FLOAT, GL_ALPHA, GL_FLOAT, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles_gl2, GL_ALPHA, GL_ALPHA, GL_HALF_FLOAT, GL_ALPHA, GL_HALF_FLOAT, 2);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles_gl2, GL_ALPHA, GL_ALPHA, GL_HALF_FLOAT_OES, GL_ALPHA, GL_HALF_FLOAT, 2);
+
+YAGL_PIXEL_FORMAT_IMPL_BEGIN(gles_gl3, GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE)
+ .src_bpp = 1,
+ .dst_internalformat = GL_RGBA,
+ .dst_format = GL_BGRA,
+ .dst_type = GL_UNSIGNED_BYTE,
+ .dst_bpp = 4,
+ .unpack = &yagl_convert_alpha_ub_bgra_ub,
+ .pack = &yagl_convert_bgra_ub_alpha_ub
+YAGL_PIXEL_FORMAT_IMPL_END()
+
+YAGL_PIXEL_FORMAT_IMPL_BEGIN(gles_gl3, GL_ALPHA, GL_ALPHA, GL_FLOAT)
+ .src_bpp = 4,
+ .dst_internalformat = GL_RGBA,
+ .dst_format = GL_BGRA,
+ .dst_type = GL_FLOAT,
+ .dst_bpp = 16,
+ .unpack = &yagl_convert_alpha_f_bgra_f,
+ .pack = &yagl_convert_bgra_f_alpha_f
+YAGL_PIXEL_FORMAT_IMPL_END()
+
+YAGL_PIXEL_FORMAT_IMPL_BEGIN(gles_gl3, GL_ALPHA, GL_ALPHA, GL_HALF_FLOAT)
+ .src_bpp = 2,
+ .dst_internalformat = GL_RGBA,
+ .dst_format = GL_BGRA,
+ .dst_type = GL_HALF_FLOAT,
+ .dst_bpp = 8,
+ .unpack = &yagl_convert_alpha_hf_bgra_hf,
+ .pack = &yagl_convert_bgra_hf_alpha_hf
+YAGL_PIXEL_FORMAT_IMPL_END()
+
+YAGL_PIXEL_FORMAT_IMPL_BEGIN(gles_gl3, GL_ALPHA, GL_ALPHA, GL_HALF_FLOAT_OES)
+ .src_bpp = 2,
+ .dst_internalformat = GL_RGBA,
+ .dst_format = GL_BGRA,
+ .dst_type = GL_HALF_FLOAT,
+ .dst_bpp = 8,
+ .unpack = &yagl_convert_alpha_hf_bgra_hf,
+ .pack = &yagl_convert_bgra_hf_alpha_hf
+YAGL_PIXEL_FORMAT_IMPL_END()
+
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles, GL_RGB, GL_RGB, GL_UNSIGNED_BYTE, GL_RGB, GL_UNSIGNED_BYTE, 3);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles, GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, 2);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles, GL_RGB, GL_RGB, GL_FLOAT, GL_RGB, GL_FLOAT, 12);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles, GL_RGB, GL_RGB, GL_HALF_FLOAT, GL_RGB, GL_HALF_FLOAT, 6);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles, GL_RGB, GL_RGB, GL_HALF_FLOAT_OES, GL_RGB, GL_HALF_FLOAT, 6);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, GL_RGBA, GL_UNSIGNED_BYTE, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, 2);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, 2);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles, GL_RGBA, GL_RGBA, GL_FLOAT, GL_RGBA, GL_FLOAT, 16);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles, GL_RGBA, GL_RGBA, GL_HALF_FLOAT, GL_RGBA, GL_HALF_FLOAT, 8);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles, GL_RGBA, GL_RGBA, GL_HALF_FLOAT_OES, GL_RGBA, GL_HALF_FLOAT, 8);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles, GL_BGRA, GL_BGRA, GL_UNSIGNED_BYTE, GL_RGBA, GL_UNSIGNED_BYTE, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles, GL_BGRA, GL_BGRA, GL_FLOAT, GL_RGBA, GL_FLOAT, 16);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles, GL_BGRA, GL_BGRA, GL_HALF_FLOAT, GL_RGBA, GL_HALF_FLOAT, 8);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles, GL_BGRA, GL_BGRA, GL_HALF_FLOAT_OES, GL_RGBA, GL_HALF_FLOAT, 8);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles_gl2, GL_LUMINANCE, GL_LUMINANCE, GL_UNSIGNED_BYTE, GL_LUMINANCE, GL_UNSIGNED_BYTE, 1);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles_gl2, GL_LUMINANCE, GL_LUMINANCE, GL_FLOAT, GL_LUMINANCE, GL_FLOAT, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles_gl2, GL_LUMINANCE, GL_LUMINANCE, GL_HALF_FLOAT, GL_LUMINANCE, GL_HALF_FLOAT, 2);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles_gl2, GL_LUMINANCE, GL_LUMINANCE, GL_HALF_FLOAT_OES, GL_LUMINANCE, GL_HALF_FLOAT, 2);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles_gl2, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, 2);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles_gl2, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_FLOAT, GL_LUMINANCE_ALPHA, GL_FLOAT, 8);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles_gl2, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles_gl2, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT_OES, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT, 4);
+
+YAGL_PIXEL_FORMAT_IMPL_BEGIN(gles_gl3, GL_LUMINANCE, GL_LUMINANCE, GL_UNSIGNED_BYTE)
+ .src_bpp = 1,
+ .dst_internalformat = GL_RGBA,
+ .dst_format = GL_BGRA,
+ .dst_type = GL_UNSIGNED_BYTE,
+ .dst_bpp = 4,
+ .unpack = &yagl_convert_luminance_ub_bgra_ub,
+ .pack = &yagl_convert_bgra_ub_luminance_ub
+YAGL_PIXEL_FORMAT_IMPL_END()
+
+YAGL_PIXEL_FORMAT_IMPL_BEGIN(gles_gl3, GL_LUMINANCE, GL_LUMINANCE, GL_FLOAT)
+ .src_bpp = 4,
+ .dst_internalformat = GL_RGBA,
+ .dst_format = GL_BGRA,
+ .dst_type = GL_FLOAT,
+ .dst_bpp = 16,
+ .unpack = &yagl_convert_luminance_f_bgra_f,
+ .pack = &yagl_convert_bgra_f_luminance_f
+YAGL_PIXEL_FORMAT_IMPL_END()
+
+YAGL_PIXEL_FORMAT_IMPL_BEGIN(gles_gl3, GL_LUMINANCE, GL_LUMINANCE, GL_HALF_FLOAT)
+ .src_bpp = 2,
+ .dst_internalformat = GL_RGBA,
+ .dst_format = GL_BGRA,
+ .dst_type = GL_HALF_FLOAT,
+ .dst_bpp = 8,
+ .unpack = &yagl_convert_luminance_hf_bgra_hf,
+ .pack = &yagl_convert_bgra_hf_luminance_hf
+YAGL_PIXEL_FORMAT_IMPL_END()
+
+YAGL_PIXEL_FORMAT_IMPL_BEGIN(gles_gl3, GL_LUMINANCE, GL_LUMINANCE, GL_HALF_FLOAT_OES)
+ .src_bpp = 2,
+ .dst_internalformat = GL_RGBA,
+ .dst_format = GL_BGRA,
+ .dst_type = GL_HALF_FLOAT,
+ .dst_bpp = 8,
+ .unpack = &yagl_convert_luminance_hf_bgra_hf,
+ .pack = &yagl_convert_bgra_hf_luminance_hf
+YAGL_PIXEL_FORMAT_IMPL_END()
+
+YAGL_PIXEL_FORMAT_IMPL_BEGIN(gles_gl3, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE)
+ .src_bpp = 2,
+ .dst_internalformat = GL_RGBA,
+ .dst_format = GL_BGRA,
+ .dst_type = GL_UNSIGNED_BYTE,
+ .dst_bpp = 4,
+ .unpack = &yagl_convert_luminance_alpha_ub_bgra_ub,
+ .pack = &yagl_convert_bgra_ub_luminance_alpha_ub
+YAGL_PIXEL_FORMAT_IMPL_END()
+
+YAGL_PIXEL_FORMAT_IMPL_BEGIN(gles_gl3, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_FLOAT)
+ .src_bpp = 8,
+ .dst_internalformat = GL_RGBA,
+ .dst_format = GL_BGRA,
+ .dst_type = GL_FLOAT,
+ .dst_bpp = 16,
+ .unpack = &yagl_convert_luminance_alpha_f_bgra_f,
+ .pack = &yagl_convert_bgra_f_luminance_alpha_f
+YAGL_PIXEL_FORMAT_IMPL_END()
+
+YAGL_PIXEL_FORMAT_IMPL_BEGIN(gles_gl3, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT)
+ .src_bpp = 4,
+ .dst_internalformat = GL_RGBA,
+ .dst_format = GL_BGRA,
+ .dst_type = GL_HALF_FLOAT,
+ .dst_bpp = 8,
+ .unpack = &yagl_convert_luminance_alpha_hf_bgra_hf,
+ .pack = &yagl_convert_bgra_hf_luminance_alpha_hf
+YAGL_PIXEL_FORMAT_IMPL_END()
+
+YAGL_PIXEL_FORMAT_IMPL_BEGIN(gles_gl3, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT_OES)
+ .src_bpp = 4,
+ .dst_internalformat = GL_RGBA,
+ .dst_format = GL_BGRA,
+ .dst_type = GL_HALF_FLOAT,
+ .dst_bpp = 8,
+ .unpack = &yagl_convert_luminance_alpha_hf_bgra_hf,
+ .pack = &yagl_convert_bgra_hf_luminance_alpha_hf
+YAGL_PIXEL_FORMAT_IMPL_END()
+
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, 2);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles, GL_DEPTH_STENCIL, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 4);
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES_PIXEL_FORMATS_H_
+#define _YAGL_GLES_PIXEL_FORMATS_H_
+
+#include "yagl_pixel_format.h"
+
+YAGL_PIXEL_FORMAT_DECL(gles_gl2, GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles_gl2, GL_ALPHA, GL_ALPHA, GL_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles_gl2, GL_ALPHA, GL_ALPHA, GL_HALF_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles_gl2, GL_ALPHA, GL_ALPHA, GL_HALF_FLOAT_OES);
+YAGL_PIXEL_FORMAT_DECL(gles_gl3, GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles_gl3, GL_ALPHA, GL_ALPHA, GL_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles_gl3, GL_ALPHA, GL_ALPHA, GL_HALF_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles_gl3, GL_ALPHA, GL_ALPHA, GL_HALF_FLOAT_OES);
+YAGL_PIXEL_FORMAT_DECL(gles, GL_RGB, GL_RGB, GL_UNSIGNED_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles, GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5);
+YAGL_PIXEL_FORMAT_DECL(gles, GL_RGB, GL_RGB, GL_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles, GL_RGB, GL_RGB, GL_HALF_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles, GL_RGB, GL_RGB, GL_HALF_FLOAT_OES);
+YAGL_PIXEL_FORMAT_DECL(gles, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4);
+YAGL_PIXEL_FORMAT_DECL(gles, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1);
+YAGL_PIXEL_FORMAT_DECL(gles, GL_RGBA, GL_RGBA, GL_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles, GL_RGBA, GL_RGBA, GL_HALF_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles, GL_RGBA, GL_RGBA, GL_HALF_FLOAT_OES);
+YAGL_PIXEL_FORMAT_DECL(gles, GL_BGRA, GL_BGRA, GL_UNSIGNED_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles, GL_BGRA, GL_BGRA, GL_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles, GL_BGRA, GL_BGRA, GL_HALF_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles, GL_BGRA, GL_BGRA, GL_HALF_FLOAT_OES);
+YAGL_PIXEL_FORMAT_DECL(gles_gl2, GL_LUMINANCE, GL_LUMINANCE, GL_UNSIGNED_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles_gl2, GL_LUMINANCE, GL_LUMINANCE, GL_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles_gl2, GL_LUMINANCE, GL_LUMINANCE, GL_HALF_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles_gl2, GL_LUMINANCE, GL_LUMINANCE, GL_HALF_FLOAT_OES);
+YAGL_PIXEL_FORMAT_DECL(gles_gl2, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles_gl2, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles_gl2, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles_gl2, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT_OES);
+YAGL_PIXEL_FORMAT_DECL(gles_gl3, GL_LUMINANCE, GL_LUMINANCE, GL_UNSIGNED_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles_gl3, GL_LUMINANCE, GL_LUMINANCE, GL_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles_gl3, GL_LUMINANCE, GL_LUMINANCE, GL_HALF_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles_gl3, GL_LUMINANCE, GL_LUMINANCE, GL_HALF_FLOAT_OES);
+YAGL_PIXEL_FORMAT_DECL(gles_gl3, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles_gl3, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles_gl3, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles_gl3, GL_LUMINANCE_ALPHA, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT_OES);
+YAGL_PIXEL_FORMAT_DECL(gles, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT);
+YAGL_PIXEL_FORMAT_DECL(gles, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT);
+YAGL_PIXEL_FORMAT_DECL(gles, GL_DEPTH_STENCIL, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GL/gl.h"
+#include "yagl_gles_renderbuffer.h"
+#include "yagl_malloc.h"
+#include "yagl_state.h"
+#include "yagl_host_gles_calls.h"
+
+static void yagl_gles_renderbuffer_destroy(struct yagl_ref *ref)
+{
+ struct yagl_gles_renderbuffer *rb = (struct yagl_gles_renderbuffer*)ref;
+
+ yagl_host_glDeleteObjects(&rb->global_name, 1);
+
+ yagl_object_cleanup(&rb->base);
+
+ yagl_free(rb);
+}
+
+struct yagl_gles_renderbuffer *yagl_gles_renderbuffer_create(void)
+{
+ struct yagl_gles_renderbuffer *rb;
+
+ rb = yagl_malloc0(sizeof(*rb));
+
+ yagl_object_init(&rb->base, &yagl_gles_renderbuffer_destroy);
+
+ rb->global_name = yagl_get_global_name();
+
+ yagl_host_glGenRenderbuffers(&rb->global_name, 1);
+
+ return rb;
+}
+
+void yagl_gles_renderbuffer_acquire(struct yagl_gles_renderbuffer *rb)
+{
+ if (rb) {
+ yagl_object_acquire(&rb->base);
+ }
+}
+
+void yagl_gles_renderbuffer_release(struct yagl_gles_renderbuffer *rb)
+{
+ if (rb) {
+ yagl_object_release(&rb->base);
+ }
+}
+
+void yagl_gles_renderbuffer_bind(struct yagl_gles_renderbuffer *rb,
+ GLenum target)
+{
+ if (!rb) {
+ yagl_host_glBindRenderbuffer(target, 0);
+ return;
+ }
+
+ yagl_host_glBindRenderbuffer(target, rb->global_name);
+
+ rb->was_bound = 1;
+}
+
+void yagl_gles_renderbuffer_set_internalformat(struct yagl_gles_renderbuffer *rb,
+ GLenum internalformat)
+{
+ rb->internalformat = internalformat;
+}
+
+int yagl_gles_renderbuffer_was_bound(struct yagl_gles_renderbuffer *rb)
+{
+ return rb->was_bound;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES_RENDERBUFFER_H_
+#define _YAGL_GLES_RENDERBUFFER_H_
+
+#include "yagl_types.h"
+#include "yagl_object.h"
+
+#define YAGL_NS_RENDERBUFFER 2
+
+struct yagl_gles_renderbuffer
+{
+ struct yagl_object base;
+
+ yagl_object_name global_name;
+
+ GLenum internalformat;
+
+ int was_bound;
+};
+
+struct yagl_gles_renderbuffer *yagl_gles_renderbuffer_create(void);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_gles_renderbuffer_acquire(struct yagl_gles_renderbuffer *rb);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_gles_renderbuffer_release(struct yagl_gles_renderbuffer *rb);
+
+/*
+ * Assumes that 'target' is valid.
+ */
+void yagl_gles_renderbuffer_bind(struct yagl_gles_renderbuffer *rb,
+ GLenum target);
+
+void yagl_gles_renderbuffer_set_internalformat(struct yagl_gles_renderbuffer *rb,
+ GLenum internalformat);
+
+int yagl_gles_renderbuffer_was_bound(struct yagl_gles_renderbuffer *rb);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GL/gl.h"
+#include "yagl_gles_sampler.h"
+#include "yagl_malloc.h"
+#include "yagl_state.h"
+#include "yagl_host_gles_calls.h"
+
+static void yagl_gles_sampler_destroy(struct yagl_ref *ref)
+{
+ struct yagl_gles_sampler *sampler = (struct yagl_gles_sampler*)ref;
+
+ yagl_host_glDeleteObjects(&sampler->global_name, 1);
+
+ yagl_object_cleanup(&sampler->base);
+
+ yagl_free(sampler);
+}
+
+struct yagl_gles_sampler *yagl_gles_sampler_create(void)
+{
+ struct yagl_gles_sampler *sampler;
+
+ sampler = yagl_malloc0(sizeof(*sampler));
+
+ yagl_object_init(&sampler->base, &yagl_gles_sampler_destroy);
+
+ sampler->global_name = yagl_get_global_name();
+
+ sampler->min_filter = GL_NEAREST_MIPMAP_LINEAR;
+ sampler->mag_filter = GL_LINEAR;
+ sampler->min_lod = -1000;
+ sampler->max_lod = -1000;
+ sampler->wrap_s = GL_REPEAT;
+ sampler->wrap_t = GL_REPEAT;
+ sampler->wrap_r = GL_REPEAT;
+ sampler->compare_mode = GL_NONE;
+ sampler->compare_func = GL_LEQUAL;
+
+ yagl_host_glGenSamplers(&sampler->global_name, 1);
+
+ return sampler;
+}
+
+void yagl_gles_sampler_acquire(struct yagl_gles_sampler *sampler)
+{
+ if (sampler) {
+ yagl_object_acquire(&sampler->base);
+ }
+}
+
+void yagl_gles_sampler_release(struct yagl_gles_sampler *sampler)
+{
+ if (sampler) {
+ yagl_object_release(&sampler->base);
+ }
+}
+
+void yagl_gles_sampler_bind(struct yagl_gles_sampler *sampler,
+ GLuint unit)
+{
+ if (!sampler) {
+ yagl_host_glBindSampler(unit, 0);
+ return;
+ }
+
+ yagl_host_glBindSampler(unit, sampler->global_name);
+}
+
+int yagl_gles_sampler_set_parameteriv(struct yagl_gles_sampler *sampler,
+ GLenum pname, const GLint *param)
+{
+ switch (pname) {
+ case GL_TEXTURE_MIN_FILTER:
+ sampler->min_filter = param[0];
+ break;
+ case GL_TEXTURE_MAG_FILTER:
+ sampler->mag_filter = param[0];
+ break;
+ case GL_TEXTURE_WRAP_S:
+ sampler->wrap_s = param[0];
+ break;
+ case GL_TEXTURE_WRAP_T:
+ sampler->wrap_t = param[0];
+ break;
+ case GL_TEXTURE_WRAP_R:
+ sampler->wrap_r = param[0];
+ break;
+ case GL_TEXTURE_COMPARE_MODE:
+ sampler->compare_mode = param[0];
+ break;
+ case GL_TEXTURE_COMPARE_FUNC:
+ sampler->compare_func = param[0];
+ break;
+ default:
+ return 0;
+ }
+
+ yagl_host_glSamplerParameteriv(sampler->global_name, pname, param, 1);
+
+ return 1;
+}
+
+int yagl_gles_sampler_set_parameterfv(struct yagl_gles_sampler *sampler,
+ GLenum pname, const GLfloat *param)
+{
+ switch (pname) {
+ case GL_TEXTURE_MIN_LOD:
+ sampler->min_lod = param[0];
+ break;
+ case GL_TEXTURE_MAX_LOD:
+ sampler->max_lod = param[0];
+ break;
+ default:
+ return 0;
+ }
+
+ yagl_host_glSamplerParameterfv(sampler->global_name, pname, param, 1);
+
+ return 1;
+}
+
+int yagl_gles_sampler_get_parameteriv(struct yagl_gles_sampler *sampler,
+ GLenum pname, GLint *param)
+{
+ switch (pname) {
+ case GL_TEXTURE_MIN_FILTER:
+ param[0] = sampler->min_filter;
+ break;
+ case GL_TEXTURE_MAG_FILTER:
+ param[0] = sampler->mag_filter;
+ break;
+ case GL_TEXTURE_WRAP_S:
+ param[0] = sampler->wrap_s;
+ break;
+ case GL_TEXTURE_WRAP_T:
+ param[0] = sampler->wrap_t;
+ break;
+ case GL_TEXTURE_WRAP_R:
+ param[0] = sampler->wrap_r;
+ break;
+ case GL_TEXTURE_COMPARE_MODE:
+ param[0] = sampler->compare_mode;
+ break;
+ case GL_TEXTURE_COMPARE_FUNC:
+ param[0] = sampler->compare_func;
+ break;
+ default:
+ return 0;
+ }
+
+ return 1;
+}
+
+int yagl_gles_sampler_get_parameterfv(struct yagl_gles_sampler *sampler,
+ GLenum pname, GLfloat *param)
+{
+ switch (pname) {
+ case GL_TEXTURE_MIN_LOD:
+ param[0] = sampler->min_lod;
+ break;
+ case GL_TEXTURE_MAX_LOD:
+ param[0] = sampler->max_lod;
+ break;
+ default:
+ return 0;
+ }
+
+ return 1;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES_SAMPLER_H_
+#define _YAGL_GLES_SAMPLER_H_
+
+#include "yagl_types.h"
+#include "yagl_object.h"
+
+#define YAGL_NS_SAMPLER 4
+
+struct yagl_gles_sampler
+{
+ struct yagl_object base;
+
+ yagl_object_name global_name;
+
+ GLenum min_filter;
+ GLenum mag_filter;
+ GLfloat min_lod;
+ GLfloat max_lod;
+ GLenum wrap_s;
+ GLenum wrap_t;
+ GLenum wrap_r;
+ GLenum compare_mode;
+ GLenum compare_func;
+};
+
+struct yagl_gles_sampler *yagl_gles_sampler_create(void);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_gles_sampler_acquire(struct yagl_gles_sampler *sampler);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_gles_sampler_release(struct yagl_gles_sampler *sampler);
+
+void yagl_gles_sampler_bind(struct yagl_gles_sampler *sampler,
+ GLuint unit);
+
+int yagl_gles_sampler_set_parameteriv(struct yagl_gles_sampler *sampler,
+ GLenum pname, const GLint *param);
+
+int yagl_gles_sampler_set_parameterfv(struct yagl_gles_sampler *sampler,
+ GLenum pname, const GLfloat *param);
+
+int yagl_gles_sampler_get_parameteriv(struct yagl_gles_sampler *sampler,
+ GLenum pname, GLint *param);
+
+int yagl_gles_sampler_get_parameterfv(struct yagl_gles_sampler *sampler,
+ GLenum pname, GLfloat *param);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GL/gl.h"
+#include "yagl_gles_texture.h"
+#include "yagl_gles_image.h"
+#include "yagl_tex_image_binding.h"
+#include "yagl_malloc.h"
+#include "yagl_state.h"
+#include "yagl_host_gles_calls.h"
+#include <assert.h>
+
+/*
+ * We can't include GLES2/gl2ext.h here
+ */
+#define GL_HALF_FLOAT_OES 0x8D61
+
+static void yagl_gles_texture_swizzle(struct yagl_gles_texture *texture,
+ GLenum internalformat)
+{
+ switch (internalformat) {
+ case GL_ALPHA:
+ yagl_host_glTexParameteri(texture->target, GL_TEXTURE_SWIZZLE_R, GL_ZERO);
+ yagl_host_glTexParameteri(texture->target, GL_TEXTURE_SWIZZLE_G, GL_ZERO);
+ yagl_host_glTexParameteri(texture->target, GL_TEXTURE_SWIZZLE_B, GL_ZERO);
+ yagl_host_glTexParameteri(texture->target, GL_TEXTURE_SWIZZLE_A, GL_ALPHA);
+ texture->is_swizzled = 1;
+ break;
+ case GL_LUMINANCE:
+ yagl_host_glTexParameteri(texture->target, GL_TEXTURE_SWIZZLE_R, GL_RED);
+ yagl_host_glTexParameteri(texture->target, GL_TEXTURE_SWIZZLE_G, GL_RED);
+ yagl_host_glTexParameteri(texture->target, GL_TEXTURE_SWIZZLE_B, GL_RED);
+ yagl_host_glTexParameteri(texture->target, GL_TEXTURE_SWIZZLE_A, GL_ONE);
+ texture->is_swizzled = 1;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ yagl_host_glTexParameteri(texture->target, GL_TEXTURE_SWIZZLE_R, GL_RED);
+ yagl_host_glTexParameteri(texture->target, GL_TEXTURE_SWIZZLE_G, GL_RED);
+ yagl_host_glTexParameteri(texture->target, GL_TEXTURE_SWIZZLE_B, GL_RED);
+ yagl_host_glTexParameteri(texture->target, GL_TEXTURE_SWIZZLE_A, GL_ALPHA);
+ texture->is_swizzled = 1;
+ break;
+ case GL_DEPTH_COMPONENT16:
+ case GL_DEPTH_COMPONENT24:
+ case GL_DEPTH_COMPONENT32:
+ case GL_DEPTH_COMPONENT32F:
+ case GL_DEPTH24_STENCIL8:
+ case GL_DEPTH32F_STENCIL8:
+ yagl_host_glTexParameteri(texture->target, GL_TEXTURE_SWIZZLE_R, GL_RED);
+ yagl_host_glTexParameteri(texture->target, GL_TEXTURE_SWIZZLE_G, GL_ZERO);
+ yagl_host_glTexParameteri(texture->target, GL_TEXTURE_SWIZZLE_B, GL_ZERO);
+ yagl_host_glTexParameteri(texture->target, GL_TEXTURE_SWIZZLE_A, GL_ONE);
+ texture->is_swizzled = 1;
+ break;
+ default:
+ if (texture->is_swizzled) {
+ /*
+ * Unswizzle if it was swizzled.
+ */
+ yagl_host_glTexParameteri(texture->target, GL_TEXTURE_SWIZZLE_R, GL_RED);
+ yagl_host_glTexParameteri(texture->target, GL_TEXTURE_SWIZZLE_G, GL_GREEN);
+ yagl_host_glTexParameteri(texture->target, GL_TEXTURE_SWIZZLE_B, GL_BLUE);
+ yagl_host_glTexParameteri(texture->target, GL_TEXTURE_SWIZZLE_A, GL_ALPHA);
+ texture->is_swizzled = 0;
+ }
+ break;
+ }
+}
+
+static void yagl_gles_texture_destroy(struct yagl_ref *ref)
+{
+ struct yagl_gles_texture *texture = (struct yagl_gles_texture*)ref;
+
+ if (texture->binding) {
+ texture->binding->unbind(texture->binding);
+ texture->binding = NULL;
+ }
+
+ if (texture->image) {
+ yagl_gles_image_release(texture->image);
+ texture->image = NULL;
+ } else {
+ yagl_host_glDeleteObjects(&texture->global_name, 1);
+ }
+
+ yagl_object_cleanup(&texture->base);
+
+ yagl_free(texture);
+}
+
+struct yagl_gles_texture *yagl_gles_texture_create(void)
+{
+ struct yagl_gles_texture *texture;
+
+ texture = yagl_malloc0(sizeof(*texture));
+
+ yagl_object_init(&texture->base, &yagl_gles_texture_destroy);
+
+ texture->global_name = yagl_get_global_name();
+ texture->min_filter = GL_NEAREST_MIPMAP_LINEAR;
+ texture->mag_filter = GL_LINEAR;
+
+ yagl_host_glGenTextures(&texture->global_name, 1);
+
+ return texture;
+}
+
+void yagl_gles_texture_acquire(struct yagl_gles_texture *texture)
+{
+ if (texture) {
+ yagl_object_acquire(&texture->base);
+ }
+}
+
+void yagl_gles_texture_release(struct yagl_gles_texture *texture)
+{
+ if (texture) {
+ yagl_object_release(&texture->base);
+ }
+}
+
+int yagl_gles_texture_bind(struct yagl_gles_texture *texture,
+ GLenum target)
+{
+ if (texture->target && (texture->target != target)) {
+ return 0;
+ }
+
+ yagl_host_glBindTexture(target, texture->global_name);
+
+ texture->target = target;
+
+ return 1;
+}
+
+void yagl_gles_texture_set_internalformat(struct yagl_gles_texture *texture,
+ GLenum internalformat,
+ GLenum type,
+ int swizzle)
+{
+ texture->internalformat = internalformat;
+
+ switch (type) {
+ case GL_FLOAT:
+ case GL_HALF_FLOAT:
+ case GL_HALF_FLOAT_OES:
+ texture->is_float = 1;
+ break;
+ default:
+ texture->is_float = 0;
+ break;
+ }
+
+ if (swizzle) {
+ yagl_gles_texture_swizzle(texture, internalformat);
+ }
+}
+
+void yagl_gles_texture_set_immutable(struct yagl_gles_texture *texture,
+ GLenum internalformat,
+ GLenum type,
+ int swizzle)
+{
+ texture->immutable = GL_TRUE;
+ texture->internalformat = internalformat;
+
+ switch (type) {
+ case GL_FLOAT:
+ case GL_HALF_FLOAT:
+ case GL_HALF_FLOAT_OES:
+ texture->is_float = 1;
+ break;
+ default:
+ texture->is_float = 0;
+ break;
+ }
+
+ if (swizzle) {
+ yagl_gles_texture_swizzle(texture, internalformat);
+ }
+}
+
+int yagl_gles_texture_color_renderable(struct yagl_gles_texture *texture)
+{
+ if (!texture->is_float) {
+ return 1;
+ }
+
+ switch (texture->min_filter) {
+ case GL_NEAREST:
+ case GL_NEAREST_MIPMAP_NEAREST:
+ break;
+ default:
+ return 0;
+ }
+
+ switch (texture->mag_filter) {
+ case GL_NEAREST:
+ break;
+ default:
+ return 0;
+ }
+
+ return 1;
+}
+
+void yagl_gles_texture_set_image(struct yagl_gles_texture *texture,
+ struct yagl_gles_image *image)
+{
+ assert(texture->target);
+ assert(image);
+
+ if (texture->binding) {
+ texture->binding->unbind(texture->binding);
+ texture->binding = NULL;
+ }
+
+ if (texture->image == image) {
+ return;
+ }
+
+ yagl_gles_image_acquire(image);
+
+ if (texture->image) {
+ yagl_gles_image_release(texture->image);
+ } else {
+ yagl_host_glDeleteObjects(&texture->global_name, 1);
+ }
+
+ texture->global_name = image->tex_global_name;
+ texture->image = image;
+
+ yagl_host_glBindTexture(texture->target, texture->global_name);
+}
+
+void yagl_gles_texture_unset_image(struct yagl_gles_texture *texture)
+{
+ if (texture->binding) {
+ texture->binding->unbind(texture->binding);
+ texture->binding = NULL;
+ }
+
+ if (texture->image) {
+ yagl_gles_image_release(texture->image);
+ texture->image = NULL;
+
+ texture->global_name = yagl_get_global_name();
+
+ yagl_host_glGenTextures(&texture->global_name, 1);
+ yagl_host_glBindTexture(texture->target, texture->global_name);
+ }
+}
+
+void yagl_gles_texture_bind_tex_image(struct yagl_gles_texture *texture,
+ struct yagl_gles_image *image,
+ struct yagl_tex_image_binding *binding)
+{
+ assert(texture->target);
+ assert(image);
+
+ if (texture->binding) {
+ texture->binding->unbind(texture->binding);
+ texture->binding = NULL;
+ }
+
+ yagl_gles_image_acquire(image);
+
+ if (texture->image) {
+ yagl_gles_image_release(texture->image);
+ } else {
+ yagl_host_glDeleteObjects(&texture->global_name, 1);
+ }
+
+ texture->global_name = image->tex_global_name;
+ texture->image = image;
+ texture->binding = binding;
+
+ yagl_host_glBindTexture(texture->target, texture->global_name);
+}
+
+/*
+ * Can be called with an arbitrary context being set, careful.
+ */
+void yagl_gles_texture_release_tex_image(struct yagl_gles_texture *texture)
+{
+ assert(texture->image);
+
+ texture->binding = NULL;
+
+ yagl_gles_image_release(texture->image);
+ texture->image = NULL;
+
+ texture->global_name = yagl_get_global_name();
+
+ /*
+ * Must ensure context on host for this call!
+ */
+ yagl_host_glGenTextures(&texture->global_name, 1);
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES_TEXTURE_H_
+#define _YAGL_GLES_TEXTURE_H_
+
+#include "yagl_types.h"
+#include "yagl_object.h"
+
+#define YAGL_NS_TEXTURE 1
+
+struct yagl_gles_image;
+struct yagl_tex_image_binding;
+
+struct yagl_gles_texture
+{
+ struct yagl_object base;
+
+ yagl_object_name global_name;
+
+ GLenum target;
+
+ GLenum internalformat;
+ int is_float;
+ int is_swizzled;
+
+ GLboolean immutable;
+
+ GLenum min_filter;
+ GLenum mag_filter;
+
+ /*
+ * Non-NULL if it's an EGLImage/eglBindTexImage target.
+ */
+ struct yagl_gles_image *image;
+
+ /*
+ * Non-NULL if it's an eglBindTexImage target.
+ */
+ struct yagl_tex_image_binding *binding;
+};
+
+struct yagl_gles_texture *yagl_gles_texture_create(void);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_gles_texture_acquire(struct yagl_gles_texture *texture);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_gles_texture_release(struct yagl_gles_texture *texture);
+
+/*
+ * Assumes that 'target' is valid.
+ */
+int yagl_gles_texture_bind(struct yagl_gles_texture *texture,
+ GLenum target);
+
+void yagl_gles_texture_set_internalformat(struct yagl_gles_texture *texture,
+ GLenum internalformat,
+ GLenum type,
+ int swizzle);
+
+void yagl_gles_texture_set_immutable(struct yagl_gles_texture *texture,
+ GLenum internalformat,
+ GLenum type,
+ int swizzle);
+
+int yagl_gles_texture_color_renderable(struct yagl_gles_texture *texture);
+
+void yagl_gles_texture_set_image(struct yagl_gles_texture *texture,
+ struct yagl_gles_image *image);
+
+void yagl_gles_texture_unset_image(struct yagl_gles_texture *texture);
+
+void yagl_gles_texture_bind_tex_image(struct yagl_gles_texture *texture,
+ struct yagl_gles_image *image,
+ struct yagl_tex_image_binding *binding);
+
+/*
+ * Can be called with an arbitrary context being set, careful.
+ */
+void yagl_gles_texture_release_tex_image(struct yagl_gles_texture *texture);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GL/gl.h"
+#include "GL/glext.h"
+#include "yagl_gles_texture_unit.h"
+#include "yagl_gles_texture.h"
+#include "yagl_gles_sampler.h"
+#include <string.h>
+
+static const GLenum target_map[] =
+{
+ GL_TEXTURE_2D,
+ GL_TEXTURE_2D_ARRAY,
+ GL_TEXTURE_3D,
+ GL_TEXTURE_CUBE_MAP
+};
+
+void yagl_gles_texture_unit_init(struct yagl_gles_texture_unit *texture_unit,
+ struct yagl_sharegroup *sg)
+{
+ memset(texture_unit, 0, sizeof(*texture_unit));
+
+ int i;
+
+ for (i = 0; i < YAGL_NUM_TEXTURE_TARGETS; ++i) {
+ if (sg->texture_zero[i]) {
+ yagl_object_acquire(sg->texture_zero[i]);
+ texture_unit->target_states[i].texture_zero = (struct yagl_gles_texture*)sg->texture_zero[i];
+ } else {
+ texture_unit->target_states[i].texture_zero = yagl_gles_texture_create();
+ sg->texture_zero[i] = &texture_unit->target_states[i].texture_zero->base;
+ yagl_object_acquire(sg->texture_zero[i]);
+ }
+
+ yagl_gles_texture_bind(texture_unit->target_states[i].texture_zero,
+ target_map[i]);
+
+ yagl_gles_texture_acquire(texture_unit->target_states[i].texture_zero);
+ texture_unit->target_states[i].texture =
+ texture_unit->target_states[i].texture_zero;
+ }
+}
+
+void yagl_gles_texture_unit_cleanup(struct yagl_gles_texture_unit *texture_unit)
+{
+ int i;
+
+ for (i = 0; i < YAGL_NUM_TEXTURE_TARGETS; ++i) {
+ yagl_gles_texture_release(texture_unit->target_states[i].texture);
+ yagl_gles_texture_release(texture_unit->target_states[i].texture_zero);
+ }
+
+ yagl_gles_sampler_release(texture_unit->sampler);
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES_TEXTURE_UNIT_H_
+#define _YAGL_GLES_TEXTURE_UNIT_H_
+
+#include "yagl_gles_types.h"
+#include "yagl_sharegroup.h"
+
+struct yagl_gles_texture;
+struct yagl_gles_sampler;
+
+struct yagl_gles_texture_target_state
+{
+ struct yagl_gles_texture *texture;
+
+ /*
+ * For GLESv1 only. In GLESv2 2D texture and cubemap textures cannot be
+ * enabled/disabled. Currently not used.
+ */
+ int enabled;
+
+ struct yagl_gles_texture *texture_zero;
+};
+
+struct yagl_gles_texture_unit
+{
+ struct yagl_gles_texture_target_state target_states[YAGL_NUM_TEXTURE_TARGETS];
+
+ struct yagl_gles_sampler *sampler;
+};
+
+void yagl_gles_texture_unit_init(struct yagl_gles_texture_unit *texture_unit,
+ struct yagl_sharegroup *sg);
+
+void yagl_gles_texture_unit_cleanup(struct yagl_gles_texture_unit *texture_unit);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES_TYPES_H_
+#define _YAGL_GLES_TYPES_H_
+
+#include "yagl_types.h"
+
+struct yagl_gles_buffer;
+
+typedef enum
+{
+ yagl_gles_texture_target_2d = 0,
+ yagl_gles_texture_target_2d_array = 1,
+ yagl_gles_texture_target_3d = 2,
+ yagl_gles_texture_target_cubemap = 3
+} yagl_gles_texture_target;
+
+typedef enum
+{
+ yagl_gles_framebuffer_attachment_depth = 0,
+ yagl_gles_framebuffer_attachment_stencil = 1,
+ yagl_gles_framebuffer_attachment_color0 = 2
+} yagl_gles_framebuffer_attachment;
+
+#define YAGL_MAX_GLES_FRAMEBUFFER_COLOR_ATTACHMENTS 16
+
+typedef enum
+{
+ yagl_gles_format_color_renderable = (1 << 0),
+ yagl_gles_format_depth_renderable = (1 << 1),
+ yagl_gles_format_stencil_renderable = (1 << 2),
+ yagl_gles_format_sized = (1 << 3),
+ yagl_gles_format_signed_integer = (1 << 4),
+ yagl_gles_format_unsigned_integer = (1 << 5),
+ yagl_gles_format_float = (1 << 6),
+ yagl_gles_format_srgb = (1 << 7)
+} yagl_gles_format_flag;
+
+struct yagl_gles_pixelstore
+{
+ GLint alignment;
+ GLint row_length;
+ GLint image_height;
+ GLint skip_pixels;
+ GLint skip_rows;
+ GLint skip_images;
+ struct yagl_gles_buffer *pbo;
+};
+
+struct yagl_gles_format_info
+{
+ uint32_t flags;
+ uint32_t num_components;
+ uint32_t red_size;
+ uint32_t green_size;
+ uint32_t blue_size;
+ uint32_t alpha_size;
+ uint32_t depth_size;
+ uint32_t stencil_size;
+};
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GLES3/gl3.h"
+#include "GLES2/gl2ext.h"
+#include "yagl_gles_utils.h"
+#include "yagl_host_gles_calls.h"
+#include <assert.h>
+
+/*
+ * We can't include GL/glext.h here
+ */
+#define GL_DEPTH_COMPONENT32 0x81A7
+#define GL_BGRA 0x80E1
+
+#define YAGL_INTERNALFORMAT_R(arg_internalformat, \
+ arg_flags, \
+ arg_red_size) \
+static const struct yagl_gles_format_info internalformat_##arg_internalformat = \
+{ \
+ .flags = arg_flags, \
+ .num_components = 1, \
+ .red_size = arg_red_size, \
+ .green_size = 0, \
+ .blue_size = 0, \
+ .alpha_size = 0, \
+ .depth_size = 0, \
+ .stencil_size = 0 \
+}
+
+#define YAGL_INTERNALFORMAT_RG(arg_internalformat, \
+ arg_flags, \
+ arg_red_size, \
+ arg_green_size) \
+static const struct yagl_gles_format_info internalformat_##arg_internalformat = \
+{ \
+ .flags = arg_flags, \
+ .num_components = 2, \
+ .red_size = arg_red_size, \
+ .green_size = arg_green_size, \
+ .blue_size = 0, \
+ .alpha_size = 0, \
+ .depth_size = 0, \
+ .stencil_size = 0 \
+}
+
+#define YAGL_INTERNALFORMAT_RGB(arg_internalformat, \
+ arg_flags, \
+ arg_red_size, \
+ arg_green_size, \
+ arg_blue_size) \
+static const struct yagl_gles_format_info internalformat_##arg_internalformat = \
+{ \
+ .flags = arg_flags, \
+ .num_components = 3, \
+ .red_size = arg_red_size, \
+ .green_size = arg_green_size, \
+ .blue_size = arg_blue_size, \
+ .alpha_size = 0, \
+ .depth_size = 0, \
+ .stencil_size = 0 \
+}
+
+#define YAGL_INTERNALFORMAT_RGBA(arg_internalformat, \
+ arg_flags, \
+ arg_red_size, \
+ arg_green_size, \
+ arg_blue_size, \
+ arg_alpha_size) \
+static const struct yagl_gles_format_info internalformat_##arg_internalformat = \
+{ \
+ .flags = arg_flags, \
+ .num_components = 4, \
+ .red_size = arg_red_size, \
+ .green_size = arg_green_size, \
+ .blue_size = arg_blue_size, \
+ .alpha_size = arg_alpha_size, \
+ .depth_size = 0, \
+ .stencil_size = 0 \
+}
+
+#define YAGL_INTERNALFORMAT_DEPTH(arg_internalformat, \
+ arg_flags, \
+ arg_depth_size) \
+static const struct yagl_gles_format_info internalformat_##arg_internalformat = \
+{ \
+ .flags = arg_flags, \
+ .num_components = 1, \
+ .red_size = 0, \
+ .green_size = 0, \
+ .blue_size = 0, \
+ .alpha_size = 0, \
+ .depth_size = arg_depth_size, \
+ .stencil_size = 0 \
+}
+
+#define YAGL_INTERNALFORMAT_STENCIL(arg_internalformat, \
+ arg_flags, \
+ arg_stencil_size) \
+static const struct yagl_gles_format_info internalformat_##arg_internalformat = \
+{ \
+ .flags = arg_flags, \
+ .num_components = 1, \
+ .red_size = 0, \
+ .green_size = 0, \
+ .blue_size = 0, \
+ .alpha_size = 0, \
+ .depth_size = 0, \
+ .stencil_size = arg_stencil_size \
+}
+
+#define YAGL_INTERNALFORMAT_DEPTH_STENCIL(arg_internalformat, \
+ arg_flags, \
+ arg_depth_size, \
+ arg_stencil_size) \
+static const struct yagl_gles_format_info internalformat_##arg_internalformat = \
+{ \
+ .flags = arg_flags, \
+ .num_components = 2, \
+ .red_size = 0, \
+ .green_size = 0, \
+ .blue_size = 0, \
+ .alpha_size = 0, \
+ .depth_size = arg_depth_size, \
+ .stencil_size = arg_stencil_size \
+}
+
+static const struct yagl_gles_format_info internalformat_0 =
+{
+ .flags = 0,
+ .num_components = 4,
+ .red_size = 8,
+ .green_size = 8,
+ .blue_size = 8,
+ .alpha_size = 8,
+ .depth_size = 0,
+ .stencil_size = 0
+};
+
+static const struct yagl_gles_format_info internalformat_GL_ALPHA =
+{
+ .flags = 0,
+ .num_components = 1,
+ .red_size = 0,
+ .green_size = 0,
+ .blue_size = 0,
+ .alpha_size = 8,
+ .depth_size = 0,
+ .stencil_size = 0
+};
+
+static const struct yagl_gles_format_info internalformat_GL_LUMINANCE =
+{
+ .flags = 0,
+ .num_components = 1,
+ .red_size = 0,
+ .green_size = 0,
+ .blue_size = 0,
+ .alpha_size = 0,
+ .depth_size = 0,
+ .stencil_size = 0
+};
+
+static const struct yagl_gles_format_info internalformat_GL_LUMINANCE_ALPHA =
+{
+ .flags = 0,
+ .num_components = 2,
+ .red_size = 0,
+ .green_size = 0,
+ .blue_size = 0,
+ .alpha_size = 8,
+ .depth_size = 0,
+ .stencil_size = 0
+};
+
+YAGL_INTERNALFORMAT_R(GL_RED, yagl_gles_format_color_renderable, 8);
+YAGL_INTERNALFORMAT_RG(GL_RG, yagl_gles_format_color_renderable, 8, 8);
+YAGL_INTERNALFORMAT_RGB(GL_RGB, yagl_gles_format_color_renderable, 8, 8, 8);
+YAGL_INTERNALFORMAT_RGBA(GL_RGBA, yagl_gles_format_color_renderable, 8, 8, 8, 8);
+YAGL_INTERNALFORMAT_RGBA(GL_BGRA, yagl_gles_format_color_renderable, 8, 8, 8, 8);
+YAGL_INTERNALFORMAT_R(GL_R8_SNORM, yagl_gles_format_sized, 8);
+YAGL_INTERNALFORMAT_RG(GL_RG8_SNORM, yagl_gles_format_sized, 8, 8);
+YAGL_INTERNALFORMAT_RGB(GL_RGB8_SNORM, yagl_gles_format_sized, 8, 8, 8);
+YAGL_INTERNALFORMAT_RGBA(GL_RGBA8_SNORM, yagl_gles_format_sized, 8, 8, 8, 8);
+YAGL_INTERNALFORMAT_RGB(GL_RGB9_E5, yagl_gles_format_sized, 9, 9, 9);
+YAGL_INTERNALFORMAT_RGB(GL_SRGB8, yagl_gles_format_sized | yagl_gles_format_srgb, 8, 8, 8);
+YAGL_INTERNALFORMAT_RGB(GL_RGB8UI, yagl_gles_format_sized | yagl_gles_format_unsigned_integer, 8, 8, 8);
+YAGL_INTERNALFORMAT_RGB(GL_RGB16UI, yagl_gles_format_sized | yagl_gles_format_unsigned_integer, 8, 8, 8);
+YAGL_INTERNALFORMAT_RGB(GL_RGB32UI, yagl_gles_format_sized | yagl_gles_format_unsigned_integer, 8, 8, 8);
+YAGL_INTERNALFORMAT_RGB(GL_RGB8I, yagl_gles_format_sized | yagl_gles_format_signed_integer, 8, 8, 8);
+YAGL_INTERNALFORMAT_RGB(GL_RGB16I, yagl_gles_format_sized | yagl_gles_format_signed_integer, 8, 8, 8);
+YAGL_INTERNALFORMAT_RGB(GL_RGB32I, yagl_gles_format_sized | yagl_gles_format_signed_integer, 8, 8, 8);
+YAGL_INTERNALFORMAT_R(GL_R8, yagl_gles_format_sized | yagl_gles_format_color_renderable, 8);
+YAGL_INTERNALFORMAT_RG(GL_RG8, yagl_gles_format_sized | yagl_gles_format_color_renderable, 8, 8);
+YAGL_INTERNALFORMAT_RGB(GL_RGB8, yagl_gles_format_sized | yagl_gles_format_color_renderable, 8, 8, 8);
+YAGL_INTERNALFORMAT_RGB(GL_RGB565, yagl_gles_format_sized | yagl_gles_format_color_renderable, 5, 6, 5);
+YAGL_INTERNALFORMAT_RGBA(GL_RGBA8, yagl_gles_format_sized | yagl_gles_format_color_renderable, 8, 8, 8, 8);
+YAGL_INTERNALFORMAT_RGBA(GL_RGB5_A1, yagl_gles_format_sized | yagl_gles_format_color_renderable, 5, 5, 5, 1);
+YAGL_INTERNALFORMAT_RGBA(GL_RGBA4, yagl_gles_format_sized | yagl_gles_format_color_renderable, 4, 4, 4, 4);
+YAGL_INTERNALFORMAT_RGBA(GL_RGB10_A2, yagl_gles_format_sized | yagl_gles_format_color_renderable, 10, 10, 10, 2);
+YAGL_INTERNALFORMAT_RGBA(GL_SRGB8_ALPHA8, yagl_gles_format_sized | yagl_gles_format_color_renderable | yagl_gles_format_srgb, 8, 8, 8, 8);
+YAGL_INTERNALFORMAT_R(GL_R8UI, yagl_gles_format_sized | yagl_gles_format_color_renderable | yagl_gles_format_unsigned_integer, 8);
+YAGL_INTERNALFORMAT_R(GL_R16UI, yagl_gles_format_sized | yagl_gles_format_color_renderable | yagl_gles_format_unsigned_integer, 16);
+YAGL_INTERNALFORMAT_R(GL_R32UI, yagl_gles_format_sized | yagl_gles_format_color_renderable | yagl_gles_format_unsigned_integer, 32);
+YAGL_INTERNALFORMAT_RG(GL_RG8UI, yagl_gles_format_sized | yagl_gles_format_color_renderable | yagl_gles_format_unsigned_integer, 8, 8);
+YAGL_INTERNALFORMAT_RG(GL_RG16UI, yagl_gles_format_sized | yagl_gles_format_color_renderable | yagl_gles_format_unsigned_integer, 16, 16);
+YAGL_INTERNALFORMAT_RG(GL_RG32UI, yagl_gles_format_sized | yagl_gles_format_color_renderable | yagl_gles_format_unsigned_integer, 32, 32);
+YAGL_INTERNALFORMAT_RGBA(GL_RGBA8UI, yagl_gles_format_sized | yagl_gles_format_color_renderable | yagl_gles_format_unsigned_integer, 8, 8, 8, 8);
+YAGL_INTERNALFORMAT_RGBA(GL_RGB10_A2UI, yagl_gles_format_sized | yagl_gles_format_color_renderable | yagl_gles_format_unsigned_integer, 10, 10, 10, 2);
+YAGL_INTERNALFORMAT_RGBA(GL_RGBA16UI, yagl_gles_format_sized | yagl_gles_format_color_renderable | yagl_gles_format_unsigned_integer, 16, 16, 16, 16);
+YAGL_INTERNALFORMAT_RGBA(GL_RGBA32UI, yagl_gles_format_sized | yagl_gles_format_color_renderable | yagl_gles_format_unsigned_integer, 32, 32, 32, 32);
+YAGL_INTERNALFORMAT_R(GL_R8I, yagl_gles_format_sized | yagl_gles_format_color_renderable | yagl_gles_format_signed_integer, 8);
+YAGL_INTERNALFORMAT_R(GL_R16I, yagl_gles_format_sized | yagl_gles_format_color_renderable | yagl_gles_format_signed_integer, 16);
+YAGL_INTERNALFORMAT_R(GL_R32I, yagl_gles_format_sized | yagl_gles_format_color_renderable | yagl_gles_format_signed_integer, 32);
+YAGL_INTERNALFORMAT_RG(GL_RG8I, yagl_gles_format_sized | yagl_gles_format_color_renderable | yagl_gles_format_signed_integer, 8, 8);
+YAGL_INTERNALFORMAT_RG(GL_RG16I, yagl_gles_format_sized | yagl_gles_format_color_renderable | yagl_gles_format_signed_integer, 16, 16);
+YAGL_INTERNALFORMAT_RG(GL_RG32I, yagl_gles_format_sized | yagl_gles_format_color_renderable | yagl_gles_format_signed_integer, 32, 32);
+YAGL_INTERNALFORMAT_RGBA(GL_RGBA8I, yagl_gles_format_sized | yagl_gles_format_color_renderable | yagl_gles_format_signed_integer, 8, 8, 8, 8);
+YAGL_INTERNALFORMAT_RGBA(GL_RGBA16I, yagl_gles_format_sized | yagl_gles_format_color_renderable | yagl_gles_format_signed_integer, 16, 16, 16, 16);
+YAGL_INTERNALFORMAT_RGBA(GL_RGBA32I, yagl_gles_format_sized | yagl_gles_format_color_renderable | yagl_gles_format_signed_integer, 32, 32, 32, 32);
+YAGL_INTERNALFORMAT_R(GL_R16F, yagl_gles_format_sized | yagl_gles_format_float, 16);
+YAGL_INTERNALFORMAT_R(GL_R32F, yagl_gles_format_sized | yagl_gles_format_float, 32);
+YAGL_INTERNALFORMAT_RG(GL_RG16F, yagl_gles_format_sized | yagl_gles_format_float, 16, 16);
+YAGL_INTERNALFORMAT_RG(GL_RG32F, yagl_gles_format_sized | yagl_gles_format_float, 32, 32);
+YAGL_INTERNALFORMAT_RGB(GL_R11F_G11F_B10F, yagl_gles_format_sized | yagl_gles_format_float, 11, 11, 10);
+YAGL_INTERNALFORMAT_RGB(GL_RGB16F, yagl_gles_format_sized | yagl_gles_format_float, 16, 16, 16);
+YAGL_INTERNALFORMAT_RGB(GL_RGB32F, yagl_gles_format_sized | yagl_gles_format_float, 32, 32, 32);
+YAGL_INTERNALFORMAT_RGBA(GL_RGBA16F, yagl_gles_format_sized | yagl_gles_format_float, 16, 16, 16, 16);
+YAGL_INTERNALFORMAT_RGBA(GL_RGBA32F, yagl_gles_format_sized | yagl_gles_format_float, 32, 32, 32, 32);
+YAGL_INTERNALFORMAT_DEPTH(GL_DEPTH_COMPONENT, yagl_gles_format_depth_renderable, 8);
+YAGL_INTERNALFORMAT_DEPTH(GL_DEPTH_COMPONENT16, yagl_gles_format_depth_renderable, 16);
+YAGL_INTERNALFORMAT_DEPTH(GL_DEPTH_COMPONENT24, yagl_gles_format_depth_renderable, 24);
+YAGL_INTERNALFORMAT_DEPTH(GL_DEPTH_COMPONENT32, yagl_gles_format_depth_renderable, 32);
+YAGL_INTERNALFORMAT_DEPTH(GL_DEPTH_COMPONENT32F, yagl_gles_format_depth_renderable | yagl_gles_format_float, 32);
+YAGL_INTERNALFORMAT_STENCIL(GL_STENCIL_INDEX8, yagl_gles_format_stencil_renderable, 8);
+YAGL_INTERNALFORMAT_DEPTH_STENCIL(GL_DEPTH_STENCIL, yagl_gles_format_depth_renderable | yagl_gles_format_stencil_renderable, 24, 8);
+YAGL_INTERNALFORMAT_DEPTH_STENCIL(GL_DEPTH24_STENCIL8, yagl_gles_format_depth_renderable | yagl_gles_format_stencil_renderable, 24, 8);
+YAGL_INTERNALFORMAT_DEPTH_STENCIL(GL_DEPTH32F_STENCIL8, yagl_gles_format_depth_renderable | yagl_gles_format_stencil_renderable, 32, 8);
+
+#define YAGL_INTERNALFORMAT_CASE(arg_internalformat) \
+case arg_internalformat: \
+ return &internalformat_##arg_internalformat
+
+void yagl_gles_reset_unpack(const struct yagl_gles_pixelstore* ps)
+{
+ if (ps->alignment != 1) {
+ yagl_host_glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ }
+
+ if (ps->row_length > 0) {
+ yagl_host_glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+ }
+
+ if (ps->image_height > 0) {
+ yagl_host_glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0);
+ }
+}
+
+void yagl_gles_set_unpack(const struct yagl_gles_pixelstore* ps)
+{
+ if (ps->alignment != 1) {
+ yagl_host_glPixelStorei(GL_UNPACK_ALIGNMENT, ps->alignment);
+ }
+
+ if (ps->row_length > 0) {
+ yagl_host_glPixelStorei(GL_UNPACK_ROW_LENGTH, ps->row_length);
+ }
+
+ if (ps->image_height > 0) {
+ yagl_host_glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, ps->image_height);
+ }
+}
+
+const struct yagl_gles_format_info
+ *yagl_gles_internalformat_info(GLenum internalformat)
+{
+ switch (internalformat) {
+ case 0:
+ /*
+ * No internalformat, it's ok.
+ */
+ return &internalformat_0;
+ YAGL_INTERNALFORMAT_CASE(GL_ALPHA);
+ YAGL_INTERNALFORMAT_CASE(GL_LUMINANCE);
+ YAGL_INTERNALFORMAT_CASE(GL_LUMINANCE_ALPHA);
+ YAGL_INTERNALFORMAT_CASE(GL_RED);
+ YAGL_INTERNALFORMAT_CASE(GL_RG);
+ YAGL_INTERNALFORMAT_CASE(GL_RGB);
+ YAGL_INTERNALFORMAT_CASE(GL_RGBA);
+ YAGL_INTERNALFORMAT_CASE(GL_BGRA);
+ YAGL_INTERNALFORMAT_CASE(GL_R8_SNORM);
+ YAGL_INTERNALFORMAT_CASE(GL_RG8_SNORM);
+ YAGL_INTERNALFORMAT_CASE(GL_RGB8_SNORM);
+ YAGL_INTERNALFORMAT_CASE(GL_RGBA8_SNORM);
+ YAGL_INTERNALFORMAT_CASE(GL_RGB9_E5);
+ YAGL_INTERNALFORMAT_CASE(GL_SRGB8);
+ YAGL_INTERNALFORMAT_CASE(GL_RGB8UI);
+ YAGL_INTERNALFORMAT_CASE(GL_RGB16UI);
+ YAGL_INTERNALFORMAT_CASE(GL_RGB32UI);
+ YAGL_INTERNALFORMAT_CASE(GL_RGB8I);
+ YAGL_INTERNALFORMAT_CASE(GL_RGB16I);
+ YAGL_INTERNALFORMAT_CASE(GL_RGB32I);
+ YAGL_INTERNALFORMAT_CASE(GL_R8);
+ YAGL_INTERNALFORMAT_CASE(GL_RG8);
+ YAGL_INTERNALFORMAT_CASE(GL_RGB8);
+ YAGL_INTERNALFORMAT_CASE(GL_RGB565);
+ YAGL_INTERNALFORMAT_CASE(GL_RGBA8);
+ YAGL_INTERNALFORMAT_CASE(GL_RGB5_A1);
+ YAGL_INTERNALFORMAT_CASE(GL_RGBA4);
+ YAGL_INTERNALFORMAT_CASE(GL_RGB10_A2);
+ YAGL_INTERNALFORMAT_CASE(GL_SRGB8_ALPHA8);
+ YAGL_INTERNALFORMAT_CASE(GL_R8UI);
+ YAGL_INTERNALFORMAT_CASE(GL_R16UI);
+ YAGL_INTERNALFORMAT_CASE(GL_R32UI);
+ YAGL_INTERNALFORMAT_CASE(GL_RG8UI);
+ YAGL_INTERNALFORMAT_CASE(GL_RG16UI);
+ YAGL_INTERNALFORMAT_CASE(GL_RG32UI);
+ YAGL_INTERNALFORMAT_CASE(GL_RGBA8UI);
+ YAGL_INTERNALFORMAT_CASE(GL_RGB10_A2UI);
+ YAGL_INTERNALFORMAT_CASE(GL_RGBA16UI);
+ YAGL_INTERNALFORMAT_CASE(GL_RGBA32UI);
+ YAGL_INTERNALFORMAT_CASE(GL_R8I);
+ YAGL_INTERNALFORMAT_CASE(GL_R16I);
+ YAGL_INTERNALFORMAT_CASE(GL_R32I);
+ YAGL_INTERNALFORMAT_CASE(GL_RG8I);
+ YAGL_INTERNALFORMAT_CASE(GL_RG16I);
+ YAGL_INTERNALFORMAT_CASE(GL_RG32I);
+ YAGL_INTERNALFORMAT_CASE(GL_RGBA8I);
+ YAGL_INTERNALFORMAT_CASE(GL_RGBA16I);
+ YAGL_INTERNALFORMAT_CASE(GL_RGBA32I);
+ YAGL_INTERNALFORMAT_CASE(GL_R16F);
+ YAGL_INTERNALFORMAT_CASE(GL_R32F);
+ YAGL_INTERNALFORMAT_CASE(GL_RG16F);
+ YAGL_INTERNALFORMAT_CASE(GL_RG32F);
+ YAGL_INTERNALFORMAT_CASE(GL_R11F_G11F_B10F);
+ YAGL_INTERNALFORMAT_CASE(GL_RGB16F);
+ YAGL_INTERNALFORMAT_CASE(GL_RGB32F);
+ YAGL_INTERNALFORMAT_CASE(GL_RGBA16F);
+ YAGL_INTERNALFORMAT_CASE(GL_RGBA32F);
+ YAGL_INTERNALFORMAT_CASE(GL_DEPTH_COMPONENT);
+ YAGL_INTERNALFORMAT_CASE(GL_DEPTH_COMPONENT16);
+ YAGL_INTERNALFORMAT_CASE(GL_DEPTH_COMPONENT24);
+ YAGL_INTERNALFORMAT_CASE(GL_DEPTH_COMPONENT32);
+ YAGL_INTERNALFORMAT_CASE(GL_DEPTH_COMPONENT32F);
+ YAGL_INTERNALFORMAT_CASE(GL_STENCIL_INDEX8);
+ YAGL_INTERNALFORMAT_CASE(GL_DEPTH_STENCIL);
+ YAGL_INTERNALFORMAT_CASE(GL_DEPTH24_STENCIL8);
+ YAGL_INTERNALFORMAT_CASE(GL_DEPTH32F_STENCIL8);
+ default:
+ assert(0);
+ return &internalformat_0;
+ }
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES_UTILS_H_
+#define _YAGL_GLES_UTILS_H_
+
+#include "yagl_gles_types.h"
+
+void yagl_gles_reset_unpack(const struct yagl_gles_pixelstore* ps);
+
+void yagl_gles_set_unpack(const struct yagl_gles_pixelstore* ps);
+
+const struct yagl_gles_format_info
+ *yagl_gles_internalformat_info(GLenum internalformat);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GL/gl.h"
+#include "yagl_gles_validate.h"
+
+int yagl_gles_is_stencil_op_valid(GLenum op)
+{
+ switch (op) {
+ case GL_KEEP:
+ case GL_ZERO:
+ case GL_REPLACE:
+ case GL_INCR:
+ case GL_INCR_WRAP:
+ case GL_DECR:
+ case GL_DECR_WRAP:
+ case GL_INVERT:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+int yagl_gles_is_stencil_func_valid(GLenum func)
+{
+ switch (func) {
+ case GL_NEVER:
+ case GL_LESS:
+ case GL_LEQUAL:
+ case GL_GREATER:
+ case GL_GEQUAL:
+ case GL_EQUAL:
+ case GL_NOTEQUAL:
+ case GL_ALWAYS:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+int yagl_gles_is_hint_mode_valid(GLenum mode)
+{
+ switch (mode) {
+ case GL_FASTEST:
+ case GL_NICEST:
+ case GL_DONT_CARE:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+int yagl_gles_is_draw_mode_valid(GLenum mode)
+{
+ switch (mode) {
+ case GL_POINTS:
+ case GL_LINE_STRIP:
+ case GL_LINE_LOOP:
+ case GL_LINES:
+ case GL_TRIANGLE_STRIP:
+ case GL_TRIANGLE_FAN:
+ case GL_TRIANGLES:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+int yagl_gles_is_buffer_usage_valid(GLenum usage)
+{
+ switch (usage) {
+ case GL_STREAM_DRAW:
+ case GL_STREAM_READ:
+ case GL_STREAM_COPY:
+ case GL_STATIC_DRAW:
+ case GL_STATIC_READ:
+ case GL_STATIC_COPY:
+ case GL_DYNAMIC_DRAW:
+ case GL_DYNAMIC_READ:
+ case GL_DYNAMIC_COPY:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+int yagl_gles_is_blend_equation_valid(GLenum mode)
+{
+ switch (mode) {
+ case GL_FUNC_ADD:
+ case GL_FUNC_SUBTRACT:
+ case GL_FUNC_REVERSE_SUBTRACT:
+ case GL_MIN:
+ case GL_MAX:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+int yagl_gles_is_blend_func_valid(GLenum func)
+{
+ switch (func) {
+ case GL_ZERO:
+ case GL_ONE:
+ case GL_SRC_COLOR:
+ case GL_ONE_MINUS_SRC_COLOR:
+ case GL_DST_COLOR:
+ case GL_ONE_MINUS_DST_COLOR:
+ case GL_SRC_ALPHA:
+ case GL_ONE_MINUS_SRC_ALPHA:
+ case GL_DST_ALPHA:
+ case GL_ONE_MINUS_DST_ALPHA:
+ case GL_CONSTANT_COLOR:
+ case GL_ONE_MINUS_CONSTANT_COLOR:
+ case GL_CONSTANT_ALPHA:
+ case GL_ONE_MINUS_CONSTANT_ALPHA:
+ case GL_SRC_ALPHA_SATURATE:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+int yagl_gles_is_cull_face_mode_valid(GLenum mode)
+{
+ switch (mode) {
+ case GL_FRONT:
+ case GL_BACK:
+ case GL_FRONT_AND_BACK:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+int yagl_gles_is_depth_func_valid(GLenum func)
+{
+ switch (func) {
+ case GL_NEVER:
+ case GL_LESS:
+ case GL_EQUAL:
+ case GL_LEQUAL:
+ case GL_GREATER:
+ case GL_NOTEQUAL:
+ case GL_GEQUAL:
+ case GL_ALWAYS:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+int yagl_gles_is_front_face_mode_valid(GLenum mode)
+{
+ switch (mode) {
+ case GL_CW:
+ case GL_CCW:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+int yagl_gles_is_alignment_valid(GLint alignment)
+{
+ switch (alignment) {
+ case 1:
+ case 2:
+ case 4:
+ case 8:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+int yagl_gles_get_index_size(GLenum type, int *index_size)
+{
+ switch (type) {
+ case GL_UNSIGNED_BYTE:
+ *index_size = 1;
+ break;
+ case GL_UNSIGNED_SHORT:
+ *index_size = 2;
+ break;
+ case GL_UNSIGNED_INT:
+ *index_size = 4;
+ break;
+ default:
+ return 0;
+ }
+ return 1;
+}
+
+int yagl_gles_validate_framebuffer_attachment(GLenum attachment,
+ int num_color_attachments,
+ yagl_gles_framebuffer_attachment *framebuffer_attachment)
+{
+ switch (attachment) {
+ case GL_DEPTH_ATTACHMENT:
+ *framebuffer_attachment = yagl_gles_framebuffer_attachment_depth;
+ break;
+ case GL_STENCIL_ATTACHMENT:
+ *framebuffer_attachment = yagl_gles_framebuffer_attachment_stencil;
+ break;
+ default:
+ if ((attachment >= GL_COLOR_ATTACHMENT0) &&
+ (attachment <= (GL_COLOR_ATTACHMENT0 + num_color_attachments - 1))) {
+ *framebuffer_attachment = yagl_gles_framebuffer_attachment_color0 +
+ (attachment - GL_COLOR_ATTACHMENT0);
+ break;
+ }
+ return 0;
+ }
+
+ return 1;
+}
+
+int yagl_gles_validate_texture_target_squash(GLenum target,
+ GLenum *squashed_target)
+{
+ switch (target) {
+ case GL_TEXTURE_2D:
+ *squashed_target = GL_TEXTURE_2D;
+ break;
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
+ *squashed_target = GL_TEXTURE_CUBE_MAP;
+ break;
+ default:
+ return 0;
+ }
+
+ return 1;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES_VALIDATE_H_
+#define _YAGL_GLES_VALIDATE_H_
+
+#include "yagl_gles_types.h"
+
+int yagl_gles_is_stencil_op_valid(GLenum op);
+
+int yagl_gles_is_stencil_func_valid(GLenum func);
+
+int yagl_gles_is_hint_mode_valid(GLenum mode);
+
+int yagl_gles_is_draw_mode_valid(GLenum mode);
+
+int yagl_gles_is_buffer_usage_valid(GLenum usage);
+
+int yagl_gles_is_blend_equation_valid(GLenum mode);
+
+int yagl_gles_is_blend_func_valid(GLenum func);
+
+int yagl_gles_is_cull_face_mode_valid(GLenum mode);
+
+int yagl_gles_is_depth_func_valid(GLenum func);
+
+int yagl_gles_is_front_face_mode_valid(GLenum mode);
+
+int yagl_gles_is_alignment_valid(GLint alignment);
+
+int yagl_gles_get_index_size(GLenum type, int *index_size);
+
+int yagl_gles_validate_framebuffer_attachment(GLenum attachment,
+ int num_color_attachments,
+ yagl_gles_framebuffer_attachment *framebuffer_attachment);
+
+int yagl_gles_validate_texture_target_squash(GLenum target,
+ GLenum *squashed_target);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GL/gl.h"
+#include "yagl_gles_vertex_array.h"
+#include "yagl_gles_array.h"
+#include "yagl_gles_buffer.h"
+#include "yagl_malloc.h"
+#include "yagl_state.h"
+#include "yagl_host_gles_calls.h"
+
+static void yagl_gles_vertex_array_destroy(struct yagl_ref *ref)
+{
+ struct yagl_gles_vertex_array *va = (struct yagl_gles_vertex_array*)ref;
+ int i;
+
+ yagl_gles_buffer_release(va->ebo);
+
+ for (i = 0; i < va->num_arrays; ++i) {
+ yagl_gles_array_cleanup(&va->arrays[i]);
+ }
+ yagl_free(va->arrays);
+
+ if (va->global_name) {
+ yagl_host_glDeleteObjects(&va->global_name, 1);
+ }
+
+ yagl_object_cleanup(&va->base);
+
+ yagl_free(va);
+}
+
+struct yagl_gles_vertex_array
+ *yagl_gles_vertex_array_create(int fake,
+ struct yagl_gles_array *arrays,
+ int num_arrays)
+{
+ struct yagl_gles_vertex_array *va;
+
+ va = yagl_malloc0(sizeof(*va));
+
+ yagl_object_init(&va->base, &yagl_gles_vertex_array_destroy);
+
+ va->arrays = arrays;
+ va->num_arrays = num_arrays;
+
+ if (!fake) {
+ va->global_name = yagl_get_global_name();
+
+ yagl_host_glGenVertexArrays(&va->global_name, 1);
+ }
+
+ return va;
+}
+
+void yagl_gles_vertex_array_acquire(struct yagl_gles_vertex_array *va)
+{
+ if (va) {
+ yagl_object_acquire(&va->base);
+ }
+}
+
+void yagl_gles_vertex_array_release(struct yagl_gles_vertex_array *va)
+{
+ if (va) {
+ yagl_object_release(&va->base);
+ }
+}
+
+void yagl_gles_vertex_array_bind(struct yagl_gles_vertex_array *va)
+{
+ yagl_host_glBindVertexArray(va->global_name);
+
+ va->was_bound = 1;
+}
+
+int yagl_gles_vertex_array_was_bound(struct yagl_gles_vertex_array *va)
+{
+ return va->was_bound;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES_VERTEX_ARRAY_H_
+#define _YAGL_GLES_VERTEX_ARRAY_H_
+
+#include "yagl_gles_types.h"
+#include "yagl_object.h"
+
+struct yagl_gles_array;
+struct yagl_gles_buffer;
+
+struct yagl_gles_vertex_array
+{
+ struct yagl_object base;
+
+ yagl_object_name global_name;
+
+ /*
+ * GLES arrays, the number of arrays is different depending on
+ * GLES version, 'num_arrays' holds that number.
+ */
+ struct yagl_gles_array *arrays;
+ int num_arrays;
+
+ struct yagl_gles_buffer *ebo;
+
+ int was_bound;
+};
+
+struct yagl_gles_vertex_array
+ *yagl_gles_vertex_array_create(int fake,
+ struct yagl_gles_array *arrays,
+ int num_arrays);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_gles_vertex_array_acquire(struct yagl_gles_vertex_array *va);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_gles_vertex_array_release(struct yagl_gles_vertex_array *va);
+
+void yagl_gles_vertex_array_bind(struct yagl_gles_vertex_array *va);
+
+int yagl_gles_vertex_array_was_bound(struct yagl_gles_vertex_array *va);
+
+#endif
--- /dev/null
+/*
+ * Generated by gen-yagl-calls.py, do not modify!
+ */
+#include "GL/gl.h"
+#include "yagl_host_gles_calls.h"
+#include "yagl_transport_gl.h"
+#include "yagl_state.h"
+#include <assert.h>
+
+/*
+ * glDrawArrays wrapper. id = 1
+ */
+void yagl_host_glDrawArrays(GLenum mode, GLint first, GLsizei count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 1, 3 * 8, 3 * 8);
+ yagl_transport_put_out_GLenum(t, mode);
+ yagl_transport_put_out_GLint(t, first);
+ yagl_transport_put_out_GLsizei(t, count);
+ yagl_transport_end(t);
+}
+
+/*
+ * glDrawElements wrapper. id = 2
+ */
+void yagl_host_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, int32_t indices_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 2, 5 * 8, 3 * 8 + yagl_transport_array_size(indices, indices_count, 1));
+ yagl_transport_put_out_GLenum(t, mode);
+ yagl_transport_put_out_GLsizei(t, count);
+ yagl_transport_put_out_GLenum(t, type);
+ yagl_transport_put_out_array(t, indices, indices_count, 1);
+ yagl_transport_end(t);
+}
+
+/*
+ * glReadPixelsData wrapper. id = 3
+ */
+void yagl_host_glReadPixelsData(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels, int32_t pixels_maxcount, int32_t *pixels_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 3, 8 * 8, 6 * 8 + yagl_transport_array_size(pixels, pixels_maxcount, 1));
+ yagl_transport_put_out_GLint(t, x);
+ yagl_transport_put_out_GLint(t, y);
+ yagl_transport_put_out_GLsizei(t, width);
+ yagl_transport_put_out_GLsizei(t, height);
+ yagl_transport_put_out_GLenum(t, format);
+ yagl_transport_put_out_GLenum(t, type);
+ yagl_transport_put_in_array(t, pixels, pixels_maxcount, pixels_count, 1);
+ yagl_transport_end(t);
+}
+
+/*
+ * glReadPixelsOffset wrapper. id = 4
+ */
+void yagl_host_glReadPixelsOffset(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei pixels)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 4, 7 * 8, 7 * 8);
+ yagl_transport_put_out_GLint(t, x);
+ yagl_transport_put_out_GLint(t, y);
+ yagl_transport_put_out_GLsizei(t, width);
+ yagl_transport_put_out_GLsizei(t, height);
+ yagl_transport_put_out_GLenum(t, format);
+ yagl_transport_put_out_GLenum(t, type);
+ yagl_transport_put_out_GLsizei(t, pixels);
+ yagl_transport_end(t);
+}
+
+/*
+ * glDrawArraysInstanced wrapper. id = 5
+ */
+void yagl_host_glDrawArraysInstanced(GLenum mode, GLint start, GLsizei count, GLsizei primcount)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 5, 4 * 8, 4 * 8);
+ yagl_transport_put_out_GLenum(t, mode);
+ yagl_transport_put_out_GLint(t, start);
+ yagl_transport_put_out_GLsizei(t, count);
+ yagl_transport_put_out_GLsizei(t, primcount);
+ yagl_transport_end(t);
+}
+
+/*
+ * glDrawElementsInstanced wrapper. id = 6
+ */
+void yagl_host_glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const void *indices, int32_t indices_count, GLsizei primcount)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 6, 6 * 8, 4 * 8 + yagl_transport_array_size(indices, indices_count, 1));
+ yagl_transport_put_out_GLenum(t, mode);
+ yagl_transport_put_out_GLsizei(t, count);
+ yagl_transport_put_out_GLenum(t, type);
+ yagl_transport_put_out_array(t, indices, indices_count, 1);
+ yagl_transport_put_out_GLsizei(t, primcount);
+ yagl_transport_end(t);
+}
+
+/*
+ * glDrawRangeElements wrapper. id = 7
+ */
+void yagl_host_glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, int32_t indices_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 7, 7 * 8, 5 * 8 + yagl_transport_array_size(indices, indices_count, 1));
+ yagl_transport_put_out_GLenum(t, mode);
+ yagl_transport_put_out_GLuint(t, start);
+ yagl_transport_put_out_GLuint(t, end);
+ yagl_transport_put_out_GLsizei(t, count);
+ yagl_transport_put_out_GLenum(t, type);
+ yagl_transport_put_out_array(t, indices, indices_count, 1);
+ yagl_transport_end(t);
+}
+
+/*
+ * glGenVertexArrays wrapper. id = 8
+ */
+void yagl_host_glGenVertexArrays(const GLuint *arrays, int32_t arrays_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 8, 2 * 8, 0 * 8 + yagl_transport_array_size(arrays, arrays_count, sizeof(GLuint)));
+ yagl_transport_put_out_array(t, arrays, arrays_count, sizeof(GLuint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glBindVertexArray wrapper. id = 9
+ */
+void yagl_host_glBindVertexArray(GLuint array)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 9, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLuint(t, array);
+ yagl_transport_end(t);
+}
+
+/*
+ * glDisableVertexAttribArray wrapper. id = 10
+ */
+void yagl_host_glDisableVertexAttribArray(GLuint index)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 10, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLuint(t, index);
+ yagl_transport_end(t);
+}
+
+/*
+ * glEnableVertexAttribArray wrapper. id = 11
+ */
+void yagl_host_glEnableVertexAttribArray(GLuint index)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 11, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLuint(t, index);
+ yagl_transport_end(t);
+}
+
+/*
+ * glVertexAttribPointerData wrapper. id = 12
+ */
+void yagl_host_glVertexAttribPointerData(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLint first, const GLvoid *data, int32_t data_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 12, 8 * 8, 6 * 8 + yagl_transport_array_size(data, data_count, 1));
+ yagl_transport_put_out_GLuint(t, indx);
+ yagl_transport_put_out_GLint(t, size);
+ yagl_transport_put_out_GLenum(t, type);
+ yagl_transport_put_out_GLboolean(t, normalized);
+ yagl_transport_put_out_GLsizei(t, stride);
+ yagl_transport_put_out_GLint(t, first);
+ yagl_transport_put_out_array(t, data, data_count, 1);
+ yagl_transport_end(t);
+}
+
+/*
+ * glVertexAttribPointerOffset wrapper. id = 13
+ */
+void yagl_host_glVertexAttribPointerOffset(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLsizei offset)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 13, 6 * 8, 6 * 8);
+ yagl_transport_put_out_GLuint(t, indx);
+ yagl_transport_put_out_GLint(t, size);
+ yagl_transport_put_out_GLenum(t, type);
+ yagl_transport_put_out_GLboolean(t, normalized);
+ yagl_transport_put_out_GLsizei(t, stride);
+ yagl_transport_put_out_GLsizei(t, offset);
+ yagl_transport_end(t);
+}
+
+/*
+ * glVertexPointerData wrapper. id = 14
+ */
+void yagl_host_glVertexPointerData(GLint size, GLenum type, GLsizei stride, GLint first, const GLvoid *data, int32_t data_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 14, 6 * 8, 4 * 8 + yagl_transport_array_size(data, data_count, 1));
+ yagl_transport_put_out_GLint(t, size);
+ yagl_transport_put_out_GLenum(t, type);
+ yagl_transport_put_out_GLsizei(t, stride);
+ yagl_transport_put_out_GLint(t, first);
+ yagl_transport_put_out_array(t, data, data_count, 1);
+ yagl_transport_end(t);
+}
+
+/*
+ * glVertexPointerOffset wrapper. id = 15
+ */
+void yagl_host_glVertexPointerOffset(GLint size, GLenum type, GLsizei stride, GLsizei offset)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 15, 4 * 8, 4 * 8);
+ yagl_transport_put_out_GLint(t, size);
+ yagl_transport_put_out_GLenum(t, type);
+ yagl_transport_put_out_GLsizei(t, stride);
+ yagl_transport_put_out_GLsizei(t, offset);
+ yagl_transport_end(t);
+}
+
+/*
+ * glNormalPointerData wrapper. id = 16
+ */
+void yagl_host_glNormalPointerData(GLenum type, GLsizei stride, GLint first, const GLvoid *data, int32_t data_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 16, 5 * 8, 3 * 8 + yagl_transport_array_size(data, data_count, 1));
+ yagl_transport_put_out_GLenum(t, type);
+ yagl_transport_put_out_GLsizei(t, stride);
+ yagl_transport_put_out_GLint(t, first);
+ yagl_transport_put_out_array(t, data, data_count, 1);
+ yagl_transport_end(t);
+}
+
+/*
+ * glNormalPointerOffset wrapper. id = 17
+ */
+void yagl_host_glNormalPointerOffset(GLenum type, GLsizei stride, GLsizei offset)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 17, 3 * 8, 3 * 8);
+ yagl_transport_put_out_GLenum(t, type);
+ yagl_transport_put_out_GLsizei(t, stride);
+ yagl_transport_put_out_GLsizei(t, offset);
+ yagl_transport_end(t);
+}
+
+/*
+ * glColorPointerData wrapper. id = 18
+ */
+void yagl_host_glColorPointerData(GLint size, GLenum type, GLsizei stride, GLint first, const GLvoid *data, int32_t data_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 18, 6 * 8, 4 * 8 + yagl_transport_array_size(data, data_count, 1));
+ yagl_transport_put_out_GLint(t, size);
+ yagl_transport_put_out_GLenum(t, type);
+ yagl_transport_put_out_GLsizei(t, stride);
+ yagl_transport_put_out_GLint(t, first);
+ yagl_transport_put_out_array(t, data, data_count, 1);
+ yagl_transport_end(t);
+}
+
+/*
+ * glColorPointerOffset wrapper. id = 19
+ */
+void yagl_host_glColorPointerOffset(GLint size, GLenum type, GLsizei stride, GLsizei offset)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 19, 4 * 8, 4 * 8);
+ yagl_transport_put_out_GLint(t, size);
+ yagl_transport_put_out_GLenum(t, type);
+ yagl_transport_put_out_GLsizei(t, stride);
+ yagl_transport_put_out_GLsizei(t, offset);
+ yagl_transport_end(t);
+}
+
+/*
+ * glTexCoordPointerData wrapper. id = 20
+ */
+void yagl_host_glTexCoordPointerData(GLint tex_id, GLint size, GLenum type, GLsizei stride, GLint first, const GLvoid *data, int32_t data_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 20, 7 * 8, 5 * 8 + yagl_transport_array_size(data, data_count, 1));
+ yagl_transport_put_out_GLint(t, tex_id);
+ yagl_transport_put_out_GLint(t, size);
+ yagl_transport_put_out_GLenum(t, type);
+ yagl_transport_put_out_GLsizei(t, stride);
+ yagl_transport_put_out_GLint(t, first);
+ yagl_transport_put_out_array(t, data, data_count, 1);
+ yagl_transport_end(t);
+}
+
+/*
+ * glTexCoordPointerOffset wrapper. id = 21
+ */
+void yagl_host_glTexCoordPointerOffset(GLint size, GLenum type, GLsizei stride, GLsizei offset)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 21, 4 * 8, 4 * 8);
+ yagl_transport_put_out_GLint(t, size);
+ yagl_transport_put_out_GLenum(t, type);
+ yagl_transport_put_out_GLsizei(t, stride);
+ yagl_transport_put_out_GLsizei(t, offset);
+ yagl_transport_end(t);
+}
+
+/*
+ * glDisableClientState wrapper. id = 22
+ */
+void yagl_host_glDisableClientState(GLenum array)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 22, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLenum(t, array);
+ yagl_transport_end(t);
+}
+
+/*
+ * glEnableClientState wrapper. id = 23
+ */
+void yagl_host_glEnableClientState(GLenum array)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 23, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLenum(t, array);
+ yagl_transport_end(t);
+}
+
+/*
+ * glVertexAttribDivisor wrapper. id = 24
+ */
+void yagl_host_glVertexAttribDivisor(GLuint index, GLuint divisor)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 24, 2 * 8, 2 * 8);
+ yagl_transport_put_out_GLuint(t, index);
+ yagl_transport_put_out_GLuint(t, divisor);
+ yagl_transport_end(t);
+}
+
+/*
+ * glVertexAttribIPointerData wrapper. id = 25
+ */
+void yagl_host_glVertexAttribIPointerData(GLuint index, GLint size, GLenum type, GLsizei stride, GLint first, const GLvoid *data, int32_t data_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 25, 7 * 8, 5 * 8 + yagl_transport_array_size(data, data_count, 1));
+ yagl_transport_put_out_GLuint(t, index);
+ yagl_transport_put_out_GLint(t, size);
+ yagl_transport_put_out_GLenum(t, type);
+ yagl_transport_put_out_GLsizei(t, stride);
+ yagl_transport_put_out_GLint(t, first);
+ yagl_transport_put_out_array(t, data, data_count, 1);
+ yagl_transport_end(t);
+}
+
+/*
+ * glVertexAttribIPointerOffset wrapper. id = 26
+ */
+void yagl_host_glVertexAttribIPointerOffset(GLuint index, GLint size, GLenum type, GLsizei stride, GLsizei offset)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 26, 5 * 8, 5 * 8);
+ yagl_transport_put_out_GLuint(t, index);
+ yagl_transport_put_out_GLint(t, size);
+ yagl_transport_put_out_GLenum(t, type);
+ yagl_transport_put_out_GLsizei(t, stride);
+ yagl_transport_put_out_GLsizei(t, offset);
+ yagl_transport_end(t);
+}
+
+/*
+ * glGenBuffers wrapper. id = 27
+ */
+void yagl_host_glGenBuffers(const GLuint *buffers, int32_t buffers_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 27, 2 * 8, 0 * 8 + yagl_transport_array_size(buffers, buffers_count, sizeof(GLuint)));
+ yagl_transport_put_out_array(t, buffers, buffers_count, sizeof(GLuint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glBindBuffer wrapper. id = 28
+ */
+void yagl_host_glBindBuffer(GLenum target, GLuint buffer)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 28, 2 * 8, 2 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLuint(t, buffer);
+ yagl_transport_end(t);
+}
+
+/*
+ * glBufferData wrapper. id = 29
+ */
+void yagl_host_glBufferData(GLenum target, const GLvoid *data, int32_t data_count, GLenum usage)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 29, 4 * 8, 2 * 8 + yagl_transport_array_size(data, data_count, 1));
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_array(t, data, data_count, 1);
+ yagl_transport_put_out_GLenum(t, usage);
+ yagl_transport_end(t);
+}
+
+/*
+ * glBufferSubData wrapper. id = 30
+ */
+void yagl_host_glBufferSubData(GLenum target, GLsizei offset, const GLvoid *data, int32_t data_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 30, 4 * 8, 2 * 8 + yagl_transport_array_size(data, data_count, 1));
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLsizei(t, offset);
+ yagl_transport_put_out_array(t, data, data_count, 1);
+ yagl_transport_end(t);
+}
+
+/*
+ * glBindBufferBase wrapper. id = 31
+ */
+void yagl_host_glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 31, 3 * 8, 3 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLuint(t, index);
+ yagl_transport_put_out_GLuint(t, buffer);
+ yagl_transport_end(t);
+}
+
+/*
+ * glBindBufferRange wrapper. id = 32
+ */
+void yagl_host_glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLint offset, GLsizei size)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 32, 5 * 8, 5 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLuint(t, index);
+ yagl_transport_put_out_GLuint(t, buffer);
+ yagl_transport_put_out_GLint(t, offset);
+ yagl_transport_put_out_GLsizei(t, size);
+ yagl_transport_end(t);
+}
+
+/*
+ * glMapBuffer wrapper. id = 33
+ */
+void yagl_host_glMapBuffer(GLuint buffer, const GLuint *ranges, int32_t ranges_count, GLvoid *data, int32_t data_maxcount, int32_t *data_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 33, 5 * 8, 1 * 8 + yagl_transport_array_size(ranges, ranges_count, sizeof(GLuint)) + yagl_transport_array_size(data, data_maxcount, 1));
+ yagl_transport_put_out_GLuint(t, buffer);
+ yagl_transport_put_out_array(t, ranges, ranges_count, sizeof(GLuint));
+ yagl_transport_put_in_array(t, data, data_maxcount, data_count, 1);
+ yagl_transport_end(t);
+}
+
+/*
+ * glCopyBufferSubData wrapper. id = 34
+ */
+void yagl_host_glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLint readOffset, GLint writeOffset, GLsizei size)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 34, 5 * 8, 5 * 8);
+ yagl_transport_put_out_GLenum(t, readTarget);
+ yagl_transport_put_out_GLenum(t, writeTarget);
+ yagl_transport_put_out_GLint(t, readOffset);
+ yagl_transport_put_out_GLint(t, writeOffset);
+ yagl_transport_put_out_GLsizei(t, size);
+ yagl_transport_end(t);
+}
+
+/*
+ * glGenTextures wrapper. id = 35
+ */
+void yagl_host_glGenTextures(const GLuint *textures, int32_t textures_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 35, 2 * 8, 0 * 8 + yagl_transport_array_size(textures, textures_count, sizeof(GLuint)));
+ yagl_transport_put_out_array(t, textures, textures_count, sizeof(GLuint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glBindTexture wrapper. id = 36
+ */
+void yagl_host_glBindTexture(GLenum target, GLuint texture)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 36, 2 * 8, 2 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLuint(t, texture);
+ yagl_transport_end(t);
+}
+
+/*
+ * glActiveTexture wrapper. id = 37
+ */
+void yagl_host_glActiveTexture(GLenum texture)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 37, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLenum(t, texture);
+ yagl_transport_end(t);
+}
+
+/*
+ * glCopyTexImage2D wrapper. id = 38
+ */
+void yagl_host_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 38, 8 * 8, 8 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLint(t, level);
+ yagl_transport_put_out_GLenum(t, internalformat);
+ yagl_transport_put_out_GLint(t, x);
+ yagl_transport_put_out_GLint(t, y);
+ yagl_transport_put_out_GLsizei(t, width);
+ yagl_transport_put_out_GLsizei(t, height);
+ yagl_transport_put_out_GLint(t, border);
+ yagl_transport_end(t);
+}
+
+/*
+ * glCopyTexSubImage2D wrapper. id = 39
+ */
+void yagl_host_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 39, 8 * 8, 8 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLint(t, level);
+ yagl_transport_put_out_GLint(t, xoffset);
+ yagl_transport_put_out_GLint(t, yoffset);
+ yagl_transport_put_out_GLint(t, x);
+ yagl_transport_put_out_GLint(t, y);
+ yagl_transport_put_out_GLsizei(t, width);
+ yagl_transport_put_out_GLsizei(t, height);
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetTexParameterfv wrapper. id = 40
+ */
+void yagl_host_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *param)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 40, 4 * 8, 4 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_in_GLfloat(t, param);
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetTexParameteriv wrapper. id = 41
+ */
+void yagl_host_glGetTexParameteriv(GLenum target, GLenum pname, GLint *param)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 41, 4 * 8, 4 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_in_GLint(t, param);
+ yagl_transport_end(t);
+}
+
+/*
+ * glTexImage2DData wrapper. id = 42
+ */
+void yagl_host_glTexImage2DData(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, int32_t pixels_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 42, 10 * 8, 8 * 8 + yagl_transport_array_size(pixels, pixels_count, 1));
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLint(t, level);
+ yagl_transport_put_out_GLint(t, internalformat);
+ yagl_transport_put_out_GLsizei(t, width);
+ yagl_transport_put_out_GLsizei(t, height);
+ yagl_transport_put_out_GLint(t, border);
+ yagl_transport_put_out_GLenum(t, format);
+ yagl_transport_put_out_GLenum(t, type);
+ yagl_transport_put_out_array(t, pixels, pixels_count, 1);
+ yagl_transport_end(t);
+}
+
+/*
+ * glTexImage2DOffset wrapper. id = 43
+ */
+void yagl_host_glTexImage2DOffset(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLsizei pixels)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 43, 9 * 8, 9 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLint(t, level);
+ yagl_transport_put_out_GLint(t, internalformat);
+ yagl_transport_put_out_GLsizei(t, width);
+ yagl_transport_put_out_GLsizei(t, height);
+ yagl_transport_put_out_GLint(t, border);
+ yagl_transport_put_out_GLenum(t, format);
+ yagl_transport_put_out_GLenum(t, type);
+ yagl_transport_put_out_GLsizei(t, pixels);
+ yagl_transport_end(t);
+}
+
+/*
+ * glTexParameterf wrapper. id = 44
+ */
+void yagl_host_glTexParameterf(GLenum target, GLenum pname, GLfloat param)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 44, 3 * 8, 3 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_out_GLfloat(t, param);
+ yagl_transport_end(t);
+}
+
+/*
+ * glTexParameterfv wrapper. id = 45
+ */
+void yagl_host_glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params, int32_t params_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 45, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_count, sizeof(GLfloat)));
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_out_array(t, params, params_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glTexParameteri wrapper. id = 46
+ */
+void yagl_host_glTexParameteri(GLenum target, GLenum pname, GLint param)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 46, 3 * 8, 3 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_out_GLint(t, param);
+ yagl_transport_end(t);
+}
+
+/*
+ * glTexParameteriv wrapper. id = 47
+ */
+void yagl_host_glTexParameteriv(GLenum target, GLenum pname, const GLint *params, int32_t params_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 47, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_count, sizeof(GLint)));
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_out_array(t, params, params_count, sizeof(GLint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glTexSubImage2DData wrapper. id = 48
+ */
+void yagl_host_glTexSubImage2DData(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, int32_t pixels_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 48, 10 * 8, 8 * 8 + yagl_transport_array_size(pixels, pixels_count, 1));
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLint(t, level);
+ yagl_transport_put_out_GLint(t, xoffset);
+ yagl_transport_put_out_GLint(t, yoffset);
+ yagl_transport_put_out_GLsizei(t, width);
+ yagl_transport_put_out_GLsizei(t, height);
+ yagl_transport_put_out_GLenum(t, format);
+ yagl_transport_put_out_GLenum(t, type);
+ yagl_transport_put_out_array(t, pixels, pixels_count, 1);
+ yagl_transport_end(t);
+}
+
+/*
+ * glTexSubImage2DOffset wrapper. id = 49
+ */
+void yagl_host_glTexSubImage2DOffset(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei pixels)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 49, 9 * 8, 9 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLint(t, level);
+ yagl_transport_put_out_GLint(t, xoffset);
+ yagl_transport_put_out_GLint(t, yoffset);
+ yagl_transport_put_out_GLsizei(t, width);
+ yagl_transport_put_out_GLsizei(t, height);
+ yagl_transport_put_out_GLenum(t, format);
+ yagl_transport_put_out_GLenum(t, type);
+ yagl_transport_put_out_GLsizei(t, pixels);
+ yagl_transport_end(t);
+}
+
+/*
+ * glClientActiveTexture wrapper. id = 50
+ */
+void yagl_host_glClientActiveTexture(GLenum texture)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 50, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLenum(t, texture);
+ yagl_transport_end(t);
+}
+
+/*
+ * glTexEnvi wrapper. id = 51
+ */
+void yagl_host_glTexEnvi(GLenum target, GLenum pname, GLint param)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 51, 3 * 8, 3 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_out_GLint(t, param);
+ yagl_transport_end(t);
+}
+
+/*
+ * glTexEnvf wrapper. id = 52
+ */
+void yagl_host_glTexEnvf(GLenum target, GLenum pname, GLfloat param)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 52, 3 * 8, 3 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_out_GLfloat(t, param);
+ yagl_transport_end(t);
+}
+
+/*
+ * glMultiTexCoord4f wrapper. id = 53
+ */
+void yagl_host_glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat tt, GLfloat r, GLfloat q)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 53, 5 * 8, 5 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLfloat(t, s);
+ yagl_transport_put_out_GLfloat(t, tt);
+ yagl_transport_put_out_GLfloat(t, r);
+ yagl_transport_put_out_GLfloat(t, q);
+ yagl_transport_end(t);
+}
+
+/*
+ * glTexEnviv wrapper. id = 54
+ */
+void yagl_host_glTexEnviv(GLenum target, GLenum pname, const GLint *params, int32_t params_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 54, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_count, sizeof(GLint)));
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_out_array(t, params, params_count, sizeof(GLint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glTexEnvfv wrapper. id = 55
+ */
+void yagl_host_glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params, int32_t params_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 55, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_count, sizeof(GLfloat)));
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_out_array(t, params, params_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetTexEnviv wrapper. id = 56
+ */
+void yagl_host_glGetTexEnviv(GLenum env, GLenum pname, GLint *params, int32_t params_maxcount, int32_t *params_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 56, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_maxcount, sizeof(GLint)));
+ yagl_transport_put_out_GLenum(t, env);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_in_array(t, params, params_maxcount, params_count, sizeof(GLint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetTexEnvfv wrapper. id = 57
+ */
+void yagl_host_glGetTexEnvfv(GLenum env, GLenum pname, GLfloat *params, int32_t params_maxcount, int32_t *params_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 57, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_maxcount, sizeof(GLfloat)));
+ yagl_transport_put_out_GLenum(t, env);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_in_array(t, params, params_maxcount, params_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glTexImage3DData wrapper. id = 58
+ */
+void yagl_host_glTexImage3DData(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels, int32_t pixels_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 58, 11 * 8, 9 * 8 + yagl_transport_array_size(pixels, pixels_count, 1));
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLint(t, level);
+ yagl_transport_put_out_GLint(t, internalformat);
+ yagl_transport_put_out_GLsizei(t, width);
+ yagl_transport_put_out_GLsizei(t, height);
+ yagl_transport_put_out_GLsizei(t, depth);
+ yagl_transport_put_out_GLint(t, border);
+ yagl_transport_put_out_GLenum(t, format);
+ yagl_transport_put_out_GLenum(t, type);
+ yagl_transport_put_out_array(t, pixels, pixels_count, 1);
+ yagl_transport_end(t);
+}
+
+/*
+ * glTexImage3DOffset wrapper. id = 59
+ */
+void yagl_host_glTexImage3DOffset(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLsizei pixels)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 59, 10 * 8, 10 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLint(t, level);
+ yagl_transport_put_out_GLint(t, internalformat);
+ yagl_transport_put_out_GLsizei(t, width);
+ yagl_transport_put_out_GLsizei(t, height);
+ yagl_transport_put_out_GLsizei(t, depth);
+ yagl_transport_put_out_GLint(t, border);
+ yagl_transport_put_out_GLenum(t, format);
+ yagl_transport_put_out_GLenum(t, type);
+ yagl_transport_put_out_GLsizei(t, pixels);
+ yagl_transport_end(t);
+}
+
+/*
+ * glTexSubImage3DData wrapper. id = 60
+ */
+void yagl_host_glTexSubImage3DData(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels, int32_t pixels_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 60, 12 * 8, 10 * 8 + yagl_transport_array_size(pixels, pixels_count, 1));
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLint(t, level);
+ yagl_transport_put_out_GLint(t, xoffset);
+ yagl_transport_put_out_GLint(t, yoffset);
+ yagl_transport_put_out_GLint(t, zoffset);
+ yagl_transport_put_out_GLsizei(t, width);
+ yagl_transport_put_out_GLsizei(t, height);
+ yagl_transport_put_out_GLsizei(t, depth);
+ yagl_transport_put_out_GLenum(t, format);
+ yagl_transport_put_out_GLenum(t, type);
+ yagl_transport_put_out_array(t, pixels, pixels_count, 1);
+ yagl_transport_end(t);
+}
+
+/*
+ * glTexSubImage3DOffset wrapper. id = 61
+ */
+void yagl_host_glTexSubImage3DOffset(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei pixels)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 61, 11 * 8, 11 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLint(t, level);
+ yagl_transport_put_out_GLint(t, xoffset);
+ yagl_transport_put_out_GLint(t, yoffset);
+ yagl_transport_put_out_GLint(t, zoffset);
+ yagl_transport_put_out_GLsizei(t, width);
+ yagl_transport_put_out_GLsizei(t, height);
+ yagl_transport_put_out_GLsizei(t, depth);
+ yagl_transport_put_out_GLenum(t, format);
+ yagl_transport_put_out_GLenum(t, type);
+ yagl_transport_put_out_GLsizei(t, pixels);
+ yagl_transport_end(t);
+}
+
+/*
+ * glCopyTexSubImage3D wrapper. id = 62
+ */
+void yagl_host_glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 62, 9 * 8, 9 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLint(t, level);
+ yagl_transport_put_out_GLint(t, xoffset);
+ yagl_transport_put_out_GLint(t, yoffset);
+ yagl_transport_put_out_GLint(t, zoffset);
+ yagl_transport_put_out_GLint(t, x);
+ yagl_transport_put_out_GLint(t, y);
+ yagl_transport_put_out_GLsizei(t, width);
+ yagl_transport_put_out_GLsizei(t, height);
+ yagl_transport_end(t);
+}
+
+/*
+ * glGenFramebuffers wrapper. id = 63
+ */
+void yagl_host_glGenFramebuffers(const GLuint *framebuffers, int32_t framebuffers_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 63, 2 * 8, 0 * 8 + yagl_transport_array_size(framebuffers, framebuffers_count, sizeof(GLuint)));
+ yagl_transport_put_out_array(t, framebuffers, framebuffers_count, sizeof(GLuint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glBindFramebuffer wrapper. id = 64
+ */
+void yagl_host_glBindFramebuffer(GLenum target, GLuint framebuffer)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 64, 2 * 8, 2 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLuint(t, framebuffer);
+ yagl_transport_end(t);
+}
+
+/*
+ * glFramebufferTexture2D wrapper. id = 65
+ */
+void yagl_host_glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 65, 5 * 8, 5 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLenum(t, attachment);
+ yagl_transport_put_out_GLenum(t, textarget);
+ yagl_transport_put_out_GLuint(t, texture);
+ yagl_transport_put_out_GLint(t, level);
+ yagl_transport_end(t);
+}
+
+/*
+ * glFramebufferRenderbuffer wrapper. id = 66
+ */
+void yagl_host_glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 66, 4 * 8, 4 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLenum(t, attachment);
+ yagl_transport_put_out_GLenum(t, renderbuffertarget);
+ yagl_transport_put_out_GLuint(t, renderbuffer);
+ yagl_transport_end(t);
+}
+
+/*
+ * glBlitFramebuffer wrapper. id = 67
+ */
+void yagl_host_glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 67, 10 * 8, 10 * 8);
+ yagl_transport_put_out_GLint(t, srcX0);
+ yagl_transport_put_out_GLint(t, srcY0);
+ yagl_transport_put_out_GLint(t, srcX1);
+ yagl_transport_put_out_GLint(t, srcY1);
+ yagl_transport_put_out_GLint(t, dstX0);
+ yagl_transport_put_out_GLint(t, dstY0);
+ yagl_transport_put_out_GLint(t, dstX1);
+ yagl_transport_put_out_GLint(t, dstY1);
+ yagl_transport_put_out_GLbitfield(t, mask);
+ yagl_transport_put_out_GLenum(t, filter);
+ yagl_transport_end(t);
+}
+
+/*
+ * glDrawBuffers wrapper. id = 68
+ */
+void yagl_host_glDrawBuffers(const GLenum *bufs, int32_t bufs_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 68, 2 * 8, 0 * 8 + yagl_transport_array_size(bufs, bufs_count, sizeof(GLenum)));
+ yagl_transport_put_out_array(t, bufs, bufs_count, sizeof(GLenum));
+ yagl_transport_end(t);
+}
+
+/*
+ * glReadBuffer wrapper. id = 69
+ */
+void yagl_host_glReadBuffer(GLenum mode)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 69, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLenum(t, mode);
+ yagl_transport_end(t);
+}
+
+/*
+ * glFramebufferTexture3D wrapper. id = 70
+ */
+void yagl_host_glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 70, 6 * 8, 6 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLenum(t, attachment);
+ yagl_transport_put_out_GLenum(t, textarget);
+ yagl_transport_put_out_GLuint(t, texture);
+ yagl_transport_put_out_GLint(t, level);
+ yagl_transport_put_out_GLint(t, zoffset);
+ yagl_transport_end(t);
+}
+
+/*
+ * glFramebufferTextureLayer wrapper. id = 71
+ */
+void yagl_host_glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 71, 5 * 8, 5 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLenum(t, attachment);
+ yagl_transport_put_out_GLuint(t, texture);
+ yagl_transport_put_out_GLint(t, level);
+ yagl_transport_put_out_GLint(t, layer);
+ yagl_transport_end(t);
+}
+
+/*
+ * glClearBufferiv wrapper. id = 72
+ */
+void yagl_host_glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value, int32_t value_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 72, 4 * 8, 2 * 8 + yagl_transport_array_size(value, value_count, sizeof(GLint)));
+ yagl_transport_put_out_GLenum(t, buffer);
+ yagl_transport_put_out_GLint(t, drawbuffer);
+ yagl_transport_put_out_array(t, value, value_count, sizeof(GLint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glClearBufferuiv wrapper. id = 73
+ */
+void yagl_host_glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value, int32_t value_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 73, 4 * 8, 2 * 8 + yagl_transport_array_size(value, value_count, sizeof(GLuint)));
+ yagl_transport_put_out_GLenum(t, buffer);
+ yagl_transport_put_out_GLint(t, drawbuffer);
+ yagl_transport_put_out_array(t, value, value_count, sizeof(GLuint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glClearBufferfi wrapper. id = 74
+ */
+void yagl_host_glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 74, 4 * 8, 4 * 8);
+ yagl_transport_put_out_GLenum(t, buffer);
+ yagl_transport_put_out_GLint(t, drawbuffer);
+ yagl_transport_put_out_GLfloat(t, depth);
+ yagl_transport_put_out_GLint(t, stencil);
+ yagl_transport_end(t);
+}
+
+/*
+ * glClearBufferfv wrapper. id = 75
+ */
+void yagl_host_glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value, int32_t value_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 75, 4 * 8, 2 * 8 + yagl_transport_array_size(value, value_count, sizeof(GLfloat)));
+ yagl_transport_put_out_GLenum(t, buffer);
+ yagl_transport_put_out_GLint(t, drawbuffer);
+ yagl_transport_put_out_array(t, value, value_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glGenRenderbuffers wrapper. id = 76
+ */
+void yagl_host_glGenRenderbuffers(const GLuint *renderbuffers, int32_t renderbuffers_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 76, 2 * 8, 0 * 8 + yagl_transport_array_size(renderbuffers, renderbuffers_count, sizeof(GLuint)));
+ yagl_transport_put_out_array(t, renderbuffers, renderbuffers_count, sizeof(GLuint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glBindRenderbuffer wrapper. id = 77
+ */
+void yagl_host_glBindRenderbuffer(GLenum target, GLuint renderbuffer)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 77, 2 * 8, 2 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLuint(t, renderbuffer);
+ yagl_transport_end(t);
+}
+
+/*
+ * glRenderbufferStorage wrapper. id = 78
+ */
+void yagl_host_glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 78, 4 * 8, 4 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLenum(t, internalformat);
+ yagl_transport_put_out_GLsizei(t, width);
+ yagl_transport_put_out_GLsizei(t, height);
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetRenderbufferParameteriv wrapper. id = 79
+ */
+void yagl_host_glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *param)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 79, 4 * 8, 4 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_in_GLint(t, param);
+ yagl_transport_end(t);
+}
+
+/*
+ * glRenderbufferStorageMultisample wrapper. id = 80
+ */
+void yagl_host_glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 80, 5 * 8, 5 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLsizei(t, samples);
+ yagl_transport_put_out_GLenum(t, internalformat);
+ yagl_transport_put_out_GLsizei(t, width);
+ yagl_transport_put_out_GLsizei(t, height);
+ yagl_transport_end(t);
+}
+
+/*
+ * glCreateProgram wrapper. id = 81
+ */
+void yagl_host_glCreateProgram(GLuint program)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 81, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLuint(t, program);
+ yagl_transport_end(t);
+}
+
+/*
+ * glCreateShader wrapper. id = 82
+ */
+void yagl_host_glCreateShader(GLuint shader, GLenum type)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 82, 2 * 8, 2 * 8);
+ yagl_transport_put_out_GLuint(t, shader);
+ yagl_transport_put_out_GLenum(t, type);
+ yagl_transport_end(t);
+}
+
+/*
+ * glShaderSource wrapper. id = 83
+ */
+void yagl_host_glShaderSource(GLuint shader, const GLchar *string, int32_t string_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 83, 3 * 8, 1 * 8 + yagl_transport_array_size(string, string_count, sizeof(GLchar)));
+ yagl_transport_put_out_GLuint(t, shader);
+ yagl_transport_put_out_array(t, string, string_count, sizeof(GLchar));
+ yagl_transport_end(t);
+}
+
+/*
+ * glAttachShader wrapper. id = 84
+ */
+void yagl_host_glAttachShader(GLuint program, GLuint shader)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 84, 2 * 8, 2 * 8);
+ yagl_transport_put_out_GLuint(t, program);
+ yagl_transport_put_out_GLuint(t, shader);
+ yagl_transport_end(t);
+}
+
+/*
+ * glDetachShader wrapper. id = 85
+ */
+void yagl_host_glDetachShader(GLuint program, GLuint shader)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 85, 2 * 8, 2 * 8);
+ yagl_transport_put_out_GLuint(t, program);
+ yagl_transport_put_out_GLuint(t, shader);
+ yagl_transport_end(t);
+}
+
+/*
+ * glCompileShader wrapper. id = 86
+ */
+void yagl_host_glCompileShader(GLuint shader)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 86, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLuint(t, shader);
+ yagl_transport_end(t);
+}
+
+/*
+ * glBindAttribLocation wrapper. id = 87
+ */
+void yagl_host_glBindAttribLocation(GLuint program, GLuint index, const GLchar *name, int32_t name_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 87, 4 * 8, 2 * 8 + yagl_transport_array_size(name, name_count, sizeof(GLchar)));
+ yagl_transport_put_out_GLuint(t, program);
+ yagl_transport_put_out_GLuint(t, index);
+ yagl_transport_put_out_array(t, name, name_count, sizeof(GLchar));
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetActiveAttrib wrapper. id = 88
+ */
+void yagl_host_glGetActiveAttrib(GLuint program, GLuint index, GLint *size, GLenum *type, GLchar *name, int32_t name_maxcount, int32_t *name_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 88, 8 * 8, 6 * 8 + yagl_transport_array_size(name, name_maxcount, sizeof(GLchar)));
+ yagl_transport_put_out_GLuint(t, program);
+ yagl_transport_put_out_GLuint(t, index);
+ yagl_transport_put_in_GLint(t, size);
+ yagl_transport_put_in_GLenum(t, type);
+ yagl_transport_put_in_array(t, name, name_maxcount, name_count, sizeof(GLchar));
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetActiveUniform wrapper. id = 89
+ */
+void yagl_host_glGetActiveUniform(GLuint program, GLuint index, GLint *size, GLenum *type, GLchar *name, int32_t name_maxcount, int32_t *name_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 89, 8 * 8, 6 * 8 + yagl_transport_array_size(name, name_maxcount, sizeof(GLchar)));
+ yagl_transport_put_out_GLuint(t, program);
+ yagl_transport_put_out_GLuint(t, index);
+ yagl_transport_put_in_GLint(t, size);
+ yagl_transport_put_in_GLenum(t, type);
+ yagl_transport_put_in_array(t, name, name_maxcount, name_count, sizeof(GLchar));
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetAttribLocation wrapper. id = 90
+ */
+int yagl_host_glGetAttribLocation(GLuint program, const GLchar *name, int32_t name_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ int retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_gles, 90, 5 * 8, 3 * 8 + yagl_transport_array_size(name, name_count, sizeof(GLchar)));
+ yagl_transport_put_out_GLuint(t, program);
+ yagl_transport_put_out_array(t, name, name_count, sizeof(GLchar));
+ yagl_transport_put_in_int(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
+
+/*
+ * glGetProgramiv wrapper. id = 91
+ */
+void yagl_host_glGetProgramiv(GLuint program, GLenum pname, GLint *param)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 91, 4 * 8, 4 * 8);
+ yagl_transport_put_out_GLuint(t, program);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_in_GLint(t, param);
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetProgramInfoLog wrapper. id = 92
+ */
+GLboolean yagl_host_glGetProgramInfoLog(GLuint program, GLchar *infolog, int32_t infolog_maxcount, int32_t *infolog_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ GLboolean retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_gles, 92, 5 * 8, 3 * 8 + yagl_transport_array_size(infolog, infolog_maxcount, sizeof(GLchar)));
+ yagl_transport_put_out_GLuint(t, program);
+ yagl_transport_put_in_array(t, infolog, infolog_maxcount, infolog_count, sizeof(GLchar));
+ yagl_transport_put_in_GLboolean(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
+
+/*
+ * glGetShaderiv wrapper. id = 93
+ */
+void yagl_host_glGetShaderiv(GLuint shader, GLenum pname, GLint *param)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 93, 4 * 8, 4 * 8);
+ yagl_transport_put_out_GLuint(t, shader);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_in_GLint(t, param);
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetShaderInfoLog wrapper. id = 94
+ */
+GLboolean yagl_host_glGetShaderInfoLog(GLuint shader, GLchar *infolog, int32_t infolog_maxcount, int32_t *infolog_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ GLboolean retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_gles, 94, 5 * 8, 3 * 8 + yagl_transport_array_size(infolog, infolog_maxcount, sizeof(GLchar)));
+ yagl_transport_put_out_GLuint(t, shader);
+ yagl_transport_put_in_array(t, infolog, infolog_maxcount, infolog_count, sizeof(GLchar));
+ yagl_transport_put_in_GLboolean(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
+
+/*
+ * glGetUniformfv wrapper. id = 95
+ */
+void yagl_host_glGetUniformfv(GLboolean tl, GLuint program, uint32_t location, GLfloat *params, int32_t params_maxcount, int32_t *params_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 95, 5 * 8, 3 * 8 + yagl_transport_array_size(params, params_maxcount, sizeof(GLfloat)));
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_GLuint(t, program);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_in_array(t, params, params_maxcount, params_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetUniformiv wrapper. id = 96
+ */
+void yagl_host_glGetUniformiv(GLboolean tl, GLuint program, uint32_t location, GLint *params, int32_t params_maxcount, int32_t *params_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 96, 5 * 8, 3 * 8 + yagl_transport_array_size(params, params_maxcount, sizeof(GLint)));
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_GLuint(t, program);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_in_array(t, params, params_maxcount, params_count, sizeof(GLint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetUniformLocation wrapper. id = 97
+ */
+int yagl_host_glGetUniformLocation(GLuint program, const GLchar *name, int32_t name_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ int retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_gles, 97, 5 * 8, 3 * 8 + yagl_transport_array_size(name, name_count, sizeof(GLchar)));
+ yagl_transport_put_out_GLuint(t, program);
+ yagl_transport_put_out_array(t, name, name_count, sizeof(GLchar));
+ yagl_transport_put_in_int(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
+
+/*
+ * glGetVertexAttribfv wrapper. id = 98
+ */
+void yagl_host_glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params, int32_t params_maxcount, int32_t *params_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 98, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_maxcount, sizeof(GLfloat)));
+ yagl_transport_put_out_GLuint(t, index);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_in_array(t, params, params_maxcount, params_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetVertexAttribiv wrapper. id = 99
+ */
+void yagl_host_glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params, int32_t params_maxcount, int32_t *params_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 99, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_maxcount, sizeof(GLint)));
+ yagl_transport_put_out_GLuint(t, index);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_in_array(t, params, params_maxcount, params_count, sizeof(GLint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glLinkProgram wrapper. id = 100
+ */
+void yagl_host_glLinkProgram(GLuint program, GLint *params, int32_t params_maxcount, int32_t *params_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 100, 3 * 8, 1 * 8 + yagl_transport_array_size(params, params_maxcount, sizeof(GLint)));
+ yagl_transport_put_out_GLuint(t, program);
+ yagl_transport_put_in_array(t, params, params_maxcount, params_count, sizeof(GLint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniform1f wrapper. id = 101
+ */
+void yagl_host_glUniform1f(GLboolean tl, uint32_t location, GLfloat x)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 101, 3 * 8, 3 * 8);
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_GLfloat(t, x);
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniform1fv wrapper. id = 102
+ */
+void yagl_host_glUniform1fv(GLboolean tl, uint32_t location, const GLfloat *v, int32_t v_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 102, 4 * 8, 2 * 8 + yagl_transport_array_size(v, v_count, sizeof(GLfloat)));
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_array(t, v, v_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniform1i wrapper. id = 103
+ */
+void yagl_host_glUniform1i(GLboolean tl, uint32_t location, GLint x)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 103, 3 * 8, 3 * 8);
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_GLint(t, x);
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniform1iv wrapper. id = 104
+ */
+void yagl_host_glUniform1iv(GLboolean tl, uint32_t location, const GLint *v, int32_t v_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 104, 4 * 8, 2 * 8 + yagl_transport_array_size(v, v_count, sizeof(GLint)));
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_array(t, v, v_count, sizeof(GLint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniform2f wrapper. id = 105
+ */
+void yagl_host_glUniform2f(GLboolean tl, uint32_t location, GLfloat x, GLfloat y)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 105, 4 * 8, 4 * 8);
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_GLfloat(t, x);
+ yagl_transport_put_out_GLfloat(t, y);
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniform2fv wrapper. id = 106
+ */
+void yagl_host_glUniform2fv(GLboolean tl, uint32_t location, const GLfloat *v, int32_t v_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 106, 4 * 8, 2 * 8 + yagl_transport_array_size(v, v_count, sizeof(GLfloat)));
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_array(t, v, v_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniform2i wrapper. id = 107
+ */
+void yagl_host_glUniform2i(GLboolean tl, uint32_t location, GLint x, GLint y)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 107, 4 * 8, 4 * 8);
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_GLint(t, x);
+ yagl_transport_put_out_GLint(t, y);
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniform2iv wrapper. id = 108
+ */
+void yagl_host_glUniform2iv(GLboolean tl, uint32_t location, const GLint *v, int32_t v_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 108, 4 * 8, 2 * 8 + yagl_transport_array_size(v, v_count, sizeof(GLint)));
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_array(t, v, v_count, sizeof(GLint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniform3f wrapper. id = 109
+ */
+void yagl_host_glUniform3f(GLboolean tl, uint32_t location, GLfloat x, GLfloat y, GLfloat z)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 109, 5 * 8, 5 * 8);
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_GLfloat(t, x);
+ yagl_transport_put_out_GLfloat(t, y);
+ yagl_transport_put_out_GLfloat(t, z);
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniform3fv wrapper. id = 110
+ */
+void yagl_host_glUniform3fv(GLboolean tl, uint32_t location, const GLfloat *v, int32_t v_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 110, 4 * 8, 2 * 8 + yagl_transport_array_size(v, v_count, sizeof(GLfloat)));
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_array(t, v, v_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniform3i wrapper. id = 111
+ */
+void yagl_host_glUniform3i(GLboolean tl, uint32_t location, GLint x, GLint y, GLint z)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 111, 5 * 8, 5 * 8);
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_GLint(t, x);
+ yagl_transport_put_out_GLint(t, y);
+ yagl_transport_put_out_GLint(t, z);
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniform3iv wrapper. id = 112
+ */
+void yagl_host_glUniform3iv(GLboolean tl, uint32_t location, const GLint *v, int32_t v_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 112, 4 * 8, 2 * 8 + yagl_transport_array_size(v, v_count, sizeof(GLint)));
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_array(t, v, v_count, sizeof(GLint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniform4f wrapper. id = 113
+ */
+void yagl_host_glUniform4f(GLboolean tl, uint32_t location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 113, 6 * 8, 6 * 8);
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_GLfloat(t, x);
+ yagl_transport_put_out_GLfloat(t, y);
+ yagl_transport_put_out_GLfloat(t, z);
+ yagl_transport_put_out_GLfloat(t, w);
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniform4fv wrapper. id = 114
+ */
+void yagl_host_glUniform4fv(GLboolean tl, uint32_t location, const GLfloat *v, int32_t v_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 114, 4 * 8, 2 * 8 + yagl_transport_array_size(v, v_count, sizeof(GLfloat)));
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_array(t, v, v_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniform4i wrapper. id = 115
+ */
+void yagl_host_glUniform4i(GLboolean tl, uint32_t location, GLint x, GLint y, GLint z, GLint w)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 115, 6 * 8, 6 * 8);
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_GLint(t, x);
+ yagl_transport_put_out_GLint(t, y);
+ yagl_transport_put_out_GLint(t, z);
+ yagl_transport_put_out_GLint(t, w);
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniform4iv wrapper. id = 116
+ */
+void yagl_host_glUniform4iv(GLboolean tl, uint32_t location, const GLint *v, int32_t v_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 116, 4 * 8, 2 * 8 + yagl_transport_array_size(v, v_count, sizeof(GLint)));
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_array(t, v, v_count, sizeof(GLint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniformMatrix2fv wrapper. id = 117
+ */
+void yagl_host_glUniformMatrix2fv(GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 117, 5 * 8, 3 * 8 + yagl_transport_array_size(value, value_count, sizeof(GLfloat)));
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_GLboolean(t, transpose);
+ yagl_transport_put_out_array(t, value, value_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniformMatrix3fv wrapper. id = 118
+ */
+void yagl_host_glUniformMatrix3fv(GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 118, 5 * 8, 3 * 8 + yagl_transport_array_size(value, value_count, sizeof(GLfloat)));
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_GLboolean(t, transpose);
+ yagl_transport_put_out_array(t, value, value_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniformMatrix4fv wrapper. id = 119
+ */
+void yagl_host_glUniformMatrix4fv(GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 119, 5 * 8, 3 * 8 + yagl_transport_array_size(value, value_count, sizeof(GLfloat)));
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_GLboolean(t, transpose);
+ yagl_transport_put_out_array(t, value, value_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glUseProgram wrapper. id = 120
+ */
+void yagl_host_glUseProgram(GLuint program)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 120, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLuint(t, program);
+ yagl_transport_end(t);
+}
+
+/*
+ * glValidateProgram wrapper. id = 121
+ */
+void yagl_host_glValidateProgram(GLuint program)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 121, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLuint(t, program);
+ yagl_transport_end(t);
+}
+
+/*
+ * glVertexAttrib1f wrapper. id = 122
+ */
+void yagl_host_glVertexAttrib1f(GLuint indx, GLfloat x)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 122, 2 * 8, 2 * 8);
+ yagl_transport_put_out_GLuint(t, indx);
+ yagl_transport_put_out_GLfloat(t, x);
+ yagl_transport_end(t);
+}
+
+/*
+ * glVertexAttrib1fv wrapper. id = 123
+ */
+void yagl_host_glVertexAttrib1fv(GLuint indx, const GLfloat *values, int32_t values_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 123, 3 * 8, 1 * 8 + yagl_transport_array_size(values, values_count, sizeof(GLfloat)));
+ yagl_transport_put_out_GLuint(t, indx);
+ yagl_transport_put_out_array(t, values, values_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glVertexAttrib2f wrapper. id = 124
+ */
+void yagl_host_glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 124, 3 * 8, 3 * 8);
+ yagl_transport_put_out_GLuint(t, indx);
+ yagl_transport_put_out_GLfloat(t, x);
+ yagl_transport_put_out_GLfloat(t, y);
+ yagl_transport_end(t);
+}
+
+/*
+ * glVertexAttrib2fv wrapper. id = 125
+ */
+void yagl_host_glVertexAttrib2fv(GLuint indx, const GLfloat *values, int32_t values_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 125, 3 * 8, 1 * 8 + yagl_transport_array_size(values, values_count, sizeof(GLfloat)));
+ yagl_transport_put_out_GLuint(t, indx);
+ yagl_transport_put_out_array(t, values, values_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glVertexAttrib3f wrapper. id = 126
+ */
+void yagl_host_glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 126, 4 * 8, 4 * 8);
+ yagl_transport_put_out_GLuint(t, indx);
+ yagl_transport_put_out_GLfloat(t, x);
+ yagl_transport_put_out_GLfloat(t, y);
+ yagl_transport_put_out_GLfloat(t, z);
+ yagl_transport_end(t);
+}
+
+/*
+ * glVertexAttrib3fv wrapper. id = 127
+ */
+void yagl_host_glVertexAttrib3fv(GLuint indx, const GLfloat *values, int32_t values_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 127, 3 * 8, 1 * 8 + yagl_transport_array_size(values, values_count, sizeof(GLfloat)));
+ yagl_transport_put_out_GLuint(t, indx);
+ yagl_transport_put_out_array(t, values, values_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glVertexAttrib4f wrapper. id = 128
+ */
+void yagl_host_glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 128, 5 * 8, 5 * 8);
+ yagl_transport_put_out_GLuint(t, indx);
+ yagl_transport_put_out_GLfloat(t, x);
+ yagl_transport_put_out_GLfloat(t, y);
+ yagl_transport_put_out_GLfloat(t, z);
+ yagl_transport_put_out_GLfloat(t, w);
+ yagl_transport_end(t);
+}
+
+/*
+ * glVertexAttrib4fv wrapper. id = 129
+ */
+void yagl_host_glVertexAttrib4fv(GLuint indx, const GLfloat *values, int32_t values_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 129, 3 * 8, 1 * 8 + yagl_transport_array_size(values, values_count, sizeof(GLfloat)));
+ yagl_transport_put_out_GLuint(t, indx);
+ yagl_transport_put_out_array(t, values, values_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetActiveUniformsiv wrapper. id = 130
+ */
+void yagl_host_glGetActiveUniformsiv(GLuint program, const GLuint *uniformIndices, int32_t uniformIndices_count, GLint *params, int32_t params_maxcount, int32_t *params_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 130, 5 * 8, 1 * 8 + yagl_transport_array_size(uniformIndices, uniformIndices_count, sizeof(GLuint)) + yagl_transport_array_size(params, params_maxcount, sizeof(GLint)));
+ yagl_transport_put_out_GLuint(t, program);
+ yagl_transport_put_out_array(t, uniformIndices, uniformIndices_count, sizeof(GLuint));
+ yagl_transport_put_in_array(t, params, params_maxcount, params_count, sizeof(GLint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetUniformIndices wrapper. id = 131
+ */
+void yagl_host_glGetUniformIndices(GLuint program, const GLchar *uniformNames, int32_t uniformNames_count, GLuint *uniformIndices, int32_t uniformIndices_maxcount, int32_t *uniformIndices_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 131, 5 * 8, 1 * 8 + yagl_transport_array_size(uniformNames, uniformNames_count, sizeof(GLchar)) + yagl_transport_array_size(uniformIndices, uniformIndices_maxcount, sizeof(GLuint)));
+ yagl_transport_put_out_GLuint(t, program);
+ yagl_transport_put_out_array(t, uniformNames, uniformNames_count, sizeof(GLchar));
+ yagl_transport_put_in_array(t, uniformIndices, uniformIndices_maxcount, uniformIndices_count, sizeof(GLuint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetUniformBlockIndex wrapper. id = 132
+ */
+GLuint yagl_host_glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName, int32_t uniformBlockName_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ GLuint retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_gles, 132, 5 * 8, 3 * 8 + yagl_transport_array_size(uniformBlockName, uniformBlockName_count, sizeof(GLchar)));
+ yagl_transport_put_out_GLuint(t, program);
+ yagl_transport_put_out_array(t, uniformBlockName, uniformBlockName_count, sizeof(GLchar));
+ yagl_transport_put_in_GLuint(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
+
+/*
+ * glUniformBlockBinding wrapper. id = 133
+ */
+void yagl_host_glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 133, 3 * 8, 3 * 8);
+ yagl_transport_put_out_GLuint(t, program);
+ yagl_transport_put_out_GLuint(t, uniformBlockIndex);
+ yagl_transport_put_out_GLuint(t, uniformBlockBinding);
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetActiveUniformBlockName wrapper. id = 134
+ */
+void yagl_host_glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLchar *uniformBlockName, int32_t uniformBlockName_maxcount, int32_t *uniformBlockName_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 134, 4 * 8, 2 * 8 + yagl_transport_array_size(uniformBlockName, uniformBlockName_maxcount, sizeof(GLchar)));
+ yagl_transport_put_out_GLuint(t, program);
+ yagl_transport_put_out_GLuint(t, uniformBlockIndex);
+ yagl_transport_put_in_array(t, uniformBlockName, uniformBlockName_maxcount, uniformBlockName_count, sizeof(GLchar));
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetActiveUniformBlockiv wrapper. id = 135
+ */
+void yagl_host_glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params, int32_t params_maxcount, int32_t *params_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 135, 5 * 8, 3 * 8 + yagl_transport_array_size(params, params_maxcount, sizeof(GLint)));
+ yagl_transport_put_out_GLuint(t, program);
+ yagl_transport_put_out_GLuint(t, uniformBlockIndex);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_in_array(t, params, params_maxcount, params_count, sizeof(GLint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetVertexAttribIiv wrapper. id = 136
+ */
+void yagl_host_glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params, int32_t params_maxcount, int32_t *params_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 136, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_maxcount, sizeof(GLint)));
+ yagl_transport_put_out_GLuint(t, index);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_in_array(t, params, params_maxcount, params_count, sizeof(GLint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetVertexAttribIuiv wrapper. id = 137
+ */
+void yagl_host_glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params, int32_t params_maxcount, int32_t *params_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 137, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_maxcount, sizeof(GLuint)));
+ yagl_transport_put_out_GLuint(t, index);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_in_array(t, params, params_maxcount, params_count, sizeof(GLuint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glVertexAttribI4i wrapper. id = 138
+ */
+void yagl_host_glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 138, 5 * 8, 5 * 8);
+ yagl_transport_put_out_GLuint(t, index);
+ yagl_transport_put_out_GLint(t, x);
+ yagl_transport_put_out_GLint(t, y);
+ yagl_transport_put_out_GLint(t, z);
+ yagl_transport_put_out_GLint(t, w);
+ yagl_transport_end(t);
+}
+
+/*
+ * glVertexAttribI4ui wrapper. id = 139
+ */
+void yagl_host_glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 139, 5 * 8, 5 * 8);
+ yagl_transport_put_out_GLuint(t, index);
+ yagl_transport_put_out_GLuint(t, x);
+ yagl_transport_put_out_GLuint(t, y);
+ yagl_transport_put_out_GLuint(t, z);
+ yagl_transport_put_out_GLuint(t, w);
+ yagl_transport_end(t);
+}
+
+/*
+ * glVertexAttribI4iv wrapper. id = 140
+ */
+void yagl_host_glVertexAttribI4iv(GLuint index, const GLint *v, int32_t v_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 140, 3 * 8, 1 * 8 + yagl_transport_array_size(v, v_count, sizeof(GLint)));
+ yagl_transport_put_out_GLuint(t, index);
+ yagl_transport_put_out_array(t, v, v_count, sizeof(GLint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glVertexAttribI4uiv wrapper. id = 141
+ */
+void yagl_host_glVertexAttribI4uiv(GLuint index, const GLuint *v, int32_t v_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 141, 3 * 8, 1 * 8 + yagl_transport_array_size(v, v_count, sizeof(GLuint)));
+ yagl_transport_put_out_GLuint(t, index);
+ yagl_transport_put_out_array(t, v, v_count, sizeof(GLuint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetUniformuiv wrapper. id = 142
+ */
+void yagl_host_glGetUniformuiv(GLboolean tl, GLuint program, uint32_t location, GLuint *params, int32_t params_maxcount, int32_t *params_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 142, 5 * 8, 3 * 8 + yagl_transport_array_size(params, params_maxcount, sizeof(GLuint)));
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_GLuint(t, program);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_in_array(t, params, params_maxcount, params_count, sizeof(GLuint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniform1ui wrapper. id = 143
+ */
+void yagl_host_glUniform1ui(GLboolean tl, uint32_t location, GLuint v0)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 143, 3 * 8, 3 * 8);
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_GLuint(t, v0);
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniform2ui wrapper. id = 144
+ */
+void yagl_host_glUniform2ui(GLboolean tl, uint32_t location, GLuint v0, GLuint v1)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 144, 4 * 8, 4 * 8);
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_GLuint(t, v0);
+ yagl_transport_put_out_GLuint(t, v1);
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniform3ui wrapper. id = 145
+ */
+void yagl_host_glUniform3ui(GLboolean tl, uint32_t location, GLuint v0, GLuint v1, GLuint v2)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 145, 5 * 8, 5 * 8);
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_GLuint(t, v0);
+ yagl_transport_put_out_GLuint(t, v1);
+ yagl_transport_put_out_GLuint(t, v2);
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniform4ui wrapper. id = 146
+ */
+void yagl_host_glUniform4ui(GLboolean tl, uint32_t location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 146, 6 * 8, 6 * 8);
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_GLuint(t, v0);
+ yagl_transport_put_out_GLuint(t, v1);
+ yagl_transport_put_out_GLuint(t, v2);
+ yagl_transport_put_out_GLuint(t, v3);
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniform1uiv wrapper. id = 147
+ */
+void yagl_host_glUniform1uiv(GLboolean tl, uint32_t location, const GLuint *v, int32_t v_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 147, 4 * 8, 2 * 8 + yagl_transport_array_size(v, v_count, sizeof(GLuint)));
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_array(t, v, v_count, sizeof(GLuint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniform2uiv wrapper. id = 148
+ */
+void yagl_host_glUniform2uiv(GLboolean tl, uint32_t location, const GLuint *v, int32_t v_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 148, 4 * 8, 2 * 8 + yagl_transport_array_size(v, v_count, sizeof(GLuint)));
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_array(t, v, v_count, sizeof(GLuint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniform3uiv wrapper. id = 149
+ */
+void yagl_host_glUniform3uiv(GLboolean tl, uint32_t location, const GLuint *v, int32_t v_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 149, 4 * 8, 2 * 8 + yagl_transport_array_size(v, v_count, sizeof(GLuint)));
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_array(t, v, v_count, sizeof(GLuint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniform4uiv wrapper. id = 150
+ */
+void yagl_host_glUniform4uiv(GLboolean tl, uint32_t location, const GLuint *v, int32_t v_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 150, 4 * 8, 2 * 8 + yagl_transport_array_size(v, v_count, sizeof(GLuint)));
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_array(t, v, v_count, sizeof(GLuint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniformMatrix2x3fv wrapper. id = 151
+ */
+void yagl_host_glUniformMatrix2x3fv(GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 151, 5 * 8, 3 * 8 + yagl_transport_array_size(value, value_count, sizeof(GLfloat)));
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_GLboolean(t, transpose);
+ yagl_transport_put_out_array(t, value, value_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniformMatrix2x4fv wrapper. id = 152
+ */
+void yagl_host_glUniformMatrix2x4fv(GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 152, 5 * 8, 3 * 8 + yagl_transport_array_size(value, value_count, sizeof(GLfloat)));
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_GLboolean(t, transpose);
+ yagl_transport_put_out_array(t, value, value_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniformMatrix3x2fv wrapper. id = 153
+ */
+void yagl_host_glUniformMatrix3x2fv(GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 153, 5 * 8, 3 * 8 + yagl_transport_array_size(value, value_count, sizeof(GLfloat)));
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_GLboolean(t, transpose);
+ yagl_transport_put_out_array(t, value, value_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniformMatrix3x4fv wrapper. id = 154
+ */
+void yagl_host_glUniformMatrix3x4fv(GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 154, 5 * 8, 3 * 8 + yagl_transport_array_size(value, value_count, sizeof(GLfloat)));
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_GLboolean(t, transpose);
+ yagl_transport_put_out_array(t, value, value_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniformMatrix4x2fv wrapper. id = 155
+ */
+void yagl_host_glUniformMatrix4x2fv(GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 155, 5 * 8, 3 * 8 + yagl_transport_array_size(value, value_count, sizeof(GLfloat)));
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_GLboolean(t, transpose);
+ yagl_transport_put_out_array(t, value, value_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glUniformMatrix4x3fv wrapper. id = 156
+ */
+void yagl_host_glUniformMatrix4x3fv(GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 156, 5 * 8, 3 * 8 + yagl_transport_array_size(value, value_count, sizeof(GLfloat)));
+ yagl_transport_put_out_GLboolean(t, tl);
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_GLboolean(t, transpose);
+ yagl_transport_put_out_array(t, value, value_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetFragDataLocation wrapper. id = 157
+ */
+int yagl_host_glGetFragDataLocation(GLuint program, const GLchar *name, int32_t name_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ int retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_gles, 157, 5 * 8, 3 * 8 + yagl_transport_array_size(name, name_count, sizeof(GLchar)));
+ yagl_transport_put_out_GLuint(t, program);
+ yagl_transport_put_out_array(t, name, name_count, sizeof(GLchar));
+ yagl_transport_put_in_int(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
+
+/*
+ * glGetIntegerv wrapper. id = 158
+ */
+void yagl_host_glGetIntegerv(GLenum pname, GLint *params, int32_t params_maxcount, int32_t *params_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 158, 3 * 8, 1 * 8 + yagl_transport_array_size(params, params_maxcount, sizeof(GLint)));
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_in_array(t, params, params_maxcount, params_count, sizeof(GLint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetFloatv wrapper. id = 159
+ */
+void yagl_host_glGetFloatv(GLenum pname, GLfloat *params, int32_t params_maxcount, int32_t *params_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 159, 3 * 8, 1 * 8 + yagl_transport_array_size(params, params_maxcount, sizeof(GLfloat)));
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_in_array(t, params, params_maxcount, params_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetString wrapper. id = 160
+ */
+void yagl_host_glGetString(GLenum name, GLchar *str, int32_t str_maxcount, int32_t *str_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 160, 3 * 8, 1 * 8 + yagl_transport_array_size(str, str_maxcount, sizeof(GLchar)));
+ yagl_transport_put_out_GLenum(t, name);
+ yagl_transport_put_in_array(t, str, str_maxcount, str_count, sizeof(GLchar));
+ yagl_transport_end(t);
+}
+
+/*
+ * glIsEnabled wrapper. id = 161
+ */
+GLboolean yagl_host_glIsEnabled(GLenum cap)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ GLboolean retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_gles, 161, 3 * 8, 3 * 8);
+ yagl_transport_put_out_GLenum(t, cap);
+ yagl_transport_put_in_GLboolean(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
+
+/*
+ * glGenTransformFeedbacks wrapper. id = 162
+ */
+void yagl_host_glGenTransformFeedbacks(const GLuint *ids, int32_t ids_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 162, 2 * 8, 0 * 8 + yagl_transport_array_size(ids, ids_count, sizeof(GLuint)));
+ yagl_transport_put_out_array(t, ids, ids_count, sizeof(GLuint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glBindTransformFeedback wrapper. id = 163
+ */
+void yagl_host_glBindTransformFeedback(GLenum target, GLuint id)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 163, 2 * 8, 2 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLuint(t, id);
+ yagl_transport_end(t);
+}
+
+/*
+ * glBeginTransformFeedback wrapper. id = 164
+ */
+void yagl_host_glBeginTransformFeedback(GLenum primitiveMode)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 164, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLenum(t, primitiveMode);
+ yagl_transport_end(t);
+}
+
+/*
+ * glEndTransformFeedback wrapper. id = 165
+ */
+void yagl_host_glEndTransformFeedback()
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 165, 0 * 8, 0 * 8);
+ yagl_transport_end(t);
+}
+
+/*
+ * glPauseTransformFeedback wrapper. id = 166
+ */
+void yagl_host_glPauseTransformFeedback()
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 166, 0 * 8, 0 * 8);
+ yagl_transport_end(t);
+}
+
+/*
+ * glResumeTransformFeedback wrapper. id = 167
+ */
+void yagl_host_glResumeTransformFeedback()
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 167, 0 * 8, 0 * 8);
+ yagl_transport_end(t);
+}
+
+/*
+ * glTransformFeedbackVaryings wrapper. id = 168
+ */
+void yagl_host_glTransformFeedbackVaryings(GLuint program, const GLchar *varyings, int32_t varyings_count, GLenum bufferMode)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 168, 4 * 8, 2 * 8 + yagl_transport_array_size(varyings, varyings_count, sizeof(GLchar)));
+ yagl_transport_put_out_GLuint(t, program);
+ yagl_transport_put_out_array(t, varyings, varyings_count, sizeof(GLchar));
+ yagl_transport_put_out_GLenum(t, bufferMode);
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetTransformFeedbackVaryings wrapper. id = 169
+ */
+void yagl_host_glGetTransformFeedbackVaryings(GLuint program, GLsizei *sizes, int32_t sizes_maxcount, int32_t *sizes_count, GLenum *types, int32_t types_maxcount, int32_t *types_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 169, 5 * 8, 1 * 8 + yagl_transport_array_size(sizes, sizes_maxcount, sizeof(GLsizei)) + yagl_transport_array_size(types, types_maxcount, sizeof(GLenum)));
+ yagl_transport_put_out_GLuint(t, program);
+ yagl_transport_put_in_array(t, sizes, sizes_maxcount, sizes_count, sizeof(GLsizei));
+ yagl_transport_put_in_array(t, types, types_maxcount, types_count, sizeof(GLenum));
+ yagl_transport_end(t);
+}
+
+/*
+ * glGenQueries wrapper. id = 170
+ */
+void yagl_host_glGenQueries(const GLuint *ids, int32_t ids_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 170, 2 * 8, 0 * 8 + yagl_transport_array_size(ids, ids_count, sizeof(GLuint)));
+ yagl_transport_put_out_array(t, ids, ids_count, sizeof(GLuint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glBeginQuery wrapper. id = 171
+ */
+void yagl_host_glBeginQuery(GLenum target, GLuint id)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 171, 2 * 8, 2 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLuint(t, id);
+ yagl_transport_end(t);
+}
+
+/*
+ * glEndQuery wrapper. id = 172
+ */
+void yagl_host_glEndQuery(GLenum target)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 172, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetQueryObjectuiv wrapper. id = 173
+ */
+GLboolean yagl_host_glGetQueryObjectuiv(GLuint id, GLuint *result)
+{
+ struct yagl_transport *t = yagl_get_transport();
+ GLboolean retval = 0;
+
+ yagl_transport_begin(t, yagl_api_id_gles, 173, 5 * 8, 5 * 8);
+ yagl_transport_put_out_GLuint(t, id);
+ yagl_transport_put_in_GLuint(t, result);
+ yagl_transport_put_in_GLboolean(t, &retval);
+ yagl_transport_end(t);
+
+ return retval;
+}
+
+/*
+ * glGenSamplers wrapper. id = 174
+ */
+void yagl_host_glGenSamplers(const GLuint *samplers, int32_t samplers_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 174, 2 * 8, 0 * 8 + yagl_transport_array_size(samplers, samplers_count, sizeof(GLuint)));
+ yagl_transport_put_out_array(t, samplers, samplers_count, sizeof(GLuint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glBindSampler wrapper. id = 175
+ */
+void yagl_host_glBindSampler(GLuint unit, GLuint sampler)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 175, 2 * 8, 2 * 8);
+ yagl_transport_put_out_GLuint(t, unit);
+ yagl_transport_put_out_GLuint(t, sampler);
+ yagl_transport_end(t);
+}
+
+/*
+ * glSamplerParameteri wrapper. id = 176
+ */
+void yagl_host_glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 176, 3 * 8, 3 * 8);
+ yagl_transport_put_out_GLuint(t, sampler);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_out_GLint(t, param);
+ yagl_transport_end(t);
+}
+
+/*
+ * glSamplerParameteriv wrapper. id = 177
+ */
+void yagl_host_glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param, int32_t param_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 177, 4 * 8, 2 * 8 + yagl_transport_array_size(param, param_count, sizeof(GLint)));
+ yagl_transport_put_out_GLuint(t, sampler);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_out_array(t, param, param_count, sizeof(GLint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glSamplerParameterf wrapper. id = 178
+ */
+void yagl_host_glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 178, 3 * 8, 3 * 8);
+ yagl_transport_put_out_GLuint(t, sampler);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_out_GLfloat(t, param);
+ yagl_transport_end(t);
+}
+
+/*
+ * glSamplerParameterfv wrapper. id = 179
+ */
+void yagl_host_glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param, int32_t param_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 179, 4 * 8, 2 * 8 + yagl_transport_array_size(param, param_count, sizeof(GLfloat)));
+ yagl_transport_put_out_GLuint(t, sampler);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_out_array(t, param, param_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glDeleteObjects wrapper. id = 180
+ */
+void yagl_host_glDeleteObjects(const GLuint *objects, int32_t objects_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 180, 2 * 8, 0 * 8 + yagl_transport_array_size(objects, objects_count, sizeof(GLuint)));
+ yagl_transport_put_out_array(t, objects, objects_count, sizeof(GLuint));
+ yagl_transport_end(t);
+}
+
+/*
+ * glBlendEquation wrapper. id = 181
+ */
+void yagl_host_glBlendEquation(GLenum mode)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 181, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLenum(t, mode);
+ yagl_transport_end(t);
+}
+
+/*
+ * glBlendEquationSeparate wrapper. id = 182
+ */
+void yagl_host_glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 182, 2 * 8, 2 * 8);
+ yagl_transport_put_out_GLenum(t, modeRGB);
+ yagl_transport_put_out_GLenum(t, modeAlpha);
+ yagl_transport_end(t);
+}
+
+/*
+ * glBlendFunc wrapper. id = 183
+ */
+void yagl_host_glBlendFunc(GLenum sfactor, GLenum dfactor)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 183, 2 * 8, 2 * 8);
+ yagl_transport_put_out_GLenum(t, sfactor);
+ yagl_transport_put_out_GLenum(t, dfactor);
+ yagl_transport_end(t);
+}
+
+/*
+ * glBlendFuncSeparate wrapper. id = 184
+ */
+void yagl_host_glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 184, 4 * 8, 4 * 8);
+ yagl_transport_put_out_GLenum(t, srcRGB);
+ yagl_transport_put_out_GLenum(t, dstRGB);
+ yagl_transport_put_out_GLenum(t, srcAlpha);
+ yagl_transport_put_out_GLenum(t, dstAlpha);
+ yagl_transport_end(t);
+}
+
+/*
+ * glBlendColor wrapper. id = 185
+ */
+void yagl_host_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 185, 4 * 8, 4 * 8);
+ yagl_transport_put_out_GLclampf(t, red);
+ yagl_transport_put_out_GLclampf(t, green);
+ yagl_transport_put_out_GLclampf(t, blue);
+ yagl_transport_put_out_GLclampf(t, alpha);
+ yagl_transport_end(t);
+}
+
+/*
+ * glClear wrapper. id = 186
+ */
+void yagl_host_glClear(GLbitfield mask)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 186, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLbitfield(t, mask);
+ yagl_transport_end(t);
+}
+
+/*
+ * glClearColor wrapper. id = 187
+ */
+void yagl_host_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 187, 4 * 8, 4 * 8);
+ yagl_transport_put_out_GLclampf(t, red);
+ yagl_transport_put_out_GLclampf(t, green);
+ yagl_transport_put_out_GLclampf(t, blue);
+ yagl_transport_put_out_GLclampf(t, alpha);
+ yagl_transport_end(t);
+}
+
+/*
+ * glClearDepthf wrapper. id = 188
+ */
+void yagl_host_glClearDepthf(GLclampf depth)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 188, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLclampf(t, depth);
+ yagl_transport_end(t);
+}
+
+/*
+ * glClearStencil wrapper. id = 189
+ */
+void yagl_host_glClearStencil(GLint s)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 189, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLint(t, s);
+ yagl_transport_end(t);
+}
+
+/*
+ * glColorMask wrapper. id = 190
+ */
+void yagl_host_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 190, 4 * 8, 4 * 8);
+ yagl_transport_put_out_GLboolean(t, red);
+ yagl_transport_put_out_GLboolean(t, green);
+ yagl_transport_put_out_GLboolean(t, blue);
+ yagl_transport_put_out_GLboolean(t, alpha);
+ yagl_transport_end(t);
+}
+
+/*
+ * glCullFace wrapper. id = 191
+ */
+void yagl_host_glCullFace(GLenum mode)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 191, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLenum(t, mode);
+ yagl_transport_end(t);
+}
+
+/*
+ * glDepthFunc wrapper. id = 192
+ */
+void yagl_host_glDepthFunc(GLenum func)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 192, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLenum(t, func);
+ yagl_transport_end(t);
+}
+
+/*
+ * glDepthMask wrapper. id = 193
+ */
+void yagl_host_glDepthMask(GLboolean flag)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 193, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLboolean(t, flag);
+ yagl_transport_end(t);
+}
+
+/*
+ * glDepthRangef wrapper. id = 194
+ */
+void yagl_host_glDepthRangef(GLclampf zNear, GLclampf zFar)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 194, 2 * 8, 2 * 8);
+ yagl_transport_put_out_GLclampf(t, zNear);
+ yagl_transport_put_out_GLclampf(t, zFar);
+ yagl_transport_end(t);
+}
+
+/*
+ * glEnable wrapper. id = 195
+ */
+void yagl_host_glEnable(GLenum cap)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 195, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLenum(t, cap);
+ yagl_transport_end(t);
+}
+
+/*
+ * glDisable wrapper. id = 196
+ */
+void yagl_host_glDisable(GLenum cap)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 196, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLenum(t, cap);
+ yagl_transport_end(t);
+}
+
+/*
+ * glFlush wrapper. id = 197
+ */
+void yagl_host_glFlush()
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 197, 0 * 8, 0 * 8);
+ yagl_transport_end(t);
+ yagl_transport_flush(t, NULL);
+}
+
+/*
+ * glFrontFace wrapper. id = 198
+ */
+void yagl_host_glFrontFace(GLenum mode)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 198, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLenum(t, mode);
+ yagl_transport_end(t);
+}
+
+/*
+ * glGenerateMipmap wrapper. id = 199
+ */
+void yagl_host_glGenerateMipmap(GLenum target)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 199, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_end(t);
+}
+
+/*
+ * glHint wrapper. id = 200
+ */
+void yagl_host_glHint(GLenum target, GLenum mode)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 200, 2 * 8, 2 * 8);
+ yagl_transport_put_out_GLenum(t, target);
+ yagl_transport_put_out_GLenum(t, mode);
+ yagl_transport_end(t);
+}
+
+/*
+ * glLineWidth wrapper. id = 201
+ */
+void yagl_host_glLineWidth(GLfloat width)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 201, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLfloat(t, width);
+ yagl_transport_end(t);
+}
+
+/*
+ * glPixelStorei wrapper. id = 202
+ */
+void yagl_host_glPixelStorei(GLenum pname, GLint param)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 202, 2 * 8, 2 * 8);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_out_GLint(t, param);
+ yagl_transport_end(t);
+}
+
+/*
+ * glPolygonOffset wrapper. id = 203
+ */
+void yagl_host_glPolygonOffset(GLfloat factor, GLfloat units)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 203, 2 * 8, 2 * 8);
+ yagl_transport_put_out_GLfloat(t, factor);
+ yagl_transport_put_out_GLfloat(t, units);
+ yagl_transport_end(t);
+}
+
+/*
+ * glScissor wrapper. id = 204
+ */
+void yagl_host_glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 204, 4 * 8, 4 * 8);
+ yagl_transport_put_out_GLint(t, x);
+ yagl_transport_put_out_GLint(t, y);
+ yagl_transport_put_out_GLsizei(t, width);
+ yagl_transport_put_out_GLsizei(t, height);
+ yagl_transport_end(t);
+}
+
+/*
+ * glStencilFunc wrapper. id = 205
+ */
+void yagl_host_glStencilFunc(GLenum func, GLint ref, GLuint mask)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 205, 3 * 8, 3 * 8);
+ yagl_transport_put_out_GLenum(t, func);
+ yagl_transport_put_out_GLint(t, ref);
+ yagl_transport_put_out_GLuint(t, mask);
+ yagl_transport_end(t);
+}
+
+/*
+ * glStencilMask wrapper. id = 206
+ */
+void yagl_host_glStencilMask(GLuint mask)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 206, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLuint(t, mask);
+ yagl_transport_end(t);
+}
+
+/*
+ * glStencilOp wrapper. id = 207
+ */
+void yagl_host_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 207, 3 * 8, 3 * 8);
+ yagl_transport_put_out_GLenum(t, fail);
+ yagl_transport_put_out_GLenum(t, zfail);
+ yagl_transport_put_out_GLenum(t, zpass);
+ yagl_transport_end(t);
+}
+
+/*
+ * glSampleCoverage wrapper. id = 208
+ */
+void yagl_host_glSampleCoverage(GLclampf value, GLboolean invert)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 208, 2 * 8, 2 * 8);
+ yagl_transport_put_out_GLclampf(t, value);
+ yagl_transport_put_out_GLboolean(t, invert);
+ yagl_transport_end(t);
+}
+
+/*
+ * glViewport wrapper. id = 209
+ */
+void yagl_host_glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 209, 4 * 8, 4 * 8);
+ yagl_transport_put_out_GLint(t, x);
+ yagl_transport_put_out_GLint(t, y);
+ yagl_transport_put_out_GLsizei(t, width);
+ yagl_transport_put_out_GLsizei(t, height);
+ yagl_transport_end(t);
+}
+
+/*
+ * glStencilFuncSeparate wrapper. id = 210
+ */
+void yagl_host_glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 210, 4 * 8, 4 * 8);
+ yagl_transport_put_out_GLenum(t, face);
+ yagl_transport_put_out_GLenum(t, func);
+ yagl_transport_put_out_GLint(t, ref);
+ yagl_transport_put_out_GLuint(t, mask);
+ yagl_transport_end(t);
+}
+
+/*
+ * glStencilMaskSeparate wrapper. id = 211
+ */
+void yagl_host_glStencilMaskSeparate(GLenum face, GLuint mask)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 211, 2 * 8, 2 * 8);
+ yagl_transport_put_out_GLenum(t, face);
+ yagl_transport_put_out_GLuint(t, mask);
+ yagl_transport_end(t);
+}
+
+/*
+ * glStencilOpSeparate wrapper. id = 212
+ */
+void yagl_host_glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 212, 4 * 8, 4 * 8);
+ yagl_transport_put_out_GLenum(t, face);
+ yagl_transport_put_out_GLenum(t, fail);
+ yagl_transport_put_out_GLenum(t, zfail);
+ yagl_transport_put_out_GLenum(t, zpass);
+ yagl_transport_end(t);
+}
+
+/*
+ * glPointSize wrapper. id = 213
+ */
+void yagl_host_glPointSize(GLfloat size)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 213, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLfloat(t, size);
+ yagl_transport_end(t);
+}
+
+/*
+ * glAlphaFunc wrapper. id = 214
+ */
+void yagl_host_glAlphaFunc(GLenum func, GLclampf ref)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 214, 2 * 8, 2 * 8);
+ yagl_transport_put_out_GLenum(t, func);
+ yagl_transport_put_out_GLclampf(t, ref);
+ yagl_transport_end(t);
+}
+
+/*
+ * glMatrixMode wrapper. id = 215
+ */
+void yagl_host_glMatrixMode(GLenum mode)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 215, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLenum(t, mode);
+ yagl_transport_end(t);
+}
+
+/*
+ * glLoadIdentity wrapper. id = 216
+ */
+void yagl_host_glLoadIdentity()
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 216, 0 * 8, 0 * 8);
+ yagl_transport_end(t);
+}
+
+/*
+ * glPopMatrix wrapper. id = 217
+ */
+void yagl_host_glPopMatrix()
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 217, 0 * 8, 0 * 8);
+ yagl_transport_end(t);
+}
+
+/*
+ * glPushMatrix wrapper. id = 218
+ */
+void yagl_host_glPushMatrix()
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 218, 0 * 8, 0 * 8);
+ yagl_transport_end(t);
+}
+
+/*
+ * glRotatef wrapper. id = 219
+ */
+void yagl_host_glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 219, 4 * 8, 4 * 8);
+ yagl_transport_put_out_GLfloat(t, angle);
+ yagl_transport_put_out_GLfloat(t, x);
+ yagl_transport_put_out_GLfloat(t, y);
+ yagl_transport_put_out_GLfloat(t, z);
+ yagl_transport_end(t);
+}
+
+/*
+ * glTranslatef wrapper. id = 220
+ */
+void yagl_host_glTranslatef(GLfloat x, GLfloat y, GLfloat z)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 220, 3 * 8, 3 * 8);
+ yagl_transport_put_out_GLfloat(t, x);
+ yagl_transport_put_out_GLfloat(t, y);
+ yagl_transport_put_out_GLfloat(t, z);
+ yagl_transport_end(t);
+}
+
+/*
+ * glScalef wrapper. id = 221
+ */
+void yagl_host_glScalef(GLfloat x, GLfloat y, GLfloat z)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 221, 3 * 8, 3 * 8);
+ yagl_transport_put_out_GLfloat(t, x);
+ yagl_transport_put_out_GLfloat(t, y);
+ yagl_transport_put_out_GLfloat(t, z);
+ yagl_transport_end(t);
+}
+
+/*
+ * glOrthof wrapper. id = 222
+ */
+void yagl_host_glOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 222, 6 * 8, 6 * 8);
+ yagl_transport_put_out_GLfloat(t, left);
+ yagl_transport_put_out_GLfloat(t, right);
+ yagl_transport_put_out_GLfloat(t, bottom);
+ yagl_transport_put_out_GLfloat(t, top);
+ yagl_transport_put_out_GLfloat(t, zNear);
+ yagl_transport_put_out_GLfloat(t, zFar);
+ yagl_transport_end(t);
+}
+
+/*
+ * glColor4f wrapper. id = 223
+ */
+void yagl_host_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 223, 4 * 8, 4 * 8);
+ yagl_transport_put_out_GLfloat(t, red);
+ yagl_transport_put_out_GLfloat(t, green);
+ yagl_transport_put_out_GLfloat(t, blue);
+ yagl_transport_put_out_GLfloat(t, alpha);
+ yagl_transport_end(t);
+}
+
+/*
+ * glColor4ub wrapper. id = 224
+ */
+void yagl_host_glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 224, 4 * 8, 4 * 8);
+ yagl_transport_put_out_GLubyte(t, red);
+ yagl_transport_put_out_GLubyte(t, green);
+ yagl_transport_put_out_GLubyte(t, blue);
+ yagl_transport_put_out_GLubyte(t, alpha);
+ yagl_transport_end(t);
+}
+
+/*
+ * glNormal3f wrapper. id = 225
+ */
+void yagl_host_glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 225, 3 * 8, 3 * 8);
+ yagl_transport_put_out_GLfloat(t, nx);
+ yagl_transport_put_out_GLfloat(t, ny);
+ yagl_transport_put_out_GLfloat(t, nz);
+ yagl_transport_end(t);
+}
+
+/*
+ * glPointParameterf wrapper. id = 226
+ */
+void yagl_host_glPointParameterf(GLenum pname, GLfloat param)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 226, 2 * 8, 2 * 8);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_out_GLfloat(t, param);
+ yagl_transport_end(t);
+}
+
+/*
+ * glPointParameterfv wrapper. id = 227
+ */
+void yagl_host_glPointParameterfv(GLenum pname, const GLfloat *params, int32_t params_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 227, 3 * 8, 1 * 8 + yagl_transport_array_size(params, params_count, sizeof(GLfloat)));
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_out_array(t, params, params_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glFogf wrapper. id = 228
+ */
+void yagl_host_glFogf(GLenum pname, GLfloat param)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 228, 2 * 8, 2 * 8);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_out_GLfloat(t, param);
+ yagl_transport_end(t);
+}
+
+/*
+ * glFogfv wrapper. id = 229
+ */
+void yagl_host_glFogfv(GLenum pname, const GLfloat *params, int32_t params_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 229, 3 * 8, 1 * 8 + yagl_transport_array_size(params, params_count, sizeof(GLfloat)));
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_out_array(t, params, params_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glFrustumf wrapper. id = 230
+ */
+void yagl_host_glFrustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 230, 6 * 8, 6 * 8);
+ yagl_transport_put_out_GLfloat(t, left);
+ yagl_transport_put_out_GLfloat(t, right);
+ yagl_transport_put_out_GLfloat(t, bottom);
+ yagl_transport_put_out_GLfloat(t, top);
+ yagl_transport_put_out_GLfloat(t, zNear);
+ yagl_transport_put_out_GLfloat(t, zFar);
+ yagl_transport_end(t);
+}
+
+/*
+ * glLightf wrapper. id = 231
+ */
+void yagl_host_glLightf(GLenum light, GLenum pname, GLfloat param)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 231, 3 * 8, 3 * 8);
+ yagl_transport_put_out_GLenum(t, light);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_out_GLfloat(t, param);
+ yagl_transport_end(t);
+}
+
+/*
+ * glLightfv wrapper. id = 232
+ */
+void yagl_host_glLightfv(GLenum light, GLenum pname, const GLfloat *params, int32_t params_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 232, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_count, sizeof(GLfloat)));
+ yagl_transport_put_out_GLenum(t, light);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_out_array(t, params, params_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetLightfv wrapper. id = 233
+ */
+void yagl_host_glGetLightfv(GLenum light, GLenum pname, GLfloat *params, int32_t params_maxcount, int32_t *params_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 233, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_maxcount, sizeof(GLfloat)));
+ yagl_transport_put_out_GLenum(t, light);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_in_array(t, params, params_maxcount, params_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glLightModelf wrapper. id = 234
+ */
+void yagl_host_glLightModelf(GLenum pname, GLfloat param)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 234, 2 * 8, 2 * 8);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_out_GLfloat(t, param);
+ yagl_transport_end(t);
+}
+
+/*
+ * glLightModelfv wrapper. id = 235
+ */
+void yagl_host_glLightModelfv(GLenum pname, const GLfloat *params, int32_t params_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 235, 3 * 8, 1 * 8 + yagl_transport_array_size(params, params_count, sizeof(GLfloat)));
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_out_array(t, params, params_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glMaterialf wrapper. id = 236
+ */
+void yagl_host_glMaterialf(GLenum face, GLenum pname, GLfloat param)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 236, 3 * 8, 3 * 8);
+ yagl_transport_put_out_GLenum(t, face);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_out_GLfloat(t, param);
+ yagl_transport_end(t);
+}
+
+/*
+ * glMaterialfv wrapper. id = 237
+ */
+void yagl_host_glMaterialfv(GLenum face, GLenum pname, const GLfloat *params, int32_t params_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 237, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_count, sizeof(GLfloat)));
+ yagl_transport_put_out_GLenum(t, face);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_out_array(t, params, params_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetMaterialfv wrapper. id = 238
+ */
+void yagl_host_glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params, int32_t params_maxcount, int32_t *params_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 238, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_maxcount, sizeof(GLfloat)));
+ yagl_transport_put_out_GLenum(t, face);
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_in_array(t, params, params_maxcount, params_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glShadeModel wrapper. id = 239
+ */
+void yagl_host_glShadeModel(GLenum mode)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 239, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLenum(t, mode);
+ yagl_transport_end(t);
+}
+
+/*
+ * glLogicOp wrapper. id = 240
+ */
+void yagl_host_glLogicOp(GLenum opcode)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 240, 1 * 8, 1 * 8);
+ yagl_transport_put_out_GLenum(t, opcode);
+ yagl_transport_end(t);
+}
+
+/*
+ * glMultMatrixf wrapper. id = 241
+ */
+void yagl_host_glMultMatrixf(const GLfloat *m, int32_t m_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 241, 2 * 8, 0 * 8 + yagl_transport_array_size(m, m_count, sizeof(GLfloat)));
+ yagl_transport_put_out_array(t, m, m_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glLoadMatrixf wrapper. id = 242
+ */
+void yagl_host_glLoadMatrixf(const GLfloat *m, int32_t m_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 242, 2 * 8, 0 * 8 + yagl_transport_array_size(m, m_count, sizeof(GLfloat)));
+ yagl_transport_put_out_array(t, m, m_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glClipPlanef wrapper. id = 243
+ */
+void yagl_host_glClipPlanef(GLenum plane, const GLfloat *equation, int32_t equation_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 243, 3 * 8, 1 * 8 + yagl_transport_array_size(equation, equation_count, sizeof(GLfloat)));
+ yagl_transport_put_out_GLenum(t, plane);
+ yagl_transport_put_out_array(t, equation, equation_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glGetClipPlanef wrapper. id = 244
+ */
+void yagl_host_glGetClipPlanef(GLenum pname, GLfloat *eqn, int32_t eqn_maxcount, int32_t *eqn_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 244, 3 * 8, 1 * 8 + yagl_transport_array_size(eqn, eqn_maxcount, sizeof(GLfloat)));
+ yagl_transport_put_out_GLenum(t, pname);
+ yagl_transport_put_in_array(t, eqn, eqn_maxcount, eqn_count, sizeof(GLfloat));
+ yagl_transport_end(t);
+}
+
+/*
+ * glUpdateOffscreenImageYAGL wrapper. id = 245
+ */
+void yagl_host_glUpdateOffscreenImageYAGL(GLuint texture, uint32_t width, uint32_t height, uint32_t bpp, const void *pixels, int32_t pixels_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 245, 6 * 8, 4 * 8 + yagl_transport_array_size(pixels, pixels_count, 1));
+ yagl_transport_put_out_GLuint(t, texture);
+ yagl_transport_put_out_uint32_t(t, width);
+ yagl_transport_put_out_uint32_t(t, height);
+ yagl_transport_put_out_uint32_t(t, bpp);
+ yagl_transport_put_out_array(t, pixels, pixels_count, 1);
+ yagl_transport_end(t);
+}
+
+/*
+ * glGenUniformLocationYAGL wrapper. id = 246
+ */
+void yagl_host_glGenUniformLocationYAGL(uint32_t location, GLuint program, const GLchar *name, int32_t name_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 246, 4 * 8, 2 * 8 + yagl_transport_array_size(name, name_count, sizeof(GLchar)));
+ yagl_transport_put_out_uint32_t(t, location);
+ yagl_transport_put_out_GLuint(t, program);
+ yagl_transport_put_out_array(t, name, name_count, sizeof(GLchar));
+ yagl_transport_end(t);
+}
+
+/*
+ * glDeleteUniformLocationsYAGL wrapper. id = 247
+ */
+void yagl_host_glDeleteUniformLocationsYAGL(const uint32_t *locations, int32_t locations_count)
+{
+ struct yagl_transport *t = yagl_get_transport();
+
+ yagl_transport_begin(t, yagl_api_id_gles, 247, 2 * 8, 0 * 8 + yagl_transport_array_size(locations, locations_count, sizeof(uint32_t)));
+ yagl_transport_put_out_array(t, locations, locations_count, sizeof(uint32_t));
+ yagl_transport_end(t);
+}
--- /dev/null
+/*
+ * Generated by gen-yagl-calls.py, do not modify!
+ */
+#ifndef _YAGL_HOST_GLES_CALLS_H_
+#define _YAGL_HOST_GLES_CALLS_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+
+/*
+ * glDrawArrays wrapper. id = 1
+ */
+void yagl_host_glDrawArrays(GLenum mode, GLint first, GLsizei count);
+
+/*
+ * glDrawElements wrapper. id = 2
+ */
+void yagl_host_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, int32_t indices_count);
+
+/*
+ * glReadPixelsData wrapper. id = 3
+ */
+void yagl_host_glReadPixelsData(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels, int32_t pixels_maxcount, int32_t *pixels_count);
+
+/*
+ * glReadPixelsOffset wrapper. id = 4
+ */
+void yagl_host_glReadPixelsOffset(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei pixels);
+
+/*
+ * glDrawArraysInstanced wrapper. id = 5
+ */
+void yagl_host_glDrawArraysInstanced(GLenum mode, GLint start, GLsizei count, GLsizei primcount);
+
+/*
+ * glDrawElementsInstanced wrapper. id = 6
+ */
+void yagl_host_glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const void *indices, int32_t indices_count, GLsizei primcount);
+
+/*
+ * glDrawRangeElements wrapper. id = 7
+ */
+void yagl_host_glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, int32_t indices_count);
+
+/*
+ * glGenVertexArrays wrapper. id = 8
+ */
+void yagl_host_glGenVertexArrays(const GLuint *arrays, int32_t arrays_count);
+
+/*
+ * glBindVertexArray wrapper. id = 9
+ */
+void yagl_host_glBindVertexArray(GLuint array);
+
+/*
+ * glDisableVertexAttribArray wrapper. id = 10
+ */
+void yagl_host_glDisableVertexAttribArray(GLuint index);
+
+/*
+ * glEnableVertexAttribArray wrapper. id = 11
+ */
+void yagl_host_glEnableVertexAttribArray(GLuint index);
+
+/*
+ * glVertexAttribPointerData wrapper. id = 12
+ */
+void yagl_host_glVertexAttribPointerData(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLint first, const GLvoid *data, int32_t data_count);
+
+/*
+ * glVertexAttribPointerOffset wrapper. id = 13
+ */
+void yagl_host_glVertexAttribPointerOffset(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLsizei offset);
+
+/*
+ * glVertexPointerData wrapper. id = 14
+ */
+void yagl_host_glVertexPointerData(GLint size, GLenum type, GLsizei stride, GLint first, const GLvoid *data, int32_t data_count);
+
+/*
+ * glVertexPointerOffset wrapper. id = 15
+ */
+void yagl_host_glVertexPointerOffset(GLint size, GLenum type, GLsizei stride, GLsizei offset);
+
+/*
+ * glNormalPointerData wrapper. id = 16
+ */
+void yagl_host_glNormalPointerData(GLenum type, GLsizei stride, GLint first, const GLvoid *data, int32_t data_count);
+
+/*
+ * glNormalPointerOffset wrapper. id = 17
+ */
+void yagl_host_glNormalPointerOffset(GLenum type, GLsizei stride, GLsizei offset);
+
+/*
+ * glColorPointerData wrapper. id = 18
+ */
+void yagl_host_glColorPointerData(GLint size, GLenum type, GLsizei stride, GLint first, const GLvoid *data, int32_t data_count);
+
+/*
+ * glColorPointerOffset wrapper. id = 19
+ */
+void yagl_host_glColorPointerOffset(GLint size, GLenum type, GLsizei stride, GLsizei offset);
+
+/*
+ * glTexCoordPointerData wrapper. id = 20
+ */
+void yagl_host_glTexCoordPointerData(GLint tex_id, GLint size, GLenum type, GLsizei stride, GLint first, const GLvoid *data, int32_t data_count);
+
+/*
+ * glTexCoordPointerOffset wrapper. id = 21
+ */
+void yagl_host_glTexCoordPointerOffset(GLint size, GLenum type, GLsizei stride, GLsizei offset);
+
+/*
+ * glDisableClientState wrapper. id = 22
+ */
+void yagl_host_glDisableClientState(GLenum array);
+
+/*
+ * glEnableClientState wrapper. id = 23
+ */
+void yagl_host_glEnableClientState(GLenum array);
+
+/*
+ * glVertexAttribDivisor wrapper. id = 24
+ */
+void yagl_host_glVertexAttribDivisor(GLuint index, GLuint divisor);
+
+/*
+ * glVertexAttribIPointerData wrapper. id = 25
+ */
+void yagl_host_glVertexAttribIPointerData(GLuint index, GLint size, GLenum type, GLsizei stride, GLint first, const GLvoid *data, int32_t data_count);
+
+/*
+ * glVertexAttribIPointerOffset wrapper. id = 26
+ */
+void yagl_host_glVertexAttribIPointerOffset(GLuint index, GLint size, GLenum type, GLsizei stride, GLsizei offset);
+
+/*
+ * glGenBuffers wrapper. id = 27
+ */
+void yagl_host_glGenBuffers(const GLuint *buffers, int32_t buffers_count);
+
+/*
+ * glBindBuffer wrapper. id = 28
+ */
+void yagl_host_glBindBuffer(GLenum target, GLuint buffer);
+
+/*
+ * glBufferData wrapper. id = 29
+ */
+void yagl_host_glBufferData(GLenum target, const GLvoid *data, int32_t data_count, GLenum usage);
+
+/*
+ * glBufferSubData wrapper. id = 30
+ */
+void yagl_host_glBufferSubData(GLenum target, GLsizei offset, const GLvoid *data, int32_t data_count);
+
+/*
+ * glBindBufferBase wrapper. id = 31
+ */
+void yagl_host_glBindBufferBase(GLenum target, GLuint index, GLuint buffer);
+
+/*
+ * glBindBufferRange wrapper. id = 32
+ */
+void yagl_host_glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLint offset, GLsizei size);
+
+/*
+ * glMapBuffer wrapper. id = 33
+ */
+void yagl_host_glMapBuffer(GLuint buffer, const GLuint *ranges, int32_t ranges_count, GLvoid *data, int32_t data_maxcount, int32_t *data_count);
+
+/*
+ * glCopyBufferSubData wrapper. id = 34
+ */
+void yagl_host_glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLint readOffset, GLint writeOffset, GLsizei size);
+
+/*
+ * glGenTextures wrapper. id = 35
+ */
+void yagl_host_glGenTextures(const GLuint *textures, int32_t textures_count);
+
+/*
+ * glBindTexture wrapper. id = 36
+ */
+void yagl_host_glBindTexture(GLenum target, GLuint texture);
+
+/*
+ * glActiveTexture wrapper. id = 37
+ */
+void yagl_host_glActiveTexture(GLenum texture);
+
+/*
+ * glCopyTexImage2D wrapper. id = 38
+ */
+void yagl_host_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+
+/*
+ * glCopyTexSubImage2D wrapper. id = 39
+ */
+void yagl_host_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+
+/*
+ * glGetTexParameterfv wrapper. id = 40
+ */
+void yagl_host_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *param);
+
+/*
+ * glGetTexParameteriv wrapper. id = 41
+ */
+void yagl_host_glGetTexParameteriv(GLenum target, GLenum pname, GLint *param);
+
+/*
+ * glTexImage2DData wrapper. id = 42
+ */
+void yagl_host_glTexImage2DData(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, int32_t pixels_count);
+
+/*
+ * glTexImage2DOffset wrapper. id = 43
+ */
+void yagl_host_glTexImage2DOffset(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLsizei pixels);
+
+/*
+ * glTexParameterf wrapper. id = 44
+ */
+void yagl_host_glTexParameterf(GLenum target, GLenum pname, GLfloat param);
+
+/*
+ * glTexParameterfv wrapper. id = 45
+ */
+void yagl_host_glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params, int32_t params_count);
+
+/*
+ * glTexParameteri wrapper. id = 46
+ */
+void yagl_host_glTexParameteri(GLenum target, GLenum pname, GLint param);
+
+/*
+ * glTexParameteriv wrapper. id = 47
+ */
+void yagl_host_glTexParameteriv(GLenum target, GLenum pname, const GLint *params, int32_t params_count);
+
+/*
+ * glTexSubImage2DData wrapper. id = 48
+ */
+void yagl_host_glTexSubImage2DData(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, int32_t pixels_count);
+
+/*
+ * glTexSubImage2DOffset wrapper. id = 49
+ */
+void yagl_host_glTexSubImage2DOffset(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei pixels);
+
+/*
+ * glClientActiveTexture wrapper. id = 50
+ */
+void yagl_host_glClientActiveTexture(GLenum texture);
+
+/*
+ * glTexEnvi wrapper. id = 51
+ */
+void yagl_host_glTexEnvi(GLenum target, GLenum pname, GLint param);
+
+/*
+ * glTexEnvf wrapper. id = 52
+ */
+void yagl_host_glTexEnvf(GLenum target, GLenum pname, GLfloat param);
+
+/*
+ * glMultiTexCoord4f wrapper. id = 53
+ */
+void yagl_host_glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat tt, GLfloat r, GLfloat q);
+
+/*
+ * glTexEnviv wrapper. id = 54
+ */
+void yagl_host_glTexEnviv(GLenum target, GLenum pname, const GLint *params, int32_t params_count);
+
+/*
+ * glTexEnvfv wrapper. id = 55
+ */
+void yagl_host_glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params, int32_t params_count);
+
+/*
+ * glGetTexEnviv wrapper. id = 56
+ */
+void yagl_host_glGetTexEnviv(GLenum env, GLenum pname, GLint *params, int32_t params_maxcount, int32_t *params_count);
+
+/*
+ * glGetTexEnvfv wrapper. id = 57
+ */
+void yagl_host_glGetTexEnvfv(GLenum env, GLenum pname, GLfloat *params, int32_t params_maxcount, int32_t *params_count);
+
+/*
+ * glTexImage3DData wrapper. id = 58
+ */
+void yagl_host_glTexImage3DData(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels, int32_t pixels_count);
+
+/*
+ * glTexImage3DOffset wrapper. id = 59
+ */
+void yagl_host_glTexImage3DOffset(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLsizei pixels);
+
+/*
+ * glTexSubImage3DData wrapper. id = 60
+ */
+void yagl_host_glTexSubImage3DData(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels, int32_t pixels_count);
+
+/*
+ * glTexSubImage3DOffset wrapper. id = 61
+ */
+void yagl_host_glTexSubImage3DOffset(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei pixels);
+
+/*
+ * glCopyTexSubImage3D wrapper. id = 62
+ */
+void yagl_host_glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+
+/*
+ * glGenFramebuffers wrapper. id = 63
+ */
+void yagl_host_glGenFramebuffers(const GLuint *framebuffers, int32_t framebuffers_count);
+
+/*
+ * glBindFramebuffer wrapper. id = 64
+ */
+void yagl_host_glBindFramebuffer(GLenum target, GLuint framebuffer);
+
+/*
+ * glFramebufferTexture2D wrapper. id = 65
+ */
+void yagl_host_glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+
+/*
+ * glFramebufferRenderbuffer wrapper. id = 66
+ */
+void yagl_host_glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+
+/*
+ * glBlitFramebuffer wrapper. id = 67
+ */
+void yagl_host_glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+
+/*
+ * glDrawBuffers wrapper. id = 68
+ */
+void yagl_host_glDrawBuffers(const GLenum *bufs, int32_t bufs_count);
+
+/*
+ * glReadBuffer wrapper. id = 69
+ */
+void yagl_host_glReadBuffer(GLenum mode);
+
+/*
+ * glFramebufferTexture3D wrapper. id = 70
+ */
+void yagl_host_glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+
+/*
+ * glFramebufferTextureLayer wrapper. id = 71
+ */
+void yagl_host_glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+
+/*
+ * glClearBufferiv wrapper. id = 72
+ */
+void yagl_host_glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value, int32_t value_count);
+
+/*
+ * glClearBufferuiv wrapper. id = 73
+ */
+void yagl_host_glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value, int32_t value_count);
+
+/*
+ * glClearBufferfi wrapper. id = 74
+ */
+void yagl_host_glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
+
+/*
+ * glClearBufferfv wrapper. id = 75
+ */
+void yagl_host_glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value, int32_t value_count);
+
+/*
+ * glGenRenderbuffers wrapper. id = 76
+ */
+void yagl_host_glGenRenderbuffers(const GLuint *renderbuffers, int32_t renderbuffers_count);
+
+/*
+ * glBindRenderbuffer wrapper. id = 77
+ */
+void yagl_host_glBindRenderbuffer(GLenum target, GLuint renderbuffer);
+
+/*
+ * glRenderbufferStorage wrapper. id = 78
+ */
+void yagl_host_glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+
+/*
+ * glGetRenderbufferParameteriv wrapper. id = 79
+ */
+void yagl_host_glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *param);
+
+/*
+ * glRenderbufferStorageMultisample wrapper. id = 80
+ */
+void yagl_host_glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+
+/*
+ * glCreateProgram wrapper. id = 81
+ */
+void yagl_host_glCreateProgram(GLuint program);
+
+/*
+ * glCreateShader wrapper. id = 82
+ */
+void yagl_host_glCreateShader(GLuint shader, GLenum type);
+
+/*
+ * glShaderSource wrapper. id = 83
+ */
+void yagl_host_glShaderSource(GLuint shader, const GLchar *string, int32_t string_count);
+
+/*
+ * glAttachShader wrapper. id = 84
+ */
+void yagl_host_glAttachShader(GLuint program, GLuint shader);
+
+/*
+ * glDetachShader wrapper. id = 85
+ */
+void yagl_host_glDetachShader(GLuint program, GLuint shader);
+
+/*
+ * glCompileShader wrapper. id = 86
+ */
+void yagl_host_glCompileShader(GLuint shader);
+
+/*
+ * glBindAttribLocation wrapper. id = 87
+ */
+void yagl_host_glBindAttribLocation(GLuint program, GLuint index, const GLchar *name, int32_t name_count);
+
+/*
+ * glGetActiveAttrib wrapper. id = 88
+ */
+void yagl_host_glGetActiveAttrib(GLuint program, GLuint index, GLint *size, GLenum *type, GLchar *name, int32_t name_maxcount, int32_t *name_count);
+
+/*
+ * glGetActiveUniform wrapper. id = 89
+ */
+void yagl_host_glGetActiveUniform(GLuint program, GLuint index, GLint *size, GLenum *type, GLchar *name, int32_t name_maxcount, int32_t *name_count);
+
+/*
+ * glGetAttribLocation wrapper. id = 90
+ */
+int yagl_host_glGetAttribLocation(GLuint program, const GLchar *name, int32_t name_count);
+
+/*
+ * glGetProgramiv wrapper. id = 91
+ */
+void yagl_host_glGetProgramiv(GLuint program, GLenum pname, GLint *param);
+
+/*
+ * glGetProgramInfoLog wrapper. id = 92
+ */
+GLboolean yagl_host_glGetProgramInfoLog(GLuint program, GLchar *infolog, int32_t infolog_maxcount, int32_t *infolog_count);
+
+/*
+ * glGetShaderiv wrapper. id = 93
+ */
+void yagl_host_glGetShaderiv(GLuint shader, GLenum pname, GLint *param);
+
+/*
+ * glGetShaderInfoLog wrapper. id = 94
+ */
+GLboolean yagl_host_glGetShaderInfoLog(GLuint shader, GLchar *infolog, int32_t infolog_maxcount, int32_t *infolog_count);
+
+/*
+ * glGetUniformfv wrapper. id = 95
+ */
+void yagl_host_glGetUniformfv(GLboolean tl, GLuint program, uint32_t location, GLfloat *params, int32_t params_maxcount, int32_t *params_count);
+
+/*
+ * glGetUniformiv wrapper. id = 96
+ */
+void yagl_host_glGetUniformiv(GLboolean tl, GLuint program, uint32_t location, GLint *params, int32_t params_maxcount, int32_t *params_count);
+
+/*
+ * glGetUniformLocation wrapper. id = 97
+ */
+int yagl_host_glGetUniformLocation(GLuint program, const GLchar *name, int32_t name_count);
+
+/*
+ * glGetVertexAttribfv wrapper. id = 98
+ */
+void yagl_host_glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params, int32_t params_maxcount, int32_t *params_count);
+
+/*
+ * glGetVertexAttribiv wrapper. id = 99
+ */
+void yagl_host_glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params, int32_t params_maxcount, int32_t *params_count);
+
+/*
+ * glLinkProgram wrapper. id = 100
+ */
+void yagl_host_glLinkProgram(GLuint program, GLint *params, int32_t params_maxcount, int32_t *params_count);
+
+/*
+ * glUniform1f wrapper. id = 101
+ */
+void yagl_host_glUniform1f(GLboolean tl, uint32_t location, GLfloat x);
+
+/*
+ * glUniform1fv wrapper. id = 102
+ */
+void yagl_host_glUniform1fv(GLboolean tl, uint32_t location, const GLfloat *v, int32_t v_count);
+
+/*
+ * glUniform1i wrapper. id = 103
+ */
+void yagl_host_glUniform1i(GLboolean tl, uint32_t location, GLint x);
+
+/*
+ * glUniform1iv wrapper. id = 104
+ */
+void yagl_host_glUniform1iv(GLboolean tl, uint32_t location, const GLint *v, int32_t v_count);
+
+/*
+ * glUniform2f wrapper. id = 105
+ */
+void yagl_host_glUniform2f(GLboolean tl, uint32_t location, GLfloat x, GLfloat y);
+
+/*
+ * glUniform2fv wrapper. id = 106
+ */
+void yagl_host_glUniform2fv(GLboolean tl, uint32_t location, const GLfloat *v, int32_t v_count);
+
+/*
+ * glUniform2i wrapper. id = 107
+ */
+void yagl_host_glUniform2i(GLboolean tl, uint32_t location, GLint x, GLint y);
+
+/*
+ * glUniform2iv wrapper. id = 108
+ */
+void yagl_host_glUniform2iv(GLboolean tl, uint32_t location, const GLint *v, int32_t v_count);
+
+/*
+ * glUniform3f wrapper. id = 109
+ */
+void yagl_host_glUniform3f(GLboolean tl, uint32_t location, GLfloat x, GLfloat y, GLfloat z);
+
+/*
+ * glUniform3fv wrapper. id = 110
+ */
+void yagl_host_glUniform3fv(GLboolean tl, uint32_t location, const GLfloat *v, int32_t v_count);
+
+/*
+ * glUniform3i wrapper. id = 111
+ */
+void yagl_host_glUniform3i(GLboolean tl, uint32_t location, GLint x, GLint y, GLint z);
+
+/*
+ * glUniform3iv wrapper. id = 112
+ */
+void yagl_host_glUniform3iv(GLboolean tl, uint32_t location, const GLint *v, int32_t v_count);
+
+/*
+ * glUniform4f wrapper. id = 113
+ */
+void yagl_host_glUniform4f(GLboolean tl, uint32_t location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+
+/*
+ * glUniform4fv wrapper. id = 114
+ */
+void yagl_host_glUniform4fv(GLboolean tl, uint32_t location, const GLfloat *v, int32_t v_count);
+
+/*
+ * glUniform4i wrapper. id = 115
+ */
+void yagl_host_glUniform4i(GLboolean tl, uint32_t location, GLint x, GLint y, GLint z, GLint w);
+
+/*
+ * glUniform4iv wrapper. id = 116
+ */
+void yagl_host_glUniform4iv(GLboolean tl, uint32_t location, const GLint *v, int32_t v_count);
+
+/*
+ * glUniformMatrix2fv wrapper. id = 117
+ */
+void yagl_host_glUniformMatrix2fv(GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count);
+
+/*
+ * glUniformMatrix3fv wrapper. id = 118
+ */
+void yagl_host_glUniformMatrix3fv(GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count);
+
+/*
+ * glUniformMatrix4fv wrapper. id = 119
+ */
+void yagl_host_glUniformMatrix4fv(GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count);
+
+/*
+ * glUseProgram wrapper. id = 120
+ */
+void yagl_host_glUseProgram(GLuint program);
+
+/*
+ * glValidateProgram wrapper. id = 121
+ */
+void yagl_host_glValidateProgram(GLuint program);
+
+/*
+ * glVertexAttrib1f wrapper. id = 122
+ */
+void yagl_host_glVertexAttrib1f(GLuint indx, GLfloat x);
+
+/*
+ * glVertexAttrib1fv wrapper. id = 123
+ */
+void yagl_host_glVertexAttrib1fv(GLuint indx, const GLfloat *values, int32_t values_count);
+
+/*
+ * glVertexAttrib2f wrapper. id = 124
+ */
+void yagl_host_glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
+
+/*
+ * glVertexAttrib2fv wrapper. id = 125
+ */
+void yagl_host_glVertexAttrib2fv(GLuint indx, const GLfloat *values, int32_t values_count);
+
+/*
+ * glVertexAttrib3f wrapper. id = 126
+ */
+void yagl_host_glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
+
+/*
+ * glVertexAttrib3fv wrapper. id = 127
+ */
+void yagl_host_glVertexAttrib3fv(GLuint indx, const GLfloat *values, int32_t values_count);
+
+/*
+ * glVertexAttrib4f wrapper. id = 128
+ */
+void yagl_host_glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+
+/*
+ * glVertexAttrib4fv wrapper. id = 129
+ */
+void yagl_host_glVertexAttrib4fv(GLuint indx, const GLfloat *values, int32_t values_count);
+
+/*
+ * glGetActiveUniformsiv wrapper. id = 130
+ */
+void yagl_host_glGetActiveUniformsiv(GLuint program, const GLuint *uniformIndices, int32_t uniformIndices_count, GLint *params, int32_t params_maxcount, int32_t *params_count);
+
+/*
+ * glGetUniformIndices wrapper. id = 131
+ */
+void yagl_host_glGetUniformIndices(GLuint program, const GLchar *uniformNames, int32_t uniformNames_count, GLuint *uniformIndices, int32_t uniformIndices_maxcount, int32_t *uniformIndices_count);
+
+/*
+ * glGetUniformBlockIndex wrapper. id = 132
+ */
+GLuint yagl_host_glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName, int32_t uniformBlockName_count);
+
+/*
+ * glUniformBlockBinding wrapper. id = 133
+ */
+void yagl_host_glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+
+/*
+ * glGetActiveUniformBlockName wrapper. id = 134
+ */
+void yagl_host_glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLchar *uniformBlockName, int32_t uniformBlockName_maxcount, int32_t *uniformBlockName_count);
+
+/*
+ * glGetActiveUniformBlockiv wrapper. id = 135
+ */
+void yagl_host_glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params, int32_t params_maxcount, int32_t *params_count);
+
+/*
+ * glGetVertexAttribIiv wrapper. id = 136
+ */
+void yagl_host_glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params, int32_t params_maxcount, int32_t *params_count);
+
+/*
+ * glGetVertexAttribIuiv wrapper. id = 137
+ */
+void yagl_host_glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params, int32_t params_maxcount, int32_t *params_count);
+
+/*
+ * glVertexAttribI4i wrapper. id = 138
+ */
+void yagl_host_glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);
+
+/*
+ * glVertexAttribI4ui wrapper. id = 139
+ */
+void yagl_host_glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+
+/*
+ * glVertexAttribI4iv wrapper. id = 140
+ */
+void yagl_host_glVertexAttribI4iv(GLuint index, const GLint *v, int32_t v_count);
+
+/*
+ * glVertexAttribI4uiv wrapper. id = 141
+ */
+void yagl_host_glVertexAttribI4uiv(GLuint index, const GLuint *v, int32_t v_count);
+
+/*
+ * glGetUniformuiv wrapper. id = 142
+ */
+void yagl_host_glGetUniformuiv(GLboolean tl, GLuint program, uint32_t location, GLuint *params, int32_t params_maxcount, int32_t *params_count);
+
+/*
+ * glUniform1ui wrapper. id = 143
+ */
+void yagl_host_glUniform1ui(GLboolean tl, uint32_t location, GLuint v0);
+
+/*
+ * glUniform2ui wrapper. id = 144
+ */
+void yagl_host_glUniform2ui(GLboolean tl, uint32_t location, GLuint v0, GLuint v1);
+
+/*
+ * glUniform3ui wrapper. id = 145
+ */
+void yagl_host_glUniform3ui(GLboolean tl, uint32_t location, GLuint v0, GLuint v1, GLuint v2);
+
+/*
+ * glUniform4ui wrapper. id = 146
+ */
+void yagl_host_glUniform4ui(GLboolean tl, uint32_t location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+
+/*
+ * glUniform1uiv wrapper. id = 147
+ */
+void yagl_host_glUniform1uiv(GLboolean tl, uint32_t location, const GLuint *v, int32_t v_count);
+
+/*
+ * glUniform2uiv wrapper. id = 148
+ */
+void yagl_host_glUniform2uiv(GLboolean tl, uint32_t location, const GLuint *v, int32_t v_count);
+
+/*
+ * glUniform3uiv wrapper. id = 149
+ */
+void yagl_host_glUniform3uiv(GLboolean tl, uint32_t location, const GLuint *v, int32_t v_count);
+
+/*
+ * glUniform4uiv wrapper. id = 150
+ */
+void yagl_host_glUniform4uiv(GLboolean tl, uint32_t location, const GLuint *v, int32_t v_count);
+
+/*
+ * glUniformMatrix2x3fv wrapper. id = 151
+ */
+void yagl_host_glUniformMatrix2x3fv(GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count);
+
+/*
+ * glUniformMatrix2x4fv wrapper. id = 152
+ */
+void yagl_host_glUniformMatrix2x4fv(GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count);
+
+/*
+ * glUniformMatrix3x2fv wrapper. id = 153
+ */
+void yagl_host_glUniformMatrix3x2fv(GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count);
+
+/*
+ * glUniformMatrix3x4fv wrapper. id = 154
+ */
+void yagl_host_glUniformMatrix3x4fv(GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count);
+
+/*
+ * glUniformMatrix4x2fv wrapper. id = 155
+ */
+void yagl_host_glUniformMatrix4x2fv(GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count);
+
+/*
+ * glUniformMatrix4x3fv wrapper. id = 156
+ */
+void yagl_host_glUniformMatrix4x3fv(GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count);
+
+/*
+ * glGetFragDataLocation wrapper. id = 157
+ */
+int yagl_host_glGetFragDataLocation(GLuint program, const GLchar *name, int32_t name_count);
+
+/*
+ * glGetIntegerv wrapper. id = 158
+ */
+void yagl_host_glGetIntegerv(GLenum pname, GLint *params, int32_t params_maxcount, int32_t *params_count);
+
+/*
+ * glGetFloatv wrapper. id = 159
+ */
+void yagl_host_glGetFloatv(GLenum pname, GLfloat *params, int32_t params_maxcount, int32_t *params_count);
+
+/*
+ * glGetString wrapper. id = 160
+ */
+void yagl_host_glGetString(GLenum name, GLchar *str, int32_t str_maxcount, int32_t *str_count);
+
+/*
+ * glIsEnabled wrapper. id = 161
+ */
+GLboolean yagl_host_glIsEnabled(GLenum cap);
+
+/*
+ * glGenTransformFeedbacks wrapper. id = 162
+ */
+void yagl_host_glGenTransformFeedbacks(const GLuint *ids, int32_t ids_count);
+
+/*
+ * glBindTransformFeedback wrapper. id = 163
+ */
+void yagl_host_glBindTransformFeedback(GLenum target, GLuint id);
+
+/*
+ * glBeginTransformFeedback wrapper. id = 164
+ */
+void yagl_host_glBeginTransformFeedback(GLenum primitiveMode);
+
+/*
+ * glEndTransformFeedback wrapper. id = 165
+ */
+void yagl_host_glEndTransformFeedback();
+
+/*
+ * glPauseTransformFeedback wrapper. id = 166
+ */
+void yagl_host_glPauseTransformFeedback();
+
+/*
+ * glResumeTransformFeedback wrapper. id = 167
+ */
+void yagl_host_glResumeTransformFeedback();
+
+/*
+ * glTransformFeedbackVaryings wrapper. id = 168
+ */
+void yagl_host_glTransformFeedbackVaryings(GLuint program, const GLchar *varyings, int32_t varyings_count, GLenum bufferMode);
+
+/*
+ * glGetTransformFeedbackVaryings wrapper. id = 169
+ */
+void yagl_host_glGetTransformFeedbackVaryings(GLuint program, GLsizei *sizes, int32_t sizes_maxcount, int32_t *sizes_count, GLenum *types, int32_t types_maxcount, int32_t *types_count);
+
+/*
+ * glGenQueries wrapper. id = 170
+ */
+void yagl_host_glGenQueries(const GLuint *ids, int32_t ids_count);
+
+/*
+ * glBeginQuery wrapper. id = 171
+ */
+void yagl_host_glBeginQuery(GLenum target, GLuint id);
+
+/*
+ * glEndQuery wrapper. id = 172
+ */
+void yagl_host_glEndQuery(GLenum target);
+
+/*
+ * glGetQueryObjectuiv wrapper. id = 173
+ */
+GLboolean yagl_host_glGetQueryObjectuiv(GLuint id, GLuint *result);
+
+/*
+ * glGenSamplers wrapper. id = 174
+ */
+void yagl_host_glGenSamplers(const GLuint *samplers, int32_t samplers_count);
+
+/*
+ * glBindSampler wrapper. id = 175
+ */
+void yagl_host_glBindSampler(GLuint unit, GLuint sampler);
+
+/*
+ * glSamplerParameteri wrapper. id = 176
+ */
+void yagl_host_glSamplerParameteri(GLuint sampler, GLenum pname, GLint param);
+
+/*
+ * glSamplerParameteriv wrapper. id = 177
+ */
+void yagl_host_glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param, int32_t param_count);
+
+/*
+ * glSamplerParameterf wrapper. id = 178
+ */
+void yagl_host_glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
+
+/*
+ * glSamplerParameterfv wrapper. id = 179
+ */
+void yagl_host_glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param, int32_t param_count);
+
+/*
+ * glDeleteObjects wrapper. id = 180
+ */
+void yagl_host_glDeleteObjects(const GLuint *objects, int32_t objects_count);
+
+/*
+ * glBlendEquation wrapper. id = 181
+ */
+void yagl_host_glBlendEquation(GLenum mode);
+
+/*
+ * glBlendEquationSeparate wrapper. id = 182
+ */
+void yagl_host_glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
+
+/*
+ * glBlendFunc wrapper. id = 183
+ */
+void yagl_host_glBlendFunc(GLenum sfactor, GLenum dfactor);
+
+/*
+ * glBlendFuncSeparate wrapper. id = 184
+ */
+void yagl_host_glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+
+/*
+ * glBlendColor wrapper. id = 185
+ */
+void yagl_host_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+
+/*
+ * glClear wrapper. id = 186
+ */
+void yagl_host_glClear(GLbitfield mask);
+
+/*
+ * glClearColor wrapper. id = 187
+ */
+void yagl_host_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+
+/*
+ * glClearDepthf wrapper. id = 188
+ */
+void yagl_host_glClearDepthf(GLclampf depth);
+
+/*
+ * glClearStencil wrapper. id = 189
+ */
+void yagl_host_glClearStencil(GLint s);
+
+/*
+ * glColorMask wrapper. id = 190
+ */
+void yagl_host_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+
+/*
+ * glCullFace wrapper. id = 191
+ */
+void yagl_host_glCullFace(GLenum mode);
+
+/*
+ * glDepthFunc wrapper. id = 192
+ */
+void yagl_host_glDepthFunc(GLenum func);
+
+/*
+ * glDepthMask wrapper. id = 193
+ */
+void yagl_host_glDepthMask(GLboolean flag);
+
+/*
+ * glDepthRangef wrapper. id = 194
+ */
+void yagl_host_glDepthRangef(GLclampf zNear, GLclampf zFar);
+
+/*
+ * glEnable wrapper. id = 195
+ */
+void yagl_host_glEnable(GLenum cap);
+
+/*
+ * glDisable wrapper. id = 196
+ */
+void yagl_host_glDisable(GLenum cap);
+
+/*
+ * glFlush wrapper. id = 197
+ */
+void yagl_host_glFlush();
+
+/*
+ * glFrontFace wrapper. id = 198
+ */
+void yagl_host_glFrontFace(GLenum mode);
+
+/*
+ * glGenerateMipmap wrapper. id = 199
+ */
+void yagl_host_glGenerateMipmap(GLenum target);
+
+/*
+ * glHint wrapper. id = 200
+ */
+void yagl_host_glHint(GLenum target, GLenum mode);
+
+/*
+ * glLineWidth wrapper. id = 201
+ */
+void yagl_host_glLineWidth(GLfloat width);
+
+/*
+ * glPixelStorei wrapper. id = 202
+ */
+void yagl_host_glPixelStorei(GLenum pname, GLint param);
+
+/*
+ * glPolygonOffset wrapper. id = 203
+ */
+void yagl_host_glPolygonOffset(GLfloat factor, GLfloat units);
+
+/*
+ * glScissor wrapper. id = 204
+ */
+void yagl_host_glScissor(GLint x, GLint y, GLsizei width, GLsizei height);
+
+/*
+ * glStencilFunc wrapper. id = 205
+ */
+void yagl_host_glStencilFunc(GLenum func, GLint ref, GLuint mask);
+
+/*
+ * glStencilMask wrapper. id = 206
+ */
+void yagl_host_glStencilMask(GLuint mask);
+
+/*
+ * glStencilOp wrapper. id = 207
+ */
+void yagl_host_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass);
+
+/*
+ * glSampleCoverage wrapper. id = 208
+ */
+void yagl_host_glSampleCoverage(GLclampf value, GLboolean invert);
+
+/*
+ * glViewport wrapper. id = 209
+ */
+void yagl_host_glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
+
+/*
+ * glStencilFuncSeparate wrapper. id = 210
+ */
+void yagl_host_glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
+
+/*
+ * glStencilMaskSeparate wrapper. id = 211
+ */
+void yagl_host_glStencilMaskSeparate(GLenum face, GLuint mask);
+
+/*
+ * glStencilOpSeparate wrapper. id = 212
+ */
+void yagl_host_glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
+
+/*
+ * glPointSize wrapper. id = 213
+ */
+void yagl_host_glPointSize(GLfloat size);
+
+/*
+ * glAlphaFunc wrapper. id = 214
+ */
+void yagl_host_glAlphaFunc(GLenum func, GLclampf ref);
+
+/*
+ * glMatrixMode wrapper. id = 215
+ */
+void yagl_host_glMatrixMode(GLenum mode);
+
+/*
+ * glLoadIdentity wrapper. id = 216
+ */
+void yagl_host_glLoadIdentity();
+
+/*
+ * glPopMatrix wrapper. id = 217
+ */
+void yagl_host_glPopMatrix();
+
+/*
+ * glPushMatrix wrapper. id = 218
+ */
+void yagl_host_glPushMatrix();
+
+/*
+ * glRotatef wrapper. id = 219
+ */
+void yagl_host_glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
+
+/*
+ * glTranslatef wrapper. id = 220
+ */
+void yagl_host_glTranslatef(GLfloat x, GLfloat y, GLfloat z);
+
+/*
+ * glScalef wrapper. id = 221
+ */
+void yagl_host_glScalef(GLfloat x, GLfloat y, GLfloat z);
+
+/*
+ * glOrthof wrapper. id = 222
+ */
+void yagl_host_glOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
+
+/*
+ * glColor4f wrapper. id = 223
+ */
+void yagl_host_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+
+/*
+ * glColor4ub wrapper. id = 224
+ */
+void yagl_host_glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
+
+/*
+ * glNormal3f wrapper. id = 225
+ */
+void yagl_host_glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
+
+/*
+ * glPointParameterf wrapper. id = 226
+ */
+void yagl_host_glPointParameterf(GLenum pname, GLfloat param);
+
+/*
+ * glPointParameterfv wrapper. id = 227
+ */
+void yagl_host_glPointParameterfv(GLenum pname, const GLfloat *params, int32_t params_count);
+
+/*
+ * glFogf wrapper. id = 228
+ */
+void yagl_host_glFogf(GLenum pname, GLfloat param);
+
+/*
+ * glFogfv wrapper. id = 229
+ */
+void yagl_host_glFogfv(GLenum pname, const GLfloat *params, int32_t params_count);
+
+/*
+ * glFrustumf wrapper. id = 230
+ */
+void yagl_host_glFrustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
+
+/*
+ * glLightf wrapper. id = 231
+ */
+void yagl_host_glLightf(GLenum light, GLenum pname, GLfloat param);
+
+/*
+ * glLightfv wrapper. id = 232
+ */
+void yagl_host_glLightfv(GLenum light, GLenum pname, const GLfloat *params, int32_t params_count);
+
+/*
+ * glGetLightfv wrapper. id = 233
+ */
+void yagl_host_glGetLightfv(GLenum light, GLenum pname, GLfloat *params, int32_t params_maxcount, int32_t *params_count);
+
+/*
+ * glLightModelf wrapper. id = 234
+ */
+void yagl_host_glLightModelf(GLenum pname, GLfloat param);
+
+/*
+ * glLightModelfv wrapper. id = 235
+ */
+void yagl_host_glLightModelfv(GLenum pname, const GLfloat *params, int32_t params_count);
+
+/*
+ * glMaterialf wrapper. id = 236
+ */
+void yagl_host_glMaterialf(GLenum face, GLenum pname, GLfloat param);
+
+/*
+ * glMaterialfv wrapper. id = 237
+ */
+void yagl_host_glMaterialfv(GLenum face, GLenum pname, const GLfloat *params, int32_t params_count);
+
+/*
+ * glGetMaterialfv wrapper. id = 238
+ */
+void yagl_host_glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params, int32_t params_maxcount, int32_t *params_count);
+
+/*
+ * glShadeModel wrapper. id = 239
+ */
+void yagl_host_glShadeModel(GLenum mode);
+
+/*
+ * glLogicOp wrapper. id = 240
+ */
+void yagl_host_glLogicOp(GLenum opcode);
+
+/*
+ * glMultMatrixf wrapper. id = 241
+ */
+void yagl_host_glMultMatrixf(const GLfloat *m, int32_t m_count);
+
+/*
+ * glLoadMatrixf wrapper. id = 242
+ */
+void yagl_host_glLoadMatrixf(const GLfloat *m, int32_t m_count);
+
+/*
+ * glClipPlanef wrapper. id = 243
+ */
+void yagl_host_glClipPlanef(GLenum plane, const GLfloat *equation, int32_t equation_count);
+
+/*
+ * glGetClipPlanef wrapper. id = 244
+ */
+void yagl_host_glGetClipPlanef(GLenum pname, GLfloat *eqn, int32_t eqn_maxcount, int32_t *eqn_count);
+
+/*
+ * glUpdateOffscreenImageYAGL wrapper. id = 245
+ */
+void yagl_host_glUpdateOffscreenImageYAGL(GLuint texture, uint32_t width, uint32_t height, uint32_t bpp, const void *pixels, int32_t pixels_count);
+
+/*
+ * glGenUniformLocationYAGL wrapper. id = 246
+ */
+void yagl_host_glGenUniformLocationYAGL(uint32_t location, GLuint program, const GLchar *name, int32_t name_count);
+
+/*
+ * glDeleteUniformLocationsYAGL wrapper. id = 247
+ */
+void yagl_host_glDeleteUniformLocationsYAGL(const uint32_t *locations, int32_t locations_count);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GL/gl.h"
+#include "yagl_pixel_format.h"
+#include "yagl_state.h"
+#include <assert.h>
+
+static GLsizei yagl_pixel_format_get_strides(const struct yagl_gles_pixelstore* ps,
+ GLsizei width,
+ GLsizei height,
+ GLsizei bpp,
+ GLsizei *image_stride)
+{
+ GLsizei num_columns = (ps->row_length > 0) ? ps->row_length : width;
+ GLsizei row_stride = ((num_columns * bpp) + ps->alignment - 1) & ~(ps->alignment - 1);
+ GLsizei num_rows = (ps->image_height > 0) ? ps->image_height : height;
+
+ assert(width >= 0);
+ assert(height >= 0);
+ assert(bpp > 0);
+
+ *image_stride = row_stride * num_rows;
+
+ return row_stride;
+}
+
+GLsizei yagl_pixel_format_get_info(struct yagl_pixel_format *pf,
+ const struct yagl_gles_pixelstore *ps,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLsizei *size)
+{
+ GLsizei src_row_stride, src_image_stride;
+ GLsizei dst_row_stride, dst_image_stride;
+
+ assert(width >= 0);
+ assert(height >= 0);
+ assert(depth >= 0);
+
+ src_row_stride = yagl_pixel_format_get_strides(ps, width, height,
+ pf->src_bpp,
+ &src_image_stride);
+
+ dst_row_stride = yagl_pixel_format_get_strides(ps, width, height,
+ pf->dst_bpp,
+ &dst_image_stride);
+
+ *size = (width * pf->dst_bpp) +
+ ((height - 1) * dst_row_stride) +
+ ((depth - 1) * dst_image_stride);
+
+ return (ps->skip_images * src_image_stride) +
+ (ps->skip_rows * src_row_stride) +
+ (ps->skip_pixels * pf->src_bpp);
+}
+
+const GLvoid *yagl_pixel_format_unpack(struct yagl_pixel_format *pf,
+ const struct yagl_gles_pixelstore *ps,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ const GLvoid *pixels)
+{
+ GLsizei src_row_stride, src_image_stride;
+ GLsizei dst_row_stride, dst_image_stride;
+ GLsizei i;
+ GLvoid *res, *it;
+
+ assert(width >= 0);
+ assert(height >= 0);
+ assert(depth >= 0);
+
+ if (!pixels || !pf->unpack) {
+ return pixels;
+ }
+
+ src_row_stride = yagl_pixel_format_get_strides(ps, width, height,
+ pf->src_bpp,
+ &src_image_stride);
+
+ dst_row_stride = yagl_pixel_format_get_strides(ps, width, height,
+ pf->dst_bpp,
+ &dst_image_stride);
+
+ res = it = yagl_get_tmp_buffer(dst_image_stride * depth);
+
+ for (i = 0; i < depth; ++i) {
+ pf->unpack(pixels, src_row_stride, it, dst_row_stride,
+ width, height);
+ pixels += src_image_stride;
+ it += dst_image_stride;
+ }
+
+ return res;
+}
+
+GLvoid *yagl_pixel_format_pack_alloc(struct yagl_pixel_format *pf,
+ const struct yagl_gles_pixelstore *ps,
+ GLsizei width,
+ GLsizei height,
+ GLvoid *pixels)
+{
+ GLsizei dst_row_stride, dst_image_stride;
+
+ assert(width >= 0);
+ assert(height >= 0);
+
+ if (!pf->pack) {
+ return pixels;
+ }
+
+ dst_row_stride = yagl_pixel_format_get_strides(ps, width, height,
+ pf->dst_bpp,
+ &dst_image_stride);
+
+ return yagl_get_tmp_buffer(dst_row_stride * height);
+}
+
+void yagl_pixel_format_pack(struct yagl_pixel_format *pf,
+ const struct yagl_gles_pixelstore *ps,
+ GLsizei width,
+ GLsizei height,
+ const GLvoid *pixels_src,
+ GLvoid *pixels_dst)
+{
+ GLsizei src_row_stride, src_image_stride;
+ GLsizei dst_row_stride, dst_image_stride;
+
+ assert(width >= 0);
+ assert(height >= 0);
+
+ if (!pf->pack) {
+ return;
+ }
+
+ src_row_stride = yagl_pixel_format_get_strides(ps, width, height,
+ pf->src_bpp,
+ &src_image_stride);
+
+ dst_row_stride = yagl_pixel_format_get_strides(ps, width, height,
+ pf->dst_bpp,
+ &dst_image_stride);
+
+ /*
+ * No mistake here, when we 'pack' we need to
+ * swap src and dst strides.
+ */
+
+ pf->pack(pixels_src, dst_row_stride, pixels_dst, src_row_stride,
+ width, height);
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_PIXEL_FORMAT_H_
+#define _YAGL_PIXEL_FORMAT_H_
+
+#include "yagl_gles_types.h"
+
+#define YAGL_PIXEL_FORMAT_DECL(prefix, internalformat, format, type) \
+extern struct yagl_pixel_format yagl_##prefix##_pixel_format_##internalformat##_##format##_##type
+
+#define YAGL_PIXEL_FORMAT_IMPL_NOCONV(prefix, internalformat, format, type, dstinternalformat, dsttype, bpp) \
+struct yagl_pixel_format yagl_##prefix##_pixel_format_##internalformat##_##format##_##type = \
+{ \
+ .need_convert = 0, \
+ .src_internalformat = internalformat, \
+ .src_format = format, \
+ .src_type = type, \
+ .src_bpp = bpp, \
+ .dst_internalformat = dstinternalformat, \
+ .dst_format = format, \
+ .dst_type = dsttype, \
+ .dst_bpp = bpp, \
+ .unpack = NULL, \
+ .pack = NULL \
+}
+
+#define YAGL_PIXEL_FORMAT_IMPL_BEGIN(prefix, internalformat, format, type) \
+struct yagl_pixel_format yagl_##prefix##_pixel_format_##internalformat##_##format##_##type = \
+{ \
+ .need_convert = 1, \
+ .src_internalformat = internalformat, \
+ .src_format = format, \
+ .src_type = type,
+
+#define YAGL_PIXEL_FORMAT_IMPL_END() };
+
+#define YAGL_PIXEL_FORMAT_CASE(prefix, internalformat, format, type) \
+case type: \
+ return &yagl_##prefix##_pixel_format_##internalformat##_##format##_##type
+
+struct yagl_pixel_format;
+
+typedef void (*yagl_pixel_format_converter)(const GLvoid */*src*/,
+ GLsizei /*src_stride*/,
+ GLvoid */*dst*/,
+ GLsizei /*dst_stride*/,
+ GLsizei /*width*/,
+ GLsizei /*height*/);
+
+struct yagl_pixel_format
+{
+ int need_convert;
+
+ GLenum src_internalformat;
+ GLenum src_format;
+ GLenum src_type;
+ GLint src_bpp;
+
+ GLenum dst_internalformat;
+ GLenum dst_format;
+ GLenum dst_type;
+ GLint dst_bpp;
+
+ /*
+ * NULL if no conversion is required.
+ */
+ yagl_pixel_format_converter unpack;
+ yagl_pixel_format_converter pack;
+};
+
+/*
+ * Returns offset that needs to be applied to 'pixels' in
+ * order to get correct data location. It can be non-0 when
+ * GL_UNPACK_SKIP_XXX or GL_PACK_SKIP_XXX are non-0.
+ * 'size' is unpacked size of the image.
+ */
+GLsizei yagl_pixel_format_get_info(struct yagl_pixel_format *pf,
+ const struct yagl_gles_pixelstore *ps,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLsizei *size);
+
+const GLvoid *yagl_pixel_format_unpack(struct yagl_pixel_format *pf,
+ const struct yagl_gles_pixelstore *ps,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ const GLvoid *pixels);
+
+GLvoid *yagl_pixel_format_pack_alloc(struct yagl_pixel_format *pf,
+ const struct yagl_gles_pixelstore *ps,
+ GLsizei width,
+ GLsizei height,
+ GLvoid *pixels);
+
+void yagl_pixel_format_pack(struct yagl_pixel_format *pf,
+ const struct yagl_gles_pixelstore *ps,
+ GLsizei width,
+ GLsizei height,
+ const GLvoid *pixels_src,
+ GLvoid *pixels_dst);
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2011 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "GL/gl.h"
+#include "yagl_texcompress_etc1.h"
+#include <stdbool.h>
+
+/* define etc1_parse_block and etc. */
+#define UINT8_TYPE GLubyte
+#define TAG(x) x
+#include "yagl_texcompress_etc_tmp.h"
+
+static UINT8_TYPE
+TAG(etc1_clamp)(UINT8_TYPE base, int modifier)
+{
+ int tmp = (int) base + modifier;
+
+ /* CLAMP(tmp, 0, 255) */
+ return (UINT8_TYPE) ((tmp < 0) ? 0 : ((tmp > 255) ? 255 : tmp));
+}
+
+static void
+TAG(etc1_parse_block)(struct TAG(etc1_block) *block, const UINT8_TYPE *src)
+{
+ if (src[3] & 0x2) {
+ /* differential mode */
+ block->base_colors[0][0] = (int) TAG(etc1_base_color_diff_hi)(src[0]);
+ block->base_colors[1][0] = (int) TAG(etc1_base_color_diff_lo)(src[0]);
+ block->base_colors[0][1] = (int) TAG(etc1_base_color_diff_hi)(src[1]);
+ block->base_colors[1][1] = (int) TAG(etc1_base_color_diff_lo)(src[1]);
+ block->base_colors[0][2] = (int) TAG(etc1_base_color_diff_hi)(src[2]);
+ block->base_colors[1][2] = (int) TAG(etc1_base_color_diff_lo)(src[2]);
+ }
+ else {
+ /* individual mode */
+ block->base_colors[0][0] = (int) TAG(etc1_base_color_ind_hi)(src[0]);
+ block->base_colors[1][0] = (int) TAG(etc1_base_color_ind_lo)(src[0]);
+ block->base_colors[0][1] = (int) TAG(etc1_base_color_ind_hi)(src[1]);
+ block->base_colors[1][1] = (int) TAG(etc1_base_color_ind_lo)(src[1]);
+ block->base_colors[0][2] = (int) TAG(etc1_base_color_ind_hi)(src[2]);
+ block->base_colors[1][2] = (int) TAG(etc1_base_color_ind_lo)(src[2]);
+ }
+
+ /* pick modifier tables */
+ block->modifier_tables[0] = TAG(etc1_modifier_tables)[(src[3] >> 5) & 0x7];
+ block->modifier_tables[1] = TAG(etc1_modifier_tables)[(src[3] >> 2) & 0x7];
+
+ block->flipped = (src[3] & 0x1);
+
+ block->pixel_indices =
+ (src[4] << 24) | (src[5] << 16) | (src[6] << 8) | src[7];
+}
+
+static void
+TAG(etc1_fetch_texel)(const struct TAG(etc1_block) *block,
+ int x, int y, UINT8_TYPE *dst)
+{
+ const UINT8_TYPE *base_color;
+ int modifier, bit, idx, blk;
+
+ /* get pixel index */
+ bit = y + x * 4;
+ idx = ((block->pixel_indices >> (15 + bit)) & 0x2) |
+ ((block->pixel_indices >> (bit)) & 0x1);
+
+ /* get subblock */
+ blk = (block->flipped) ? (y >= 2) : (x >= 2);
+
+ base_color = block->base_colors[blk];
+ modifier = block->modifier_tables[blk][idx];
+
+ dst[0] = TAG(etc1_clamp)(base_color[0], modifier);
+ dst[1] = TAG(etc1_clamp)(base_color[1], modifier);
+ dst[2] = TAG(etc1_clamp)(base_color[2], modifier);
+}
+
+static void
+etc1_unpack_rgba8888(uint8_t *dst_row,
+ unsigned dst_stride,
+ const uint8_t *src_row,
+ unsigned src_stride,
+ unsigned width,
+ unsigned height)
+{
+ const unsigned bw = 4, bh = 4, bs = 8, comps = 4;
+ struct etc1_block block;
+ unsigned x, y, i, j;
+
+ for (y = 0; y < height; y += bh) {
+ const uint8_t *src = src_row;
+
+ for (x = 0; x < width; x+= bw) {
+ etc1_parse_block(&block, src);
+
+ for (j = 0; j < MIN2(bh, height - y); j++) {
+ uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
+ for (i = 0; i < MIN2(bw, width - x); i++) {
+ etc1_fetch_texel(&block, i, j, dst);
+ dst[3] = 255;
+ dst += comps;
+ }
+ }
+
+ src += bs;
+ }
+
+ src_row += src_stride;
+ }
+}
+
+#undef TAG
+#undef UINT8_TYPE
+
+void yagl_texcompress_etc1_unpack_rgba8888(uint8_t *dst_row,
+ unsigned dst_stride,
+ const uint8_t *src_row,
+ unsigned src_stride,
+ unsigned width,
+ unsigned height)
+{
+ etc1_unpack_rgba8888(dst_row, dst_stride,
+ src_row, src_stride,
+ width, height);
+}
--- /dev/null
+/*
+ * Copyright (C) 2011 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _YAGL_TEXCOMPRESS_ETC1_H_
+#define _YAGL_TEXCOMPRESS_ETC1_H_
+
+#include "yagl_types.h"
+
+void yagl_texcompress_etc1_unpack_rgba8888(uint8_t *dst_row,
+ unsigned dst_stride,
+ const uint8_t *src_row,
+ unsigned src_stride,
+ unsigned width,
+ unsigned height);
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2011 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _YAGL_TEXCOMPRESS_ETC_TMP_H_
+#define _YAGL_TEXCOMPRESS_ETC_TMP_H_
+
+#define MIN2(A, B) ((A)<(B) ? (A) : (B))
+
+struct TAG(etc1_block) {
+ uint32_t pixel_indices;
+ int flipped;
+ const int *modifier_tables[2];
+ UINT8_TYPE base_colors[2][3];
+};
+
+static UINT8_TYPE
+TAG(etc1_base_color_diff_hi)(UINT8_TYPE in)
+{
+ return (in & 0xf8) | (in >> 5);
+}
+
+static UINT8_TYPE
+TAG(etc1_base_color_diff_lo)(UINT8_TYPE in)
+{
+ static const int lookup[8] = { 0, 1, 2, 3, -4, -3, -2, -1 };
+
+ in = (in >> 3) + lookup[in & 0x7];
+
+ return (in << 3) | (in >> 2);
+}
+
+static UINT8_TYPE
+TAG(etc1_base_color_ind_hi)(UINT8_TYPE in)
+{
+ return (in & 0xf0) | ((in & 0xf0) >> 4);
+}
+
+static UINT8_TYPE
+TAG(etc1_base_color_ind_lo)(UINT8_TYPE in)
+{
+ return ((in & 0xf) << 4) | (in & 0xf);
+}
+
+static const int TAG(etc1_modifier_tables)[8][4] = {
+ { 2, 8, -2, -8},
+ { 5, 17, -5, -17},
+ { 9, 29, -9, -29},
+ { 13, 42, -13, -42},
+ { 18, 60, -18, -60},
+ { 24, 80, -24, -80},
+ { 33, 106, -33, -106},
+ { 47, 183, -47, -183}
+};
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_TRANSPORT_GL_H_
+#define _YAGL_TRANSPORT_GL_H_
+
+#include "yagl_transport.h"
+
+static __inline void yagl_transport_put_out_GLenum(struct yagl_transport *t,
+ GLenum value)
+{
+ yagl_transport_put_out_uint32_t(t, value);
+}
+
+static __inline void yagl_transport_put_out_GLuint(struct yagl_transport *t,
+ GLuint value)
+{
+ yagl_transport_put_out_uint32_t(t, value);
+}
+
+static __inline void yagl_transport_put_out_GLint(struct yagl_transport *t,
+ GLint value)
+{
+ yagl_transport_put_out_uint32_t(t, value);
+}
+
+static __inline void yagl_transport_put_out_GLbitfield(struct yagl_transport *t,
+ GLbitfield value)
+{
+ yagl_transport_put_out_uint32_t(t, value);
+}
+
+static __inline void yagl_transport_put_out_GLboolean(struct yagl_transport *t,
+ GLboolean value)
+{
+ yagl_transport_put_out_uint8_t(t, value);
+}
+
+static __inline void yagl_transport_put_out_GLubyte(struct yagl_transport *t,
+ GLubyte value)
+{
+ yagl_transport_put_out_uint8_t(t, value);
+}
+
+static __inline void yagl_transport_put_out_GLsizei(struct yagl_transport *t,
+ GLsizei value)
+{
+ yagl_transport_put_out_uint32_t(t, value);
+}
+
+static __inline void yagl_transport_put_out_GLclampf(struct yagl_transport *t,
+ GLclampf value)
+{
+ yagl_transport_put_out_float(t, value);
+}
+
+static __inline void yagl_transport_put_out_GLfloat(struct yagl_transport *t,
+ GLfloat value)
+{
+ yagl_transport_put_out_float(t, value);
+}
+
+static __inline void yagl_transport_put_in_GLenum(struct yagl_transport *t,
+ GLenum *value)
+{
+ yagl_transport_put_in_uint32_t(t, (uint32_t*)value);
+}
+
+static __inline void yagl_transport_put_in_GLuint(struct yagl_transport *t,
+ GLuint *value)
+{
+ yagl_transport_put_in_uint32_t(t, value);
+}
+
+static __inline void yagl_transport_put_in_GLint(struct yagl_transport *t,
+ GLint *value)
+{
+ yagl_transport_put_in_uint32_t(t, (uint32_t*)value);
+}
+
+static __inline void yagl_transport_put_in_GLsizei(struct yagl_transport *t,
+ GLsizei *value)
+{
+ yagl_transport_put_in_uint32_t(t, (uint32_t*)value);
+}
+
+static __inline void yagl_transport_put_in_GLboolean(struct yagl_transport *t,
+ GLboolean *value)
+{
+ yagl_transport_put_in_uint8_t(t, value);
+}
+
+static __inline void yagl_transport_put_in_GLfloat(struct yagl_transport *t,
+ GLfloat *value)
+{
+ yagl_transport_put_in_float(t, value);
+}
+
+#endif
--- /dev/null
+set(SOURCES
+ yagl_gles1_context.c
+ yagl_gles1_interface.c
+ yagl_gles1_validate.c
+ yagl_gles1_calls.c
+)
+
+include_directories(${YAGL_SOURCE_DIR}/GLES_common)
+include_directories(.)
+link_directories(${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
+
+add_library(GLESv1_CM SHARED ${SOURCES})
+set_target_properties(GLESv1_CM PROPERTIES VERSION 1.0 SOVERSION 1)
+
+target_link_libraries(GLESv1_CM "-Wl,-whole-archive" GLES_common "-Wl,-no-whole-archive" EGL)
+
+install(
+ TARGETS GLESv1_CM
+ LIBRARY DESTINATION ${INSTALL_LIB_DIR}
+)
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GLES/gl.h"
+#include "GLES/glext.h"
+#include "yagl_gles_calls.h"
+#include "yagl_host_gles_calls.h"
+#include "yagl_gles1_validate.h"
+#include "yagl_gles1_context.h"
+#include "yagl_gles_vertex_array.h"
+#include "yagl_gles_array.h"
+#include "yagl_gles_buffer.h"
+#include "yagl_impl.h"
+#include "yagl_malloc.h"
+#include "yagl_transport.h"
+#include "yagl_utils.h"
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+#define YAGL_SET_ERR(err) \
+ yagl_gles_context_set_error(&ctx->base, err); \
+ YAGL_LOG_ERROR("error = 0x%X", err)
+
+#define YAGL_GET_CTX_IMPL(ret_expr) \
+ struct yagl_gles1_context *ctx = \
+ (struct yagl_gles1_context*)yagl_get_client_context(); \
+ if (!ctx || (ctx->base.base.client_api != yagl_client_api_gles1)) { \
+ YAGL_LOG_WARN("no current context"); \
+ YAGL_LOG_FUNC_EXIT(NULL); \
+ ret_expr; \
+ }
+
+#define YAGL_GET_CTX_RET(ret) YAGL_GET_CTX_IMPL(return ret)
+
+#define YAGL_GET_CTX() YAGL_GET_CTX_IMPL(return)
+
+static __inline int yagl_gles1_array_idx_get(struct yagl_gles1_context *ctx,
+ GLenum array,
+ unsigned *arr_idx_p)
+{
+ switch (array) {
+ case GL_VERTEX_ARRAY:
+ *arr_idx_p = yagl_gles1_array_vertex;
+ break;
+ case GL_COLOR_ARRAY:
+ *arr_idx_p = yagl_gles1_array_color;
+ break;
+ case GL_NORMAL_ARRAY:
+ *arr_idx_p = yagl_gles1_array_normal;
+ break;
+ case GL_TEXTURE_COORD_ARRAY:
+ *arr_idx_p = yagl_gles1_array_texcoord + ctx->client_active_texture;
+ break;
+ case GL_POINT_SIZE_ARRAY_OES:
+ *arr_idx_p = yagl_gles1_array_pointsize;
+ break;
+ default:
+ return 0;
+ }
+
+ return 1;
+}
+
+/*
+ * TODO: Passthrough for now.
+ * @{
+ */
+
+YAGL_IMPLEMENT_API_NORET2(glAlphaFunc, GLenum, GLclampf, func, ref)
+YAGL_IMPLEMENT_API_NORET3(glTexEnvf, GLenum, GLenum, GLfloat, target, pname, param)
+YAGL_IMPLEMENT_API_NORET1(glMatrixMode, GLenum, mode)
+YAGL_IMPLEMENT_API_NORET0(glLoadIdentity)
+YAGL_IMPLEMENT_API_NORET0(glPopMatrix)
+YAGL_IMPLEMENT_API_NORET0(glPushMatrix)
+YAGL_IMPLEMENT_API_NORET4(glRotatef, GLfloat, GLfloat, GLfloat, GLfloat, angle, x, y, z)
+YAGL_IMPLEMENT_API_NORET3(glTranslatef, GLfloat, GLfloat, GLfloat, x, y, z)
+YAGL_IMPLEMENT_API_NORET3(glScalef, GLfloat, GLfloat, GLfloat, x, y, z)
+YAGL_IMPLEMENT_API_NORET4(glColor4f, GLfloat, GLfloat, GLfloat, GLfloat, red, green, blue, alpha)
+YAGL_IMPLEMENT_API_NORET4(glColor4ub, GLubyte, GLubyte, GLubyte, GLubyte, red, green, blue, alpha)
+YAGL_IMPLEMENT_API_NORET3(glNormal3f, GLfloat, GLfloat, GLfloat, nx, ny, nz)
+YAGL_IMPLEMENT_API_NORET1(glShadeModel, GLenum, mode)
+YAGL_IMPLEMENT_API_NORET1(glLogicOp, GLenum, opcode)
+
+/*
+ * @}
+ */
+
+YAGL_API void glAlphaFuncx(GLenum func, GLclampx ref)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glAlphaFuncx, GLenum, GLclampx, func, ref);
+
+ YAGL_GET_CTX();
+
+ yagl_host_glAlphaFunc(func, yagl_fixed_to_float(ref));
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glTexEnvi(GLenum target, GLenum pname, GLint param)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glTexEnvi, GLenum, GLenum, GLint, target, pname, param);
+
+ YAGL_GET_CTX();
+
+ if ((target != GL_TEXTURE_ENV) && (target != GL_POINT_SPRITE_OES)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ yagl_host_glTexEnvi(target, pname, param);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glTexEnvx(GLenum target, GLenum pname, GLfixed param)
+{
+ GLfloat paramf;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glTexEnvx, GLenum, GLenum, GLfixed, target, pname, param);
+
+ YAGL_GET_CTX();
+
+ if ((target != GL_TEXTURE_ENV) && (target != GL_POINT_SPRITE_OES)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if ((pname == GL_RGB_SCALE) || (pname == GL_ALPHA_SCALE)) {
+ paramf = yagl_fixed_to_float(param);
+ } else {
+ paramf = (GLfloat)param;
+ }
+
+ yagl_host_glTexEnvf(target, pname, paramf);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glRotatex(GLfixed angle,
+ GLfixed x,
+ GLfixed y,
+ GLfixed z)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glRotatex, GLfixed, GLfixed, GLfixed, GLfixed, angle, x, y, z);
+
+ YAGL_GET_CTX();
+
+ yagl_host_glRotatef(yagl_fixed_to_float(angle),
+ yagl_fixed_to_float(x),
+ yagl_fixed_to_float(y),
+ yagl_fixed_to_float(z));
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glTranslatex(GLfixed x,
+ GLfixed y,
+ GLfixed z)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glTranslatex, GLfixed, GLfixed, GLfixed, x, y, z);
+
+ YAGL_GET_CTX();
+
+ yagl_host_glTranslatef(yagl_fixed_to_float(x),
+ yagl_fixed_to_float(y),
+ yagl_fixed_to_float(z));
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glScalex(GLfixed x,
+ GLfixed y,
+ GLfixed z)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glScalex, GLfixed, GLfixed, GLfixed, x, y, z);
+
+ YAGL_GET_CTX();
+
+ yagl_host_glScalef(yagl_fixed_to_float(x),
+ yagl_fixed_to_float(y),
+ yagl_fixed_to_float(z));
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glOrthof(GLfloat left,
+ GLfloat right,
+ GLfloat bottom,
+ GLfloat top,
+ GLfloat zNear,
+ GLfloat zFar)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT6(glOrthof, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, left, right, bottom, top, zNear, zFar);
+
+ YAGL_GET_CTX();
+
+ if ((left == right) || (bottom == top) || (zNear == zFar)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ } else {
+ yagl_host_glOrthof(left, right, bottom, top, zNear, zFar);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glOrthox(GLfixed left,
+ GLfixed right,
+ GLfixed bottom,
+ GLfixed top,
+ GLfixed zNear,
+ GLfixed zFar)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT6(glOrthox, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, left, right, bottom, top, zNear, zFar);
+
+ YAGL_GET_CTX();
+
+ if ((left == right) || (bottom == top) || (zNear == zFar)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ } else {
+ yagl_host_glOrthof(yagl_fixed_to_float(left),
+ yagl_fixed_to_float(right),
+ yagl_fixed_to_float(bottom),
+ yagl_fixed_to_float(top),
+ yagl_fixed_to_float(zNear),
+ yagl_fixed_to_float(zFar));
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glPointSize(GLfloat size)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glPointSize, GLfloat, size);
+
+ YAGL_GET_CTX();
+
+ if (size <= 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ } else {
+ yagl_host_glPointSize(size);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glPointSizex(GLfixed size)
+{
+ GLfloat sizef;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glPointSizex, GLfixed, size);
+
+ YAGL_GET_CTX();
+
+ sizef = yagl_fixed_to_float(size);
+
+ if (sizef <= 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ } else {
+ yagl_host_glPointSize(sizef);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glLineWidthx(GLfixed width)
+{
+ GLfloat widthf;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glLineWidthx, GLfixed, width);
+
+ YAGL_GET_CTX();
+
+ widthf = yagl_fixed_to_float(width);
+
+ if (widthf <= 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ yagl_gles_context_line_width(&ctx->base, widthf);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glTexParameterx(GLenum target,
+ GLenum pname,
+ GLfixed param)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glTexParameterx, GLenum, GLenum, GLfixed, target, pname, param);
+
+ YAGL_GET_CTX();
+
+ if (target != GL_TEXTURE_2D) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ yagl_gles_context_tex_parameterf(&ctx->base, target, pname, (GLfloat)param);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glColor4x(GLfixed red,
+ GLfixed green,
+ GLfixed blue,
+ GLfixed alpha)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glColor4x, GLfixed, GLfixed, GLfixed, GLfixed, red, green, blue, alpha);
+
+ YAGL_GET_CTX();
+
+ yagl_host_glColor4f(yagl_fixed_to_float(red),
+ yagl_fixed_to_float(green),
+ yagl_fixed_to_float(blue),
+ yagl_fixed_to_float(alpha));
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glNormal3x(GLfixed nx,
+ GLfixed ny,
+ GLfixed nz)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glNormal3x, GLfixed, GLfixed, GLfixed, nx, ny, nz);
+
+ YAGL_GET_CTX();
+
+ yagl_host_glNormal3f(yagl_fixed_to_float(nx),
+ yagl_fixed_to_float(ny),
+ yagl_fixed_to_float(nz));
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glClearColorx(GLclampx red,
+ GLclampx green,
+ GLclampx blue,
+ GLclampx alpha)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glClearColorx, GLclampx, GLclampx, GLclampx, GLclampx, red, green, blue, alpha);
+
+ YAGL_GET_CTX();
+
+ yagl_gles_context_clear_color(&ctx->base,
+ yagl_fixed_to_float(red),
+ yagl_fixed_to_float(green),
+ yagl_fixed_to_float(blue),
+ yagl_fixed_to_float(alpha));
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glClearDepthx(GLclampx depth)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glClearDepthx, GLclampx, depth);
+
+ YAGL_GET_CTX();
+
+ yagl_gles_context_clear_depthf(&ctx->base, yagl_fixed_to_float(depth));
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glMultiTexCoord4f(GLenum target,
+ GLfloat s,
+ GLfloat t,
+ GLfloat r,
+ GLfloat q)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glMultiTexCoord4f, GLenum, GLfloat, GLfloat, GLfloat, GLfloat, target, s, t, r, q);
+
+ YAGL_GET_CTX();
+
+ if (target >= GL_TEXTURE0 &&
+ target < (GL_TEXTURE0 + ctx->base.num_texture_units)) {
+ yagl_host_glMultiTexCoord4f(target, s, t, r, q);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glMultiTexCoord4x(GLenum target,
+ GLfixed s,
+ GLfixed t,
+ GLfixed r,
+ GLfixed q)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glMultiTexCoord4x, GLenum, GLfixed, GLfixed, GLfixed, GLfixed, target, s, t, r, q);
+
+ YAGL_GET_CTX();
+
+ if (target >= GL_TEXTURE0 &&
+ target < (GL_TEXTURE0 + ctx->base.num_texture_units)) {
+ yagl_host_glMultiTexCoord4f(target,
+ yagl_fixed_to_float(s),
+ yagl_fixed_to_float(t),
+ yagl_fixed_to_float(r),
+ yagl_fixed_to_float(q));
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glPointParameterf(GLenum pname,
+ GLfloat param)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glPointParameterf, GLenum, GLfloat, pname, param);
+
+ YAGL_GET_CTX();
+
+ if (pname != GL_POINT_SIZE_MIN && pname != GL_POINT_SIZE_MIN &&
+ pname != GL_POINT_SIZE_MAX && pname != GL_POINT_FADE_THRESHOLD_SIZE) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ } else {
+ yagl_host_glPointParameterf(pname, param);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glPointParameterx(GLenum pname,
+ GLfixed param)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glPointParameterx, GLenum, GLfixed, pname, param);
+
+ YAGL_GET_CTX();
+
+ if (pname != GL_POINT_SIZE_MIN && pname != GL_POINT_SIZE_MIN &&
+ pname != GL_POINT_SIZE_MAX && pname != GL_POINT_FADE_THRESHOLD_SIZE) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ } else {
+ yagl_host_glPointParameterf(pname, yagl_fixed_to_float(param));
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glFogf(GLenum pname, GLfloat param)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glFogf, GLenum, GLfloat, pname, param);
+
+ YAGL_GET_CTX();
+
+ if (pname != GL_FOG_MODE && pname != GL_FOG_DENSITY &&
+ pname != GL_FOG_START && pname != GL_FOG_END) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ } else {
+ yagl_host_glFogf(pname, param);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glFogx(GLenum pname, GLfixed param)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glFogx, GLenum, GLfixed, pname, param);
+
+ YAGL_GET_CTX();
+
+ if (pname != GL_FOG_MODE && pname != GL_FOG_DENSITY &&
+ pname != GL_FOG_START && pname != GL_FOG_END) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ } else {
+ if (pname == GL_FOG_MODE) {
+ yagl_host_glFogf(pname, (GLfloat)param);
+ } else {
+ yagl_host_glFogf(pname, yagl_fixed_to_float(param));
+ }
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glFrustumf(GLfloat left,
+ GLfloat right,
+ GLfloat bottom,
+ GLfloat top,
+ GLfloat zNear,
+ GLfloat zFar)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT6(glFrustumf, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, left, right, bottom, top, zNear, zFar);
+
+ YAGL_GET_CTX();
+
+ if (zNear <= 0 || zFar <= 0 || left == right ||
+ bottom == top || zNear == zFar) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ } else {
+ yagl_host_glFrustumf(left, right, bottom, top, zNear, zFar);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glFrustumx(GLfixed left,
+ GLfixed right,
+ GLfixed bottom,
+ GLfixed top,
+ GLfixed zNear,
+ GLfixed zFar)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT6(glFrustumx, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, left, right, bottom, top, zNear, zFar);
+
+ YAGL_GET_CTX();
+
+ if (zNear <= 0 || zFar <= 0 ||left == right ||
+ bottom == top || zNear == zFar) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ } else {
+ yagl_host_glFrustumf(yagl_fixed_to_float(left),
+ yagl_fixed_to_float(right),
+ yagl_fixed_to_float(bottom),
+ yagl_fixed_to_float(top),
+ yagl_fixed_to_float(zNear),
+ yagl_fixed_to_float(zFar));
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glLightf(GLenum light,
+ GLenum pname,
+ GLfloat param)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glLightf, GLenum, GLenum, GLfloat, light, pname, param);
+
+ YAGL_GET_CTX();
+
+ if (light < GL_LIGHT0 || light >= (GL_LIGHT0 + ctx->max_lights)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ } else {
+ yagl_host_glLightf(light, pname, param);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glLightx(GLenum light,
+ GLenum pname,
+ GLfixed param)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glLightx, GLenum, GLenum, GLfixed, light, pname, param);
+
+ YAGL_GET_CTX();
+
+ if (light < GL_LIGHT0 || light >= (GL_LIGHT0 + ctx->max_lights)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ } else {
+ yagl_host_glLightf(light, pname, yagl_fixed_to_float(param));
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glLightModelf(GLenum pname, GLfloat param)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glLightModelf, GLenum, GLfloat, pname, param);
+
+ YAGL_GET_CTX();
+
+ if (pname != GL_LIGHT_MODEL_TWO_SIDE) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ } else {
+ yagl_host_glLightModelf(pname, param);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glLightModelx(GLenum pname,
+ GLfixed param)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glLightModelx, GLenum, GLfixed, pname, param);
+
+ YAGL_GET_CTX();
+
+ if (pname != GL_LIGHT_MODEL_TWO_SIDE) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ } else {
+ yagl_host_glLightModelf(pname, (GLfloat)param);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glMaterialf(GLenum face,
+ GLenum pname,
+ GLfloat param)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glMaterialf, GLenum, GLenum, GLfloat, face, pname, param);
+
+ YAGL_GET_CTX();
+
+ if (face != GL_FRONT_AND_BACK) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ } else {
+ yagl_host_glMaterialf(face, pname, param);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glMaterialx(GLenum face,
+ GLenum pname,
+ GLfixed param)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glMaterialx, GLenum, GLenum, GLfixed, face, pname, param);
+
+ YAGL_GET_CTX();
+
+ if (face != GL_FRONT_AND_BACK) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ } else {
+ yagl_host_glMaterialf(face, pname, yagl_fixed_to_float(param));
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glSampleCoveragex(GLclampx value,
+ GLboolean invert)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glSampleCoveragex, GLclampx, GLboolean, value, invert);
+
+ YAGL_GET_CTX();
+
+ yagl_gles_context_sample_coverage(&ctx->base,
+ yagl_fixed_to_float(value),
+ invert);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glDepthRangex(GLclampx zNear, GLclampx zFar)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glDepthRangex, GLclampx, GLclampx, zNear, zFar);
+
+ YAGL_GET_CTX();
+
+ yagl_gles_context_depth_rangef(&ctx->base,
+ yagl_fixed_to_float(zNear),
+ yagl_fixed_to_float(zFar));
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glPolygonOffsetx(GLfixed factor, GLfixed units)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glPolygonOffsetx, GLfixed, GLfixed, factor, units);
+
+ YAGL_GET_CTX();
+
+ yagl_gles_context_polygon_offset(&ctx->base,
+ yagl_fixed_to_float(factor),
+ yagl_fixed_to_float(units));
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glTexEnviv(GLenum target, GLenum pname, const GLint *params)
+{
+ int count = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glTexEnviv, GLenum, GLenum, const GLint*, target, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (target != GL_TEXTURE_ENV && target != GL_POINT_SPRITE_OES) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!yagl_gles1_get_texenv_param_count(pname, &count)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ yagl_host_glTexEnviv(target, pname, params, count);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
+{
+ int count = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glTexEnvfv, GLenum, GLenum, const GLfloat *, target, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (target != GL_TEXTURE_ENV && target != GL_POINT_SPRITE_OES) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!yagl_gles1_get_texenv_param_count(pname, &count)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ yagl_host_glTexEnvfv(target, pname, params, count);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glTexEnvxv(GLenum target, GLenum pname, const GLfixed *params)
+{
+ GLfloat paramsf[100]; // This fits all cases.
+ int i, count = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glTexEnvxv, GLenum, GLenum, const GLfixed *, target, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (target != GL_TEXTURE_ENV && target != GL_POINT_SPRITE_OES) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!yagl_gles1_get_texenv_param_count(pname, &count)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (params) {
+ if ((pname == GL_TEXTURE_ENV_COLOR) ||
+ (pname == GL_RGB_SCALE) ||
+ (pname == GL_ALPHA_SCALE)) {
+ for (i = 0; i < count; ++i) {
+ paramsf[i] = yagl_fixed_to_float(params[i]);
+ }
+ } else {
+ for (i = 0; i < count; ++i) {
+ paramsf[i] = (GLfloat)params[i];
+ }
+ }
+
+ yagl_host_glTexEnvfv(target, pname, paramsf, count);
+ } else {
+ yagl_host_glTexEnvfv(target, pname, NULL, 0);
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glClientActiveTexture(GLenum texture)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glClientActiveTexture, GLenum, texture);
+
+ YAGL_GET_CTX();
+
+ if ((texture < GL_TEXTURE0) ||
+ (texture >= (GL_TEXTURE0 + ctx->base.num_texture_units))) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ ctx->client_active_texture = texture - GL_TEXTURE0;
+
+ yagl_host_glClientActiveTexture(texture);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glDisableClientState(GLenum array_name)
+{
+ unsigned arr_idx;
+ struct yagl_gles_array *array;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glDisableClientState, GLenum, array_name);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles1_array_idx_get(ctx, array_name, &arr_idx)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ array = &ctx->base.vao->arrays[arr_idx];
+
+ yagl_gles_array_enable(array, 0);
+
+ if (array_name != GL_POINT_SIZE_ARRAY_OES) {
+ yagl_host_glDisableClientState(array_name);
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glEnableClientState(GLenum array_name)
+{
+ unsigned arr_idx;
+ struct yagl_gles_array *array;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glEnableClientState, GLenum, array_name);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles1_array_idx_get(ctx, array_name, &arr_idx)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ array = &ctx->base.vao->arrays[arr_idx];
+
+ yagl_gles_array_enable(array, 1);
+
+ if (array_name != GL_POINT_SIZE_ARRAY_OES) {
+ yagl_host_glEnableClientState(array_name);
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetTexEnviv(GLenum target, GLenum pname, GLint *params)
+{
+ int count = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetTexEnviv, GLenum, GLenum, GLint *, target, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (target != GL_TEXTURE_ENV && target != GL_POINT_SPRITE_OES) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!yagl_gles1_get_texenv_param_count(pname, &count)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ yagl_host_glGetTexEnviv(target, pname, params, count, NULL);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params)
+{
+ int count = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetTexEnvfv, GLenum, GLenum, GLfloat *, target, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (target != GL_TEXTURE_ENV && target != GL_POINT_SPRITE_OES) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!yagl_gles1_get_texenv_param_count(pname, &count)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ yagl_host_glGetTexEnvfv(target, pname, params, count, NULL);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetTexEnvxv(GLenum target, GLenum pname, GLfixed *params)
+{
+ int i, count = 0;
+ GLfloat paramsf[100]; // This fits all cases.
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetTexEnvxv, GLenum, GLenum, GLint *, target, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (target != GL_TEXTURE_ENV && target != GL_POINT_SPRITE_OES) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!yagl_gles1_get_texenv_param_count(pname, &count)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ yagl_host_glGetTexEnvfv(target, pname, paramsf, count, NULL);
+
+ if (params) {
+ if ((pname == GL_TEXTURE_ENV_COLOR) ||
+ (pname == GL_RGB_SCALE) ||
+ (pname == GL_ALPHA_SCALE)) {
+ for (i = 0; i < count; ++i) {
+ params[i] = yagl_float_to_fixed(paramsf[i]);
+ }
+ } else {
+ for (i = 0; i < count; ++i) {
+ params[i] = (GLfixed)paramsf[i];
+ }
+ }
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetPointerv(GLenum pname, GLvoid** pointer)
+{
+ struct yagl_gles_array *array = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glGetPointerv, GLenum, GLvoid**, pname, pointer);
+
+ YAGL_GET_CTX();
+
+ switch (pname) {
+ case GL_VERTEX_ARRAY_POINTER:
+ array = &ctx->base.vao->arrays[yagl_gles1_array_vertex];
+ break;
+ case GL_COLOR_ARRAY_POINTER:
+ array = &ctx->base.vao->arrays[yagl_gles1_array_color];
+ break;
+ case GL_NORMAL_ARRAY_POINTER:
+ array = &ctx->base.vao->arrays[yagl_gles1_array_normal];
+ break;
+ case GL_TEXTURE_COORD_ARRAY_POINTER:
+ array = &ctx->base.vao->arrays[yagl_gles1_array_texcoord + ctx->client_active_texture];
+ break;
+ case GL_POINT_SIZE_ARRAY_POINTER_OES:
+ array = &ctx->base.vao->arrays[yagl_gles1_array_pointsize];
+ break;
+ default:
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (pointer) {
+ if (array->vbo) {
+ *pointer = (GLvoid*)array->offset;
+ } else {
+ *pointer = (GLvoid*)array->ptr;
+ }
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glNormalPointer(GLenum type, GLsizei stride, const GLvoid* pointer)
+{
+ struct yagl_gles_array *array;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glNormalPointer, GLenum, GLsizei, const GLvoid*, type, stride, pointer);
+
+ YAGL_GET_CTX();
+
+ if (stride < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (type != GL_FLOAT && type != GL_FIXED &&
+ type != GL_SHORT && type != GL_BYTE) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ array = &ctx->base.vao->arrays[yagl_gles1_array_normal];
+
+ if (ctx->base.vbo) {
+ if (!yagl_gles_array_update_vbo(array,
+ 3,
+ type,
+ type == GL_FIXED,
+ GL_FALSE,
+ stride,
+ ctx->base.vbo,
+ (GLint)pointer,
+ 0)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+ } else {
+ /*
+ * GL_OES_vertex_array_object:
+ * "Binding a zero-named vertex array buffer:
+ * this can be detected by *Pointer(ES1) or VertexAttribPointer(ES2);
+ * if the pointer argument is not NULL:
+ * this means to bind a client vertex array;
+ * an INVALID_OPERATION error will be returned."
+ */
+ if ((ctx->base.vao != ctx->base.va_zero) && pointer) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles_array_update(array,
+ 3,
+ type,
+ type == GL_FIXED,
+ GL_FALSE,
+ stride,
+ pointer,
+ 0)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
+{
+ struct yagl_gles_array *array;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glVertexPointer, GLint, GLenum, GLsizei, const GLvoid*, size, type, stride, pointer);
+
+ YAGL_GET_CTX();
+
+ if ((size < 2) || (size > 4) || (stride < 0)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (type != GL_FLOAT && type != GL_FIXED &&
+ type != GL_SHORT && type != GL_BYTE) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ array = &ctx->base.vao->arrays[yagl_gles1_array_vertex];
+
+ if (ctx->base.vbo) {
+ if (!yagl_gles_array_update_vbo(array,
+ size,
+ type,
+ type == GL_FIXED || type == GL_BYTE,
+ GL_FALSE,
+ stride,
+ ctx->base.vbo,
+ (GLint)pointer,
+ 0)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+ } else {
+ /*
+ * GL_OES_vertex_array_object:
+ * "Binding a zero-named vertex array buffer:
+ * this can be detected by *Pointer(ES1) or VertexAttribPointer(ES2);
+ * if the pointer argument is not NULL:
+ * this means to bind a client vertex array;
+ * an INVALID_OPERATION error will be returned."
+ */
+ if ((ctx->base.vao != ctx->base.va_zero) && pointer) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles_array_update(array,
+ size,
+ type,
+ type == GL_FIXED || type == GL_BYTE,
+ GL_FALSE,
+ stride,
+ pointer,
+ 0)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
+{
+ struct yagl_gles_array *array;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glColorPointer, GLint, GLenum, GLsizei, const GLvoid*, size, type, stride, pointer);
+
+ YAGL_GET_CTX();
+
+ if (size != 4 || stride < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (type != GL_FLOAT && type != GL_FIXED && type != GL_UNSIGNED_BYTE) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ array = &ctx->base.vao->arrays[yagl_gles1_array_color];
+
+ if (ctx->base.vbo) {
+ if (!yagl_gles_array_update_vbo(array,
+ size,
+ type,
+ type == GL_FIXED,
+ GL_FALSE,
+ stride,
+ ctx->base.vbo,
+ (GLint)pointer,
+ 0)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+ } else {
+ /*
+ * GL_OES_vertex_array_object:
+ * "Binding a zero-named vertex array buffer:
+ * this can be detected by *Pointer(ES1) or VertexAttribPointer(ES2);
+ * if the pointer argument is not NULL:
+ * this means to bind a client vertex array;
+ * an INVALID_OPERATION error will be returned."
+ */
+ if ((ctx->base.vao != ctx->base.va_zero) && pointer) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles_array_update(array,
+ size,
+ type,
+ type == GL_FIXED,
+ GL_FALSE,
+ stride,
+ pointer,
+ 0)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
+{
+ struct yagl_gles_array *array;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glTexCoordPointer, GLint, GLenum, GLsizei, const GLvoid*, size, type, stride, pointer);
+
+ YAGL_GET_CTX();
+
+ if ((size < 2) || (size > 4) || (stride < 0)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (type != GL_FLOAT && type != GL_FIXED &&
+ type != GL_SHORT && type != GL_BYTE) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ array = &ctx->base.vao->arrays[yagl_gles1_array_texcoord + ctx->client_active_texture];
+
+ if (ctx->base.vbo) {
+ if (!yagl_gles_array_update_vbo(array,
+ size,
+ type,
+ type == GL_FIXED || type == GL_BYTE,
+ GL_FALSE,
+ stride,
+ ctx->base.vbo,
+ (GLint)pointer,
+ 0)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+ } else {
+ /*
+ * GL_OES_vertex_array_object:
+ * "Binding a zero-named vertex array buffer:
+ * this can be detected by *Pointer(ES1) or VertexAttribPointer(ES2);
+ * if the pointer argument is not NULL:
+ * this means to bind a client vertex array;
+ * an INVALID_OPERATION error will be returned."
+ */
+ if ((ctx->base.vao != ctx->base.va_zero) && pointer) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles_array_update(array,
+ size,
+ type,
+ type == GL_FIXED || type == GL_BYTE,
+ GL_FALSE,
+ stride,
+ pointer,
+ 0)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glPointSizePointerOES(GLenum type, GLsizei stride, const GLvoid* pointer)
+{
+ struct yagl_gles_array *array;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glPointSizePointerOES, GLenum, GLsizei, const GLvoid*, type, stride, pointer);
+
+ YAGL_GET_CTX();
+
+ if (stride < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (type != GL_FLOAT && type != GL_FIXED) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ array = &ctx->base.vao->arrays[yagl_gles1_array_pointsize];
+
+ if (ctx->base.vbo) {
+ if (!yagl_gles_array_update_vbo(array,
+ 1,
+ type,
+ type == GL_FIXED,
+ GL_FALSE,
+ stride,
+ ctx->base.vbo,
+ (GLint)pointer,
+ 0)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+ } else {
+ /*
+ * GL_OES_vertex_array_object:
+ * "Binding a zero-named vertex array buffer:
+ * this can be detected by *Pointer(ES1) or VertexAttribPointer(ES2);
+ * if the pointer argument is not NULL:
+ * this means to bind a client vertex array;
+ * an INVALID_OPERATION error will be returned."
+ */
+ if ((ctx->base.vao != ctx->base.va_zero) && pointer) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles_array_update(array,
+ 1,
+ type,
+ type == GL_FIXED,
+ GL_FALSE,
+ stride,
+ pointer,
+ 0)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glTexParameterxv(GLenum target, GLenum pname, const GLfixed *params)
+{
+ GLfloat paramf;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glTexParameterxv, GLenum, GLenum, const GLfixed*, target, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (target != GL_TEXTURE_2D) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (params) {
+ paramf = (GLfloat)params[0];
+ yagl_gles_context_tex_parameterfv(&ctx->base, target, pname, ¶mf);
+ } else {
+ yagl_gles_context_tex_parameterfv(&ctx->base, target, pname, NULL);
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetTexParameterxv(GLenum target, GLenum pname, GLfixed *params)
+{
+ GLfloat paramf;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetTexParameterxv, GLenum, GLenum, GLfixed*, target, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles_context_get_tex_parameterfv(&ctx->base, target, pname, ¶mf)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (params) {
+ *params = (GLfixed)paramf;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glMultMatrixf(const GLfloat* m)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glMultMatrixf, const GLfloat*, m);
+ yagl_host_glMultMatrixf(m, 16);
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glMultMatrixx(const GLfixed* m)
+{
+ GLfloat tmp[16];
+ int i;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glMultMatrixx, const GLfixed*, m);
+
+ YAGL_GET_CTX();
+
+ if (m) {
+ for (i = 0; i < 16; ++i) {
+ tmp[i] = yagl_fixed_to_float(m[i]);
+ }
+ yagl_host_glMultMatrixf(tmp, 16);
+ } else {
+ yagl_host_glMultMatrixf(NULL, 16);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glLoadMatrixf(const GLfloat* m)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glLoadMatrixf, const GLfloat*, m);
+ yagl_host_glLoadMatrixf(m, 16);
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glLoadMatrixx(const GLfixed* m)
+{
+ GLfloat tmp[16];
+ int i;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glLoadMatrixx, const GLfixed*, m);
+
+ YAGL_GET_CTX();
+
+ if (m) {
+ for (i = 0; i < 16; ++i) {
+ tmp[i] = yagl_fixed_to_float(m[i]);
+ }
+ yagl_host_glLoadMatrixf(tmp, 16);
+ } else {
+ yagl_host_glLoadMatrixf(NULL, 16);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glPointParameterfv(GLenum pname, const GLfloat *params)
+{
+ int count = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glPointParameterfv, GLenum, const GLfloat *, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles1_get_point_param_count(pname, &count)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ yagl_host_glPointParameterfv(pname, params, count);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glPointParameterxv(GLenum pname, const GLfixed *params)
+{
+ GLfloat paramsf[100]; // This fits all cases.
+ int i, count = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glPointParameterxv, GLenum, const GLfixed *, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles1_get_point_param_count(pname, &count)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (params) {
+ for (i = 0; i < count; ++i) {
+ paramsf[i] = yagl_fixed_to_float(params[i]);
+ }
+ yagl_host_glPointParameterfv(pname, paramsf, count);
+ } else {
+ yagl_host_glPointParameterfv(pname, NULL, count);
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glFogfv(GLenum pname, const GLfloat *params)
+{
+ int count = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glFogfv, GLenum, const GLfloat *, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles1_get_fog_param_count(pname, &count)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ yagl_host_glFogfv(pname, params, count);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glFogxv(GLenum pname, const GLfixed *params)
+{
+ GLfloat paramsf[100]; // This fits all cases.
+ int i, count = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glFogxv, GLenum, const GLfixed *, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles1_get_fog_param_count(pname, &count)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (params) {
+ if (pname == GL_FOG_MODE) {
+ for (i = 0; i < count; ++i) {
+ paramsf[i] = (GLfloat)params[i];
+ }
+ } else {
+ for (i = 0; i < count; ++i) {
+ paramsf[i] = yagl_fixed_to_float(params[i]);
+ }
+ }
+ yagl_host_glFogfv(pname, paramsf, count);
+ } else {
+ yagl_host_glFogfv(pname, NULL, count);
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glClipPlanef(GLenum plane, const GLfloat *equation)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glClipPlanef, GLenum, const GLfloat *, plane, equation);
+
+ YAGL_GET_CTX();
+
+ if (plane < GL_CLIP_PLANE0 || plane >= (GL_CLIP_PLANE0 + ctx->max_clip_planes)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ yagl_host_glClipPlanef(plane, equation, 4);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glClipPlanex(GLenum plane, const GLfixed *equation)
+{
+ GLfloat equationf[4];
+ int i;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glClipPlanex, GLenum, const GLfixed *, plane, equation);
+
+ YAGL_GET_CTX();
+
+ if (plane < GL_CLIP_PLANE0 || plane >= (GL_CLIP_PLANE0 + ctx->max_clip_planes)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (equation) {
+ for (i = 0; i < 4; ++i) {
+ equationf[i] = yagl_fixed_to_float(equation[i]);
+ }
+ yagl_host_glClipPlanef(plane, equationf, 4);
+ } else {
+ yagl_host_glClipPlanef(plane, NULL, 4);
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetClipPlanef(GLenum pname, GLfloat *eqn)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glGetClipPlanef, GLenum, GLfloat*, pname, eqn);
+
+ YAGL_GET_CTX();
+
+ if (pname < GL_CLIP_PLANE0 || pname >= (GL_CLIP_PLANE0 + ctx->max_clip_planes)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ yagl_host_glGetClipPlanef(pname, eqn, 4, NULL);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetClipPlanex(GLenum pname, GLfixed *eqn)
+{
+ GLfloat equationf[4];
+ int i;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glGetClipPlanex, GLenum, GLfixed*, pname, eqn);
+
+ YAGL_GET_CTX();
+
+ if (pname < GL_CLIP_PLANE0 ||
+ pname >= (GL_CLIP_PLANE0 + ctx->max_clip_planes)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ yagl_host_glGetClipPlanef(pname, equationf, 4, NULL);
+
+ if (eqn) {
+ for (i = 0; i < 4; ++i) {
+ eqn[i] = yagl_float_to_fixed(equationf[i]);
+ }
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glLightfv(GLenum light, GLenum pname, const GLfloat *params)
+{
+ int count = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glLightfv, GLenum, GLenum, const GLfloat *, light, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (light < GL_LIGHT0 || light >= (GL_LIGHT0 + ctx->max_lights) ||
+ !yagl_gles1_get_light_param_count(pname, &count)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ yagl_host_glLightfv(light, pname, params, count);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glLightxv(GLenum light, GLenum pname, const GLfixed *params)
+{
+ GLfloat paramsf[100]; // This fits all cases.
+ int i, count = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glLightxv, GLenum, GLenum, const GLfixed *, light, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (light < GL_LIGHT0 || light >= (GL_LIGHT0 + ctx->max_lights) ||
+ !yagl_gles1_get_light_param_count(pname, &count)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (params) {
+ for (i = 0; i < count; ++i) {
+ paramsf[i] = yagl_fixed_to_float(params[i]);
+ }
+ yagl_host_glLightfv(light, pname, paramsf, count);
+ } else {
+ yagl_host_glLightfv(light, pname, NULL, count);
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glLightModelfv(GLenum pname, const GLfloat *params)
+{
+ int count = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glLightModelfv, GLenum, const GLfloat *, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles1_get_light_model_param_count(pname, &count)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ yagl_host_glLightModelfv(pname, params, count);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glLightModelxv(GLenum pname, const GLfixed *params)
+{
+ GLfloat paramsf[100]; // This fits all cases.
+ int i, count = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glLightModelxv, GLenum, const GLfixed *, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles1_get_light_model_param_count(pname, &count)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (params) {
+ if (pname == GL_LIGHT_MODEL_TWO_SIDE) {
+ for (i = 0; i < count; ++i) {
+ paramsf[i] = (GLfloat)(params[i]);
+ }
+ } else {
+ for (i = 0; i < count; ++i) {
+ paramsf[i] = yagl_fixed_to_float(params[i]);
+ }
+ }
+ yagl_host_glLightModelfv(pname, paramsf, count);
+ } else {
+ yagl_host_glLightModelfv(pname, NULL, count);
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetLightfv(GLenum light, GLenum pname, GLfloat *params)
+{
+ int count = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetLightfv, GLenum, GLenum, GLfloat*, light, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (light < GL_LIGHT0 || light >= (GL_LIGHT0 + ctx->max_lights) ||
+ !yagl_gles1_get_light_param_count(pname, &count)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ yagl_host_glGetLightfv(light, pname, params, count, NULL);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetLightxv(GLenum light, GLenum pname, GLfixed *params)
+{
+ GLfloat paramsf[100]; // This fits all cases.
+ int i, count = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetLightxv, GLenum, GLenum, GLfixed*, light, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (light < GL_LIGHT0 || light >= (GL_LIGHT0 + ctx->max_lights) ||
+ !yagl_gles1_get_light_param_count(pname, &count)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ yagl_host_glGetLightfv(light, pname, paramsf, count, NULL);
+
+ if (params) {
+ for (i = 0; i < count; ++i) {
+ params[i] = yagl_float_to_fixed(paramsf[i]);
+ }
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
+{
+ int count = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glMaterialfv, GLenum, GLenum, const GLfloat *, face, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (face != GL_FRONT_AND_BACK ||
+ !yagl_gles1_get_material_param_count(pname, &count)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ yagl_host_glMaterialfv(face, pname, params, count);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glMaterialxv(GLenum face, GLenum pname, const GLfixed *params)
+{
+ GLfloat paramsf[100]; // This fits all cases.
+ int i, count = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glMaterialxv, GLenum, GLenum, const GLfixed *, face, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (face != GL_FRONT_AND_BACK ||
+ !yagl_gles1_get_material_param_count(pname, &count)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (params) {
+ for (i = 0; i < count; ++i) {
+ paramsf[i] = yagl_fixed_to_float(params[i]);
+ }
+ yagl_host_glMaterialfv(face, pname, paramsf, count);
+ } else {
+ yagl_host_glMaterialfv(face, pname, NULL, count);
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
+{
+ int count = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetMaterialfv, GLenum, GLenum, GLfloat*, face, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles1_get_material_param_count(pname, &count)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ yagl_host_glGetMaterialfv(face, pname, params, count, NULL);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetMaterialxv(GLenum light, GLenum pname, GLfixed *params)
+{
+ GLfloat paramsf[100]; // This fits all cases.
+ int i, count = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetMaterialxv, GLenum, GLenum, GLfixed*, light, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles1_get_material_param_count(pname, &count)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ yagl_host_glGetMaterialfv(light, pname, paramsf, count, NULL);
+
+ if (params) {
+ for (i = 0; i < count; ++i) {
+ params[i] = yagl_float_to_fixed(paramsf[i]);
+ }
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetFixedv(GLenum pname, GLfixed* params)
+{
+ GLfloat floats[100]; // This fits all cases.
+ uint32_t i, num = 0;
+ int needs_map;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glGetFixedv, GLenum, GLfixed*, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles_context_get_floatv(&ctx->base, pname, floats, &num, &needs_map)) {
+ GLint ints[100]; // This fits all cases.
+ if (yagl_gles_context_get_integerv(&ctx->base, pname, ints, &num)) {
+ for (i = 0; i < num; ++i) {
+ floats[i] = ints[i];
+ }
+ } else {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+ }
+
+ if (params) {
+ for (i = 0; i < num; ++i) {
+ params[i] = yagl_float_to_fixed(floats[i]);
+ }
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+/* GL_OES_framebuffer_object */
+
+YAGL_API GLboolean glIsRenderbufferOES(GLuint renderbuffer)
+{
+ return glIsRenderbuffer(renderbuffer);
+}
+
+YAGL_API void glBindRenderbufferOES(GLenum target, GLuint renderbuffer)
+{
+ glBindRenderbuffer(target, renderbuffer);
+}
+
+YAGL_API void glDeleteRenderbuffersOES(GLsizei n, const GLuint* renderbuffers)
+{
+ glDeleteRenderbuffers(n, renderbuffers);
+}
+
+YAGL_API void glGenRenderbuffersOES(GLsizei n, GLuint* renderbuffers)
+{
+ glGenRenderbuffers(n, renderbuffers);
+}
+
+YAGL_API void glRenderbufferStorageOES(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
+{
+ glRenderbufferStorage(target, internalformat, width, height);
+}
+
+YAGL_API void glGetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint* params)
+{
+ glGetRenderbufferParameteriv(target, pname, params);
+}
+
+YAGL_API GLboolean glIsFramebufferOES(GLuint framebuffer)
+{
+ return glIsFramebuffer(framebuffer);
+}
+
+YAGL_API void glBindFramebufferOES(GLenum target, GLuint framebuffer)
+{
+ glBindFramebuffer(target, framebuffer);
+}
+
+YAGL_API void glDeleteFramebuffersOES(GLsizei n, const GLuint* framebuffers)
+{
+ glDeleteFramebuffers(n, framebuffers);
+}
+
+YAGL_API void glGenFramebuffersOES(GLsizei n, GLuint* framebuffers)
+{
+ glGenFramebuffers(n, framebuffers);
+}
+
+YAGL_API GLenum glCheckFramebufferStatusOES(GLenum target)
+{
+ return glCheckFramebufferStatus(target);
+}
+
+YAGL_API void glFramebufferTexture2DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
+{
+ glFramebufferTexture2D(target, attachment, textarget, texture, level);
+}
+
+YAGL_API void glFramebufferRenderbufferOES(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
+{
+ glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
+}
+
+YAGL_API void glGetFramebufferAttachmentParameterivOES(GLenum target, GLenum attachment, GLenum pname, GLint* params)
+{
+ glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
+}
+
+YAGL_API void glGenerateMipmapOES(GLenum target)
+{
+ glGenerateMipmap(target);
+}
+
+/* GL_OES_blend_subtract */
+
+YAGL_API void glBlendEquationOES(GLenum mode)
+{
+ glBlendEquation(mode);
+}
+
+/* GL_OES_blend_equation_separate */
+
+YAGL_API void glBlendEquationSeparateOES(GLenum modeRGB, GLenum modeAlpha)
+{
+ glBlendEquationSeparate(modeRGB, modeAlpha);
+}
+
+/* GL_OES_blend_func_separate */
+
+YAGL_API void glBlendFuncSeparateOES(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
+{
+ glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GLES/gl.h"
+#include "GLES/glext.h"
+#include "yagl_gles1_context.h"
+#include "yagl_gles_vertex_array.h"
+#include "yagl_gles_array.h"
+#include "yagl_gles_buffer.h"
+#include "yagl_gles_texture.h"
+#include "yagl_gles_texture_unit.h"
+#include "yagl_gles_utils.h"
+#include "yagl_log.h"
+#include "yagl_malloc.h"
+#include "yagl_utils.h"
+#include "yagl_state.h"
+#include "yagl_egl_fence.h"
+#include "yagl_host_gles_calls.h"
+#include "yagl_texcompress_etc1.h"
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+
+/*
+ * We can't include GL/gl.h here
+ */
+#define GL_RGBA8 0x8058
+
+#define YAGL_SET_ERR(err) \
+ yagl_gles_context_set_error(ctx, err); \
+ YAGL_LOG_ERROR("error = 0x%X", err)
+
+#define YAGL_GLES1_NUM_COMP_TEX_FORMATS 11
+
+static const GLchar *blend_subtract_ext = "GL_OES_blend_subtract";
+static const GLchar *blend_equation_separate_ext = "GL_OES_blend_equation_separate";
+static const GLchar *blend_func_separate_ext = "GL_OES_blend_func_separate";
+static const GLchar *blend_minmax_ext = "GL_EXT_blend_minmax";
+static const GLchar *element_index_uint_ext = "GL_OES_element_index_uint";
+static const GLchar *texture_mirrored_repeat_ext = "GL_OES_texture_mirrored_repeat";
+static const GLchar *texture_format_bgra8888_ext = "GL_EXT_texture_format_BGRA8888";
+static const GLchar *point_sprite_ext = "GL_OES_point_sprite";
+static const GLchar *point_size_array_ext = "GL_OES_point_size_array";
+static const GLchar *stencil_wrap_ext = "GL_OES_stencil_wrap";
+static const GLchar *compressed_paletted_texture_ext = "GL_OES_compressed_paletted_texture";
+static const GLchar *depth_texture_ext = "GL_OES_depth_texture";
+static const GLchar *framebuffer_object_ext = "GL_OES_framebuffer_object";
+static const GLchar *depth24_ext = "GL_OES_depth24";
+static const GLchar *depth32_ext = "GL_OES_depth32";
+static const GLchar *rgb8_rgba8_ext = "GL_OES_rgb8_rgba8";
+static const GLchar *stencil1_ext = "GL_OES_stencil1";
+static const GLchar *stencil4_ext = "GL_OES_stencil4";
+static const GLchar *stencil8_ext = "GL_OES_stencil8";
+static const GLchar *egl_image_ext = "GL_OES_EGL_image";
+static const GLchar *framebuffer_blit_ext = "GL_ANGLE_framebuffer_blit";
+static const GLchar *draw_buffers_ext = "GL_EXT_draw_buffers";
+static const GLchar *mapbuffer_ext = "GL_OES_mapbuffer";
+static const GLchar *map_buffer_range_ext = "GL_EXT_map_buffer_range";
+static const GLchar *pbo_ext = "GL_NV_pixel_buffer_object";
+static const GLchar *read_buffer_ext = "GL_NV_read_buffer";
+static const GLchar *compressed_etc1_rgb8_texture_ext = "GL_OES_compressed_ETC1_RGB8_texture";
+static const GLchar *pack_subimage_ext = "GL_NV_pack_subimage";
+static const GLchar *unpack_subimage_ext = "GL_EXT_unpack_subimage";
+static const GLchar *surfaceless_context_ext = "GL_OES_surfaceless_context";
+static const GLchar *egl_sync_ext = "GL_OES_EGL_sync";
+static const GLchar *packed_depth_stencil_ext = "GL_OES_packed_depth_stencil";
+static const GLchar *texture_npot_ext = "GL_OES_texture_npot";
+static const GLchar *texture_filter_anisotropic_ext = "GL_EXT_texture_filter_anisotropic";
+static const GLchar *vertex_array_object_ext = "GL_OES_vertex_array_object";
+static const GLchar *matrix_palette_ext = "GL_OES_matrix_palette";
+
+static const GLchar **yagl_gles1_context_get_extensions(struct yagl_gles1_context *ctx,
+ int *num_extensions)
+{
+ const GLchar **extensions;
+ int i = 0;
+
+ extensions = yagl_malloc(100 * sizeof(*extensions));
+
+ extensions[i++] = blend_subtract_ext;
+ extensions[i++] = blend_equation_separate_ext;
+ extensions[i++] = blend_func_separate_ext;
+ extensions[i++] = blend_minmax_ext;
+ extensions[i++] = element_index_uint_ext;
+ extensions[i++] = texture_mirrored_repeat_ext;
+ extensions[i++] = texture_format_bgra8888_ext;
+ extensions[i++] = point_sprite_ext;
+ extensions[i++] = point_size_array_ext;
+ extensions[i++] = stencil_wrap_ext;
+ extensions[i++] = compressed_paletted_texture_ext;
+ extensions[i++] = depth_texture_ext;
+ extensions[i++] = framebuffer_object_ext;
+ extensions[i++] = depth24_ext;
+ extensions[i++] = depth32_ext;
+ extensions[i++] = rgb8_rgba8_ext;
+ extensions[i++] = stencil1_ext;
+ extensions[i++] = stencil4_ext;
+ extensions[i++] = stencil8_ext;
+ extensions[i++] = egl_image_ext;
+ extensions[i++] = framebuffer_blit_ext;
+ extensions[i++] = draw_buffers_ext;
+ extensions[i++] = mapbuffer_ext;
+ extensions[i++] = map_buffer_range_ext;
+ extensions[i++] = pbo_ext;
+ extensions[i++] = read_buffer_ext;
+ extensions[i++] = compressed_etc1_rgb8_texture_ext;
+ extensions[i++] = pack_subimage_ext;
+ extensions[i++] = unpack_subimage_ext;
+ extensions[i++] = surfaceless_context_ext;
+
+ if (yagl_egl_fence_supported()) {
+ extensions[i++] = egl_sync_ext;
+ }
+
+ if (ctx->base.texture_npot) {
+ extensions[i++] = texture_npot_ext;
+ }
+
+ if (ctx->base.texture_filter_anisotropic) {
+ extensions[i++] = texture_filter_anisotropic_ext;
+ }
+
+ if (ctx->base.packed_depth_stencil) {
+ extensions[i++] = packed_depth_stencil_ext;
+ }
+
+ if (ctx->base.vertex_arrays_supported) {
+ extensions[i++] = vertex_array_object_ext;
+ }
+
+ if (ctx->matrix_palette) {
+ extensions[i++] = matrix_palette_ext;
+ }
+
+ *num_extensions = i;
+
+ return extensions;
+}
+
+static void yagl_gles1_compressed_texture_formats_fill(GLint *params)
+{
+ params[0] = GL_PALETTE4_RGB8_OES;
+ params[1] = GL_PALETTE4_RGBA8_OES;
+ params[2] = GL_PALETTE4_R5_G6_B5_OES;
+ params[3] = GL_PALETTE4_RGBA4_OES;
+ params[4] = GL_PALETTE4_RGB5_A1_OES;
+ params[5] = GL_PALETTE8_RGB8_OES;
+ params[6] = GL_PALETTE8_RGBA8_OES;
+ params[7] = GL_PALETTE8_R5_G6_B5_OES;
+ params[8] = GL_PALETTE8_RGBA4_OES;
+ params[9] = GL_PALETTE8_RGB5_A1_OES;
+ params[10] = GL_ETC1_RGB8_OES;
+}
+
+static void yagl_gles1_vertex_array_apply(struct yagl_gles_array *array,
+ uint32_t first,
+ uint32_t count,
+ const GLvoid *ptr,
+ void *user_data)
+{
+ if (array->vbo) {
+ yagl_host_glVertexPointerOffset(array->size,
+ array->actual_type,
+ array->actual_stride,
+ array->actual_offset);
+ } else {
+ yagl_host_glVertexPointerData(array->size,
+ array->actual_type,
+ array->actual_stride,
+ first,
+ ptr + (first * array->actual_stride),
+ count * array->actual_stride);
+ }
+}
+
+static void yagl_gles1_normal_array_apply(struct yagl_gles_array *array,
+ uint32_t first,
+ uint32_t count,
+ const GLvoid *ptr,
+ void *user_data)
+{
+ if (array->vbo) {
+ yagl_host_glNormalPointerOffset(array->actual_type,
+ array->actual_stride,
+ array->actual_offset);
+ } else {
+ yagl_host_glNormalPointerData(array->actual_type,
+ array->actual_stride,
+ first,
+ ptr + (first * array->actual_stride),
+ count * array->actual_stride);
+ }
+}
+
+static void yagl_gles1_color_array_apply(struct yagl_gles_array *array,
+ uint32_t first,
+ uint32_t count,
+ const GLvoid *ptr,
+ void *user_data)
+{
+ if (array->vbo) {
+ yagl_host_glColorPointerOffset(array->size,
+ array->actual_type,
+ array->actual_stride,
+ array->actual_offset);
+ } else {
+ yagl_host_glColorPointerData(array->size,
+ array->actual_type,
+ array->actual_stride,
+ first,
+ ptr + (first * array->actual_stride),
+ count * array->actual_stride);
+ }
+}
+
+static void yagl_gles1_texcoord_array_apply(struct yagl_gles_array *array,
+ uint32_t first,
+ uint32_t count,
+ const GLvoid *ptr,
+ void *user_data)
+{
+ struct yagl_gles1_context *gles1_ctx = user_data;
+ int tex_id = array->index - yagl_gles1_array_texcoord;
+
+ if (tex_id != gles1_ctx->client_active_texture) {
+ yagl_host_glClientActiveTexture(tex_id + GL_TEXTURE0);
+ }
+
+ if (array->vbo) {
+ yagl_host_glTexCoordPointerOffset(array->size,
+ array->actual_type,
+ array->actual_stride,
+ array->actual_offset);
+ } else {
+ yagl_host_glTexCoordPointerData(tex_id,
+ array->size,
+ array->actual_type,
+ array->actual_stride,
+ first,
+ ptr + (first * array->actual_stride),
+ count * array->actual_stride);
+ }
+
+ if (tex_id != gles1_ctx->client_active_texture) {
+ yagl_host_glClientActiveTexture(gles1_ctx->client_active_texture +
+ GL_TEXTURE0);
+ }
+}
+
+static void yagl_gles1_pointsize_array_apply(struct yagl_gles_array *array,
+ uint32_t first,
+ uint32_t count,
+ const GLvoid *ptr,
+ void *user_data)
+{
+}
+
+static unsigned yagl_gles1_array_idx_from_pname(struct yagl_gles1_context *ctx,
+ GLenum pname)
+{
+ switch (pname) {
+ case GL_VERTEX_ARRAY:
+ case GL_VERTEX_ARRAY_BUFFER_BINDING:
+ case GL_VERTEX_ARRAY_SIZE:
+ case GL_VERTEX_ARRAY_STRIDE:
+ case GL_VERTEX_ARRAY_TYPE:
+ return yagl_gles1_array_vertex;
+ case GL_COLOR_ARRAY:
+ case GL_COLOR_ARRAY_BUFFER_BINDING:
+ case GL_COLOR_ARRAY_SIZE:
+ case GL_COLOR_ARRAY_STRIDE:
+ case GL_COLOR_ARRAY_TYPE:
+ return yagl_gles1_array_color;
+ case GL_NORMAL_ARRAY:
+ case GL_NORMAL_ARRAY_BUFFER_BINDING:
+ case GL_NORMAL_ARRAY_STRIDE:
+ case GL_NORMAL_ARRAY_TYPE:
+ return yagl_gles1_array_normal;
+ case GL_TEXTURE_COORD_ARRAY:
+ case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING:
+ case GL_TEXTURE_COORD_ARRAY_SIZE:
+ case GL_TEXTURE_COORD_ARRAY_STRIDE:
+ case GL_TEXTURE_COORD_ARRAY_TYPE:
+ return yagl_gles1_array_texcoord + ctx->client_active_texture;
+ case GL_POINT_SIZE_ARRAY_TYPE_OES:
+ case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES:
+ case GL_POINT_SIZE_ARRAY_OES:
+ case GL_POINT_SIZE_ARRAY_STRIDE_OES:
+ return yagl_gles1_array_pointsize;
+ default:
+ fprintf(stderr, "Critical error! Bad array name!\n");
+ exit(1);
+ }
+}
+
+static void yagl_gles1_context_prepare(struct yagl_client_context *ctx)
+{
+ struct yagl_gles1_context *gles1_ctx = (struct yagl_gles1_context*)ctx;
+ GLint num_texture_units = 0;
+ int32_t size = 0;
+ char *host_extensions;
+ const GLchar **extensions;
+ int num_extensions;
+
+ YAGL_LOG_FUNC_ENTER(yagl_gles1_context_prepare, "%p", ctx);
+
+ yagl_host_glGetIntegerv(GL_MAX_TEXTURE_UNITS,
+ &num_texture_units, 1, NULL);
+
+ /*
+ * We limit this by 32 for conformance.
+ */
+ if (num_texture_units > 32) {
+ num_texture_units = 32;
+ }
+
+ yagl_gles_context_prepare(&gles1_ctx->base,
+ num_texture_units,
+ /* Each texture unit has its own client-side array state */
+ yagl_gles1_array_texcoord + num_texture_units);
+
+ yagl_host_glGetIntegerv(GL_MAX_CLIP_PLANES,
+ &gles1_ctx->max_clip_planes,
+ 1, NULL);
+
+ if (gles1_ctx->max_clip_planes < 6) {
+ YAGL_LOG_WARN("host GL_MAX_CLIP_PLANES=%d is less then required 6",
+ gles1_ctx->max_clip_planes);
+ } else {
+ /* According to OpenGLES 1.1 docs on khronos website we only need
+ * to support 6 planes. This will protect us from bogus
+ * GL_MAX_CLIP_PLANES value reported by some drivers */
+ gles1_ctx->max_clip_planes = 6;
+ }
+
+ yagl_host_glGetIntegerv(GL_MAX_LIGHTS, &gles1_ctx->max_lights, 1, NULL);
+
+ yagl_host_glGetIntegerv(GL_MAX_TEXTURE_SIZE, &gles1_ctx->max_tex_size, 1, NULL);
+
+ yagl_host_glGetString(GL_EXTENSIONS, NULL, 0, &size);
+ host_extensions = yagl_malloc0(size);
+ yagl_host_glGetString(GL_EXTENSIONS, host_extensions, size, NULL);
+
+ gles1_ctx->matrix_palette =
+ (strstr(host_extensions, "GL_ARB_vertex_blend ") != NULL) &&
+ (strstr(host_extensions, "GL_ARB_matrix_palette ") != NULL);
+
+ yagl_free(host_extensions);
+
+ extensions = yagl_gles1_context_get_extensions(gles1_ctx, &num_extensions);
+
+ yagl_gles_context_prepare_end(&gles1_ctx->base, extensions, num_extensions);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+static void yagl_gles1_context_destroy(struct yagl_client_context *ctx)
+{
+ struct yagl_gles1_context *gles1_ctx = (struct yagl_gles1_context*)ctx;
+
+ YAGL_LOG_FUNC_ENTER(yagl_gles1_context_destroy, "%p", ctx);
+
+ yagl_gles_context_cleanup(&gles1_ctx->base);
+
+ yagl_free(gles1_ctx);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+static struct yagl_gles_array
+ *yagl_gles1_context_create_arrays(struct yagl_gles_context *ctx)
+{
+ GLint i;
+ struct yagl_gles_array *arrays;
+
+ arrays = yagl_malloc(ctx->num_arrays * sizeof(*arrays));
+
+ yagl_gles_array_init(&arrays[yagl_gles1_array_vertex],
+ yagl_gles1_array_vertex,
+ &yagl_gles1_vertex_array_apply,
+ ctx);
+
+ yagl_gles_array_init(&arrays[yagl_gles1_array_color],
+ yagl_gles1_array_color,
+ &yagl_gles1_color_array_apply,
+ ctx);
+
+ yagl_gles_array_init(&arrays[yagl_gles1_array_normal],
+ yagl_gles1_array_normal,
+ &yagl_gles1_normal_array_apply,
+ ctx);
+
+ yagl_gles_array_init(&arrays[yagl_gles1_array_pointsize],
+ yagl_gles1_array_pointsize,
+ &yagl_gles1_pointsize_array_apply,
+ ctx);
+
+ for (i = yagl_gles1_array_texcoord; i < ctx->num_arrays; ++i) {
+ yagl_gles_array_init(&arrays[i],
+ i,
+ &yagl_gles1_texcoord_array_apply,
+ ctx);
+ }
+
+ return arrays;
+}
+
+static const GLchar
+ *yagl_gles1_context_get_string(struct yagl_gles_context *ctx,
+ GLenum name)
+{
+ const char *str = NULL;
+
+ switch (name) {
+ case GL_VERSION:
+ str = "OpenGL ES-CM 1.1";
+ break;
+ case GL_RENDERER:
+ str = "YaGL GLESv1_CM";
+ break;
+ default:
+ str = "";
+ }
+
+ return str;
+}
+
+typedef struct YaglGles1PalFmtDesc {
+ GLenum uncomp_format;
+ GLenum pixel_type;
+ unsigned pixel_size;
+ unsigned bits_per_index;
+} YaglGles1PalFmtDesc;
+
+static inline int yagl_log2(int val)
+{
+ int ret = 0;
+
+ if (val > 0) {
+ while (val >>= 1) {
+ ret++;
+ }
+ }
+
+ return ret;
+}
+
+static inline int yagl_gles1_tex_dims_valid(GLsizei width,
+ GLsizei height,
+ int max_size)
+{
+ if (width < 0 || height < 0 || width > max_size || height > max_size ||
+ (width & (width - 1)) || (height & (height - 1))) {
+ return 0;
+ }
+
+ return 1;
+}
+
+static void yagl_gles1_cpal_format_get_descr(GLenum format,
+ YaglGles1PalFmtDesc *desc)
+{
+ assert(format >= GL_PALETTE4_RGB8_OES && format <= GL_PALETTE8_RGB5_A1_OES);
+
+ switch (format) {
+ case GL_PALETTE4_RGB8_OES:
+ desc->uncomp_format = GL_RGB;
+ desc->bits_per_index = 4;
+ desc->pixel_type = GL_UNSIGNED_BYTE;
+ desc->pixel_size = 3;
+ break;
+ case GL_PALETTE4_RGBA8_OES:
+ desc->uncomp_format = GL_RGBA;
+ desc->bits_per_index = 4;
+ desc->pixel_type = GL_UNSIGNED_BYTE;
+ desc->pixel_size = 4;
+ break;
+ case GL_PALETTE4_R5_G6_B5_OES:
+ desc->uncomp_format = GL_RGB;
+ desc->bits_per_index = 4;
+ desc->pixel_type = GL_UNSIGNED_SHORT_5_6_5;
+ desc->pixel_size = 2;
+ break;
+ case GL_PALETTE4_RGBA4_OES:
+ desc->uncomp_format = GL_RGBA;
+ desc->bits_per_index = 4;
+ desc->pixel_type = GL_UNSIGNED_SHORT_4_4_4_4;
+ desc->pixel_size = 2;
+ break;
+ case GL_PALETTE4_RGB5_A1_OES:
+ desc->uncomp_format = GL_RGBA;
+ desc->bits_per_index = 4;
+ desc->pixel_type = GL_UNSIGNED_SHORT_5_5_5_1;
+ desc->pixel_size = 2;
+ break;
+ case GL_PALETTE8_RGB8_OES:
+ desc->uncomp_format = GL_RGB;
+ desc->bits_per_index = 8;
+ desc->pixel_type = GL_UNSIGNED_BYTE;
+ desc->pixel_size = 3;
+ break;
+ case GL_PALETTE8_RGBA8_OES:
+ desc->uncomp_format = GL_RGBA;
+ desc->bits_per_index = 8;
+ desc->pixel_type = GL_UNSIGNED_BYTE;
+ desc->pixel_size = 4;
+ break;
+ case GL_PALETTE8_R5_G6_B5_OES:
+ desc->uncomp_format = GL_RGB;
+ desc->bits_per_index = 8;
+ desc->pixel_type = GL_UNSIGNED_SHORT_5_6_5;
+ desc->pixel_size = 2;
+ break;
+ case GL_PALETTE8_RGBA4_OES:
+ desc->uncomp_format = GL_RGBA;
+ desc->bits_per_index = 8;
+ desc->pixel_type = GL_UNSIGNED_SHORT_4_4_4_4;
+ desc->pixel_size = 2;
+ break;
+ case GL_PALETTE8_RGB5_A1_OES:
+ desc->uncomp_format = GL_RGBA;
+ desc->bits_per_index = 8;
+ desc->pixel_type = GL_UNSIGNED_SHORT_5_5_5_1;
+ desc->pixel_size = 2;
+ break;
+ }
+}
+
+static GLsizei yagl_gles1_cpal_tex_size(YaglGles1PalFmtDesc *fmt_desc,
+ unsigned width,
+ unsigned height,
+ unsigned max_level)
+{
+ GLsizei size;
+
+ /* Palette table size */
+ size = (1 << fmt_desc->bits_per_index) * fmt_desc->pixel_size;
+
+ /* Texture palette indices array size for each miplevel */
+ do {
+ if (fmt_desc->bits_per_index == 4) {
+ size += (width * height + 1) / 2;
+ } else {
+ size += width * height;
+ }
+
+ width >>= 1;
+ if (width == 0) {
+ width = 1;
+ }
+
+ height >>= 1;
+ if (height == 0) {
+ height = 1;
+ }
+ } while (max_level--);
+
+ return size;
+}
+
+static void yagl_gles1_cpal_tex_uncomp_and_apply(struct yagl_gles_context *ctx,
+ struct yagl_gles_texture *texture,
+ YaglGles1PalFmtDesc *fmt_desc,
+ unsigned max_level,
+ unsigned width,
+ unsigned height,
+ const GLvoid *data)
+{
+ uint8_t *tex_img_data = NULL;
+ uint8_t *img;
+ const uint8_t *indices;
+ unsigned cur_level, i;
+ unsigned num_of_texels = width * height;
+
+ if (!data) {
+ for (cur_level = 0; cur_level <= max_level; ++cur_level) {
+ yagl_host_glTexImage2DData(GL_TEXTURE_2D,
+ cur_level,
+ fmt_desc->uncomp_format,
+ width, height,
+ 0,
+ fmt_desc->uncomp_format,
+ fmt_desc->pixel_type,
+ NULL, 0);
+ width >>= 1;
+ height >>= 1;
+
+ if (width == 0) {
+ width = 1;
+ }
+
+ if (height == 0) {
+ height = 1;
+ }
+ }
+
+ yagl_gles_texture_set_internalformat(texture,
+ fmt_desc->uncomp_format,
+ fmt_desc->pixel_type,
+ yagl_gles_context_convert_textures(ctx));
+
+ return;
+ }
+
+ /* Jump over palette data to first image data */
+ indices = data + (1 << fmt_desc->bits_per_index) * fmt_desc->pixel_size;
+
+ /* 0 level image is the largest */
+ tex_img_data = yagl_malloc(num_of_texels * fmt_desc->pixel_size);
+
+ /* We will pass tightly packed data to glTexImage2D */
+ yagl_gles_reset_unpack(&ctx->unpack);
+
+ for (cur_level = 0; cur_level <= max_level; ++cur_level) {
+ img = tex_img_data;
+
+ if (fmt_desc->bits_per_index == 4) {
+ unsigned cur_idx;
+
+ for (i = 0; i < num_of_texels; ++i) {
+ if ((i % 2) == 0) {
+ cur_idx = indices[i / 2] >> 4;
+ } else {
+ cur_idx = indices[i / 2] & 0xf;
+ }
+
+ memcpy(img,
+ data + cur_idx * fmt_desc->pixel_size,
+ fmt_desc->pixel_size);
+
+ img += fmt_desc->pixel_size;
+ }
+
+ indices += (num_of_texels + 1) / 2;
+ } else {
+ for (i = 0; i < num_of_texels; ++i) {
+ memcpy(img,
+ data + indices[i] * fmt_desc->pixel_size,
+ fmt_desc->pixel_size);
+ img += fmt_desc->pixel_size;
+ }
+
+ indices += num_of_texels;
+ }
+
+ yagl_host_glTexImage2DData(GL_TEXTURE_2D,
+ cur_level,
+ fmt_desc->uncomp_format,
+ width, height,
+ 0,
+ fmt_desc->uncomp_format,
+ fmt_desc->pixel_type,
+ tex_img_data,
+ num_of_texels * fmt_desc->pixel_size);
+
+ width >>= 1;
+ if (width == 0) {
+ width = 1;
+ }
+
+ height >>= 1;
+ if (height == 0) {
+ height = 1;
+ }
+
+ num_of_texels = width * height;
+ }
+
+ yagl_free(tex_img_data);
+
+ yagl_gles_set_unpack(&ctx->unpack);
+
+ yagl_gles_texture_set_internalformat(texture,
+ fmt_desc->uncomp_format,
+ fmt_desc->pixel_type,
+ yagl_gles_context_convert_textures(ctx));
+}
+
+static void yagl_gles1_etc1_rgb8_uncomp_and_apply(struct yagl_gles_context *ctx,
+ struct yagl_gles_texture *texture,
+ GLint level,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ const GLvoid *data)
+{
+ GLsizei wblocks = (width + 3) / 4;
+ GLsizei hblocks = (height + 3) / 4;
+ uint8_t *buff;
+
+ YAGL_LOG_FUNC_SET(glCompressedTexImage2D);
+
+ if (imageSize != (wblocks * hblocks * 8)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ return;
+ }
+
+ if (!data) {
+ yagl_host_glTexImage2DData(GL_TEXTURE_2D,
+ level,
+ GL_RGBA8,
+ width,
+ height,
+ border,
+ GL_RGBA,
+ GL_UNSIGNED_BYTE,
+ NULL,
+ width * height * 4);
+
+ yagl_gles_texture_set_internalformat(texture,
+ GL_RGBA8,
+ GL_UNSIGNED_BYTE,
+ yagl_gles_context_convert_textures(ctx));
+
+ return;
+ }
+
+ buff = yagl_get_tmp_buffer(width * height * 4);
+
+ yagl_texcompress_etc1_unpack_rgba8888(buff,
+ (width * 4),
+ data,
+ (wblocks * 8),
+ width,
+ height);
+
+ yagl_gles_reset_unpack(&ctx->unpack);
+
+ yagl_host_glTexImage2DData(GL_TEXTURE_2D,
+ level,
+ GL_RGBA8,
+ width,
+ height,
+ border,
+ GL_RGBA,
+ GL_UNSIGNED_BYTE,
+ buff,
+ width * height * 4);
+
+ yagl_gles_set_unpack(&ctx->unpack);
+
+ yagl_gles_texture_set_internalformat(texture,
+ GL_RGBA8,
+ GL_UNSIGNED_BYTE,
+ yagl_gles_context_convert_textures(ctx));
+}
+
+static void yagl_gles1_context_compressed_tex_image_2d(struct yagl_gles_context *ctx,
+ GLenum target,
+ struct yagl_gles_texture *texture,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ const GLvoid *data)
+{
+ const int max_tex_size = ((struct yagl_gles1_context*)ctx)->max_tex_size;
+ YaglGles1PalFmtDesc fmt_desc;
+
+ YAGL_LOG_FUNC_SET(glCompressedTexImage2D);
+
+ if (target != GL_TEXTURE_2D) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ return;
+ }
+
+ switch (internalformat) {
+ case GL_PALETTE4_RGB8_OES ... GL_PALETTE8_RGB5_A1_OES:
+ yagl_gles1_cpal_format_get_descr(internalformat, &fmt_desc);
+
+ if ((level > 0) || (-level > yagl_log2(max_tex_size)) ||
+ !yagl_gles1_tex_dims_valid(width, height, max_tex_size) ||
+ border != 0 || (imageSize !=
+ yagl_gles1_cpal_tex_size(&fmt_desc, width, height, -level))) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ return;
+ }
+
+ yagl_gles1_cpal_tex_uncomp_and_apply(ctx,
+ texture,
+ &fmt_desc,
+ -level,
+ width,
+ height,
+ data);
+ break;
+ case GL_ETC1_RGB8_OES:
+ yagl_gles1_etc1_rgb8_uncomp_and_apply(ctx, texture, level, width, height,
+ border, imageSize, data);
+ break;
+ default:
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ return;
+ }
+}
+
+static void yagl_gles1_context_compressed_tex_sub_image_2d(struct yagl_gles_context *ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ const GLvoid *data)
+{
+ YAGL_LOG_FUNC_SET(glCompressedTexSubImage2D);
+
+ /* No formats are supported by this call in GLES1 API */
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+}
+
+static int yagl_gles1_context_enable(struct yagl_gles_context *ctx,
+ GLenum cap,
+ GLboolean enable)
+{
+ struct yagl_gles1_context *gles1_ctx = (struct yagl_gles1_context*)ctx;
+
+ switch (cap) {
+ case GL_TEXTURE_2D:
+ yagl_gles_context_active_texture_set_enabled(ctx,
+ yagl_gles_texture_target_2d, enable);
+ break;
+ case GL_ALPHA_TEST:
+ case GL_COLOR_LOGIC_OP:
+ case GL_COLOR_MATERIAL:
+ case GL_FOG:
+ case GL_LIGHTING:
+ case GL_LINE_SMOOTH:
+ case GL_MULTISAMPLE:
+ case GL_NORMALIZE:
+ case GL_POINT_SMOOTH:
+ case GL_POINT_SPRITE_OES:
+ case GL_RESCALE_NORMAL:
+ case GL_SAMPLE_ALPHA_TO_ONE:
+ break;
+ default:
+ if ((cap >= GL_CLIP_PLANE0 &&
+ cap <= (GL_CLIP_PLANE0 + gles1_ctx->max_clip_planes - 1)) ||
+ (cap >= GL_LIGHT0 &&
+ cap <= (GL_LIGHT0 + gles1_ctx->max_lights - 1))) {
+ break;
+ }
+ return 0;
+ }
+
+ if (enable) {
+ yagl_host_glEnable(cap);
+ } else {
+ yagl_host_glDisable(cap);
+ }
+
+ return 1;
+}
+
+static int yagl_gles1_context_is_enabled(struct yagl_gles_context *ctx,
+ GLenum cap,
+ GLboolean *enabled)
+{
+ struct yagl_gles1_context *gles1_ctx = (struct yagl_gles1_context*)ctx;
+ struct yagl_gles_texture_target_state *tts;
+
+ switch (cap) {
+ case GL_TEXTURE_2D:
+ tts = yagl_gles_context_get_active_texture_target_state(ctx,
+ yagl_gles_texture_target_2d);
+ *enabled = tts->enabled;
+ return 1;
+ case GL_VERTEX_ARRAY:
+ case GL_NORMAL_ARRAY:
+ case GL_COLOR_ARRAY:
+ case GL_TEXTURE_COORD_ARRAY:
+ case GL_POINT_SIZE_ARRAY_OES:
+ *enabled = ctx->vao->arrays[yagl_gles1_array_idx_from_pname(gles1_ctx, cap)].enabled;
+ return 1;
+ case GL_ALPHA_TEST:
+ case GL_COLOR_LOGIC_OP:
+ case GL_COLOR_MATERIAL:
+ case GL_FOG:
+ case GL_LIGHTING:
+ case GL_LINE_SMOOTH:
+ case GL_MULTISAMPLE:
+ case GL_NORMALIZE:
+ case GL_POINT_SMOOTH:
+ case GL_RESCALE_NORMAL:
+ case GL_SAMPLE_ALPHA_TO_ONE:
+ case GL_POINT_SPRITE_OES:
+ break;
+ default:
+ if ((cap >= GL_CLIP_PLANE0 &&
+ cap <= (GL_CLIP_PLANE0 + gles1_ctx->max_clip_planes - 1)) ||
+ (cap >= GL_LIGHT0 &&
+ cap <= (GL_LIGHT0 + gles1_ctx->max_lights - 1))) {
+ break;
+ }
+ return 0;
+ }
+
+ *enabled = yagl_host_glIsEnabled(cap);
+
+ return 1;
+}
+
+static int yagl_gles1_context_get_integerv(struct yagl_gles_context *ctx,
+ GLenum pname,
+ GLint *params,
+ uint32_t *num_params)
+{
+ int processed = 1;
+ struct yagl_gles1_context *gles1_ctx = (struct yagl_gles1_context*)ctx;
+
+ switch (pname) {
+ case GL_COMPRESSED_TEXTURE_FORMATS:
+ yagl_gles1_compressed_texture_formats_fill(params);
+ *num_params = YAGL_GLES1_NUM_COMP_TEX_FORMATS;
+ break;
+ case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
+ *params = YAGL_GLES1_NUM_COMP_TEX_FORMATS;
+ *num_params = 1;
+ break;
+ case GL_MAX_CLIP_PLANES:
+ *params = gles1_ctx->max_clip_planes;
+ *num_params = 1;
+ break;
+ case GL_MAX_LIGHTS:
+ *params = gles1_ctx->max_lights;
+ *num_params = 1;
+ break;
+ case GL_MAX_TEXTURE_SIZE:
+ *params = gles1_ctx->max_tex_size;
+ *num_params = 1;
+ break;
+ case GL_VERTEX_ARRAY:
+ case GL_NORMAL_ARRAY:
+ case GL_COLOR_ARRAY:
+ case GL_TEXTURE_COORD_ARRAY:
+ case GL_POINT_SIZE_ARRAY_OES:
+ *params = ctx->vao->arrays[yagl_gles1_array_idx_from_pname(gles1_ctx, pname)].enabled;
+ *num_params = 1;
+ break;
+ case GL_VERTEX_ARRAY_BUFFER_BINDING:
+ case GL_COLOR_ARRAY_BUFFER_BINDING:
+ case GL_NORMAL_ARRAY_BUFFER_BINDING:
+ case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING:
+ case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES:
+ *params = ctx->vao->arrays[yagl_gles1_array_idx_from_pname(gles1_ctx, pname)].vbo ?
+ ctx->vao->arrays[yagl_gles1_array_idx_from_pname(gles1_ctx, pname)].vbo->base.local_name
+ : 0;
+ *num_params = 1;
+ break;
+ case GL_VERTEX_ARRAY_STRIDE:
+ case GL_COLOR_ARRAY_STRIDE:
+ case GL_NORMAL_ARRAY_STRIDE:
+ case GL_TEXTURE_COORD_ARRAY_STRIDE:
+ case GL_POINT_SIZE_ARRAY_STRIDE_OES:
+ *params = ctx->vao->arrays[yagl_gles1_array_idx_from_pname(gles1_ctx, pname)].stride;
+ *num_params = 1;
+ break;
+ case GL_VERTEX_ARRAY_TYPE:
+ case GL_COLOR_ARRAY_TYPE:
+ case GL_NORMAL_ARRAY_TYPE:
+ case GL_TEXTURE_COORD_ARRAY_TYPE:
+ case GL_POINT_SIZE_ARRAY_TYPE_OES:
+ *params = ctx->vao->arrays[yagl_gles1_array_idx_from_pname(gles1_ctx, pname)].type;
+ *num_params = 1;
+ break;
+ case GL_VERTEX_ARRAY_SIZE:
+ case GL_COLOR_ARRAY_SIZE:
+ case GL_TEXTURE_COORD_ARRAY_SIZE:
+ *params = ctx->vao->arrays[yagl_gles1_array_idx_from_pname(gles1_ctx, pname)].size;
+ *num_params = 1;
+ break;
+ default:
+ processed = 0;
+ break;
+ }
+
+ if (processed) {
+ return 1;
+ }
+
+ switch (pname) {
+ case GL_ALPHA_TEST:
+ *num_params = 1;
+ break;
+ case GL_ALPHA_TEST_FUNC:
+ *num_params = 1;
+ break;
+ case GL_BLEND_DST:
+ *num_params = 1;
+ break;
+ case GL_BLEND_SRC:
+ *num_params = 1;
+ break;
+ case GL_CLIENT_ACTIVE_TEXTURE:
+ *num_params = 1;
+ break;
+ case GL_COLOR_LOGIC_OP:
+ *num_params = 1;
+ break;
+ case GL_COLOR_MATERIAL:
+ *num_params = 1;
+ break;
+ case GL_FOG:
+ *num_params = 1;
+ break;
+ case GL_FOG_HINT:
+ *num_params = 1;
+ break;
+ case GL_FOG_MODE:
+ *num_params = 1;
+ break;
+ case GL_LIGHTING:
+ *num_params = 1;
+ break;
+ case GL_LIGHT_MODEL_TWO_SIDE:
+ *num_params = 1;
+ break;
+ case GL_LINE_SMOOTH:
+ *num_params = 1;
+ break;
+ case GL_LINE_SMOOTH_HINT:
+ *num_params = 1;
+ break;
+ case GL_LOGIC_OP_MODE:
+ *num_params = 1;
+ break;
+ case GL_MATRIX_MODE:
+ *num_params = 1;
+ break;
+ case GL_MAX_MODELVIEW_STACK_DEPTH:
+ *num_params = 1;
+ break;
+ case GL_MAX_PROJECTION_STACK_DEPTH:
+ *num_params = 1;
+ break;
+ case GL_MAX_TEXTURE_STACK_DEPTH:
+ *num_params = 1;
+ break;
+ case GL_MAX_TEXTURE_UNITS:
+ *num_params = 1;
+ break;
+ case GL_MODELVIEW_STACK_DEPTH:
+ *num_params = 1;
+ break;
+ case GL_MULTISAMPLE:
+ *num_params = 1;
+ break;
+ case GL_NORMALIZE:
+ *num_params = 1;
+ break;
+ case GL_PERSPECTIVE_CORRECTION_HINT:
+ *num_params = 1;
+ break;
+ case GL_POINT_SMOOTH:
+ *num_params = 1;
+ break;
+ case GL_POINT_SMOOTH_HINT:
+ *num_params = 1;
+ break;
+ case GL_POINT_SPRITE_OES:
+ *num_params = 1;
+ break;
+ case GL_PROJECTION_STACK_DEPTH:
+ *num_params = 1;
+ break;
+ case GL_RESCALE_NORMAL:
+ *num_params = 1;
+ break;
+ case GL_SAMPLE_ALPHA_TO_ONE:
+ *num_params = 1;
+ break;
+ case GL_SHADE_MODEL:
+ *num_params = 1;
+ break;
+ case GL_TEXTURE_2D:
+ *num_params = 1;
+ break;
+ case GL_TEXTURE_STACK_DEPTH:
+ *num_params = 1;
+ break;
+ /* GL_OES_matrix_palette */
+ case GL_MAX_PALETTE_MATRICES_OES:
+ case GL_MAX_VERTEX_UNITS_OES:
+ case GL_CURRENT_PALETTE_MATRIX_OES:
+ case GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES:
+ case GL_MATRIX_INDEX_ARRAY_SIZE_OES:
+ case GL_MATRIX_INDEX_ARRAY_STRIDE_OES:
+ case GL_MATRIX_INDEX_ARRAY_TYPE_OES:
+ case GL_WEIGHT_ARRAY_BUFFER_BINDING_OES:
+ case GL_WEIGHT_ARRAY_SIZE_OES:
+ case GL_WEIGHT_ARRAY_STRIDE_OES:
+ case GL_WEIGHT_ARRAY_TYPE_OES:
+ if (!gles1_ctx->matrix_palette) {
+ return 0;
+ }
+ *num_params = 1;
+ break;
+ default:
+ if ((pname >= GL_CLIP_PLANE0 &&
+ pname <= (GL_CLIP_PLANE0 + gles1_ctx->max_clip_planes - 1)) ||
+ (pname >= GL_LIGHT0 &&
+ pname <= (GL_LIGHT0 + gles1_ctx->max_lights - 1))) {
+ *num_params = 1;
+ break;
+ }
+ return 0;
+ }
+
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+
+ return 1;
+}
+
+static int yagl_gles1_context_get_floatv(struct yagl_gles_context *ctx,
+ GLenum pname,
+ GLfloat *params,
+ uint32_t *num_params,
+ int *needs_map)
+{
+ switch (pname) {
+ case GL_ALPHA_TEST_REF:
+ *num_params = 1;
+ *needs_map = 1;
+ break;
+ case GL_CURRENT_COLOR:
+ *num_params = 4;
+ *needs_map = 1;
+ break;
+ case GL_CURRENT_NORMAL:
+ *num_params = 3;
+ *needs_map = 1;
+ break;
+ case GL_CURRENT_TEXTURE_COORDS:
+ *num_params = 4;
+ break;
+ case GL_FOG_COLOR:
+ *num_params = 4;
+ *needs_map = 1;
+ break;
+ case GL_FOG_DENSITY:
+ *num_params = 1;
+ break;
+ case GL_FOG_END:
+ *num_params = 1;
+ break;
+ case GL_FOG_START:
+ *num_params = 1;
+ break;
+ case GL_LIGHT_MODEL_AMBIENT:
+ *num_params = 4;
+ *needs_map = 1;
+ break;
+ case GL_MODELVIEW_MATRIX:
+ *num_params = 16;
+ break;
+ case GL_POINT_DISTANCE_ATTENUATION:
+ *num_params = 3;
+ break;
+ case GL_POINT_FADE_THRESHOLD_SIZE:
+ *num_params = 1;
+ break;
+ case GL_POINT_SIZE:
+ *num_params = 1;
+ break;
+ case GL_POINT_SIZE_MAX:
+ *num_params = 1;
+ break;
+ case GL_POINT_SIZE_MIN:
+ *num_params = 1;
+ break;
+ case GL_PROJECTION_MATRIX:
+ *num_params = 16;
+ break;
+ case GL_SMOOTH_LINE_WIDTH_RANGE:
+ *num_params = 2;
+ break;
+ case GL_SMOOTH_POINT_SIZE_RANGE:
+ *num_params = 2;
+ break;
+ case GL_TEXTURE_MATRIX:
+ *num_params = 16;
+ break;
+ default:
+ return 0;
+ }
+
+ yagl_host_glGetFloatv(pname, params, *num_params, NULL);
+
+ return 1;
+}
+
+static __inline GLfloat yagl_gles1_pointsize_to_float(struct yagl_gles_array *array,
+ const void *psize)
+{
+ switch (array->type) {
+ case GL_FIXED:
+ return yagl_fixed_to_float(*(GLfixed*)psize);
+ break;
+ case GL_FLOAT:
+ return *(GLfloat*)psize;
+ break;
+ default:
+ fprintf(stderr, "Critical error! Bad pointsize type!\n");
+ exit(1);
+ }
+}
+
+static void yagl_gles1_draw_arrays_psize(struct yagl_gles_context *ctx,
+ GLint first,
+ GLsizei count)
+{
+ struct yagl_gles_array *parray = &ctx->vao->arrays[yagl_gles1_array_pointsize];
+ unsigned i = 0;
+ unsigned stride = parray->stride;
+ GLsizei points_cnt;
+ GLint arr_offset;
+ const void *next_psize_p;
+ GLfloat cur_psize;
+
+ if (parray->vbo) {
+ next_psize_p = parray->vbo->data + parray->offset + first * stride;
+ } else {
+ next_psize_p = parray->ptr + first * stride;
+ }
+
+ while (i < count) {
+ points_cnt = 0;
+ arr_offset = i;
+ cur_psize = yagl_gles1_pointsize_to_float(parray, next_psize_p);
+
+ do {
+ ++points_cnt;
+ ++i;
+ next_psize_p += stride;
+ } while ((i < count) && (cur_psize == yagl_gles1_pointsize_to_float(parray, next_psize_p)));
+
+ yagl_host_glPointSize(cur_psize);
+
+ yagl_host_glDrawArrays(GL_POINTS, first + arr_offset, points_cnt);
+ }
+}
+
+static inline const void *yagl_get_next_psize_p(struct yagl_gles_buffer *ebo,
+ struct yagl_gles_array *parray,
+ GLenum type,
+ unsigned idx,
+ const GLvoid *indices,
+ int32_t indices_count)
+{
+ unsigned idx_val;
+
+ if (ebo) {
+ if (type == GL_UNSIGNED_SHORT) {
+ idx_val = ((uint16_t *)(ebo->data + indices_count))[idx];
+ } else {
+ idx_val = ((uint8_t *)(ebo->data + indices_count))[idx];
+ }
+ } else {
+ if (type == GL_UNSIGNED_SHORT) {
+ idx_val = ((uint16_t *)indices)[idx];
+ } else {
+ idx_val = ((uint8_t *)indices)[idx];
+ }
+ }
+
+ if (parray->vbo) {
+ return parray->vbo->data + parray->offset + idx_val * parray->stride;
+ } else {
+ return parray->ptr + idx_val * parray->stride;
+ }
+}
+
+static void yagl_gles1_draw_elem_psize(struct yagl_gles_context *ctx,
+ GLsizei count,
+ GLenum type,
+ const GLvoid *indices,
+ int32_t indices_count)
+{
+ struct yagl_gles_array *parray = &ctx->vao->arrays[yagl_gles1_array_pointsize];
+ unsigned i = 0, el_size;
+ GLsizei points_cnt;
+ GLint arr_offset;
+ GLfloat cur_psize;
+ const void *next_psize_p;
+
+ switch (type) {
+ case GL_UNSIGNED_BYTE:
+ el_size = 1;
+ break;
+ case GL_UNSIGNED_SHORT:
+ el_size = 2;
+ break;
+ default:
+ el_size = 0;
+ break;
+ }
+
+ assert(el_size > 0);
+
+ next_psize_p = yagl_get_next_psize_p(ctx->vao->ebo, parray, type, i, indices, indices_count);
+
+ while (i < count) {
+ points_cnt = 0;
+ arr_offset = i;
+ cur_psize = yagl_gles1_pointsize_to_float(parray, next_psize_p);
+
+ do {
+ ++points_cnt;
+ ++i;
+ next_psize_p = yagl_get_next_psize_p(ctx->vao->ebo,
+ parray,
+ type,
+ i,
+ indices,
+ indices_count);
+ } while ((i < count) && (cur_psize == yagl_gles1_pointsize_to_float(parray, next_psize_p)));
+
+ yagl_host_glPointSize(cur_psize);
+
+ if (ctx->vao->ebo) {
+ yagl_host_glDrawElements(GL_POINTS,
+ points_cnt,
+ type,
+ NULL,
+ indices_count + arr_offset * el_size);
+ } else {
+ yagl_host_glDrawElements(GL_POINTS,
+ points_cnt,
+ type,
+ indices + arr_offset * el_size,
+ points_cnt * el_size);
+ }
+ }
+}
+
+static void yagl_gles1_context_draw_arrays(struct yagl_gles_context *ctx,
+ GLenum mode,
+ GLint first,
+ GLsizei count,
+ GLsizei primcount)
+{
+ assert(primcount < 0);
+
+ if (!ctx->vao->arrays[yagl_gles1_array_vertex].enabled) {
+ return;
+ }
+
+ if ((mode == GL_POINTS) && ctx->vao->arrays[yagl_gles1_array_pointsize].enabled) {
+ yagl_gles1_draw_arrays_psize(ctx, first, count);
+ } else {
+ yagl_host_glDrawArrays(mode, first, count);
+ }
+}
+
+static void yagl_gles1_context_draw_elements(struct yagl_gles_context *ctx,
+ GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const GLvoid *indices,
+ int32_t indices_count,
+ GLsizei primcount,
+ uint32_t max_idx)
+{
+ assert(primcount < 0);
+
+ if (!ctx->vao->arrays[yagl_gles1_array_vertex].enabled) {
+ return;
+ }
+
+ if ((mode == GL_POINTS) && ctx->vao->arrays[yagl_gles1_array_pointsize].enabled) {
+ yagl_gles1_draw_elem_psize(ctx, count, type, indices, indices_count);
+ } else {
+ yagl_host_glDrawElements(mode, count, type, indices, indices_count);
+ }
+}
+
+static int yagl_gles1_context_bind_buffer(struct yagl_gles_context *ctx,
+ GLenum target,
+ struct yagl_gles_buffer *buffer)
+{
+ return 0;
+}
+
+static void yagl_gles1_context_unbind_buffer(struct yagl_gles_context *ctx,
+ yagl_object_name buffer_local_name)
+{
+}
+
+static int yagl_gles1_context_acquire_binded_buffer(struct yagl_gles_context *ctx,
+ GLenum target,
+ struct yagl_gles_buffer **buffer)
+{
+ return 0;
+}
+
+static int yagl_gles1_context_validate_texture_target(struct yagl_gles_context *ctx,
+ GLenum target,
+ yagl_gles_texture_target *texture_target)
+{
+ return 0;
+}
+
+static struct yagl_pixel_format
+ *yagl_gles1_context_validate_teximage_format(struct yagl_gles_context *ctx,
+ GLenum internalformat,
+ GLenum format,
+ GLenum type)
+{
+ return NULL;
+}
+
+static struct yagl_pixel_format
+ *yagl_gles1_context_validate_getteximage_format(struct yagl_gles_context *ctx,
+ GLenum readbuffer_internalformat,
+ GLenum format,
+ GLenum type)
+{
+ return NULL;
+}
+
+static int yagl_gles1_context_validate_copyteximage_format(struct yagl_gles_context *ctx,
+ GLenum readbuffer_internalformat,
+ GLenum *internalformat)
+{
+ return 0;
+}
+
+static int yagl_gles1_context_validate_texstorage_format(struct yagl_gles_context *ctx,
+ GLenum *internalformat,
+ GLenum *base_internalformat,
+ GLenum *any_format,
+ GLenum *any_type)
+{
+ YaglGles1PalFmtDesc fmt_desc;
+
+ switch (*internalformat) {
+ case GL_PALETTE4_RGB8_OES ... GL_PALETTE8_RGB5_A1_OES:
+ yagl_gles1_cpal_format_get_descr(*internalformat, &fmt_desc);
+ *internalformat = fmt_desc.uncomp_format;
+ *base_internalformat = fmt_desc.uncomp_format;
+ *any_format = fmt_desc.uncomp_format;
+ *any_type = fmt_desc.pixel_type;
+ break;
+ default:
+ return 0;
+ }
+
+ return 1;
+}
+
+static int yagl_gles1_context_validate_renderbuffer_format(struct yagl_gles_context *ctx,
+ GLenum *internalformat)
+{
+ return 0;
+}
+
+static void yagl_gles1_context_hint(struct yagl_gles_context *ctx,
+ GLenum target,
+ GLenum mode)
+{
+}
+
+struct yagl_client_context *yagl_gles1_context_create(struct yagl_sharegroup *sg)
+{
+ struct yagl_gles1_context *gles1_ctx;
+
+ YAGL_LOG_FUNC_ENTER(yagl_gles1_context_create, NULL);
+
+ gles1_ctx = yagl_malloc0(sizeof(*gles1_ctx));
+
+ yagl_gles_context_init(&gles1_ctx->base, yagl_client_api_gles1, sg);
+
+ gles1_ctx->sg = sg;
+
+ gles1_ctx->base.base.prepare = &yagl_gles1_context_prepare;
+ gles1_ctx->base.base.destroy = &yagl_gles1_context_destroy;
+ gles1_ctx->base.create_arrays = &yagl_gles1_context_create_arrays;
+ gles1_ctx->base.get_string = &yagl_gles1_context_get_string;
+ gles1_ctx->base.compressed_tex_image_2d = &yagl_gles1_context_compressed_tex_image_2d;
+ gles1_ctx->base.compressed_tex_sub_image_2d = &yagl_gles1_context_compressed_tex_sub_image_2d;
+ gles1_ctx->base.enable = &yagl_gles1_context_enable;
+ gles1_ctx->base.is_enabled = &yagl_gles1_context_is_enabled;
+ gles1_ctx->base.get_integerv = &yagl_gles1_context_get_integerv;
+ gles1_ctx->base.get_floatv = &yagl_gles1_context_get_floatv;
+ gles1_ctx->base.draw_arrays = &yagl_gles1_context_draw_arrays;
+ gles1_ctx->base.draw_elements = &yagl_gles1_context_draw_elements;
+ gles1_ctx->base.bind_buffer = &yagl_gles1_context_bind_buffer;
+ gles1_ctx->base.unbind_buffer = &yagl_gles1_context_unbind_buffer;
+ gles1_ctx->base.acquire_binded_buffer = &yagl_gles1_context_acquire_binded_buffer;
+ gles1_ctx->base.validate_texture_target = &yagl_gles1_context_validate_texture_target;
+ gles1_ctx->base.validate_teximage_format = &yagl_gles1_context_validate_teximage_format;
+ gles1_ctx->base.validate_getteximage_format = &yagl_gles1_context_validate_getteximage_format;
+ gles1_ctx->base.validate_copyteximage_format = &yagl_gles1_context_validate_copyteximage_format;
+ gles1_ctx->base.validate_texstorage_format = &yagl_gles1_context_validate_texstorage_format;
+ gles1_ctx->base.validate_renderbuffer_format = &yagl_gles1_context_validate_renderbuffer_format;
+ gles1_ctx->base.hint = &yagl_gles1_context_hint;
+
+ YAGL_LOG_FUNC_EXIT("%p", gles1_ctx);
+
+ return &gles1_ctx->base.base;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES1_CONTEXT_H_
+#define _YAGL_GLES1_CONTEXT_H_
+
+#include "yagl_gles_context.h"
+
+/*
+ * GLES1 has arrays of vertices, normals, colors, texture coordinates and
+ * point sizes. Every texture unit has its own texture coordinates array.
+ */
+typedef enum
+{
+ yagl_gles1_array_vertex = 0,
+ yagl_gles1_array_color,
+ yagl_gles1_array_normal,
+ yagl_gles1_array_pointsize,
+ yagl_gles1_array_texcoord,
+} yagl_gles1_array_type;
+
+struct yagl_gles1_context
+{
+ struct yagl_gles_context base;
+
+ /*
+ * From 'base.base.sg'.
+ */
+ struct yagl_sharegroup *sg;
+
+ /* GL_OES_matrix_palette */
+ int matrix_palette;
+
+ int client_active_texture;
+
+ int max_clip_planes;
+
+ int max_lights;
+
+ int max_tex_size;
+};
+
+struct yagl_client_context *yagl_gles1_context_create(struct yagl_sharegroup *sg);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GLES/gl.h"
+#include "yagl_export.h"
+#include "yagl_client_interface.h"
+#include "yagl_gles1_context.h"
+#include "yagl_gles_image.h"
+#include "yagl_gles_texture.h"
+
+static struct yagl_client_context *yagl_gles1_create_ctx(struct yagl_client_interface *iface,
+ yagl_client_api client_api,
+ struct yagl_sharegroup *sg)
+{
+ return yagl_gles1_context_create(sg);
+}
+
+static struct yagl_client_image
+ *yagl_gles1_create_image(struct yagl_client_interface *iface,
+ yagl_object_name tex_global_name)
+{
+ return &yagl_gles_image_create(tex_global_name)->base;
+}
+
+static void yagl_gles1_release_tex_image(struct yagl_client_interface *iface,
+ void *cookie)
+{
+ struct yagl_gles_texture *texture = cookie;
+
+ yagl_gles_texture_release_tex_image(texture);
+}
+
+YAGL_API struct yagl_client_interface yagl_gles1_interface =
+{
+ .create_ctx = &yagl_gles1_create_ctx,
+ .create_image = &yagl_gles1_create_image,
+ .release_tex_image = &yagl_gles1_release_tex_image
+};
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GLES/gl.h"
+#include "yagl_gles1_validate.h"
+
+int yagl_gles1_get_texenv_param_count(GLenum type, int *count)
+{
+ switch (type) {
+ case GL_TEXTURE_ENV_COLOR:
+ *count = 4;
+ break;
+ case GL_TEXTURE_ENV_MODE:
+ case GL_COMBINE_RGB:
+ case GL_COMBINE_ALPHA:
+ case GL_SRC0_RGB:
+ case GL_SRC1_RGB:
+ case GL_SRC2_RGB:
+ case GL_SRC0_ALPHA:
+ case GL_SRC1_ALPHA:
+ case GL_SRC2_ALPHA:
+ case GL_OPERAND0_RGB:
+ case GL_OPERAND1_RGB:
+ case GL_OPERAND2_RGB:
+ case GL_OPERAND0_ALPHA:
+ case GL_OPERAND1_ALPHA:
+ case GL_OPERAND2_ALPHA:
+ case GL_RGB_SCALE:
+ case GL_ALPHA_SCALE:
+ case GL_COORD_REPLACE_OES:
+ *count = 1;
+ break;
+ default:
+ return 0;
+ }
+ return 1;
+}
+
+int yagl_gles1_get_point_param_count(GLenum pname, int *count)
+{
+ switch (pname) {
+ case GL_POINT_DISTANCE_ATTENUATION:
+ *count = 3;
+ break;
+ case GL_POINT_SIZE_MIN:
+ case GL_POINT_SIZE_MAX:
+ case GL_POINT_FADE_THRESHOLD_SIZE:
+ *count = 1;
+ break;
+ default:
+ return 0;
+ }
+ return 1;
+}
+
+int yagl_gles1_get_fog_param_count(GLenum pname, int *count)
+{
+ switch (pname) {
+ case GL_FOG_COLOR:
+ *count = 4;
+ break;
+ case GL_FOG_MODE:
+ case GL_FOG_DENSITY:
+ case GL_FOG_START:
+ case GL_FOG_END:
+ *count = 1;
+ break;
+ default:
+ return 0;
+ }
+ return 1;
+}
+
+int yagl_gles1_get_light_param_count(GLenum pname, int *count)
+{
+ switch (pname) {
+ case GL_AMBIENT:
+ case GL_DIFFUSE:
+ case GL_SPECULAR:
+ case GL_POSITION:
+ *count = 4;
+ break;
+ case GL_SPOT_DIRECTION:
+ *count = 3;
+ break;
+ case GL_SPOT_EXPONENT:
+ case GL_SPOT_CUTOFF:
+ case GL_CONSTANT_ATTENUATION:
+ case GL_LINEAR_ATTENUATION:
+ case GL_QUADRATIC_ATTENUATION:
+ *count = 1;
+ break;
+ default:
+ return 0;
+ }
+ return 1;
+}
+
+int yagl_gles1_get_light_model_param_count(GLenum pname, int *count)
+{
+ switch (pname) {
+ case GL_LIGHT_MODEL_AMBIENT:
+ *count = 4;
+ break;
+ case GL_LIGHT_MODEL_TWO_SIDE:
+ *count = 1;
+ break;
+ default:
+ return 0;
+ }
+ return 1;
+}
+
+int yagl_gles1_get_material_param_count(GLenum pname, int *count)
+{
+ switch (pname) {
+ case GL_AMBIENT:
+ case GL_DIFFUSE:
+ case GL_SPECULAR:
+ case GL_EMISSION:
+ case GL_AMBIENT_AND_DIFFUSE:
+ *count = 4;
+ break;
+ case GL_SHININESS:
+ *count = 1;
+ break;
+ default:
+ return 0;
+ }
+ return 1;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES1_VALIDATE_H_
+#define _YAGL_GLES1_VALIDATE_H_
+
+#include "yagl_types.h"
+
+int yagl_gles1_get_texenv_param_count(GLenum type, int *count);
+
+int yagl_gles1_get_point_param_count(GLenum pname, int *count);
+
+int yagl_gles1_get_fog_param_count(GLenum pname, int *count);
+
+int yagl_gles1_get_light_param_count(GLenum pname, int *count);
+
+int yagl_gles1_get_light_model_param_count(GLenum pname, int *count);
+
+int yagl_gles1_get_material_param_count(GLenum pname, int *count);
+
+#endif
--- /dev/null
+set(SOURCES
+ yagl_glsl_lexer.l
+ yagl_glsl_parser.y
+ yagl_glsl_state.c
+ yagl_gles2_context.c
+ yagl_gles2_interface.c
+ yagl_gles2_program.c
+ yagl_gles2_shader.c
+ yagl_gles2_validate.c
+ yagl_gles2_calls.c
+ yagl_gles2_utils.c
+ yagl_texcompress.c
+ yagl_texcompress_etc2.c
+ yagl_gles3_context.c
+ yagl_gles3_calls.c
+ yagl_gles3_buffer_binding.c
+ yagl_gles3_program.c
+ yagl_gles3_validate.c
+ yagl_gles3_transform_feedback.c
+ yagl_gles3_query.c
+ yagl_gles3_sync.c
+ yagl_gles3_pixel_formats.c
+)
+
+include_directories(${YAGL_SOURCE_DIR}/GLES_common)
+include_directories(.)
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+link_directories(${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
+
+flex_target(GLESv2 ${CMAKE_CURRENT_SOURCE_DIR}/yagl_glsl_lexer.l ${CMAKE_CURRENT_BINARY_DIR}/yagl_glsl_lexer.c)
+bison_target(GLESv2 ${CMAKE_CURRENT_SOURCE_DIR}/yagl_glsl_parser.y ${CMAKE_CURRENT_BINARY_DIR}/yagl_glsl_parser.c)
+
+add_library(GLESv2 SHARED ${SOURCES} ${FLEX_GLESv2_OUTPUTS} ${BISON_GLESv2_OUTPUTS})
+set_target_properties(GLESv2 PROPERTIES VERSION 2.0 SOVERSION 2)
+
+target_link_libraries(GLESv2 "-Wl,-whole-archive" GLES_common "-Wl,-no-whole-archive")
+
+install(
+ TARGETS GLESv2
+ LIBRARY DESTINATION ${INSTALL_LIB_DIR}
+)
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GLES2/gl2.h"
+#include "GLES2/gl2ext.h"
+#include "yagl_host_gles_calls.h"
+#include "yagl_gles2_program.h"
+#include "yagl_gles2_shader.h"
+#include "yagl_gles2_validate.h"
+#include "yagl_gles2_context.h"
+#include "yagl_gles_validate.h"
+#include "yagl_gles_vertex_array.h"
+#include "yagl_gles_array.h"
+#include "yagl_gles_buffer.h"
+#include "yagl_gles_texture_unit.h"
+#include "yagl_gles_texture.h"
+#include "yagl_impl.h"
+#include "yagl_malloc.h"
+#include "yagl_sharegroup.h"
+#include "yagl_transport.h"
+#include "yagl_utils.h"
+#include "yagl_pixel_format.h"
+#include "yagl_glsl_state.h"
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+
+/*
+ * We can't include GL/gl.h here
+ */
+#define GL_INT_2_10_10_10_REV 0x8D9F
+#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
+
+#define YAGL_SET_ERR(err) \
+ yagl_gles_context_set_error(&ctx->base, err); \
+ YAGL_LOG_ERROR("error = 0x%X", err)
+
+#define YAGL_GET_CTX_IMPL(ret_expr) \
+ struct yagl_gles2_context *ctx = \
+ (struct yagl_gles2_context*)yagl_get_client_context(); \
+ if (!ctx || ((ctx->base.base.client_api & (yagl_client_api_gles2|yagl_client_api_gles3)) == 0)) { \
+ YAGL_LOG_WARN("no current context"); \
+ YAGL_LOG_FUNC_EXIT(NULL); \
+ ret_expr; \
+ }
+
+#define YAGL_GET_CTX_RET(ret) YAGL_GET_CTX_IMPL(return ret)
+
+#define YAGL_GET_CTX() YAGL_GET_CTX_IMPL(return)
+
+YAGL_API void glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
+{
+ int tmp = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glStencilFuncSeparate, GLenum, GLenum, GLint, GLuint, face, func, ref, mask);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles_is_stencil_func_valid(func)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if ((face == GL_FRONT) || (face == GL_FRONT_AND_BACK)) {
+ ctx->base.stencil_front.func = func;
+ ctx->base.stencil_front.ref = ref;
+ ctx->base.stencil_front.mask = mask;
+
+ tmp = 1;
+ }
+
+ if ((face == GL_BACK) || (face == GL_FRONT_AND_BACK)) {
+ ctx->base.stencil_back.func = func;
+ ctx->base.stencil_back.ref = ref;
+ ctx->base.stencil_back.mask = mask;
+
+ tmp = 1;
+ }
+
+ if (tmp) {
+ yagl_host_glStencilFuncSeparate(face, func, ref, mask);
+ } else {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glStencilMaskSeparate(GLenum face, GLuint mask)
+{
+ int tmp = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glStencilMaskSeparate, GLenum, GLuint, face, mask);
+
+ YAGL_GET_CTX();
+
+ if ((face == GL_FRONT) || (face == GL_FRONT_AND_BACK)) {
+ ctx->base.stencil_front.writemask = mask;
+
+ tmp = 1;
+ }
+
+ if ((face == GL_BACK) || (face == GL_FRONT_AND_BACK)) {
+ ctx->base.stencil_back.writemask = mask;
+
+ tmp = 1;
+ }
+
+ if (tmp) {
+ yagl_host_glStencilMaskSeparate(face, mask);
+ } else {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
+{
+ int tmp = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glStencilOpSeparate, GLenum, GLenum, GLenum, GLenum, face, fail, zfail, zpass);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles_is_stencil_op_valid(fail) ||
+ !yagl_gles_is_stencil_op_valid(zfail) ||
+ !yagl_gles_is_stencil_op_valid(zpass)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if ((face == GL_FRONT) || (face == GL_FRONT_AND_BACK)) {
+ ctx->base.stencil_front.fail = fail;
+ ctx->base.stencil_front.zfail = zfail;
+ ctx->base.stencil_front.zpass = zpass;
+
+ tmp = 1;
+ }
+
+ if ((face == GL_BACK) || (face == GL_FRONT_AND_BACK)) {
+ ctx->base.stencil_back.fail = fail;
+ ctx->base.stencil_back.zfail = zfail;
+ ctx->base.stencil_back.zpass = zpass;
+
+ tmp = 1;
+ }
+
+ if (tmp) {
+ yagl_host_glStencilOpSeparate(face, fail, zfail, zpass);
+ } else {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glAttachShader(GLuint program, GLuint shader)
+{
+ struct yagl_gles2_program *program_obj = NULL;
+ struct yagl_gles2_shader *shader_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glAttachShader, GLuint, GLuint, program, shader);
+
+ YAGL_GET_CTX();
+
+ program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg,
+ YAGL_NS_SHADER_PROGRAM, program);
+
+ if (!program_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (program_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ shader_obj = (struct yagl_gles2_shader*)yagl_sharegroup_acquire_object(ctx->sg,
+ YAGL_NS_SHADER_PROGRAM, shader);
+
+ if (!shader_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (!shader_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles2_program_attach_shader(program_obj, shader_obj)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ yagl_gles2_shader_release(shader_obj);
+ yagl_gles2_program_release(program_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glBindAttribLocation(GLuint program, GLuint index, const GLchar *name)
+{
+ struct yagl_gles2_program *program_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glBindAttribLocation, GLuint, GLuint, const GLchar*, program, index, name);
+
+ YAGL_GET_CTX();
+
+ program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg,
+ YAGL_NS_SHADER_PROGRAM, program);
+
+ if (!program_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (program_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (index >= ctx->base.num_arrays) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (name) {
+ if (strncmp(name, "gl_", 3) == 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ YAGL_LOG_TRACE("binding attrib %s location to %d", name, index);
+ }
+
+ yagl_host_glBindAttribLocation(program_obj->global_name,
+ index,
+ name,
+ yagl_transport_string_count(name));
+
+out:
+ yagl_gles2_program_release(program_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glBlendColor(GLclampf red,
+ GLclampf green,
+ GLclampf blue,
+ GLclampf alpha)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glBlendColor, GLclampf, GLclampf, GLclampf, GLclampf, red, green, blue, alpha);
+
+ YAGL_GET_CTX();
+
+ ctx->blend_color[0] = yagl_clampf(red);
+ ctx->blend_color[1] = yagl_clampf(green);
+ ctx->blend_color[2] = yagl_clampf(blue);
+ ctx->blend_color[3] = yagl_clampf(alpha);
+
+ yagl_host_glBlendColor(red, green, blue, alpha);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glCompileShader(GLuint shader)
+{
+ struct yagl_gles2_shader *shader_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glCompileShader, GLuint, shader);
+
+ YAGL_GET_CTX();
+
+ shader_obj = (struct yagl_gles2_shader*)yagl_sharegroup_acquire_object(ctx->sg,
+ YAGL_NS_SHADER_PROGRAM, shader);
+
+ if (!shader_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (!shader_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ yagl_host_glCompileShader(shader_obj->global_name);
+
+out:
+ yagl_gles2_shader_release(shader_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API GLuint glCreateProgram(void)
+{
+ GLuint res = 0;
+ struct yagl_gles2_program *program = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT0(glCreateProgram);
+
+ YAGL_GET_CTX_RET(0);
+
+ program = yagl_gles2_program_create(ctx->gen_locations);
+
+ if (!program) {
+ goto out;
+ }
+
+ yagl_sharegroup_add(ctx->sg, YAGL_NS_SHADER_PROGRAM, &program->base);
+ res = program->base.local_name;
+
+out:
+ yagl_gles2_program_release(program);
+
+ YAGL_LOG_FUNC_EXIT_SPLIT(GLuint, res);
+
+ return res;
+}
+
+YAGL_API GLuint glCreateShader(GLenum type)
+{
+ GLuint res = 0;
+ struct yagl_gles2_shader *shader = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glCreateShader, GLenum, type);
+
+ YAGL_GET_CTX_RET(0);
+
+ if (yagl_gles2_is_shader_type_valid(type)) {
+ shader = yagl_gles2_shader_create(type);
+
+ if (!shader) {
+ goto out;
+ }
+
+ yagl_sharegroup_add(ctx->sg, YAGL_NS_SHADER_PROGRAM, &shader->base);
+ res = shader->base.local_name;
+ } else {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+
+out:
+ yagl_gles2_shader_release(shader);
+
+ YAGL_LOG_FUNC_EXIT_SPLIT(GLuint, res);
+
+ return res;
+}
+
+YAGL_API void glDeleteProgram(GLuint program)
+{
+ struct yagl_gles2_program *program_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glDeleteProgram, GLuint, program);
+
+ YAGL_GET_CTX();
+
+ if (program == 0) {
+ goto out;
+ }
+
+ program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg,
+ YAGL_NS_SHADER_PROGRAM, program);
+
+ if (!program_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (program_obj->is_shader) {
+ goto out;
+ }
+
+ yagl_gles2_context_unuse_program(ctx, program_obj);
+
+ yagl_sharegroup_remove(ctx->sg,
+ YAGL_NS_SHADER_PROGRAM,
+ program);
+
+out:
+ yagl_gles2_program_release(program_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glDeleteShader(GLuint shader)
+{
+ struct yagl_gles2_shader *shader_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glDeleteShader, GLuint, shader);
+
+ YAGL_GET_CTX();
+
+ if (shader == 0) {
+ goto out;
+ }
+
+ shader_obj = (struct yagl_gles2_shader*)yagl_sharegroup_acquire_object(ctx->sg,
+ YAGL_NS_SHADER_PROGRAM, shader);
+
+ if (!shader_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (!shader_obj->is_shader) {
+ goto out;
+ }
+
+ yagl_sharegroup_remove(ctx->sg,
+ YAGL_NS_SHADER_PROGRAM,
+ shader);
+
+out:
+ yagl_gles2_shader_release(shader_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glDetachShader(GLuint program, GLuint shader)
+{
+ struct yagl_gles2_program *program_obj = NULL;
+ struct yagl_gles2_shader *shader_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glDetachShader, GLuint, GLuint, program, shader);
+
+ YAGL_GET_CTX();
+
+ program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg,
+ YAGL_NS_SHADER_PROGRAM, program);
+
+ if (!program_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (program_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (program_obj->vertex_shader &&
+ (program_obj->vertex_shader->base.local_name == shader)) {
+ shader_obj = program_obj->vertex_shader;
+ yagl_gles2_shader_acquire(shader_obj);
+ } else if (program_obj->fragment_shader &&
+ (program_obj->fragment_shader->base.local_name == shader)) {
+ shader_obj = program_obj->fragment_shader;
+ yagl_gles2_shader_acquire(shader_obj);
+ } else {
+ shader_obj = (struct yagl_gles2_shader*)yagl_sharegroup_acquire_object(ctx->sg,
+ YAGL_NS_SHADER_PROGRAM, shader);
+
+ if (shader_obj) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ } else {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ }
+
+ goto out;
+ }
+
+ yagl_gles2_program_detach_shader(program_obj, shader_obj);
+
+out:
+ yagl_gles2_shader_release(shader_obj);
+ yagl_gles2_program_release(program_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glEnableVertexAttribArray(GLuint index)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glEnableVertexAttribArray, GLuint, index);
+
+ YAGL_GET_CTX();
+
+ if (index < ctx->base.num_arrays) {
+ yagl_gles_array_enable(&ctx->base.vao->arrays[index], 1);
+ }
+
+ yagl_host_glEnableVertexAttribArray(index);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glDisableVertexAttribArray(GLuint index)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glDisableVertexAttribArray, GLuint, index);
+
+ YAGL_GET_CTX();
+
+ if (index < ctx->base.num_arrays) {
+ yagl_gles_array_enable(&ctx->base.vao->arrays[index], 0);
+ }
+
+ yagl_host_glDisableVertexAttribArray(index);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
+{
+ struct yagl_gles2_program *program_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT7(glGetActiveAttrib, GLuint, GLuint, GLsizei, GLsizei*, GLint*, GLenum*, GLchar*, program, index, bufsize, length, size, type, name);
+
+ YAGL_GET_CTX();
+
+ program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg,
+ YAGL_NS_SHADER_PROGRAM, program);
+
+ if (!program_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (program_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (bufsize < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (index >= program_obj->num_active_attribs) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ yagl_gles2_program_get_active_attrib(program_obj, index, bufsize, length, size, type, name);
+
+out:
+ yagl_gles2_program_release(program_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
+{
+ struct yagl_gles2_program *program_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT7(glGetActiveUniform, GLuint, GLuint, GLsizei, GLsizei*, GLint*, GLenum*, GLchar*, program, index, bufsize, length, size, type, name);
+
+ YAGL_GET_CTX();
+
+ program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg,
+ YAGL_NS_SHADER_PROGRAM, program);
+
+ if (!program_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (program_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (bufsize < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (index >= program_obj->num_active_uniforms) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ yagl_gles2_program_get_active_uniform(program_obj, index, bufsize, length, size, type, name);
+
+out:
+ yagl_gles2_program_release(program_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders)
+{
+ struct yagl_gles2_program *program_obj = NULL;
+ GLsizei tmp = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glGetAttachedShaders, GLuint, GLsizei, GLsizei*, GLuint*, program, maxcount, count, shaders);
+
+ YAGL_GET_CTX();
+
+ program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg,
+ YAGL_NS_SHADER_PROGRAM, program);
+
+ if (!program_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (program_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (maxcount < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ tmp = 0;
+
+ if (program_obj->vertex_shader) {
+ if (tmp < maxcount) {
+ if (shaders) {
+ shaders[tmp] = program_obj->vertex_shader->base.local_name;
+ }
+ ++tmp;
+ }
+ }
+
+ if (program_obj->fragment_shader) {
+ if (tmp < maxcount) {
+ if (shaders) {
+ shaders[tmp] = program_obj->fragment_shader->base.local_name;
+ }
+ ++tmp;
+ }
+ }
+
+ if (count) {
+ *count = tmp;
+ }
+
+out:
+ yagl_gles2_program_release(program_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API int glGetAttribLocation(GLuint program, const GLchar *name)
+{
+ struct yagl_gles2_program *program_obj = NULL;
+ int ret = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glGetAttribLocation, GLuint, const GLchar*, program, name);
+
+ YAGL_GET_CTX_RET(0);
+
+ program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg,
+ YAGL_NS_SHADER_PROGRAM, program);
+
+ if (!program_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (program_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!program_obj->linked) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ ret = yagl_gles2_program_get_attrib_location(program_obj, name);
+
+out:
+ yagl_gles2_program_release(program_obj);
+
+ YAGL_LOG_FUNC_EXIT_SPLIT(int, ret);
+
+ return ret;
+}
+
+YAGL_API void glGetProgramiv(GLuint program, GLenum pname, GLint *params)
+{
+ struct yagl_gles2_program *program_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetProgramiv, GLuint, GLenum, GLint*, program, pname, params);
+
+ YAGL_GET_CTX();
+
+ program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg,
+ YAGL_NS_SHADER_PROGRAM, program);
+
+ if (!program_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (program_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!ctx->get_programiv(ctx, program_obj, pname, params)) {
+ switch (pname) {
+ case GL_VALIDATE_STATUS:
+ yagl_host_glGetProgramiv(program_obj->global_name, pname, params);
+ break;
+ default:
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+ }
+
+out:
+ yagl_gles2_program_release(program_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei *length, GLchar *infolog)
+{
+ struct yagl_gles2_program *program_obj = NULL;
+ int32_t tmp = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glGetProgramInfoLog, GLuint, GLsizei, GLsizei*, GLchar*, program, bufsize, length, infolog);
+
+ YAGL_GET_CTX();
+
+ program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg,
+ YAGL_NS_SHADER_PROGRAM, program);
+
+ if (!program_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (program_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (bufsize < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (yagl_host_glGetProgramInfoLog(program_obj->global_name, infolog, bufsize, &tmp)) {
+ if (length) {
+ *length = (tmp > 0) ? (tmp - 1) : 0;
+ }
+ YAGL_LOG_TRACE("infolog = %s", infolog);
+ }
+
+out:
+ yagl_gles2_program_release(program_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetShaderiv(GLuint shader, GLenum pname, GLint *params)
+{
+ struct yagl_gles2_shader *shader_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetShaderiv, GLuint, GLenum, GLint*, shader, pname, params);
+
+ YAGL_GET_CTX();
+
+ shader_obj = (struct yagl_gles2_shader*)yagl_sharegroup_acquire_object(ctx->sg,
+ YAGL_NS_SHADER_PROGRAM, shader);
+
+ if (!shader_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (!shader_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ switch (pname) {
+ case GL_SHADER_TYPE:
+ *params = shader_obj->type;
+ break;
+ case GL_SHADER_SOURCE_LENGTH:
+ *params = shader_obj->source ? (strlen(shader_obj->source) + 1) : 0;
+ break;
+ case GL_INFO_LOG_LENGTH:
+ case GL_DELETE_STATUS:
+ case GL_COMPILE_STATUS:
+ yagl_host_glGetShaderiv(shader_obj->global_name, pname, params);
+ break;
+ default:
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ break;
+ }
+
+out:
+ yagl_gles2_shader_release(shader_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *infolog)
+{
+ int32_t tmp = 0;
+ struct yagl_gles2_shader *shader_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glGetShaderInfoLog, GLuint, GLsizei, GLsizei*, GLchar*, shader, bufsize, length, infolog);
+
+ YAGL_GET_CTX();
+
+ shader_obj = (struct yagl_gles2_shader*)yagl_sharegroup_acquire_object(ctx->sg,
+ YAGL_NS_SHADER_PROGRAM, shader);
+
+ if (!shader_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (!shader_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (bufsize < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (yagl_host_glGetShaderInfoLog(shader_obj->global_name, infolog, bufsize, &tmp)) {
+ if (length) {
+ *length = (tmp > 0) ? (tmp - 1) : 0;
+ }
+ YAGL_LOG_TRACE("infolog = %s", infolog);
+ }
+
+out:
+ yagl_gles2_shader_release(shader_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glGetShaderPrecisionFormat, GLenum, GLenum, GLint*, GLint*, shadertype, precisiontype, range, precision);
+
+ YAGL_GET_CTX();
+
+ switch (precisiontype) {
+ case GL_LOW_INT:
+ case GL_MEDIUM_INT:
+ case GL_HIGH_INT:
+ if (range) {
+ range[0] = range[1] = 16;
+ }
+ if (precision) {
+ *precision = 0;
+ }
+ break;
+ case GL_LOW_FLOAT:
+ case GL_MEDIUM_FLOAT:
+ case GL_HIGH_FLOAT:
+ if (range) {
+ range[0] = range[1] = 127;
+ }
+ if (precision) {
+ *precision = 24;
+ }
+ break;
+ default:
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ break;
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source)
+{
+ struct yagl_gles2_shader *shader_obj = NULL;
+ GLsizei tmp;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glGetShaderSource, GLuint, GLsizei, GLsizei*, GLchar*, shader, bufsize, length, source);
+
+ YAGL_GET_CTX();
+
+ shader_obj = (struct yagl_gles2_shader*)yagl_sharegroup_acquire_object(ctx->sg,
+ YAGL_NS_SHADER_PROGRAM, shader);
+
+ if (!shader_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (!shader_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (bufsize < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (!shader_obj->source) {
+ if (length) {
+ *length = 0;
+ }
+ goto out;
+ }
+
+ tmp = strlen(shader_obj->source) + 1;
+ tmp = (bufsize <= tmp) ? bufsize : tmp;
+
+ if (source && (tmp > 0)) {
+ strncpy(source, shader_obj->source, tmp);
+ source[tmp - 1] = '\0';
+ }
+
+ if (tmp > 0) {
+ --tmp;
+ }
+
+ if (length) {
+ *length = tmp;
+ }
+
+out:
+ yagl_gles2_shader_release(shader_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetUniformfv(GLuint program, GLint location, GLfloat *params)
+{
+ struct yagl_gles2_program *program_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetUniformfv, GLuint, GLint, GLfloat*, program, location, params);
+
+ YAGL_GET_CTX();
+
+ program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg,
+ YAGL_NS_SHADER_PROGRAM, program);
+
+ if (!program_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (program_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!program_obj->linked) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles2_program_get_uniformfv(program_obj, location, params)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ yagl_gles2_program_release(program_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetUniformiv(GLuint program, GLint location, GLint *params)
+{
+ struct yagl_gles2_program *program_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetUniformiv, GLuint, GLint, GLint*, program, location, params);
+
+ YAGL_GET_CTX();
+
+ program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg,
+ YAGL_NS_SHADER_PROGRAM, program);
+
+ if (!program_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (program_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!program_obj->linked) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles2_program_get_uniformiv(program_obj, location, params)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ yagl_gles2_program_release(program_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API int glGetUniformLocation(GLuint program, const GLchar *name)
+{
+ struct yagl_gles2_program *program_obj = NULL;
+ int ret = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glGetUniformLocation, GLuint, const GLchar*, program, name);
+
+ YAGL_GET_CTX_RET(0);
+
+ program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg,
+ YAGL_NS_SHADER_PROGRAM, program);
+
+ if (!program_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (program_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!program_obj->linked) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (name) {
+ YAGL_LOG_TRACE("getting uniform %s location", name);
+ }
+
+ ret = yagl_gles2_program_get_uniform_location(program_obj, name);
+
+out:
+ yagl_gles2_program_release(program_obj);
+
+ YAGL_LOG_FUNC_EXIT_SPLIT(int, ret);
+
+ return ret;
+}
+
+YAGL_API void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params)
+{
+ GLint param = 0;
+ GLfloat tmp[100]; // This fits all cases.
+ int32_t num = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetVertexAttribfv, GLuint, GLenum, GLfloat*, index, pname, params);
+
+ YAGL_GET_CTX();
+
+ if ((index == 0) &&
+ (pname == GL_CURRENT_VERTEX_ATTRIB)) {
+ if (params) {
+ switch (ctx->vertex_attrib0.type) {
+ case GL_INT:
+ params[0] = ctx->vertex_attrib0.value.i[0];
+ params[1] = ctx->vertex_attrib0.value.i[1];
+ params[2] = ctx->vertex_attrib0.value.i[2];
+ params[3] = ctx->vertex_attrib0.value.i[3];
+ break;
+ case GL_UNSIGNED_INT:
+ params[0] = ctx->vertex_attrib0.value.ui[0];
+ params[1] = ctx->vertex_attrib0.value.ui[1];
+ params[2] = ctx->vertex_attrib0.value.ui[2];
+ params[3] = ctx->vertex_attrib0.value.ui[3];
+ break;
+ default:
+ assert(0);
+ case GL_FLOAT:
+ params[0] = ctx->vertex_attrib0.value.f[0];
+ params[1] = ctx->vertex_attrib0.value.f[1];
+ params[2] = ctx->vertex_attrib0.value.f[2];
+ params[3] = ctx->vertex_attrib0.value.f[3];
+ break;
+ }
+ }
+
+ goto out;
+ }
+
+ if (yagl_gles2_context_get_array_param(ctx,
+ index,
+ pname,
+ ¶m)) {
+ if (params) {
+ params[0] = param;
+ }
+ } else {
+ yagl_host_glGetVertexAttribfv(index, pname, tmp, sizeof(tmp)/sizeof(tmp[0]), &num);
+ if (params) {
+ memcpy(params, tmp, num * sizeof(tmp[0]));
+ }
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params)
+{
+ GLint tmp[100]; // This fits all cases.
+ int32_t num = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetVertexAttribiv, GLuint, GLenum, GLint*, index, pname, params);
+
+ YAGL_GET_CTX();
+
+ if ((index == 0) &&
+ (pname == GL_CURRENT_VERTEX_ATTRIB)) {
+ if (params) {
+ switch (ctx->vertex_attrib0.type) {
+ case GL_INT:
+ params[0] = ctx->vertex_attrib0.value.i[0];
+ params[1] = ctx->vertex_attrib0.value.i[1];
+ params[2] = ctx->vertex_attrib0.value.i[2];
+ params[3] = ctx->vertex_attrib0.value.i[3];
+ break;
+ case GL_UNSIGNED_INT:
+ params[0] = ctx->vertex_attrib0.value.ui[0];
+ params[1] = ctx->vertex_attrib0.value.ui[1];
+ params[2] = ctx->vertex_attrib0.value.ui[2];
+ params[3] = ctx->vertex_attrib0.value.ui[3];
+ break;
+ default:
+ assert(0);
+ case GL_FLOAT:
+ params[0] = ctx->vertex_attrib0.value.f[0];
+ params[1] = ctx->vertex_attrib0.value.f[1];
+ params[2] = ctx->vertex_attrib0.value.f[2];
+ params[3] = ctx->vertex_attrib0.value.f[3];
+ break;
+ }
+ }
+
+ goto out;
+ }
+
+ if (yagl_gles2_context_get_array_param(ctx,
+ index,
+ pname,
+ params)) {
+ } else {
+ yagl_host_glGetVertexAttribiv(index, pname, tmp, sizeof(tmp)/sizeof(tmp[0]), &num);
+ if (params) {
+ memcpy(params, tmp, num * sizeof(tmp[0]));
+ }
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid **pointer)
+{
+ struct yagl_gles_array *array = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetVertexAttribPointerv, GLuint, GLenum, GLvoid**, index, pname, pointer);
+
+ YAGL_GET_CTX();
+
+ if (index >= ctx->base.num_arrays) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ array = &ctx->base.vao->arrays[index];
+
+ if (pointer) {
+ if (array->vbo) {
+ *pointer = (GLvoid*)array->offset;
+ } else {
+ *pointer = (GLvoid*)array->ptr;
+ }
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API GLboolean glIsProgram(GLuint program)
+{
+ GLboolean res = GL_FALSE;
+ struct yagl_gles2_program *program_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glIsProgram, GLuint, program);
+
+ YAGL_GET_CTX_RET(GL_FALSE);
+
+ program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg,
+ YAGL_NS_SHADER_PROGRAM, program);
+
+ if (program_obj) {
+ res = program_obj->is_shader ? GL_FALSE : GL_TRUE;
+ }
+
+ yagl_gles2_program_release(program_obj);
+
+ YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, res);
+
+ return res;
+}
+
+YAGL_API GLboolean glIsShader(GLuint shader)
+{
+ GLboolean res = GL_FALSE;
+ struct yagl_gles2_shader *shader_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glIsShader, GLuint, shader);
+
+ YAGL_GET_CTX_RET(GL_FALSE);
+
+ shader_obj = (struct yagl_gles2_shader*)yagl_sharegroup_acquire_object(ctx->sg,
+ YAGL_NS_SHADER_PROGRAM, shader);
+
+ if (shader_obj) {
+ res = shader_obj->is_shader ? GL_TRUE : GL_FALSE;
+ }
+
+ yagl_gles2_shader_release(shader_obj);
+
+ YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, res);
+
+ return res;
+}
+
+YAGL_API void glLinkProgram(GLuint program)
+{
+ struct yagl_gles2_program *program_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glLinkProgram, GLuint, program);
+
+ YAGL_GET_CTX();
+
+ program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg,
+ YAGL_NS_SHADER_PROGRAM, program);
+
+ if (!program_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (program_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!ctx->pre_link_program(ctx, program_obj)) {
+ goto out;
+ }
+
+ yagl_gles2_program_link(program_obj);
+
+out:
+ yagl_gles2_program_release(program_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glReleaseShaderCompiler(void)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT0(glReleaseShaderCompiler);
+
+ YAGL_GET_CTX();
+
+ /*
+ * No-op.
+ */
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glShaderBinary(GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glShaderBinary, GLsizei, const GLuint*, GLenum, const GLvoid*, GLsizei, n, shaders, binaryformat, binary, length);
+
+ YAGL_GET_CTX();
+
+ /*
+ * No-op.
+ */
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glShaderSource(GLuint shader, GLsizei count, const GLchar * const *string, const GLint *length)
+{
+ struct yagl_gles2_shader *shader_obj = NULL;
+ int have_strings = 0;
+ uint32_t total_length = 0;
+ int i;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glShaderSource, GLuint, GLsizei, const GLchar**, const GLint*, shader, count, string, length);
+
+ YAGL_GET_CTX();
+
+ if (count < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ shader_obj = (struct yagl_gles2_shader*)yagl_sharegroup_acquire_object(ctx->sg,
+ YAGL_NS_SHADER_PROGRAM, shader);
+
+ if (!shader_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (!shader_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (string) {
+ for (i = 0; i < count; ++i) {
+ if (string[i]) {
+ if (length && (length[i] >= 0)) {
+ total_length += length[i];
+ have_strings = 1;
+ } else {
+ total_length += strlen(string[i]);
+ have_strings = 1;
+ }
+ }
+ }
+ }
+
+ if (have_strings) {
+ uint8_t *tmp_buff;
+ struct yagl_glsl_state glsl_state;
+ int ret;
+ int patched_len = 0;
+ char *patched_source;
+
+ tmp_buff = yagl_malloc(total_length + 1);
+ tmp_buff[0] = '\0';
+
+ for (i = 0; i < count; ++i) {
+ if (string[i]) {
+ if (length && (length[i] >= 0)) {
+ strncat((char*)tmp_buff, string[i], length[i]);
+ } else {
+ strcat((char*)tmp_buff, string[i]);
+ }
+ }
+ }
+
+ tmp_buff[total_length] = '\0';
+
+ YAGL_LOG_TRACE("orig source = %s", tmp_buff);
+
+ yagl_glsl_state_init(&glsl_state,
+ shader_obj->type,
+ (char*)tmp_buff,
+ total_length,
+ (ctx->base.base.client_api == yagl_client_api_gles3));
+
+ ret = yagl_glsl_parse(&glsl_state);
+
+ if ((ret == 0) && !glsl_state.have_error) {
+ patched_source = yagl_glsl_state_get_output(&glsl_state,
+ &patched_len);
+
+ YAGL_LOG_TRACE("patched source = %s", patched_source);
+
+ yagl_gles2_shader_source(shader_obj,
+ (GLchar*)tmp_buff,
+ patched_source,
+ patched_len);
+
+ yagl_free(patched_source);
+ } else {
+ /*
+ * Unable to parse source, pass as-is.
+ */
+ yagl_gles2_shader_source(shader_obj,
+ (GLchar*)tmp_buff,
+ (GLchar*)tmp_buff,
+ total_length);
+ }
+
+ yagl_glsl_state_cleanup(&glsl_state);
+ }
+
+out:
+ yagl_gles2_shader_release(shader_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniform1f(GLint location, GLfloat x)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glUniform1f, GLint, GLfloat, location, x);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles2_program_uniform1f(ctx->program, location, x)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniform1fv(GLint location, GLsizei count, const GLfloat* v)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform1fv, GLint, GLsizei, const GLfloat*, location, count, v);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (count < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles2_program_uniform1fv(ctx->program, location, count, v)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniform1i(GLint location, GLint x)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glUniform1i, GLint, GLint, location, x);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles2_program_uniform1i(ctx->program, location, x)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniform1iv(GLint location, GLsizei count, const GLint* v)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform1iv, GLint, GLsizei, const GLint*, location, count, v);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (count < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles2_program_uniform1iv(ctx->program, location, count, v)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniform2f(GLint location, GLfloat x, GLfloat y)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform2f, GLint, GLfloat, GLfloat, location, x, y);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles2_program_uniform2f(ctx->program, location, x, y)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniform2fv(GLint location, GLsizei count, const GLfloat* v)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform2fv, GLint, GLsizei, const GLfloat*, location, count, v);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (count < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles2_program_uniform2fv(ctx->program, location, count, v)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniform2i(GLint location, GLint x, GLint y)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform2i, GLint, GLint, GLint, location, x, y);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles2_program_uniform2i(ctx->program, location, x, y)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniform2iv(GLint location, GLsizei count, const GLint* v)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform2iv, GLint, GLsizei, const GLint*, location, count, v);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (count < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles2_program_uniform2iv(ctx->program, location, count, v)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glUniform3f, GLint, GLfloat, GLfloat, GLfloat, location, x, y, z);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles2_program_uniform3f(ctx->program, location, x, y, z)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniform3fv(GLint location, GLsizei count, const GLfloat* v)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform3fv, GLint, GLsizei, const GLfloat*, location, count, v);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (count < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles2_program_uniform3fv(ctx->program, location, count, v)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniform3i(GLint location, GLint x, GLint y, GLint z)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glUniform3i, GLint, GLint, GLint, GLint, location, x, y, z);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles2_program_uniform3i(ctx->program, location, x, y, z)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniform3iv(GLint location, GLsizei count, const GLint* v)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform3iv, GLint, GLsizei, const GLint*, location, count, v);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (count < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles2_program_uniform3iv(ctx->program, location, count, v)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glUniform4f, GLint, GLfloat, GLfloat, GLfloat, GLfloat, location, x, y, z, w);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles2_program_uniform4f(ctx->program, location, x, y, z, w)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniform4fv(GLint location, GLsizei count, const GLfloat* v)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform4fv, GLint, GLsizei, const GLfloat*, location, count, v);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (count < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles2_program_uniform4fv(ctx->program, location, count, v)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glUniform4i, GLint, GLint, GLint, GLint, GLint, location, x, y, z, w);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles2_program_uniform4i(ctx->program, location, x, y, z, w)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniform4iv(GLint location, GLsizei count, const GLint* v)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform4iv, GLint, GLsizei, const GLint*, location, count, v);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (count < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles2_program_uniform4iv(ctx->program, location, count, v)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glUniformMatrix2fv, GLint, GLsizei, GLboolean, const GLfloat*, location, count, transpose, value);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (count < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles2_program_uniform_matrix2fv(ctx->program, location, count, transpose, value)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glUniformMatrix3fv, GLint, GLsizei, GLboolean, const GLfloat*, location, count, transpose, value);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (count < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles2_program_uniform_matrix3fv(ctx->program, location, count, transpose, value)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glUniformMatrix4fv, GLint, GLsizei, GLboolean, const GLfloat*, location, count, transpose, value);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (count < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles2_program_uniform_matrix4fv(ctx->program, location, count, transpose, value)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUseProgram(GLuint program)
+{
+ struct yagl_gles2_program *program_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glUseProgram, GLuint, program);
+
+ YAGL_GET_CTX();
+
+ if (program != 0) {
+ program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg,
+ YAGL_NS_SHADER_PROGRAM, program);
+
+ if (!program_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (program_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+ }
+
+ if (!ctx->pre_use_program(ctx, program_obj)) {
+ goto out;
+ }
+
+ yagl_gles2_context_use_program(ctx, program_obj);
+
+out:
+ yagl_gles2_program_release(program_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glValidateProgram(GLuint program)
+{
+ struct yagl_gles2_program *program_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glValidateProgram, GLuint, program);
+
+ YAGL_GET_CTX();
+
+ program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg,
+ YAGL_NS_SHADER_PROGRAM, program);
+
+ if (!program_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (program_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ yagl_host_glValidateProgram(program_obj->global_name);
+
+out:
+ yagl_gles2_program_release(program_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glVertexAttrib1f(GLuint indx, GLfloat x)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glVertexAttrib1f, GLuint, GLfloat, indx, x);
+
+ YAGL_GET_CTX();
+
+ if (indx == 0) {
+ ctx->vertex_attrib0.value.f[0] = x;
+ ctx->vertex_attrib0.value.f[1] = 0.0f;
+ ctx->vertex_attrib0.value.f[2] = 0.0f;
+ ctx->vertex_attrib0.value.f[3] = 1.0f;
+ ctx->vertex_attrib0.type = GL_FLOAT;
+ } else {
+ yagl_host_glVertexAttrib1f(indx, x);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glVertexAttrib1fv(GLuint indx, const GLfloat* values)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glVertexAttrib1fv, GLuint, const GLfloat*, indx, values);
+
+ YAGL_GET_CTX();
+
+ if (indx == 0) {
+ ctx->vertex_attrib0.value.f[0] = values[0];
+ ctx->vertex_attrib0.value.f[1] = 0.0f;
+ ctx->vertex_attrib0.value.f[2] = 0.0f;
+ ctx->vertex_attrib0.value.f[3] = 1.0f;
+ ctx->vertex_attrib0.type = GL_FLOAT;
+ } else {
+ yagl_host_glVertexAttrib1fv(indx, values, 1);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glVertexAttrib2f, GLuint, GLfloat, GLfloat, indx, x, y);
+
+ YAGL_GET_CTX();
+
+ if (indx == 0) {
+ ctx->vertex_attrib0.value.f[0] = x;
+ ctx->vertex_attrib0.value.f[1] = y;
+ ctx->vertex_attrib0.value.f[2] = 0.0f;
+ ctx->vertex_attrib0.value.f[3] = 1.0f;
+ ctx->vertex_attrib0.type = GL_FLOAT;
+ } else {
+ yagl_host_glVertexAttrib2f(indx, x, y);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glVertexAttrib2fv(GLuint indx, const GLfloat* values)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glVertexAttrib2fv, GLuint, const GLfloat*, indx, values);
+
+ YAGL_GET_CTX();
+
+ if (indx == 0) {
+ ctx->vertex_attrib0.value.f[0] = values[0];
+ ctx->vertex_attrib0.value.f[1] = values[1];
+ ctx->vertex_attrib0.value.f[2] = 0.0f;
+ ctx->vertex_attrib0.value.f[3] = 1.0f;
+ ctx->vertex_attrib0.type = GL_FLOAT;
+ } else {
+ yagl_host_glVertexAttrib2fv(indx, values, 2);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glVertexAttrib3f, GLuint, GLfloat, GLfloat, GLfloat, indx, x, y, z);
+
+ YAGL_GET_CTX();
+
+ if (indx == 0) {
+ ctx->vertex_attrib0.value.f[0] = x;
+ ctx->vertex_attrib0.value.f[1] = y;
+ ctx->vertex_attrib0.value.f[2] = z;
+ ctx->vertex_attrib0.value.f[3] = 1.0f;
+ ctx->vertex_attrib0.type = GL_FLOAT;
+ } else {
+ yagl_host_glVertexAttrib3f(indx, x, y, z);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glVertexAttrib3fv(GLuint indx, const GLfloat* values)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glVertexAttrib3fv, GLuint, const GLfloat*, indx, values);
+
+ YAGL_GET_CTX();
+
+ if (indx == 0) {
+ ctx->vertex_attrib0.value.f[0] = values[0];
+ ctx->vertex_attrib0.value.f[1] = values[1];
+ ctx->vertex_attrib0.value.f[2] = values[2];
+ ctx->vertex_attrib0.value.f[3] = 1.0f;
+ ctx->vertex_attrib0.type = GL_FLOAT;
+ } else {
+ yagl_host_glVertexAttrib3fv(indx, values, 3);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glVertexAttrib4f, GLuint, GLfloat, GLfloat, GLfloat, GLfloat, indx, x, y, z, w);
+
+ YAGL_GET_CTX();
+
+ if (indx == 0) {
+ ctx->vertex_attrib0.value.f[0] = x;
+ ctx->vertex_attrib0.value.f[1] = y;
+ ctx->vertex_attrib0.value.f[2] = z;
+ ctx->vertex_attrib0.value.f[3] = w;
+ ctx->vertex_attrib0.type = GL_FLOAT;
+ } else {
+ yagl_host_glVertexAttrib4f(indx, x, y, z, w);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glVertexAttrib4fv(GLuint indx, const GLfloat* values)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glVertexAttrib4fv, GLuint, const GLfloat*, indx, values);
+
+ YAGL_GET_CTX();
+
+ if (indx == 0) {
+ ctx->vertex_attrib0.value.f[0] = values[0];
+ ctx->vertex_attrib0.value.f[1] = values[1];
+ ctx->vertex_attrib0.value.f[2] = values[2];
+ ctx->vertex_attrib0.value.f[3] = values[3];
+ ctx->vertex_attrib0.type = GL_FLOAT;
+ } else {
+ yagl_host_glVertexAttrib4fv(indx, values, 4);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr)
+{
+ struct yagl_gles_array *array;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT6(glVertexAttribPointer, GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid*, indx, size, type, normalized, stride, ptr);
+
+ YAGL_GET_CTX();
+
+ if (indx >= ctx->base.num_arrays) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if ((stride < 0) || (size < 1) || (size > 4)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if ((type == GL_INT_2_10_10_10_REV) ||
+ (type == GL_UNSIGNED_INT_2_10_10_10_REV)) {
+ if (ctx->base.base.client_api == yagl_client_api_gles2) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ } else if (size != 4) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+ }
+
+ array = &ctx->base.vao->arrays[indx];
+
+ if (ctx->base.vbo) {
+ if (!yagl_gles_array_update_vbo(array,
+ size,
+ type,
+ 0,
+ normalized,
+ stride,
+ ctx->base.vbo,
+ (GLint)ptr,
+ 0)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+ } else {
+ /*
+ * GL_OES_vertex_array_object:
+ * "Binding a zero-named vertex array buffer:
+ * this can be detected by *Pointer(ES1) or VertexAttribPointer(ES2);
+ * if the pointer argument is not NULL:
+ * this means to bind a client vertex array;
+ * an INVALID_OPERATION error will be returned."
+ */
+ if ((ctx->base.vao != ctx->base.va_zero) && ptr) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles_array_update(array,
+ size,
+ type,
+ 0,
+ normalized,
+ stride,
+ ptr,
+ 0)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+/*
+ * GL_EXT_instanced_arrays.
+ * @{
+ */
+
+YAGL_API void glDrawArraysInstanced(GLenum mode, GLint start, GLsizei count,
+ GLsizei primcount)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glDrawArraysInstanced, GLenum, GLint, GLsizei, GLsizei, mode, start, count, primcount);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->instanced_arrays) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (primcount < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ yagl_gles_context_draw_arrays(&ctx->base, mode, start, count, primcount);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+YAGL_API YAGL_ALIAS(glDrawArraysInstanced, glDrawArraysInstancedEXT);
+
+YAGL_API void glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type,
+ const void *indices, GLsizei primcount)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glDrawElementsInstanced, GLenum, GLsizei, GLenum, const void*, GLsizei, mode, count, type, indices, primcount);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->instanced_arrays) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (primcount < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ yagl_gles_context_draw_elements(&ctx->base, mode, count, type, indices, primcount);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+YAGL_API YAGL_ALIAS(glDrawElementsInstanced, glDrawElementsInstancedEXT);
+
+YAGL_API void glVertexAttribDivisor(GLuint index, GLuint divisor)
+{
+ struct yagl_gles_array *array;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glVertexAttribDivisor, GLuint, GLuint, index, divisor);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->instanced_arrays) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (index >= ctx->base.num_arrays) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ array = &ctx->base.vao->arrays[index];
+
+ yagl_gles_array_set_divisor(array, divisor);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+YAGL_API YAGL_ALIAS(glVertexAttribDivisor, glVertexAttribDivisorEXT);
+
+/*
+ * @}
+ */
+
+/*
+ * GL_OES_texture_3D.
+ * @{
+ */
+
+YAGL_API void glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels)
+{
+ yagl_gles_texture_target texture_target;
+ struct yagl_gles_texture_target_state *tex_target_state;
+ struct yagl_pixel_format *pf;
+ GLsizei size;
+ int using_pbo = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT10(glTexImage3D, GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const void*, target, level, internalformat, width, height, depth, border, format, type, pixels);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles_context_validate_texture_target(&ctx->base,
+ target,
+ &texture_target)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!yagl_gles2_is_texture_target_layered(target)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ tex_target_state =
+ yagl_gles_context_get_active_texture_target_state(&ctx->base,
+ texture_target);
+
+ if ((width < 0) || (height < 0) || (depth < 0)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if ((width == 0) || (height == 0) || (depth == 0)) {
+ width = height = depth = 0;
+ }
+
+ pf = yagl_gles_context_validate_teximage_format(&ctx->base,
+ internalformat,
+ format,
+ type);
+
+ if (!pf) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if ((texture_target == yagl_gles_texture_target_3d) &&
+ ((pf->src_format == GL_DEPTH_COMPONENT) ||
+ (pf->src_format == GL_DEPTH_STENCIL_OES))) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if ((width != 0) && !yagl_gles_context_pre_unpack(&ctx->base, &pixels, pf->need_convert, &using_pbo)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (pixels || using_pbo) {
+ pixels += yagl_pixel_format_get_info(pf, &ctx->base.unpack,
+ width, height, depth, &size);
+ } else {
+ yagl_pixel_format_get_info(pf, &ctx->base.unpack,
+ width, height, depth, &size);
+ }
+
+ if (using_pbo) {
+ yagl_host_glTexImage3DOffset(target,
+ level,
+ pf->dst_internalformat,
+ width,
+ height,
+ depth,
+ border,
+ pf->dst_format,
+ pf->dst_type,
+ (GLsizei)pixels);
+ } else {
+ yagl_host_glTexImage3DData(target,
+ level,
+ pf->dst_internalformat,
+ width,
+ height,
+ depth,
+ border,
+ pf->dst_format,
+ pf->dst_type,
+ yagl_pixel_format_unpack(pf,
+ &ctx->base.unpack,
+ width,
+ height,
+ depth,
+ pixels),
+ size);
+ }
+
+ if (width != 0) {
+ yagl_gles_context_post_unpack(&ctx->base, pf->need_convert);
+ }
+
+ yagl_gles_texture_set_internalformat(tex_target_state->texture,
+ internalformat,
+ type,
+ yagl_gles_context_convert_textures(&ctx->base));
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+YAGL_API YAGL_ALIAS(glTexImage3D, glTexImage3DOES);
+
+YAGL_API void glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels)
+{
+ yagl_gles_texture_target texture_target;
+ struct yagl_gles_texture_target_state *tex_target_state;
+ struct yagl_pixel_format *pf;
+ GLsizei size;
+ int using_pbo = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT11(glTexSubImage3D, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const void*, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles_context_validate_texture_target(&ctx->base,
+ target,
+ &texture_target)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!yagl_gles2_is_texture_target_layered(target)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ tex_target_state =
+ yagl_gles_context_get_active_texture_target_state(&ctx->base,
+ texture_target);
+
+ if ((width < 0) || (height < 0) || (depth < 0)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if ((width == 0) || (height == 0) || (depth == 0)) {
+ width = height = depth = 0;
+ }
+
+ pf = yagl_gles_context_validate_teximage_format(&ctx->base,
+ tex_target_state->texture->internalformat, format, type);
+
+ if (!pf) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if ((width != 0) && !yagl_gles_context_pre_unpack(&ctx->base, &pixels, pf->need_convert, &using_pbo)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ pixels += yagl_pixel_format_get_info(pf, &ctx->base.unpack,
+ width, height, depth, &size);
+
+ if (using_pbo) {
+ yagl_host_glTexSubImage3DOffset(target,
+ level,
+ xoffset,
+ yoffset,
+ zoffset,
+ width,
+ height,
+ depth,
+ pf->dst_format,
+ pf->dst_type,
+ (GLsizei)pixels);
+ } else {
+ yagl_host_glTexSubImage3DData(target,
+ level,
+ xoffset,
+ yoffset,
+ zoffset,
+ width,
+ height,
+ depth,
+ pf->dst_format,
+ pf->dst_type,
+ yagl_pixel_format_unpack(pf,
+ &ctx->base.unpack,
+ width,
+ height,
+ depth,
+ pixels),
+ size);
+ }
+
+ if (width != 0) {
+ yagl_gles_context_post_unpack(&ctx->base, pf->need_convert);
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+YAGL_API YAGL_ALIAS(glTexSubImage3D, glTexSubImage3DOES);
+
+YAGL_API void glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ yagl_gles_texture_target texture_target;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT9(glCopyTexSubImage3D, GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, target, level, xoffset, yoffset, zoffset, x, y, width, height);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles_context_validate_texture_target(&ctx->base,
+ target,
+ &texture_target)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!yagl_gles2_is_texture_target_layered(target)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ yagl_host_glCopyTexSubImage3D(target,
+ level,
+ xoffset,
+ yoffset,
+ zoffset,
+ x,
+ y,
+ width,
+ height);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+YAGL_API YAGL_ALIAS(glCopyTexSubImage3D, glCopyTexSubImage3DOES);
+
+YAGL_API void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data)
+{
+ yagl_gles_texture_target texture_target;
+ struct yagl_gles_texture_target_state *tex_target_state;
+ int using_pbo = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT9(glCompressedTexImage3D, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*, target, level, internalformat, width, height, depth, border, imageSize, data);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles_context_validate_texture_target(&ctx->base,
+ target,
+ &texture_target)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!yagl_gles2_is_texture_target_layered(target)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ tex_target_state =
+ yagl_gles_context_get_active_texture_target_state(&ctx->base,
+ texture_target);
+
+ if ((width < 0) || (height < 0) || (depth < 0)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if ((width == 0) || (height == 0) || (depth == 0)) {
+ width = height = depth = 0;
+ }
+
+ if ((width != 0) && !yagl_gles_context_pre_unpack(&ctx->base, &data, 1, &using_pbo)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ assert(!using_pbo);
+
+ yagl_gles2_context_compressed_tex_image_3d(ctx,
+ target,
+ tex_target_state->texture,
+ level,
+ internalformat,
+ width,
+ height,
+ depth,
+ border,
+ imageSize,
+ data);
+
+ if (width != 0) {
+ yagl_gles_context_post_unpack(&ctx->base, 1);
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+YAGL_API YAGL_ALIAS(glCompressedTexImage3D, glCompressedTexImage3DOES);
+
+YAGL_API void glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data)
+{
+ yagl_gles_texture_target texture_target;
+ int using_pbo = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT11(glCompressedTexSubImage3D, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*, target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles_context_validate_texture_target(&ctx->base,
+ target,
+ &texture_target)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!yagl_gles2_is_texture_target_layered(target)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if ((width < 0) || (height < 0) || (depth < 0)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if ((width == 0) || (height == 0) || (depth == 0)) {
+ width = height = depth = 0;
+ }
+
+ if ((width != 0) && !yagl_gles_context_pre_unpack(&ctx->base, &data, 1, &using_pbo)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ assert(!using_pbo);
+
+ yagl_gles2_context_compressed_tex_sub_image_3d(ctx,
+ target,
+ level,
+ xoffset,
+ yoffset,
+ zoffset,
+ width,
+ height,
+ depth,
+ format,
+ imageSize,
+ data);
+
+ if (width != 0) {
+ yagl_gles_context_post_unpack(&ctx->base, 1);
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+YAGL_API YAGL_ALIAS(glCompressedTexSubImage3D, glCompressedTexSubImage3DOES);
+
+YAGL_API void glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
+{
+ fprintf(stderr, "glFramebufferTexture3D not supported in YaGL\n");
+}
+YAGL_API YAGL_ALIAS(glFramebufferTexture3D, glFramebufferTexture3DOES);
+
+/*
+ * @}
+ */
+
+/*
+ * GL_EXT_texture_storage.
+ * @{
+ */
+
+YAGL_API void glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
+{
+ yagl_gles_texture_target texture_target;
+ struct yagl_gles_texture_target_state *tex_target_state;
+ GLenum base_internalformat, format, type;
+ GLsizei i;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT6(glTexStorage3D, GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei, target, levels, internalformat, width, height, depth);
+
+ YAGL_GET_CTX();
+
+ if ((levels <= 0) || (width <= 0) || (height <= 0)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (!yagl_gles_context_validate_texstorage_format(&ctx->base,
+ &internalformat,
+ &base_internalformat,
+ &format,
+ &type)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!yagl_gles_context_validate_texture_target(&ctx->base, target, &texture_target)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ tex_target_state = yagl_gles_context_get_active_texture_target_state(&ctx->base,
+ texture_target);
+
+ if ((tex_target_state->texture == tex_target_state->texture_zero) ||
+ tex_target_state->texture->immutable) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if ((texture_target == yagl_gles_texture_target_3d) &&
+ ((format == GL_DEPTH_COMPONENT) ||
+ (format == GL_DEPTH_STENCIL_OES))) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ switch (texture_target) {
+ case yagl_gles_texture_target_3d:
+ for (i = 0; i < levels; ++i) {
+ yagl_host_glTexImage3DData(target, i, internalformat,
+ width, height, depth, 0, format, type,
+ NULL, 0);
+
+ width >>= 1;
+ if (width == 0) {
+ width = 1;
+ }
+
+ height >>= 1;
+ if (height == 0) {
+ height = 1;
+ }
+
+ depth >>= 1;
+ if (depth == 0) {
+ depth = 1;
+ }
+ }
+ break;
+ case yagl_gles_texture_target_2d_array:
+ for (i = 0; i < levels; ++i) {
+ yagl_host_glTexImage3DData(target, i, internalformat,
+ width, height, depth, 0, format, type,
+ NULL, 0);
+
+ width >>= 1;
+ if (width == 0) {
+ width = 1;
+ }
+
+ height >>= 1;
+ if (height == 0) {
+ height = 1;
+ }
+ }
+ break;
+ default:
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ yagl_gles_texture_set_immutable(tex_target_state->texture,
+ base_internalformat,
+ type,
+ yagl_gles_context_convert_textures(&ctx->base));
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+YAGL_API YAGL_ALIAS(glTexStorage3D, glTexStorage3DEXT);
+
+/*
+ * @}
+ */
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GLES2/gl2.h"
+#include "GLES2/gl2ext.h"
+#include "yagl_gles2_context.h"
+#include "yagl_gles2_program.h"
+#include "yagl_gles2_utils.h"
+#include "yagl_gles_array.h"
+#include "yagl_gles_buffer.h"
+#include "yagl_gles_texture.h"
+#include "yagl_gles_texture_unit.h"
+#include "yagl_gles_vertex_array.h"
+#include "yagl_gles_utils.h"
+#include "yagl_log.h"
+#include "yagl_malloc.h"
+#include "yagl_state.h"
+#include "yagl_egl_fence.h"
+#include "yagl_texcompress.h"
+#include "yagl_host_gles_calls.h"
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
+
+#define YAGL_SET_ERR(err) \
+ yagl_gles_context_set_error(&ctx->base, err); \
+ YAGL_LOG_ERROR("error = 0x%X", err)
+
+/*
+ * We can't include GL/glext.h here
+ */
+#define GL_POINT_SPRITE 0x8861
+#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642
+#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49
+#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A
+#define GL_MAX_VARYING_FLOATS 0x8B4B
+#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD
+
+static const GLchar *egl_image_ext = "GL_OES_EGL_image";
+static const GLchar *depth24_ext = "GL_OES_depth24";
+static const GLchar *depth32_ext = "GL_OES_depth32";
+static const GLchar *texture_float_ext = "GL_OES_texture_float";
+static const GLchar *texture_float_linear_ext = "GL_OES_texture_float_linear";
+static const GLchar *texture_format_bgra8888_ext = "GL_EXT_texture_format_BGRA8888";
+static const GLchar *depth_texture_ext = "GL_OES_depth_texture";
+static const GLchar *framebuffer_blit_ext = "GL_ANGLE_framebuffer_blit";
+static const GLchar *draw_buffers_ext = "GL_EXT_draw_buffers";
+static const GLchar *mapbuffer_ext = "GL_OES_mapbuffer";
+static const GLchar *map_buffer_range_ext = "GL_EXT_map_buffer_range";
+static const GLchar *element_index_uint_ext = "GL_OES_element_index_uint";
+static const GLchar *texture_3d_ext = "GL_OES_texture_3D";
+static const GLchar *blend_minmax_ext = "GL_EXT_blend_minmax";
+static const GLchar *pbo_ext = "GL_NV_pixel_buffer_object";
+static const GLchar *read_buffer_ext = "GL_NV_read_buffer";
+static const GLchar *compressed_etc1_rgb8_texture_ext = "GL_OES_compressed_ETC1_RGB8_texture";
+static const GLchar *pack_subimage_ext = "GL_NV_pack_subimage";
+static const GLchar *unpack_subimage_ext = "GL_EXT_unpack_subimage";
+static const GLchar *surfaceless_context_ext = "GL_OES_surfaceless_context";
+static const GLchar *egl_sync_ext = "GL_OES_EGL_sync";
+static const GLchar *packed_depth_stencil_ext = "GL_OES_packed_depth_stencil";
+static const GLchar *texture_npot_ext = "GL_OES_texture_npot";
+static const GLchar *texture_filter_anisotropic_ext = "GL_EXT_texture_filter_anisotropic";
+static const GLchar *vertex_array_object_ext = "GL_OES_vertex_array_object";
+static const GLchar *texture_half_float_ext = "GL_OES_texture_half_float";
+static const GLchar *texture_half_float_linear_ext = "GL_OES_texture_half_float_linear";
+static const GLchar *vertex_half_float_ext = "GL_OES_vertex_half_float";
+static const GLchar *standard_derivatives_ext = "GL_OES_standard_derivatives";
+static const GLchar *instanced_arrays_ext = "GL_EXT_instanced_arrays";
+
+static void yagl_gles2_context_prepare_internal(struct yagl_client_context *ctx)
+{
+ struct yagl_gles2_context *gles2_ctx = (struct yagl_gles2_context*)ctx;
+ const GLchar **extensions;
+ int num_extensions;
+
+ yagl_gles2_context_prepare(gles2_ctx);
+
+ extensions = yagl_gles2_context_get_extensions(gles2_ctx, &num_extensions);
+
+ yagl_gles_context_prepare_end(&gles2_ctx->base, extensions, num_extensions);
+}
+
+static void yagl_gles2_context_destroy(struct yagl_client_context *ctx)
+{
+ struct yagl_gles2_context *gles2_ctx = (struct yagl_gles2_context*)ctx;
+
+ YAGL_LOG_FUNC_ENTER(yagl_gles2_context_destroy, "%p", ctx);
+
+ yagl_gles2_context_cleanup(gles2_ctx);
+
+ yagl_free(gles2_ctx);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+static void yagl_gles2_array_apply(struct yagl_gles_array *array,
+ uint32_t first,
+ uint32_t count,
+ const GLvoid *ptr,
+ void *user_data)
+{
+ if (array->integer) {
+ if (array->vbo) {
+ yagl_host_glVertexAttribIPointerOffset(array->index,
+ array->size,
+ array->actual_type,
+ array->actual_stride,
+ array->actual_offset);
+ } else {
+ yagl_host_glVertexAttribIPointerData(array->index,
+ array->size,
+ array->actual_type,
+ array->actual_stride,
+ first,
+ ptr + (first * array->actual_stride),
+ count * array->actual_stride);
+ }
+
+ return;
+ }
+
+ if (array->vbo) {
+ yagl_host_glVertexAttribPointerOffset(array->index,
+ array->size,
+ array->actual_type,
+ array->normalized,
+ array->actual_stride,
+ array->actual_offset);
+ } else {
+ yagl_host_glVertexAttribPointerData(array->index,
+ array->size,
+ array->actual_type,
+ array->normalized,
+ array->actual_stride,
+ first,
+ ptr + (first * array->actual_stride),
+ count * array->actual_stride);
+ }
+}
+
+static const GLchar
+ *yagl_gles2_context_get_string(struct yagl_gles_context *ctx,
+ GLenum name)
+{
+ const char *str = NULL;
+
+ switch (name) {
+ case GL_VERSION:
+ str = "OpenGL ES 2.0";
+ break;
+ case GL_RENDERER:
+ str = "YaGL GLESv2";
+ break;
+ case GL_SHADING_LANGUAGE_VERSION:
+ str = "OpenGL ES GLSL ES 1.4";
+ break;
+ default:
+ str = "";
+ }
+
+ return str;
+}
+
+static int yagl_gles2_context_enable(struct yagl_gles_context *ctx,
+ GLenum cap,
+ GLboolean enable)
+{
+ return 0;
+}
+
+static int yagl_gles2_context_is_enabled(struct yagl_gles_context *ctx,
+ GLenum cap,
+ GLboolean *enabled)
+{
+ return 0;
+}
+
+static int yagl_gles2_context_bind_buffer(struct yagl_gles_context *ctx,
+ GLenum target,
+ struct yagl_gles_buffer *buffer)
+{
+ return 0;
+}
+
+static void yagl_gles2_context_unbind_buffer(struct yagl_gles_context *ctx,
+ yagl_object_name buffer_local_name)
+{
+}
+
+static int yagl_gles2_context_acquire_binded_buffer(struct yagl_gles_context *ctx,
+ GLenum target,
+ struct yagl_gles_buffer **buffer)
+{
+ return 0;
+}
+
+static int yagl_gles2_context_pre_use_program(struct yagl_gles2_context *ctx,
+ struct yagl_gles2_program *program)
+{
+ return 1;
+}
+
+static int yagl_gles2_context_pre_link_program(struct yagl_gles2_context *ctx,
+ struct yagl_gles2_program *program)
+{
+ return 1;
+}
+
+void yagl_gles2_context_init(struct yagl_gles2_context *ctx,
+ yagl_client_api client_api,
+ struct yagl_sharegroup *sg)
+{
+ yagl_gles_context_init(&ctx->base, client_api, sg);
+
+ ctx->sg = sg;
+}
+
+void yagl_gles2_context_cleanup(struct yagl_gles2_context *ctx)
+{
+ yagl_gles2_program_release(ctx->program);
+
+ yagl_gles_buffer_release(ctx->vertex_attrib0.vbo);
+
+ yagl_gles_context_cleanup(&ctx->base);
+}
+
+void yagl_gles2_context_prepare(struct yagl_gles2_context *ctx)
+{
+ GLint num_texture_units = 0;
+ int32_t size = 0;
+ char *extensions, *nonconformant;
+ int num_arrays = 1;
+
+ YAGL_LOG_FUNC_ENTER(yagl_gles2_context_prepare, "%p", ctx);
+
+ yagl_host_glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &num_arrays, 1, NULL);
+
+ yagl_host_glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS,
+ &num_texture_units, 1, NULL);
+
+ /*
+ * We limit this by 32 for conformance.
+ */
+ if (num_texture_units > 32) {
+ num_texture_units = 32;
+ }
+
+ yagl_gles_context_prepare(&ctx->base,
+ num_texture_units,
+ num_arrays);
+
+ ctx->vertex_attrib0.value.f[0] = 0.0f;
+ ctx->vertex_attrib0.value.f[1] = 0.0f;
+ ctx->vertex_attrib0.value.f[2] = 0.0f;
+ ctx->vertex_attrib0.value.f[3] = 1.0f;
+ ctx->vertex_attrib0.type = GL_FLOAT;
+ ctx->vertex_attrib0.vbo = yagl_gles_buffer_create();
+
+ nonconformant = getenv("YAGL_NONCONFORMANT");
+
+ /*
+ * Generating variable locations on target is faster, but
+ * it's not conformant (will not pass some khronos tests)
+ * since we can't know if variable with a given name exists or not,
+ * so we just assume it exists.
+ *
+ * We used to set 'gen_locations' to 1 by default, but that's bad,
+ * since app may do something like this:
+ * if (glGetUniformLocation(p, "my_uniform") == -1) {
+ * // do logic when 'my_uniform' is not in the shader
+ * } else {
+ * // do logic when 'my_uniform' is in the shader
+ * }
+ * i.e. 'gen_locations == 1' will break this logic, thus, we
+ * now set gen_locations to 0 by default.
+ */
+
+ if (nonconformant && atoi(nonconformant)) {
+ ctx->gen_locations = 1;
+ } else {
+ ctx->gen_locations = 0;
+ }
+
+ yagl_host_glGetString(GL_EXTENSIONS, NULL, 0, &size);
+ extensions = yagl_malloc0(size);
+ yagl_host_glGetString(GL_EXTENSIONS, extensions, size, NULL);
+
+ if (yagl_get_host_gl_version() > yagl_gl_2) {
+ ctx->texture_half_float = 1;
+ ctx->vertex_half_float = 1;
+ } else {
+ ctx->texture_half_float = (strstr(extensions, "GL_ARB_half_float_pixel ") != NULL) ||
+ (strstr(extensions, "GL_NV_half_float ") != NULL);
+
+ ctx->vertex_half_float = (strstr(extensions, "GL_ARB_half_float_vertex ") != NULL);
+ }
+
+ ctx->standard_derivatives = 1;
+
+ yagl_free(extensions);
+
+ ctx->instanced_arrays = (yagl_get_host_gl_version() > yagl_gl_2);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+const GLchar **yagl_gles2_context_get_extensions(struct yagl_gles2_context *ctx,
+ int *num_extensions)
+{
+ const GLchar **extensions;
+ int i = 0;
+
+ extensions = yagl_malloc(100 * sizeof(*extensions));
+
+ extensions[i++] = egl_image_ext;
+ extensions[i++] = depth24_ext;
+ extensions[i++] = depth32_ext;
+ extensions[i++] = texture_float_ext;
+ extensions[i++] = texture_float_linear_ext;
+ extensions[i++] = texture_format_bgra8888_ext;
+ extensions[i++] = depth_texture_ext;
+ extensions[i++] = framebuffer_blit_ext;
+ extensions[i++] = draw_buffers_ext;
+ extensions[i++] = mapbuffer_ext;
+ extensions[i++] = map_buffer_range_ext;
+ extensions[i++] = element_index_uint_ext;
+ extensions[i++] = texture_3d_ext;
+ extensions[i++] = blend_minmax_ext;
+ extensions[i++] = pbo_ext;
+ extensions[i++] = read_buffer_ext;
+ extensions[i++] = compressed_etc1_rgb8_texture_ext;
+ extensions[i++] = pack_subimage_ext;
+ extensions[i++] = unpack_subimage_ext;
+ extensions[i++] = surfaceless_context_ext;
+
+ if (yagl_egl_fence_supported()) {
+ extensions[i++] = egl_sync_ext;
+ }
+
+ if (ctx->base.packed_depth_stencil) {
+ extensions[i++] = packed_depth_stencil_ext;
+ }
+
+ if (ctx->base.texture_npot) {
+ extensions[i++] = texture_npot_ext;
+ }
+
+ if (ctx->base.texture_filter_anisotropic) {
+ extensions[i++] = texture_filter_anisotropic_ext;
+ }
+
+ if (ctx->base.vertex_arrays_supported) {
+ extensions[i++] = vertex_array_object_ext;
+ }
+
+ if (ctx->texture_half_float) {
+ extensions[i++] = texture_half_float_ext;
+ extensions[i++] = texture_half_float_linear_ext;
+ }
+
+ if (ctx->vertex_half_float) {
+ extensions[i++] = vertex_half_float_ext;
+ }
+
+ if (ctx->standard_derivatives) {
+ extensions[i++] = standard_derivatives_ext;
+ }
+
+ if (ctx->instanced_arrays) {
+ extensions[i++] = instanced_arrays_ext;
+ }
+
+ *num_extensions = i;
+
+ return extensions;
+}
+
+struct yagl_gles_array
+ *yagl_gles2_context_create_arrays(struct yagl_gles_context *ctx)
+{
+ GLint i;
+ struct yagl_gles_array *arrays;
+
+ arrays = yagl_malloc(ctx->num_arrays * sizeof(*arrays));
+
+ for (i = 0; i < ctx->num_arrays; ++i) {
+ yagl_gles_array_init(&arrays[i],
+ i,
+ &yagl_gles2_array_apply,
+ ctx);
+ }
+
+ return arrays;
+}
+
+void yagl_gles2_context_pre_draw(struct yagl_gles2_context *ctx,
+ GLenum mode,
+ GLint count)
+{
+ YAGL_LOG_FUNC_SET(yagl_gles2_context_pre_draw);
+
+ /*
+ * 'count' can be <= 0 in case of integer overflows, this is
+ * typically user problem, just don't simulate vertex attribute array 0
+ * in this case.
+ */
+
+ if (!ctx->base.vao->arrays[0].enabled && (count > 0)) {
+ /*
+ * vertex attribute array 0 not enabled, simulate
+ * vertex attribute array 0.
+ */
+
+ GLint size = count * sizeof(ctx->vertex_attrib0.value);
+ void *tmp, *it;
+
+ if (!ctx->vertex_attrib0.warned) {
+ YAGL_LOG_WARN("vertex attribute array 0 not enabled, simulating");
+
+ ctx->vertex_attrib0.warned = 1;
+ }
+
+ if (ctx->vertex_attrib0.vbo->size < size) {
+ /*
+ * Required buffer size is greater than allocated so far,
+ * we're forced to reallocate. This is slow path, we basically
+ * need to update everything.
+ */
+
+ tmp = it = yagl_get_tmp_buffer2(size);
+
+ while (it < (tmp + size)) {
+ memcpy(it, &ctx->vertex_attrib0.value, sizeof(ctx->vertex_attrib0.value));
+ it += sizeof(ctx->vertex_attrib0.value);
+ }
+
+ yagl_gles_buffer_set_data(ctx->vertex_attrib0.vbo,
+ size,
+ tmp,
+ GL_STREAM_DRAW);
+
+ ctx->vertex_attrib0.count = count;
+ } else {
+ /*
+ * We can fit it in existing buffer.
+ */
+
+ GLint offset = 0;
+
+ tmp = ctx->vertex_attrib0.vbo->data;
+
+ if (memcmp(tmp,
+ &ctx->vertex_attrib0.value,
+ sizeof(ctx->vertex_attrib0.value)) == 0) {
+ if (ctx->vertex_attrib0.count < count) {
+ /*
+ * vertex attribute 0 didn't change, but we need more than
+ * 'vertex_attrib0.count' elements, thus, update only part
+ * of the buffer. This is semi-fast path. We also update
+ * 'vertex_attrib0.count' here to specify that we now
+ * have more valid elements in the buffer.
+ */
+ offset = sizeof(ctx->vertex_attrib0.value) * ctx->vertex_attrib0.count;
+ size = sizeof(ctx->vertex_attrib0.value) * (count - ctx->vertex_attrib0.count);
+ ctx->vertex_attrib0.count = count;
+ } else {
+ /*
+ * vertex attribute 0 didn't change and we need less than
+ * 'vertex_attrib0.count' elements, this is fast-path,
+ * don't transfer anything. Also, don't update
+ * 'vertex_attrib0.count' here since elements pass 'count'
+ * are still equal to vertex attribute 0, thus, they can
+ * be reused later.
+ */
+ size = 0;
+ }
+ } else {
+ /*
+ * vertex attribute 0 changed, we'll update the buffer
+ * starting from element 0 and up to 'count' elements.
+ * Also, we set 'vertex_attrib0.count' to specify that we have
+ * 'vertex_attrib0.count' elements valid. Note that the buffer
+ * may still contain elements with outdated vertex attribute 0
+ * values.
+ */
+
+ ctx->vertex_attrib0.count = count;
+ }
+
+ tmp = it = yagl_get_tmp_buffer2(size);
+
+ while (it < (tmp + size)) {
+ memcpy(it, &ctx->vertex_attrib0.value, sizeof(ctx->vertex_attrib0.value));
+ it += sizeof(ctx->vertex_attrib0.value);
+ }
+
+ yagl_gles_buffer_update_data(ctx->vertex_attrib0.vbo,
+ offset,
+ size,
+ tmp);
+ }
+
+ yagl_host_glEnableVertexAttribArray(0);
+
+ if (ctx->base.vao->arrays[0].divisor != 0) {
+ yagl_host_glVertexAttribDivisor(0, 0);
+ }
+
+ yagl_gles_buffer_bind(ctx->vertex_attrib0.vbo,
+ 0,
+ 0,
+ GL_ARRAY_BUFFER);
+ yagl_gles_buffer_transfer(ctx->vertex_attrib0.vbo,
+ 0,
+ GL_ARRAY_BUFFER,
+ 0);
+ switch (ctx->vertex_attrib0.type) {
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ yagl_host_glVertexAttribIPointerOffset(0,
+ 4,
+ ctx->vertex_attrib0.type,
+ 0,
+ 0);
+ break;
+ default:
+ assert(0);
+ case GL_FLOAT:
+ yagl_host_glVertexAttribPointerOffset(0,
+ 4,
+ ctx->vertex_attrib0.type,
+ GL_FALSE,
+ 0,
+ 0);
+ break;
+ }
+ yagl_host_glBindBuffer(GL_ARRAY_BUFFER, 0);
+ }
+
+ /*
+ * Enable texture generation for GL_POINTS and gl_PointSize shader variable.
+ * GLESv2 assumes this is enabled by default, we need to set this
+ * state for GL.
+ */
+
+ if (mode == GL_POINTS) {
+ if (yagl_get_host_gl_version() <= yagl_gl_2) {
+ yagl_host_glEnable(GL_POINT_SPRITE);
+ }
+ yagl_host_glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
+ }
+}
+
+void yagl_gles2_context_post_draw(struct yagl_gles2_context *ctx,
+ GLenum mode,
+ GLint count)
+{
+ if (mode == GL_POINTS) {
+ yagl_host_glDisable(GL_VERTEX_PROGRAM_POINT_SIZE);
+ if (yagl_get_host_gl_version() <= yagl_gl_2) {
+ yagl_host_glDisable(GL_POINT_SPRITE);
+ }
+ }
+
+ if (!ctx->base.vao->arrays[0].enabled && (count > 0)) {
+ /*
+ * Restore vertex attribute array 0 pointer.
+ */
+ yagl_gles_array_apply(&ctx->base.vao->arrays[0]);
+
+ if (ctx->base.vao->arrays[0].divisor != 0) {
+ /*
+ * Restore vertex attribute array 0 divisor.
+ */
+ yagl_host_glVertexAttribDivisor(0, ctx->base.vao->arrays[0].divisor);
+ }
+
+ /*
+ * Restore vertex attribute array 0 state.
+ */
+ yagl_host_glDisableVertexAttribArray(0);
+ }
+}
+
+void yagl_gles2_context_compressed_tex_image_2d(struct yagl_gles_context *gles_ctx,
+ GLenum target,
+ struct yagl_gles_texture *texture,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ const GLvoid *data)
+{
+ struct yagl_gles2_context *ctx = (struct yagl_gles2_context*)gles_ctx;
+ struct yagl_texcompress_format *tc_format;
+ GLsizei src_stride;
+ GLsizei dst_stride;
+ GLsizei dst_size;
+ uint8_t *buff;
+
+ YAGL_LOG_FUNC_SET(glCompressedTexImage2D);
+
+ tc_format = yagl_texcompress_get_format(internalformat);
+
+ if (!tc_format) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ return;
+ }
+
+ if (!yagl_texcompress_get_info(tc_format,
+ width,
+ height,
+ imageSize,
+ &src_stride,
+ &dst_stride,
+ &dst_size)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ return;
+ }
+
+ if (!data) {
+ yagl_host_glTexImage2DData(target,
+ level,
+ tc_format->dst_internalformat,
+ width,
+ height,
+ border,
+ tc_format->dst_format,
+ tc_format->dst_type,
+ NULL,
+ dst_size);
+
+ yagl_gles_texture_set_internalformat(texture,
+ tc_format->dst_internalformat,
+ tc_format->dst_type,
+ yagl_gles_context_convert_textures(gles_ctx));
+
+ return;
+ }
+
+ buff = yagl_get_tmp_buffer(dst_size);
+
+ tc_format->unpack(tc_format,
+ data,
+ width,
+ height,
+ src_stride,
+ buff,
+ dst_stride);
+
+ yagl_gles_reset_unpack(&gles_ctx->unpack);
+
+ yagl_host_glTexImage2DData(target,
+ level,
+ tc_format->dst_internalformat,
+ width,
+ height,
+ border,
+ tc_format->dst_format,
+ tc_format->dst_type,
+ buff,
+ dst_size);
+
+ yagl_gles_set_unpack(&gles_ctx->unpack);
+
+ yagl_gles_texture_set_internalformat(texture,
+ tc_format->dst_internalformat,
+ tc_format->dst_type,
+ yagl_gles_context_convert_textures(gles_ctx));
+}
+
+void yagl_gles2_context_compressed_tex_sub_image_2d(struct yagl_gles_context *gles_ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ const GLvoid *data)
+{
+ struct yagl_gles2_context *ctx = (struct yagl_gles2_context*)gles_ctx;
+ struct yagl_texcompress_format *tc_format;
+ GLsizei src_stride;
+ GLsizei dst_stride;
+ GLsizei dst_size;
+ uint8_t *buff;
+
+ YAGL_LOG_FUNC_SET(glCompressedTexSubImage2D);
+
+ if (format == GL_ETC1_RGB8_OES) {
+ /*
+ * "INVALID_OPERATION is generated by CompressedTexSubImage2D,
+ * TexSubImage2D, or CopyTexSubImage2D if the texture image <level>
+ * bound to <target> has internal format ETC1_RGB8_OES."
+ */
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ return;
+ }
+
+ tc_format = yagl_texcompress_get_format(format);
+
+ if (!tc_format) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ return;
+ }
+
+ if (!yagl_texcompress_get_info(tc_format,
+ width,
+ height,
+ imageSize,
+ &src_stride,
+ &dst_stride,
+ &dst_size)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ return;
+ }
+
+ if (!data) {
+ yagl_host_glTexSubImage2DData(target,
+ level,
+ xoffset,
+ yoffset,
+ width,
+ height,
+ tc_format->dst_format,
+ tc_format->dst_type,
+ NULL,
+ dst_size);
+
+ return;
+ }
+
+ buff = yagl_get_tmp_buffer(dst_size);
+
+ tc_format->unpack(tc_format,
+ data,
+ width,
+ height,
+ src_stride,
+ buff,
+ dst_stride);
+
+ yagl_gles_reset_unpack(&gles_ctx->unpack);
+
+ yagl_host_glTexSubImage2DData(target,
+ level,
+ xoffset,
+ yoffset,
+ width,
+ height,
+ tc_format->dst_format,
+ tc_format->dst_type,
+ buff,
+ dst_size);
+
+ yagl_gles_set_unpack(&gles_ctx->unpack);
+}
+
+void yagl_gles2_context_compressed_tex_image_3d(struct yagl_gles2_context *ctx,
+ GLenum target,
+ struct yagl_gles_texture *texture,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ const GLvoid *data)
+{
+ GLsizei singleImageSize = 0;
+ struct yagl_texcompress_format *tc_format;
+ GLsizei src_stride;
+ GLsizei dst_stride;
+ GLsizei dst_size;
+ uint8_t *buff, *tmp;
+ GLsizei i;
+
+ YAGL_LOG_FUNC_SET(glCompressedTexImage3D);
+
+ tc_format = yagl_texcompress_get_format(internalformat);
+
+ if (!tc_format) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ return;
+ }
+
+ if (depth > 0) {
+ singleImageSize = imageSize / depth;
+ }
+
+ if (!yagl_texcompress_get_info(tc_format,
+ width,
+ height,
+ singleImageSize,
+ &src_stride,
+ &dst_stride,
+ &dst_size)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ return;
+ }
+
+ if (!data) {
+ yagl_host_glTexImage3DData(target,
+ level,
+ tc_format->dst_internalformat,
+ width,
+ height,
+ depth,
+ border,
+ tc_format->dst_format,
+ tc_format->dst_type,
+ NULL,
+ dst_size * depth);
+
+ yagl_gles_texture_set_internalformat(texture,
+ tc_format->dst_internalformat,
+ tc_format->dst_type,
+ yagl_gles_context_convert_textures(&ctx->base));
+
+ return;
+ }
+
+ buff = tmp = yagl_get_tmp_buffer(dst_size * depth);
+
+ for (i = 0; i < depth; ++i) {
+ tc_format->unpack(tc_format,
+ data,
+ width,
+ height,
+ src_stride,
+ tmp,
+ dst_stride);
+ data += singleImageSize;
+ tmp += dst_size;
+ }
+
+ yagl_gles_reset_unpack(&ctx->base.unpack);
+
+ yagl_host_glTexImage3DData(target,
+ level,
+ tc_format->dst_internalformat,
+ width,
+ height,
+ depth,
+ border,
+ tc_format->dst_format,
+ tc_format->dst_type,
+ buff,
+ dst_size * depth);
+
+ yagl_gles_set_unpack(&ctx->base.unpack);
+
+ yagl_gles_texture_set_internalformat(texture,
+ tc_format->dst_internalformat,
+ tc_format->dst_type,
+ yagl_gles_context_convert_textures(&ctx->base));
+}
+
+void yagl_gles2_context_compressed_tex_sub_image_3d(struct yagl_gles2_context *ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ const GLvoid *data)
+{
+ GLsizei singleImageSize = 0;
+ struct yagl_texcompress_format *tc_format;
+ GLsizei src_stride;
+ GLsizei dst_stride;
+ GLsizei dst_size;
+ uint8_t *buff, *tmp;
+ GLsizei i;
+
+ YAGL_LOG_FUNC_SET(glCompressedTexSubImage3D);
+
+ if (format == GL_ETC1_RGB8_OES) {
+ /*
+ * "INVALID_OPERATION is generated by CompressedTexSubImage2D,
+ * TexSubImage2D, or CopyTexSubImage2D if the texture image <level>
+ * bound to <target> has internal format ETC1_RGB8_OES."
+ */
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ return;
+ }
+
+ tc_format = yagl_texcompress_get_format(format);
+
+ if (!tc_format) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ return;
+ }
+
+ if (depth > 0) {
+ singleImageSize = imageSize / depth;
+ }
+
+ if (!yagl_texcompress_get_info(tc_format,
+ width,
+ height,
+ singleImageSize,
+ &src_stride,
+ &dst_stride,
+ &dst_size)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ return;
+ }
+
+ if (!data) {
+ yagl_host_glTexSubImage3DData(target,
+ level,
+ xoffset,
+ yoffset,
+ zoffset,
+ width,
+ height,
+ depth,
+ tc_format->dst_format,
+ tc_format->dst_type,
+ NULL,
+ dst_size * depth);
+
+ return;
+ }
+
+ buff = tmp = yagl_get_tmp_buffer(dst_size * depth);
+
+ for (i = 0; i < depth; ++i) {
+ tc_format->unpack(tc_format,
+ data,
+ width,
+ height,
+ src_stride,
+ tmp,
+ dst_stride);
+ data += singleImageSize;
+ tmp += dst_size;
+ }
+
+ yagl_gles_reset_unpack(&ctx->base.unpack);
+
+ yagl_host_glTexSubImage3DData(target,
+ level,
+ xoffset,
+ yoffset,
+ zoffset,
+ width,
+ height,
+ depth,
+ tc_format->dst_format,
+ tc_format->dst_type,
+ buff,
+ dst_size * depth);
+
+ yagl_gles_set_unpack(&ctx->base.unpack);
+}
+
+int yagl_gles2_context_get_integerv(struct yagl_gles_context *ctx,
+ GLenum pname,
+ GLint *params,
+ uint32_t *num_params)
+{
+ int processed = 1;
+ struct yagl_gles2_context *gles2_ctx = (struct yagl_gles2_context*)ctx;
+ struct yagl_gles_texture_target_state *tts;
+
+ switch (pname) {
+ case GL_NUM_SHADER_BINARY_FORMATS:
+ *params = 0;
+ *num_params = 1;
+ break;
+ case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
+ *params = yagl_texcompress_get_format_names(NULL);
+ *num_params = 1;
+ break;
+ case GL_TEXTURE_BINDING_CUBE_MAP:
+ tts = yagl_gles_context_get_active_texture_target_state(ctx,
+ yagl_gles_texture_target_cubemap);
+ *params = tts->texture->base.local_name;
+ *num_params = 1;
+ break;
+ case GL_TEXTURE_BINDING_3D_OES:
+ tts = yagl_gles_context_get_active_texture_target_state(ctx,
+ yagl_gles_texture_target_3d);
+ *params = tts->texture->base.local_name;
+ *num_params = 1;
+ break;
+ case GL_CURRENT_PROGRAM:
+ *params = gles2_ctx->program ? gles2_ctx->program->base.local_name : 0;
+ *num_params = 1;
+ break;
+ case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
+ *params = ctx->num_texture_units;
+ *num_params = 1;
+ break;
+ case GL_MAX_VERTEX_ATTRIBS:
+ *params = ctx->num_arrays;
+ *num_params = 1;
+ break;
+ case GL_COMPRESSED_TEXTURE_FORMATS:
+ *num_params = yagl_texcompress_get_format_names((GLenum*)params);
+ break;
+ case GL_MAX_FRAGMENT_UNIFORM_VECTORS:
+ *num_params = 1;
+ if (gles2_ctx->have_max_fragment_uniform_components) {
+ *params = gles2_ctx->max_fragment_uniform_components;
+ } else {
+ yagl_host_glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, params, *num_params, NULL);
+ gles2_ctx->max_fragment_uniform_components = *params;
+ gles2_ctx->have_max_fragment_uniform_components = 1;
+ }
+ *params /= 4;
+ break;
+ case GL_MAX_VARYING_VECTORS:
+ *num_params = 1;
+ if (yagl_get_host_gl_version() >= yagl_gl_3_2) {
+ /*
+ * GL_MAX_VARYING_COMPONENTS is an alias for GL_MAX_VARYING_FLOATS
+ * and it should be used in OpenGL 3.1, but it's deprecated in
+ * OpenGL 3.2, thus, we use a constant.
+ */
+ *params = 64;
+ } else if (gles2_ctx->have_max_varying_floats) {
+ *params = gles2_ctx->max_varying_floats;
+ } else {
+ yagl_host_glGetIntegerv(GL_MAX_VARYING_FLOATS, params, *num_params, NULL);
+ gles2_ctx->max_varying_floats = *params;
+ gles2_ctx->have_max_varying_floats = 1;
+ }
+ *params /= 4;
+ break;
+ case GL_MAX_VERTEX_UNIFORM_VECTORS:
+ *num_params = 1;
+ if (gles2_ctx->have_max_vertex_uniform_components) {
+ *params = gles2_ctx->max_vertex_uniform_components;
+ } else {
+ yagl_host_glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS, params, *num_params, NULL);
+ gles2_ctx->max_vertex_uniform_components = *params;
+ gles2_ctx->have_max_vertex_uniform_components = 1;
+ }
+ *params /= 4;
+ break;
+ case GL_SHADER_COMPILER:
+ *params = GL_TRUE;
+ *num_params = 1;
+ break;
+ case GL_STENCIL_BACK_FAIL:
+ *params = ctx->stencil_back.fail;
+ *num_params = 1;
+ break;
+ case GL_STENCIL_BACK_FUNC:
+ *params = ctx->stencil_back.func;
+ *num_params = 1;
+ break;
+ case GL_STENCIL_BACK_PASS_DEPTH_FAIL:
+ *params = ctx->stencil_back.zfail;
+ *num_params = 1;
+ break;
+ case GL_STENCIL_BACK_PASS_DEPTH_PASS:
+ *params = ctx->stencil_back.zpass;
+ *num_params = 1;
+ break;
+ case GL_STENCIL_BACK_REF:
+ *params = ctx->stencil_back.ref;
+ *num_params = 1;
+ break;
+ case GL_STENCIL_BACK_VALUE_MASK:
+ *params = ctx->stencil_back.mask;
+ *num_params = 1;
+ break;
+ case GL_STENCIL_BACK_WRITEMASK:
+ *params = ctx->stencil_back.writemask;
+ *num_params = 1;
+ break;
+ case GL_DITHER:
+ *params = ctx->dither_enabled;
+ *num_params = 1;
+ break;
+ case GL_MAX_TEXTURE_SIZE:
+ if (gles2_ctx->have_max_texture_size) {
+ *params = gles2_ctx->max_texture_size;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_MAX_CUBE_MAP_TEXTURE_SIZE:
+ if (gles2_ctx->have_max_cubemap_texture_size) {
+ *params = gles2_ctx->max_cubemap_texture_size;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_MAX_SAMPLES_IMG:
+ if (gles2_ctx->have_max_samples_img) {
+ *params = gles2_ctx->max_samples_img;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_MAX_TEXTURE_IMAGE_UNITS:
+ if (gles2_ctx->have_max_texture_image_units) {
+ *params = gles2_ctx->max_texture_image_units;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
+ if (gles2_ctx->have_max_texture_max_anisotropy) {
+ *params = gles2_ctx->max_texture_max_anisotropy;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:
+ if (gles2_ctx->have_max_vertex_texture_image_units) {
+ *params = gles2_ctx->max_vertex_texture_image_units;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_MAX_3D_TEXTURE_SIZE_OES:
+ if (gles2_ctx->have_max_3d_texture_size) {
+ *params = gles2_ctx->max_3d_texture_size;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ default:
+ processed = 0;
+ break;
+ }
+
+ if (processed) {
+ return 1;
+ }
+
+ switch (pname) {
+ case GL_MAX_TEXTURE_SIZE:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ gles2_ctx->max_texture_size = *params;
+ gles2_ctx->have_max_texture_size = 1;
+ break;
+ case GL_MAX_CUBE_MAP_TEXTURE_SIZE:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ gles2_ctx->max_cubemap_texture_size = *params;
+ gles2_ctx->have_max_cubemap_texture_size = 1;
+ break;
+ case GL_MAX_SAMPLES_IMG:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ gles2_ctx->max_samples_img = *params;
+ gles2_ctx->have_max_samples_img = 1;
+ break;
+ case GL_MAX_TEXTURE_IMAGE_UNITS:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ gles2_ctx->max_texture_image_units = *params;
+ gles2_ctx->have_max_texture_image_units = 1;
+ break;
+ case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ gles2_ctx->max_texture_max_anisotropy = *params;
+ gles2_ctx->have_max_texture_max_anisotropy = 1;
+ break;
+ case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ gles2_ctx->max_vertex_texture_image_units = *params;
+ gles2_ctx->have_max_vertex_texture_image_units = 1;
+ break;
+ case GL_SHADER_BINARY_FORMATS:
+ *num_params = 0;
+ break;
+ case GL_MAX_3D_TEXTURE_SIZE_OES:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ gles2_ctx->max_3d_texture_size = *params;
+ gles2_ctx->have_max_3d_texture_size = 1;
+ break;
+ default:
+ return 0;
+ }
+
+ return 1;
+}
+
+int yagl_gles2_context_get_floatv(struct yagl_gles_context *ctx,
+ GLenum pname,
+ GLfloat *params,
+ uint32_t *num_params,
+ int *needs_map)
+{
+ struct yagl_gles2_context *gles2_ctx = (struct yagl_gles2_context*)ctx;
+
+ switch (pname) {
+ case GL_BLEND_COLOR:
+ params[0] = gles2_ctx->blend_color[0];
+ params[1] = gles2_ctx->blend_color[1];
+ params[2] = gles2_ctx->blend_color[2];
+ params[3] = gles2_ctx->blend_color[3];
+ *num_params = 4;
+ *needs_map = 1;
+ break;
+ default:
+ return 0;
+ }
+
+ return 1;
+}
+
+void yagl_gles2_context_draw_arrays(struct yagl_gles_context *ctx,
+ GLenum mode,
+ GLint first,
+ GLsizei count,
+ GLsizei primcount)
+{
+ struct yagl_gles2_context *gles2_ctx = (struct yagl_gles2_context*)ctx;
+
+ yagl_gles2_context_pre_draw(gles2_ctx, mode, first + count);
+
+ if (primcount < 0) {
+ yagl_host_glDrawArrays(mode, first, count);
+ } else {
+ yagl_host_glDrawArraysInstanced(mode, first, count, primcount);
+ }
+
+ yagl_gles2_context_post_draw(gles2_ctx, mode, first + count);
+}
+
+void yagl_gles2_context_draw_elements(struct yagl_gles_context *ctx,
+ GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const GLvoid *indices,
+ int32_t indices_count,
+ GLsizei primcount,
+ uint32_t max_idx)
+{
+ struct yagl_gles2_context *gles2_ctx = (struct yagl_gles2_context*)ctx;
+
+ yagl_gles2_context_pre_draw(gles2_ctx, mode, max_idx + 1);
+
+ if (primcount < 0) {
+ yagl_host_glDrawElements(mode, count, type, indices, indices_count);
+ } else {
+ yagl_host_glDrawElementsInstanced(mode, count, type, indices, indices_count, primcount);
+ }
+
+ yagl_gles2_context_post_draw(gles2_ctx, mode, max_idx + 1);
+}
+
+int yagl_gles2_context_validate_texture_target(struct yagl_gles_context *ctx,
+ GLenum target,
+ yagl_gles_texture_target *texture_target)
+{
+ switch (target) {
+ case GL_TEXTURE_3D_OES:
+ *texture_target = yagl_gles_texture_target_3d;
+ break;
+ case GL_TEXTURE_CUBE_MAP:
+ *texture_target = yagl_gles_texture_target_cubemap;
+ break;
+ default:
+ return 0;
+ }
+
+ return 1;
+}
+
+struct yagl_pixel_format
+ *yagl_gles2_context_validate_teximage_format(struct yagl_gles_context *ctx,
+ GLenum internalformat,
+ GLenum format,
+ GLenum type)
+{
+ return NULL;
+}
+
+struct yagl_pixel_format
+ *yagl_gles2_context_validate_getteximage_format(struct yagl_gles_context *ctx,
+ GLenum readbuffer_internalformat,
+ GLenum format,
+ GLenum type)
+{
+ return NULL;
+}
+
+int yagl_gles2_context_validate_copyteximage_format(struct yagl_gles_context *ctx,
+ GLenum readbuffer_internalformat,
+ GLenum *internalformat)
+{
+ return 0;
+}
+
+int yagl_gles2_context_validate_texstorage_format(struct yagl_gles_context *ctx,
+ GLenum *internalformat,
+ GLenum *base_internalformat,
+ GLenum *any_format,
+ GLenum *any_type)
+{
+ struct yagl_texcompress_format *tc_format;
+
+ if (*internalformat == GL_ETC1_RGB8_OES) {
+ /*
+ * This is not allowed for TexStorage.
+ */
+ return 0;
+ }
+
+ tc_format = yagl_texcompress_get_format(*internalformat);
+
+ if (!tc_format) {
+ return 0;
+ }
+
+ *internalformat = tc_format->dst_internalformat;
+ *base_internalformat = tc_format->dst_internalformat;
+ *any_format = tc_format->dst_format;
+ *any_type = tc_format->dst_type;
+
+ return 1;
+}
+
+int yagl_gles2_context_validate_renderbuffer_format(struct yagl_gles_context *ctx,
+ GLenum *internalformat)
+{
+ return 0;
+}
+
+void yagl_gles2_context_hint(struct yagl_gles_context *ctx,
+ GLenum target,
+ GLenum mode)
+{
+}
+
+int yagl_gles2_context_get_programiv(struct yagl_gles2_context *ctx,
+ struct yagl_gles2_program *program,
+ GLenum pname,
+ GLint *params)
+{
+ switch (pname) {
+ case GL_ATTACHED_SHADERS:
+ *params = (program->fragment_shader != NULL) ? 1 : 0;
+ *params += (program->vertex_shader != NULL) ? 1 : 0;
+ break;
+ case GL_INFO_LOG_LENGTH:
+ *params = program->info_log_length;
+ break;
+ case GL_ACTIVE_ATTRIBUTES:
+ *params = program->num_active_attribs;
+ break;
+ case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH:
+ *params = program->max_active_attrib_bufsize;
+ break;
+ case GL_ACTIVE_UNIFORMS:
+ *params = program->num_active_uniforms;
+ break;
+ case GL_ACTIVE_UNIFORM_MAX_LENGTH:
+ *params = program->max_active_uniform_bufsize;
+ break;
+ case GL_DELETE_STATUS:
+ *params = GL_FALSE;
+ break;
+ case GL_LINK_STATUS:
+ *params = program->link_status;
+ break;
+ default:
+ return 0;
+ }
+
+ return 1;
+}
+
+struct yagl_client_context *yagl_gles2_context_create(struct yagl_sharegroup *sg)
+{
+ struct yagl_gles2_context *gles2_ctx;
+
+ YAGL_LOG_FUNC_ENTER(yagl_gles2_context_create, NULL);
+
+ gles2_ctx = yagl_malloc0(sizeof(*gles2_ctx));
+
+ yagl_gles2_context_init(gles2_ctx, yagl_client_api_gles2, sg);
+
+ gles2_ctx->base.base.prepare = &yagl_gles2_context_prepare_internal;
+ gles2_ctx->base.base.destroy = &yagl_gles2_context_destroy;
+ gles2_ctx->base.create_arrays = &yagl_gles2_context_create_arrays;
+ gles2_ctx->base.get_string = &yagl_gles2_context_get_string;
+ gles2_ctx->base.compressed_tex_image_2d = &yagl_gles2_context_compressed_tex_image_2d;
+ gles2_ctx->base.compressed_tex_sub_image_2d = &yagl_gles2_context_compressed_tex_sub_image_2d;
+ gles2_ctx->base.enable = &yagl_gles2_context_enable;
+ gles2_ctx->base.is_enabled = &yagl_gles2_context_is_enabled;
+ gles2_ctx->base.get_integerv = &yagl_gles2_context_get_integerv;
+ gles2_ctx->base.get_floatv = &yagl_gles2_context_get_floatv;
+ gles2_ctx->base.draw_arrays = &yagl_gles2_context_draw_arrays;
+ gles2_ctx->base.draw_elements = &yagl_gles2_context_draw_elements;
+ gles2_ctx->base.bind_buffer = &yagl_gles2_context_bind_buffer;
+ gles2_ctx->base.unbind_buffer = &yagl_gles2_context_unbind_buffer;
+ gles2_ctx->base.acquire_binded_buffer = &yagl_gles2_context_acquire_binded_buffer;
+ gles2_ctx->base.validate_texture_target = &yagl_gles2_context_validate_texture_target;
+ gles2_ctx->base.validate_teximage_format = &yagl_gles2_context_validate_teximage_format;
+ gles2_ctx->base.validate_getteximage_format = &yagl_gles2_context_validate_getteximage_format;
+ gles2_ctx->base.validate_copyteximage_format = &yagl_gles2_context_validate_copyteximage_format;
+ gles2_ctx->base.validate_texstorage_format = &yagl_gles2_context_validate_texstorage_format;
+ gles2_ctx->base.validate_renderbuffer_format = &yagl_gles2_context_validate_renderbuffer_format;
+ gles2_ctx->base.hint = &yagl_gles2_context_hint;
+ gles2_ctx->get_programiv = &yagl_gles2_context_get_programiv;
+ gles2_ctx->pre_use_program = &yagl_gles2_context_pre_use_program;
+ gles2_ctx->pre_link_program = &yagl_gles2_context_pre_link_program;
+
+ YAGL_LOG_FUNC_EXIT("%p", gles2_ctx);
+
+ return &gles2_ctx->base.base;
+}
+
+void yagl_gles2_context_use_program(struct yagl_gles2_context *ctx,
+ struct yagl_gles2_program *program)
+{
+ yagl_gles2_program_acquire(program);
+ yagl_gles2_program_release(ctx->program);
+ ctx->program = program;
+
+ yagl_host_glUseProgram((program ? program->global_name : 0));
+}
+
+void yagl_gles2_context_unuse_program(struct yagl_gles2_context *ctx,
+ struct yagl_gles2_program *program)
+{
+ if (ctx->program == program) {
+ yagl_gles2_program_release(ctx->program);
+ ctx->program = NULL;
+ }
+}
+
+int yagl_gles2_context_get_array_param(struct yagl_gles2_context *ctx,
+ GLuint index,
+ GLenum pname,
+ GLint *param)
+{
+ struct yagl_gles_array *array;
+
+ YAGL_LOG_FUNC_SET(yagl_gles2_context_get_array_param);
+
+ if (index >= ctx->base.num_arrays) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ return 1;
+ }
+
+ array = &ctx->base.vao->arrays[index];
+
+ switch (pname) {
+ case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
+ *param = array->vbo ? array->vbo->base.local_name : 0;
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
+ *param = array->enabled;
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_SIZE:
+ *param = array->size;
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
+ *param = array->stride;
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_TYPE:
+ *param = array->type;
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
+ *param = array->normalized;
+ break;
+ case GL_CURRENT_VERTEX_ATTRIB:
+ return 0;
+ case GL_VERTEX_ATTRIB_ARRAY_DIVISOR_EXT:
+ if (ctx->instanced_arrays) {
+ *param = array->divisor;
+ } else {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+ break;
+ case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
+ if (ctx->base.base.client_api == yagl_client_api_gles3) {
+ *param = array->integer;
+ } else {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+ break;
+ default:
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ break;
+ }
+
+ return 1;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES2_CONTEXT_H_
+#define _YAGL_GLES2_CONTEXT_H_
+
+#include "yagl_gles_context.h"
+
+struct yagl_gles2_program;
+
+struct yagl_gles2_context
+{
+ struct yagl_gles_context base;
+
+ int (*get_programiv)(struct yagl_gles2_context */*ctx*/,
+ struct yagl_gles2_program */*program*/,
+ GLenum /*pname*/,
+ GLint */*params*/);
+
+ int (*pre_use_program)(struct yagl_gles2_context */*ctx*/,
+ struct yagl_gles2_program */*program*/);
+
+ int (*pre_link_program)(struct yagl_gles2_context */*ctx*/,
+ struct yagl_gles2_program */*program*/);
+
+ /*
+ * From 'base.base.sg'.
+ */
+ struct yagl_sharegroup *sg;
+
+ /*
+ * Host OpenGL (version < 3.1) vertex attribute 0 is "magic", it has to be
+ * always enabled as a vertex attribute array. This means we have to
+ * keep some buffer around and on each drawing call:
+ * + Check if vertex attribute array 0 is enabled, if not then
+ * + Resize this buffer to fit the number of elements to draw and
+ * stuff it with vertex attribute 0 value
+ * + Call glEnableVertexAttribArray + glVertexAttribPointer
+ * + Draw
+ * + Restore everything back to normal.
+ * This is really heavy, but luckily almost everyone uses vertex attribute
+ * array 0, so this code will be triggered on very rare occasions, like
+ * khronos conformance test.
+ * Also, Host OpenGL 3.1+ says that vertex attribute 0
+ * "is not magic anymore", but this is
+ * currently broken in many drivers, so we have to workaround even
+ * when we're running with OpenGL 3.1+ core...
+ */
+ struct
+ {
+ union
+ {
+ /*
+ * We assume that all these arrays
+ * are equal in size.
+ */
+ GLfloat f[4];
+ GLint i[4];
+ GLuint ui[4];
+ } value;
+ GLenum type;
+ GLint count;
+ struct yagl_gles_buffer *vbo;
+ int warned;
+ } vertex_attrib0;
+
+ /*
+ * Generate program uniform locations ourselves or vmexit
+ * and ask host.
+ */
+ int gen_locations;
+
+ int texture_half_float;
+
+ int vertex_half_float;
+
+ int standard_derivatives;
+
+ int instanced_arrays;
+
+ struct yagl_gles2_program *program;
+
+ int have_max_texture_size;
+ GLint max_texture_size;
+
+ int have_max_cubemap_texture_size;
+ GLint max_cubemap_texture_size;
+
+ int have_max_samples_img;
+ GLint max_samples_img;
+
+ int have_max_texture_image_units;
+ GLint max_texture_image_units;
+
+ int have_max_texture_max_anisotropy;
+ GLint max_texture_max_anisotropy;
+
+ int have_max_vertex_texture_image_units;
+ GLint max_vertex_texture_image_units;
+
+ int have_max_3d_texture_size;
+ GLint max_3d_texture_size;
+
+ int have_max_fragment_uniform_components;
+ GLint max_fragment_uniform_components;
+
+ int have_max_varying_floats;
+ GLint max_varying_floats;
+
+ int have_max_vertex_uniform_components;
+ GLint max_vertex_uniform_components;
+
+ GLclampf blend_color[4];
+};
+
+/*
+ * GLESv2/v3 common.
+ * @{
+ */
+
+void yagl_gles2_context_init(struct yagl_gles2_context *ctx,
+ yagl_client_api client_api,
+ struct yagl_sharegroup *sg);
+
+void yagl_gles2_context_cleanup(struct yagl_gles2_context *ctx);
+
+void yagl_gles2_context_prepare(struct yagl_gles2_context *ctx);
+
+const GLchar **yagl_gles2_context_get_extensions(struct yagl_gles2_context *ctx,
+ int *num_extensions);
+
+struct yagl_gles_array
+ *yagl_gles2_context_create_arrays(struct yagl_gles_context *ctx);
+
+void yagl_gles2_context_pre_draw(struct yagl_gles2_context *ctx,
+ GLenum mode,
+ GLint count);
+
+void yagl_gles2_context_post_draw(struct yagl_gles2_context *ctx,
+ GLenum mode,
+ GLint count);
+
+void yagl_gles2_context_compressed_tex_image_2d(struct yagl_gles_context *ctx,
+ GLenum target,
+ struct yagl_gles_texture *texture,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ const GLvoid *data);
+
+void yagl_gles2_context_compressed_tex_sub_image_2d(struct yagl_gles_context *ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ const GLvoid *data);
+
+void yagl_gles2_context_compressed_tex_image_3d(struct yagl_gles2_context *ctx,
+ GLenum target,
+ struct yagl_gles_texture *texture,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLint border,
+ GLsizei imageSize,
+ const GLvoid *data);
+
+void yagl_gles2_context_compressed_tex_sub_image_3d(struct yagl_gles2_context *ctx,
+ GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint zoffset,
+ GLsizei width,
+ GLsizei height,
+ GLsizei depth,
+ GLenum format,
+ GLsizei imageSize,
+ const GLvoid *data);
+
+int yagl_gles2_context_get_integerv(struct yagl_gles_context *ctx,
+ GLenum pname,
+ GLint *params,
+ uint32_t *num_params);
+
+int yagl_gles2_context_get_floatv(struct yagl_gles_context *ctx,
+ GLenum pname,
+ GLfloat *params,
+ uint32_t *num_params,
+ int *needs_map);
+
+void yagl_gles2_context_draw_arrays(struct yagl_gles_context *ctx,
+ GLenum mode,
+ GLint first,
+ GLsizei count,
+ GLsizei primcount);
+
+void yagl_gles2_context_draw_elements(struct yagl_gles_context *ctx,
+ GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const GLvoid *indices,
+ int32_t indices_count,
+ GLsizei primcount,
+ uint32_t max_idx);
+
+int yagl_gles2_context_validate_texture_target(struct yagl_gles_context *ctx,
+ GLenum target,
+ yagl_gles_texture_target *texture_target);
+
+struct yagl_pixel_format
+ *yagl_gles2_context_validate_teximage_format(struct yagl_gles_context *ctx,
+ GLenum internalformat,
+ GLenum format,
+ GLenum type);
+
+struct yagl_pixel_format
+ *yagl_gles2_context_validate_getteximage_format(struct yagl_gles_context *ctx,
+ GLenum readbuffer_internalformat,
+ GLenum format,
+ GLenum type);
+
+int yagl_gles2_context_validate_copyteximage_format(struct yagl_gles_context *ctx,
+ GLenum readbuffer_internalformat,
+ GLenum *internalformat);
+
+int yagl_gles2_context_validate_texstorage_format(struct yagl_gles_context *ctx,
+ GLenum *internalformat,
+ GLenum *base_internalformat,
+ GLenum *any_format,
+ GLenum *any_type);
+
+int yagl_gles2_context_validate_renderbuffer_format(struct yagl_gles_context *ctx,
+ GLenum *internalformat);
+
+void yagl_gles2_context_hint(struct yagl_gles_context *ctx,
+ GLenum target,
+ GLenum mode);
+
+int yagl_gles2_context_get_programiv(struct yagl_gles2_context *ctx,
+ struct yagl_gles2_program *program,
+ GLenum pname,
+ GLint *params);
+
+/*
+ * @}
+ */
+
+struct yagl_client_context *yagl_gles2_context_create(struct yagl_sharegroup *sg);
+
+void yagl_gles2_context_use_program(struct yagl_gles2_context *ctx,
+ struct yagl_gles2_program *program);
+
+void yagl_gles2_context_unuse_program(struct yagl_gles2_context *ctx,
+ struct yagl_gles2_program *program);
+
+int yagl_gles2_context_get_array_param(struct yagl_gles2_context *ctx,
+ GLuint index,
+ GLenum pname,
+ GLint *param);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GLES2/gl2.h"
+#include "yagl_export.h"
+#include "yagl_client_interface.h"
+#include "yagl_gles2_context.h"
+#include "yagl_gles3_context.h"
+#include "yagl_gles_image.h"
+#include "yagl_gles_texture.h"
+
+static struct yagl_client_context *yagl_gles2_create_ctx(struct yagl_client_interface *iface,
+ yagl_client_api client_api,
+ struct yagl_sharegroup *sg)
+{
+ switch (client_api) {
+ case yagl_client_api_gles2:
+ return yagl_gles2_context_create(sg);
+ case yagl_client_api_gles3:
+ return yagl_gles3_context_create(sg);
+ default:
+ return NULL;
+ }
+}
+
+static struct yagl_client_image
+ *yagl_gles2_create_image(struct yagl_client_interface *iface,
+ yagl_object_name tex_global_name)
+{
+ return &yagl_gles_image_create(tex_global_name)->base;
+}
+
+static void yagl_gles2_release_tex_image(struct yagl_client_interface *iface,
+ void *cookie)
+{
+ struct yagl_gles_texture *texture = cookie;
+
+ yagl_gles_texture_release_tex_image(texture);
+}
+
+YAGL_API struct yagl_client_interface yagl_gles2_interface =
+{
+ .create_ctx = &yagl_gles2_create_ctx,
+ .create_image = &yagl_gles2_create_image,
+ .release_tex_image = &yagl_gles2_release_tex_image
+};
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GLES2/gl2.h"
+#include "yagl_gles2_program.h"
+#include "yagl_gles2_shader.h"
+#include "yagl_gles2_utils.h"
+#include "yagl_malloc.h"
+#include "yagl_state.h"
+#include "yagl_transport.h"
+#include "yagl_log.h"
+#include "yagl_utils.h"
+#include "yagl_host_gles_calls.h"
+#include <string.h>
+#include <stdlib.h>
+#include <pthread.h>
+
+/*
+ * We don't want to include GLES3/gl3.h here
+ */
+#define GL_INTERLEAVED_ATTRIBS 0x8C8C
+
+struct yagl_gles2_location_v
+{
+ GLchar *name;
+
+ uint32_t global_location;
+};
+
+static pthread_once_t g_gen_locations_init = PTHREAD_ONCE_INIT;
+
+static pthread_mutex_t g_gen_locations_mutex;
+static uint32_t g_gen_locations_next = 0;
+
+static void yagl_gen_locations_init()
+{
+ yagl_mutex_init(&g_gen_locations_mutex);
+}
+
+static uint32_t yagl_gen_location()
+{
+ uint32_t ret;
+
+ pthread_once(&g_gen_locations_init, yagl_gen_locations_init);
+
+ pthread_mutex_lock(&g_gen_locations_mutex);
+
+ ret = g_gen_locations_next++;
+
+ pthread_mutex_unlock(&g_gen_locations_mutex);
+
+ return ret;
+}
+
+static void yagl_gles2_transform_feedback_info_copy(
+ struct yagl_gles2_transform_feedback_info *from,
+ struct yagl_gles2_transform_feedback_info *to)
+{
+ GLuint i;
+
+ yagl_gles2_transform_feedback_info_reset(to);
+
+ memcpy(to, from, sizeof(*from));
+
+ if (from->num_varyings > 0) {
+ to->varyings = yagl_malloc(to->num_varyings * sizeof(*to->varyings));
+
+ for (i = 0; i < from->num_varyings; ++i) {
+ memcpy(&to->varyings[i],
+ &from->varyings[i],
+ sizeof(from->varyings[0]));
+
+ if (from->varyings[i].name) {
+ to->varyings[i].name = yagl_malloc(from->varyings[i].name_size);
+ memcpy(to->varyings[i].name,
+ from->varyings[i].name,
+ from->varyings[i].name_size);
+ }
+ }
+ }
+}
+
+static void yagl_gles2_program_reset_cached(struct yagl_gles2_program *program)
+{
+ int i;
+ struct yagl_gles2_location_l *location_l, *tmp_l;
+
+ for (i = 0; i < (int)program->num_active_attribs; ++i) {
+ yagl_free(program->active_attribs[i].name);
+ }
+ yagl_free(program->active_attribs);
+ program->active_attribs = NULL;
+
+ for (i = 0; i < (int)program->num_active_uniforms; ++i) {
+ yagl_free(program->active_uniforms[i].name);
+ }
+ yagl_free(program->active_uniforms);
+ program->active_uniforms = NULL;
+
+ for (i = 0; i < (int)program->num_active_uniform_blocks; ++i) {
+ yagl_free(program->active_uniform_blocks[i].name);
+ yagl_free(program->active_uniform_blocks[i].active_uniform_indices);
+ }
+ yagl_free(program->active_uniform_blocks);
+ program->active_uniform_blocks = NULL;
+
+ yagl_list_for_each_safe(struct yagl_gles2_location_l,
+ location_l,
+ tmp_l,
+ &program->frag_data_locations, list) {
+ yagl_list_remove(&location_l->list);
+ free(location_l->name);
+ yagl_free(location_l);
+ }
+
+ yagl_list_for_each_safe(struct yagl_gles2_location_l,
+ location_l,
+ tmp_l,
+ &program->attrib_locations, list) {
+ yagl_list_remove(&location_l->list);
+ free(location_l->name);
+ yagl_free(location_l);
+ }
+
+ if (program->gen_locations) {
+ struct yagl_gles2_location_v *locations =
+ yagl_vector_data(&program->uniform_locations_v);
+ uint32_t *tmp = (uint32_t*)yagl_get_tmp_buffer(
+ yagl_vector_size(&program->uniform_locations_v) * sizeof(uint32_t));
+
+ for (i = 0; i < yagl_vector_size(&program->uniform_locations_v); ++i) {
+ tmp[i] = locations[i].global_location;
+ free(locations[i].name);
+ }
+
+ yagl_host_glDeleteUniformLocationsYAGL(tmp,
+ yagl_vector_size(&program->uniform_locations_v));
+
+ yagl_vector_resize(&program->uniform_locations_v, 0);
+ } else {
+ yagl_list_for_each_safe(struct yagl_gles2_location_l,
+ location_l,
+ tmp_l,
+ &program->uniform_locations_l, list) {
+ yagl_list_remove(&location_l->list);
+ free(location_l->name);
+ yagl_free(location_l);
+ }
+ }
+}
+
+static void yagl_gles2_program_destroy(struct yagl_ref *ref)
+{
+ struct yagl_gles2_program *program = (struct yagl_gles2_program*)ref;
+
+ yagl_gles2_program_reset_cached(program);
+
+ yagl_gles2_transform_feedback_info_reset(&program->linked_transform_feedback_info);
+ yagl_gles2_transform_feedback_info_reset(&program->transform_feedback_info);
+
+ if (program->gen_locations) {
+ yagl_vector_cleanup(&program->uniform_locations_v);
+ }
+
+ yagl_gles2_shader_release(program->fragment_shader);
+ yagl_gles2_shader_release(program->vertex_shader);
+
+ yagl_host_glDeleteObjects(&program->global_name, 1);
+
+ yagl_object_cleanup(&program->base);
+
+ yagl_free(program);
+}
+
+int yagl_gles2_program_translate_location(struct yagl_gles2_program *program,
+ GLint location,
+ uint32_t *global_location)
+{
+ struct yagl_gles2_location_v *locations;
+
+ if (program->gen_locations) {
+ if ((location < 0) ||
+ (location >= yagl_vector_size(&program->uniform_locations_v))) {
+ return 0;
+ }
+
+ locations = yagl_vector_data(&program->uniform_locations_v);
+
+ *global_location = locations[location].global_location;
+ } else {
+ *global_location = location;
+ }
+
+ return 1;
+}
+
+void yagl_gles2_transform_feedback_info_reset(
+ struct yagl_gles2_transform_feedback_info *transform_feedback_info)
+{
+ GLuint i;
+
+ for (i = 0; i < transform_feedback_info->num_varyings; ++i) {
+ yagl_free(transform_feedback_info->varyings[i].name);
+ }
+ yagl_free(transform_feedback_info->varyings);
+
+ memset(transform_feedback_info, 0, sizeof(*transform_feedback_info));
+}
+
+struct yagl_gles2_program *yagl_gles2_program_create(int gen_locations)
+{
+ struct yagl_gles2_program *program;
+
+ program = yagl_malloc0(sizeof(*program));
+
+ yagl_object_init(&program->base, &yagl_gles2_program_destroy);
+
+ program->is_shader = 0;
+ program->gen_locations = gen_locations;
+ program->global_name = yagl_get_global_name();
+
+ if (gen_locations) {
+ yagl_vector_init(&program->uniform_locations_v,
+ sizeof(struct yagl_gles2_location_v),
+ 0);
+ } else {
+ yagl_list_init(&program->uniform_locations_l);
+ }
+
+ yagl_list_init(&program->attrib_locations);
+ yagl_list_init(&program->frag_data_locations);
+
+ program->transform_feedback_info.buffer_mode = GL_INTERLEAVED_ATTRIBS;
+
+ yagl_host_glCreateProgram(program->global_name);
+
+ return program;
+}
+
+int yagl_gles2_program_attach_shader(struct yagl_gles2_program *program,
+ struct yagl_gles2_shader *shader)
+{
+ switch (shader->type) {
+ case GL_VERTEX_SHADER:
+ if (program->vertex_shader) {
+ return 0;
+ }
+ yagl_gles2_shader_acquire(shader);
+ program->vertex_shader = shader;
+ break;
+ case GL_FRAGMENT_SHADER:
+ if (program->fragment_shader) {
+ return 0;
+ }
+ yagl_gles2_shader_acquire(shader);
+ program->fragment_shader = shader;
+ break;
+ default:
+ return 0;
+ }
+
+ yagl_host_glAttachShader(program->global_name,
+ shader->global_name);
+
+ return 1;
+}
+
+int yagl_gles2_program_detach_shader(struct yagl_gles2_program *program,
+ struct yagl_gles2_shader *shader)
+{
+ if (program->vertex_shader == shader) {
+ yagl_gles2_shader_release(program->vertex_shader);
+ program->vertex_shader = NULL;
+ } else if (program->fragment_shader == shader) {
+ yagl_gles2_shader_release(program->fragment_shader);
+ program->fragment_shader = NULL;
+ } else {
+ return 0;
+ }
+
+ yagl_host_glDetachShader(program->global_name,
+ shader->global_name);
+
+ return 1;
+}
+
+void yagl_gles2_program_link(struct yagl_gles2_program *program)
+{
+ GLint params[8];
+
+ memset(¶ms[0], 0, sizeof(params));
+
+ yagl_gles2_program_reset_cached(program);
+
+ yagl_host_glLinkProgram(program->global_name,
+ params,
+ sizeof(params)/sizeof(params[0]),
+ NULL);
+
+ program->linked = 1;
+
+ program->link_status = params[0];
+ program->info_log_length = params[1];
+ program->num_active_attribs = params[2];
+ program->max_active_attrib_bufsize = params[3];
+ program->num_active_uniforms = params[4];
+ program->max_active_uniform_bufsize = params[5];
+ program->num_active_uniform_blocks = params[6];
+ program->max_active_uniform_block_bufsize = params[7];
+
+ if (program->num_active_attribs > 0) {
+ program->active_attribs = yagl_malloc0(program->num_active_attribs *
+ sizeof(program->active_attribs[0]));
+ }
+
+ if (program->num_active_uniforms) {
+ program->active_uniforms = yagl_malloc0(program->num_active_uniforms *
+ sizeof(program->active_uniforms[0]));
+ }
+
+ if (program->num_active_uniform_blocks) {
+ program->active_uniform_blocks = yagl_malloc0(program->num_active_uniform_blocks *
+ sizeof(program->active_uniform_blocks[0]));
+ }
+
+ yagl_gles2_transform_feedback_info_copy(
+ &program->transform_feedback_info,
+ &program->linked_transform_feedback_info);
+}
+
+int yagl_gles2_program_get_uniform_location(struct yagl_gles2_program *program,
+ const GLchar *name)
+{
+ int ret = 0;
+
+ if (program->gen_locations) {
+ struct yagl_gles2_location_v *locations =
+ yagl_vector_data(&program->uniform_locations_v);
+ int i;
+ struct yagl_gles2_location_v location;
+
+ for (i = 0; i < yagl_vector_size(&program->uniform_locations_v); ++i) {
+ if (strcmp(locations[i].name, name) == 0) {
+ return i;
+ }
+ }
+
+ location.name = strdup(name);
+ location.global_location = yagl_gen_location();
+
+ yagl_vector_push_back(&program->uniform_locations_v, &location);
+
+ yagl_host_glGenUniformLocationYAGL(location.global_location,
+ program->global_name,
+ name,
+ yagl_transport_string_count(name));
+
+ ret = yagl_vector_size(&program->uniform_locations_v) - 1;
+ } else {
+ struct yagl_gles2_location_l *location;
+
+ yagl_list_for_each(struct yagl_gles2_location_l,
+ location,
+ &program->uniform_locations_l, list) {
+ if (strcmp(location->name, name) == 0) {
+ return location->location;
+ }
+ }
+
+ ret = yagl_host_glGetUniformLocation(program->global_name,
+ name,
+ yagl_transport_string_count(name));
+
+ location = yagl_malloc(sizeof(*location));
+
+ yagl_list_init(&location->list);
+ location->name = strdup(name);
+ location->location = ret;
+
+ yagl_list_add_tail(&program->uniform_locations_l, &location->list);
+ }
+
+ return ret;
+}
+
+int yagl_gles2_program_get_attrib_location(struct yagl_gles2_program *program,
+ const GLchar *name)
+{
+ struct yagl_gles2_location_l *location;
+ int ret;
+
+ yagl_list_for_each(struct yagl_gles2_location_l,
+ location,
+ &program->attrib_locations, list) {
+ if (strcmp(location->name, name) == 0) {
+ return location->location;
+ }
+ }
+
+ ret = yagl_host_glGetAttribLocation(program->global_name,
+ name,
+ yagl_transport_string_count(name));
+
+ location = yagl_malloc(sizeof(*location));
+
+ yagl_list_init(&location->list);
+ location->name = strdup(name);
+ location->location = ret;
+
+ yagl_list_add_tail(&program->attrib_locations, &location->list);
+
+ return ret;
+}
+
+void yagl_gles2_program_get_active_uniform(struct yagl_gles2_program *program,
+ GLuint index,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name)
+{
+ struct yagl_gles2_uniform_variable *var;
+
+ YAGL_LOG_FUNC_SET(yagl_gles2_program_get_active_uniform);
+
+ if (index >= program->num_active_uniforms) {
+ assert(0);
+ return;
+ }
+
+ var = &program->active_uniforms[index];
+
+ if (!var->generic_fetched) {
+ yagl_free(var->name);
+ var->name = yagl_malloc(program->max_active_uniform_bufsize);
+ var->name[0] = '\0';
+
+ yagl_host_glGetActiveUniform(program->global_name,
+ index,
+ &var->size,
+ &var->type,
+ var->name,
+ program->max_active_uniform_bufsize,
+ &var->name_size);
+
+ var->name_fetched = 1;
+ var->generic_fetched = 1;
+ }
+
+ yagl_gles2_set_name(var->name, var->name_size,
+ bufsize,
+ length,
+ name);
+
+ if (size) {
+ *size = var->size;
+ }
+
+ if (type) {
+ *type = var->type;
+ }
+
+ YAGL_LOG_DEBUG("Got uniform variable at index %u: name = %s, size = %d, type = 0x%X",
+ index,
+ ((bufsize > 0) ? name : NULL),
+ var->size,
+ var->type);
+}
+
+void yagl_gles2_program_get_active_attrib(struct yagl_gles2_program *program,
+ GLuint index,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name)
+{
+ struct yagl_gles2_attrib_variable *var;
+
+ YAGL_LOG_FUNC_SET(yagl_gles2_program_get_active_attrib);
+
+ if (index >= program->num_active_attribs) {
+ assert(0);
+ return;
+ }
+
+ var = &program->active_attribs[index];
+
+ if (!var->fetched) {
+ yagl_free(var->name);
+ var->name = yagl_malloc(program->max_active_attrib_bufsize);
+ var->name[0] = '\0';
+
+ yagl_host_glGetActiveAttrib(program->global_name,
+ index,
+ &var->size,
+ &var->type,
+ var->name,
+ program->max_active_attrib_bufsize,
+ &var->name_size);
+
+ var->fetched = 1;
+ }
+
+ yagl_gles2_set_name(var->name, var->name_size,
+ bufsize,
+ length,
+ name);
+
+ if (size) {
+ *size = var->size;
+ }
+
+ if (type) {
+ *type = var->type;
+ }
+
+ YAGL_LOG_DEBUG("Got attrib variable at index %u: name = %s, size = %d, type = 0x%X",
+ index,
+ ((bufsize > 0) ? name : NULL),
+ var->size,
+ var->type);
+}
+
+int yagl_gles2_program_get_uniformfv(struct yagl_gles2_program *program,
+ GLint location,
+ GLfloat *params)
+{
+ uint32_t global_location;
+ GLfloat tmp[100]; // This fits all cases.
+ int32_t num = 0;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glGetUniformfv(program->gen_locations,
+ program->global_name,
+ global_location,
+ tmp,
+ sizeof(tmp)/sizeof(tmp[0]),
+ &num);
+
+ if (params) {
+ memcpy(params, tmp, num * sizeof(tmp[0]));
+ }
+
+ return 1;
+}
+
+int yagl_gles2_program_get_uniformiv(struct yagl_gles2_program *program,
+ GLint location,
+ GLint *params)
+{
+ uint32_t global_location;
+ GLint tmp[100]; // This fits all cases.
+ int32_t num = 0;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glGetUniformiv(program->gen_locations,
+ program->global_name,
+ global_location,
+ tmp,
+ sizeof(tmp)/sizeof(tmp[0]),
+ &num);
+
+ if (params) {
+ memcpy(params, tmp, num * sizeof(tmp[0]));
+ }
+
+ return 1;
+}
+
+int yagl_gles2_program_uniform1f(struct yagl_gles2_program *program,
+ GLint location,
+ GLfloat x)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniform1f(program->gen_locations, global_location, x);
+
+ return 1;
+}
+
+int yagl_gles2_program_uniform1fv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *v)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniform1fv(program->gen_locations, global_location, v, count);
+
+ return 1;
+}
+
+int yagl_gles2_program_uniform1i(struct yagl_gles2_program *program,
+ GLint location,
+ GLint x)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniform1i(program->gen_locations, global_location, x);
+
+ return 1;
+}
+
+int yagl_gles2_program_uniform1iv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ const GLint *v)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniform1iv(program->gen_locations, global_location, v, count);
+
+ return 1;
+}
+
+int yagl_gles2_program_uniform2f(struct yagl_gles2_program *program,
+ GLint location,
+ GLfloat x,
+ GLfloat y)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniform2f(program->gen_locations, global_location, x, y);
+
+ return 1;
+}
+
+int yagl_gles2_program_uniform2fv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *v)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniform2fv(program->gen_locations, global_location, v, 2 * count);
+
+ return 1;
+}
+
+int yagl_gles2_program_uniform2i(struct yagl_gles2_program *program,
+ GLint location,
+ GLint x,
+ GLint y)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniform2i(program->gen_locations, global_location, x, y);
+
+ return 1;
+}
+
+int yagl_gles2_program_uniform2iv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ const GLint *v)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniform2iv(program->gen_locations, global_location, v, 2 * count);
+
+ return 1;
+}
+
+int yagl_gles2_program_uniform3f(struct yagl_gles2_program *program,
+ GLint location,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniform3f(program->gen_locations, global_location, x, y, z);
+
+ return 1;
+}
+
+int yagl_gles2_program_uniform3fv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *v)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniform3fv(program->gen_locations, global_location, v, 3 * count);
+
+ return 1;
+}
+
+int yagl_gles2_program_uniform3i(struct yagl_gles2_program *program,
+ GLint location,
+ GLint x,
+ GLint y,
+ GLint z)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniform3i(program->gen_locations, global_location, x, y, z);
+
+ return 1;
+}
+
+int yagl_gles2_program_uniform3iv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ const GLint *v)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniform3iv(program->gen_locations, global_location, v, 3 * count);
+
+ return 1;
+}
+
+int yagl_gles2_program_uniform4f(struct yagl_gles2_program *program,
+ GLint location,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z,
+ GLfloat w)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniform4f(program->gen_locations, global_location, x, y, z, w);
+
+ return 1;
+}
+
+int yagl_gles2_program_uniform4fv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *v)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniform4fv(program->gen_locations, global_location, v, 4 * count);
+
+ return 1;
+}
+
+int yagl_gles2_program_uniform4i(struct yagl_gles2_program *program,
+ GLint location,
+ GLint x,
+ GLint y,
+ GLint z,
+ GLint w)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniform4i(program->gen_locations, global_location, x, y, z, w);
+
+ return 1;
+}
+
+int yagl_gles2_program_uniform4iv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ const GLint *v)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniform4iv(program->gen_locations, global_location, v, 4 * count);
+
+ return 1;
+}
+
+int yagl_gles2_program_uniform_matrix2fv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniformMatrix2fv(program->gen_locations, global_location, transpose, value, 2 * 2 * count);
+
+ return 1;
+}
+
+int yagl_gles2_program_uniform_matrix3fv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniformMatrix3fv(program->gen_locations, global_location, transpose, value, 3 * 3 * count);
+
+ return 1;
+}
+
+int yagl_gles2_program_uniform_matrix4fv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniformMatrix4fv(program->gen_locations, global_location, transpose, value, 4 * 4 * count);
+
+ return 1;
+}
+
+void yagl_gles2_program_acquire(struct yagl_gles2_program *program)
+{
+ if (program) {
+ yagl_object_acquire(&program->base);
+ }
+}
+
+void yagl_gles2_program_release(struct yagl_gles2_program *program)
+{
+ if (program) {
+ yagl_object_release(&program->base);
+ }
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES2_PROGRAM_H_
+#define _YAGL_GLES2_PROGRAM_H_
+
+#include "yagl_types.h"
+#include "yagl_object.h"
+#include "yagl_list.h"
+#include "yagl_vector.h"
+
+struct yagl_gles2_shader;
+
+struct yagl_gles2_location_l
+{
+ struct yagl_list list;
+
+ int location;
+
+ GLchar *name;
+};
+
+struct yagl_gles2_attrib_variable
+{
+ int fetched;
+
+ GLchar *name;
+
+ GLint name_size;
+
+ GLenum type;
+ GLint size;
+};
+
+struct yagl_gles2_uniform_variable
+{
+ int name_fetched;
+ int generic_fetched;
+ int extended_fetched;
+
+ /*
+ * Common parameters, present when
+ * 'name_fetched', 'generic_fetched' or 'extended_fetched' is true.
+ * @{
+ */
+ GLint name_size;
+ /*
+ * @}
+ */
+
+ /*
+ * Common parameters, present when
+ * 'generic_fetched' or 'extended_fetched' is true.
+ * @{
+ */
+ GLenum type;
+ GLint size;
+ /*
+ * @}
+ */
+
+ /*
+ * 'name_fetched' or 'generic_fetched'.
+ * @{
+ */
+ GLchar *name;
+ /*
+ * @}
+ */
+
+ /*
+ * 'extended_fetched'.
+ * @{
+ */
+ GLint block_index;
+ GLint block_offset;
+ GLint array_stride;
+ GLint matrix_stride;
+ GLint is_row_major;
+ /*
+ * @}
+ */
+};
+
+struct yagl_gles2_uniform_block
+{
+ int name_fetched;
+ int params_fetched;
+
+ GLuint binding;
+
+ /*
+ * Present when 'name_fetched' or 'params_fetched' is true.
+ * @{
+ */
+ GLint name_size;
+ /*
+ * @}
+ */
+
+ /*
+ * 'name_fetched'.
+ * @{
+ */
+ GLchar *name;
+ /*
+ * @}
+ */
+
+ /*
+ * 'params_fetched'.
+ * @{
+ */
+ GLuint num_active_uniform_indices;
+ GLint data_size;
+ GLint referenced_by_vertex_shader;
+ GLint referenced_by_fragment_shader;
+ /*
+ * @}
+ */
+
+ GLuint *active_uniform_indices;
+};
+
+struct yagl_gles2_transform_feedback_varying
+{
+ /*
+ * Valid when struct yagl_gles2_transform_feedback_info::fetched is true.
+ * @{
+ */
+
+ /*
+ * These will be set on link and
+ * updated on fetch.
+ * @{
+ */
+ GLchar *name;
+ GLint name_size;
+ /*
+ * @}
+ */
+
+ GLenum type;
+ GLint size;
+
+ /*
+ * @}
+ */
+};
+
+struct yagl_gles2_transform_feedback_info
+{
+ int fetched;
+
+ struct yagl_gles2_transform_feedback_varying *varyings;
+ GLuint num_varyings;
+ GLenum buffer_mode;
+ GLint max_varying_bufsize;
+};
+
+struct yagl_gles2_program
+{
+ /*
+ * These members must be exactly as in yagl_gles2_shader
+ * @{
+ */
+ struct yagl_object base;
+
+ int is_shader;
+ /*
+ * @}
+ */
+
+ /*
+ * Generate uniform locations ourselves or vmexit
+ * and ask host.
+ */
+ int gen_locations;
+
+ yagl_object_name global_name;
+
+ struct yagl_gles2_shader *vertex_shader;
+
+ struct yagl_gles2_shader *fragment_shader;
+
+ union
+ {
+ struct yagl_list uniform_locations_l;
+ struct yagl_vector uniform_locations_v;
+ };
+
+ struct yagl_list attrib_locations;
+
+ struct yagl_list frag_data_locations;
+
+ struct yagl_gles2_attrib_variable *active_attribs;
+ GLuint num_active_attribs;
+ GLint max_active_attrib_bufsize;
+
+ struct yagl_gles2_uniform_variable *active_uniforms;
+ GLuint num_active_uniforms;
+ GLint max_active_uniform_bufsize;
+
+ struct yagl_gles2_uniform_block *active_uniform_blocks;
+ GLuint num_active_uniform_blocks;
+ GLint max_active_uniform_block_bufsize;
+
+ /*
+ * Transform feedback info specified via glTransformFeedbackVaryings.
+ */
+ struct yagl_gles2_transform_feedback_info transform_feedback_info;
+
+ /*
+ * Actual transform feedback info after program link.
+ */
+ struct yagl_gles2_transform_feedback_info linked_transform_feedback_info;
+
+ int linked;
+
+ GLint link_status;
+ GLint info_log_length;
+};
+
+int yagl_gles2_program_translate_location(struct yagl_gles2_program *program,
+ GLint location,
+ uint32_t *global_location);
+
+void yagl_gles2_transform_feedback_info_reset(
+ struct yagl_gles2_transform_feedback_info *transform_feedback_info);
+
+struct yagl_gles2_program *yagl_gles2_program_create(int gen_locations);
+
+int yagl_gles2_program_attach_shader(struct yagl_gles2_program *program,
+ struct yagl_gles2_shader *shader);
+
+int yagl_gles2_program_detach_shader(struct yagl_gles2_program *program,
+ struct yagl_gles2_shader *shader);
+
+void yagl_gles2_program_link(struct yagl_gles2_program *program);
+
+int yagl_gles2_program_get_uniform_location(struct yagl_gles2_program *program,
+ const GLchar *name);
+
+int yagl_gles2_program_get_attrib_location(struct yagl_gles2_program *program,
+ const GLchar *name);
+
+void yagl_gles2_program_get_active_uniform(struct yagl_gles2_program *program,
+ GLuint index,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name);
+
+void yagl_gles2_program_get_active_attrib(struct yagl_gles2_program *program,
+ GLuint index,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLint *size,
+ GLenum *type,
+ GLchar *name);
+
+int yagl_gles2_program_get_uniformfv(struct yagl_gles2_program *program,
+ GLint location,
+ GLfloat *params);
+
+int yagl_gles2_program_get_uniformiv(struct yagl_gles2_program *program,
+ GLint location,
+ GLint *params);
+
+int yagl_gles2_program_uniform1f(struct yagl_gles2_program *program,
+ GLint location,
+ GLfloat x);
+
+int yagl_gles2_program_uniform1fv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *v);
+
+int yagl_gles2_program_uniform1i(struct yagl_gles2_program *program,
+ GLint location,
+ GLint x);
+
+int yagl_gles2_program_uniform1iv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ const GLint *v);
+
+int yagl_gles2_program_uniform2f(struct yagl_gles2_program *program,
+ GLint location,
+ GLfloat x,
+ GLfloat y);
+
+int yagl_gles2_program_uniform2fv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *v);
+
+int yagl_gles2_program_uniform2i(struct yagl_gles2_program *program,
+ GLint location,
+ GLint x,
+ GLint y);
+
+int yagl_gles2_program_uniform2iv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ const GLint *v);
+
+int yagl_gles2_program_uniform3f(struct yagl_gles2_program *program,
+ GLint location,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z);
+
+int yagl_gles2_program_uniform3fv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *v);
+
+int yagl_gles2_program_uniform3i(struct yagl_gles2_program *program,
+ GLint location,
+ GLint x,
+ GLint y,
+ GLint z);
+
+int yagl_gles2_program_uniform3iv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ const GLint *v);
+
+int yagl_gles2_program_uniform4f(struct yagl_gles2_program *program,
+ GLint location,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z,
+ GLfloat w);
+
+int yagl_gles2_program_uniform4fv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ const GLfloat *v);
+
+int yagl_gles2_program_uniform4i(struct yagl_gles2_program *program,
+ GLint location,
+ GLint x,
+ GLint y,
+ GLint z,
+ GLint w);
+
+int yagl_gles2_program_uniform4iv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ const GLint *v);
+
+int yagl_gles2_program_uniform_matrix2fv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+
+int yagl_gles2_program_uniform_matrix3fv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+
+int yagl_gles2_program_uniform_matrix4fv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_gles2_program_acquire(struct yagl_gles2_program *program);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_gles2_program_release(struct yagl_gles2_program *program);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GLES2/gl2.h"
+#include "yagl_gles2_shader.h"
+#include "yagl_malloc.h"
+#include "yagl_state.h"
+#include "yagl_host_gles_calls.h"
+
+static void yagl_gles2_shader_destroy(struct yagl_ref *ref)
+{
+ struct yagl_gles2_shader *shader = (struct yagl_gles2_shader*)ref;
+
+ yagl_free(shader->source);
+
+ yagl_host_glDeleteObjects(&shader->global_name, 1);
+
+ yagl_object_cleanup(&shader->base);
+
+ yagl_free(shader);
+}
+
+struct yagl_gles2_shader *yagl_gles2_shader_create(GLenum type)
+{
+ struct yagl_gles2_shader *shader;
+
+ shader = yagl_malloc0(sizeof(*shader));
+
+ yagl_object_init(&shader->base, &yagl_gles2_shader_destroy);
+
+ shader->is_shader = 1;
+ shader->global_name = yagl_get_global_name();
+ shader->type = type;
+
+ yagl_host_glCreateShader(shader->global_name, type);
+
+ return shader;
+}
+
+void yagl_gles2_shader_source(struct yagl_gles2_shader *shader,
+ GLchar *source,
+ const GLchar *patched_source,
+ int patched_len)
+{
+ yagl_host_glShaderSource(shader->global_name,
+ patched_source,
+ patched_len + 1);
+
+ yagl_free(shader->source);
+ shader->source = source;
+}
+
+void yagl_gles2_shader_acquire(struct yagl_gles2_shader *shader)
+{
+ if (shader) {
+ yagl_object_acquire(&shader->base);
+ }
+}
+
+void yagl_gles2_shader_release(struct yagl_gles2_shader *shader)
+{
+ if (shader) {
+ yagl_object_release(&shader->base);
+ }
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES2_SHADER_H_
+#define _YAGL_GLES2_SHADER_H_
+
+#include "yagl_types.h"
+#include "yagl_object.h"
+
+/*
+ * Programs and shaders share the same namespace,
+ * pretty clumsy!
+ */
+#define YAGL_NS_SHADER_PROGRAM 3
+
+struct yagl_gles2_shader
+{
+ /*
+ * These members must be exactly as in yagl_gles2_program
+ * @{
+ */
+ struct yagl_object base;
+
+ int is_shader;
+ /*
+ * @}
+ */
+
+ yagl_object_name global_name;
+
+ GLenum type;
+
+ GLchar *source;
+};
+
+struct yagl_gles2_shader *yagl_gles2_shader_create(GLenum type);
+
+/*
+ * Takes ownership of 'source'.
+ */
+void yagl_gles2_shader_source(struct yagl_gles2_shader *shader,
+ GLchar *source,
+ const GLchar *patched_source,
+ int patched_len);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_gles2_shader_acquire(struct yagl_gles2_shader *shader);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_gles2_shader_release(struct yagl_gles2_shader *shader);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GLES2/gl2.h"
+#include "yagl_gles2_utils.h"
+#include <string.h>
+
+void yagl_gles2_set_name(const GLchar *from, GLint from_size,
+ GLint bufsize,
+ GLint *length,
+ GLchar *name)
+{
+ GLint tmp_length;
+
+ if (bufsize < 0) {
+ bufsize = 0;
+ }
+
+ tmp_length = (bufsize <= from_size) ? bufsize : from_size;
+
+ if (tmp_length > 0) {
+ strncpy(name, from, tmp_length);
+ name[tmp_length - 1] = '\0';
+ --tmp_length;
+ } else if (bufsize > 0) {
+ name[0] = '\0';
+ }
+
+ if (length) {
+ *length = tmp_length;
+ }
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES2_UTILS_H_
+#define _YAGL_GLES2_UTILS_H_
+
+#include "yagl_types.h"
+
+void yagl_gles2_set_name(const GLchar *from, GLint from_size,
+ GLint bufsize,
+ GLint *length,
+ GLchar *name);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GLES3/gl3.h"
+#include "yagl_gles2_validate.h"
+
+int yagl_gles2_is_shader_type_valid(GLenum type)
+{
+ switch (type) {
+ case GL_VERTEX_SHADER:
+ case GL_FRAGMENT_SHADER:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+int yagl_gles2_is_texture_target_layered(GLenum target)
+{
+ switch (target) {
+ case GL_TEXTURE_2D_ARRAY:
+ case GL_TEXTURE_3D:
+ return 1;
+ default:
+ return 0;
+ }
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES2_VALIDATE_H_
+#define _YAGL_GLES2_VALIDATE_H_
+
+#include "yagl_gles_types.h"
+
+int yagl_gles2_is_shader_type_valid(GLenum type);
+
+int yagl_gles2_is_texture_target_layered(GLenum target);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GLES3/gl3.h"
+#include "yagl_gles3_buffer_binding.h"
+#include "yagl_gles_buffer.h"
+#include "yagl_host_gles_calls.h"
+#include <assert.h>
+
+static int yagl_gles3_buffer_binding_fixup(struct yagl_gles3_buffer_binding *buffer_binding,
+ GLint *offset,
+ GLsizei *size)
+{
+ *offset = buffer_binding->offset;
+ *size = buffer_binding->size;
+
+ if (*offset < 0) {
+ *size += *offset;
+ *offset = 0;
+ }
+
+ if ((*offset >= buffer_binding->buffer->size) || (*size <= 0)) {
+ return 0;
+ }
+
+ if ((*offset + *size) > buffer_binding->buffer->size) {
+ *size = buffer_binding->buffer->size - *offset;
+ }
+
+ return 1;
+}
+
+void yagl_gles3_buffer_binding_init(struct yagl_gles3_buffer_binding *buffer_binding,
+ GLenum target,
+ GLuint index)
+{
+ buffer_binding->target = target;
+ buffer_binding->index = index;
+ yagl_list_init(&buffer_binding->list);
+}
+
+void yagl_gles3_buffer_binding_reset(struct yagl_gles3_buffer_binding *buffer_binding)
+{
+ yagl_gles_buffer_release(buffer_binding->buffer);
+ yagl_list_remove(&buffer_binding->list);
+ buffer_binding->buffer = NULL;
+ buffer_binding->entire = 0;
+ buffer_binding->offset = 0;
+ buffer_binding->size = 0;
+}
+
+void yagl_gles3_buffer_binding_set_base(struct yagl_gles3_buffer_binding *buffer_binding,
+ struct yagl_gles_buffer *buffer)
+{
+ yagl_gles_buffer_acquire(buffer);
+ yagl_gles3_buffer_binding_reset(buffer_binding);
+ if (buffer) {
+ buffer_binding->buffer = buffer;
+ buffer_binding->entire = 1;
+ }
+}
+
+void yagl_gles3_buffer_binding_set_range(struct yagl_gles3_buffer_binding *buffer_binding,
+ struct yagl_gles_buffer *buffer,
+ GLintptr offset,
+ GLsizeiptr size)
+{
+ yagl_gles_buffer_acquire(buffer);
+ yagl_gles3_buffer_binding_reset(buffer_binding);
+ if (buffer) {
+ buffer_binding->buffer = buffer;
+ buffer_binding->offset = offset;
+ buffer_binding->size = size;
+ }
+}
+
+void yagl_gles3_buffer_binding_transfer_begin(struct yagl_gles3_buffer_binding *buffer_binding)
+{
+ GLint offset;
+ GLsizei size;
+
+ assert(buffer_binding->buffer);
+ if (!buffer_binding->buffer) {
+ return;
+ }
+
+ if (buffer_binding->buffer->size <= 0) {
+ return;
+ }
+
+ if (yagl_gles_buffer_is_cpu_dirty(buffer_binding->buffer, 0, 0)) {
+ yagl_gles_buffer_bind(buffer_binding->buffer, 0, 0,
+ buffer_binding->target);
+ yagl_gles_buffer_transfer(buffer_binding->buffer, 0,
+ buffer_binding->target, 0);
+ }
+
+ if (buffer_binding->entire) {
+ yagl_host_glBindBufferBase(buffer_binding->target,
+ buffer_binding->index,
+ buffer_binding->buffer->default_part.global_name);
+ } else {
+ if (!yagl_gles3_buffer_binding_fixup(buffer_binding,
+ &offset,
+ &size)) {
+ return;
+ }
+
+ yagl_host_glBindBufferRange(buffer_binding->target,
+ buffer_binding->index,
+ buffer_binding->buffer->default_part.global_name,
+ offset, size);
+ }
+}
+
+void yagl_gles3_buffer_binding_transfer_end(struct yagl_gles3_buffer_binding *buffer_binding)
+{
+ yagl_host_glBindBufferBase(buffer_binding->target,
+ buffer_binding->index,
+ 0);
+}
+
+void yagl_gles3_buffer_binding_set_gpu_dirty(struct yagl_gles3_buffer_binding *buffer_binding)
+{
+ GLint offset;
+ GLsizei size;
+
+ assert(buffer_binding->buffer);
+ if (!buffer_binding->buffer) {
+ return;
+ }
+
+ if (buffer_binding->entire) {
+ yagl_gles_buffer_set_gpu_dirty(buffer_binding->buffer,
+ 0,
+ buffer_binding->buffer->size);
+ } else if (yagl_gles3_buffer_binding_fixup(buffer_binding,
+ &offset,
+ &size)) {
+ yagl_gles_buffer_set_gpu_dirty(buffer_binding->buffer,
+ offset,
+ size);
+ }
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES3_BUFFER_BINDING_H_
+#define _YAGL_GLES3_BUFFER_BINDING_H_
+
+#include "yagl_gles_types.h"
+#include "yagl_list.h"
+
+struct yagl_gles_buffer;
+
+struct yagl_gles3_buffer_binding
+{
+ struct yagl_list list;
+ GLenum target;
+ GLuint index;
+
+ struct yagl_gles_buffer *buffer;
+
+ int entire;
+
+ GLintptr offset;
+ GLsizeiptr size;
+};
+
+void yagl_gles3_buffer_binding_init(struct yagl_gles3_buffer_binding *buffer_binding,
+ GLenum target,
+ GLuint index);
+
+void yagl_gles3_buffer_binding_reset(struct yagl_gles3_buffer_binding *buffer_binding);
+
+void yagl_gles3_buffer_binding_set_base(struct yagl_gles3_buffer_binding *buffer_binding,
+ struct yagl_gles_buffer *buffer);
+
+void yagl_gles3_buffer_binding_set_range(struct yagl_gles3_buffer_binding *buffer_binding,
+ struct yagl_gles_buffer *buffer,
+ GLintptr offset,
+ GLsizeiptr size);
+
+void yagl_gles3_buffer_binding_transfer_begin(struct yagl_gles3_buffer_binding *buffer_binding);
+
+void yagl_gles3_buffer_binding_transfer_end(struct yagl_gles3_buffer_binding *buffer_binding);
+
+void yagl_gles3_buffer_binding_set_gpu_dirty(struct yagl_gles3_buffer_binding *buffer_binding);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GLES3/gl3.h"
+#include "yagl_host_gles_calls.h"
+#include "yagl_gles3_context.h"
+#include "yagl_gles3_program.h"
+#include "yagl_gles3_transform_feedback.h"
+#include "yagl_gles3_buffer_binding.h"
+#include "yagl_gles3_query.h"
+#include "yagl_gles3_sync.h"
+#include "yagl_gles3_validate.h"
+#include "yagl_gles2_shader.h"
+#include "yagl_gles2_validate.h"
+#include "yagl_gles_buffer.h"
+#include "yagl_gles_texture.h"
+#include "yagl_gles_framebuffer.h"
+#include "yagl_gles_renderbuffer.h"
+#include "yagl_gles_sampler.h"
+#include "yagl_gles_vertex_array.h"
+#include "yagl_gles_array.h"
+#include "yagl_gles_validate.h"
+#include "yagl_sharegroup.h"
+#include "yagl_log.h"
+#include "yagl_impl.h"
+#include "yagl_malloc.h"
+#include "yagl_transport.h"
+#include "yagl_state.h"
+#include "yagl_render.h"
+#include "yagl_egl_fence.h"
+#include "yagl_utils.h"
+
+#define YAGL_SET_ERR(err) \
+ yagl_gles_context_set_error(&ctx->base.base, err); \
+ YAGL_LOG_ERROR("error = 0x%X", err)
+
+#define YAGL_GET_CTX_IMPL(ret_expr) \
+ struct yagl_gles3_context *ctx = \
+ (struct yagl_gles3_context*)yagl_get_client_context(); \
+ if (!ctx || ((ctx->base.base.base.client_api & yagl_client_api_gles3) == 0)) { \
+ YAGL_LOG_WARN("no current context"); \
+ YAGL_LOG_FUNC_EXIT(NULL); \
+ ret_expr; \
+ }
+
+#define YAGL_GET_CTX_RET(ret) YAGL_GET_CTX_IMPL(return ret)
+
+#define YAGL_GET_CTX() YAGL_GET_CTX_IMPL(return)
+
+YAGL_API void glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments)
+{
+ struct yagl_gles_framebuffer *framebuffer_obj = NULL;
+ GLsizei i;
+ yagl_gles_framebuffer_attachment framebuffer_attachment;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glInvalidateFramebuffer, GLenum, GLsizei, const GLenum*, target, numAttachments, attachments);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles_context_acquire_binded_framebuffer(&ctx->base.base,
+ target,
+ &framebuffer_obj)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ for (i = 0; i < numAttachments; ++i) {
+ if (framebuffer_obj) {
+ if ((attachments[i] != GL_DEPTH_STENCIL_ATTACHMENT) &&
+ !yagl_gles_validate_framebuffer_attachment(attachments[i],
+ ctx->base.base.max_color_attachments,
+ &framebuffer_attachment)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+ } else {
+ switch (attachments[i]) {
+ case GL_COLOR:
+ case GL_DEPTH:
+ case GL_STENCIL:
+ break;
+ default:
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+ }
+ }
+
+out:
+ yagl_gles_framebuffer_release(framebuffer_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT7(glInvalidateSubFramebuffer, GLenum, GLsizei, const GLenum*, GLint, GLint, GLsizei, GLsizei, target, numAttachments, attachments, x, y, width, height);
+
+ YAGL_GET_CTX();
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
+{
+ struct yagl_gles_buffer *buffer_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glBindBufferBase, GLenum, GLuint, GLuint, target, index, buffer);
+
+ YAGL_GET_CTX();
+
+ if (buffer != 0) {
+ buffer_obj = (struct yagl_gles_buffer*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_BUFFER, buffer);
+
+ if (!buffer_obj) {
+ buffer_obj = yagl_gles_buffer_create();
+
+ if (!buffer_obj) {
+ goto out;
+ }
+
+ buffer_obj = (struct yagl_gles_buffer*)yagl_sharegroup_add_named(ctx->base.sg,
+ YAGL_NS_BUFFER, buffer, &buffer_obj->base);
+ }
+ }
+
+ yagl_gles3_context_bind_buffer_base(ctx, target, index, buffer_obj);
+
+out:
+ yagl_gles_buffer_release(buffer_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glBindBufferRange(GLenum target, GLuint index, GLuint buffer,
+ GLintptr offset, GLsizeiptr size)
+{
+ struct yagl_gles_buffer *buffer_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glBindBufferRange, GLenum, GLuint, GLuint, GLintptr, GLsizeiptr, target, index, buffer, offset, size);
+
+ YAGL_GET_CTX();
+
+ if (buffer != 0) {
+ buffer_obj = (struct yagl_gles_buffer*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_BUFFER, buffer);
+
+ if (!buffer_obj) {
+ buffer_obj = yagl_gles_buffer_create();
+
+ if (!buffer_obj) {
+ goto out;
+ }
+
+ buffer_obj = (struct yagl_gles_buffer*)yagl_sharegroup_add_named(ctx->base.sg,
+ YAGL_NS_BUFFER, buffer, &buffer_obj->base);
+ }
+ }
+
+ yagl_gles3_context_bind_buffer_range(ctx, target, index, offset, size,
+ buffer_obj);
+
+out:
+ yagl_gles_buffer_release(buffer_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API GLuint glGetUniformBlockIndex(GLuint program,
+ const GLchar *uniformBlockName)
+{
+ struct yagl_gles2_program *program_obj = NULL;
+ GLuint index = GL_INVALID_INDEX;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glGetUniformBlockIndex, GLuint, const GLchar*, program, uniformBlockName);
+
+ YAGL_GET_CTX_RET(GL_INVALID_INDEX);
+
+ program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_SHADER_PROGRAM, program);
+
+ if (!program_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (program_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!program_obj->linked) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ index = yagl_gles3_program_get_uniform_block_index(program_obj,
+ uniformBlockName);
+
+out:
+ yagl_gles2_program_release(program_obj);
+
+ YAGL_LOG_FUNC_EXIT("%u", index);
+
+ return index;
+}
+
+YAGL_API void glGetUniformIndices(GLuint program, GLsizei uniformCount,
+ const GLchar *const *uniformNames,
+ GLuint *uniformIndices)
+{
+ struct yagl_gles2_program *program_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glGetUniformIndices, GLuint, GLsizei, const GLchar* const*, GLuint*, program, uniformCount, uniformNames, uniformIndices);
+
+ YAGL_GET_CTX();
+
+ program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_SHADER_PROGRAM, program);
+
+ if (!program_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (program_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (uniformCount < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ yagl_gles3_program_get_uniform_indices(program_obj,
+ uniformNames,
+ uniformCount,
+ uniformIndices);
+
+out:
+ yagl_gles2_program_release(program_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetActiveUniformsiv(GLuint program, GLsizei uniformCount,
+ const GLuint *uniformIndices,
+ GLenum pname, GLint *params)
+{
+ struct yagl_gles2_program *program_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glGetActiveUniformsiv, GLuint, GLsizei, const GLuint*, GLenum, GLint*, program, uniformCount, uniformIndices, pname, params);
+
+ YAGL_GET_CTX();
+
+ program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_SHADER_PROGRAM, program);
+
+ if (!program_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (program_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles3_is_uniform_param_valid(pname)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (uniformCount > program_obj->num_active_uniforms) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (!yagl_gles3_program_get_active_uniformsiv(program_obj, uniformIndices, uniformCount, pname, params)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+out:
+ yagl_gles2_program_release(program_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex,
+ GLuint uniformBlockBinding)
+{
+ struct yagl_gles2_program *program_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glUniformBlockBinding, GLuint, GLuint, GLuint, program, uniformBlockIndex, uniformBlockBinding);
+
+ YAGL_GET_CTX();
+
+ program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_SHADER_PROGRAM, program);
+
+ if (!program_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (program_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (uniformBlockIndex >= program_obj->num_active_uniform_blocks) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (uniformBlockBinding >= ctx->num_uniform_buffer_bindings) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ yagl_gles3_program_set_uniform_block_binding(program_obj,
+ uniformBlockIndex,
+ uniformBlockBinding);
+
+out:
+ yagl_gles2_program_release(program_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetActiveUniformBlockName(GLuint program,
+ GLuint uniformBlockIndex,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLchar *uniformBlockName)
+{
+ struct yagl_gles2_program *program_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glGetActiveUniformBlockName, GLuint, GLuint, GLsizei, GLsizei*, GLchar*, program, uniformBlockIndex, bufSize, length, uniformBlockName);
+
+ YAGL_GET_CTX();
+
+ program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_SHADER_PROGRAM, program);
+
+ if (!program_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (program_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (uniformBlockIndex >= program_obj->num_active_uniform_blocks) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ yagl_gles3_program_get_active_uniform_block_name(program_obj,
+ uniformBlockIndex,
+ bufSize,
+ length,
+ uniformBlockName);
+
+out:
+ yagl_gles2_program_release(program_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetActiveUniformBlockiv(GLuint program,
+ GLuint uniformBlockIndex,
+ GLenum pname, GLint *params)
+{
+ struct yagl_gles2_program *program_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glGetActiveUniformBlockiv, GLuint, GLuint, GLenum, GLint*, program, uniformBlockIndex, pname, params);
+
+ YAGL_GET_CTX();
+
+ program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_SHADER_PROGRAM, program);
+
+ if (!program_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (program_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (uniformBlockIndex >= program_obj->num_active_uniform_blocks) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (!yagl_gles3_program_get_active_uniform_blockiv(program_obj,
+ uniformBlockIndex,
+ pname,
+ params)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+out:
+ yagl_gles2_program_release(program_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGenTransformFeedbacks(GLsizei n, GLuint *ids)
+{
+ struct yagl_gles3_transform_feedback **transform_feedbacks = NULL;
+ GLsizei i;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glGenTransformFeedbacks, GLsizei, GLuint*, n, ids);
+
+ YAGL_GET_CTX();
+
+ if (n < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ transform_feedbacks = yagl_malloc0(n * sizeof(*transform_feedbacks));
+
+ for (i = 0; i < n; ++i) {
+ transform_feedbacks[i] =
+ yagl_gles3_transform_feedback_create(0,
+ ctx->max_transform_feedback_separate_attribs);
+
+ if (!transform_feedbacks[i]) {
+ goto out;
+ }
+ }
+
+ for (i = 0; i < n; ++i) {
+ yagl_namespace_add(&ctx->transform_feedbacks,
+ &transform_feedbacks[i]->base);
+
+ if (ids) {
+ ids[i] = transform_feedbacks[i]->base.local_name;
+ }
+ }
+
+out:
+ for (i = 0; i < n; ++i) {
+ yagl_gles3_transform_feedback_release(transform_feedbacks[i]);
+ }
+ yagl_free(transform_feedbacks);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glBindTransformFeedback(GLenum target, GLuint id)
+{
+ struct yagl_gles3_transform_feedback *tf = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glBindTransformFeedback, GLenum, GLuint, target, id);
+
+ YAGL_GET_CTX();
+
+ if (id != 0) {
+ tf = (struct yagl_gles3_transform_feedback*)yagl_namespace_acquire(&ctx->transform_feedbacks,
+ id);
+
+ if (!tf) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+ }
+
+ yagl_gles3_context_bind_transform_feedback(ctx, target, tf);
+
+out:
+ yagl_gles3_transform_feedback_release(tf);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glBeginTransformFeedback(GLenum primitiveMode)
+{
+ GLuint i, num_active_buffer_bindings;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glBeginTransformFeedback, GLenum, primitiveMode);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->base.program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ num_active_buffer_bindings = ctx->base.program->linked_transform_feedback_info.num_varyings;
+
+ if (num_active_buffer_bindings == 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles3_is_primitive_mode_valid(primitiveMode)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (ctx->tfo->active) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (ctx->base.program->linked_transform_feedback_info.buffer_mode == GL_INTERLEAVED_ATTRIBS) {
+ /*
+ * "In interleaved mode, only the first buffer object binding point is ever written to."
+ */
+ num_active_buffer_bindings = 1;
+ }
+
+ for (i = 0; i < num_active_buffer_bindings; ++i) {
+ if (!ctx->tfo->buffer_bindings[i].buffer) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+ }
+
+ yagl_gles3_transform_feedback_begin(ctx->tfo,
+ primitiveMode,
+ num_active_buffer_bindings);
+
+ ctx->tf_primitive_mode = primitiveMode;
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glEndTransformFeedback(void)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT0(glEndTransformFeedback);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->tfo->active) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ yagl_gles3_transform_feedback_end(ctx->tfo);
+
+ ctx->tf_primitive_mode = 0;
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glPauseTransformFeedback(void)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT0(glPauseTransformFeedback);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->tfo->active || ctx->tfo->paused) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ yagl_gles3_transform_feedback_pause(ctx->tfo);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glResumeTransformFeedback(void)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT0(glResumeTransformFeedback);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->tfo->active || !ctx->tfo->paused) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ yagl_gles3_transform_feedback_resume(ctx->tfo);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids)
+{
+ GLsizei i;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glDeleteTransformFeedbacks, GLsizei, const GLuint*, n, ids);
+
+ YAGL_GET_CTX();
+
+ if (n < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (ids) {
+ if (ctx->tfo->active) {
+ for (i = 0; i < n; ++i) {
+ if (ids[i] && (ctx->tfo->base.local_name == ids[i])) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+ }
+ }
+
+ for (i = 0; i < n; ++i) {
+ yagl_namespace_remove(&ctx->transform_feedbacks, ids[i]);
+ }
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API GLboolean glIsTransformFeedback(GLuint id)
+{
+ GLboolean res = GL_FALSE;
+ struct yagl_gles3_transform_feedback *tf = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glIsTransformFeedback, GLuint, id);
+
+ YAGL_GET_CTX_RET(GL_FALSE);
+
+ tf = (struct yagl_gles3_transform_feedback*)yagl_namespace_acquire(&ctx->transform_feedbacks,
+ id);
+
+ if (tf && yagl_gles3_transform_feedback_was_bound(tf)) {
+ res = GL_TRUE;
+ }
+
+ yagl_gles3_transform_feedback_release(tf);
+
+ YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, res);
+
+ return res;
+}
+
+YAGL_API void glTransformFeedbackVaryings(GLuint program,
+ GLsizei count,
+ const GLchar *const *varyings,
+ GLenum bufferMode)
+{
+ struct yagl_gles2_program *program_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glTransformFeedbackVaryings, GLuint, GLsizei, const GLchar* const*, GLenum, program, count, varyings, bufferMode);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles3_is_transform_feedback_buffer_mode_valid(bufferMode)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_SHADER_PROGRAM, program);
+
+ if (!program_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (program_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (count < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if ((bufferMode == GL_SEPARATE_ATTRIBS) &&
+ (count > ctx->max_transform_feedback_separate_attribs)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ yagl_gles3_program_set_transform_feedback_varyings(program_obj,
+ varyings,
+ count,
+ bufferMode);
+
+out:
+ yagl_gles2_program_release(program_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetTransformFeedbackVarying(GLuint program,
+ GLuint index,
+ GLsizei bufSize,
+ GLsizei *length,
+ GLsizei *size,
+ GLenum *type,
+ GLchar *name)
+{
+ struct yagl_gles2_program *program_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT7(glGetTransformFeedbackVarying, GLuint, GLuint, GLsizei, GLsizei*, GLsizei*, GLenum*, GLchar*, program, index, bufSize, length, size, type, name);
+
+ YAGL_GET_CTX();
+
+ program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_SHADER_PROGRAM, program);
+
+ if (!program_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (program_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!program_obj->linked) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (index >= program_obj->linked_transform_feedback_info.num_varyings) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ yagl_gles3_program_get_transform_feedback_varying(program_obj,
+ index,
+ bufSize,
+ length,
+ size,
+ type,
+ name);
+
+out:
+ yagl_gles2_program_release(program_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGenQueries(GLsizei n, GLuint *ids)
+{
+ struct yagl_gles3_query **queries = NULL;
+ GLsizei i;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glGenQueries, GLsizei, GLuint*, n, ids);
+
+ YAGL_GET_CTX();
+
+ if (n < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ queries = yagl_malloc0(n * sizeof(*queries));
+
+ for (i = 0; i < n; ++i) {
+ queries[i] = yagl_gles3_query_create();
+
+ if (!queries[i]) {
+ goto out;
+ }
+ }
+
+ for (i = 0; i < n; ++i) {
+ yagl_namespace_add(&ctx->queries, &queries[i]->base);
+
+ if (ids) {
+ ids[i] = queries[i]->base.local_name;
+ }
+ }
+
+out:
+ for (i = 0; i < n; ++i) {
+ yagl_gles3_query_release(queries[i]);
+ }
+ yagl_free(queries);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glDeleteQueries(GLsizei n, const GLuint *ids)
+{
+ GLsizei i;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glDeleteQueries, GLsizei, const GLuint*, n, ids);
+
+ YAGL_GET_CTX();
+
+ if (n < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (ids) {
+ for (i = 0; i < n; ++i) {
+ yagl_namespace_remove(&ctx->queries, ids[i]);
+ }
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glBeginQuery(GLenum target, GLuint id)
+{
+ struct yagl_gles3_query *query = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glBeginQuery, GLenum, GLuint, target, id);
+
+ YAGL_GET_CTX();
+
+ query = (struct yagl_gles3_query*)yagl_namespace_acquire(&ctx->queries, id);
+
+ if (!query) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ yagl_gles3_context_begin_query(ctx, target, query);
+
+out:
+ yagl_gles3_query_release(query);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glEndQuery(GLenum target)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glEndQuery, GLenum, target);
+
+ YAGL_GET_CTX();
+
+ yagl_gles3_context_end_query(ctx, target);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetQueryiv(GLenum target, GLenum pname, GLint *params)
+{
+ struct yagl_gles3_query *query = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetQueryiv, GLenum, GLenum, GLint*, target, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles3_context_acquire_active_query(ctx, target, &query)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ switch (pname) {
+ case GL_CURRENT_QUERY:
+ *params = query ? query->base.local_name : 0;
+ break;
+ default:
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+out:
+ yagl_gles3_query_release(query);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
+{
+ struct yagl_gles3_query *query = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetQueryObjectuiv, GLuint, GLenum, GLuint*, id, pname, params);
+
+ YAGL_GET_CTX();
+
+ query = (struct yagl_gles3_query*)yagl_namespace_acquire(&ctx->queries, id);
+
+ if (!query) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (query->active) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ switch (pname) {
+ case GL_QUERY_RESULT_AVAILABLE:
+ *params = yagl_gles3_query_is_result_available(query);
+ break;
+ case GL_QUERY_RESULT:
+ *params = yagl_gles3_query_get_result(query);
+ break;
+ default:
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+out:
+ yagl_gles3_query_release(query);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API GLboolean glIsQuery(GLuint id)
+{
+ GLboolean res = GL_FALSE;
+ struct yagl_gles3_query *query = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glIsQuery, GLuint, id);
+
+ YAGL_GET_CTX_RET(GL_FALSE);
+
+ query = (struct yagl_gles3_query*)yagl_namespace_acquire(&ctx->queries, id);
+
+ if (query && yagl_gles3_query_was_active(query)) {
+ res = GL_TRUE;
+ }
+
+ yagl_gles3_query_release(query);
+
+ YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, res);
+
+ return res;
+}
+
+YAGL_API void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
+{
+ struct yagl_gles_framebuffer *framebuffer_obj = NULL;
+ struct yagl_gles_texture *texture_obj = NULL;
+ yagl_gles_framebuffer_attachment framebuffer_attachment;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glFramebufferTextureLayer, GLenum, GLenum, GLuint, GLint, GLint, target, attachment, texture, level, layer);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles_context_acquire_binded_framebuffer(&ctx->base.base,
+ target,
+ &framebuffer_obj)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!framebuffer_obj) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (texture) {
+ texture_obj = (struct yagl_gles_texture*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_TEXTURE, texture);
+
+ if (!texture_obj) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles2_is_texture_target_layered(texture_obj->target)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (layer < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+ }
+
+ if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
+ yagl_gles_framebuffer_texture_layer(framebuffer_obj,
+ target, GL_DEPTH_ATTACHMENT,
+ yagl_gles_framebuffer_attachment_depth,
+ texture_obj, level, layer);
+ yagl_gles_framebuffer_texture_layer(framebuffer_obj,
+ target, GL_STENCIL_ATTACHMENT,
+ yagl_gles_framebuffer_attachment_stencil,
+ texture_obj, level, layer);
+ } else {
+ if (!yagl_gles_validate_framebuffer_attachment(attachment,
+ ctx->base.base.max_color_attachments,
+ &framebuffer_attachment)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ yagl_gles_framebuffer_texture_layer(framebuffer_obj,
+ target, attachment,
+ framebuffer_attachment,
+ texture_obj, level, layer);
+ }
+
+out:
+ yagl_gles_texture_release(texture_obj);
+ yagl_gles_framebuffer_release(framebuffer_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGenSamplers(GLsizei count, GLuint *sampler_names)
+{
+ struct yagl_gles_sampler **samplers = NULL;
+ GLsizei i;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glGenSamplers, GLsizei, GLuint*, count, sampler_names);
+
+ YAGL_GET_CTX();
+
+ if (count < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ samplers = yagl_malloc0(count * sizeof(*samplers));
+
+ for (i = 0; i < count; ++i) {
+ samplers[i] = yagl_gles_sampler_create();
+
+ if (!samplers[i]) {
+ goto out;
+ }
+ }
+
+ for (i = 0; i < count; ++i) {
+ yagl_sharegroup_add(ctx->base.sg,
+ YAGL_NS_SAMPLER,
+ &samplers[i]->base);
+
+ if (sampler_names) {
+ sampler_names[i] = samplers[i]->base.local_name;
+ }
+ }
+
+out:
+ for (i = 0; i < count; ++i) {
+ yagl_gles_sampler_release(samplers[i]);
+ }
+ yagl_free(samplers);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glDeleteSamplers(GLsizei count, const GLuint *samplers)
+{
+ GLsizei i;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glDeleteSamplers, GLsizei, const GLuint*, count, samplers);
+
+ YAGL_GET_CTX();
+
+ if (count < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (samplers) {
+ for (i = 0; i < count; ++i) {
+ yagl_gles3_context_unbind_sampler(ctx, samplers[i]);
+
+ yagl_sharegroup_remove(ctx->base.sg,
+ YAGL_NS_SAMPLER,
+ samplers[i]);
+ }
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API GLboolean glIsSampler(GLuint sampler)
+{
+ GLboolean res = GL_FALSE;
+ struct yagl_gles_sampler *sampler_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glIsSampler, GLuint, sampler);
+
+ YAGL_GET_CTX_RET(GL_FALSE);
+
+ sampler_obj = (struct yagl_gles_sampler*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_SAMPLER, sampler);
+
+ if (sampler_obj) {
+ res = GL_TRUE;
+ }
+
+ yagl_gles_sampler_release(sampler_obj);
+
+ YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, res);
+
+ return res;
+}
+
+YAGL_API void glBindSampler(GLuint unit, GLuint sampler)
+{
+ struct yagl_gles_sampler *sampler_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glBindSampler, GLuint, GLuint, unit, sampler);
+
+ YAGL_GET_CTX();
+
+ if (sampler != 0) {
+ sampler_obj = (struct yagl_gles_sampler*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_SAMPLER, sampler);
+
+ if (!sampler_obj) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+ }
+
+ if (!yagl_gles3_context_bind_sampler(ctx, unit, sampler_obj)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+out:
+ yagl_gles_sampler_release(sampler_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
+{
+ struct yagl_gles_sampler *sampler_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glSamplerParameteri, GLuint, GLenum, GLint, sampler, pname, param);
+
+ YAGL_GET_CTX();
+
+ sampler_obj = (struct yagl_gles_sampler*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_SAMPLER, sampler);
+
+ if (!sampler_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (!yagl_gles_sampler_set_parameteriv(sampler_obj, pname, ¶m)) {
+ GLfloat float_param = param;
+
+ if (!yagl_gles_sampler_set_parameterfv(sampler_obj, pname, &float_param)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+ }
+
+out:
+ yagl_gles_sampler_release(sampler_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
+{
+ struct yagl_gles_sampler *sampler_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glSamplerParameteriv, GLuint, GLenum, const GLint*, sampler, pname, param);
+
+ YAGL_GET_CTX();
+
+ sampler_obj = (struct yagl_gles_sampler*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_SAMPLER, sampler);
+
+ if (!sampler_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (!yagl_gles_sampler_set_parameteriv(sampler_obj, pname, param)) {
+ GLfloat float_param = param[0];
+
+ if (!yagl_gles_sampler_set_parameterfv(sampler_obj, pname, &float_param)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+ }
+
+out:
+ yagl_gles_sampler_release(sampler_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
+{
+ struct yagl_gles_sampler *sampler_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glSamplerParameterf, GLuint, GLenum, GLfloat, sampler, pname, param);
+
+ YAGL_GET_CTX();
+
+ sampler_obj = (struct yagl_gles_sampler*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_SAMPLER, sampler);
+
+ if (!sampler_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (!yagl_gles_sampler_set_parameterfv(sampler_obj, pname, ¶m)) {
+ GLint int_param = param;
+
+ if (!yagl_gles_sampler_set_parameteriv(sampler_obj, pname, &int_param)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+ }
+
+out:
+ yagl_gles_sampler_release(sampler_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
+{
+ struct yagl_gles_sampler *sampler_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glSamplerParameterfv, GLuint, GLenum, const GLfloat*, sampler, pname, param);
+
+ YAGL_GET_CTX();
+
+ sampler_obj = (struct yagl_gles_sampler*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_SAMPLER, sampler);
+
+ if (!sampler_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (!yagl_gles_sampler_set_parameterfv(sampler_obj, pname, param)) {
+ GLint int_param = param[0];
+
+ if (!yagl_gles_sampler_set_parameteriv(sampler_obj, pname, &int_param)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+ }
+
+out:
+ yagl_gles_sampler_release(sampler_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
+{
+ struct yagl_gles_sampler *sampler_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetSamplerParameteriv, GLuint, GLenum, GLint*, sampler, pname, params);
+
+ YAGL_GET_CTX();
+
+ sampler_obj = (struct yagl_gles_sampler*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_SAMPLER, sampler);
+
+ if (!sampler_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (!yagl_gles_sampler_get_parameteriv(sampler_obj, pname, params)) {
+ GLfloat float_param;
+
+ if (!yagl_gles_sampler_get_parameterfv(sampler_obj, pname, &float_param)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ params[0] = float_param;
+ }
+
+out:
+ yagl_gles_sampler_release(sampler_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
+{
+ struct yagl_gles_sampler *sampler_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetSamplerParameterfv, GLuint, GLenum, GLfloat*, sampler, pname, params);
+
+ YAGL_GET_CTX();
+
+ sampler_obj = (struct yagl_gles_sampler*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_SAMPLER, sampler);
+
+ if (!sampler_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (!yagl_gles_sampler_get_parameterfv(sampler_obj, pname, params)) {
+ GLint int_param;
+
+ if (!yagl_gles_sampler_get_parameteriv(sampler_obj, pname, &int_param)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ params[0] = int_param;
+ }
+
+out:
+ yagl_gles_sampler_release(sampler_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
+{
+ GLenum actual_internalformat = internalformat;
+ struct yagl_gles_renderbuffer *renderbuffer_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glRenderbufferStorageMultisample, GLenum, GLsizei, GLenum, GLsizei, GLsizei, target, samples, internalformat, width, height);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles_context_validate_renderbuffer_format(&ctx->base.base, &actual_internalformat)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!yagl_gles_context_acquire_binded_renderbuffer(&ctx->base.base, target, &renderbuffer_obj)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!renderbuffer_obj) {
+ goto out;
+ }
+
+ yagl_gles_renderbuffer_set_internalformat(renderbuffer_obj, internalformat);
+
+ yagl_host_glRenderbufferStorageMultisample(target, samples, actual_internalformat, width, height);
+
+out:
+ yagl_gles_renderbuffer_release(renderbuffer_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
+{
+ struct yagl_gles_buffer *read_buffer_obj = NULL;
+ struct yagl_gles_buffer *write_buffer_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glCopyBufferSubData, GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr, readTarget, writeTarget, readOffset, writeOffset, size);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles_context_acquire_binded_buffer(&ctx->base.base, readTarget, &read_buffer_obj)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!read_buffer_obj) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles_context_acquire_binded_buffer(&ctx->base.base, writeTarget, &write_buffer_obj)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!write_buffer_obj) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ yagl_gles_buffer_bind(read_buffer_obj,
+ 0,
+ 0,
+ readTarget);
+ yagl_gles_buffer_bind(write_buffer_obj,
+ 0,
+ 0,
+ writeTarget);
+ yagl_gles_buffer_transfer(read_buffer_obj,
+ 0,
+ readTarget,
+ 0);
+ yagl_gles_buffer_transfer(write_buffer_obj,
+ 0,
+ writeTarget,
+ 0);
+
+ if (yagl_gles_buffer_copy_gpu(read_buffer_obj, readTarget,
+ write_buffer_obj, writeTarget,
+ readOffset,
+ writeOffset,
+ size)) {
+ yagl_gles_buffer_set_gpu_dirty(write_buffer_obj,
+ writeOffset,
+ size);
+ } else {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ }
+
+ yagl_host_glBindBuffer(writeTarget, 0);
+ yagl_host_glBindBuffer(readTarget, 0);
+
+out:
+ yagl_gles_buffer_release(read_buffer_obj);
+ yagl_gles_buffer_release(write_buffer_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API GLsync glFenceSync(GLenum condition, GLbitfield flags)
+{
+ GLsync res = NULL;
+ struct yagl_gles3_sync *sync = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glFenceSync, GLenum, GLbitfield, condition, flags);
+
+ YAGL_GET_CTX_RET(NULL);
+
+ if (!yagl_egl_fence_supported()) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (condition != GL_SYNC_GPU_COMMANDS_COMPLETE) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (flags != 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ sync = yagl_gles3_sync_create();
+
+ if (!sync) {
+ goto out;
+ }
+
+ yagl_sharegroup_add(ctx->base.sg, YAGL_NS_SYNC, &sync->base);
+ res = (GLsync)sync->base.local_name;
+
+ yagl_transport_flush(yagl_get_transport(), sync->egl_fence);
+
+out:
+ yagl_gles3_sync_release(sync);
+
+ YAGL_LOG_FUNC_EXIT_SPLIT(GLsync, res);
+
+ return res;
+}
+
+YAGL_API GLboolean glIsSync(GLsync sync)
+{
+ GLboolean res = GL_FALSE;
+ struct yagl_gles3_sync *sync_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glIsSync, GLsync, sync);
+
+ YAGL_GET_CTX_RET(GL_FALSE);
+
+ sync_obj = (struct yagl_gles3_sync*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_SYNC, (yagl_object_name)sync);
+
+ res = (sync_obj != NULL);
+
+ yagl_gles3_sync_release(sync_obj);
+
+ YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, res);
+
+ return res;
+}
+
+YAGL_API void glDeleteSync(GLsync sync)
+{
+ struct yagl_gles3_sync *sync_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glDeleteSync, GLsync, sync);
+
+ YAGL_GET_CTX();
+
+ if (sync == NULL) {
+ goto out;
+ }
+
+ sync_obj = (struct yagl_gles3_sync*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_SYNC, (yagl_object_name)sync);
+
+ if (!sync_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ yagl_sharegroup_remove(ctx->base.sg,
+ YAGL_NS_SYNC,
+ (yagl_object_name)sync);
+
+out:
+ yagl_gles3_sync_release(sync_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API GLenum glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
+{
+ GLenum status = GL_WAIT_FAILED;
+ struct yagl_gles3_sync *sync_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glClientWaitSync, GLsync, GLbitfield, GLuint64, sync, flags, timeout);
+
+ YAGL_GET_CTX_RET(status);
+
+ if (flags & ~(GL_SYNC_FLUSH_COMMANDS_BIT)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ sync_obj = (struct yagl_gles3_sync*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_SYNC, (yagl_object_name)sync);
+
+ if (!sync_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (sync_obj->signaled) {
+ status = GL_ALREADY_SIGNALED;
+ } else {
+ if (timeout == 0) {
+ if (sync_obj->egl_fence->signaled(sync_obj->egl_fence)) {
+ status = GL_ALREADY_SIGNALED;
+ sync_obj->signaled = 1;
+ } else {
+ status = GL_TIMEOUT_EXPIRED;
+ }
+ } else if (sync_obj->egl_fence->wait(sync_obj->egl_fence)) {
+ status = GL_CONDITION_SATISFIED;
+ sync_obj->signaled = 1;
+ } else {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ }
+ }
+
+out:
+ yagl_gles3_sync_release(sync_obj);
+
+ YAGL_LOG_FUNC_EXIT_SPLIT(GLenum, status);
+
+ return status;
+}
+
+YAGL_API void glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
+{
+ struct yagl_gles3_sync *sync_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glWaitSync, GLsync, GLbitfield, GLuint64, sync, flags, timeout);
+
+ YAGL_GET_CTX();
+
+ if ((flags != 0) || (timeout != GL_TIMEOUT_IGNORED)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ sync_obj = (struct yagl_gles3_sync*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_SYNC, (yagl_object_name)sync);
+
+ if (!sync_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ /*
+ * All our OpenGL commands are serialized, this is a no-op.
+ */
+
+out:
+ yagl_gles3_sync_release(sync_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)
+{
+ struct yagl_gles3_sync *sync_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glGetSynciv, GLsync, GLenum, GLsizei, GLsizei*, GLint*, sync, pname, bufSize, length, values);
+
+ YAGL_GET_CTX();
+
+ sync_obj = (struct yagl_gles3_sync*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_SYNC, (yagl_object_name)sync);
+
+ if (!sync_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ switch (pname) {
+ case GL_OBJECT_TYPE:
+ if (bufSize > 0) {
+ *values = GL_SYNC_FENCE;
+ if (length) {
+ *length = 1;
+ }
+ } else if (length) {
+ *length = 0;
+ }
+ break;
+ case GL_SYNC_STATUS:
+ if (bufSize > 0) {
+ *values = (sync_obj->egl_fence->signaled(sync_obj->egl_fence) ? GL_SIGNALED : GL_UNSIGNALED);
+ if (length) {
+ *length = 1;
+ }
+ } else if (length) {
+ *length = 0;
+ }
+ break;
+ case GL_SYNC_CONDITION:
+ if (bufSize > 0) {
+ *values = GL_SYNC_GPU_COMMANDS_COMPLETE;
+ if (length) {
+ *length = 1;
+ }
+ } else if (length) {
+ *length = 0;
+ }
+ break;
+ case GL_SYNC_FLAGS:
+ if (bufSize > 0) {
+ *values = 0;
+ if (length) {
+ *length = 1;
+ }
+ } else if (length) {
+ *length = 0;
+ }
+ break;
+ default:
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+
+out:
+ yagl_gles3_sync_release(sync_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetInteger64v(GLenum pname, GLint64 *params)
+{
+ uint32_t i, num = 0;
+ int needs_map = 0;
+ GLint ints[100]; // This fits all cases.
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glGetInteger64v, GLenum, GLint64*, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles_context_get_integerv(&ctx->base.base, pname, ints, &num)) {
+ GLfloat floats[100]; // This fits all cases.
+ if (yagl_gles_context_get_floatv(&ctx->base.base, pname, floats, &num, &needs_map)) {
+ for (i = 0; i < num; ++i) {
+ if (needs_map) {
+ params[i] = 2147483647.0 * floats[i];
+ } else {
+ params[i] = floats[i];
+ }
+ }
+ } else {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+ } else {
+ for (i = 0; i < num; ++i) {
+ params[i] = ints[i];
+ }
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetIntegeri_v(GLenum target, GLuint index, GLint *data)
+{
+ uint32_t num = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetIntegeri_v, GLenum, GLuint, GLint*, target, index, data);
+
+ YAGL_GET_CTX();
+
+ yagl_gles3_context_get_integerv_indexed(ctx,
+ target,
+ index,
+ data,
+ &num);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data)
+{
+ uint32_t i, num = 0;
+ GLint ints[100]; // This fits all cases.
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetInteger64i_v, GLenum, GLuint, GLint64*, target, index, data);
+
+ YAGL_GET_CTX();
+
+ if (yagl_gles3_context_get_integerv_indexed(ctx,
+ target,
+ index,
+ ints,
+ &num)) {
+ for (i = 0; i < num; ++i) {
+ data[i] = ints[i];
+ }
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API const GLubyte *glGetStringi(GLenum name, GLuint index)
+{
+ const char *str = NULL;
+
+ YAGL_LOG_FUNC_ENTER(glGetStringi, "name = 0x%X, index = %u", name, index);
+
+ YAGL_GET_CTX_RET(NULL);
+
+ switch (name) {
+ case GL_EXTENSIONS:
+ if (index >= ctx->base.base.num_extensions) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ break;
+ }
+ str = ctx->base.base.extensions[index];
+ break;
+ default:
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ break;
+ }
+
+ YAGL_LOG_FUNC_EXIT("%s", str);
+
+ return (const GLubyte*)str;
+}
+
+YAGL_API void glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
+{
+ struct yagl_gles_buffer *buffer_obj = NULL;
+ GLint int_param = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetBufferParameteri64v, GLenum, GLenum, GLint64*, target, pname, params);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles_context_acquire_binded_buffer(&ctx->base.base, target, &buffer_obj)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!buffer_obj) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (yagl_gles_buffer_get_parameter(buffer_obj,
+ pname,
+ &int_param)) {
+ params[0] = int_param;
+ } else {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+out:
+ yagl_gles_buffer_release(buffer_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer)
+{
+ struct yagl_gles_array *array;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glVertexAttribIPointer, GLuint, GLint, GLenum, GLsizei, const void*, index, size, type, stride, pointer);
+
+ YAGL_GET_CTX();
+
+ if (index >= ctx->base.base.num_arrays) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if ((stride < 0) || (size < 1) || (size > 4)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (((type == GL_INT_2_10_10_10_REV) || (type == GL_UNSIGNED_INT_2_10_10_10_REV)) &&
+ (size != 4)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ array = &ctx->base.base.vao->arrays[index];
+
+ if (ctx->base.base.vbo) {
+ if (!yagl_gles_array_update_vbo(array,
+ size,
+ type,
+ 0,
+ GL_FALSE,
+ stride,
+ ctx->base.base.vbo,
+ (GLint)pointer,
+ 1)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+ } else {
+ /*
+ * GL_OES_vertex_array_object:
+ * "Binding a zero-named vertex array buffer:
+ * this can be detected by *Pointer(ES1) or VertexAttribPointer(ES2);
+ * if the pointer argument is not NULL:
+ * this means to bind a client vertex array;
+ * an INVALID_OPERATION error will be returned."
+ */
+ if ((ctx->base.base.vao != ctx->base.base.va_zero) && pointer) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles_array_update(array,
+ size,
+ type,
+ 0,
+ GL_FALSE,
+ stride,
+ pointer,
+ 1)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ }
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
+{
+ GLint tmp[100]; // This fits all cases.
+ int32_t num = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetVertexAttribIiv, GLuint, GLenum, GLint*, index, pname, params);
+
+ YAGL_GET_CTX();
+
+ if ((index == 0) &&
+ (pname == GL_CURRENT_VERTEX_ATTRIB)) {
+ if (params) {
+ switch (ctx->base.vertex_attrib0.type) {
+ case GL_INT:
+ params[0] = ctx->base.vertex_attrib0.value.i[0];
+ params[1] = ctx->base.vertex_attrib0.value.i[1];
+ params[2] = ctx->base.vertex_attrib0.value.i[2];
+ params[3] = ctx->base.vertex_attrib0.value.i[3];
+ break;
+ case GL_UNSIGNED_INT:
+ params[0] = ctx->base.vertex_attrib0.value.ui[0];
+ params[1] = ctx->base.vertex_attrib0.value.ui[1];
+ params[2] = ctx->base.vertex_attrib0.value.ui[2];
+ params[3] = ctx->base.vertex_attrib0.value.ui[3];
+ break;
+ default:
+ assert(0);
+ case GL_FLOAT:
+ params[0] = ctx->base.vertex_attrib0.value.f[0];
+ params[1] = ctx->base.vertex_attrib0.value.f[1];
+ params[2] = ctx->base.vertex_attrib0.value.f[2];
+ params[3] = ctx->base.vertex_attrib0.value.f[3];
+ break;
+ }
+ }
+
+ goto out;
+ }
+
+ if (yagl_gles2_context_get_array_param(&ctx->base,
+ index,
+ pname,
+ params)) {
+ } else {
+ yagl_host_glGetVertexAttribIiv(index, pname, tmp, sizeof(tmp)/sizeof(tmp[0]), &num);
+ if (params) {
+ memcpy(params, tmp, num * sizeof(tmp[0]));
+ }
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
+{
+ GLint param = 0;
+ GLuint tmp[100]; // This fits all cases.
+ int32_t num = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetVertexAttribIuiv, GLuint, GLenum, GLuint*, index, pname, params);
+
+ YAGL_GET_CTX();
+
+ if ((index == 0) &&
+ (pname == GL_CURRENT_VERTEX_ATTRIB)) {
+ if (params) {
+ switch (ctx->base.vertex_attrib0.type) {
+ case GL_INT:
+ params[0] = ctx->base.vertex_attrib0.value.i[0];
+ params[1] = ctx->base.vertex_attrib0.value.i[1];
+ params[2] = ctx->base.vertex_attrib0.value.i[2];
+ params[3] = ctx->base.vertex_attrib0.value.i[3];
+ break;
+ case GL_UNSIGNED_INT:
+ params[0] = ctx->base.vertex_attrib0.value.ui[0];
+ params[1] = ctx->base.vertex_attrib0.value.ui[1];
+ params[2] = ctx->base.vertex_attrib0.value.ui[2];
+ params[3] = ctx->base.vertex_attrib0.value.ui[3];
+ break;
+ default:
+ assert(0);
+ case GL_FLOAT:
+ params[0] = ctx->base.vertex_attrib0.value.f[0];
+ params[1] = ctx->base.vertex_attrib0.value.f[1];
+ params[2] = ctx->base.vertex_attrib0.value.f[2];
+ params[3] = ctx->base.vertex_attrib0.value.f[3];
+ break;
+ }
+ }
+
+ goto out;
+ }
+
+ if (yagl_gles2_context_get_array_param(&ctx->base,
+ index,
+ pname,
+ ¶m)) {
+ if (params) {
+ params[0] = param;
+ }
+ } else {
+ yagl_host_glGetVertexAttribIuiv(index, pname, tmp, sizeof(tmp)/sizeof(tmp[0]), &num);
+ if (params) {
+ memcpy(params, tmp, num * sizeof(tmp[0]));
+ }
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glVertexAttribI4i, GLuint, GLint, GLint, GLint, GLint, index, x, y, z, w);
+
+ YAGL_GET_CTX();
+
+ if (index == 0) {
+ ctx->base.vertex_attrib0.value.i[0] = x;
+ ctx->base.vertex_attrib0.value.i[1] = y;
+ ctx->base.vertex_attrib0.value.i[2] = z;
+ ctx->base.vertex_attrib0.value.i[3] = w;
+ ctx->base.vertex_attrib0.type = GL_INT;
+ } else {
+ yagl_host_glVertexAttribI4i(index, x, y, z, w);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glVertexAttribI4ui, GLuint, GLuint, GLuint, GLuint, GLuint, index, x, y, z, w);
+
+ YAGL_GET_CTX();
+
+ if (index == 0) {
+ ctx->base.vertex_attrib0.value.ui[0] = x;
+ ctx->base.vertex_attrib0.value.ui[1] = y;
+ ctx->base.vertex_attrib0.value.ui[2] = z;
+ ctx->base.vertex_attrib0.value.ui[3] = w;
+ ctx->base.vertex_attrib0.type = GL_UNSIGNED_INT;
+ } else {
+ yagl_host_glVertexAttribI4ui(index, x, y, z, w);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glVertexAttribI4iv(GLuint index, const GLint *v)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glVertexAttribI4iv, GLuint, const GLint*, index, v);
+
+ YAGL_GET_CTX();
+
+ if (index == 0) {
+ ctx->base.vertex_attrib0.value.i[0] = v[0];
+ ctx->base.vertex_attrib0.value.i[1] = v[1];
+ ctx->base.vertex_attrib0.value.i[2] = v[2];
+ ctx->base.vertex_attrib0.value.i[3] = v[3];
+ ctx->base.vertex_attrib0.type = GL_INT;
+ } else {
+ yagl_host_glVertexAttribI4iv(index, v, 4);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glVertexAttribI4uiv(GLuint index, const GLuint *v)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glVertexAttribI4uiv, GLuint, const GLuint*, index, v);
+
+ YAGL_GET_CTX();
+
+ if (index == 0) {
+ ctx->base.vertex_attrib0.value.ui[0] = v[0];
+ ctx->base.vertex_attrib0.value.ui[1] = v[1];
+ ctx->base.vertex_attrib0.value.ui[2] = v[2];
+ ctx->base.vertex_attrib0.value.ui[3] = v[3];
+ ctx->base.vertex_attrib0.type = GL_UNSIGNED_INT;
+ } else {
+ yagl_host_glVertexAttribI4uiv(index, v, 4);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetUniformuiv(GLuint program, GLint location, GLuint *params)
+{
+ struct yagl_gles2_program *program_obj = NULL;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetUniformuiv, GLuint, GLint, GLuint*, program, location, params);
+
+ YAGL_GET_CTX();
+
+ program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_SHADER_PROGRAM, program);
+
+ if (!program_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (program_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!program_obj->linked) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles3_program_get_uniformuiv(program_obj, location, params)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ yagl_gles2_program_release(program_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniform1ui(GLint location, GLuint v0)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glUniform1ui, GLint, GLuint, location, v0);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->base.program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles3_program_uniform1ui(ctx->base.program, location, v0)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniform2ui(GLint location, GLuint v0, GLuint v1)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform2ui, GLint, GLuint, GLuint, location, v0, v1);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->base.program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles3_program_uniform2ui(ctx->base.program, location, v0, v1)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glUniform3ui, GLint, GLuint, GLuint, GLuint, location, v0, v1, v2);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->base.program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles3_program_uniform3ui(ctx->base.program, location, v0, v1, v2)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glUniform4ui, GLint, GLuint, GLuint, GLuint, GLuint, location, v0, v1, v2, v3);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->base.program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles3_program_uniform4ui(ctx->base.program, location, v0, v1, v2, v3)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniform1uiv(GLint location, GLsizei count, const GLuint *value)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform1uiv, GLint, GLsizei, const GLuint*, location, count, value);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->base.program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (count < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles3_program_uniform1uiv(ctx->base.program, location, count, value)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniform2uiv(GLint location, GLsizei count, const GLuint *value)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform2uiv, GLint, GLsizei, const GLuint*, location, count, value);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->base.program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (count < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles3_program_uniform2uiv(ctx->base.program, location, count, value)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniform3uiv(GLint location, GLsizei count, const GLuint *value)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform3uiv, GLint, GLsizei, const GLuint*, location, count, value);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->base.program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (count < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles3_program_uniform3uiv(ctx->base.program, location, count, value)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniform4uiv(GLint location, GLsizei count, const GLuint *value)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform4uiv, GLint, GLsizei, const GLuint*, location, count, value);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->base.program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (count < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles3_program_uniform4uiv(ctx->base.program, location, count, value)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glUniformMatrix2x3fv, GLint, GLsizei, GLboolean, const GLfloat*, location, count, transpose, value);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->base.program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (count < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles3_program_uniform_matrix2x3fv(ctx->base.program, location, count, transpose, value)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glUniformMatrix2x4fv, GLint, GLsizei, GLboolean, const GLfloat*, location, count, transpose, value);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->base.program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (count < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles3_program_uniform_matrix2x4fv(ctx->base.program, location, count, transpose, value)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glUniformMatrix3x2fv, GLint, GLsizei, GLboolean, const GLfloat*, location, count, transpose, value);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->base.program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (count < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles3_program_uniform_matrix3x2fv(ctx->base.program, location, count, transpose, value)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glUniformMatrix3x4fv, GLint, GLsizei, GLboolean, const GLfloat*, location, count, transpose, value);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->base.program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (count < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles3_program_uniform_matrix3x4fv(ctx->base.program, location, count, transpose, value)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glUniformMatrix4x2fv, GLint, GLsizei, GLboolean, const GLfloat*, location, count, transpose, value);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->base.program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (count < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles3_program_uniform_matrix4x2fv(ctx->base.program, location, count, transpose, value)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glUniformMatrix4x3fv, GLint, GLsizei, GLboolean, const GLfloat*, location, count, transpose, value);
+
+ YAGL_GET_CTX();
+
+ if (!ctx->base.program) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (count < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (location == -1) {
+ goto out;
+ }
+
+ if (location < 0) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!yagl_gles3_program_uniform_matrix4x3fv(ctx->base.program, location, count, transpose, value)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glClearBufferiv, GLenum, GLint, const GLint*, buffer, drawbuffer, value);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles3_is_buffer_valid(buffer)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ switch (buffer) {
+ case GL_DEPTH:
+ case GL_STENCIL:
+ if (drawbuffer != 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+ yagl_host_glClearBufferiv(buffer, drawbuffer, value, 1);
+ break;
+ default:
+ if ((drawbuffer < 0) ||
+ (drawbuffer >= ctx->base.base.max_draw_buffers)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+ yagl_host_glClearBufferiv(buffer, drawbuffer, value, 4);
+ break;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glClearBufferuiv, GLenum, GLint, const GLuint*, buffer, drawbuffer, value);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles3_is_buffer_valid(buffer)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ switch (buffer) {
+ case GL_DEPTH:
+ case GL_STENCIL:
+ if (drawbuffer != 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+ yagl_host_glClearBufferuiv(buffer, drawbuffer, value, 1);
+ break;
+ default:
+ if ((drawbuffer < 0) ||
+ (drawbuffer >= ctx->base.base.max_draw_buffers)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+ yagl_host_glClearBufferuiv(buffer, drawbuffer, value, 4);
+ break;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glClearBufferfi, GLenum, GLint, GLfloat, GLint, buffer, drawbuffer, depth, stencil);
+
+ YAGL_GET_CTX();
+
+ if (buffer != GL_DEPTH_STENCIL) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (drawbuffer != 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ yagl_host_glClearBufferfi(buffer, drawbuffer, yagl_clampf(depth), stencil);
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
+{
+ GLfloat tmp[4];
+
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glClearBufferfv, GLenum, GLint, const GLfloat*, buffer, drawbuffer, value);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles3_is_buffer_valid(buffer)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ switch (buffer) {
+ case GL_DEPTH:
+ case GL_STENCIL:
+ if (drawbuffer != 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+ tmp[0] = yagl_clampf(value[0]);
+ yagl_host_glClearBufferfv(buffer, drawbuffer, tmp, 1);
+ break;
+ default:
+ if ((drawbuffer < 0) ||
+ (drawbuffer >= ctx->base.base.max_draw_buffers)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+ tmp[0] = yagl_clampf(value[0]);
+ tmp[1] = yagl_clampf(value[1]);
+ tmp[2] = yagl_clampf(value[2]);
+ tmp[3] = yagl_clampf(value[3]);
+ yagl_host_glClearBufferfv(buffer, drawbuffer, tmp, 4);
+ break;
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API GLint glGetFragDataLocation(GLuint program, const GLchar *name)
+{
+ struct yagl_gles2_program *program_obj = NULL;
+ GLint ret = 0;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glGetFragDataLocation, GLuint, const GLchar*, program, name);
+
+ YAGL_GET_CTX_RET(0);
+
+ program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->base.sg,
+ YAGL_NS_SHADER_PROGRAM, program);
+
+ if (!program_obj) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (program_obj->is_shader) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ if (!program_obj->linked) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ goto out;
+ }
+
+ ret = yagl_gles3_program_get_frag_data_location(program_obj, name);
+
+out:
+ yagl_gles2_program_release(program_obj);
+
+ YAGL_LOG_FUNC_EXIT_SPLIT(GLint, ret);
+
+ return ret;
+}
+
+YAGL_API void glDrawRangeElements(GLenum mode, GLuint start, GLuint end,
+ GLsizei count, GLenum type,
+ const void *indices)
+{
+ int index_size = 0;
+ GLuint i;
+
+ YAGL_LOG_FUNC_ENTER_SPLIT6(glDrawRangeElements, GLenum, GLuint, GLuint, GLsizei, GLenum, const void*, mode, start, end, count, type, indices);
+
+ YAGL_GET_CTX();
+
+ if (!yagl_gles_is_draw_mode_valid(mode)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (count < 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (end < start) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (!yagl_gles_get_index_size(type, &index_size)) {
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ goto out;
+ }
+
+ if (!ctx->base.base.vao->ebo && !indices) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ goto out;
+ }
+
+ if (count == 0) {
+ goto out;
+ }
+
+ yagl_render_invalidate(0);
+
+ for (i = 0; i < ctx->base.base.vao->num_arrays; ++i) {
+ if (!ctx->base.base.vao->arrays[i].enabled) {
+ continue;
+ }
+
+ yagl_gles_array_transfer(&ctx->base.base.vao->arrays[i],
+ start,
+ end + 1 - start,
+ -1);
+ }
+
+ if (ctx->base.base.vao->ebo) {
+ yagl_gles_buffer_bind(ctx->base.base.vao->ebo,
+ type,
+ 0,
+ GL_ELEMENT_ARRAY_BUFFER);
+ yagl_gles_buffer_transfer(ctx->base.base.vao->ebo,
+ type,
+ GL_ELEMENT_ARRAY_BUFFER,
+ 0);
+ yagl_gles3_context_draw_range_elements(ctx, mode, start, end, count,
+ type, NULL, (int32_t)indices);
+ yagl_host_glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
+ } else {
+ yagl_gles3_context_draw_range_elements(ctx, mode, start, end, count,
+ type, indices, count * index_size);
+ }
+
+out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glGetProgramBinary, GLuint, GLsizei, GLsizei*, GLenum*, void*, program, bufSize, length, binaryFormat, binary);
+
+ YAGL_GET_CTX();
+
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glProgramBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glProgramBinary, GLuint, GLenum, const void*, GLsizei, program, binaryFormat, binary, length);
+
+ YAGL_GET_CTX();
+
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glProgramParameteri(GLuint program, GLenum pname, GLint value)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glProgramParameteri, GLuint, GLenum, GLint, program, pname, value);
+
+ YAGL_GET_CTX();
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+YAGL_API void glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params)
+{
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glGetInternalformativ, GLenum, GLenum, GLenum, GLsizei, GLint*, target, internalformat, pname, bufSize, params);
+
+ YAGL_GET_CTX();
+
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GLES3/gl3.h"
+#include "yagl_gles3_context.h"
+#include "yagl_gles3_buffer_binding.h"
+#include "yagl_gles3_transform_feedback.h"
+#include "yagl_gles3_query.h"
+#include "yagl_gles3_pixel_formats.h"
+#include "yagl_gles2_program.h"
+#include "yagl_gles2_utils.h"
+#include "yagl_gles_buffer.h"
+#include "yagl_gles_texture_unit.h"
+#include "yagl_gles_texture.h"
+#include "yagl_gles_sampler.h"
+#include "yagl_gles_utils.h"
+#include "yagl_log.h"
+#include "yagl_malloc.h"
+#include "yagl_state.h"
+#include "yagl_egl_fence.h"
+#include "yagl_host_gles_calls.h"
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
+
+/*
+ * We can't include GLES2/gl2ext.h here
+ */
+#define GL_HALF_FLOAT_OES 0x8D61
+
+/*
+ * We can't include GL/glext.h here
+ */
+#define GL_FRAMEBUFFER_SRGB 0x8DB9
+
+#define YAGL_SET_ERR(err) \
+ yagl_gles_context_set_error(&ctx->base.base, err); \
+ YAGL_LOG_ERROR("error = 0x%X", err)
+
+static inline void yagl_gles3_context_pre_draw(struct yagl_gles3_context *ctx)
+{
+ struct yagl_gles3_buffer_binding *buffer_binding;
+
+ yagl_list_for_each(struct yagl_gles3_buffer_binding,
+ buffer_binding,
+ &ctx->active_uniform_buffer_bindings, list) {
+ yagl_gles3_buffer_binding_transfer_begin(buffer_binding);
+ }
+}
+
+static inline void yagl_gles3_context_post_draw(struct yagl_gles3_context *ctx)
+{
+ struct yagl_gles3_buffer_binding *buffer_binding;
+
+ yagl_list_for_each(struct yagl_gles3_buffer_binding,
+ buffer_binding,
+ &ctx->active_uniform_buffer_bindings, list) {
+ yagl_gles3_buffer_binding_transfer_end(buffer_binding);
+ }
+
+ if (ctx->tfo->active && !ctx->tfo->paused) {
+ yagl_gles3_transform_feedback_post_draw(ctx->tfo);
+ }
+}
+
+static void yagl_gles3_context_prepare(struct yagl_client_context *ctx)
+{
+ struct yagl_gles3_context *gles3_ctx = (struct yagl_gles3_context*)ctx;
+ GLuint i;
+ const GLchar **extensions;
+ int num_extensions;
+
+ yagl_host_glEnable(GL_FRAMEBUFFER_SRGB);
+
+ yagl_gles2_context_prepare(&gles3_ctx->base);
+
+ yagl_host_glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS,
+ (GLint*)&gles3_ctx->num_uniform_buffer_bindings,
+ 1,
+ NULL);
+
+ gles3_ctx->uniform_buffer_bindings =
+ yagl_malloc0(sizeof(gles3_ctx->uniform_buffer_bindings[0]) * gles3_ctx->num_uniform_buffer_bindings);
+
+ for (i = 0; i < gles3_ctx->num_uniform_buffer_bindings; ++i) {
+ yagl_gles3_buffer_binding_init(&gles3_ctx->uniform_buffer_bindings[i],
+ GL_UNIFORM_BUFFER,
+ i);
+ }
+
+ yagl_host_glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT,
+ &gles3_ctx->uniform_buffer_offset_alignment,
+ 1,
+ NULL);
+
+ yagl_host_glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS,
+ &gles3_ctx->max_transform_feedback_separate_attribs,
+ 1,
+ NULL);
+
+ gles3_ctx->tf_zero =
+ yagl_gles3_transform_feedback_create(1,
+ gles3_ctx->max_transform_feedback_separate_attribs);
+
+ yagl_gles3_transform_feedback_acquire(gles3_ctx->tf_zero);
+ gles3_ctx->tfo = gles3_ctx->tf_zero;
+
+ extensions = yagl_gles2_context_get_extensions(&gles3_ctx->base,
+ &num_extensions);
+
+ yagl_gles_context_prepare_end(&gles3_ctx->base.base,
+ extensions, num_extensions);
+}
+
+static void yagl_gles3_context_destroy(struct yagl_client_context *ctx)
+{
+ struct yagl_gles3_context *gles3_ctx = (struct yagl_gles3_context*)ctx;
+ GLuint i;
+
+ YAGL_LOG_FUNC_ENTER(yagl_gles3_context_destroy, "%p", ctx);
+
+ yagl_gles_buffer_release(gles3_ctx->cwbo);
+ yagl_gles_buffer_release(gles3_ctx->crbo);
+
+ yagl_gles3_query_release(gles3_ctx->occlusion_query);
+ yagl_gles3_query_release(gles3_ctx->tf_primitives_written_query);
+
+ yagl_gles3_transform_feedback_release(gles3_ctx->tfo);
+ yagl_gles3_transform_feedback_release(gles3_ctx->tf_zero);
+ yagl_gles_buffer_release(gles3_ctx->tfbo);
+
+ yagl_gles_buffer_release(gles3_ctx->ubo);
+
+ for (i = 0; i < gles3_ctx->num_uniform_buffer_bindings; ++i) {
+ yagl_gles3_buffer_binding_reset(&gles3_ctx->uniform_buffer_bindings[i]);
+ }
+
+ yagl_free(gles3_ctx->uniform_buffer_bindings);
+
+ yagl_namespace_cleanup(&gles3_ctx->queries);
+ yagl_namespace_cleanup(&gles3_ctx->transform_feedbacks);
+
+ yagl_gles2_context_cleanup(&gles3_ctx->base);
+
+ yagl_free(gles3_ctx);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+static const GLchar
+ *yagl_gles3_context_get_string(struct yagl_gles_context *ctx,
+ GLenum name)
+{
+ const char *str = NULL;
+
+ switch (name) {
+ case GL_VERSION:
+ str = "OpenGL ES 3.0";
+ break;
+ case GL_RENDERER:
+ str = "YaGL GLESv3";
+ break;
+ case GL_SHADING_LANGUAGE_VERSION:
+ str = "OpenGL ES GLSL ES 3.0";
+ break;
+ default:
+ str = "";
+ }
+
+ return str;
+}
+
+static int yagl_gles3_context_enable(struct yagl_gles_context *ctx,
+ GLenum cap,
+ GLboolean enable)
+{
+ struct yagl_gles3_context *gles3_ctx = (struct yagl_gles3_context*)ctx;
+
+ switch (cap) {
+ case GL_PRIMITIVE_RESTART_FIXED_INDEX:
+ gles3_ctx->primitive_restart_fixed_index = enable;
+ break;
+ case GL_RASTERIZER_DISCARD:
+ gles3_ctx->rasterizer_discard = enable;
+ break;
+ default:
+ return 0;
+ }
+
+ if (enable) {
+ yagl_host_glEnable(cap);
+ } else {
+ yagl_host_glDisable(cap);
+ }
+
+ return 1;
+}
+
+static int yagl_gles3_context_is_enabled(struct yagl_gles_context *ctx,
+ GLenum cap,
+ GLboolean *enabled)
+{
+ struct yagl_gles3_context *gles3_ctx = (struct yagl_gles3_context*)ctx;
+
+ switch (cap) {
+ case GL_PRIMITIVE_RESTART_FIXED_INDEX:
+ *enabled = gles3_ctx->primitive_restart_fixed_index;
+ break;
+ case GL_RASTERIZER_DISCARD:
+ *enabled = gles3_ctx->rasterizer_discard;
+ break;
+ default:
+ return 0;
+ }
+
+ return 1;
+}
+
+static int yagl_gles3_context_get_integerv(struct yagl_gles_context *ctx,
+ GLenum pname,
+ GLint *params,
+ uint32_t *num_params)
+{
+ int processed = 1;
+ struct yagl_gles3_context *gles3_ctx = (struct yagl_gles3_context*)ctx;
+ struct yagl_gles_sampler *sampler;
+ struct yagl_gles_texture_target_state *tts;
+
+ switch (pname) {
+ case GL_MAX_UNIFORM_BUFFER_BINDINGS:
+ *params = gles3_ctx->num_uniform_buffer_bindings;
+ *num_params = 1;
+ break;
+ case GL_NUM_PROGRAM_BINARY_FORMATS:
+ *params = 0;
+ *num_params = 1;
+ break;
+ case GL_UNIFORM_BUFFER_BINDING:
+ *params = gles3_ctx->ubo ? gles3_ctx->ubo->base.local_name : 0;
+ *num_params = 1;
+ break;
+ case GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT:
+ *params = gles3_ctx->uniform_buffer_offset_alignment;
+ *num_params = 1;
+ break;
+ case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:
+ *params = gles3_ctx->max_transform_feedback_separate_attribs;
+ *num_params = 1;
+ break;
+ case GL_TRANSFORM_FEEDBACK_BINDING:
+ *params = gles3_ctx->tfo->base.local_name;
+ *num_params = 1;
+ break;
+ case GL_TRANSFORM_FEEDBACK_ACTIVE:
+ *params = gles3_ctx->tfo->active;
+ *num_params = 1;
+ break;
+ case GL_TRANSFORM_FEEDBACK_PAUSED:
+ *params = gles3_ctx->tfo->paused;
+ *num_params = 1;
+ break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
+ *params = gles3_ctx->tfbo ? gles3_ctx->tfbo->base.local_name : 0;
+ *num_params = 1;
+ break;
+ case GL_SAMPLER_BINDING:
+ sampler = yagl_gles_context_get_active_texture_unit(ctx)->sampler;
+ *params = sampler ? sampler->base.local_name : 0;
+ *num_params = 1;
+ break;
+ case GL_TEXTURE_BINDING_2D_ARRAY:
+ tts = yagl_gles_context_get_active_texture_target_state(ctx,
+ yagl_gles_texture_target_2d_array);
+ *params = tts->texture->base.local_name;
+ *num_params = 1;
+ break;
+ case GL_COPY_READ_BUFFER_BINDING:
+ *params = gles3_ctx->crbo ? gles3_ctx->crbo->base.local_name : 0;
+ *num_params = 1;
+ break;
+ case GL_COPY_WRITE_BUFFER_BINDING:
+ *params = gles3_ctx->cwbo ? gles3_ctx->cwbo->base.local_name : 0;
+ *num_params = 1;
+ break;
+ case GL_MAX_SERVER_WAIT_TIMEOUT:
+ *params = 0x7FFFFFFE;
+ *num_params = 1;
+ break;
+ case GL_NUM_EXTENSIONS:
+ *params = ctx->num_extensions;
+ *num_params = 1;
+ break;
+ case GL_MAJOR_VERSION:
+ *params = 3;
+ *num_params = 1;
+ break;
+ case GL_MINOR_VERSION:
+ *params = 0;
+ *num_params = 1;
+ break;
+ case GL_MAX_VARYING_COMPONENTS:
+ *num_params = 1;
+ if (yagl_get_host_gl_version() >= yagl_gl_3_2) {
+ /*
+ * GL_MAX_VARYING_COMPONENTS is deprecated in
+ * OpenGL 3.2, thus, we use a constant.
+ */
+ *params = 64;
+ } else if (gles3_ctx->base.have_max_varying_floats) {
+ *params = gles3_ctx->base.max_varying_floats;
+ } else {
+ yagl_host_glGetIntegerv(GL_MAX_VARYING_COMPONENTS, params, *num_params, NULL);
+ gles3_ctx->base.max_varying_floats = *params;
+ gles3_ctx->base.have_max_varying_floats = 1;
+ }
+ break;
+ case GL_FRAGMENT_SHADER_DERIVATIVE_HINT:
+ *params = gles3_ctx->fragment_shader_derivative_hint;
+ *num_params = 1;
+ break;
+ case GL_MAX_ARRAY_TEXTURE_LAYERS:
+ if (gles3_ctx->have_max_array_texture_layers) {
+ *params = gles3_ctx->max_array_texture_layers;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:
+ if (gles3_ctx->have_max_combined_fragment_uniform_components) {
+ *params = gles3_ctx->max_combined_fragment_uniform_components;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_MAX_COMBINED_UNIFORM_BLOCKS:
+ if (gles3_ctx->have_max_combined_uniform_blocks) {
+ *params = gles3_ctx->max_combined_uniform_blocks;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:
+ if (gles3_ctx->have_max_combined_vertex_uniform_components) {
+ *params = gles3_ctx->max_combined_vertex_uniform_components;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_MAX_ELEMENT_INDEX:
+ if (gles3_ctx->have_max_element_index) {
+ *params = gles3_ctx->max_element_index;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_MAX_ELEMENTS_INDICES:
+ if (gles3_ctx->have_max_elements_indices) {
+ *params = gles3_ctx->max_elements_indices;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_MAX_ELEMENTS_VERTICES:
+ if (gles3_ctx->have_max_elements_vertices) {
+ *params = gles3_ctx->max_elements_vertices;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_MAX_FRAGMENT_INPUT_COMPONENTS:
+ if (gles3_ctx->have_max_fragment_input_components) {
+ *params = gles3_ctx->max_fragment_input_components;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_MAX_FRAGMENT_UNIFORM_BLOCKS:
+ if (gles3_ctx->have_max_fragment_uniform_blocks) {
+ *params = gles3_ctx->max_fragment_uniform_blocks;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS:
+ if (gles3_ctx->have_max_fragment_uniform_components) {
+ *params = gles3_ctx->max_fragment_uniform_components;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_MAX_PROGRAM_TEXEL_OFFSET:
+ if (gles3_ctx->have_max_program_texel_offset) {
+ *params = gles3_ctx->max_program_texel_offset;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_MAX_SAMPLES:
+ if (gles3_ctx->have_max_samples) {
+ *params = gles3_ctx->max_samples;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_MAX_TEXTURE_LOD_BIAS:
+ if (gles3_ctx->have_max_texture_lod_bias) {
+ *params = gles3_ctx->max_texture_lod_bias;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:
+ if (gles3_ctx->have_max_transform_feedback_interleaved_components) {
+ *params = gles3_ctx->max_transform_feedback_interleaved_components;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:
+ if (gles3_ctx->have_max_transform_feedback_separate_components) {
+ *params = gles3_ctx->max_transform_feedback_separate_components;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_MAX_UNIFORM_BLOCK_SIZE:
+ if (gles3_ctx->have_max_uniform_block_size) {
+ *params = gles3_ctx->max_uniform_block_size;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_MAX_VERTEX_OUTPUT_COMPONENTS:
+ if (gles3_ctx->have_max_vertex_output_components) {
+ *params = gles3_ctx->max_vertex_output_components;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_MAX_VERTEX_UNIFORM_BLOCKS:
+ if (gles3_ctx->have_max_vertex_uniform_blocks) {
+ *params = gles3_ctx->max_vertex_uniform_blocks;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_MAX_VERTEX_UNIFORM_COMPONENTS:
+ if (gles3_ctx->have_max_vertex_uniform_components) {
+ *params = gles3_ctx->max_vertex_uniform_components;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_MIN_PROGRAM_TEXEL_OFFSET:
+ if (gles3_ctx->have_min_program_texel_offset) {
+ *params = gles3_ctx->min_program_texel_offset;
+ *num_params = 1;
+ } else {
+ processed = 0;
+ }
+ break;
+ case GL_PRIMITIVE_RESTART_FIXED_INDEX:
+ *params = gles3_ctx->primitive_restart_fixed_index;
+ *num_params = 1;
+ break;
+ default:
+ processed = 0;
+ break;
+ }
+
+ if (processed) {
+ return 1;
+ }
+
+ switch (pname) {
+ case GL_MAX_ARRAY_TEXTURE_LAYERS:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ gles3_ctx->max_array_texture_layers = *params;
+ gles3_ctx->have_max_array_texture_layers = 1;
+ break;
+ case GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ gles3_ctx->max_combined_fragment_uniform_components = *params;
+ gles3_ctx->have_max_combined_fragment_uniform_components = 1;
+ break;
+ case GL_MAX_COMBINED_UNIFORM_BLOCKS:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ gles3_ctx->max_combined_uniform_blocks = *params;
+ gles3_ctx->have_max_combined_uniform_blocks = 1;
+ break;
+ case GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ gles3_ctx->max_combined_vertex_uniform_components = *params;
+ gles3_ctx->have_max_combined_vertex_uniform_components = 1;
+ break;
+ case GL_MAX_ELEMENT_INDEX:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ gles3_ctx->max_element_index = *params;
+ gles3_ctx->have_max_element_index = 1;
+ break;
+ case GL_MAX_ELEMENTS_INDICES:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ gles3_ctx->max_elements_indices = *params;
+ gles3_ctx->have_max_elements_indices = 1;
+ break;
+ case GL_MAX_ELEMENTS_VERTICES:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ gles3_ctx->max_elements_vertices = *params;
+ gles3_ctx->have_max_elements_vertices = 1;
+ break;
+ case GL_MAX_FRAGMENT_INPUT_COMPONENTS:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ gles3_ctx->max_fragment_input_components = *params;
+ gles3_ctx->have_max_fragment_input_components = 1;
+ break;
+ case GL_MAX_FRAGMENT_UNIFORM_BLOCKS:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ gles3_ctx->max_fragment_uniform_blocks = *params;
+ gles3_ctx->have_max_fragment_uniform_blocks = 1;
+ break;
+ case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ gles3_ctx->max_fragment_uniform_components = *params;
+ gles3_ctx->have_max_fragment_uniform_components = 1;
+ break;
+ case GL_MAX_PROGRAM_TEXEL_OFFSET:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ gles3_ctx->max_program_texel_offset = *params;
+ gles3_ctx->have_max_program_texel_offset = 1;
+ break;
+ case GL_MAX_SAMPLES:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ gles3_ctx->max_samples = *params;
+ gles3_ctx->have_max_samples = 1;
+ break;
+ case GL_MAX_TEXTURE_LOD_BIAS:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ gles3_ctx->max_texture_lod_bias = *params;
+ gles3_ctx->have_max_texture_lod_bias = 1;
+ break;
+ case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ gles3_ctx->max_transform_feedback_interleaved_components = *params;
+ gles3_ctx->have_max_transform_feedback_interleaved_components = 1;
+ break;
+ case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ gles3_ctx->max_transform_feedback_separate_components = *params;
+ gles3_ctx->have_max_transform_feedback_separate_components = 1;
+ break;
+ case GL_MAX_UNIFORM_BLOCK_SIZE:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ gles3_ctx->max_uniform_block_size = *params;
+ gles3_ctx->have_max_uniform_block_size = 1;
+ break;
+ case GL_MAX_VERTEX_OUTPUT_COMPONENTS:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ gles3_ctx->max_vertex_output_components = *params;
+ gles3_ctx->have_max_vertex_output_components = 1;
+ break;
+ case GL_MAX_VERTEX_UNIFORM_BLOCKS:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ gles3_ctx->max_vertex_uniform_blocks = *params;
+ gles3_ctx->have_max_vertex_uniform_blocks = 1;
+ break;
+ case GL_MAX_VERTEX_UNIFORM_COMPONENTS:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ gles3_ctx->max_vertex_uniform_components = *params;
+ gles3_ctx->have_max_vertex_uniform_components = 1;
+ break;
+ case GL_MIN_PROGRAM_TEXEL_OFFSET:
+ *num_params = 1;
+ yagl_host_glGetIntegerv(pname, params, *num_params, NULL);
+ gles3_ctx->min_program_texel_offset = *params;
+ gles3_ctx->have_min_program_texel_offset = 1;
+ break;
+ case GL_PROGRAM_BINARY_FORMATS:
+ *num_params = 0;
+ break;
+ default:
+ return yagl_gles2_context_get_integerv(ctx, pname, params, num_params);
+ }
+
+ return 1;
+}
+
+static void yagl_gles3_context_draw_arrays(struct yagl_gles_context *gles_ctx,
+ GLenum mode,
+ GLint first,
+ GLsizei count,
+ GLsizei primcount)
+{
+ struct yagl_gles3_context *ctx = (struct yagl_gles3_context*)gles_ctx;
+
+ YAGL_LOG_FUNC_SET(yagl_gles3_context_draw_arrays);
+
+ if (ctx->tfo->active &&
+ !ctx->tfo->paused &&
+ (mode != ctx->tf_primitive_mode)) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ return;
+ }
+
+ yagl_gles3_context_pre_draw(ctx);
+
+ yagl_gles2_context_draw_arrays(gles_ctx, mode, first, count, primcount);
+
+ yagl_gles3_context_post_draw(ctx);
+}
+
+static void yagl_gles3_context_draw_elements(struct yagl_gles_context *gles_ctx,
+ GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const GLvoid *indices,
+ int32_t indices_count,
+ GLsizei primcount,
+ uint32_t max_idx)
+{
+ struct yagl_gles3_context *ctx = (struct yagl_gles3_context*)gles_ctx;
+
+ YAGL_LOG_FUNC_SET(yagl_gles3_context_draw_elements);
+
+ if (ctx->tfo->active && !ctx->tfo->paused) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ return;
+ }
+
+ yagl_gles3_context_pre_draw(ctx);
+
+ yagl_gles2_context_draw_elements(gles_ctx,
+ mode,
+ count,
+ type,
+ indices,
+ indices_count,
+ primcount,
+ max_idx);
+
+ yagl_gles3_context_post_draw(ctx);
+}
+
+static int yagl_gles3_context_bind_buffer(struct yagl_gles_context *ctx,
+ GLenum target,
+ struct yagl_gles_buffer *buffer)
+{
+ struct yagl_gles3_context *gles3_ctx = (struct yagl_gles3_context*)ctx;
+
+ switch (target) {
+ case GL_UNIFORM_BUFFER:
+ yagl_gles_buffer_acquire(buffer);
+ yagl_gles_buffer_release(gles3_ctx->ubo);
+ gles3_ctx->ubo = buffer;
+ break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER:
+ yagl_gles_buffer_acquire(buffer);
+ yagl_gles_buffer_release(gles3_ctx->tfbo);
+ gles3_ctx->tfbo = buffer;
+ break;
+ case GL_COPY_READ_BUFFER:
+ yagl_gles_buffer_acquire(buffer);
+ yagl_gles_buffer_release(gles3_ctx->crbo);
+ gles3_ctx->crbo = buffer;
+ break;
+ case GL_COPY_WRITE_BUFFER:
+ yagl_gles_buffer_acquire(buffer);
+ yagl_gles_buffer_release(gles3_ctx->cwbo);
+ gles3_ctx->cwbo = buffer;
+ break;
+ default:
+ return 0;
+ }
+
+ return 1;
+}
+
+static void yagl_gles3_context_unbind_buffer(struct yagl_gles_context *ctx,
+ yagl_object_name buffer_local_name)
+{
+ struct yagl_gles3_context *gles3_ctx = (struct yagl_gles3_context*)ctx;
+ GLuint i;
+
+ if (gles3_ctx->ubo && (gles3_ctx->ubo->base.local_name == buffer_local_name)) {
+ yagl_gles_buffer_release(gles3_ctx->ubo);
+ gles3_ctx->ubo = NULL;
+ }
+
+ if (gles3_ctx->tfbo && (gles3_ctx->tfbo->base.local_name == buffer_local_name)) {
+ yagl_gles_buffer_release(gles3_ctx->tfbo);
+ gles3_ctx->tfbo = NULL;
+ }
+
+ for (i = 0; i < gles3_ctx->num_uniform_buffer_bindings; ++i) {
+ struct yagl_gles_buffer *buffer = gles3_ctx->uniform_buffer_bindings[i].buffer;
+
+ if (buffer && (buffer->base.local_name == buffer_local_name)) {
+ yagl_gles3_buffer_binding_reset(&gles3_ctx->uniform_buffer_bindings[i]);
+ }
+ }
+
+ yagl_gles3_transform_feedback_unbind_buffer(gles3_ctx->tfo,
+ buffer_local_name);
+
+ if (gles3_ctx->crbo && (gles3_ctx->crbo->base.local_name == buffer_local_name)) {
+ yagl_gles_buffer_release(gles3_ctx->crbo);
+ gles3_ctx->crbo = NULL;
+ }
+
+ if (gles3_ctx->cwbo && (gles3_ctx->cwbo->base.local_name == buffer_local_name)) {
+ yagl_gles_buffer_release(gles3_ctx->cwbo);
+ gles3_ctx->cwbo = NULL;
+ }
+}
+
+static int yagl_gles3_context_acquire_binded_buffer(struct yagl_gles_context *ctx,
+ GLenum target,
+ struct yagl_gles_buffer **buffer)
+{
+ struct yagl_gles3_context *gles3_ctx = (struct yagl_gles3_context*)ctx;
+
+ switch (target) {
+ case GL_UNIFORM_BUFFER:
+ yagl_gles_buffer_acquire(gles3_ctx->ubo);
+ *buffer = gles3_ctx->ubo;
+ break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER:
+ yagl_gles_buffer_acquire(gles3_ctx->tfbo);
+ *buffer = gles3_ctx->tfbo;
+ break;
+ case GL_COPY_READ_BUFFER:
+ yagl_gles_buffer_acquire(gles3_ctx->crbo);
+ *buffer = gles3_ctx->crbo;
+ break;
+ case GL_COPY_WRITE_BUFFER:
+ yagl_gles_buffer_acquire(gles3_ctx->cwbo);
+ *buffer = gles3_ctx->cwbo;
+ break;
+ default:
+ return 0;
+ }
+
+ return 1;
+}
+
+static int yagl_gles3_context_validate_texture_target(struct yagl_gles_context *ctx,
+ GLenum target,
+ yagl_gles_texture_target *texture_target)
+{
+ if (yagl_gles2_context_validate_texture_target(ctx,
+ target,
+ texture_target)) {
+ return 1;
+ }
+
+ switch (target) {
+ case GL_TEXTURE_2D_ARRAY:
+ *texture_target = yagl_gles_texture_target_2d_array;
+ break;
+ default:
+ return 0;
+ }
+
+ return 1;
+}
+
+static struct yagl_pixel_format
+ *yagl_gles3_context_validate_teximage_format(struct yagl_gles_context *ctx,
+ GLenum internalformat,
+ GLenum format,
+ GLenum type)
+{
+ struct yagl_pixel_format *pf =
+ yagl_gles2_context_validate_teximage_format(ctx,
+ internalformat,
+ format,
+ type);
+
+ if (pf) {
+ return pf;
+ }
+
+ switch (format) {
+ case GL_RED:
+ switch (internalformat) {
+ case GL_R8:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_R8, GL_RED, GL_UNSIGNED_BYTE);
+ }
+ break;
+ case GL_R8_SNORM:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_R8_SNORM, GL_RED, GL_BYTE);
+ }
+ break;
+ case GL_R16F:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_R16F, GL_RED, GL_FLOAT);
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_R16F, GL_RED, GL_HALF_FLOAT);
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_R16F, GL_RED, GL_HALF_FLOAT_OES);
+ }
+ break;
+ case GL_R32F:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_R32F, GL_RED, GL_FLOAT);
+ }
+ break;
+ }
+ break;
+ case GL_RED_INTEGER:
+ switch (internalformat) {
+ case GL_R8UI:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE);
+ }
+ break;
+ case GL_R8I:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_R8I, GL_RED_INTEGER, GL_BYTE);
+ }
+ break;
+ case GL_R16UI:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT);
+ }
+ break;
+ case GL_R16I:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_R16I, GL_RED_INTEGER, GL_SHORT);
+ }
+ break;
+ case GL_R32UI:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT);
+ }
+ break;
+ case GL_R32I:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_R32I, GL_RED_INTEGER, GL_INT);
+ }
+ break;
+ }
+ break;
+ case GL_RG:
+ switch (internalformat) {
+ case GL_RG8:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RG8, GL_RG, GL_UNSIGNED_BYTE);
+ }
+ break;
+ case GL_RG8_SNORM:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RG8_SNORM, GL_RG, GL_BYTE);
+ }
+ break;
+ case GL_RG16F:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RG16F, GL_RG, GL_FLOAT);
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RG16F, GL_RG, GL_HALF_FLOAT);
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RG16F, GL_RG, GL_HALF_FLOAT_OES);
+ }
+ break;
+ case GL_RG32F:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RG32F, GL_RG, GL_FLOAT);
+ }
+ break;
+ }
+ break;
+ case GL_RG_INTEGER:
+ switch (internalformat) {
+ case GL_RG8UI:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RG8UI, GL_RG_INTEGER, GL_UNSIGNED_BYTE);
+ }
+ break;
+ case GL_RG8I:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RG8I, GL_RG_INTEGER, GL_BYTE);
+ }
+ break;
+ case GL_RG16UI:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT);
+ }
+ break;
+ case GL_RG16I:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RG16I, GL_RG_INTEGER, GL_SHORT);
+ }
+ break;
+ case GL_RG32UI:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT);
+ }
+ break;
+ case GL_RG32I:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RG32I, GL_RG_INTEGER, GL_INT);
+ }
+ break;
+ }
+ break;
+ case GL_RGB:
+ switch (internalformat) {
+ case GL_RGB8:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE);
+ }
+ break;
+ case GL_SRGB8:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_SRGB8, GL_RGB, GL_UNSIGNED_BYTE);
+ }
+ break;
+ case GL_RGB565:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGB565, GL_RGB, GL_UNSIGNED_BYTE);
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5);
+ }
+ break;
+ case GL_RGB8_SNORM:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGB8_SNORM, GL_RGB, GL_BYTE);
+ }
+ break;
+ case GL_R11F_G11F_B10F:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_R11F_G11F_B10F, GL_RGB, GL_FLOAT);
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_R11F_G11F_B10F, GL_RGB, GL_HALF_FLOAT);
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_R11F_G11F_B10F, GL_RGB, GL_HALF_FLOAT_OES);
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV);
+ }
+ break;
+ case GL_RGB9_E5:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGB9_E5, GL_RGB, GL_FLOAT);
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGB9_E5, GL_RGB, GL_HALF_FLOAT);
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGB9_E5, GL_RGB, GL_HALF_FLOAT_OES);
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGB9_E5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV);
+ }
+ break;
+ case GL_RGB16F:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGB16F, GL_RGB, GL_FLOAT);
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGB16F, GL_RGB, GL_HALF_FLOAT);
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGB16F, GL_RGB, GL_HALF_FLOAT_OES);
+ }
+ break;
+ case GL_RGB32F:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGB32F, GL_RGB, GL_FLOAT);
+ }
+ break;
+ }
+ break;
+ case GL_RGB_INTEGER:
+ switch (internalformat) {
+ case GL_RGB8UI:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGB8UI, GL_RGB_INTEGER, GL_UNSIGNED_BYTE);
+ }
+ break;
+ case GL_RGB8I:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGB8I, GL_RGB_INTEGER, GL_BYTE);
+ }
+ break;
+ case GL_RGB16UI:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGB16UI, GL_RGB_INTEGER, GL_UNSIGNED_SHORT);
+ }
+ break;
+ case GL_RGB16I:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGB16I, GL_RGB_INTEGER, GL_SHORT);
+ }
+ break;
+ case GL_RGB32UI:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGB32UI, GL_RGB_INTEGER, GL_UNSIGNED_INT);
+ }
+ break;
+ case GL_RGB32I:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGB32I, GL_RGB_INTEGER, GL_INT);
+ }
+ break;
+ }
+ break;
+ case GL_RGBA:
+ switch (internalformat) {
+ case GL_RGBA8:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE);
+ }
+ break;
+ case GL_SRGB8_ALPHA8:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE);
+ }
+ break;
+ case GL_RGBA8_SNORM:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGBA8_SNORM, GL_RGBA, GL_BYTE);
+ }
+ break;
+ case GL_RGB5_A1:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_BYTE);
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1);
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV);
+ }
+ break;
+ case GL_RGBA4:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGBA4, GL_RGBA, GL_UNSIGNED_BYTE);
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGBA4, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4);
+ }
+ break;
+ case GL_RGB10_A2:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV);
+ }
+ break;
+ case GL_RGBA16F:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGBA16F, GL_RGBA, GL_FLOAT);
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT);
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT_OES);
+ }
+ break;
+ case GL_RGBA32F:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGBA32F, GL_RGBA, GL_FLOAT);
+ }
+ break;
+ }
+ break;
+ case GL_RGBA_INTEGER:
+ switch (internalformat) {
+ case GL_RGBA8UI:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGBA8UI, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE);
+ }
+ break;
+ case GL_RGBA8I:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGBA8I, GL_RGBA_INTEGER, GL_BYTE);
+ }
+ break;
+ case GL_RGB10_A2UI:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGB10_A2UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT_2_10_10_10_REV);
+ }
+ break;
+ case GL_RGBA16UI:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT);
+ }
+ break;
+ case GL_RGBA16I:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGBA16I, GL_RGBA_INTEGER, GL_SHORT);
+ }
+ break;
+ case GL_RGBA32UI:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT);
+ }
+ break;
+ case GL_RGBA32I:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGBA32I, GL_RGBA_INTEGER, GL_INT);
+ }
+ break;
+ }
+ break;
+ case GL_DEPTH_COMPONENT:
+ switch (internalformat) {
+ case GL_DEPTH_COMPONENT16:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT);
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT);
+ }
+ break;
+ case GL_DEPTH_COMPONENT24:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT);
+ }
+ break;
+ case GL_DEPTH_COMPONENT32F:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT);
+ }
+ break;
+ }
+ break;
+ case GL_DEPTH_STENCIL:
+ switch (internalformat) {
+ case GL_DEPTH24_STENCIL8:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8);
+ }
+ break;
+ case GL_DEPTH32F_STENCIL8:
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV);
+ }
+ break;
+ }
+ break;
+ }
+
+ return NULL;
+}
+
+static struct yagl_pixel_format
+ *yagl_gles3_context_validate_getteximage_format(struct yagl_gles_context *ctx,
+ GLenum readbuffer_internalformat,
+ GLenum format,
+ GLenum type)
+{
+ const struct yagl_gles_format_info *readbuffer_format_info;
+ struct yagl_pixel_format *pf =
+ yagl_gles2_context_validate_getteximage_format(ctx,
+ readbuffer_internalformat,
+ format,
+ type);
+
+ if (pf) {
+ return pf;
+ }
+
+ readbuffer_format_info = yagl_gles_internalformat_info(readbuffer_internalformat);
+
+ switch (format) {
+ case GL_RGBA:
+ if (readbuffer_internalformat == GL_RGB10_A2) {
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV);
+ }
+ }
+ break;
+ case GL_RGBA_INTEGER:
+ if ((readbuffer_format_info->flags & (yagl_gles_format_unsigned_integer)) != 0) {
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT);
+ }
+ }
+ if ((readbuffer_format_info->flags & (yagl_gles_format_signed_integer)) != 0) {
+ switch (type) {
+ YAGL_PIXEL_FORMAT_CASE(gles3, GL_RGBA32I, GL_RGBA_INTEGER, GL_INT);
+ }
+ }
+ break;
+ }
+
+ return NULL;
+}
+
+static int yagl_gles3_context_validate_copyteximage_format(struct yagl_gles_context *ctx,
+ GLenum readbuffer_internalformat,
+ GLenum *internalformat)
+{
+ const struct yagl_gles_format_info *readbuffer_format_info;
+
+ if (yagl_gles2_context_validate_copyteximage_format(ctx,
+ readbuffer_internalformat,
+ internalformat)) {
+ return 1;
+ }
+
+ readbuffer_format_info = yagl_gles_internalformat_info(readbuffer_internalformat);
+
+ if ((readbuffer_format_info->flags & yagl_gles_format_unsigned_integer) != 0) {
+ switch (*internalformat) {
+ case GL_R8UI:
+ case GL_R16UI:
+ case GL_R32UI:
+ case GL_RG8UI:
+ case GL_RG16UI:
+ case GL_RG32UI:
+ case GL_RGBA8UI:
+ case GL_RGB10_A2UI:
+ case GL_RGBA16UI:
+ case GL_RGBA32UI:
+ case GL_RGB8UI:
+ case GL_RGB16UI:
+ case GL_RGB32UI:
+ return 1;
+ }
+ } else if ((readbuffer_format_info->flags & yagl_gles_format_signed_integer) != 0) {
+ switch (*internalformat) {
+ case GL_R8I:
+ case GL_R16I:
+ case GL_R32I:
+ case GL_RG8I:
+ case GL_RG16I:
+ case GL_RG32I:
+ case GL_RGBA8I:
+ case GL_RGBA16I:
+ case GL_RGBA32I:
+ case GL_RGB8I:
+ case GL_RGB16I:
+ case GL_RGB32I:
+ return 1;
+ }
+ } else {
+ switch (*internalformat) {
+ case GL_R16F:
+ case GL_R32F:
+ case GL_RG16F:
+ case GL_RG32F:
+ case GL_R11F_G11F_B10F:
+ case GL_RGB16F:
+ case GL_RGB32F:
+ case GL_RGBA16F:
+ case GL_RGBA32F:
+ case GL_R8:
+ case GL_RG8:
+ case GL_RGB565:
+ case GL_RGB8:
+ case GL_RGBA4:
+ case GL_RGB5_A1:
+ case GL_RGBA8:
+ case GL_RGB10_A2:
+ case GL_SRGB8_ALPHA8:
+ case GL_R8_SNORM:
+ case GL_RG8_SNORM:
+ case GL_RGB8_SNORM:
+ case GL_RGBA8_SNORM:
+ case GL_SRGB8:
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+static int yagl_gles3_context_validate_texstorage_format(struct yagl_gles_context *ctx,
+ GLenum *internalformat,
+ GLenum *base_internalformat,
+ GLenum *any_format,
+ GLenum *any_type)
+{
+ if (yagl_gles2_context_validate_texstorage_format(ctx,
+ internalformat,
+ base_internalformat,
+ any_format,
+ any_type)) {
+ return 1;
+ }
+
+ switch (*internalformat) {
+ case GL_R8:
+ *any_format = GL_RED;
+ *any_type = GL_UNSIGNED_BYTE;
+ break;
+ case GL_R8_SNORM:
+ *any_format = GL_RED;
+ *any_type = GL_BYTE;
+ break;
+ case GL_R16F:
+ case GL_R32F:
+ *any_format = GL_RED;
+ *any_type = GL_FLOAT;
+ break;
+ case GL_R8UI:
+ *any_format = GL_RED_INTEGER;
+ *any_type = GL_UNSIGNED_BYTE;
+ break;
+ case GL_R8I:
+ *any_format = GL_RED_INTEGER;
+ *any_type = GL_BYTE;
+ break;
+ case GL_R16UI:
+ *any_format = GL_RED_INTEGER;
+ *any_type = GL_UNSIGNED_SHORT;
+ break;
+ case GL_R16I:
+ *any_format = GL_RED_INTEGER;
+ *any_type = GL_SHORT;
+ break;
+ case GL_R32UI:
+ *any_format = GL_RED_INTEGER;
+ *any_type = GL_UNSIGNED_INT;
+ break;
+ case GL_R32I:
+ *any_format = GL_RED_INTEGER;
+ *any_type = GL_INT;
+ break;
+ case GL_RG8:
+ *any_format = GL_RG;
+ *any_type = GL_UNSIGNED_BYTE;
+ break;
+ case GL_RG8_SNORM:
+ *any_format = GL_RG;
+ *any_type = GL_BYTE;
+ break;
+ case GL_RG16F:
+ case GL_RG32F:
+ *any_format = GL_RG;
+ *any_type = GL_FLOAT;
+ break;
+ case GL_RG8UI:
+ *any_format = GL_RG_INTEGER;
+ *any_type = GL_UNSIGNED_BYTE;
+ break;
+ case GL_RG8I:
+ *any_format = GL_RG_INTEGER;
+ *any_type = GL_BYTE;
+ break;
+ case GL_RG16UI:
+ *any_format = GL_RG_INTEGER;
+ *any_type = GL_UNSIGNED_SHORT;
+ break;
+ case GL_RG16I:
+ *any_format = GL_RG_INTEGER;
+ *any_type = GL_SHORT;
+ break;
+ case GL_RG32UI:
+ *any_format = GL_RG_INTEGER;
+ *any_type = GL_UNSIGNED_INT;
+ break;
+ case GL_RG32I:
+ *any_format = GL_RG_INTEGER;
+ *any_type = GL_INT;
+ break;
+ case GL_RGB8:
+ case GL_SRGB8:
+ case GL_RGB565:
+ *any_format = GL_RGB;
+ *any_type = GL_UNSIGNED_BYTE;
+ break;
+ case GL_RGB8_SNORM:
+ *any_format = GL_RGB;
+ *any_type = GL_BYTE;
+ break;
+ case GL_R11F_G11F_B10F:
+ case GL_RGB9_E5:
+ case GL_RGB16F:
+ case GL_RGB32F:
+ *any_format = GL_RGB;
+ *any_type = GL_FLOAT;
+ break;
+ case GL_RGB8UI:
+ *any_format = GL_RGB_INTEGER;
+ *any_type = GL_UNSIGNED_BYTE;
+ break;
+ case GL_RGB8I:
+ *any_format = GL_RGB_INTEGER;
+ *any_type = GL_BYTE;
+ break;
+ case GL_RGB16UI:
+ *any_format = GL_RGB_INTEGER;
+ *any_type = GL_UNSIGNED_SHORT;
+ break;
+ case GL_RGB16I:
+ *any_format = GL_RGB_INTEGER;
+ *any_type = GL_SHORT;
+ break;
+ case GL_RGB32UI:
+ *any_format = GL_RGB_INTEGER;
+ *any_type = GL_UNSIGNED_INT;
+ break;
+ case GL_RGB32I:
+ *any_format = GL_RGB_INTEGER;
+ *any_type = GL_INT;
+ break;
+ case GL_RGBA8:
+ case GL_SRGB8_ALPHA8:
+ case GL_RGB5_A1:
+ case GL_RGBA4:
+ *any_format = GL_RGBA;
+ *any_type = GL_UNSIGNED_BYTE;
+ break;
+ case GL_RGBA8_SNORM:
+ *any_format = GL_RGBA;
+ *any_type = GL_BYTE;
+ break;
+ case GL_RGB10_A2:
+ *any_format = GL_RGBA;
+ *any_type = GL_UNSIGNED_INT_2_10_10_10_REV;
+ break;
+ case GL_RGBA16F:
+ case GL_RGBA32F:
+ *any_format = GL_RGBA;
+ *any_type = GL_FLOAT;
+ break;
+ case GL_RGBA8UI:
+ *any_format = GL_RGBA_INTEGER;
+ *any_type = GL_UNSIGNED_BYTE;
+ break;
+ case GL_RGBA8I:
+ *any_format = GL_RGBA_INTEGER;
+ *any_type = GL_BYTE;
+ break;
+ case GL_RGB10_A2UI:
+ *any_format = GL_RGBA_INTEGER;
+ *any_type = GL_UNSIGNED_INT_2_10_10_10_REV;
+ break;
+ case GL_RGBA16UI:
+ *any_format = GL_RGBA_INTEGER;
+ *any_type = GL_UNSIGNED_SHORT;
+ break;
+ case GL_RGBA16I:
+ *any_format = GL_RGBA_INTEGER;
+ *any_type = GL_SHORT;
+ break;
+ case GL_RGBA32I:
+ *any_format = GL_RGBA_INTEGER;
+ *any_type = GL_INT;
+ break;
+ case GL_RGBA32UI:
+ *any_format = GL_RGBA_INTEGER;
+ *any_type = GL_UNSIGNED_INT;
+ break;
+ case GL_DEPTH_COMPONENT16:
+ case GL_DEPTH_COMPONENT24:
+ *any_format = GL_DEPTH_COMPONENT;
+ *any_type = GL_UNSIGNED_INT;
+ break;
+ case GL_DEPTH_COMPONENT32F:
+ *any_format = GL_DEPTH_COMPONENT;
+ *any_type = GL_FLOAT;
+ break;
+ case GL_DEPTH24_STENCIL8:
+ *any_format = GL_DEPTH_STENCIL;
+ *any_type = GL_UNSIGNED_INT_24_8;
+ break;
+ case GL_DEPTH32F_STENCIL8:
+ *any_format = GL_DEPTH_STENCIL;
+ *any_type = GL_FLOAT_32_UNSIGNED_INT_24_8_REV;
+ break;
+ default:
+ return 0;
+ }
+
+ *base_internalformat = *internalformat;
+
+ return 1;
+}
+
+static int yagl_gles3_context_validate_renderbuffer_format(struct yagl_gles_context *ctx,
+ GLenum *internalformat)
+{
+ if (yagl_gles2_context_validate_renderbuffer_format(ctx,
+ internalformat)) {
+ return 1;
+ }
+
+ switch (*internalformat) {
+ case GL_R8:
+ case GL_R8UI:
+ case GL_R8I:
+ case GL_R16UI:
+ case GL_R16I:
+ case GL_R32UI:
+ case GL_R32I:
+ case GL_RG8:
+ case GL_RG8UI:
+ case GL_RG8I:
+ case GL_RG16UI:
+ case GL_RG16I:
+ case GL_RG32UI:
+ case GL_RG32I:
+ case GL_RGB8:
+ case GL_RGBA8:
+ case GL_SRGB8_ALPHA8:
+ case GL_RGB10_A2:
+ case GL_RGBA8UI:
+ case GL_RGBA8I:
+ case GL_RGB10_A2UI:
+ case GL_RGBA16UI:
+ case GL_RGBA16I:
+ case GL_RGBA32I:
+ case GL_RGBA32UI:
+ case GL_DEPTH_COMPONENT32F:
+ case GL_DEPTH32F_STENCIL8:
+ break;
+ default:
+ return 0;
+ }
+
+ return 1;
+}
+
+static void yagl_gles3_context_hint(struct yagl_gles_context *gles_ctx,
+ GLenum target,
+ GLenum mode)
+{
+ struct yagl_gles3_context *ctx = (struct yagl_gles3_context*)gles_ctx;
+
+ switch (target) {
+ case GL_FRAGMENT_SHADER_DERIVATIVE_HINT:
+ ctx->fragment_shader_derivative_hint = mode;
+ break;
+ default:
+ yagl_gles2_context_hint(gles_ctx, target, mode);
+ break;
+ }
+}
+
+static int yagl_gles3_context_get_programiv(struct yagl_gles2_context *ctx,
+ struct yagl_gles2_program *program,
+ GLenum pname,
+ GLint *params)
+{
+ if (yagl_gles2_context_get_programiv(ctx, program, pname, params)) {
+ return 1;
+ }
+
+ switch (pname) {
+ case GL_ACTIVE_UNIFORM_BLOCKS:
+ *params = program->num_active_uniform_blocks;
+ break;
+ case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH:
+ *params = program->max_active_uniform_block_bufsize;
+ break;
+ case GL_PROGRAM_BINARY_RETRIEVABLE_HINT:
+ *params = GL_FALSE;
+ break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER_MODE:
+ *params = program->transform_feedback_info.buffer_mode;
+ break;
+ case GL_TRANSFORM_FEEDBACK_VARYINGS:
+ *params = program->transform_feedback_info.num_varyings;
+ break;
+ case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH:
+ *params = program->transform_feedback_info.max_varying_bufsize;
+ break;
+ default:
+ return 0;
+ }
+
+ return 1;
+}
+
+static int yagl_gles3_context_pre_use_program(struct yagl_gles2_context *gles_ctx,
+ struct yagl_gles2_program *program)
+{
+ struct yagl_gles3_context *ctx = (struct yagl_gles3_context*)gles_ctx;
+
+ YAGL_LOG_FUNC_SET(glUseProgram);
+
+ if (ctx->tfo->active && !ctx->tfo->paused) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ return 0;
+ } else {
+ return 1;
+ }
+}
+
+static int yagl_gles3_context_pre_link_program(struct yagl_gles2_context *gles_ctx,
+ struct yagl_gles2_program *program)
+{
+ struct yagl_gles3_context *ctx = (struct yagl_gles3_context*)gles_ctx;
+
+ YAGL_LOG_FUNC_SET(glLinkProgram);
+
+ if (ctx->tfo->active) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ return 0;
+ } else {
+ return 1;
+ }
+}
+
+struct yagl_client_context *yagl_gles3_context_create(struct yagl_sharegroup *sg)
+{
+ struct yagl_gles3_context *gles3_ctx;
+
+ YAGL_LOG_FUNC_ENTER(yagl_gles3_context_create, NULL);
+
+ gles3_ctx = yagl_malloc0(sizeof(*gles3_ctx));
+
+ yagl_gles2_context_init(&gles3_ctx->base, yagl_client_api_gles3, sg);
+
+ yagl_namespace_init(&gles3_ctx->transform_feedbacks);
+ yagl_namespace_init(&gles3_ctx->queries);
+
+ yagl_list_init(&gles3_ctx->active_uniform_buffer_bindings);
+
+ gles3_ctx->fragment_shader_derivative_hint = GL_DONT_CARE;
+
+ gles3_ctx->base.base.base.prepare = &yagl_gles3_context_prepare;
+ gles3_ctx->base.base.base.destroy = &yagl_gles3_context_destroy;
+ gles3_ctx->base.base.create_arrays = &yagl_gles2_context_create_arrays;
+ gles3_ctx->base.base.get_string = &yagl_gles3_context_get_string;
+ gles3_ctx->base.base.compressed_tex_image_2d = &yagl_gles2_context_compressed_tex_image_2d;
+ gles3_ctx->base.base.compressed_tex_sub_image_2d = &yagl_gles2_context_compressed_tex_sub_image_2d;
+ gles3_ctx->base.base.enable = &yagl_gles3_context_enable;
+ gles3_ctx->base.base.is_enabled = &yagl_gles3_context_is_enabled;
+ gles3_ctx->base.base.get_integerv = &yagl_gles3_context_get_integerv;
+ gles3_ctx->base.base.get_floatv = &yagl_gles2_context_get_floatv;
+ gles3_ctx->base.base.draw_arrays = &yagl_gles3_context_draw_arrays;
+ gles3_ctx->base.base.draw_elements = &yagl_gles3_context_draw_elements;
+ gles3_ctx->base.base.bind_buffer = &yagl_gles3_context_bind_buffer;
+ gles3_ctx->base.base.unbind_buffer = &yagl_gles3_context_unbind_buffer;
+ gles3_ctx->base.base.acquire_binded_buffer = &yagl_gles3_context_acquire_binded_buffer;
+ gles3_ctx->base.base.validate_texture_target = &yagl_gles3_context_validate_texture_target;
+ gles3_ctx->base.base.validate_teximage_format = &yagl_gles3_context_validate_teximage_format;
+ gles3_ctx->base.base.validate_getteximage_format = &yagl_gles3_context_validate_getteximage_format;
+ gles3_ctx->base.base.validate_copyteximage_format = &yagl_gles3_context_validate_copyteximage_format;
+ gles3_ctx->base.base.validate_texstorage_format = &yagl_gles3_context_validate_texstorage_format;
+ gles3_ctx->base.base.validate_renderbuffer_format = &yagl_gles3_context_validate_renderbuffer_format;
+ gles3_ctx->base.base.hint = &yagl_gles3_context_hint;
+ gles3_ctx->base.get_programiv = &yagl_gles3_context_get_programiv;
+ gles3_ctx->base.pre_use_program = &yagl_gles3_context_pre_use_program;
+ gles3_ctx->base.pre_link_program = &yagl_gles3_context_pre_link_program;
+
+ YAGL_LOG_FUNC_EXIT("%p", gles3_ctx);
+
+ return &gles3_ctx->base.base.base;
+}
+
+void yagl_gles3_context_bind_buffer_base(struct yagl_gles3_context *ctx,
+ GLenum target,
+ GLuint index,
+ struct yagl_gles_buffer *buffer)
+{
+ YAGL_LOG_FUNC_SET(glBindBufferBase);
+
+ switch (target) {
+ case GL_UNIFORM_BUFFER:
+ if (index >= ctx->num_uniform_buffer_bindings) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ return;
+ }
+
+ /*
+ * Set indexed binding point.
+ */
+
+ yagl_gles3_buffer_binding_set_base(&ctx->uniform_buffer_bindings[index],
+ buffer);
+
+ if (buffer) {
+ yagl_list_add_tail(&ctx->active_uniform_buffer_bindings,
+ &ctx->uniform_buffer_bindings[index].list);
+ }
+
+ /*
+ * Set generic binding point.
+ */
+
+ yagl_gles_buffer_acquire(buffer);
+ yagl_gles_buffer_release(ctx->ubo);
+ ctx->ubo = buffer;
+
+ break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER:
+ /*
+ * Set indexed binding point.
+ */
+
+ if (ctx->tfo->active) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ return;
+ }
+
+ if (!yagl_gles3_transform_feedback_bind_buffer_base(ctx->tfo,
+ index,
+ buffer)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ return;
+ }
+
+ /*
+ * Set generic binding point.
+ */
+
+ yagl_gles_buffer_acquire(buffer);
+ yagl_gles_buffer_release(ctx->tfbo);
+ ctx->tfbo = buffer;
+
+ break;
+ default:
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ return;
+ }
+
+ if (buffer) {
+ yagl_gles_buffer_set_bound(buffer);
+ }
+}
+
+void yagl_gles3_context_bind_buffer_range(struct yagl_gles3_context *ctx,
+ GLenum target,
+ GLuint index,
+ GLintptr offset,
+ GLsizeiptr size,
+ struct yagl_gles_buffer *buffer)
+{
+ YAGL_LOG_FUNC_SET(glBindBufferRange);
+
+ switch (target) {
+ case GL_UNIFORM_BUFFER:
+ if (index >= ctx->num_uniform_buffer_bindings) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ return;
+ }
+
+ if (buffer) {
+ if (size <= 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ return;
+ }
+
+ if ((offset % ctx->uniform_buffer_offset_alignment) != 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ return;
+ }
+ }
+
+ /*
+ * Set indexed binding point.
+ */
+
+ yagl_gles3_buffer_binding_set_range(&ctx->uniform_buffer_bindings[index],
+ buffer, offset, size);
+
+ if (buffer) {
+ yagl_list_add_tail(&ctx->active_uniform_buffer_bindings,
+ &ctx->uniform_buffer_bindings[index].list);
+ }
+
+ /*
+ * Set generic binding point.
+ */
+
+ yagl_gles_buffer_acquire(buffer);
+ yagl_gles_buffer_release(ctx->ubo);
+ ctx->ubo = buffer;
+
+ break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER:
+ /*
+ * Set indexed binding point.
+ */
+
+ if (ctx->tfo->active) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ return;
+ }
+
+ if (buffer) {
+ if (size <= 0) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ return;
+ }
+
+ if (((offset % 4) != 0) || ((size % 4) != 0)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ return;
+ }
+ }
+
+ if (!yagl_gles3_transform_feedback_bind_buffer_range(ctx->tfo,
+ index,
+ offset,
+ size,
+ buffer)) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ return;
+ }
+
+ /*
+ * Set generic binding point.
+ */
+
+ yagl_gles_buffer_acquire(buffer);
+ yagl_gles_buffer_release(ctx->tfbo);
+ ctx->tfbo = buffer;
+
+ break;
+ default:
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ return;
+ }
+
+ if (buffer) {
+ yagl_gles_buffer_set_bound(buffer);
+ }
+}
+
+void yagl_gles3_context_bind_transform_feedback(struct yagl_gles3_context *ctx,
+ GLenum target,
+ struct yagl_gles3_transform_feedback *tfo)
+{
+ YAGL_LOG_FUNC_SET(glBindTransformFeedback);
+
+ if (!tfo) {
+ tfo = ctx->tf_zero;
+ }
+
+ switch (target) {
+ case GL_TRANSFORM_FEEDBACK:
+ if (ctx->tfo->active && !ctx->tfo->paused) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ return;
+ }
+
+ yagl_gles3_transform_feedback_acquire(tfo);
+ yagl_gles3_transform_feedback_release(ctx->tfo);
+ ctx->tfo = tfo;
+ break;
+ default:
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ return;
+ }
+
+ yagl_gles3_transform_feedback_bind(tfo, target);
+}
+
+void yagl_gles3_context_begin_query(struct yagl_gles3_context *ctx,
+ GLenum target,
+ struct yagl_gles3_query *query)
+{
+ YAGL_LOG_FUNC_SET(glBeginQuery);
+
+ if (query->active) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ return;
+ }
+
+ switch (target) {
+ case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
+ if (ctx->tf_primitives_written_query) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ return;
+ }
+
+ yagl_gles3_query_acquire(query);
+ yagl_gles3_query_release(ctx->tf_primitives_written_query);
+ ctx->tf_primitives_written_query = query;
+ break;
+ case GL_ANY_SAMPLES_PASSED:
+ case GL_ANY_SAMPLES_PASSED_CONSERVATIVE:
+ if (ctx->occlusion_query) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ return;
+ }
+
+ yagl_gles3_query_acquire(query);
+ yagl_gles3_query_release(ctx->occlusion_query);
+ ctx->occlusion_query = query;
+ break;
+ default:
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ return;
+ }
+
+ yagl_gles3_query_begin(query, target);
+}
+
+void yagl_gles3_context_end_query(struct yagl_gles3_context *ctx,
+ GLenum target)
+{
+ struct yagl_gles3_query *query = NULL;
+
+ YAGL_LOG_FUNC_SET(glEndQuery);
+
+ switch (target) {
+ case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
+ if (!ctx->tf_primitives_written_query) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ return;
+ }
+
+ query = ctx->tf_primitives_written_query;
+ ctx->tf_primitives_written_query = NULL;
+ break;
+ case GL_ANY_SAMPLES_PASSED:
+ case GL_ANY_SAMPLES_PASSED_CONSERVATIVE:
+ if (!ctx->occlusion_query) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ return;
+ }
+
+ query = ctx->occlusion_query;
+ ctx->occlusion_query = NULL;
+ break;
+ default:
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ return;
+ }
+
+ yagl_gles3_query_end(query, target);
+ yagl_gles3_query_release(query);
+}
+
+int yagl_gles3_context_acquire_active_query(struct yagl_gles3_context *ctx,
+ GLenum target,
+ struct yagl_gles3_query **query)
+{
+ switch (target) {
+ case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
+ yagl_gles3_query_acquire(ctx->tf_primitives_written_query);
+ *query = ctx->tf_primitives_written_query;
+ break;
+ case GL_ANY_SAMPLES_PASSED:
+ case GL_ANY_SAMPLES_PASSED_CONSERVATIVE:
+ yagl_gles3_query_acquire(ctx->occlusion_query);
+ *query = ctx->occlusion_query;
+ break;
+ default:
+ return 0;
+ }
+
+ return 1;
+}
+
+int yagl_gles3_context_bind_sampler(struct yagl_gles3_context *ctx,
+ GLuint unit,
+ struct yagl_gles_sampler *sampler)
+{
+ if (unit > ctx->base.base.num_texture_units) {
+ return 0;
+ }
+
+ yagl_gles_sampler_acquire(sampler);
+ yagl_gles_sampler_release(ctx->base.base.texture_units[unit].sampler);
+ ctx->base.base.texture_units[unit].sampler = sampler;
+
+ yagl_gles_sampler_bind(sampler, unit);
+
+ return 1;
+}
+
+void yagl_gles3_context_unbind_sampler(struct yagl_gles3_context *ctx,
+ yagl_object_name sampler_local_name)
+{
+ int i;
+
+ for (i = 0; i < ctx->base.base.num_texture_units; ++i) {
+ if (ctx->base.base.texture_units[i].sampler &&
+ (ctx->base.base.texture_units[i].sampler->base.local_name == sampler_local_name)) {
+ yagl_gles_sampler_release(ctx->base.base.texture_units[i].sampler);
+ ctx->base.base.texture_units[i].sampler = NULL;
+ }
+ }
+}
+
+int yagl_gles3_context_get_integerv_indexed(struct yagl_gles3_context *ctx,
+ GLenum target,
+ GLuint index,
+ GLint *params,
+ uint32_t *num_params)
+{
+ YAGL_LOG_FUNC_SET(glGetIntegeri_v);
+
+ switch (target) {
+ case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE:
+ if (index >= ctx->tfo->num_buffer_bindings) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ return 0;
+ }
+
+ if (ctx->tfo->buffer_bindings[index].entire) {
+ *params = 0;
+ } else {
+ *params = ctx->tfo->buffer_bindings[index].size;
+ }
+
+ *num_params = 1;
+ break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER_START:
+ if (index >= ctx->tfo->num_buffer_bindings) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ return 0;
+ }
+
+ if (ctx->tfo->buffer_bindings[index].entire) {
+ *params = 0;
+ } else {
+ *params = ctx->tfo->buffer_bindings[index].offset;
+ }
+
+ *num_params = 1;
+ break;
+ case GL_UNIFORM_BUFFER_SIZE:
+ if (index >= ctx->num_uniform_buffer_bindings) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ return 0;
+ }
+
+ if (ctx->uniform_buffer_bindings[index].entire) {
+ *params = 0;
+ } else {
+ *params = ctx->uniform_buffer_bindings[index].size;
+ }
+
+ *num_params = 1;
+ break;
+ case GL_UNIFORM_BUFFER_START:
+ if (index >= ctx->num_uniform_buffer_bindings) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ return 0;
+ }
+
+ if (ctx->uniform_buffer_bindings[index].entire) {
+ *params = 0;
+ } else {
+ *params = ctx->uniform_buffer_bindings[index].offset;
+ }
+
+ *num_params = 1;
+ break;
+ case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
+ if (index >= ctx->tfo->num_buffer_bindings) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ return 0;
+ }
+ *params = ctx->tfo->buffer_bindings[index].buffer ? ctx->tfo->buffer_bindings[index].buffer->base.local_name : 0;
+ *num_params = 1;
+ break;
+ case GL_UNIFORM_BUFFER_BINDING:
+ if (index >= ctx->num_uniform_buffer_bindings) {
+ YAGL_SET_ERR(GL_INVALID_VALUE);
+ return 0;
+ }
+ *params = ctx->uniform_buffer_bindings[index].buffer ? ctx->uniform_buffer_bindings[index].buffer->base.local_name : 0;
+ *num_params = 1;
+ break;
+ default:
+ YAGL_SET_ERR(GL_INVALID_ENUM);
+ return 0;
+ }
+
+ return 1;
+}
+
+void yagl_gles3_context_draw_range_elements(struct yagl_gles3_context *ctx,
+ GLenum mode,
+ GLuint start,
+ GLuint end,
+ GLsizei count,
+ GLenum type,
+ const GLvoid *indices,
+ int32_t indices_count)
+{
+ YAGL_LOG_FUNC_SET(yagl_gles3_context_draw_range_elements);
+
+ if (ctx->tfo->active && !ctx->tfo->paused) {
+ YAGL_SET_ERR(GL_INVALID_OPERATION);
+ return;
+ }
+
+ yagl_gles3_context_pre_draw(ctx);
+ yagl_gles2_context_pre_draw(&ctx->base, mode, end + 1);
+
+ yagl_host_glDrawRangeElements(mode, start, end, count, type, indices, indices_count);
+
+ yagl_gles2_context_post_draw(&ctx->base, mode, end + 1);
+ yagl_gles3_context_post_draw(ctx);
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES3_CONTEXT_H_
+#define _YAGL_GLES3_CONTEXT_H_
+
+#include "yagl_gles2_context.h"
+#include "yagl_namespace.h"
+#include "yagl_list.h"
+
+struct yagl_gles_buffer;
+struct yagl_gles_sampler;
+struct yagl_gles3_buffer_binding;
+struct yagl_gles3_transform_feedback;
+struct yagl_gles3_query;
+
+struct yagl_gles3_context
+{
+ struct yagl_gles2_context base;
+
+ struct yagl_namespace transform_feedbacks;
+ struct yagl_namespace queries;
+
+ GLboolean primitive_restart_fixed_index;
+ GLboolean rasterizer_discard;
+
+ GLenum fragment_shader_derivative_hint;
+
+ int have_max_array_texture_layers;
+ GLint max_array_texture_layers;
+
+ int have_max_combined_fragment_uniform_components;
+ GLint max_combined_fragment_uniform_components;
+
+ int have_max_combined_uniform_blocks;
+ GLint max_combined_uniform_blocks;
+
+ int have_max_combined_vertex_uniform_components;
+ GLint max_combined_vertex_uniform_components;
+
+ int have_max_element_index;
+ GLint max_element_index;
+
+ int have_max_elements_indices;
+ GLint max_elements_indices;
+
+ int have_max_elements_vertices;
+ GLint max_elements_vertices;
+
+ int have_max_fragment_input_components;
+ GLint max_fragment_input_components;
+
+ int have_max_fragment_uniform_blocks;
+ GLint max_fragment_uniform_blocks;
+
+ int have_max_fragment_uniform_components;
+ GLint max_fragment_uniform_components;
+
+ int have_max_program_texel_offset;
+ GLint max_program_texel_offset;
+
+ int have_max_samples;
+ GLint max_samples;
+
+ int have_max_texture_lod_bias;
+ GLint max_texture_lod_bias;
+
+ int have_max_transform_feedback_interleaved_components;
+ GLint max_transform_feedback_interleaved_components;
+
+ int have_max_transform_feedback_separate_components;
+ GLint max_transform_feedback_separate_components;
+
+ int have_max_uniform_block_size;
+ GLint max_uniform_block_size;
+
+ int have_max_vertex_output_components;
+ GLint max_vertex_output_components;
+
+ int have_max_vertex_uniform_blocks;
+ GLint max_vertex_uniform_blocks;
+
+ int have_max_vertex_uniform_components;
+ GLint max_vertex_uniform_components;
+
+ int have_min_program_texel_offset;
+ GLint min_program_texel_offset;
+
+ /*
+ * Uniform buffer objects.
+ * @{
+ */
+
+ struct yagl_gles_buffer *ubo;
+
+ struct yagl_gles3_buffer_binding *uniform_buffer_bindings;
+ GLuint num_uniform_buffer_bindings;
+
+ struct yagl_list active_uniform_buffer_bindings;
+
+ GLint uniform_buffer_offset_alignment;
+
+ /*
+ * @}
+ */
+
+ /*
+ * Transform feedbacks.
+ * @{
+ */
+
+ struct yagl_gles_buffer *tfbo;
+ struct yagl_gles3_transform_feedback *tf_zero;
+ struct yagl_gles3_transform_feedback *tfo;
+ GLenum tf_primitive_mode;
+
+ GLint max_transform_feedback_separate_attribs;
+
+ /*
+ * @}
+ */
+
+ /*
+ * Queries.
+ * @{
+ */
+
+ struct yagl_gles3_query *tf_primitives_written_query;
+ struct yagl_gles3_query *occlusion_query;
+
+ /*
+ * @}
+ */
+
+ /*
+ * Copy buffer objects.
+ * @{
+ */
+
+ struct yagl_gles_buffer *crbo;
+ struct yagl_gles_buffer *cwbo;
+
+ /*
+ * @}
+ */
+};
+
+struct yagl_client_context *yagl_gles3_context_create(struct yagl_sharegroup *sg);
+
+void yagl_gles3_context_bind_buffer_base(struct yagl_gles3_context *ctx,
+ GLenum target,
+ GLuint index,
+ struct yagl_gles_buffer *buffer);
+
+void yagl_gles3_context_bind_buffer_range(struct yagl_gles3_context *ctx,
+ GLenum target,
+ GLuint index,
+ GLintptr offset,
+ GLsizeiptr size,
+ struct yagl_gles_buffer *buffer);
+
+void yagl_gles3_context_bind_transform_feedback(struct yagl_gles3_context *ctx,
+ GLenum target,
+ struct yagl_gles3_transform_feedback *tfo);
+
+void yagl_gles3_context_begin_query(struct yagl_gles3_context *ctx,
+ GLenum target,
+ struct yagl_gles3_query *query);
+
+void yagl_gles3_context_end_query(struct yagl_gles3_context *ctx,
+ GLenum target);
+
+int yagl_gles3_context_acquire_active_query(struct yagl_gles3_context *ctx,
+ GLenum target,
+ struct yagl_gles3_query **query);
+
+int yagl_gles3_context_bind_sampler(struct yagl_gles3_context *ctx,
+ GLuint unit,
+ struct yagl_gles_sampler *sampler);
+
+void yagl_gles3_context_unbind_sampler(struct yagl_gles3_context *ctx,
+ yagl_object_name sampler_local_name);
+
+int yagl_gles3_context_get_integerv_indexed(struct yagl_gles3_context *ctx,
+ GLenum target,
+ GLuint index,
+ GLint *params,
+ uint32_t *num_params);
+
+void yagl_gles3_context_draw_range_elements(struct yagl_gles3_context *ctx,
+ GLenum mode,
+ GLuint start,
+ GLuint end,
+ GLsizei count,
+ GLenum type,
+ const GLvoid *indices,
+ int32_t indices_count);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GLES3/gl3.h"
+#include "yagl_gles3_pixel_formats.h"
+
+/*
+ * We can't include GLES2/gl2ext.h here
+ */
+#define GL_HALF_FLOAT_OES 0x8D61
+
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_R8, GL_RED, GL_UNSIGNED_BYTE, GL_R8, GL_UNSIGNED_BYTE, 1);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_R8_SNORM, GL_RED, GL_BYTE, GL_R8_SNORM, GL_BYTE, 1);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_R16F, GL_RED, GL_FLOAT, GL_R16F, GL_FLOAT, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_R16F, GL_RED, GL_HALF_FLOAT, GL_R16F, GL_HALF_FLOAT, 2);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_R16F, GL_RED, GL_HALF_FLOAT_OES, GL_R16F, GL_HALF_FLOAT, 2);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_R32F, GL_RED, GL_FLOAT, GL_R32F, GL_FLOAT, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE, GL_R8UI, GL_UNSIGNED_BYTE, 1);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_R8I, GL_RED_INTEGER, GL_BYTE, GL_R8I, GL_BYTE, 1);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT, GL_R16UI, GL_UNSIGNED_SHORT, 2);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_R16I, GL_RED_INTEGER, GL_SHORT, GL_R16I, GL_SHORT, 2);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT, GL_R32UI, GL_UNSIGNED_INT, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_R32I, GL_RED_INTEGER, GL_INT, GL_R32I, GL_INT, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RG8, GL_RG, GL_UNSIGNED_BYTE, GL_RG8, GL_UNSIGNED_BYTE, 2);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RG8_SNORM, GL_RG, GL_BYTE, GL_RG8_SNORM, GL_BYTE, 2);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RG16F, GL_RG, GL_FLOAT, GL_RG16F, GL_FLOAT, 8);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RG16F, GL_RG, GL_HALF_FLOAT, GL_RG16F, GL_HALF_FLOAT, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RG16F, GL_RG, GL_HALF_FLOAT_OES, GL_RG16F, GL_HALF_FLOAT, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RG32F, GL_RG, GL_FLOAT, GL_RG32F, GL_FLOAT, 8);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RG8UI, GL_RG_INTEGER, GL_UNSIGNED_BYTE, GL_RG8UI, GL_UNSIGNED_BYTE, 2);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RG8I, GL_RG_INTEGER, GL_BYTE, GL_RG8I, GL_BYTE, 2);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT, GL_RG16UI, GL_UNSIGNED_SHORT, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RG16I, GL_RG_INTEGER, GL_SHORT, GL_RG16I, GL_SHORT, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT, GL_RG32UI, GL_UNSIGNED_INT, 8);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RG32I, GL_RG_INTEGER, GL_INT, GL_RG32I, GL_INT, 8);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, GL_RGB8, GL_UNSIGNED_BYTE, 3);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_SRGB8, GL_RGB, GL_UNSIGNED_BYTE, GL_SRGB8, GL_UNSIGNED_BYTE, 3);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGB565, GL_RGB, GL_UNSIGNED_BYTE, GL_RGB565, GL_UNSIGNED_BYTE, 3);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, GL_RGB565, GL_UNSIGNED_SHORT_5_6_5, 2);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGB8_SNORM, GL_RGB, GL_BYTE, GL_RGB8_SNORM, GL_BYTE, 3);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_R11F_G11F_B10F, GL_RGB, GL_FLOAT, GL_R11F_G11F_B10F, GL_FLOAT, 12);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_R11F_G11F_B10F, GL_RGB, GL_HALF_FLOAT, GL_R11F_G11F_B10F, GL_HALF_FLOAT, 6);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_R11F_G11F_B10F, GL_RGB, GL_HALF_FLOAT_OES, GL_R11F_G11F_B10F, GL_HALF_FLOAT, 6);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, GL_R11F_G11F_B10F, GL_UNSIGNED_INT_10F_11F_11F_REV, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGB9_E5, GL_RGB, GL_FLOAT, GL_RGB9_E5, GL_FLOAT, 12);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGB9_E5, GL_RGB, GL_HALF_FLOAT, GL_RGB9_E5, GL_HALF_FLOAT, 6);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGB9_E5, GL_RGB, GL_HALF_FLOAT_OES, GL_RGB9_E5, GL_HALF_FLOAT, 6);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGB9_E5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV, GL_RGB9_E5, GL_UNSIGNED_INT_5_9_9_9_REV, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGB16F, GL_RGB, GL_FLOAT, GL_RGB16F, GL_FLOAT, 12);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGB16F, GL_RGB, GL_HALF_FLOAT, GL_RGB16F, GL_HALF_FLOAT, 6);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGB16F, GL_RGB, GL_HALF_FLOAT_OES, GL_RGB16F, GL_HALF_FLOAT, 6);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGB32F, GL_RGB, GL_FLOAT, GL_RGB32F, GL_FLOAT, 12);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGB8UI, GL_RGB_INTEGER, GL_UNSIGNED_BYTE, GL_RGB8UI, GL_UNSIGNED_BYTE, 3);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGB8I, GL_RGB_INTEGER, GL_BYTE, GL_RGB8I, GL_BYTE, 3);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGB16UI, GL_RGB_INTEGER, GL_UNSIGNED_SHORT, GL_RGB16UI, GL_UNSIGNED_SHORT, 6);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGB16I, GL_RGB_INTEGER, GL_SHORT, GL_RGB16I, GL_SHORT, 6);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGB32UI, GL_RGB_INTEGER, GL_UNSIGNED_INT, GL_RGB32UI, GL_UNSIGNED_INT, 12);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGB32I, GL_RGB_INTEGER, GL_INT, GL_RGB32I, GL_INT, 12);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, GL_RGBA8, GL_UNSIGNED_BYTE, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE, GL_SRGB8_ALPHA8, GL_UNSIGNED_BYTE, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGBA8_SNORM, GL_RGBA, GL_BYTE, GL_RGBA8_SNORM, GL_BYTE, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_BYTE, GL_RGB5_A1, GL_UNSIGNED_BYTE, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, GL_RGB5_A1, GL_UNSIGNED_SHORT_5_5_5_1, 2);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, GL_RGB5_A1, GL_UNSIGNED_INT_2_10_10_10_REV, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGBA4, GL_RGBA, GL_UNSIGNED_BYTE, GL_RGBA4, GL_UNSIGNED_BYTE, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGBA4, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, GL_RGBA4, GL_UNSIGNED_SHORT_4_4_4_4, 2);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, GL_RGB10_A2, GL_UNSIGNED_INT_2_10_10_10_REV, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGBA16F, GL_RGBA, GL_FLOAT, GL_RGBA16F, GL_FLOAT, 16);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT, GL_RGBA16F, GL_HALF_FLOAT, 8);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT_OES, GL_RGBA16F, GL_HALF_FLOAT, 8);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGBA32F, GL_RGBA, GL_FLOAT, GL_RGBA32F, GL_FLOAT, 16);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGBA8UI, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE, GL_RGBA8UI, GL_UNSIGNED_BYTE, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGBA8I, GL_RGBA_INTEGER, GL_BYTE, GL_RGBA8I, GL_BYTE, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGB10_A2UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT_2_10_10_10_REV, GL_RGB10_A2UI, GL_UNSIGNED_INT_2_10_10_10_REV, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT, GL_RGBA16UI, GL_UNSIGNED_SHORT, 8);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGBA16I, GL_RGBA_INTEGER, GL_SHORT, GL_RGBA16I, GL_SHORT, 8);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT, GL_RGBA32UI, GL_UNSIGNED_INT, 16);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_RGBA32I, GL_RGBA_INTEGER, GL_INT, GL_RGBA32I, GL_INT, 16);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, GL_DEPTH_COMPONENT16, GL_UNSIGNED_SHORT, 2);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, GL_DEPTH_COMPONENT16, GL_UNSIGNED_INT, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, GL_DEPTH_COMPONENT24, GL_UNSIGNED_INT, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT, GL_DEPTH_COMPONENT32F, GL_FLOAT, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_DEPTH24_STENCIL8, GL_UNSIGNED_INT_24_8, 4);
+YAGL_PIXEL_FORMAT_IMPL_NOCONV(gles3, GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, GL_DEPTH32F_STENCIL8, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, 8);
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES3_PIXEL_FORMATS_H_
+#define _YAGL_GLES3_PIXEL_FORMATS_H_
+
+#include "yagl_pixel_format.h"
+
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_R8, GL_RED, GL_UNSIGNED_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_R8_SNORM, GL_RED, GL_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_R16F, GL_RED, GL_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_R16F, GL_RED, GL_HALF_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_R16F, GL_RED, GL_HALF_FLOAT_OES);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_R32F, GL_RED, GL_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_R8I, GL_RED_INTEGER, GL_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_R16I, GL_RED_INTEGER, GL_SHORT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_R32UI, GL_RED_INTEGER, GL_UNSIGNED_INT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_R32I, GL_RED_INTEGER, GL_INT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RG8, GL_RG, GL_UNSIGNED_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RG8_SNORM, GL_RG, GL_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RG16F, GL_RG, GL_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RG16F, GL_RG, GL_HALF_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RG16F, GL_RG, GL_HALF_FLOAT_OES);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RG32F, GL_RG, GL_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RG8UI, GL_RG_INTEGER, GL_UNSIGNED_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RG8I, GL_RG_INTEGER, GL_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RG16UI, GL_RG_INTEGER, GL_UNSIGNED_SHORT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RG16I, GL_RG_INTEGER, GL_SHORT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RG32UI, GL_RG_INTEGER, GL_UNSIGNED_INT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RG32I, GL_RG_INTEGER, GL_INT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_SRGB8, GL_RGB, GL_UNSIGNED_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGB565, GL_RGB, GL_UNSIGNED_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGB565, GL_RGB, GL_UNSIGNED_SHORT_5_6_5);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGB8_SNORM, GL_RGB, GL_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_R11F_G11F_B10F, GL_RGB, GL_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_R11F_G11F_B10F, GL_RGB, GL_HALF_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_R11F_G11F_B10F, GL_RGB, GL_HALF_FLOAT_OES);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGB9_E5, GL_RGB, GL_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGB9_E5, GL_RGB, GL_HALF_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGB9_E5, GL_RGB, GL_HALF_FLOAT_OES);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGB9_E5, GL_RGB, GL_UNSIGNED_INT_5_9_9_9_REV);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGB16F, GL_RGB, GL_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGB16F, GL_RGB, GL_HALF_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGB16F, GL_RGB, GL_HALF_FLOAT_OES);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGB32F, GL_RGB, GL_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGB8UI, GL_RGB_INTEGER, GL_UNSIGNED_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGB8I, GL_RGB_INTEGER, GL_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGB16UI, GL_RGB_INTEGER, GL_UNSIGNED_SHORT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGB16I, GL_RGB_INTEGER, GL_SHORT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGB32UI, GL_RGB_INTEGER, GL_UNSIGNED_INT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGB32I, GL_RGB_INTEGER, GL_INT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGBA8_SNORM, GL_RGBA, GL_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGB5_A1, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGBA4, GL_RGBA, GL_UNSIGNED_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGBA4, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGB10_A2, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGBA16F, GL_RGBA, GL_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGBA16F, GL_RGBA, GL_HALF_FLOAT_OES);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGBA32F, GL_RGBA, GL_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGBA8UI, GL_RGBA_INTEGER, GL_UNSIGNED_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGBA8I, GL_RGBA_INTEGER, GL_BYTE);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGB10_A2UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT_2_10_10_10_REV);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGBA16I, GL_RGBA_INTEGER, GL_SHORT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_RGBA32I, GL_RGBA_INTEGER, GL_INT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT, GL_FLOAT);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_DEPTH24_STENCIL8, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8);
+YAGL_PIXEL_FORMAT_DECL(gles3, GL_DEPTH32F_STENCIL8, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GLES3/gl3.h"
+#include "yagl_gles3_program.h"
+#include "yagl_gles2_utils.h"
+#include "yagl_malloc.h"
+#include "yagl_state.h"
+#include "yagl_transport.h"
+#include "yagl_log.h"
+#include "yagl_host_gles_calls.h"
+#include <string.h>
+
+static int yagl_gles3_get_uniform_param(struct yagl_gles2_uniform_variable *var,
+ GLenum pname,
+ GLint *param)
+{
+ switch (pname) {
+ case GL_UNIFORM_TYPE:
+ if (var->generic_fetched ||
+ var->extended_fetched) {
+ *param = var->type;
+ return 1;
+ }
+ break;
+ case GL_UNIFORM_SIZE:
+ if (var->generic_fetched ||
+ var->extended_fetched) {
+ *param = var->size;
+ return 1;
+ }
+ break;
+ case GL_UNIFORM_NAME_LENGTH:
+ if (var->name_fetched ||
+ var->generic_fetched ||
+ var->extended_fetched) {
+ *param = var->name_size;
+ return 1;
+ }
+ break;
+ case GL_UNIFORM_BLOCK_INDEX:
+ if (var->extended_fetched) {
+ *param = var->block_index;
+ return 1;
+ }
+ break;
+ case GL_UNIFORM_OFFSET:
+ if (var->extended_fetched) {
+ *param = var->block_offset;
+ return 1;
+ }
+ break;
+ case GL_UNIFORM_ARRAY_STRIDE:
+ if (var->extended_fetched) {
+ *param = var->array_stride;
+ return 1;
+ }
+ break;
+ case GL_UNIFORM_MATRIX_STRIDE:
+ if (var->extended_fetched) {
+ *param = var->matrix_stride;
+ return 1;
+ }
+ break;
+ case GL_UNIFORM_IS_ROW_MAJOR:
+ if (var->extended_fetched) {
+ *param = var->is_row_major;
+ return 1;
+ }
+ break;
+ default:
+ break;
+ }
+ return 0;
+}
+
+static int yagl_gles3_get_uniform_block_params(struct yagl_gles2_uniform_block *block,
+ GLenum pname,
+ GLint *params)
+{
+ switch (pname) {
+ case GL_UNIFORM_BLOCK_BINDING:
+ *params = block->binding;
+ return 1;
+ case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:
+ if (block->active_uniform_indices) {
+ memcpy(params,
+ block->active_uniform_indices,
+ block->num_active_uniform_indices *
+ sizeof(block->active_uniform_indices[0]));
+ return 1;
+ }
+ break;
+ case GL_UNIFORM_BLOCK_DATA_SIZE:
+ if (block->params_fetched) {
+ *params = block->data_size;
+ return 1;
+ }
+ break;
+ case GL_UNIFORM_BLOCK_NAME_LENGTH:
+ if (block->name_fetched || block->params_fetched) {
+ *params = block->name_size;
+ return 1;
+ }
+ break;
+ case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS:
+ if (block->params_fetched) {
+ *params = block->num_active_uniform_indices;
+ return 1;
+ }
+ break;
+ case GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:
+ if (block->params_fetched) {
+ *params = block->referenced_by_vertex_shader;
+ return 1;
+ }
+ break;
+ case GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:
+ if (block->params_fetched) {
+ *params = block->referenced_by_fragment_shader;
+ return 1;
+ }
+ break;
+ default:
+ return 0;
+ }
+ return -1;
+}
+
+int yagl_gles3_program_get_active_uniformsiv(struct yagl_gles2_program *program,
+ const GLuint *indices,
+ int num_indices,
+ GLenum pname,
+ GLint *params)
+{
+ int i;
+ GLuint *fetch_indices_positions;
+ int num_fetch_indices = 0;
+ struct yagl_gles2_uniform_variable *var;
+ GLint *fetch_params;
+
+ YAGL_LOG_FUNC_SET(yagl_gles3_program_get_active_uniformsiv);
+
+ fetch_indices_positions = (GLuint*)yagl_get_tmp_buffer(
+ num_indices * sizeof(fetch_indices_positions[0]) * 2);
+
+ for (i = 0; i < num_indices; ++i) {
+ if (indices[i] >= program->num_active_uniforms) {
+ return 0;
+ }
+
+ var = &program->active_uniforms[indices[i]];
+
+ if (!yagl_gles3_get_uniform_param(var, pname, ¶ms[i])) {
+ fetch_indices_positions[num_fetch_indices] = indices[i];
+ fetch_indices_positions[num_indices + num_fetch_indices] = i;
+ ++num_fetch_indices;
+ }
+ }
+
+ if (num_fetch_indices == 0) {
+ /*
+ * Everything read from cache, return.
+ */
+
+ YAGL_LOG_DEBUG("Program %u, got uniform parameters 0x%X for %d indices from cache",
+ program->global_name, pname, num_indices);
+
+ return 1;
+ }
+
+ fetch_params = (GLint*)yagl_get_tmp_buffer2(
+ num_fetch_indices * sizeof(fetch_params[0]) * 8);
+
+ yagl_host_glGetActiveUniformsiv(program->global_name,
+ fetch_indices_positions,
+ num_fetch_indices,
+ fetch_params,
+ num_fetch_indices * 8, NULL);
+
+ for (i = 0; i < num_fetch_indices; ++i) {
+ var = &program->active_uniforms[fetch_indices_positions[i]];
+
+ var->type = fetch_params[i + (num_fetch_indices * 0)];
+ var->size = fetch_params[i + (num_fetch_indices * 1)];
+ var->name_size = fetch_params[i + (num_fetch_indices * 2)];
+ var->block_index = fetch_params[i + (num_fetch_indices * 3)];
+ var->block_offset = fetch_params[i + (num_fetch_indices * 4)];
+ var->array_stride = fetch_params[i + (num_fetch_indices * 5)];
+ var->matrix_stride = fetch_params[i + (num_fetch_indices * 6)];
+ var->is_row_major = fetch_params[i + (num_fetch_indices * 7)];
+
+ var->extended_fetched = 1;
+
+ yagl_gles3_get_uniform_param(var,
+ pname,
+ ¶ms[fetch_indices_positions[num_indices + i]]);
+ }
+
+ YAGL_LOG_DEBUG("Program %u, got uniform parameters 0x%X for %d indices, %d from cache",
+ program->global_name, pname, num_indices,
+ (num_indices - num_fetch_indices));
+
+ return 1;
+}
+
+void yagl_gles3_program_get_uniform_indices(struct yagl_gles2_program *program,
+ const GLchar *const *names,
+ int num_names,
+ GLuint *indices)
+{
+ struct yagl_gles2_uniform_variable *var;
+ GLchar *fetch_names;
+ int num_fetch_names = 0;
+ int *fetch_positions;
+ GLuint *fetch_indices;
+ int i, j;
+
+ YAGL_LOG_FUNC_SET(yagl_gles3_program_get_uniform_indices);
+
+ fetch_names = (GLchar*)yagl_get_tmp_buffer(
+ program->max_active_uniform_bufsize * num_names);
+
+ fetch_positions = (int*)yagl_get_tmp_buffer2(
+ num_names * sizeof(fetch_positions[0]));
+
+ for (i = 0; i < num_names; ++i) {
+ int found = 0;
+
+ if ((strlen(names[i]) + 1) > program->max_active_uniform_bufsize) {
+ indices[i] = GL_INVALID_INDEX;
+ continue;
+ }
+
+ for (j = 0; j < program->num_active_uniforms; ++j) {
+ var = &program->active_uniforms[j];
+
+ if (var->name_fetched && (strcmp(var->name, names[i]) == 0)) {
+ indices[i] = j;
+ found = 1;
+ break;
+ }
+ }
+
+ if (!found) {
+ strcpy(fetch_names +
+ (program->max_active_uniform_bufsize * num_fetch_names),
+ names[i]);
+ fetch_positions[num_fetch_names] = i;
+ ++num_fetch_names;
+ }
+ }
+
+ if (num_fetch_names == 0) {
+ /*
+ * Everything read from cache, return.
+ */
+
+ YAGL_LOG_DEBUG("Program %u, got uniform indices for %d names from cache",
+ program->global_name, num_names);
+
+ return;
+ }
+
+ fetch_indices = (GLuint*)yagl_get_tmp_buffer3(
+ num_fetch_names * sizeof(fetch_indices[0]));
+
+ yagl_host_glGetUniformIndices(program->global_name,
+ fetch_names,
+ program->max_active_uniform_bufsize * num_fetch_names,
+ fetch_indices,
+ num_fetch_names,
+ NULL);
+
+ for (i = 0; i < num_fetch_names; ++i) {
+ indices[fetch_positions[i]] = fetch_indices[i];
+
+ if ((fetch_indices[i] == GL_INVALID_INDEX) ||
+ (fetch_indices[i] >= program->num_active_uniforms)) {
+ continue;
+ }
+
+ var = &program->active_uniforms[fetch_indices[i]];
+
+ var->name_size = strlen(names[fetch_positions[i]]) + 1;
+ yagl_free(var->name);
+ var->name = yagl_malloc(var->name_size);
+
+ strcpy(var->name, names[fetch_positions[i]]);
+
+ var->name_fetched = 1;
+ }
+
+ YAGL_LOG_DEBUG("Program %u, got uniform indices for %d names, %d from cache",
+ program->global_name, num_names,
+ (num_names - num_fetch_names));
+}
+
+GLuint yagl_gles3_program_get_uniform_block_index(struct yagl_gles2_program *program,
+ const GLchar *block_name)
+{
+ int32_t block_name_size = strlen(block_name) + 1;
+ GLuint i;
+ struct yagl_gles2_uniform_block *block;
+
+ YAGL_LOG_FUNC_SET(yagl_gles3_program_get_uniform_block_index);
+
+ if (block_name_size > program->max_active_uniform_block_bufsize) {
+ return GL_INVALID_INDEX;
+ }
+
+ for (i = 0; i < program->num_active_uniform_blocks; ++i) {
+ block = &program->active_uniform_blocks[i];
+
+ if (block->name_fetched && (strcmp(block->name, block_name) == 0)) {
+ YAGL_LOG_DEBUG("Program %u, got uniform block index for %s = %u from cache",
+ program->global_name, block_name, i);
+
+ return i;
+ }
+ }
+
+ i = yagl_host_glGetUniformBlockIndex(program->global_name,
+ block_name,
+ block_name_size);
+
+ if ((i != GL_INVALID_INDEX) && (i < program->num_active_uniform_blocks)) {
+ block = &program->active_uniform_blocks[i];
+
+ block->name_size = block_name_size;
+ yagl_free(block->name);
+ block->name = yagl_malloc(block_name_size);
+
+ strcpy(block->name, block_name);
+
+ block->name_fetched = 1;
+ }
+
+ YAGL_LOG_DEBUG("Program %u, got uniform block index for %s = %u",
+ program->global_name, block_name, i);
+
+ return i;
+}
+
+void yagl_gles3_program_set_uniform_block_binding(struct yagl_gles2_program *program,
+ GLuint block_index,
+ GLuint block_binding)
+{
+ YAGL_LOG_FUNC_SET(yagl_gles3_program_set_uniform_block_binding);
+
+ if (block_index >= program->num_active_uniform_blocks) {
+ return;
+ }
+
+ yagl_host_glUniformBlockBinding(program->global_name,
+ block_index,
+ block_binding);
+
+ program->active_uniform_blocks[block_index].binding = block_binding;
+
+ YAGL_LOG_DEBUG("Program %u, setting uniform block binding %u to %u",
+ program->global_name, block_index, block_binding);
+}
+
+void yagl_gles3_program_get_active_uniform_block_name(struct yagl_gles2_program *program,
+ GLuint block_index,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLchar *block_name)
+{
+ struct yagl_gles2_uniform_block *block;
+
+ YAGL_LOG_FUNC_SET(yagl_gles3_program_get_active_uniform_block_name);
+
+ if (block_index >= program->num_active_uniform_blocks) {
+ return;
+ }
+
+ block = &program->active_uniform_blocks[block_index];
+
+ if (!block->name_fetched) {
+ yagl_free(block->name);
+ block->name = yagl_malloc(program->max_active_uniform_block_bufsize);
+ block->name[0] = '\0';
+
+ yagl_host_glGetActiveUniformBlockName(program->global_name,
+ block_index,
+ block->name,
+ program->max_active_uniform_block_bufsize,
+ &block->name_size);
+
+ block->name_fetched = 1;
+ }
+
+ yagl_gles2_set_name(block->name, block->name_size,
+ bufsize,
+ length,
+ block_name);
+
+ YAGL_LOG_DEBUG("Program %u, got active uniform block name at index %u = %s",
+ program->global_name,
+ block_index,
+ ((bufsize > 0) ? block_name : NULL));
+}
+
+int yagl_gles3_program_get_active_uniform_blockiv(struct yagl_gles2_program *program,
+ GLuint block_index,
+ GLenum pname,
+ GLint *params)
+{
+ struct yagl_gles2_uniform_block *block;
+ int res;
+ GLint *fetch_params;
+
+ YAGL_LOG_FUNC_SET(yagl_gles3_program_get_active_uniform_blockiv);
+
+ if (block_index >= program->num_active_uniform_blocks) {
+ return 0;
+ }
+
+ block = &program->active_uniform_blocks[block_index];
+
+ res = yagl_gles3_get_uniform_block_params(block,
+ pname,
+ params);
+
+ if (res >= 0) {
+ if (res > 0) {
+ YAGL_LOG_DEBUG("Program %u, got active uniform block %u pname 0x%X from cache",
+ program->global_name,
+ block_index,
+ pname);
+ }
+
+ return res;
+ }
+
+ if (!block->params_fetched) {
+ fetch_params = (GLint*)yagl_get_tmp_buffer(
+ sizeof(fetch_params[0]) * 5);
+
+ yagl_host_glGetActiveUniformBlockiv(program->global_name,
+ block_index,
+ 0,
+ fetch_params,
+ 5,
+ NULL);
+
+ block->data_size = fetch_params[0];
+ block->name_size = fetch_params[1];
+ block->num_active_uniform_indices = fetch_params[2];
+ block->referenced_by_vertex_shader = fetch_params[3];
+ block->referenced_by_fragment_shader = fetch_params[4];
+
+ block->params_fetched = 1;
+ }
+
+ if (pname == GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES) {
+ yagl_free(block->active_uniform_indices);
+
+ block->active_uniform_indices = yagl_malloc(
+ block->num_active_uniform_indices *
+ sizeof(block->active_uniform_indices[0]));
+
+ yagl_host_glGetActiveUniformBlockiv(program->global_name,
+ block_index,
+ pname,
+ (GLint*)block->active_uniform_indices,
+ block->num_active_uniform_indices,
+ NULL);
+ }
+
+ yagl_gles3_get_uniform_block_params(block, pname, params);
+
+ YAGL_LOG_DEBUG("Program %u, got active uniform block %u pname 0x%X",
+ program->global_name,
+ block_index,
+ pname);
+
+ return 1;
+}
+
+void yagl_gles3_program_set_transform_feedback_varyings(struct yagl_gles2_program *program,
+ const GLchar *const *varyings,
+ GLuint num_varyings,
+ GLenum buffer_mode)
+{
+ GLchar *varyings_str = NULL;
+ GLint varyings_size = 0;
+
+ struct yagl_gles2_transform_feedback_info *tfi = &program->transform_feedback_info;
+
+ yagl_gles2_transform_feedback_info_reset(tfi);
+
+ if (num_varyings > 0) {
+ GLuint i;
+ GLchar *tmp;
+
+ tfi->varyings = yagl_malloc0(num_varyings * sizeof(*tfi->varyings));
+
+ for (i = 0; i < num_varyings; ++i) {
+ tfi->varyings[i].name_size = strlen(varyings[i]) + 1;
+ tfi->varyings[i].name = yagl_malloc(tfi->varyings[i].name_size);
+ memcpy(tfi->varyings[i].name, varyings[i], tfi->varyings[i].name_size);
+
+ if (tfi->varyings[i].name_size > tfi->max_varying_bufsize) {
+ tfi->max_varying_bufsize = tfi->varyings[i].name_size;
+ }
+
+ varyings_size += tfi->varyings[i].name_size;
+ }
+
+ varyings_str = tmp = (GLchar*)yagl_get_tmp_buffer(varyings_size);
+
+ for (i = 0; i < num_varyings; ++i) {
+ memcpy(tmp, varyings[i], tfi->varyings[i].name_size);
+ tmp += tfi->varyings[i].name_size;
+ }
+ }
+
+ tfi->num_varyings = num_varyings;
+ tfi->buffer_mode = buffer_mode;
+
+ yagl_host_glTransformFeedbackVaryings(program->global_name,
+ varyings_str,
+ varyings_size,
+ buffer_mode);
+}
+
+void yagl_gles3_program_get_transform_feedback_varying(struct yagl_gles2_program *program,
+ GLuint index,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLsizei *size,
+ GLenum *type,
+ GLchar *name)
+{
+ struct yagl_gles2_transform_feedback_info *tfi = &program->linked_transform_feedback_info;
+ struct yagl_gles2_transform_feedback_varying *varying;
+
+ if (index >= tfi->num_varyings) {
+ return;
+ }
+
+ varying = &tfi->varyings[index];
+
+ if (!tfi->fetched) {
+ GLuint i;
+ GLsizei *sizes;
+ GLenum *types;
+
+ sizes = (GLsizei*)yagl_get_tmp_buffer(tfi->num_varyings *
+ sizeof(sizes[0]));
+ types = (GLenum*)yagl_get_tmp_buffer2(tfi->num_varyings *
+ sizeof(types[0]));
+
+ yagl_host_glGetTransformFeedbackVaryings(program->global_name,
+ sizes,
+ tfi->num_varyings,
+ NULL,
+ types,
+ tfi->num_varyings,
+ NULL);
+
+ for (i = 0; i < tfi->num_varyings; ++i) {
+ tfi->varyings[i].size = sizes[i];
+ tfi->varyings[i].type = types[i];
+
+ if ((sizes[i] == 0) && (types[i] == 0)) {
+ yagl_free(tfi->varyings[i].name);
+ tfi->varyings[i].name = NULL;
+ tfi->varyings[i].name_size = 0;
+ }
+ }
+
+ tfi->fetched = 1;
+ }
+
+ yagl_gles2_set_name(varying->name, varying->name_size,
+ bufsize,
+ length,
+ name);
+
+ if (size) {
+ *size = varying->size;
+ }
+
+ if (type) {
+ *type = varying->type;
+ }
+}
+
+int yagl_gles3_program_get_uniformuiv(struct yagl_gles2_program *program,
+ GLint location,
+ GLuint *params)
+{
+ uint32_t global_location;
+ GLuint tmp[100]; // This fits all cases.
+ int32_t num = 0;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glGetUniformuiv(program->gen_locations,
+ program->global_name,
+ global_location,
+ tmp,
+ sizeof(tmp)/sizeof(tmp[0]),
+ &num);
+
+ if (params) {
+ memcpy(params, tmp, num * sizeof(tmp[0]));
+ }
+
+ return 1;
+}
+
+int yagl_gles3_program_uniform1ui(struct yagl_gles2_program *program,
+ GLint location,
+ GLuint v0)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniform1ui(program->gen_locations, global_location, v0);
+
+ return 1;
+}
+
+int yagl_gles3_program_uniform2ui(struct yagl_gles2_program *program,
+ GLint location,
+ GLuint v0,
+ GLuint v1)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniform2ui(program->gen_locations, global_location, v0, v1);
+
+ return 1;
+}
+
+int yagl_gles3_program_uniform3ui(struct yagl_gles2_program *program,
+ GLint location,
+ GLuint v0,
+ GLuint v1,
+ GLuint v2)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniform3ui(program->gen_locations, global_location, v0, v1, v2);
+
+ return 1;
+}
+
+int yagl_gles3_program_uniform4ui(struct yagl_gles2_program *program,
+ GLint location,
+ GLuint v0,
+ GLuint v1,
+ GLuint v2,
+ GLuint v3)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniform4ui(program->gen_locations, global_location, v0, v1, v2, v3);
+
+ return 1;
+}
+
+int yagl_gles3_program_uniform1uiv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ const GLuint *v)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniform1uiv(program->gen_locations, global_location, v, count);
+
+ return 1;
+}
+
+int yagl_gles3_program_uniform2uiv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ const GLuint *v)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniform2uiv(program->gen_locations, global_location, v, 2 * count);
+
+ return 1;
+}
+
+int yagl_gles3_program_uniform3uiv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ const GLuint *v)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniform3uiv(program->gen_locations, global_location, v, 3 * count);
+
+ return 1;
+}
+
+int yagl_gles3_program_uniform4uiv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ const GLuint *v)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniform4uiv(program->gen_locations, global_location, v, 4 * count);
+
+ return 1;
+}
+
+int yagl_gles3_program_uniform_matrix2x3fv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniformMatrix2x3fv(program->gen_locations, global_location, transpose, value, 2 * 3 * count);
+
+ return 1;
+}
+
+int yagl_gles3_program_uniform_matrix2x4fv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniformMatrix2x4fv(program->gen_locations, global_location, transpose, value, 2 * 4 * count);
+
+ return 1;
+}
+
+int yagl_gles3_program_uniform_matrix3x2fv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniformMatrix3x2fv(program->gen_locations, global_location, transpose, value, 3 * 2 * count);
+
+ return 1;
+}
+
+int yagl_gles3_program_uniform_matrix3x4fv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniformMatrix3x4fv(program->gen_locations, global_location, transpose, value, 3 * 4 * count);
+
+ return 1;
+}
+
+int yagl_gles3_program_uniform_matrix4x2fv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniformMatrix4x2fv(program->gen_locations, global_location, transpose, value, 4 * 2 * count);
+
+ return 1;
+}
+
+int yagl_gles3_program_uniform_matrix4x3fv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value)
+{
+ uint32_t global_location;
+
+ if (!yagl_gles2_program_translate_location(program,
+ location,
+ &global_location)) {
+ return 0;
+ }
+
+ yagl_host_glUniformMatrix4x3fv(program->gen_locations, global_location, transpose, value, 4 * 3 * count);
+
+ return 1;
+}
+
+int yagl_gles3_program_get_frag_data_location(struct yagl_gles2_program *program,
+ const GLchar *name)
+{
+ struct yagl_gles2_location_l *location;
+ int ret;
+
+ yagl_list_for_each(struct yagl_gles2_location_l,
+ location,
+ &program->frag_data_locations, list) {
+ if (strcmp(location->name, name) == 0) {
+ return location->location;
+ }
+ }
+
+ ret = yagl_host_glGetFragDataLocation(program->global_name,
+ name,
+ yagl_transport_string_count(name));
+
+ location = yagl_malloc(sizeof(*location));
+
+ yagl_list_init(&location->list);
+ location->name = strdup(name);
+ location->location = ret;
+
+ yagl_list_add_tail(&program->frag_data_locations, &location->list);
+
+ return ret;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES3_PROGRAM_H_
+#define _YAGL_GLES3_PROGRAM_H_
+
+#include "yagl_gles2_program.h"
+
+int yagl_gles3_program_get_active_uniformsiv(struct yagl_gles2_program *program,
+ const GLuint *indices,
+ int num_indices,
+ GLenum pname,
+ GLint *params);
+
+void yagl_gles3_program_get_uniform_indices(struct yagl_gles2_program *program,
+ const GLchar *const *names,
+ int num_names,
+ GLuint *indices);
+
+GLuint yagl_gles3_program_get_uniform_block_index(struct yagl_gles2_program *program,
+ const GLchar *block_name);
+
+void yagl_gles3_program_set_uniform_block_binding(struct yagl_gles2_program *program,
+ GLuint block_index,
+ GLuint block_binding);
+
+void yagl_gles3_program_get_active_uniform_block_name(struct yagl_gles2_program *program,
+ GLuint block_index,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLchar *block_name);
+
+int yagl_gles3_program_get_active_uniform_blockiv(struct yagl_gles2_program *program,
+ GLuint block_index,
+ GLenum pname,
+ GLint *params);
+
+void yagl_gles3_program_set_transform_feedback_varyings(struct yagl_gles2_program *program,
+ const GLchar *const *varyings,
+ GLuint num_varyings,
+ GLenum buffer_mode);
+
+void yagl_gles3_program_get_transform_feedback_varying(struct yagl_gles2_program *program,
+ GLuint index,
+ GLsizei bufsize,
+ GLsizei *length,
+ GLsizei *size,
+ GLenum *type,
+ GLchar *name);
+
+int yagl_gles3_program_get_uniformuiv(struct yagl_gles2_program *program,
+ GLint location,
+ GLuint *params);
+
+int yagl_gles3_program_uniform1ui(struct yagl_gles2_program *program,
+ GLint location,
+ GLuint v0);
+
+int yagl_gles3_program_uniform2ui(struct yagl_gles2_program *program,
+ GLint location,
+ GLuint v0,
+ GLuint v1);
+
+int yagl_gles3_program_uniform3ui(struct yagl_gles2_program *program,
+ GLint location,
+ GLuint v0,
+ GLuint v1,
+ GLuint v2);
+
+int yagl_gles3_program_uniform4ui(struct yagl_gles2_program *program,
+ GLint location,
+ GLuint v0,
+ GLuint v1,
+ GLuint v2,
+ GLuint v3);
+
+int yagl_gles3_program_uniform1uiv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ const GLuint *v);
+
+int yagl_gles3_program_uniform2uiv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ const GLuint *v);
+
+int yagl_gles3_program_uniform3uiv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ const GLuint *v);
+
+int yagl_gles3_program_uniform4uiv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ const GLuint *v);
+
+int yagl_gles3_program_uniform_matrix2x3fv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+
+int yagl_gles3_program_uniform_matrix2x4fv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+
+int yagl_gles3_program_uniform_matrix3x2fv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+
+int yagl_gles3_program_uniform_matrix3x4fv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+
+int yagl_gles3_program_uniform_matrix4x2fv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+
+int yagl_gles3_program_uniform_matrix4x3fv(struct yagl_gles2_program *program,
+ GLint location,
+ GLsizei count,
+ GLboolean transpose,
+ const GLfloat *value);
+
+int yagl_gles3_program_get_frag_data_location(struct yagl_gles2_program *program,
+ const GLchar *name);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GLES3/gl3.h"
+#include "yagl_gles3_query.h"
+#include "yagl_malloc.h"
+#include "yagl_state.h"
+#include "yagl_host_gles_calls.h"
+
+static void yagl_gles3_query_update_result(struct yagl_gles3_query *query)
+{
+ if (!query->result_available) {
+ query->result_available =
+ yagl_host_glGetQueryObjectuiv(query->global_name, &query->result);
+ }
+}
+
+static void yagl_gles3_query_destroy(struct yagl_ref *ref)
+{
+ struct yagl_gles3_query *query = (struct yagl_gles3_query*)ref;
+
+ yagl_host_glDeleteObjects(&query->global_name, 1);
+
+ yagl_object_cleanup(&query->base);
+
+ yagl_free(query);
+}
+
+struct yagl_gles3_query *yagl_gles3_query_create(void)
+{
+ struct yagl_gles3_query *query;
+
+ query = yagl_malloc0(sizeof(*query));
+
+ yagl_object_init(&query->base, &yagl_gles3_query_destroy);
+
+ query->global_name = yagl_get_global_name();
+
+ yagl_host_glGenQueries(&query->global_name, 1);
+
+ return query;
+}
+
+void yagl_gles3_query_acquire(struct yagl_gles3_query *query)
+{
+ if (query) {
+ yagl_object_acquire(&query->base);
+ }
+}
+
+void yagl_gles3_query_release(struct yagl_gles3_query *query)
+{
+ if (query) {
+ yagl_object_release(&query->base);
+ }
+}
+
+void yagl_gles3_query_begin(struct yagl_gles3_query *query,
+ GLenum target)
+{
+ yagl_host_glBeginQuery(target, query->global_name);
+
+ query->active = 1;
+ query->result_available = 0;
+ query->result = 0;
+ query->was_active = 1;
+}
+
+void yagl_gles3_query_end(struct yagl_gles3_query *query,
+ GLenum target)
+{
+ yagl_host_glEndQuery(target);
+
+ query->active = 0;
+}
+
+int yagl_gles3_query_is_result_available(struct yagl_gles3_query *query)
+{
+ yagl_gles3_query_update_result(query);
+
+ return query->result_available;
+}
+
+GLuint yagl_gles3_query_get_result(struct yagl_gles3_query *query)
+{
+ yagl_gles3_query_update_result(query);
+
+ return query->result;
+}
+
+int yagl_gles3_query_was_active(struct yagl_gles3_query *query)
+{
+ return query->was_active;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES3_QUERY_H_
+#define _YAGL_GLES3_QUERY_H_
+
+#include "yagl_types.h"
+#include "yagl_object.h"
+
+struct yagl_gles3_query
+{
+ struct yagl_object base;
+
+ yagl_object_name global_name;
+
+ int active;
+
+ int result_available;
+ GLuint result;
+
+ int was_active;
+};
+
+struct yagl_gles3_query *yagl_gles3_query_create(void);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_gles3_query_acquire(struct yagl_gles3_query *query);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_gles3_query_release(struct yagl_gles3_query *query);
+
+void yagl_gles3_query_begin(struct yagl_gles3_query *query,
+ GLenum target);
+
+void yagl_gles3_query_end(struct yagl_gles3_query *query,
+ GLenum target);
+
+int yagl_gles3_query_is_result_available(struct yagl_gles3_query *query);
+
+GLuint yagl_gles3_query_get_result(struct yagl_gles3_query *query);
+
+int yagl_gles3_query_was_active(struct yagl_gles3_query *query);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_gles3_sync.h"
+#include "yagl_egl_fence.h"
+#include "yagl_malloc.h"
+
+static void yagl_gles3_sync_destroy(struct yagl_ref *ref)
+{
+ struct yagl_gles3_sync *sync = (struct yagl_gles3_sync*)ref;
+
+ yagl_egl_fence_release(sync->egl_fence);
+
+ yagl_object_cleanup(&sync->base);
+
+ yagl_free(sync);
+}
+
+struct yagl_gles3_sync *yagl_gles3_sync_create(void)
+{
+ struct yagl_egl_fence *egl_fence;
+ struct yagl_gles3_sync *sync;
+
+ egl_fence = yagl_create_egl_fence();
+
+ if (!egl_fence) {
+ return NULL;
+ }
+
+ sync = yagl_malloc0(sizeof(*sync));
+
+ yagl_object_init(&sync->base, &yagl_gles3_sync_destroy);
+
+ sync->egl_fence = egl_fence;
+
+ return sync;
+}
+
+void yagl_gles3_sync_acquire(struct yagl_gles3_sync *sync)
+{
+ if (sync) {
+ yagl_object_acquire(&sync->base);
+ }
+}
+
+void yagl_gles3_sync_release(struct yagl_gles3_sync *sync)
+{
+ if (sync) {
+ yagl_object_release(&sync->base);
+ }
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES3_SYNC_H_
+#define _YAGL_GLES3_SYNC_H_
+
+#include "yagl_types.h"
+#include "yagl_object.h"
+
+#define YAGL_NS_SYNC 5
+
+struct yagl_egl_fence;
+
+struct yagl_gles3_sync
+{
+ struct yagl_object base;
+
+ struct yagl_egl_fence *egl_fence;
+
+ int signaled;
+};
+
+struct yagl_gles3_sync *yagl_gles3_sync_create(void);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_gles3_sync_acquire(struct yagl_gles3_sync *sync);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_gles3_sync_release(struct yagl_gles3_sync *sync);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GLES3/gl3.h"
+#include "yagl_gles3_transform_feedback.h"
+#include "yagl_gles3_buffer_binding.h"
+#include "yagl_gles_buffer.h"
+#include "yagl_malloc.h"
+#include "yagl_state.h"
+#include "yagl_host_gles_calls.h"
+
+static void yagl_gles3_transform_feedback_destroy(struct yagl_ref *ref)
+{
+ struct yagl_gles3_transform_feedback *tf = (struct yagl_gles3_transform_feedback*)ref;
+ GLuint i;
+
+ for (i = 0; i < tf->num_buffer_bindings; ++i) {
+ yagl_gles3_buffer_binding_reset(&tf->buffer_bindings[i]);
+ }
+
+ yagl_free(tf->buffer_bindings);
+
+ if (tf->global_name) {
+ yagl_host_glDeleteObjects(&tf->global_name, 1);
+ }
+
+ yagl_object_cleanup(&tf->base);
+
+ yagl_free(tf);
+}
+
+struct yagl_gles3_transform_feedback
+ *yagl_gles3_transform_feedback_create(int fake,
+ GLuint num_buffer_bindings)
+{
+ struct yagl_gles3_transform_feedback *tf;
+ GLuint i;
+
+ tf = yagl_malloc0(sizeof(*tf));
+
+ yagl_object_init(&tf->base, &yagl_gles3_transform_feedback_destroy);
+
+ if (fake) {
+ tf->was_bound = 1;
+ } else {
+ tf->global_name = yagl_get_global_name();
+
+ yagl_host_glGenTransformFeedbacks(&tf->global_name, 1);
+ }
+
+ tf->num_buffer_bindings = num_buffer_bindings;
+
+ tf->buffer_bindings = yagl_malloc0(sizeof(tf->buffer_bindings[0]) *
+ tf->num_buffer_bindings);
+
+ for (i = 0; i < tf->num_buffer_bindings; ++i) {
+ yagl_gles3_buffer_binding_init(&tf->buffer_bindings[i],
+ GL_TRANSFORM_FEEDBACK_BUFFER,
+ i);
+ }
+
+ return tf;
+}
+
+void yagl_gles3_transform_feedback_acquire(struct yagl_gles3_transform_feedback *tf)
+{
+ if (tf) {
+ yagl_object_acquire(&tf->base);
+ }
+}
+
+void yagl_gles3_transform_feedback_release(struct yagl_gles3_transform_feedback *tf)
+{
+ if (tf) {
+ yagl_object_release(&tf->base);
+ }
+}
+
+int yagl_gles3_transform_feedback_bind_buffer_base(struct yagl_gles3_transform_feedback *tf,
+ GLuint index,
+ struct yagl_gles_buffer *buffer)
+{
+ if (index >= tf->num_buffer_bindings) {
+ return 0;
+ }
+
+ yagl_gles3_buffer_binding_set_base(&tf->buffer_bindings[index], buffer);
+
+ return 1;
+}
+
+int yagl_gles3_transform_feedback_bind_buffer_range(struct yagl_gles3_transform_feedback *tf,
+ GLuint index,
+ GLintptr offset,
+ GLsizeiptr size,
+ struct yagl_gles_buffer *buffer)
+{
+ if (index >= tf->num_buffer_bindings) {
+ return 0;
+ }
+
+ yagl_gles3_buffer_binding_set_range(&tf->buffer_bindings[index],
+ buffer, offset, size);
+
+ return 1;
+}
+
+void yagl_gles3_transform_feedback_unbind_buffer(struct yagl_gles3_transform_feedback *tf,
+ yagl_object_name buffer_local_name)
+{
+ GLuint i;
+
+ for (i = 0; i < tf->num_buffer_bindings; ++i) {
+ struct yagl_gles_buffer *buffer = tf->buffer_bindings[i].buffer;
+
+ if (buffer && (buffer->base.local_name == buffer_local_name)) {
+ yagl_gles3_buffer_binding_reset(&tf->buffer_bindings[i]);
+ }
+ }
+}
+
+void yagl_gles3_transform_feedback_bind(struct yagl_gles3_transform_feedback *tf,
+ GLenum target)
+{
+ yagl_host_glBindTransformFeedback(target, tf->global_name);
+
+ tf->was_bound = 1;
+}
+
+int yagl_gles3_transform_feedback_was_bound(struct yagl_gles3_transform_feedback *tf)
+{
+ return tf->was_bound;
+}
+
+void yagl_gles3_transform_feedback_begin(struct yagl_gles3_transform_feedback *tf,
+ GLenum primitive_mode,
+ GLuint num_active_buffer_bindings)
+{
+ GLuint i;
+
+ if (num_active_buffer_bindings > tf->num_buffer_bindings) {
+ return;
+ }
+
+ tf->num_active_buffer_bindings = num_active_buffer_bindings;
+
+ for (i = 0; i < num_active_buffer_bindings; ++i) {
+ yagl_gles3_buffer_binding_transfer_begin(&tf->buffer_bindings[i]);
+ }
+
+ yagl_host_glBeginTransformFeedback(primitive_mode);
+
+ tf->active = 1;
+}
+
+void yagl_gles3_transform_feedback_pause(struct yagl_gles3_transform_feedback *tf)
+{
+ tf->paused = 1;
+
+ yagl_host_glPauseTransformFeedback();
+}
+
+void yagl_gles3_transform_feedback_resume(struct yagl_gles3_transform_feedback *tf)
+{
+ yagl_host_glResumeTransformFeedback();
+
+ tf->paused = 0;
+}
+
+void yagl_gles3_transform_feedback_post_draw(struct yagl_gles3_transform_feedback *tf)
+{
+ GLuint i;
+
+ for (i = 0; i < tf->num_active_buffer_bindings; ++i) {
+ yagl_gles3_buffer_binding_set_gpu_dirty(&tf->buffer_bindings[i]);
+ }
+}
+
+void yagl_gles3_transform_feedback_end(struct yagl_gles3_transform_feedback *tf)
+{
+ GLuint i;
+
+ yagl_host_glEndTransformFeedback();
+
+ for (i = 0; i < tf->num_active_buffer_bindings; ++i) {
+ yagl_gles3_buffer_binding_transfer_end(&tf->buffer_bindings[i]);
+ }
+
+ tf->active = 0;
+ tf->paused = 0;
+ tf->num_active_buffer_bindings = 0;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES3_TRANSFORM_FEEDBACK_H_
+#define _YAGL_GLES3_TRANSFORM_FEEDBACK_H_
+
+#include "yagl_types.h"
+#include "yagl_object.h"
+
+struct yagl_gles3_buffer_binding;
+struct yagl_gles_buffer;
+
+struct yagl_gles3_transform_feedback
+{
+ struct yagl_object base;
+
+ yagl_object_name global_name;
+
+ struct yagl_gles3_buffer_binding *buffer_bindings;
+ GLuint num_buffer_bindings;
+
+ int active;
+ int paused;
+
+ GLuint num_active_buffer_bindings;
+
+ int was_bound;
+};
+
+struct yagl_gles3_transform_feedback
+ *yagl_gles3_transform_feedback_create(int fake,
+ GLuint num_buffer_bindings);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_gles3_transform_feedback_acquire(struct yagl_gles3_transform_feedback *tf);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+void yagl_gles3_transform_feedback_release(struct yagl_gles3_transform_feedback *tf);
+
+int yagl_gles3_transform_feedback_bind_buffer_base(struct yagl_gles3_transform_feedback *tf,
+ GLuint index,
+ struct yagl_gles_buffer *buffer);
+
+int yagl_gles3_transform_feedback_bind_buffer_range(struct yagl_gles3_transform_feedback *tf,
+ GLuint index,
+ GLintptr offset,
+ GLsizeiptr size,
+ struct yagl_gles_buffer *buffer);
+
+void yagl_gles3_transform_feedback_unbind_buffer(struct yagl_gles3_transform_feedback *tf,
+ yagl_object_name buffer_local_name);
+
+void yagl_gles3_transform_feedback_bind(struct yagl_gles3_transform_feedback *tf,
+ GLenum target);
+
+int yagl_gles3_transform_feedback_was_bound(struct yagl_gles3_transform_feedback *tf);
+
+void yagl_gles3_transform_feedback_begin(struct yagl_gles3_transform_feedback *tf,
+ GLenum primitive_mode,
+ GLuint num_active_buffer_bindings);
+
+void yagl_gles3_transform_feedback_pause(struct yagl_gles3_transform_feedback *tf);
+
+void yagl_gles3_transform_feedback_resume(struct yagl_gles3_transform_feedback *tf);
+
+void yagl_gles3_transform_feedback_post_draw(struct yagl_gles3_transform_feedback *tf);
+
+void yagl_gles3_transform_feedback_end(struct yagl_gles3_transform_feedback *tf);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GLES3/gl3.h"
+#include "yagl_gles3_validate.h"
+
+int yagl_gles3_is_uniform_param_valid(GLenum pname)
+{
+ switch (pname) {
+ case GL_UNIFORM_TYPE:
+ case GL_UNIFORM_SIZE:
+ case GL_UNIFORM_NAME_LENGTH:
+ case GL_UNIFORM_BLOCK_INDEX:
+ case GL_UNIFORM_OFFSET:
+ case GL_UNIFORM_ARRAY_STRIDE:
+ case GL_UNIFORM_MATRIX_STRIDE:
+ case GL_UNIFORM_IS_ROW_MAJOR:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+int yagl_gles3_is_transform_feedback_buffer_mode_valid(GLenum buffer_mode)
+{
+ switch (buffer_mode) {
+ case GL_INTERLEAVED_ATTRIBS:
+ case GL_SEPARATE_ATTRIBS:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+int yagl_gles3_is_primitive_mode_valid(GLenum primitive_mode)
+{
+ switch (primitive_mode) {
+ case GL_POINTS:
+ case GL_LINES:
+ case GL_TRIANGLES:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+int yagl_gles3_is_buffer_valid(GLenum buffer)
+{
+ switch (buffer) {
+ case GL_COLOR:
+ case GL_FRONT:
+ case GL_BACK:
+ case GL_FRONT_AND_BACK:
+ case GL_DEPTH:
+ case GL_STENCIL:
+ return 1;
+ default:
+ return 0;
+ }
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLES3_VALIDATE_H_
+#define _YAGL_GLES3_VALIDATE_H_
+
+#include "yagl_types.h"
+
+int yagl_gles3_is_uniform_param_valid(GLenum pname);
+
+int yagl_gles3_is_transform_feedback_buffer_mode_valid(GLenum buffer_mode);
+
+int yagl_gles3_is_primitive_mode_valid(GLenum primitive_mode);
+
+int yagl_gles3_is_buffer_valid(GLenum buffer);
+
+#endif
--- /dev/null
+%{
+#include <GL/gl.h>
+#include "yagl_glsl_state.h"
+#include "yagl_malloc.h"
+
+#define YY_NO_INPUT
+
+#define YY_INPUT(buf, result, max_size) \
+ result = string_input(buf, max_size, yyscanner);
+
+static yy_size_t string_input(char *buf, yy_size_t max_size, yyscan_t yyscanner);
+%}
+
+%option bison-bridge reentrant noyywrap
+%option nounput
+%option never-interactive
+%option prefix="yagl_glsl_lexer_"
+%option extra-type="struct yagl_glsl_state *"
+
+%x COMMENT PP
+
+WS [ \r\t\v\f]
+PRECISION "lowp"|"mediump"|"highp"|"precision"[^;\n]+;?
+CONTROL [()\[\]{},;?:/%*&|^!+\-=<>\.]
+STRING [^ \r\t\v\f\n()\[\]{},;?:/%*&|^!+\-=<>\.]+
+
+%%
+
+"//"[^\n]* {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_comment(state, strlen(yytext));
+}
+
+"/*" {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ BEGIN(COMMENT);
+ yagl_glsl_state_new_comment(state, strlen(yytext));
+}
+
+^{WS}*#{WS}*version {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ BEGIN(PP);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_VERSION;
+}
+
+^{WS}*#{WS}*define {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ BEGIN(PP);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_DEFINE;
+}
+
+^{WS}*#{WS}*extension[^\n]* {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_EXTENSION;
+}
+
+[\n]+ {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_pending(state, yytext);
+}
+
+{WS}+ {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_pending(state, yytext);
+}
+
+"gl_MaxVertexUniformVectors" {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_MAXVERTEXUNIFORMVECTORS;
+}
+
+"gl_MaxFragmentUniformVectors" {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_MAXFRAGMENTUNIFORMVECTORS;
+}
+
+"gl_MaxVaryingVectors" {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_MAXVARYINGVECTORS;
+}
+
+"gl_MaxVaryingFloats" {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_MAXVARYINGFLOATS;
+}
+
+"attribute" {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_ATTRIBUTE;
+}
+
+"varying" {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_VARYING;
+}
+
+"texture1DProjLod" {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_TEXTURE1DPROJLOD;
+}
+
+"texture1DProj" {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_TEXTURE1DPROJ;
+}
+
+"texture1DLod" {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_TEXTURE1DLOD;
+}
+
+"texture1D" {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_TEXTURE1D;
+}
+
+"texture2DProjLod" {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_TEXTURE2DPROJLOD;
+}
+
+"texture2DLod" {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_TEXTURE2DLOD;
+}
+
+"texture2DProj" {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_TEXTURE2DPROJ;
+}
+
+"texture2D" {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_TEXTURE2D;
+}
+
+"texture3DProjLod" {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_TEXTURE3DPROJLOD;
+}
+
+"texture3DLod" {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_TEXTURE3DLOD;
+}
+
+"texture3DProj" {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_TEXTURE3DPROJ;
+}
+
+"texture3D" {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_TEXTURE3D;
+}
+
+"textureCubeLod" {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_TEXTURECUBELOD;
+}
+
+"textureCube" {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_TEXTURECUBE;
+}
+
+"gl_FragColor" {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_GLFRAGCOLOR;
+}
+
+{PRECISION} {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_PRECISION;
+}
+
+{CONTROL} {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_pending(state, yytext);
+}
+
+{STRING} {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_pending(state, yytext);
+}
+
+<PP>\n {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ BEGIN(INITIAL);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_EOL;
+}
+
+<PP>{WS}+ {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_pending(state, yytext);
+}
+
+<PP>[1-9][0-9]* {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_integer_token(state, yylval, strtol(yytext, NULL, 10));
+ return TOK_INTEGER;
+}
+
+<PP>"es" {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_ES;
+}
+
+<PP>{PRECISION} {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_PRECISION;
+}
+
+<PP>{CONTROL} {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_STRING;
+}
+
+<PP>{STRING} {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_str_token(state, yylval, yytext);
+ return TOK_STRING;
+}
+
+<COMMENT>[^*\n]* {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_comment(state, strlen(yytext));
+}
+
+<COMMENT>[^*\n]*\n {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_comment(state, strlen(yytext) - 1);
+ yagl_glsl_state_new_pending(state, "\n");
+}
+
+<COMMENT>"*"+[^*/\n]* {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_comment(state, strlen(yytext));
+}
+
+<COMMENT>"*"+[^*/\n]*\n {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ yagl_glsl_state_new_comment(state, strlen(yytext) - 1);
+ yagl_glsl_state_new_pending(state, "\n");
+}
+
+<COMMENT>"*"+"/" {
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ BEGIN(INITIAL);
+ yagl_glsl_state_new_comment(state, strlen(yytext));
+}
+
+%%
+
+static yy_size_t string_input(char *buf, yy_size_t max_size, yyscan_t yyscanner)
+{
+ struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
+ int rem = state->source_len - state->source_pos;
+ int num_read = (rem < max_size) ? rem : max_size;
+
+ memcpy(buf, state->source + state->source_pos, num_read);
+
+ state->source_pos += num_read;
+
+ return num_read;
+}
+
+//extern int yagl_glsl_debug;
+
+int yagl_glsl_state_init(struct yagl_glsl_state *state,
+ GLenum shader_type,
+ const char *source,
+ int source_len,
+ int es3_supported)
+{
+ yyscan_t scanner = NULL;
+
+ memset(state, 0, sizeof(*state));
+
+ //yagl_glsl_debug = 1;
+
+ if (yagl_glsl_lexer_lex_init_extra(state, &scanner)) {
+ return 0;
+ }
+
+ state->shader_type = shader_type;
+ state->source = source;
+ state->source_len = source_len;
+ state->es3_supported = es3_supported;
+ state->scanner = scanner;
+ state->token_index = 1;
+
+ yagl_glsl_state_set_version(state, 120, 0);
+
+ yagl_vector_init(&state->header, sizeof(char), 0);
+ yagl_vector_init(&state->output, sizeof(char), 0);
+ yagl_list_init(&state->pending_list);
+ yagl_vector_init(&state->pending, sizeof(char), 0);
+ yagl_vector_init(&state->strings, sizeof(char*), 0);
+
+ return 1;
+}
+
+void yagl_glsl_state_cleanup(struct yagl_glsl_state *state)
+{
+ yyscan_t scanner = state->scanner;
+ int i;
+ char **tmp;
+ struct yagl_glsl_pending *it, *tmp_it;
+
+ tmp = yagl_vector_data(&state->strings);
+
+ for (i = 0; i < yagl_vector_size(&state->strings); ++i) {
+ free(*(tmp + i));
+ }
+
+ yagl_vector_cleanup(&state->strings);
+
+ yagl_vector_cleanup(&state->pending);
+
+ yagl_list_for_each_safe(struct yagl_glsl_pending,
+ it,
+ tmp_it,
+ &state->pending_list, list) {
+ yagl_list_remove(&it->list);
+ yagl_free(it);
+ }
+
+ yagl_vector_cleanup(&state->output);
+
+ yagl_vector_cleanup(&state->header);
+
+ yagl_glsl_lexer_lex_destroy(scanner);
+}
--- /dev/null
+%{
+#include <GL/gl.h>
+#include "yagl_glsl_state.h"
+#include <stdio.h>
+#include <string.h>
+
+#undef yyerror
+
+extern int yagl_glsl_lexer_lex(YYSTYPE *yylval, void *scanner);
+
+static void yyerror(struct yagl_glsl_state *state, const char *msg)
+{
+ yagl_glsl_state_set_error(state, msg);
+}
+
+static int yagl_glsl_lex(union YYSTYPE *val, struct yagl_glsl_state *state)
+{
+ return yagl_glsl_lexer_lex(val, state->scanner);
+}
+%}
+
+%pure-parser
+%name-prefix="yagl_glsl_"
+%lex-param {struct yagl_glsl_state *state}
+%parse-param {struct yagl_glsl_state *state}
+%debug
+
+%union
+{
+ struct
+ {
+ int index;
+ int value;
+ } integer;
+
+ struct
+ {
+ int index;
+ const char *value;
+ } str;
+}
+
+%token <str> TOK_EOL
+%token <str> TOK_VERSION
+%token <str> TOK_DEFINE
+%token <str> TOK_EXTENSION
+%token <str> TOK_STRING
+%token <integer> TOK_INTEGER
+%token <str> TOK_ES
+%token <str> TOK_PRECISION
+%token <str> TOK_MAXVERTEXUNIFORMVECTORS
+%token <str> TOK_MAXFRAGMENTUNIFORMVECTORS
+%token <str> TOK_MAXVARYINGVECTORS
+%token <str> TOK_MAXVARYINGFLOATS
+%token <str> TOK_ATTRIBUTE
+%token <str> TOK_VARYING
+%token <str> TOK_TEXTURE1D
+%token <str> TOK_TEXTURE1DPROJ
+%token <str> TOK_TEXTURE1DLOD
+%token <str> TOK_TEXTURE1DPROJLOD
+%token <str> TOK_TEXTURE2D
+%token <str> TOK_TEXTURE2DPROJ
+%token <str> TOK_TEXTURE2DLOD
+%token <str> TOK_TEXTURE2DPROJLOD
+%token <str> TOK_TEXTURE3D
+%token <str> TOK_TEXTURE3DPROJ
+%token <str> TOK_TEXTURE3DLOD
+%token <str> TOK_TEXTURE3DPROJLOD
+%token <str> TOK_TEXTURECUBE
+%token <str> TOK_TEXTURECUBELOD
+%token <str> TOK_GLFRAGCOLOR
+
+%%
+
+start
+:
+{
+}
+| version expressions
+{
+}
+| expressions
+{
+}
+| version
+{
+}
+;
+
+version
+: TOK_VERSION TOK_INTEGER TOK_ES TOK_EOL
+{
+ char s[100];
+ int version = $2.value;
+
+ yagl_glsl_state_set_version(state, $2.value, 1);
+
+ state->have_version = 1;
+
+ yagl_glsl_state_flush_pending(state, $1.index);
+ yagl_glsl_state_append_output(state, $1.value);
+ yagl_glsl_state_flush_pending(state, $2.index);
+
+ switch (state->patch_version) {
+ case yagl_glsl_120:
+ version = 120;
+ break;
+ case yagl_glsl_140:
+ version = 140;
+ break;
+ case yagl_glsl_150:
+ version = 150;
+ break;
+ default:
+ break;
+ }
+
+ sprintf(s, "%d", version);
+ yagl_glsl_state_append_output(state, s);
+ yagl_glsl_state_flush_pending(state, $3.index);
+ if (state->patch_version == yagl_glsl_asis) {
+ yagl_glsl_state_append_output(state, $3.value);
+ }
+ yagl_glsl_state_flush_pending(state, $4.index);
+ yagl_glsl_state_append_output(state, $4.value);
+
+ yagl_glsl_state_output_to_header(state);
+}
+| TOK_VERSION TOK_INTEGER TOK_EOL
+{
+ char s[100];
+ int version = $2.value;
+
+ yagl_glsl_state_set_version(state, $2.value, 0);
+
+ state->have_version = 1;
+
+ yagl_glsl_state_flush_pending(state, $1.index);
+ yagl_glsl_state_append_output(state, $1.value);
+ yagl_glsl_state_flush_pending(state, $2.index);
+
+ switch (state->patch_version) {
+ case yagl_glsl_120:
+ version = 120;
+ break;
+ case yagl_glsl_140:
+ version = 140;
+ break;
+ case yagl_glsl_150:
+ version = 150;
+ break;
+ default:
+ break;
+ }
+
+ sprintf(s, "%d", version);
+ yagl_glsl_state_append_output(state, s);
+ yagl_glsl_state_flush_pending(state, $3.index);
+ yagl_glsl_state_append_output(state, $3.value);
+
+ yagl_glsl_state_output_to_header(state);
+}
+;
+
+expressions
+: expression
+{
+}
+| expressions expression
+{
+}
+;
+
+expression
+: TOK_EOL
+{
+ yagl_glsl_state_flush_pending(state, $1.index);
+ yagl_glsl_state_append_output(state, $1.value);
+}
+| TOK_DEFINE TOK_PRECISION
+{
+ yagl_glsl_state_flush_pending(state, $1.index);
+ yagl_glsl_state_append_output(state, $1.value);
+ yagl_glsl_state_flush_pending(state, $2.index);
+ yagl_glsl_state_append_output(state, $2.value);
+}
+| TOK_DEFINE
+{
+ yagl_glsl_state_flush_pending(state, $1.index);
+ yagl_glsl_state_append_output(state, $1.value);
+}
+| TOK_EXTENSION
+{
+ /*
+ * Always strip #extension constructs. The reasons are:
+ *
+ * 1. Pretty useless, host GLSL already includes
+ * most of the extensions as core features. Extension naming
+ * on real hardware and host OpenGL is
+ * different, so #extension constructs can fail.
+ *
+ * e.g. GLSL ES shader can contain something like this:
+ *
+ * #ifdef GL_ARB_draw_instanced
+ * #extension GL_ARB_draw_instanced : require
+ * #endif
+ *
+ * On real hardware GL_ARB_draw_instanced is not defined, so the code
+ * inside won't compile. In emulated environment when host GPU
+ * is used GL_ARB_draw_instanced will be defined and #extension inside
+ * will be compiled when it shouldn't.
+ *
+ * Another e.g. GLSL ES 2.0 shader can contain:
+ *
+ * #extension GL_OES_texture_3D : enable
+ *
+ * Useless, host GLSL already has 3D textures and they're
+ * called GL_EXT_texture_3D, so this code can either be ignored
+ * or fail.
+ *
+ * 2. Some host OpenGL drivers like mesa only allow #extension constructs
+ * after #version. Many real hardware allow #extension anywhere. Also,
+ * when we patch shaders we need to add some of our own #extension
+ * constructs, functions, variables right after #version. If such shader
+ * contains #extension constructs of its own it'll fail to compile with
+ * mesa.
+ */
+
+ yagl_glsl_state_flush_pending(state, $1.index);
+}
+| TOK_PRECISION
+{
+ yagl_glsl_state_flush_pending(state, $1.index);
+ if (!state->patch_precision) {
+ yagl_glsl_state_append_output(state, $1.value);
+ }
+}
+| TOK_ES
+{
+ yagl_glsl_state_flush_pending(state, $1.index);
+ yagl_glsl_state_append_output(state, $1.value);
+}
+| TOK_INTEGER
+{
+ char s[100];
+
+ yagl_glsl_state_flush_pending(state, $1.index);
+ sprintf(s, "%d", $1.value);
+ yagl_glsl_state_append_output(state, s);
+}
+| TOK_STRING
+{
+ yagl_glsl_state_flush_pending(state, $1.index);
+ yagl_glsl_state_append_output(state, $1.value);
+}
+| TOK_MAXVERTEXUNIFORMVECTORS
+{
+ yagl_glsl_state_flush_pending(state, $1.index);
+ if (state->patch_builtins) {
+ yagl_glsl_state_append_output(state, "(gl_MaxVertexUniformComponents / 4)");
+ } else {
+ yagl_glsl_state_append_output(state, $1.value);
+ }
+}
+| TOK_MAXFRAGMENTUNIFORMVECTORS
+{
+ yagl_glsl_state_flush_pending(state, $1.index);
+ if (state->patch_builtins) {
+ yagl_glsl_state_append_output(state, "(gl_MaxFragmentUniformComponents / 4)");
+ } else {
+ yagl_glsl_state_append_output(state, $1.value);
+ }
+}
+| TOK_MAXVARYINGVECTORS
+{
+ yagl_glsl_state_flush_pending(state, $1.index);
+ if (state->patch_builtins) {
+ if (state->patch_max_varying_floats) {
+ /*
+ * gl_MaxVaryingComponents must be used instead of
+ * gl_MaxVaryingFloats in OpenGL 3.1, but it's deprecated in
+ * OpenGL 3.2, thus, we just use a constant.
+ */
+ yagl_glsl_state_append_output(state, "(64 / 4)");
+ } else {
+ yagl_glsl_state_append_output(state, "(gl_MaxVaryingFloats / 4)");
+ }
+ } else {
+ yagl_glsl_state_append_output(state, $1.value);
+ }
+}
+| TOK_MAXVARYINGFLOATS
+{
+ yagl_glsl_state_flush_pending(state, $1.index);
+ if (state->patch_max_varying_floats) {
+ /*
+ * See 'TOK_MAXVARYINGVECTORS' case.
+ */
+ yagl_glsl_state_append_output(state, "64");
+ } else {
+ yagl_glsl_state_append_output(state, $1.value);
+ }
+}
+| TOK_ATTRIBUTE
+{
+ yagl_glsl_state_flush_pending(state, $1.index);
+
+ if (state->patch_gl2) {
+ if (state->shader_type == GL_VERTEX_SHADER) {
+ yagl_glsl_state_append_output(state, "in");
+ }
+ } else {
+ yagl_glsl_state_append_output(state, $1.value);
+ }
+}
+| TOK_VARYING
+{
+ yagl_glsl_state_flush_pending(state, $1.index);
+
+ if (state->patch_gl2) {
+ if (state->shader_type == GL_VERTEX_SHADER) {
+ yagl_glsl_state_append_output(state, "out");
+ } else {
+ yagl_glsl_state_append_output(state, "in");
+ }
+ } else {
+ yagl_glsl_state_append_output(state, $1.value);
+ }
+}
+| TOK_TEXTURE1D
+{
+ yagl_glsl_state_flush_pending(state, $1.index);
+ yagl_glsl_state_append_output(state, $1.value);
+
+ if (state->patch_gl2) {
+ if (!state->texture1d_declared) {
+ if (state->shader_type == GL_FRAGMENT_SHADER) {
+ yagl_glsl_state_append_header(state, "vec4 texture1D(sampler1D sampler, float coord, float bias) {\n");
+ yagl_glsl_state_append_header(state, " return texture(sampler, coord, bias);\n");
+ yagl_glsl_state_append_header(state, "}\n");
+ }
+ yagl_glsl_state_append_header(state, "vec4 texture1D(sampler1D sampler, float coord) {\n");
+ yagl_glsl_state_append_header(state, " return texture(sampler, coord);\n");
+ yagl_glsl_state_append_header(state, "}\n");
+ state->texture1d_declared = 1;
+ }
+ }
+}
+| TOK_TEXTURE1DPROJ
+{
+ yagl_glsl_state_flush_pending(state, $1.index);
+ yagl_glsl_state_append_output(state, $1.value);
+
+ if (state->patch_gl2) {
+ if (!state->texture1dproj_declared) {
+ if (state->shader_type == GL_FRAGMENT_SHADER) {
+ yagl_glsl_state_append_header(state, "vec4 texture1DProj(sampler1D sampler, vec2 coord, float bias) {\n");
+ yagl_glsl_state_append_header(state, " return textureProj(sampler, coord, bias);\n");
+ yagl_glsl_state_append_header(state, "}\n");
+ yagl_glsl_state_append_header(state, "vec4 texture1DProj(sampler1D sampler, vec4 coord, float bias) {\n");
+ yagl_glsl_state_append_header(state, " return textureProj(sampler, coord, bias);\n");
+ yagl_glsl_state_append_header(state, "}\n");
+ }
+ yagl_glsl_state_append_header(state, "vec4 texture1DProj(sampler1D sampler, vec2 coord) {\n");
+ yagl_glsl_state_append_header(state, " return textureProj(sampler, coord);\n");
+ yagl_glsl_state_append_header(state, "}\n");
+ yagl_glsl_state_append_header(state, "vec4 texture1DProj(sampler1D sampler, vec4 coord) {\n");
+ yagl_glsl_state_append_header(state, " return textureProj(sampler, coord);\n");
+ yagl_glsl_state_append_header(state, "}\n");
+ state->texture1dproj_declared = 1;
+ }
+ }
+}
+| TOK_TEXTURE1DLOD
+{
+ yagl_glsl_state_flush_pending(state, $1.index);
+ yagl_glsl_state_append_output(state, $1.value);
+
+ if (state->patch_gl2) {
+ if (!state->texture1dlod_declared) {
+ yagl_glsl_state_append_header(state, "vec4 texture1DLod(sampler1D sampler, float coord, float lod) {\n");
+ yagl_glsl_state_append_header(state, " return textureLod(sampler, coord, lod);\n");
+ yagl_glsl_state_append_header(state, "}\n");
+ state->texture1dlod_declared = 1;
+ }
+ }
+}
+| TOK_TEXTURE1DPROJLOD
+{
+ yagl_glsl_state_flush_pending(state, $1.index);
+ yagl_glsl_state_append_output(state, $1.value);
+
+ if (state->patch_gl2) {
+ if (!state->texture1dprojlod_declared) {
+ yagl_glsl_state_append_header(state, "vec4 texture1DProjLod(sampler1D sampler, vec2 coord, float lod) {\n");
+ yagl_glsl_state_append_header(state, " return textureProjLod(sampler, coord, lod);\n");
+ yagl_glsl_state_append_header(state, "}\n");
+ yagl_glsl_state_append_header(state, "vec4 texture1DProjLod(sampler1D sampler, vec4 coord, float lod) {\n");
+ yagl_glsl_state_append_header(state, " return textureProjLod(sampler, coord, lod);\n");
+ yagl_glsl_state_append_header(state, "}\n");
+ state->texture1dprojlod_declared = 1;
+ }
+ }
+}
+| TOK_TEXTURE2D
+{
+ yagl_glsl_state_flush_pending(state, $1.index);
+ yagl_glsl_state_append_output(state, $1.value);
+
+ if (state->patch_gl2) {
+ if (!state->texture2d_declared) {
+ if (state->shader_type == GL_FRAGMENT_SHADER) {
+ yagl_glsl_state_append_header(state, "vec4 texture2D(sampler2D sampler, vec2 coord, float bias) {\n");
+ yagl_glsl_state_append_header(state, " return texture(sampler, coord, bias);\n");
+ yagl_glsl_state_append_header(state, "}\n");
+ }
+ yagl_glsl_state_append_header(state, "vec4 texture2D(sampler2D sampler, vec2 coord) {\n");
+ yagl_glsl_state_append_header(state, " return texture(sampler, coord);\n");
+ yagl_glsl_state_append_header(state, "}\n");
+ state->texture2d_declared = 1;
+ }
+ }
+}
+| TOK_TEXTURE2DPROJ
+{
+ yagl_glsl_state_flush_pending(state, $1.index);
+ yagl_glsl_state_append_output(state, $1.value);
+
+ if (state->patch_gl2) {
+ if (!state->texture2dproj_declared) {
+ if (state->shader_type == GL_FRAGMENT_SHADER) {
+ yagl_glsl_state_append_header(state, "vec4 texture2DProj(sampler2D sampler, vec3 coord, float bias) {\n");
+ yagl_glsl_state_append_header(state, " return textureProj(sampler, coord, bias);\n");
+ yagl_glsl_state_append_header(state, "}\n");
+ yagl_glsl_state_append_header(state, "vec4 texture2DProj(sampler2D sampler, vec4 coord, float bias) {\n");
+ yagl_glsl_state_append_header(state, " return textureProj(sampler, coord, bias);\n");
+ yagl_glsl_state_append_header(state, "}\n");
+ }
+ yagl_glsl_state_append_header(state, "vec4 texture2DProj(sampler2D sampler, vec3 coord) {\n");
+ yagl_glsl_state_append_header(state, " return textureProj(sampler, coord);\n");
+ yagl_glsl_state_append_header(state, "}\n");
+ yagl_glsl_state_append_header(state, "vec4 texture2DProj(sampler2D sampler, vec4 coord) {\n");
+ yagl_glsl_state_append_header(state, " return textureProj(sampler, coord);\n");
+ yagl_glsl_state_append_header(state, "}\n");
+ state->texture2dproj_declared = 1;
+ }
+ }
+}
+| TOK_TEXTURE2DLOD
+{
+ yagl_glsl_state_flush_pending(state, $1.index);
+ yagl_glsl_state_append_output(state, $1.value);
+
+ if (state->patch_gl2) {
+ if (!state->texture2dlod_declared) {
+ yagl_glsl_state_append_header(state, "vec4 texture2DLod(sampler2D sampler, vec2 coord, float lod) {\n");
+ yagl_glsl_state_append_header(state, " return textureLod(sampler, coord, lod);\n");
+ yagl_glsl_state_append_header(state, "}\n");
+ state->texture2dlod_declared = 1;
+ }
+ }
+}
+| TOK_TEXTURE2DPROJLOD
+{
+ yagl_glsl_state_flush_pending(state, $1.index);
+ yagl_glsl_state_append_output(state, $1.value);
+
+ if (state->patch_gl2) {
+ if (!state->texture2dprojlod_declared) {
+ yagl_glsl_state_append_header(state, "vec4 texture2DProjLod(sampler2D sampler, vec3 coord, float lod) {\n");
+ yagl_glsl_state_append_header(state, " return textureProjLod(sampler, coord, lod);\n");
+ yagl_glsl_state_append_header(state, "}\n");
+ yagl_glsl_state_append_header(state, "vec4 texture2DProjLod(sampler2D sampler, vec4 coord, float lod) {\n");
+ yagl_glsl_state_append_header(state, " return textureProjLod(sampler, coord, lod);\n");
+ yagl_glsl_state_append_header(state, "}\n");
+ state->texture2dprojlod_declared = 1;
+ }
+ }
+}
+| TOK_TEXTURE3D
+{
+ yagl_glsl_state_flush_pending(state, $1.index);
+ yagl_glsl_state_append_output(state, $1.value);
+
+ if (state->patch_gl2) {
+ if (!state->texture3d_declared) {
+ if (state->shader_type == GL_FRAGMENT_SHADER) {
+ yagl_glsl_state_append_header(state, "vec4 texture3D(sampler3D sampler, vec3 coord, float bias) {\n");
+ yagl_glsl_state_append_header(state, " return texture(sampler, coord, bias);\n");
+ yagl_glsl_state_append_header(state, "}\n");
+ }
+ yagl_glsl_state_append_header(state, "vec4 texture3D(sampler3D sampler, vec3 coord) {\n");
+ yagl_glsl_state_append_header(state, " return texture(sampler, coord);\n");
+ yagl_glsl_state_append_header(state, "}\n");
+ state->texture3d_declared = 1;
+ }
+ }
+}
+| TOK_TEXTURE3DPROJ
+{
+ yagl_glsl_state_flush_pending(state, $1.index);
+ yagl_glsl_state_append_output(state, $1.value);
+
+ if (state->patch_gl2) {
+ if (!state->texture3dproj_declared) {
+ if (state->shader_type == GL_FRAGMENT_SHADER) {
+ yagl_glsl_state_append_header(state, "vec4 texture3DProj(sampler3D sampler, vec4 coord, float bias) {\n");
+ yagl_glsl_state_append_header(state, " return textureProj(sampler, coord, bias);\n");
+ yagl_glsl_state_append_header(state, "}\n");
+ }
+ yagl_glsl_state_append_header(state, "vec4 texture3DProj(sampler3D sampler, vec4 coord) {\n");
+ yagl_glsl_state_append_header(state, " return textureProj(sampler, coord);\n");
+ yagl_glsl_state_append_header(state, "}\n");
+ state->texture3dproj_declared = 1;
+ }
+ }
+}
+| TOK_TEXTURE3DLOD
+{
+ yagl_glsl_state_flush_pending(state, $1.index);
+ yagl_glsl_state_append_output(state, $1.value);
+
+ if (state->patch_gl2) {
+ if (!state->texture3dlod_declared) {
+ yagl_glsl_state_append_header(state, "vec4 texture3DLod(sampler3D sampler, vec3 coord, float lod) {\n");
+ yagl_glsl_state_append_header(state, " return textureLod(sampler, coord, lod);\n");
+ yagl_glsl_state_append_header(state, "}\n");
+ state->texture3dlod_declared = 1;
+ }
+ }
+}
+| TOK_TEXTURE3DPROJLOD
+{
+ yagl_glsl_state_flush_pending(state, $1.index);
+ yagl_glsl_state_append_output(state, $1.value);
+
+ if (state->patch_gl2) {
+ if (!state->texture3dprojlod_declared) {
+ yagl_glsl_state_append_header(state, "vec4 texture3DProjLod(sampler3D sampler, vec4 coord, float lod) {\n");
+ yagl_glsl_state_append_header(state, " return textureProjLod(sampler, coord, lod);\n");
+ yagl_glsl_state_append_header(state, "}\n");
+ state->texture3dprojlod_declared = 1;
+ }
+ }
+}
+| TOK_TEXTURECUBE
+{
+ yagl_glsl_state_flush_pending(state, $1.index);
+ yagl_glsl_state_append_output(state, $1.value);
+
+ if (state->patch_gl2) {
+ if (!state->texturecube_declared) {
+ if (state->shader_type == GL_FRAGMENT_SHADER) {
+ yagl_glsl_state_append_header(state, "vec4 textureCube(samplerCube sampler, vec3 coord, float bias) {\n");
+ yagl_glsl_state_append_header(state, " return texture(sampler, coord, bias);\n");
+ yagl_glsl_state_append_header(state, "}\n");
+ }
+ yagl_glsl_state_append_header(state, "vec4 textureCube(samplerCube sampler, vec3 coord) {\n");
+ yagl_glsl_state_append_header(state, " return texture(sampler, coord);\n");
+ yagl_glsl_state_append_header(state, "}\n");
+ state->texturecube_declared = 1;
+ }
+ }
+}
+| TOK_TEXTURECUBELOD
+{
+ yagl_glsl_state_flush_pending(state, $1.index);
+ yagl_glsl_state_append_output(state, $1.value);
+
+ if (state->patch_gl2) {
+ if (!state->texturecubelod_declared) {
+ yagl_glsl_state_append_header(state, "vec4 textureCubeLod(samplerCube sampler, vec3 coord, float lod) {\n");
+ yagl_glsl_state_append_header(state, " return textureLod(sampler, coord, lod);\n");
+ yagl_glsl_state_append_header(state, "}\n");
+ state->texturecubelod_declared = 1;
+ }
+ }
+}
+| TOK_GLFRAGCOLOR
+{
+ yagl_glsl_state_flush_pending(state, $1.index);
+
+ if (state->patch_gl2) {
+ if (!state->frag_color_declared) {
+ yagl_glsl_state_append_header(state, "out vec4 GL_FragColor;\n");
+ state->frag_color_declared = 1;
+ }
+ yagl_glsl_state_append_output(state, "GL_FragColor");
+ } else {
+ yagl_glsl_state_append_output(state, $1.value);
+ }
+}
+;
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include <GL/gl.h>
+#include "yagl_glsl_state.h"
+#include "yagl_log.h"
+#include "yagl_malloc.h"
+#include "yagl_state.h"
+#include <string.h>
+#include <stdio.h>
+
+static void yagl_glsl_state_flush_version(struct yagl_glsl_state *state)
+{
+ int have_version = state->have_version;
+ int have_extensions = state->have_extensions;
+
+ if (have_version && have_extensions) {
+ return;
+ }
+
+ state->have_version = 1;
+ state->have_extensions = 1;
+
+ if (!have_version) {
+ switch (state->patch_version) {
+ case yagl_glsl_140:
+ yagl_glsl_state_append_header(state, "#version 140\n\n");
+ break;
+ case yagl_glsl_150:
+ yagl_glsl_state_append_header(state, "#version 150\n\n");
+ break;
+ default:
+ yagl_glsl_state_append_header(state, "#version 120\n\n");
+ break;
+ }
+ }
+
+ if (!have_extensions) {
+ switch (state->patch_version) {
+ case yagl_glsl_150:
+ yagl_glsl_state_append_header(state, "#ifdef GL_ARB_explicit_attrib_location\n");
+ yagl_glsl_state_append_header(state, "#extension GL_ARB_explicit_attrib_location : enable\n");
+ yagl_glsl_state_append_header(state, "#endif\n");
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+static void yagl_glsl_state_move_pending(struct yagl_glsl_state *state)
+{
+ struct yagl_glsl_pending *p;
+ int pending_size = yagl_vector_size(&state->pending);
+ char c = '\0';
+
+ if (pending_size <= 0) {
+ return;
+ }
+
+ yagl_vector_push_back(&state->pending, &c);
+
+ p = yagl_malloc(sizeof(*p) + pending_size + 1);
+
+ yagl_list_init(&p->list);
+
+ p->token_index = state->token_index;
+
+ memcpy((p + 1), yagl_vector_data(&state->pending), pending_size + 1);
+
+ yagl_list_add_tail(&state->pending_list, &p->list);
+
+ yagl_vector_resize(&state->pending, 0);
+}
+
+void yagl_glsl_state_set_version(struct yagl_glsl_state *state,
+ int version,
+ int is_es)
+{
+ if (((version == 100) || (version == 110) || (version == 120)) && !is_es) {
+ /*
+ * GLSL ES 2.
+ */
+
+ state->patch_precision = 1;
+ state->patch_builtins = 1;
+
+ switch (yagl_get_host_gl_version()) {
+ case yagl_gl_2:
+ state->patch_version = yagl_glsl_120;
+ state->patch_gl2 = 0;
+ state->patch_max_varying_floats = 0;
+ break;
+ default:
+ state->patch_version = yagl_glsl_140;
+ state->patch_gl2 = 1;
+ state->patch_max_varying_floats = 1;
+ break;
+ }
+ } else if ((version == 300) && is_es && state->es3_supported) {
+ /*
+ * GLSL ES 3.
+ */
+
+ state->patch_gl2 = 0;
+
+ switch (yagl_get_host_gl_version()) {
+ case yagl_gl_3_1_es3:
+ /*
+ * GL_ARB_ES3_compatibility includes full ES 3.00 shader
+ * support, no patching is required.
+ */
+
+ state->patch_version = yagl_glsl_asis;
+ state->patch_precision = 0;
+ state->patch_builtins = 0;
+ state->patch_max_varying_floats = 0;
+ break;
+ default:
+ state->patch_version = yagl_glsl_150;
+ state->patch_precision = 1;
+ state->patch_builtins = 1;
+ state->patch_max_varying_floats = 1;
+ break;
+ }
+ } else {
+ /*
+ * Unknown.
+ */
+
+ state->patch_version = yagl_glsl_asis;
+ state->patch_precision = 0;
+ state->patch_builtins = 0;
+ state->patch_gl2 = 0;
+ state->patch_max_varying_floats = 0;
+ }
+}
+
+void yagl_glsl_state_set_error(struct yagl_glsl_state *state,
+ const char *msg)
+{
+ YAGL_LOG_FUNC_SET(yagl_glsl_state_set_error);
+
+ state->have_error = 1;
+
+ YAGL_LOG_WARN("%s", msg);
+}
+
+void yagl_glsl_state_new_pending(struct yagl_glsl_state *state,
+ const char *str)
+{
+ int size = yagl_vector_size(&state->pending);
+ int str_len = strlen(str);
+
+ yagl_vector_resize(&state->pending, size + str_len);
+ memcpy(yagl_vector_data(&state->pending) + size, str, str_len);
+}
+
+void yagl_glsl_state_new_comment(struct yagl_glsl_state *state,
+ int len)
+{
+ int size = yagl_vector_size(&state->pending);
+
+ yagl_vector_resize(&state->pending, size + len);
+ memset(yagl_vector_data(&state->pending) + size, ' ', len);
+}
+
+void yagl_glsl_state_new_str_token(struct yagl_glsl_state *state,
+ YYSTYPE *yylval,
+ const char *value)
+{
+ char *tmp;
+
+ yagl_glsl_state_move_pending(state);
+
+ tmp = strdup(value);
+
+ yagl_vector_push_back(&state->strings, &tmp);
+
+ yylval->str.index = state->token_index;
+ yylval->str.value = tmp;
+
+ ++state->token_index;
+}
+
+void yagl_glsl_state_new_integer_token(struct yagl_glsl_state *state,
+ YYSTYPE *yylval,
+ int value)
+{
+ yagl_glsl_state_move_pending(state);
+
+ yylval->integer.index = state->token_index;
+ yylval->integer.value = value;
+
+ ++state->token_index;
+}
+
+void yagl_glsl_state_flush_pending(struct yagl_glsl_state *state,
+ int token_index)
+{
+ struct yagl_glsl_pending *it, *tmp_it;
+
+ yagl_list_for_each_safe(struct yagl_glsl_pending,
+ it,
+ tmp_it,
+ &state->pending_list, list) {
+ if (it->token_index > token_index) {
+ break;
+ }
+
+ yagl_glsl_state_append_output(state, (const char*)(it + 1));
+
+ yagl_list_remove(&it->list);
+ yagl_free(it);
+ }
+}
+
+void yagl_glsl_state_append_header(struct yagl_glsl_state *state,
+ const char *str)
+{
+ int size, str_len;
+
+ yagl_glsl_state_flush_version(state);
+
+ size = yagl_vector_size(&state->header);
+ str_len = strlen(str);
+
+ yagl_vector_resize(&state->header, size + str_len);
+ memcpy(yagl_vector_data(&state->header) + size, str, str_len);
+}
+
+void yagl_glsl_state_append_output(struct yagl_glsl_state *state,
+ const char *str)
+{
+ int size, str_len;
+
+ size = yagl_vector_size(&state->output);
+ str_len = strlen(str);
+
+ yagl_vector_resize(&state->output, size + str_len);
+ memcpy(yagl_vector_data(&state->output) + size, str, str_len);
+}
+
+void yagl_glsl_state_output_to_header(struct yagl_glsl_state *state)
+{
+ int header_size, output_size;
+
+ header_size = yagl_vector_size(&state->header);
+ output_size = yagl_vector_size(&state->output);
+
+ yagl_vector_resize(&state->header, header_size + output_size);
+ memcpy(yagl_vector_data(&state->header) + header_size,
+ yagl_vector_data(&state->output),
+ output_size);
+
+ yagl_vector_resize(&state->output, 0);
+}
+
+char *yagl_glsl_state_get_output(struct yagl_glsl_state *state, int *output_len)
+{
+ char c = '\0';
+
+ yagl_glsl_state_move_pending(state);
+ yagl_glsl_state_flush_pending(state, state->token_index);
+ yagl_glsl_state_flush_version(state);
+
+ yagl_glsl_state_output_to_header(state);
+
+ *output_len = yagl_vector_size(&state->header);
+
+ yagl_vector_push_back(&state->header, &c);
+
+ return yagl_vector_detach(&state->header);
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GLSL_STATE_H_
+#define _YAGL_GLSL_STATE_H_
+
+#include "yagl_types.h"
+#include "yagl_list.h"
+#include "yagl_vector.h"
+
+struct yagl_glsl_state;
+
+#include "yagl_glsl_parser.h"
+
+struct yagl_glsl_pending
+{
+ struct yagl_list list;
+
+ int token_index;
+};
+
+typedef enum
+{
+ yagl_glsl_asis,
+ yagl_glsl_120,
+ yagl_glsl_140,
+ yagl_glsl_150,
+} yagl_glsl_version;
+
+struct yagl_glsl_state
+{
+ GLenum shader_type;
+
+ const char *source;
+ int source_len;
+ int source_pos;
+
+ int es3_supported;
+
+ void *scanner;
+
+ /*
+ * These are modified during GLSL parsing.
+ * @{
+ */
+
+ yagl_glsl_version patch_version;
+ int patch_precision;
+ int patch_builtins;
+ int patch_gl2;
+ int patch_max_varying_floats;
+
+ int have_error;
+
+ int have_version;
+
+ int have_extensions;
+
+ int frag_color_declared;
+ int texture1d_declared;
+ int texture1dproj_declared;
+ int texture1dlod_declared;
+ int texture1dprojlod_declared;
+ int texture2d_declared;
+ int texture2dproj_declared;
+ int texture2dlod_declared;
+ int texture2dprojlod_declared;
+ int texture3d_declared;
+ int texture3dproj_declared;
+ int texture3dlod_declared;
+ int texture3dprojlod_declared;
+ int texturecube_declared;
+ int texturecubelod_declared;
+
+ // Each token is assigned an index.
+ int token_index;
+
+ // Output shader source header.
+ struct yagl_vector header;
+
+ // Output shader source.
+ struct yagl_vector output;
+
+ // Strings that are waiting to be inserted into 'output'
+ // or to be discarded.
+ struct yagl_list pending_list;
+
+ // String that's waiting to be inserted into 'pending_list'.
+ struct yagl_vector pending;
+
+ // strdup'ed strings.
+ struct yagl_vector strings;
+
+ /*
+ * @}
+ */
+};
+
+int yagl_glsl_state_init(struct yagl_glsl_state *state,
+ GLenum shader_type,
+ const char *source,
+ int source_len,
+ int es3_supported);
+
+void yagl_glsl_state_cleanup(struct yagl_glsl_state *state);
+
+void yagl_glsl_state_set_version(struct yagl_glsl_state *state,
+ int version,
+ int is_es);
+
+void yagl_glsl_state_set_error(struct yagl_glsl_state *state,
+ const char *msg);
+
+void yagl_glsl_state_new_pending(struct yagl_glsl_state *state,
+ const char *str);
+
+void yagl_glsl_state_new_comment(struct yagl_glsl_state *state,
+ int len);
+
+void yagl_glsl_state_new_str_token(struct yagl_glsl_state *state,
+ YYSTYPE *yylval,
+ const char *value);
+
+void yagl_glsl_state_new_integer_token(struct yagl_glsl_state *state,
+ YYSTYPE *yylval,
+ int value);
+
+void yagl_glsl_state_flush_pending(struct yagl_glsl_state *state,
+ int token_index);
+
+void yagl_glsl_state_append_header(struct yagl_glsl_state *state,
+ const char *str);
+
+void yagl_glsl_state_append_output(struct yagl_glsl_state *state,
+ const char *str);
+
+void yagl_glsl_state_output_to_header(struct yagl_glsl_state *state);
+
+/*
+ * The caller owns the data, it must be freed with 'yagl_free'.
+ */
+char *yagl_glsl_state_get_output(struct yagl_glsl_state *state, int *output_len);
+
+int yagl_glsl_parse(struct yagl_glsl_state *state);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GLES3/gl3.h"
+#include "yagl_texcompress.h"
+#include "yagl_texcompress_etc1.h"
+#include "yagl_texcompress_etc2.h"
+#include <assert.h>
+
+/*
+ * We can't include GL/gl.h here
+ */
+#define GL_BGRA 0x80E1
+
+/*
+ * We can't include GLES2/gl2ext.h here
+ */
+#define GL_ETC1_RGB8_OES 0x8D64
+
+#define YAGL_TEXCOMPRESS_ETC_UNPACK_IMPL(etc, name) \
+ static void yagl_texcompress_unpack_##name(struct yagl_texcompress_format *format, \
+ const GLvoid *src, \
+ GLsizei width, \
+ GLsizei height, \
+ GLsizei src_stride, \
+ GLvoid *dst, \
+ GLsizei dst_stride) \
+ { \
+ yagl_texcompress_##etc##_unpack_##name(dst, \
+ dst_stride, \
+ src, \
+ src_stride, \
+ width, \
+ height); \
+ }
+
+YAGL_TEXCOMPRESS_ETC_UNPACK_IMPL(etc1, rgba8888)
+YAGL_TEXCOMPRESS_ETC_UNPACK_IMPL(etc2, r11)
+YAGL_TEXCOMPRESS_ETC_UNPACK_IMPL(etc2, signed_r11)
+YAGL_TEXCOMPRESS_ETC_UNPACK_IMPL(etc2, rg11)
+YAGL_TEXCOMPRESS_ETC_UNPACK_IMPL(etc2, signed_rg11)
+YAGL_TEXCOMPRESS_ETC_UNPACK_IMPL(etc2, rgb8)
+YAGL_TEXCOMPRESS_ETC_UNPACK_IMPL(etc2, srgb8)
+YAGL_TEXCOMPRESS_ETC_UNPACK_IMPL(etc2, rgb8_punchthrough_alpha1)
+YAGL_TEXCOMPRESS_ETC_UNPACK_IMPL(etc2, srgb8_punchthrough_alpha1)
+YAGL_TEXCOMPRESS_ETC_UNPACK_IMPL(etc2, rgba8)
+YAGL_TEXCOMPRESS_ETC_UNPACK_IMPL(etc2, srgb8_alpha8)
+
+static struct yagl_texcompress_format texcompress_formats[] =
+{
+ {
+ .unpack = &yagl_texcompress_unpack_rgba8888,
+ .src_format = GL_ETC1_RGB8_OES,
+ .block_width = 4,
+ .block_height = 4,
+ .block_bytes = 8,
+ .dst_format = GL_RGBA,
+ .dst_internalformat = GL_RGBA8,
+ .dst_type = GL_UNSIGNED_BYTE
+ },
+ {
+ .unpack = &yagl_texcompress_unpack_r11,
+ .src_format = GL_COMPRESSED_R11_EAC,
+ .block_width = 4,
+ .block_height = 4,
+ .block_bytes = 8,
+ .dst_format = GL_RED,
+ .dst_internalformat = GL_RED,
+ .dst_type = GL_UNSIGNED_SHORT
+ },
+ {
+ .unpack = &yagl_texcompress_unpack_signed_r11,
+ .src_format = GL_COMPRESSED_SIGNED_R11_EAC,
+ .block_width = 4,
+ .block_height = 4,
+ .block_bytes = 8,
+ .dst_format = GL_RED,
+ .dst_internalformat = GL_RED,
+ .dst_type = GL_SHORT
+ },
+ {
+ .unpack = &yagl_texcompress_unpack_rg11,
+ .src_format = GL_COMPRESSED_RG11_EAC,
+ .block_width = 4,
+ .block_height = 4,
+ .block_bytes = 16,
+ .dst_format = GL_RGB,
+ .dst_internalformat = GL_RGB,
+ .dst_type = GL_UNSIGNED_SHORT
+ },
+ {
+ .unpack = &yagl_texcompress_unpack_signed_rg11,
+ .src_format = GL_COMPRESSED_SIGNED_RG11_EAC,
+ .block_width = 4,
+ .block_height = 4,
+ .block_bytes = 16,
+ .dst_format = GL_RGB,
+ .dst_internalformat = GL_RGB,
+ .dst_type = GL_SHORT
+ },
+ {
+ .unpack = &yagl_texcompress_unpack_rgb8,
+ .src_format = GL_COMPRESSED_RGB8_ETC2,
+ .block_width = 4,
+ .block_height = 4,
+ .block_bytes = 8,
+ .dst_format = GL_RGBA,
+ .dst_internalformat = GL_RGBA8,
+ .dst_type = GL_UNSIGNED_BYTE
+ },
+ {
+ .unpack = &yagl_texcompress_unpack_srgb8,
+ .src_format = GL_COMPRESSED_SRGB8_ETC2,
+ .block_width = 4,
+ .block_height = 4,
+ .block_bytes = 8,
+ .dst_format = GL_BGRA,
+ .dst_internalformat = GL_SRGB8_ALPHA8,
+ .dst_type = GL_UNSIGNED_BYTE
+ },
+ {
+ .unpack = &yagl_texcompress_unpack_rgb8_punchthrough_alpha1,
+ .src_format = GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
+ .block_width = 4,
+ .block_height = 4,
+ .block_bytes = 8,
+ .dst_format = GL_RGBA,
+ .dst_internalformat = GL_RGBA8,
+ .dst_type = GL_UNSIGNED_BYTE
+ },
+ {
+ .unpack = &yagl_texcompress_unpack_srgb8_punchthrough_alpha1,
+ .src_format = GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
+ .block_width = 4,
+ .block_height = 4,
+ .block_bytes = 8,
+ .dst_format = GL_BGRA,
+ .dst_internalformat = GL_SRGB8_ALPHA8,
+ .dst_type = GL_UNSIGNED_BYTE
+ },
+ {
+ .unpack = &yagl_texcompress_unpack_rgba8,
+ .src_format = GL_COMPRESSED_RGBA8_ETC2_EAC,
+ .block_width = 4,
+ .block_height = 4,
+ .block_bytes = 16,
+ .dst_format = GL_RGBA,
+ .dst_internalformat = GL_RGBA8,
+ .dst_type = GL_UNSIGNED_BYTE
+ },
+ {
+ .unpack = &yagl_texcompress_unpack_srgb8_alpha8,
+ .src_format = GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
+ .block_width = 4,
+ .block_height = 4,
+ .block_bytes = 16,
+ .dst_format = GL_BGRA,
+ .dst_internalformat = GL_SRGB8_ALPHA8,
+ .dst_type = GL_UNSIGNED_BYTE
+ }
+};
+
+int yagl_texcompress_get_format_names(GLenum *formats)
+{
+ int num_formats = sizeof(texcompress_formats)/sizeof(texcompress_formats[0]);
+ int i;
+
+ if (formats) {
+ for (i = 0; i < num_formats; ++i) {
+ formats[i] = texcompress_formats[i].src_format;
+ }
+ }
+
+ return num_formats;
+}
+
+struct yagl_texcompress_format *yagl_texcompress_get_format(GLenum format)
+{
+ int i;
+
+ for (i = 0;
+ i < sizeof(texcompress_formats)/sizeof(texcompress_formats[0]);
+ ++i) {
+ if (texcompress_formats[i].src_format == format) {
+ return &texcompress_formats[i];
+ }
+ }
+
+ return NULL;
+}
+
+int yagl_texcompress_get_info(struct yagl_texcompress_format *format,
+ GLsizei width,
+ GLsizei height,
+ GLsizei src_size,
+ GLsizei *src_stride,
+ GLsizei *dst_stride,
+ GLsizei *dst_size)
+{
+ GLsizei wblocks = (width + format->block_width - 1) / format->block_width;
+ GLsizei hblocks = (height + format->block_height - 1) / format->block_height;
+ GLsizei num_components = 0, bpp = 0;
+
+ if (src_size != (wblocks * hblocks * format->block_bytes)) {
+ return 0;
+ }
+
+ switch (format->dst_format) {
+ case GL_RED:
+ num_components = 1;
+ break;
+ case GL_RGB:
+ num_components = 3;
+ break;
+ case GL_RGBA:
+ case GL_BGRA:
+ num_components = 4;
+ break;
+ default:
+ assert(0);
+ return 0;
+ }
+
+ switch (format->dst_type) {
+ case GL_UNSIGNED_BYTE:
+ bpp = num_components;
+ break;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ bpp = num_components * 2;
+ break;
+ default:
+ assert(0);
+ return 0;
+ }
+
+ *src_stride = wblocks * format->block_bytes;
+ *dst_stride = width * bpp;
+ *dst_size = *dst_stride * height;
+
+ return 1;
+}
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_TEXCOMPRESS_H_
+#define _YAGL_TEXCOMPRESS_H_
+
+#include "yagl_types.h"
+
+struct yagl_texcompress_format
+{
+ void (*unpack)(struct yagl_texcompress_format */*format*/,
+ const GLvoid */*src*/,
+ GLsizei /*width*/,
+ GLsizei /*height*/,
+ GLsizei /*src_stride*/,
+ GLvoid */*dst*/,
+ GLsizei /*dst_stride*/);
+
+ GLenum src_format;
+ GLint block_width;
+ GLint block_height;
+ GLint block_bytes;
+
+ GLenum dst_format;
+ GLenum dst_internalformat;
+ GLenum dst_type;
+};
+
+int yagl_texcompress_get_format_names(GLenum *formats);
+
+struct yagl_texcompress_format *yagl_texcompress_get_format(GLenum format);
+
+int yagl_texcompress_get_info(struct yagl_texcompress_format *format,
+ GLsizei width,
+ GLsizei height,
+ GLsizei src_size,
+ GLsizei *src_stride,
+ GLsizei *dst_stride,
+ GLsizei *dst_size);
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2011 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "GL/gl.h"
+#include "yagl_texcompress_etc2.h"
+#include <stdbool.h>
+
+#define CLAMP(X, MIN, MAX) ((X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)))
+
+struct etc2_block {
+ int distance;
+ uint64_t pixel_indices[2];
+ const int *modifier_tables[2];
+ bool flipped;
+ bool opaque;
+ bool is_ind_mode;
+ bool is_diff_mode;
+ bool is_t_mode;
+ bool is_h_mode;
+ bool is_planar_mode;
+ uint8_t base_colors[3][3];
+ uint8_t paint_colors[4][3];
+ uint8_t base_codeword;
+ uint8_t multiplier;
+ uint8_t table_index;
+};
+
+static const int etc2_distance_table[8] = {
+ 3, 6, 11, 16, 23, 32, 41, 64 };
+
+static const int etc2_modifier_tables[16][8] = {
+ { -3, -6, -9, -15, 2, 5, 8, 14},
+ { -3, -7, -10, -13, 2, 6, 9, 12},
+ { -2, -5, -8, -13, 1, 4, 7, 12},
+ { -2, -4, -6, -13, 1, 3, 5, 12},
+ { -3, -6, -8, -12, 2, 5, 7, 11},
+ { -3, -7, -9, -11, 2, 6, 8, 10},
+ { -4, -7, -8, -11, 3, 6, 7, 10},
+ { -3, -5, -8, -11, 2, 4, 7, 10},
+ { -2, -6, -8, -10, 1, 5, 7, 9},
+ { -2, -5, -8, -10, 1, 4, 7, 9},
+ { -2, -4, -8, -10, 1, 3, 7, 9},
+ { -2, -5, -7, -10, 1, 4, 6, 9},
+ { -3, -4, -7, -10, 2, 3, 6, 9},
+ { -1, -2, -3, -10, 0, 1, 2, 9},
+ { -4, -6, -8, -9, 3, 5, 7, 8},
+ { -3, -5, -7, -9, 2, 4, 6, 8},
+};
+
+static const int etc2_modifier_tables_non_opaque[8][4] = {
+ { 0, 8, 0, -8},
+ { 0, 17, 0, -17},
+ { 0, 29, 0, -29},
+ { 0, 42, 0, -42},
+ { 0, 60, 0, -60},
+ { 0, 80, 0, -80},
+ { 0, 106, 0, -106},
+ { 0, 183, 0, -183}
+};
+
+/* define etc1_parse_block and etc. */
+#define UINT8_TYPE GLubyte
+#define TAG(x) x
+#include "yagl_texcompress_etc_tmp.h"
+#undef TAG
+#undef UINT8_TYPE
+
+static uint8_t
+etc2_base_color1_t_mode(const uint8_t *in, GLuint index)
+{
+ uint8_t R1a = 0, x = 0;
+ /* base col 1 = extend_4to8bits( (R1a << 2) | R1b, G1, B1) */
+ switch(index) {
+ case 0:
+ R1a = (in[0] >> 3) & 0x3;
+ x = ((R1a << 2) | (in[0] & 0x3));
+ break;
+ case 1:
+ x = ((in[1] >> 4) & 0xf);
+ break;
+ case 2:
+ x = (in[1] & 0xf);
+ break;
+ default:
+ /* invalid index */
+ break;
+ }
+ return ((x << 4) | (x & 0xf));
+}
+
+static uint8_t
+etc2_base_color2_t_mode(const uint8_t *in, GLuint index)
+{
+ uint8_t x = 0;
+ /*extend 4to8bits(R2, G2, B2)*/
+ switch(index) {
+ case 0:
+ x = ((in[2] >> 4) & 0xf );
+ break;
+ case 1:
+ x = (in[2] & 0xf);
+ break;
+ case 2:
+ x = ((in[3] >> 4) & 0xf);
+ break;
+ default:
+ /* invalid index */
+ break;
+ }
+ return ((x << 4) | (x & 0xf));
+}
+
+static uint8_t
+etc2_base_color1_h_mode(const uint8_t *in, GLuint index)
+{
+ uint8_t x = 0;
+ /* base col 1 = extend 4to8bits(R1, (G1a << 1) | G1b, (B1a << 3) | B1b) */
+ switch(index) {
+ case 0:
+ x = ((in[0] >> 3) & 0xf);
+ break;
+ case 1:
+ x = (((in[0] & 0x7) << 1) | ((in[1] >> 4) & 0x1));
+ break;
+ case 2:
+ x = ((in[1] & 0x8) |
+ (((in[1] & 0x3) << 1) | ((in[2] >> 7) & 0x1)));
+ break;
+ default:
+ /* invalid index */
+ break;
+ }
+ return ((x << 4) | (x & 0xf));
+}
+
+static uint8_t
+etc2_base_color2_h_mode(const uint8_t *in, GLuint index)
+{
+ uint8_t x = 0;
+ /* base col 2 = extend 4to8bits(R2, G2, B2) */
+ switch(index) {
+ case 0:
+ x = ((in[2] >> 3) & 0xf );
+ break;
+ case 1:
+ x = (((in[2] & 0x7) << 1) | ((in[3] >> 7) & 0x1));
+ break;
+ case 2:
+ x = ((in[3] >> 3) & 0xf);
+ break;
+ default:
+ /* invalid index */
+ break;
+ }
+ return ((x << 4) | (x & 0xf));
+}
+
+static uint8_t
+etc2_base_color_o_planar(const uint8_t *in, GLuint index)
+{
+ GLuint tmp;
+ switch(index) {
+ case 0:
+ tmp = ((in[0] >> 1) & 0x3f); /* RO */
+ return ((tmp << 2) | (tmp >> 4));
+ case 1:
+ tmp = (((in[0] & 0x1) << 6) | /* GO1 */
+ ((in[1] >> 1) & 0x3f)); /* GO2 */
+ return ((tmp << 1) | (tmp >> 6));
+ case 2:
+ tmp = (((in[1] & 0x1) << 5) | /* BO1 */
+ (in[2] & 0x18) | /* BO2 */
+ (((in[2] & 0x3) << 1) | ((in[3] >> 7) & 0x1))); /* BO3 */
+ return ((tmp << 2) | (tmp >> 4));
+ default:
+ /* invalid index */
+ return 0;
+ }
+}
+
+static uint8_t
+etc2_base_color_h_planar(const uint8_t *in, GLuint index)
+{
+ GLuint tmp;
+ switch(index) {
+ case 0:
+ tmp = (((in[3] & 0x7c) >> 1) | /* RH1 */
+ (in[3] & 0x1)); /* RH2 */
+ return ((tmp << 2) | (tmp >> 4));
+ case 1:
+ tmp = (in[4] >> 1) & 0x7f; /* GH */
+ return ((tmp << 1) | (tmp >> 6));
+ case 2:
+ tmp = (((in[4] & 0x1) << 5) |
+ ((in[5] >> 3) & 0x1f)); /* BH */
+ return ((tmp << 2) | (tmp >> 4));
+ default:
+ /* invalid index */
+ return 0;
+ }
+}
+
+static uint8_t
+etc2_base_color_v_planar(const uint8_t *in, GLuint index)
+{
+ GLuint tmp;
+ switch(index) {
+ case 0:
+ tmp = (((in[5] & 0x7) << 0x3) |
+ ((in[6] >> 5) & 0x7)); /* RV */
+ return ((tmp << 2) | (tmp >> 4));
+ case 1:
+ tmp = (((in[6] & 0x1f) << 2) |
+ ((in[7] >> 6) & 0x3)); /* GV */
+ return ((tmp << 1) | (tmp >> 6));
+ case 2:
+ tmp = in[7] & 0x3f; /* BV */
+ return ((tmp << 2) | (tmp >> 4));
+ default:
+ /* invalid index */
+ return 0;
+ }
+}
+
+static GLint
+etc2_get_pixel_index(const struct etc2_block *block, int x, int y)
+{
+ int bit = ((3 - y) + (3 - x) * 4) * 3;
+ int idx = (block->pixel_indices[1] >> bit) & 0x7;
+ return idx;
+}
+
+static uint8_t
+etc2_clamp(int color)
+{
+ /* CLAMP(color, 0, 255) */
+ return (uint8_t) CLAMP(color, 0, 255);
+}
+
+static GLushort
+etc2_clamp2(int color)
+{
+ /* CLAMP(color, 0, 2047) */
+ return (GLushort) CLAMP(color, 0, 2047);
+}
+
+static GLshort
+etc2_clamp3(int color)
+{
+ /* CLAMP(color, -1023, 1023) */
+ return (GLshort) CLAMP(color, -1023, 1023);
+}
+
+static void
+etc2_rgb8_parse_block(struct etc2_block *block,
+ const uint8_t *src,
+ GLboolean punchthrough_alpha)
+{
+ unsigned i;
+ GLboolean diffbit = false;
+ static const int lookup[8] = { 0, 1, 2, 3, -4, -3, -2, -1 };
+
+ const int R_plus_dR = (src[0] >> 3) + lookup[src[0] & 0x7];
+ const int G_plus_dG = (src[1] >> 3) + lookup[src[1] & 0x7];
+ const int B_plus_dB = (src[2] >> 3) + lookup[src[2] & 0x7];
+
+ /* Reset the mode flags */
+ block->is_ind_mode = false;
+ block->is_diff_mode = false;
+ block->is_t_mode = false;
+ block->is_h_mode = false;
+ block->is_planar_mode = false;
+
+ if (punchthrough_alpha)
+ block->opaque = src[3] & 0x2;
+ else
+ diffbit = src[3] & 0x2;
+
+ if (!diffbit && !punchthrough_alpha) {
+ /* individual mode */
+ block->is_ind_mode = true;
+
+ for (i = 0; i < 3; i++) {
+ /* Texture decode algorithm is same for individual mode in etc1
+ * & etc2.
+ */
+ block->base_colors[0][i] = etc1_base_color_ind_hi(src[i]);
+ block->base_colors[1][i] = etc1_base_color_ind_lo(src[i]);
+ }
+ }
+ else if (R_plus_dR < 0 || R_plus_dR > 31){
+ /* T mode */
+ block->is_t_mode = true;
+
+ for(i = 0; i < 3; i++) {
+ block->base_colors[0][i] = etc2_base_color1_t_mode(src, i);
+ block->base_colors[1][i] = etc2_base_color2_t_mode(src, i);
+ }
+ /* pick distance */
+ block->distance =
+ etc2_distance_table[(((src[3] >> 2) & 0x3) << 1) |
+ (src[3] & 0x1)];
+
+ for (i = 0; i < 3; i++) {
+ block->paint_colors[0][i] = etc2_clamp(block->base_colors[0][i]);
+ block->paint_colors[1][i] = etc2_clamp(block->base_colors[1][i] +
+ block->distance);
+ block->paint_colors[2][i] = etc2_clamp(block->base_colors[1][i]);
+ block->paint_colors[3][i] = etc2_clamp(block->base_colors[1][i] -
+ block->distance);
+ }
+ }
+ else if (G_plus_dG < 0 || G_plus_dG > 31){
+ int base_color_1_value, base_color_2_value;
+
+ /* H mode */
+ block->is_h_mode = true;
+
+ for(i = 0; i < 3; i++) {
+ block->base_colors[0][i] = etc2_base_color1_h_mode(src, i);
+ block->base_colors[1][i] = etc2_base_color2_h_mode(src, i);
+ }
+
+ base_color_1_value = (block->base_colors[0][0] << 16) +
+ (block->base_colors[0][1] << 8) +
+ block->base_colors[0][2];
+ base_color_2_value = (block->base_colors[1][0] << 16) +
+ (block->base_colors[1][1] << 8) +
+ block->base_colors[1][2];
+ /* pick distance */
+ block->distance =
+ etc2_distance_table[(src[3] & 0x4) |
+ ((src[3] & 0x1) << 1) |
+ (base_color_1_value >= base_color_2_value)];
+
+ for (i = 0; i < 3; i++) {
+ block->paint_colors[0][i] = etc2_clamp(block->base_colors[0][i] +
+ block->distance);
+ block->paint_colors[1][i] = etc2_clamp(block->base_colors[0][i] -
+ block->distance);
+ block->paint_colors[2][i] = etc2_clamp(block->base_colors[1][i] +
+ block->distance);
+ block->paint_colors[3][i] = etc2_clamp(block->base_colors[1][i] -
+ block->distance);
+ }
+ }
+ else if (B_plus_dB < 0 || B_plus_dB > 31) {
+ /* Planar mode */
+ block->is_planar_mode = true;
+
+ /* opaque bit must be set in planar mode */
+ if (!block->opaque)
+ block->opaque = true;
+
+ for (i = 0; i < 3; i++) {
+ block->base_colors[0][i] = etc2_base_color_o_planar(src, i);
+ block->base_colors[1][i] = etc2_base_color_h_planar(src, i);
+ block->base_colors[2][i] = etc2_base_color_v_planar(src, i);
+ }
+ }
+ else if (diffbit || punchthrough_alpha) {
+ /* differential mode */
+ block->is_diff_mode = true;
+
+ for (i = 0; i < 3; i++) {
+ /* Texture decode algorithm is same for differential mode in etc1
+ * & etc2.
+ */
+ block->base_colors[0][i] = etc1_base_color_diff_hi(src[i]);
+ block->base_colors[1][i] = etc1_base_color_diff_lo(src[i]);
+ }
+ }
+
+ if (block->is_ind_mode || block->is_diff_mode) {
+ int table1_idx = (src[3] >> 5) & 0x7;
+ int table2_idx = (src[3] >> 2) & 0x7;
+
+ /* Use same modifier tables as for etc1 textures if opaque bit is set
+ * or if non punchthrough texture format
+ */
+ block->modifier_tables[0] = (block->opaque || !punchthrough_alpha) ?
+ etc1_modifier_tables[table1_idx] :
+ etc2_modifier_tables_non_opaque[table1_idx];
+ block->modifier_tables[1] = (block->opaque || !punchthrough_alpha) ?
+ etc1_modifier_tables[table2_idx] :
+ etc2_modifier_tables_non_opaque[table2_idx];
+
+ block->flipped = (src[3] & 0x1);
+ }
+
+ block->pixel_indices[0] =
+ (src[4] << 24) | (src[5] << 16) | (src[6] << 8) | src[7];
+}
+
+static void
+etc2_rgb8_fetch_texel(const struct etc2_block *block,
+ int x, int y, uint8_t *dst,
+ GLboolean punchthrough_alpha)
+{
+ const uint8_t *base_color;
+ int modifier, bit, idx, blk;
+
+ /* get pixel index */
+ bit = y + x * 4;
+ idx = ((block->pixel_indices[0] >> (15 + bit)) & 0x2) |
+ ((block->pixel_indices[0] >> (bit)) & 0x1);
+
+ if (block->is_ind_mode || block->is_diff_mode) {
+ /* check for punchthrough_alpha format */
+ if (punchthrough_alpha) {
+ if (!block->opaque && idx == 2) {
+ dst[0] = dst[1] = dst[2] = dst[3] = 0;
+ return;
+ }
+ else
+ dst[3] = 255;
+ }
+
+ /* Use pixel index and subblock to get the modifier */
+ blk = (block->flipped) ? (y >= 2) : (x >= 2);
+ base_color = block->base_colors[blk];
+ modifier = block->modifier_tables[blk][idx];
+
+ dst[0] = etc2_clamp(base_color[0] + modifier);
+ dst[1] = etc2_clamp(base_color[1] + modifier);
+ dst[2] = etc2_clamp(base_color[2] + modifier);
+ }
+ else if (block->is_t_mode || block->is_h_mode) {
+ /* check for punchthrough_alpha format */
+ if (punchthrough_alpha) {
+ if (!block->opaque && idx == 2) {
+ dst[0] = dst[1] = dst[2] = dst[3] = 0;
+ return;
+ }
+ else
+ dst[3] = 255;
+ }
+
+ /* Use pixel index to pick one of the paint colors */
+ dst[0] = block->paint_colors[idx][0];
+ dst[1] = block->paint_colors[idx][1];
+ dst[2] = block->paint_colors[idx][2];
+ }
+ else if (block->is_planar_mode) {
+ /* {R(x, y) = clamp255((x × (RH − RO) + y × (RV − RO) + 4 × RO + 2) >> 2)
+ * {G(x, y) = clamp255((x × (GH − GO) + y × (GV − GO) + 4 × GO + 2) >> 2)
+ * {B(x, y) = clamp255((x × (BH − BO) + y × (BV − BO) + 4 × BO + 2) >> 2)
+ */
+ int red, green, blue;
+ red = (x * (block->base_colors[1][0] - block->base_colors[0][0]) +
+ y * (block->base_colors[2][0] - block->base_colors[0][0]) +
+ 4 * block->base_colors[0][0] + 2) >> 2;
+
+ green = (x * (block->base_colors[1][1] - block->base_colors[0][1]) +
+ y * (block->base_colors[2][1] - block->base_colors[0][1]) +
+ 4 * block->base_colors[0][1] + 2) >> 2;
+
+ blue = (x * (block->base_colors[1][2] - block->base_colors[0][2]) +
+ y * (block->base_colors[2][2] - block->base_colors[0][2]) +
+ 4 * block->base_colors[0][2] + 2) >> 2;
+
+ dst[0] = etc2_clamp(red);
+ dst[1] = etc2_clamp(green);
+ dst[2] = etc2_clamp(blue);
+
+ /* check for punchthrough_alpha format */
+ if (punchthrough_alpha)
+ dst[3] = 255;
+ }
+}
+
+static void
+etc2_alpha8_fetch_texel(const struct etc2_block *block,
+ int x, int y, uint8_t *dst)
+{
+ int modifier, alpha, idx;
+ /* get pixel index */
+ idx = etc2_get_pixel_index(block, x, y);
+ modifier = etc2_modifier_tables[block->table_index][idx];
+ alpha = block->base_codeword + modifier * block->multiplier;
+ dst[3] = etc2_clamp(alpha);
+}
+
+static void
+etc2_r11_fetch_texel(const struct etc2_block *block,
+ int x, int y, uint8_t *dst)
+{
+ GLint modifier, idx;
+ GLshort color;
+ /* Get pixel index */
+ idx = etc2_get_pixel_index(block, x, y);
+ modifier = etc2_modifier_tables[block->table_index][idx];
+
+ if (block->multiplier != 0)
+ /* clamp2(base codeword × 8 + 4 + modifier × multiplier × 8) */
+ color = etc2_clamp2(((block->base_codeword << 3) | 0x4) +
+ ((modifier * block->multiplier) << 3));
+ else
+ color = etc2_clamp2(((block->base_codeword << 3) | 0x4) + modifier);
+
+ /* Extend 11 bits color value to 16 bits. OpenGL ES 3.0 specification
+ * allows extending the color value to any number of bits. But, an
+ * implementation is not allowed to truncate the 11-bit value to less than
+ * 11 bits."
+ */
+ color = (color << 5) | (color >> 6);
+ ((GLushort *)dst)[0] = color;
+}
+
+static void
+etc2_signed_r11_fetch_texel(const struct etc2_block *block,
+ int x, int y, uint8_t *dst)
+{
+ GLint modifier, idx;
+ GLshort color;
+ GLbyte base_codeword = (GLbyte) block->base_codeword;
+
+ if (base_codeword == -128)
+ base_codeword = -127;
+
+ /* Get pixel index */
+ idx = etc2_get_pixel_index(block, x, y);
+ modifier = etc2_modifier_tables[block->table_index][idx];
+
+ if (block->multiplier != 0)
+ /* clamp3(base codeword × 8 + modifier × multiplier × 8) */
+ color = etc2_clamp3((base_codeword << 3) +
+ ((modifier * block->multiplier) << 3));
+ else
+ color = etc2_clamp3((base_codeword << 3) + modifier);
+
+ /* Extend 11 bits color value to 16 bits. OpenGL ES 3.0 specification
+ * allows extending the color value to any number of bits. But, an
+ * implementation is not allowed to truncate the 11-bit value to less than
+ * 11 bits. A negative 11-bit value must first be made positive before bit
+ * replication, and then made negative again
+ */
+ if (color >= 0)
+ color = (color << 5) | (color >> 5);
+ else {
+ color = -color;
+ color = (color << 5) | (color >> 5);
+ color = -color;
+ }
+ ((GLshort *)dst)[0] = color;
+}
+
+static void
+etc2_alpha8_parse_block(struct etc2_block *block, const uint8_t *src)
+{
+ block->base_codeword = src[0];
+ block->multiplier = (src[1] >> 4) & 0xf;
+ block->table_index = src[1] & 0xf;
+ block->pixel_indices[1] = (((uint64_t)src[2] << 40) |
+ ((uint64_t)src[3] << 32) |
+ ((uint64_t)src[4] << 24) |
+ ((uint64_t)src[5] << 16) |
+ ((uint64_t)src[6] << 8) |
+ ((uint64_t)src[7]));
+}
+
+static void
+etc2_r11_parse_block(struct etc2_block *block, const uint8_t *src)
+{
+ /* Parsing logic remains same as for etc2_alpha8_parse_block */
+ etc2_alpha8_parse_block(block, src);
+}
+
+static void
+etc2_rgba8_parse_block(struct etc2_block *block, const uint8_t *src)
+{
+ /* RGB component is parsed the same way as for GL_COMPRESSED_RGB8_ETC2 */
+ etc2_rgb8_parse_block(block, src + 8,
+ false /* punchthrough_alpha */);
+ /* Parse Alpha component */
+ etc2_alpha8_parse_block(block, src);
+}
+
+static void
+etc2_rgba8_fetch_texel(const struct etc2_block *block,
+ int x, int y, uint8_t *dst)
+{
+ etc2_rgb8_fetch_texel(block, x, y, dst,
+ false /* punchthrough_alpha */);
+ etc2_alpha8_fetch_texel(block, x, y, dst);
+}
+
+void yagl_texcompress_etc2_unpack_r11(uint8_t *dst_row,
+ unsigned dst_stride,
+ const uint8_t *src_row,
+ unsigned src_stride,
+ unsigned width,
+ unsigned height)
+{
+ /* If internalformat is COMPRESSED_R11_EAC, each 4 × 4 block of
+ color information is compressed to 64 bits.
+ */
+ const unsigned bw = 4, bh = 4, bs = 8, comps = 1, comp_size = 2;
+ struct etc2_block block;
+ unsigned x, y, i, j;
+
+ for (y = 0; y < height; y += bh) {
+ const uint8_t *src = src_row;
+
+ for (x = 0; x < width; x+= bw) {
+ etc2_r11_parse_block(&block, src);
+
+ for (j = 0; (j < bh) && ((y + j) < height); j++) {
+ uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps * comp_size;
+ for (i = 0; (i < bw) && ((x + i) < width); i++) {
+ etc2_r11_fetch_texel(&block, i, j, dst);
+ dst += comps * comp_size;
+ }
+ }
+ src += bs;
+ }
+
+ src_row += src_stride;
+ }
+}
+
+void yagl_texcompress_etc2_unpack_signed_r11(uint8_t *dst_row,
+ unsigned dst_stride,
+ const uint8_t *src_row,
+ unsigned src_stride,
+ unsigned width,
+ unsigned height)
+{
+ /* If internalformat is COMPRESSED_SIGNED_R11_EAC, each 4 × 4 block of
+ red color information is compressed to 64 bits.
+ */
+ const unsigned bw = 4, bh = 4, bs = 8, comps = 1, comp_size = 2;
+ struct etc2_block block;
+ unsigned x, y, i, j;
+
+ for (y = 0; y < height; y += bh) {
+ const uint8_t *src = src_row;
+
+ for (x = 0; x < width; x+= bw) {
+ etc2_r11_parse_block(&block, src);
+
+ for (j = 0; (j < bh) && ((y + j) < height); j++) {
+ uint8_t *dst = dst_row + (y + j) * dst_stride +
+ x * comps * comp_size;
+ for (i = 0; (i < bw) && ((x + i) < width); i++) {
+ etc2_signed_r11_fetch_texel(&block, i, j, dst);
+ dst += comps * comp_size;
+ }
+ }
+ src += bs;
+ }
+
+ src_row += src_stride;
+ }
+}
+
+void yagl_texcompress_etc2_unpack_rg11(uint8_t *dst_row,
+ unsigned dst_stride,
+ const uint8_t *src_row,
+ unsigned src_stride,
+ unsigned width,
+ unsigned height)
+{
+ /* If internalformat is COMPRESSED_RG11_EAC, each 4 × 4 block of
+ RG color information is compressed to 128 bits.
+ */
+ const unsigned bw = 4, bh = 4, bs = 16, comps = 3, comp_size = 2;
+ struct etc2_block block;
+ unsigned x, y, i, j;
+
+ for (y = 0; y < height; y += bh) {
+ const uint8_t *src = src_row;
+
+ for (x = 0; x < width; x+= bw) {
+ /* red component */
+ etc2_r11_parse_block(&block, src);
+
+ for (j = 0; (j < bh) && ((y + j) < height); j++) {
+ uint8_t *dst = dst_row + (y + j) * dst_stride +
+ x * comps * comp_size;
+ for (i = 0; (i < bw) && ((x + i) < width); i++) {
+ etc2_r11_fetch_texel(&block, i, j, dst);
+ dst += comps * comp_size;
+ }
+ }
+ /* green/blue component */
+ etc2_r11_parse_block(&block, src + 8);
+
+ for (j = 0; (j < bh) && ((y + j) < height); j++) {
+ uint8_t *dst = dst_row + (y + j) * dst_stride +
+ x * comps * comp_size;
+ for (i = 0; (i < bw) && ((x + i) < width); i++) {
+ etc2_r11_fetch_texel(&block, i, j, dst + comp_size);
+ *(GLushort*)(dst + comp_size * 2) = 0;
+ dst += comps * comp_size;
+ }
+ }
+ src += bs;
+ }
+
+ src_row += src_stride;
+ }
+}
+
+void yagl_texcompress_etc2_unpack_signed_rg11(uint8_t *dst_row,
+ unsigned dst_stride,
+ const uint8_t *src_row,
+ unsigned src_stride,
+ unsigned width,
+ unsigned height)
+{
+ /* If internalformat is COMPRESSED_SIGNED_RG11_EAC, each 4 × 4 block of
+ RG color information is compressed to 128 bits.
+ */
+ const unsigned bw = 4, bh = 4, bs = 16, comps = 3, comp_size = 2;
+ struct etc2_block block;
+ unsigned x, y, i, j;
+
+ for (y = 0; y < height; y += bh) {
+ const uint8_t *src = src_row;
+
+ for (x = 0; x < width; x+= bw) {
+ /* red component */
+ etc2_r11_parse_block(&block, src);
+
+ for (j = 0; (j < bh) && ((y + j) < height); j++) {
+ uint8_t *dst = dst_row + (y + j) * dst_stride +
+ x * comps * comp_size;
+ for (i = 0; (i < bw) && ((x + i) < width); i++) {
+ etc2_signed_r11_fetch_texel(&block, i, j, dst);
+ dst += comps * comp_size;
+ }
+ }
+ /* green/blue component */
+ etc2_r11_parse_block(&block, src + 8);
+
+ for (j = 0; (j < bh) && ((y + j) < height); j++) {
+ uint8_t *dst = dst_row + (y + j) * dst_stride +
+ x * comps * comp_size;
+ for (i = 0; (i < bw) && ((x + i) < width); i++) {
+ etc2_signed_r11_fetch_texel(&block, i, j, dst + comp_size);
+ *(GLushort*)(dst + comp_size * 2) = 0;
+ dst += comps * comp_size;
+ }
+ }
+ src += bs;
+ }
+
+ src_row += src_stride;
+ }
+}
+
+void yagl_texcompress_etc2_unpack_rgb8(uint8_t *dst_row,
+ unsigned dst_stride,
+ const uint8_t *src_row,
+ unsigned src_stride,
+ unsigned width,
+ unsigned height)
+{
+ const unsigned bw = 4, bh = 4, bs = 8, comps = 4;
+ struct etc2_block block;
+ unsigned x, y, i, j;
+
+ for (y = 0; y < height; y += bh) {
+ const uint8_t *src = src_row;
+
+ for (x = 0; x < width; x+= bw) {
+ etc2_rgb8_parse_block(&block, src,
+ false /* punchthrough_alpha */);
+
+ for (j = 0; (j < bh) && ((y + j) < height); j++) {
+ uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
+ for (i = 0; (i < bw) && ((x + i) < width); i++) {
+ etc2_rgb8_fetch_texel(&block, i, j, dst,
+ false /* punchthrough_alpha */);
+ dst[3] = 255;
+ dst += comps;
+ }
+ }
+
+ src += bs;
+ }
+
+ src_row += src_stride;
+ }
+}
+
+void yagl_texcompress_etc2_unpack_srgb8(uint8_t *dst_row,
+ unsigned dst_stride,
+ const uint8_t *src_row,
+ unsigned src_stride,
+ unsigned width,
+ unsigned height)
+{
+ const unsigned bw = 4, bh = 4, bs = 8, comps = 4;
+ struct etc2_block block;
+ unsigned x, y, i, j;
+ uint8_t tmp;
+
+ for (y = 0; y < height; y += bh) {
+ const uint8_t *src = src_row;
+
+ for (x = 0; x < width; x+= bw) {
+ etc2_rgb8_parse_block(&block, src,
+ false /* punchthrough_alpha */);
+
+ for (j = 0; (j < bh) && ((y + j) < height); j++) {
+ uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
+ for (i = 0; (i < bw) && ((x + i) < width); i++) {
+ etc2_rgb8_fetch_texel(&block, i, j, dst,
+ false /* punchthrough_alpha */);
+ /* Convert to GL_BGRA */
+ tmp = dst[0];
+ dst[0] = dst[2];
+ dst[2] = tmp;
+ dst[3] = 255;
+
+ dst += comps;
+ }
+ }
+ src += bs;
+ }
+
+ src_row += src_stride;
+ }
+}
+
+void yagl_texcompress_etc2_unpack_rgb8_punchthrough_alpha1(uint8_t *dst_row,
+ unsigned dst_stride,
+ const uint8_t *src_row,
+ unsigned src_stride,
+ unsigned width,
+ unsigned height)
+{
+ const unsigned bw = 4, bh = 4, bs = 8, comps = 4;
+ struct etc2_block block;
+ unsigned x, y, i, j;
+
+ for (y = 0; y < height; y += bh) {
+ const uint8_t *src = src_row;
+
+ for (x = 0; x < width; x+= bw) {
+ etc2_rgb8_parse_block(&block, src,
+ true /* punchthrough_alpha */);
+ for (j = 0; (j < bh) && ((y + j) < height); j++) {
+ uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
+ for (i = 0; (i < bw) && ((x + i) < width); i++) {
+ etc2_rgb8_fetch_texel(&block, i, j, dst,
+ true /* punchthrough_alpha */);
+ dst += comps;
+ }
+ }
+
+ src += bs;
+ }
+
+ src_row += src_stride;
+ }
+}
+
+void yagl_texcompress_etc2_unpack_srgb8_punchthrough_alpha1(uint8_t *dst_row,
+ unsigned dst_stride,
+ const uint8_t *src_row,
+ unsigned src_stride,
+ unsigned width,
+ unsigned height)
+{
+ const unsigned bw = 4, bh = 4, bs = 8, comps = 4;
+ struct etc2_block block;
+ unsigned x, y, i, j;
+ uint8_t tmp;
+
+ for (y = 0; y < height; y += bh) {
+ const uint8_t *src = src_row;
+
+ for (x = 0; x < width; x+= bw) {
+ etc2_rgb8_parse_block(&block, src,
+ true /* punchthrough_alpha */);
+ for (j = 0; (j < bh) && ((y + j) < height); j++) {
+ uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
+ for (i = 0; (i < bw) && ((x + i) < width); i++) {
+ etc2_rgb8_fetch_texel(&block, i, j, dst,
+ true /* punchthrough_alpha */);
+ /* Convert to GL_BGRA */
+ tmp = dst[0];
+ dst[0] = dst[2];
+ dst[2] = tmp;
+ dst[3] = dst[3];
+
+ dst += comps;
+ }
+ }
+
+ src += bs;
+ }
+
+ src_row += src_stride;
+ }
+}
+
+void yagl_texcompress_etc2_unpack_rgba8(uint8_t *dst_row,
+ unsigned dst_stride,
+ const uint8_t *src_row,
+ unsigned src_stride,
+ unsigned width,
+ unsigned height)
+{
+ /* If internalformat is COMPRESSED_RGBA8_ETC2_EAC, each 4 × 4 block of
+ * RGBA8888 information is compressed to 128 bits. To decode a block, the
+ * two 64-bit integers int64bitAlpha and int64bitColor are calculated.
+ */
+ const unsigned bw = 4, bh = 4, bs = 16, comps = 4;
+ struct etc2_block block;
+ unsigned x, y, i, j;
+
+ for (y = 0; y < height; y += bh) {
+ const uint8_t *src = src_row;
+
+ for (x = 0; x < width; x+= bw) {
+ etc2_rgba8_parse_block(&block, src);
+
+ for (j = 0; (j < bh) && ((y + j) < height); j++) {
+ uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
+ for (i = 0; (i < bw) && ((x + i) < width); i++) {
+ etc2_rgba8_fetch_texel(&block, i, j, dst);
+ dst += comps;
+ }
+ }
+ src += bs;
+ }
+
+ src_row += src_stride;
+ }
+}
+
+void yagl_texcompress_etc2_unpack_srgb8_alpha8(uint8_t *dst_row,
+ unsigned dst_stride,
+ const uint8_t *src_row,
+ unsigned src_stride,
+ unsigned width,
+ unsigned height)
+{
+ /* If internalformat is COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, each 4 × 4 block
+ * of RGBA8888 information is compressed to 128 bits. To decode a block, the
+ * two 64-bit integers int64bitAlpha and int64bitColor are calculated.
+ */
+ const unsigned bw = 4, bh = 4, bs = 16, comps = 4;
+ struct etc2_block block;
+ unsigned x, y, i, j;
+ uint8_t tmp;
+
+ for (y = 0; y < height; y += bh) {
+ const uint8_t *src = src_row;
+
+ for (x = 0; x < width; x+= bw) {
+ etc2_rgba8_parse_block(&block, src);
+
+ for (j = 0; (j < bh) && ((y + j) < height); j++) {
+ uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
+ for (i = 0; (i < bw) && ((x + i) < width); i++) {
+ etc2_rgba8_fetch_texel(&block, i, j, dst);
+
+ /* Convert to GL_BGRA */
+ tmp = dst[0];
+ dst[0] = dst[2];
+ dst[2] = tmp;
+ dst[3] = dst[3];
+
+ dst += comps;
+ }
+ }
+ src += bs;
+ }
+
+ src_row += src_stride;
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2011 LunarG, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _YAGL_TEXCOMPRESS_ETC2_H_
+#define _YAGL_TEXCOMPRESS_ETC2_H_
+
+#include "yagl_types.h"
+
+void yagl_texcompress_etc2_unpack_r11(uint8_t *dst_row,
+ unsigned dst_stride,
+ const uint8_t *src_row,
+ unsigned src_stride,
+ unsigned width,
+ unsigned height);
+
+void yagl_texcompress_etc2_unpack_signed_r11(uint8_t *dst_row,
+ unsigned dst_stride,
+ const uint8_t *src_row,
+ unsigned src_stride,
+ unsigned width,
+ unsigned height);
+
+void yagl_texcompress_etc2_unpack_rg11(uint8_t *dst_row,
+ unsigned dst_stride,
+ const uint8_t *src_row,
+ unsigned src_stride,
+ unsigned width,
+ unsigned height);
+
+void yagl_texcompress_etc2_unpack_signed_rg11(uint8_t *dst_row,
+ unsigned dst_stride,
+ const uint8_t *src_row,
+ unsigned src_stride,
+ unsigned width,
+ unsigned height);
+
+void yagl_texcompress_etc2_unpack_rgb8(uint8_t *dst_row,
+ unsigned dst_stride,
+ const uint8_t *src_row,
+ unsigned src_stride,
+ unsigned width,
+ unsigned height);
+
+void yagl_texcompress_etc2_unpack_srgb8(uint8_t *dst_row,
+ unsigned dst_stride,
+ const uint8_t *src_row,
+ unsigned src_stride,
+ unsigned width,
+ unsigned height);
+
+void yagl_texcompress_etc2_unpack_rgb8_punchthrough_alpha1(uint8_t *dst_row,
+ unsigned dst_stride,
+ const uint8_t *src_row,
+ unsigned src_stride,
+ unsigned width,
+ unsigned height);
+
+void yagl_texcompress_etc2_unpack_srgb8_punchthrough_alpha1(uint8_t *dst_row,
+ unsigned dst_stride,
+ const uint8_t *src_row,
+ unsigned src_stride,
+ unsigned width,
+ unsigned height);
+
+void yagl_texcompress_etc2_unpack_rgba8(uint8_t *dst_row,
+ unsigned dst_stride,
+ const uint8_t *src_row,
+ unsigned src_stride,
+ unsigned width,
+ unsigned height);
+
+void yagl_texcompress_etc2_unpack_srgb8_alpha8(uint8_t *dst_row,
+ unsigned dst_stride,
+ const uint8_t *src_row,
+ unsigned src_stride,
+ unsigned width,
+ unsigned height);
+
+#endif
--- /dev/null
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
--- /dev/null
+Copyright (C) 2012 Samsung Electronics co., Ltd. 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 fur-
+nished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
+NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON-
+NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--- /dev/null
+Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under MIT License.
+Please, see the LICENSE.MIT file for MIT License terms and conditions.
+
+Several source codes may have its original copyright owner and/or
+be licensed under other than MIT License, say, GNU Lesser General Public License, version 3.
+Please, see copyright and license comments section in the header of each file,
+and the LICENSE.LGPL3.0 file for GNU Lesser General Public License, version 3 terms and conditions.
--- /dev/null
+include_directories(.)
+
+add_library(EGL_dummy SHARED egl_dummy.c)
+add_library(GLESv1_dummy SHARED gles1_dummy.c)
+add_library(GLESv2_dummy SHARED gles2_dummy.c)
+
+install(
+ TARGETS EGL_dummy GLESv1_dummy GLESv2_dummy
+ LIBRARY DESTINATION lib/dummy-gl
+)
--- /dev/null
+/*
+ * Emulator YaGL dummy headder for export API
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Jinhyung Jo <jinhyung.jo@samsung.conm>
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+
+#define DUMMY_API __attribute__ ((visibility("default")))
+
--- /dev/null
+/*
+ * Emulator YaGL dummy library for EGL
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Jinhyung Jo <jinhyung.jo@samsung.conm>
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
+
+#include "EGL/egl.h"
+#include "dummy.h"
+
+/* EGL Functions */
+DUMMY_API EGLAPI EGLint EGLAPIENTRY eglGetError(void) { return 0; }
+DUMMY_API EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id) { return EGL_NO_DISPLAY; }
+DUMMY_API EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) { return EGL_FALSE; }
+DUMMY_API EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy) { return EGL_FALSE; }
+DUMMY_API EGLAPI const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name) { return 0; }
+DUMMY_API EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config) { return EGL_FALSE; }
+DUMMY_API EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config) { return EGL_FALSE; }
+DUMMY_API EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value) { return EGL_FALSE; }
+DUMMY_API EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list) { return EGL_NO_SURFACE; }
+DUMMY_API EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list) { return EGL_NO_SURFACE; }
+DUMMY_API EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list) { return EGL_NO_SURFACE; }
+DUMMY_API EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface) { return EGL_FALSE; }
+DUMMY_API EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value) { return EGL_FALSE; }
+DUMMY_API EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api) { return EGL_FALSE; }
+DUMMY_API EGLAPI EGLenum EGLAPIENTRY eglQueryAPI(void) { return 0; }
+DUMMY_API EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void) { return EGL_FALSE; }
+DUMMY_API EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void) { return EGL_FALSE; }
+DUMMY_API EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list) { return EGL_NO_SURFACE; }
+DUMMY_API EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value) { return EGL_FALSE; }
+DUMMY_API EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) { return EGL_FALSE; }
+DUMMY_API EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) { return EGL_FALSE; }
+DUMMY_API EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval) { return EGL_FALSE; }
+DUMMY_API EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list) { return EGL_NO_CONTEXT; }
+DUMMY_API EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx) { return EGL_FALSE; }
+DUMMY_API EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx) { return EGL_FALSE; }
+DUMMY_API EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void) { return EGL_NO_CONTEXT; }
+DUMMY_API EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw) { return EGL_NO_SURFACE; }
+DUMMY_API EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void) { return EGL_NO_DISPLAY; }
+DUMMY_API EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value) { return EGL_FALSE; }
+DUMMY_API EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL(void) { return EGL_FALSE; }
+DUMMY_API EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine) { return EGL_FALSE; }
+DUMMY_API EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) { return EGL_FALSE; }
+DUMMY_API EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target) { return EGL_FALSE; }
+DUMMY_API EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress(const char *procname) { return ((__eglMustCastToProperFunctionPointerType)0); }
--- /dev/null
+/*
+ * Emulator YaGL dummy library for GLESv1
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Jinhyung Jo <jinhyung.jo@samsung.conm>
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GLES/gl.h"
+#include "dummy.h"
+
+/* Available only in Common profile */
+DUMMY_API GL_API void GL_APIENTRY glAlphaFunc (GLenum func, GLclampf ref) { return; }
+DUMMY_API GL_API void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { return; }
+DUMMY_API GL_API void GL_APIENTRY glClearDepthf (GLclampf depth) { return; }
+DUMMY_API GL_API void GL_APIENTRY glClipPlanef (GLenum plane, const GLfloat *equation) { return; }
+DUMMY_API GL_API void GL_APIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { return; }
+DUMMY_API GL_API void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar) { return; }
+DUMMY_API GL_API void GL_APIENTRY glFogf (GLenum pname, GLfloat param) { return; }
+DUMMY_API GL_API void GL_APIENTRY glFogfv (GLenum pname, const GLfloat *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glFrustumf (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) { return; }
+DUMMY_API GL_API void GL_APIENTRY glGetClipPlanef (GLenum pname, GLfloat eqn[4]) { return; }
+DUMMY_API GL_API void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glGetLightfv (GLenum light, GLenum pname, GLfloat *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glGetTexEnvfv (GLenum env, GLenum pname, GLfloat *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glLightModelf (GLenum pname, GLfloat param) { return; }
+DUMMY_API GL_API void GL_APIENTRY glLightModelfv (GLenum pname, const GLfloat *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glLightf (GLenum light, GLenum pname, GLfloat param) { return; }
+DUMMY_API GL_API void GL_APIENTRY glLightfv (GLenum light, GLenum pname, const GLfloat *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glLineWidth (GLfloat width) { return; }
+DUMMY_API GL_API void GL_APIENTRY glLoadMatrixf (const GLfloat *m) { return; }
+DUMMY_API GL_API void GL_APIENTRY glMaterialf (GLenum face, GLenum pname, GLfloat param) { return; }
+DUMMY_API GL_API void GL_APIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glMultMatrixf (const GLfloat *m) { return; }
+DUMMY_API GL_API void GL_APIENTRY glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) { return; }
+DUMMY_API GL_API void GL_APIENTRY glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz) { return; }
+DUMMY_API GL_API void GL_APIENTRY glOrthof (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) { return; }
+DUMMY_API GL_API void GL_APIENTRY glPointParameterf (GLenum pname, GLfloat param) { return; }
+DUMMY_API GL_API void GL_APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glPointSize (GLfloat size) { return; }
+DUMMY_API GL_API void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units) { return; }
+DUMMY_API GL_API void GL_APIENTRY glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z) { return; }
+DUMMY_API GL_API void GL_APIENTRY glScalef (GLfloat x, GLfloat y, GLfloat z) { return; }
+DUMMY_API GL_API void GL_APIENTRY glTexEnvf (GLenum target, GLenum pname, GLfloat param) { return; }
+DUMMY_API GL_API void GL_APIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param) { return; }
+DUMMY_API GL_API void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z) { return; }
+
+/* Available in both Common and Common-Lite profiles */
+DUMMY_API GL_API void GL_APIENTRY glActiveTexture (GLenum texture) { return; }
+DUMMY_API GL_API void GL_APIENTRY glAlphaFuncx (GLenum func, GLclampx ref) { return; }
+DUMMY_API GL_API void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer) { return; }
+DUMMY_API GL_API void GL_APIENTRY glBindTexture (GLenum target, GLuint texture) { return; }
+DUMMY_API GL_API void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor) { return; }
+DUMMY_API GL_API void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage) { return; }
+DUMMY_API GL_API void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data) { return; }
+DUMMY_API GL_API void GL_APIENTRY glClear (GLbitfield mask) { return; }
+DUMMY_API GL_API void GL_APIENTRY glClearColorx (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) { return; }
+DUMMY_API GL_API void GL_APIENTRY glClearDepthx (GLclampx depth) { return; }
+DUMMY_API GL_API void GL_APIENTRY glClearStencil (GLint s) { return; }
+DUMMY_API GL_API void GL_APIENTRY glClientActiveTexture (GLenum texture) { return; }
+DUMMY_API GL_API void GL_APIENTRY glClipPlanex (GLenum plane, const GLfixed *equation) { return; }
+DUMMY_API GL_API void GL_APIENTRY glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) { return; }
+DUMMY_API GL_API void GL_APIENTRY glColor4x (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) { return; }
+DUMMY_API GL_API void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { return; }
+DUMMY_API GL_API void GL_APIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { return; }
+DUMMY_API GL_API void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) { return; }
+DUMMY_API 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) { return; }
+DUMMY_API GL_API void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { return; }
+DUMMY_API GL_API void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { return; }
+DUMMY_API GL_API void GL_APIENTRY glCullFace (GLenum mode) { return; }
+DUMMY_API GL_API void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers) { return; }
+DUMMY_API GL_API void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures) { return; }
+DUMMY_API GL_API void GL_APIENTRY glDepthFunc (GLenum func) { return; }
+DUMMY_API GL_API void GL_APIENTRY glDepthMask (GLboolean flag) { return; }
+DUMMY_API GL_API void GL_APIENTRY glDepthRangex (GLclampx zNear, GLclampx zFar) { return; }
+DUMMY_API GL_API void GL_APIENTRY glDisable (GLenum cap) { return; }
+DUMMY_API GL_API void GL_APIENTRY glDisableClientState (GLenum array) { return; }
+DUMMY_API GL_API void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count) { return; }
+DUMMY_API GL_API void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) { return; }
+DUMMY_API GL_API void GL_APIENTRY glEnable (GLenum cap) { return; }
+DUMMY_API GL_API void GL_APIENTRY glEnableClientState (GLenum array) { return; }
+DUMMY_API GL_API void GL_APIENTRY glFinish (void) { return; }
+DUMMY_API GL_API void GL_APIENTRY glFlush (void) { return; }
+DUMMY_API GL_API void GL_APIENTRY glFogx (GLenum pname, GLfixed param) { return; }
+DUMMY_API GL_API void GL_APIENTRY glFogxv (GLenum pname, const GLfixed *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glFrontFace (GLenum mode) { return; }
+DUMMY_API GL_API void GL_APIENTRY glFrustumx (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) { return; }
+DUMMY_API GL_API void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glGetClipPlanex (GLenum pname, GLfixed eqn[4]) { return; }
+DUMMY_API GL_API void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers) { return; }
+DUMMY_API GL_API void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures) { return; }
+DUMMY_API GL_API GLenum GL_APIENTRY glGetError (void) { return 0; }
+DUMMY_API GL_API void GL_APIENTRY glGetFixedv (GLenum pname, GLfixed *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glGetLightxv (GLenum light, GLenum pname, GLfixed *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glGetMaterialxv (GLenum face, GLenum pname, GLfixed *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glGetPointerv (GLenum pname, GLvoid **params) { return; }
+DUMMY_API GL_API const GLubyte * GL_APIENTRY glGetString (GLenum name) { return 0; }
+DUMMY_API GL_API void GL_APIENTRY glGetTexEnviv (GLenum env, GLenum pname, GLint *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glGetTexEnvxv (GLenum env, GLenum pname, GLfixed *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glGetTexParameterxv (GLenum target, GLenum pname, GLfixed *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glHint (GLenum target, GLenum mode) { return; }
+DUMMY_API GL_API GLboolean GL_APIENTRY glIsBuffer (GLuint buffer) { return GL_FALSE; }
+DUMMY_API GL_API GLboolean GL_APIENTRY glIsEnabled (GLenum cap) { return GL_FALSE; }
+DUMMY_API GL_API GLboolean GL_APIENTRY glIsTexture (GLuint texture) { return GL_FALSE; }
+DUMMY_API GL_API void GL_APIENTRY glLightModelx (GLenum pname, GLfixed param) { return; }
+DUMMY_API GL_API void GL_APIENTRY glLightModelxv (GLenum pname, const GLfixed *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glLightx (GLenum light, GLenum pname, GLfixed param) { return; }
+DUMMY_API GL_API void GL_APIENTRY glLightxv (GLenum light, GLenum pname, const GLfixed *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glLineWidthx (GLfixed width) { return; }
+DUMMY_API GL_API void GL_APIENTRY glLoadIdentity (void) { return; }
+DUMMY_API GL_API void GL_APIENTRY glLoadMatrixx (const GLfixed *m) { return; }
+DUMMY_API GL_API void GL_APIENTRY glLogicOp (GLenum opcode) { return; }
+DUMMY_API GL_API void GL_APIENTRY glMaterialx (GLenum face, GLenum pname, GLfixed param) { return; }
+DUMMY_API GL_API void GL_APIENTRY glMaterialxv (GLenum face, GLenum pname, const GLfixed *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glMatrixMode (GLenum mode) { return; }
+DUMMY_API GL_API void GL_APIENTRY glMultMatrixx (const GLfixed *m) { return; }
+DUMMY_API GL_API void GL_APIENTRY glMultiTexCoord4x (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) { return; }
+DUMMY_API GL_API void GL_APIENTRY glNormal3x (GLfixed nx, GLfixed ny, GLfixed nz) { return; }
+DUMMY_API GL_API void GL_APIENTRY glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer) { return; }
+DUMMY_API GL_API void GL_APIENTRY glOrthox (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) { return; }
+DUMMY_API GL_API void GL_APIENTRY glPixelStorei (GLenum pname, GLint param) { return; }
+DUMMY_API GL_API void GL_APIENTRY glPointParameterx (GLenum pname, GLfixed param) { return; }
+DUMMY_API GL_API void GL_APIENTRY glPointParameterxv (GLenum pname, const GLfixed *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glPointSizex (GLfixed size) { return; }
+DUMMY_API GL_API void GL_APIENTRY glPolygonOffsetx (GLfixed factor, GLfixed units) { return; }
+DUMMY_API GL_API void GL_APIENTRY glPopMatrix (void) { return; }
+DUMMY_API GL_API void GL_APIENTRY glPushMatrix (void) { return; }
+DUMMY_API GL_API void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels) { return; }
+DUMMY_API GL_API void GL_APIENTRY glRotatex (GLfixed angle, GLfixed x, GLfixed y, GLfixed z) { return; }
+DUMMY_API GL_API void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert) { return; }
+DUMMY_API GL_API void GL_APIENTRY glSampleCoveragex (GLclampx value, GLboolean invert) { return; }
+DUMMY_API GL_API void GL_APIENTRY glScalex (GLfixed x, GLfixed y, GLfixed z) { return; }
+DUMMY_API GL_API void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height) { return; }
+DUMMY_API GL_API void GL_APIENTRY glShadeModel (GLenum mode) { return; }
+DUMMY_API GL_API void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask) { return; }
+DUMMY_API GL_API void GL_APIENTRY glStencilMask (GLuint mask) { return; }
+DUMMY_API GL_API void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass) { return; }
+DUMMY_API GL_API void GL_APIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { return; }
+DUMMY_API GL_API void GL_APIENTRY glTexEnvi (GLenum target, GLenum pname, GLint param) { return; }
+DUMMY_API GL_API void GL_APIENTRY glTexEnvx (GLenum target, GLenum pname, GLfixed param) { return; }
+DUMMY_API GL_API void GL_APIENTRY glTexEnviv (GLenum target, GLenum pname, const GLint *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glTexEnvxv (GLenum target, GLenum pname, const GLfixed *params) { return; }
+DUMMY_API 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) { return; }
+DUMMY_API GL_API void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param) { return; }
+DUMMY_API GL_API void GL_APIENTRY glTexParameterx (GLenum target, GLenum pname, GLfixed param) { return; }
+DUMMY_API GL_API void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params) { return; }
+DUMMY_API GL_API void GL_APIENTRY glTexParameterxv (GLenum target, GLenum pname, const GLfixed *params) { return; }
+DUMMY_API 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) { return; }
+DUMMY_API GL_API void GL_APIENTRY glTranslatex (GLfixed x, GLfixed y, GLfixed z) { return; }
+DUMMY_API GL_API void GL_APIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { return; }
+DUMMY_API GL_API void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height) { return; }
+DUMMY_API GL_API void GL_APIENTRY glPointSizePointerOES (GLenum type, GLsizei stride, const GLvoid *pointer) { return; }
--- /dev/null
+/*
+ * Emulator YaGL dummy library for GLESv2
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Jinhyung Jo <jinhyung.jo@samsung.conm>
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "GLES2/gl2.h"
+#include "dummy.h"
+
+/* GL core functions */
+DUMMY_API GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar* name) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glBlendEquation ( GLenum mode ) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data) { return; }
+DUMMY_API GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target) { return 0; }
+DUMMY_API GL_APICALL void GL_APIENTRY glClear (GLbitfield mask) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glClearStencil (GLint s) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { return; }
+DUMMY_API GL_APICALL GLuint GL_APIENTRY glCreateProgram (void) { return 0; }
+DUMMY_API GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type) { return 0; }
+DUMMY_API GL_APICALL void GL_APIENTRY glCullFace (GLenum mode) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glDisable (GLenum cap) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glEnable (GLenum cap) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glFinish (void) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glFlush (void) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) { return; }
+DUMMY_API GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name) { return 0; }
+DUMMY_API GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params) { return; }
+DUMMY_API GL_APICALL GLenum GL_APIENTRY glGetError (void) { return 0; }
+DUMMY_API GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source) { return; }
+DUMMY_API GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name) { return (GLubyte*)0; }
+DUMMY_API GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params) { return; }
+DUMMY_API GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name) { return 0; }
+DUMMY_API GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode) { return; }
+DUMMY_API GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer) { return GL_FALSE; }
+DUMMY_API GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap) { return GL_FALSE; }
+DUMMY_API GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer) { return GL_FALSE; }
+DUMMY_API GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program) { return GL_FALSE; }
+DUMMY_API GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer) { return GL_FALSE; }
+DUMMY_API GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader) { return GL_FALSE; }
+DUMMY_API GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture) { return GL_FALSE; }
+DUMMY_API GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar*const* string, const GLint* length) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glUseProgram (GLuint program) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr) { return; }
+DUMMY_API GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height) { return; }
--- /dev/null
+set(SOURCES
+ yagl_gbm.c
+)
+
+set(LIBRARIES
+ ${CMAKE_THREAD_LIBS_INIT}
+ ${LIBDRM_LIBRARIES}
+ ${LIBDRM_VIGS_LIBRARIES}
+)
+
+if (PLATFORM_WAYLAND)
+ set(LIBRARIES ${LIBRARIES}
+ wayland-drm
+ )
+ add_definitions(-DYAGL_PLATFORM_WAYLAND)
+endif ()
+
+add_library(gbm-yagl SHARED ${SOURCES})
+set_target_properties(gbm-yagl PROPERTIES VERSION 1.0.0 SOVERSION 1)
+set_target_properties(gbm-yagl PROPERTIES OUTPUT_NAME gbm)
+
+target_link_libraries(gbm-yagl ${LIBRARIES})
+
+install(
+ TARGETS gbm-yagl
+ LIBRARY DESTINATION ${INSTALL_LIB_DIR}
+)
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_export.h"
+#include "yagl_gbm.h"
+#include "vigs.h"
+#ifdef YAGL_PLATFORM_WAYLAND
+#include "wayland-drm.h"
+#endif
+#include <gbm.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+struct yagl_gbm_bo
+{
+ struct gbm_bo base;
+
+ uint32_t format;
+ union gbm_bo_handle handle;
+
+ void *user_data;
+
+ void (*destroy_user_data)(struct gbm_bo */*bo*/,
+ void */*user_data*/);
+};
+
+struct yagl_gbm_surface
+{
+ struct gbm_surface base;
+
+ struct
+ {
+ struct gbm_bo *bo;
+ int locked;
+ int age;
+ } color_buffers[3], *back, *front;
+};
+
+static void* gbm_malloc0(size_t size)
+{
+ void *tmp = malloc(size);
+ if (!tmp) {
+ fprintf(stderr,
+ "GBM: Critical error! Unable to allocate %u bytes!\n",
+ (unsigned int)size);
+ exit(1);
+ return 0;
+ }
+ memset(tmp, 0, size);
+ return tmp;
+}
+
+static void gbm_free(void *ptr)
+{
+ free(ptr);
+}
+
+static int yagl_gbm_surface_ensure_back(struct yagl_gbm_surface *yagl_sfc)
+{
+ int i;
+
+ if (!yagl_sfc->back) {
+ for (i = 0;
+ i < sizeof(yagl_sfc->color_buffers)/sizeof(yagl_sfc->color_buffers[0]);
+ ++i) {
+ if (!yagl_sfc->color_buffers[i].locked) {
+ yagl_sfc->back = &yagl_sfc->color_buffers[i];
+ break;
+ }
+ }
+ }
+
+ if (!yagl_sfc->back) {
+ return 0;
+ }
+
+ if (!yagl_sfc->back->bo) {
+ yagl_sfc->back->bo = gbm_bo_create(yagl_sfc->base.gbm, yagl_sfc->base.width,
+ yagl_sfc->base.height, yagl_sfc->base.format,
+ yagl_sfc->base.flags);
+ }
+
+ if (!yagl_sfc->back->bo) {
+ yagl_sfc->back = NULL;
+ return 0;
+ }
+
+ return 1;
+}
+
+static struct vigs_drm_surface
+ *yagl_gbm_surface_acquire_back(struct gbm_surface *sfc)
+{
+ struct yagl_gbm_surface *yagl_sfc = (struct yagl_gbm_surface*)sfc;
+
+ if (!yagl_gbm_surface_ensure_back(yagl_sfc)) {
+ return NULL;
+ }
+
+ vigs_drm_gem_ref(&yagl_sfc->back->bo->drm_sfc->gem);
+
+ return yagl_sfc->back->bo->drm_sfc;
+}
+
+static void yagl_gbm_surface_swap_buffers(struct gbm_surface *sfc)
+{
+ struct yagl_gbm_surface *yagl_sfc = (struct yagl_gbm_surface*)sfc;
+ int i;
+
+ for (i = 0;
+ i < sizeof(yagl_sfc->color_buffers)/sizeof(yagl_sfc->color_buffers[0]);
+ ++i) {
+ if (yagl_sfc->color_buffers[i].age > 0) {
+ ++yagl_sfc->color_buffers[i].age;
+ }
+ }
+
+ yagl_sfc->front = yagl_sfc->back;
+ yagl_sfc->front->age = 1;
+ yagl_sfc->back = NULL;
+}
+
+static int yagl_gbm_surface_get_buffer_age(struct gbm_surface *sfc)
+{
+ struct yagl_gbm_surface *yagl_sfc = (struct yagl_gbm_surface*)sfc;
+
+ if (!yagl_gbm_surface_ensure_back(yagl_sfc)) {
+ return 0;
+ }
+
+ return yagl_sfc->back->age;
+}
+
+YAGL_API int gbm_device_get_fd(struct gbm_device *gbm)
+{
+ return gbm->drm_dev->fd;
+}
+
+YAGL_API const char *gbm_device_get_backend_name(struct gbm_device *gbm)
+{
+ return "gbm_yagl.so";
+}
+
+YAGL_API int gbm_device_is_format_supported(struct gbm_device *gbm,
+ uint32_t format,
+ uint32_t usage)
+{
+ switch (format) {
+ case GBM_BO_FORMAT_XRGB8888:
+ case GBM_FORMAT_XRGB8888:
+ case GBM_BO_FORMAT_ARGB8888:
+ case GBM_FORMAT_ARGB8888:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+YAGL_API void gbm_device_destroy(struct gbm_device *gbm)
+{
+ vigs_drm_device_destroy(gbm->drm_dev);
+ gbm_free(gbm);
+}
+
+YAGL_API struct gbm_device *gbm_create_device(int fd)
+{
+ struct vigs_drm_device *drm_dev;
+ struct gbm_device *gbm;
+ int ret;
+
+ ret = vigs_drm_device_create(fd, &drm_dev);
+
+ if (ret != 0) {
+ fprintf(stderr,
+ "GBM: Critical error! vigs_drm_device_create failed: %s\n",
+ strerror(-ret));
+ return NULL;
+ }
+
+ gbm = gbm_malloc0(sizeof(*gbm));
+
+ gbm->dummy = &gbm_create_device;
+ gbm->drm_dev = drm_dev;
+
+ return gbm;
+}
+
+YAGL_API struct gbm_bo *gbm_bo_create(struct gbm_device *gbm,
+ uint32_t width, uint32_t height,
+ uint32_t format, uint32_t flags)
+{
+ vigs_drm_surface_format sfc_format;
+ uint32_t depth;
+ struct yagl_gbm_bo *bo;
+ struct vigs_drm_surface *sfc;
+ int ret;
+
+ if ((flags & GBM_BO_USE_CURSOR_64X64) != 0) {
+ return NULL;
+ }
+
+ switch (format) {
+ case GBM_BO_FORMAT_XRGB8888:
+ case GBM_FORMAT_XRGB8888:
+ sfc_format = vigs_drm_surface_bgrx8888;
+ depth = 24;
+ break;
+ case GBM_BO_FORMAT_ARGB8888:
+ case GBM_FORMAT_ARGB8888:
+ sfc_format = vigs_drm_surface_bgra8888;
+ depth = 32;
+ break;
+ default:
+ fprintf(stderr, "GBM: Bad format = %u\n", format);
+ return NULL;
+ }
+
+ ret = vigs_drm_surface_create(gbm->drm_dev,
+ width,
+ height,
+ (width * 4),
+ sfc_format,
+ 0,
+ &sfc);
+
+ if (ret != 0) {
+ fprintf(stderr,
+ "GBM: Unable to create DRM surface(%ux%u, fmt = %u): %s\n",
+ width, height, sfc_format,
+ strerror(-ret));
+ return NULL;
+ }
+
+ bo = gbm_malloc0(sizeof(*bo));
+
+ bo->base.gbm = gbm;
+ bo->base.drm_sfc = sfc;
+ bo->base.depth = depth;
+
+ bo->format = format;
+ bo->handle.u32 = sfc->gem.handle;
+
+ return &bo->base;
+}
+
+YAGL_API struct gbm_bo *gbm_bo_import(struct gbm_device *gbm, uint32_t type,
+ void *buffer, uint32_t usage)
+{
+#ifdef YAGL_PLATFORM_WAYLAND
+ struct wl_drm_buffer *drm_buffer;
+#endif
+ struct vigs_drm_surface *drm_sfc;
+ struct yagl_gbm_bo *bo;
+
+ switch (type) {
+#ifdef YAGL_PLATFORM_WAYLAND
+ case GBM_BO_IMPORT_WL_BUFFER:
+ drm_buffer = wayland_drm_get_buffer((struct wl_resource*)buffer);
+
+ if (!drm_buffer) {
+ return NULL;
+ }
+
+ drm_sfc = wayland_drm_buffer_get_sfc(drm_buffer);
+
+ vigs_drm_gem_ref(&drm_sfc->gem);
+
+ break;
+#endif
+ default:
+ fprintf(stderr, "GBM: bo_import bad type = %u\n", type);
+ return NULL;
+ }
+
+ bo = gbm_malloc0(sizeof(*bo));
+
+ bo->base.gbm = gbm;
+ bo->base.drm_sfc = drm_sfc;
+
+ bo->handle.u32 = drm_sfc->gem.handle;
+
+ switch (drm_sfc->format) {
+ case vigs_drm_surface_bgrx8888:
+ bo->format = GBM_FORMAT_XRGB8888;
+ bo->base.depth = 24;
+ break;
+ case vigs_drm_surface_bgra8888:
+ bo->format = GBM_FORMAT_ARGB8888;
+ bo->base.depth = 32;
+ break;
+ default:
+ fprintf(stderr, "GBM: bo_import, bad format = %u\n", drm_sfc->format);
+ return NULL;
+ }
+
+ return &bo->base;
+}
+
+YAGL_API uint32_t gbm_bo_get_width(struct gbm_bo *bo)
+{
+ return bo->drm_sfc->width;
+}
+
+YAGL_API uint32_t gbm_bo_get_height(struct gbm_bo *bo)
+{
+ return bo->drm_sfc->height;
+}
+
+YAGL_API uint32_t gbm_bo_get_stride(struct gbm_bo *bo)
+{
+ return bo->drm_sfc->stride;
+}
+
+YAGL_API uint32_t gbm_bo_get_format(struct gbm_bo *bo)
+{
+ struct yagl_gbm_bo *yagl_bo = (struct yagl_gbm_bo*)bo;
+ return yagl_bo->format;
+}
+
+YAGL_API struct gbm_device *gbm_bo_get_device(struct gbm_bo *bo)
+{
+ return bo->gbm;
+}
+
+YAGL_API union gbm_bo_handle gbm_bo_get_handle(struct gbm_bo *bo)
+{
+ struct yagl_gbm_bo *yagl_bo = (struct yagl_gbm_bo*)bo;
+ return yagl_bo->handle;
+}
+
+YAGL_API int gbm_bo_write(struct gbm_bo *bo, const void *buf, size_t count)
+{
+ int ret = vigs_drm_gem_map(&bo->drm_sfc->gem, 1);
+
+ if (ret != 0) {
+ fprintf(stderr,
+ "GBM: Unable to map DRM surface(id = %u): %s\n",
+ bo->drm_sfc->id,
+ strerror(-ret));
+ return -1;
+ }
+
+ ret = vigs_drm_surface_start_access(bo->drm_sfc, VIGS_DRM_SAF_WRITE);
+
+ if (ret != 0) {
+ fprintf(stderr,
+ "GBM: Unable to start DRM surface access(id = %u): %s\n",
+ bo->drm_sfc->id,
+ strerror(-ret));
+ return -1;
+ }
+
+ memcpy(bo->drm_sfc->gem.vaddr, buf, count);
+
+ ret = vigs_drm_surface_end_access(bo->drm_sfc, 1);
+
+ if (ret != 0) {
+ fprintf(stderr,
+ "GBM: Unable to end DRM surface access(id = %u): %s\n",
+ bo->drm_sfc->id,
+ strerror(-ret));
+ return -1;
+ }
+
+ return 0;
+}
+
+YAGL_API void gbm_bo_set_user_data(struct gbm_bo *bo,
+ void *data,
+ void (*destroy_user_data)(struct gbm_bo*, void*))
+{
+ struct yagl_gbm_bo *yagl_bo = (struct yagl_gbm_bo*)bo;
+
+ yagl_bo->user_data = data;
+ yagl_bo->destroy_user_data = destroy_user_data;
+}
+
+YAGL_API void *gbm_bo_get_user_data(struct gbm_bo *bo)
+{
+ struct yagl_gbm_bo *yagl_bo = (struct yagl_gbm_bo*)bo;
+ return yagl_bo->user_data;
+}
+
+YAGL_API void gbm_bo_destroy(struct gbm_bo *bo)
+{
+ struct yagl_gbm_bo *yagl_bo = (struct yagl_gbm_bo*)bo;
+
+ if (yagl_bo->destroy_user_data) {
+ yagl_bo->destroy_user_data(bo, yagl_bo->user_data);
+ }
+
+ vigs_drm_gem_unref(&bo->drm_sfc->gem);
+
+ gbm_free(yagl_bo);
+}
+
+YAGL_API struct gbm_surface *gbm_surface_create(struct gbm_device *gbm,
+ uint32_t width, uint32_t height,
+ uint32_t format, uint32_t flags)
+{
+ uint32_t depth;
+ struct yagl_gbm_surface *sfc;
+
+ switch (format) {
+ case GBM_BO_FORMAT_XRGB8888:
+ case GBM_FORMAT_XRGB8888:
+ depth = 24;
+ break;
+ case GBM_BO_FORMAT_ARGB8888:
+ case GBM_FORMAT_ARGB8888:
+ depth = 32;
+ break;
+ default:
+ fprintf(stderr, "GBM: Bad format = %u\n", format);
+ return NULL;
+ }
+
+ sfc = gbm_malloc0(sizeof(*sfc));
+
+ sfc->base.gbm = gbm;
+ sfc->base.width = width;
+ sfc->base.depth = depth;
+ sfc->base.height = height;
+ sfc->base.format = format;
+ sfc->base.flags = flags;
+
+ sfc->base.acquire_back = &yagl_gbm_surface_acquire_back;
+ sfc->base.swap_buffers = &yagl_gbm_surface_swap_buffers;
+ sfc->base.get_buffer_age = &yagl_gbm_surface_get_buffer_age;
+
+ return &sfc->base;
+}
+
+YAGL_API struct gbm_bo *gbm_surface_lock_front_buffer(struct gbm_surface *surface)
+{
+ struct yagl_gbm_surface *yagl_sfc = (struct yagl_gbm_surface*)surface;
+ struct gbm_bo *bo;
+
+ if (!yagl_sfc->front) {
+ return NULL;
+ }
+
+ bo = yagl_sfc->front->bo;
+
+ yagl_sfc->front->locked = 1;
+ yagl_sfc->front = NULL;
+
+ return bo;
+}
+
+YAGL_API void gbm_surface_release_buffer(struct gbm_surface *surface,
+ struct gbm_bo *bo)
+{
+ struct yagl_gbm_surface *yagl_sfc = (struct yagl_gbm_surface*)surface;
+ int i;
+
+ for (i = 0;
+ i < sizeof(yagl_sfc->color_buffers)/sizeof(yagl_sfc->color_buffers[0]);
+ ++i) {
+ if (yagl_sfc->color_buffers[i].bo == bo) {
+ yagl_sfc->color_buffers[i].locked = 0;
+ }
+ }
+}
+
+YAGL_API int gbm_surface_has_free_buffers(struct gbm_surface *surface)
+{
+ struct yagl_gbm_surface *yagl_sfc = (struct yagl_gbm_surface*)surface;
+ int i;
+
+ for (i = 0;
+ i < sizeof(yagl_sfc->color_buffers)/sizeof(yagl_sfc->color_buffers[0]);
+ ++i) {
+ if (!yagl_sfc->color_buffers[i].locked) {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+YAGL_API void gbm_surface_destroy(struct gbm_surface *surface)
+{
+ struct yagl_gbm_surface *yagl_sfc = (struct yagl_gbm_surface*)surface;
+ int i;
+
+ for (i = 0;
+ i < sizeof(yagl_sfc->color_buffers)/sizeof(yagl_sfc->color_buffers[0]);
+ ++i) {
+ if (yagl_sfc->color_buffers[i].bo) {
+ gbm_bo_destroy(yagl_sfc->color_buffers[i].bo);
+ }
+ }
+
+ gbm_free(yagl_sfc);
+}
--- /dev/null
+/* -*- mode: c; tab-width: 8; -*- */
+/* vi: set sw=4 ts=8: */
+/* Reference version of egl.h for EGL 1.4.
+ * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $
+ */
+
+/*
+** Copyright (c) 2007-2009 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+#ifndef __egl_h_
+#define __egl_h_
+
+/* All platform-dependent types and macro boilerplate (such as EGLAPI
+ * and EGLAPIENTRY) should go in eglplatform.h.
+ */
+#include <EGL/eglplatform.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* EGL Types */
+/* EGLint is defined in eglplatform.h */
+typedef unsigned int EGLBoolean;
+typedef unsigned int EGLenum;
+typedef void *EGLConfig;
+typedef void *EGLContext;
+typedef void *EGLDisplay;
+typedef void *EGLSurface;
+typedef void *EGLClientBuffer;
+
+/* EGL Versioning */
+#define EGL_VERSION_1_0 1
+#define EGL_VERSION_1_1 1
+#define EGL_VERSION_1_2 1
+#define EGL_VERSION_1_3 1
+#define EGL_VERSION_1_4 1
+
+/* EGL Enumerants. Bitmasks and other exceptional cases aside, most
+ * enums are assigned unique values starting at 0x3000.
+ */
+
+/* EGL aliases */
+#define EGL_FALSE 0
+#define EGL_TRUE 1
+
+/* Out-of-band handle values */
+#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0)
+#define EGL_NO_CONTEXT ((EGLContext)0)
+#define EGL_NO_DISPLAY ((EGLDisplay)0)
+#define EGL_NO_SURFACE ((EGLSurface)0)
+
+/* Out-of-band attribute value */
+#define EGL_DONT_CARE ((EGLint)-1)
+
+/* Errors / GetError return values */
+#define EGL_SUCCESS 0x3000
+#define EGL_NOT_INITIALIZED 0x3001
+#define EGL_BAD_ACCESS 0x3002
+#define EGL_BAD_ALLOC 0x3003
+#define EGL_BAD_ATTRIBUTE 0x3004
+#define EGL_BAD_CONFIG 0x3005
+#define EGL_BAD_CONTEXT 0x3006
+#define EGL_BAD_CURRENT_SURFACE 0x3007
+#define EGL_BAD_DISPLAY 0x3008
+#define EGL_BAD_MATCH 0x3009
+#define EGL_BAD_NATIVE_PIXMAP 0x300A
+#define EGL_BAD_NATIVE_WINDOW 0x300B
+#define EGL_BAD_PARAMETER 0x300C
+#define EGL_BAD_SURFACE 0x300D
+#define EGL_CONTEXT_LOST 0x300E /* EGL 1.1 - IMG_power_management */
+
+/* Reserved 0x300F-0x301F for additional errors */
+
+/* Config attributes */
+#define EGL_BUFFER_SIZE 0x3020
+#define EGL_ALPHA_SIZE 0x3021
+#define EGL_BLUE_SIZE 0x3022
+#define EGL_GREEN_SIZE 0x3023
+#define EGL_RED_SIZE 0x3024
+#define EGL_DEPTH_SIZE 0x3025
+#define EGL_STENCIL_SIZE 0x3026
+#define EGL_CONFIG_CAVEAT 0x3027
+#define EGL_CONFIG_ID 0x3028
+#define EGL_LEVEL 0x3029
+#define EGL_MAX_PBUFFER_HEIGHT 0x302A
+#define EGL_MAX_PBUFFER_PIXELS 0x302B
+#define EGL_MAX_PBUFFER_WIDTH 0x302C
+#define EGL_NATIVE_RENDERABLE 0x302D
+#define EGL_NATIVE_VISUAL_ID 0x302E
+#define EGL_NATIVE_VISUAL_TYPE 0x302F
+#define EGL_SAMPLES 0x3031
+#define EGL_SAMPLE_BUFFERS 0x3032
+#define EGL_SURFACE_TYPE 0x3033
+#define EGL_TRANSPARENT_TYPE 0x3034
+#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
+#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
+#define EGL_TRANSPARENT_RED_VALUE 0x3037
+#define EGL_NONE 0x3038 /* Attrib list terminator */
+#define EGL_BIND_TO_TEXTURE_RGB 0x3039
+#define EGL_BIND_TO_TEXTURE_RGBA 0x303A
+#define EGL_MIN_SWAP_INTERVAL 0x303B
+#define EGL_MAX_SWAP_INTERVAL 0x303C
+#define EGL_LUMINANCE_SIZE 0x303D
+#define EGL_ALPHA_MASK_SIZE 0x303E
+#define EGL_COLOR_BUFFER_TYPE 0x303F
+#define EGL_RENDERABLE_TYPE 0x3040
+#define EGL_MATCH_NATIVE_PIXMAP 0x3041 /* Pseudo-attribute (not queryable) */
+#define EGL_CONFORMANT 0x3042
+
+/* Reserved 0x3041-0x304F for additional config attributes */
+
+/* Config attribute values */
+#define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */
+#define EGL_NON_CONFORMANT_CONFIG 0x3051 /* EGL_CONFIG_CAVEAT value */
+#define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */
+#define EGL_RGB_BUFFER 0x308E /* EGL_COLOR_BUFFER_TYPE value */
+#define EGL_LUMINANCE_BUFFER 0x308F /* EGL_COLOR_BUFFER_TYPE value */
+
+/* More config attribute values, for EGL_TEXTURE_FORMAT */
+#define EGL_NO_TEXTURE 0x305C
+#define EGL_TEXTURE_RGB 0x305D
+#define EGL_TEXTURE_RGBA 0x305E
+#define EGL_TEXTURE_2D 0x305F
+
+/* Config attribute mask bits */
+#define EGL_PBUFFER_BIT 0x0001 /* EGL_SURFACE_TYPE mask bits */
+#define EGL_PIXMAP_BIT 0x0002 /* EGL_SURFACE_TYPE mask bits */
+#define EGL_WINDOW_BIT 0x0004 /* EGL_SURFACE_TYPE mask bits */
+#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 /* EGL_SURFACE_TYPE mask bits */
+#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 /* EGL_SURFACE_TYPE mask bits */
+#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 /* EGL_SURFACE_TYPE mask bits */
+#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 /* EGL_SURFACE_TYPE mask bits */
+
+#define EGL_OPENGL_ES_BIT 0x0001 /* EGL_RENDERABLE_TYPE mask bits */
+#define EGL_OPENVG_BIT 0x0002 /* EGL_RENDERABLE_TYPE mask bits */
+#define EGL_OPENGL_ES2_BIT 0x0004 /* EGL_RENDERABLE_TYPE mask bits */
+#define EGL_OPENGL_BIT 0x0008 /* EGL_RENDERABLE_TYPE mask bits */
+
+/* QueryString targets */
+#define EGL_VENDOR 0x3053
+#define EGL_VERSION 0x3054
+#define EGL_EXTENSIONS 0x3055
+#define EGL_CLIENT_APIS 0x308D
+
+/* QuerySurface / SurfaceAttrib / CreatePbufferSurface targets */
+#define EGL_HEIGHT 0x3056
+#define EGL_WIDTH 0x3057
+#define EGL_LARGEST_PBUFFER 0x3058
+#define EGL_TEXTURE_FORMAT 0x3080
+#define EGL_TEXTURE_TARGET 0x3081
+#define EGL_MIPMAP_TEXTURE 0x3082
+#define EGL_MIPMAP_LEVEL 0x3083
+#define EGL_RENDER_BUFFER 0x3086
+#define EGL_VG_COLORSPACE 0x3087
+#define EGL_VG_ALPHA_FORMAT 0x3088
+#define EGL_HORIZONTAL_RESOLUTION 0x3090
+#define EGL_VERTICAL_RESOLUTION 0x3091
+#define EGL_PIXEL_ASPECT_RATIO 0x3092
+#define EGL_SWAP_BEHAVIOR 0x3093
+#define EGL_MULTISAMPLE_RESOLVE 0x3099
+
+/* EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets */
+#define EGL_BACK_BUFFER 0x3084
+#define EGL_SINGLE_BUFFER 0x3085
+
+/* OpenVG color spaces */
+#define EGL_VG_COLORSPACE_sRGB 0x3089 /* EGL_VG_COLORSPACE value */
+#define EGL_VG_COLORSPACE_LINEAR 0x308A /* EGL_VG_COLORSPACE value */
+
+/* OpenVG alpha formats */
+#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B /* EGL_ALPHA_FORMAT value */
+#define EGL_VG_ALPHA_FORMAT_PRE 0x308C /* EGL_ALPHA_FORMAT value */
+
+/* Constant scale factor by which fractional display resolutions &
+ * aspect ratio are scaled when queried as integer values.
+ */
+#define EGL_DISPLAY_SCALING 10000
+
+/* Unknown display resolution/aspect ratio */
+#define EGL_UNKNOWN ((EGLint)-1)
+
+/* Back buffer swap behaviors */
+#define EGL_BUFFER_PRESERVED 0x3094 /* EGL_SWAP_BEHAVIOR value */
+#define EGL_BUFFER_DESTROYED 0x3095 /* EGL_SWAP_BEHAVIOR value */
+
+/* CreatePbufferFromClientBuffer buffer types */
+#define EGL_OPENVG_IMAGE 0x3096
+
+/* QueryContext targets */
+#define EGL_CONTEXT_CLIENT_TYPE 0x3097
+
+/* CreateContext attributes */
+#define EGL_CONTEXT_CLIENT_VERSION 0x3098
+
+/* Multisample resolution behaviors */
+#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A /* EGL_MULTISAMPLE_RESOLVE value */
+#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B /* EGL_MULTISAMPLE_RESOLVE value */
+
+/* BindAPI/QueryAPI targets */
+#define EGL_OPENGL_ES_API 0x30A0
+#define EGL_OPENVG_API 0x30A1
+#define EGL_OPENGL_API 0x30A2
+
+/* GetCurrentSurface targets */
+#define EGL_DRAW 0x3059
+#define EGL_READ 0x305A
+
+/* WaitNative engines */
+#define EGL_CORE_NATIVE_ENGINE 0x305B
+
+/* EGL 1.2 tokens renamed for consistency in EGL 1.3 */
+#define EGL_COLORSPACE EGL_VG_COLORSPACE
+#define EGL_ALPHA_FORMAT EGL_VG_ALPHA_FORMAT
+#define EGL_COLORSPACE_sRGB EGL_VG_COLORSPACE_sRGB
+#define EGL_COLORSPACE_LINEAR EGL_VG_COLORSPACE_LINEAR
+#define EGL_ALPHA_FORMAT_NONPRE EGL_VG_ALPHA_FORMAT_NONPRE
+#define EGL_ALPHA_FORMAT_PRE EGL_VG_ALPHA_FORMAT_PRE
+
+/* EGL extensions must request enum blocks from the Khronos
+ * API Registrar, who maintains the enumerant registry. Submit
+ * a bug in Khronos Bugzilla against task "Registry".
+ */
+
+
+
+/* EGL Functions */
+
+EGLAPI EGLint EGLAPIENTRY eglGetError(void);
+
+EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id);
+EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor);
+EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy);
+
+EGLAPI const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name);
+
+EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs,
+ EGLint config_size, EGLint *num_config);
+EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list,
+ EGLConfig *configs, EGLint config_size,
+ EGLint *num_config);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config,
+ EGLint attribute, EGLint *value);
+
+EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
+ EGLNativeWindowType win,
+ const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config,
+ const EGLint *attrib_list);
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
+ EGLNativePixmapType pixmap,
+ const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface);
+EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface,
+ EGLint attribute, EGLint *value);
+
+EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api);
+EGLAPI EGLenum EGLAPIENTRY eglQueryAPI(void);
+
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void);
+
+EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void);
+
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(
+ EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
+ EGLConfig config, const EGLint *attrib_list);
+
+EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface,
+ EGLint attribute, EGLint value);
+EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
+
+
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval);
+
+
+EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config,
+ EGLContext share_context,
+ const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx);
+EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw,
+ EGLSurface read, EGLContext ctx);
+
+EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void);
+EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw);
+EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx,
+ EGLint attribute, EGLint *value);
+
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL(void);
+EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine);
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface);
+EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface,
+ EGLNativePixmapType target);
+
+/* This is a generic function pointer type, whose name indicates it must
+ * be cast to the proper type *and calling convention* before use.
+ */
+typedef void (*__eglMustCastToProperFunctionPointerType)(void);
+
+/* Now, define eglGetProcAddress using the generic function ptr. type */
+EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY
+ eglGetProcAddress(const char *procname);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __egl_h_ */
--- /dev/null
+#ifndef __eglext_h_
+#define __eglext_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 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.
+*/
+/*
+** 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: 23535 $ on $Date: 2013-10-16 10:29:40 -0700 (Wed, 16 Oct 2013) $
+*/
+
+#include <EGL/eglplatform.h>
+
+#define EGL_EGLEXT_VERSION 20131016
+
+/* 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_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_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 display, EGLSurface surface, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface);
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay display, EGLSurface surface);
+#endif
+#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_reusable_sync
+#define EGL_KHR_reusable_sync 1
+typedef void *EGLSyncKHR;
+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_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_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_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_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_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_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_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 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null
+/**************************************************************************
+ *
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * 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, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef __eglmesaext_h_
+#define __eglmesaext_h_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <EGL/eglplatform.h>
+
+/* EGL_MESA_screen extension >>> PRELIMINARY <<< */
+#ifndef EGL_MESA_screen_surface
+#define EGL_MESA_screen_surface 1
+
+#define EGL_BAD_SCREEN_MESA 0x4000
+#define EGL_BAD_MODE_MESA 0x4001
+#define EGL_SCREEN_COUNT_MESA 0x4002
+#define EGL_SCREEN_POSITION_MESA 0x4003
+#define EGL_SCREEN_POSITION_GRANULARITY_MESA 0x4004
+#define EGL_MODE_ID_MESA 0x4005
+#define EGL_REFRESH_RATE_MESA 0x4006
+#define EGL_OPTIMAL_MESA 0x4007
+#define EGL_INTERLACED_MESA 0x4008
+#define EGL_SCREEN_BIT_MESA 0x08
+
+typedef khronos_uint32_t EGLScreenMESA;
+typedef khronos_uint32_t EGLModeMESA;
+
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
+EGLAPI EGLSurface EGLAPIENTRY eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglShowScreenSurfaceMESA(EGLDisplay dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode);
+EGLAPI EGLBoolean EGLAPIENTRY eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryScreenMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode);
+EGLAPI const char * EGLAPIENTRY eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLCHOOSEMODEMESA) (EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETMODESMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGetModeATTRIBMESA) (EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSCRREENSMESA) (EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESCREENSURFACEMESA) (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSHOWSCREENSURFACEMESA) (EGLDisplay dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSCREENPOSIITONMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSCREENMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSCREENSURFACEMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSCREENMODEMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode);
+typedef const char * (EGLAPIENTRYP PFNEGLQUERYMODESTRINGMESA) (EGLDisplay dpy, EGLModeMESA mode);
+
+#endif /* EGL_MESA_screen_surface */
+
+#ifndef EGL_MESA_copy_context
+#define EGL_MESA_copy_context 1
+
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglCopyContextMESA(EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOPYCONTEXTMESA) (EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask);
+
+#endif /* EGL_MESA_copy_context */
+
+#ifndef EGL_MESA_drm_display
+#define EGL_MESA_drm_display 1
+
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLDisplay EGLAPIENTRY eglGetDRMDisplayMESA(int fd);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+
+typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETDRMDISPLAYMESA) (int fd);
+
+#endif /* EGL_MESA_drm_display */
+
+#ifdef EGL_MESA_drm_image
+/* Mesa's extension to EGL_MESA_drm_image... */
+#ifndef EGL_DRM_BUFFER_USE_CURSOR_MESA
+#define EGL_DRM_BUFFER_USE_CURSOR_MESA 0x0004
+#endif
+#endif
+
+#ifndef EGL_WL_bind_wayland_display
+#define EGL_WL_bind_wayland_display 1
+
+#define EGL_WAYLAND_BUFFER_WL 0x31D5 /* eglCreateImageKHR target */
+#define EGL_WAYLAND_PLANE_WL 0x31D6 /* eglCreateImageKHR target */
+
+#define EGL_WAYLAND_Y_INVERTED_WL 0x31DB /* eglQueryWaylandBufferWL attribute */
+
+#define EGL_TEXTURE_Y_U_V_WL 0x31D7
+#define EGL_TEXTURE_Y_UV_WL 0x31D8
+#define EGL_TEXTURE_Y_XUXV_WL 0x31D9
+
+struct wl_display;
+struct wl_resource;
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglBindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display);
+EGLAPI EGLBoolean EGLAPIENTRY eglUnbindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display);
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryWaylandBufferWL(EGLDisplay dpy, struct wl_resource *buffer, EGLint attribute, EGLint *value);
+#endif
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLBINDWAYLANDDISPLAYWL) (EGLDisplay dpy, struct wl_display *display);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNBINDWAYLANDDISPLAYWL) (EGLDisplay dpy, struct wl_display *display);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYWAYLANDBUFFERWL) (EGLDisplay dpy, struct wl_resource *buffer, EGLint attribute, EGLint *value);
+
+#endif
+
+#ifndef EGL_NOK_swap_region
+#define EGL_NOK_swap_region 1
+
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegionNOK(EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint* rects);
+#endif
+
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOK) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint* rects);
+#endif
+
+#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_ANDROID_image_native_buffer
+#define EGL_ANDROID_image_native_buffer 1
+#define EGL_NATIVE_BUFFER_ANDROID 0x3140 /* eglCreateImageKHR target */
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null
+#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;
+
+#elif defined(__unix__)
+
+#ifdef MESA_EGL_NO_X11_HEADERS
+
+typedef void *EGLNativeDisplayType;
+typedef khronos_uintptr_t EGLNativePixmapType;
+typedef khronos_uintptr_t EGLNativeWindowType;
+
+#else
+
+/* X11 (tentative) */
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+
+typedef Display *EGLNativeDisplayType;
+typedef Pixmap EGLNativePixmapType;
+typedef Window EGLNativeWindowType;
+
+#endif /* MESA_EGL_NO_X11_HEADERS */
+
+#else
+#error "Platform not recognized"
+#endif
+
+/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
+typedef EGLNativeDisplayType NativeDisplayType;
+typedef EGLNativePixmapType NativePixmapType;
+typedef EGLNativeWindowType NativeWindowType;
+
+
+/* Define EGLint. This must be a signed integral type large enough to contain
+ * all legal attribute names and values passed into and out of EGL, whether
+ * their type is boolean, bitmask, enumerant (symbolic constant), integer,
+ * handle, or other. While in general a 32-bit integer will suffice, if
+ * handles are 64 bit types, then EGLint should be defined as a signed 64-bit
+ * integer type.
+ */
+typedef khronos_int32_t EGLint;
+
+#endif /* __eglplatform_h */
--- /dev/null
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.6
+ *
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
+ * Copyright (C) 2009 VMware, 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 and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef __gl_h_
+#define __gl_h_
+
+#if defined(USE_MGL_NAMESPACE)
+#include "gl_mangle.h"
+#endif
+
+
+/**********************************************************************
+ * Begin system-specific stuff. Do not do any of this when building
+ * for SciTech SNAP, as this is all done before this header file is
+ * included.
+ */
+#if !defined(__SCITECH_SNAP__)
+
+#if defined(__BEOS__)
+#include <stdlib.h> /* to get some BeOS-isms */
+#endif
+
+#if !defined(OPENSTEP) && (defined(NeXT) || defined(NeXT_PDO))
+#define OPENSTEP
+#endif
+
+#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__)
+#define __WIN32__
+#endif
+
+#if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__))
+# if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
+# define GLAPI __declspec(dllexport)
+# elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
+# define GLAPI __declspec(dllimport)
+# else /* for use with static link lib build of Win32 edition only */
+# define GLAPI extern
+# endif /* _STATIC_MESA support */
+# if defined(__MINGW32__) && defined(GL_NO_STDCALL) || defined(UNDER_CE) /* The generated DLLs by MingW with STDCALL are not compatible with the ones done by Microsoft's compilers */
+# define GLAPIENTRY
+# else
+# define GLAPIENTRY __stdcall
+# endif
+#elif defined(__CYGWIN__) && defined(USE_OPENGL32) /* use native windows opengl32 */
+# define GLAPI extern
+# define GLAPIENTRY __stdcall
+#elif (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+# define GLAPI __attribute__((visibility("default")))
+# define GLAPIENTRY
+#endif /* WIN32 && !CYGWIN */
+
+#if (defined(__BEOS__) && defined(__POWERPC__)) || defined(__QUICKDRAW__)
+# define PRAGMA_EXPORT_SUPPORTED 1
+#endif
+
+/*
+ * WINDOWS: Include windows.h here to define APIENTRY.
+ * It is also useful when applications include this file by
+ * including only glut.h, since glut.h depends on windows.h.
+ * Applications needing to include windows.h with parms other
+ * than "WIN32_LEAN_AND_MEAN" may include windows.h before
+ * glut.h or gl.h.
+ */
+#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__)
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN 1
+#endif
+#include <windows.h>
+#endif
+
+#if defined(macintosh) && PRAGMA_IMPORT_SUPPORTED
+#pragma import on
+#endif
+
+#ifndef GLAPI
+#define GLAPI extern
+#endif
+
+#ifndef GLAPIENTRY
+#define GLAPIENTRY
+#endif
+
+#ifndef APIENTRY
+#define APIENTRY GLAPIENTRY
+#endif
+
+/* "P" suffix to be used for a pointer to a function */
+#ifndef APIENTRYP
+#define APIENTRYP APIENTRY *
+#endif
+
+#ifndef GLAPIENTRYP
+#define GLAPIENTRYP GLAPIENTRY *
+#endif
+
+#ifdef CENTERLINE_CLPP
+#define signed
+#endif
+
+#if defined(PRAGMA_EXPORT_SUPPORTED)
+#pragma export on
+#endif
+
+#endif /* !__SCITECH_SNAP__ */
+/*
+ * End system-specific stuff.
+ **********************************************************************/
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#define GL_VERSION_1_1 1
+#define GL_VERSION_1_2 1
+#define GL_VERSION_1_3 1
+#define GL_ARB_imaging 1
+
+
+/*
+ * Datatypes
+ */
+typedef unsigned int GLenum;
+typedef unsigned char GLboolean;
+typedef unsigned int GLbitfield;
+typedef void GLvoid;
+typedef signed char GLbyte; /* 1-byte signed */
+typedef short GLshort; /* 2-byte signed */
+typedef int GLint; /* 4-byte signed */
+typedef unsigned char GLubyte; /* 1-byte unsigned */
+typedef unsigned short GLushort; /* 2-byte unsigned */
+typedef unsigned int GLuint; /* 4-byte unsigned */
+typedef int GLsizei; /* 4-byte signed */
+typedef float GLfloat; /* single precision float */
+typedef float GLclampf; /* single precision float in [0,1] */
+typedef double GLdouble; /* double precision float */
+typedef double GLclampd; /* double precision float in [0,1] */
+
+
+
+/*
+ * Constants
+ */
+
+/* Boolean values */
+#define GL_FALSE 0x0
+#define GL_TRUE 0x1
+
+/* Data types */
+#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_2_BYTES 0x1407
+#define GL_3_BYTES 0x1408
+#define GL_4_BYTES 0x1409
+#define GL_DOUBLE 0x140A
+
+/* Primitives */
+#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_QUADS 0x0007
+#define GL_QUAD_STRIP 0x0008
+#define GL_POLYGON 0x0009
+
+/* Vertex Arrays */
+#define GL_VERTEX_ARRAY 0x8074
+#define GL_NORMAL_ARRAY 0x8075
+#define GL_COLOR_ARRAY 0x8076
+#define GL_INDEX_ARRAY 0x8077
+#define GL_TEXTURE_COORD_ARRAY 0x8078
+#define GL_EDGE_FLAG_ARRAY 0x8079
+#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_INDEX_ARRAY_TYPE 0x8085
+#define GL_INDEX_ARRAY_STRIDE 0x8086
+#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088
+#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089
+#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A
+#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C
+#define GL_VERTEX_ARRAY_POINTER 0x808E
+#define GL_NORMAL_ARRAY_POINTER 0x808F
+#define GL_COLOR_ARRAY_POINTER 0x8090
+#define GL_INDEX_ARRAY_POINTER 0x8091
+#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092
+#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093
+#define GL_V2F 0x2A20
+#define GL_V3F 0x2A21
+#define GL_C4UB_V2F 0x2A22
+#define GL_C4UB_V3F 0x2A23
+#define GL_C3F_V3F 0x2A24
+#define GL_N3F_V3F 0x2A25
+#define GL_C4F_N3F_V3F 0x2A26
+#define GL_T2F_V3F 0x2A27
+#define GL_T4F_V4F 0x2A28
+#define GL_T2F_C4UB_V3F 0x2A29
+#define GL_T2F_C3F_V3F 0x2A2A
+#define GL_T2F_N3F_V3F 0x2A2B
+#define GL_T2F_C4F_N3F_V3F 0x2A2C
+#define GL_T4F_C4F_N3F_V4F 0x2A2D
+
+/* Matrix Mode */
+#define GL_MATRIX_MODE 0x0BA0
+#define GL_MODELVIEW 0x1700
+#define GL_PROJECTION 0x1701
+#define GL_TEXTURE 0x1702
+
+/* Points */
+#define GL_POINT_SMOOTH 0x0B10
+#define GL_POINT_SIZE 0x0B11
+#define GL_POINT_SIZE_GRANULARITY 0x0B13
+#define GL_POINT_SIZE_RANGE 0x0B12
+
+/* Lines */
+#define GL_LINE_SMOOTH 0x0B20
+#define GL_LINE_STIPPLE 0x0B24
+#define GL_LINE_STIPPLE_PATTERN 0x0B25
+#define GL_LINE_STIPPLE_REPEAT 0x0B26
+#define GL_LINE_WIDTH 0x0B21
+#define GL_LINE_WIDTH_GRANULARITY 0x0B23
+#define GL_LINE_WIDTH_RANGE 0x0B22
+
+/* Polygons */
+#define GL_POINT 0x1B00
+#define GL_LINE 0x1B01
+#define GL_FILL 0x1B02
+#define GL_CW 0x0900
+#define GL_CCW 0x0901
+#define GL_FRONT 0x0404
+#define GL_BACK 0x0405
+#define GL_POLYGON_MODE 0x0B40
+#define GL_POLYGON_SMOOTH 0x0B41
+#define GL_POLYGON_STIPPLE 0x0B42
+#define GL_EDGE_FLAG 0x0B43
+#define GL_CULL_FACE 0x0B44
+#define GL_CULL_FACE_MODE 0x0B45
+#define GL_FRONT_FACE 0x0B46
+#define GL_POLYGON_OFFSET_FACTOR 0x8038
+#define GL_POLYGON_OFFSET_UNITS 0x2A00
+#define GL_POLYGON_OFFSET_POINT 0x2A01
+#define GL_POLYGON_OFFSET_LINE 0x2A02
+#define GL_POLYGON_OFFSET_FILL 0x8037
+
+/* Display Lists */
+#define GL_COMPILE 0x1300
+#define GL_COMPILE_AND_EXECUTE 0x1301
+#define GL_LIST_BASE 0x0B32
+#define GL_LIST_INDEX 0x0B33
+#define GL_LIST_MODE 0x0B30
+
+/* Depth buffer */
+#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_DEPTH_TEST 0x0B71
+#define GL_DEPTH_BITS 0x0D56
+#define GL_DEPTH_CLEAR_VALUE 0x0B73
+#define GL_DEPTH_FUNC 0x0B74
+#define GL_DEPTH_RANGE 0x0B70
+#define GL_DEPTH_WRITEMASK 0x0B72
+#define GL_DEPTH_COMPONENT 0x1902
+
+/* Lighting */
+#define GL_LIGHTING 0x0B50
+#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
+#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
+#define GL_AMBIENT 0x1200
+#define GL_DIFFUSE 0x1201
+#define GL_SPECULAR 0x1202
+#define GL_SHININESS 0x1601
+#define GL_EMISSION 0x1600
+#define GL_POSITION 0x1203
+#define GL_SPOT_DIRECTION 0x1204
+#define GL_AMBIENT_AND_DIFFUSE 0x1602
+#define GL_COLOR_INDEXES 0x1603
+#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52
+#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51
+#define GL_LIGHT_MODEL_AMBIENT 0x0B53
+#define GL_FRONT_AND_BACK 0x0408
+#define GL_SHADE_MODEL 0x0B54
+#define GL_FLAT 0x1D00
+#define GL_SMOOTH 0x1D01
+#define GL_COLOR_MATERIAL 0x0B57
+#define GL_COLOR_MATERIAL_FACE 0x0B55
+#define GL_COLOR_MATERIAL_PARAMETER 0x0B56
+#define GL_NORMALIZE 0x0BA1
+
+/* User clipping planes */
+#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
+
+/* Accumulation buffer */
+#define GL_ACCUM_RED_BITS 0x0D58
+#define GL_ACCUM_GREEN_BITS 0x0D59
+#define GL_ACCUM_BLUE_BITS 0x0D5A
+#define GL_ACCUM_ALPHA_BITS 0x0D5B
+#define GL_ACCUM_CLEAR_VALUE 0x0B80
+#define GL_ACCUM 0x0100
+#define GL_ADD 0x0104
+#define GL_LOAD 0x0101
+#define GL_MULT 0x0103
+#define GL_RETURN 0x0102
+
+/* Alpha testing */
+#define GL_ALPHA_TEST 0x0BC0
+#define GL_ALPHA_TEST_REF 0x0BC2
+#define GL_ALPHA_TEST_FUNC 0x0BC1
+
+/* Blending */
+#define GL_BLEND 0x0BE2
+#define GL_BLEND_SRC 0x0BE1
+#define GL_BLEND_DST 0x0BE0
+#define GL_ZERO 0x0
+#define GL_ONE 0x1
+#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
+
+/* Render Mode */
+#define GL_FEEDBACK 0x1C01
+#define GL_RENDER 0x1C00
+#define GL_SELECT 0x1C02
+
+/* Feedback */
+#define GL_2D 0x0600
+#define GL_3D 0x0601
+#define GL_3D_COLOR 0x0602
+#define GL_3D_COLOR_TEXTURE 0x0603
+#define GL_4D_COLOR_TEXTURE 0x0604
+#define GL_POINT_TOKEN 0x0701
+#define GL_LINE_TOKEN 0x0702
+#define GL_LINE_RESET_TOKEN 0x0707
+#define GL_POLYGON_TOKEN 0x0703
+#define GL_BITMAP_TOKEN 0x0704
+#define GL_DRAW_PIXEL_TOKEN 0x0705
+#define GL_COPY_PIXEL_TOKEN 0x0706
+#define GL_PASS_THROUGH_TOKEN 0x0700
+#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0
+#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1
+#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2
+
+/* Selection */
+#define GL_SELECTION_BUFFER_POINTER 0x0DF3
+#define GL_SELECTION_BUFFER_SIZE 0x0DF4
+
+/* Fog */
+#define GL_FOG 0x0B60
+#define GL_FOG_MODE 0x0B65
+#define GL_FOG_DENSITY 0x0B62
+#define GL_FOG_COLOR 0x0B66
+#define GL_FOG_INDEX 0x0B61
+#define GL_FOG_START 0x0B63
+#define GL_FOG_END 0x0B64
+#define GL_LINEAR 0x2601
+#define GL_EXP 0x0800
+#define GL_EXP2 0x0801
+
+/* Logic Ops */
+#define GL_LOGIC_OP 0x0BF1
+#define GL_INDEX_LOGIC_OP 0x0BF1
+#define GL_COLOR_LOGIC_OP 0x0BF2
+#define GL_LOGIC_OP_MODE 0x0BF0
+#define GL_CLEAR 0x1500
+#define GL_SET 0x150F
+#define GL_COPY 0x1503
+#define GL_COPY_INVERTED 0x150C
+#define GL_NOOP 0x1505
+#define GL_INVERT 0x150A
+#define GL_AND 0x1501
+#define GL_NAND 0x150E
+#define GL_OR 0x1507
+#define GL_NOR 0x1508
+#define GL_XOR 0x1506
+#define GL_EQUIV 0x1509
+#define GL_AND_REVERSE 0x1502
+#define GL_AND_INVERTED 0x1504
+#define GL_OR_REVERSE 0x150B
+#define GL_OR_INVERTED 0x150D
+
+/* Stencil */
+#define GL_STENCIL_BITS 0x0D57
+#define GL_STENCIL_TEST 0x0B90
+#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_STENCIL_INDEX 0x1901
+#define GL_KEEP 0x1E00
+#define GL_REPLACE 0x1E01
+#define GL_INCR 0x1E02
+#define GL_DECR 0x1E03
+
+/* Buffers, Pixel Drawing/Reading */
+#define GL_NONE 0x0
+#define GL_LEFT 0x0406
+#define GL_RIGHT 0x0407
+/*GL_FRONT 0x0404 */
+/*GL_BACK 0x0405 */
+/*GL_FRONT_AND_BACK 0x0408 */
+#define GL_FRONT_LEFT 0x0400
+#define GL_FRONT_RIGHT 0x0401
+#define GL_BACK_LEFT 0x0402
+#define GL_BACK_RIGHT 0x0403
+#define GL_AUX0 0x0409
+#define GL_AUX1 0x040A
+#define GL_AUX2 0x040B
+#define GL_AUX3 0x040C
+#define GL_COLOR_INDEX 0x1900
+#define GL_RED 0x1903
+#define GL_GREEN 0x1904
+#define GL_BLUE 0x1905
+#define GL_ALPHA 0x1906
+#define GL_LUMINANCE 0x1909
+#define GL_LUMINANCE_ALPHA 0x190A
+#define GL_ALPHA_BITS 0x0D55
+#define GL_RED_BITS 0x0D52
+#define GL_GREEN_BITS 0x0D53
+#define GL_BLUE_BITS 0x0D54
+#define GL_INDEX_BITS 0x0D51
+#define GL_SUBPIXEL_BITS 0x0D50
+#define GL_AUX_BUFFERS 0x0C00
+#define GL_READ_BUFFER 0x0C02
+#define GL_DRAW_BUFFER 0x0C01
+#define GL_DOUBLEBUFFER 0x0C32
+#define GL_STEREO 0x0C33
+#define GL_BITMAP 0x1A00
+#define GL_COLOR 0x1800
+#define GL_DEPTH 0x1801
+#define GL_STENCIL 0x1802
+#define GL_DITHER 0x0BD0
+#define GL_RGB 0x1907
+#define GL_RGBA 0x1908
+
+/* Implementation limits */
+#define GL_MAX_LIST_NESTING 0x0B31
+#define GL_MAX_EVAL_ORDER 0x0D30
+#define GL_MAX_LIGHTS 0x0D31
+#define GL_MAX_CLIP_PLANES 0x0D32
+#define GL_MAX_TEXTURE_SIZE 0x0D33
+#define GL_MAX_PIXEL_MAP_TABLE 0x0D34
+#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35
+#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36
+#define GL_MAX_NAME_STACK_DEPTH 0x0D37
+#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38
+#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39
+#define GL_MAX_VIEWPORT_DIMS 0x0D3A
+#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B
+
+/* Gets */
+#define GL_ATTRIB_STACK_DEPTH 0x0BB0
+#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1
+#define GL_COLOR_CLEAR_VALUE 0x0C22
+#define GL_COLOR_WRITEMASK 0x0C23
+#define GL_CURRENT_INDEX 0x0B01
+#define GL_CURRENT_COLOR 0x0B00
+#define GL_CURRENT_NORMAL 0x0B02
+#define GL_CURRENT_RASTER_COLOR 0x0B04
+#define GL_CURRENT_RASTER_DISTANCE 0x0B09
+#define GL_CURRENT_RASTER_INDEX 0x0B05
+#define GL_CURRENT_RASTER_POSITION 0x0B07
+#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06
+#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08
+#define GL_CURRENT_TEXTURE_COORDS 0x0B03
+#define GL_INDEX_CLEAR_VALUE 0x0C20
+#define GL_INDEX_MODE 0x0C30
+#define GL_INDEX_WRITEMASK 0x0C21
+#define GL_MODELVIEW_MATRIX 0x0BA6
+#define GL_MODELVIEW_STACK_DEPTH 0x0BA3
+#define GL_NAME_STACK_DEPTH 0x0D70
+#define GL_PROJECTION_MATRIX 0x0BA7
+#define GL_PROJECTION_STACK_DEPTH 0x0BA4
+#define GL_RENDER_MODE 0x0C40
+#define GL_RGBA_MODE 0x0C31
+#define GL_TEXTURE_MATRIX 0x0BA8
+#define GL_TEXTURE_STACK_DEPTH 0x0BA5
+#define GL_VIEWPORT 0x0BA2
+
+/* Evaluators */
+#define GL_AUTO_NORMAL 0x0D80
+#define GL_MAP1_COLOR_4 0x0D90
+#define GL_MAP1_INDEX 0x0D91
+#define GL_MAP1_NORMAL 0x0D92
+#define GL_MAP1_TEXTURE_COORD_1 0x0D93
+#define GL_MAP1_TEXTURE_COORD_2 0x0D94
+#define GL_MAP1_TEXTURE_COORD_3 0x0D95
+#define GL_MAP1_TEXTURE_COORD_4 0x0D96
+#define GL_MAP1_VERTEX_3 0x0D97
+#define GL_MAP1_VERTEX_4 0x0D98
+#define GL_MAP2_COLOR_4 0x0DB0
+#define GL_MAP2_INDEX 0x0DB1
+#define GL_MAP2_NORMAL 0x0DB2
+#define GL_MAP2_TEXTURE_COORD_1 0x0DB3
+#define GL_MAP2_TEXTURE_COORD_2 0x0DB4
+#define GL_MAP2_TEXTURE_COORD_3 0x0DB5
+#define GL_MAP2_TEXTURE_COORD_4 0x0DB6
+#define GL_MAP2_VERTEX_3 0x0DB7
+#define GL_MAP2_VERTEX_4 0x0DB8
+#define GL_MAP1_GRID_DOMAIN 0x0DD0
+#define GL_MAP1_GRID_SEGMENTS 0x0DD1
+#define GL_MAP2_GRID_DOMAIN 0x0DD2
+#define GL_MAP2_GRID_SEGMENTS 0x0DD3
+#define GL_COEFF 0x0A00
+#define GL_ORDER 0x0A01
+#define GL_DOMAIN 0x0A02
+
+/* Hints */
+#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50
+#define GL_POINT_SMOOTH_HINT 0x0C51
+#define GL_LINE_SMOOTH_HINT 0x0C52
+#define GL_POLYGON_SMOOTH_HINT 0x0C53
+#define GL_FOG_HINT 0x0C54
+#define GL_DONT_CARE 0x1100
+#define GL_FASTEST 0x1101
+#define GL_NICEST 0x1102
+
+/* Scissor box */
+#define GL_SCISSOR_BOX 0x0C10
+#define GL_SCISSOR_TEST 0x0C11
+
+/* Pixel Mode / Transfer */
+#define GL_MAP_COLOR 0x0D10
+#define GL_MAP_STENCIL 0x0D11
+#define GL_INDEX_SHIFT 0x0D12
+#define GL_INDEX_OFFSET 0x0D13
+#define GL_RED_SCALE 0x0D14
+#define GL_RED_BIAS 0x0D15
+#define GL_GREEN_SCALE 0x0D18
+#define GL_GREEN_BIAS 0x0D19
+#define GL_BLUE_SCALE 0x0D1A
+#define GL_BLUE_BIAS 0x0D1B
+#define GL_ALPHA_SCALE 0x0D1C
+#define GL_ALPHA_BIAS 0x0D1D
+#define GL_DEPTH_SCALE 0x0D1E
+#define GL_DEPTH_BIAS 0x0D1F
+#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1
+#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0
+#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2
+#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3
+#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4
+#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5
+#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6
+#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7
+#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8
+#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9
+#define GL_PIXEL_MAP_S_TO_S 0x0C71
+#define GL_PIXEL_MAP_I_TO_I 0x0C70
+#define GL_PIXEL_MAP_I_TO_R 0x0C72
+#define GL_PIXEL_MAP_I_TO_G 0x0C73
+#define GL_PIXEL_MAP_I_TO_B 0x0C74
+#define GL_PIXEL_MAP_I_TO_A 0x0C75
+#define GL_PIXEL_MAP_R_TO_R 0x0C76
+#define GL_PIXEL_MAP_G_TO_G 0x0C77
+#define GL_PIXEL_MAP_B_TO_B 0x0C78
+#define GL_PIXEL_MAP_A_TO_A 0x0C79
+#define GL_PACK_ALIGNMENT 0x0D05
+#define GL_PACK_LSB_FIRST 0x0D01
+#define GL_PACK_ROW_LENGTH 0x0D02
+#define GL_PACK_SKIP_PIXELS 0x0D04
+#define GL_PACK_SKIP_ROWS 0x0D03
+#define GL_PACK_SWAP_BYTES 0x0D00
+#define GL_UNPACK_ALIGNMENT 0x0CF5
+#define GL_UNPACK_LSB_FIRST 0x0CF1
+#define GL_UNPACK_ROW_LENGTH 0x0CF2
+#define GL_UNPACK_SKIP_PIXELS 0x0CF4
+#define GL_UNPACK_SKIP_ROWS 0x0CF3
+#define GL_UNPACK_SWAP_BYTES 0x0CF0
+#define GL_ZOOM_X 0x0D16
+#define GL_ZOOM_Y 0x0D17
+
+/* Texture mapping */
+#define GL_TEXTURE_ENV 0x2300
+#define GL_TEXTURE_ENV_MODE 0x2200
+#define GL_TEXTURE_1D 0x0DE0
+#define GL_TEXTURE_2D 0x0DE1
+#define GL_TEXTURE_WRAP_S 0x2802
+#define GL_TEXTURE_WRAP_T 0x2803
+#define GL_TEXTURE_MAG_FILTER 0x2800
+#define GL_TEXTURE_MIN_FILTER 0x2801
+#define GL_TEXTURE_ENV_COLOR 0x2201
+#define GL_TEXTURE_GEN_S 0x0C60
+#define GL_TEXTURE_GEN_T 0x0C61
+#define GL_TEXTURE_GEN_R 0x0C62
+#define GL_TEXTURE_GEN_Q 0x0C63
+#define GL_TEXTURE_GEN_MODE 0x2500
+#define GL_TEXTURE_BORDER_COLOR 0x1004
+#define GL_TEXTURE_WIDTH 0x1000
+#define GL_TEXTURE_HEIGHT 0x1001
+#define GL_TEXTURE_BORDER 0x1005
+#define GL_TEXTURE_COMPONENTS 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_LUMINANCE_SIZE 0x8060
+#define GL_TEXTURE_INTENSITY_SIZE 0x8061
+#define GL_NEAREST_MIPMAP_NEAREST 0x2700
+#define GL_NEAREST_MIPMAP_LINEAR 0x2702
+#define GL_LINEAR_MIPMAP_NEAREST 0x2701
+#define GL_LINEAR_MIPMAP_LINEAR 0x2703
+#define GL_OBJECT_LINEAR 0x2401
+#define GL_OBJECT_PLANE 0x2501
+#define GL_EYE_LINEAR 0x2400
+#define GL_EYE_PLANE 0x2502
+#define GL_SPHERE_MAP 0x2402
+#define GL_DECAL 0x2101
+#define GL_MODULATE 0x2100
+#define GL_NEAREST 0x2600
+#define GL_REPEAT 0x2901
+#define GL_CLAMP 0x2900
+#define GL_S 0x2000
+#define GL_T 0x2001
+#define GL_R 0x2002
+#define GL_Q 0x2003
+
+/* Utility */
+#define GL_VENDOR 0x1F00
+#define GL_RENDERER 0x1F01
+#define GL_VERSION 0x1F02
+#define GL_EXTENSIONS 0x1F03
+
+/* Errors */
+#define GL_NO_ERROR 0x0
+#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
+
+/* glPush/PopAttrib bits */
+#define GL_CURRENT_BIT 0x00000001
+#define GL_POINT_BIT 0x00000002
+#define GL_LINE_BIT 0x00000004
+#define GL_POLYGON_BIT 0x00000008
+#define GL_POLYGON_STIPPLE_BIT 0x00000010
+#define GL_PIXEL_MODE_BIT 0x00000020
+#define GL_LIGHTING_BIT 0x00000040
+#define GL_FOG_BIT 0x00000080
+#define GL_DEPTH_BUFFER_BIT 0x00000100
+#define GL_ACCUM_BUFFER_BIT 0x00000200
+#define GL_STENCIL_BUFFER_BIT 0x00000400
+#define GL_VIEWPORT_BIT 0x00000800
+#define GL_TRANSFORM_BIT 0x00001000
+#define GL_ENABLE_BIT 0x00002000
+#define GL_COLOR_BUFFER_BIT 0x00004000
+#define GL_HINT_BIT 0x00008000
+#define GL_EVAL_BIT 0x00010000
+#define GL_LIST_BIT 0x00020000
+#define GL_TEXTURE_BIT 0x00040000
+#define GL_SCISSOR_BIT 0x00080000
+#define GL_ALL_ATTRIB_BITS 0x000FFFFF
+
+
+/* OpenGL 1.1 */
+#define GL_PROXY_TEXTURE_1D 0x8063
+#define GL_PROXY_TEXTURE_2D 0x8064
+#define GL_TEXTURE_PRIORITY 0x8066
+#define GL_TEXTURE_RESIDENT 0x8067
+#define GL_TEXTURE_BINDING_1D 0x8068
+#define GL_TEXTURE_BINDING_2D 0x8069
+#define GL_TEXTURE_INTERNAL_FORMAT 0x1003
+#define GL_ALPHA4 0x803B
+#define GL_ALPHA8 0x803C
+#define GL_ALPHA12 0x803D
+#define GL_ALPHA16 0x803E
+#define GL_LUMINANCE4 0x803F
+#define GL_LUMINANCE8 0x8040
+#define GL_LUMINANCE12 0x8041
+#define GL_LUMINANCE16 0x8042
+#define GL_LUMINANCE4_ALPHA4 0x8043
+#define GL_LUMINANCE6_ALPHA2 0x8044
+#define GL_LUMINANCE8_ALPHA8 0x8045
+#define GL_LUMINANCE12_ALPHA4 0x8046
+#define GL_LUMINANCE12_ALPHA12 0x8047
+#define GL_LUMINANCE16_ALPHA16 0x8048
+#define GL_INTENSITY 0x8049
+#define GL_INTENSITY4 0x804A
+#define GL_INTENSITY8 0x804B
+#define GL_INTENSITY12 0x804C
+#define GL_INTENSITY16 0x804D
+#define GL_R3_G3_B2 0x2A10
+#define GL_RGB4 0x804F
+#define GL_RGB5 0x8050
+#define GL_RGB8 0x8051
+#define GL_RGB10 0x8052
+#define GL_RGB12 0x8053
+#define GL_RGB16 0x8054
+#define GL_RGBA2 0x8055
+#define GL_RGBA4 0x8056
+#define GL_RGB5_A1 0x8057
+#define GL_RGBA8 0x8058
+#define GL_RGB10_A2 0x8059
+#define GL_RGBA12 0x805A
+#define GL_RGBA16 0x805B
+#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001
+#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002
+#define GL_ALL_CLIENT_ATTRIB_BITS 0xFFFFFFFF
+#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF
+
+
+
+/*
+ * Miscellaneous
+ */
+
+GLAPI void GLAPIENTRY glClearIndex( GLfloat c );
+
+GLAPI void GLAPIENTRY glClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
+
+GLAPI void GLAPIENTRY glClear( GLbitfield mask );
+
+GLAPI void GLAPIENTRY glIndexMask( GLuint mask );
+
+GLAPI void GLAPIENTRY glColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha );
+
+GLAPI void GLAPIENTRY glAlphaFunc( GLenum func, GLclampf ref );
+
+GLAPI void GLAPIENTRY glBlendFunc( GLenum sfactor, GLenum dfactor );
+
+GLAPI void GLAPIENTRY glLogicOp( GLenum opcode );
+
+GLAPI void GLAPIENTRY glCullFace( GLenum mode );
+
+GLAPI void GLAPIENTRY glFrontFace( GLenum mode );
+
+GLAPI void GLAPIENTRY glPointSize( GLfloat size );
+
+GLAPI void GLAPIENTRY glLineWidth( GLfloat width );
+
+GLAPI void GLAPIENTRY glLineStipple( GLint factor, GLushort pattern );
+
+GLAPI void GLAPIENTRY glPolygonMode( GLenum face, GLenum mode );
+
+GLAPI void GLAPIENTRY glPolygonOffset( GLfloat factor, GLfloat units );
+
+GLAPI void GLAPIENTRY glPolygonStipple( const GLubyte *mask );
+
+GLAPI void GLAPIENTRY glGetPolygonStipple( GLubyte *mask );
+
+GLAPI void GLAPIENTRY glEdgeFlag( GLboolean flag );
+
+GLAPI void GLAPIENTRY glEdgeFlagv( const GLboolean *flag );
+
+GLAPI void GLAPIENTRY glScissor( GLint x, GLint y, GLsizei width, GLsizei height);
+
+GLAPI void GLAPIENTRY glClipPlane( GLenum plane, const GLdouble *equation );
+
+GLAPI void GLAPIENTRY glGetClipPlane( GLenum plane, GLdouble *equation );
+
+GLAPI void GLAPIENTRY glDrawBuffer( GLenum mode );
+
+GLAPI void GLAPIENTRY glReadBuffer( GLenum mode );
+
+GLAPI void GLAPIENTRY glEnable( GLenum cap );
+
+GLAPI void GLAPIENTRY glDisable( GLenum cap );
+
+GLAPI GLboolean GLAPIENTRY glIsEnabled( GLenum cap );
+
+
+GLAPI void GLAPIENTRY glEnableClientState( GLenum cap ); /* 1.1 */
+
+GLAPI void GLAPIENTRY glDisableClientState( GLenum cap ); /* 1.1 */
+
+
+GLAPI void GLAPIENTRY glGetBooleanv( GLenum pname, GLboolean *params );
+
+GLAPI void GLAPIENTRY glGetDoublev( GLenum pname, GLdouble *params );
+
+GLAPI void GLAPIENTRY glGetFloatv( GLenum pname, GLfloat *params );
+
+GLAPI void GLAPIENTRY glGetIntegerv( GLenum pname, GLint *params );
+
+
+GLAPI void GLAPIENTRY glPushAttrib( GLbitfield mask );
+
+GLAPI void GLAPIENTRY glPopAttrib( void );
+
+
+GLAPI void GLAPIENTRY glPushClientAttrib( GLbitfield mask ); /* 1.1 */
+
+GLAPI void GLAPIENTRY glPopClientAttrib( void ); /* 1.1 */
+
+
+GLAPI GLint GLAPIENTRY glRenderMode( GLenum mode );
+
+GLAPI GLenum GLAPIENTRY glGetError( void );
+
+GLAPI const GLubyte * GLAPIENTRY glGetString( GLenum name );
+
+GLAPI void GLAPIENTRY glFinish( void );
+
+GLAPI void GLAPIENTRY glFlush( void );
+
+GLAPI void GLAPIENTRY glHint( GLenum target, GLenum mode );
+
+
+/*
+ * Depth Buffer
+ */
+
+GLAPI void GLAPIENTRY glClearDepth( GLclampd depth );
+
+GLAPI void GLAPIENTRY glDepthFunc( GLenum func );
+
+GLAPI void GLAPIENTRY glDepthMask( GLboolean flag );
+
+GLAPI void GLAPIENTRY glDepthRange( GLclampd near_val, GLclampd far_val );
+
+
+/*
+ * Accumulation Buffer
+ */
+
+GLAPI void GLAPIENTRY glClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha );
+
+GLAPI void GLAPIENTRY glAccum( GLenum op, GLfloat value );
+
+
+/*
+ * Transformation
+ */
+
+GLAPI void GLAPIENTRY glMatrixMode( GLenum mode );
+
+GLAPI void GLAPIENTRY glOrtho( GLdouble left, GLdouble right,
+ GLdouble bottom, GLdouble top,
+ GLdouble near_val, GLdouble far_val );
+
+GLAPI void GLAPIENTRY glFrustum( GLdouble left, GLdouble right,
+ GLdouble bottom, GLdouble top,
+ GLdouble near_val, GLdouble far_val );
+
+GLAPI void GLAPIENTRY glViewport( GLint x, GLint y,
+ GLsizei width, GLsizei height );
+
+GLAPI void GLAPIENTRY glPushMatrix( void );
+
+GLAPI void GLAPIENTRY glPopMatrix( void );
+
+GLAPI void GLAPIENTRY glLoadIdentity( void );
+
+GLAPI void GLAPIENTRY glLoadMatrixd( const GLdouble *m );
+GLAPI void GLAPIENTRY glLoadMatrixf( const GLfloat *m );
+
+GLAPI void GLAPIENTRY glMultMatrixd( const GLdouble *m );
+GLAPI void GLAPIENTRY glMultMatrixf( const GLfloat *m );
+
+GLAPI void GLAPIENTRY glRotated( GLdouble angle,
+ GLdouble x, GLdouble y, GLdouble z );
+GLAPI void GLAPIENTRY glRotatef( GLfloat angle,
+ GLfloat x, GLfloat y, GLfloat z );
+
+GLAPI void GLAPIENTRY glScaled( GLdouble x, GLdouble y, GLdouble z );
+GLAPI void GLAPIENTRY glScalef( GLfloat x, GLfloat y, GLfloat z );
+
+GLAPI void GLAPIENTRY glTranslated( GLdouble x, GLdouble y, GLdouble z );
+GLAPI void GLAPIENTRY glTranslatef( GLfloat x, GLfloat y, GLfloat z );
+
+
+/*
+ * Display Lists
+ */
+
+GLAPI GLboolean GLAPIENTRY glIsList( GLuint list );
+
+GLAPI void GLAPIENTRY glDeleteLists( GLuint list, GLsizei range );
+
+GLAPI GLuint GLAPIENTRY glGenLists( GLsizei range );
+
+GLAPI void GLAPIENTRY glNewList( GLuint list, GLenum mode );
+
+GLAPI void GLAPIENTRY glEndList( void );
+
+GLAPI void GLAPIENTRY glCallList( GLuint list );
+
+GLAPI void GLAPIENTRY glCallLists( GLsizei n, GLenum type,
+ const GLvoid *lists );
+
+GLAPI void GLAPIENTRY glListBase( GLuint base );
+
+
+/*
+ * Drawing Functions
+ */
+
+GLAPI void GLAPIENTRY glBegin( GLenum mode );
+
+GLAPI void GLAPIENTRY glEnd( void );
+
+
+GLAPI void GLAPIENTRY glVertex2d( GLdouble x, GLdouble y );
+GLAPI void GLAPIENTRY glVertex2f( GLfloat x, GLfloat y );
+GLAPI void GLAPIENTRY glVertex2i( GLint x, GLint y );
+GLAPI void GLAPIENTRY glVertex2s( GLshort x, GLshort y );
+
+GLAPI void GLAPIENTRY glVertex3d( GLdouble x, GLdouble y, GLdouble z );
+GLAPI void GLAPIENTRY glVertex3f( GLfloat x, GLfloat y, GLfloat z );
+GLAPI void GLAPIENTRY glVertex3i( GLint x, GLint y, GLint z );
+GLAPI void GLAPIENTRY glVertex3s( GLshort x, GLshort y, GLshort z );
+
+GLAPI void GLAPIENTRY glVertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w );
+GLAPI void GLAPIENTRY glVertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w );
+GLAPI void GLAPIENTRY glVertex4i( GLint x, GLint y, GLint z, GLint w );
+GLAPI void GLAPIENTRY glVertex4s( GLshort x, GLshort y, GLshort z, GLshort w );
+
+GLAPI void GLAPIENTRY glVertex2dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glVertex2fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glVertex2iv( const GLint *v );
+GLAPI void GLAPIENTRY glVertex2sv( const GLshort *v );
+
+GLAPI void GLAPIENTRY glVertex3dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glVertex3fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glVertex3iv( const GLint *v );
+GLAPI void GLAPIENTRY glVertex3sv( const GLshort *v );
+
+GLAPI void GLAPIENTRY glVertex4dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glVertex4fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glVertex4iv( const GLint *v );
+GLAPI void GLAPIENTRY glVertex4sv( const GLshort *v );
+
+
+GLAPI void GLAPIENTRY glNormal3b( GLbyte nx, GLbyte ny, GLbyte nz );
+GLAPI void GLAPIENTRY glNormal3d( GLdouble nx, GLdouble ny, GLdouble nz );
+GLAPI void GLAPIENTRY glNormal3f( GLfloat nx, GLfloat ny, GLfloat nz );
+GLAPI void GLAPIENTRY glNormal3i( GLint nx, GLint ny, GLint nz );
+GLAPI void GLAPIENTRY glNormal3s( GLshort nx, GLshort ny, GLshort nz );
+
+GLAPI void GLAPIENTRY glNormal3bv( const GLbyte *v );
+GLAPI void GLAPIENTRY glNormal3dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glNormal3fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glNormal3iv( const GLint *v );
+GLAPI void GLAPIENTRY glNormal3sv( const GLshort *v );
+
+
+GLAPI void GLAPIENTRY glIndexd( GLdouble c );
+GLAPI void GLAPIENTRY glIndexf( GLfloat c );
+GLAPI void GLAPIENTRY glIndexi( GLint c );
+GLAPI void GLAPIENTRY glIndexs( GLshort c );
+GLAPI void GLAPIENTRY glIndexub( GLubyte c ); /* 1.1 */
+
+GLAPI void GLAPIENTRY glIndexdv( const GLdouble *c );
+GLAPI void GLAPIENTRY glIndexfv( const GLfloat *c );
+GLAPI void GLAPIENTRY glIndexiv( const GLint *c );
+GLAPI void GLAPIENTRY glIndexsv( const GLshort *c );
+GLAPI void GLAPIENTRY glIndexubv( const GLubyte *c ); /* 1.1 */
+
+GLAPI void GLAPIENTRY glColor3b( GLbyte red, GLbyte green, GLbyte blue );
+GLAPI void GLAPIENTRY glColor3d( GLdouble red, GLdouble green, GLdouble blue );
+GLAPI void GLAPIENTRY glColor3f( GLfloat red, GLfloat green, GLfloat blue );
+GLAPI void GLAPIENTRY glColor3i( GLint red, GLint green, GLint blue );
+GLAPI void GLAPIENTRY glColor3s( GLshort red, GLshort green, GLshort blue );
+GLAPI void GLAPIENTRY glColor3ub( GLubyte red, GLubyte green, GLubyte blue );
+GLAPI void GLAPIENTRY glColor3ui( GLuint red, GLuint green, GLuint blue );
+GLAPI void GLAPIENTRY glColor3us( GLushort red, GLushort green, GLushort blue );
+
+GLAPI void GLAPIENTRY glColor4b( GLbyte red, GLbyte green,
+ GLbyte blue, GLbyte alpha );
+GLAPI void GLAPIENTRY glColor4d( GLdouble red, GLdouble green,
+ GLdouble blue, GLdouble alpha );
+GLAPI void GLAPIENTRY glColor4f( GLfloat red, GLfloat green,
+ GLfloat blue, GLfloat alpha );
+GLAPI void GLAPIENTRY glColor4i( GLint red, GLint green,
+ GLint blue, GLint alpha );
+GLAPI void GLAPIENTRY glColor4s( GLshort red, GLshort green,
+ GLshort blue, GLshort alpha );
+GLAPI void GLAPIENTRY glColor4ub( GLubyte red, GLubyte green,
+ GLubyte blue, GLubyte alpha );
+GLAPI void GLAPIENTRY glColor4ui( GLuint red, GLuint green,
+ GLuint blue, GLuint alpha );
+GLAPI void GLAPIENTRY glColor4us( GLushort red, GLushort green,
+ GLushort blue, GLushort alpha );
+
+
+GLAPI void GLAPIENTRY glColor3bv( const GLbyte *v );
+GLAPI void GLAPIENTRY glColor3dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glColor3fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glColor3iv( const GLint *v );
+GLAPI void GLAPIENTRY glColor3sv( const GLshort *v );
+GLAPI void GLAPIENTRY glColor3ubv( const GLubyte *v );
+GLAPI void GLAPIENTRY glColor3uiv( const GLuint *v );
+GLAPI void GLAPIENTRY glColor3usv( const GLushort *v );
+
+GLAPI void GLAPIENTRY glColor4bv( const GLbyte *v );
+GLAPI void GLAPIENTRY glColor4dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glColor4fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glColor4iv( const GLint *v );
+GLAPI void GLAPIENTRY glColor4sv( const GLshort *v );
+GLAPI void GLAPIENTRY glColor4ubv( const GLubyte *v );
+GLAPI void GLAPIENTRY glColor4uiv( const GLuint *v );
+GLAPI void GLAPIENTRY glColor4usv( const GLushort *v );
+
+
+GLAPI void GLAPIENTRY glTexCoord1d( GLdouble s );
+GLAPI void GLAPIENTRY glTexCoord1f( GLfloat s );
+GLAPI void GLAPIENTRY glTexCoord1i( GLint s );
+GLAPI void GLAPIENTRY glTexCoord1s( GLshort s );
+
+GLAPI void GLAPIENTRY glTexCoord2d( GLdouble s, GLdouble t );
+GLAPI void GLAPIENTRY glTexCoord2f( GLfloat s, GLfloat t );
+GLAPI void GLAPIENTRY glTexCoord2i( GLint s, GLint t );
+GLAPI void GLAPIENTRY glTexCoord2s( GLshort s, GLshort t );
+
+GLAPI void GLAPIENTRY glTexCoord3d( GLdouble s, GLdouble t, GLdouble r );
+GLAPI void GLAPIENTRY glTexCoord3f( GLfloat s, GLfloat t, GLfloat r );
+GLAPI void GLAPIENTRY glTexCoord3i( GLint s, GLint t, GLint r );
+GLAPI void GLAPIENTRY glTexCoord3s( GLshort s, GLshort t, GLshort r );
+
+GLAPI void GLAPIENTRY glTexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q );
+GLAPI void GLAPIENTRY glTexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q );
+GLAPI void GLAPIENTRY glTexCoord4i( GLint s, GLint t, GLint r, GLint q );
+GLAPI void GLAPIENTRY glTexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q );
+
+GLAPI void GLAPIENTRY glTexCoord1dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glTexCoord1fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glTexCoord1iv( const GLint *v );
+GLAPI void GLAPIENTRY glTexCoord1sv( const GLshort *v );
+
+GLAPI void GLAPIENTRY glTexCoord2dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glTexCoord2fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glTexCoord2iv( const GLint *v );
+GLAPI void GLAPIENTRY glTexCoord2sv( const GLshort *v );
+
+GLAPI void GLAPIENTRY glTexCoord3dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glTexCoord3fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glTexCoord3iv( const GLint *v );
+GLAPI void GLAPIENTRY glTexCoord3sv( const GLshort *v );
+
+GLAPI void GLAPIENTRY glTexCoord4dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glTexCoord4fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glTexCoord4iv( const GLint *v );
+GLAPI void GLAPIENTRY glTexCoord4sv( const GLshort *v );
+
+
+GLAPI void GLAPIENTRY glRasterPos2d( GLdouble x, GLdouble y );
+GLAPI void GLAPIENTRY glRasterPos2f( GLfloat x, GLfloat y );
+GLAPI void GLAPIENTRY glRasterPos2i( GLint x, GLint y );
+GLAPI void GLAPIENTRY glRasterPos2s( GLshort x, GLshort y );
+
+GLAPI void GLAPIENTRY glRasterPos3d( GLdouble x, GLdouble y, GLdouble z );
+GLAPI void GLAPIENTRY glRasterPos3f( GLfloat x, GLfloat y, GLfloat z );
+GLAPI void GLAPIENTRY glRasterPos3i( GLint x, GLint y, GLint z );
+GLAPI void GLAPIENTRY glRasterPos3s( GLshort x, GLshort y, GLshort z );
+
+GLAPI void GLAPIENTRY glRasterPos4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w );
+GLAPI void GLAPIENTRY glRasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w );
+GLAPI void GLAPIENTRY glRasterPos4i( GLint x, GLint y, GLint z, GLint w );
+GLAPI void GLAPIENTRY glRasterPos4s( GLshort x, GLshort y, GLshort z, GLshort w );
+
+GLAPI void GLAPIENTRY glRasterPos2dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glRasterPos2fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glRasterPos2iv( const GLint *v );
+GLAPI void GLAPIENTRY glRasterPos2sv( const GLshort *v );
+
+GLAPI void GLAPIENTRY glRasterPos3dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glRasterPos3fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glRasterPos3iv( const GLint *v );
+GLAPI void GLAPIENTRY glRasterPos3sv( const GLshort *v );
+
+GLAPI void GLAPIENTRY glRasterPos4dv( const GLdouble *v );
+GLAPI void GLAPIENTRY glRasterPos4fv( const GLfloat *v );
+GLAPI void GLAPIENTRY glRasterPos4iv( const GLint *v );
+GLAPI void GLAPIENTRY glRasterPos4sv( const GLshort *v );
+
+
+GLAPI void GLAPIENTRY glRectd( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 );
+GLAPI void GLAPIENTRY glRectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 );
+GLAPI void GLAPIENTRY glRecti( GLint x1, GLint y1, GLint x2, GLint y2 );
+GLAPI void GLAPIENTRY glRects( GLshort x1, GLshort y1, GLshort x2, GLshort y2 );
+
+
+GLAPI void GLAPIENTRY glRectdv( const GLdouble *v1, const GLdouble *v2 );
+GLAPI void GLAPIENTRY glRectfv( const GLfloat *v1, const GLfloat *v2 );
+GLAPI void GLAPIENTRY glRectiv( const GLint *v1, const GLint *v2 );
+GLAPI void GLAPIENTRY glRectsv( const GLshort *v1, const GLshort *v2 );
+
+
+/*
+ * Vertex Arrays (1.1)
+ */
+
+GLAPI void GLAPIENTRY glVertexPointer( GLint size, GLenum type,
+ GLsizei stride, const GLvoid *ptr );
+
+GLAPI void GLAPIENTRY glNormalPointer( GLenum type, GLsizei stride,
+ const GLvoid *ptr );
+
+GLAPI void GLAPIENTRY glColorPointer( GLint size, GLenum type,
+ GLsizei stride, const GLvoid *ptr );
+
+GLAPI void GLAPIENTRY glIndexPointer( GLenum type, GLsizei stride,
+ const GLvoid *ptr );
+
+GLAPI void GLAPIENTRY glTexCoordPointer( GLint size, GLenum type,
+ GLsizei stride, const GLvoid *ptr );
+
+GLAPI void GLAPIENTRY glEdgeFlagPointer( GLsizei stride, const GLvoid *ptr );
+
+GLAPI void GLAPIENTRY glGetPointerv( GLenum pname, GLvoid **params );
+
+GLAPI void GLAPIENTRY glArrayElement( GLint i );
+
+GLAPI void GLAPIENTRY glDrawArrays( GLenum mode, GLint first, GLsizei count );
+
+GLAPI void GLAPIENTRY glDrawElements( GLenum mode, GLsizei count,
+ GLenum type, const GLvoid *indices );
+
+GLAPI void GLAPIENTRY glInterleavedArrays( GLenum format, GLsizei stride,
+ const GLvoid *pointer );
+
+/*
+ * Lighting
+ */
+
+GLAPI void GLAPIENTRY glShadeModel( GLenum mode );
+
+GLAPI void GLAPIENTRY glLightf( GLenum light, GLenum pname, GLfloat param );
+GLAPI void GLAPIENTRY glLighti( GLenum light, GLenum pname, GLint param );
+GLAPI void GLAPIENTRY glLightfv( GLenum light, GLenum pname,
+ const GLfloat *params );
+GLAPI void GLAPIENTRY glLightiv( GLenum light, GLenum pname,
+ const GLint *params );
+
+GLAPI void GLAPIENTRY glGetLightfv( GLenum light, GLenum pname,
+ GLfloat *params );
+GLAPI void GLAPIENTRY glGetLightiv( GLenum light, GLenum pname,
+ GLint *params );
+
+GLAPI void GLAPIENTRY glLightModelf( GLenum pname, GLfloat param );
+GLAPI void GLAPIENTRY glLightModeli( GLenum pname, GLint param );
+GLAPI void GLAPIENTRY glLightModelfv( GLenum pname, const GLfloat *params );
+GLAPI void GLAPIENTRY glLightModeliv( GLenum pname, const GLint *params );
+
+GLAPI void GLAPIENTRY glMaterialf( GLenum face, GLenum pname, GLfloat param );
+GLAPI void GLAPIENTRY glMateriali( GLenum face, GLenum pname, GLint param );
+GLAPI void GLAPIENTRY glMaterialfv( GLenum face, GLenum pname, const GLfloat *params );
+GLAPI void GLAPIENTRY glMaterialiv( GLenum face, GLenum pname, const GLint *params );
+
+GLAPI void GLAPIENTRY glGetMaterialfv( GLenum face, GLenum pname, GLfloat *params );
+GLAPI void GLAPIENTRY glGetMaterialiv( GLenum face, GLenum pname, GLint *params );
+
+GLAPI void GLAPIENTRY glColorMaterial( GLenum face, GLenum mode );
+
+
+/*
+ * Raster functions
+ */
+
+GLAPI void GLAPIENTRY glPixelZoom( GLfloat xfactor, GLfloat yfactor );
+
+GLAPI void GLAPIENTRY glPixelStoref( GLenum pname, GLfloat param );
+GLAPI void GLAPIENTRY glPixelStorei( GLenum pname, GLint param );
+
+GLAPI void GLAPIENTRY glPixelTransferf( GLenum pname, GLfloat param );
+GLAPI void GLAPIENTRY glPixelTransferi( GLenum pname, GLint param );
+
+GLAPI void GLAPIENTRY glPixelMapfv( GLenum map, GLsizei mapsize,
+ const GLfloat *values );
+GLAPI void GLAPIENTRY glPixelMapuiv( GLenum map, GLsizei mapsize,
+ const GLuint *values );
+GLAPI void GLAPIENTRY glPixelMapusv( GLenum map, GLsizei mapsize,
+ const GLushort *values );
+
+GLAPI void GLAPIENTRY glGetPixelMapfv( GLenum map, GLfloat *values );
+GLAPI void GLAPIENTRY glGetPixelMapuiv( GLenum map, GLuint *values );
+GLAPI void GLAPIENTRY glGetPixelMapusv( GLenum map, GLushort *values );
+
+GLAPI void GLAPIENTRY glBitmap( GLsizei width, GLsizei height,
+ GLfloat xorig, GLfloat yorig,
+ GLfloat xmove, GLfloat ymove,
+ const GLubyte *bitmap );
+
+GLAPI void GLAPIENTRY glReadPixels( GLint x, GLint y,
+ GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ GLvoid *pixels );
+
+GLAPI void GLAPIENTRY glDrawPixels( GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const GLvoid *pixels );
+
+GLAPI void GLAPIENTRY glCopyPixels( GLint x, GLint y,
+ GLsizei width, GLsizei height,
+ GLenum type );
+
+/*
+ * Stenciling
+ */
+
+GLAPI void GLAPIENTRY glStencilFunc( GLenum func, GLint ref, GLuint mask );
+
+GLAPI void GLAPIENTRY glStencilMask( GLuint mask );
+
+GLAPI void GLAPIENTRY glStencilOp( GLenum fail, GLenum zfail, GLenum zpass );
+
+GLAPI void GLAPIENTRY glClearStencil( GLint s );
+
+
+
+/*
+ * Texture mapping
+ */
+
+GLAPI void GLAPIENTRY glTexGend( GLenum coord, GLenum pname, GLdouble param );
+GLAPI void GLAPIENTRY glTexGenf( GLenum coord, GLenum pname, GLfloat param );
+GLAPI void GLAPIENTRY glTexGeni( GLenum coord, GLenum pname, GLint param );
+
+GLAPI void GLAPIENTRY glTexGendv( GLenum coord, GLenum pname, const GLdouble *params );
+GLAPI void GLAPIENTRY glTexGenfv( GLenum coord, GLenum pname, const GLfloat *params );
+GLAPI void GLAPIENTRY glTexGeniv( GLenum coord, GLenum pname, const GLint *params );
+
+GLAPI void GLAPIENTRY glGetTexGendv( GLenum coord, GLenum pname, GLdouble *params );
+GLAPI void GLAPIENTRY glGetTexGenfv( GLenum coord, GLenum pname, GLfloat *params );
+GLAPI void GLAPIENTRY glGetTexGeniv( GLenum coord, GLenum pname, GLint *params );
+
+
+GLAPI void GLAPIENTRY glTexEnvf( GLenum target, GLenum pname, GLfloat param );
+GLAPI void GLAPIENTRY glTexEnvi( GLenum target, GLenum pname, GLint param );
+
+GLAPI void GLAPIENTRY glTexEnvfv( GLenum target, GLenum pname, const GLfloat *params );
+GLAPI void GLAPIENTRY glTexEnviv( GLenum target, GLenum pname, const GLint *params );
+
+GLAPI void GLAPIENTRY glGetTexEnvfv( GLenum target, GLenum pname, GLfloat *params );
+GLAPI void GLAPIENTRY glGetTexEnviv( GLenum target, GLenum pname, GLint *params );
+
+
+GLAPI void GLAPIENTRY glTexParameterf( GLenum target, GLenum pname, GLfloat param );
+GLAPI void GLAPIENTRY glTexParameteri( GLenum target, GLenum pname, GLint param );
+
+GLAPI void GLAPIENTRY glTexParameterfv( GLenum target, GLenum pname,
+ const GLfloat *params );
+GLAPI void GLAPIENTRY glTexParameteriv( GLenum target, GLenum pname,
+ const GLint *params );
+
+GLAPI void GLAPIENTRY glGetTexParameterfv( GLenum target,
+ GLenum pname, GLfloat *params);
+GLAPI void GLAPIENTRY glGetTexParameteriv( GLenum target,
+ GLenum pname, GLint *params );
+
+GLAPI void GLAPIENTRY glGetTexLevelParameterfv( GLenum target, GLint level,
+ GLenum pname, GLfloat *params );
+GLAPI void GLAPIENTRY glGetTexLevelParameteriv( GLenum target, GLint level,
+ GLenum pname, GLint *params );
+
+
+GLAPI void GLAPIENTRY glTexImage1D( GLenum target, GLint level,
+ GLint internalFormat,
+ GLsizei width, GLint border,
+ GLenum format, GLenum type,
+ const GLvoid *pixels );
+
+GLAPI void GLAPIENTRY glTexImage2D( GLenum target, GLint level,
+ GLint internalFormat,
+ GLsizei width, GLsizei height,
+ GLint border, GLenum format, GLenum type,
+ const GLvoid *pixels );
+
+GLAPI void GLAPIENTRY glGetTexImage( GLenum target, GLint level,
+ GLenum format, GLenum type,
+ GLvoid *pixels );
+
+
+/* 1.1 functions */
+
+GLAPI void GLAPIENTRY glGenTextures( GLsizei n, GLuint *textures );
+
+GLAPI void GLAPIENTRY glDeleteTextures( GLsizei n, const GLuint *textures);
+
+GLAPI void GLAPIENTRY glBindTexture( GLenum target, GLuint texture );
+
+GLAPI void GLAPIENTRY glPrioritizeTextures( GLsizei n,
+ const GLuint *textures,
+ const GLclampf *priorities );
+
+GLAPI GLboolean GLAPIENTRY glAreTexturesResident( GLsizei n,
+ const GLuint *textures,
+ GLboolean *residences );
+
+GLAPI GLboolean GLAPIENTRY glIsTexture( GLuint texture );
+
+
+GLAPI void GLAPIENTRY glTexSubImage1D( GLenum target, GLint level,
+ GLint xoffset,
+ GLsizei width, GLenum format,
+ GLenum type, const GLvoid *pixels );
+
+
+GLAPI void GLAPIENTRY glTexSubImage2D( GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const GLvoid *pixels );
+
+
+GLAPI void GLAPIENTRY glCopyTexImage1D( GLenum target, GLint level,
+ GLenum internalformat,
+ GLint x, GLint y,
+ GLsizei width, GLint border );
+
+
+GLAPI void GLAPIENTRY glCopyTexImage2D( GLenum target, GLint level,
+ GLenum internalformat,
+ GLint x, GLint y,
+ GLsizei width, GLsizei height,
+ GLint border );
+
+
+GLAPI void GLAPIENTRY glCopyTexSubImage1D( GLenum target, GLint level,
+ GLint xoffset, GLint x, GLint y,
+ GLsizei width );
+
+
+GLAPI void GLAPIENTRY glCopyTexSubImage2D( GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLint x, GLint y,
+ GLsizei width, GLsizei height );
+
+
+/*
+ * Evaluators
+ */
+
+GLAPI void GLAPIENTRY glMap1d( GLenum target, GLdouble u1, GLdouble u2,
+ GLint stride,
+ GLint order, const GLdouble *points );
+GLAPI void GLAPIENTRY glMap1f( GLenum target, GLfloat u1, GLfloat u2,
+ GLint stride,
+ GLint order, const GLfloat *points );
+
+GLAPI void GLAPIENTRY glMap2d( GLenum target,
+ GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
+ GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
+ const GLdouble *points );
+GLAPI void GLAPIENTRY glMap2f( GLenum target,
+ GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
+ GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
+ const GLfloat *points );
+
+GLAPI void GLAPIENTRY glGetMapdv( GLenum target, GLenum query, GLdouble *v );
+GLAPI void GLAPIENTRY glGetMapfv( GLenum target, GLenum query, GLfloat *v );
+GLAPI void GLAPIENTRY glGetMapiv( GLenum target, GLenum query, GLint *v );
+
+GLAPI void GLAPIENTRY glEvalCoord1d( GLdouble u );
+GLAPI void GLAPIENTRY glEvalCoord1f( GLfloat u );
+
+GLAPI void GLAPIENTRY glEvalCoord1dv( const GLdouble *u );
+GLAPI void GLAPIENTRY glEvalCoord1fv( const GLfloat *u );
+
+GLAPI void GLAPIENTRY glEvalCoord2d( GLdouble u, GLdouble v );
+GLAPI void GLAPIENTRY glEvalCoord2f( GLfloat u, GLfloat v );
+
+GLAPI void GLAPIENTRY glEvalCoord2dv( const GLdouble *u );
+GLAPI void GLAPIENTRY glEvalCoord2fv( const GLfloat *u );
+
+GLAPI void GLAPIENTRY glMapGrid1d( GLint un, GLdouble u1, GLdouble u2 );
+GLAPI void GLAPIENTRY glMapGrid1f( GLint un, GLfloat u1, GLfloat u2 );
+
+GLAPI void GLAPIENTRY glMapGrid2d( GLint un, GLdouble u1, GLdouble u2,
+ GLint vn, GLdouble v1, GLdouble v2 );
+GLAPI void GLAPIENTRY glMapGrid2f( GLint un, GLfloat u1, GLfloat u2,
+ GLint vn, GLfloat v1, GLfloat v2 );
+
+GLAPI void GLAPIENTRY glEvalPoint1( GLint i );
+
+GLAPI void GLAPIENTRY glEvalPoint2( GLint i, GLint j );
+
+GLAPI void GLAPIENTRY glEvalMesh1( GLenum mode, GLint i1, GLint i2 );
+
+GLAPI void GLAPIENTRY glEvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 );
+
+
+/*
+ * Fog
+ */
+
+GLAPI void GLAPIENTRY glFogf( GLenum pname, GLfloat param );
+
+GLAPI void GLAPIENTRY glFogi( GLenum pname, GLint param );
+
+GLAPI void GLAPIENTRY glFogfv( GLenum pname, const GLfloat *params );
+
+GLAPI void GLAPIENTRY glFogiv( GLenum pname, const GLint *params );
+
+
+/*
+ * Selection and Feedback
+ */
+
+GLAPI void GLAPIENTRY glFeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer );
+
+GLAPI void GLAPIENTRY glPassThrough( GLfloat token );
+
+GLAPI void GLAPIENTRY glSelectBuffer( GLsizei size, GLuint *buffer );
+
+GLAPI void GLAPIENTRY glInitNames( void );
+
+GLAPI void GLAPIENTRY glLoadName( GLuint name );
+
+GLAPI void GLAPIENTRY glPushName( GLuint name );
+
+GLAPI void GLAPIENTRY glPopName( void );
+
+
+
+/*
+ * OpenGL 1.2
+ */
+
+#define GL_RESCALE_NORMAL 0x803A
+#define GL_CLAMP_TO_EDGE 0x812F
+#define GL_MAX_ELEMENTS_VERTICES 0x80E8
+#define GL_MAX_ELEMENTS_INDICES 0x80E9
+#define GL_BGR 0x80E0
+#define GL_BGRA 0x80E1
+#define GL_UNSIGNED_BYTE_3_3_2 0x8032
+#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362
+#define GL_UNSIGNED_SHORT_5_6_5 0x8363
+#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364
+#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
+#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365
+#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
+#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366
+#define GL_UNSIGNED_INT_8_8_8_8 0x8035
+#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367
+#define GL_UNSIGNED_INT_10_10_10_2 0x8036
+#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
+#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8
+#define GL_SINGLE_COLOR 0x81F9
+#define GL_SEPARATE_SPECULAR_COLOR 0x81FA
+#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_SMOOTH_POINT_SIZE_RANGE 0x0B12
+#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13
+#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
+#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23
+#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
+#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
+#define GL_PACK_SKIP_IMAGES 0x806B
+#define GL_PACK_IMAGE_HEIGHT 0x806C
+#define GL_UNPACK_SKIP_IMAGES 0x806D
+#define GL_UNPACK_IMAGE_HEIGHT 0x806E
+#define GL_TEXTURE_3D 0x806F
+#define GL_PROXY_TEXTURE_3D 0x8070
+#define GL_TEXTURE_DEPTH 0x8071
+#define GL_TEXTURE_WRAP_R 0x8072
+#define GL_MAX_3D_TEXTURE_SIZE 0x8073
+#define GL_TEXTURE_BINDING_3D 0x806A
+
+GLAPI void GLAPIENTRY glDrawRangeElements( GLenum mode, GLuint start,
+ GLuint end, GLsizei count, GLenum type, const GLvoid *indices );
+
+GLAPI void GLAPIENTRY glTexImage3D( GLenum target, GLint level,
+ GLint internalFormat,
+ GLsizei width, GLsizei height,
+ GLsizei depth, GLint border,
+ GLenum format, GLenum type,
+ const GLvoid *pixels );
+
+GLAPI void GLAPIENTRY glTexSubImage3D( GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLint zoffset, GLsizei width,
+ GLsizei height, GLsizei depth,
+ GLenum format,
+ GLenum type, const GLvoid *pixels);
+
+GLAPI void GLAPIENTRY glCopyTexSubImage3D( GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLint zoffset, GLint x,
+ GLint y, GLsizei width,
+ GLsizei height );
+
+typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
+typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+
+
+/*
+ * GL_ARB_imaging
+ */
+
+#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_COLOR_TABLE 0x80D0
+#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1
+#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2
+#define GL_PROXY_COLOR_TABLE 0x80D3
+#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4
+#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5
+#define GL_COLOR_TABLE_SCALE 0x80D6
+#define GL_COLOR_TABLE_BIAS 0x80D7
+#define GL_COLOR_TABLE_FORMAT 0x80D8
+#define GL_COLOR_TABLE_WIDTH 0x80D9
+#define GL_COLOR_TABLE_RED_SIZE 0x80DA
+#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB
+#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC
+#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD
+#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE
+#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF
+#define GL_CONVOLUTION_1D 0x8010
+#define GL_CONVOLUTION_2D 0x8011
+#define GL_SEPARABLE_2D 0x8012
+#define GL_CONVOLUTION_BORDER_MODE 0x8013
+#define GL_CONVOLUTION_FILTER_SCALE 0x8014
+#define GL_CONVOLUTION_FILTER_BIAS 0x8015
+#define GL_REDUCE 0x8016
+#define GL_CONVOLUTION_FORMAT 0x8017
+#define GL_CONVOLUTION_WIDTH 0x8018
+#define GL_CONVOLUTION_HEIGHT 0x8019
+#define GL_MAX_CONVOLUTION_WIDTH 0x801A
+#define GL_MAX_CONVOLUTION_HEIGHT 0x801B
+#define GL_POST_CONVOLUTION_RED_SCALE 0x801C
+#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D
+#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E
+#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F
+#define GL_POST_CONVOLUTION_RED_BIAS 0x8020
+#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021
+#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022
+#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023
+#define GL_CONSTANT_BORDER 0x8151
+#define GL_REPLICATE_BORDER 0x8153
+#define GL_CONVOLUTION_BORDER_COLOR 0x8154
+#define GL_COLOR_MATRIX 0x80B1
+#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2
+#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3
+#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4
+#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5
+#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6
+#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7
+#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8
+#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9
+#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA
+#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB
+#define GL_HISTOGRAM 0x8024
+#define GL_PROXY_HISTOGRAM 0x8025
+#define GL_HISTOGRAM_WIDTH 0x8026
+#define GL_HISTOGRAM_FORMAT 0x8027
+#define GL_HISTOGRAM_RED_SIZE 0x8028
+#define GL_HISTOGRAM_GREEN_SIZE 0x8029
+#define GL_HISTOGRAM_BLUE_SIZE 0x802A
+#define GL_HISTOGRAM_ALPHA_SIZE 0x802B
+#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C
+#define GL_HISTOGRAM_SINK 0x802D
+#define GL_MINMAX 0x802E
+#define GL_MINMAX_FORMAT 0x802F
+#define GL_MINMAX_SINK 0x8030
+#define GL_TABLE_TOO_LARGE 0x8031
+#define GL_BLEND_EQUATION 0x8009
+#define GL_MIN 0x8007
+#define GL_MAX 0x8008
+#define GL_FUNC_ADD 0x8006
+#define GL_FUNC_SUBTRACT 0x800A
+#define GL_FUNC_REVERSE_SUBTRACT 0x800B
+#define GL_BLEND_COLOR 0x8005
+
+
+GLAPI void GLAPIENTRY glColorTable( GLenum target, GLenum internalformat,
+ GLsizei width, GLenum format,
+ GLenum type, const GLvoid *table );
+
+GLAPI void GLAPIENTRY glColorSubTable( GLenum target,
+ GLsizei start, GLsizei count,
+ GLenum format, GLenum type,
+ const GLvoid *data );
+
+GLAPI void GLAPIENTRY glColorTableParameteriv(GLenum target, GLenum pname,
+ const GLint *params);
+
+GLAPI void GLAPIENTRY glColorTableParameterfv(GLenum target, GLenum pname,
+ const GLfloat *params);
+
+GLAPI void GLAPIENTRY glCopyColorSubTable( GLenum target, GLsizei start,
+ GLint x, GLint y, GLsizei width );
+
+GLAPI void GLAPIENTRY glCopyColorTable( GLenum target, GLenum internalformat,
+ GLint x, GLint y, GLsizei width );
+
+GLAPI void GLAPIENTRY glGetColorTable( GLenum target, GLenum format,
+ GLenum type, GLvoid *table );
+
+GLAPI void GLAPIENTRY glGetColorTableParameterfv( GLenum target, GLenum pname,
+ GLfloat *params );
+
+GLAPI void GLAPIENTRY glGetColorTableParameteriv( GLenum target, GLenum pname,
+ GLint *params );
+
+GLAPI void GLAPIENTRY glBlendEquation( GLenum mode );
+
+GLAPI void GLAPIENTRY glBlendColor( GLclampf red, GLclampf green,
+ GLclampf blue, GLclampf alpha );
+
+GLAPI void GLAPIENTRY glHistogram( GLenum target, GLsizei width,
+ GLenum internalformat, GLboolean sink );
+
+GLAPI void GLAPIENTRY glResetHistogram( GLenum target );
+
+GLAPI void GLAPIENTRY glGetHistogram( GLenum target, GLboolean reset,
+ GLenum format, GLenum type,
+ GLvoid *values );
+
+GLAPI void GLAPIENTRY glGetHistogramParameterfv( GLenum target, GLenum pname,
+ GLfloat *params );
+
+GLAPI void GLAPIENTRY glGetHistogramParameteriv( GLenum target, GLenum pname,
+ GLint *params );
+
+GLAPI void GLAPIENTRY glMinmax( GLenum target, GLenum internalformat,
+ GLboolean sink );
+
+GLAPI void GLAPIENTRY glResetMinmax( GLenum target );
+
+GLAPI void GLAPIENTRY glGetMinmax( GLenum target, GLboolean reset,
+ GLenum format, GLenum types,
+ GLvoid *values );
+
+GLAPI void GLAPIENTRY glGetMinmaxParameterfv( GLenum target, GLenum pname,
+ GLfloat *params );
+
+GLAPI void GLAPIENTRY glGetMinmaxParameteriv( GLenum target, GLenum pname,
+ GLint *params );
+
+GLAPI void GLAPIENTRY glConvolutionFilter1D( GLenum target,
+ GLenum internalformat, GLsizei width, GLenum format, GLenum type,
+ const GLvoid *image );
+
+GLAPI void GLAPIENTRY glConvolutionFilter2D( GLenum target,
+ GLenum internalformat, GLsizei width, GLsizei height, GLenum format,
+ GLenum type, const GLvoid *image );
+
+GLAPI void GLAPIENTRY glConvolutionParameterf( GLenum target, GLenum pname,
+ GLfloat params );
+
+GLAPI void GLAPIENTRY glConvolutionParameterfv( GLenum target, GLenum pname,
+ const GLfloat *params );
+
+GLAPI void GLAPIENTRY glConvolutionParameteri( GLenum target, GLenum pname,
+ GLint params );
+
+GLAPI void GLAPIENTRY glConvolutionParameteriv( GLenum target, GLenum pname,
+ const GLint *params );
+
+GLAPI void GLAPIENTRY glCopyConvolutionFilter1D( GLenum target,
+ GLenum internalformat, GLint x, GLint y, GLsizei width );
+
+GLAPI void GLAPIENTRY glCopyConvolutionFilter2D( GLenum target,
+ GLenum internalformat, GLint x, GLint y, GLsizei width,
+ GLsizei height);
+
+GLAPI void GLAPIENTRY glGetConvolutionFilter( GLenum target, GLenum format,
+ GLenum type, GLvoid *image );
+
+GLAPI void GLAPIENTRY glGetConvolutionParameterfv( GLenum target, GLenum pname,
+ GLfloat *params );
+
+GLAPI void GLAPIENTRY glGetConvolutionParameteriv( GLenum target, GLenum pname,
+ GLint *params );
+
+GLAPI void GLAPIENTRY glSeparableFilter2D( GLenum target,
+ GLenum internalformat, GLsizei width, GLsizei height, GLenum format,
+ GLenum type, const GLvoid *row, const GLvoid *column );
+
+GLAPI void GLAPIENTRY glGetSeparableFilter( GLenum target, GLenum format,
+ GLenum type, GLvoid *row, GLvoid *column, GLvoid *span );
+
+typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
+
+
+
+/*
+ * OpenGL 1.3
+ */
+
+/* multitexture */
+#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
+#define GL_MAX_TEXTURE_UNITS 0x84E2
+/* texture_cube_map */
+#define GL_NORMAL_MAP 0x8511
+#define GL_REFLECTION_MAP 0x8512
+#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_PROXY_TEXTURE_CUBE_MAP 0x851B
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
+/* texture_compression */
+#define GL_COMPRESSED_ALPHA 0x84E9
+#define GL_COMPRESSED_LUMINANCE 0x84EA
+#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB
+#define GL_COMPRESSED_INTENSITY 0x84EC
+#define GL_COMPRESSED_RGB 0x84ED
+#define GL_COMPRESSED_RGBA 0x84EE
+#define GL_TEXTURE_COMPRESSION_HINT 0x84EF
+#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0
+#define GL_TEXTURE_COMPRESSED 0x86A1
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
+/* multisample */
+#define GL_MULTISAMPLE 0x809D
+#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
+#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
+#define GL_SAMPLE_COVERAGE 0x80A0
+#define GL_SAMPLE_BUFFERS 0x80A8
+#define GL_SAMPLES 0x80A9
+#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
+#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
+#define GL_MULTISAMPLE_BIT 0x20000000
+/* transpose_matrix */
+#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3
+#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4
+#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5
+#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6
+/* texture_env_combine */
+#define GL_COMBINE 0x8570
+#define GL_COMBINE_RGB 0x8571
+#define GL_COMBINE_ALPHA 0x8572
+#define GL_SOURCE0_RGB 0x8580
+#define GL_SOURCE1_RGB 0x8581
+#define GL_SOURCE2_RGB 0x8582
+#define GL_SOURCE0_ALPHA 0x8588
+#define GL_SOURCE1_ALPHA 0x8589
+#define GL_SOURCE2_ALPHA 0x858A
+#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_RGB_SCALE 0x8573
+#define GL_ADD_SIGNED 0x8574
+#define GL_INTERPOLATE 0x8575
+#define GL_SUBTRACT 0x84E7
+#define GL_CONSTANT 0x8576
+#define GL_PRIMARY_COLOR 0x8577
+#define GL_PREVIOUS 0x8578
+/* texture_env_dot3 */
+#define GL_DOT3_RGB 0x86AE
+#define GL_DOT3_RGBA 0x86AF
+/* texture_border_clamp */
+#define GL_CLAMP_TO_BORDER 0x812D
+
+GLAPI void GLAPIENTRY glActiveTexture( GLenum texture );
+
+GLAPI void GLAPIENTRY glClientActiveTexture( GLenum texture );
+
+GLAPI void GLAPIENTRY glCompressedTexImage1D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data );
+
+GLAPI void GLAPIENTRY glCompressedTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data );
+
+GLAPI void GLAPIENTRY glCompressedTexImage3D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data );
+
+GLAPI void GLAPIENTRY glCompressedTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data );
+
+GLAPI void GLAPIENTRY glCompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data );
+
+GLAPI void GLAPIENTRY glCompressedTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data );
+
+GLAPI void GLAPIENTRY glGetCompressedTexImage( GLenum target, GLint lod, GLvoid *img );
+
+GLAPI void GLAPIENTRY glMultiTexCoord1d( GLenum target, GLdouble s );
+
+GLAPI void GLAPIENTRY glMultiTexCoord1dv( GLenum target, const GLdouble *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord1f( GLenum target, GLfloat s );
+
+GLAPI void GLAPIENTRY glMultiTexCoord1fv( GLenum target, const GLfloat *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord1i( GLenum target, GLint s );
+
+GLAPI void GLAPIENTRY glMultiTexCoord1iv( GLenum target, const GLint *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord1s( GLenum target, GLshort s );
+
+GLAPI void GLAPIENTRY glMultiTexCoord1sv( GLenum target, const GLshort *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord2d( GLenum target, GLdouble s, GLdouble t );
+
+GLAPI void GLAPIENTRY glMultiTexCoord2dv( GLenum target, const GLdouble *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord2f( GLenum target, GLfloat s, GLfloat t );
+
+GLAPI void GLAPIENTRY glMultiTexCoord2fv( GLenum target, const GLfloat *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord2i( GLenum target, GLint s, GLint t );
+
+GLAPI void GLAPIENTRY glMultiTexCoord2iv( GLenum target, const GLint *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord2s( GLenum target, GLshort s, GLshort t );
+
+GLAPI void GLAPIENTRY glMultiTexCoord2sv( GLenum target, const GLshort *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord3d( GLenum target, GLdouble s, GLdouble t, GLdouble r );
+
+GLAPI void GLAPIENTRY glMultiTexCoord3dv( GLenum target, const GLdouble *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord3f( GLenum target, GLfloat s, GLfloat t, GLfloat r );
+
+GLAPI void GLAPIENTRY glMultiTexCoord3fv( GLenum target, const GLfloat *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord3i( GLenum target, GLint s, GLint t, GLint r );
+
+GLAPI void GLAPIENTRY glMultiTexCoord3iv( GLenum target, const GLint *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord3s( GLenum target, GLshort s, GLshort t, GLshort r );
+
+GLAPI void GLAPIENTRY glMultiTexCoord3sv( GLenum target, const GLshort *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord4d( GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q );
+
+GLAPI void GLAPIENTRY glMultiTexCoord4dv( GLenum target, const GLdouble *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord4f( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q );
+
+GLAPI void GLAPIENTRY glMultiTexCoord4fv( GLenum target, const GLfloat *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord4i( GLenum target, GLint s, GLint t, GLint r, GLint q );
+
+GLAPI void GLAPIENTRY glMultiTexCoord4iv( GLenum target, const GLint *v );
+
+GLAPI void GLAPIENTRY glMultiTexCoord4s( GLenum target, GLshort s, GLshort t, GLshort r, GLshort q );
+
+GLAPI void GLAPIENTRY glMultiTexCoord4sv( GLenum target, const GLshort *v );
+
+
+GLAPI void GLAPIENTRY glLoadTransposeMatrixd( const GLdouble m[16] );
+
+GLAPI void GLAPIENTRY glLoadTransposeMatrixf( const GLfloat m[16] );
+
+GLAPI void GLAPIENTRY glMultTransposeMatrixd( const GLdouble m[16] );
+
+GLAPI void GLAPIENTRY glMultTransposeMatrixf( const GLfloat m[16] );
+
+GLAPI void GLAPIENTRY glSampleCoverage( GLclampf value, GLboolean invert );
+
+
+typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
+typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img);
+
+
+
+/*
+ * GL_ARB_multitexture (ARB extension 1 and OpenGL 1.2.1)
+ */
+#ifndef GL_ARB_multitexture
+#define GL_ARB_multitexture 1
+
+#define GL_TEXTURE0_ARB 0x84C0
+#define GL_TEXTURE1_ARB 0x84C1
+#define GL_TEXTURE2_ARB 0x84C2
+#define GL_TEXTURE3_ARB 0x84C3
+#define GL_TEXTURE4_ARB 0x84C4
+#define GL_TEXTURE5_ARB 0x84C5
+#define GL_TEXTURE6_ARB 0x84C6
+#define GL_TEXTURE7_ARB 0x84C7
+#define GL_TEXTURE8_ARB 0x84C8
+#define GL_TEXTURE9_ARB 0x84C9
+#define GL_TEXTURE10_ARB 0x84CA
+#define GL_TEXTURE11_ARB 0x84CB
+#define GL_TEXTURE12_ARB 0x84CC
+#define GL_TEXTURE13_ARB 0x84CD
+#define GL_TEXTURE14_ARB 0x84CE
+#define GL_TEXTURE15_ARB 0x84CF
+#define GL_TEXTURE16_ARB 0x84D0
+#define GL_TEXTURE17_ARB 0x84D1
+#define GL_TEXTURE18_ARB 0x84D2
+#define GL_TEXTURE19_ARB 0x84D3
+#define GL_TEXTURE20_ARB 0x84D4
+#define GL_TEXTURE21_ARB 0x84D5
+#define GL_TEXTURE22_ARB 0x84D6
+#define GL_TEXTURE23_ARB 0x84D7
+#define GL_TEXTURE24_ARB 0x84D8
+#define GL_TEXTURE25_ARB 0x84D9
+#define GL_TEXTURE26_ARB 0x84DA
+#define GL_TEXTURE27_ARB 0x84DB
+#define GL_TEXTURE28_ARB 0x84DC
+#define GL_TEXTURE29_ARB 0x84DD
+#define GL_TEXTURE30_ARB 0x84DE
+#define GL_TEXTURE31_ARB 0x84DF
+#define GL_ACTIVE_TEXTURE_ARB 0x84E0
+#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1
+#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2
+
+GLAPI void GLAPIENTRY glActiveTextureARB(GLenum texture);
+GLAPI void GLAPIENTRY glClientActiveTextureARB(GLenum texture);
+GLAPI void GLAPIENTRY glMultiTexCoord1dARB(GLenum target, GLdouble s);
+GLAPI void GLAPIENTRY glMultiTexCoord1dvARB(GLenum target, const GLdouble *v);
+GLAPI void GLAPIENTRY glMultiTexCoord1fARB(GLenum target, GLfloat s);
+GLAPI void GLAPIENTRY glMultiTexCoord1fvARB(GLenum target, const GLfloat *v);
+GLAPI void GLAPIENTRY glMultiTexCoord1iARB(GLenum target, GLint s);
+GLAPI void GLAPIENTRY glMultiTexCoord1ivARB(GLenum target, const GLint *v);
+GLAPI void GLAPIENTRY glMultiTexCoord1sARB(GLenum target, GLshort s);
+GLAPI void GLAPIENTRY glMultiTexCoord1svARB(GLenum target, const GLshort *v);
+GLAPI void GLAPIENTRY glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t);
+GLAPI void GLAPIENTRY glMultiTexCoord2dvARB(GLenum target, const GLdouble *v);
+GLAPI void GLAPIENTRY glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t);
+GLAPI void GLAPIENTRY glMultiTexCoord2fvARB(GLenum target, const GLfloat *v);
+GLAPI void GLAPIENTRY glMultiTexCoord2iARB(GLenum target, GLint s, GLint t);
+GLAPI void GLAPIENTRY glMultiTexCoord2ivARB(GLenum target, const GLint *v);
+GLAPI void GLAPIENTRY glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t);
+GLAPI void GLAPIENTRY glMultiTexCoord2svARB(GLenum target, const GLshort *v);
+GLAPI void GLAPIENTRY glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r);
+GLAPI void GLAPIENTRY glMultiTexCoord3dvARB(GLenum target, const GLdouble *v);
+GLAPI void GLAPIENTRY glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r);
+GLAPI void GLAPIENTRY glMultiTexCoord3fvARB(GLenum target, const GLfloat *v);
+GLAPI void GLAPIENTRY glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r);
+GLAPI void GLAPIENTRY glMultiTexCoord3ivARB(GLenum target, const GLint *v);
+GLAPI void GLAPIENTRY glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r);
+GLAPI void GLAPIENTRY glMultiTexCoord3svARB(GLenum target, const GLshort *v);
+GLAPI void GLAPIENTRY glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
+GLAPI void GLAPIENTRY glMultiTexCoord4dvARB(GLenum target, const GLdouble *v);
+GLAPI void GLAPIENTRY glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
+GLAPI void GLAPIENTRY glMultiTexCoord4fvARB(GLenum target, const GLfloat *v);
+GLAPI void GLAPIENTRY glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q);
+GLAPI void GLAPIENTRY glMultiTexCoord4ivARB(GLenum target, const GLint *v);
+GLAPI void GLAPIENTRY glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
+GLAPI void GLAPIENTRY glMultiTexCoord4svARB(GLenum target, const GLshort *v);
+
+typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture);
+typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v);
+
+#endif /* GL_ARB_multitexture */
+
+
+
+/*
+ * Define this token if you want "old-style" header file behaviour (extensions
+ * defined in gl.h). Otherwise, extensions will be included from glext.h.
+ */
+#if defined(GL_GLEXT_LEGACY)
+
+/* All extensions that used to be here are now found in glext.h */
+
+#else /* GL_GLEXT_LEGACY */
+
+#include <GL/glext.h>
+
+#endif /* GL_GLEXT_LEGACY */
+
+
+
+#if GL_ARB_shader_objects
+
+#ifndef GL_MESA_shader_debug
+#define GL_MESA_shader_debug 1
+
+#define GL_DEBUG_OBJECT_MESA 0x8759
+#define GL_DEBUG_PRINT_MESA 0x875A
+#define GL_DEBUG_ASSERT_MESA 0x875B
+
+GLAPI GLhandleARB GLAPIENTRY glCreateDebugObjectMESA (void);
+GLAPI void GLAPIENTRY glClearDebugLogMESA (GLhandleARB obj, GLenum logType, GLenum shaderType);
+GLAPI void GLAPIENTRY glGetDebugLogMESA (GLhandleARB obj, GLenum logType, GLenum shaderType, GLsizei maxLength,
+ GLsizei *length, GLcharARB *debugLog);
+GLAPI GLsizei GLAPIENTRY glGetDebugLogLengthMESA (GLhandleARB obj, GLenum logType, GLenum shaderType);
+
+#endif /* GL_MESA_shader_debug */
+
+#endif /* GL_ARB_shader_objects */
+
+
+/*
+ * ???. GL_MESA_packed_depth_stencil
+ * XXX obsolete
+ */
+#ifndef GL_MESA_packed_depth_stencil
+#define GL_MESA_packed_depth_stencil 1
+
+#define GL_DEPTH_STENCIL_MESA 0x8750
+#define GL_UNSIGNED_INT_24_8_MESA 0x8751
+#define GL_UNSIGNED_INT_8_24_REV_MESA 0x8752
+#define GL_UNSIGNED_SHORT_15_1_MESA 0x8753
+#define GL_UNSIGNED_SHORT_1_15_REV_MESA 0x8754
+
+#endif /* GL_MESA_packed_depth_stencil */
+
+
+#ifndef GL_MESA_program_debug
+#define GL_MESA_program_debug 1
+
+#define GL_FRAGMENT_PROGRAM_POSITION_MESA 0x8bb0
+#define GL_FRAGMENT_PROGRAM_CALLBACK_MESA 0x8bb1
+#define GL_FRAGMENT_PROGRAM_CALLBACK_FUNC_MESA 0x8bb2
+#define GL_FRAGMENT_PROGRAM_CALLBACK_DATA_MESA 0x8bb3
+#define GL_VERTEX_PROGRAM_POSITION_MESA 0x8bb4
+#define GL_VERTEX_PROGRAM_CALLBACK_MESA 0x8bb5
+#define GL_VERTEX_PROGRAM_CALLBACK_FUNC_MESA 0x8bb6
+#define GL_VERTEX_PROGRAM_CALLBACK_DATA_MESA 0x8bb7
+
+typedef void (*GLprogramcallbackMESA)(GLenum target, GLvoid *data);
+
+GLAPI void GLAPIENTRY glProgramCallbackMESA(GLenum target, GLprogramcallbackMESA callback, GLvoid *data);
+
+GLAPI void GLAPIENTRY glGetProgramRegisterfvMESA(GLenum target, GLsizei len, const GLubyte *name, GLfloat *v);
+
+#endif /* GL_MESA_program_debug */
+
+
+#ifndef GL_MESA_texture_array
+#define GL_MESA_texture_array 1
+
+/* GL_MESA_texture_array uses the same enum values as GL_EXT_texture_array.
+ */
+#ifndef GL_EXT_texture_array
+
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glFramebufferTextureLayerEXT(GLenum target,
+ GLenum attachment, GLuint texture, GLint level, GLint layer);
+#endif /* GL_GLEXT_PROTOTYPES */
+
+#if 0
+/* (temporarily) disabled because of collision with typedef in glext.h
+ * that happens if apps include both gl.h and glext.h
+ */
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target,
+ GLenum attachment, GLuint texture, GLint level, GLint layer);
+#endif
+
+#define GL_TEXTURE_1D_ARRAY_EXT 0x8C18
+#define GL_PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19
+#define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A
+#define GL_PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B
+#define GL_TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C
+#define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D
+#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4
+#endif
+
+#endif
+
+
+#ifndef GL_ATI_blend_equation_separate
+#define GL_ATI_blend_equation_separate 1
+
+#define GL_ALPHA_BLEND_EQUATION_ATI 0x883D
+
+GLAPI void GLAPIENTRY glBlendEquationSeparateATI( GLenum modeRGB, GLenum modeA );
+typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEATIPROC) (GLenum modeRGB, GLenum modeA);
+
+#endif /* GL_ATI_blend_equation_separate */
+
+
+/* GL_OES_EGL_image */
+#ifndef GL_OES_EGL_image
+typedef void* GLeglImageOES;
+#endif
+
+#ifndef GL_OES_EGL_image
+#define GL_OES_EGL_image 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image);
+GLAPI void APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image);
+#endif
+typedef void (APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
+typedef void (APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
+#endif
+
+
+/**
+ ** NOTE!!!!! If you add new functions to this file, or update
+ ** glext.h be sure to regenerate the gl_mangle.h file. See comments
+ ** in that file for details.
+ **/
+
+
+
+/**********************************************************************
+ * Begin system-specific stuff
+ */
+#if defined(PRAGMA_EXPORT_SUPPORTED)
+#pragma export off
+#endif
+
+#if defined(macintosh) && PRAGMA_IMPORT_SUPPORTED
+#pragma import off
+#endif
+/*
+ * End system-specific stuff
+ **********************************************************************/
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gl_h_ */
--- /dev/null
+#if 0
+#define GL_MANGLE_C1 "DO NOT EDIT!!! - TO REGENERATE from gl.h, EXECUTE THIS FILE IN SHELL (/bin/sh) and save the output"
+#define GL_MANGLE_C2 "This file is used to create GL function protypes and aliases for the function names"
+ files="gl.h glext.h"
+#define GL_MANGLE_C3 "get regeneration header - copy everything in this file above the 'REGENERATE_TO_END' line"
+ awk '!done; /^\/\*REGENERATE_TO_END/ {done=1}' $0
+ echo ""
+#define GL_MANGLE_C4 get aliases
+ grep '^GLAPI' $files | sed -e 's/.*ENTRY gl\([^( ]*\).*$/#define gl\1 MANGLE(\1)/' | sort | uniq
+ echo ""
+ echo "#endif /* GL_MANGLE_H */"
+ exit
+#endif /* REGENERATION */
+
+/*
+ * If you compile Mesa with USE_MGL_NAMESPACE defined then you can link
+ * your application both with OpenGL and Mesa. The Mesa functions will
+ * be redefined so they are prefixed with "mgl" instead of "gl".
+ * Mgl contributed by Randy Frank (rfrank@rsinc.com)
+ * Regneration code contributed by Ray Tice (rayt@ma.ultra.net)
+ */
+
+#ifndef GL_MANGLE_H
+#define GL_MANGLE_H
+
+#ifndef MANGLE
+#define MANGLE(x) mgl##x
+#endif /*MANGLE*/
+
+/*REGENERATE_TO_END-----------ALL LINES BELOW HERE GET REPLACED ON REGENERATION */
+
+#define glAccum MANGLE(Accum)
+#define glActiveProgramEXT MANGLE(ActiveProgramEXT)
+#define glActiveShaderProgram MANGLE(ActiveShaderProgram)
+#define glActiveStencilFaceEXT MANGLE(ActiveStencilFaceEXT)
+#define glActiveTextureARB MANGLE(ActiveTextureARB)
+#define glActiveTexture MANGLE(ActiveTexture)
+#define glActiveVaryingNV MANGLE(ActiveVaryingNV)
+#define glAlphaFragmentOp1ATI MANGLE(AlphaFragmentOp1ATI)
+#define glAlphaFragmentOp2ATI MANGLE(AlphaFragmentOp2ATI)
+#define glAlphaFragmentOp3ATI MANGLE(AlphaFragmentOp3ATI)
+#define glAlphaFunc MANGLE(AlphaFunc)
+#define glApplyTextureEXT MANGLE(ApplyTextureEXT)
+#define glAreProgramsResidentNV MANGLE(AreProgramsResidentNV)
+#define glAreTexturesResidentEXT MANGLE(AreTexturesResidentEXT)
+#define glAreTexturesResident MANGLE(AreTexturesResident)
+#define glArrayElementEXT MANGLE(ArrayElementEXT)
+#define glArrayElement MANGLE(ArrayElement)
+#define glArrayObjectATI MANGLE(ArrayObjectATI)
+#define glAsyncMarkerSGIX MANGLE(AsyncMarkerSGIX)
+#define glAttachObjectARB MANGLE(AttachObjectARB)
+#define glAttachShader MANGLE(AttachShader)
+#define glBeginConditionalRender MANGLE(BeginConditionalRender)
+#define glBeginConditionalRenderNV MANGLE(BeginConditionalRenderNV)
+#define glBeginFragmentShaderATI MANGLE(BeginFragmentShaderATI)
+#define glBegin MANGLE(Begin)
+#define glBeginOcclusionQueryNV MANGLE(BeginOcclusionQueryNV)
+#define glBeginPerfMonitorAMD MANGLE(BeginPerfMonitorAMD)
+#define glBeginQueryARB MANGLE(BeginQueryARB)
+#define glBeginQueryIndexed MANGLE(BeginQueryIndexed)
+#define glBeginQuery MANGLE(BeginQuery)
+#define glBeginTransformFeedbackEXT MANGLE(BeginTransformFeedbackEXT)
+#define glBeginTransformFeedback MANGLE(BeginTransformFeedback)
+#define glBeginTransformFeedbackNV MANGLE(BeginTransformFeedbackNV)
+#define glBeginVertexShaderEXT MANGLE(BeginVertexShaderEXT)
+#define glBeginVideoCaptureNV MANGLE(BeginVideoCaptureNV)
+#define glBindAttribLocationARB MANGLE(BindAttribLocationARB)
+#define glBindAttribLocation MANGLE(BindAttribLocation)
+#define glBindBufferARB MANGLE(BindBufferARB)
+#define glBindBufferBaseEXT MANGLE(BindBufferBaseEXT)
+#define glBindBufferBase MANGLE(BindBufferBase)
+#define glBindBufferBaseNV MANGLE(BindBufferBaseNV)
+#define glBindBuffer MANGLE(BindBuffer)
+#define glBindBufferOffsetEXT MANGLE(BindBufferOffsetEXT)
+#define glBindBufferOffsetNV MANGLE(BindBufferOffsetNV)
+#define glBindBufferRangeEXT MANGLE(BindBufferRangeEXT)
+#define glBindBufferRange MANGLE(BindBufferRange)
+#define glBindBufferRangeNV MANGLE(BindBufferRangeNV)
+#define glBindFragDataLocationEXT MANGLE(BindFragDataLocationEXT)
+#define glBindFragDataLocationIndexed MANGLE(BindFragDataLocationIndexed)
+#define glBindFragDataLocation MANGLE(BindFragDataLocation)
+#define glBindFragmentShaderATI MANGLE(BindFragmentShaderATI)
+#define glBindFramebufferEXT MANGLE(BindFramebufferEXT)
+#define glBindFramebuffer MANGLE(BindFramebuffer)
+#define glBindImageTextureEXT MANGLE(BindImageTextureEXT)
+#define glBindLightParameterEXT MANGLE(BindLightParameterEXT)
+#define glBindMaterialParameterEXT MANGLE(BindMaterialParameterEXT)
+#define glBindMultiTextureEXT MANGLE(BindMultiTextureEXT)
+#define glBindParameterEXT MANGLE(BindParameterEXT)
+#define glBindProgramARB MANGLE(BindProgramARB)
+#define glBindProgramNV MANGLE(BindProgramNV)
+#define glBindProgramPipeline MANGLE(BindProgramPipeline)
+#define glBindRenderbufferEXT MANGLE(BindRenderbufferEXT)
+#define glBindRenderbuffer MANGLE(BindRenderbuffer)
+#define glBindSampler MANGLE(BindSampler)
+#define glBindTexGenParameterEXT MANGLE(BindTexGenParameterEXT)
+#define glBindTextureEXT MANGLE(BindTextureEXT)
+#define glBindTexture MANGLE(BindTexture)
+#define glBindTextureUnitParameterEXT MANGLE(BindTextureUnitParameterEXT)
+#define glBindTransformFeedback MANGLE(BindTransformFeedback)
+#define glBindTransformFeedbackNV MANGLE(BindTransformFeedbackNV)
+#define glBindVertexArrayAPPLE MANGLE(BindVertexArrayAPPLE)
+#define glBindVertexArray MANGLE(BindVertexArray)
+#define glBindVertexShaderEXT MANGLE(BindVertexShaderEXT)
+#define glBindVideoCaptureStreamBufferNV MANGLE(BindVideoCaptureStreamBufferNV)
+#define glBindVideoCaptureStreamTextureNV MANGLE(BindVideoCaptureStreamTextureNV)
+#define glBinormal3bEXT MANGLE(Binormal3bEXT)
+#define glBinormal3bvEXT MANGLE(Binormal3bvEXT)
+#define glBinormal3dEXT MANGLE(Binormal3dEXT)
+#define glBinormal3dvEXT MANGLE(Binormal3dvEXT)
+#define glBinormal3fEXT MANGLE(Binormal3fEXT)
+#define glBinormal3fvEXT MANGLE(Binormal3fvEXT)
+#define glBinormal3iEXT MANGLE(Binormal3iEXT)
+#define glBinormal3ivEXT MANGLE(Binormal3ivEXT)
+#define glBinormal3sEXT MANGLE(Binormal3sEXT)
+#define glBinormal3svEXT MANGLE(Binormal3svEXT)
+#define glBinormalPointerEXT MANGLE(BinormalPointerEXT)
+#define glBitmap MANGLE(Bitmap)
+#define glBlendColorEXT MANGLE(BlendColorEXT)
+#define glBlendColor MANGLE(BlendColor)
+#define glBlendEquationEXT MANGLE(BlendEquationEXT)
+#define glBlendEquationiARB MANGLE(BlendEquationiARB)
+#define glBlendEquationi MANGLE(BlendEquationi)
+#define glBlendEquationIndexedAMD MANGLE(BlendEquationIndexedAMD)
+#define glBlendEquation MANGLE(BlendEquation)
+#define glBlendEquationSeparateATI MANGLE(BlendEquationSeparateATI)
+#define glBlendEquationSeparateEXT MANGLE(BlendEquationSeparateEXT)
+#define glBlendEquationSeparateiARB MANGLE(BlendEquationSeparateiARB)
+#define glBlendEquationSeparatei MANGLE(BlendEquationSeparatei)
+#define glBlendEquationSeparateIndexedAMD MANGLE(BlendEquationSeparateIndexedAMD)
+#define glBlendEquationSeparate MANGLE(BlendEquationSeparate)
+#define glBlendFunciARB MANGLE(BlendFunciARB)
+#define glBlendFunci MANGLE(BlendFunci)
+#define glBlendFuncIndexedAMD MANGLE(BlendFuncIndexedAMD)
+#define glBlendFunc MANGLE(BlendFunc)
+#define glBlendFuncSeparateEXT MANGLE(BlendFuncSeparateEXT)
+#define glBlendFuncSeparateiARB MANGLE(BlendFuncSeparateiARB)
+#define glBlendFuncSeparatei MANGLE(BlendFuncSeparatei)
+#define glBlendFuncSeparateIndexedAMD MANGLE(BlendFuncSeparateIndexedAMD)
+#define glBlendFuncSeparateINGR MANGLE(BlendFuncSeparateINGR)
+#define glBlendFuncSeparate MANGLE(BlendFuncSeparate)
+#define glBlitFramebufferEXT MANGLE(BlitFramebufferEXT)
+#define glBlitFramebuffer MANGLE(BlitFramebuffer)
+#define glBufferAddressRangeNV MANGLE(BufferAddressRangeNV)
+#define glBufferDataARB MANGLE(BufferDataARB)
+#define glBufferData MANGLE(BufferData)
+#define glBufferParameteriAPPLE MANGLE(BufferParameteriAPPLE)
+#define glBufferSubDataARB MANGLE(BufferSubDataARB)
+#define glBufferSubData MANGLE(BufferSubData)
+#define glCallList MANGLE(CallList)
+#define glCallLists MANGLE(CallLists)
+#define glCheckFramebufferStatusEXT MANGLE(CheckFramebufferStatusEXT)
+#define glCheckFramebufferStatus MANGLE(CheckFramebufferStatus)
+#define glCheckNamedFramebufferStatusEXT MANGLE(CheckNamedFramebufferStatusEXT)
+#define glClampColorARB MANGLE(ClampColorARB)
+#define glClampColor MANGLE(ClampColor)
+#define glClearAccum MANGLE(ClearAccum)
+#define glClearBufferfi MANGLE(ClearBufferfi)
+#define glClearBufferfv MANGLE(ClearBufferfv)
+#define glClearBufferiv MANGLE(ClearBufferiv)
+#define glClearBufferuiv MANGLE(ClearBufferuiv)
+#define glClearColorIiEXT MANGLE(ClearColorIiEXT)
+#define glClearColorIuiEXT MANGLE(ClearColorIuiEXT)
+#define glClearColor MANGLE(ClearColor)
+#define glClearDebugLogMESA MANGLE(ClearDebugLogMESA)
+#define glClearDepthdNV MANGLE(ClearDepthdNV)
+#define glClearDepthf MANGLE(ClearDepthf)
+#define glClearDepth MANGLE(ClearDepth)
+#define glClearIndex MANGLE(ClearIndex)
+#define glClear MANGLE(Clear)
+#define glClearStencil MANGLE(ClearStencil)
+#define glClientActiveTextureARB MANGLE(ClientActiveTextureARB)
+#define glClientActiveTexture MANGLE(ClientActiveTexture)
+#define glClientActiveVertexStreamATI MANGLE(ClientActiveVertexStreamATI)
+#define glClientAttribDefaultEXT MANGLE(ClientAttribDefaultEXT)
+#define glClientWaitSync MANGLE(ClientWaitSync)
+#define glClipPlane MANGLE(ClipPlane)
+#define glColor3b MANGLE(Color3b)
+#define glColor3bv MANGLE(Color3bv)
+#define glColor3d MANGLE(Color3d)
+#define glColor3dv MANGLE(Color3dv)
+#define glColor3f MANGLE(Color3f)
+#define glColor3fVertex3fSUN MANGLE(Color3fVertex3fSUN)
+#define glColor3fVertex3fvSUN MANGLE(Color3fVertex3fvSUN)
+#define glColor3fv MANGLE(Color3fv)
+#define glColor3hNV MANGLE(Color3hNV)
+#define glColor3hvNV MANGLE(Color3hvNV)
+#define glColor3i MANGLE(Color3i)
+#define glColor3iv MANGLE(Color3iv)
+#define glColor3s MANGLE(Color3s)
+#define glColor3sv MANGLE(Color3sv)
+#define glColor3ub MANGLE(Color3ub)
+#define glColor3ubv MANGLE(Color3ubv)
+#define glColor3ui MANGLE(Color3ui)
+#define glColor3uiv MANGLE(Color3uiv)
+#define glColor3us MANGLE(Color3us)
+#define glColor3usv MANGLE(Color3usv)
+#define glColor4b MANGLE(Color4b)
+#define glColor4bv MANGLE(Color4bv)
+#define glColor4d MANGLE(Color4d)
+#define glColor4dv MANGLE(Color4dv)
+#define glColor4f MANGLE(Color4f)
+#define glColor4fNormal3fVertex3fSUN MANGLE(Color4fNormal3fVertex3fSUN)
+#define glColor4fNormal3fVertex3fvSUN MANGLE(Color4fNormal3fVertex3fvSUN)
+#define glColor4fv MANGLE(Color4fv)
+#define glColor4hNV MANGLE(Color4hNV)
+#define glColor4hvNV MANGLE(Color4hvNV)
+#define glColor4i MANGLE(Color4i)
+#define glColor4iv MANGLE(Color4iv)
+#define glColor4s MANGLE(Color4s)
+#define glColor4sv MANGLE(Color4sv)
+#define glColor4ub MANGLE(Color4ub)
+#define glColor4ubVertex2fSUN MANGLE(Color4ubVertex2fSUN)
+#define glColor4ubVertex2fvSUN MANGLE(Color4ubVertex2fvSUN)
+#define glColor4ubVertex3fSUN MANGLE(Color4ubVertex3fSUN)
+#define glColor4ubVertex3fvSUN MANGLE(Color4ubVertex3fvSUN)
+#define glColor4ubv MANGLE(Color4ubv)
+#define glColor4ui MANGLE(Color4ui)
+#define glColor4uiv MANGLE(Color4uiv)
+#define glColor4us MANGLE(Color4us)
+#define glColor4usv MANGLE(Color4usv)
+#define glColorFormatNV MANGLE(ColorFormatNV)
+#define glColorFragmentOp1ATI MANGLE(ColorFragmentOp1ATI)
+#define glColorFragmentOp2ATI MANGLE(ColorFragmentOp2ATI)
+#define glColorFragmentOp3ATI MANGLE(ColorFragmentOp3ATI)
+#define glColorMaski MANGLE(ColorMaski)
+#define glColorMaskIndexedEXT MANGLE(ColorMaskIndexedEXT)
+#define glColorMask MANGLE(ColorMask)
+#define glColorMaterial MANGLE(ColorMaterial)
+#define glColorP3ui MANGLE(ColorP3ui)
+#define glColorP3uiv MANGLE(ColorP3uiv)
+#define glColorP4ui MANGLE(ColorP4ui)
+#define glColorP4uiv MANGLE(ColorP4uiv)
+#define glColorPointerEXT MANGLE(ColorPointerEXT)
+#define glColorPointerListIBM MANGLE(ColorPointerListIBM)
+#define glColorPointer MANGLE(ColorPointer)
+#define glColorPointervINTEL MANGLE(ColorPointervINTEL)
+#define glColorSubTableEXT MANGLE(ColorSubTableEXT)
+#define glColorSubTable MANGLE(ColorSubTable)
+#define glColorTableEXT MANGLE(ColorTableEXT)
+#define glColorTable MANGLE(ColorTable)
+#define glColorTableParameterfv MANGLE(ColorTableParameterfv)
+#define glColorTableParameterfvSGI MANGLE(ColorTableParameterfvSGI)
+#define glColorTableParameteriv MANGLE(ColorTableParameteriv)
+#define glColorTableParameterivSGI MANGLE(ColorTableParameterivSGI)
+#define glColorTableSGI MANGLE(ColorTableSGI)
+#define glCombinerInputNV MANGLE(CombinerInputNV)
+#define glCombinerOutputNV MANGLE(CombinerOutputNV)
+#define glCombinerParameterfNV MANGLE(CombinerParameterfNV)
+#define glCombinerParameterfvNV MANGLE(CombinerParameterfvNV)
+#define glCombinerParameteriNV MANGLE(CombinerParameteriNV)
+#define glCombinerParameterivNV MANGLE(CombinerParameterivNV)
+#define glCombinerStageParameterfvNV MANGLE(CombinerStageParameterfvNV)
+#define glCompileShaderARB MANGLE(CompileShaderARB)
+#define glCompileShaderIncludeARB MANGLE(CompileShaderIncludeARB)
+#define glCompileShader MANGLE(CompileShader)
+#define glCompressedMultiTexImage1DEXT MANGLE(CompressedMultiTexImage1DEXT)
+#define glCompressedMultiTexImage2DEXT MANGLE(CompressedMultiTexImage2DEXT)
+#define glCompressedMultiTexImage3DEXT MANGLE(CompressedMultiTexImage3DEXT)
+#define glCompressedMultiTexSubImage1DEXT MANGLE(CompressedMultiTexSubImage1DEXT)
+#define glCompressedMultiTexSubImage2DEXT MANGLE(CompressedMultiTexSubImage2DEXT)
+#define glCompressedMultiTexSubImage3DEXT MANGLE(CompressedMultiTexSubImage3DEXT)
+#define glCompressedTexImage1DARB MANGLE(CompressedTexImage1DARB)
+#define glCompressedTexImage1D MANGLE(CompressedTexImage1D)
+#define glCompressedTexImage2DARB MANGLE(CompressedTexImage2DARB)
+#define glCompressedTexImage2D MANGLE(CompressedTexImage2D)
+#define glCompressedTexImage3DARB MANGLE(CompressedTexImage3DARB)
+#define glCompressedTexImage3D MANGLE(CompressedTexImage3D)
+#define glCompressedTexSubImage1DARB MANGLE(CompressedTexSubImage1DARB)
+#define glCompressedTexSubImage1D MANGLE(CompressedTexSubImage1D)
+#define glCompressedTexSubImage2DARB MANGLE(CompressedTexSubImage2DARB)
+#define glCompressedTexSubImage2D MANGLE(CompressedTexSubImage2D)
+#define glCompressedTexSubImage3DARB MANGLE(CompressedTexSubImage3DARB)
+#define glCompressedTexSubImage3D MANGLE(CompressedTexSubImage3D)
+#define glCompressedTextureImage1DEXT MANGLE(CompressedTextureImage1DEXT)
+#define glCompressedTextureImage2DEXT MANGLE(CompressedTextureImage2DEXT)
+#define glCompressedTextureImage3DEXT MANGLE(CompressedTextureImage3DEXT)
+#define glCompressedTextureSubImage1DEXT MANGLE(CompressedTextureSubImage1DEXT)
+#define glCompressedTextureSubImage2DEXT MANGLE(CompressedTextureSubImage2DEXT)
+#define glCompressedTextureSubImage3DEXT MANGLE(CompressedTextureSubImage3DEXT)
+#define glConvolutionFilter1DEXT MANGLE(ConvolutionFilter1DEXT)
+#define glConvolutionFilter1D MANGLE(ConvolutionFilter1D)
+#define glConvolutionFilter2DEXT MANGLE(ConvolutionFilter2DEXT)
+#define glConvolutionFilter2D MANGLE(ConvolutionFilter2D)
+#define glConvolutionParameterfEXT MANGLE(ConvolutionParameterfEXT)
+#define glConvolutionParameterf MANGLE(ConvolutionParameterf)
+#define glConvolutionParameterfvEXT MANGLE(ConvolutionParameterfvEXT)
+#define glConvolutionParameterfv MANGLE(ConvolutionParameterfv)
+#define glConvolutionParameteriEXT MANGLE(ConvolutionParameteriEXT)
+#define glConvolutionParameteri MANGLE(ConvolutionParameteri)
+#define glConvolutionParameterivEXT MANGLE(ConvolutionParameterivEXT)
+#define glConvolutionParameteriv MANGLE(ConvolutionParameteriv)
+#define glCopyBufferSubData MANGLE(CopyBufferSubData)
+#define glCopyColorSubTableEXT MANGLE(CopyColorSubTableEXT)
+#define glCopyColorSubTable MANGLE(CopyColorSubTable)
+#define glCopyColorTable MANGLE(CopyColorTable)
+#define glCopyColorTableSGI MANGLE(CopyColorTableSGI)
+#define glCopyConvolutionFilter1DEXT MANGLE(CopyConvolutionFilter1DEXT)
+#define glCopyConvolutionFilter1D MANGLE(CopyConvolutionFilter1D)
+#define glCopyConvolutionFilter2DEXT MANGLE(CopyConvolutionFilter2DEXT)
+#define glCopyConvolutionFilter2D MANGLE(CopyConvolutionFilter2D)
+#define glCopyImageSubDataNV MANGLE(CopyImageSubDataNV)
+#define glCopyMultiTexImage1DEXT MANGLE(CopyMultiTexImage1DEXT)
+#define glCopyMultiTexImage2DEXT MANGLE(CopyMultiTexImage2DEXT)
+#define glCopyMultiTexSubImage1DEXT MANGLE(CopyMultiTexSubImage1DEXT)
+#define glCopyMultiTexSubImage2DEXT MANGLE(CopyMultiTexSubImage2DEXT)
+#define glCopyMultiTexSubImage3DEXT MANGLE(CopyMultiTexSubImage3DEXT)
+#define glCopyPixels MANGLE(CopyPixels)
+#define glCopyTexImage1DEXT MANGLE(CopyTexImage1DEXT)
+#define glCopyTexImage1D MANGLE(CopyTexImage1D)
+#define glCopyTexImage2DEXT MANGLE(CopyTexImage2DEXT)
+#define glCopyTexImage2D MANGLE(CopyTexImage2D)
+#define glCopyTexSubImage1DEXT MANGLE(CopyTexSubImage1DEXT)
+#define glCopyTexSubImage1D MANGLE(CopyTexSubImage1D)
+#define glCopyTexSubImage2DEXT MANGLE(CopyTexSubImage2DEXT)
+#define glCopyTexSubImage2D MANGLE(CopyTexSubImage2D)
+#define glCopyTexSubImage3DEXT MANGLE(CopyTexSubImage3DEXT)
+#define glCopyTexSubImage3D MANGLE(CopyTexSubImage3D)
+#define glCopyTextureImage1DEXT MANGLE(CopyTextureImage1DEXT)
+#define glCopyTextureImage2DEXT MANGLE(CopyTextureImage2DEXT)
+#define glCopyTextureSubImage1DEXT MANGLE(CopyTextureSubImage1DEXT)
+#define glCopyTextureSubImage2DEXT MANGLE(CopyTextureSubImage2DEXT)
+#define glCopyTextureSubImage3DEXT MANGLE(CopyTextureSubImage3DEXT)
+#define glCreateDebugObjectMESA MANGLE(CreateDebugObjectMESA)
+#define glCreateProgram MANGLE(CreateProgram)
+#define glCreateProgramObjectARB MANGLE(CreateProgramObjectARB)
+#define glCreateShader MANGLE(CreateShader)
+#define glCreateShaderObjectARB MANGLE(CreateShaderObjectARB)
+#define glCreateShaderProgramEXT MANGLE(CreateShaderProgramEXT)
+#define glCreateShaderProgramv MANGLE(CreateShaderProgramv)
+#define glCreateSyncFromCLeventARB MANGLE(CreateSyncFromCLeventARB)
+#define glCullFace MANGLE(CullFace)
+#define glCullParameterdvEXT MANGLE(CullParameterdvEXT)
+#define glCullParameterfvEXT MANGLE(CullParameterfvEXT)
+#define glCurrentPaletteMatrixARB MANGLE(CurrentPaletteMatrixARB)
+#define glDebugMessageCallbackAMD MANGLE(DebugMessageCallbackAMD)
+#define glDebugMessageCallbackARB MANGLE(DebugMessageCallbackARB)
+#define glDebugMessageControlARB MANGLE(DebugMessageControlARB)
+#define glDebugMessageEnableAMD MANGLE(DebugMessageEnableAMD)
+#define glDebugMessageInsertAMD MANGLE(DebugMessageInsertAMD)
+#define glDebugMessageInsertARB MANGLE(DebugMessageInsertARB)
+#define glDeformationMap3dSGIX MANGLE(DeformationMap3dSGIX)
+#define glDeformationMap3fSGIX MANGLE(DeformationMap3fSGIX)
+#define glDeformSGIX MANGLE(DeformSGIX)
+#define glDeleteAsyncMarkersSGIX MANGLE(DeleteAsyncMarkersSGIX)
+#define glDeleteBuffersARB MANGLE(DeleteBuffersARB)
+#define glDeleteBuffers MANGLE(DeleteBuffers)
+#define glDeleteFencesAPPLE MANGLE(DeleteFencesAPPLE)
+#define glDeleteFencesNV MANGLE(DeleteFencesNV)
+#define glDeleteFragmentShaderATI MANGLE(DeleteFragmentShaderATI)
+#define glDeleteFramebuffersEXT MANGLE(DeleteFramebuffersEXT)
+#define glDeleteFramebuffers MANGLE(DeleteFramebuffers)
+#define glDeleteLists MANGLE(DeleteLists)
+#define glDeleteNamedStringARB MANGLE(DeleteNamedStringARB)
+#define glDeleteNamesAMD MANGLE(DeleteNamesAMD)
+#define glDeleteObjectARB MANGLE(DeleteObjectARB)
+#define glDeleteOcclusionQueriesNV MANGLE(DeleteOcclusionQueriesNV)
+#define glDeletePerfMonitorsAMD MANGLE(DeletePerfMonitorsAMD)
+#define glDeleteProgram MANGLE(DeleteProgram)
+#define glDeleteProgramPipelines MANGLE(DeleteProgramPipelines)
+#define glDeleteProgramsARB MANGLE(DeleteProgramsARB)
+#define glDeleteProgramsNV MANGLE(DeleteProgramsNV)
+#define glDeleteQueriesARB MANGLE(DeleteQueriesARB)
+#define glDeleteQueries MANGLE(DeleteQueries)
+#define glDeleteRenderbuffersEXT MANGLE(DeleteRenderbuffersEXT)
+#define glDeleteRenderbuffers MANGLE(DeleteRenderbuffers)
+#define glDeleteSamplers MANGLE(DeleteSamplers)
+#define glDeleteShader MANGLE(DeleteShader)
+#define glDeleteSync MANGLE(DeleteSync)
+#define glDeleteTexturesEXT MANGLE(DeleteTexturesEXT)
+#define glDeleteTextures MANGLE(DeleteTextures)
+#define glDeleteTransformFeedbacks MANGLE(DeleteTransformFeedbacks)
+#define glDeleteTransformFeedbacksNV MANGLE(DeleteTransformFeedbacksNV)
+#define glDeleteVertexArraysAPPLE MANGLE(DeleteVertexArraysAPPLE)
+#define glDeleteVertexArrays MANGLE(DeleteVertexArrays)
+#define glDeleteVertexShaderEXT MANGLE(DeleteVertexShaderEXT)
+#define glDepthBoundsdNV MANGLE(DepthBoundsdNV)
+#define glDepthBoundsEXT MANGLE(DepthBoundsEXT)
+#define glDepthFunc MANGLE(DepthFunc)
+#define glDepthMask MANGLE(DepthMask)
+#define glDepthRangeArrayv MANGLE(DepthRangeArrayv)
+#define glDepthRangedNV MANGLE(DepthRangedNV)
+#define glDepthRangef MANGLE(DepthRangef)
+#define glDepthRangeIndexed MANGLE(DepthRangeIndexed)
+#define glDepthRange MANGLE(DepthRange)
+#define glDetachObjectARB MANGLE(DetachObjectARB)
+#define glDetachShader MANGLE(DetachShader)
+#define glDetailTexFuncSGIS MANGLE(DetailTexFuncSGIS)
+#define glDisableClientStateIndexedEXT MANGLE(DisableClientStateIndexedEXT)
+#define glDisableClientState MANGLE(DisableClientState)
+#define glDisablei MANGLE(Disablei)
+#define glDisableIndexedEXT MANGLE(DisableIndexedEXT)
+#define glDisable MANGLE(Disable)
+#define glDisableVariantClientStateEXT MANGLE(DisableVariantClientStateEXT)
+#define glDisableVertexAttribAPPLE MANGLE(DisableVertexAttribAPPLE)
+#define glDisableVertexAttribArrayARB MANGLE(DisableVertexAttribArrayARB)
+#define glDisableVertexAttribArray MANGLE(DisableVertexAttribArray)
+#define glDrawArraysEXT MANGLE(DrawArraysEXT)
+#define glDrawArraysIndirect MANGLE(DrawArraysIndirect)
+#define glDrawArraysInstancedARB MANGLE(DrawArraysInstancedARB)
+#define glDrawArraysInstancedEXT MANGLE(DrawArraysInstancedEXT)
+#define glDrawArraysInstanced MANGLE(DrawArraysInstanced)
+#define glDrawArrays MANGLE(DrawArrays)
+#define glDrawBuffer MANGLE(DrawBuffer)
+#define glDrawBuffersARB MANGLE(DrawBuffersARB)
+#define glDrawBuffersATI MANGLE(DrawBuffersATI)
+#define glDrawBuffers MANGLE(DrawBuffers)
+#define glDrawElementArrayAPPLE MANGLE(DrawElementArrayAPPLE)
+#define glDrawElementArrayATI MANGLE(DrawElementArrayATI)
+#define glDrawElementsBaseVertex MANGLE(DrawElementsBaseVertex)
+#define glDrawElementsIndirect MANGLE(DrawElementsIndirect)
+#define glDrawElementsInstancedARB MANGLE(DrawElementsInstancedARB)
+#define glDrawElementsInstancedBaseVertex MANGLE(DrawElementsInstancedBaseVertex)
+#define glDrawElementsInstancedEXT MANGLE(DrawElementsInstancedEXT)
+#define glDrawElementsInstanced MANGLE(DrawElementsInstanced)
+#define glDrawElements MANGLE(DrawElements)
+#define glDrawMeshArraysSUN MANGLE(DrawMeshArraysSUN)
+#define glDrawPixels MANGLE(DrawPixels)
+#define glDrawRangeElementArrayAPPLE MANGLE(DrawRangeElementArrayAPPLE)
+#define glDrawRangeElementArrayATI MANGLE(DrawRangeElementArrayATI)
+#define glDrawRangeElementsBaseVertex MANGLE(DrawRangeElementsBaseVertex)
+#define glDrawRangeElementsEXT MANGLE(DrawRangeElementsEXT)
+#define glDrawRangeElements MANGLE(DrawRangeElements)
+#define glDrawTransformFeedback MANGLE(DrawTransformFeedback)
+#define glDrawTransformFeedbackNV MANGLE(DrawTransformFeedbackNV)
+#define glDrawTransformFeedbackStream MANGLE(DrawTransformFeedbackStream)
+#define glEdgeFlagFormatNV MANGLE(EdgeFlagFormatNV)
+#define glEdgeFlag MANGLE(EdgeFlag)
+#define glEdgeFlagPointerEXT MANGLE(EdgeFlagPointerEXT)
+#define glEdgeFlagPointerListIBM MANGLE(EdgeFlagPointerListIBM)
+#define glEdgeFlagPointer MANGLE(EdgeFlagPointer)
+#define glEdgeFlagv MANGLE(EdgeFlagv)
+#define glEGLImageTargetRenderbufferStorageOES MANGLE(EGLImageTargetRenderbufferStorageOES)
+#define glEGLImageTargetTexture2DOES MANGLE(EGLImageTargetTexture2DOES)
+#define glElementPointerAPPLE MANGLE(ElementPointerAPPLE)
+#define glElementPointerATI MANGLE(ElementPointerATI)
+#define glEnableClientStateIndexedEXT MANGLE(EnableClientStateIndexedEXT)
+#define glEnableClientState MANGLE(EnableClientState)
+#define glEnablei MANGLE(Enablei)
+#define glEnableIndexedEXT MANGLE(EnableIndexedEXT)
+#define glEnable MANGLE(Enable)
+#define glEnableVariantClientStateEXT MANGLE(EnableVariantClientStateEXT)
+#define glEnableVertexAttribAPPLE MANGLE(EnableVertexAttribAPPLE)
+#define glEnableVertexAttribArrayARB MANGLE(EnableVertexAttribArrayARB)
+#define glEnableVertexAttribArray MANGLE(EnableVertexAttribArray)
+#define glEndConditionalRender MANGLE(EndConditionalRender)
+#define glEndConditionalRenderNV MANGLE(EndConditionalRenderNV)
+#define glEndFragmentShaderATI MANGLE(EndFragmentShaderATI)
+#define glEndList MANGLE(EndList)
+#define glEnd MANGLE(End)
+#define glEndOcclusionQueryNV MANGLE(EndOcclusionQueryNV)
+#define glEndPerfMonitorAMD MANGLE(EndPerfMonitorAMD)
+#define glEndQueryARB MANGLE(EndQueryARB)
+#define glEndQueryIndexed MANGLE(EndQueryIndexed)
+#define glEndQuery MANGLE(EndQuery)
+#define glEndTransformFeedbackEXT MANGLE(EndTransformFeedbackEXT)
+#define glEndTransformFeedback MANGLE(EndTransformFeedback)
+#define glEndTransformFeedbackNV MANGLE(EndTransformFeedbackNV)
+#define glEndVertexShaderEXT MANGLE(EndVertexShaderEXT)
+#define glEndVideoCaptureNV MANGLE(EndVideoCaptureNV)
+#define glEvalCoord1d MANGLE(EvalCoord1d)
+#define glEvalCoord1dv MANGLE(EvalCoord1dv)
+#define glEvalCoord1f MANGLE(EvalCoord1f)
+#define glEvalCoord1fv MANGLE(EvalCoord1fv)
+#define glEvalCoord2d MANGLE(EvalCoord2d)
+#define glEvalCoord2dv MANGLE(EvalCoord2dv)
+#define glEvalCoord2f MANGLE(EvalCoord2f)
+#define glEvalCoord2fv MANGLE(EvalCoord2fv)
+#define glEvalMapsNV MANGLE(EvalMapsNV)
+#define glEvalMesh1 MANGLE(EvalMesh1)
+#define glEvalMesh2 MANGLE(EvalMesh2)
+#define glEvalPoint1 MANGLE(EvalPoint1)
+#define glEvalPoint2 MANGLE(EvalPoint2)
+#define glExecuteProgramNV MANGLE(ExecuteProgramNV)
+#define glExtractComponentEXT MANGLE(ExtractComponentEXT)
+#define glFeedbackBuffer MANGLE(FeedbackBuffer)
+#define glFenceSync MANGLE(FenceSync)
+#define glFinalCombinerInputNV MANGLE(FinalCombinerInputNV)
+#define glFinishAsyncSGIX MANGLE(FinishAsyncSGIX)
+#define glFinishFenceAPPLE MANGLE(FinishFenceAPPLE)
+#define glFinishFenceNV MANGLE(FinishFenceNV)
+#define glFinish MANGLE(Finish)
+#define glFinishObjectAPPLE MANGLE(FinishObjectAPPLE)
+#define glFinishTextureSUNX MANGLE(FinishTextureSUNX)
+#define glFlush MANGLE(Flush)
+#define glFlushMappedBufferRangeAPPLE MANGLE(FlushMappedBufferRangeAPPLE)
+#define glFlushMappedBufferRange MANGLE(FlushMappedBufferRange)
+#define glFlushMappedNamedBufferRangeEXT MANGLE(FlushMappedNamedBufferRangeEXT)
+#define glFlushPixelDataRangeNV MANGLE(FlushPixelDataRangeNV)
+#define glFlushRasterSGIX MANGLE(FlushRasterSGIX)
+#define glFlushVertexArrayRangeAPPLE MANGLE(FlushVertexArrayRangeAPPLE)
+#define glFlushVertexArrayRangeNV MANGLE(FlushVertexArrayRangeNV)
+#define glFogCoorddEXT MANGLE(FogCoorddEXT)
+#define glFogCoordd MANGLE(FogCoordd)
+#define glFogCoorddvEXT MANGLE(FogCoorddvEXT)
+#define glFogCoorddv MANGLE(FogCoorddv)
+#define glFogCoordfEXT MANGLE(FogCoordfEXT)
+#define glFogCoordf MANGLE(FogCoordf)
+#define glFogCoordFormatNV MANGLE(FogCoordFormatNV)
+#define glFogCoordfvEXT MANGLE(FogCoordfvEXT)
+#define glFogCoordfv MANGLE(FogCoordfv)
+#define glFogCoordhNV MANGLE(FogCoordhNV)
+#define glFogCoordhvNV MANGLE(FogCoordhvNV)
+#define glFogCoordPointerEXT MANGLE(FogCoordPointerEXT)
+#define glFogCoordPointerListIBM MANGLE(FogCoordPointerListIBM)
+#define glFogCoordPointer MANGLE(FogCoordPointer)
+#define glFogf MANGLE(Fogf)
+#define glFogFuncSGIS MANGLE(FogFuncSGIS)
+#define glFogfv MANGLE(Fogfv)
+#define glFogi MANGLE(Fogi)
+#define glFogiv MANGLE(Fogiv)
+#define glFragmentColorMaterialSGIX MANGLE(FragmentColorMaterialSGIX)
+#define glFragmentLightfSGIX MANGLE(FragmentLightfSGIX)
+#define glFragmentLightfvSGIX MANGLE(FragmentLightfvSGIX)
+#define glFragmentLightiSGIX MANGLE(FragmentLightiSGIX)
+#define glFragmentLightivSGIX MANGLE(FragmentLightivSGIX)
+#define glFragmentLightModelfSGIX MANGLE(FragmentLightModelfSGIX)
+#define glFragmentLightModelfvSGIX MANGLE(FragmentLightModelfvSGIX)
+#define glFragmentLightModeliSGIX MANGLE(FragmentLightModeliSGIX)
+#define glFragmentLightModelivSGIX MANGLE(FragmentLightModelivSGIX)
+#define glFragmentMaterialfSGIX MANGLE(FragmentMaterialfSGIX)
+#define glFragmentMaterialfvSGIX MANGLE(FragmentMaterialfvSGIX)
+#define glFragmentMaterialiSGIX MANGLE(FragmentMaterialiSGIX)
+#define glFragmentMaterialivSGIX MANGLE(FragmentMaterialivSGIX)
+#define glFramebufferDrawBufferEXT MANGLE(FramebufferDrawBufferEXT)
+#define glFramebufferDrawBuffersEXT MANGLE(FramebufferDrawBuffersEXT)
+#define glFramebufferReadBufferEXT MANGLE(FramebufferReadBufferEXT)
+#define glFramebufferRenderbufferEXT MANGLE(FramebufferRenderbufferEXT)
+#define glFramebufferRenderbuffer MANGLE(FramebufferRenderbuffer)
+#define glFramebufferTexture1DEXT MANGLE(FramebufferTexture1DEXT)
+#define glFramebufferTexture1D MANGLE(FramebufferTexture1D)
+#define glFramebufferTexture2DEXT MANGLE(FramebufferTexture2DEXT)
+#define glFramebufferTexture2D MANGLE(FramebufferTexture2D)
+#define glFramebufferTexture3DEXT MANGLE(FramebufferTexture3DEXT)
+#define glFramebufferTexture3D MANGLE(FramebufferTexture3D)
+#define glFramebufferTextureARB MANGLE(FramebufferTextureARB)
+#define glFramebufferTextureEXT MANGLE(FramebufferTextureEXT)
+#define glFramebufferTextureFaceARB MANGLE(FramebufferTextureFaceARB)
+#define glFramebufferTextureFaceEXT MANGLE(FramebufferTextureFaceEXT)
+#define glFramebufferTextureLayerARB MANGLE(FramebufferTextureLayerARB)
+#define glFramebufferTextureLayerEXT MANGLE(FramebufferTextureLayerEXT)
+#define glFramebufferTextureLayer MANGLE(FramebufferTextureLayer)
+#define glFramebufferTexture MANGLE(FramebufferTexture)
+#define glFrameTerminatorGREMEDY MANGLE(FrameTerminatorGREMEDY)
+#define glFrameZoomSGIX MANGLE(FrameZoomSGIX)
+#define glFreeObjectBufferATI MANGLE(FreeObjectBufferATI)
+#define glFrontFace MANGLE(FrontFace)
+#define glFrustum MANGLE(Frustum)
+#define glGenAsyncMarkersSGIX MANGLE(GenAsyncMarkersSGIX)
+#define glGenBuffersARB MANGLE(GenBuffersARB)
+#define glGenBuffers MANGLE(GenBuffers)
+#define glGenerateMipmapEXT MANGLE(GenerateMipmapEXT)
+#define glGenerateMipmap MANGLE(GenerateMipmap)
+#define glGenerateMultiTexMipmapEXT MANGLE(GenerateMultiTexMipmapEXT)
+#define glGenerateTextureMipmapEXT MANGLE(GenerateTextureMipmapEXT)
+#define glGenFencesAPPLE MANGLE(GenFencesAPPLE)
+#define glGenFencesNV MANGLE(GenFencesNV)
+#define glGenFragmentShadersATI MANGLE(GenFragmentShadersATI)
+#define glGenFramebuffersEXT MANGLE(GenFramebuffersEXT)
+#define glGenFramebuffers MANGLE(GenFramebuffers)
+#define glGenLists MANGLE(GenLists)
+#define glGenNamesAMD MANGLE(GenNamesAMD)
+#define glGenOcclusionQueriesNV MANGLE(GenOcclusionQueriesNV)
+#define glGenPerfMonitorsAMD MANGLE(GenPerfMonitorsAMD)
+#define glGenProgramPipelines MANGLE(GenProgramPipelines)
+#define glGenProgramsARB MANGLE(GenProgramsARB)
+#define glGenProgramsNV MANGLE(GenProgramsNV)
+#define glGenQueriesARB MANGLE(GenQueriesARB)
+#define glGenQueries MANGLE(GenQueries)
+#define glGenRenderbuffersEXT MANGLE(GenRenderbuffersEXT)
+#define glGenRenderbuffers MANGLE(GenRenderbuffers)
+#define glGenSamplers MANGLE(GenSamplers)
+#define glGenSymbolsEXT MANGLE(GenSymbolsEXT)
+#define glGenTexturesEXT MANGLE(GenTexturesEXT)
+#define glGenTextures MANGLE(GenTextures)
+#define glGenTransformFeedbacks MANGLE(GenTransformFeedbacks)
+#define glGenTransformFeedbacksNV MANGLE(GenTransformFeedbacksNV)
+#define glGenVertexArraysAPPLE MANGLE(GenVertexArraysAPPLE)
+#define glGenVertexArrays MANGLE(GenVertexArrays)
+#define glGenVertexShadersEXT MANGLE(GenVertexShadersEXT)
+#define glGetActiveAttribARB MANGLE(GetActiveAttribARB)
+#define glGetActiveAttrib MANGLE(GetActiveAttrib)
+#define glGetActiveSubroutineName MANGLE(GetActiveSubroutineName)
+#define glGetActiveSubroutineUniformiv MANGLE(GetActiveSubroutineUniformiv)
+#define glGetActiveSubroutineUniformName MANGLE(GetActiveSubroutineUniformName)
+#define glGetActiveUniformARB MANGLE(GetActiveUniformARB)
+#define glGetActiveUniformBlockiv MANGLE(GetActiveUniformBlockiv)
+#define glGetActiveUniformBlockName MANGLE(GetActiveUniformBlockName)
+#define glGetActiveUniform MANGLE(GetActiveUniform)
+#define glGetActiveUniformName MANGLE(GetActiveUniformName)
+#define glGetActiveUniformsiv MANGLE(GetActiveUniformsiv)
+#define glGetActiveVaryingNV MANGLE(GetActiveVaryingNV)
+#define glGetArrayObjectfvATI MANGLE(GetArrayObjectfvATI)
+#define glGetArrayObjectivATI MANGLE(GetArrayObjectivATI)
+#define glGetAttachedObjectsARB MANGLE(GetAttachedObjectsARB)
+#define glGetAttachedShaders MANGLE(GetAttachedShaders)
+#define glGetAttribLocationARB MANGLE(GetAttribLocationARB)
+#define glGetAttribLocation MANGLE(GetAttribLocation)
+#define glGetBooleanIndexedvEXT MANGLE(GetBooleanIndexedvEXT)
+#define glGetBooleani_v MANGLE(GetBooleani_v)
+#define glGetBooleanv MANGLE(GetBooleanv)
+#define glGetBufferParameteri64v MANGLE(GetBufferParameteri64v)
+#define glGetBufferParameterivARB MANGLE(GetBufferParameterivARB)
+#define glGetBufferParameteriv MANGLE(GetBufferParameteriv)
+#define glGetBufferParameterui64vNV MANGLE(GetBufferParameterui64vNV)
+#define glGetBufferPointervARB MANGLE(GetBufferPointervARB)
+#define glGetBufferPointerv MANGLE(GetBufferPointerv)
+#define glGetBufferSubDataARB MANGLE(GetBufferSubDataARB)
+#define glGetBufferSubData MANGLE(GetBufferSubData)
+#define glGetClipPlane MANGLE(GetClipPlane)
+#define glGetColorTableEXT MANGLE(GetColorTableEXT)
+#define glGetColorTable MANGLE(GetColorTable)
+#define glGetColorTableParameterfvEXT MANGLE(GetColorTableParameterfvEXT)
+#define glGetColorTableParameterfv MANGLE(GetColorTableParameterfv)
+#define glGetColorTableParameterfvSGI MANGLE(GetColorTableParameterfvSGI)
+#define glGetColorTableParameterivEXT MANGLE(GetColorTableParameterivEXT)
+#define glGetColorTableParameteriv MANGLE(GetColorTableParameteriv)
+#define glGetColorTableParameterivSGI MANGLE(GetColorTableParameterivSGI)
+#define glGetColorTableSGI MANGLE(GetColorTableSGI)
+#define glGetCombinerInputParameterfvNV MANGLE(GetCombinerInputParameterfvNV)
+#define glGetCombinerInputParameterivNV MANGLE(GetCombinerInputParameterivNV)
+#define glGetCombinerOutputParameterfvNV MANGLE(GetCombinerOutputParameterfvNV)
+#define glGetCombinerOutputParameterivNV MANGLE(GetCombinerOutputParameterivNV)
+#define glGetCombinerStageParameterfvNV MANGLE(GetCombinerStageParameterfvNV)
+#define glGetCompressedMultiTexImageEXT MANGLE(GetCompressedMultiTexImageEXT)
+#define glGetCompressedTexImageARB MANGLE(GetCompressedTexImageARB)
+#define glGetCompressedTexImage MANGLE(GetCompressedTexImage)
+#define glGetCompressedTextureImageEXT MANGLE(GetCompressedTextureImageEXT)
+#define glGetConvolutionFilterEXT MANGLE(GetConvolutionFilterEXT)
+#define glGetConvolutionFilter MANGLE(GetConvolutionFilter)
+#define glGetConvolutionParameterfvEXT MANGLE(GetConvolutionParameterfvEXT)
+#define glGetConvolutionParameterfv MANGLE(GetConvolutionParameterfv)
+#define glGetConvolutionParameterivEXT MANGLE(GetConvolutionParameterivEXT)
+#define glGetConvolutionParameteriv MANGLE(GetConvolutionParameteriv)
+#define glGetDebugLogLengthMESA MANGLE(GetDebugLogLengthMESA)
+#define glGetDebugLogMESA MANGLE(GetDebugLogMESA)
+#define glGetDebugMessageLogAMD MANGLE(GetDebugMessageLogAMD)
+#define glGetDebugMessageLogARB MANGLE(GetDebugMessageLogARB)
+#define glGetDetailTexFuncSGIS MANGLE(GetDetailTexFuncSGIS)
+#define glGetDoubleIndexedvEXT MANGLE(GetDoubleIndexedvEXT)
+#define glGetDoublei_v MANGLE(GetDoublei_v)
+#define glGetDoublev MANGLE(GetDoublev)
+#define glGetError MANGLE(GetError)
+#define glGetFenceivNV MANGLE(GetFenceivNV)
+#define glGetFinalCombinerInputParameterfvNV MANGLE(GetFinalCombinerInputParameterfvNV)
+#define glGetFinalCombinerInputParameterivNV MANGLE(GetFinalCombinerInputParameterivNV)
+#define glGetFloatIndexedvEXT MANGLE(GetFloatIndexedvEXT)
+#define glGetFloati_v MANGLE(GetFloati_v)
+#define glGetFloatv MANGLE(GetFloatv)
+#define glGetFogFuncSGIS MANGLE(GetFogFuncSGIS)
+#define glGetFragDataIndex MANGLE(GetFragDataIndex)
+#define glGetFragDataLocationEXT MANGLE(GetFragDataLocationEXT)
+#define glGetFragDataLocation MANGLE(GetFragDataLocation)
+#define glGetFragmentLightfvSGIX MANGLE(GetFragmentLightfvSGIX)
+#define glGetFragmentLightivSGIX MANGLE(GetFragmentLightivSGIX)
+#define glGetFragmentMaterialfvSGIX MANGLE(GetFragmentMaterialfvSGIX)
+#define glGetFragmentMaterialivSGIX MANGLE(GetFragmentMaterialivSGIX)
+#define glGetFramebufferAttachmentParameterivEXT MANGLE(GetFramebufferAttachmentParameterivEXT)
+#define glGetFramebufferAttachmentParameteriv MANGLE(GetFramebufferAttachmentParameteriv)
+#define glGetFramebufferParameterivEXT MANGLE(GetFramebufferParameterivEXT)
+#define glGetGraphicsResetStatusARB MANGLE(GetGraphicsResetStatusARB)
+#define glGetHandleARB MANGLE(GetHandleARB)
+#define glGetHistogramEXT MANGLE(GetHistogramEXT)
+#define glGetHistogram MANGLE(GetHistogram)
+#define glGetHistogramParameterfvEXT MANGLE(GetHistogramParameterfvEXT)
+#define glGetHistogramParameterfv MANGLE(GetHistogramParameterfv)
+#define glGetHistogramParameterivEXT MANGLE(GetHistogramParameterivEXT)
+#define glGetHistogramParameteriv MANGLE(GetHistogramParameteriv)
+#define glGetImageTransformParameterfvHP MANGLE(GetImageTransformParameterfvHP)
+#define glGetImageTransformParameterivHP MANGLE(GetImageTransformParameterivHP)
+#define glGetInfoLogARB MANGLE(GetInfoLogARB)
+#define glGetInstrumentsSGIX MANGLE(GetInstrumentsSGIX)
+#define glGetInteger64i_v MANGLE(GetInteger64i_v)
+#define glGetInteger64v MANGLE(GetInteger64v)
+#define glGetIntegerIndexedvEXT MANGLE(GetIntegerIndexedvEXT)
+#define glGetIntegeri_v MANGLE(GetIntegeri_v)
+#define glGetIntegerui64i_vNV MANGLE(GetIntegerui64i_vNV)
+#define glGetIntegerui64vNV MANGLE(GetIntegerui64vNV)
+#define glGetIntegerv MANGLE(GetIntegerv)
+#define glGetInvariantBooleanvEXT MANGLE(GetInvariantBooleanvEXT)
+#define glGetInvariantFloatvEXT MANGLE(GetInvariantFloatvEXT)
+#define glGetInvariantIntegervEXT MANGLE(GetInvariantIntegervEXT)
+#define glGetLightfv MANGLE(GetLightfv)
+#define glGetLightiv MANGLE(GetLightiv)
+#define glGetListParameterfvSGIX MANGLE(GetListParameterfvSGIX)
+#define glGetListParameterivSGIX MANGLE(GetListParameterivSGIX)
+#define glGetLocalConstantBooleanvEXT MANGLE(GetLocalConstantBooleanvEXT)
+#define glGetLocalConstantFloatvEXT MANGLE(GetLocalConstantFloatvEXT)
+#define glGetLocalConstantIntegervEXT MANGLE(GetLocalConstantIntegervEXT)
+#define glGetMapAttribParameterfvNV MANGLE(GetMapAttribParameterfvNV)
+#define glGetMapAttribParameterivNV MANGLE(GetMapAttribParameterivNV)
+#define glGetMapControlPointsNV MANGLE(GetMapControlPointsNV)
+#define glGetMapdv MANGLE(GetMapdv)
+#define glGetMapfv MANGLE(GetMapfv)
+#define glGetMapiv MANGLE(GetMapiv)
+#define glGetMapParameterfvNV MANGLE(GetMapParameterfvNV)
+#define glGetMapParameterivNV MANGLE(GetMapParameterivNV)
+#define glGetMaterialfv MANGLE(GetMaterialfv)
+#define glGetMaterialiv MANGLE(GetMaterialiv)
+#define glGetMinmaxEXT MANGLE(GetMinmaxEXT)
+#define glGetMinmax MANGLE(GetMinmax)
+#define glGetMinmaxParameterfvEXT MANGLE(GetMinmaxParameterfvEXT)
+#define glGetMinmaxParameterfv MANGLE(GetMinmaxParameterfv)
+#define glGetMinmaxParameterivEXT MANGLE(GetMinmaxParameterivEXT)
+#define glGetMinmaxParameteriv MANGLE(GetMinmaxParameteriv)
+#define glGetMultisamplefv MANGLE(GetMultisamplefv)
+#define glGetMultisamplefvNV MANGLE(GetMultisamplefvNV)
+#define glGetMultiTexEnvfvEXT MANGLE(GetMultiTexEnvfvEXT)
+#define glGetMultiTexEnvivEXT MANGLE(GetMultiTexEnvivEXT)
+#define glGetMultiTexGendvEXT MANGLE(GetMultiTexGendvEXT)
+#define glGetMultiTexGenfvEXT MANGLE(GetMultiTexGenfvEXT)
+#define glGetMultiTexGenivEXT MANGLE(GetMultiTexGenivEXT)
+#define glGetMultiTexImageEXT MANGLE(GetMultiTexImageEXT)
+#define glGetMultiTexLevelParameterfvEXT MANGLE(GetMultiTexLevelParameterfvEXT)
+#define glGetMultiTexLevelParameterivEXT MANGLE(GetMultiTexLevelParameterivEXT)
+#define glGetMultiTexParameterfvEXT MANGLE(GetMultiTexParameterfvEXT)
+#define glGetMultiTexParameterIivEXT MANGLE(GetMultiTexParameterIivEXT)
+#define glGetMultiTexParameterIuivEXT MANGLE(GetMultiTexParameterIuivEXT)
+#define glGetMultiTexParameterivEXT MANGLE(GetMultiTexParameterivEXT)
+#define glGetNamedBufferParameterivEXT MANGLE(GetNamedBufferParameterivEXT)
+#define glGetNamedBufferParameterui64vNV MANGLE(GetNamedBufferParameterui64vNV)
+#define glGetNamedBufferPointervEXT MANGLE(GetNamedBufferPointervEXT)
+#define glGetNamedBufferSubDataEXT MANGLE(GetNamedBufferSubDataEXT)
+#define glGetNamedFramebufferAttachmentParameterivEXT MANGLE(GetNamedFramebufferAttachmentParameterivEXT)
+#define glGetNamedProgramivEXT MANGLE(GetNamedProgramivEXT)
+#define glGetNamedProgramLocalParameterdvEXT MANGLE(GetNamedProgramLocalParameterdvEXT)
+#define glGetNamedProgramLocalParameterfvEXT MANGLE(GetNamedProgramLocalParameterfvEXT)
+#define glGetNamedProgramLocalParameterIivEXT MANGLE(GetNamedProgramLocalParameterIivEXT)
+#define glGetNamedProgramLocalParameterIuivEXT MANGLE(GetNamedProgramLocalParameterIuivEXT)
+#define glGetNamedProgramStringEXT MANGLE(GetNamedProgramStringEXT)
+#define glGetNamedRenderbufferParameterivEXT MANGLE(GetNamedRenderbufferParameterivEXT)
+#define glGetNamedStringARB MANGLE(GetNamedStringARB)
+#define glGetNamedStringivARB MANGLE(GetNamedStringivARB)
+#define glGetnColorTableARB MANGLE(GetnColorTableARB)
+#define glGetnCompressedTexImageARB MANGLE(GetnCompressedTexImageARB)
+#define glGetnConvolutionFilterARB MANGLE(GetnConvolutionFilterARB)
+#define glGetnHistogramARB MANGLE(GetnHistogramARB)
+#define glGetnMapdvARB MANGLE(GetnMapdvARB)
+#define glGetnMapfvARB MANGLE(GetnMapfvARB)
+#define glGetnMapivARB MANGLE(GetnMapivARB)
+#define glGetnMinmaxARB MANGLE(GetnMinmaxARB)
+#define glGetnPixelMapfvARB MANGLE(GetnPixelMapfvARB)
+#define glGetnPixelMapuivARB MANGLE(GetnPixelMapuivARB)
+#define glGetnPixelMapusvARB MANGLE(GetnPixelMapusvARB)
+#define glGetnPolygonStippleARB MANGLE(GetnPolygonStippleARB)
+#define glGetnSeparableFilterARB MANGLE(GetnSeparableFilterARB)
+#define glGetnTexImageARB MANGLE(GetnTexImageARB)
+#define glGetnUniformdvARB MANGLE(GetnUniformdvARB)
+#define glGetnUniformfvARB MANGLE(GetnUniformfvARB)
+#define glGetnUniformivARB MANGLE(GetnUniformivARB)
+#define glGetnUniformuivARB MANGLE(GetnUniformuivARB)
+#define glGetObjectBufferfvATI MANGLE(GetObjectBufferfvATI)
+#define glGetObjectBufferivATI MANGLE(GetObjectBufferivATI)
+#define glGetObjectParameterfvARB MANGLE(GetObjectParameterfvARB)
+#define glGetObjectParameterivAPPLE MANGLE(GetObjectParameterivAPPLE)
+#define glGetObjectParameterivARB MANGLE(GetObjectParameterivARB)
+#define glGetOcclusionQueryivNV MANGLE(GetOcclusionQueryivNV)
+#define glGetOcclusionQueryuivNV MANGLE(GetOcclusionQueryuivNV)
+#define glGetPerfMonitorCounterDataAMD MANGLE(GetPerfMonitorCounterDataAMD)
+#define glGetPerfMonitorCounterInfoAMD MANGLE(GetPerfMonitorCounterInfoAMD)
+#define glGetPerfMonitorCountersAMD MANGLE(GetPerfMonitorCountersAMD)
+#define glGetPerfMonitorCounterStringAMD MANGLE(GetPerfMonitorCounterStringAMD)
+#define glGetPerfMonitorGroupsAMD MANGLE(GetPerfMonitorGroupsAMD)
+#define glGetPerfMonitorGroupStringAMD MANGLE(GetPerfMonitorGroupStringAMD)
+#define glGetPixelMapfv MANGLE(GetPixelMapfv)
+#define glGetPixelMapuiv MANGLE(GetPixelMapuiv)
+#define glGetPixelMapusv MANGLE(GetPixelMapusv)
+#define glGetPixelTexGenParameterfvSGIS MANGLE(GetPixelTexGenParameterfvSGIS)
+#define glGetPixelTexGenParameterivSGIS MANGLE(GetPixelTexGenParameterivSGIS)
+#define glGetPointerIndexedvEXT MANGLE(GetPointerIndexedvEXT)
+#define glGetPointervEXT MANGLE(GetPointervEXT)
+#define glGetPointerv MANGLE(GetPointerv)
+#define glGetPolygonStipple MANGLE(GetPolygonStipple)
+#define glGetProgramBinary MANGLE(GetProgramBinary)
+#define glGetProgramEnvParameterdvARB MANGLE(GetProgramEnvParameterdvARB)
+#define glGetProgramEnvParameterfvARB MANGLE(GetProgramEnvParameterfvARB)
+#define glGetProgramEnvParameterIivNV MANGLE(GetProgramEnvParameterIivNV)
+#define glGetProgramEnvParameterIuivNV MANGLE(GetProgramEnvParameterIuivNV)
+#define glGetProgramInfoLog MANGLE(GetProgramInfoLog)
+#define glGetProgramivARB MANGLE(GetProgramivARB)
+#define glGetProgramiv MANGLE(GetProgramiv)
+#define glGetProgramivNV MANGLE(GetProgramivNV)
+#define glGetProgramLocalParameterdvARB MANGLE(GetProgramLocalParameterdvARB)
+#define glGetProgramLocalParameterfvARB MANGLE(GetProgramLocalParameterfvARB)
+#define glGetProgramLocalParameterIivNV MANGLE(GetProgramLocalParameterIivNV)
+#define glGetProgramLocalParameterIuivNV MANGLE(GetProgramLocalParameterIuivNV)
+#define glGetProgramNamedParameterdvNV MANGLE(GetProgramNamedParameterdvNV)
+#define glGetProgramNamedParameterfvNV MANGLE(GetProgramNamedParameterfvNV)
+#define glGetProgramParameterdvNV MANGLE(GetProgramParameterdvNV)
+#define glGetProgramParameterfvNV MANGLE(GetProgramParameterfvNV)
+#define glGetProgramPipelineInfoLog MANGLE(GetProgramPipelineInfoLog)
+#define glGetProgramPipelineiv MANGLE(GetProgramPipelineiv)
+#define glGetProgramRegisterfvMESA MANGLE(GetProgramRegisterfvMESA)
+#define glGetProgramStageiv MANGLE(GetProgramStageiv)
+#define glGetProgramStringARB MANGLE(GetProgramStringARB)
+#define glGetProgramStringNV MANGLE(GetProgramStringNV)
+#define glGetProgramSubroutineParameteruivNV MANGLE(GetProgramSubroutineParameteruivNV)
+#define glGetQueryIndexediv MANGLE(GetQueryIndexediv)
+#define glGetQueryivARB MANGLE(GetQueryivARB)
+#define glGetQueryiv MANGLE(GetQueryiv)
+#define glGetQueryObjecti64vEXT MANGLE(GetQueryObjecti64vEXT)
+#define glGetQueryObjecti64v MANGLE(GetQueryObjecti64v)
+#define glGetQueryObjectivARB MANGLE(GetQueryObjectivARB)
+#define glGetQueryObjectiv MANGLE(GetQueryObjectiv)
+#define glGetQueryObjectui64vEXT MANGLE(GetQueryObjectui64vEXT)
+#define glGetQueryObjectui64v MANGLE(GetQueryObjectui64v)
+#define glGetQueryObjectuivARB MANGLE(GetQueryObjectuivARB)
+#define glGetQueryObjectuiv MANGLE(GetQueryObjectuiv)
+#define glGetRenderbufferParameterivEXT MANGLE(GetRenderbufferParameterivEXT)
+#define glGetRenderbufferParameteriv MANGLE(GetRenderbufferParameteriv)
+#define glGetSamplerParameterfv MANGLE(GetSamplerParameterfv)
+#define glGetSamplerParameterIiv MANGLE(GetSamplerParameterIiv)
+#define glGetSamplerParameterIuiv MANGLE(GetSamplerParameterIuiv)
+#define glGetSamplerParameteriv MANGLE(GetSamplerParameteriv)
+#define glGetSeparableFilterEXT MANGLE(GetSeparableFilterEXT)
+#define glGetSeparableFilter MANGLE(GetSeparableFilter)
+#define glGetShaderInfoLog MANGLE(GetShaderInfoLog)
+#define glGetShaderiv MANGLE(GetShaderiv)
+#define glGetShaderPrecisionFormat MANGLE(GetShaderPrecisionFormat)
+#define glGetShaderSourceARB MANGLE(GetShaderSourceARB)
+#define glGetShaderSource MANGLE(GetShaderSource)
+#define glGetSharpenTexFuncSGIS MANGLE(GetSharpenTexFuncSGIS)
+#define glGetStringi MANGLE(GetStringi)
+#define glGetString MANGLE(GetString)
+#define glGetSubroutineIndex MANGLE(GetSubroutineIndex)
+#define glGetSubroutineUniformLocation MANGLE(GetSubroutineUniformLocation)
+#define glGetSynciv MANGLE(GetSynciv)
+#define glGetTexBumpParameterfvATI MANGLE(GetTexBumpParameterfvATI)
+#define glGetTexBumpParameterivATI MANGLE(GetTexBumpParameterivATI)
+#define glGetTexEnvfv MANGLE(GetTexEnvfv)
+#define glGetTexEnviv MANGLE(GetTexEnviv)
+#define glGetTexFilterFuncSGIS MANGLE(GetTexFilterFuncSGIS)
+#define glGetTexGendv MANGLE(GetTexGendv)
+#define glGetTexGenfv MANGLE(GetTexGenfv)
+#define glGetTexGeniv MANGLE(GetTexGeniv)
+#define glGetTexImage MANGLE(GetTexImage)
+#define glGetTexLevelParameterfv MANGLE(GetTexLevelParameterfv)
+#define glGetTexLevelParameteriv MANGLE(GetTexLevelParameteriv)
+#define glGetTexParameterfv MANGLE(GetTexParameterfv)
+#define glGetTexParameterIivEXT MANGLE(GetTexParameterIivEXT)
+#define glGetTexParameterIiv MANGLE(GetTexParameterIiv)
+#define glGetTexParameterIuivEXT MANGLE(GetTexParameterIuivEXT)
+#define glGetTexParameterIuiv MANGLE(GetTexParameterIuiv)
+#define glGetTexParameteriv MANGLE(GetTexParameteriv)
+#define glGetTexParameterPointervAPPLE MANGLE(GetTexParameterPointervAPPLE)
+#define glGetTextureImageEXT MANGLE(GetTextureImageEXT)
+#define glGetTextureLevelParameterfvEXT MANGLE(GetTextureLevelParameterfvEXT)
+#define glGetTextureLevelParameterivEXT MANGLE(GetTextureLevelParameterivEXT)
+#define glGetTextureParameterfvEXT MANGLE(GetTextureParameterfvEXT)
+#define glGetTextureParameterIivEXT MANGLE(GetTextureParameterIivEXT)
+#define glGetTextureParameterIuivEXT MANGLE(GetTextureParameterIuivEXT)
+#define glGetTextureParameterivEXT MANGLE(GetTextureParameterivEXT)
+#define glGetTrackMatrixivNV MANGLE(GetTrackMatrixivNV)
+#define glGetTransformFeedbackVaryingEXT MANGLE(GetTransformFeedbackVaryingEXT)
+#define glGetTransformFeedbackVarying MANGLE(GetTransformFeedbackVarying)
+#define glGetTransformFeedbackVaryingNV MANGLE(GetTransformFeedbackVaryingNV)
+#define glGetUniformBlockIndex MANGLE(GetUniformBlockIndex)
+#define glGetUniformBufferSizeEXT MANGLE(GetUniformBufferSizeEXT)
+#define glGetUniformdv MANGLE(GetUniformdv)
+#define glGetUniformfvARB MANGLE(GetUniformfvARB)
+#define glGetUniformfv MANGLE(GetUniformfv)
+#define glGetUniformi64vNV MANGLE(GetUniformi64vNV)
+#define glGetUniformIndices MANGLE(GetUniformIndices)
+#define glGetUniformivARB MANGLE(GetUniformivARB)
+#define glGetUniformiv MANGLE(GetUniformiv)
+#define glGetUniformLocationARB MANGLE(GetUniformLocationARB)
+#define glGetUniformLocation MANGLE(GetUniformLocation)
+#define glGetUniformOffsetEXT MANGLE(GetUniformOffsetEXT)
+#define glGetUniformSubroutineuiv MANGLE(GetUniformSubroutineuiv)
+#define glGetUniformui64vNV MANGLE(GetUniformui64vNV)
+#define glGetUniformuivEXT MANGLE(GetUniformuivEXT)
+#define glGetUniformuiv MANGLE(GetUniformuiv)
+#define glGetVariantArrayObjectfvATI MANGLE(GetVariantArrayObjectfvATI)
+#define glGetVariantArrayObjectivATI MANGLE(GetVariantArrayObjectivATI)
+#define glGetVariantBooleanvEXT MANGLE(GetVariantBooleanvEXT)
+#define glGetVariantFloatvEXT MANGLE(GetVariantFloatvEXT)
+#define glGetVariantIntegervEXT MANGLE(GetVariantIntegervEXT)
+#define glGetVariantPointervEXT MANGLE(GetVariantPointervEXT)
+#define glGetVaryingLocationNV MANGLE(GetVaryingLocationNV)
+#define glGetVertexAttribArrayObjectfvATI MANGLE(GetVertexAttribArrayObjectfvATI)
+#define glGetVertexAttribArrayObjectivATI MANGLE(GetVertexAttribArrayObjectivATI)
+#define glGetVertexAttribdvARB MANGLE(GetVertexAttribdvARB)
+#define glGetVertexAttribdv MANGLE(GetVertexAttribdv)
+#define glGetVertexAttribdvNV MANGLE(GetVertexAttribdvNV)
+#define glGetVertexAttribfvARB MANGLE(GetVertexAttribfvARB)
+#define glGetVertexAttribfv MANGLE(GetVertexAttribfv)
+#define glGetVertexAttribfvNV MANGLE(GetVertexAttribfvNV)
+#define glGetVertexAttribIivEXT MANGLE(GetVertexAttribIivEXT)
+#define glGetVertexAttribIiv MANGLE(GetVertexAttribIiv)
+#define glGetVertexAttribIuivEXT MANGLE(GetVertexAttribIuivEXT)
+#define glGetVertexAttribIuiv MANGLE(GetVertexAttribIuiv)
+#define glGetVertexAttribivARB MANGLE(GetVertexAttribivARB)
+#define glGetVertexAttribiv MANGLE(GetVertexAttribiv)
+#define glGetVertexAttribivNV MANGLE(GetVertexAttribivNV)
+#define glGetVertexAttribLdvEXT MANGLE(GetVertexAttribLdvEXT)
+#define glGetVertexAttribLdv MANGLE(GetVertexAttribLdv)
+#define glGetVertexAttribLi64vNV MANGLE(GetVertexAttribLi64vNV)
+#define glGetVertexAttribLui64vNV MANGLE(GetVertexAttribLui64vNV)
+#define glGetVertexAttribPointervARB MANGLE(GetVertexAttribPointervARB)
+#define glGetVertexAttribPointerv MANGLE(GetVertexAttribPointerv)
+#define glGetVertexAttribPointervNV MANGLE(GetVertexAttribPointervNV)
+#define glGetVideoCaptureivNV MANGLE(GetVideoCaptureivNV)
+#define glGetVideoCaptureStreamdvNV MANGLE(GetVideoCaptureStreamdvNV)
+#define glGetVideoCaptureStreamfvNV MANGLE(GetVideoCaptureStreamfvNV)
+#define glGetVideoCaptureStreamivNV MANGLE(GetVideoCaptureStreamivNV)
+#define glGetVideoi64vNV MANGLE(GetVideoi64vNV)
+#define glGetVideoivNV MANGLE(GetVideoivNV)
+#define glGetVideoui64vNV MANGLE(GetVideoui64vNV)
+#define glGetVideouivNV MANGLE(GetVideouivNV)
+#define glGlobalAlphaFactorbSUN MANGLE(GlobalAlphaFactorbSUN)
+#define glGlobalAlphaFactordSUN MANGLE(GlobalAlphaFactordSUN)
+#define glGlobalAlphaFactorfSUN MANGLE(GlobalAlphaFactorfSUN)
+#define glGlobalAlphaFactoriSUN MANGLE(GlobalAlphaFactoriSUN)
+#define glGlobalAlphaFactorsSUN MANGLE(GlobalAlphaFactorsSUN)
+#define glGlobalAlphaFactorubSUN MANGLE(GlobalAlphaFactorubSUN)
+#define glGlobalAlphaFactoruiSUN MANGLE(GlobalAlphaFactoruiSUN)
+#define glGlobalAlphaFactorusSUN MANGLE(GlobalAlphaFactorusSUN)
+#define glHint MANGLE(Hint)
+#define glHintPGI MANGLE(HintPGI)
+#define glHistogramEXT MANGLE(HistogramEXT)
+#define glHistogram MANGLE(Histogram)
+#define glIglooInterfaceSGIX MANGLE(IglooInterfaceSGIX)
+#define glImageTransformParameterfHP MANGLE(ImageTransformParameterfHP)
+#define glImageTransformParameterfvHP MANGLE(ImageTransformParameterfvHP)
+#define glImageTransformParameteriHP MANGLE(ImageTransformParameteriHP)
+#define glImageTransformParameterivHP MANGLE(ImageTransformParameterivHP)
+#define glIndexd MANGLE(Indexd)
+#define glIndexdv MANGLE(Indexdv)
+#define glIndexf MANGLE(Indexf)
+#define glIndexFormatNV MANGLE(IndexFormatNV)
+#define glIndexFuncEXT MANGLE(IndexFuncEXT)
+#define glIndexfv MANGLE(Indexfv)
+#define glIndexi MANGLE(Indexi)
+#define glIndexiv MANGLE(Indexiv)
+#define glIndexMask MANGLE(IndexMask)
+#define glIndexMaterialEXT MANGLE(IndexMaterialEXT)
+#define glIndexPointerEXT MANGLE(IndexPointerEXT)
+#define glIndexPointerListIBM MANGLE(IndexPointerListIBM)
+#define glIndexPointer MANGLE(IndexPointer)
+#define glIndexs MANGLE(Indexs)
+#define glIndexsv MANGLE(Indexsv)
+#define glIndexub MANGLE(Indexub)
+#define glIndexubv MANGLE(Indexubv)
+#define glInitNames MANGLE(InitNames)
+#define glInsertComponentEXT MANGLE(InsertComponentEXT)
+#define glInstrumentsBufferSGIX MANGLE(InstrumentsBufferSGIX)
+#define glInterleavedArrays MANGLE(InterleavedArrays)
+#define glIsAsyncMarkerSGIX MANGLE(IsAsyncMarkerSGIX)
+#define glIsBufferARB MANGLE(IsBufferARB)
+#define glIsBuffer MANGLE(IsBuffer)
+#define glIsBufferResidentNV MANGLE(IsBufferResidentNV)
+#define glIsEnabledi MANGLE(IsEnabledi)
+#define glIsEnabledIndexedEXT MANGLE(IsEnabledIndexedEXT)
+#define glIsEnabled MANGLE(IsEnabled)
+#define glIsFenceAPPLE MANGLE(IsFenceAPPLE)
+#define glIsFenceNV MANGLE(IsFenceNV)
+#define glIsFramebufferEXT MANGLE(IsFramebufferEXT)
+#define glIsFramebuffer MANGLE(IsFramebuffer)
+#define glIsList MANGLE(IsList)
+#define glIsNameAMD MANGLE(IsNameAMD)
+#define glIsNamedBufferResidentNV MANGLE(IsNamedBufferResidentNV)
+#define glIsNamedStringARB MANGLE(IsNamedStringARB)
+#define glIsObjectBufferATI MANGLE(IsObjectBufferATI)
+#define glIsOcclusionQueryNV MANGLE(IsOcclusionQueryNV)
+#define glIsProgramARB MANGLE(IsProgramARB)
+#define glIsProgram MANGLE(IsProgram)
+#define glIsProgramNV MANGLE(IsProgramNV)
+#define glIsProgramPipeline MANGLE(IsProgramPipeline)
+#define glIsQueryARB MANGLE(IsQueryARB)
+#define glIsQuery MANGLE(IsQuery)
+#define glIsRenderbufferEXT MANGLE(IsRenderbufferEXT)
+#define glIsRenderbuffer MANGLE(IsRenderbuffer)
+#define glIsSampler MANGLE(IsSampler)
+#define glIsShader MANGLE(IsShader)
+#define glIsSync MANGLE(IsSync)
+#define glIsTextureEXT MANGLE(IsTextureEXT)
+#define glIsTexture MANGLE(IsTexture)
+#define glIsTransformFeedback MANGLE(IsTransformFeedback)
+#define glIsTransformFeedbackNV MANGLE(IsTransformFeedbackNV)
+#define glIsVariantEnabledEXT MANGLE(IsVariantEnabledEXT)
+#define glIsVertexArrayAPPLE MANGLE(IsVertexArrayAPPLE)
+#define glIsVertexArray MANGLE(IsVertexArray)
+#define glIsVertexAttribEnabledAPPLE MANGLE(IsVertexAttribEnabledAPPLE)
+#define glLightEnviSGIX MANGLE(LightEnviSGIX)
+#define glLightf MANGLE(Lightf)
+#define glLightfv MANGLE(Lightfv)
+#define glLighti MANGLE(Lighti)
+#define glLightiv MANGLE(Lightiv)
+#define glLightModelf MANGLE(LightModelf)
+#define glLightModelfv MANGLE(LightModelfv)
+#define glLightModeli MANGLE(LightModeli)
+#define glLightModeliv MANGLE(LightModeliv)
+#define glLineStipple MANGLE(LineStipple)
+#define glLineWidth MANGLE(LineWidth)
+#define glLinkProgramARB MANGLE(LinkProgramARB)
+#define glLinkProgram MANGLE(LinkProgram)
+#define glListBase MANGLE(ListBase)
+#define glListParameterfSGIX MANGLE(ListParameterfSGIX)
+#define glListParameterfvSGIX MANGLE(ListParameterfvSGIX)
+#define glListParameteriSGIX MANGLE(ListParameteriSGIX)
+#define glListParameterivSGIX MANGLE(ListParameterivSGIX)
+#define glLoadIdentityDeformationMapSGIX MANGLE(LoadIdentityDeformationMapSGIX)
+#define glLoadIdentity MANGLE(LoadIdentity)
+#define glLoadMatrixd MANGLE(LoadMatrixd)
+#define glLoadMatrixf MANGLE(LoadMatrixf)
+#define glLoadName MANGLE(LoadName)
+#define glLoadProgramNV MANGLE(LoadProgramNV)
+#define glLoadTransposeMatrixdARB MANGLE(LoadTransposeMatrixdARB)
+#define glLoadTransposeMatrixd MANGLE(LoadTransposeMatrixd)
+#define glLoadTransposeMatrixfARB MANGLE(LoadTransposeMatrixfARB)
+#define glLoadTransposeMatrixf MANGLE(LoadTransposeMatrixf)
+#define glLockArraysEXT MANGLE(LockArraysEXT)
+#define glLogicOp MANGLE(LogicOp)
+#define glMakeBufferNonResidentNV MANGLE(MakeBufferNonResidentNV)
+#define glMakeBufferResidentNV MANGLE(MakeBufferResidentNV)
+#define glMakeNamedBufferNonResidentNV MANGLE(MakeNamedBufferNonResidentNV)
+#define glMakeNamedBufferResidentNV MANGLE(MakeNamedBufferResidentNV)
+#define glMap1d MANGLE(Map1d)
+#define glMap1f MANGLE(Map1f)
+#define glMap2d MANGLE(Map2d)
+#define glMap2f MANGLE(Map2f)
+#define glMapBufferARB MANGLE(MapBufferARB)
+#define glMapBuffer MANGLE(MapBuffer)
+#define glMapBufferRange MANGLE(MapBufferRange)
+#define glMapControlPointsNV MANGLE(MapControlPointsNV)
+#define glMapGrid1d MANGLE(MapGrid1d)
+#define glMapGrid1f MANGLE(MapGrid1f)
+#define glMapGrid2d MANGLE(MapGrid2d)
+#define glMapGrid2f MANGLE(MapGrid2f)
+#define glMapNamedBufferEXT MANGLE(MapNamedBufferEXT)
+#define glMapNamedBufferRangeEXT MANGLE(MapNamedBufferRangeEXT)
+#define glMapObjectBufferATI MANGLE(MapObjectBufferATI)
+#define glMapParameterfvNV MANGLE(MapParameterfvNV)
+#define glMapParameterivNV MANGLE(MapParameterivNV)
+#define glMapVertexAttrib1dAPPLE MANGLE(MapVertexAttrib1dAPPLE)
+#define glMapVertexAttrib1fAPPLE MANGLE(MapVertexAttrib1fAPPLE)
+#define glMapVertexAttrib2dAPPLE MANGLE(MapVertexAttrib2dAPPLE)
+#define glMapVertexAttrib2fAPPLE MANGLE(MapVertexAttrib2fAPPLE)
+#define glMaterialf MANGLE(Materialf)
+#define glMaterialfv MANGLE(Materialfv)
+#define glMateriali MANGLE(Materiali)
+#define glMaterialiv MANGLE(Materialiv)
+#define glMatrixFrustumEXT MANGLE(MatrixFrustumEXT)
+#define glMatrixIndexPointerARB MANGLE(MatrixIndexPointerARB)
+#define glMatrixIndexubvARB MANGLE(MatrixIndexubvARB)
+#define glMatrixIndexuivARB MANGLE(MatrixIndexuivARB)
+#define glMatrixIndexusvARB MANGLE(MatrixIndexusvARB)
+#define glMatrixLoaddEXT MANGLE(MatrixLoaddEXT)
+#define glMatrixLoadfEXT MANGLE(MatrixLoadfEXT)
+#define glMatrixLoadIdentityEXT MANGLE(MatrixLoadIdentityEXT)
+#define glMatrixLoadTransposedEXT MANGLE(MatrixLoadTransposedEXT)
+#define glMatrixLoadTransposefEXT MANGLE(MatrixLoadTransposefEXT)
+#define glMatrixMode MANGLE(MatrixMode)
+#define glMatrixMultdEXT MANGLE(MatrixMultdEXT)
+#define glMatrixMultfEXT MANGLE(MatrixMultfEXT)
+#define glMatrixMultTransposedEXT MANGLE(MatrixMultTransposedEXT)
+#define glMatrixMultTransposefEXT MANGLE(MatrixMultTransposefEXT)
+#define glMatrixOrthoEXT MANGLE(MatrixOrthoEXT)
+#define glMatrixPopEXT MANGLE(MatrixPopEXT)
+#define glMatrixPushEXT MANGLE(MatrixPushEXT)
+#define glMatrixRotatedEXT MANGLE(MatrixRotatedEXT)
+#define glMatrixRotatefEXT MANGLE(MatrixRotatefEXT)
+#define glMatrixScaledEXT MANGLE(MatrixScaledEXT)
+#define glMatrixScalefEXT MANGLE(MatrixScalefEXT)
+#define glMatrixTranslatedEXT MANGLE(MatrixTranslatedEXT)
+#define glMatrixTranslatefEXT MANGLE(MatrixTranslatefEXT)
+#define glMemoryBarrierEXT MANGLE(MemoryBarrierEXT)
+#define glMinmaxEXT MANGLE(MinmaxEXT)
+#define glMinmax MANGLE(Minmax)
+#define glMinSampleShadingARB MANGLE(MinSampleShadingARB)
+#define glMinSampleShading MANGLE(MinSampleShading)
+#define glMultiDrawArraysEXT MANGLE(MultiDrawArraysEXT)
+#define glMultiDrawArrays MANGLE(MultiDrawArrays)
+#define glMultiDrawElementArrayAPPLE MANGLE(MultiDrawElementArrayAPPLE)
+#define glMultiDrawElementsBaseVertex MANGLE(MultiDrawElementsBaseVertex)
+#define glMultiDrawElementsEXT MANGLE(MultiDrawElementsEXT)
+#define glMultiDrawElements MANGLE(MultiDrawElements)
+#define glMultiDrawRangeElementArrayAPPLE MANGLE(MultiDrawRangeElementArrayAPPLE)
+#define glMultiModeDrawArraysIBM MANGLE(MultiModeDrawArraysIBM)
+#define glMultiModeDrawElementsIBM MANGLE(MultiModeDrawElementsIBM)
+#define glMultiTexBufferEXT MANGLE(MultiTexBufferEXT)
+#define glMultiTexCoord1dARB MANGLE(MultiTexCoord1dARB)
+#define glMultiTexCoord1d MANGLE(MultiTexCoord1d)
+#define glMultiTexCoord1dvARB MANGLE(MultiTexCoord1dvARB)
+#define glMultiTexCoord1dv MANGLE(MultiTexCoord1dv)
+#define glMultiTexCoord1fARB MANGLE(MultiTexCoord1fARB)
+#define glMultiTexCoord1f MANGLE(MultiTexCoord1f)
+#define glMultiTexCoord1fvARB MANGLE(MultiTexCoord1fvARB)
+#define glMultiTexCoord1fv MANGLE(MultiTexCoord1fv)
+#define glMultiTexCoord1hNV MANGLE(MultiTexCoord1hNV)
+#define glMultiTexCoord1hvNV MANGLE(MultiTexCoord1hvNV)
+#define glMultiTexCoord1iARB MANGLE(MultiTexCoord1iARB)
+#define glMultiTexCoord1i MANGLE(MultiTexCoord1i)
+#define glMultiTexCoord1ivARB MANGLE(MultiTexCoord1ivARB)
+#define glMultiTexCoord1iv MANGLE(MultiTexCoord1iv)
+#define glMultiTexCoord1sARB MANGLE(MultiTexCoord1sARB)
+#define glMultiTexCoord1s MANGLE(MultiTexCoord1s)
+#define glMultiTexCoord1svARB MANGLE(MultiTexCoord1svARB)
+#define glMultiTexCoord1sv MANGLE(MultiTexCoord1sv)
+#define glMultiTexCoord2dARB MANGLE(MultiTexCoord2dARB)
+#define glMultiTexCoord2d MANGLE(MultiTexCoord2d)
+#define glMultiTexCoord2dvARB MANGLE(MultiTexCoord2dvARB)
+#define glMultiTexCoord2dv MANGLE(MultiTexCoord2dv)
+#define glMultiTexCoord2fARB MANGLE(MultiTexCoord2fARB)
+#define glMultiTexCoord2f MANGLE(MultiTexCoord2f)
+#define glMultiTexCoord2fvARB MANGLE(MultiTexCoord2fvARB)
+#define glMultiTexCoord2fv MANGLE(MultiTexCoord2fv)
+#define glMultiTexCoord2hNV MANGLE(MultiTexCoord2hNV)
+#define glMultiTexCoord2hvNV MANGLE(MultiTexCoord2hvNV)
+#define glMultiTexCoord2iARB MANGLE(MultiTexCoord2iARB)
+#define glMultiTexCoord2i MANGLE(MultiTexCoord2i)
+#define glMultiTexCoord2ivARB MANGLE(MultiTexCoord2ivARB)
+#define glMultiTexCoord2iv MANGLE(MultiTexCoord2iv)
+#define glMultiTexCoord2sARB MANGLE(MultiTexCoord2sARB)
+#define glMultiTexCoord2s MANGLE(MultiTexCoord2s)
+#define glMultiTexCoord2svARB MANGLE(MultiTexCoord2svARB)
+#define glMultiTexCoord2sv MANGLE(MultiTexCoord2sv)
+#define glMultiTexCoord3dARB MANGLE(MultiTexCoord3dARB)
+#define glMultiTexCoord3d MANGLE(MultiTexCoord3d)
+#define glMultiTexCoord3dvARB MANGLE(MultiTexCoord3dvARB)
+#define glMultiTexCoord3dv MANGLE(MultiTexCoord3dv)
+#define glMultiTexCoord3fARB MANGLE(MultiTexCoord3fARB)
+#define glMultiTexCoord3f MANGLE(MultiTexCoord3f)
+#define glMultiTexCoord3fvARB MANGLE(MultiTexCoord3fvARB)
+#define glMultiTexCoord3fv MANGLE(MultiTexCoord3fv)
+#define glMultiTexCoord3hNV MANGLE(MultiTexCoord3hNV)
+#define glMultiTexCoord3hvNV MANGLE(MultiTexCoord3hvNV)
+#define glMultiTexCoord3iARB MANGLE(MultiTexCoord3iARB)
+#define glMultiTexCoord3i MANGLE(MultiTexCoord3i)
+#define glMultiTexCoord3ivARB MANGLE(MultiTexCoord3ivARB)
+#define glMultiTexCoord3iv MANGLE(MultiTexCoord3iv)
+#define glMultiTexCoord3sARB MANGLE(MultiTexCoord3sARB)
+#define glMultiTexCoord3s MANGLE(MultiTexCoord3s)
+#define glMultiTexCoord3svARB MANGLE(MultiTexCoord3svARB)
+#define glMultiTexCoord3sv MANGLE(MultiTexCoord3sv)
+#define glMultiTexCoord4dARB MANGLE(MultiTexCoord4dARB)
+#define glMultiTexCoord4d MANGLE(MultiTexCoord4d)
+#define glMultiTexCoord4dvARB MANGLE(MultiTexCoord4dvARB)
+#define glMultiTexCoord4dv MANGLE(MultiTexCoord4dv)
+#define glMultiTexCoord4fARB MANGLE(MultiTexCoord4fARB)
+#define glMultiTexCoord4f MANGLE(MultiTexCoord4f)
+#define glMultiTexCoord4fvARB MANGLE(MultiTexCoord4fvARB)
+#define glMultiTexCoord4fv MANGLE(MultiTexCoord4fv)
+#define glMultiTexCoord4hNV MANGLE(MultiTexCoord4hNV)
+#define glMultiTexCoord4hvNV MANGLE(MultiTexCoord4hvNV)
+#define glMultiTexCoord4iARB MANGLE(MultiTexCoord4iARB)
+#define glMultiTexCoord4i MANGLE(MultiTexCoord4i)
+#define glMultiTexCoord4ivARB MANGLE(MultiTexCoord4ivARB)
+#define glMultiTexCoord4iv MANGLE(MultiTexCoord4iv)
+#define glMultiTexCoord4sARB MANGLE(MultiTexCoord4sARB)
+#define glMultiTexCoord4s MANGLE(MultiTexCoord4s)
+#define glMultiTexCoord4svARB MANGLE(MultiTexCoord4svARB)
+#define glMultiTexCoord4sv MANGLE(MultiTexCoord4sv)
+#define glMultiTexCoordP1ui MANGLE(MultiTexCoordP1ui)
+#define glMultiTexCoordP1uiv MANGLE(MultiTexCoordP1uiv)
+#define glMultiTexCoordP2ui MANGLE(MultiTexCoordP2ui)
+#define glMultiTexCoordP2uiv MANGLE(MultiTexCoordP2uiv)
+#define glMultiTexCoordP3ui MANGLE(MultiTexCoordP3ui)
+#define glMultiTexCoordP3uiv MANGLE(MultiTexCoordP3uiv)
+#define glMultiTexCoordP4ui MANGLE(MultiTexCoordP4ui)
+#define glMultiTexCoordP4uiv MANGLE(MultiTexCoordP4uiv)
+#define glMultiTexCoordPointerEXT MANGLE(MultiTexCoordPointerEXT)
+#define glMultiTexEnvfEXT MANGLE(MultiTexEnvfEXT)
+#define glMultiTexEnvfvEXT MANGLE(MultiTexEnvfvEXT)
+#define glMultiTexEnviEXT MANGLE(MultiTexEnviEXT)
+#define glMultiTexEnvivEXT MANGLE(MultiTexEnvivEXT)
+#define glMultiTexGendEXT MANGLE(MultiTexGendEXT)
+#define glMultiTexGendvEXT MANGLE(MultiTexGendvEXT)
+#define glMultiTexGenfEXT MANGLE(MultiTexGenfEXT)
+#define glMultiTexGenfvEXT MANGLE(MultiTexGenfvEXT)
+#define glMultiTexGeniEXT MANGLE(MultiTexGeniEXT)
+#define glMultiTexGenivEXT MANGLE(MultiTexGenivEXT)
+#define glMultiTexImage1DEXT MANGLE(MultiTexImage1DEXT)
+#define glMultiTexImage2DEXT MANGLE(MultiTexImage2DEXT)
+#define glMultiTexImage3DEXT MANGLE(MultiTexImage3DEXT)
+#define glMultiTexParameterfEXT MANGLE(MultiTexParameterfEXT)
+#define glMultiTexParameterfvEXT MANGLE(MultiTexParameterfvEXT)
+#define glMultiTexParameteriEXT MANGLE(MultiTexParameteriEXT)
+#define glMultiTexParameterIivEXT MANGLE(MultiTexParameterIivEXT)
+#define glMultiTexParameterIuivEXT MANGLE(MultiTexParameterIuivEXT)
+#define glMultiTexParameterivEXT MANGLE(MultiTexParameterivEXT)
+#define glMultiTexRenderbufferEXT MANGLE(MultiTexRenderbufferEXT)
+#define glMultiTexSubImage1DEXT MANGLE(MultiTexSubImage1DEXT)
+#define glMultiTexSubImage2DEXT MANGLE(MultiTexSubImage2DEXT)
+#define glMultiTexSubImage3DEXT MANGLE(MultiTexSubImage3DEXT)
+#define glMultMatrixd MANGLE(MultMatrixd)
+#define glMultMatrixf MANGLE(MultMatrixf)
+#define glMultTransposeMatrixdARB MANGLE(MultTransposeMatrixdARB)
+#define glMultTransposeMatrixd MANGLE(MultTransposeMatrixd)
+#define glMultTransposeMatrixfARB MANGLE(MultTransposeMatrixfARB)
+#define glMultTransposeMatrixf MANGLE(MultTransposeMatrixf)
+#define glNamedBufferDataEXT MANGLE(NamedBufferDataEXT)
+#define glNamedBufferSubDataEXT MANGLE(NamedBufferSubDataEXT)
+#define glNamedCopyBufferSubDataEXT MANGLE(NamedCopyBufferSubDataEXT)
+#define glNamedFramebufferRenderbufferEXT MANGLE(NamedFramebufferRenderbufferEXT)
+#define glNamedFramebufferTexture1DEXT MANGLE(NamedFramebufferTexture1DEXT)
+#define glNamedFramebufferTexture2DEXT MANGLE(NamedFramebufferTexture2DEXT)
+#define glNamedFramebufferTexture3DEXT MANGLE(NamedFramebufferTexture3DEXT)
+#define glNamedFramebufferTextureEXT MANGLE(NamedFramebufferTextureEXT)
+#define glNamedFramebufferTextureFaceEXT MANGLE(NamedFramebufferTextureFaceEXT)
+#define glNamedFramebufferTextureLayerEXT MANGLE(NamedFramebufferTextureLayerEXT)
+#define glNamedProgramLocalParameter4dEXT MANGLE(NamedProgramLocalParameter4dEXT)
+#define glNamedProgramLocalParameter4dvEXT MANGLE(NamedProgramLocalParameter4dvEXT)
+#define glNamedProgramLocalParameter4fEXT MANGLE(NamedProgramLocalParameter4fEXT)
+#define glNamedProgramLocalParameter4fvEXT MANGLE(NamedProgramLocalParameter4fvEXT)
+#define glNamedProgramLocalParameterI4iEXT MANGLE(NamedProgramLocalParameterI4iEXT)
+#define glNamedProgramLocalParameterI4ivEXT MANGLE(NamedProgramLocalParameterI4ivEXT)
+#define glNamedProgramLocalParameterI4uiEXT MANGLE(NamedProgramLocalParameterI4uiEXT)
+#define glNamedProgramLocalParameterI4uivEXT MANGLE(NamedProgramLocalParameterI4uivEXT)
+#define glNamedProgramLocalParameters4fvEXT MANGLE(NamedProgramLocalParameters4fvEXT)
+#define glNamedProgramLocalParametersI4ivEXT MANGLE(NamedProgramLocalParametersI4ivEXT)
+#define glNamedProgramLocalParametersI4uivEXT MANGLE(NamedProgramLocalParametersI4uivEXT)
+#define glNamedProgramStringEXT MANGLE(NamedProgramStringEXT)
+#define glNamedRenderbufferStorageEXT MANGLE(NamedRenderbufferStorageEXT)
+#define glNamedRenderbufferStorageMultisampleCoverageEXT MANGLE(NamedRenderbufferStorageMultisampleCoverageEXT)
+#define glNamedRenderbufferStorageMultisampleEXT MANGLE(NamedRenderbufferStorageMultisampleEXT)
+#define glNamedStringARB MANGLE(NamedStringARB)
+#define glNewList MANGLE(NewList)
+#define glNewObjectBufferATI MANGLE(NewObjectBufferATI)
+#define glNormal3b MANGLE(Normal3b)
+#define glNormal3bv MANGLE(Normal3bv)
+#define glNormal3d MANGLE(Normal3d)
+#define glNormal3dv MANGLE(Normal3dv)
+#define glNormal3f MANGLE(Normal3f)
+#define glNormal3fVertex3fSUN MANGLE(Normal3fVertex3fSUN)
+#define glNormal3fVertex3fvSUN MANGLE(Normal3fVertex3fvSUN)
+#define glNormal3fv MANGLE(Normal3fv)
+#define glNormal3hNV MANGLE(Normal3hNV)
+#define glNormal3hvNV MANGLE(Normal3hvNV)
+#define glNormal3i MANGLE(Normal3i)
+#define glNormal3iv MANGLE(Normal3iv)
+#define glNormal3s MANGLE(Normal3s)
+#define glNormal3sv MANGLE(Normal3sv)
+#define glNormalFormatNV MANGLE(NormalFormatNV)
+#define glNormalP3ui MANGLE(NormalP3ui)
+#define glNormalP3uiv MANGLE(NormalP3uiv)
+#define glNormalPointerEXT MANGLE(NormalPointerEXT)
+#define glNormalPointerListIBM MANGLE(NormalPointerListIBM)
+#define glNormalPointer MANGLE(NormalPointer)
+#define glNormalPointervINTEL MANGLE(NormalPointervINTEL)
+#define glNormalStream3bATI MANGLE(NormalStream3bATI)
+#define glNormalStream3bvATI MANGLE(NormalStream3bvATI)
+#define glNormalStream3dATI MANGLE(NormalStream3dATI)
+#define glNormalStream3dvATI MANGLE(NormalStream3dvATI)
+#define glNormalStream3fATI MANGLE(NormalStream3fATI)
+#define glNormalStream3fvATI MANGLE(NormalStream3fvATI)
+#define glNormalStream3iATI MANGLE(NormalStream3iATI)
+#define glNormalStream3ivATI MANGLE(NormalStream3ivATI)
+#define glNormalStream3sATI MANGLE(NormalStream3sATI)
+#define glNormalStream3svATI MANGLE(NormalStream3svATI)
+#define glObjectPurgeableAPPLE MANGLE(ObjectPurgeableAPPLE)
+#define glObjectUnpurgeableAPPLE MANGLE(ObjectUnpurgeableAPPLE)
+#define glOrtho MANGLE(Ortho)
+#define glPassTexCoordATI MANGLE(PassTexCoordATI)
+#define glPassThrough MANGLE(PassThrough)
+#define glPatchParameterfv MANGLE(PatchParameterfv)
+#define glPatchParameteri MANGLE(PatchParameteri)
+#define glPauseTransformFeedback MANGLE(PauseTransformFeedback)
+#define glPauseTransformFeedbackNV MANGLE(PauseTransformFeedbackNV)
+#define glPixelDataRangeNV MANGLE(PixelDataRangeNV)
+#define glPixelMapfv MANGLE(PixelMapfv)
+#define glPixelMapuiv MANGLE(PixelMapuiv)
+#define glPixelMapusv MANGLE(PixelMapusv)
+#define glPixelStoref MANGLE(PixelStoref)
+#define glPixelStorei MANGLE(PixelStorei)
+#define glPixelTexGenParameterfSGIS MANGLE(PixelTexGenParameterfSGIS)
+#define glPixelTexGenParameterfvSGIS MANGLE(PixelTexGenParameterfvSGIS)
+#define glPixelTexGenParameteriSGIS MANGLE(PixelTexGenParameteriSGIS)
+#define glPixelTexGenParameterivSGIS MANGLE(PixelTexGenParameterivSGIS)
+#define glPixelTexGenSGIX MANGLE(PixelTexGenSGIX)
+#define glPixelTransferf MANGLE(PixelTransferf)
+#define glPixelTransferi MANGLE(PixelTransferi)
+#define glPixelTransformParameterfEXT MANGLE(PixelTransformParameterfEXT)
+#define glPixelTransformParameterfvEXT MANGLE(PixelTransformParameterfvEXT)
+#define glPixelTransformParameteriEXT MANGLE(PixelTransformParameteriEXT)
+#define glPixelTransformParameterivEXT MANGLE(PixelTransformParameterivEXT)
+#define glPixelZoom MANGLE(PixelZoom)
+#define glPNTrianglesfATI MANGLE(PNTrianglesfATI)
+#define glPNTrianglesiATI MANGLE(PNTrianglesiATI)
+#define glPointParameterfARB MANGLE(PointParameterfARB)
+#define glPointParameterfEXT MANGLE(PointParameterfEXT)
+#define glPointParameterf MANGLE(PointParameterf)
+#define glPointParameterfSGIS MANGLE(PointParameterfSGIS)
+#define glPointParameterfvARB MANGLE(PointParameterfvARB)
+#define glPointParameterfvEXT MANGLE(PointParameterfvEXT)
+#define glPointParameterfv MANGLE(PointParameterfv)
+#define glPointParameterfvSGIS MANGLE(PointParameterfvSGIS)
+#define glPointParameteri MANGLE(PointParameteri)
+#define glPointParameteriNV MANGLE(PointParameteriNV)
+#define glPointParameteriv MANGLE(PointParameteriv)
+#define glPointParameterivNV MANGLE(PointParameterivNV)
+#define glPointSize MANGLE(PointSize)
+#define glPollAsyncSGIX MANGLE(PollAsyncSGIX)
+#define glPollInstrumentsSGIX MANGLE(PollInstrumentsSGIX)
+#define glPolygonMode MANGLE(PolygonMode)
+#define glPolygonOffsetEXT MANGLE(PolygonOffsetEXT)
+#define glPolygonOffset MANGLE(PolygonOffset)
+#define glPolygonStipple MANGLE(PolygonStipple)
+#define glPopAttrib MANGLE(PopAttrib)
+#define glPopClientAttrib MANGLE(PopClientAttrib)
+#define glPopMatrix MANGLE(PopMatrix)
+#define glPopName MANGLE(PopName)
+#define glPresentFrameDualFillNV MANGLE(PresentFrameDualFillNV)
+#define glPresentFrameKeyedNV MANGLE(PresentFrameKeyedNV)
+#define glPrimitiveRestartIndex MANGLE(PrimitiveRestartIndex)
+#define glPrimitiveRestartIndexNV MANGLE(PrimitiveRestartIndexNV)
+#define glPrimitiveRestartNV MANGLE(PrimitiveRestartNV)
+#define glPrioritizeTexturesEXT MANGLE(PrioritizeTexturesEXT)
+#define glPrioritizeTextures MANGLE(PrioritizeTextures)
+#define glProgramBinary MANGLE(ProgramBinary)
+#define glProgramBufferParametersfvNV MANGLE(ProgramBufferParametersfvNV)
+#define glProgramBufferParametersIivNV MANGLE(ProgramBufferParametersIivNV)
+#define glProgramBufferParametersIuivNV MANGLE(ProgramBufferParametersIuivNV)
+#define glProgramCallbackMESA MANGLE(ProgramCallbackMESA)
+#define glProgramEnvParameter4dARB MANGLE(ProgramEnvParameter4dARB)
+#define glProgramEnvParameter4dvARB MANGLE(ProgramEnvParameter4dvARB)
+#define glProgramEnvParameter4fARB MANGLE(ProgramEnvParameter4fARB)
+#define glProgramEnvParameter4fvARB MANGLE(ProgramEnvParameter4fvARB)
+#define glProgramEnvParameterI4iNV MANGLE(ProgramEnvParameterI4iNV)
+#define glProgramEnvParameterI4ivNV MANGLE(ProgramEnvParameterI4ivNV)
+#define glProgramEnvParameterI4uiNV MANGLE(ProgramEnvParameterI4uiNV)
+#define glProgramEnvParameterI4uivNV MANGLE(ProgramEnvParameterI4uivNV)
+#define glProgramEnvParameters4fvEXT MANGLE(ProgramEnvParameters4fvEXT)
+#define glProgramEnvParametersI4ivNV MANGLE(ProgramEnvParametersI4ivNV)
+#define glProgramEnvParametersI4uivNV MANGLE(ProgramEnvParametersI4uivNV)
+#define glProgramLocalParameter4dARB MANGLE(ProgramLocalParameter4dARB)
+#define glProgramLocalParameter4dvARB MANGLE(ProgramLocalParameter4dvARB)
+#define glProgramLocalParameter4fARB MANGLE(ProgramLocalParameter4fARB)
+#define glProgramLocalParameter4fvARB MANGLE(ProgramLocalParameter4fvARB)
+#define glProgramLocalParameterI4iNV MANGLE(ProgramLocalParameterI4iNV)
+#define glProgramLocalParameterI4ivNV MANGLE(ProgramLocalParameterI4ivNV)
+#define glProgramLocalParameterI4uiNV MANGLE(ProgramLocalParameterI4uiNV)
+#define glProgramLocalParameterI4uivNV MANGLE(ProgramLocalParameterI4uivNV)
+#define glProgramLocalParameters4fvEXT MANGLE(ProgramLocalParameters4fvEXT)
+#define glProgramLocalParametersI4ivNV MANGLE(ProgramLocalParametersI4ivNV)
+#define glProgramLocalParametersI4uivNV MANGLE(ProgramLocalParametersI4uivNV)
+#define glProgramNamedParameter4dNV MANGLE(ProgramNamedParameter4dNV)
+#define glProgramNamedParameter4dvNV MANGLE(ProgramNamedParameter4dvNV)
+#define glProgramNamedParameter4fNV MANGLE(ProgramNamedParameter4fNV)
+#define glProgramNamedParameter4fvNV MANGLE(ProgramNamedParameter4fvNV)
+#define glProgramParameter4dNV MANGLE(ProgramParameter4dNV)
+#define glProgramParameter4dvNV MANGLE(ProgramParameter4dvNV)
+#define glProgramParameter4fNV MANGLE(ProgramParameter4fNV)
+#define glProgramParameter4fvNV MANGLE(ProgramParameter4fvNV)
+#define glProgramParameteriARB MANGLE(ProgramParameteriARB)
+#define glProgramParameteriEXT MANGLE(ProgramParameteriEXT)
+#define glProgramParameteri MANGLE(ProgramParameteri)
+#define glProgramParameters4dvNV MANGLE(ProgramParameters4dvNV)
+#define glProgramParameters4fvNV MANGLE(ProgramParameters4fvNV)
+#define glProgramStringARB MANGLE(ProgramStringARB)
+#define glProgramSubroutineParametersuivNV MANGLE(ProgramSubroutineParametersuivNV)
+#define glProgramUniform1dEXT MANGLE(ProgramUniform1dEXT)
+#define glProgramUniform1d MANGLE(ProgramUniform1d)
+#define glProgramUniform1dvEXT MANGLE(ProgramUniform1dvEXT)
+#define glProgramUniform1dv MANGLE(ProgramUniform1dv)
+#define glProgramUniform1fEXT MANGLE(ProgramUniform1fEXT)
+#define glProgramUniform1f MANGLE(ProgramUniform1f)
+#define glProgramUniform1fvEXT MANGLE(ProgramUniform1fvEXT)
+#define glProgramUniform1fv MANGLE(ProgramUniform1fv)
+#define glProgramUniform1i64NV MANGLE(ProgramUniform1i64NV)
+#define glProgramUniform1i64vNV MANGLE(ProgramUniform1i64vNV)
+#define glProgramUniform1iEXT MANGLE(ProgramUniform1iEXT)
+#define glProgramUniform1i MANGLE(ProgramUniform1i)
+#define glProgramUniform1ivEXT MANGLE(ProgramUniform1ivEXT)
+#define glProgramUniform1iv MANGLE(ProgramUniform1iv)
+#define glProgramUniform1ui64NV MANGLE(ProgramUniform1ui64NV)
+#define glProgramUniform1ui64vNV MANGLE(ProgramUniform1ui64vNV)
+#define glProgramUniform1uiEXT MANGLE(ProgramUniform1uiEXT)
+#define glProgramUniform1ui MANGLE(ProgramUniform1ui)
+#define glProgramUniform1uivEXT MANGLE(ProgramUniform1uivEXT)
+#define glProgramUniform1uiv MANGLE(ProgramUniform1uiv)
+#define glProgramUniform2dEXT MANGLE(ProgramUniform2dEXT)
+#define glProgramUniform2d MANGLE(ProgramUniform2d)
+#define glProgramUniform2dvEXT MANGLE(ProgramUniform2dvEXT)
+#define glProgramUniform2dv MANGLE(ProgramUniform2dv)
+#define glProgramUniform2fEXT MANGLE(ProgramUniform2fEXT)
+#define glProgramUniform2f MANGLE(ProgramUniform2f)
+#define glProgramUniform2fvEXT MANGLE(ProgramUniform2fvEXT)
+#define glProgramUniform2fv MANGLE(ProgramUniform2fv)
+#define glProgramUniform2i64NV MANGLE(ProgramUniform2i64NV)
+#define glProgramUniform2i64vNV MANGLE(ProgramUniform2i64vNV)
+#define glProgramUniform2iEXT MANGLE(ProgramUniform2iEXT)
+#define glProgramUniform2i MANGLE(ProgramUniform2i)
+#define glProgramUniform2ivEXT MANGLE(ProgramUniform2ivEXT)
+#define glProgramUniform2iv MANGLE(ProgramUniform2iv)
+#define glProgramUniform2ui64NV MANGLE(ProgramUniform2ui64NV)
+#define glProgramUniform2ui64vNV MANGLE(ProgramUniform2ui64vNV)
+#define glProgramUniform2uiEXT MANGLE(ProgramUniform2uiEXT)
+#define glProgramUniform2ui MANGLE(ProgramUniform2ui)
+#define glProgramUniform2uivEXT MANGLE(ProgramUniform2uivEXT)
+#define glProgramUniform2uiv MANGLE(ProgramUniform2uiv)
+#define glProgramUniform3dEXT MANGLE(ProgramUniform3dEXT)
+#define glProgramUniform3d MANGLE(ProgramUniform3d)
+#define glProgramUniform3dvEXT MANGLE(ProgramUniform3dvEXT)
+#define glProgramUniform3dv MANGLE(ProgramUniform3dv)
+#define glProgramUniform3fEXT MANGLE(ProgramUniform3fEXT)
+#define glProgramUniform3f MANGLE(ProgramUniform3f)
+#define glProgramUniform3fvEXT MANGLE(ProgramUniform3fvEXT)
+#define glProgramUniform3fv MANGLE(ProgramUniform3fv)
+#define glProgramUniform3i64NV MANGLE(ProgramUniform3i64NV)
+#define glProgramUniform3i64vNV MANGLE(ProgramUniform3i64vNV)
+#define glProgramUniform3iEXT MANGLE(ProgramUniform3iEXT)
+#define glProgramUniform3i MANGLE(ProgramUniform3i)
+#define glProgramUniform3ivEXT MANGLE(ProgramUniform3ivEXT)
+#define glProgramUniform3iv MANGLE(ProgramUniform3iv)
+#define glProgramUniform3ui64NV MANGLE(ProgramUniform3ui64NV)
+#define glProgramUniform3ui64vNV MANGLE(ProgramUniform3ui64vNV)
+#define glProgramUniform3uiEXT MANGLE(ProgramUniform3uiEXT)
+#define glProgramUniform3ui MANGLE(ProgramUniform3ui)
+#define glProgramUniform3uivEXT MANGLE(ProgramUniform3uivEXT)
+#define glProgramUniform3uiv MANGLE(ProgramUniform3uiv)
+#define glProgramUniform4dEXT MANGLE(ProgramUniform4dEXT)
+#define glProgramUniform4d MANGLE(ProgramUniform4d)
+#define glProgramUniform4dvEXT MANGLE(ProgramUniform4dvEXT)
+#define glProgramUniform4dv MANGLE(ProgramUniform4dv)
+#define glProgramUniform4fEXT MANGLE(ProgramUniform4fEXT)
+#define glProgramUniform4f MANGLE(ProgramUniform4f)
+#define glProgramUniform4fvEXT MANGLE(ProgramUniform4fvEXT)
+#define glProgramUniform4fv MANGLE(ProgramUniform4fv)
+#define glProgramUniform4i64NV MANGLE(ProgramUniform4i64NV)
+#define glProgramUniform4i64vNV MANGLE(ProgramUniform4i64vNV)
+#define glProgramUniform4iEXT MANGLE(ProgramUniform4iEXT)
+#define glProgramUniform4i MANGLE(ProgramUniform4i)
+#define glProgramUniform4ivEXT MANGLE(ProgramUniform4ivEXT)
+#define glProgramUniform4iv MANGLE(ProgramUniform4iv)
+#define glProgramUniform4ui64NV MANGLE(ProgramUniform4ui64NV)
+#define glProgramUniform4ui64vNV MANGLE(ProgramUniform4ui64vNV)
+#define glProgramUniform4uiEXT MANGLE(ProgramUniform4uiEXT)
+#define glProgramUniform4ui MANGLE(ProgramUniform4ui)
+#define glProgramUniform4uivEXT MANGLE(ProgramUniform4uivEXT)
+#define glProgramUniform4uiv MANGLE(ProgramUniform4uiv)
+#define glProgramUniformMatrix2dvEXT MANGLE(ProgramUniformMatrix2dvEXT)
+#define glProgramUniformMatrix2dv MANGLE(ProgramUniformMatrix2dv)
+#define glProgramUniformMatrix2fvEXT MANGLE(ProgramUniformMatrix2fvEXT)
+#define glProgramUniformMatrix2fv MANGLE(ProgramUniformMatrix2fv)
+#define glProgramUniformMatrix2x3dvEXT MANGLE(ProgramUniformMatrix2x3dvEXT)
+#define glProgramUniformMatrix2x3dv MANGLE(ProgramUniformMatrix2x3dv)
+#define glProgramUniformMatrix2x3fvEXT MANGLE(ProgramUniformMatrix2x3fvEXT)
+#define glProgramUniformMatrix2x3fv MANGLE(ProgramUniformMatrix2x3fv)
+#define glProgramUniformMatrix2x4dvEXT MANGLE(ProgramUniformMatrix2x4dvEXT)
+#define glProgramUniformMatrix2x4dv MANGLE(ProgramUniformMatrix2x4dv)
+#define glProgramUniformMatrix2x4fvEXT MANGLE(ProgramUniformMatrix2x4fvEXT)
+#define glProgramUniformMatrix2x4fv MANGLE(ProgramUniformMatrix2x4fv)
+#define glProgramUniformMatrix3dvEXT MANGLE(ProgramUniformMatrix3dvEXT)
+#define glProgramUniformMatrix3dv MANGLE(ProgramUniformMatrix3dv)
+#define glProgramUniformMatrix3fvEXT MANGLE(ProgramUniformMatrix3fvEXT)
+#define glProgramUniformMatrix3fv MANGLE(ProgramUniformMatrix3fv)
+#define glProgramUniformMatrix3x2dvEXT MANGLE(ProgramUniformMatrix3x2dvEXT)
+#define glProgramUniformMatrix3x2dv MANGLE(ProgramUniformMatrix3x2dv)
+#define glProgramUniformMatrix3x2fvEXT MANGLE(ProgramUniformMatrix3x2fvEXT)
+#define glProgramUniformMatrix3x2fv MANGLE(ProgramUniformMatrix3x2fv)
+#define glProgramUniformMatrix3x4dvEXT MANGLE(ProgramUniformMatrix3x4dvEXT)
+#define glProgramUniformMatrix3x4dv MANGLE(ProgramUniformMatrix3x4dv)
+#define glProgramUniformMatrix3x4fvEXT MANGLE(ProgramUniformMatrix3x4fvEXT)
+#define glProgramUniformMatrix3x4fv MANGLE(ProgramUniformMatrix3x4fv)
+#define glProgramUniformMatrix4dvEXT MANGLE(ProgramUniformMatrix4dvEXT)
+#define glProgramUniformMatrix4dv MANGLE(ProgramUniformMatrix4dv)
+#define glProgramUniformMatrix4fvEXT MANGLE(ProgramUniformMatrix4fvEXT)
+#define glProgramUniformMatrix4fv MANGLE(ProgramUniformMatrix4fv)
+#define glProgramUniformMatrix4x2dvEXT MANGLE(ProgramUniformMatrix4x2dvEXT)
+#define glProgramUniformMatrix4x2dv MANGLE(ProgramUniformMatrix4x2dv)
+#define glProgramUniformMatrix4x2fvEXT MANGLE(ProgramUniformMatrix4x2fvEXT)
+#define glProgramUniformMatrix4x2fv MANGLE(ProgramUniformMatrix4x2fv)
+#define glProgramUniformMatrix4x3dvEXT MANGLE(ProgramUniformMatrix4x3dvEXT)
+#define glProgramUniformMatrix4x3dv MANGLE(ProgramUniformMatrix4x3dv)
+#define glProgramUniformMatrix4x3fvEXT MANGLE(ProgramUniformMatrix4x3fvEXT)
+#define glProgramUniformMatrix4x3fv MANGLE(ProgramUniformMatrix4x3fv)
+#define glProgramUniformui64NV MANGLE(ProgramUniformui64NV)
+#define glProgramUniformui64vNV MANGLE(ProgramUniformui64vNV)
+#define glProgramVertexLimitNV MANGLE(ProgramVertexLimitNV)
+#define glProvokingVertexEXT MANGLE(ProvokingVertexEXT)
+#define glProvokingVertex MANGLE(ProvokingVertex)
+#define glPushAttrib MANGLE(PushAttrib)
+#define glPushClientAttribDefaultEXT MANGLE(PushClientAttribDefaultEXT)
+#define glPushClientAttrib MANGLE(PushClientAttrib)
+#define glPushMatrix MANGLE(PushMatrix)
+#define glPushName MANGLE(PushName)
+#define glQueryCounter MANGLE(QueryCounter)
+#define glRasterPos2d MANGLE(RasterPos2d)
+#define glRasterPos2dv MANGLE(RasterPos2dv)
+#define glRasterPos2f MANGLE(RasterPos2f)
+#define glRasterPos2fv MANGLE(RasterPos2fv)
+#define glRasterPos2i MANGLE(RasterPos2i)
+#define glRasterPos2iv MANGLE(RasterPos2iv)
+#define glRasterPos2s MANGLE(RasterPos2s)
+#define glRasterPos2sv MANGLE(RasterPos2sv)
+#define glRasterPos3d MANGLE(RasterPos3d)
+#define glRasterPos3dv MANGLE(RasterPos3dv)
+#define glRasterPos3f MANGLE(RasterPos3f)
+#define glRasterPos3fv MANGLE(RasterPos3fv)
+#define glRasterPos3i MANGLE(RasterPos3i)
+#define glRasterPos3iv MANGLE(RasterPos3iv)
+#define glRasterPos3s MANGLE(RasterPos3s)
+#define glRasterPos3sv MANGLE(RasterPos3sv)
+#define glRasterPos4d MANGLE(RasterPos4d)
+#define glRasterPos4dv MANGLE(RasterPos4dv)
+#define glRasterPos4f MANGLE(RasterPos4f)
+#define glRasterPos4fv MANGLE(RasterPos4fv)
+#define glRasterPos4i MANGLE(RasterPos4i)
+#define glRasterPos4iv MANGLE(RasterPos4iv)
+#define glRasterPos4s MANGLE(RasterPos4s)
+#define glRasterPos4sv MANGLE(RasterPos4sv)
+#define glReadBuffer MANGLE(ReadBuffer)
+#define glReadInstrumentsSGIX MANGLE(ReadInstrumentsSGIX)
+#define glReadnPixelsARB MANGLE(ReadnPixelsARB)
+#define glReadPixels MANGLE(ReadPixels)
+#define glRectd MANGLE(Rectd)
+#define glRectdv MANGLE(Rectdv)
+#define glRectf MANGLE(Rectf)
+#define glRectfv MANGLE(Rectfv)
+#define glRecti MANGLE(Recti)
+#define glRectiv MANGLE(Rectiv)
+#define glRects MANGLE(Rects)
+#define glRectsv MANGLE(Rectsv)
+#define glReferencePlaneSGIX MANGLE(ReferencePlaneSGIX)
+#define glReleaseShaderCompiler MANGLE(ReleaseShaderCompiler)
+#define glRenderbufferStorageEXT MANGLE(RenderbufferStorageEXT)
+#define glRenderbufferStorage MANGLE(RenderbufferStorage)
+#define glRenderbufferStorageMultisampleCoverageNV MANGLE(RenderbufferStorageMultisampleCoverageNV)
+#define glRenderbufferStorageMultisampleEXT MANGLE(RenderbufferStorageMultisampleEXT)
+#define glRenderbufferStorageMultisample MANGLE(RenderbufferStorageMultisample)
+#define glRenderMode MANGLE(RenderMode)
+#define glReplacementCodePointerSUN MANGLE(ReplacementCodePointerSUN)
+#define glReplacementCodeubSUN MANGLE(ReplacementCodeubSUN)
+#define glReplacementCodeubvSUN MANGLE(ReplacementCodeubvSUN)
+#define glReplacementCodeuiColor3fVertex3fSUN MANGLE(ReplacementCodeuiColor3fVertex3fSUN)
+#define glReplacementCodeuiColor3fVertex3fvSUN MANGLE(ReplacementCodeuiColor3fVertex3fvSUN)
+#define glReplacementCodeuiColor4fNormal3fVertex3fSUN MANGLE(ReplacementCodeuiColor4fNormal3fVertex3fSUN)
+#define glReplacementCodeuiColor4fNormal3fVertex3fvSUN MANGLE(ReplacementCodeuiColor4fNormal3fVertex3fvSUN)
+#define glReplacementCodeuiColor4ubVertex3fSUN MANGLE(ReplacementCodeuiColor4ubVertex3fSUN)
+#define glReplacementCodeuiColor4ubVertex3fvSUN MANGLE(ReplacementCodeuiColor4ubVertex3fvSUN)
+#define glReplacementCodeuiNormal3fVertex3fSUN MANGLE(ReplacementCodeuiNormal3fVertex3fSUN)
+#define glReplacementCodeuiNormal3fVertex3fvSUN MANGLE(ReplacementCodeuiNormal3fVertex3fvSUN)
+#define glReplacementCodeuiSUN MANGLE(ReplacementCodeuiSUN)
+#define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN MANGLE(ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN)
+#define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN MANGLE(ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN)
+#define glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN MANGLE(ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN)
+#define glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN MANGLE(ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN)
+#define glReplacementCodeuiTexCoord2fVertex3fSUN MANGLE(ReplacementCodeuiTexCoord2fVertex3fSUN)
+#define glReplacementCodeuiTexCoord2fVertex3fvSUN MANGLE(ReplacementCodeuiTexCoord2fVertex3fvSUN)
+#define glReplacementCodeuiVertex3fSUN MANGLE(ReplacementCodeuiVertex3fSUN)
+#define glReplacementCodeuiVertex3fvSUN MANGLE(ReplacementCodeuiVertex3fvSUN)
+#define glReplacementCodeuivSUN MANGLE(ReplacementCodeuivSUN)
+#define glReplacementCodeusSUN MANGLE(ReplacementCodeusSUN)
+#define glReplacementCodeusvSUN MANGLE(ReplacementCodeusvSUN)
+#define glRequestResidentProgramsNV MANGLE(RequestResidentProgramsNV)
+#define glResetHistogramEXT MANGLE(ResetHistogramEXT)
+#define glResetHistogram MANGLE(ResetHistogram)
+#define glResetMinmaxEXT MANGLE(ResetMinmaxEXT)
+#define glResetMinmax MANGLE(ResetMinmax)
+#define glResizeBuffersMESA MANGLE(ResizeBuffersMESA)
+#define glResumeTransformFeedback MANGLE(ResumeTransformFeedback)
+#define glResumeTransformFeedbackNV MANGLE(ResumeTransformFeedbackNV)
+#define glRotated MANGLE(Rotated)
+#define glRotatef MANGLE(Rotatef)
+#define glSampleCoverageARB MANGLE(SampleCoverageARB)
+#define glSampleCoverage MANGLE(SampleCoverage)
+#define glSampleMapATI MANGLE(SampleMapATI)
+#define glSampleMaskEXT MANGLE(SampleMaskEXT)
+#define glSampleMaski MANGLE(SampleMaski)
+#define glSampleMaskIndexedNV MANGLE(SampleMaskIndexedNV)
+#define glSampleMaskSGIS MANGLE(SampleMaskSGIS)
+#define glSamplePatternEXT MANGLE(SamplePatternEXT)
+#define glSamplePatternSGIS MANGLE(SamplePatternSGIS)
+#define glSamplerParameterf MANGLE(SamplerParameterf)
+#define glSamplerParameterfv MANGLE(SamplerParameterfv)
+#define glSamplerParameterIiv MANGLE(SamplerParameterIiv)
+#define glSamplerParameteri MANGLE(SamplerParameteri)
+#define glSamplerParameterIuiv MANGLE(SamplerParameterIuiv)
+#define glSamplerParameteriv MANGLE(SamplerParameteriv)
+#define glScaled MANGLE(Scaled)
+#define glScalef MANGLE(Scalef)
+#define glScissorArrayv MANGLE(ScissorArrayv)
+#define glScissorIndexed MANGLE(ScissorIndexed)
+#define glScissorIndexedv MANGLE(ScissorIndexedv)
+#define glScissor MANGLE(Scissor)
+#define glSecondaryColor3bEXT MANGLE(SecondaryColor3bEXT)
+#define glSecondaryColor3b MANGLE(SecondaryColor3b)
+#define glSecondaryColor3bvEXT MANGLE(SecondaryColor3bvEXT)
+#define glSecondaryColor3bv MANGLE(SecondaryColor3bv)
+#define glSecondaryColor3dEXT MANGLE(SecondaryColor3dEXT)
+#define glSecondaryColor3d MANGLE(SecondaryColor3d)
+#define glSecondaryColor3dvEXT MANGLE(SecondaryColor3dvEXT)
+#define glSecondaryColor3dv MANGLE(SecondaryColor3dv)
+#define glSecondaryColor3fEXT MANGLE(SecondaryColor3fEXT)
+#define glSecondaryColor3f MANGLE(SecondaryColor3f)
+#define glSecondaryColor3fvEXT MANGLE(SecondaryColor3fvEXT)
+#define glSecondaryColor3fv MANGLE(SecondaryColor3fv)
+#define glSecondaryColor3hNV MANGLE(SecondaryColor3hNV)
+#define glSecondaryColor3hvNV MANGLE(SecondaryColor3hvNV)
+#define glSecondaryColor3iEXT MANGLE(SecondaryColor3iEXT)
+#define glSecondaryColor3i MANGLE(SecondaryColor3i)
+#define glSecondaryColor3ivEXT MANGLE(SecondaryColor3ivEXT)
+#define glSecondaryColor3iv MANGLE(SecondaryColor3iv)
+#define glSecondaryColor3sEXT MANGLE(SecondaryColor3sEXT)
+#define glSecondaryColor3s MANGLE(SecondaryColor3s)
+#define glSecondaryColor3svEXT MANGLE(SecondaryColor3svEXT)
+#define glSecondaryColor3sv MANGLE(SecondaryColor3sv)
+#define glSecondaryColor3ubEXT MANGLE(SecondaryColor3ubEXT)
+#define glSecondaryColor3ub MANGLE(SecondaryColor3ub)
+#define glSecondaryColor3ubvEXT MANGLE(SecondaryColor3ubvEXT)
+#define glSecondaryColor3ubv MANGLE(SecondaryColor3ubv)
+#define glSecondaryColor3uiEXT MANGLE(SecondaryColor3uiEXT)
+#define glSecondaryColor3ui MANGLE(SecondaryColor3ui)
+#define glSecondaryColor3uivEXT MANGLE(SecondaryColor3uivEXT)
+#define glSecondaryColor3uiv MANGLE(SecondaryColor3uiv)
+#define glSecondaryColor3usEXT MANGLE(SecondaryColor3usEXT)
+#define glSecondaryColor3us MANGLE(SecondaryColor3us)
+#define glSecondaryColor3usvEXT MANGLE(SecondaryColor3usvEXT)
+#define glSecondaryColor3usv MANGLE(SecondaryColor3usv)
+#define glSecondaryColorFormatNV MANGLE(SecondaryColorFormatNV)
+#define glSecondaryColorP3ui MANGLE(SecondaryColorP3ui)
+#define glSecondaryColorP3uiv MANGLE(SecondaryColorP3uiv)
+#define glSecondaryColorPointerEXT MANGLE(SecondaryColorPointerEXT)
+#define glSecondaryColorPointerListIBM MANGLE(SecondaryColorPointerListIBM)
+#define glSecondaryColorPointer MANGLE(SecondaryColorPointer)
+#define glSelectBuffer MANGLE(SelectBuffer)
+#define glSelectPerfMonitorCountersAMD MANGLE(SelectPerfMonitorCountersAMD)
+#define glSeparableFilter2DEXT MANGLE(SeparableFilter2DEXT)
+#define glSeparableFilter2D MANGLE(SeparableFilter2D)
+#define glSetFenceAPPLE MANGLE(SetFenceAPPLE)
+#define glSetFenceNV MANGLE(SetFenceNV)
+#define glSetFragmentShaderConstantATI MANGLE(SetFragmentShaderConstantATI)
+#define glSetInvariantEXT MANGLE(SetInvariantEXT)
+#define glSetLocalConstantEXT MANGLE(SetLocalConstantEXT)
+#define glShadeModel MANGLE(ShadeModel)
+#define glShaderBinary MANGLE(ShaderBinary)
+#define glShaderOp1EXT MANGLE(ShaderOp1EXT)
+#define glShaderOp2EXT MANGLE(ShaderOp2EXT)
+#define glShaderOp3EXT MANGLE(ShaderOp3EXT)
+#define glShaderSourceARB MANGLE(ShaderSourceARB)
+#define glShaderSource MANGLE(ShaderSource)
+#define glSharpenTexFuncSGIS MANGLE(SharpenTexFuncSGIS)
+#define glSpriteParameterfSGIX MANGLE(SpriteParameterfSGIX)
+#define glSpriteParameterfvSGIX MANGLE(SpriteParameterfvSGIX)
+#define glSpriteParameteriSGIX MANGLE(SpriteParameteriSGIX)
+#define glSpriteParameterivSGIX MANGLE(SpriteParameterivSGIX)
+#define glStartInstrumentsSGIX MANGLE(StartInstrumentsSGIX)
+#define glStencilClearTagEXT MANGLE(StencilClearTagEXT)
+#define glStencilFunc MANGLE(StencilFunc)
+#define glStencilFuncSeparateATI MANGLE(StencilFuncSeparateATI)
+#define glStencilFuncSeparate MANGLE(StencilFuncSeparate)
+#define glStencilMask MANGLE(StencilMask)
+#define glStencilMaskSeparate MANGLE(StencilMaskSeparate)
+#define glStencilOp MANGLE(StencilOp)
+#define glStencilOpSeparateATI MANGLE(StencilOpSeparateATI)
+#define glStencilOpSeparate MANGLE(StencilOpSeparate)
+#define glStopInstrumentsSGIX MANGLE(StopInstrumentsSGIX)
+#define glStringMarkerGREMEDY MANGLE(StringMarkerGREMEDY)
+#define glSwizzleEXT MANGLE(SwizzleEXT)
+#define glTagSampleBufferSGIX MANGLE(TagSampleBufferSGIX)
+#define glTangent3bEXT MANGLE(Tangent3bEXT)
+#define glTangent3bvEXT MANGLE(Tangent3bvEXT)
+#define glTangent3dEXT MANGLE(Tangent3dEXT)
+#define glTangent3dvEXT MANGLE(Tangent3dvEXT)
+#define glTangent3fEXT MANGLE(Tangent3fEXT)
+#define glTangent3fvEXT MANGLE(Tangent3fvEXT)
+#define glTangent3iEXT MANGLE(Tangent3iEXT)
+#define glTangent3ivEXT MANGLE(Tangent3ivEXT)
+#define glTangent3sEXT MANGLE(Tangent3sEXT)
+#define glTangent3svEXT MANGLE(Tangent3svEXT)
+#define glTangentPointerEXT MANGLE(TangentPointerEXT)
+#define glTbufferMask3DFX MANGLE(TbufferMask3DFX)
+#define glTessellationFactorAMD MANGLE(TessellationFactorAMD)
+#define glTessellationModeAMD MANGLE(TessellationModeAMD)
+#define glTestFenceAPPLE MANGLE(TestFenceAPPLE)
+#define glTestFenceNV MANGLE(TestFenceNV)
+#define glTestObjectAPPLE MANGLE(TestObjectAPPLE)
+#define glTexBufferARB MANGLE(TexBufferARB)
+#define glTexBufferEXT MANGLE(TexBufferEXT)
+#define glTexBuffer MANGLE(TexBuffer)
+#define glTexBumpParameterfvATI MANGLE(TexBumpParameterfvATI)
+#define glTexBumpParameterivATI MANGLE(TexBumpParameterivATI)
+#define glTexCoord1d MANGLE(TexCoord1d)
+#define glTexCoord1dv MANGLE(TexCoord1dv)
+#define glTexCoord1f MANGLE(TexCoord1f)
+#define glTexCoord1fv MANGLE(TexCoord1fv)
+#define glTexCoord1hNV MANGLE(TexCoord1hNV)
+#define glTexCoord1hvNV MANGLE(TexCoord1hvNV)
+#define glTexCoord1i MANGLE(TexCoord1i)
+#define glTexCoord1iv MANGLE(TexCoord1iv)
+#define glTexCoord1s MANGLE(TexCoord1s)
+#define glTexCoord1sv MANGLE(TexCoord1sv)
+#define glTexCoord2d MANGLE(TexCoord2d)
+#define glTexCoord2dv MANGLE(TexCoord2dv)
+#define glTexCoord2fColor3fVertex3fSUN MANGLE(TexCoord2fColor3fVertex3fSUN)
+#define glTexCoord2fColor3fVertex3fvSUN MANGLE(TexCoord2fColor3fVertex3fvSUN)
+#define glTexCoord2fColor4fNormal3fVertex3fSUN MANGLE(TexCoord2fColor4fNormal3fVertex3fSUN)
+#define glTexCoord2fColor4fNormal3fVertex3fvSUN MANGLE(TexCoord2fColor4fNormal3fVertex3fvSUN)
+#define glTexCoord2fColor4ubVertex3fSUN MANGLE(TexCoord2fColor4ubVertex3fSUN)
+#define glTexCoord2fColor4ubVertex3fvSUN MANGLE(TexCoord2fColor4ubVertex3fvSUN)
+#define glTexCoord2f MANGLE(TexCoord2f)
+#define glTexCoord2fNormal3fVertex3fSUN MANGLE(TexCoord2fNormal3fVertex3fSUN)
+#define glTexCoord2fNormal3fVertex3fvSUN MANGLE(TexCoord2fNormal3fVertex3fvSUN)
+#define glTexCoord2fVertex3fSUN MANGLE(TexCoord2fVertex3fSUN)
+#define glTexCoord2fVertex3fvSUN MANGLE(TexCoord2fVertex3fvSUN)
+#define glTexCoord2fv MANGLE(TexCoord2fv)
+#define glTexCoord2hNV MANGLE(TexCoord2hNV)
+#define glTexCoord2hvNV MANGLE(TexCoord2hvNV)
+#define glTexCoord2i MANGLE(TexCoord2i)
+#define glTexCoord2iv MANGLE(TexCoord2iv)
+#define glTexCoord2s MANGLE(TexCoord2s)
+#define glTexCoord2sv MANGLE(TexCoord2sv)
+#define glTexCoord3d MANGLE(TexCoord3d)
+#define glTexCoord3dv MANGLE(TexCoord3dv)
+#define glTexCoord3f MANGLE(TexCoord3f)
+#define glTexCoord3fv MANGLE(TexCoord3fv)
+#define glTexCoord3hNV MANGLE(TexCoord3hNV)
+#define glTexCoord3hvNV MANGLE(TexCoord3hvNV)
+#define glTexCoord3i MANGLE(TexCoord3i)
+#define glTexCoord3iv MANGLE(TexCoord3iv)
+#define glTexCoord3s MANGLE(TexCoord3s)
+#define glTexCoord3sv MANGLE(TexCoord3sv)
+#define glTexCoord4d MANGLE(TexCoord4d)
+#define glTexCoord4dv MANGLE(TexCoord4dv)
+#define glTexCoord4fColor4fNormal3fVertex4fSUN MANGLE(TexCoord4fColor4fNormal3fVertex4fSUN)
+#define glTexCoord4fColor4fNormal3fVertex4fvSUN MANGLE(TexCoord4fColor4fNormal3fVertex4fvSUN)
+#define glTexCoord4f MANGLE(TexCoord4f)
+#define glTexCoord4fVertex4fSUN MANGLE(TexCoord4fVertex4fSUN)
+#define glTexCoord4fVertex4fvSUN MANGLE(TexCoord4fVertex4fvSUN)
+#define glTexCoord4fv MANGLE(TexCoord4fv)
+#define glTexCoord4hNV MANGLE(TexCoord4hNV)
+#define glTexCoord4hvNV MANGLE(TexCoord4hvNV)
+#define glTexCoord4i MANGLE(TexCoord4i)
+#define glTexCoord4iv MANGLE(TexCoord4iv)
+#define glTexCoord4s MANGLE(TexCoord4s)
+#define glTexCoord4sv MANGLE(TexCoord4sv)
+#define glTexCoordFormatNV MANGLE(TexCoordFormatNV)
+#define glTexCoordP1ui MANGLE(TexCoordP1ui)
+#define glTexCoordP1uiv MANGLE(TexCoordP1uiv)
+#define glTexCoordP2ui MANGLE(TexCoordP2ui)
+#define glTexCoordP2uiv MANGLE(TexCoordP2uiv)
+#define glTexCoordP3ui MANGLE(TexCoordP3ui)
+#define glTexCoordP3uiv MANGLE(TexCoordP3uiv)
+#define glTexCoordP4ui MANGLE(TexCoordP4ui)
+#define glTexCoordP4uiv MANGLE(TexCoordP4uiv)
+#define glTexCoordPointerEXT MANGLE(TexCoordPointerEXT)
+#define glTexCoordPointerListIBM MANGLE(TexCoordPointerListIBM)
+#define glTexCoordPointer MANGLE(TexCoordPointer)
+#define glTexCoordPointervINTEL MANGLE(TexCoordPointervINTEL)
+#define glTexEnvf MANGLE(TexEnvf)
+#define glTexEnvfv MANGLE(TexEnvfv)
+#define glTexEnvi MANGLE(TexEnvi)
+#define glTexEnviv MANGLE(TexEnviv)
+#define glTexFilterFuncSGIS MANGLE(TexFilterFuncSGIS)
+#define glTexGend MANGLE(TexGend)
+#define glTexGendv MANGLE(TexGendv)
+#define glTexGenf MANGLE(TexGenf)
+#define glTexGenfv MANGLE(TexGenfv)
+#define glTexGeni MANGLE(TexGeni)
+#define glTexGeniv MANGLE(TexGeniv)
+#define glTexImage1D MANGLE(TexImage1D)
+#define glTexImage2D MANGLE(TexImage2D)
+#define glTexImage2DMultisample MANGLE(TexImage2DMultisample)
+#define glTexImage3DEXT MANGLE(TexImage3DEXT)
+#define glTexImage3D MANGLE(TexImage3D)
+#define glTexImage3DMultisample MANGLE(TexImage3DMultisample)
+#define glTexImage4DSGIS MANGLE(TexImage4DSGIS)
+#define glTexParameterf MANGLE(TexParameterf)
+#define glTexParameterfv MANGLE(TexParameterfv)
+#define glTexParameterIivEXT MANGLE(TexParameterIivEXT)
+#define glTexParameterIiv MANGLE(TexParameterIiv)
+#define glTexParameteri MANGLE(TexParameteri)
+#define glTexParameterIuivEXT MANGLE(TexParameterIuivEXT)
+#define glTexParameterIuiv MANGLE(TexParameterIuiv)
+#define glTexParameteriv MANGLE(TexParameteriv)
+#define glTexRenderbufferNV MANGLE(TexRenderbufferNV)
+#define glTexSubImage1DEXT MANGLE(TexSubImage1DEXT)
+#define glTexSubImage1D MANGLE(TexSubImage1D)
+#define glTexSubImage2DEXT MANGLE(TexSubImage2DEXT)
+#define glTexSubImage2D MANGLE(TexSubImage2D)
+#define glTexSubImage3DEXT MANGLE(TexSubImage3DEXT)
+#define glTexSubImage3D MANGLE(TexSubImage3D)
+#define glTexSubImage4DSGIS MANGLE(TexSubImage4DSGIS)
+#define glTextureBarrierNV MANGLE(TextureBarrierNV)
+#define glTextureBufferEXT MANGLE(TextureBufferEXT)
+#define glTextureColorMaskSGIS MANGLE(TextureColorMaskSGIS)
+#define glTextureImage1DEXT MANGLE(TextureImage1DEXT)
+#define glTextureImage2DEXT MANGLE(TextureImage2DEXT)
+#define glTextureImage3DEXT MANGLE(TextureImage3DEXT)
+#define glTextureLightEXT MANGLE(TextureLightEXT)
+#define glTextureMaterialEXT MANGLE(TextureMaterialEXT)
+#define glTextureNormalEXT MANGLE(TextureNormalEXT)
+#define glTextureParameterfEXT MANGLE(TextureParameterfEXT)
+#define glTextureParameterfvEXT MANGLE(TextureParameterfvEXT)
+#define glTextureParameteriEXT MANGLE(TextureParameteriEXT)
+#define glTextureParameterIivEXT MANGLE(TextureParameterIivEXT)
+#define glTextureParameterIuivEXT MANGLE(TextureParameterIuivEXT)
+#define glTextureParameterivEXT MANGLE(TextureParameterivEXT)
+#define glTextureRangeAPPLE MANGLE(TextureRangeAPPLE)
+#define glTextureRenderbufferEXT MANGLE(TextureRenderbufferEXT)
+#define glTextureSubImage1DEXT MANGLE(TextureSubImage1DEXT)
+#define glTextureSubImage2DEXT MANGLE(TextureSubImage2DEXT)
+#define glTextureSubImage3DEXT MANGLE(TextureSubImage3DEXT)
+#define glTrackMatrixNV MANGLE(TrackMatrixNV)
+#define glTransformFeedbackAttribsNV MANGLE(TransformFeedbackAttribsNV)
+#define glTransformFeedbackStreamAttribsNV MANGLE(TransformFeedbackStreamAttribsNV)
+#define glTransformFeedbackVaryingsEXT MANGLE(TransformFeedbackVaryingsEXT)
+#define glTransformFeedbackVaryings MANGLE(TransformFeedbackVaryings)
+#define glTransformFeedbackVaryingsNV MANGLE(TransformFeedbackVaryingsNV)
+#define glTranslated MANGLE(Translated)
+#define glTranslatef MANGLE(Translatef)
+#define glUniform1d MANGLE(Uniform1d)
+#define glUniform1dv MANGLE(Uniform1dv)
+#define glUniform1fARB MANGLE(Uniform1fARB)
+#define glUniform1f MANGLE(Uniform1f)
+#define glUniform1fvARB MANGLE(Uniform1fvARB)
+#define glUniform1fv MANGLE(Uniform1fv)
+#define glUniform1i64NV MANGLE(Uniform1i64NV)
+#define glUniform1i64vNV MANGLE(Uniform1i64vNV)
+#define glUniform1iARB MANGLE(Uniform1iARB)
+#define glUniform1i MANGLE(Uniform1i)
+#define glUniform1ivARB MANGLE(Uniform1ivARB)
+#define glUniform1iv MANGLE(Uniform1iv)
+#define glUniform1ui64NV MANGLE(Uniform1ui64NV)
+#define glUniform1ui64vNV MANGLE(Uniform1ui64vNV)
+#define glUniform1uiEXT MANGLE(Uniform1uiEXT)
+#define glUniform1ui MANGLE(Uniform1ui)
+#define glUniform1uivEXT MANGLE(Uniform1uivEXT)
+#define glUniform1uiv MANGLE(Uniform1uiv)
+#define glUniform2d MANGLE(Uniform2d)
+#define glUniform2dv MANGLE(Uniform2dv)
+#define glUniform2fARB MANGLE(Uniform2fARB)
+#define glUniform2f MANGLE(Uniform2f)
+#define glUniform2fvARB MANGLE(Uniform2fvARB)
+#define glUniform2fv MANGLE(Uniform2fv)
+#define glUniform2i64NV MANGLE(Uniform2i64NV)
+#define glUniform2i64vNV MANGLE(Uniform2i64vNV)
+#define glUniform2iARB MANGLE(Uniform2iARB)
+#define glUniform2i MANGLE(Uniform2i)
+#define glUniform2ivARB MANGLE(Uniform2ivARB)
+#define glUniform2iv MANGLE(Uniform2iv)
+#define glUniform2ui64NV MANGLE(Uniform2ui64NV)
+#define glUniform2ui64vNV MANGLE(Uniform2ui64vNV)
+#define glUniform2uiEXT MANGLE(Uniform2uiEXT)
+#define glUniform2ui MANGLE(Uniform2ui)
+#define glUniform2uivEXT MANGLE(Uniform2uivEXT)
+#define glUniform2uiv MANGLE(Uniform2uiv)
+#define glUniform3d MANGLE(Uniform3d)
+#define glUniform3dv MANGLE(Uniform3dv)
+#define glUniform3fARB MANGLE(Uniform3fARB)
+#define glUniform3f MANGLE(Uniform3f)
+#define glUniform3fvARB MANGLE(Uniform3fvARB)
+#define glUniform3fv MANGLE(Uniform3fv)
+#define glUniform3i64NV MANGLE(Uniform3i64NV)
+#define glUniform3i64vNV MANGLE(Uniform3i64vNV)
+#define glUniform3iARB MANGLE(Uniform3iARB)
+#define glUniform3i MANGLE(Uniform3i)
+#define glUniform3ivARB MANGLE(Uniform3ivARB)
+#define glUniform3iv MANGLE(Uniform3iv)
+#define glUniform3ui64NV MANGLE(Uniform3ui64NV)
+#define glUniform3ui64vNV MANGLE(Uniform3ui64vNV)
+#define glUniform3uiEXT MANGLE(Uniform3uiEXT)
+#define glUniform3ui MANGLE(Uniform3ui)
+#define glUniform3uivEXT MANGLE(Uniform3uivEXT)
+#define glUniform3uiv MANGLE(Uniform3uiv)
+#define glUniform4d MANGLE(Uniform4d)
+#define glUniform4dv MANGLE(Uniform4dv)
+#define glUniform4fARB MANGLE(Uniform4fARB)
+#define glUniform4f MANGLE(Uniform4f)
+#define glUniform4fvARB MANGLE(Uniform4fvARB)
+#define glUniform4fv MANGLE(Uniform4fv)
+#define glUniform4i64NV MANGLE(Uniform4i64NV)
+#define glUniform4i64vNV MANGLE(Uniform4i64vNV)
+#define glUniform4iARB MANGLE(Uniform4iARB)
+#define glUniform4i MANGLE(Uniform4i)
+#define glUniform4ivARB MANGLE(Uniform4ivARB)
+#define glUniform4iv MANGLE(Uniform4iv)
+#define glUniform4ui64NV MANGLE(Uniform4ui64NV)
+#define glUniform4ui64vNV MANGLE(Uniform4ui64vNV)
+#define glUniform4uiEXT MANGLE(Uniform4uiEXT)
+#define glUniform4ui MANGLE(Uniform4ui)
+#define glUniform4uivEXT MANGLE(Uniform4uivEXT)
+#define glUniform4uiv MANGLE(Uniform4uiv)
+#define glUniformBlockBinding MANGLE(UniformBlockBinding)
+#define glUniformBufferEXT MANGLE(UniformBufferEXT)
+#define glUniformMatrix2dv MANGLE(UniformMatrix2dv)
+#define glUniformMatrix2fvARB MANGLE(UniformMatrix2fvARB)
+#define glUniformMatrix2fv MANGLE(UniformMatrix2fv)
+#define glUniformMatrix2x3dv MANGLE(UniformMatrix2x3dv)
+#define glUniformMatrix2x3fv MANGLE(UniformMatrix2x3fv)
+#define glUniformMatrix2x4dv MANGLE(UniformMatrix2x4dv)
+#define glUniformMatrix2x4fv MANGLE(UniformMatrix2x4fv)
+#define glUniformMatrix3dv MANGLE(UniformMatrix3dv)
+#define glUniformMatrix3fvARB MANGLE(UniformMatrix3fvARB)
+#define glUniformMatrix3fv MANGLE(UniformMatrix3fv)
+#define glUniformMatrix3x2dv MANGLE(UniformMatrix3x2dv)
+#define glUniformMatrix3x2fv MANGLE(UniformMatrix3x2fv)
+#define glUniformMatrix3x4dv MANGLE(UniformMatrix3x4dv)
+#define glUniformMatrix3x4fv MANGLE(UniformMatrix3x4fv)
+#define glUniformMatrix4dv MANGLE(UniformMatrix4dv)
+#define glUniformMatrix4fvARB MANGLE(UniformMatrix4fvARB)
+#define glUniformMatrix4fv MANGLE(UniformMatrix4fv)
+#define glUniformMatrix4x2dv MANGLE(UniformMatrix4x2dv)
+#define glUniformMatrix4x2fv MANGLE(UniformMatrix4x2fv)
+#define glUniformMatrix4x3dv MANGLE(UniformMatrix4x3dv)
+#define glUniformMatrix4x3fv MANGLE(UniformMatrix4x3fv)
+#define glUniformSubroutinesuiv MANGLE(UniformSubroutinesuiv)
+#define glUniformui64NV MANGLE(Uniformui64NV)
+#define glUniformui64vNV MANGLE(Uniformui64vNV)
+#define glUnlockArraysEXT MANGLE(UnlockArraysEXT)
+#define glUnmapBufferARB MANGLE(UnmapBufferARB)
+#define glUnmapBuffer MANGLE(UnmapBuffer)
+#define glUnmapNamedBufferEXT MANGLE(UnmapNamedBufferEXT)
+#define glUnmapObjectBufferATI MANGLE(UnmapObjectBufferATI)
+#define glUpdateObjectBufferATI MANGLE(UpdateObjectBufferATI)
+#define glUseProgram MANGLE(UseProgram)
+#define glUseProgramObjectARB MANGLE(UseProgramObjectARB)
+#define glUseProgramStages MANGLE(UseProgramStages)
+#define glUseShaderProgramEXT MANGLE(UseShaderProgramEXT)
+#define glValidateProgramARB MANGLE(ValidateProgramARB)
+#define glValidateProgram MANGLE(ValidateProgram)
+#define glValidateProgramPipeline MANGLE(ValidateProgramPipeline)
+#define glVariantArrayObjectATI MANGLE(VariantArrayObjectATI)
+#define glVariantbvEXT MANGLE(VariantbvEXT)
+#define glVariantdvEXT MANGLE(VariantdvEXT)
+#define glVariantfvEXT MANGLE(VariantfvEXT)
+#define glVariantivEXT MANGLE(VariantivEXT)
+#define glVariantPointerEXT MANGLE(VariantPointerEXT)
+#define glVariantsvEXT MANGLE(VariantsvEXT)
+#define glVariantubvEXT MANGLE(VariantubvEXT)
+#define glVariantuivEXT MANGLE(VariantuivEXT)
+#define glVariantusvEXT MANGLE(VariantusvEXT)
+#define glVDPAUFiniNV MANGLE(VDPAUFiniNV)
+#define glVDPAUGetSurfaceivNV MANGLE(VDPAUGetSurfaceivNV)
+#define glVDPAUInitNV MANGLE(VDPAUInitNV)
+#define glVDPAUIsSurfaceNV MANGLE(VDPAUIsSurfaceNV)
+#define glVDPAUMapSurfacesNV MANGLE(VDPAUMapSurfacesNV)
+#define glVDPAURegisterOutputSurfaceNV MANGLE(VDPAURegisterOutputSurfaceNV)
+#define glVDPAURegisterVideoSurfaceNV MANGLE(VDPAURegisterVideoSurfaceNV)
+#define glVDPAUSurfaceAccessNV MANGLE(VDPAUSurfaceAccessNV)
+#define glVDPAUUnmapSurfacesNV MANGLE(VDPAUUnmapSurfacesNV)
+#define glVDPAUUnregisterSurfaceNV MANGLE(VDPAUUnregisterSurfaceNV)
+#define glVertex2d MANGLE(Vertex2d)
+#define glVertex2dv MANGLE(Vertex2dv)
+#define glVertex2f MANGLE(Vertex2f)
+#define glVertex2fv MANGLE(Vertex2fv)
+#define glVertex2hNV MANGLE(Vertex2hNV)
+#define glVertex2hvNV MANGLE(Vertex2hvNV)
+#define glVertex2i MANGLE(Vertex2i)
+#define glVertex2iv MANGLE(Vertex2iv)
+#define glVertex2s MANGLE(Vertex2s)
+#define glVertex2sv MANGLE(Vertex2sv)
+#define glVertex3d MANGLE(Vertex3d)
+#define glVertex3dv MANGLE(Vertex3dv)
+#define glVertex3f MANGLE(Vertex3f)
+#define glVertex3fv MANGLE(Vertex3fv)
+#define glVertex3hNV MANGLE(Vertex3hNV)
+#define glVertex3hvNV MANGLE(Vertex3hvNV)
+#define glVertex3i MANGLE(Vertex3i)
+#define glVertex3iv MANGLE(Vertex3iv)
+#define glVertex3s MANGLE(Vertex3s)
+#define glVertex3sv MANGLE(Vertex3sv)
+#define glVertex4d MANGLE(Vertex4d)
+#define glVertex4dv MANGLE(Vertex4dv)
+#define glVertex4f MANGLE(Vertex4f)
+#define glVertex4fv MANGLE(Vertex4fv)
+#define glVertex4hNV MANGLE(Vertex4hNV)
+#define glVertex4hvNV MANGLE(Vertex4hvNV)
+#define glVertex4i MANGLE(Vertex4i)
+#define glVertex4iv MANGLE(Vertex4iv)
+#define glVertex4s MANGLE(Vertex4s)
+#define glVertex4sv MANGLE(Vertex4sv)
+#define glVertexArrayParameteriAPPLE MANGLE(VertexArrayParameteriAPPLE)
+#define glVertexArrayRangeAPPLE MANGLE(VertexArrayRangeAPPLE)
+#define glVertexArrayRangeNV MANGLE(VertexArrayRangeNV)
+#define glVertexArrayVertexAttribLOffsetEXT MANGLE(VertexArrayVertexAttribLOffsetEXT)
+#define glVertexAttrib1dARB MANGLE(VertexAttrib1dARB)
+#define glVertexAttrib1d MANGLE(VertexAttrib1d)
+#define glVertexAttrib1dNV MANGLE(VertexAttrib1dNV)
+#define glVertexAttrib1dvARB MANGLE(VertexAttrib1dvARB)
+#define glVertexAttrib1dv MANGLE(VertexAttrib1dv)
+#define glVertexAttrib1dvNV MANGLE(VertexAttrib1dvNV)
+#define glVertexAttrib1fARB MANGLE(VertexAttrib1fARB)
+#define glVertexAttrib1f MANGLE(VertexAttrib1f)
+#define glVertexAttrib1fNV MANGLE(VertexAttrib1fNV)
+#define glVertexAttrib1fvARB MANGLE(VertexAttrib1fvARB)
+#define glVertexAttrib1fv MANGLE(VertexAttrib1fv)
+#define glVertexAttrib1fvNV MANGLE(VertexAttrib1fvNV)
+#define glVertexAttrib1hNV MANGLE(VertexAttrib1hNV)
+#define glVertexAttrib1hvNV MANGLE(VertexAttrib1hvNV)
+#define glVertexAttrib1sARB MANGLE(VertexAttrib1sARB)
+#define glVertexAttrib1s MANGLE(VertexAttrib1s)
+#define glVertexAttrib1sNV MANGLE(VertexAttrib1sNV)
+#define glVertexAttrib1svARB MANGLE(VertexAttrib1svARB)
+#define glVertexAttrib1sv MANGLE(VertexAttrib1sv)
+#define glVertexAttrib1svNV MANGLE(VertexAttrib1svNV)
+#define glVertexAttrib2dARB MANGLE(VertexAttrib2dARB)
+#define glVertexAttrib2d MANGLE(VertexAttrib2d)
+#define glVertexAttrib2dNV MANGLE(VertexAttrib2dNV)
+#define glVertexAttrib2dvARB MANGLE(VertexAttrib2dvARB)
+#define glVertexAttrib2dv MANGLE(VertexAttrib2dv)
+#define glVertexAttrib2dvNV MANGLE(VertexAttrib2dvNV)
+#define glVertexAttrib2fARB MANGLE(VertexAttrib2fARB)
+#define glVertexAttrib2f MANGLE(VertexAttrib2f)
+#define glVertexAttrib2fNV MANGLE(VertexAttrib2fNV)
+#define glVertexAttrib2fvARB MANGLE(VertexAttrib2fvARB)
+#define glVertexAttrib2fv MANGLE(VertexAttrib2fv)
+#define glVertexAttrib2fvNV MANGLE(VertexAttrib2fvNV)
+#define glVertexAttrib2hNV MANGLE(VertexAttrib2hNV)
+#define glVertexAttrib2hvNV MANGLE(VertexAttrib2hvNV)
+#define glVertexAttrib2sARB MANGLE(VertexAttrib2sARB)
+#define glVertexAttrib2s MANGLE(VertexAttrib2s)
+#define glVertexAttrib2sNV MANGLE(VertexAttrib2sNV)
+#define glVertexAttrib2svARB MANGLE(VertexAttrib2svARB)
+#define glVertexAttrib2sv MANGLE(VertexAttrib2sv)
+#define glVertexAttrib2svNV MANGLE(VertexAttrib2svNV)
+#define glVertexAttrib3dARB MANGLE(VertexAttrib3dARB)
+#define glVertexAttrib3d MANGLE(VertexAttrib3d)
+#define glVertexAttrib3dNV MANGLE(VertexAttrib3dNV)
+#define glVertexAttrib3dvARB MANGLE(VertexAttrib3dvARB)
+#define glVertexAttrib3dv MANGLE(VertexAttrib3dv)
+#define glVertexAttrib3dvNV MANGLE(VertexAttrib3dvNV)
+#define glVertexAttrib3fARB MANGLE(VertexAttrib3fARB)
+#define glVertexAttrib3f MANGLE(VertexAttrib3f)
+#define glVertexAttrib3fNV MANGLE(VertexAttrib3fNV)
+#define glVertexAttrib3fvARB MANGLE(VertexAttrib3fvARB)
+#define glVertexAttrib3fv MANGLE(VertexAttrib3fv)
+#define glVertexAttrib3fvNV MANGLE(VertexAttrib3fvNV)
+#define glVertexAttrib3hNV MANGLE(VertexAttrib3hNV)
+#define glVertexAttrib3hvNV MANGLE(VertexAttrib3hvNV)
+#define glVertexAttrib3sARB MANGLE(VertexAttrib3sARB)
+#define glVertexAttrib3s MANGLE(VertexAttrib3s)
+#define glVertexAttrib3sNV MANGLE(VertexAttrib3sNV)
+#define glVertexAttrib3svARB MANGLE(VertexAttrib3svARB)
+#define glVertexAttrib3sv MANGLE(VertexAttrib3sv)
+#define glVertexAttrib3svNV MANGLE(VertexAttrib3svNV)
+#define glVertexAttrib4bvARB MANGLE(VertexAttrib4bvARB)
+#define glVertexAttrib4bv MANGLE(VertexAttrib4bv)
+#define glVertexAttrib4dARB MANGLE(VertexAttrib4dARB)
+#define glVertexAttrib4d MANGLE(VertexAttrib4d)
+#define glVertexAttrib4dNV MANGLE(VertexAttrib4dNV)
+#define glVertexAttrib4dvARB MANGLE(VertexAttrib4dvARB)
+#define glVertexAttrib4dv MANGLE(VertexAttrib4dv)
+#define glVertexAttrib4dvNV MANGLE(VertexAttrib4dvNV)
+#define glVertexAttrib4fARB MANGLE(VertexAttrib4fARB)
+#define glVertexAttrib4f MANGLE(VertexAttrib4f)
+#define glVertexAttrib4fNV MANGLE(VertexAttrib4fNV)
+#define glVertexAttrib4fvARB MANGLE(VertexAttrib4fvARB)
+#define glVertexAttrib4fv MANGLE(VertexAttrib4fv)
+#define glVertexAttrib4fvNV MANGLE(VertexAttrib4fvNV)
+#define glVertexAttrib4hNV MANGLE(VertexAttrib4hNV)
+#define glVertexAttrib4hvNV MANGLE(VertexAttrib4hvNV)
+#define glVertexAttrib4ivARB MANGLE(VertexAttrib4ivARB)
+#define glVertexAttrib4iv MANGLE(VertexAttrib4iv)
+#define glVertexAttrib4NbvARB MANGLE(VertexAttrib4NbvARB)
+#define glVertexAttrib4Nbv MANGLE(VertexAttrib4Nbv)
+#define glVertexAttrib4NivARB MANGLE(VertexAttrib4NivARB)
+#define glVertexAttrib4Niv MANGLE(VertexAttrib4Niv)
+#define glVertexAttrib4NsvARB MANGLE(VertexAttrib4NsvARB)
+#define glVertexAttrib4Nsv MANGLE(VertexAttrib4Nsv)
+#define glVertexAttrib4NubARB MANGLE(VertexAttrib4NubARB)
+#define glVertexAttrib4Nub MANGLE(VertexAttrib4Nub)
+#define glVertexAttrib4NubvARB MANGLE(VertexAttrib4NubvARB)
+#define glVertexAttrib4Nubv MANGLE(VertexAttrib4Nubv)
+#define glVertexAttrib4NuivARB MANGLE(VertexAttrib4NuivARB)
+#define glVertexAttrib4Nuiv MANGLE(VertexAttrib4Nuiv)
+#define glVertexAttrib4NusvARB MANGLE(VertexAttrib4NusvARB)
+#define glVertexAttrib4Nusv MANGLE(VertexAttrib4Nusv)
+#define glVertexAttrib4sARB MANGLE(VertexAttrib4sARB)
+#define glVertexAttrib4s MANGLE(VertexAttrib4s)
+#define glVertexAttrib4sNV MANGLE(VertexAttrib4sNV)
+#define glVertexAttrib4svARB MANGLE(VertexAttrib4svARB)
+#define glVertexAttrib4sv MANGLE(VertexAttrib4sv)
+#define glVertexAttrib4svNV MANGLE(VertexAttrib4svNV)
+#define glVertexAttrib4ubNV MANGLE(VertexAttrib4ubNV)
+#define glVertexAttrib4ubvARB MANGLE(VertexAttrib4ubvARB)
+#define glVertexAttrib4ubv MANGLE(VertexAttrib4ubv)
+#define glVertexAttrib4ubvNV MANGLE(VertexAttrib4ubvNV)
+#define glVertexAttrib4uivARB MANGLE(VertexAttrib4uivARB)
+#define glVertexAttrib4uiv MANGLE(VertexAttrib4uiv)
+#define glVertexAttrib4usvARB MANGLE(VertexAttrib4usvARB)
+#define glVertexAttrib4usv MANGLE(VertexAttrib4usv)
+#define glVertexAttribArrayObjectATI MANGLE(VertexAttribArrayObjectATI)
+#define glVertexAttribDivisorARB MANGLE(VertexAttribDivisorARB)
+#define glVertexAttribDivisor MANGLE(VertexAttribDivisor)
+#define glVertexAttribFormatNV MANGLE(VertexAttribFormatNV)
+#define glVertexAttribI1iEXT MANGLE(VertexAttribI1iEXT)
+#define glVertexAttribI1i MANGLE(VertexAttribI1i)
+#define glVertexAttribI1ivEXT MANGLE(VertexAttribI1ivEXT)
+#define glVertexAttribI1iv MANGLE(VertexAttribI1iv)
+#define glVertexAttribI1uiEXT MANGLE(VertexAttribI1uiEXT)
+#define glVertexAttribI1ui MANGLE(VertexAttribI1ui)
+#define glVertexAttribI1uivEXT MANGLE(VertexAttribI1uivEXT)
+#define glVertexAttribI1uiv MANGLE(VertexAttribI1uiv)
+#define glVertexAttribI2iEXT MANGLE(VertexAttribI2iEXT)
+#define glVertexAttribI2i MANGLE(VertexAttribI2i)
+#define glVertexAttribI2ivEXT MANGLE(VertexAttribI2ivEXT)
+#define glVertexAttribI2iv MANGLE(VertexAttribI2iv)
+#define glVertexAttribI2uiEXT MANGLE(VertexAttribI2uiEXT)
+#define glVertexAttribI2ui MANGLE(VertexAttribI2ui)
+#define glVertexAttribI2uivEXT MANGLE(VertexAttribI2uivEXT)
+#define glVertexAttribI2uiv MANGLE(VertexAttribI2uiv)
+#define glVertexAttribI3iEXT MANGLE(VertexAttribI3iEXT)
+#define glVertexAttribI3i MANGLE(VertexAttribI3i)
+#define glVertexAttribI3ivEXT MANGLE(VertexAttribI3ivEXT)
+#define glVertexAttribI3iv MANGLE(VertexAttribI3iv)
+#define glVertexAttribI3uiEXT MANGLE(VertexAttribI3uiEXT)
+#define glVertexAttribI3ui MANGLE(VertexAttribI3ui)
+#define glVertexAttribI3uivEXT MANGLE(VertexAttribI3uivEXT)
+#define glVertexAttribI3uiv MANGLE(VertexAttribI3uiv)
+#define glVertexAttribI4bvEXT MANGLE(VertexAttribI4bvEXT)
+#define glVertexAttribI4bv MANGLE(VertexAttribI4bv)
+#define glVertexAttribI4iEXT MANGLE(VertexAttribI4iEXT)
+#define glVertexAttribI4i MANGLE(VertexAttribI4i)
+#define glVertexAttribI4ivEXT MANGLE(VertexAttribI4ivEXT)
+#define glVertexAttribI4iv MANGLE(VertexAttribI4iv)
+#define glVertexAttribI4svEXT MANGLE(VertexAttribI4svEXT)
+#define glVertexAttribI4sv MANGLE(VertexAttribI4sv)
+#define glVertexAttribI4ubvEXT MANGLE(VertexAttribI4ubvEXT)
+#define glVertexAttribI4ubv MANGLE(VertexAttribI4ubv)
+#define glVertexAttribI4uiEXT MANGLE(VertexAttribI4uiEXT)
+#define glVertexAttribI4ui MANGLE(VertexAttribI4ui)
+#define glVertexAttribI4uivEXT MANGLE(VertexAttribI4uivEXT)
+#define glVertexAttribI4uiv MANGLE(VertexAttribI4uiv)
+#define glVertexAttribI4usvEXT MANGLE(VertexAttribI4usvEXT)
+#define glVertexAttribI4usv MANGLE(VertexAttribI4usv)
+#define glVertexAttribIFormatNV MANGLE(VertexAttribIFormatNV)
+#define glVertexAttribIPointerEXT MANGLE(VertexAttribIPointerEXT)
+#define glVertexAttribIPointer MANGLE(VertexAttribIPointer)
+#define glVertexAttribL1dEXT MANGLE(VertexAttribL1dEXT)
+#define glVertexAttribL1d MANGLE(VertexAttribL1d)
+#define glVertexAttribL1dvEXT MANGLE(VertexAttribL1dvEXT)
+#define glVertexAttribL1dv MANGLE(VertexAttribL1dv)
+#define glVertexAttribL1i64NV MANGLE(VertexAttribL1i64NV)
+#define glVertexAttribL1i64vNV MANGLE(VertexAttribL1i64vNV)
+#define glVertexAttribL1ui64NV MANGLE(VertexAttribL1ui64NV)
+#define glVertexAttribL1ui64vNV MANGLE(VertexAttribL1ui64vNV)
+#define glVertexAttribL2dEXT MANGLE(VertexAttribL2dEXT)
+#define glVertexAttribL2d MANGLE(VertexAttribL2d)
+#define glVertexAttribL2dvEXT MANGLE(VertexAttribL2dvEXT)
+#define glVertexAttribL2dv MANGLE(VertexAttribL2dv)
+#define glVertexAttribL2i64NV MANGLE(VertexAttribL2i64NV)
+#define glVertexAttribL2i64vNV MANGLE(VertexAttribL2i64vNV)
+#define glVertexAttribL2ui64NV MANGLE(VertexAttribL2ui64NV)
+#define glVertexAttribL2ui64vNV MANGLE(VertexAttribL2ui64vNV)
+#define glVertexAttribL3dEXT MANGLE(VertexAttribL3dEXT)
+#define glVertexAttribL3d MANGLE(VertexAttribL3d)
+#define glVertexAttribL3dvEXT MANGLE(VertexAttribL3dvEXT)
+#define glVertexAttribL3dv MANGLE(VertexAttribL3dv)
+#define glVertexAttribL3i64NV MANGLE(VertexAttribL3i64NV)
+#define glVertexAttribL3i64vNV MANGLE(VertexAttribL3i64vNV)
+#define glVertexAttribL3ui64NV MANGLE(VertexAttribL3ui64NV)
+#define glVertexAttribL3ui64vNV MANGLE(VertexAttribL3ui64vNV)
+#define glVertexAttribL4dEXT MANGLE(VertexAttribL4dEXT)
+#define glVertexAttribL4d MANGLE(VertexAttribL4d)
+#define glVertexAttribL4dvEXT MANGLE(VertexAttribL4dvEXT)
+#define glVertexAttribL4dv MANGLE(VertexAttribL4dv)
+#define glVertexAttribL4i64NV MANGLE(VertexAttribL4i64NV)
+#define glVertexAttribL4i64vNV MANGLE(VertexAttribL4i64vNV)
+#define glVertexAttribL4ui64NV MANGLE(VertexAttribL4ui64NV)
+#define glVertexAttribL4ui64vNV MANGLE(VertexAttribL4ui64vNV)
+#define glVertexAttribLFormatNV MANGLE(VertexAttribLFormatNV)
+#define glVertexAttribLPointerEXT MANGLE(VertexAttribLPointerEXT)
+#define glVertexAttribLPointer MANGLE(VertexAttribLPointer)
+#define glVertexAttribP1ui MANGLE(VertexAttribP1ui)
+#define glVertexAttribP1uiv MANGLE(VertexAttribP1uiv)
+#define glVertexAttribP2ui MANGLE(VertexAttribP2ui)
+#define glVertexAttribP2uiv MANGLE(VertexAttribP2uiv)
+#define glVertexAttribP3ui MANGLE(VertexAttribP3ui)
+#define glVertexAttribP3uiv MANGLE(VertexAttribP3uiv)
+#define glVertexAttribP4ui MANGLE(VertexAttribP4ui)
+#define glVertexAttribP4uiv MANGLE(VertexAttribP4uiv)
+#define glVertexAttribPointerARB MANGLE(VertexAttribPointerARB)
+#define glVertexAttribPointer MANGLE(VertexAttribPointer)
+#define glVertexAttribPointerNV MANGLE(VertexAttribPointerNV)
+#define glVertexAttribs1dvNV MANGLE(VertexAttribs1dvNV)
+#define glVertexAttribs1fvNV MANGLE(VertexAttribs1fvNV)
+#define glVertexAttribs1hvNV MANGLE(VertexAttribs1hvNV)
+#define glVertexAttribs1svNV MANGLE(VertexAttribs1svNV)
+#define glVertexAttribs2dvNV MANGLE(VertexAttribs2dvNV)
+#define glVertexAttribs2fvNV MANGLE(VertexAttribs2fvNV)
+#define glVertexAttribs2hvNV MANGLE(VertexAttribs2hvNV)
+#define glVertexAttribs2svNV MANGLE(VertexAttribs2svNV)
+#define glVertexAttribs3dvNV MANGLE(VertexAttribs3dvNV)
+#define glVertexAttribs3fvNV MANGLE(VertexAttribs3fvNV)
+#define glVertexAttribs3hvNV MANGLE(VertexAttribs3hvNV)
+#define glVertexAttribs3svNV MANGLE(VertexAttribs3svNV)
+#define glVertexAttribs4dvNV MANGLE(VertexAttribs4dvNV)
+#define glVertexAttribs4fvNV MANGLE(VertexAttribs4fvNV)
+#define glVertexAttribs4hvNV MANGLE(VertexAttribs4hvNV)
+#define glVertexAttribs4svNV MANGLE(VertexAttribs4svNV)
+#define glVertexAttribs4ubvNV MANGLE(VertexAttribs4ubvNV)
+#define glVertexBlendARB MANGLE(VertexBlendARB)
+#define glVertexBlendEnvfATI MANGLE(VertexBlendEnvfATI)
+#define glVertexBlendEnviATI MANGLE(VertexBlendEnviATI)
+#define glVertexFormatNV MANGLE(VertexFormatNV)
+#define glVertexP2ui MANGLE(VertexP2ui)
+#define glVertexP2uiv MANGLE(VertexP2uiv)
+#define glVertexP3ui MANGLE(VertexP3ui)
+#define glVertexP3uiv MANGLE(VertexP3uiv)
+#define glVertexP4ui MANGLE(VertexP4ui)
+#define glVertexP4uiv MANGLE(VertexP4uiv)
+#define glVertexPointerEXT MANGLE(VertexPointerEXT)
+#define glVertexPointerListIBM MANGLE(VertexPointerListIBM)
+#define glVertexPointer MANGLE(VertexPointer)
+#define glVertexPointervINTEL MANGLE(VertexPointervINTEL)
+#define glVertexStream1dATI MANGLE(VertexStream1dATI)
+#define glVertexStream1dvATI MANGLE(VertexStream1dvATI)
+#define glVertexStream1fATI MANGLE(VertexStream1fATI)
+#define glVertexStream1fvATI MANGLE(VertexStream1fvATI)
+#define glVertexStream1iATI MANGLE(VertexStream1iATI)
+#define glVertexStream1ivATI MANGLE(VertexStream1ivATI)
+#define glVertexStream1sATI MANGLE(VertexStream1sATI)
+#define glVertexStream1svATI MANGLE(VertexStream1svATI)
+#define glVertexStream2dATI MANGLE(VertexStream2dATI)
+#define glVertexStream2dvATI MANGLE(VertexStream2dvATI)
+#define glVertexStream2fATI MANGLE(VertexStream2fATI)
+#define glVertexStream2fvATI MANGLE(VertexStream2fvATI)
+#define glVertexStream2iATI MANGLE(VertexStream2iATI)
+#define glVertexStream2ivATI MANGLE(VertexStream2ivATI)
+#define glVertexStream2sATI MANGLE(VertexStream2sATI)
+#define glVertexStream2svATI MANGLE(VertexStream2svATI)
+#define glVertexStream3dATI MANGLE(VertexStream3dATI)
+#define glVertexStream3dvATI MANGLE(VertexStream3dvATI)
+#define glVertexStream3fATI MANGLE(VertexStream3fATI)
+#define glVertexStream3fvATI MANGLE(VertexStream3fvATI)
+#define glVertexStream3iATI MANGLE(VertexStream3iATI)
+#define glVertexStream3ivATI MANGLE(VertexStream3ivATI)
+#define glVertexStream3sATI MANGLE(VertexStream3sATI)
+#define glVertexStream3svATI MANGLE(VertexStream3svATI)
+#define glVertexStream4dATI MANGLE(VertexStream4dATI)
+#define glVertexStream4dvATI MANGLE(VertexStream4dvATI)
+#define glVertexStream4fATI MANGLE(VertexStream4fATI)
+#define glVertexStream4fvATI MANGLE(VertexStream4fvATI)
+#define glVertexStream4iATI MANGLE(VertexStream4iATI)
+#define glVertexStream4ivATI MANGLE(VertexStream4ivATI)
+#define glVertexStream4sATI MANGLE(VertexStream4sATI)
+#define glVertexStream4svATI MANGLE(VertexStream4svATI)
+#define glVertexWeightfEXT MANGLE(VertexWeightfEXT)
+#define glVertexWeightfvEXT MANGLE(VertexWeightfvEXT)
+#define glVertexWeighthNV MANGLE(VertexWeighthNV)
+#define glVertexWeighthvNV MANGLE(VertexWeighthvNV)
+#define glVertexWeightPointerEXT MANGLE(VertexWeightPointerEXT)
+#define glVideoCaptureNV MANGLE(VideoCaptureNV)
+#define glVideoCaptureStreamParameterdvNV MANGLE(VideoCaptureStreamParameterdvNV)
+#define glVideoCaptureStreamParameterfvNV MANGLE(VideoCaptureStreamParameterfvNV)
+#define glVideoCaptureStreamParameterivNV MANGLE(VideoCaptureStreamParameterivNV)
+#define glViewportArrayv MANGLE(ViewportArrayv)
+#define glViewportIndexedf MANGLE(ViewportIndexedf)
+#define glViewportIndexedfv MANGLE(ViewportIndexedfv)
+#define glViewport MANGLE(Viewport)
+#define glWaitSync MANGLE(WaitSync)
+#define glWeightbvARB MANGLE(WeightbvARB)
+#define glWeightdvARB MANGLE(WeightdvARB)
+#define glWeightfvARB MANGLE(WeightfvARB)
+#define glWeightivARB MANGLE(WeightivARB)
+#define glWeightPointerARB MANGLE(WeightPointerARB)
+#define glWeightsvARB MANGLE(WeightsvARB)
+#define glWeightubvARB MANGLE(WeightubvARB)
+#define glWeightuivARB MANGLE(WeightuivARB)
+#define glWeightusvARB MANGLE(WeightusvARB)
+#define glWindowPos2dARB MANGLE(WindowPos2dARB)
+#define glWindowPos2d MANGLE(WindowPos2d)
+#define glWindowPos2dMESA MANGLE(WindowPos2dMESA)
+#define glWindowPos2dvARB MANGLE(WindowPos2dvARB)
+#define glWindowPos2dv MANGLE(WindowPos2dv)
+#define glWindowPos2dvMESA MANGLE(WindowPos2dvMESA)
+#define glWindowPos2fARB MANGLE(WindowPos2fARB)
+#define glWindowPos2f MANGLE(WindowPos2f)
+#define glWindowPos2fMESA MANGLE(WindowPos2fMESA)
+#define glWindowPos2fvARB MANGLE(WindowPos2fvARB)
+#define glWindowPos2fv MANGLE(WindowPos2fv)
+#define glWindowPos2fvMESA MANGLE(WindowPos2fvMESA)
+#define glWindowPos2iARB MANGLE(WindowPos2iARB)
+#define glWindowPos2i MANGLE(WindowPos2i)
+#define glWindowPos2iMESA MANGLE(WindowPos2iMESA)
+#define glWindowPos2ivARB MANGLE(WindowPos2ivARB)
+#define glWindowPos2iv MANGLE(WindowPos2iv)
+#define glWindowPos2ivMESA MANGLE(WindowPos2ivMESA)
+#define glWindowPos2sARB MANGLE(WindowPos2sARB)
+#define glWindowPos2s MANGLE(WindowPos2s)
+#define glWindowPos2sMESA MANGLE(WindowPos2sMESA)
+#define glWindowPos2svARB MANGLE(WindowPos2svARB)
+#define glWindowPos2sv MANGLE(WindowPos2sv)
+#define glWindowPos2svMESA MANGLE(WindowPos2svMESA)
+#define glWindowPos3dARB MANGLE(WindowPos3dARB)
+#define glWindowPos3d MANGLE(WindowPos3d)
+#define glWindowPos3dMESA MANGLE(WindowPos3dMESA)
+#define glWindowPos3dvARB MANGLE(WindowPos3dvARB)
+#define glWindowPos3dv MANGLE(WindowPos3dv)
+#define glWindowPos3dvMESA MANGLE(WindowPos3dvMESA)
+#define glWindowPos3fARB MANGLE(WindowPos3fARB)
+#define glWindowPos3f MANGLE(WindowPos3f)
+#define glWindowPos3fMESA MANGLE(WindowPos3fMESA)
+#define glWindowPos3fvARB MANGLE(WindowPos3fvARB)
+#define glWindowPos3fv MANGLE(WindowPos3fv)
+#define glWindowPos3fvMESA MANGLE(WindowPos3fvMESA)
+#define glWindowPos3iARB MANGLE(WindowPos3iARB)
+#define glWindowPos3i MANGLE(WindowPos3i)
+#define glWindowPos3iMESA MANGLE(WindowPos3iMESA)
+#define glWindowPos3ivARB MANGLE(WindowPos3ivARB)
+#define glWindowPos3iv MANGLE(WindowPos3iv)
+#define glWindowPos3ivMESA MANGLE(WindowPos3ivMESA)
+#define glWindowPos3sARB MANGLE(WindowPos3sARB)
+#define glWindowPos3s MANGLE(WindowPos3s)
+#define glWindowPos3sMESA MANGLE(WindowPos3sMESA)
+#define glWindowPos3svARB MANGLE(WindowPos3svARB)
+#define glWindowPos3sv MANGLE(WindowPos3sv)
+#define glWindowPos3svMESA MANGLE(WindowPos3svMESA)
+#define glWindowPos4dMESA MANGLE(WindowPos4dMESA)
+#define glWindowPos4dvMESA MANGLE(WindowPos4dvMESA)
+#define glWindowPos4fMESA MANGLE(WindowPos4fMESA)
+#define glWindowPos4fvMESA MANGLE(WindowPos4fvMESA)
+#define glWindowPos4iMESA MANGLE(WindowPos4iMESA)
+#define glWindowPos4ivMESA MANGLE(WindowPos4ivMESA)
+#define glWindowPos4sMESA MANGLE(WindowPos4sMESA)
+#define glWindowPos4svMESA MANGLE(WindowPos4svMESA)
+#define glWriteMaskEXT MANGLE(WriteMaskEXT)
+
+#endif /* GL_MANGLE_H */
--- /dev/null
+#ifndef __glext_h_
+#define __glext_h_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2007-2011 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.
+*/
+
+/* Header file version number, required by OpenGL ABI for Linux */
+/* glext.h last updated $Date: 2011-08-08 00:34:29 -0700 (Mon, 08 Aug 2011) $ */
+/* Current version at http://www.opengl.org/registry/ */
+#define GL_GLEXT_VERSION 72
+/* Function declaration macros - to move into glplatform.h */
+
+#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
+#define WIN32_LEAN_AND_MEAN 1
+#include <windows.h>
+#endif
+
+#ifndef APIENTRY
+#define APIENTRY
+#endif
+#ifndef APIENTRYP
+#define APIENTRYP APIENTRY *
+#endif
+#ifndef GLAPI
+#define GLAPI extern
+#endif
+
+/*************************************************************/
+
+#ifndef GL_VERSION_1_2
+#define GL_UNSIGNED_BYTE_3_3_2 0x8032
+#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
+#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
+#define GL_UNSIGNED_INT_8_8_8_8 0x8035
+#define GL_UNSIGNED_INT_10_10_10_2 0x8036
+#define GL_TEXTURE_BINDING_3D 0x806A
+#define GL_PACK_SKIP_IMAGES 0x806B
+#define GL_PACK_IMAGE_HEIGHT 0x806C
+#define GL_UNPACK_SKIP_IMAGES 0x806D
+#define GL_UNPACK_IMAGE_HEIGHT 0x806E
+#define GL_TEXTURE_3D 0x806F
+#define GL_PROXY_TEXTURE_3D 0x8070
+#define GL_TEXTURE_DEPTH 0x8071
+#define GL_TEXTURE_WRAP_R 0x8072
+#define GL_MAX_3D_TEXTURE_SIZE 0x8073
+#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362
+#define GL_UNSIGNED_SHORT_5_6_5 0x8363
+#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364
+#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365
+#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366
+#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367
+#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
+#define GL_BGR 0x80E0
+#define GL_BGRA 0x80E1
+#define GL_MAX_ELEMENTS_VERTICES 0x80E8
+#define GL_MAX_ELEMENTS_INDICES 0x80E9
+#define GL_CLAMP_TO_EDGE 0x812F
+#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_SMOOTH_POINT_SIZE_RANGE 0x0B12
+#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13
+#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
+#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23
+#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
+#endif
+
+#ifndef GL_VERSION_1_2_DEPRECATED
+#define GL_RESCALE_NORMAL 0x803A
+#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8
+#define GL_SINGLE_COLOR 0x81F9
+#define GL_SEPARATE_SPECULAR_COLOR 0x81FA
+#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
+#endif
+
+#ifndef GL_ARB_imaging
+#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_FUNC_ADD 0x8006
+#define GL_MIN 0x8007
+#define GL_MAX 0x8008
+#define GL_BLEND_EQUATION 0x8009
+#define GL_FUNC_SUBTRACT 0x800A
+#define GL_FUNC_REVERSE_SUBTRACT 0x800B
+#endif
+
+#ifndef GL_ARB_imaging_DEPRECATED
+#define GL_CONVOLUTION_1D 0x8010
+#define GL_CONVOLUTION_2D 0x8011
+#define GL_SEPARABLE_2D 0x8012
+#define GL_CONVOLUTION_BORDER_MODE 0x8013
+#define GL_CONVOLUTION_FILTER_SCALE 0x8014
+#define GL_CONVOLUTION_FILTER_BIAS 0x8015
+#define GL_REDUCE 0x8016
+#define GL_CONVOLUTION_FORMAT 0x8017
+#define GL_CONVOLUTION_WIDTH 0x8018
+#define GL_CONVOLUTION_HEIGHT 0x8019
+#define GL_MAX_CONVOLUTION_WIDTH 0x801A
+#define GL_MAX_CONVOLUTION_HEIGHT 0x801B
+#define GL_POST_CONVOLUTION_RED_SCALE 0x801C
+#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D
+#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E
+#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F
+#define GL_POST_CONVOLUTION_RED_BIAS 0x8020
+#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021
+#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022
+#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023
+#define GL_HISTOGRAM 0x8024
+#define GL_PROXY_HISTOGRAM 0x8025
+#define GL_HISTOGRAM_WIDTH 0x8026
+#define GL_HISTOGRAM_FORMAT 0x8027
+#define GL_HISTOGRAM_RED_SIZE 0x8028
+#define GL_HISTOGRAM_GREEN_SIZE 0x8029
+#define GL_HISTOGRAM_BLUE_SIZE 0x802A
+#define GL_HISTOGRAM_ALPHA_SIZE 0x802B
+#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C
+#define GL_HISTOGRAM_SINK 0x802D
+#define GL_MINMAX 0x802E
+#define GL_MINMAX_FORMAT 0x802F
+#define GL_MINMAX_SINK 0x8030
+#define GL_TABLE_TOO_LARGE 0x8031
+#define GL_COLOR_MATRIX 0x80B1
+#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2
+#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3
+#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4
+#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5
+#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6
+#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7
+#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8
+#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9
+#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA
+#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB
+#define GL_COLOR_TABLE 0x80D0
+#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1
+#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2
+#define GL_PROXY_COLOR_TABLE 0x80D3
+#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4
+#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5
+#define GL_COLOR_TABLE_SCALE 0x80D6
+#define GL_COLOR_TABLE_BIAS 0x80D7
+#define GL_COLOR_TABLE_FORMAT 0x80D8
+#define GL_COLOR_TABLE_WIDTH 0x80D9
+#define GL_COLOR_TABLE_RED_SIZE 0x80DA
+#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB
+#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC
+#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD
+#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE
+#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF
+#define GL_CONSTANT_BORDER 0x8151
+#define GL_REPLICATE_BORDER 0x8153
+#define GL_CONVOLUTION_BORDER_COLOR 0x8154
+#endif
+
+#ifndef GL_VERSION_1_3
+#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_MULTISAMPLE 0x809D
+#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
+#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
+#define GL_SAMPLE_COVERAGE 0x80A0
+#define GL_SAMPLE_BUFFERS 0x80A8
+#define GL_SAMPLES 0x80A9
+#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
+#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
+#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_PROXY_TEXTURE_CUBE_MAP 0x851B
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
+#define GL_COMPRESSED_RGB 0x84ED
+#define GL_COMPRESSED_RGBA 0x84EE
+#define GL_TEXTURE_COMPRESSION_HINT 0x84EF
+#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0
+#define GL_TEXTURE_COMPRESSED 0x86A1
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
+#define GL_CLAMP_TO_BORDER 0x812D
+#endif
+
+#ifndef GL_VERSION_1_3_DEPRECATED
+#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1
+#define GL_MAX_TEXTURE_UNITS 0x84E2
+#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3
+#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4
+#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5
+#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6
+#define GL_MULTISAMPLE_BIT 0x20000000
+#define GL_NORMAL_MAP 0x8511
+#define GL_REFLECTION_MAP 0x8512
+#define GL_COMPRESSED_ALPHA 0x84E9
+#define GL_COMPRESSED_LUMINANCE 0x84EA
+#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB
+#define GL_COMPRESSED_INTENSITY 0x84EC
+#define GL_COMBINE 0x8570
+#define GL_COMBINE_RGB 0x8571
+#define GL_COMBINE_ALPHA 0x8572
+#define GL_SOURCE0_RGB 0x8580
+#define GL_SOURCE1_RGB 0x8581
+#define GL_SOURCE2_RGB 0x8582
+#define GL_SOURCE0_ALPHA 0x8588
+#define GL_SOURCE1_ALPHA 0x8589
+#define GL_SOURCE2_ALPHA 0x858A
+#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_RGB_SCALE 0x8573
+#define GL_ADD_SIGNED 0x8574
+#define GL_INTERPOLATE 0x8575
+#define GL_SUBTRACT 0x84E7
+#define GL_CONSTANT 0x8576
+#define GL_PRIMARY_COLOR 0x8577
+#define GL_PREVIOUS 0x8578
+#define GL_DOT3_RGB 0x86AE
+#define GL_DOT3_RGBA 0x86AF
+#endif
+
+#ifndef GL_VERSION_1_4
+#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_POINT_FADE_THRESHOLD_SIZE 0x8128
+#define GL_DEPTH_COMPONENT16 0x81A5
+#define GL_DEPTH_COMPONENT24 0x81A6
+#define GL_DEPTH_COMPONENT32 0x81A7
+#define GL_MIRRORED_REPEAT 0x8370
+#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD
+#define GL_TEXTURE_LOD_BIAS 0x8501
+#define GL_INCR_WRAP 0x8507
+#define GL_DECR_WRAP 0x8508
+#define GL_TEXTURE_DEPTH_SIZE 0x884A
+#define GL_TEXTURE_COMPARE_MODE 0x884C
+#define GL_TEXTURE_COMPARE_FUNC 0x884D
+#endif
+
+#ifndef GL_VERSION_1_4_DEPRECATED
+#define GL_POINT_SIZE_MIN 0x8126
+#define GL_POINT_SIZE_MAX 0x8127
+#define GL_POINT_DISTANCE_ATTENUATION 0x8129
+#define GL_GENERATE_MIPMAP 0x8191
+#define GL_GENERATE_MIPMAP_HINT 0x8192
+#define GL_FOG_COORDINATE_SOURCE 0x8450
+#define GL_FOG_COORDINATE 0x8451
+#define GL_FRAGMENT_DEPTH 0x8452
+#define GL_CURRENT_FOG_COORDINATE 0x8453
+#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454
+#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455
+#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456
+#define GL_FOG_COORDINATE_ARRAY 0x8457
+#define GL_COLOR_SUM 0x8458
+#define GL_CURRENT_SECONDARY_COLOR 0x8459
+#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A
+#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B
+#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C
+#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D
+#define GL_SECONDARY_COLOR_ARRAY 0x845E
+#define GL_TEXTURE_FILTER_CONTROL 0x8500
+#define GL_DEPTH_TEXTURE_MODE 0x884B
+#define GL_COMPARE_R_TO_TEXTURE 0x884E
+#endif
+
+#ifndef GL_VERSION_1_5
+#define GL_BUFFER_SIZE 0x8764
+#define GL_BUFFER_USAGE 0x8765
+#define GL_QUERY_COUNTER_BITS 0x8864
+#define GL_CURRENT_QUERY 0x8865
+#define GL_QUERY_RESULT 0x8866
+#define GL_QUERY_RESULT_AVAILABLE 0x8867
+#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_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
+#define GL_READ_ONLY 0x88B8
+#define GL_WRITE_ONLY 0x88B9
+#define GL_READ_WRITE 0x88BA
+#define GL_BUFFER_ACCESS 0x88BB
+#define GL_BUFFER_MAPPED 0x88BC
+#define GL_BUFFER_MAP_POINTER 0x88BD
+#define GL_STREAM_DRAW 0x88E0
+#define GL_STREAM_READ 0x88E1
+#define GL_STREAM_COPY 0x88E2
+#define GL_STATIC_DRAW 0x88E4
+#define GL_STATIC_READ 0x88E5
+#define GL_STATIC_COPY 0x88E6
+#define GL_DYNAMIC_DRAW 0x88E8
+#define GL_DYNAMIC_READ 0x88E9
+#define GL_DYNAMIC_COPY 0x88EA
+#define GL_SAMPLES_PASSED 0x8914
+#endif
+
+#ifndef GL_VERSION_1_5_DEPRECATED
+#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896
+#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897
+#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898
+#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899
+#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A
+#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B
+#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C
+#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D
+#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E
+#define GL_FOG_COORD_SRC 0x8450
+#define GL_FOG_COORD 0x8451
+#define GL_CURRENT_FOG_COORD 0x8453
+#define GL_FOG_COORD_ARRAY_TYPE 0x8454
+#define GL_FOG_COORD_ARRAY_STRIDE 0x8455
+#define GL_FOG_COORD_ARRAY_POINTER 0x8456
+#define GL_FOG_COORD_ARRAY 0x8457
+#define GL_FOG_COORD_ARRAY_BUFFER_BINDING 0x889D
+#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
+#endif
+
+#ifndef GL_VERSION_2_0
+#define GL_BLEND_EQUATION_RGB 0x8009
+#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_CURRENT_VERTEX_ATTRIB 0x8626
+#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642
+#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
+#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_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_BLEND_EQUATION_ALPHA 0x883D
+#define GL_MAX_VERTEX_ATTRIBS 0x8869
+#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
+#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
+#define GL_FRAGMENT_SHADER 0x8B30
+#define GL_VERTEX_SHADER 0x8B31
+#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49
+#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A
+#define GL_MAX_VARYING_FLOATS 0x8B4B
+#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
+#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
+#define GL_SHADER_TYPE 0x8B4F
+#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_1D 0x8B5D
+#define GL_SAMPLER_2D 0x8B5E
+#define GL_SAMPLER_3D 0x8B5F
+#define GL_SAMPLER_CUBE 0x8B60
+#define GL_SAMPLER_1D_SHADOW 0x8B61
+#define GL_SAMPLER_2D_SHADOW 0x8B62
+#define GL_DELETE_STATUS 0x8B80
+#define GL_COMPILE_STATUS 0x8B81
+#define GL_LINK_STATUS 0x8B82
+#define GL_VALIDATE_STATUS 0x8B83
+#define GL_INFO_LOG_LENGTH 0x8B84
+#define GL_ATTACHED_SHADERS 0x8B85
+#define GL_ACTIVE_UNIFORMS 0x8B86
+#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
+#define GL_SHADER_SOURCE_LENGTH 0x8B88
+#define GL_ACTIVE_ATTRIBUTES 0x8B89
+#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
+#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B
+#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
+#define GL_CURRENT_PROGRAM 0x8B8D
+#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0
+#define GL_LOWER_LEFT 0x8CA1
+#define GL_UPPER_LEFT 0x8CA2
+#define GL_STENCIL_BACK_REF 0x8CA3
+#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
+#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
+#endif
+
+#ifndef GL_VERSION_2_0_DEPRECATED
+#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643
+#define GL_POINT_SPRITE 0x8861
+#define GL_COORD_REPLACE 0x8862
+#define GL_MAX_TEXTURE_COORDS 0x8871
+#endif
+
+#ifndef GL_VERSION_2_1
+#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_SRGB_ALPHA 0x8C42
+#define GL_SRGB8_ALPHA8 0x8C43
+#define GL_COMPRESSED_SRGB 0x8C48
+#define GL_COMPRESSED_SRGB_ALPHA 0x8C49
+#endif
+
+#ifndef GL_VERSION_2_1_DEPRECATED
+#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F
+#define GL_SLUMINANCE_ALPHA 0x8C44
+#define GL_SLUMINANCE8_ALPHA8 0x8C45
+#define GL_SLUMINANCE 0x8C46
+#define GL_SLUMINANCE8 0x8C47
+#define GL_COMPRESSED_SLUMINANCE 0x8C4A
+#define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B
+#endif
+
+#ifndef GL_VERSION_3_0
+#define GL_COMPARE_REF_TO_TEXTURE 0x884E
+#define GL_CLIP_DISTANCE0 0x3000
+#define GL_CLIP_DISTANCE1 0x3001
+#define GL_CLIP_DISTANCE2 0x3002
+#define GL_CLIP_DISTANCE3 0x3003
+#define GL_CLIP_DISTANCE4 0x3004
+#define GL_CLIP_DISTANCE5 0x3005
+#define GL_CLIP_DISTANCE6 0x3006
+#define GL_CLIP_DISTANCE7 0x3007
+#define GL_MAX_CLIP_DISTANCES 0x0D32
+#define GL_MAJOR_VERSION 0x821B
+#define GL_MINOR_VERSION 0x821C
+#define GL_NUM_EXTENSIONS 0x821D
+#define GL_CONTEXT_FLAGS 0x821E
+#define GL_DEPTH_BUFFER 0x8223
+#define GL_STENCIL_BUFFER 0x8224
+#define GL_COMPRESSED_RED 0x8225
+#define GL_COMPRESSED_RG 0x8226
+#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x0001
+#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_CLAMP_READ_COLOR 0x891C
+#define GL_FIXED_ONLY 0x891D
+#define GL_MAX_VARYING_COMPONENTS 0x8B4B
+#define GL_TEXTURE_1D_ARRAY 0x8C18
+#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19
+#define GL_TEXTURE_2D_ARRAY 0x8C1A
+#define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B
+#define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C
+#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_TEXTURE_SHARED_SIZE 0x8C3F
+#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_PRIMITIVES_GENERATED 0x8C87
+#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_GREEN_INTEGER 0x8D95
+#define GL_BLUE_INTEGER 0x8D96
+#define GL_RGB_INTEGER 0x8D98
+#define GL_RGBA_INTEGER 0x8D99
+#define GL_BGR_INTEGER 0x8D9A
+#define GL_BGRA_INTEGER 0x8D9B
+#define GL_SAMPLER_1D_ARRAY 0x8DC0
+#define GL_SAMPLER_2D_ARRAY 0x8DC1
+#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3
+#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_1D 0x8DC9
+#define GL_INT_SAMPLER_2D 0x8DCA
+#define GL_INT_SAMPLER_3D 0x8DCB
+#define GL_INT_SAMPLER_CUBE 0x8DCC
+#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE
+#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF
+#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1
+#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_1D_ARRAY 0x8DD6
+#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7
+#define GL_QUERY_WAIT 0x8E13
+#define GL_QUERY_NO_WAIT 0x8E14
+#define GL_QUERY_BY_REGION_WAIT 0x8E15
+#define GL_QUERY_BY_REGION_NO_WAIT 0x8E16
+#define GL_BUFFER_ACCESS_FLAGS 0x911F
+#define GL_BUFFER_MAP_LENGTH 0x9120
+#define GL_BUFFER_MAP_OFFSET 0x9121
+/* Reuse tokens from ARB_depth_buffer_float */
+/* reuse GL_DEPTH_COMPONENT32F */
+/* reuse GL_DEPTH32F_STENCIL8 */
+/* reuse GL_FLOAT_32_UNSIGNED_INT_24_8_REV */
+/* Reuse tokens from ARB_framebuffer_object */
+/* reuse GL_INVALID_FRAMEBUFFER_OPERATION */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */
+/* reuse GL_FRAMEBUFFER_DEFAULT */
+/* reuse GL_FRAMEBUFFER_UNDEFINED */
+/* reuse GL_DEPTH_STENCIL_ATTACHMENT */
+/* reuse GL_INDEX */
+/* reuse GL_MAX_RENDERBUFFER_SIZE */
+/* reuse GL_DEPTH_STENCIL */
+/* reuse GL_UNSIGNED_INT_24_8 */
+/* reuse GL_DEPTH24_STENCIL8 */
+/* reuse GL_TEXTURE_STENCIL_SIZE */
+/* reuse GL_TEXTURE_RED_TYPE */
+/* reuse GL_TEXTURE_GREEN_TYPE */
+/* reuse GL_TEXTURE_BLUE_TYPE */
+/* reuse GL_TEXTURE_ALPHA_TYPE */
+/* reuse GL_TEXTURE_DEPTH_TYPE */
+/* reuse GL_UNSIGNED_NORMALIZED */
+/* reuse GL_FRAMEBUFFER_BINDING */
+/* reuse GL_DRAW_FRAMEBUFFER_BINDING */
+/* reuse GL_RENDERBUFFER_BINDING */
+/* reuse GL_READ_FRAMEBUFFER */
+/* reuse GL_DRAW_FRAMEBUFFER */
+/* reuse GL_READ_FRAMEBUFFER_BINDING */
+/* reuse GL_RENDERBUFFER_SAMPLES */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
+/* reuse GL_FRAMEBUFFER_COMPLETE */
+/* reuse GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */
+/* reuse GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */
+/* reuse GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER */
+/* reuse GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */
+/* reuse GL_FRAMEBUFFER_UNSUPPORTED */
+/* reuse GL_MAX_COLOR_ATTACHMENTS */
+/* reuse GL_COLOR_ATTACHMENT0 */
+/* reuse GL_COLOR_ATTACHMENT1 */
+/* reuse GL_COLOR_ATTACHMENT2 */
+/* reuse GL_COLOR_ATTACHMENT3 */
+/* reuse GL_COLOR_ATTACHMENT4 */
+/* reuse GL_COLOR_ATTACHMENT5 */
+/* reuse GL_COLOR_ATTACHMENT6 */
+/* reuse GL_COLOR_ATTACHMENT7 */
+/* reuse GL_COLOR_ATTACHMENT8 */
+/* reuse GL_COLOR_ATTACHMENT9 */
+/* reuse GL_COLOR_ATTACHMENT10 */
+/* reuse GL_COLOR_ATTACHMENT11 */
+/* reuse GL_COLOR_ATTACHMENT12 */
+/* reuse GL_COLOR_ATTACHMENT13 */
+/* reuse GL_COLOR_ATTACHMENT14 */
+/* reuse GL_COLOR_ATTACHMENT15 */
+/* reuse GL_DEPTH_ATTACHMENT */
+/* reuse GL_STENCIL_ATTACHMENT */
+/* reuse GL_FRAMEBUFFER */
+/* reuse GL_RENDERBUFFER */
+/* reuse GL_RENDERBUFFER_WIDTH */
+/* reuse GL_RENDERBUFFER_HEIGHT */
+/* reuse GL_RENDERBUFFER_INTERNAL_FORMAT */
+/* reuse GL_STENCIL_INDEX1 */
+/* reuse GL_STENCIL_INDEX4 */
+/* reuse GL_STENCIL_INDEX8 */
+/* reuse GL_STENCIL_INDEX16 */
+/* reuse GL_RENDERBUFFER_RED_SIZE */
+/* reuse GL_RENDERBUFFER_GREEN_SIZE */
+/* reuse GL_RENDERBUFFER_BLUE_SIZE */
+/* reuse GL_RENDERBUFFER_ALPHA_SIZE */
+/* reuse GL_RENDERBUFFER_DEPTH_SIZE */
+/* reuse GL_RENDERBUFFER_STENCIL_SIZE */
+/* reuse GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */
+/* reuse GL_MAX_SAMPLES */
+/* Reuse tokens from ARB_framebuffer_sRGB */
+/* reuse GL_FRAMEBUFFER_SRGB */
+/* Reuse tokens from ARB_half_float_vertex */
+/* reuse GL_HALF_FLOAT */
+/* Reuse tokens from ARB_map_buffer_range */
+/* reuse GL_MAP_READ_BIT */
+/* reuse GL_MAP_WRITE_BIT */
+/* reuse GL_MAP_INVALIDATE_RANGE_BIT */
+/* reuse GL_MAP_INVALIDATE_BUFFER_BIT */
+/* reuse GL_MAP_FLUSH_EXPLICIT_BIT */
+/* reuse GL_MAP_UNSYNCHRONIZED_BIT */
+/* Reuse tokens from ARB_texture_compression_rgtc */
+/* reuse GL_COMPRESSED_RED_RGTC1 */
+/* reuse GL_COMPRESSED_SIGNED_RED_RGTC1 */
+/* reuse GL_COMPRESSED_RG_RGTC2 */
+/* reuse GL_COMPRESSED_SIGNED_RG_RGTC2 */
+/* Reuse tokens from ARB_texture_rg */
+/* reuse GL_RG */
+/* reuse GL_RG_INTEGER */
+/* reuse GL_R8 */
+/* reuse GL_R16 */
+/* reuse GL_RG8 */
+/* reuse GL_RG16 */
+/* reuse GL_R16F */
+/* reuse GL_R32F */
+/* reuse GL_RG16F */
+/* reuse GL_RG32F */
+/* reuse GL_R8I */
+/* reuse GL_R8UI */
+/* reuse GL_R16I */
+/* reuse GL_R16UI */
+/* reuse GL_R32I */
+/* reuse GL_R32UI */
+/* reuse GL_RG8I */
+/* reuse GL_RG8UI */
+/* reuse GL_RG16I */
+/* reuse GL_RG16UI */
+/* reuse GL_RG32I */
+/* reuse GL_RG32UI */
+/* Reuse tokens from ARB_vertex_array_object */
+/* reuse GL_VERTEX_ARRAY_BINDING */
+#endif
+
+#ifndef GL_VERSION_3_0_DEPRECATED
+#define GL_CLAMP_VERTEX_COLOR 0x891A
+#define GL_CLAMP_FRAGMENT_COLOR 0x891B
+#define GL_ALPHA_INTEGER 0x8D97
+/* Reuse tokens from ARB_framebuffer_object */
+/* reuse GL_TEXTURE_LUMINANCE_TYPE */
+/* reuse GL_TEXTURE_INTENSITY_TYPE */
+#endif
+
+#ifndef GL_VERSION_3_1
+#define GL_SAMPLER_2D_RECT 0x8B63
+#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64
+#define GL_SAMPLER_BUFFER 0x8DC2
+#define GL_INT_SAMPLER_2D_RECT 0x8DCD
+#define GL_INT_SAMPLER_BUFFER 0x8DD0
+#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5
+#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8
+#define GL_TEXTURE_BUFFER 0x8C2A
+#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B
+#define GL_TEXTURE_BINDING_BUFFER 0x8C2C
+#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D
+#define GL_TEXTURE_BUFFER_FORMAT 0x8C2E
+#define GL_TEXTURE_RECTANGLE 0x84F5
+#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6
+#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7
+#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8
+#define GL_RED_SNORM 0x8F90
+#define GL_RG_SNORM 0x8F91
+#define GL_RGB_SNORM 0x8F92
+#define GL_RGBA_SNORM 0x8F93
+#define GL_R8_SNORM 0x8F94
+#define GL_RG8_SNORM 0x8F95
+#define GL_RGB8_SNORM 0x8F96
+#define GL_RGBA8_SNORM 0x8F97
+#define GL_R16_SNORM 0x8F98
+#define GL_RG16_SNORM 0x8F99
+#define GL_RGB16_SNORM 0x8F9A
+#define GL_RGBA16_SNORM 0x8F9B
+#define GL_SIGNED_NORMALIZED 0x8F9C
+#define GL_PRIMITIVE_RESTART 0x8F9D
+#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E
+/* Reuse tokens from ARB_copy_buffer */
+/* reuse GL_COPY_READ_BUFFER */
+/* reuse GL_COPY_WRITE_BUFFER */
+/* Reuse tokens from ARB_draw_instanced (none) */
+/* Reuse tokens from ARB_uniform_buffer_object */
+/* reuse GL_UNIFORM_BUFFER */
+/* reuse GL_UNIFORM_BUFFER_BINDING */
+/* reuse GL_UNIFORM_BUFFER_START */
+/* reuse GL_UNIFORM_BUFFER_SIZE */
+/* reuse GL_MAX_VERTEX_UNIFORM_BLOCKS */
+/* reuse GL_MAX_FRAGMENT_UNIFORM_BLOCKS */
+/* reuse GL_MAX_COMBINED_UNIFORM_BLOCKS */
+/* reuse GL_MAX_UNIFORM_BUFFER_BINDINGS */
+/* reuse GL_MAX_UNIFORM_BLOCK_SIZE */
+/* reuse GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS */
+/* reuse GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS */
+/* reuse GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT */
+/* reuse GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH */
+/* reuse GL_ACTIVE_UNIFORM_BLOCKS */
+/* reuse GL_UNIFORM_TYPE */
+/* reuse GL_UNIFORM_SIZE */
+/* reuse GL_UNIFORM_NAME_LENGTH */
+/* reuse GL_UNIFORM_BLOCK_INDEX */
+/* reuse GL_UNIFORM_OFFSET */
+/* reuse GL_UNIFORM_ARRAY_STRIDE */
+/* reuse GL_UNIFORM_MATRIX_STRIDE */
+/* reuse GL_UNIFORM_IS_ROW_MAJOR */
+/* reuse GL_UNIFORM_BLOCK_BINDING */
+/* reuse GL_UNIFORM_BLOCK_DATA_SIZE */
+/* reuse GL_UNIFORM_BLOCK_NAME_LENGTH */
+/* reuse GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS */
+/* reuse GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES */
+/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER */
+/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER */
+/* reuse GL_INVALID_INDEX */
+#endif
+
+#ifndef GL_VERSION_3_2
+#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001
+#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002
+#define GL_LINES_ADJACENCY 0x000A
+#define GL_LINE_STRIP_ADJACENCY 0x000B
+#define GL_TRIANGLES_ADJACENCY 0x000C
+#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D
+#define GL_PROGRAM_POINT_SIZE 0x8642
+#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29
+#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7
+#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8
+#define GL_GEOMETRY_SHADER 0x8DD9
+#define GL_GEOMETRY_VERTICES_OUT 0x8916
+#define GL_GEOMETRY_INPUT_TYPE 0x8917
+#define GL_GEOMETRY_OUTPUT_TYPE 0x8918
+#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF
+#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0
+#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1
+#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122
+#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123
+#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124
+#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125
+#define GL_CONTEXT_PROFILE_MASK 0x9126
+/* reuse GL_MAX_VARYING_COMPONENTS */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
+/* Reuse tokens from ARB_depth_clamp */
+/* reuse GL_DEPTH_CLAMP */
+/* Reuse tokens from ARB_draw_elements_base_vertex (none) */
+/* Reuse tokens from ARB_fragment_coord_conventions (none) */
+/* Reuse tokens from ARB_provoking_vertex */
+/* reuse GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */
+/* reuse GL_FIRST_VERTEX_CONVENTION */
+/* reuse GL_LAST_VERTEX_CONVENTION */
+/* reuse GL_PROVOKING_VERTEX */
+/* Reuse tokens from ARB_seamless_cube_map */
+/* reuse GL_TEXTURE_CUBE_MAP_SEAMLESS */
+/* Reuse tokens from ARB_sync */
+/* reuse GL_MAX_SERVER_WAIT_TIMEOUT */
+/* reuse GL_OBJECT_TYPE */
+/* reuse GL_SYNC_CONDITION */
+/* reuse GL_SYNC_STATUS */
+/* reuse GL_SYNC_FLAGS */
+/* reuse GL_SYNC_FENCE */
+/* reuse GL_SYNC_GPU_COMMANDS_COMPLETE */
+/* reuse GL_UNSIGNALED */
+/* reuse GL_SIGNALED */
+/* reuse GL_ALREADY_SIGNALED */
+/* reuse GL_TIMEOUT_EXPIRED */
+/* reuse GL_CONDITION_SATISFIED */
+/* reuse GL_WAIT_FAILED */
+/* reuse GL_TIMEOUT_IGNORED */
+/* reuse GL_SYNC_FLUSH_COMMANDS_BIT */
+/* reuse GL_TIMEOUT_IGNORED */
+/* Reuse tokens from ARB_texture_multisample */
+/* reuse GL_SAMPLE_POSITION */
+/* reuse GL_SAMPLE_MASK */
+/* reuse GL_SAMPLE_MASK_VALUE */
+/* reuse GL_MAX_SAMPLE_MASK_WORDS */
+/* reuse GL_TEXTURE_2D_MULTISAMPLE */
+/* reuse GL_PROXY_TEXTURE_2D_MULTISAMPLE */
+/* reuse GL_TEXTURE_2D_MULTISAMPLE_ARRAY */
+/* reuse GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY */
+/* reuse GL_TEXTURE_BINDING_2D_MULTISAMPLE */
+/* reuse GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY */
+/* reuse GL_TEXTURE_SAMPLES */
+/* reuse GL_TEXTURE_FIXED_SAMPLE_LOCATIONS */
+/* reuse GL_SAMPLER_2D_MULTISAMPLE */
+/* reuse GL_INT_SAMPLER_2D_MULTISAMPLE */
+/* reuse GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE */
+/* reuse GL_SAMPLER_2D_MULTISAMPLE_ARRAY */
+/* reuse GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY */
+/* reuse GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY */
+/* reuse GL_MAX_COLOR_TEXTURE_SAMPLES */
+/* reuse GL_MAX_DEPTH_TEXTURE_SAMPLES */
+/* reuse GL_MAX_INTEGER_SAMPLES */
+/* Don't need to reuse tokens from ARB_vertex_array_bgra since they're already in 1.2 core */
+#endif
+
+#ifndef GL_VERSION_3_3
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE
+/* Reuse tokens from ARB_blend_func_extended */
+/* reuse GL_SRC1_COLOR */
+/* reuse GL_ONE_MINUS_SRC1_COLOR */
+/* reuse GL_ONE_MINUS_SRC1_ALPHA */
+/* reuse GL_MAX_DUAL_SOURCE_DRAW_BUFFERS */
+/* Reuse tokens from ARB_explicit_attrib_location (none) */
+/* Reuse tokens from ARB_occlusion_query2 */
+/* reuse GL_ANY_SAMPLES_PASSED */
+/* Reuse tokens from ARB_sampler_objects */
+/* reuse GL_SAMPLER_BINDING */
+/* Reuse tokens from ARB_shader_bit_encoding (none) */
+/* Reuse tokens from ARB_texture_rgb10_a2ui */
+/* reuse GL_RGB10_A2UI */
+/* Reuse tokens from ARB_texture_swizzle */
+/* reuse GL_TEXTURE_SWIZZLE_R */
+/* reuse GL_TEXTURE_SWIZZLE_G */
+/* reuse GL_TEXTURE_SWIZZLE_B */
+/* reuse GL_TEXTURE_SWIZZLE_A */
+/* reuse GL_TEXTURE_SWIZZLE_RGBA */
+/* Reuse tokens from ARB_timer_query */
+/* reuse GL_TIME_ELAPSED */
+/* reuse GL_TIMESTAMP */
+/* Reuse tokens from ARB_vertex_type_2_10_10_10_rev */
+/* reuse GL_INT_2_10_10_10_REV */
+#endif
+
+#ifndef GL_VERSION_4_0
+#define GL_SAMPLE_SHADING 0x8C36
+#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37
+#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E
+#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F
+#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009
+#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A
+#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B
+#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C
+#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D
+#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E
+#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F
+/* Reuse tokens from ARB_texture_query_lod (none) */
+/* Reuse tokens from ARB_draw_buffers_blend (none) */
+/* Reuse tokens from ARB_draw_indirect */
+/* reuse GL_DRAW_INDIRECT_BUFFER */
+/* reuse GL_DRAW_INDIRECT_BUFFER_BINDING */
+/* Reuse tokens from ARB_gpu_shader5 */
+/* reuse GL_GEOMETRY_SHADER_INVOCATIONS */
+/* reuse GL_MAX_GEOMETRY_SHADER_INVOCATIONS */
+/* reuse GL_MIN_FRAGMENT_INTERPOLATION_OFFSET */
+/* reuse GL_MAX_FRAGMENT_INTERPOLATION_OFFSET */
+/* reuse GL_FRAGMENT_INTERPOLATION_OFFSET_BITS */
+/* reuse GL_MAX_VERTEX_STREAMS */
+/* Reuse tokens from ARB_gpu_shader_fp64 */
+/* reuse GL_DOUBLE_VEC2 */
+/* reuse GL_DOUBLE_VEC3 */
+/* reuse GL_DOUBLE_VEC4 */
+/* reuse GL_DOUBLE_MAT2 */
+/* reuse GL_DOUBLE_MAT3 */
+/* reuse GL_DOUBLE_MAT4 */
+/* reuse GL_DOUBLE_MAT2x3 */
+/* reuse GL_DOUBLE_MAT2x4 */
+/* reuse GL_DOUBLE_MAT3x2 */
+/* reuse GL_DOUBLE_MAT3x4 */
+/* reuse GL_DOUBLE_MAT4x2 */
+/* reuse GL_DOUBLE_MAT4x3 */
+/* Reuse tokens from ARB_shader_subroutine */
+/* reuse GL_ACTIVE_SUBROUTINES */
+/* reuse GL_ACTIVE_SUBROUTINE_UNIFORMS */
+/* reuse GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS */
+/* reuse GL_ACTIVE_SUBROUTINE_MAX_LENGTH */
+/* reuse GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH */
+/* reuse GL_MAX_SUBROUTINES */
+/* reuse GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS */
+/* reuse GL_NUM_COMPATIBLE_SUBROUTINES */
+/* reuse GL_COMPATIBLE_SUBROUTINES */
+/* Reuse tokens from ARB_tessellation_shader */
+/* reuse GL_PATCHES */
+/* reuse GL_PATCH_VERTICES */
+/* reuse GL_PATCH_DEFAULT_INNER_LEVEL */
+/* reuse GL_PATCH_DEFAULT_OUTER_LEVEL */
+/* reuse GL_TESS_CONTROL_OUTPUT_VERTICES */
+/* reuse GL_TESS_GEN_MODE */
+/* reuse GL_TESS_GEN_SPACING */
+/* reuse GL_TESS_GEN_VERTEX_ORDER */
+/* reuse GL_TESS_GEN_POINT_MODE */
+/* reuse GL_ISOLINES */
+/* reuse GL_FRACTIONAL_ODD */
+/* reuse GL_FRACTIONAL_EVEN */
+/* reuse GL_MAX_PATCH_VERTICES */
+/* reuse GL_MAX_TESS_GEN_LEVEL */
+/* reuse GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS */
+/* reuse GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS */
+/* reuse GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS */
+/* reuse GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS */
+/* reuse GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS */
+/* reuse GL_MAX_TESS_PATCH_COMPONENTS */
+/* reuse GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS */
+/* reuse GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS */
+/* reuse GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS */
+/* reuse GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS */
+/* reuse GL_MAX_TESS_CONTROL_INPUT_COMPONENTS */
+/* reuse GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS */
+/* reuse GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS */
+/* reuse GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS */
+/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER */
+/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER */
+/* reuse GL_TESS_EVALUATION_SHADER */
+/* reuse GL_TESS_CONTROL_SHADER */
+/* Reuse tokens from ARB_texture_buffer_object_rgb32 (none) */
+/* Reuse tokens from ARB_transform_feedback2 */
+/* reuse GL_TRANSFORM_FEEDBACK */
+/* reuse GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED */
+/* reuse GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE */
+/* reuse GL_TRANSFORM_FEEDBACK_BINDING */
+/* Reuse tokens from ARB_transform_feedback3 */
+/* reuse GL_MAX_TRANSFORM_FEEDBACK_BUFFERS */
+/* reuse GL_MAX_VERTEX_STREAMS */
+#endif
+
+#ifndef GL_VERSION_4_1
+/* Reuse tokens from ARB_ES2_compatibility */
+/* reuse GL_FIXED */
+/* reuse GL_IMPLEMENTATION_COLOR_READ_TYPE */
+/* reuse GL_IMPLEMENTATION_COLOR_READ_FORMAT */
+/* reuse GL_LOW_FLOAT */
+/* reuse GL_MEDIUM_FLOAT */
+/* reuse GL_HIGH_FLOAT */
+/* reuse GL_LOW_INT */
+/* reuse GL_MEDIUM_INT */
+/* reuse GL_HIGH_INT */
+/* reuse GL_SHADER_COMPILER */
+/* reuse GL_NUM_SHADER_BINARY_FORMATS */
+/* reuse GL_MAX_VERTEX_UNIFORM_VECTORS */
+/* reuse GL_MAX_VARYING_VECTORS */
+/* reuse GL_MAX_FRAGMENT_UNIFORM_VECTORS */
+/* Reuse tokens from ARB_get_program_binary */
+/* reuse GL_PROGRAM_BINARY_RETRIEVABLE_HINT */
+/* reuse GL_PROGRAM_BINARY_LENGTH */
+/* reuse GL_NUM_PROGRAM_BINARY_FORMATS */
+/* reuse GL_PROGRAM_BINARY_FORMATS */
+/* Reuse tokens from ARB_separate_shader_objects */
+/* reuse GL_VERTEX_SHADER_BIT */
+/* reuse GL_FRAGMENT_SHADER_BIT */
+/* reuse GL_GEOMETRY_SHADER_BIT */
+/* reuse GL_TESS_CONTROL_SHADER_BIT */
+/* reuse GL_TESS_EVALUATION_SHADER_BIT */
+/* reuse GL_ALL_SHADER_BITS */
+/* reuse GL_PROGRAM_SEPARABLE */
+/* reuse GL_ACTIVE_PROGRAM */
+/* reuse GL_PROGRAM_PIPELINE_BINDING */
+/* Reuse tokens from ARB_shader_precision (none) */
+/* Reuse tokens from ARB_vertex_attrib_64bit - all are in GL 3.0 and 4.0 already */
+/* Reuse tokens from ARB_viewport_array - some are in GL 1.1 and ARB_provoking_vertex already */
+/* reuse GL_MAX_VIEWPORTS */
+/* reuse GL_VIEWPORT_SUBPIXEL_BITS */
+/* reuse GL_VIEWPORT_BOUNDS_RANGE */
+/* reuse GL_LAYER_PROVOKING_VERTEX */
+/* reuse GL_VIEWPORT_INDEX_PROVOKING_VERTEX */
+/* reuse GL_UNDEFINED_VERTEX */
+#endif
+
+#ifndef GL_VERSION_4_2
+/* Reuse tokens from ARB_base_instance (none) */
+/* Reuse tokens from ARB_shading_language_420pack (none) */
+/* Reuse tokens from ARB_transform_feedback_instanced (none) */
+/* Reuse tokens from ARB_compressed_texture_pixel_storage */
+/* reuse GL_UNPACK_COMPRESSED_BLOCK_WIDTH */
+/* reuse GL_UNPACK_COMPRESSED_BLOCK_HEIGHT */
+/* reuse GL_UNPACK_COMPRESSED_BLOCK_DEPTH */
+/* reuse GL_UNPACK_COMPRESSED_BLOCK_SIZE */
+/* reuse GL_PACK_COMPRESSED_BLOCK_WIDTH */
+/* reuse GL_PACK_COMPRESSED_BLOCK_HEIGHT */
+/* reuse GL_PACK_COMPRESSED_BLOCK_DEPTH */
+/* reuse GL_PACK_COMPRESSED_BLOCK_SIZE */
+/* Reuse tokens from ARB_conservative_depth (none) */
+/* Reuse tokens from ARB_internalformat_query */
+/* reuse GL_NUM_SAMPLE_COUNTS */
+/* Reuse tokens from ARB_map_buffer_alignment */
+/* reuse GL_MIN_MAP_BUFFER_ALIGNMENT */
+/* Reuse tokens from ARB_shader_atomic_counters */
+/* reuse GL_ATOMIC_COUNTER_BUFFER */
+/* reuse GL_ATOMIC_COUNTER_BUFFER_BINDING */
+/* reuse GL_ATOMIC_COUNTER_BUFFER_START */
+/* reuse GL_ATOMIC_COUNTER_BUFFER_SIZE */
+/* reuse GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE */
+/* reuse GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS */
+/* reuse GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES */
+/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER */
+/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER */
+/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER */
+/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER */
+/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER */
+/* reuse GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS */
+/* reuse GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS */
+/* reuse GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS */
+/* reuse GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS */
+/* reuse GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS */
+/* reuse GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS */
+/* reuse GL_MAX_VERTEX_ATOMIC_COUNTERS */
+/* reuse GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS */
+/* reuse GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS */
+/* reuse GL_MAX_GEOMETRY_ATOMIC_COUNTERS */
+/* reuse GL_MAX_FRAGMENT_ATOMIC_COUNTERS */
+/* reuse GL_MAX_COMBINED_ATOMIC_COUNTERS */
+/* reuse GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE */
+/* reuse GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS */
+/* reuse GL_ACTIVE_ATOMIC_COUNTER_BUFFERS */
+/* reuse GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX */
+/* reuse GL_UNSIGNED_INT_ATOMIC_COUNTER */
+/* Reuse tokens from ARB_shader_image_load_store */
+/* reuse GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT */
+/* reuse GL_ELEMENT_ARRAY_BARRIER_BIT */
+/* reuse GL_UNIFORM_BARRIER_BIT */
+/* reuse GL_TEXTURE_FETCH_BARRIER_BIT */
+/* reuse GL_SHADER_IMAGE_ACCESS_BARRIER_BIT */
+/* reuse GL_COMMAND_BARRIER_BIT */
+/* reuse GL_PIXEL_BUFFER_BARRIER_BIT */
+/* reuse GL_TEXTURE_UPDATE_BARRIER_BIT */
+/* reuse GL_BUFFER_UPDATE_BARRIER_BIT */
+/* reuse GL_FRAMEBUFFER_BARRIER_BIT */
+/* reuse GL_TRANSFORM_FEEDBACK_BARRIER_BIT */
+/* reuse GL_ATOMIC_COUNTER_BARRIER_BIT */
+/* reuse GL_ALL_BARRIER_BITS */
+/* reuse GL_MAX_IMAGE_UNITS */
+/* reuse GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS */
+/* reuse GL_IMAGE_BINDING_NAME */
+/* reuse GL_IMAGE_BINDING_LEVEL */
+/* reuse GL_IMAGE_BINDING_LAYERED */
+/* reuse GL_IMAGE_BINDING_LAYER */
+/* reuse GL_IMAGE_BINDING_ACCESS */
+/* reuse GL_IMAGE_1D */
+/* reuse GL_IMAGE_2D */
+/* reuse GL_IMAGE_3D */
+/* reuse GL_IMAGE_2D_RECT */
+/* reuse GL_IMAGE_CUBE */
+/* reuse GL_IMAGE_BUFFER */
+/* reuse GL_IMAGE_1D_ARRAY */
+/* reuse GL_IMAGE_2D_ARRAY */
+/* reuse GL_IMAGE_CUBE_MAP_ARRAY */
+/* reuse GL_IMAGE_2D_MULTISAMPLE */
+/* reuse GL_IMAGE_2D_MULTISAMPLE_ARRAY */
+/* reuse GL_INT_IMAGE_1D */
+/* reuse GL_INT_IMAGE_2D */
+/* reuse GL_INT_IMAGE_3D */
+/* reuse GL_INT_IMAGE_2D_RECT */
+/* reuse GL_INT_IMAGE_CUBE */
+/* reuse GL_INT_IMAGE_BUFFER */
+/* reuse GL_INT_IMAGE_1D_ARRAY */
+/* reuse GL_INT_IMAGE_2D_ARRAY */
+/* reuse GL_INT_IMAGE_CUBE_MAP_ARRAY */
+/* reuse GL_INT_IMAGE_2D_MULTISAMPLE */
+/* reuse GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY */
+/* reuse GL_UNSIGNED_INT_IMAGE_1D */
+/* reuse GL_UNSIGNED_INT_IMAGE_2D */
+/* reuse GL_UNSIGNED_INT_IMAGE_3D */
+/* reuse GL_UNSIGNED_INT_IMAGE_2D_RECT */
+/* reuse GL_UNSIGNED_INT_IMAGE_CUBE */
+/* reuse GL_UNSIGNED_INT_IMAGE_BUFFER */
+/* reuse GL_UNSIGNED_INT_IMAGE_1D_ARRAY */
+/* reuse GL_UNSIGNED_INT_IMAGE_2D_ARRAY */
+/* reuse GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY */
+/* reuse GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE */
+/* reuse GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY */
+/* reuse GL_MAX_IMAGE_SAMPLES */
+/* reuse GL_IMAGE_BINDING_FORMAT */
+/* reuse GL_IMAGE_FORMAT_COMPATIBILITY_TYPE */
+/* reuse GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE */
+/* reuse GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS */
+/* reuse GL_MAX_VERTEX_IMAGE_UNIFORMS */
+/* reuse GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS */
+/* reuse GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS */
+/* reuse GL_MAX_GEOMETRY_IMAGE_UNIFORMS */
+/* reuse GL_MAX_FRAGMENT_IMAGE_UNIFORMS */
+/* reuse GL_MAX_COMBINED_IMAGE_UNIFORMS */
+/* Reuse tokens from ARB_shading_language_packing (none) */
+/* Reuse tokens from ARB_texture_storage */
+/* reuse GL_TEXTURE_IMMUTABLE_FORMAT */
+#endif
+
+#ifndef GL_ARB_multitexture
+#define GL_TEXTURE0_ARB 0x84C0
+#define GL_TEXTURE1_ARB 0x84C1
+#define GL_TEXTURE2_ARB 0x84C2
+#define GL_TEXTURE3_ARB 0x84C3
+#define GL_TEXTURE4_ARB 0x84C4
+#define GL_TEXTURE5_ARB 0x84C5
+#define GL_TEXTURE6_ARB 0x84C6
+#define GL_TEXTURE7_ARB 0x84C7
+#define GL_TEXTURE8_ARB 0x84C8
+#define GL_TEXTURE9_ARB 0x84C9
+#define GL_TEXTURE10_ARB 0x84CA
+#define GL_TEXTURE11_ARB 0x84CB
+#define GL_TEXTURE12_ARB 0x84CC
+#define GL_TEXTURE13_ARB 0x84CD
+#define GL_TEXTURE14_ARB 0x84CE
+#define GL_TEXTURE15_ARB 0x84CF
+#define GL_TEXTURE16_ARB 0x84D0
+#define GL_TEXTURE17_ARB 0x84D1
+#define GL_TEXTURE18_ARB 0x84D2
+#define GL_TEXTURE19_ARB 0x84D3
+#define GL_TEXTURE20_ARB 0x84D4
+#define GL_TEXTURE21_ARB 0x84D5
+#define GL_TEXTURE22_ARB 0x84D6
+#define GL_TEXTURE23_ARB 0x84D7
+#define GL_TEXTURE24_ARB 0x84D8
+#define GL_TEXTURE25_ARB 0x84D9
+#define GL_TEXTURE26_ARB 0x84DA
+#define GL_TEXTURE27_ARB 0x84DB
+#define GL_TEXTURE28_ARB 0x84DC
+#define GL_TEXTURE29_ARB 0x84DD
+#define GL_TEXTURE30_ARB 0x84DE
+#define GL_TEXTURE31_ARB 0x84DF
+#define GL_ACTIVE_TEXTURE_ARB 0x84E0
+#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1
+#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2
+#endif
+
+#ifndef GL_ARB_transpose_matrix
+#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3
+#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4
+#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5
+#define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6
+#endif
+
+#ifndef GL_ARB_multisample
+#define GL_MULTISAMPLE_ARB 0x809D
+#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E
+#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F
+#define GL_SAMPLE_COVERAGE_ARB 0x80A0
+#define GL_SAMPLE_BUFFERS_ARB 0x80A8
+#define GL_SAMPLES_ARB 0x80A9
+#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA
+#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB
+#define GL_MULTISAMPLE_BIT_ARB 0x20000000
+#endif
+
+#ifndef GL_ARB_texture_env_add
+#endif
+
+#ifndef GL_ARB_texture_cube_map
+#define GL_NORMAL_MAP_ARB 0x8511
+#define GL_REFLECTION_MAP_ARB 0x8512
+#define GL_TEXTURE_CUBE_MAP_ARB 0x8513
+#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A
+#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C
+#endif
+
+#ifndef GL_ARB_texture_compression
+#define GL_COMPRESSED_ALPHA_ARB 0x84E9
+#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA
+#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB
+#define GL_COMPRESSED_INTENSITY_ARB 0x84EC
+#define GL_COMPRESSED_RGB_ARB 0x84ED
+#define GL_COMPRESSED_RGBA_ARB 0x84EE
+#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF
+#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0
+#define GL_TEXTURE_COMPRESSED_ARB 0x86A1
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3
+#endif
+
+#ifndef GL_ARB_texture_border_clamp
+#define GL_CLAMP_TO_BORDER_ARB 0x812D
+#endif
+
+#ifndef GL_ARB_point_parameters
+#define GL_POINT_SIZE_MIN_ARB 0x8126
+#define GL_POINT_SIZE_MAX_ARB 0x8127
+#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128
+#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129
+#endif
+
+#ifndef GL_ARB_vertex_blend
+#define GL_MAX_VERTEX_UNITS_ARB 0x86A4
+#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5
+#define GL_WEIGHT_SUM_UNITY_ARB 0x86A6
+#define GL_VERTEX_BLEND_ARB 0x86A7
+#define GL_CURRENT_WEIGHT_ARB 0x86A8
+#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9
+#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA
+#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB
+#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC
+#define GL_WEIGHT_ARRAY_ARB 0x86AD
+#define GL_MODELVIEW0_ARB 0x1700
+#define GL_MODELVIEW1_ARB 0x850A
+#define GL_MODELVIEW2_ARB 0x8722
+#define GL_MODELVIEW3_ARB 0x8723
+#define GL_MODELVIEW4_ARB 0x8724
+#define GL_MODELVIEW5_ARB 0x8725
+#define GL_MODELVIEW6_ARB 0x8726
+#define GL_MODELVIEW7_ARB 0x8727
+#define GL_MODELVIEW8_ARB 0x8728
+#define GL_MODELVIEW9_ARB 0x8729
+#define GL_MODELVIEW10_ARB 0x872A
+#define GL_MODELVIEW11_ARB 0x872B
+#define GL_MODELVIEW12_ARB 0x872C
+#define GL_MODELVIEW13_ARB 0x872D
+#define GL_MODELVIEW14_ARB 0x872E
+#define GL_MODELVIEW15_ARB 0x872F
+#define GL_MODELVIEW16_ARB 0x8730
+#define GL_MODELVIEW17_ARB 0x8731
+#define GL_MODELVIEW18_ARB 0x8732
+#define GL_MODELVIEW19_ARB 0x8733
+#define GL_MODELVIEW20_ARB 0x8734
+#define GL_MODELVIEW21_ARB 0x8735
+#define GL_MODELVIEW22_ARB 0x8736
+#define GL_MODELVIEW23_ARB 0x8737
+#define GL_MODELVIEW24_ARB 0x8738
+#define GL_MODELVIEW25_ARB 0x8739
+#define GL_MODELVIEW26_ARB 0x873A
+#define GL_MODELVIEW27_ARB 0x873B
+#define GL_MODELVIEW28_ARB 0x873C
+#define GL_MODELVIEW29_ARB 0x873D
+#define GL_MODELVIEW30_ARB 0x873E
+#define GL_MODELVIEW31_ARB 0x873F
+#endif
+
+#ifndef GL_ARB_matrix_palette
+#define GL_MATRIX_PALETTE_ARB 0x8840
+#define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841
+#define GL_MAX_PALETTE_MATRICES_ARB 0x8842
+#define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843
+#define GL_MATRIX_INDEX_ARRAY_ARB 0x8844
+#define GL_CURRENT_MATRIX_INDEX_ARB 0x8845
+#define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846
+#define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847
+#define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848
+#define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849
+#endif
+
+#ifndef GL_ARB_texture_env_combine
+#define GL_COMBINE_ARB 0x8570
+#define GL_COMBINE_RGB_ARB 0x8571
+#define GL_COMBINE_ALPHA_ARB 0x8572
+#define GL_SOURCE0_RGB_ARB 0x8580
+#define GL_SOURCE1_RGB_ARB 0x8581
+#define GL_SOURCE2_RGB_ARB 0x8582
+#define GL_SOURCE0_ALPHA_ARB 0x8588
+#define GL_SOURCE1_ALPHA_ARB 0x8589
+#define GL_SOURCE2_ALPHA_ARB 0x858A
+#define GL_OPERAND0_RGB_ARB 0x8590
+#define GL_OPERAND1_RGB_ARB 0x8591
+#define GL_OPERAND2_RGB_ARB 0x8592
+#define GL_OPERAND0_ALPHA_ARB 0x8598
+#define GL_OPERAND1_ALPHA_ARB 0x8599
+#define GL_OPERAND2_ALPHA_ARB 0x859A
+#define GL_RGB_SCALE_ARB 0x8573
+#define GL_ADD_SIGNED_ARB 0x8574
+#define GL_INTERPOLATE_ARB 0x8575
+#define GL_SUBTRACT_ARB 0x84E7
+#define GL_CONSTANT_ARB 0x8576
+#define GL_PRIMARY_COLOR_ARB 0x8577
+#define GL_PREVIOUS_ARB 0x8578
+#endif
+
+#ifndef GL_ARB_texture_env_crossbar
+#endif
+
+#ifndef GL_ARB_texture_env_dot3
+#define GL_DOT3_RGB_ARB 0x86AE
+#define GL_DOT3_RGBA_ARB 0x86AF
+#endif
+
+#ifndef GL_ARB_texture_mirrored_repeat
+#define GL_MIRRORED_REPEAT_ARB 0x8370
+#endif
+
+#ifndef GL_ARB_depth_texture
+#define GL_DEPTH_COMPONENT16_ARB 0x81A5
+#define GL_DEPTH_COMPONENT24_ARB 0x81A6
+#define GL_DEPTH_COMPONENT32_ARB 0x81A7
+#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A
+#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B
+#endif
+
+#ifndef GL_ARB_shadow
+#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C
+#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D
+#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E
+#endif
+
+#ifndef GL_ARB_shadow_ambient
+#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF
+#endif
+
+#ifndef GL_ARB_window_pos
+#endif
+
+#ifndef GL_ARB_vertex_program
+#define GL_COLOR_SUM_ARB 0x8458
+#define GL_VERTEX_PROGRAM_ARB 0x8620
+#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622
+#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623
+#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624
+#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625
+#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626
+#define GL_PROGRAM_LENGTH_ARB 0x8627
+#define GL_PROGRAM_STRING_ARB 0x8628
+#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E
+#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F
+#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640
+#define GL_CURRENT_MATRIX_ARB 0x8641
+#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642
+#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643
+#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645
+#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B
+#define GL_PROGRAM_BINDING_ARB 0x8677
+#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869
+#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A
+#define GL_PROGRAM_ERROR_STRING_ARB 0x8874
+#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875
+#define GL_PROGRAM_FORMAT_ARB 0x8876
+#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0
+#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1
+#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2
+#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3
+#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4
+#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5
+#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6
+#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7
+#define GL_PROGRAM_PARAMETERS_ARB 0x88A8
+#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9
+#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA
+#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB
+#define GL_PROGRAM_ATTRIBS_ARB 0x88AC
+#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD
+#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE
+#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF
+#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0
+#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1
+#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2
+#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3
+#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4
+#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5
+#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6
+#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7
+#define GL_MATRIX0_ARB 0x88C0
+#define GL_MATRIX1_ARB 0x88C1
+#define GL_MATRIX2_ARB 0x88C2
+#define GL_MATRIX3_ARB 0x88C3
+#define GL_MATRIX4_ARB 0x88C4
+#define GL_MATRIX5_ARB 0x88C5
+#define GL_MATRIX6_ARB 0x88C6
+#define GL_MATRIX7_ARB 0x88C7
+#define GL_MATRIX8_ARB 0x88C8
+#define GL_MATRIX9_ARB 0x88C9
+#define GL_MATRIX10_ARB 0x88CA
+#define GL_MATRIX11_ARB 0x88CB
+#define GL_MATRIX12_ARB 0x88CC
+#define GL_MATRIX13_ARB 0x88CD
+#define GL_MATRIX14_ARB 0x88CE
+#define GL_MATRIX15_ARB 0x88CF
+#define GL_MATRIX16_ARB 0x88D0
+#define GL_MATRIX17_ARB 0x88D1
+#define GL_MATRIX18_ARB 0x88D2
+#define GL_MATRIX19_ARB 0x88D3
+#define GL_MATRIX20_ARB 0x88D4
+#define GL_MATRIX21_ARB 0x88D5
+#define GL_MATRIX22_ARB 0x88D6
+#define GL_MATRIX23_ARB 0x88D7
+#define GL_MATRIX24_ARB 0x88D8
+#define GL_MATRIX25_ARB 0x88D9
+#define GL_MATRIX26_ARB 0x88DA
+#define GL_MATRIX27_ARB 0x88DB
+#define GL_MATRIX28_ARB 0x88DC
+#define GL_MATRIX29_ARB 0x88DD
+#define GL_MATRIX30_ARB 0x88DE
+#define GL_MATRIX31_ARB 0x88DF
+#endif
+
+#ifndef GL_ARB_fragment_program
+#define GL_FRAGMENT_PROGRAM_ARB 0x8804
+#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805
+#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806
+#define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807
+#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808
+#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809
+#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A
+#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B
+#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C
+#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D
+#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E
+#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F
+#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810
+#define GL_MAX_TEXTURE_COORDS_ARB 0x8871
+#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872
+#endif
+
+#ifndef GL_ARB_vertex_buffer_object
+#define GL_BUFFER_SIZE_ARB 0x8764
+#define GL_BUFFER_USAGE_ARB 0x8765
+#define GL_ARRAY_BUFFER_ARB 0x8892
+#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893
+#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894
+#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895
+#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896
+#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897
+#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898
+#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899
+#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A
+#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B
+#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C
+#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D
+#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E
+#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F
+#define GL_READ_ONLY_ARB 0x88B8
+#define GL_WRITE_ONLY_ARB 0x88B9
+#define GL_READ_WRITE_ARB 0x88BA
+#define GL_BUFFER_ACCESS_ARB 0x88BB
+#define GL_BUFFER_MAPPED_ARB 0x88BC
+#define GL_BUFFER_MAP_POINTER_ARB 0x88BD
+#define GL_STREAM_DRAW_ARB 0x88E0
+#define GL_STREAM_READ_ARB 0x88E1
+#define GL_STREAM_COPY_ARB 0x88E2
+#define GL_STATIC_DRAW_ARB 0x88E4
+#define GL_STATIC_READ_ARB 0x88E5
+#define GL_STATIC_COPY_ARB 0x88E6
+#define GL_DYNAMIC_DRAW_ARB 0x88E8
+#define GL_DYNAMIC_READ_ARB 0x88E9
+#define GL_DYNAMIC_COPY_ARB 0x88EA
+#endif
+
+#ifndef GL_ARB_occlusion_query
+#define GL_QUERY_COUNTER_BITS_ARB 0x8864
+#define GL_CURRENT_QUERY_ARB 0x8865
+#define GL_QUERY_RESULT_ARB 0x8866
+#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867
+#define GL_SAMPLES_PASSED_ARB 0x8914
+#endif
+
+#ifndef GL_ARB_shader_objects
+#define GL_PROGRAM_OBJECT_ARB 0x8B40
+#define GL_SHADER_OBJECT_ARB 0x8B48
+#define GL_OBJECT_TYPE_ARB 0x8B4E
+#define GL_OBJECT_SUBTYPE_ARB 0x8B4F
+#define GL_FLOAT_VEC2_ARB 0x8B50
+#define GL_FLOAT_VEC3_ARB 0x8B51
+#define GL_FLOAT_VEC4_ARB 0x8B52
+#define GL_INT_VEC2_ARB 0x8B53
+#define GL_INT_VEC3_ARB 0x8B54
+#define GL_INT_VEC4_ARB 0x8B55
+#define GL_BOOL_ARB 0x8B56
+#define GL_BOOL_VEC2_ARB 0x8B57
+#define GL_BOOL_VEC3_ARB 0x8B58
+#define GL_BOOL_VEC4_ARB 0x8B59
+#define GL_FLOAT_MAT2_ARB 0x8B5A
+#define GL_FLOAT_MAT3_ARB 0x8B5B
+#define GL_FLOAT_MAT4_ARB 0x8B5C
+#define GL_SAMPLER_1D_ARB 0x8B5D
+#define GL_SAMPLER_2D_ARB 0x8B5E
+#define GL_SAMPLER_3D_ARB 0x8B5F
+#define GL_SAMPLER_CUBE_ARB 0x8B60
+#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61
+#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62
+#define GL_SAMPLER_2D_RECT_ARB 0x8B63
+#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64
+#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80
+#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81
+#define GL_OBJECT_LINK_STATUS_ARB 0x8B82
+#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83
+#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84
+#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85
+#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86
+#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87
+#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88
+#endif
+
+#ifndef GL_ARB_vertex_shader
+#define GL_VERTEX_SHADER_ARB 0x8B31
+#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A
+#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B
+#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C
+#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D
+#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89
+#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A
+#endif
+
+#ifndef GL_ARB_fragment_shader
+#define GL_FRAGMENT_SHADER_ARB 0x8B30
+#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49
+#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B
+#endif
+
+#ifndef GL_ARB_shading_language_100
+#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C
+#endif
+
+#ifndef GL_ARB_texture_non_power_of_two
+#endif
+
+#ifndef GL_ARB_point_sprite
+#define GL_POINT_SPRITE_ARB 0x8861
+#define GL_COORD_REPLACE_ARB 0x8862
+#endif
+
+#ifndef GL_ARB_fragment_program_shadow
+#endif
+
+#ifndef GL_ARB_draw_buffers
+#define GL_MAX_DRAW_BUFFERS_ARB 0x8824
+#define GL_DRAW_BUFFER0_ARB 0x8825
+#define GL_DRAW_BUFFER1_ARB 0x8826
+#define GL_DRAW_BUFFER2_ARB 0x8827
+#define GL_DRAW_BUFFER3_ARB 0x8828
+#define GL_DRAW_BUFFER4_ARB 0x8829
+#define GL_DRAW_BUFFER5_ARB 0x882A
+#define GL_DRAW_BUFFER6_ARB 0x882B
+#define GL_DRAW_BUFFER7_ARB 0x882C
+#define GL_DRAW_BUFFER8_ARB 0x882D
+#define GL_DRAW_BUFFER9_ARB 0x882E
+#define GL_DRAW_BUFFER10_ARB 0x882F
+#define GL_DRAW_BUFFER11_ARB 0x8830
+#define GL_DRAW_BUFFER12_ARB 0x8831
+#define GL_DRAW_BUFFER13_ARB 0x8832
+#define GL_DRAW_BUFFER14_ARB 0x8833
+#define GL_DRAW_BUFFER15_ARB 0x8834
+#endif
+
+#ifndef GL_ARB_texture_rectangle
+#define GL_TEXTURE_RECTANGLE_ARB 0x84F5
+#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6
+#define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7
+#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8
+#endif
+
+#ifndef GL_ARB_color_buffer_float
+#define GL_RGBA_FLOAT_MODE_ARB 0x8820
+#define GL_CLAMP_VERTEX_COLOR_ARB 0x891A
+#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B
+#define GL_CLAMP_READ_COLOR_ARB 0x891C
+#define GL_FIXED_ONLY_ARB 0x891D
+#endif
+
+#ifndef GL_ARB_half_float_pixel
+#define GL_HALF_FLOAT_ARB 0x140B
+#endif
+
+#ifndef GL_ARB_texture_float
+#define GL_TEXTURE_RED_TYPE_ARB 0x8C10
+#define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11
+#define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12
+#define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13
+#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14
+#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15
+#define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16
+#define GL_UNSIGNED_NORMALIZED_ARB 0x8C17
+#define GL_RGBA32F_ARB 0x8814
+#define GL_RGB32F_ARB 0x8815
+#define GL_ALPHA32F_ARB 0x8816
+#define GL_INTENSITY32F_ARB 0x8817
+#define GL_LUMINANCE32F_ARB 0x8818
+#define GL_LUMINANCE_ALPHA32F_ARB 0x8819
+#define GL_RGBA16F_ARB 0x881A
+#define GL_RGB16F_ARB 0x881B
+#define GL_ALPHA16F_ARB 0x881C
+#define GL_INTENSITY16F_ARB 0x881D
+#define GL_LUMINANCE16F_ARB 0x881E
+#define GL_LUMINANCE_ALPHA16F_ARB 0x881F
+#endif
+
+#ifndef GL_ARB_pixel_buffer_object
+#define GL_PIXEL_PACK_BUFFER_ARB 0x88EB
+#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC
+#define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED
+#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF
+#endif
+
+#ifndef GL_ARB_depth_buffer_float
+#define GL_DEPTH_COMPONENT32F 0x8CAC
+#define GL_DEPTH32F_STENCIL8 0x8CAD
+#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD
+#endif
+
+#ifndef GL_ARB_draw_instanced
+#endif
+
+#ifndef GL_ARB_framebuffer_object
+#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
+#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_MAX_RENDERBUFFER_SIZE 0x84E8
+#define GL_DEPTH_STENCIL 0x84F9
+#define GL_UNSIGNED_INT_24_8 0x84FA
+#define GL_DEPTH24_STENCIL8 0x88F0
+#define GL_TEXTURE_STENCIL_SIZE 0x88F1
+#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_UNSIGNED_NORMALIZED 0x8C17
+#define GL_FRAMEBUFFER_BINDING 0x8CA6
+#define GL_DRAW_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING
+#define GL_RENDERBUFFER_BINDING 0x8CA7
+#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_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_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4
+#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
+#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
+#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
+#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB
+#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC
+#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
+#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF
+#define GL_COLOR_ATTACHMENT0 0x8CE0
+#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_DEPTH_ATTACHMENT 0x8D00
+#define GL_STENCIL_ATTACHMENT 0x8D20
+#define GL_FRAMEBUFFER 0x8D40
+#define GL_RENDERBUFFER 0x8D41
+#define GL_RENDERBUFFER_WIDTH 0x8D42
+#define GL_RENDERBUFFER_HEIGHT 0x8D43
+#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
+#define GL_STENCIL_INDEX1 0x8D46
+#define GL_STENCIL_INDEX4 0x8D47
+#define GL_STENCIL_INDEX8 0x8D48
+#define GL_STENCIL_INDEX16 0x8D49
+#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_INCOMPLETE_MULTISAMPLE 0x8D56
+#define GL_MAX_SAMPLES 0x8D57
+#endif
+
+#ifndef GL_ARB_framebuffer_object_DEPRECATED
+#define GL_INDEX 0x8222
+#define GL_TEXTURE_LUMINANCE_TYPE 0x8C14
+#define GL_TEXTURE_INTENSITY_TYPE 0x8C15
+#endif
+
+#ifndef GL_ARB_framebuffer_sRGB
+#define GL_FRAMEBUFFER_SRGB 0x8DB9
+#endif
+
+#ifndef GL_ARB_geometry_shader4
+#define GL_LINES_ADJACENCY_ARB 0x000A
+#define GL_LINE_STRIP_ADJACENCY_ARB 0x000B
+#define GL_TRIANGLES_ADJACENCY_ARB 0x000C
+#define GL_TRIANGLE_STRIP_ADJACENCY_ARB 0x000D
+#define GL_PROGRAM_POINT_SIZE_ARB 0x8642
+#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB 0x8C29
+#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB 0x8DA7
+#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB 0x8DA8
+#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB 0x8DA9
+#define GL_GEOMETRY_SHADER_ARB 0x8DD9
+#define GL_GEOMETRY_VERTICES_OUT_ARB 0x8DDA
+#define GL_GEOMETRY_INPUT_TYPE_ARB 0x8DDB
+#define GL_GEOMETRY_OUTPUT_TYPE_ARB 0x8DDC
+#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB 0x8DDD
+#define GL_MAX_VERTEX_VARYING_COMPONENTS_ARB 0x8DDE
+#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB 0x8DDF
+#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB 0x8DE0
+#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB 0x8DE1
+/* reuse GL_MAX_VARYING_COMPONENTS */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
+#endif
+
+#ifndef GL_ARB_half_float_vertex
+#define GL_HALF_FLOAT 0x140B
+#endif
+
+#ifndef GL_ARB_instanced_arrays
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0x88FE
+#endif
+
+#ifndef GL_ARB_map_buffer_range
+#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
+#endif
+
+#ifndef GL_ARB_texture_buffer_object
+#define GL_TEXTURE_BUFFER_ARB 0x8C2A
+#define GL_MAX_TEXTURE_BUFFER_SIZE_ARB 0x8C2B
+#define GL_TEXTURE_BINDING_BUFFER_ARB 0x8C2C
+#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB 0x8C2D
+#define GL_TEXTURE_BUFFER_FORMAT_ARB 0x8C2E
+#endif
+
+#ifndef GL_ARB_texture_compression_rgtc
+#define GL_COMPRESSED_RED_RGTC1 0x8DBB
+#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC
+#define GL_COMPRESSED_RG_RGTC2 0x8DBD
+#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE
+#endif
+
+#ifndef GL_ARB_texture_rg
+#define GL_RG 0x8227
+#define GL_RG_INTEGER 0x8228
+#define GL_R8 0x8229
+#define GL_R16 0x822A
+#define GL_RG8 0x822B
+#define GL_RG16 0x822C
+#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
+#endif
+
+#ifndef GL_ARB_vertex_array_object
+#define GL_VERTEX_ARRAY_BINDING 0x85B5
+#endif
+
+#ifndef GL_ARB_uniform_buffer_object
+#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_GEOMETRY_UNIFORM_BLOCKS 0x8A2C
+#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_GEOMETRY_UNIFORM_COMPONENTS 0x8A32
+#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_GEOMETRY_SHADER 0x8A45
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46
+#define GL_INVALID_INDEX 0xFFFFFFFFu
+#endif
+
+#ifndef GL_ARB_compatibility
+/* ARB_compatibility just defines tokens from core 3.0 */
+#endif
+
+#ifndef GL_ARB_copy_buffer
+#define GL_COPY_READ_BUFFER 0x8F36
+#define GL_COPY_WRITE_BUFFER 0x8F37
+#endif
+
+#ifndef GL_ARB_shader_texture_lod
+#endif
+
+#ifndef GL_ARB_depth_clamp
+#define GL_DEPTH_CLAMP 0x864F
+#endif
+
+#ifndef GL_ARB_draw_elements_base_vertex
+#endif
+
+#ifndef GL_ARB_fragment_coord_conventions
+#endif
+
+#ifndef GL_ARB_provoking_vertex
+#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C
+#define GL_FIRST_VERTEX_CONVENTION 0x8E4D
+#define GL_LAST_VERTEX_CONVENTION 0x8E4E
+#define GL_PROVOKING_VERTEX 0x8E4F
+#endif
+
+#ifndef GL_ARB_seamless_cube_map
+#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F
+#endif
+
+#ifndef GL_ARB_sync
+#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
+#endif
+
+#ifndef GL_ARB_texture_multisample
+#define GL_SAMPLE_POSITION 0x8E50
+#define GL_SAMPLE_MASK 0x8E51
+#define GL_SAMPLE_MASK_VALUE 0x8E52
+#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59
+#define GL_TEXTURE_2D_MULTISAMPLE 0x9100
+#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101
+#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102
+#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103
+#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104
+#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105
+#define GL_TEXTURE_SAMPLES 0x9106
+#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107
+#define GL_SAMPLER_2D_MULTISAMPLE 0x9108
+#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109
+#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A
+#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B
+#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C
+#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D
+#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E
+#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F
+#define GL_MAX_INTEGER_SAMPLES 0x9110
+#endif
+
+#ifndef GL_ARB_vertex_array_bgra
+/* reuse GL_BGRA */
+#endif
+
+#ifndef GL_ARB_draw_buffers_blend
+#endif
+
+#ifndef GL_ARB_sample_shading
+#define GL_SAMPLE_SHADING_ARB 0x8C36
+#define GL_MIN_SAMPLE_SHADING_VALUE_ARB 0x8C37
+#endif
+
+#ifndef GL_ARB_texture_cube_map_array
+#define GL_TEXTURE_CUBE_MAP_ARRAY_ARB 0x9009
+#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB 0x900A
+#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB 0x900B
+#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C
+#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D
+#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900E
+#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900F
+#endif
+
+#ifndef GL_ARB_texture_gather
+#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5E
+#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5F
+#endif
+
+#ifndef GL_ARB_texture_query_lod
+#endif
+
+#ifndef GL_ARB_shading_language_include
+#define GL_SHADER_INCLUDE_ARB 0x8DAE
+#define GL_NAMED_STRING_LENGTH_ARB 0x8DE9
+#define GL_NAMED_STRING_TYPE_ARB 0x8DEA
+#endif
+
+#ifndef GL_ARB_texture_compression_bptc
+#define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C
+#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D
+#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E
+#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F
+#endif
+
+#ifndef GL_ARB_blend_func_extended
+#define GL_SRC1_COLOR 0x88F9
+/* reuse GL_SRC1_ALPHA */
+#define GL_ONE_MINUS_SRC1_COLOR 0x88FA
+#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB
+#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC
+#endif
+
+#ifndef GL_ARB_explicit_attrib_location
+#endif
+
+#ifndef GL_ARB_occlusion_query2
+#define GL_ANY_SAMPLES_PASSED 0x8C2F
+#endif
+
+#ifndef GL_ARB_sampler_objects
+#define GL_SAMPLER_BINDING 0x8919
+#endif
+
+#ifndef GL_ARB_shader_bit_encoding
+#endif
+
+#ifndef GL_ARB_texture_rgb10_a2ui
+#define GL_RGB10_A2UI 0x906F
+#endif
+
+#ifndef GL_ARB_texture_swizzle
+#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_TEXTURE_SWIZZLE_RGBA 0x8E46
+#endif
+
+#ifndef GL_ARB_timer_query
+#define GL_TIME_ELAPSED 0x88BF
+#define GL_TIMESTAMP 0x8E28
+#endif
+
+#ifndef GL_ARB_vertex_type_2_10_10_10_rev
+/* reuse GL_UNSIGNED_INT_2_10_10_10_REV */
+#define GL_INT_2_10_10_10_REV 0x8D9F
+#endif
+
+#ifndef GL_ARB_draw_indirect
+#define GL_DRAW_INDIRECT_BUFFER 0x8F3F
+#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43
+#endif
+
+#ifndef GL_ARB_gpu_shader5
+#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F
+#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A
+#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B
+#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C
+#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D
+/* reuse GL_MAX_VERTEX_STREAMS */
+#endif
+
+#ifndef GL_ARB_gpu_shader_fp64
+/* reuse GL_DOUBLE */
+#define GL_DOUBLE_VEC2 0x8FFC
+#define GL_DOUBLE_VEC3 0x8FFD
+#define GL_DOUBLE_VEC4 0x8FFE
+#define GL_DOUBLE_MAT2 0x8F46
+#define GL_DOUBLE_MAT3 0x8F47
+#define GL_DOUBLE_MAT4 0x8F48
+#define GL_DOUBLE_MAT2x3 0x8F49
+#define GL_DOUBLE_MAT2x4 0x8F4A
+#define GL_DOUBLE_MAT3x2 0x8F4B
+#define GL_DOUBLE_MAT3x4 0x8F4C
+#define GL_DOUBLE_MAT4x2 0x8F4D
+#define GL_DOUBLE_MAT4x3 0x8F4E
+#endif
+
+#ifndef GL_ARB_shader_subroutine
+#define GL_ACTIVE_SUBROUTINES 0x8DE5
+#define GL_ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6
+#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47
+#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH 0x8E48
+#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49
+#define GL_MAX_SUBROUTINES 0x8DE7
+#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8
+#define GL_NUM_COMPATIBLE_SUBROUTINES 0x8E4A
+#define GL_COMPATIBLE_SUBROUTINES 0x8E4B
+/* reuse GL_UNIFORM_SIZE */
+/* reuse GL_UNIFORM_NAME_LENGTH */
+#endif
+
+#ifndef GL_ARB_tessellation_shader
+#define GL_PATCHES 0x000E
+#define GL_PATCH_VERTICES 0x8E72
+#define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73
+#define GL_PATCH_DEFAULT_OUTER_LEVEL 0x8E74
+#define GL_TESS_CONTROL_OUTPUT_VERTICES 0x8E75
+#define GL_TESS_GEN_MODE 0x8E76
+#define GL_TESS_GEN_SPACING 0x8E77
+#define GL_TESS_GEN_VERTEX_ORDER 0x8E78
+#define GL_TESS_GEN_POINT_MODE 0x8E79
+/* reuse GL_TRIANGLES */
+/* reuse GL_QUADS */
+#define GL_ISOLINES 0x8E7A
+/* reuse GL_EQUAL */
+#define GL_FRACTIONAL_ODD 0x8E7B
+#define GL_FRACTIONAL_EVEN 0x8E7C
+/* reuse GL_CCW */
+/* reuse GL_CW */
+#define GL_MAX_PATCH_VERTICES 0x8E7D
+#define GL_MAX_TESS_GEN_LEVEL 0x8E7E
+#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F
+#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80
+#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81
+#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82
+#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83
+#define GL_MAX_TESS_PATCH_COMPONENTS 0x8E84
+#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85
+#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86
+#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89
+#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A
+#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C
+#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D
+#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E
+#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1
+#define GL_TESS_EVALUATION_SHADER 0x8E87
+#define GL_TESS_CONTROL_SHADER 0x8E88
+#endif
+
+#ifndef GL_ARB_texture_buffer_object_rgb32
+/* reuse GL_RGB32F */
+/* reuse GL_RGB32UI */
+/* reuse GL_RGB32I */
+#endif
+
+#ifndef GL_ARB_transform_feedback2
+#define GL_TRANSFORM_FEEDBACK 0x8E22
+#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23
+#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24
+#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25
+#endif
+
+#ifndef GL_ARB_transform_feedback3
+#define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70
+#define GL_MAX_VERTEX_STREAMS 0x8E71
+#endif
+
+#ifndef GL_ARB_ES2_compatibility
+#define GL_FIXED 0x140C
+#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
+#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
+#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_SHADER_COMPILER 0x8DFA
+#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
+#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
+#define GL_MAX_VARYING_VECTORS 0x8DFC
+#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
+#endif
+
+#ifndef GL_ARB_get_program_binary
+#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
+#endif
+
+#ifndef GL_ARB_separate_shader_objects
+#define GL_VERTEX_SHADER_BIT 0x00000001
+#define GL_FRAGMENT_SHADER_BIT 0x00000002
+#define GL_GEOMETRY_SHADER_BIT 0x00000004
+#define GL_TESS_CONTROL_SHADER_BIT 0x00000008
+#define GL_TESS_EVALUATION_SHADER_BIT 0x00000010
+#define GL_ALL_SHADER_BITS 0xFFFFFFFF
+#define GL_PROGRAM_SEPARABLE 0x8258
+#define GL_ACTIVE_PROGRAM 0x8259
+#define GL_PROGRAM_PIPELINE_BINDING 0x825A
+#endif
+
+#ifndef GL_ARB_shader_precision
+#endif
+
+#ifndef GL_ARB_vertex_attrib_64bit
+/* reuse GL_RGB32I */
+/* reuse GL_DOUBLE_VEC2 */
+/* reuse GL_DOUBLE_VEC3 */
+/* reuse GL_DOUBLE_VEC4 */
+/* reuse GL_DOUBLE_MAT2 */
+/* reuse GL_DOUBLE_MAT3 */
+/* reuse GL_DOUBLE_MAT4 */
+/* reuse GL_DOUBLE_MAT2x3 */
+/* reuse GL_DOUBLE_MAT2x4 */
+/* reuse GL_DOUBLE_MAT3x2 */
+/* reuse GL_DOUBLE_MAT3x4 */
+/* reuse GL_DOUBLE_MAT4x2 */
+/* reuse GL_DOUBLE_MAT4x3 */
+#endif
+
+#ifndef GL_ARB_viewport_array
+/* reuse GL_SCISSOR_BOX */
+/* reuse GL_VIEWPORT */
+/* reuse GL_DEPTH_RANGE */
+/* reuse GL_SCISSOR_TEST */
+#define GL_MAX_VIEWPORTS 0x825B
+#define GL_VIEWPORT_SUBPIXEL_BITS 0x825C
+#define GL_VIEWPORT_BOUNDS_RANGE 0x825D
+#define GL_LAYER_PROVOKING_VERTEX 0x825E
+#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F
+#define GL_UNDEFINED_VERTEX 0x8260
+/* reuse GL_FIRST_VERTEX_CONVENTION */
+/* reuse GL_LAST_VERTEX_CONVENTION */
+/* reuse GL_PROVOKING_VERTEX */
+#endif
+
+#ifndef GL_ARB_cl_event
+#define GL_SYNC_CL_EVENT_ARB 0x8240
+#define GL_SYNC_CL_EVENT_COMPLETE_ARB 0x8241
+#endif
+
+#ifndef GL_ARB_debug_output
+#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242
+#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243
+#define GL_DEBUG_CALLBACK_FUNCTION_ARB 0x8244
+#define GL_DEBUG_CALLBACK_USER_PARAM_ARB 0x8245
+#define GL_DEBUG_SOURCE_API_ARB 0x8246
+#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247
+#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248
+#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB 0x8249
+#define GL_DEBUG_SOURCE_APPLICATION_ARB 0x824A
+#define GL_DEBUG_SOURCE_OTHER_ARB 0x824B
+#define GL_DEBUG_TYPE_ERROR_ARB 0x824C
+#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D
+#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E
+#define GL_DEBUG_TYPE_PORTABILITY_ARB 0x824F
+#define GL_DEBUG_TYPE_PERFORMANCE_ARB 0x8250
+#define GL_DEBUG_TYPE_OTHER_ARB 0x8251
+#define GL_MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143
+#define GL_MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144
+#define GL_DEBUG_LOGGED_MESSAGES_ARB 0x9145
+#define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146
+#define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147
+#define GL_DEBUG_SEVERITY_LOW_ARB 0x9148
+#endif
+
+#ifndef GL_ARB_robustness
+/* reuse GL_NO_ERROR */
+#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004
+#define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
+#define GL_GUILTY_CONTEXT_RESET_ARB 0x8253
+#define GL_INNOCENT_CONTEXT_RESET_ARB 0x8254
+#define GL_UNKNOWN_CONTEXT_RESET_ARB 0x8255
+#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
+#define GL_NO_RESET_NOTIFICATION_ARB 0x8261
+#endif
+
+#ifndef GL_ARB_shader_stencil_export
+#endif
+
+#ifndef GL_ARB_base_instance
+#endif
+
+#ifndef GL_ARB_shading_language_420pack
+#endif
+
+#ifndef GL_ARB_transform_feedback_instanced
+#endif
+
+#ifndef GL_ARB_compressed_texture_pixel_storage
+#define GL_UNPACK_COMPRESSED_BLOCK_WIDTH 0x9127
+#define GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128
+#define GL_UNPACK_COMPRESSED_BLOCK_DEPTH 0x9129
+#define GL_UNPACK_COMPRESSED_BLOCK_SIZE 0x912A
+#define GL_PACK_COMPRESSED_BLOCK_WIDTH 0x912B
+#define GL_PACK_COMPRESSED_BLOCK_HEIGHT 0x912C
+#define GL_PACK_COMPRESSED_BLOCK_DEPTH 0x912D
+#define GL_PACK_COMPRESSED_BLOCK_SIZE 0x912E
+#endif
+
+#ifndef GL_ARB_conservative_depth
+#endif
+
+#ifndef GL_ARB_internalformat_query
+#define GL_NUM_SAMPLE_COUNTS 0x9380
+#endif
+
+#ifndef GL_ARB_map_buffer_alignment
+#define GL_MIN_MAP_BUFFER_ALIGNMENT 0x90BC
+#endif
+
+#ifndef GL_ARB_shader_atomic_counters
+#define GL_ATOMIC_COUNTER_BUFFER 0x92C0
+#define GL_ATOMIC_COUNTER_BUFFER_BINDING 0x92C1
+#define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2
+#define GL_ATOMIC_COUNTER_BUFFER_SIZE 0x92C3
+#define GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE 0x92C4
+#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS 0x92C5
+#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES 0x92C6
+#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER 0x92C7
+#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER 0x92C8
+#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER 0x92C9
+#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER 0x92CA
+#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER 0x92CB
+#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC
+#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS 0x92CD
+#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS 0x92CE
+#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS 0x92CF
+#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_TESS_CONTROL_ATOMIC_COUNTERS 0x92D3
+#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS 0x92D4
+#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS 0x92D5
+#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_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX 0x92DA
+#define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB
+#endif
+
+#ifndef GL_ARB_shader_image_load_store
+#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_MAX_IMAGE_UNITS 0x8F38
+#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS 0x8F39
+#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_1D 0x904C
+#define GL_IMAGE_2D 0x904D
+#define GL_IMAGE_3D 0x904E
+#define GL_IMAGE_2D_RECT 0x904F
+#define GL_IMAGE_CUBE 0x9050
+#define GL_IMAGE_BUFFER 0x9051
+#define GL_IMAGE_1D_ARRAY 0x9052
+#define GL_IMAGE_2D_ARRAY 0x9053
+#define GL_IMAGE_CUBE_MAP_ARRAY 0x9054
+#define GL_IMAGE_2D_MULTISAMPLE 0x9055
+#define GL_IMAGE_2D_MULTISAMPLE_ARRAY 0x9056
+#define GL_INT_IMAGE_1D 0x9057
+#define GL_INT_IMAGE_2D 0x9058
+#define GL_INT_IMAGE_3D 0x9059
+#define GL_INT_IMAGE_2D_RECT 0x905A
+#define GL_INT_IMAGE_CUBE 0x905B
+#define GL_INT_IMAGE_BUFFER 0x905C
+#define GL_INT_IMAGE_1D_ARRAY 0x905D
+#define GL_INT_IMAGE_2D_ARRAY 0x905E
+#define GL_INT_IMAGE_CUBE_MAP_ARRAY 0x905F
+#define GL_INT_IMAGE_2D_MULTISAMPLE 0x9060
+#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x9061
+#define GL_UNSIGNED_INT_IMAGE_1D 0x9062
+#define GL_UNSIGNED_INT_IMAGE_2D 0x9063
+#define GL_UNSIGNED_INT_IMAGE_3D 0x9064
+#define GL_UNSIGNED_INT_IMAGE_2D_RECT 0x9065
+#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066
+#define GL_UNSIGNED_INT_IMAGE_BUFFER 0x9067
+#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY 0x9068
+#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069
+#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A
+#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE 0x906B
+#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x906C
+#define GL_MAX_IMAGE_SAMPLES 0x906D
+#define GL_IMAGE_BINDING_FORMAT 0x906E
+#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_MAX_VERTEX_IMAGE_UNIFORMS 0x90CA
+#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS 0x90CB
+#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS 0x90CC
+#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS 0x90CD
+#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE
+#define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF
+#endif
+
+#ifndef GL_ARB_shading_language_packing
+#endif
+
+#ifndef GL_ARB_texture_storage
+#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F
+#endif
+
+#ifndef GL_EXT_abgr
+#define GL_ABGR_EXT 0x8000
+#endif
+
+#ifndef GL_EXT_blend_color
+#define GL_CONSTANT_COLOR_EXT 0x8001
+#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002
+#define GL_CONSTANT_ALPHA_EXT 0x8003
+#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004
+#define GL_BLEND_COLOR_EXT 0x8005
+#endif
+
+#ifndef GL_EXT_polygon_offset
+#define GL_POLYGON_OFFSET_EXT 0x8037
+#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038
+#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039
+#endif
+
+#ifndef GL_EXT_texture
+#define GL_ALPHA4_EXT 0x803B
+#define GL_ALPHA8_EXT 0x803C
+#define GL_ALPHA12_EXT 0x803D
+#define GL_ALPHA16_EXT 0x803E
+#define GL_LUMINANCE4_EXT 0x803F
+#define GL_LUMINANCE8_EXT 0x8040
+#define GL_LUMINANCE12_EXT 0x8041
+#define GL_LUMINANCE16_EXT 0x8042
+#define GL_LUMINANCE4_ALPHA4_EXT 0x8043
+#define GL_LUMINANCE6_ALPHA2_EXT 0x8044
+#define GL_LUMINANCE8_ALPHA8_EXT 0x8045
+#define GL_LUMINANCE12_ALPHA4_EXT 0x8046
+#define GL_LUMINANCE12_ALPHA12_EXT 0x8047
+#define GL_LUMINANCE16_ALPHA16_EXT 0x8048
+#define GL_INTENSITY_EXT 0x8049
+#define GL_INTENSITY4_EXT 0x804A
+#define GL_INTENSITY8_EXT 0x804B
+#define GL_INTENSITY12_EXT 0x804C
+#define GL_INTENSITY16_EXT 0x804D
+#define GL_RGB2_EXT 0x804E
+#define GL_RGB4_EXT 0x804F
+#define GL_RGB5_EXT 0x8050
+#define GL_RGB8_EXT 0x8051
+#define GL_RGB10_EXT 0x8052
+#define GL_RGB12_EXT 0x8053
+#define GL_RGB16_EXT 0x8054
+#define GL_RGBA2_EXT 0x8055
+#define GL_RGBA4_EXT 0x8056
+#define GL_RGB5_A1_EXT 0x8057
+#define GL_RGBA8_EXT 0x8058
+#define GL_RGB10_A2_EXT 0x8059
+#define GL_RGBA12_EXT 0x805A
+#define GL_RGBA16_EXT 0x805B
+#define GL_TEXTURE_RED_SIZE_EXT 0x805C
+#define GL_TEXTURE_GREEN_SIZE_EXT 0x805D
+#define GL_TEXTURE_BLUE_SIZE_EXT 0x805E
+#define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F
+#define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060
+#define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061
+#define GL_REPLACE_EXT 0x8062
+#define GL_PROXY_TEXTURE_1D_EXT 0x8063
+#define GL_PROXY_TEXTURE_2D_EXT 0x8064
+#define GL_TEXTURE_TOO_LARGE_EXT 0x8065
+#endif
+
+#ifndef GL_EXT_texture3D
+#define GL_PACK_SKIP_IMAGES_EXT 0x806B
+#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C
+#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D
+#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E
+#define GL_TEXTURE_3D_EXT 0x806F
+#define GL_PROXY_TEXTURE_3D_EXT 0x8070
+#define GL_TEXTURE_DEPTH_EXT 0x8071
+#define GL_TEXTURE_WRAP_R_EXT 0x8072
+#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073
+#endif
+
+#ifndef GL_SGIS_texture_filter4
+#define GL_FILTER4_SGIS 0x8146
+#define GL_TEXTURE_FILTER4_SIZE_SGIS 0x8147
+#endif
+
+#ifndef GL_EXT_subtexture
+#endif
+
+#ifndef GL_EXT_copy_texture
+#endif
+
+#ifndef GL_EXT_histogram
+#define GL_HISTOGRAM_EXT 0x8024
+#define GL_PROXY_HISTOGRAM_EXT 0x8025
+#define GL_HISTOGRAM_WIDTH_EXT 0x8026
+#define GL_HISTOGRAM_FORMAT_EXT 0x8027
+#define GL_HISTOGRAM_RED_SIZE_EXT 0x8028
+#define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029
+#define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A
+#define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B
+#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C
+#define GL_HISTOGRAM_SINK_EXT 0x802D
+#define GL_MINMAX_EXT 0x802E
+#define GL_MINMAX_FORMAT_EXT 0x802F
+#define GL_MINMAX_SINK_EXT 0x8030
+#define GL_TABLE_TOO_LARGE_EXT 0x8031
+#endif
+
+#ifndef GL_EXT_convolution
+#define GL_CONVOLUTION_1D_EXT 0x8010
+#define GL_CONVOLUTION_2D_EXT 0x8011
+#define GL_SEPARABLE_2D_EXT 0x8012
+#define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013
+#define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014
+#define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015
+#define GL_REDUCE_EXT 0x8016
+#define GL_CONVOLUTION_FORMAT_EXT 0x8017
+#define GL_CONVOLUTION_WIDTH_EXT 0x8018
+#define GL_CONVOLUTION_HEIGHT_EXT 0x8019
+#define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A
+#define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B
+#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C
+#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D
+#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E
+#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F
+#define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020
+#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021
+#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022
+#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023
+#endif
+
+#ifndef GL_SGI_color_matrix
+#define GL_COLOR_MATRIX_SGI 0x80B1
+#define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2
+#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3
+#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4
+#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5
+#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6
+#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7
+#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8
+#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9
+#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA
+#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB
+#endif
+
+#ifndef GL_SGI_color_table
+#define GL_COLOR_TABLE_SGI 0x80D0
+#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1
+#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2
+#define GL_PROXY_COLOR_TABLE_SGI 0x80D3
+#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4
+#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5
+#define GL_COLOR_TABLE_SCALE_SGI 0x80D6
+#define GL_COLOR_TABLE_BIAS_SGI 0x80D7
+#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8
+#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9
+#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA
+#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB
+#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC
+#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD
+#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE
+#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF
+#endif
+
+#ifndef GL_SGIS_pixel_texture
+#define GL_PIXEL_TEXTURE_SGIS 0x8353
+#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354
+#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355
+#define GL_PIXEL_GROUP_COLOR_SGIS 0x8356
+#endif
+
+#ifndef GL_SGIX_pixel_texture
+#define GL_PIXEL_TEX_GEN_SGIX 0x8139
+#define GL_PIXEL_TEX_GEN_MODE_SGIX 0x832B
+#endif
+
+#ifndef GL_SGIS_texture4D
+#define GL_PACK_SKIP_VOLUMES_SGIS 0x8130
+#define GL_PACK_IMAGE_DEPTH_SGIS 0x8131
+#define GL_UNPACK_SKIP_VOLUMES_SGIS 0x8132
+#define GL_UNPACK_IMAGE_DEPTH_SGIS 0x8133
+#define GL_TEXTURE_4D_SGIS 0x8134
+#define GL_PROXY_TEXTURE_4D_SGIS 0x8135
+#define GL_TEXTURE_4DSIZE_SGIS 0x8136
+#define GL_TEXTURE_WRAP_Q_SGIS 0x8137
+#define GL_MAX_4D_TEXTURE_SIZE_SGIS 0x8138
+#define GL_TEXTURE_4D_BINDING_SGIS 0x814F
+#endif
+
+#ifndef GL_SGI_texture_color_table
+#define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC
+#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD
+#endif
+
+#ifndef GL_EXT_cmyka
+#define GL_CMYK_EXT 0x800C
+#define GL_CMYKA_EXT 0x800D
+#define GL_PACK_CMYK_HINT_EXT 0x800E
+#define GL_UNPACK_CMYK_HINT_EXT 0x800F
+#endif
+
+#ifndef GL_EXT_texture_object
+#define GL_TEXTURE_PRIORITY_EXT 0x8066
+#define GL_TEXTURE_RESIDENT_EXT 0x8067
+#define GL_TEXTURE_1D_BINDING_EXT 0x8068
+#define GL_TEXTURE_2D_BINDING_EXT 0x8069
+#define GL_TEXTURE_3D_BINDING_EXT 0x806A
+#endif
+
+#ifndef GL_SGIS_detail_texture
+#define GL_DETAIL_TEXTURE_2D_SGIS 0x8095
+#define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096
+#define GL_LINEAR_DETAIL_SGIS 0x8097
+#define GL_LINEAR_DETAIL_ALPHA_SGIS 0x8098
+#define GL_LINEAR_DETAIL_COLOR_SGIS 0x8099
+#define GL_DETAIL_TEXTURE_LEVEL_SGIS 0x809A
+#define GL_DETAIL_TEXTURE_MODE_SGIS 0x809B
+#define GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS 0x809C
+#endif
+
+#ifndef GL_SGIS_sharpen_texture
+#define GL_LINEAR_SHARPEN_SGIS 0x80AD
+#define GL_LINEAR_SHARPEN_ALPHA_SGIS 0x80AE
+#define GL_LINEAR_SHARPEN_COLOR_SGIS 0x80AF
+#define GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS 0x80B0
+#endif
+
+#ifndef GL_EXT_packed_pixels
+#define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032
+#define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033
+#define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034
+#define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035
+#define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036
+#endif
+
+#ifndef GL_SGIS_texture_lod
+#define GL_TEXTURE_MIN_LOD_SGIS 0x813A
+#define GL_TEXTURE_MAX_LOD_SGIS 0x813B
+#define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C
+#define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D
+#endif
+
+#ifndef GL_SGIS_multisample
+#define GL_MULTISAMPLE_SGIS 0x809D
+#define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E
+#define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F
+#define GL_SAMPLE_MASK_SGIS 0x80A0
+#define GL_1PASS_SGIS 0x80A1
+#define GL_2PASS_0_SGIS 0x80A2
+#define GL_2PASS_1_SGIS 0x80A3
+#define GL_4PASS_0_SGIS 0x80A4
+#define GL_4PASS_1_SGIS 0x80A5
+#define GL_4PASS_2_SGIS 0x80A6
+#define GL_4PASS_3_SGIS 0x80A7
+#define GL_SAMPLE_BUFFERS_SGIS 0x80A8
+#define GL_SAMPLES_SGIS 0x80A9
+#define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA
+#define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB
+#define GL_SAMPLE_PATTERN_SGIS 0x80AC
+#endif
+
+#ifndef GL_EXT_rescale_normal
+#define GL_RESCALE_NORMAL_EXT 0x803A
+#endif
+
+#ifndef GL_EXT_vertex_array
+#define GL_VERTEX_ARRAY_EXT 0x8074
+#define GL_NORMAL_ARRAY_EXT 0x8075
+#define GL_COLOR_ARRAY_EXT 0x8076
+#define GL_INDEX_ARRAY_EXT 0x8077
+#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078
+#define GL_EDGE_FLAG_ARRAY_EXT 0x8079
+#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A
+#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B
+#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C
+#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D
+#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E
+#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F
+#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080
+#define GL_COLOR_ARRAY_SIZE_EXT 0x8081
+#define GL_COLOR_ARRAY_TYPE_EXT 0x8082
+#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083
+#define GL_COLOR_ARRAY_COUNT_EXT 0x8084
+#define GL_INDEX_ARRAY_TYPE_EXT 0x8085
+#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086
+#define GL_INDEX_ARRAY_COUNT_EXT 0x8087
+#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088
+#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089
+#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A
+#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B
+#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C
+#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D
+#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E
+#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F
+#define GL_COLOR_ARRAY_POINTER_EXT 0x8090
+#define GL_INDEX_ARRAY_POINTER_EXT 0x8091
+#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092
+#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093
+#endif
+
+#ifndef GL_EXT_misc_attribute
+#endif
+
+#ifndef GL_SGIS_generate_mipmap
+#define GL_GENERATE_MIPMAP_SGIS 0x8191
+#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192
+#endif
+
+#ifndef GL_SGIX_clipmap
+#define GL_LINEAR_CLIPMAP_LINEAR_SGIX 0x8170
+#define GL_TEXTURE_CLIPMAP_CENTER_SGIX 0x8171
+#define GL_TEXTURE_CLIPMAP_FRAME_SGIX 0x8172
+#define GL_TEXTURE_CLIPMAP_OFFSET_SGIX 0x8173
+#define GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8174
+#define GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX 0x8175
+#define GL_TEXTURE_CLIPMAP_DEPTH_SGIX 0x8176
+#define GL_MAX_CLIPMAP_DEPTH_SGIX 0x8177
+#define GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8178
+#define GL_NEAREST_CLIPMAP_NEAREST_SGIX 0x844D
+#define GL_NEAREST_CLIPMAP_LINEAR_SGIX 0x844E
+#define GL_LINEAR_CLIPMAP_NEAREST_SGIX 0x844F
+#endif
+
+#ifndef GL_SGIX_shadow
+#define GL_TEXTURE_COMPARE_SGIX 0x819A
+#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B
+#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C
+#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D
+#endif
+
+#ifndef GL_SGIS_texture_edge_clamp
+#define GL_CLAMP_TO_EDGE_SGIS 0x812F
+#endif
+
+#ifndef GL_SGIS_texture_border_clamp
+#define GL_CLAMP_TO_BORDER_SGIS 0x812D
+#endif
+
+#ifndef GL_EXT_blend_minmax
+#define GL_FUNC_ADD_EXT 0x8006
+#define GL_MIN_EXT 0x8007
+#define GL_MAX_EXT 0x8008
+#define GL_BLEND_EQUATION_EXT 0x8009
+#endif
+
+#ifndef GL_EXT_blend_subtract
+#define GL_FUNC_SUBTRACT_EXT 0x800A
+#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B
+#endif
+
+#ifndef GL_EXT_blend_logic_op
+#endif
+
+#ifndef GL_SGIX_interlace
+#define GL_INTERLACE_SGIX 0x8094
+#endif
+
+#ifndef GL_SGIX_pixel_tiles
+#define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E
+#define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F
+#define GL_PIXEL_TILE_WIDTH_SGIX 0x8140
+#define GL_PIXEL_TILE_HEIGHT_SGIX 0x8141
+#define GL_PIXEL_TILE_GRID_WIDTH_SGIX 0x8142
+#define GL_PIXEL_TILE_GRID_HEIGHT_SGIX 0x8143
+#define GL_PIXEL_TILE_GRID_DEPTH_SGIX 0x8144
+#define GL_PIXEL_TILE_CACHE_SIZE_SGIX 0x8145
+#endif
+
+#ifndef GL_SGIS_texture_select
+#define GL_DUAL_ALPHA4_SGIS 0x8110
+#define GL_DUAL_ALPHA8_SGIS 0x8111
+#define GL_DUAL_ALPHA12_SGIS 0x8112
+#define GL_DUAL_ALPHA16_SGIS 0x8113
+#define GL_DUAL_LUMINANCE4_SGIS 0x8114
+#define GL_DUAL_LUMINANCE8_SGIS 0x8115
+#define GL_DUAL_LUMINANCE12_SGIS 0x8116
+#define GL_DUAL_LUMINANCE16_SGIS 0x8117
+#define GL_DUAL_INTENSITY4_SGIS 0x8118
+#define GL_DUAL_INTENSITY8_SGIS 0x8119
+#define GL_DUAL_INTENSITY12_SGIS 0x811A
+#define GL_DUAL_INTENSITY16_SGIS 0x811B
+#define GL_DUAL_LUMINANCE_ALPHA4_SGIS 0x811C
+#define GL_DUAL_LUMINANCE_ALPHA8_SGIS 0x811D
+#define GL_QUAD_ALPHA4_SGIS 0x811E
+#define GL_QUAD_ALPHA8_SGIS 0x811F
+#define GL_QUAD_LUMINANCE4_SGIS 0x8120
+#define GL_QUAD_LUMINANCE8_SGIS 0x8121
+#define GL_QUAD_INTENSITY4_SGIS 0x8122
+#define GL_QUAD_INTENSITY8_SGIS 0x8123
+#define GL_DUAL_TEXTURE_SELECT_SGIS 0x8124
+#define GL_QUAD_TEXTURE_SELECT_SGIS 0x8125
+#endif
+
+#ifndef GL_SGIX_sprite
+#define GL_SPRITE_SGIX 0x8148
+#define GL_SPRITE_MODE_SGIX 0x8149
+#define GL_SPRITE_AXIS_SGIX 0x814A
+#define GL_SPRITE_TRANSLATION_SGIX 0x814B
+#define GL_SPRITE_AXIAL_SGIX 0x814C
+#define GL_SPRITE_OBJECT_ALIGNED_SGIX 0x814D
+#define GL_SPRITE_EYE_ALIGNED_SGIX 0x814E
+#endif
+
+#ifndef GL_SGIX_texture_multi_buffer
+#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E
+#endif
+
+#ifndef GL_EXT_point_parameters
+#define GL_POINT_SIZE_MIN_EXT 0x8126
+#define GL_POINT_SIZE_MAX_EXT 0x8127
+#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128
+#define GL_DISTANCE_ATTENUATION_EXT 0x8129
+#endif
+
+#ifndef GL_SGIS_point_parameters
+#define GL_POINT_SIZE_MIN_SGIS 0x8126
+#define GL_POINT_SIZE_MAX_SGIS 0x8127
+#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128
+#define GL_DISTANCE_ATTENUATION_SGIS 0x8129
+#endif
+
+#ifndef GL_SGIX_instruments
+#define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180
+#define GL_INSTRUMENT_MEASUREMENTS_SGIX 0x8181
+#endif
+
+#ifndef GL_SGIX_texture_scale_bias
+#define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179
+#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A
+#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B
+#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C
+#endif
+
+#ifndef GL_SGIX_framezoom
+#define GL_FRAMEZOOM_SGIX 0x818B
+#define GL_FRAMEZOOM_FACTOR_SGIX 0x818C
+#define GL_MAX_FRAMEZOOM_FACTOR_SGIX 0x818D
+#endif
+
+#ifndef GL_SGIX_tag_sample_buffer
+#endif
+
+#ifndef GL_FfdMaskSGIX
+#define GL_TEXTURE_DEFORMATION_BIT_SGIX 0x00000001
+#define GL_GEOMETRY_DEFORMATION_BIT_SGIX 0x00000002
+#endif
+
+#ifndef GL_SGIX_polynomial_ffd
+#define GL_GEOMETRY_DEFORMATION_SGIX 0x8194
+#define GL_TEXTURE_DEFORMATION_SGIX 0x8195
+#define GL_DEFORMATIONS_MASK_SGIX 0x8196
+#define GL_MAX_DEFORMATION_ORDER_SGIX 0x8197
+#endif
+
+#ifndef GL_SGIX_reference_plane
+#define GL_REFERENCE_PLANE_SGIX 0x817D
+#define GL_REFERENCE_PLANE_EQUATION_SGIX 0x817E
+#endif
+
+#ifndef GL_SGIX_flush_raster
+#endif
+
+#ifndef GL_SGIX_depth_texture
+#define GL_DEPTH_COMPONENT16_SGIX 0x81A5
+#define GL_DEPTH_COMPONENT24_SGIX 0x81A6
+#define GL_DEPTH_COMPONENT32_SGIX 0x81A7
+#endif
+
+#ifndef GL_SGIS_fog_function
+#define GL_FOG_FUNC_SGIS 0x812A
+#define GL_FOG_FUNC_POINTS_SGIS 0x812B
+#define GL_MAX_FOG_FUNC_POINTS_SGIS 0x812C
+#endif
+
+#ifndef GL_SGIX_fog_offset
+#define GL_FOG_OFFSET_SGIX 0x8198
+#define GL_FOG_OFFSET_VALUE_SGIX 0x8199
+#endif
+
+#ifndef GL_HP_image_transform
+#define GL_IMAGE_SCALE_X_HP 0x8155
+#define GL_IMAGE_SCALE_Y_HP 0x8156
+#define GL_IMAGE_TRANSLATE_X_HP 0x8157
+#define GL_IMAGE_TRANSLATE_Y_HP 0x8158
+#define GL_IMAGE_ROTATE_ANGLE_HP 0x8159
+#define GL_IMAGE_ROTATE_ORIGIN_X_HP 0x815A
+#define GL_IMAGE_ROTATE_ORIGIN_Y_HP 0x815B
+#define GL_IMAGE_MAG_FILTER_HP 0x815C
+#define GL_IMAGE_MIN_FILTER_HP 0x815D
+#define GL_IMAGE_CUBIC_WEIGHT_HP 0x815E
+#define GL_CUBIC_HP 0x815F
+#define GL_AVERAGE_HP 0x8160
+#define GL_IMAGE_TRANSFORM_2D_HP 0x8161
+#define GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8162
+#define GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8163
+#endif
+
+#ifndef GL_HP_convolution_border_modes
+#define GL_IGNORE_BORDER_HP 0x8150
+#define GL_CONSTANT_BORDER_HP 0x8151
+#define GL_REPLICATE_BORDER_HP 0x8153
+#define GL_CONVOLUTION_BORDER_COLOR_HP 0x8154
+#endif
+
+#ifndef GL_INGR_palette_buffer
+#endif
+
+#ifndef GL_SGIX_texture_add_env
+#define GL_TEXTURE_ENV_BIAS_SGIX 0x80BE
+#endif
+
+#ifndef GL_EXT_color_subtable
+#endif
+
+#ifndef GL_PGI_vertex_hints
+#define GL_VERTEX_DATA_HINT_PGI 0x1A22A
+#define GL_VERTEX_CONSISTENT_HINT_PGI 0x1A22B
+#define GL_MATERIAL_SIDE_HINT_PGI 0x1A22C
+#define GL_MAX_VERTEX_HINT_PGI 0x1A22D
+#define GL_COLOR3_BIT_PGI 0x00010000
+#define GL_COLOR4_BIT_PGI 0x00020000
+#define GL_EDGEFLAG_BIT_PGI 0x00040000
+#define GL_INDEX_BIT_PGI 0x00080000
+#define GL_MAT_AMBIENT_BIT_PGI 0x00100000
+#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000
+#define GL_MAT_DIFFUSE_BIT_PGI 0x00400000
+#define GL_MAT_EMISSION_BIT_PGI 0x00800000
+#define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000
+#define GL_MAT_SHININESS_BIT_PGI 0x02000000
+#define GL_MAT_SPECULAR_BIT_PGI 0x04000000
+#define GL_NORMAL_BIT_PGI 0x08000000
+#define GL_TEXCOORD1_BIT_PGI 0x10000000
+#define GL_TEXCOORD2_BIT_PGI 0x20000000
+#define GL_TEXCOORD3_BIT_PGI 0x40000000
+#define GL_TEXCOORD4_BIT_PGI 0x80000000
+#define GL_VERTEX23_BIT_PGI 0x00000004
+#define GL_VERTEX4_BIT_PGI 0x00000008
+#endif
+
+#ifndef GL_PGI_misc_hints
+#define GL_PREFER_DOUBLEBUFFER_HINT_PGI 0x1A1F8
+#define GL_CONSERVE_MEMORY_HINT_PGI 0x1A1FD
+#define GL_RECLAIM_MEMORY_HINT_PGI 0x1A1FE
+#define GL_NATIVE_GRAPHICS_HANDLE_PGI 0x1A202
+#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 0x1A203
+#define GL_NATIVE_GRAPHICS_END_HINT_PGI 0x1A204
+#define GL_ALWAYS_FAST_HINT_PGI 0x1A20C
+#define GL_ALWAYS_SOFT_HINT_PGI 0x1A20D
+#define GL_ALLOW_DRAW_OBJ_HINT_PGI 0x1A20E
+#define GL_ALLOW_DRAW_WIN_HINT_PGI 0x1A20F
+#define GL_ALLOW_DRAW_FRG_HINT_PGI 0x1A210
+#define GL_ALLOW_DRAW_MEM_HINT_PGI 0x1A211
+#define GL_STRICT_DEPTHFUNC_HINT_PGI 0x1A216
+#define GL_STRICT_LIGHTING_HINT_PGI 0x1A217
+#define GL_STRICT_SCISSOR_HINT_PGI 0x1A218
+#define GL_FULL_STIPPLE_HINT_PGI 0x1A219
+#define GL_CLIP_NEAR_HINT_PGI 0x1A220
+#define GL_CLIP_FAR_HINT_PGI 0x1A221
+#define GL_WIDE_LINE_HINT_PGI 0x1A222
+#define GL_BACK_NORMALS_HINT_PGI 0x1A223
+#endif
+
+#ifndef GL_EXT_paletted_texture
+#define GL_COLOR_INDEX1_EXT 0x80E2
+#define GL_COLOR_INDEX2_EXT 0x80E3
+#define GL_COLOR_INDEX4_EXT 0x80E4
+#define GL_COLOR_INDEX8_EXT 0x80E5
+#define GL_COLOR_INDEX12_EXT 0x80E6
+#define GL_COLOR_INDEX16_EXT 0x80E7
+#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED
+#endif
+
+#ifndef GL_EXT_clip_volume_hint
+#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0
+#endif
+
+#ifndef GL_SGIX_list_priority
+#define GL_LIST_PRIORITY_SGIX 0x8182
+#endif
+
+#ifndef GL_SGIX_ir_instrument1
+#define GL_IR_INSTRUMENT1_SGIX 0x817F
+#endif
+
+#ifndef GL_SGIX_calligraphic_fragment
+#define GL_CALLIGRAPHIC_FRAGMENT_SGIX 0x8183
+#endif
+
+#ifndef GL_SGIX_texture_lod_bias
+#define GL_TEXTURE_LOD_BIAS_S_SGIX 0x818E
+#define GL_TEXTURE_LOD_BIAS_T_SGIX 0x818F
+#define GL_TEXTURE_LOD_BIAS_R_SGIX 0x8190
+#endif
+
+#ifndef GL_SGIX_shadow_ambient
+#define GL_SHADOW_AMBIENT_SGIX 0x80BF
+#endif
+
+#ifndef GL_EXT_index_texture
+#endif
+
+#ifndef GL_EXT_index_material
+#define GL_INDEX_MATERIAL_EXT 0x81B8
+#define GL_INDEX_MATERIAL_PARAMETER_EXT 0x81B9
+#define GL_INDEX_MATERIAL_FACE_EXT 0x81BA
+#endif
+
+#ifndef GL_EXT_index_func
+#define GL_INDEX_TEST_EXT 0x81B5
+#define GL_INDEX_TEST_FUNC_EXT 0x81B6
+#define GL_INDEX_TEST_REF_EXT 0x81B7
+#endif
+
+#ifndef GL_EXT_index_array_formats
+#define GL_IUI_V2F_EXT 0x81AD
+#define GL_IUI_V3F_EXT 0x81AE
+#define GL_IUI_N3F_V2F_EXT 0x81AF
+#define GL_IUI_N3F_V3F_EXT 0x81B0
+#define GL_T2F_IUI_V2F_EXT 0x81B1
+#define GL_T2F_IUI_V3F_EXT 0x81B2
+#define GL_T2F_IUI_N3F_V2F_EXT 0x81B3
+#define GL_T2F_IUI_N3F_V3F_EXT 0x81B4
+#endif
+
+#ifndef GL_EXT_compiled_vertex_array
+#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8
+#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9
+#endif
+
+#ifndef GL_EXT_cull_vertex
+#define GL_CULL_VERTEX_EXT 0x81AA
+#define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB
+#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC
+#endif
+
+#ifndef GL_SGIX_ycrcb
+#define GL_YCRCB_422_SGIX 0x81BB
+#define GL_YCRCB_444_SGIX 0x81BC
+#endif
+
+#ifndef GL_SGIX_fragment_lighting
+#define GL_FRAGMENT_LIGHTING_SGIX 0x8400
+#define GL_FRAGMENT_COLOR_MATERIAL_SGIX 0x8401
+#define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402
+#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX 0x8403
+#define GL_MAX_FRAGMENT_LIGHTS_SGIX 0x8404
+#define GL_MAX_ACTIVE_LIGHTS_SGIX 0x8405
+#define GL_CURRENT_RASTER_NORMAL_SGIX 0x8406
+#define GL_LIGHT_ENV_MODE_SGIX 0x8407
+#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX 0x8408
+#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX 0x8409
+#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX 0x840A
+#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX 0x840B
+#define GL_FRAGMENT_LIGHT0_SGIX 0x840C
+#define GL_FRAGMENT_LIGHT1_SGIX 0x840D
+#define GL_FRAGMENT_LIGHT2_SGIX 0x840E
+#define GL_FRAGMENT_LIGHT3_SGIX 0x840F
+#define GL_FRAGMENT_LIGHT4_SGIX 0x8410
+#define GL_FRAGMENT_LIGHT5_SGIX 0x8411
+#define GL_FRAGMENT_LIGHT6_SGIX 0x8412
+#define GL_FRAGMENT_LIGHT7_SGIX 0x8413
+#endif
+
+#ifndef GL_IBM_rasterpos_clip
+#define GL_RASTER_POSITION_UNCLIPPED_IBM 0x19262
+#endif
+
+#ifndef GL_HP_texture_lighting
+#define GL_TEXTURE_LIGHTING_MODE_HP 0x8167
+#define GL_TEXTURE_POST_SPECULAR_HP 0x8168
+#define GL_TEXTURE_PRE_SPECULAR_HP 0x8169
+#endif
+
+#ifndef GL_EXT_draw_range_elements
+#define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8
+#define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9
+#endif
+
+#ifndef GL_WIN_phong_shading
+#define GL_PHONG_WIN 0x80EA
+#define GL_PHONG_HINT_WIN 0x80EB
+#endif
+
+#ifndef GL_WIN_specular_fog
+#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC
+#endif
+
+#ifndef GL_EXT_light_texture
+#define GL_FRAGMENT_MATERIAL_EXT 0x8349
+#define GL_FRAGMENT_NORMAL_EXT 0x834A
+#define GL_FRAGMENT_COLOR_EXT 0x834C
+#define GL_ATTENUATION_EXT 0x834D
+#define GL_SHADOW_ATTENUATION_EXT 0x834E
+#define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F
+#define GL_TEXTURE_LIGHT_EXT 0x8350
+#define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351
+#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352
+/* reuse GL_FRAGMENT_DEPTH_EXT */
+#endif
+
+#ifndef GL_SGIX_blend_alpha_minmax
+#define GL_ALPHA_MIN_SGIX 0x8320
+#define GL_ALPHA_MAX_SGIX 0x8321
+#endif
+
+#ifndef GL_SGIX_impact_pixel_texture
+#define GL_PIXEL_TEX_GEN_Q_CEILING_SGIX 0x8184
+#define GL_PIXEL_TEX_GEN_Q_ROUND_SGIX 0x8185
+#define GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX 0x8186
+#define GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX 0x8187
+#define GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX 0x8188
+#define GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX 0x8189
+#define GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX 0x818A
+#endif
+
+#ifndef GL_EXT_bgra
+#define GL_BGR_EXT 0x80E0
+#define GL_BGRA_EXT 0x80E1
+#endif
+
+#ifndef GL_SGIX_async
+#define GL_ASYNC_MARKER_SGIX 0x8329
+#endif
+
+#ifndef GL_SGIX_async_pixel
+#define GL_ASYNC_TEX_IMAGE_SGIX 0x835C
+#define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D
+#define GL_ASYNC_READ_PIXELS_SGIX 0x835E
+#define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F
+#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360
+#define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361
+#endif
+
+#ifndef GL_SGIX_async_histogram
+#define GL_ASYNC_HISTOGRAM_SGIX 0x832C
+#define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D
+#endif
+
+#ifndef GL_INTEL_texture_scissor
+#endif
+
+#ifndef GL_INTEL_parallel_arrays
+#define GL_PARALLEL_ARRAYS_INTEL 0x83F4
+#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5
+#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6
+#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7
+#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8
+#endif
+
+#ifndef GL_HP_occlusion_test
+#define GL_OCCLUSION_TEST_HP 0x8165
+#define GL_OCCLUSION_TEST_RESULT_HP 0x8166
+#endif
+
+#ifndef GL_EXT_pixel_transform
+#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330
+#define GL_PIXEL_MAG_FILTER_EXT 0x8331
+#define GL_PIXEL_MIN_FILTER_EXT 0x8332
+#define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333
+#define GL_CUBIC_EXT 0x8334
+#define GL_AVERAGE_EXT 0x8335
+#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336
+#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337
+#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338
+#endif
+
+#ifndef GL_EXT_pixel_transform_color_table
+#endif
+
+#ifndef GL_EXT_shared_texture_palette
+#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB
+#endif
+
+#ifndef GL_EXT_separate_specular_color
+#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8
+#define GL_SINGLE_COLOR_EXT 0x81F9
+#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA
+#endif
+
+#ifndef GL_EXT_secondary_color
+#define GL_COLOR_SUM_EXT 0x8458
+#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459
+#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A
+#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B
+#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C
+#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D
+#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E
+#endif
+
+#ifndef GL_EXT_texture_perturb_normal
+#define GL_PERTURB_EXT 0x85AE
+#define GL_TEXTURE_NORMAL_EXT 0x85AF
+#endif
+
+#ifndef GL_EXT_multi_draw_arrays
+#endif
+
+#ifndef GL_EXT_fog_coord
+#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450
+#define GL_FOG_COORDINATE_EXT 0x8451
+#define GL_FRAGMENT_DEPTH_EXT 0x8452
+#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453
+#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454
+#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455
+#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456
+#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457
+#endif
+
+#ifndef GL_REND_screen_coordinates
+#define GL_SCREEN_COORDINATES_REND 0x8490
+#define GL_INVERTED_SCREEN_W_REND 0x8491
+#endif
+
+#ifndef GL_EXT_coordinate_frame
+#define GL_TANGENT_ARRAY_EXT 0x8439
+#define GL_BINORMAL_ARRAY_EXT 0x843A
+#define GL_CURRENT_TANGENT_EXT 0x843B
+#define GL_CURRENT_BINORMAL_EXT 0x843C
+#define GL_TANGENT_ARRAY_TYPE_EXT 0x843E
+#define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F
+#define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440
+#define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441
+#define GL_TANGENT_ARRAY_POINTER_EXT 0x8442
+#define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443
+#define GL_MAP1_TANGENT_EXT 0x8444
+#define GL_MAP2_TANGENT_EXT 0x8445
+#define GL_MAP1_BINORMAL_EXT 0x8446
+#define GL_MAP2_BINORMAL_EXT 0x8447
+#endif
+
+#ifndef GL_EXT_texture_env_combine
+#define GL_COMBINE_EXT 0x8570
+#define GL_COMBINE_RGB_EXT 0x8571
+#define GL_COMBINE_ALPHA_EXT 0x8572
+#define GL_RGB_SCALE_EXT 0x8573
+#define GL_ADD_SIGNED_EXT 0x8574
+#define GL_INTERPOLATE_EXT 0x8575
+#define GL_CONSTANT_EXT 0x8576
+#define GL_PRIMARY_COLOR_EXT 0x8577
+#define GL_PREVIOUS_EXT 0x8578
+#define GL_SOURCE0_RGB_EXT 0x8580
+#define GL_SOURCE1_RGB_EXT 0x8581
+#define GL_SOURCE2_RGB_EXT 0x8582
+#define GL_SOURCE0_ALPHA_EXT 0x8588
+#define GL_SOURCE1_ALPHA_EXT 0x8589
+#define GL_SOURCE2_ALPHA_EXT 0x858A
+#define GL_OPERAND0_RGB_EXT 0x8590
+#define GL_OPERAND1_RGB_EXT 0x8591
+#define GL_OPERAND2_RGB_EXT 0x8592
+#define GL_OPERAND0_ALPHA_EXT 0x8598
+#define GL_OPERAND1_ALPHA_EXT 0x8599
+#define GL_OPERAND2_ALPHA_EXT 0x859A
+#endif
+
+#ifndef GL_APPLE_specular_vector
+#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0
+#endif
+
+#ifndef GL_APPLE_transform_hint
+#define GL_TRANSFORM_HINT_APPLE 0x85B1
+#endif
+
+#ifndef GL_SGIX_fog_scale
+#define GL_FOG_SCALE_SGIX 0x81FC
+#define GL_FOG_SCALE_VALUE_SGIX 0x81FD
+#endif
+
+#ifndef GL_SUNX_constant_data
+#define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5
+#define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6
+#endif
+
+#ifndef GL_SUN_global_alpha
+#define GL_GLOBAL_ALPHA_SUN 0x81D9
+#define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA
+#endif
+
+#ifndef GL_SUN_triangle_list
+#define GL_RESTART_SUN 0x0001
+#define GL_REPLACE_MIDDLE_SUN 0x0002
+#define GL_REPLACE_OLDEST_SUN 0x0003
+#define GL_TRIANGLE_LIST_SUN 0x81D7
+#define GL_REPLACEMENT_CODE_SUN 0x81D8
+#define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0
+#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1
+#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2
+#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3
+#define GL_R1UI_V3F_SUN 0x85C4
+#define GL_R1UI_C4UB_V3F_SUN 0x85C5
+#define GL_R1UI_C3F_V3F_SUN 0x85C6
+#define GL_R1UI_N3F_V3F_SUN 0x85C7
+#define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8
+#define GL_R1UI_T2F_V3F_SUN 0x85C9
+#define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA
+#define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB
+#endif
+
+#ifndef GL_SUN_vertex
+#endif
+
+#ifndef GL_EXT_blend_func_separate
+#define GL_BLEND_DST_RGB_EXT 0x80C8
+#define GL_BLEND_SRC_RGB_EXT 0x80C9
+#define GL_BLEND_DST_ALPHA_EXT 0x80CA
+#define GL_BLEND_SRC_ALPHA_EXT 0x80CB
+#endif
+
+#ifndef GL_INGR_color_clamp
+#define GL_RED_MIN_CLAMP_INGR 0x8560
+#define GL_GREEN_MIN_CLAMP_INGR 0x8561
+#define GL_BLUE_MIN_CLAMP_INGR 0x8562
+#define GL_ALPHA_MIN_CLAMP_INGR 0x8563
+#define GL_RED_MAX_CLAMP_INGR 0x8564
+#define GL_GREEN_MAX_CLAMP_INGR 0x8565
+#define GL_BLUE_MAX_CLAMP_INGR 0x8566
+#define GL_ALPHA_MAX_CLAMP_INGR 0x8567
+#endif
+
+#ifndef GL_INGR_interlace_read
+#define GL_INTERLACE_READ_INGR 0x8568
+#endif
+
+#ifndef GL_EXT_stencil_wrap
+#define GL_INCR_WRAP_EXT 0x8507
+#define GL_DECR_WRAP_EXT 0x8508
+#endif
+
+#ifndef GL_EXT_422_pixels
+#define GL_422_EXT 0x80CC
+#define GL_422_REV_EXT 0x80CD
+#define GL_422_AVERAGE_EXT 0x80CE
+#define GL_422_REV_AVERAGE_EXT 0x80CF
+#endif
+
+#ifndef GL_NV_texgen_reflection
+#define GL_NORMAL_MAP_NV 0x8511
+#define GL_REFLECTION_MAP_NV 0x8512
+#endif
+
+#ifndef GL_EXT_texture_cube_map
+#define GL_NORMAL_MAP_EXT 0x8511
+#define GL_REFLECTION_MAP_EXT 0x8512
+#define GL_TEXTURE_CUBE_MAP_EXT 0x8513
+#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A
+#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C
+#endif
+
+#ifndef GL_SUN_convolution_border_modes
+#define GL_WRAP_BORDER_SUN 0x81D4
+#endif
+
+#ifndef GL_EXT_texture_env_add
+#endif
+
+#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
+
+#ifndef GL_EXT_texture_filter_anisotropic
+#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
+#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
+#endif
+
+#ifndef GL_EXT_vertex_weighting
+#define GL_MODELVIEW0_STACK_DEPTH_EXT GL_MODELVIEW_STACK_DEPTH
+#define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502
+#define GL_MODELVIEW0_MATRIX_EXT GL_MODELVIEW_MATRIX
+#define GL_MODELVIEW1_MATRIX_EXT 0x8506
+#define GL_VERTEX_WEIGHTING_EXT 0x8509
+#define GL_MODELVIEW0_EXT GL_MODELVIEW
+#define GL_MODELVIEW1_EXT 0x850A
+#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B
+#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C
+#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D
+#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E
+#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F
+#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510
+#endif
+
+#ifndef GL_NV_light_max_exponent
+#define GL_MAX_SHININESS_NV 0x8504
+#define GL_MAX_SPOT_EXPONENT_NV 0x8505
+#endif
+
+#ifndef GL_NV_vertex_array_range
+#define GL_VERTEX_ARRAY_RANGE_NV 0x851D
+#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E
+#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F
+#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520
+#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521
+#endif
+
+#ifndef GL_NV_register_combiners
+#define GL_REGISTER_COMBINERS_NV 0x8522
+#define GL_VARIABLE_A_NV 0x8523
+#define GL_VARIABLE_B_NV 0x8524
+#define GL_VARIABLE_C_NV 0x8525
+#define GL_VARIABLE_D_NV 0x8526
+#define GL_VARIABLE_E_NV 0x8527
+#define GL_VARIABLE_F_NV 0x8528
+#define GL_VARIABLE_G_NV 0x8529
+#define GL_CONSTANT_COLOR0_NV 0x852A
+#define GL_CONSTANT_COLOR1_NV 0x852B
+#define GL_PRIMARY_COLOR_NV 0x852C
+#define GL_SECONDARY_COLOR_NV 0x852D
+#define GL_SPARE0_NV 0x852E
+#define GL_SPARE1_NV 0x852F
+#define GL_DISCARD_NV 0x8530
+#define GL_E_TIMES_F_NV 0x8531
+#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532
+#define GL_UNSIGNED_IDENTITY_NV 0x8536
+#define GL_UNSIGNED_INVERT_NV 0x8537
+#define GL_EXPAND_NORMAL_NV 0x8538
+#define GL_EXPAND_NEGATE_NV 0x8539
+#define GL_HALF_BIAS_NORMAL_NV 0x853A
+#define GL_HALF_BIAS_NEGATE_NV 0x853B
+#define GL_SIGNED_IDENTITY_NV 0x853C
+#define GL_SIGNED_NEGATE_NV 0x853D
+#define GL_SCALE_BY_TWO_NV 0x853E
+#define GL_SCALE_BY_FOUR_NV 0x853F
+#define GL_SCALE_BY_ONE_HALF_NV 0x8540
+#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541
+#define GL_COMBINER_INPUT_NV 0x8542
+#define GL_COMBINER_MAPPING_NV 0x8543
+#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544
+#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545
+#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546
+#define GL_COMBINER_MUX_SUM_NV 0x8547
+#define GL_COMBINER_SCALE_NV 0x8548
+#define GL_COMBINER_BIAS_NV 0x8549
+#define GL_COMBINER_AB_OUTPUT_NV 0x854A
+#define GL_COMBINER_CD_OUTPUT_NV 0x854B
+#define GL_COMBINER_SUM_OUTPUT_NV 0x854C
+#define GL_MAX_GENERAL_COMBINERS_NV 0x854D
+#define GL_NUM_GENERAL_COMBINERS_NV 0x854E
+#define GL_COLOR_SUM_CLAMP_NV 0x854F
+#define GL_COMBINER0_NV 0x8550
+#define GL_COMBINER1_NV 0x8551
+#define GL_COMBINER2_NV 0x8552
+#define GL_COMBINER3_NV 0x8553
+#define GL_COMBINER4_NV 0x8554
+#define GL_COMBINER5_NV 0x8555
+#define GL_COMBINER6_NV 0x8556
+#define GL_COMBINER7_NV 0x8557
+/* reuse GL_TEXTURE0_ARB */
+/* reuse GL_TEXTURE1_ARB */
+/* reuse GL_ZERO */
+/* reuse GL_NONE */
+/* reuse GL_FOG */
+#endif
+
+#ifndef GL_NV_fog_distance
+#define GL_FOG_DISTANCE_MODE_NV 0x855A
+#define GL_EYE_RADIAL_NV 0x855B
+#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C
+/* reuse GL_EYE_PLANE */
+#endif
+
+#ifndef GL_NV_texgen_emboss
+#define GL_EMBOSS_LIGHT_NV 0x855D
+#define GL_EMBOSS_CONSTANT_NV 0x855E
+#define GL_EMBOSS_MAP_NV 0x855F
+#endif
+
+#ifndef GL_NV_blend_square
+#endif
+
+#ifndef GL_NV_texture_env_combine4
+#define GL_COMBINE4_NV 0x8503
+#define GL_SOURCE3_RGB_NV 0x8583
+#define GL_SOURCE3_ALPHA_NV 0x858B
+#define GL_OPERAND3_RGB_NV 0x8593
+#define GL_OPERAND3_ALPHA_NV 0x859B
+#endif
+
+#ifndef GL_MESA_resize_buffers
+#endif
+
+#ifndef GL_MESA_window_pos
+#endif
+
+#ifndef GL_EXT_texture_compression_s3tc
+#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
+#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
+#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
+#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
+#endif
+
+#ifndef GL_IBM_cull_vertex
+#define GL_CULL_VERTEX_IBM 103050
+#endif
+
+#ifndef GL_IBM_multimode_draw_arrays
+#endif
+
+#ifndef GL_IBM_vertex_array_lists
+#define GL_VERTEX_ARRAY_LIST_IBM 103070
+#define GL_NORMAL_ARRAY_LIST_IBM 103071
+#define GL_COLOR_ARRAY_LIST_IBM 103072
+#define GL_INDEX_ARRAY_LIST_IBM 103073
+#define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074
+#define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075
+#define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076
+#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077
+#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080
+#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081
+#define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082
+#define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083
+#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084
+#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085
+#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086
+#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087
+#endif
+
+#ifndef GL_SGIX_subsample
+#define GL_PACK_SUBSAMPLE_RATE_SGIX 0x85A0
+#define GL_UNPACK_SUBSAMPLE_RATE_SGIX 0x85A1
+#define GL_PIXEL_SUBSAMPLE_4444_SGIX 0x85A2
+#define GL_PIXEL_SUBSAMPLE_2424_SGIX 0x85A3
+#define GL_PIXEL_SUBSAMPLE_4242_SGIX 0x85A4
+#endif
+
+#ifndef GL_SGIX_ycrcb_subsample
+#endif
+
+#ifndef GL_SGIX_ycrcba
+#define GL_YCRCB_SGIX 0x8318
+#define GL_YCRCBA_SGIX 0x8319
+#endif
+
+#ifndef GL_SGI_depth_pass_instrument
+#define GL_DEPTH_PASS_INSTRUMENT_SGIX 0x8310
+#define GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX 0x8311
+#define GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX 0x8312
+#endif
+
+#ifndef GL_3DFX_texture_compression_FXT1
+#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0
+#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1
+#endif
+
+#ifndef GL_3DFX_multisample
+#define GL_MULTISAMPLE_3DFX 0x86B2
+#define GL_SAMPLE_BUFFERS_3DFX 0x86B3
+#define GL_SAMPLES_3DFX 0x86B4
+#define GL_MULTISAMPLE_BIT_3DFX 0x20000000
+#endif
+
+#ifndef GL_3DFX_tbuffer
+#endif
+
+#ifndef GL_EXT_multisample
+#define GL_MULTISAMPLE_EXT 0x809D
+#define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E
+#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F
+#define GL_SAMPLE_MASK_EXT 0x80A0
+#define GL_1PASS_EXT 0x80A1
+#define GL_2PASS_0_EXT 0x80A2
+#define GL_2PASS_1_EXT 0x80A3
+#define GL_4PASS_0_EXT 0x80A4
+#define GL_4PASS_1_EXT 0x80A5
+#define GL_4PASS_2_EXT 0x80A6
+#define GL_4PASS_3_EXT 0x80A7
+#define GL_SAMPLE_BUFFERS_EXT 0x80A8
+#define GL_SAMPLES_EXT 0x80A9
+#define GL_SAMPLE_MASK_VALUE_EXT 0x80AA
+#define GL_SAMPLE_MASK_INVERT_EXT 0x80AB
+#define GL_SAMPLE_PATTERN_EXT 0x80AC
+#define GL_MULTISAMPLE_BIT_EXT 0x20000000
+#endif
+
+#ifndef GL_SGIX_vertex_preclip
+#define GL_VERTEX_PRECLIP_SGIX 0x83EE
+#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF
+#endif
+
+#ifndef GL_SGIX_convolution_accuracy
+#define GL_CONVOLUTION_HINT_SGIX 0x8316
+#endif
+
+#ifndef GL_SGIX_resample
+#define GL_PACK_RESAMPLE_SGIX 0x842C
+#define GL_UNPACK_RESAMPLE_SGIX 0x842D
+#define GL_RESAMPLE_REPLICATE_SGIX 0x842E
+#define GL_RESAMPLE_ZERO_FILL_SGIX 0x842F
+#define GL_RESAMPLE_DECIMATE_SGIX 0x8430
+#endif
+
+#ifndef GL_SGIS_point_line_texgen
+#define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0
+#define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1
+#define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2
+#define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3
+#define GL_EYE_POINT_SGIS 0x81F4
+#define GL_OBJECT_POINT_SGIS 0x81F5
+#define GL_EYE_LINE_SGIS 0x81F6
+#define GL_OBJECT_LINE_SGIS 0x81F7
+#endif
+
+#ifndef GL_SGIS_texture_color_mask
+#define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF
+#endif
+
+#ifndef GL_EXT_texture_env_dot3
+#define GL_DOT3_RGB_EXT 0x8740
+#define GL_DOT3_RGBA_EXT 0x8741
+#endif
+
+#ifndef GL_ATI_texture_mirror_once
+#define GL_MIRROR_CLAMP_ATI 0x8742
+#define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743
+#endif
+
+#ifndef GL_NV_fence
+#define GL_ALL_COMPLETED_NV 0x84F2
+#define GL_FENCE_STATUS_NV 0x84F3
+#define GL_FENCE_CONDITION_NV 0x84F4
+#endif
+
+#ifndef GL_IBM_texture_mirrored_repeat
+#define GL_MIRRORED_REPEAT_IBM 0x8370
+#endif
+
+#ifndef GL_NV_evaluators
+#define GL_EVAL_2D_NV 0x86C0
+#define GL_EVAL_TRIANGULAR_2D_NV 0x86C1
+#define GL_MAP_TESSELLATION_NV 0x86C2
+#define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3
+#define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4
+#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5
+#define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6
+#define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7
+#define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8
+#define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9
+#define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA
+#define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB
+#define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC
+#define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD
+#define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE
+#define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF
+#define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0
+#define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1
+#define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2
+#define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3
+#define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4
+#define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5
+#define GL_MAX_MAP_TESSELLATION_NV 0x86D6
+#define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7
+#endif
+
+#ifndef GL_NV_packed_depth_stencil
+#define GL_DEPTH_STENCIL_NV 0x84F9
+#define GL_UNSIGNED_INT_24_8_NV 0x84FA
+#endif
+
+#ifndef GL_NV_register_combiners2
+#define GL_PER_STAGE_CONSTANTS_NV 0x8535
+#endif
+
+#ifndef GL_NV_texture_compression_vtc
+#endif
+
+#ifndef GL_NV_texture_rectangle
+#define GL_TEXTURE_RECTANGLE_NV 0x84F5
+#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6
+#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7
+#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8
+#endif
+
+#ifndef GL_NV_texture_shader
+#define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C
+#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D
+#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E
+#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9
+#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA
+#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB
+#define GL_DSDT_MAG_INTENSITY_NV 0x86DC
+#define GL_SHADER_CONSISTENT_NV 0x86DD
+#define GL_TEXTURE_SHADER_NV 0x86DE
+#define GL_SHADER_OPERATION_NV 0x86DF
+#define GL_CULL_MODES_NV 0x86E0
+#define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1
+#define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2
+#define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3
+#define GL_OFFSET_TEXTURE_2D_MATRIX_NV GL_OFFSET_TEXTURE_MATRIX_NV
+#define GL_OFFSET_TEXTURE_2D_SCALE_NV GL_OFFSET_TEXTURE_SCALE_NV
+#define GL_OFFSET_TEXTURE_2D_BIAS_NV GL_OFFSET_TEXTURE_BIAS_NV
+#define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4
+#define GL_CONST_EYE_NV 0x86E5
+#define GL_PASS_THROUGH_NV 0x86E6
+#define GL_CULL_FRAGMENT_NV 0x86E7
+#define GL_OFFSET_TEXTURE_2D_NV 0x86E8
+#define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9
+#define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA
+#define GL_DOT_PRODUCT_NV 0x86EC
+#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED
+#define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE
+#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0
+#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1
+#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2
+#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3
+#define GL_HILO_NV 0x86F4
+#define GL_DSDT_NV 0x86F5
+#define GL_DSDT_MAG_NV 0x86F6
+#define GL_DSDT_MAG_VIB_NV 0x86F7
+#define GL_HILO16_NV 0x86F8
+#define GL_SIGNED_HILO_NV 0x86F9
+#define GL_SIGNED_HILO16_NV 0x86FA
+#define GL_SIGNED_RGBA_NV 0x86FB
+#define GL_SIGNED_RGBA8_NV 0x86FC
+#define GL_SIGNED_RGB_NV 0x86FE
+#define GL_SIGNED_RGB8_NV 0x86FF
+#define GL_SIGNED_LUMINANCE_NV 0x8701
+#define GL_SIGNED_LUMINANCE8_NV 0x8702
+#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703
+#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704
+#define GL_SIGNED_ALPHA_NV 0x8705
+#define GL_SIGNED_ALPHA8_NV 0x8706
+#define GL_SIGNED_INTENSITY_NV 0x8707
+#define GL_SIGNED_INTENSITY8_NV 0x8708
+#define GL_DSDT8_NV 0x8709
+#define GL_DSDT8_MAG8_NV 0x870A
+#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B
+#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C
+#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D
+#define GL_HI_SCALE_NV 0x870E
+#define GL_LO_SCALE_NV 0x870F
+#define GL_DS_SCALE_NV 0x8710
+#define GL_DT_SCALE_NV 0x8711
+#define GL_MAGNITUDE_SCALE_NV 0x8712
+#define GL_VIBRANCE_SCALE_NV 0x8713
+#define GL_HI_BIAS_NV 0x8714
+#define GL_LO_BIAS_NV 0x8715
+#define GL_DS_BIAS_NV 0x8716
+#define GL_DT_BIAS_NV 0x8717
+#define GL_MAGNITUDE_BIAS_NV 0x8718
+#define GL_VIBRANCE_BIAS_NV 0x8719
+#define GL_TEXTURE_BORDER_VALUES_NV 0x871A
+#define GL_TEXTURE_HI_SIZE_NV 0x871B
+#define GL_TEXTURE_LO_SIZE_NV 0x871C
+#define GL_TEXTURE_DS_SIZE_NV 0x871D
+#define GL_TEXTURE_DT_SIZE_NV 0x871E
+#define GL_TEXTURE_MAG_SIZE_NV 0x871F
+#endif
+
+#ifndef GL_NV_texture_shader2
+#define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF
+#endif
+
+#ifndef GL_NV_vertex_array_range2
+#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533
+#endif
+
+#ifndef GL_NV_vertex_program
+#define GL_VERTEX_PROGRAM_NV 0x8620
+#define GL_VERTEX_STATE_PROGRAM_NV 0x8621
+#define GL_ATTRIB_ARRAY_SIZE_NV 0x8623
+#define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624
+#define GL_ATTRIB_ARRAY_TYPE_NV 0x8625
+#define GL_CURRENT_ATTRIB_NV 0x8626
+#define GL_PROGRAM_LENGTH_NV 0x8627
+#define GL_PROGRAM_STRING_NV 0x8628
+#define GL_MODELVIEW_PROJECTION_NV 0x8629
+#define GL_IDENTITY_NV 0x862A
+#define GL_INVERSE_NV 0x862B
+#define GL_TRANSPOSE_NV 0x862C
+#define GL_INVERSE_TRANSPOSE_NV 0x862D
+#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E
+#define GL_MAX_TRACK_MATRICES_NV 0x862F
+#define GL_MATRIX0_NV 0x8630
+#define GL_MATRIX1_NV 0x8631
+#define GL_MATRIX2_NV 0x8632
+#define GL_MATRIX3_NV 0x8633
+#define GL_MATRIX4_NV 0x8634
+#define GL_MATRIX5_NV 0x8635
+#define GL_MATRIX6_NV 0x8636
+#define GL_MATRIX7_NV 0x8637
+#define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640
+#define GL_CURRENT_MATRIX_NV 0x8641
+#define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642
+#define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643
+#define GL_PROGRAM_PARAMETER_NV 0x8644
+#define GL_ATTRIB_ARRAY_POINTER_NV 0x8645
+#define GL_PROGRAM_TARGET_NV 0x8646
+#define GL_PROGRAM_RESIDENT_NV 0x8647
+#define GL_TRACK_MATRIX_NV 0x8648
+#define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649
+#define GL_VERTEX_PROGRAM_BINDING_NV 0x864A
+#define GL_PROGRAM_ERROR_POSITION_NV 0x864B
+#define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650
+#define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651
+#define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652
+#define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653
+#define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654
+#define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655
+#define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656
+#define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657
+#define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658
+#define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659
+#define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A
+#define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B
+#define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C
+#define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D
+#define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E
+#define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F
+#define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660
+#define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661
+#define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662
+#define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663
+#define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664
+#define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665
+#define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666
+#define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667
+#define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668
+#define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669
+#define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A
+#define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B
+#define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C
+#define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D
+#define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E
+#define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F
+#define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670
+#define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671
+#define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672
+#define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673
+#define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674
+#define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675
+#define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676
+#define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677
+#define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678
+#define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679
+#define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A
+#define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B
+#define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C
+#define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D
+#define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E
+#define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F
+#endif
+
+#ifndef GL_SGIX_texture_coordinate_clamp
+#define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369
+#define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A
+#define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B
+#endif
+
+#ifndef GL_SGIX_scalebias_hint
+#define GL_SCALEBIAS_HINT_SGIX 0x8322
+#endif
+
+#ifndef GL_OML_interlace
+#define GL_INTERLACE_OML 0x8980
+#define GL_INTERLACE_READ_OML 0x8981
+#endif
+
+#ifndef GL_OML_subsample
+#define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982
+#define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983
+#endif
+
+#ifndef GL_OML_resample
+#define GL_PACK_RESAMPLE_OML 0x8984
+#define GL_UNPACK_RESAMPLE_OML 0x8985
+#define GL_RESAMPLE_REPLICATE_OML 0x8986
+#define GL_RESAMPLE_ZERO_FILL_OML 0x8987
+#define GL_RESAMPLE_AVERAGE_OML 0x8988
+#define GL_RESAMPLE_DECIMATE_OML 0x8989
+#endif
+
+#ifndef GL_NV_copy_depth_to_color
+#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E
+#define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F
+#endif
+
+#ifndef GL_ATI_envmap_bumpmap
+#define GL_BUMP_ROT_MATRIX_ATI 0x8775
+#define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776
+#define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777
+#define GL_BUMP_TEX_UNITS_ATI 0x8778
+#define GL_DUDV_ATI 0x8779
+#define GL_DU8DV8_ATI 0x877A
+#define GL_BUMP_ENVMAP_ATI 0x877B
+#define GL_BUMP_TARGET_ATI 0x877C
+#endif
+
+#ifndef GL_ATI_fragment_shader
+#define GL_FRAGMENT_SHADER_ATI 0x8920
+#define GL_REG_0_ATI 0x8921
+#define GL_REG_1_ATI 0x8922
+#define GL_REG_2_ATI 0x8923
+#define GL_REG_3_ATI 0x8924
+#define GL_REG_4_ATI 0x8925
+#define GL_REG_5_ATI 0x8926
+#define GL_REG_6_ATI 0x8927
+#define GL_REG_7_ATI 0x8928
+#define GL_REG_8_ATI 0x8929
+#define GL_REG_9_ATI 0x892A
+#define GL_REG_10_ATI 0x892B
+#define GL_REG_11_ATI 0x892C
+#define GL_REG_12_ATI 0x892D
+#define GL_REG_13_ATI 0x892E
+#define GL_REG_14_ATI 0x892F
+#define GL_REG_15_ATI 0x8930
+#define GL_REG_16_ATI 0x8931
+#define GL_REG_17_ATI 0x8932
+#define GL_REG_18_ATI 0x8933
+#define GL_REG_19_ATI 0x8934
+#define GL_REG_20_ATI 0x8935
+#define GL_REG_21_ATI 0x8936
+#define GL_REG_22_ATI 0x8937
+#define GL_REG_23_ATI 0x8938
+#define GL_REG_24_ATI 0x8939
+#define GL_REG_25_ATI 0x893A
+#define GL_REG_26_ATI 0x893B
+#define GL_REG_27_ATI 0x893C
+#define GL_REG_28_ATI 0x893D
+#define GL_REG_29_ATI 0x893E
+#define GL_REG_30_ATI 0x893F
+#define GL_REG_31_ATI 0x8940
+#define GL_CON_0_ATI 0x8941
+#define GL_CON_1_ATI 0x8942
+#define GL_CON_2_ATI 0x8943
+#define GL_CON_3_ATI 0x8944
+#define GL_CON_4_ATI 0x8945
+#define GL_CON_5_ATI 0x8946
+#define GL_CON_6_ATI 0x8947
+#define GL_CON_7_ATI 0x8948
+#define GL_CON_8_ATI 0x8949
+#define GL_CON_9_ATI 0x894A
+#define GL_CON_10_ATI 0x894B
+#define GL_CON_11_ATI 0x894C
+#define GL_CON_12_ATI 0x894D
+#define GL_CON_13_ATI 0x894E
+#define GL_CON_14_ATI 0x894F
+#define GL_CON_15_ATI 0x8950
+#define GL_CON_16_ATI 0x8951
+#define GL_CON_17_ATI 0x8952
+#define GL_CON_18_ATI 0x8953
+#define GL_CON_19_ATI 0x8954
+#define GL_CON_20_ATI 0x8955
+#define GL_CON_21_ATI 0x8956
+#define GL_CON_22_ATI 0x8957
+#define GL_CON_23_ATI 0x8958
+#define GL_CON_24_ATI 0x8959
+#define GL_CON_25_ATI 0x895A
+#define GL_CON_26_ATI 0x895B
+#define GL_CON_27_ATI 0x895C
+#define GL_CON_28_ATI 0x895D
+#define GL_CON_29_ATI 0x895E
+#define GL_CON_30_ATI 0x895F
+#define GL_CON_31_ATI 0x8960
+#define GL_MOV_ATI 0x8961
+#define GL_ADD_ATI 0x8963
+#define GL_MUL_ATI 0x8964
+#define GL_SUB_ATI 0x8965
+#define GL_DOT3_ATI 0x8966
+#define GL_DOT4_ATI 0x8967
+#define GL_MAD_ATI 0x8968
+#define GL_LERP_ATI 0x8969
+#define GL_CND_ATI 0x896A
+#define GL_CND0_ATI 0x896B
+#define GL_DOT2_ADD_ATI 0x896C
+#define GL_SECONDARY_INTERPOLATOR_ATI 0x896D
+#define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E
+#define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F
+#define GL_NUM_PASSES_ATI 0x8970
+#define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971
+#define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972
+#define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973
+#define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974
+#define GL_COLOR_ALPHA_PAIRING_ATI 0x8975
+#define GL_SWIZZLE_STR_ATI 0x8976
+#define GL_SWIZZLE_STQ_ATI 0x8977
+#define GL_SWIZZLE_STR_DR_ATI 0x8978
+#define GL_SWIZZLE_STQ_DQ_ATI 0x8979
+#define GL_SWIZZLE_STRQ_ATI 0x897A
+#define GL_SWIZZLE_STRQ_DQ_ATI 0x897B
+#define GL_RED_BIT_ATI 0x00000001
+#define GL_GREEN_BIT_ATI 0x00000002
+#define GL_BLUE_BIT_ATI 0x00000004
+#define GL_2X_BIT_ATI 0x00000001
+#define GL_4X_BIT_ATI 0x00000002
+#define GL_8X_BIT_ATI 0x00000004
+#define GL_HALF_BIT_ATI 0x00000008
+#define GL_QUARTER_BIT_ATI 0x00000010
+#define GL_EIGHTH_BIT_ATI 0x00000020
+#define GL_SATURATE_BIT_ATI 0x00000040
+#define GL_COMP_BIT_ATI 0x00000002
+#define GL_NEGATE_BIT_ATI 0x00000004
+#define GL_BIAS_BIT_ATI 0x00000008
+#endif
+
+#ifndef GL_ATI_pn_triangles
+#define GL_PN_TRIANGLES_ATI 0x87F0
+#define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1
+#define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2
+#define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3
+#define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4
+#define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5
+#define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6
+#define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7
+#define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8
+#endif
+
+#ifndef GL_ATI_vertex_array_object
+#define GL_STATIC_ATI 0x8760
+#define GL_DYNAMIC_ATI 0x8761
+#define GL_PRESERVE_ATI 0x8762
+#define GL_DISCARD_ATI 0x8763
+#define GL_OBJECT_BUFFER_SIZE_ATI 0x8764
+#define GL_OBJECT_BUFFER_USAGE_ATI 0x8765
+#define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766
+#define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767
+#endif
+
+#ifndef GL_EXT_vertex_shader
+#define GL_VERTEX_SHADER_EXT 0x8780
+#define GL_VERTEX_SHADER_BINDING_EXT 0x8781
+#define GL_OP_INDEX_EXT 0x8782
+#define GL_OP_NEGATE_EXT 0x8783
+#define GL_OP_DOT3_EXT 0x8784
+#define GL_OP_DOT4_EXT 0x8785
+#define GL_OP_MUL_EXT 0x8786
+#define GL_OP_ADD_EXT 0x8787
+#define GL_OP_MADD_EXT 0x8788
+#define GL_OP_FRAC_EXT 0x8789
+#define GL_OP_MAX_EXT 0x878A
+#define GL_OP_MIN_EXT 0x878B
+#define GL_OP_SET_GE_EXT 0x878C
+#define GL_OP_SET_LT_EXT 0x878D
+#define GL_OP_CLAMP_EXT 0x878E
+#define GL_OP_FLOOR_EXT 0x878F
+#define GL_OP_ROUND_EXT 0x8790
+#define GL_OP_EXP_BASE_2_EXT 0x8791
+#define GL_OP_LOG_BASE_2_EXT 0x8792
+#define GL_OP_POWER_EXT 0x8793
+#define GL_OP_RECIP_EXT 0x8794
+#define GL_OP_RECIP_SQRT_EXT 0x8795
+#define GL_OP_SUB_EXT 0x8796
+#define GL_OP_CROSS_PRODUCT_EXT 0x8797
+#define GL_OP_MULTIPLY_MATRIX_EXT 0x8798
+#define GL_OP_MOV_EXT 0x8799
+#define GL_OUTPUT_VERTEX_EXT 0x879A
+#define GL_OUTPUT_COLOR0_EXT 0x879B
+#define GL_OUTPUT_COLOR1_EXT 0x879C
+#define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D
+#define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E
+#define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F
+#define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0
+#define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1
+#define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2
+#define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3
+#define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4
+#define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5
+#define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6
+#define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7
+#define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8
+#define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9
+#define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA
+#define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB
+#define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC
+#define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD
+#define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE
+#define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF
+#define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0
+#define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1
+#define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2
+#define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3
+#define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4
+#define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5
+#define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6
+#define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7
+#define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8
+#define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9
+#define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA
+#define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB
+#define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC
+#define GL_OUTPUT_FOG_EXT 0x87BD
+#define GL_SCALAR_EXT 0x87BE
+#define GL_VECTOR_EXT 0x87BF
+#define GL_MATRIX_EXT 0x87C0
+#define GL_VARIANT_EXT 0x87C1
+#define GL_INVARIANT_EXT 0x87C2
+#define GL_LOCAL_CONSTANT_EXT 0x87C3
+#define GL_LOCAL_EXT 0x87C4
+#define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5
+#define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6
+#define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7
+#define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8
+#define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9
+#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA
+#define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB
+#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CC
+#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CD
+#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE
+#define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF
+#define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0
+#define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1
+#define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2
+#define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3
+#define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4
+#define GL_X_EXT 0x87D5
+#define GL_Y_EXT 0x87D6
+#define GL_Z_EXT 0x87D7
+#define GL_W_EXT 0x87D8
+#define GL_NEGATIVE_X_EXT 0x87D9
+#define GL_NEGATIVE_Y_EXT 0x87DA
+#define GL_NEGATIVE_Z_EXT 0x87DB
+#define GL_NEGATIVE_W_EXT 0x87DC
+#define GL_ZERO_EXT 0x87DD
+#define GL_ONE_EXT 0x87DE
+#define GL_NEGATIVE_ONE_EXT 0x87DF
+#define GL_NORMALIZED_RANGE_EXT 0x87E0
+#define GL_FULL_RANGE_EXT 0x87E1
+#define GL_CURRENT_VERTEX_EXT 0x87E2
+#define GL_MVP_MATRIX_EXT 0x87E3
+#define GL_VARIANT_VALUE_EXT 0x87E4
+#define GL_VARIANT_DATATYPE_EXT 0x87E5
+#define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6
+#define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7
+#define GL_VARIANT_ARRAY_EXT 0x87E8
+#define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9
+#define GL_INVARIANT_VALUE_EXT 0x87EA
+#define GL_INVARIANT_DATATYPE_EXT 0x87EB
+#define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC
+#define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED
+#endif
+
+#ifndef GL_ATI_vertex_streams
+#define GL_MAX_VERTEX_STREAMS_ATI 0x876B
+#define GL_VERTEX_STREAM0_ATI 0x876C
+#define GL_VERTEX_STREAM1_ATI 0x876D
+#define GL_VERTEX_STREAM2_ATI 0x876E
+#define GL_VERTEX_STREAM3_ATI 0x876F
+#define GL_VERTEX_STREAM4_ATI 0x8770
+#define GL_VERTEX_STREAM5_ATI 0x8771
+#define GL_VERTEX_STREAM6_ATI 0x8772
+#define GL_VERTEX_STREAM7_ATI 0x8773
+#define GL_VERTEX_SOURCE_ATI 0x8774
+#endif
+
+#ifndef GL_ATI_element_array
+#define GL_ELEMENT_ARRAY_ATI 0x8768
+#define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769
+#define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A
+#endif
+
+#ifndef GL_SUN_mesh_array
+#define GL_QUAD_MESH_SUN 0x8614
+#define GL_TRIANGLE_MESH_SUN 0x8615
+#endif
+
+#ifndef GL_SUN_slice_accum
+#define GL_SLICE_ACCUM_SUN 0x85CC
+#endif
+
+#ifndef GL_NV_multisample_filter_hint
+#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534
+#endif
+
+#ifndef GL_NV_depth_clamp
+#define GL_DEPTH_CLAMP_NV 0x864F
+#endif
+
+#ifndef GL_NV_occlusion_query
+#define GL_PIXEL_COUNTER_BITS_NV 0x8864
+#define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865
+#define GL_PIXEL_COUNT_NV 0x8866
+#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867
+#endif
+
+#ifndef GL_NV_point_sprite
+#define GL_POINT_SPRITE_NV 0x8861
+#define GL_COORD_REPLACE_NV 0x8862
+#define GL_POINT_SPRITE_R_MODE_NV 0x8863
+#endif
+
+#ifndef GL_NV_texture_shader3
+#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850
+#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851
+#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852
+#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853
+#define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854
+#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855
+#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856
+#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857
+#define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858
+#define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859
+#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A
+#define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B
+#define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C
+#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D
+#define GL_HILO8_NV 0x885E
+#define GL_SIGNED_HILO8_NV 0x885F
+#define GL_FORCE_BLUE_TO_ONE_NV 0x8860
+#endif
+
+#ifndef GL_NV_vertex_program1_1
+#endif
+
+#ifndef GL_EXT_shadow_funcs
+#endif
+
+#ifndef GL_EXT_stencil_two_side
+#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910
+#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911
+#endif
+
+#ifndef GL_ATI_text_fragment_shader
+#define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200
+#endif
+
+#ifndef GL_APPLE_client_storage
+#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2
+#endif
+
+#ifndef GL_APPLE_element_array
+#define GL_ELEMENT_ARRAY_APPLE 0x8A0C
+#define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8A0D
+#define GL_ELEMENT_ARRAY_POINTER_APPLE 0x8A0E
+#endif
+
+#ifndef GL_APPLE_fence
+#define GL_DRAW_PIXELS_APPLE 0x8A0A
+#define GL_FENCE_APPLE 0x8A0B
+#endif
+
+#ifndef GL_APPLE_vertex_array_object
+#define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5
+#endif
+
+#ifndef GL_APPLE_vertex_array_range
+#define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D
+#define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E
+#define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F
+#define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521
+#define GL_STORAGE_CLIENT_APPLE 0x85B4
+#define GL_STORAGE_CACHED_APPLE 0x85BE
+#define GL_STORAGE_SHARED_APPLE 0x85BF
+#endif
+
+#ifndef GL_APPLE_ycbcr_422
+#define GL_YCBCR_422_APPLE 0x85B9
+#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA
+#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB
+#endif
+
+#ifndef GL_S3_s3tc
+#define GL_RGB_S3TC 0x83A0
+#define GL_RGB4_S3TC 0x83A1
+#define GL_RGBA_S3TC 0x83A2
+#define GL_RGBA4_S3TC 0x83A3
+#endif
+
+#ifndef GL_ATI_draw_buffers
+#define GL_MAX_DRAW_BUFFERS_ATI 0x8824
+#define GL_DRAW_BUFFER0_ATI 0x8825
+#define GL_DRAW_BUFFER1_ATI 0x8826
+#define GL_DRAW_BUFFER2_ATI 0x8827
+#define GL_DRAW_BUFFER3_ATI 0x8828
+#define GL_DRAW_BUFFER4_ATI 0x8829
+#define GL_DRAW_BUFFER5_ATI 0x882A
+#define GL_DRAW_BUFFER6_ATI 0x882B
+#define GL_DRAW_BUFFER7_ATI 0x882C
+#define GL_DRAW_BUFFER8_ATI 0x882D
+#define GL_DRAW_BUFFER9_ATI 0x882E
+#define GL_DRAW_BUFFER10_ATI 0x882F
+#define GL_DRAW_BUFFER11_ATI 0x8830
+#define GL_DRAW_BUFFER12_ATI 0x8831
+#define GL_DRAW_BUFFER13_ATI 0x8832
+#define GL_DRAW_BUFFER14_ATI 0x8833
+#define GL_DRAW_BUFFER15_ATI 0x8834
+#endif
+
+#ifndef GL_ATI_pixel_format_float
+#define GL_TYPE_RGBA_FLOAT_ATI 0x8820
+#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835
+#endif
+
+#ifndef GL_ATI_texture_env_combine3
+#define GL_MODULATE_ADD_ATI 0x8744
+#define GL_MODULATE_SIGNED_ADD_ATI 0x8745
+#define GL_MODULATE_SUBTRACT_ATI 0x8746
+#endif
+
+#ifndef GL_ATI_texture_float
+#define GL_RGBA_FLOAT32_ATI 0x8814
+#define GL_RGB_FLOAT32_ATI 0x8815
+#define GL_ALPHA_FLOAT32_ATI 0x8816
+#define GL_INTENSITY_FLOAT32_ATI 0x8817
+#define GL_LUMINANCE_FLOAT32_ATI 0x8818
+#define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819
+#define GL_RGBA_FLOAT16_ATI 0x881A
+#define GL_RGB_FLOAT16_ATI 0x881B
+#define GL_ALPHA_FLOAT16_ATI 0x881C
+#define GL_INTENSITY_FLOAT16_ATI 0x881D
+#define GL_LUMINANCE_FLOAT16_ATI 0x881E
+#define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F
+#endif
+
+#ifndef GL_NV_float_buffer
+#define GL_FLOAT_R_NV 0x8880
+#define GL_FLOAT_RG_NV 0x8881
+#define GL_FLOAT_RGB_NV 0x8882
+#define GL_FLOAT_RGBA_NV 0x8883
+#define GL_FLOAT_R16_NV 0x8884
+#define GL_FLOAT_R32_NV 0x8885
+#define GL_FLOAT_RG16_NV 0x8886
+#define GL_FLOAT_RG32_NV 0x8887
+#define GL_FLOAT_RGB16_NV 0x8888
+#define GL_FLOAT_RGB32_NV 0x8889
+#define GL_FLOAT_RGBA16_NV 0x888A
+#define GL_FLOAT_RGBA32_NV 0x888B
+#define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C
+#define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D
+#define GL_FLOAT_RGBA_MODE_NV 0x888E
+#endif
+
+#ifndef GL_NV_fragment_program
+#define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868
+#define GL_FRAGMENT_PROGRAM_NV 0x8870
+#define GL_MAX_TEXTURE_COORDS_NV 0x8871
+#define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872
+#define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873
+#define GL_PROGRAM_ERROR_STRING_NV 0x8874
+#endif
+
+#ifndef GL_NV_half_float
+#define GL_HALF_FLOAT_NV 0x140B
+#endif
+
+#ifndef GL_NV_pixel_data_range
+#define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878
+#define GL_READ_PIXEL_DATA_RANGE_NV 0x8879
+#define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A
+#define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B
+#define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C
+#define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D
+#endif
+
+#ifndef GL_NV_primitive_restart
+#define GL_PRIMITIVE_RESTART_NV 0x8558
+#define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559
+#endif
+
+#ifndef GL_NV_texture_expand_normal
+#define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F
+#endif
+
+#ifndef GL_NV_vertex_program2
+#endif
+
+#ifndef GL_ATI_map_object_buffer
+#endif
+
+#ifndef GL_ATI_separate_stencil
+#define GL_STENCIL_BACK_FUNC_ATI 0x8800
+#define GL_STENCIL_BACK_FAIL_ATI 0x8801
+#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802
+#define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803
+#endif
+
+#ifndef GL_ATI_vertex_attrib_array_object
+#endif
+
+#ifndef GL_OES_read_format
+#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A
+#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B
+#endif
+
+#ifndef GL_EXT_depth_bounds_test
+#define GL_DEPTH_BOUNDS_TEST_EXT 0x8890
+#define GL_DEPTH_BOUNDS_EXT 0x8891
+#endif
+
+#ifndef GL_EXT_texture_mirror_clamp
+#define GL_MIRROR_CLAMP_EXT 0x8742
+#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743
+#define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912
+#endif
+
+#ifndef GL_EXT_blend_equation_separate
+#define GL_BLEND_EQUATION_RGB_EXT 0x8009
+#define GL_BLEND_EQUATION_ALPHA_EXT 0x883D
+#endif
+
+#ifndef GL_MESA_pack_invert
+#define GL_PACK_INVERT_MESA 0x8758
+#endif
+
+#ifndef GL_MESA_ycbcr_texture
+#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA
+#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB
+#define GL_YCBCR_MESA 0x8757
+#endif
+
+#ifndef GL_EXT_pixel_buffer_object
+#define GL_PIXEL_PACK_BUFFER_EXT 0x88EB
+#define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC
+#define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED
+#define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF
+#endif
+
+#ifndef GL_NV_fragment_program_option
+#endif
+
+#ifndef GL_NV_fragment_program2
+#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4
+#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5
+#define GL_MAX_PROGRAM_IF_DEPTH_NV 0x88F6
+#define GL_MAX_PROGRAM_LOOP_DEPTH_NV 0x88F7
+#define GL_MAX_PROGRAM_LOOP_COUNT_NV 0x88F8
+#endif
+
+#ifndef GL_NV_vertex_program2_option
+/* reuse GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */
+/* reuse GL_MAX_PROGRAM_CALL_DEPTH_NV */
+#endif
+
+#ifndef GL_NV_vertex_program3
+/* reuse GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */
+#endif
+
+#ifndef GL_EXT_framebuffer_object
+#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506
+#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8
+#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6
+#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4
+#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5
+#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6
+#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7
+#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9
+#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA
+#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB
+#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC
+#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD
+#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
+#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
+#define GL_DEPTH_ATTACHMENT_EXT 0x8D00
+#define GL_STENCIL_ATTACHMENT_EXT 0x8D20
+#define GL_FRAMEBUFFER_EXT 0x8D40
+#define GL_RENDERBUFFER_EXT 0x8D41
+#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42
+#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43
+#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44
+#define GL_STENCIL_INDEX1_EXT 0x8D46
+#define GL_STENCIL_INDEX4_EXT 0x8D47
+#define GL_STENCIL_INDEX8_EXT 0x8D48
+#define GL_STENCIL_INDEX16_EXT 0x8D49
+#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50
+#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51
+#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52
+#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53
+#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54
+#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55
+#endif
+
+#ifndef GL_GREMEDY_string_marker
+#endif
+
+#ifndef GL_EXT_packed_depth_stencil
+#define GL_DEPTH_STENCIL_EXT 0x84F9
+#define GL_UNSIGNED_INT_24_8_EXT 0x84FA
+#define GL_DEPTH24_STENCIL8_EXT 0x88F0
+#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1
+#endif
+
+#ifndef GL_EXT_stencil_clear_tag
+#define GL_STENCIL_TAG_BITS_EXT 0x88F2
+#define GL_STENCIL_CLEAR_TAG_VALUE_EXT 0x88F3
+#endif
+
+#ifndef GL_EXT_texture_sRGB
+#define GL_SRGB_EXT 0x8C40
+#define GL_SRGB8_EXT 0x8C41
+#define GL_SRGB_ALPHA_EXT 0x8C42
+#define GL_SRGB8_ALPHA8_EXT 0x8C43
+#define GL_SLUMINANCE_ALPHA_EXT 0x8C44
+#define GL_SLUMINANCE8_ALPHA8_EXT 0x8C45
+#define GL_SLUMINANCE_EXT 0x8C46
+#define GL_SLUMINANCE8_EXT 0x8C47
+#define GL_COMPRESSED_SRGB_EXT 0x8C48
+#define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8C49
+#define GL_COMPRESSED_SLUMINANCE_EXT 0x8C4A
+#define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B
+#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E
+#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F
+#endif
+
+#ifndef GL_EXT_framebuffer_blit
+#define GL_READ_FRAMEBUFFER_EXT 0x8CA8
+#define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9
+#define GL_DRAW_FRAMEBUFFER_BINDING_EXT GL_FRAMEBUFFER_BINDING_EXT
+#define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA
+#endif
+
+#ifndef GL_EXT_framebuffer_multisample
+#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
+#define GL_MAX_SAMPLES_EXT 0x8D57
+#endif
+
+#ifndef GL_MESAX_texture_stack
+#define GL_TEXTURE_1D_STACK_MESAX 0x8759
+#define GL_TEXTURE_2D_STACK_MESAX 0x875A
+#define GL_PROXY_TEXTURE_1D_STACK_MESAX 0x875B
+#define GL_PROXY_TEXTURE_2D_STACK_MESAX 0x875C
+#define GL_TEXTURE_1D_STACK_BINDING_MESAX 0x875D
+#define GL_TEXTURE_2D_STACK_BINDING_MESAX 0x875E
+#endif
+
+#ifndef GL_EXT_timer_query
+#define GL_TIME_ELAPSED_EXT 0x88BF
+#endif
+
+#ifndef GL_EXT_gpu_program_parameters
+#endif
+
+#ifndef GL_APPLE_flush_buffer_range
+#define GL_BUFFER_SERIALIZED_MODIFY_APPLE 0x8A12
+#define GL_BUFFER_FLUSHING_UNMAP_APPLE 0x8A13
+#endif
+
+#ifndef GL_NV_gpu_program4
+#define GL_MIN_PROGRAM_TEXEL_OFFSET_NV 0x8904
+#define GL_MAX_PROGRAM_TEXEL_OFFSET_NV 0x8905
+#define GL_PROGRAM_ATTRIB_COMPONENTS_NV 0x8906
+#define GL_PROGRAM_RESULT_COMPONENTS_NV 0x8907
+#define GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV 0x8908
+#define GL_MAX_PROGRAM_RESULT_COMPONENTS_NV 0x8909
+#define GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV 0x8DA5
+#define GL_MAX_PROGRAM_GENERIC_RESULTS_NV 0x8DA6
+#endif
+
+#ifndef GL_NV_geometry_program4
+#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_GEOMETRY_PROGRAM_NV 0x8C26
+#define GL_MAX_PROGRAM_OUTPUT_VERTICES_NV 0x8C27
+#define GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV 0x8C28
+#define GL_GEOMETRY_VERTICES_OUT_EXT 0x8DDA
+#define GL_GEOMETRY_INPUT_TYPE_EXT 0x8DDB
+#define GL_GEOMETRY_OUTPUT_TYPE_EXT 0x8DDC
+#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29
+#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7
+#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8
+#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT 0x8DA9
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4
+#define GL_PROGRAM_POINT_SIZE_EXT 0x8642
+#endif
+
+#ifndef GL_EXT_geometry_shader4
+#define GL_GEOMETRY_SHADER_EXT 0x8DD9
+/* reuse GL_GEOMETRY_VERTICES_OUT_EXT */
+/* reuse GL_GEOMETRY_INPUT_TYPE_EXT */
+/* reuse GL_GEOMETRY_OUTPUT_TYPE_EXT */
+/* reuse GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT */
+#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT 0x8DDD
+#define GL_MAX_VERTEX_VARYING_COMPONENTS_EXT 0x8DDE
+#define GL_MAX_VARYING_COMPONENTS_EXT 0x8B4B
+#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF
+#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0
+#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1
+/* reuse GL_LINES_ADJACENCY_EXT */
+/* reuse GL_LINE_STRIP_ADJACENCY_EXT */
+/* reuse GL_TRIANGLES_ADJACENCY_EXT */
+/* reuse GL_TRIANGLE_STRIP_ADJACENCY_EXT */
+/* reuse GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT */
+/* reuse GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT */
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */
+/* reuse GL_PROGRAM_POINT_SIZE_EXT */
+#endif
+
+#ifndef GL_NV_vertex_program4
+#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_NV 0x88FD
+#endif
+
+#ifndef GL_EXT_gpu_shader4
+#define GL_SAMPLER_1D_ARRAY_EXT 0x8DC0
+#define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1
+#define GL_SAMPLER_BUFFER_EXT 0x8DC2
+#define GL_SAMPLER_1D_ARRAY_SHADOW_EXT 0x8DC3
+#define GL_SAMPLER_2D_ARRAY_SHADOW_EXT 0x8DC4
+#define GL_SAMPLER_CUBE_SHADOW_EXT 0x8DC5
+#define GL_UNSIGNED_INT_VEC2_EXT 0x8DC6
+#define GL_UNSIGNED_INT_VEC3_EXT 0x8DC7
+#define GL_UNSIGNED_INT_VEC4_EXT 0x8DC8
+#define GL_INT_SAMPLER_1D_EXT 0x8DC9
+#define GL_INT_SAMPLER_2D_EXT 0x8DCA
+#define GL_INT_SAMPLER_3D_EXT 0x8DCB
+#define GL_INT_SAMPLER_CUBE_EXT 0x8DCC
+#define GL_INT_SAMPLER_2D_RECT_EXT 0x8DCD
+#define GL_INT_SAMPLER_1D_ARRAY_EXT 0x8DCE
+#define GL_INT_SAMPLER_2D_ARRAY_EXT 0x8DCF
+#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0
+#define GL_UNSIGNED_INT_SAMPLER_1D_EXT 0x8DD1
+#define GL_UNSIGNED_INT_SAMPLER_2D_EXT 0x8DD2
+#define GL_UNSIGNED_INT_SAMPLER_3D_EXT 0x8DD3
+#define GL_UNSIGNED_INT_SAMPLER_CUBE_EXT 0x8DD4
+#define GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT 0x8DD5
+#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT 0x8DD6
+#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT 0x8DD7
+#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8
+#endif
+
+#ifndef GL_EXT_draw_instanced
+#endif
+
+#ifndef GL_EXT_packed_float
+#define GL_R11F_G11F_B10F_EXT 0x8C3A
+#define GL_UNSIGNED_INT_10F_11F_11F_REV_EXT 0x8C3B
+#define GL_RGBA_SIGNED_COMPONENTS_EXT 0x8C3C
+#endif
+
+#ifndef GL_EXT_texture_array
+#define GL_TEXTURE_1D_ARRAY_EXT 0x8C18
+#define GL_PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19
+#define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A
+#define GL_PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B
+#define GL_TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C
+#define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D
+#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF
+#define GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E
+/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */
+#endif
+
+#ifndef GL_EXT_texture_buffer_object
+#define GL_TEXTURE_BUFFER_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_FORMAT_EXT 0x8C2E
+#endif
+
+#ifndef GL_EXT_texture_compression_latc
+#define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70
+#define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71
+#define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72
+#define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73
+#endif
+
+#ifndef GL_EXT_texture_compression_rgtc
+#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB
+#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC
+#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD
+#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE
+#endif
+
+#ifndef GL_EXT_texture_shared_exponent
+#define GL_RGB9_E5_EXT 0x8C3D
+#define GL_UNSIGNED_INT_5_9_9_9_REV_EXT 0x8C3E
+#define GL_TEXTURE_SHARED_SIZE_EXT 0x8C3F
+#endif
+
+#ifndef GL_NV_depth_buffer_float
+#define GL_DEPTH_COMPONENT32F_NV 0x8DAB
+#define GL_DEPTH32F_STENCIL8_NV 0x8DAC
+#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV 0x8DAD
+#define GL_DEPTH_BUFFER_FLOAT_MODE_NV 0x8DAF
+#endif
+
+#ifndef GL_NV_fragment_program4
+#endif
+
+#ifndef GL_NV_framebuffer_multisample_coverage
+#define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB
+#define GL_RENDERBUFFER_COLOR_SAMPLES_NV 0x8E10
+#define GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV 0x8E11
+#define GL_MULTISAMPLE_COVERAGE_MODES_NV 0x8E12
+#endif
+
+#ifndef GL_EXT_framebuffer_sRGB
+#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9
+#define GL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA
+#endif
+
+#ifndef GL_NV_geometry_shader4
+#endif
+
+#ifndef GL_NV_parameter_buffer_object
+#define GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV 0x8DA0
+#define GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV 0x8DA1
+#define GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV 0x8DA2
+#define GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV 0x8DA3
+#define GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV 0x8DA4
+#endif
+
+#ifndef GL_EXT_draw_buffers2
+#endif
+
+#ifndef GL_NV_transform_feedback
+#define GL_BACK_PRIMARY_COLOR_NV 0x8C77
+#define GL_BACK_SECONDARY_COLOR_NV 0x8C78
+#define GL_TEXTURE_COORD_NV 0x8C79
+#define GL_CLIP_DISTANCE_NV 0x8C7A
+#define GL_VERTEX_ID_NV 0x8C7B
+#define GL_PRIMITIVE_ID_NV 0x8C7C
+#define GL_GENERIC_ATTRIB_NV 0x8C7D
+#define GL_TRANSFORM_FEEDBACK_ATTRIBS_NV 0x8C7E
+#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV 0x8C7F
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV 0x8C80
+#define GL_ACTIVE_VARYINGS_NV 0x8C81
+#define GL_ACTIVE_VARYING_MAX_LENGTH_NV 0x8C82
+#define GL_TRANSFORM_FEEDBACK_VARYINGS_NV 0x8C83
+#define GL_TRANSFORM_FEEDBACK_BUFFER_START_NV 0x8C84
+#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV 0x8C85
+#define GL_TRANSFORM_FEEDBACK_RECORD_NV 0x8C86
+#define GL_PRIMITIVES_GENERATED_NV 0x8C87
+#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV 0x8C88
+#define GL_RASTERIZER_DISCARD_NV 0x8C89
+#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_ATTRIBS_NV 0x8C8A
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV 0x8C8B
+#define GL_INTERLEAVED_ATTRIBS_NV 0x8C8C
+#define GL_SEPARATE_ATTRIBS_NV 0x8C8D
+#define GL_TRANSFORM_FEEDBACK_BUFFER_NV 0x8C8E
+#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV 0x8C8F
+#define GL_LAYER_NV 0x8DAA
+#define GL_NEXT_BUFFER_NV -2
+#define GL_SKIP_COMPONENTS4_NV -3
+#define GL_SKIP_COMPONENTS3_NV -4
+#define GL_SKIP_COMPONENTS2_NV -5
+#define GL_SKIP_COMPONENTS1_NV -6
+#endif
+
+#ifndef GL_EXT_bindable_uniform
+#define GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT 0x8DE2
+#define GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT 0x8DE3
+#define GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT 0x8DE4
+#define GL_MAX_BINDABLE_UNIFORM_SIZE_EXT 0x8DED
+#define GL_UNIFORM_BUFFER_EXT 0x8DEE
+#define GL_UNIFORM_BUFFER_BINDING_EXT 0x8DEF
+#endif
+
+#ifndef GL_EXT_texture_integer
+#define GL_RGBA32UI_EXT 0x8D70
+#define GL_RGB32UI_EXT 0x8D71
+#define GL_ALPHA32UI_EXT 0x8D72
+#define GL_INTENSITY32UI_EXT 0x8D73
+#define GL_LUMINANCE32UI_EXT 0x8D74
+#define GL_LUMINANCE_ALPHA32UI_EXT 0x8D75
+#define GL_RGBA16UI_EXT 0x8D76
+#define GL_RGB16UI_EXT 0x8D77
+#define GL_ALPHA16UI_EXT 0x8D78
+#define GL_INTENSITY16UI_EXT 0x8D79
+#define GL_LUMINANCE16UI_EXT 0x8D7A
+#define GL_LUMINANCE_ALPHA16UI_EXT 0x8D7B
+#define GL_RGBA8UI_EXT 0x8D7C
+#define GL_RGB8UI_EXT 0x8D7D
+#define GL_ALPHA8UI_EXT 0x8D7E
+#define GL_INTENSITY8UI_EXT 0x8D7F
+#define GL_LUMINANCE8UI_EXT 0x8D80
+#define GL_LUMINANCE_ALPHA8UI_EXT 0x8D81
+#define GL_RGBA32I_EXT 0x8D82
+#define GL_RGB32I_EXT 0x8D83
+#define GL_ALPHA32I_EXT 0x8D84
+#define GL_INTENSITY32I_EXT 0x8D85
+#define GL_LUMINANCE32I_EXT 0x8D86
+#define GL_LUMINANCE_ALPHA32I_EXT 0x8D87
+#define GL_RGBA16I_EXT 0x8D88
+#define GL_RGB16I_EXT 0x8D89
+#define GL_ALPHA16I_EXT 0x8D8A
+#define GL_INTENSITY16I_EXT 0x8D8B
+#define GL_LUMINANCE16I_EXT 0x8D8C
+#define GL_LUMINANCE_ALPHA16I_EXT 0x8D8D
+#define GL_RGBA8I_EXT 0x8D8E
+#define GL_RGB8I_EXT 0x8D8F
+#define GL_ALPHA8I_EXT 0x8D90
+#define GL_INTENSITY8I_EXT 0x8D91
+#define GL_LUMINANCE8I_EXT 0x8D92
+#define GL_LUMINANCE_ALPHA8I_EXT 0x8D93
+#define GL_RED_INTEGER_EXT 0x8D94
+#define GL_GREEN_INTEGER_EXT 0x8D95
+#define GL_BLUE_INTEGER_EXT 0x8D96
+#define GL_ALPHA_INTEGER_EXT 0x8D97
+#define GL_RGB_INTEGER_EXT 0x8D98
+#define GL_RGBA_INTEGER_EXT 0x8D99
+#define GL_BGR_INTEGER_EXT 0x8D9A
+#define GL_BGRA_INTEGER_EXT 0x8D9B
+#define GL_LUMINANCE_INTEGER_EXT 0x8D9C
+#define GL_LUMINANCE_ALPHA_INTEGER_EXT 0x8D9D
+#define GL_RGBA_INTEGER_MODE_EXT 0x8D9E
+#endif
+
+#ifndef GL_GREMEDY_frame_terminator
+#endif
+
+#ifndef GL_NV_conditional_render
+#define GL_QUERY_WAIT_NV 0x8E13
+#define GL_QUERY_NO_WAIT_NV 0x8E14
+#define GL_QUERY_BY_REGION_WAIT_NV 0x8E15
+#define GL_QUERY_BY_REGION_NO_WAIT_NV 0x8E16
+#endif
+
+#ifndef GL_NV_present_video
+#define GL_FRAME_NV 0x8E26
+#define GL_FIELDS_NV 0x8E27
+#define GL_CURRENT_TIME_NV 0x8E28
+#define GL_NUM_FILL_STREAMS_NV 0x8E29
+#define GL_PRESENT_TIME_NV 0x8E2A
+#define GL_PRESENT_DURATION_NV 0x8E2B
+#endif
+
+#ifndef GL_EXT_transform_feedback
+#define GL_TRANSFORM_FEEDBACK_BUFFER_EXT 0x8C8E
+#define GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT 0x8C84
+#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT 0x8C85
+#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT 0x8C8F
+#define GL_INTERLEAVED_ATTRIBS_EXT 0x8C8C
+#define GL_SEPARATE_ATTRIBS_EXT 0x8C8D
+#define GL_PRIMITIVES_GENERATED_EXT 0x8C87
+#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT 0x8C88
+#define GL_RASTERIZER_DISCARD_EXT 0x8C89
+#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT 0x8C8A
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT 0x8C8B
+#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT 0x8C80
+#define GL_TRANSFORM_FEEDBACK_VARYINGS_EXT 0x8C83
+#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT 0x8C7F
+#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT 0x8C76
+#endif
+
+#ifndef GL_EXT_direct_state_access
+#define GL_PROGRAM_MATRIX_EXT 0x8E2D
+#define GL_TRANSPOSE_PROGRAM_MATRIX_EXT 0x8E2E
+#define GL_PROGRAM_MATRIX_STACK_DEPTH_EXT 0x8E2F
+#endif
+
+#ifndef GL_EXT_vertex_array_bgra
+/* reuse GL_BGRA */
+#endif
+
+#ifndef GL_EXT_texture_swizzle
+#define GL_TEXTURE_SWIZZLE_R_EXT 0x8E42
+#define GL_TEXTURE_SWIZZLE_G_EXT 0x8E43
+#define GL_TEXTURE_SWIZZLE_B_EXT 0x8E44
+#define GL_TEXTURE_SWIZZLE_A_EXT 0x8E45
+#define GL_TEXTURE_SWIZZLE_RGBA_EXT 0x8E46
+#endif
+
+#ifndef GL_NV_explicit_multisample
+#define GL_SAMPLE_POSITION_NV 0x8E50
+#define GL_SAMPLE_MASK_NV 0x8E51
+#define GL_SAMPLE_MASK_VALUE_NV 0x8E52
+#define GL_TEXTURE_BINDING_RENDERBUFFER_NV 0x8E53
+#define GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV 0x8E54
+#define GL_TEXTURE_RENDERBUFFER_NV 0x8E55
+#define GL_SAMPLER_RENDERBUFFER_NV 0x8E56
+#define GL_INT_SAMPLER_RENDERBUFFER_NV 0x8E57
+#define GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV 0x8E58
+#define GL_MAX_SAMPLE_MASK_WORDS_NV 0x8E59
+#endif
+
+#ifndef GL_NV_transform_feedback2
+#define GL_TRANSFORM_FEEDBACK_NV 0x8E22
+#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV 0x8E23
+#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV 0x8E24
+#define GL_TRANSFORM_FEEDBACK_BINDING_NV 0x8E25
+#endif
+
+#ifndef GL_ATI_meminfo
+#define GL_VBO_FREE_MEMORY_ATI 0x87FB
+#define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC
+#define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD
+#endif
+
+#ifndef GL_AMD_performance_monitor
+#define GL_COUNTER_TYPE_AMD 0x8BC0
+#define GL_COUNTER_RANGE_AMD 0x8BC1
+#define GL_UNSIGNED_INT64_AMD 0x8BC2
+#define GL_PERCENTAGE_AMD 0x8BC3
+#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4
+#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5
+#define GL_PERFMON_RESULT_AMD 0x8BC6
+#endif
+
+#ifndef GL_AMD_texture_texture4
+#endif
+
+#ifndef GL_AMD_vertex_shader_tesselator
+#define GL_SAMPLER_BUFFER_AMD 0x9001
+#define GL_INT_SAMPLER_BUFFER_AMD 0x9002
+#define GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD 0x9003
+#define GL_TESSELLATION_MODE_AMD 0x9004
+#define GL_TESSELLATION_FACTOR_AMD 0x9005
+#define GL_DISCRETE_AMD 0x9006
+#define GL_CONTINUOUS_AMD 0x9007
+#endif
+
+#ifndef GL_EXT_provoking_vertex
+#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT 0x8E4C
+#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D
+#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E
+#define GL_PROVOKING_VERTEX_EXT 0x8E4F
+#endif
+
+#ifndef GL_EXT_texture_snorm
+#define GL_ALPHA_SNORM 0x9010
+#define GL_LUMINANCE_SNORM 0x9011
+#define GL_LUMINANCE_ALPHA_SNORM 0x9012
+#define GL_INTENSITY_SNORM 0x9013
+#define GL_ALPHA8_SNORM 0x9014
+#define GL_LUMINANCE8_SNORM 0x9015
+#define GL_LUMINANCE8_ALPHA8_SNORM 0x9016
+#define GL_INTENSITY8_SNORM 0x9017
+#define GL_ALPHA16_SNORM 0x9018
+#define GL_LUMINANCE16_SNORM 0x9019
+#define GL_LUMINANCE16_ALPHA16_SNORM 0x901A
+#define GL_INTENSITY16_SNORM 0x901B
+/* reuse GL_RED_SNORM */
+/* reuse GL_RG_SNORM */
+/* reuse GL_RGB_SNORM */
+/* reuse GL_RGBA_SNORM */
+/* reuse GL_R8_SNORM */
+/* reuse GL_RG8_SNORM */
+/* reuse GL_RGB8_SNORM */
+/* reuse GL_RGBA8_SNORM */
+/* reuse GL_R16_SNORM */
+/* reuse GL_RG16_SNORM */
+/* reuse GL_RGB16_SNORM */
+/* reuse GL_RGBA16_SNORM */
+/* reuse GL_SIGNED_NORMALIZED */
+#endif
+
+#ifndef GL_AMD_draw_buffers_blend
+#endif
+
+#ifndef GL_APPLE_texture_range
+#define GL_TEXTURE_RANGE_LENGTH_APPLE 0x85B7
+#define GL_TEXTURE_RANGE_POINTER_APPLE 0x85B8
+#define GL_TEXTURE_STORAGE_HINT_APPLE 0x85BC
+#define GL_STORAGE_PRIVATE_APPLE 0x85BD
+/* reuse GL_STORAGE_CACHED_APPLE */
+/* reuse GL_STORAGE_SHARED_APPLE */
+#endif
+
+#ifndef GL_APPLE_float_pixels
+#define GL_HALF_APPLE 0x140B
+#define GL_RGBA_FLOAT32_APPLE 0x8814
+#define GL_RGB_FLOAT32_APPLE 0x8815
+#define GL_ALPHA_FLOAT32_APPLE 0x8816
+#define GL_INTENSITY_FLOAT32_APPLE 0x8817
+#define GL_LUMINANCE_FLOAT32_APPLE 0x8818
+#define GL_LUMINANCE_ALPHA_FLOAT32_APPLE 0x8819
+#define GL_RGBA_FLOAT16_APPLE 0x881A
+#define GL_RGB_FLOAT16_APPLE 0x881B
+#define GL_ALPHA_FLOAT16_APPLE 0x881C
+#define GL_INTENSITY_FLOAT16_APPLE 0x881D
+#define GL_LUMINANCE_FLOAT16_APPLE 0x881E
+#define GL_LUMINANCE_ALPHA_FLOAT16_APPLE 0x881F
+#define GL_COLOR_FLOAT_APPLE 0x8A0F
+#endif
+
+#ifndef GL_APPLE_vertex_program_evaluators
+#define GL_VERTEX_ATTRIB_MAP1_APPLE 0x8A00
+#define GL_VERTEX_ATTRIB_MAP2_APPLE 0x8A01
+#define GL_VERTEX_ATTRIB_MAP1_SIZE_APPLE 0x8A02
+#define GL_VERTEX_ATTRIB_MAP1_COEFF_APPLE 0x8A03
+#define GL_VERTEX_ATTRIB_MAP1_ORDER_APPLE 0x8A04
+#define GL_VERTEX_ATTRIB_MAP1_DOMAIN_APPLE 0x8A05
+#define GL_VERTEX_ATTRIB_MAP2_SIZE_APPLE 0x8A06
+#define GL_VERTEX_ATTRIB_MAP2_COEFF_APPLE 0x8A07
+#define GL_VERTEX_ATTRIB_MAP2_ORDER_APPLE 0x8A08
+#define GL_VERTEX_ATTRIB_MAP2_DOMAIN_APPLE 0x8A09
+#endif
+
+#ifndef GL_APPLE_aux_depth_stencil
+#define GL_AUX_DEPTH_STENCIL_APPLE 0x8A14
+#endif
+
+#ifndef GL_APPLE_object_purgeable
+#define GL_BUFFER_OBJECT_APPLE 0x85B3
+#define GL_RELEASED_APPLE 0x8A19
+#define GL_VOLATILE_APPLE 0x8A1A
+#define GL_RETAINED_APPLE 0x8A1B
+#define GL_UNDEFINED_APPLE 0x8A1C
+#define GL_PURGEABLE_APPLE 0x8A1D
+#endif
+
+#ifndef GL_APPLE_row_bytes
+#define GL_PACK_ROW_BYTES_APPLE 0x8A15
+#define GL_UNPACK_ROW_BYTES_APPLE 0x8A16
+#endif
+
+#ifndef GL_APPLE_rgb_422
+#define GL_RGB_422_APPLE 0x8A1F
+/* reuse GL_UNSIGNED_SHORT_8_8_APPLE */
+/* reuse GL_UNSIGNED_SHORT_8_8_REV_APPLE */
+#endif
+
+#ifndef GL_NV_video_capture
+#define GL_VIDEO_BUFFER_NV 0x9020
+#define GL_VIDEO_BUFFER_BINDING_NV 0x9021
+#define GL_FIELD_UPPER_NV 0x9022
+#define GL_FIELD_LOWER_NV 0x9023
+#define GL_NUM_VIDEO_CAPTURE_STREAMS_NV 0x9024
+#define GL_NEXT_VIDEO_CAPTURE_BUFFER_STATUS_NV 0x9025
+#define GL_VIDEO_CAPTURE_TO_422_SUPPORTED_NV 0x9026
+#define GL_LAST_VIDEO_CAPTURE_STATUS_NV 0x9027
+#define GL_VIDEO_BUFFER_PITCH_NV 0x9028
+#define GL_VIDEO_COLOR_CONVERSION_MATRIX_NV 0x9029
+#define GL_VIDEO_COLOR_CONVERSION_MAX_NV 0x902A
+#define GL_VIDEO_COLOR_CONVERSION_MIN_NV 0x902B
+#define GL_VIDEO_COLOR_CONVERSION_OFFSET_NV 0x902C
+#define GL_VIDEO_BUFFER_INTERNAL_FORMAT_NV 0x902D
+#define GL_PARTIAL_SUCCESS_NV 0x902E
+#define GL_SUCCESS_NV 0x902F
+#define GL_FAILURE_NV 0x9030
+#define GL_YCBYCR8_422_NV 0x9031
+#define GL_YCBAYCR8A_4224_NV 0x9032
+#define GL_Z6Y10Z6CB10Z6Y10Z6CR10_422_NV 0x9033
+#define GL_Z6Y10Z6CB10Z6A10Z6Y10Z6CR10Z6A10_4224_NV 0x9034
+#define GL_Z4Y12Z4CB12Z4Y12Z4CR12_422_NV 0x9035
+#define GL_Z4Y12Z4CB12Z4A12Z4Y12Z4CR12Z4A12_4224_NV 0x9036
+#define GL_Z4Y12Z4CB12Z4CR12_444_NV 0x9037
+#define GL_VIDEO_CAPTURE_FRAME_WIDTH_NV 0x9038
+#define GL_VIDEO_CAPTURE_FRAME_HEIGHT_NV 0x9039
+#define GL_VIDEO_CAPTURE_FIELD_UPPER_HEIGHT_NV 0x903A
+#define GL_VIDEO_CAPTURE_FIELD_LOWER_HEIGHT_NV 0x903B
+#define GL_VIDEO_CAPTURE_SURFACE_ORIGIN_NV 0x903C
+#endif
+
+#ifndef GL_NV_copy_image
+#endif
+
+#ifndef GL_EXT_separate_shader_objects
+#define GL_ACTIVE_PROGRAM_EXT 0x8B8D
+#endif
+
+#ifndef GL_NV_parameter_buffer_object2
+#endif
+
+#ifndef GL_NV_shader_buffer_load
+#define GL_BUFFER_GPU_ADDRESS_NV 0x8F1D
+#define GL_GPU_ADDRESS_NV 0x8F34
+#define GL_MAX_SHADER_BUFFER_ADDRESS_NV 0x8F35
+#endif
+
+#ifndef GL_NV_vertex_buffer_unified_memory
+#define GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV 0x8F1E
+#define GL_ELEMENT_ARRAY_UNIFIED_NV 0x8F1F
+#define GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV 0x8F20
+#define GL_VERTEX_ARRAY_ADDRESS_NV 0x8F21
+#define GL_NORMAL_ARRAY_ADDRESS_NV 0x8F22
+#define GL_COLOR_ARRAY_ADDRESS_NV 0x8F23
+#define GL_INDEX_ARRAY_ADDRESS_NV 0x8F24
+#define GL_TEXTURE_COORD_ARRAY_ADDRESS_NV 0x8F25
+#define GL_EDGE_FLAG_ARRAY_ADDRESS_NV 0x8F26
+#define GL_SECONDARY_COLOR_ARRAY_ADDRESS_NV 0x8F27
+#define GL_FOG_COORD_ARRAY_ADDRESS_NV 0x8F28
+#define GL_ELEMENT_ARRAY_ADDRESS_NV 0x8F29
+#define GL_VERTEX_ATTRIB_ARRAY_LENGTH_NV 0x8F2A
+#define GL_VERTEX_ARRAY_LENGTH_NV 0x8F2B
+#define GL_NORMAL_ARRAY_LENGTH_NV 0x8F2C
+#define GL_COLOR_ARRAY_LENGTH_NV 0x8F2D
+#define GL_INDEX_ARRAY_LENGTH_NV 0x8F2E
+#define GL_TEXTURE_COORD_ARRAY_LENGTH_NV 0x8F2F
+#define GL_EDGE_FLAG_ARRAY_LENGTH_NV 0x8F30
+#define GL_SECONDARY_COLOR_ARRAY_LENGTH_NV 0x8F31
+#define GL_FOG_COORD_ARRAY_LENGTH_NV 0x8F32
+#define GL_ELEMENT_ARRAY_LENGTH_NV 0x8F33
+#define GL_DRAW_INDIRECT_UNIFIED_NV 0x8F40
+#define GL_DRAW_INDIRECT_ADDRESS_NV 0x8F41
+#define GL_DRAW_INDIRECT_LENGTH_NV 0x8F42
+#endif
+
+#ifndef GL_NV_texture_barrier
+#endif
+
+#ifndef GL_AMD_shader_stencil_export
+#endif
+
+#ifndef GL_AMD_seamless_cubemap_per_texture
+/* reuse GL_TEXTURE_CUBE_MAP_SEAMLESS */
+#endif
+
+#ifndef GL_AMD_conservative_depth
+#endif
+
+#ifndef GL_EXT_shader_image_load_store
+#define GL_MAX_IMAGE_UNITS_EXT 0x8F38
+#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS_EXT 0x8F39
+#define GL_IMAGE_BINDING_NAME_EXT 0x8F3A
+#define GL_IMAGE_BINDING_LEVEL_EXT 0x8F3B
+#define GL_IMAGE_BINDING_LAYERED_EXT 0x8F3C
+#define GL_IMAGE_BINDING_LAYER_EXT 0x8F3D
+#define GL_IMAGE_BINDING_ACCESS_EXT 0x8F3E
+#define GL_IMAGE_1D_EXT 0x904C
+#define GL_IMAGE_2D_EXT 0x904D
+#define GL_IMAGE_3D_EXT 0x904E
+#define GL_IMAGE_2D_RECT_EXT 0x904F
+#define GL_IMAGE_CUBE_EXT 0x9050
+#define GL_IMAGE_BUFFER_EXT 0x9051
+#define GL_IMAGE_1D_ARRAY_EXT 0x9052
+#define GL_IMAGE_2D_ARRAY_EXT 0x9053
+#define GL_IMAGE_CUBE_MAP_ARRAY_EXT 0x9054
+#define GL_IMAGE_2D_MULTISAMPLE_EXT 0x9055
+#define GL_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9056
+#define GL_INT_IMAGE_1D_EXT 0x9057
+#define GL_INT_IMAGE_2D_EXT 0x9058
+#define GL_INT_IMAGE_3D_EXT 0x9059
+#define GL_INT_IMAGE_2D_RECT_EXT 0x905A
+#define GL_INT_IMAGE_CUBE_EXT 0x905B
+#define GL_INT_IMAGE_BUFFER_EXT 0x905C
+#define GL_INT_IMAGE_1D_ARRAY_EXT 0x905D
+#define GL_INT_IMAGE_2D_ARRAY_EXT 0x905E
+#define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x905F
+#define GL_INT_IMAGE_2D_MULTISAMPLE_EXT 0x9060
+#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9061
+#define GL_UNSIGNED_INT_IMAGE_1D_EXT 0x9062
+#define GL_UNSIGNED_INT_IMAGE_2D_EXT 0x9063
+#define GL_UNSIGNED_INT_IMAGE_3D_EXT 0x9064
+#define GL_UNSIGNED_INT_IMAGE_2D_RECT_EXT 0x9065
+#define GL_UNSIGNED_INT_IMAGE_CUBE_EXT 0x9066
+#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT 0x9067
+#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY_EXT 0x9068
+#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY_EXT 0x9069
+#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A
+#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_EXT 0x906B
+#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x906C
+#define GL_MAX_IMAGE_SAMPLES_EXT 0x906D
+#define GL_IMAGE_BINDING_FORMAT_EXT 0x906E
+#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT_EXT 0x00000001
+#define GL_ELEMENT_ARRAY_BARRIER_BIT_EXT 0x00000002
+#define GL_UNIFORM_BARRIER_BIT_EXT 0x00000004
+#define GL_TEXTURE_FETCH_BARRIER_BIT_EXT 0x00000008
+#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT_EXT 0x00000020
+#define GL_COMMAND_BARRIER_BIT_EXT 0x00000040
+#define GL_PIXEL_BUFFER_BARRIER_BIT_EXT 0x00000080
+#define GL_TEXTURE_UPDATE_BARRIER_BIT_EXT 0x00000100
+#define GL_BUFFER_UPDATE_BARRIER_BIT_EXT 0x00000200
+#define GL_FRAMEBUFFER_BARRIER_BIT_EXT 0x00000400
+#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT_EXT 0x00000800
+#define GL_ATOMIC_COUNTER_BARRIER_BIT_EXT 0x00001000
+#define GL_ALL_BARRIER_BITS_EXT 0xFFFFFFFF
+#endif
+
+#ifndef GL_EXT_vertex_attrib_64bit
+/* reuse GL_DOUBLE */
+#define GL_DOUBLE_VEC2_EXT 0x8FFC
+#define GL_DOUBLE_VEC3_EXT 0x8FFD
+#define GL_DOUBLE_VEC4_EXT 0x8FFE
+#define GL_DOUBLE_MAT2_EXT 0x8F46
+#define GL_DOUBLE_MAT3_EXT 0x8F47
+#define GL_DOUBLE_MAT4_EXT 0x8F48
+#define GL_DOUBLE_MAT2x3_EXT 0x8F49
+#define GL_DOUBLE_MAT2x4_EXT 0x8F4A
+#define GL_DOUBLE_MAT3x2_EXT 0x8F4B
+#define GL_DOUBLE_MAT3x4_EXT 0x8F4C
+#define GL_DOUBLE_MAT4x2_EXT 0x8F4D
+#define GL_DOUBLE_MAT4x3_EXT 0x8F4E
+#endif
+
+#ifndef GL_NV_gpu_program5
+#define GL_MAX_GEOMETRY_PROGRAM_INVOCATIONS_NV 0x8E5A
+#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5B
+#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5C
+#define GL_FRAGMENT_PROGRAM_INTERPOLATION_OFFSET_BITS_NV 0x8E5D
+#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5E
+#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5F
+#define GL_MAX_PROGRAM_SUBROUTINE_PARAMETERS_NV 0x8F44
+#define GL_MAX_PROGRAM_SUBROUTINE_NUM_NV 0x8F45
+#endif
+
+#ifndef GL_NV_gpu_shader5
+#define GL_INT64_NV 0x140E
+#define GL_UNSIGNED_INT64_NV 0x140F
+#define GL_INT8_NV 0x8FE0
+#define GL_INT8_VEC2_NV 0x8FE1
+#define GL_INT8_VEC3_NV 0x8FE2
+#define GL_INT8_VEC4_NV 0x8FE3
+#define GL_INT16_NV 0x8FE4
+#define GL_INT16_VEC2_NV 0x8FE5
+#define GL_INT16_VEC3_NV 0x8FE6
+#define GL_INT16_VEC4_NV 0x8FE7
+#define GL_INT64_VEC2_NV 0x8FE9
+#define GL_INT64_VEC3_NV 0x8FEA
+#define GL_INT64_VEC4_NV 0x8FEB
+#define GL_UNSIGNED_INT8_NV 0x8FEC
+#define GL_UNSIGNED_INT8_VEC2_NV 0x8FED
+#define GL_UNSIGNED_INT8_VEC3_NV 0x8FEE
+#define GL_UNSIGNED_INT8_VEC4_NV 0x8FEF
+#define GL_UNSIGNED_INT16_NV 0x8FF0
+#define GL_UNSIGNED_INT16_VEC2_NV 0x8FF1
+#define GL_UNSIGNED_INT16_VEC3_NV 0x8FF2
+#define GL_UNSIGNED_INT16_VEC4_NV 0x8FF3
+#define GL_UNSIGNED_INT64_VEC2_NV 0x8FF5
+#define GL_UNSIGNED_INT64_VEC3_NV 0x8FF6
+#define GL_UNSIGNED_INT64_VEC4_NV 0x8FF7
+#define GL_FLOAT16_NV 0x8FF8
+#define GL_FLOAT16_VEC2_NV 0x8FF9
+#define GL_FLOAT16_VEC3_NV 0x8FFA
+#define GL_FLOAT16_VEC4_NV 0x8FFB
+/* reuse GL_PATCHES */
+#endif
+
+#ifndef GL_NV_shader_buffer_store
+#define GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV 0x00000010
+/* reuse GL_READ_WRITE */
+/* reuse GL_WRITE_ONLY */
+#endif
+
+#ifndef GL_NV_tessellation_program5
+#define GL_MAX_PROGRAM_PATCH_ATTRIBS_NV 0x86D8
+#define GL_TESS_CONTROL_PROGRAM_NV 0x891E
+#define GL_TESS_EVALUATION_PROGRAM_NV 0x891F
+#define GL_TESS_CONTROL_PROGRAM_PARAMETER_BUFFER_NV 0x8C74
+#define GL_TESS_EVALUATION_PROGRAM_PARAMETER_BUFFER_NV 0x8C75
+#endif
+
+#ifndef GL_NV_vertex_attrib_integer_64bit
+/* reuse GL_INT64_NV */
+/* reuse GL_UNSIGNED_INT64_NV */
+#endif
+
+#ifndef GL_NV_multisample_coverage
+#define GL_COVERAGE_SAMPLES_NV 0x80A9
+#define GL_COLOR_SAMPLES_NV 0x8E20
+#endif
+
+#ifndef GL_AMD_name_gen_delete
+#define GL_DATA_BUFFER_AMD 0x9151
+#define GL_PERFORMANCE_MONITOR_AMD 0x9152
+#define GL_QUERY_OBJECT_AMD 0x9153
+#define GL_VERTEX_ARRAY_OBJECT_AMD 0x9154
+#define GL_SAMPLER_OBJECT_AMD 0x9155
+#endif
+
+#ifndef GL_AMD_debug_output
+#define GL_MAX_DEBUG_LOGGED_MESSAGES_AMD 0x9144
+#define GL_DEBUG_LOGGED_MESSAGES_AMD 0x9145
+#define GL_DEBUG_SEVERITY_HIGH_AMD 0x9146
+#define GL_DEBUG_SEVERITY_MEDIUM_AMD 0x9147
+#define GL_DEBUG_SEVERITY_LOW_AMD 0x9148
+#define GL_DEBUG_CATEGORY_API_ERROR_AMD 0x9149
+#define GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD 0x914A
+#define GL_DEBUG_CATEGORY_DEPRECATION_AMD 0x914B
+#define GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD 0x914C
+#define GL_DEBUG_CATEGORY_PERFORMANCE_AMD 0x914D
+#define GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD 0x914E
+#define GL_DEBUG_CATEGORY_APPLICATION_AMD 0x914F
+#define GL_DEBUG_CATEGORY_OTHER_AMD 0x9150
+#endif
+
+#ifndef GL_NV_vdpau_interop
+#define GL_SURFACE_STATE_NV 0x86EB
+#define GL_SURFACE_REGISTERED_NV 0x86FD
+#define GL_SURFACE_MAPPED_NV 0x8700
+#define GL_WRITE_DISCARD_NV 0x88BE
+#endif
+
+#ifndef GL_AMD_transform_feedback3_lines_triangles
+#endif
+
+#ifndef GL_AMD_depth_clamp_separate
+#define GL_DEPTH_CLAMP_NEAR_AMD 0x901E
+#define GL_DEPTH_CLAMP_FAR_AMD 0x901F
+#endif
+
+#ifndef GL_EXT_texture_sRGB_decode
+#define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48
+#define GL_DECODE_EXT 0x8A49
+#define GL_SKIP_DECODE_EXT 0x8A4A
+#endif
+
+#ifndef GL_NV_texture_multisample
+#define GL_TEXTURE_COVERAGE_SAMPLES_NV 0x9045
+#define GL_TEXTURE_COLOR_SAMPLES_NV 0x9046
+#endif
+
+#ifndef GL_AMD_blend_minmax_factor
+#define GL_FACTOR_MIN_AMD 0x901C
+#define GL_FACTOR_MAX_AMD 0x901D
+#endif
+
+#ifndef GL_AMD_sample_positions
+#define GL_SUBSAMPLE_DISTANCE_AMD 0x883F
+#endif
+
+#ifndef GL_EXT_x11_sync_object
+#define GL_SYNC_X11_FENCE_EXT 0x90E1
+#endif
+
+#ifndef GL_AMD_multi_draw_indirect
+#endif
+
+#ifndef GL_EXT_framebuffer_multisample_blit_scaled
+#define GL_SCALED_RESOLVE_FASTEST_EXT 0x90BA
+#define GL_SCALED_RESOLVE_NICEST_EXT 0x90BB
+#endif
+
+
+/*************************************************************/
+
+#include <stddef.h>
+#ifndef GL_VERSION_2_0
+/* GL type for program/shader text */
+typedef char GLchar;
+#endif
+
+#ifndef GL_VERSION_1_5
+/* GL types for handling large vertex buffer objects */
+typedef ptrdiff_t GLintptr;
+typedef ptrdiff_t GLsizeiptr;
+#endif
+
+#ifndef GL_ARB_vertex_buffer_object
+/* GL types for handling large vertex buffer objects */
+typedef ptrdiff_t GLintptrARB;
+typedef ptrdiff_t GLsizeiptrARB;
+#endif
+
+#ifndef GL_ARB_shader_objects
+/* GL types for program/shader text and shader object handles */
+typedef char GLcharARB;
+typedef unsigned int GLhandleARB;
+#endif
+
+/* GL type for "half" precision (s10e5) float data in host memory */
+#ifndef GL_ARB_half_float_pixel
+typedef unsigned short GLhalfARB;
+#endif
+
+#ifndef GL_NV_half_float
+typedef unsigned short GLhalfNV;
+#endif
+
+#ifndef GLEXT_64_TYPES_DEFINED
+/* This code block is duplicated in glxext.h, so must be protected */
+#define GLEXT_64_TYPES_DEFINED
+/* Define int32_t, int64_t, and uint64_t types for UST/MSC */
+/* (as used in the GL_EXT_timer_query extension). */
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#include <inttypes.h>
+#elif defined(__sun__) || defined(__digital__)
+#include <inttypes.h>
+#if defined(__STDC__)
+#if defined(__arch64__) || defined(_LP64)
+typedef long int int64_t;
+typedef unsigned long int uint64_t;
+#else
+typedef long long int int64_t;
+typedef unsigned long long int uint64_t;
+#endif /* __arch64__ */
+#endif /* __STDC__ */
+#elif defined( __VMS ) || defined(__sgi)
+#include <inttypes.h>
+#elif defined(__SCO__) || defined(__USLC__)
+#include <stdint.h>
+#elif defined(__UNIXOS2__) || defined(__SOL64__)
+typedef long int int32_t;
+typedef long long int int64_t;
+typedef unsigned long long int uint64_t;
+#elif defined(_WIN32) && defined(__GNUC__)
+#include <stdint.h>
+#elif defined(_WIN32)
+typedef __int32 int32_t;
+typedef __int64 int64_t;
+typedef unsigned __int64 uint64_t;
+#else
+/* Fallback if nothing above works */
+#include <inttypes.h>
+#endif
+#endif
+
+#ifndef GL_EXT_timer_query
+typedef int64_t GLint64EXT;
+typedef uint64_t GLuint64EXT;
+#endif
+
+#ifndef GL_ARB_sync
+typedef int64_t GLint64;
+typedef uint64_t GLuint64;
+typedef struct __GLsync *GLsync;
+#endif
+
+#ifndef GL_ARB_cl_event
+/* These incomplete types let us declare types compatible with OpenCL's cl_context and cl_event */
+struct _cl_context;
+struct _cl_event;
+#endif
+
+#ifndef GL_ARB_debug_output
+typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);
+#endif
+
+#ifndef GL_AMD_debug_output
+typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);
+#endif
+
+#ifndef GL_NV_vdpau_interop
+typedef GLintptr GLvdpauSurfaceNV;
+#endif
+
+#ifndef GL_VERSION_1_2
+#define GL_VERSION_1_2 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+GLAPI void APIENTRY glBlendEquation (GLenum mode);
+GLAPI void APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
+GLAPI void APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
+typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
+typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+#endif
+
+#ifndef GL_VERSION_1_2_DEPRECATED
+#define GL_VERSION_1_2_DEPRECATED 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glColorTable (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
+GLAPI void APIENTRY glColorTableParameterfv (GLenum target, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glColorTableParameteriv (GLenum target, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glCopyColorTable (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
+GLAPI void APIENTRY glGetColorTable (GLenum target, GLenum format, GLenum type, GLvoid *table);
+GLAPI void APIENTRY glGetColorTableParameterfv (GLenum target, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetColorTableParameteriv (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glColorSubTable (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);
+GLAPI void APIENTRY glCopyColorSubTable (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
+GLAPI void APIENTRY glConvolutionFilter1D (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);
+GLAPI void APIENTRY glConvolutionFilter2D (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);
+GLAPI void APIENTRY glConvolutionParameterf (GLenum target, GLenum pname, GLfloat params);
+GLAPI void APIENTRY glConvolutionParameterfv (GLenum target, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glConvolutionParameteri (GLenum target, GLenum pname, GLint params);
+GLAPI void APIENTRY glConvolutionParameteriv (GLenum target, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glCopyConvolutionFilter1D (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
+GLAPI void APIENTRY glCopyConvolutionFilter2D (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glGetConvolutionFilter (GLenum target, GLenum format, GLenum type, GLvoid *image);
+GLAPI void APIENTRY glGetConvolutionParameterfv (GLenum target, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetConvolutionParameteriv (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetSeparableFilter (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);
+GLAPI void APIENTRY glSeparableFilter2D (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);
+GLAPI void APIENTRY glGetHistogram (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
+GLAPI void APIENTRY glGetHistogramParameterfv (GLenum target, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetHistogramParameteriv (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetMinmax (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
+GLAPI void APIENTRY glGetMinmaxParameterfv (GLenum target, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetMinmaxParameteriv (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glHistogram (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
+GLAPI void APIENTRY glMinmax (GLenum target, GLenum internalformat, GLboolean sink);
+GLAPI void APIENTRY glResetHistogram (GLenum target);
+GLAPI void APIENTRY glResetMinmax (GLenum target);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
+typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
+typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
+typedef void (APIENTRYP PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table);
+typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
+typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);
+typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);
+typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params);
+typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
+typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params);
+typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
+typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image);
+typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);
+typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);
+typedef void (APIENTRYP PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
+typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
+typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
+typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink);
+typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target);
+typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target);
+#endif
+
+#ifndef GL_VERSION_1_3
+#define GL_VERSION_1_3 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glActiveTexture (GLenum texture);
+GLAPI void APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
+GLAPI void APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
+GLAPI void APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
+GLAPI void APIENTRY glCompressedTexImage1D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
+GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
+GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
+GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
+GLAPI void APIENTRY glGetCompressedTexImage (GLenum target, GLint level, GLvoid *img);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
+typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img);
+#endif
+
+#ifndef GL_VERSION_1_3_DEPRECATED
+#define GL_VERSION_1_3_DEPRECATED 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glClientActiveTexture (GLenum texture);
+GLAPI void APIENTRY glMultiTexCoord1d (GLenum target, GLdouble s);
+GLAPI void APIENTRY glMultiTexCoord1dv (GLenum target, const GLdouble *v);
+GLAPI void APIENTRY glMultiTexCoord1f (GLenum target, GLfloat s);
+GLAPI void APIENTRY glMultiTexCoord1fv (GLenum target, const GLfloat *v);
+GLAPI void APIENTRY glMultiTexCoord1i (GLenum target, GLint s);
+GLAPI void APIENTRY glMultiTexCoord1iv (GLenum target, const GLint *v);
+GLAPI void APIENTRY glMultiTexCoord1s (GLenum target, GLshort s);
+GLAPI void APIENTRY glMultiTexCoord1sv (GLenum target, const GLshort *v);
+GLAPI void APIENTRY glMultiTexCoord2d (GLenum target, GLdouble s, GLdouble t);
+GLAPI void APIENTRY glMultiTexCoord2dv (GLenum target, const GLdouble *v);
+GLAPI void APIENTRY glMultiTexCoord2f (GLenum target, GLfloat s, GLfloat t);
+GLAPI void APIENTRY glMultiTexCoord2fv (GLenum target, const GLfloat *v);
+GLAPI void APIENTRY glMultiTexCoord2i (GLenum target, GLint s, GLint t);
+GLAPI void APIENTRY glMultiTexCoord2iv (GLenum target, const GLint *v);
+GLAPI void APIENTRY glMultiTexCoord2s (GLenum target, GLshort s, GLshort t);
+GLAPI void APIENTRY glMultiTexCoord2sv (GLenum target, const GLshort *v);
+GLAPI void APIENTRY glMultiTexCoord3d (GLenum target, GLdouble s, GLdouble t, GLdouble r);
+GLAPI void APIENTRY glMultiTexCoord3dv (GLenum target, const GLdouble *v);
+GLAPI void APIENTRY glMultiTexCoord3f (GLenum target, GLfloat s, GLfloat t, GLfloat r);
+GLAPI void APIENTRY glMultiTexCoord3fv (GLenum target, const GLfloat *v);
+GLAPI void APIENTRY glMultiTexCoord3i (GLenum target, GLint s, GLint t, GLint r);
+GLAPI void APIENTRY glMultiTexCoord3iv (GLenum target, const GLint *v);
+GLAPI void APIENTRY glMultiTexCoord3s (GLenum target, GLshort s, GLshort t, GLshort r);
+GLAPI void APIENTRY glMultiTexCoord3sv (GLenum target, const GLshort *v);
+GLAPI void APIENTRY glMultiTexCoord4d (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
+GLAPI void APIENTRY glMultiTexCoord4dv (GLenum target, const GLdouble *v);
+GLAPI void APIENTRY glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
+GLAPI void APIENTRY glMultiTexCoord4fv (GLenum target, const GLfloat *v);
+GLAPI void APIENTRY glMultiTexCoord4i (GLenum target, GLint s, GLint t, GLint r, GLint q);
+GLAPI void APIENTRY glMultiTexCoord4iv (GLenum target, const GLint *v);
+GLAPI void APIENTRY glMultiTexCoord4s (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
+GLAPI void APIENTRY glMultiTexCoord4sv (GLenum target, const GLshort *v);
+GLAPI void APIENTRY glLoadTransposeMatrixf (const GLfloat *m);
+GLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *m);
+GLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *m);
+GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *m);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v);
+typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m);
+typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m);
+typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m);
+typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m);
+#endif
+
+#ifndef GL_VERSION_1_4
+#define GL_VERSION_1_4 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+GLAPI void APIENTRY glMultiDrawArrays (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
+GLAPI void APIENTRY glMultiDrawElements (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
+GLAPI void APIENTRY glPointParameterf (GLenum pname, GLfloat param);
+GLAPI void APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glPointParameteri (GLenum pname, GLint param);
+GLAPI void APIENTRY glPointParameteriv (GLenum pname, const GLint *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
+typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
+typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param);
+typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params);
+typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param);
+typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params);
+#endif
+
+#ifndef GL_VERSION_1_4_DEPRECATED
+#define GL_VERSION_1_4_DEPRECATED 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glFogCoordf (GLfloat coord);
+GLAPI void APIENTRY glFogCoordfv (const GLfloat *coord);
+GLAPI void APIENTRY glFogCoordd (GLdouble coord);
+GLAPI void APIENTRY glFogCoorddv (const GLdouble *coord);
+GLAPI void APIENTRY glFogCoordPointer (GLenum type, GLsizei stride, const GLvoid *pointer);
+GLAPI void APIENTRY glSecondaryColor3b (GLbyte red, GLbyte green, GLbyte blue);
+GLAPI void APIENTRY glSecondaryColor3bv (const GLbyte *v);
+GLAPI void APIENTRY glSecondaryColor3d (GLdouble red, GLdouble green, GLdouble blue);
+GLAPI void APIENTRY glSecondaryColor3dv (const GLdouble *v);
+GLAPI void APIENTRY glSecondaryColor3f (GLfloat red, GLfloat green, GLfloat blue);
+GLAPI void APIENTRY glSecondaryColor3fv (const GLfloat *v);
+GLAPI void APIENTRY glSecondaryColor3i (GLint red, GLint green, GLint blue);
+GLAPI void APIENTRY glSecondaryColor3iv (const GLint *v);
+GLAPI void APIENTRY glSecondaryColor3s (GLshort red, GLshort green, GLshort blue);
+GLAPI void APIENTRY glSecondaryColor3sv (const GLshort *v);
+GLAPI void APIENTRY glSecondaryColor3ub (GLubyte red, GLubyte green, GLubyte blue);
+GLAPI void APIENTRY glSecondaryColor3ubv (const GLubyte *v);
+GLAPI void APIENTRY glSecondaryColor3ui (GLuint red, GLuint green, GLuint blue);
+GLAPI void APIENTRY glSecondaryColor3uiv (const GLuint *v);
+GLAPI void APIENTRY glSecondaryColor3us (GLushort red, GLushort green, GLushort blue);
+GLAPI void APIENTRY glSecondaryColor3usv (const GLushort *v);
+GLAPI void APIENTRY glSecondaryColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+GLAPI void APIENTRY glWindowPos2d (GLdouble x, GLdouble y);
+GLAPI void APIENTRY glWindowPos2dv (const GLdouble *v);
+GLAPI void APIENTRY glWindowPos2f (GLfloat x, GLfloat y);
+GLAPI void APIENTRY glWindowPos2fv (const GLfloat *v);
+GLAPI void APIENTRY glWindowPos2i (GLint x, GLint y);
+GLAPI void APIENTRY glWindowPos2iv (const GLint *v);
+GLAPI void APIENTRY glWindowPos2s (GLshort x, GLshort y);
+GLAPI void APIENTRY glWindowPos2sv (const GLshort *v);
+GLAPI void APIENTRY glWindowPos3d (GLdouble x, GLdouble y, GLdouble z);
+GLAPI void APIENTRY glWindowPos3dv (const GLdouble *v);
+GLAPI void APIENTRY glWindowPos3f (GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glWindowPos3fv (const GLfloat *v);
+GLAPI void APIENTRY glWindowPos3i (GLint x, GLint y, GLint z);
+GLAPI void APIENTRY glWindowPos3iv (const GLint *v);
+GLAPI void APIENTRY glWindowPos3s (GLshort x, GLshort y, GLshort z);
+GLAPI void APIENTRY glWindowPos3sv (const GLshort *v);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLFOGCOORDFPROC) (GLfloat coord);
+typedef void (APIENTRYP PFNGLFOGCOORDFVPROC) (const GLfloat *coord);
+typedef void (APIENTRYP PFNGLFOGCOORDDPROC) (GLdouble coord);
+typedef void (APIENTRYP PFNGLFOGCOORDDVPROC) (const GLdouble *coord);
+typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v);
+typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+typedef void (APIENTRYP PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y);
+typedef void (APIENTRYP PFNGLWINDOWPOS2DVPROC) (const GLdouble *v);
+typedef void (APIENTRYP PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y);
+typedef void (APIENTRYP PFNGLWINDOWPOS2FVPROC) (const GLfloat *v);
+typedef void (APIENTRYP PFNGLWINDOWPOS2IPROC) (GLint x, GLint y);
+typedef void (APIENTRYP PFNGLWINDOWPOS2IVPROC) (const GLint *v);
+typedef void (APIENTRYP PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y);
+typedef void (APIENTRYP PFNGLWINDOWPOS2SVPROC) (const GLshort *v);
+typedef void (APIENTRYP PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRYP PFNGLWINDOWPOS3DVPROC) (const GLdouble *v);
+typedef void (APIENTRYP PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLWINDOWPOS3FVPROC) (const GLfloat *v);
+typedef void (APIENTRYP PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z);
+typedef void (APIENTRYP PFNGLWINDOWPOS3IVPROC) (const GLint *v);
+typedef void (APIENTRYP PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z);
+typedef void (APIENTRYP PFNGLWINDOWPOS3SVPROC) (const GLshort *v);
+#endif
+
+#ifndef GL_VERSION_1_5
+#define GL_VERSION_1_5 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGenQueries (GLsizei n, GLuint *ids);
+GLAPI void APIENTRY glDeleteQueries (GLsizei n, const GLuint *ids);
+GLAPI GLboolean APIENTRY glIsQuery (GLuint id);
+GLAPI void APIENTRY glBeginQuery (GLenum target, GLuint id);
+GLAPI void APIENTRY glEndQuery (GLenum target);
+GLAPI void APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetQueryObjectiv (GLuint id, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params);
+GLAPI void APIENTRY glBindBuffer (GLenum target, GLuint buffer);
+GLAPI void APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
+GLAPI void APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
+GLAPI GLboolean APIENTRY glIsBuffer (GLuint buffer);
+GLAPI void APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
+GLAPI void APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
+GLAPI void APIENTRY glGetBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data);
+GLAPI GLvoid* APIENTRY glMapBuffer (GLenum target, GLenum access);
+GLAPI GLboolean APIENTRY glUnmapBuffer (GLenum target);
+GLAPI void APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, GLvoid* *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids);
+typedef void (APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids);
+typedef GLboolean (APIENTRYP PFNGLISQUERYPROC) (GLuint id);
+typedef void (APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id);
+typedef void (APIENTRYP PFNGLENDQUERYPROC) (GLenum target);
+typedef void (APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params);
+typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
+typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers);
+typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
+typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer);
+typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
+typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
+typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data);
+typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access);
+typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target);
+typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, GLvoid* *params);
+#endif
+
+#ifndef GL_VERSION_2_0
+#define GL_VERSION_2_0 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
+GLAPI void APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs);
+GLAPI void APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
+GLAPI void APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
+GLAPI void APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
+GLAPI void APIENTRY glAttachShader (GLuint program, GLuint shader);
+GLAPI void APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name);
+GLAPI void APIENTRY glCompileShader (GLuint shader);
+GLAPI GLuint APIENTRY glCreateProgram (void);
+GLAPI GLuint APIENTRY glCreateShader (GLenum type);
+GLAPI void APIENTRY glDeleteProgram (GLuint program);
+GLAPI void APIENTRY glDeleteShader (GLuint shader);
+GLAPI void APIENTRY glDetachShader (GLuint program, GLuint shader);
+GLAPI void APIENTRY glDisableVertexAttribArray (GLuint index);
+GLAPI void APIENTRY glEnableVertexAttribArray (GLuint index);
+GLAPI void APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+GLAPI void APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+GLAPI void APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj);
+GLAPI GLint APIENTRY glGetAttribLocation (GLuint program, const GLchar *name);
+GLAPI void APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GLAPI void APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GLAPI void APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
+GLAPI GLint APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
+GLAPI void APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params);
+GLAPI void APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params);
+GLAPI void APIENTRY glGetVertexAttribdv (GLuint index, GLenum pname, GLdouble *params);
+GLAPI void APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid* *pointer);
+GLAPI GLboolean APIENTRY glIsProgram (GLuint program);
+GLAPI GLboolean APIENTRY glIsShader (GLuint shader);
+GLAPI void APIENTRY glLinkProgram (GLuint program);
+GLAPI void APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length);
+GLAPI void APIENTRY glUseProgram (GLuint program);
+GLAPI void APIENTRY glUniform1f (GLint location, GLfloat v0);
+GLAPI void APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1);
+GLAPI void APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+GLAPI void APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+GLAPI void APIENTRY glUniform1i (GLint location, GLint v0);
+GLAPI void APIENTRY glUniform2i (GLint location, GLint v0, GLint v1);
+GLAPI void APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);
+GLAPI void APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+GLAPI void APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glValidateProgram (GLuint program);
+GLAPI void APIENTRY glVertexAttrib1d (GLuint index, GLdouble x);
+GLAPI void APIENTRY glVertexAttrib1dv (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttrib1f (GLuint index, GLfloat x);
+GLAPI void APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttrib1s (GLuint index, GLshort x);
+GLAPI void APIENTRY glVertexAttrib1sv (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttrib2d (GLuint index, GLdouble x, GLdouble y);
+GLAPI void APIENTRY glVertexAttrib2dv (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y);
+GLAPI void APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttrib2s (GLuint index, GLshort x, GLshort y);
+GLAPI void APIENTRY glVertexAttrib2sv (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttrib3d (GLuint index, GLdouble x, GLdouble y, GLdouble z);
+GLAPI void APIENTRY glVertexAttrib3dv (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttrib3s (GLuint index, GLshort x, GLshort y, GLshort z);
+GLAPI void APIENTRY glVertexAttrib3sv (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttrib4Nbv (GLuint index, const GLbyte *v);
+GLAPI void APIENTRY glVertexAttrib4Niv (GLuint index, const GLint *v);
+GLAPI void APIENTRY glVertexAttrib4Nsv (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttrib4Nub (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
+GLAPI void APIENTRY glVertexAttrib4Nubv (GLuint index, const GLubyte *v);
+GLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint index, const GLuint *v);
+GLAPI void APIENTRY glVertexAttrib4Nusv (GLuint index, const GLushort *v);
+GLAPI void APIENTRY glVertexAttrib4bv (GLuint index, const GLbyte *v);
+GLAPI void APIENTRY glVertexAttrib4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+GLAPI void APIENTRY glVertexAttrib4dv (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GLAPI void APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttrib4iv (GLuint index, const GLint *v);
+GLAPI void APIENTRY glVertexAttrib4s (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
+GLAPI void APIENTRY glVertexAttrib4sv (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttrib4ubv (GLuint index, const GLubyte *v);
+GLAPI void APIENTRY glVertexAttrib4uiv (GLuint index, const GLuint *v);
+GLAPI void APIENTRY glVertexAttrib4usv (GLuint index, const GLushort *v);
+GLAPI void APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha);
+typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs);
+typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
+typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask);
+typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask);
+typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);
+typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name);
+typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader);
+typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void);
+typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type);
+typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program);
+typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader);
+typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader);
+typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index);
+typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
+typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
+typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj);
+typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name);
+typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
+typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name);
+typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble *params);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, GLvoid* *pointer);
+typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program);
+typedef GLboolean (APIENTRYP PFNGLISSHADERPROC) (GLuint shader);
+typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program);
+typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length);
+typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program);
+typedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0);
+typedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1);
+typedef void (APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+typedef void (APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0);
+typedef void (APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1);
+typedef void (APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2);
+typedef void (APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+typedef void (APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
+#endif
+
+#ifndef GL_VERSION_2_1
+#define GL_VERSION_2_1 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+#endif
+
+#ifndef GL_VERSION_3_0
+#define GL_VERSION_3_0 1
+/* OpenGL 3.0 also reuses entry points from these extensions: */
+/* ARB_framebuffer_object */
+/* ARB_map_buffer_range */
+/* ARB_vertex_array_object */
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glColorMaski (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
+GLAPI void APIENTRY glGetBooleani_v (GLenum target, GLuint index, GLboolean *data);
+GLAPI void APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint *data);
+GLAPI void APIENTRY glEnablei (GLenum target, GLuint index);
+GLAPI void APIENTRY glDisablei (GLenum target, GLuint index);
+GLAPI GLboolean APIENTRY glIsEnabledi (GLenum target, GLuint index);
+GLAPI void APIENTRY glBeginTransformFeedback (GLenum primitiveMode);
+GLAPI void APIENTRY glEndTransformFeedback (void);
+GLAPI void APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+GLAPI void APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer);
+GLAPI void APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode);
+GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
+GLAPI void APIENTRY glClampColor (GLenum target, GLenum clamp);
+GLAPI void APIENTRY glBeginConditionalRender (GLuint id, GLenum mode);
+GLAPI void APIENTRY glEndConditionalRender (void);
+GLAPI void APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+GLAPI void APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params);
+GLAPI void APIENTRY glVertexAttribI1i (GLuint index, GLint x);
+GLAPI void APIENTRY glVertexAttribI2i (GLuint index, GLint x, GLint y);
+GLAPI void APIENTRY glVertexAttribI3i (GLuint index, GLint x, GLint y, GLint z);
+GLAPI void APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w);
+GLAPI void APIENTRY glVertexAttribI1ui (GLuint index, GLuint x);
+GLAPI void APIENTRY glVertexAttribI2ui (GLuint index, GLuint x, GLuint y);
+GLAPI void APIENTRY glVertexAttribI3ui (GLuint index, GLuint x, GLuint y, GLuint z);
+GLAPI void APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+GLAPI void APIENTRY glVertexAttribI1iv (GLuint index, const GLint *v);
+GLAPI void APIENTRY glVertexAttribI2iv (GLuint index, const GLint *v);
+GLAPI void APIENTRY glVertexAttribI3iv (GLuint index, const GLint *v);
+GLAPI void APIENTRY glVertexAttribI4iv (GLuint index, const GLint *v);
+GLAPI void APIENTRY glVertexAttribI1uiv (GLuint index, const GLuint *v);
+GLAPI void APIENTRY glVertexAttribI2uiv (GLuint index, const GLuint *v);
+GLAPI void APIENTRY glVertexAttribI3uiv (GLuint index, const GLuint *v);
+GLAPI void APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint *v);
+GLAPI void APIENTRY glVertexAttribI4bv (GLuint index, const GLbyte *v);
+GLAPI void APIENTRY glVertexAttribI4sv (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttribI4ubv (GLuint index, const GLubyte *v);
+GLAPI void APIENTRY glVertexAttribI4usv (GLuint index, const GLushort *v);
+GLAPI void APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint *params);
+GLAPI void APIENTRY glBindFragDataLocation (GLuint program, GLuint color, const GLchar *name);
+GLAPI GLint APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name);
+GLAPI void APIENTRY glUniform1ui (GLint location, GLuint v0);
+GLAPI void APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1);
+GLAPI void APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2);
+GLAPI void APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+GLAPI void APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glTexParameterIiv (GLenum target, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glTexParameterIuiv (GLenum target, GLenum pname, const GLuint *params);
+GLAPI void APIENTRY glGetTexParameterIiv (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetTexParameterIuiv (GLenum target, GLenum pname, GLuint *params);
+GLAPI void APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value);
+GLAPI void APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value);
+GLAPI void APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value);
+GLAPI void APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
+GLAPI const GLubyte * APIENTRY glGetStringi (GLenum name, GLuint index);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCOLORMASKIPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
+typedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC) (GLenum target, GLuint index, GLboolean *data);
+typedef void (APIENTRYP PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint *data);
+typedef void (APIENTRYP PFNGLENABLEIPROC) (GLenum target, GLuint index);
+typedef void (APIENTRYP PFNGLDISABLEIPROC) (GLenum target, GLuint index);
+typedef GLboolean (APIENTRYP PFNGLISENABLEDIPROC) (GLenum target, GLuint index);
+typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode);
+typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void);
+typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer);
+typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode);
+typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
+typedef void (APIENTRYP PFNGLCLAMPCOLORPROC) (GLenum target, GLenum clamp);
+typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC) (GLuint id, GLenum mode);
+typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC) (void);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint *params);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC) (GLuint index, GLint x);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC) (GLuint index, GLint x, GLint y);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC) (GLuint index, GLint x, GLint y, GLint z);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIPROC) (GLuint index, GLuint x);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIPROC) (GLuint index, GLuint x, GLuint y);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVPROC) (GLuint index, const GLint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVPROC) (GLuint index, const GLint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVPROC) (GLuint index, const GLint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC) (GLuint index, const GLuint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC) (GLuint index, const GLuint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC) (GLuint index, const GLuint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC) (GLuint index, const GLbyte *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC) (GLuint index, const GLubyte *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC) (GLuint index, const GLushort *v);
+typedef void (APIENTRYP PFNGLGETUNIFORMUIVPROC) (GLuint program, GLint location, GLuint *params);
+typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONPROC) (GLuint program, GLuint color, const GLchar *name);
+typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONPROC) (GLuint program, const GLchar *name);
+typedef void (APIENTRYP PFNGLUNIFORM1UIPROC) (GLint location, GLuint v0);
+typedef void (APIENTRYP PFNGLUNIFORM2UIPROC) (GLint location, GLuint v0, GLuint v1);
+typedef void (APIENTRYP PFNGLUNIFORM3UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2);
+typedef void (APIENTRYP PFNGLUNIFORM4UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+typedef void (APIENTRYP PFNGLUNIFORM1UIVPROC) (GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLUNIFORM2UIVPROC) (GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLUNIFORM3UIVPROC) (GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLUNIFORM4UIVPROC) (GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, const GLuint *params);
+typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, GLuint *params);
+typedef void (APIENTRYP PFNGLCLEARBUFFERIVPROC) (GLenum buffer, GLint drawbuffer, const GLint *value);
+typedef void (APIENTRYP PFNGLCLEARBUFFERUIVPROC) (GLenum buffer, GLint drawbuffer, const GLuint *value);
+typedef void (APIENTRYP PFNGLCLEARBUFFERFVPROC) (GLenum buffer, GLint drawbuffer, const GLfloat *value);
+typedef void (APIENTRYP PFNGLCLEARBUFFERFIPROC) (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
+typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index);
+#endif
+
+#ifndef GL_VERSION_3_1
+#define GL_VERSION_3_1 1
+/* OpenGL 3.1 also reuses entry points from these extensions: */
+/* ARB_copy_buffer */
+/* ARB_uniform_buffer_object */
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+GLAPI void APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
+GLAPI void APIENTRY glTexBuffer (GLenum target, GLenum internalformat, GLuint buffer);
+GLAPI void APIENTRY glPrimitiveRestartIndex (GLuint index);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
+typedef void (APIENTRYP PFNGLTEXBUFFERPROC) (GLenum target, GLenum internalformat, GLuint buffer);
+typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC) (GLuint index);
+#endif
+
+#ifndef GL_VERSION_3_2
+#define GL_VERSION_3_2 1
+/* OpenGL 3.2 also reuses entry points from these extensions: */
+/* ARB_draw_elements_base_vertex */
+/* ARB_provoking_vertex */
+/* ARB_sync */
+/* ARB_texture_multisample */
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data);
+GLAPI void APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params);
+GLAPI void APIENTRY glFramebufferTexture (GLenum target, GLenum attachment, GLuint texture, GLint level);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data);
+typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
+#endif
+
+#ifndef GL_VERSION_3_3
+#define GL_VERSION_3_3 1
+/* OpenGL 3.3 also reuses entry points from these extensions: */
+/* ARB_blend_func_extended */
+/* ARB_sampler_objects */
+/* ARB_explicit_attrib_location, but it has none */
+/* ARB_occlusion_query2 (no entry points) */
+/* ARB_shader_bit_encoding (no entry points) */
+/* ARB_texture_rgb10_a2ui (no entry points) */
+/* ARB_texture_swizzle (no entry points) */
+/* ARB_timer_query */
+/* ARB_vertex_type_2_10_10_10_rev */
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor);
+#endif
+
+#ifndef GL_VERSION_4_0
+#define GL_VERSION_4_0 1
+/* OpenGL 4.0 also reuses entry points from these extensions: */
+/* ARB_texture_query_lod (no entry points) */
+/* ARB_draw_indirect */
+/* ARB_gpu_shader5 (no entry points) */
+/* ARB_gpu_shader_fp64 */
+/* ARB_shader_subroutine */
+/* ARB_tessellation_shader */
+/* ARB_texture_buffer_object_rgb32 (no entry points) */
+/* ARB_texture_cube_map_array (no entry points) */
+/* ARB_texture_gather (no entry points) */
+/* ARB_transform_feedback2 */
+/* ARB_transform_feedback3 */
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glMinSampleShading (GLclampf value);
+GLAPI void APIENTRY glBlendEquationi (GLuint buf, GLenum mode);
+GLAPI void APIENTRY glBlendEquationSeparatei (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+GLAPI void APIENTRY glBlendFunci (GLuint buf, GLenum src, GLenum dst);
+GLAPI void APIENTRY glBlendFuncSeparatei (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLMINSAMPLESHADINGPROC) (GLclampf value);
+typedef void (APIENTRYP PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode);
+typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+typedef void (APIENTRYP PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst);
+typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+#endif
+
+#ifndef GL_VERSION_4_1
+#define GL_VERSION_4_1 1
+/* OpenGL 4.1 reuses entry points from these extensions: */
+/* ARB_ES2_compatibility */
+/* ARB_get_program_binary */
+/* ARB_separate_shader_objects */
+/* ARB_shader_precision (no entry points) */
+/* ARB_vertex_attrib_64bit */
+/* ARB_viewport_array */
+#endif
+
+#ifndef GL_VERSION_4_2
+#define GL_VERSION_4_2 1
+/* OpenGL 4.2 reuses entry points from these extensions: */
+/* ARB_base_instance */
+/* ARB_shading_language_420pack (no entry points) */
+/* ARB_transform_feedback_instanced */
+/* ARB_compressed_texture_pixel_storage (no entry points) */
+/* ARB_conservative_depth (no entry points) */
+/* ARB_internalformat_query */
+/* ARB_map_buffer_alignment (no entry points) */
+/* ARB_shader_atomic_counters */
+/* ARB_shader_image_load_store */
+/* ARB_shading_language_packing (no entry points) */
+/* ARB_texture_storage */
+#endif
+
+#ifndef GL_ARB_multitexture
+#define GL_ARB_multitexture 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glActiveTextureARB (GLenum texture);
+GLAPI void APIENTRY glClientActiveTextureARB (GLenum texture);
+GLAPI void APIENTRY glMultiTexCoord1dARB (GLenum target, GLdouble s);
+GLAPI void APIENTRY glMultiTexCoord1dvARB (GLenum target, const GLdouble *v);
+GLAPI void APIENTRY glMultiTexCoord1fARB (GLenum target, GLfloat s);
+GLAPI void APIENTRY glMultiTexCoord1fvARB (GLenum target, const GLfloat *v);
+GLAPI void APIENTRY glMultiTexCoord1iARB (GLenum target, GLint s);
+GLAPI void APIENTRY glMultiTexCoord1ivARB (GLenum target, const GLint *v);
+GLAPI void APIENTRY glMultiTexCoord1sARB (GLenum target, GLshort s);
+GLAPI void APIENTRY glMultiTexCoord1svARB (GLenum target, const GLshort *v);
+GLAPI void APIENTRY glMultiTexCoord2dARB (GLenum target, GLdouble s, GLdouble t);
+GLAPI void APIENTRY glMultiTexCoord2dvARB (GLenum target, const GLdouble *v);
+GLAPI void APIENTRY glMultiTexCoord2fARB (GLenum target, GLfloat s, GLfloat t);
+GLAPI void APIENTRY glMultiTexCoord2fvARB (GLenum target, const GLfloat *v);
+GLAPI void APIENTRY glMultiTexCoord2iARB (GLenum target, GLint s, GLint t);
+GLAPI void APIENTRY glMultiTexCoord2ivARB (GLenum target, const GLint *v);
+GLAPI void APIENTRY glMultiTexCoord2sARB (GLenum target, GLshort s, GLshort t);
+GLAPI void APIENTRY glMultiTexCoord2svARB (GLenum target, const GLshort *v);
+GLAPI void APIENTRY glMultiTexCoord3dARB (GLenum target, GLdouble s, GLdouble t, GLdouble r);
+GLAPI void APIENTRY glMultiTexCoord3dvARB (GLenum target, const GLdouble *v);
+GLAPI void APIENTRY glMultiTexCoord3fARB (GLenum target, GLfloat s, GLfloat t, GLfloat r);
+GLAPI void APIENTRY glMultiTexCoord3fvARB (GLenum target, const GLfloat *v);
+GLAPI void APIENTRY glMultiTexCoord3iARB (GLenum target, GLint s, GLint t, GLint r);
+GLAPI void APIENTRY glMultiTexCoord3ivARB (GLenum target, const GLint *v);
+GLAPI void APIENTRY glMultiTexCoord3sARB (GLenum target, GLshort s, GLshort t, GLshort r);
+GLAPI void APIENTRY glMultiTexCoord3svARB (GLenum target, const GLshort *v);
+GLAPI void APIENTRY glMultiTexCoord4dARB (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
+GLAPI void APIENTRY glMultiTexCoord4dvARB (GLenum target, const GLdouble *v);
+GLAPI void APIENTRY glMultiTexCoord4fARB (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
+GLAPI void APIENTRY glMultiTexCoord4fvARB (GLenum target, const GLfloat *v);
+GLAPI void APIENTRY glMultiTexCoord4iARB (GLenum target, GLint s, GLint t, GLint r, GLint q);
+GLAPI void APIENTRY glMultiTexCoord4ivARB (GLenum target, const GLint *v);
+GLAPI void APIENTRY glMultiTexCoord4sARB (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
+GLAPI void APIENTRY glMultiTexCoord4svARB (GLenum target, const GLshort *v);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture);
+typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v);
+#endif
+
+#ifndef GL_ARB_transpose_matrix
+#define GL_ARB_transpose_matrix 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glLoadTransposeMatrixfARB (const GLfloat *m);
+GLAPI void APIENTRY glLoadTransposeMatrixdARB (const GLdouble *m);
+GLAPI void APIENTRY glMultTransposeMatrixfARB (const GLfloat *m);
+GLAPI void APIENTRY glMultTransposeMatrixdARB (const GLdouble *m);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFARBPROC) (const GLfloat *m);
+typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDARBPROC) (const GLdouble *m);
+typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFARBPROC) (const GLfloat *m);
+typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m);
+#endif
+
+#ifndef GL_ARB_multisample
+#define GL_ARB_multisample 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glSampleCoverageARB (GLclampf value, GLboolean invert);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert);
+#endif
+
+#ifndef GL_ARB_texture_env_add
+#define GL_ARB_texture_env_add 1
+#endif
+
+#ifndef GL_ARB_texture_cube_map
+#define GL_ARB_texture_cube_map 1
+#endif
+
+#ifndef GL_ARB_texture_compression
+#define GL_ARB_texture_compression 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glCompressedTexImage3DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
+GLAPI void APIENTRY glCompressedTexImage2DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
+GLAPI void APIENTRY glCompressedTexImage1DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
+GLAPI void APIENTRY glCompressedTexSubImage3DARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
+GLAPI void APIENTRY glCompressedTexSubImage2DARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
+GLAPI void APIENTRY glCompressedTexSubImage1DARB (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
+GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum target, GLint level, GLvoid *img);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
+typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint level, GLvoid *img);
+#endif
+
+#ifndef GL_ARB_texture_border_clamp
+#define GL_ARB_texture_border_clamp 1
+#endif
+
+#ifndef GL_ARB_point_parameters
+#define GL_ARB_point_parameters 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glPointParameterfARB (GLenum pname, GLfloat param);
+GLAPI void APIENTRY glPointParameterfvARB (GLenum pname, const GLfloat *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param);
+typedef void (APIENTRYP PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat *params);
+#endif
+
+#ifndef GL_ARB_vertex_blend
+#define GL_ARB_vertex_blend 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glWeightbvARB (GLint size, const GLbyte *weights);
+GLAPI void APIENTRY glWeightsvARB (GLint size, const GLshort *weights);
+GLAPI void APIENTRY glWeightivARB (GLint size, const GLint *weights);
+GLAPI void APIENTRY glWeightfvARB (GLint size, const GLfloat *weights);
+GLAPI void APIENTRY glWeightdvARB (GLint size, const GLdouble *weights);
+GLAPI void APIENTRY glWeightubvARB (GLint size, const GLubyte *weights);
+GLAPI void APIENTRY glWeightusvARB (GLint size, const GLushort *weights);
+GLAPI void APIENTRY glWeightuivARB (GLint size, const GLuint *weights);
+GLAPI void APIENTRY glWeightPointerARB (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+GLAPI void APIENTRY glVertexBlendARB (GLint count);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLWEIGHTBVARBPROC) (GLint size, const GLbyte *weights);
+typedef void (APIENTRYP PFNGLWEIGHTSVARBPROC) (GLint size, const GLshort *weights);
+typedef void (APIENTRYP PFNGLWEIGHTIVARBPROC) (GLint size, const GLint *weights);
+typedef void (APIENTRYP PFNGLWEIGHTFVARBPROC) (GLint size, const GLfloat *weights);
+typedef void (APIENTRYP PFNGLWEIGHTDVARBPROC) (GLint size, const GLdouble *weights);
+typedef void (APIENTRYP PFNGLWEIGHTUBVARBPROC) (GLint size, const GLubyte *weights);
+typedef void (APIENTRYP PFNGLWEIGHTUSVARBPROC) (GLint size, const GLushort *weights);
+typedef void (APIENTRYP PFNGLWEIGHTUIVARBPROC) (GLint size, const GLuint *weights);
+typedef void (APIENTRYP PFNGLWEIGHTPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+typedef void (APIENTRYP PFNGLVERTEXBLENDARBPROC) (GLint count);
+#endif
+
+#ifndef GL_ARB_matrix_palette
+#define GL_ARB_matrix_palette 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glCurrentPaletteMatrixARB (GLint index);
+GLAPI void APIENTRY glMatrixIndexubvARB (GLint size, const GLubyte *indices);
+GLAPI void APIENTRY glMatrixIndexusvARB (GLint size, const GLushort *indices);
+GLAPI void APIENTRY glMatrixIndexuivARB (GLint size, const GLuint *indices);
+GLAPI void APIENTRY glMatrixIndexPointerARB (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCURRENTPALETTEMATRIXARBPROC) (GLint index);
+typedef void (APIENTRYP PFNGLMATRIXINDEXUBVARBPROC) (GLint size, const GLubyte *indices);
+typedef void (APIENTRYP PFNGLMATRIXINDEXUSVARBPROC) (GLint size, const GLushort *indices);
+typedef void (APIENTRYP PFNGLMATRIXINDEXUIVARBPROC) (GLint size, const GLuint *indices);
+typedef void (APIENTRYP PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+#endif
+
+#ifndef GL_ARB_texture_env_combine
+#define GL_ARB_texture_env_combine 1
+#endif
+
+#ifndef GL_ARB_texture_env_crossbar
+#define GL_ARB_texture_env_crossbar 1
+#endif
+
+#ifndef GL_ARB_texture_env_dot3
+#define GL_ARB_texture_env_dot3 1
+#endif
+
+#ifndef GL_ARB_texture_mirrored_repeat
+#define GL_ARB_texture_mirrored_repeat 1
+#endif
+
+#ifndef GL_ARB_depth_texture
+#define GL_ARB_depth_texture 1
+#endif
+
+#ifndef GL_ARB_shadow
+#define GL_ARB_shadow 1
+#endif
+
+#ifndef GL_ARB_shadow_ambient
+#define GL_ARB_shadow_ambient 1
+#endif
+
+#ifndef GL_ARB_window_pos
+#define GL_ARB_window_pos 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glWindowPos2dARB (GLdouble x, GLdouble y);
+GLAPI void APIENTRY glWindowPos2dvARB (const GLdouble *v);
+GLAPI void APIENTRY glWindowPos2fARB (GLfloat x, GLfloat y);
+GLAPI void APIENTRY glWindowPos2fvARB (const GLfloat *v);
+GLAPI void APIENTRY glWindowPos2iARB (GLint x, GLint y);
+GLAPI void APIENTRY glWindowPos2ivARB (const GLint *v);
+GLAPI void APIENTRY glWindowPos2sARB (GLshort x, GLshort y);
+GLAPI void APIENTRY glWindowPos2svARB (const GLshort *v);
+GLAPI void APIENTRY glWindowPos3dARB (GLdouble x, GLdouble y, GLdouble z);
+GLAPI void APIENTRY glWindowPos3dvARB (const GLdouble *v);
+GLAPI void APIENTRY glWindowPos3fARB (GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glWindowPos3fvARB (const GLfloat *v);
+GLAPI void APIENTRY glWindowPos3iARB (GLint x, GLint y, GLint z);
+GLAPI void APIENTRY glWindowPos3ivARB (const GLint *v);
+GLAPI void APIENTRY glWindowPos3sARB (GLshort x, GLshort y, GLshort z);
+GLAPI void APIENTRY glWindowPos3svARB (const GLshort *v);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y);
+typedef void (APIENTRYP PFNGLWINDOWPOS2DVARBPROC) (const GLdouble *v);
+typedef void (APIENTRYP PFNGLWINDOWPOS2FARBPROC) (GLfloat x, GLfloat y);
+typedef void (APIENTRYP PFNGLWINDOWPOS2FVARBPROC) (const GLfloat *v);
+typedef void (APIENTRYP PFNGLWINDOWPOS2IARBPROC) (GLint x, GLint y);
+typedef void (APIENTRYP PFNGLWINDOWPOS2IVARBPROC) (const GLint *v);
+typedef void (APIENTRYP PFNGLWINDOWPOS2SARBPROC) (GLshort x, GLshort y);
+typedef void (APIENTRYP PFNGLWINDOWPOS2SVARBPROC) (const GLshort *v);
+typedef void (APIENTRYP PFNGLWINDOWPOS3DARBPROC) (GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRYP PFNGLWINDOWPOS3DVARBPROC) (const GLdouble *v);
+typedef void (APIENTRYP PFNGLWINDOWPOS3FARBPROC) (GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLWINDOWPOS3FVARBPROC) (const GLfloat *v);
+typedef void (APIENTRYP PFNGLWINDOWPOS3IARBPROC) (GLint x, GLint y, GLint z);
+typedef void (APIENTRYP PFNGLWINDOWPOS3IVARBPROC) (const GLint *v);
+typedef void (APIENTRYP PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort z);
+typedef void (APIENTRYP PFNGLWINDOWPOS3SVARBPROC) (const GLshort *v);
+#endif
+
+#ifndef GL_ARB_vertex_program
+#define GL_ARB_vertex_program 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glVertexAttrib1dARB (GLuint index, GLdouble x);
+GLAPI void APIENTRY glVertexAttrib1dvARB (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttrib1fARB (GLuint index, GLfloat x);
+GLAPI void APIENTRY glVertexAttrib1fvARB (GLuint index, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttrib1sARB (GLuint index, GLshort x);
+GLAPI void APIENTRY glVertexAttrib1svARB (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttrib2dARB (GLuint index, GLdouble x, GLdouble y);
+GLAPI void APIENTRY glVertexAttrib2dvARB (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttrib2fARB (GLuint index, GLfloat x, GLfloat y);
+GLAPI void APIENTRY glVertexAttrib2fvARB (GLuint index, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttrib2sARB (GLuint index, GLshort x, GLshort y);
+GLAPI void APIENTRY glVertexAttrib2svARB (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttrib3dARB (GLuint index, GLdouble x, GLdouble y, GLdouble z);
+GLAPI void APIENTRY glVertexAttrib3dvARB (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttrib3fARB (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glVertexAttrib3fvARB (GLuint index, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttrib3sARB (GLuint index, GLshort x, GLshort y, GLshort z);
+GLAPI void APIENTRY glVertexAttrib3svARB (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttrib4NbvARB (GLuint index, const GLbyte *v);
+GLAPI void APIENTRY glVertexAttrib4NivARB (GLuint index, const GLint *v);
+GLAPI void APIENTRY glVertexAttrib4NsvARB (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttrib4NubARB (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
+GLAPI void APIENTRY glVertexAttrib4NubvARB (GLuint index, const GLubyte *v);
+GLAPI void APIENTRY glVertexAttrib4NuivARB (GLuint index, const GLuint *v);
+GLAPI void APIENTRY glVertexAttrib4NusvARB (GLuint index, const GLushort *v);
+GLAPI void APIENTRY glVertexAttrib4bvARB (GLuint index, const GLbyte *v);
+GLAPI void APIENTRY glVertexAttrib4dARB (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+GLAPI void APIENTRY glVertexAttrib4dvARB (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttrib4fARB (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GLAPI void APIENTRY glVertexAttrib4fvARB (GLuint index, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttrib4ivARB (GLuint index, const GLint *v);
+GLAPI void APIENTRY glVertexAttrib4sARB (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
+GLAPI void APIENTRY glVertexAttrib4svARB (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttrib4ubvARB (GLuint index, const GLubyte *v);
+GLAPI void APIENTRY glVertexAttrib4uivARB (GLuint index, const GLuint *v);
+GLAPI void APIENTRY glVertexAttrib4usvARB (GLuint index, const GLushort *v);
+GLAPI void APIENTRY glVertexAttribPointerARB (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
+GLAPI void APIENTRY glEnableVertexAttribArrayARB (GLuint index);
+GLAPI void APIENTRY glDisableVertexAttribArrayARB (GLuint index);
+GLAPI void APIENTRY glProgramStringARB (GLenum target, GLenum format, GLsizei len, const GLvoid *string);
+GLAPI void APIENTRY glBindProgramARB (GLenum target, GLuint program);
+GLAPI void APIENTRY glDeleteProgramsARB (GLsizei n, const GLuint *programs);
+GLAPI void APIENTRY glGenProgramsARB (GLsizei n, GLuint *programs);
+GLAPI void APIENTRY glProgramEnvParameter4dARB (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+GLAPI void APIENTRY glProgramEnvParameter4dvARB (GLenum target, GLuint index, const GLdouble *params);
+GLAPI void APIENTRY glProgramEnvParameter4fARB (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GLAPI void APIENTRY glProgramEnvParameter4fvARB (GLenum target, GLuint index, const GLfloat *params);
+GLAPI void APIENTRY glProgramLocalParameter4dARB (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+GLAPI void APIENTRY glProgramLocalParameter4dvARB (GLenum target, GLuint index, const GLdouble *params);
+GLAPI void APIENTRY glProgramLocalParameter4fARB (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GLAPI void APIENTRY glProgramLocalParameter4fvARB (GLenum target, GLuint index, const GLfloat *params);
+GLAPI void APIENTRY glGetProgramEnvParameterdvARB (GLenum target, GLuint index, GLdouble *params);
+GLAPI void APIENTRY glGetProgramEnvParameterfvARB (GLenum target, GLuint index, GLfloat *params);
+GLAPI void APIENTRY glGetProgramLocalParameterdvARB (GLenum target, GLuint index, GLdouble *params);
+GLAPI void APIENTRY glGetProgramLocalParameterfvARB (GLenum target, GLuint index, GLfloat *params);
+GLAPI void APIENTRY glGetProgramivARB (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetProgramStringARB (GLenum target, GLenum pname, GLvoid *string);
+GLAPI void APIENTRY glGetVertexAttribdvARB (GLuint index, GLenum pname, GLdouble *params);
+GLAPI void APIENTRY glGetVertexAttribfvARB (GLuint index, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetVertexAttribivARB (GLuint index, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetVertexAttribPointervARB (GLuint index, GLenum pname, GLvoid* *pointer);
+GLAPI GLboolean APIENTRY glIsProgramARB (GLuint program);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
+typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index);
+typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index);
+typedef void (APIENTRYP PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const GLvoid *string);
+typedef void (APIENTRYP PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program);
+typedef void (APIENTRYP PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs);
+typedef void (APIENTRYP PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs);
+typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params);
+typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params);
+typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params);
+typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params);
+typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params);
+typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params);
+typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, GLvoid *string);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble *params);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, GLvoid* *pointer);
+typedef GLboolean (APIENTRYP PFNGLISPROGRAMARBPROC) (GLuint program);
+#endif
+
+#ifndef GL_ARB_fragment_program
+#define GL_ARB_fragment_program 1
+/* All ARB_fragment_program entry points are shared with ARB_vertex_program. */
+#endif
+
+#ifndef GL_ARB_vertex_buffer_object
+#define GL_ARB_vertex_buffer_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBindBufferARB (GLenum target, GLuint buffer);
+GLAPI void APIENTRY glDeleteBuffersARB (GLsizei n, const GLuint *buffers);
+GLAPI void APIENTRY glGenBuffersARB (GLsizei n, GLuint *buffers);
+GLAPI GLboolean APIENTRY glIsBufferARB (GLuint buffer);
+GLAPI void APIENTRY glBufferDataARB (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage);
+GLAPI void APIENTRY glBufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data);
+GLAPI void APIENTRY glGetBufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data);
+GLAPI GLvoid* APIENTRY glMapBufferARB (GLenum target, GLenum access);
+GLAPI GLboolean APIENTRY glUnmapBufferARB (GLenum target);
+GLAPI void APIENTRY glGetBufferParameterivARB (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetBufferPointervARB (GLenum target, GLenum pname, GLvoid* *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer);
+typedef void (APIENTRYP PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers);
+typedef void (APIENTRYP PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers);
+typedef GLboolean (APIENTRYP PFNGLISBUFFERARBPROC) (GLuint buffer);
+typedef void (APIENTRYP PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage);
+typedef void (APIENTRYP PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data);
+typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data);
+typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access);
+typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERARBPROC) (GLenum target);
+typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, GLvoid* *params);
+#endif
+
+#ifndef GL_ARB_occlusion_query
+#define GL_ARB_occlusion_query 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGenQueriesARB (GLsizei n, GLuint *ids);
+GLAPI void APIENTRY glDeleteQueriesARB (GLsizei n, const GLuint *ids);
+GLAPI GLboolean APIENTRY glIsQueryARB (GLuint id);
+GLAPI void APIENTRY glBeginQueryARB (GLenum target, GLuint id);
+GLAPI void APIENTRY glEndQueryARB (GLenum target);
+GLAPI void APIENTRY glGetQueryivARB (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetQueryObjectivARB (GLuint id, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetQueryObjectuivARB (GLuint id, GLenum pname, GLuint *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGENQUERIESARBPROC) (GLsizei n, GLuint *ids);
+typedef void (APIENTRYP PFNGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint *ids);
+typedef GLboolean (APIENTRYP PFNGLISQUERYARBPROC) (GLuint id);
+typedef void (APIENTRYP PFNGLBEGINQUERYARBPROC) (GLenum target, GLuint id);
+typedef void (APIENTRYP PFNGLENDQUERYARBPROC) (GLenum target);
+typedef void (APIENTRYP PFNGLGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVARBPROC) (GLuint id, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname, GLuint *params);
+#endif
+
+#ifndef GL_ARB_shader_objects
+#define GL_ARB_shader_objects 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDeleteObjectARB (GLhandleARB obj);
+GLAPI GLhandleARB APIENTRY glGetHandleARB (GLenum pname);
+GLAPI void APIENTRY glDetachObjectARB (GLhandleARB containerObj, GLhandleARB attachedObj);
+GLAPI GLhandleARB APIENTRY glCreateShaderObjectARB (GLenum shaderType);
+GLAPI void APIENTRY glShaderSourceARB (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length);
+GLAPI void APIENTRY glCompileShaderARB (GLhandleARB shaderObj);
+GLAPI GLhandleARB APIENTRY glCreateProgramObjectARB (void);
+GLAPI void APIENTRY glAttachObjectARB (GLhandleARB containerObj, GLhandleARB obj);
+GLAPI void APIENTRY glLinkProgramARB (GLhandleARB programObj);
+GLAPI void APIENTRY glUseProgramObjectARB (GLhandleARB programObj);
+GLAPI void APIENTRY glValidateProgramARB (GLhandleARB programObj);
+GLAPI void APIENTRY glUniform1fARB (GLint location, GLfloat v0);
+GLAPI void APIENTRY glUniform2fARB (GLint location, GLfloat v0, GLfloat v1);
+GLAPI void APIENTRY glUniform3fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+GLAPI void APIENTRY glUniform4fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+GLAPI void APIENTRY glUniform1iARB (GLint location, GLint v0);
+GLAPI void APIENTRY glUniform2iARB (GLint location, GLint v0, GLint v1);
+GLAPI void APIENTRY glUniform3iARB (GLint location, GLint v0, GLint v1, GLint v2);
+GLAPI void APIENTRY glUniform4iARB (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+GLAPI void APIENTRY glUniform1fvARB (GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glUniform2fvARB (GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glUniform3fvARB (GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glUniform4fvARB (GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glUniform1ivARB (GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glUniform2ivARB (GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glUniform3ivARB (GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glUniform4ivARB (GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glUniformMatrix2fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glUniformMatrix3fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glUniformMatrix4fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glGetObjectParameterfvARB (GLhandleARB obj, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetObjectParameterivARB (GLhandleARB obj, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetInfoLogARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog);
+GLAPI void APIENTRY glGetAttachedObjectsARB (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj);
+GLAPI GLint APIENTRY glGetUniformLocationARB (GLhandleARB programObj, const GLcharARB *name);
+GLAPI void APIENTRY glGetActiveUniformARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
+GLAPI void APIENTRY glGetUniformfvARB (GLhandleARB programObj, GLint location, GLfloat *params);
+GLAPI void APIENTRY glGetUniformivARB (GLhandleARB programObj, GLint location, GLint *params);
+GLAPI void APIENTRY glGetShaderSourceARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj);
+typedef GLhandleARB (APIENTRYP PFNGLGETHANDLEARBPROC) (GLenum pname);
+typedef void (APIENTRYP PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj);
+typedef GLhandleARB (APIENTRYP PFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType);
+typedef void (APIENTRYP PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length);
+typedef void (APIENTRYP PFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj);
+typedef GLhandleARB (APIENTRYP PFNGLCREATEPROGRAMOBJECTARBPROC) (void);
+typedef void (APIENTRYP PFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj);
+typedef void (APIENTRYP PFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj);
+typedef void (APIENTRYP PFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj);
+typedef void (APIENTRYP PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj);
+typedef void (APIENTRYP PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0);
+typedef void (APIENTRYP PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1);
+typedef void (APIENTRYP PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+typedef void (APIENTRYP PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+typedef void (APIENTRYP PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0);
+typedef void (APIENTRYP PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1);
+typedef void (APIENTRYP PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2);
+typedef void (APIENTRYP PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+typedef void (APIENTRYP PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (APIENTRYP PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (APIENTRYP PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (APIENTRYP PFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat *value);
+typedef void (APIENTRYP PFNGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (APIENTRYP PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (APIENTRYP PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (APIENTRYP PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog);
+typedef void (APIENTRYP PFNGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj);
+typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name);
+typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
+typedef void (APIENTRYP PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint *params);
+typedef void (APIENTRYP PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source);
+#endif
+
+#ifndef GL_ARB_vertex_shader
+#define GL_ARB_vertex_shader 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBindAttribLocationARB (GLhandleARB programObj, GLuint index, const GLcharARB *name);
+GLAPI void APIENTRY glGetActiveAttribARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
+GLAPI GLint APIENTRY glGetAttribLocationARB (GLhandleARB programObj, const GLcharARB *name);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB *name);
+typedef void (APIENTRYP PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
+typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name);
+#endif
+
+#ifndef GL_ARB_fragment_shader
+#define GL_ARB_fragment_shader 1
+#endif
+
+#ifndef GL_ARB_shading_language_100
+#define GL_ARB_shading_language_100 1
+#endif
+
+#ifndef GL_ARB_texture_non_power_of_two
+#define GL_ARB_texture_non_power_of_two 1
+#endif
+
+#ifndef GL_ARB_point_sprite
+#define GL_ARB_point_sprite 1
+#endif
+
+#ifndef GL_ARB_fragment_program_shadow
+#define GL_ARB_fragment_program_shadow 1
+#endif
+
+#ifndef GL_ARB_draw_buffers
+#define GL_ARB_draw_buffers 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDrawBuffersARB (GLsizei n, const GLenum *bufs);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum *bufs);
+#endif
+
+#ifndef GL_ARB_texture_rectangle
+#define GL_ARB_texture_rectangle 1
+#endif
+
+#ifndef GL_ARB_color_buffer_float
+#define GL_ARB_color_buffer_float 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glClampColorARB (GLenum target, GLenum clamp);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp);
+#endif
+
+#ifndef GL_ARB_half_float_pixel
+#define GL_ARB_half_float_pixel 1
+#endif
+
+#ifndef GL_ARB_texture_float
+#define GL_ARB_texture_float 1
+#endif
+
+#ifndef GL_ARB_pixel_buffer_object
+#define GL_ARB_pixel_buffer_object 1
+#endif
+
+#ifndef GL_ARB_depth_buffer_float
+#define GL_ARB_depth_buffer_float 1
+#endif
+
+#ifndef GL_ARB_draw_instanced
+#define GL_ARB_draw_instanced 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDrawArraysInstancedARB (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+GLAPI void APIENTRY glDrawElementsInstancedARB (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDARBPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
+#endif
+
+#ifndef GL_ARB_framebuffer_object
+#define GL_ARB_framebuffer_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI GLboolean APIENTRY glIsRenderbuffer (GLuint renderbuffer);
+GLAPI void APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
+GLAPI void APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers);
+GLAPI void APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers);
+GLAPI void APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params);
+GLAPI GLboolean APIENTRY glIsFramebuffer (GLuint framebuffer);
+GLAPI void APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
+GLAPI void APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers);
+GLAPI void APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers);
+GLAPI GLenum APIENTRY glCheckFramebufferStatus (GLenum target);
+GLAPI void APIENTRY glFramebufferTexture1D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GLAPI void APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GLAPI void APIENTRY glFramebufferTexture3D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+GLAPI void APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+GLAPI void APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGenerateMipmap (GLenum target);
+GLAPI void APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+GLAPI void APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer);
+typedef void (APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer);
+typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers);
+typedef void (APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers);
+typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer);
+typedef void (APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer);
+typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers);
+typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers);
+typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target);
+typedef void (APIENTRYP PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+#endif
+
+#ifndef GL_ARB_framebuffer_sRGB
+#define GL_ARB_framebuffer_sRGB 1
+#endif
+
+#ifndef GL_ARB_geometry_shader4
+#define GL_ARB_geometry_shader4 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glProgramParameteriARB (GLuint program, GLenum pname, GLint value);
+GLAPI void APIENTRY glFramebufferTextureARB (GLenum target, GLenum attachment, GLuint texture, GLint level);
+GLAPI void APIENTRY glFramebufferTextureLayerARB (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+GLAPI void APIENTRY glFramebufferTextureFaceARB (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIARBPROC) (GLuint program, GLenum pname, GLint value);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);
+#endif
+
+#ifndef GL_ARB_half_float_vertex
+#define GL_ARB_half_float_vertex 1
+#endif
+
+#ifndef GL_ARB_instanced_arrays
+#define GL_ARB_instanced_arrays 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glVertexAttribDivisorARB (GLuint index, GLuint divisor);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor);
+#endif
+
+#ifndef GL_ARB_map_buffer_range
+#define GL_ARB_map_buffer_range 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI GLvoid* APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+GLAPI void APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
+typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
+#endif
+
+#ifndef GL_ARB_texture_buffer_object
+#define GL_ARB_texture_buffer_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTexBufferARB (GLenum target, GLenum internalformat, GLuint buffer);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTEXBUFFERARBPROC) (GLenum target, GLenum internalformat, GLuint buffer);
+#endif
+
+#ifndef GL_ARB_texture_compression_rgtc
+#define GL_ARB_texture_compression_rgtc 1
+#endif
+
+#ifndef GL_ARB_texture_rg
+#define GL_ARB_texture_rg 1
+#endif
+
+#ifndef GL_ARB_vertex_array_object
+#define GL_ARB_vertex_array_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBindVertexArray (GLuint array);
+GLAPI void APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays);
+GLAPI void APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays);
+GLAPI GLboolean APIENTRY glIsVertexArray (GLuint array);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array);
+typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays);
+typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays);
+typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC) (GLuint array);
+#endif
+
+#ifndef GL_ARB_uniform_buffer_object
+#define GL_ARB_uniform_buffer_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar* *uniformNames, GLuint *uniformIndices);
+GLAPI void APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetActiveUniformName (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
+GLAPI GLuint APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName);
+GLAPI void APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
+GLAPI void APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar* *uniformNames, GLuint *uniformIndices);
+typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
+typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName);
+typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
+typedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+#endif
+
+#ifndef GL_ARB_compatibility
+#define GL_ARB_compatibility 1
+#endif
+
+#ifndef GL_ARB_copy_buffer
+#define GL_ARB_copy_buffer 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+#endif
+
+#ifndef GL_ARB_shader_texture_lod
+#define GL_ARB_shader_texture_lod 1
+#endif
+
+#ifndef GL_ARB_depth_clamp
+#define GL_ARB_depth_clamp 1
+#endif
+
+#ifndef GL_ARB_draw_elements_base_vertex
+#define GL_ARB_draw_elements_base_vertex 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDrawElementsBaseVertex (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
+GLAPI void APIENTRY glDrawRangeElementsBaseVertex (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
+GLAPI void APIENTRY glDrawElementsInstancedBaseVertex (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount, GLint basevertex);
+GLAPI void APIENTRY glMultiDrawElementsBaseVertex (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount, const GLint *basevertex);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
+typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex);
+typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount, GLint basevertex);
+typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount, const GLint *basevertex);
+#endif
+
+#ifndef GL_ARB_fragment_coord_conventions
+#define GL_ARB_fragment_coord_conventions 1
+#endif
+
+#ifndef GL_ARB_provoking_vertex
+#define GL_ARB_provoking_vertex 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glProvokingVertex (GLenum mode);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPROVOKINGVERTEXPROC) (GLenum mode);
+#endif
+
+#ifndef GL_ARB_seamless_cube_map
+#define GL_ARB_seamless_cube_map 1
+#endif
+
+#ifndef GL_ARB_sync
+#define GL_ARB_sync 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI GLsync APIENTRY glFenceSync (GLenum condition, GLbitfield flags);
+GLAPI GLboolean APIENTRY glIsSync (GLsync sync);
+GLAPI void APIENTRY glDeleteSync (GLsync sync);
+GLAPI GLenum APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GLAPI void APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
+GLAPI void APIENTRY glGetInteger64v (GLenum pname, GLint64 *params);
+GLAPI void APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLsync (APIENTRYP PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flags);
+typedef GLboolean (APIENTRYP PFNGLISSYNCPROC) (GLsync sync);
+typedef void (APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync);
+typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+typedef void (APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
+typedef void (APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *params);
+typedef void (APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+#endif
+
+#ifndef GL_ARB_texture_multisample
+#define GL_ARB_texture_multisample 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTexImage2DMultisample (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
+GLAPI void APIENTRY glTexImage3DMultisample (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
+GLAPI void APIENTRY glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val);
+GLAPI void APIENTRY glSampleMaski (GLuint index, GLbitfield mask);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
+typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
+typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat *val);
+typedef void (APIENTRYP PFNGLSAMPLEMASKIPROC) (GLuint index, GLbitfield mask);
+#endif
+
+#ifndef GL_ARB_vertex_array_bgra
+#define GL_ARB_vertex_array_bgra 1
+#endif
+
+#ifndef GL_ARB_draw_buffers_blend
+#define GL_ARB_draw_buffers_blend 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBlendEquationiARB (GLuint buf, GLenum mode);
+GLAPI void APIENTRY glBlendEquationSeparateiARB (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+GLAPI void APIENTRY glBlendFunciARB (GLuint buf, GLenum src, GLenum dst);
+GLAPI void APIENTRY glBlendFuncSeparateiARB (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBLENDEQUATIONIARBPROC) (GLuint buf, GLenum mode);
+typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIARBPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+typedef void (APIENTRYP PFNGLBLENDFUNCIARBPROC) (GLuint buf, GLenum src, GLenum dst);
+typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIARBPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+#endif
+
+#ifndef GL_ARB_sample_shading
+#define GL_ARB_sample_shading 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glMinSampleShadingARB (GLclampf value);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLMINSAMPLESHADINGARBPROC) (GLclampf value);
+#endif
+
+#ifndef GL_ARB_texture_cube_map_array
+#define GL_ARB_texture_cube_map_array 1
+#endif
+
+#ifndef GL_ARB_texture_gather
+#define GL_ARB_texture_gather 1
+#endif
+
+#ifndef GL_ARB_texture_query_lod
+#define GL_ARB_texture_query_lod 1
+#endif
+
+#ifndef GL_ARB_shading_language_include
+#define GL_ARB_shading_language_include 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glNamedStringARB (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string);
+GLAPI void APIENTRY glDeleteNamedStringARB (GLint namelen, const GLchar *name);
+GLAPI void APIENTRY glCompileShaderIncludeARB (GLuint shader, GLsizei count, const GLchar* *path, const GLint *length);
+GLAPI GLboolean APIENTRY glIsNamedStringARB (GLint namelen, const GLchar *name);
+GLAPI void APIENTRY glGetNamedStringARB (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string);
+GLAPI void APIENTRY glGetNamedStringivARB (GLint namelen, const GLchar *name, GLenum pname, GLint *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLNAMEDSTRINGARBPROC) (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string);
+typedef void (APIENTRYP PFNGLDELETENAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name);
+typedef void (APIENTRYP PFNGLCOMPILESHADERINCLUDEARBPROC) (GLuint shader, GLsizei count, const GLchar* *path, const GLint *length);
+typedef GLboolean (APIENTRYP PFNGLISNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name);
+typedef void (APIENTRYP PFNGLGETNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string);
+typedef void (APIENTRYP PFNGLGETNAMEDSTRINGIVARBPROC) (GLint namelen, const GLchar *name, GLenum pname, GLint *params);
+#endif
+
+#ifndef GL_ARB_texture_compression_bptc
+#define GL_ARB_texture_compression_bptc 1
+#endif
+
+#ifndef GL_ARB_blend_func_extended
+#define GL_ARB_blend_func_extended 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBindFragDataLocationIndexed (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
+GLAPI GLint APIENTRY glGetFragDataIndex (GLuint program, const GLchar *name);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
+typedef GLint (APIENTRYP PFNGLGETFRAGDATAINDEXPROC) (GLuint program, const GLchar *name);
+#endif
+
+#ifndef GL_ARB_explicit_attrib_location
+#define GL_ARB_explicit_attrib_location 1
+#endif
+
+#ifndef GL_ARB_occlusion_query2
+#define GL_ARB_occlusion_query2 1
+#endif
+
+#ifndef GL_ARB_sampler_objects
+#define GL_ARB_sampler_objects 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGenSamplers (GLsizei count, GLuint *samplers);
+GLAPI void APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers);
+GLAPI GLboolean APIENTRY glIsSampler (GLuint sampler);
+GLAPI void APIENTRY glBindSampler (GLuint unit, GLuint sampler);
+GLAPI void APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param);
+GLAPI void APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param);
+GLAPI void APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param);
+GLAPI void APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param);
+GLAPI void APIENTRY glSamplerParameterIiv (GLuint sampler, GLenum pname, const GLint *param);
+GLAPI void APIENTRY glSamplerParameterIuiv (GLuint sampler, GLenum pname, const GLuint *param);
+GLAPI void APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetSamplerParameterIiv (GLuint sampler, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetSamplerParameterIuiv (GLuint sampler, GLenum pname, GLuint *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers);
+typedef void (APIENTRYP PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint *samplers);
+typedef GLboolean (APIENTRYP PFNGLISSAMPLERPROC) (GLuint sampler);
+typedef void (APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler);
+typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param);
+typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint *param);
+typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param);
+typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat *param);
+typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, const GLint *param);
+typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, const GLuint *param);
+typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, GLuint *params);
+#endif
+
+#ifndef GL_ARB_shader_bit_encoding
+#define GL_ARB_shader_bit_encoding 1
+#endif
+
+#ifndef GL_ARB_texture_rgb10_a2ui
+#define GL_ARB_texture_rgb10_a2ui 1
+#endif
+
+#ifndef GL_ARB_texture_swizzle
+#define GL_ARB_texture_swizzle 1
+#endif
+
+#ifndef GL_ARB_timer_query
+#define GL_ARB_timer_query 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glQueryCounter (GLuint id, GLenum target);
+GLAPI void APIENTRY glGetQueryObjecti64v (GLuint id, GLenum pname, GLint64 *params);
+GLAPI void APIENTRY glGetQueryObjectui64v (GLuint id, GLenum pname, GLuint64 *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLQUERYCOUNTERPROC) (GLuint id, GLenum target);
+typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VPROC) (GLuint id, GLenum pname, GLint64 *params);
+typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VPROC) (GLuint id, GLenum pname, GLuint64 *params);
+#endif
+
+#ifndef GL_ARB_vertex_type_2_10_10_10_rev
+#define GL_ARB_vertex_type_2_10_10_10_rev 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glVertexP2ui (GLenum type, GLuint value);
+GLAPI void APIENTRY glVertexP2uiv (GLenum type, const GLuint *value);
+GLAPI void APIENTRY glVertexP3ui (GLenum type, GLuint value);
+GLAPI void APIENTRY glVertexP3uiv (GLenum type, const GLuint *value);
+GLAPI void APIENTRY glVertexP4ui (GLenum type, GLuint value);
+GLAPI void APIENTRY glVertexP4uiv (GLenum type, const GLuint *value);
+GLAPI void APIENTRY glTexCoordP1ui (GLenum type, GLuint coords);
+GLAPI void APIENTRY glTexCoordP1uiv (GLenum type, const GLuint *coords);
+GLAPI void APIENTRY glTexCoordP2ui (GLenum type, GLuint coords);
+GLAPI void APIENTRY glTexCoordP2uiv (GLenum type, const GLuint *coords);
+GLAPI void APIENTRY glTexCoordP3ui (GLenum type, GLuint coords);
+GLAPI void APIENTRY glTexCoordP3uiv (GLenum type, const GLuint *coords);
+GLAPI void APIENTRY glTexCoordP4ui (GLenum type, GLuint coords);
+GLAPI void APIENTRY glTexCoordP4uiv (GLenum type, const GLuint *coords);
+GLAPI void APIENTRY glMultiTexCoordP1ui (GLenum texture, GLenum type, GLuint coords);
+GLAPI void APIENTRY glMultiTexCoordP1uiv (GLenum texture, GLenum type, const GLuint *coords);
+GLAPI void APIENTRY glMultiTexCoordP2ui (GLenum texture, GLenum type, GLuint coords);
+GLAPI void APIENTRY glMultiTexCoordP2uiv (GLenum texture, GLenum type, const GLuint *coords);
+GLAPI void APIENTRY glMultiTexCoordP3ui (GLenum texture, GLenum type, GLuint coords);
+GLAPI void APIENTRY glMultiTexCoordP3uiv (GLenum texture, GLenum type, const GLuint *coords);
+GLAPI void APIENTRY glMultiTexCoordP4ui (GLenum texture, GLenum type, GLuint coords);
+GLAPI void APIENTRY glMultiTexCoordP4uiv (GLenum texture, GLenum type, const GLuint *coords);
+GLAPI void APIENTRY glNormalP3ui (GLenum type, GLuint coords);
+GLAPI void APIENTRY glNormalP3uiv (GLenum type, const GLuint *coords);
+GLAPI void APIENTRY glColorP3ui (GLenum type, GLuint color);
+GLAPI void APIENTRY glColorP3uiv (GLenum type, const GLuint *color);
+GLAPI void APIENTRY glColorP4ui (GLenum type, GLuint color);
+GLAPI void APIENTRY glColorP4uiv (GLenum type, const GLuint *color);
+GLAPI void APIENTRY glSecondaryColorP3ui (GLenum type, GLuint color);
+GLAPI void APIENTRY glSecondaryColorP3uiv (GLenum type, const GLuint *color);
+GLAPI void APIENTRY glVertexAttribP1ui (GLuint index, GLenum type, GLboolean normalized, GLuint value);
+GLAPI void APIENTRY glVertexAttribP1uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
+GLAPI void APIENTRY glVertexAttribP2ui (GLuint index, GLenum type, GLboolean normalized, GLuint value);
+GLAPI void APIENTRY glVertexAttribP2uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
+GLAPI void APIENTRY glVertexAttribP3ui (GLuint index, GLenum type, GLboolean normalized, GLuint value);
+GLAPI void APIENTRY glVertexAttribP3uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
+GLAPI void APIENTRY glVertexAttribP4ui (GLuint index, GLenum type, GLboolean normalized, GLuint value);
+GLAPI void APIENTRY glVertexAttribP4uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLVERTEXP2UIPROC) (GLenum type, GLuint value);
+typedef void (APIENTRYP PFNGLVERTEXP2UIVPROC) (GLenum type, const GLuint *value);
+typedef void (APIENTRYP PFNGLVERTEXP3UIPROC) (GLenum type, GLuint value);
+typedef void (APIENTRYP PFNGLVERTEXP3UIVPROC) (GLenum type, const GLuint *value);
+typedef void (APIENTRYP PFNGLVERTEXP4UIPROC) (GLenum type, GLuint value);
+typedef void (APIENTRYP PFNGLVERTEXP4UIVPROC) (GLenum type, const GLuint *value);
+typedef void (APIENTRYP PFNGLTEXCOORDP1UIPROC) (GLenum type, GLuint coords);
+typedef void (APIENTRYP PFNGLTEXCOORDP1UIVPROC) (GLenum type, const GLuint *coords);
+typedef void (APIENTRYP PFNGLTEXCOORDP2UIPROC) (GLenum type, GLuint coords);
+typedef void (APIENTRYP PFNGLTEXCOORDP2UIVPROC) (GLenum type, const GLuint *coords);
+typedef void (APIENTRYP PFNGLTEXCOORDP3UIPROC) (GLenum type, GLuint coords);
+typedef void (APIENTRYP PFNGLTEXCOORDP3UIVPROC) (GLenum type, const GLuint *coords);
+typedef void (APIENTRYP PFNGLTEXCOORDP4UIPROC) (GLenum type, GLuint coords);
+typedef void (APIENTRYP PFNGLTEXCOORDP4UIVPROC) (GLenum type, const GLuint *coords);
+typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIPROC) (GLenum texture, GLenum type, GLuint coords);
+typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIVPROC) (GLenum texture, GLenum type, const GLuint *coords);
+typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIPROC) (GLenum texture, GLenum type, GLuint coords);
+typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIVPROC) (GLenum texture, GLenum type, const GLuint *coords);
+typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIPROC) (GLenum texture, GLenum type, GLuint coords);
+typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIVPROC) (GLenum texture, GLenum type, const GLuint *coords);
+typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIPROC) (GLenum texture, GLenum type, GLuint coords);
+typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIVPROC) (GLenum texture, GLenum type, const GLuint *coords);
+typedef void (APIENTRYP PFNGLNORMALP3UIPROC) (GLenum type, GLuint coords);
+typedef void (APIENTRYP PFNGLNORMALP3UIVPROC) (GLenum type, const GLuint *coords);
+typedef void (APIENTRYP PFNGLCOLORP3UIPROC) (GLenum type, GLuint color);
+typedef void (APIENTRYP PFNGLCOLORP3UIVPROC) (GLenum type, const GLuint *color);
+typedef void (APIENTRYP PFNGLCOLORP4UIPROC) (GLenum type, GLuint color);
+typedef void (APIENTRYP PFNGLCOLORP4UIVPROC) (GLenum type, const GLuint *color);
+typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIPROC) (GLenum type, GLuint color);
+typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIVPROC) (GLenum type, const GLuint *color);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
+#endif
+
+#ifndef GL_ARB_draw_indirect
+#define GL_ARB_draw_indirect 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDrawArraysIndirect (GLenum mode, const GLvoid *indirect);
+GLAPI void APIENTRY glDrawElementsIndirect (GLenum mode, GLenum type, const GLvoid *indirect);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDRAWARRAYSINDIRECTPROC) (GLenum mode, const GLvoid *indirect);
+typedef void (APIENTRYP PFNGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const GLvoid *indirect);
+#endif
+
+#ifndef GL_ARB_gpu_shader5
+#define GL_ARB_gpu_shader5 1
+#endif
+
+#ifndef GL_ARB_gpu_shader_fp64
+#define GL_ARB_gpu_shader_fp64 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glUniform1d (GLint location, GLdouble x);
+GLAPI void APIENTRY glUniform2d (GLint location, GLdouble x, GLdouble y);
+GLAPI void APIENTRY glUniform3d (GLint location, GLdouble x, GLdouble y, GLdouble z);
+GLAPI void APIENTRY glUniform4d (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+GLAPI void APIENTRY glUniform1dv (GLint location, GLsizei count, const GLdouble *value);
+GLAPI void APIENTRY glUniform2dv (GLint location, GLsizei count, const GLdouble *value);
+GLAPI void APIENTRY glUniform3dv (GLint location, GLsizei count, const GLdouble *value);
+GLAPI void APIENTRY glUniform4dv (GLint location, GLsizei count, const GLdouble *value);
+GLAPI void APIENTRY glUniformMatrix2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glUniformMatrix3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glUniformMatrix4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glUniformMatrix2x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glUniformMatrix2x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glUniformMatrix3x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glUniformMatrix3x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glUniformMatrix4x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glUniformMatrix4x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glGetUniformdv (GLuint program, GLint location, GLdouble *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLUNIFORM1DPROC) (GLint location, GLdouble x);
+typedef void (APIENTRYP PFNGLUNIFORM2DPROC) (GLint location, GLdouble x, GLdouble y);
+typedef void (APIENTRYP PFNGLUNIFORM3DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRYP PFNGLUNIFORM4DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRYP PFNGLUNIFORM1DVPROC) (GLint location, GLsizei count, const GLdouble *value);
+typedef void (APIENTRYP PFNGLUNIFORM2DVPROC) (GLint location, GLsizei count, const GLdouble *value);
+typedef void (APIENTRYP PFNGLUNIFORM3DVPROC) (GLint location, GLsizei count, const GLdouble *value);
+typedef void (APIENTRYP PFNGLUNIFORM4DVPROC) (GLint location, GLsizei count, const GLdouble *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLGETUNIFORMDVPROC) (GLuint program, GLint location, GLdouble *params);
+#endif
+
+#ifndef GL_ARB_shader_subroutine
+#define GL_ARB_shader_subroutine 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI GLint APIENTRY glGetSubroutineUniformLocation (GLuint program, GLenum shadertype, const GLchar *name);
+GLAPI GLuint APIENTRY glGetSubroutineIndex (GLuint program, GLenum shadertype, const GLchar *name);
+GLAPI void APIENTRY glGetActiveSubroutineUniformiv (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);
+GLAPI void APIENTRY glGetActiveSubroutineUniformName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
+GLAPI void APIENTRY glGetActiveSubroutineName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
+GLAPI void APIENTRY glUniformSubroutinesuiv (GLenum shadertype, GLsizei count, const GLuint *indices);
+GLAPI void APIENTRY glGetUniformSubroutineuiv (GLenum shadertype, GLint location, GLuint *params);
+GLAPI void APIENTRY glGetProgramStageiv (GLuint program, GLenum shadertype, GLenum pname, GLint *values);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLint (APIENTRYP PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC) (GLuint program, GLenum shadertype, const GLchar *name);
+typedef GLuint (APIENTRYP PFNGLGETSUBROUTINEINDEXPROC) (GLuint program, GLenum shadertype, const GLchar *name);
+typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC) (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);
+typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
+typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINENAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
+typedef void (APIENTRYP PFNGLUNIFORMSUBROUTINESUIVPROC) (GLenum shadertype, GLsizei count, const GLuint *indices);
+typedef void (APIENTRYP PFNGLGETUNIFORMSUBROUTINEUIVPROC) (GLenum shadertype, GLint location, GLuint *params);
+typedef void (APIENTRYP PFNGLGETPROGRAMSTAGEIVPROC) (GLuint program, GLenum shadertype, GLenum pname, GLint *values);
+#endif
+
+#ifndef GL_ARB_tessellation_shader
+#define GL_ARB_tessellation_shader 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glPatchParameteri (GLenum pname, GLint value);
+GLAPI void APIENTRY glPatchParameterfv (GLenum pname, const GLfloat *values);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPATCHPARAMETERIPROC) (GLenum pname, GLint value);
+typedef void (APIENTRYP PFNGLPATCHPARAMETERFVPROC) (GLenum pname, const GLfloat *values);
+#endif
+
+#ifndef GL_ARB_texture_buffer_object_rgb32
+#define GL_ARB_texture_buffer_object_rgb32 1
+#endif
+
+#ifndef GL_ARB_transform_feedback2
+#define GL_ARB_transform_feedback2 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBindTransformFeedback (GLenum target, GLuint id);
+GLAPI void APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint *ids);
+GLAPI void APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint *ids);
+GLAPI GLboolean APIENTRY glIsTransformFeedback (GLuint id);
+GLAPI void APIENTRY glPauseTransformFeedback (void);
+GLAPI void APIENTRY glResumeTransformFeedback (void);
+GLAPI void APIENTRY glDrawTransformFeedback (GLenum mode, GLuint id);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKPROC) (GLenum target, GLuint id);
+typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSPROC) (GLsizei n, const GLuint *ids);
+typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids);
+typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKPROC) (GLuint id);
+typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKPROC) (void);
+typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKPROC) (void);
+typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKPROC) (GLenum mode, GLuint id);
+#endif
+
+#ifndef GL_ARB_transform_feedback3
+#define GL_ARB_transform_feedback3 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDrawTransformFeedbackStream (GLenum mode, GLuint id, GLuint stream);
+GLAPI void APIENTRY glBeginQueryIndexed (GLenum target, GLuint index, GLuint id);
+GLAPI void APIENTRY glEndQueryIndexed (GLenum target, GLuint index);
+GLAPI void APIENTRY glGetQueryIndexediv (GLenum target, GLuint index, GLenum pname, GLint *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC) (GLenum mode, GLuint id, GLuint stream);
+typedef void (APIENTRYP PFNGLBEGINQUERYINDEXEDPROC) (GLenum target, GLuint index, GLuint id);
+typedef void (APIENTRYP PFNGLENDQUERYINDEXEDPROC) (GLenum target, GLuint index);
+typedef void (APIENTRYP PFNGLGETQUERYINDEXEDIVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params);
+#endif
+
+#ifndef GL_ARB_ES2_compatibility
+#define GL_ARB_ES2_compatibility 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glReleaseShaderCompiler (void);
+GLAPI void APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length);
+GLAPI void APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
+GLAPI void APIENTRY glDepthRangef (GLclampf n, GLclampf f);
+GLAPI void APIENTRY glClearDepthf (GLclampf d);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void);
+typedef void (APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length);
+typedef void (APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
+typedef void (APIENTRYP PFNGLDEPTHRANGEFPROC) (GLclampf n, GLclampf f);
+typedef void (APIENTRYP PFNGLCLEARDEPTHFPROC) (GLclampf d);
+#endif
+
+#ifndef GL_ARB_get_program_binary
+#define GL_ARB_get_program_binary 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
+GLAPI void APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length);
+GLAPI void APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
+typedef void (APIENTRYP PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length);
+typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value);
+#endif
+
+#ifndef GL_ARB_separate_shader_objects
+#define GL_ARB_separate_shader_objects 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glUseProgramStages (GLuint pipeline, GLbitfield stages, GLuint program);
+GLAPI void APIENTRY glActiveShaderProgram (GLuint pipeline, GLuint program);
+GLAPI GLuint APIENTRY glCreateShaderProgramv (GLenum type, GLsizei count, const GLchar* *strings);
+GLAPI void APIENTRY glBindProgramPipeline (GLuint pipeline);
+GLAPI void APIENTRY glDeleteProgramPipelines (GLsizei n, const GLuint *pipelines);
+GLAPI void APIENTRY glGenProgramPipelines (GLsizei n, GLuint *pipelines);
+GLAPI GLboolean APIENTRY glIsProgramPipeline (GLuint pipeline);
+GLAPI void APIENTRY glGetProgramPipelineiv (GLuint pipeline, GLenum pname, GLint *params);
+GLAPI void APIENTRY glProgramUniform1i (GLuint program, GLint location, GLint v0);
+GLAPI void APIENTRY glProgramUniform1iv (GLuint program, GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glProgramUniform1f (GLuint program, GLint location, GLfloat v0);
+GLAPI void APIENTRY glProgramUniform1fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniform1d (GLuint program, GLint location, GLdouble v0);
+GLAPI void APIENTRY glProgramUniform1dv (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniform1ui (GLuint program, GLint location, GLuint v0);
+GLAPI void APIENTRY glProgramUniform1uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glProgramUniform2i (GLuint program, GLint location, GLint v0, GLint v1);
+GLAPI void APIENTRY glProgramUniform2iv (GLuint program, GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glProgramUniform2f (GLuint program, GLint location, GLfloat v0, GLfloat v1);
+GLAPI void APIENTRY glProgramUniform2fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniform2d (GLuint program, GLint location, GLdouble v0, GLdouble v1);
+GLAPI void APIENTRY glProgramUniform2dv (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniform2ui (GLuint program, GLint location, GLuint v0, GLuint v1);
+GLAPI void APIENTRY glProgramUniform2uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glProgramUniform3i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
+GLAPI void APIENTRY glProgramUniform3iv (GLuint program, GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glProgramUniform3f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+GLAPI void APIENTRY glProgramUniform3fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniform3d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);
+GLAPI void APIENTRY glProgramUniform3dv (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniform3ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
+GLAPI void APIENTRY glProgramUniform3uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glProgramUniform4i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+GLAPI void APIENTRY glProgramUniform4iv (GLuint program, GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glProgramUniform4f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+GLAPI void APIENTRY glProgramUniform4fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniform4d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);
+GLAPI void APIENTRY glProgramUniform4dv (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniform4ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+GLAPI void APIENTRY glProgramUniform4uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glProgramUniformMatrix2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix2x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix3x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix2x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix4x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix3x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix4x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix2x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix3x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix2x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix4x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix3x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix4x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glValidateProgramPipeline (GLuint pipeline);
+GLAPI void APIENTRY glGetProgramPipelineInfoLog (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLUSEPROGRAMSTAGESPROC) (GLuint pipeline, GLbitfield stages, GLuint program);
+typedef void (APIENTRYP PFNGLACTIVESHADERPROGRAMPROC) (GLuint pipeline, GLuint program);
+typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMVPROC) (GLenum type, GLsizei count, const GLchar* *strings);
+typedef void (APIENTRYP PFNGLBINDPROGRAMPIPELINEPROC) (GLuint pipeline);
+typedef void (APIENTRYP PFNGLDELETEPROGRAMPIPELINESPROC) (GLsizei n, const GLuint *pipelines);
+typedef void (APIENTRYP PFNGLGENPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines);
+typedef GLboolean (APIENTRYP PFNGLISPROGRAMPIPELINEPROC) (GLuint pipeline);
+typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEIVPROC) (GLuint pipeline, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IPROC) (GLuint program, GLint location, GLint v0);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FPROC) (GLuint program, GLint location, GLfloat v0);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DPROC) (GLuint program, GLint location, GLdouble v0);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIPROC) (GLuint program, GLint location, GLuint v0);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IPROC) (GLuint program, GLint location, GLint v0, GLint v1);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEPROC) (GLuint pipeline);
+typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+#endif
+
+#ifndef GL_ARB_vertex_attrib_64bit
+#define GL_ARB_vertex_attrib_64bit 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glVertexAttribL1d (GLuint index, GLdouble x);
+GLAPI void APIENTRY glVertexAttribL2d (GLuint index, GLdouble x, GLdouble y);
+GLAPI void APIENTRY glVertexAttribL3d (GLuint index, GLdouble x, GLdouble y, GLdouble z);
+GLAPI void APIENTRY glVertexAttribL4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+GLAPI void APIENTRY glVertexAttribL1dv (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttribL2dv (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttribL3dv (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttribL4dv (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttribLPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+GLAPI void APIENTRY glGetVertexAttribLdv (GLuint index, GLenum pname, GLdouble *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DPROC) (GLuint index, GLdouble x);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DPROC) (GLuint index, GLdouble x, GLdouble y);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVPROC) (GLuint index, GLenum pname, GLdouble *params);
+#endif
+
+#ifndef GL_ARB_viewport_array
+#define GL_ARB_viewport_array 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glViewportArrayv (GLuint first, GLsizei count, const GLfloat *v);
+GLAPI void APIENTRY glViewportIndexedf (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
+GLAPI void APIENTRY glViewportIndexedfv (GLuint index, const GLfloat *v);
+GLAPI void APIENTRY glScissorArrayv (GLuint first, GLsizei count, const GLint *v);
+GLAPI void APIENTRY glScissorIndexed (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glScissorIndexedv (GLuint index, const GLint *v);
+GLAPI void APIENTRY glDepthRangeArrayv (GLuint first, GLsizei count, const GLclampd *v);
+GLAPI void APIENTRY glDepthRangeIndexed (GLuint index, GLclampd n, GLclampd f);
+GLAPI void APIENTRY glGetFloati_v (GLenum target, GLuint index, GLfloat *data);
+GLAPI void APIENTRY glGetDoublei_v (GLenum target, GLuint index, GLdouble *data);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLVIEWPORTARRAYVPROC) (GLuint first, GLsizei count, const GLfloat *v);
+typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
+typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFVPROC) (GLuint index, const GLfloat *v);
+typedef void (APIENTRYP PFNGLSCISSORARRAYVPROC) (GLuint first, GLsizei count, const GLint *v);
+typedef void (APIENTRYP PFNGLSCISSORINDEXEDPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
+typedef void (APIENTRYP PFNGLSCISSORINDEXEDVPROC) (GLuint index, const GLint *v);
+typedef void (APIENTRYP PFNGLDEPTHRANGEARRAYVPROC) (GLuint first, GLsizei count, const GLclampd *v);
+typedef void (APIENTRYP PFNGLDEPTHRANGEINDEXEDPROC) (GLuint index, GLclampd n, GLclampd f);
+typedef void (APIENTRYP PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfloat *data);
+typedef void (APIENTRYP PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble *data);
+#endif
+
+#ifndef GL_ARB_cl_event
+#define GL_ARB_cl_event 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI GLsync APIENTRY glCreateSyncFromCLeventARB (struct _cl_context * context, struct _cl_event * event, GLbitfield flags);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLsync (APIENTRYP PFNGLCREATESYNCFROMCLEVENTARBPROC) (struct _cl_context * context, struct _cl_event * event, GLbitfield flags);
+#endif
+
+#ifndef GL_ARB_debug_output
+#define GL_ARB_debug_output 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDebugMessageControlARB (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
+GLAPI void APIENTRY glDebugMessageInsertARB (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
+GLAPI void APIENTRY glDebugMessageCallbackARB (GLDEBUGPROCARB callback, const GLvoid *userParam);
+GLAPI GLuint APIENTRY glGetDebugMessageLogARB (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLARBPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
+typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTARBPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
+typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKARBPROC) (GLDEBUGPROCARB callback, const GLvoid *userParam);
+typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGARBPROC) (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
+#endif
+
+#ifndef GL_ARB_robustness
+#define GL_ARB_robustness 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI GLenum APIENTRY glGetGraphicsResetStatusARB (void);
+GLAPI void APIENTRY glGetnMapdvARB (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v);
+GLAPI void APIENTRY glGetnMapfvARB (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v);
+GLAPI void APIENTRY glGetnMapivARB (GLenum target, GLenum query, GLsizei bufSize, GLint *v);
+GLAPI void APIENTRY glGetnPixelMapfvARB (GLenum map, GLsizei bufSize, GLfloat *values);
+GLAPI void APIENTRY glGetnPixelMapuivARB (GLenum map, GLsizei bufSize, GLuint *values);
+GLAPI void APIENTRY glGetnPixelMapusvARB (GLenum map, GLsizei bufSize, GLushort *values);
+GLAPI void APIENTRY glGetnPolygonStippleARB (GLsizei bufSize, GLubyte *pattern);
+GLAPI void APIENTRY glGetnColorTableARB (GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *table);
+GLAPI void APIENTRY glGetnConvolutionFilterARB (GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *image);
+GLAPI void APIENTRY glGetnSeparableFilterARB (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, GLvoid *row, GLsizei columnBufSize, GLvoid *column, GLvoid *span);
+GLAPI void APIENTRY glGetnHistogramARB (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values);
+GLAPI void APIENTRY glGetnMinmaxARB (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values);
+GLAPI void APIENTRY glGetnTexImageARB (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, GLvoid *img);
+GLAPI void APIENTRY glReadnPixelsARB (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data);
+GLAPI void APIENTRY glGetnCompressedTexImageARB (GLenum target, GLint lod, GLsizei bufSize, GLvoid *img);
+GLAPI void APIENTRY glGetnUniformfvARB (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
+GLAPI void APIENTRY glGetnUniformivARB (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+GLAPI void APIENTRY glGetnUniformuivARB (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
+GLAPI void APIENTRY glGetnUniformdvARB (GLuint program, GLint location, GLsizei bufSize, GLdouble *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSARBPROC) (void);
+typedef void (APIENTRYP PFNGLGETNMAPDVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v);
+typedef void (APIENTRYP PFNGLGETNMAPFVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v);
+typedef void (APIENTRYP PFNGLGETNMAPIVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLint *v);
+typedef void (APIENTRYP PFNGLGETNPIXELMAPFVARBPROC) (GLenum map, GLsizei bufSize, GLfloat *values);
+typedef void (APIENTRYP PFNGLGETNPIXELMAPUIVARBPROC) (GLenum map, GLsizei bufSize, GLuint *values);
+typedef void (APIENTRYP PFNGLGETNPIXELMAPUSVARBPROC) (GLenum map, GLsizei bufSize, GLushort *values);
+typedef void (APIENTRYP PFNGLGETNPOLYGONSTIPPLEARBPROC) (GLsizei bufSize, GLubyte *pattern);
+typedef void (APIENTRYP PFNGLGETNCOLORTABLEARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *table);
+typedef void (APIENTRYP PFNGLGETNCONVOLUTIONFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, GLvoid *image);
+typedef void (APIENTRYP PFNGLGETNSEPARABLEFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, GLvoid *row, GLsizei columnBufSize, GLvoid *column, GLvoid *span);
+typedef void (APIENTRYP PFNGLGETNHISTOGRAMARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values);
+typedef void (APIENTRYP PFNGLGETNMINMAXARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, GLvoid *values);
+typedef void (APIENTRYP PFNGLGETNTEXIMAGEARBPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, GLvoid *img);
+typedef void (APIENTRYP PFNGLREADNPIXELSARBPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data);
+typedef void (APIENTRYP PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, GLsizei bufSize, GLvoid *img);
+typedef void (APIENTRYP PFNGLGETNUNIFORMFVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETNUNIFORMIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+typedef void (APIENTRYP PFNGLGETNUNIFORMUIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
+typedef void (APIENTRYP PFNGLGETNUNIFORMDVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble *params);
+#endif
+
+#ifndef GL_ARB_shader_stencil_export
+#define GL_ARB_shader_stencil_export 1
+#endif
+
+#ifndef GL_ARB_base_instance
+#define GL_ARB_base_instance 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDrawArraysInstancedBaseInstance (GLenum mode, GLint first, GLsizei count, GLsizei primcount, GLuint baseinstance);
+GLAPI void APIENTRY glDrawElementsInstancedBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLuint baseinstance);
+GLAPI void APIENTRY glDrawElementsInstancedBaseVertexBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLint basevertex, GLuint baseinstance);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount, GLuint baseinstance);
+typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLuint baseinstance);
+typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLint basevertex, GLuint baseinstance);
+#endif
+
+#ifndef GL_ARB_shading_language_420pack
+#define GL_ARB_shading_language_420pack 1
+#endif
+
+#ifndef GL_ARB_transform_feedback_instanced
+#define GL_ARB_transform_feedback_instanced 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDrawTransformFeedbackInstanced (GLenum mode, GLuint id, GLsizei primcount);
+GLAPI void APIENTRY glDrawTransformFeedbackStreamInstanced (GLenum mode, GLuint id, GLuint stream, GLsizei primcount);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC) (GLenum mode, GLuint id, GLsizei primcount);
+typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum mode, GLuint id, GLuint stream, GLsizei primcount);
+#endif
+
+#ifndef GL_ARB_compressed_texture_pixel_storage
+#define GL_ARB_compressed_texture_pixel_storage 1
+#endif
+
+#ifndef GL_ARB_conservative_depth
+#define GL_ARB_conservative_depth 1
+#endif
+
+#ifndef GL_ARB_internalformat_query
+#define GL_ARB_internalformat_query 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
+#endif
+
+#ifndef GL_ARB_map_buffer_alignment
+#define GL_ARB_map_buffer_alignment 1
+#endif
+
+#ifndef GL_ARB_shader_atomic_counters
+#define GL_ARB_shader_atomic_counters 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetActiveAtomicCounterBufferiv (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC) (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params);
+#endif
+
+#ifndef GL_ARB_shader_image_load_store
+#define GL_ARB_shader_image_load_store 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBindImageTexture (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
+GLAPI void APIENTRY glMemoryBarrier (GLbitfield barriers);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBINDIMAGETEXTUREPROC) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
+typedef void (APIENTRYP PFNGLMEMORYBARRIERPROC) (GLbitfield barriers);
+#endif
+
+#ifndef GL_ARB_shading_language_packing
+#define GL_ARB_shading_language_packing 1
+#endif
+
+#ifndef GL_ARB_texture_storage
+#define GL_ARB_texture_storage 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTexStorage1D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+GLAPI void APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+GLAPI void APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+GLAPI void APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTEXSTORAGE1DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+typedef void (APIENTRYP PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (APIENTRYP PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+typedef void (APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+#endif
+
+#ifndef GL_EXT_abgr
+#define GL_EXT_abgr 1
+#endif
+
+#ifndef GL_EXT_blend_color
+#define GL_EXT_blend_color 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBlendColorEXT (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+#endif
+
+#ifndef GL_EXT_polygon_offset
+#define GL_EXT_polygon_offset 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glPolygonOffsetEXT (GLfloat factor, GLfloat bias);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias);
+#endif
+
+#ifndef GL_EXT_texture
+#define GL_EXT_texture 1
+#endif
+
+#ifndef GL_EXT_texture3D
+#define GL_EXT_texture3D 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTexImage3DEXT (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glTexSubImage3DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
+#endif
+
+#ifndef GL_SGIS_texture_filter4
+#define GL_SGIS_texture_filter4 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetTexFilterFuncSGIS (GLenum target, GLenum filter, GLfloat *weights);
+GLAPI void APIENTRY glTexFilterFuncSGIS (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat *weights);
+typedef void (APIENTRYP PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights);
+#endif
+
+#ifndef GL_EXT_subtexture
+#define GL_EXT_subtexture 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTexSubImage1DEXT (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glTexSubImage2DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
+#endif
+
+#ifndef GL_EXT_copy_texture
+#define GL_EXT_copy_texture 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glCopyTexImage1DEXT (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
+GLAPI void APIENTRY glCopyTexImage2DEXT (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+GLAPI void APIENTRY glCopyTexSubImage1DEXT (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
+GLAPI void APIENTRY glCopyTexSubImage2DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glCopyTexSubImage3DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
+typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
+typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+#endif
+
+#ifndef GL_EXT_histogram
+#define GL_EXT_histogram 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetHistogramEXT (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
+GLAPI void APIENTRY glGetHistogramParameterfvEXT (GLenum target, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetHistogramParameterivEXT (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetMinmaxEXT (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
+GLAPI void APIENTRY glGetMinmaxParameterfvEXT (GLenum target, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetMinmaxParameterivEXT (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glHistogramEXT (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
+GLAPI void APIENTRY glMinmaxEXT (GLenum target, GLenum internalformat, GLboolean sink);
+GLAPI void APIENTRY glResetHistogramEXT (GLenum target);
+GLAPI void APIENTRY glResetMinmaxEXT (GLenum target);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
+typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
+typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
+typedef void (APIENTRYP PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink);
+typedef void (APIENTRYP PFNGLRESETHISTOGRAMEXTPROC) (GLenum target);
+typedef void (APIENTRYP PFNGLRESETMINMAXEXTPROC) (GLenum target);
+#endif
+
+#ifndef GL_EXT_convolution
+#define GL_EXT_convolution 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glConvolutionFilter1DEXT (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);
+GLAPI void APIENTRY glConvolutionFilter2DEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);
+GLAPI void APIENTRY glConvolutionParameterfEXT (GLenum target, GLenum pname, GLfloat params);
+GLAPI void APIENTRY glConvolutionParameterfvEXT (GLenum target, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glConvolutionParameteriEXT (GLenum target, GLenum pname, GLint params);
+GLAPI void APIENTRY glConvolutionParameterivEXT (GLenum target, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glCopyConvolutionFilter1DEXT (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
+GLAPI void APIENTRY glCopyConvolutionFilter2DEXT (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glGetConvolutionFilterEXT (GLenum target, GLenum format, GLenum type, GLvoid *image);
+GLAPI void APIENTRY glGetConvolutionParameterfvEXT (GLenum target, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetConvolutionParameterivEXT (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetSeparableFilterEXT (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);
+GLAPI void APIENTRY glSeparableFilter2DEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);
+typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);
+typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat params);
+typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params);
+typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint params);
+typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
+typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image);
+typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);
+typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);
+#endif
+
+#ifndef GL_SGI_color_matrix
+#define GL_SGI_color_matrix 1
+#endif
+
+#ifndef GL_SGI_color_table
+#define GL_SGI_color_table 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glColorTableSGI (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
+GLAPI void APIENTRY glColorTableParameterfvSGI (GLenum target, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glColorTableParameterivSGI (GLenum target, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glCopyColorTableSGI (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
+GLAPI void APIENTRY glGetColorTableSGI (GLenum target, GLenum format, GLenum type, GLvoid *table);
+GLAPI void APIENTRY glGetColorTableParameterfvSGI (GLenum target, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetColorTableParameterivSGI (GLenum target, GLenum pname, GLint *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
+typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat *params);
+typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
+typedef void (APIENTRYP PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table);
+typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint *params);
+#endif
+
+#ifndef GL_SGIX_pixel_texture
+#define GL_SGIX_pixel_texture 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glPixelTexGenSGIX (GLenum mode);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPIXELTEXGENSGIXPROC) (GLenum mode);
+#endif
+
+#ifndef GL_SGIS_pixel_texture
+#define GL_SGIS_pixel_texture 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glPixelTexGenParameteriSGIS (GLenum pname, GLint param);
+GLAPI void APIENTRY glPixelTexGenParameterivSGIS (GLenum pname, const GLint *params);
+GLAPI void APIENTRY glPixelTexGenParameterfSGIS (GLenum pname, GLfloat param);
+GLAPI void APIENTRY glPixelTexGenParameterfvSGIS (GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glGetPixelTexGenParameterivSGIS (GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetPixelTexGenParameterfvSGIS (GLenum pname, GLfloat *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERISGISPROC) (GLenum pname, GLint param);
+typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFSGISPROC) (GLenum pname, GLfloat param);
+typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params);
+typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, GLfloat *params);
+#endif
+
+#ifndef GL_SGIS_texture4D
+#define GL_SGIS_texture4D 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTexImage4DSGIS (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glTexSubImage4DSGIS (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid *pixels);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid *pixels);
+#endif
+
+#ifndef GL_SGI_texture_color_table
+#define GL_SGI_texture_color_table 1
+#endif
+
+#ifndef GL_EXT_cmyka
+#define GL_EXT_cmyka 1
+#endif
+
+#ifndef GL_EXT_texture_object
+#define GL_EXT_texture_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI GLboolean APIENTRY glAreTexturesResidentEXT (GLsizei n, const GLuint *textures, GLboolean *residences);
+GLAPI void APIENTRY glBindTextureEXT (GLenum target, GLuint texture);
+GLAPI void APIENTRY glDeleteTexturesEXT (GLsizei n, const GLuint *textures);
+GLAPI void APIENTRY glGenTexturesEXT (GLsizei n, GLuint *textures);
+GLAPI GLboolean APIENTRY glIsTextureEXT (GLuint texture);
+GLAPI void APIENTRY glPrioritizeTexturesEXT (GLsizei n, const GLuint *textures, const GLclampf *priorities);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLboolean (APIENTRYP PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint *textures, GLboolean *residences);
+typedef void (APIENTRYP PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture);
+typedef void (APIENTRYP PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint *textures);
+typedef void (APIENTRYP PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint *textures);
+typedef GLboolean (APIENTRYP PFNGLISTEXTUREEXTPROC) (GLuint texture);
+typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint *textures, const GLclampf *priorities);
+#endif
+
+#ifndef GL_SGIS_detail_texture
+#define GL_SGIS_detail_texture 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDetailTexFuncSGIS (GLenum target, GLsizei n, const GLfloat *points);
+GLAPI void APIENTRY glGetDetailTexFuncSGIS (GLenum target, GLfloat *points);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points);
+typedef void (APIENTRYP PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat *points);
+#endif
+
+#ifndef GL_SGIS_sharpen_texture
+#define GL_SGIS_sharpen_texture 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glSharpenTexFuncSGIS (GLenum target, GLsizei n, const GLfloat *points);
+GLAPI void APIENTRY glGetSharpenTexFuncSGIS (GLenum target, GLfloat *points);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points);
+typedef void (APIENTRYP PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat *points);
+#endif
+
+#ifndef GL_EXT_packed_pixels
+#define GL_EXT_packed_pixels 1
+#endif
+
+#ifndef GL_SGIS_texture_lod
+#define GL_SGIS_texture_lod 1
+#endif
+
+#ifndef GL_SGIS_multisample
+#define GL_SGIS_multisample 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glSampleMaskSGIS (GLclampf value, GLboolean invert);
+GLAPI void APIENTRY glSamplePatternSGIS (GLenum pattern);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert);
+typedef void (APIENTRYP PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern);
+#endif
+
+#ifndef GL_EXT_rescale_normal
+#define GL_EXT_rescale_normal 1
+#endif
+
+#ifndef GL_EXT_vertex_array
+#define GL_EXT_vertex_array 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glArrayElementEXT (GLint i);
+GLAPI void APIENTRY glColorPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+GLAPI void APIENTRY glDrawArraysEXT (GLenum mode, GLint first, GLsizei count);
+GLAPI void APIENTRY glEdgeFlagPointerEXT (GLsizei stride, GLsizei count, const GLboolean *pointer);
+GLAPI void APIENTRY glGetPointervEXT (GLenum pname, GLvoid* *params);
+GLAPI void APIENTRY glIndexPointerEXT (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+GLAPI void APIENTRY glNormalPointerEXT (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+GLAPI void APIENTRY glTexCoordPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+GLAPI void APIENTRY glVertexPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLARRAYELEMENTEXTPROC) (GLint i);
+typedef void (APIENTRYP PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+typedef void (APIENTRYP PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count);
+typedef void (APIENTRYP PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean *pointer);
+typedef void (APIENTRYP PFNGLGETPOINTERVEXTPROC) (GLenum pname, GLvoid* *params);
+typedef void (APIENTRYP PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+typedef void (APIENTRYP PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+typedef void (APIENTRYP PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+typedef void (APIENTRYP PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
+#endif
+
+#ifndef GL_EXT_misc_attribute
+#define GL_EXT_misc_attribute 1
+#endif
+
+#ifndef GL_SGIS_generate_mipmap
+#define GL_SGIS_generate_mipmap 1
+#endif
+
+#ifndef GL_SGIX_clipmap
+#define GL_SGIX_clipmap 1
+#endif
+
+#ifndef GL_SGIX_shadow
+#define GL_SGIX_shadow 1
+#endif
+
+#ifndef GL_SGIS_texture_edge_clamp
+#define GL_SGIS_texture_edge_clamp 1
+#endif
+
+#ifndef GL_SGIS_texture_border_clamp
+#define GL_SGIS_texture_border_clamp 1
+#endif
+
+#ifndef GL_EXT_blend_minmax
+#define GL_EXT_blend_minmax 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBlendEquationEXT (GLenum mode);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBLENDEQUATIONEXTPROC) (GLenum mode);
+#endif
+
+#ifndef GL_EXT_blend_subtract
+#define GL_EXT_blend_subtract 1
+#endif
+
+#ifndef GL_EXT_blend_logic_op
+#define GL_EXT_blend_logic_op 1
+#endif
+
+#ifndef GL_SGIX_interlace
+#define GL_SGIX_interlace 1
+#endif
+
+#ifndef GL_SGIX_pixel_tiles
+#define GL_SGIX_pixel_tiles 1
+#endif
+
+#ifndef GL_SGIX_texture_select
+#define GL_SGIX_texture_select 1
+#endif
+
+#ifndef GL_SGIX_sprite
+#define GL_SGIX_sprite 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glSpriteParameterfSGIX (GLenum pname, GLfloat param);
+GLAPI void APIENTRY glSpriteParameterfvSGIX (GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glSpriteParameteriSGIX (GLenum pname, GLint param);
+GLAPI void APIENTRY glSpriteParameterivSGIX (GLenum pname, const GLint *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param);
+typedef void (APIENTRYP PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, const GLfloat *params);
+typedef void (APIENTRYP PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param);
+typedef void (APIENTRYP PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, const GLint *params);
+#endif
+
+#ifndef GL_SGIX_texture_multi_buffer
+#define GL_SGIX_texture_multi_buffer 1
+#endif
+
+#ifndef GL_EXT_point_parameters
+#define GL_EXT_point_parameters 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glPointParameterfEXT (GLenum pname, GLfloat param);
+GLAPI void APIENTRY glPointParameterfvEXT (GLenum pname, const GLfloat *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param);
+typedef void (APIENTRYP PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params);
+#endif
+
+#ifndef GL_SGIS_point_parameters
+#define GL_SGIS_point_parameters 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glPointParameterfSGIS (GLenum pname, GLfloat param);
+GLAPI void APIENTRY glPointParameterfvSGIS (GLenum pname, const GLfloat *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPOINTPARAMETERFSGISPROC) (GLenum pname, GLfloat param);
+typedef void (APIENTRYP PFNGLPOINTPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params);
+#endif
+
+#ifndef GL_SGIX_instruments
+#define GL_SGIX_instruments 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI GLint APIENTRY glGetInstrumentsSGIX (void);
+GLAPI void APIENTRY glInstrumentsBufferSGIX (GLsizei size, GLint *buffer);
+GLAPI GLint APIENTRY glPollInstrumentsSGIX (GLint *marker_p);
+GLAPI void APIENTRY glReadInstrumentsSGIX (GLint marker);
+GLAPI void APIENTRY glStartInstrumentsSGIX (void);
+GLAPI void APIENTRY glStopInstrumentsSGIX (GLint marker);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLint (APIENTRYP PFNGLGETINSTRUMENTSSGIXPROC) (void);
+typedef void (APIENTRYP PFNGLINSTRUMENTSBUFFERSGIXPROC) (GLsizei size, GLint *buffer);
+typedef GLint (APIENTRYP PFNGLPOLLINSTRUMENTSSGIXPROC) (GLint *marker_p);
+typedef void (APIENTRYP PFNGLREADINSTRUMENTSSGIXPROC) (GLint marker);
+typedef void (APIENTRYP PFNGLSTARTINSTRUMENTSSGIXPROC) (void);
+typedef void (APIENTRYP PFNGLSTOPINSTRUMENTSSGIXPROC) (GLint marker);
+#endif
+
+#ifndef GL_SGIX_texture_scale_bias
+#define GL_SGIX_texture_scale_bias 1
+#endif
+
+#ifndef GL_SGIX_framezoom
+#define GL_SGIX_framezoom 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glFrameZoomSGIX (GLint factor);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLFRAMEZOOMSGIXPROC) (GLint factor);
+#endif
+
+#ifndef GL_SGIX_tag_sample_buffer
+#define GL_SGIX_tag_sample_buffer 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTagSampleBufferSGIX (void);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTAGSAMPLEBUFFERSGIXPROC) (void);
+#endif
+
+#ifndef GL_SGIX_polynomial_ffd
+#define GL_SGIX_polynomial_ffd 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDeformationMap3dSGIX (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points);
+GLAPI void APIENTRY glDeformationMap3fSGIX (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points);
+GLAPI void APIENTRY glDeformSGIX (GLbitfield mask);
+GLAPI void APIENTRY glLoadIdentityDeformationMapSGIX (GLbitfield mask);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDEFORMATIONMAP3DSGIXPROC) (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points);
+typedef void (APIENTRYP PFNGLDEFORMATIONMAP3FSGIXPROC) (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points);
+typedef void (APIENTRYP PFNGLDEFORMSGIXPROC) (GLbitfield mask);
+typedef void (APIENTRYP PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC) (GLbitfield mask);
+#endif
+
+#ifndef GL_SGIX_reference_plane
+#define GL_SGIX_reference_plane 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glReferencePlaneSGIX (const GLdouble *equation);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLREFERENCEPLANESGIXPROC) (const GLdouble *equation);
+#endif
+
+#ifndef GL_SGIX_flush_raster
+#define GL_SGIX_flush_raster 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glFlushRasterSGIX (void);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLFLUSHRASTERSGIXPROC) (void);
+#endif
+
+#ifndef GL_SGIX_depth_texture
+#define GL_SGIX_depth_texture 1
+#endif
+
+#ifndef GL_SGIS_fog_function
+#define GL_SGIS_fog_function 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glFogFuncSGIS (GLsizei n, const GLfloat *points);
+GLAPI void APIENTRY glGetFogFuncSGIS (GLfloat *points);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat *points);
+typedef void (APIENTRYP PFNGLGETFOGFUNCSGISPROC) (GLfloat *points);
+#endif
+
+#ifndef GL_SGIX_fog_offset
+#define GL_SGIX_fog_offset 1
+#endif
+
+#ifndef GL_HP_image_transform
+#define GL_HP_image_transform 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glImageTransformParameteriHP (GLenum target, GLenum pname, GLint param);
+GLAPI void APIENTRY glImageTransformParameterfHP (GLenum target, GLenum pname, GLfloat param);
+GLAPI void APIENTRY glImageTransformParameterivHP (GLenum target, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glImageTransformParameterfvHP (GLenum target, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glGetImageTransformParameterivHP (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetImageTransformParameterfvHP (GLenum target, GLenum pname, GLfloat *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, GLint param);
+typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, GLfloat param);
+typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat *params);
+typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, GLfloat *params);
+#endif
+
+#ifndef GL_HP_convolution_border_modes
+#define GL_HP_convolution_border_modes 1
+#endif
+
+#ifndef GL_SGIX_texture_add_env
+#define GL_SGIX_texture_add_env 1
+#endif
+
+#ifndef GL_EXT_color_subtable
+#define GL_EXT_color_subtable 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glColorSubTableEXT (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);
+GLAPI void APIENTRY glCopyColorSubTableEXT (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);
+typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
+#endif
+
+#ifndef GL_PGI_vertex_hints
+#define GL_PGI_vertex_hints 1
+#endif
+
+#ifndef GL_PGI_misc_hints
+#define GL_PGI_misc_hints 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glHintPGI (GLenum target, GLint mode);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLHINTPGIPROC) (GLenum target, GLint mode);
+#endif
+
+#ifndef GL_EXT_paletted_texture
+#define GL_EXT_paletted_texture 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glColorTableEXT (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
+GLAPI void APIENTRY glGetColorTableEXT (GLenum target, GLenum format, GLenum type, GLvoid *data);
+GLAPI void APIENTRY glGetColorTableParameterivEXT (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetColorTableParameterfvEXT (GLenum target, GLenum pname, GLfloat *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
+typedef void (APIENTRYP PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *data);
+typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);
+#endif
+
+#ifndef GL_EXT_clip_volume_hint
+#define GL_EXT_clip_volume_hint 1
+#endif
+
+#ifndef GL_SGIX_list_priority
+#define GL_SGIX_list_priority 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetListParameterfvSGIX (GLuint list, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetListParameterivSGIX (GLuint list, GLenum pname, GLint *params);
+GLAPI void APIENTRY glListParameterfSGIX (GLuint list, GLenum pname, GLfloat param);
+GLAPI void APIENTRY glListParameterfvSGIX (GLuint list, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glListParameteriSGIX (GLuint list, GLenum pname, GLint param);
+GLAPI void APIENTRY glListParameterivSGIX (GLuint list, GLenum pname, const GLint *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLLISTPARAMETERFSGIXPROC) (GLuint list, GLenum pname, GLfloat param);
+typedef void (APIENTRYP PFNGLLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, const GLfloat *params);
+typedef void (APIENTRYP PFNGLLISTPARAMETERISGIXPROC) (GLuint list, GLenum pname, GLint param);
+typedef void (APIENTRYP PFNGLLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, const GLint *params);
+#endif
+
+#ifndef GL_SGIX_ir_instrument1
+#define GL_SGIX_ir_instrument1 1
+#endif
+
+#ifndef GL_SGIX_calligraphic_fragment
+#define GL_SGIX_calligraphic_fragment 1
+#endif
+
+#ifndef GL_SGIX_texture_lod_bias
+#define GL_SGIX_texture_lod_bias 1
+#endif
+
+#ifndef GL_SGIX_shadow_ambient
+#define GL_SGIX_shadow_ambient 1
+#endif
+
+#ifndef GL_EXT_index_texture
+#define GL_EXT_index_texture 1
+#endif
+
+#ifndef GL_EXT_index_material
+#define GL_EXT_index_material 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glIndexMaterialEXT (GLenum face, GLenum mode);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode);
+#endif
+
+#ifndef GL_EXT_index_func
+#define GL_EXT_index_func 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glIndexFuncEXT (GLenum func, GLclampf ref);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLINDEXFUNCEXTPROC) (GLenum func, GLclampf ref);
+#endif
+
+#ifndef GL_EXT_index_array_formats
+#define GL_EXT_index_array_formats 1
+#endif
+
+#ifndef GL_EXT_compiled_vertex_array
+#define GL_EXT_compiled_vertex_array 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glLockArraysEXT (GLint first, GLsizei count);
+GLAPI void APIENTRY glUnlockArraysEXT (void);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count);
+typedef void (APIENTRYP PFNGLUNLOCKARRAYSEXTPROC) (void);
+#endif
+
+#ifndef GL_EXT_cull_vertex
+#define GL_EXT_cull_vertex 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glCullParameterdvEXT (GLenum pname, GLdouble *params);
+GLAPI void APIENTRY glCullParameterfvEXT (GLenum pname, GLfloat *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble *params);
+typedef void (APIENTRYP PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat *params);
+#endif
+
+#ifndef GL_SGIX_ycrcb
+#define GL_SGIX_ycrcb 1
+#endif
+
+#ifndef GL_SGIX_fragment_lighting
+#define GL_SGIX_fragment_lighting 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glFragmentColorMaterialSGIX (GLenum face, GLenum mode);
+GLAPI void APIENTRY glFragmentLightfSGIX (GLenum light, GLenum pname, GLfloat param);
+GLAPI void APIENTRY glFragmentLightfvSGIX (GLenum light, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glFragmentLightiSGIX (GLenum light, GLenum pname, GLint param);
+GLAPI void APIENTRY glFragmentLightivSGIX (GLenum light, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glFragmentLightModelfSGIX (GLenum pname, GLfloat param);
+GLAPI void APIENTRY glFragmentLightModelfvSGIX (GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glFragmentLightModeliSGIX (GLenum pname, GLint param);
+GLAPI void APIENTRY glFragmentLightModelivSGIX (GLenum pname, const GLint *params);
+GLAPI void APIENTRY glFragmentMaterialfSGIX (GLenum face, GLenum pname, GLfloat param);
+GLAPI void APIENTRY glFragmentMaterialfvSGIX (GLenum face, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glFragmentMaterialiSGIX (GLenum face, GLenum pname, GLint param);
+GLAPI void APIENTRY glFragmentMaterialivSGIX (GLenum face, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glGetFragmentLightfvSGIX (GLenum light, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetFragmentLightivSGIX (GLenum light, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetFragmentMaterialfvSGIX (GLenum face, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetFragmentMaterialivSGIX (GLenum face, GLenum pname, GLint *params);
+GLAPI void APIENTRY glLightEnviSGIX (GLenum pname, GLint param);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode);
+typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param);
+typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, const GLfloat *params);
+typedef void (APIENTRYP PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param);
+typedef void (APIENTRYP PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param);
+typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, const GLfloat *params);
+typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param);
+typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, GLfloat param);
+typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat *params);
+typedef void (APIENTRYP PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, GLint param);
+typedef void (APIENTRYP PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param);
+#endif
+
+#ifndef GL_IBM_rasterpos_clip
+#define GL_IBM_rasterpos_clip 1
+#endif
+
+#ifndef GL_HP_texture_lighting
+#define GL_HP_texture_lighting 1
+#endif
+
+#ifndef GL_EXT_draw_range_elements
+#define GL_EXT_draw_range_elements 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDrawRangeElementsEXT (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
+#endif
+
+#ifndef GL_WIN_phong_shading
+#define GL_WIN_phong_shading 1
+#endif
+
+#ifndef GL_WIN_specular_fog
+#define GL_WIN_specular_fog 1
+#endif
+
+#ifndef GL_EXT_light_texture
+#define GL_EXT_light_texture 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glApplyTextureEXT (GLenum mode);
+GLAPI void APIENTRY glTextureLightEXT (GLenum pname);
+GLAPI void APIENTRY glTextureMaterialEXT (GLenum face, GLenum mode);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode);
+typedef void (APIENTRYP PFNGLTEXTURELIGHTEXTPROC) (GLenum pname);
+typedef void (APIENTRYP PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode);
+#endif
+
+#ifndef GL_SGIX_blend_alpha_minmax
+#define GL_SGIX_blend_alpha_minmax 1
+#endif
+
+#ifndef GL_EXT_bgra
+#define GL_EXT_bgra 1
+#endif
+
+#ifndef GL_SGIX_async
+#define GL_SGIX_async 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glAsyncMarkerSGIX (GLuint marker);
+GLAPI GLint APIENTRY glFinishAsyncSGIX (GLuint *markerp);
+GLAPI GLint APIENTRY glPollAsyncSGIX (GLuint *markerp);
+GLAPI GLuint APIENTRY glGenAsyncMarkersSGIX (GLsizei range);
+GLAPI void APIENTRY glDeleteAsyncMarkersSGIX (GLuint marker, GLsizei range);
+GLAPI GLboolean APIENTRY glIsAsyncMarkerSGIX (GLuint marker);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLASYNCMARKERSGIXPROC) (GLuint marker);
+typedef GLint (APIENTRYP PFNGLFINISHASYNCSGIXPROC) (GLuint *markerp);
+typedef GLint (APIENTRYP PFNGLPOLLASYNCSGIXPROC) (GLuint *markerp);
+typedef GLuint (APIENTRYP PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range);
+typedef void (APIENTRYP PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range);
+typedef GLboolean (APIENTRYP PFNGLISASYNCMARKERSGIXPROC) (GLuint marker);
+#endif
+
+#ifndef GL_SGIX_async_pixel
+#define GL_SGIX_async_pixel 1
+#endif
+
+#ifndef GL_SGIX_async_histogram
+#define GL_SGIX_async_histogram 1
+#endif
+
+#ifndef GL_INTEL_parallel_arrays
+#define GL_INTEL_parallel_arrays 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glVertexPointervINTEL (GLint size, GLenum type, const GLvoid* *pointer);
+GLAPI void APIENTRY glNormalPointervINTEL (GLenum type, const GLvoid* *pointer);
+GLAPI void APIENTRY glColorPointervINTEL (GLint size, GLenum type, const GLvoid* *pointer);
+GLAPI void APIENTRY glTexCoordPointervINTEL (GLint size, GLenum type, const GLvoid* *pointer);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer);
+typedef void (APIENTRYP PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const GLvoid* *pointer);
+typedef void (APIENTRYP PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer);
+typedef void (APIENTRYP PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer);
+#endif
+
+#ifndef GL_HP_occlusion_test
+#define GL_HP_occlusion_test 1
+#endif
+
+#ifndef GL_EXT_pixel_transform
+#define GL_EXT_pixel_transform 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glPixelTransformParameteriEXT (GLenum target, GLenum pname, GLint param);
+GLAPI void APIENTRY glPixelTransformParameterfEXT (GLenum target, GLenum pname, GLfloat param);
+GLAPI void APIENTRY glPixelTransformParameterivEXT (GLenum target, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glPixelTransformParameterfvEXT (GLenum target, GLenum pname, const GLfloat *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param);
+typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param);
+typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params);
+#endif
+
+#ifndef GL_EXT_pixel_transform_color_table
+#define GL_EXT_pixel_transform_color_table 1
+#endif
+
+#ifndef GL_EXT_shared_texture_palette
+#define GL_EXT_shared_texture_palette 1
+#endif
+
+#ifndef GL_EXT_separate_specular_color
+#define GL_EXT_separate_specular_color 1
+#endif
+
+#ifndef GL_EXT_secondary_color
+#define GL_EXT_secondary_color 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glSecondaryColor3bEXT (GLbyte red, GLbyte green, GLbyte blue);
+GLAPI void APIENTRY glSecondaryColor3bvEXT (const GLbyte *v);
+GLAPI void APIENTRY glSecondaryColor3dEXT (GLdouble red, GLdouble green, GLdouble blue);
+GLAPI void APIENTRY glSecondaryColor3dvEXT (const GLdouble *v);
+GLAPI void APIENTRY glSecondaryColor3fEXT (GLfloat red, GLfloat green, GLfloat blue);
+GLAPI void APIENTRY glSecondaryColor3fvEXT (const GLfloat *v);
+GLAPI void APIENTRY glSecondaryColor3iEXT (GLint red, GLint green, GLint blue);
+GLAPI void APIENTRY glSecondaryColor3ivEXT (const GLint *v);
+GLAPI void APIENTRY glSecondaryColor3sEXT (GLshort red, GLshort green, GLshort blue);
+GLAPI void APIENTRY glSecondaryColor3svEXT (const GLshort *v);
+GLAPI void APIENTRY glSecondaryColor3ubEXT (GLubyte red, GLubyte green, GLubyte blue);
+GLAPI void APIENTRY glSecondaryColor3ubvEXT (const GLubyte *v);
+GLAPI void APIENTRY glSecondaryColor3uiEXT (GLuint red, GLuint green, GLuint blue);
+GLAPI void APIENTRY glSecondaryColor3uivEXT (const GLuint *v);
+GLAPI void APIENTRY glSecondaryColor3usEXT (GLushort red, GLushort green, GLushort blue);
+GLAPI void APIENTRY glSecondaryColor3usvEXT (const GLushort *v);
+GLAPI void APIENTRY glSecondaryColorPointerEXT (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v);
+typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+#endif
+
+#ifndef GL_EXT_texture_perturb_normal
+#define GL_EXT_texture_perturb_normal 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTextureNormalEXT (GLenum mode);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTEXTURENORMALEXTPROC) (GLenum mode);
+#endif
+
+#ifndef GL_EXT_multi_draw_arrays
+#define GL_EXT_multi_draw_arrays 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glMultiDrawArraysEXT (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
+GLAPI void APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
+typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
+#endif
+
+#ifndef GL_EXT_fog_coord
+#define GL_EXT_fog_coord 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glFogCoordfEXT (GLfloat coord);
+GLAPI void APIENTRY glFogCoordfvEXT (const GLfloat *coord);
+GLAPI void APIENTRY glFogCoorddEXT (GLdouble coord);
+GLAPI void APIENTRY glFogCoorddvEXT (const GLdouble *coord);
+GLAPI void APIENTRY glFogCoordPointerEXT (GLenum type, GLsizei stride, const GLvoid *pointer);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLFOGCOORDFEXTPROC) (GLfloat coord);
+typedef void (APIENTRYP PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord);
+typedef void (APIENTRYP PFNGLFOGCOORDDEXTPROC) (GLdouble coord);
+typedef void (APIENTRYP PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord);
+typedef void (APIENTRYP PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);
+#endif
+
+#ifndef GL_REND_screen_coordinates
+#define GL_REND_screen_coordinates 1
+#endif
+
+#ifndef GL_EXT_coordinate_frame
+#define GL_EXT_coordinate_frame 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTangent3bEXT (GLbyte tx, GLbyte ty, GLbyte tz);
+GLAPI void APIENTRY glTangent3bvEXT (const GLbyte *v);
+GLAPI void APIENTRY glTangent3dEXT (GLdouble tx, GLdouble ty, GLdouble tz);
+GLAPI void APIENTRY glTangent3dvEXT (const GLdouble *v);
+GLAPI void APIENTRY glTangent3fEXT (GLfloat tx, GLfloat ty, GLfloat tz);
+GLAPI void APIENTRY glTangent3fvEXT (const GLfloat *v);
+GLAPI void APIENTRY glTangent3iEXT (GLint tx, GLint ty, GLint tz);
+GLAPI void APIENTRY glTangent3ivEXT (const GLint *v);
+GLAPI void APIENTRY glTangent3sEXT (GLshort tx, GLshort ty, GLshort tz);
+GLAPI void APIENTRY glTangent3svEXT (const GLshort *v);
+GLAPI void APIENTRY glBinormal3bEXT (GLbyte bx, GLbyte by, GLbyte bz);
+GLAPI void APIENTRY glBinormal3bvEXT (const GLbyte *v);
+GLAPI void APIENTRY glBinormal3dEXT (GLdouble bx, GLdouble by, GLdouble bz);
+GLAPI void APIENTRY glBinormal3dvEXT (const GLdouble *v);
+GLAPI void APIENTRY glBinormal3fEXT (GLfloat bx, GLfloat by, GLfloat bz);
+GLAPI void APIENTRY glBinormal3fvEXT (const GLfloat *v);
+GLAPI void APIENTRY glBinormal3iEXT (GLint bx, GLint by, GLint bz);
+GLAPI void APIENTRY glBinormal3ivEXT (const GLint *v);
+GLAPI void APIENTRY glBinormal3sEXT (GLshort bx, GLshort by, GLshort bz);
+GLAPI void APIENTRY glBinormal3svEXT (const GLshort *v);
+GLAPI void APIENTRY glTangentPointerEXT (GLenum type, GLsizei stride, const GLvoid *pointer);
+GLAPI void APIENTRY glBinormalPointerEXT (GLenum type, GLsizei stride, const GLvoid *pointer);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTANGENT3BEXTPROC) (GLbyte tx, GLbyte ty, GLbyte tz);
+typedef void (APIENTRYP PFNGLTANGENT3BVEXTPROC) (const GLbyte *v);
+typedef void (APIENTRYP PFNGLTANGENT3DEXTPROC) (GLdouble tx, GLdouble ty, GLdouble tz);
+typedef void (APIENTRYP PFNGLTANGENT3DVEXTPROC) (const GLdouble *v);
+typedef void (APIENTRYP PFNGLTANGENT3FEXTPROC) (GLfloat tx, GLfloat ty, GLfloat tz);
+typedef void (APIENTRYP PFNGLTANGENT3FVEXTPROC) (const GLfloat *v);
+typedef void (APIENTRYP PFNGLTANGENT3IEXTPROC) (GLint tx, GLint ty, GLint tz);
+typedef void (APIENTRYP PFNGLTANGENT3IVEXTPROC) (const GLint *v);
+typedef void (APIENTRYP PFNGLTANGENT3SEXTPROC) (GLshort tx, GLshort ty, GLshort tz);
+typedef void (APIENTRYP PFNGLTANGENT3SVEXTPROC) (const GLshort *v);
+typedef void (APIENTRYP PFNGLBINORMAL3BEXTPROC) (GLbyte bx, GLbyte by, GLbyte bz);
+typedef void (APIENTRYP PFNGLBINORMAL3BVEXTPROC) (const GLbyte *v);
+typedef void (APIENTRYP PFNGLBINORMAL3DEXTPROC) (GLdouble bx, GLdouble by, GLdouble bz);
+typedef void (APIENTRYP PFNGLBINORMAL3DVEXTPROC) (const GLdouble *v);
+typedef void (APIENTRYP PFNGLBINORMAL3FEXTPROC) (GLfloat bx, GLfloat by, GLfloat bz);
+typedef void (APIENTRYP PFNGLBINORMAL3FVEXTPROC) (const GLfloat *v);
+typedef void (APIENTRYP PFNGLBINORMAL3IEXTPROC) (GLint bx, GLint by, GLint bz);
+typedef void (APIENTRYP PFNGLBINORMAL3IVEXTPROC) (const GLint *v);
+typedef void (APIENTRYP PFNGLBINORMAL3SEXTPROC) (GLshort bx, GLshort by, GLshort bz);
+typedef void (APIENTRYP PFNGLBINORMAL3SVEXTPROC) (const GLshort *v);
+typedef void (APIENTRYP PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);
+typedef void (APIENTRYP PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);
+#endif
+
+#ifndef GL_EXT_texture_env_combine
+#define GL_EXT_texture_env_combine 1
+#endif
+
+#ifndef GL_APPLE_specular_vector
+#define GL_APPLE_specular_vector 1
+#endif
+
+#ifndef GL_APPLE_transform_hint
+#define GL_APPLE_transform_hint 1
+#endif
+
+#ifndef GL_SGIX_fog_scale
+#define GL_SGIX_fog_scale 1
+#endif
+
+#ifndef GL_SUNX_constant_data
+#define GL_SUNX_constant_data 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glFinishTextureSUNX (void);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLFINISHTEXTURESUNXPROC) (void);
+#endif
+
+#ifndef GL_SUN_global_alpha
+#define GL_SUN_global_alpha 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGlobalAlphaFactorbSUN (GLbyte factor);
+GLAPI void APIENTRY glGlobalAlphaFactorsSUN (GLshort factor);
+GLAPI void APIENTRY glGlobalAlphaFactoriSUN (GLint factor);
+GLAPI void APIENTRY glGlobalAlphaFactorfSUN (GLfloat factor);
+GLAPI void APIENTRY glGlobalAlphaFactordSUN (GLdouble factor);
+GLAPI void APIENTRY glGlobalAlphaFactorubSUN (GLubyte factor);
+GLAPI void APIENTRY glGlobalAlphaFactorusSUN (GLushort factor);
+GLAPI void APIENTRY glGlobalAlphaFactoruiSUN (GLuint factor);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor);
+typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor);
+typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor);
+typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor);
+typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor);
+typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor);
+typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor);
+typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor);
+#endif
+
+#ifndef GL_SUN_triangle_list
+#define GL_SUN_triangle_list 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glReplacementCodeuiSUN (GLuint code);
+GLAPI void APIENTRY glReplacementCodeusSUN (GLushort code);
+GLAPI void APIENTRY glReplacementCodeubSUN (GLubyte code);
+GLAPI void APIENTRY glReplacementCodeuivSUN (const GLuint *code);
+GLAPI void APIENTRY glReplacementCodeusvSUN (const GLushort *code);
+GLAPI void APIENTRY glReplacementCodeubvSUN (const GLubyte *code);
+GLAPI void APIENTRY glReplacementCodePointerSUN (GLenum type, GLsizei stride, const GLvoid* *pointer);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code);
+typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code);
+typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code);
+typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint *code);
+typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort *code);
+typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte *code);
+typedef void (APIENTRYP PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const GLvoid* *pointer);
+#endif
+
+#ifndef GL_SUN_vertex
+#define GL_SUN_vertex 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glColor4ubVertex2fSUN (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y);
+GLAPI void APIENTRY glColor4ubVertex2fvSUN (const GLubyte *c, const GLfloat *v);
+GLAPI void APIENTRY glColor4ubVertex3fSUN (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glColor4ubVertex3fvSUN (const GLubyte *c, const GLfloat *v);
+GLAPI void APIENTRY glColor3fVertex3fSUN (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glColor3fVertex3fvSUN (const GLfloat *c, const GLfloat *v);
+GLAPI void APIENTRY glNormal3fVertex3fSUN (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glNormal3fVertex3fvSUN (const GLfloat *n, const GLfloat *v);
+GLAPI void APIENTRY glColor4fNormal3fVertex3fSUN (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glColor4fNormal3fVertex3fvSUN (const GLfloat *c, const GLfloat *n, const GLfloat *v);
+GLAPI void APIENTRY glTexCoord2fVertex3fSUN (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glTexCoord2fVertex3fvSUN (const GLfloat *tc, const GLfloat *v);
+GLAPI void APIENTRY glTexCoord4fVertex4fSUN (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GLAPI void APIENTRY glTexCoord4fVertex4fvSUN (const GLfloat *tc, const GLfloat *v);
+GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fSUN (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fvSUN (const GLfloat *tc, const GLubyte *c, const GLfloat *v);
+GLAPI void APIENTRY glTexCoord2fColor3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glTexCoord2fColor3fVertex3fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *v);
+GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fvSUN (const GLfloat *tc, const GLfloat *n, const GLfloat *v);
+GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
+GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fSUN (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
+GLAPI void APIENTRY glReplacementCodeuiVertex3fSUN (GLuint rc, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glReplacementCodeuiVertex3fvSUN (const GLuint *rc, const GLfloat *v);
+GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fSUN (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fvSUN (const GLuint *rc, const GLubyte *c, const GLfloat *v);
+GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fSUN (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fvSUN (const GLuint *rc, const GLfloat *c, const GLfloat *v);
+GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fSUN (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *n, const GLfloat *v);
+GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fSUN (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
+GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *v);
+GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v);
+GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y);
+typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte *c, const GLfloat *v);
+typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte *c, const GLfloat *v);
+typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *v);
+typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *n, const GLfloat *v);
+typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *n, const GLfloat *v);
+typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *v);
+typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *v);
+typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat *tc, const GLubyte *c, const GLfloat *v);
+typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *v);
+typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *n, const GLfloat *v);
+typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
+typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
+typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLuint rc, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *v);
+typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLuint *rc, const GLubyte *c, const GLfloat *v);
+typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *v);
+typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *n, const GLfloat *v);
+typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
+typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *v);
+typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v);
+typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
+#endif
+
+#ifndef GL_EXT_blend_func_separate
+#define GL_EXT_blend_func_separate 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBlendFuncSeparateEXT (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+#endif
+
+#ifndef GL_INGR_blend_func_separate
+#define GL_INGR_blend_func_separate 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+#endif
+
+#ifndef GL_INGR_color_clamp
+#define GL_INGR_color_clamp 1
+#endif
+
+#ifndef GL_INGR_interlace_read
+#define GL_INGR_interlace_read 1
+#endif
+
+#ifndef GL_EXT_stencil_wrap
+#define GL_EXT_stencil_wrap 1
+#endif
+
+#ifndef GL_EXT_422_pixels
+#define GL_EXT_422_pixels 1
+#endif
+
+#ifndef GL_NV_texgen_reflection
+#define GL_NV_texgen_reflection 1
+#endif
+
+#ifndef GL_SUN_convolution_border_modes
+#define GL_SUN_convolution_border_modes 1
+#endif
+
+#ifndef GL_EXT_texture_env_add
+#define GL_EXT_texture_env_add 1
+#endif
+
+#ifndef GL_EXT_texture_lod_bias
+#define GL_EXT_texture_lod_bias 1
+#endif
+
+#ifndef GL_EXT_texture_filter_anisotropic
+#define GL_EXT_texture_filter_anisotropic 1
+#endif
+
+#ifndef GL_EXT_vertex_weighting
+#define GL_EXT_vertex_weighting 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glVertexWeightfEXT (GLfloat weight);
+GLAPI void APIENTRY glVertexWeightfvEXT (const GLfloat *weight);
+GLAPI void APIENTRY glVertexWeightPointerEXT (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight);
+typedef void (APIENTRYP PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight);
+typedef void (APIENTRYP PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer);
+#endif
+
+#ifndef GL_NV_light_max_exponent
+#define GL_NV_light_max_exponent 1
+#endif
+
+#ifndef GL_NV_vertex_array_range
+#define GL_NV_vertex_array_range 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glFlushVertexArrayRangeNV (void);
+GLAPI void APIENTRY glVertexArrayRangeNV (GLsizei length, const GLvoid *pointer);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void);
+typedef void (APIENTRYP PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, const GLvoid *pointer);
+#endif
+
+#ifndef GL_NV_register_combiners
+#define GL_NV_register_combiners 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glCombinerParameterfvNV (GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glCombinerParameterfNV (GLenum pname, GLfloat param);
+GLAPI void APIENTRY glCombinerParameterivNV (GLenum pname, const GLint *params);
+GLAPI void APIENTRY glCombinerParameteriNV (GLenum pname, GLint param);
+GLAPI void APIENTRY glCombinerInputNV (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
+GLAPI void APIENTRY glCombinerOutputNV (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum);
+GLAPI void APIENTRY glFinalCombinerInputNV (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
+GLAPI void APIENTRY glGetCombinerInputParameterfvNV (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetCombinerInputParameterivNV (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetCombinerOutputParameterfvNV (GLenum stage, GLenum portion, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetCombinerOutputParameterivNV (GLenum stage, GLenum portion, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetFinalCombinerInputParameterfvNV (GLenum variable, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetFinalCombinerInputParameterivNV (GLenum variable, GLenum pname, GLint *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat *params);
+typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param);
+typedef void (APIENTRYP PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param);
+typedef void (APIENTRYP PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
+typedef void (APIENTRYP PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum);
+typedef void (APIENTRYP PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
+typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint *params);
+#endif
+
+#ifndef GL_NV_fog_distance
+#define GL_NV_fog_distance 1
+#endif
+
+#ifndef GL_NV_texgen_emboss
+#define GL_NV_texgen_emboss 1
+#endif
+
+#ifndef GL_NV_blend_square
+#define GL_NV_blend_square 1
+#endif
+
+#ifndef GL_NV_texture_env_combine4
+#define GL_NV_texture_env_combine4 1
+#endif
+
+#ifndef GL_MESA_resize_buffers
+#define GL_MESA_resize_buffers 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glResizeBuffersMESA (void);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLRESIZEBUFFERSMESAPROC) (void);
+#endif
+
+#ifndef GL_MESA_window_pos
+#define GL_MESA_window_pos 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glWindowPos2dMESA (GLdouble x, GLdouble y);
+GLAPI void APIENTRY glWindowPos2dvMESA (const GLdouble *v);
+GLAPI void APIENTRY glWindowPos2fMESA (GLfloat x, GLfloat y);
+GLAPI void APIENTRY glWindowPos2fvMESA (const GLfloat *v);
+GLAPI void APIENTRY glWindowPos2iMESA (GLint x, GLint y);
+GLAPI void APIENTRY glWindowPos2ivMESA (const GLint *v);
+GLAPI void APIENTRY glWindowPos2sMESA (GLshort x, GLshort y);
+GLAPI void APIENTRY glWindowPos2svMESA (const GLshort *v);
+GLAPI void APIENTRY glWindowPos3dMESA (GLdouble x, GLdouble y, GLdouble z);
+GLAPI void APIENTRY glWindowPos3dvMESA (const GLdouble *v);
+GLAPI void APIENTRY glWindowPos3fMESA (GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glWindowPos3fvMESA (const GLfloat *v);
+GLAPI void APIENTRY glWindowPos3iMESA (GLint x, GLint y, GLint z);
+GLAPI void APIENTRY glWindowPos3ivMESA (const GLint *v);
+GLAPI void APIENTRY glWindowPos3sMESA (GLshort x, GLshort y, GLshort z);
+GLAPI void APIENTRY glWindowPos3svMESA (const GLshort *v);
+GLAPI void APIENTRY glWindowPos4dMESA (GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+GLAPI void APIENTRY glWindowPos4dvMESA (const GLdouble *v);
+GLAPI void APIENTRY glWindowPos4fMESA (GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GLAPI void APIENTRY glWindowPos4fvMESA (const GLfloat *v);
+GLAPI void APIENTRY glWindowPos4iMESA (GLint x, GLint y, GLint z, GLint w);
+GLAPI void APIENTRY glWindowPos4ivMESA (const GLint *v);
+GLAPI void APIENTRY glWindowPos4sMESA (GLshort x, GLshort y, GLshort z, GLshort w);
+GLAPI void APIENTRY glWindowPos4svMESA (const GLshort *v);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y);
+typedef void (APIENTRYP PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble *v);
+typedef void (APIENTRYP PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y);
+typedef void (APIENTRYP PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat *v);
+typedef void (APIENTRYP PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y);
+typedef void (APIENTRYP PFNGLWINDOWPOS2IVMESAPROC) (const GLint *v);
+typedef void (APIENTRYP PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y);
+typedef void (APIENTRYP PFNGLWINDOWPOS2SVMESAPROC) (const GLshort *v);
+typedef void (APIENTRYP PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRYP PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble *v);
+typedef void (APIENTRYP PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat *v);
+typedef void (APIENTRYP PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z);
+typedef void (APIENTRYP PFNGLWINDOWPOS3IVMESAPROC) (const GLint *v);
+typedef void (APIENTRYP PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z);
+typedef void (APIENTRYP PFNGLWINDOWPOS3SVMESAPROC) (const GLshort *v);
+typedef void (APIENTRYP PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRYP PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble *v);
+typedef void (APIENTRYP PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (APIENTRYP PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat *v);
+typedef void (APIENTRYP PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w);
+typedef void (APIENTRYP PFNGLWINDOWPOS4IVMESAPROC) (const GLint *v);
+typedef void (APIENTRYP PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w);
+typedef void (APIENTRYP PFNGLWINDOWPOS4SVMESAPROC) (const GLshort *v);
+#endif
+
+#ifndef GL_IBM_cull_vertex
+#define GL_IBM_cull_vertex 1
+#endif
+
+#ifndef GL_IBM_multimode_draw_arrays
+#define GL_IBM_multimode_draw_arrays 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glMultiModeDrawArraysIBM (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride);
+GLAPI void APIENTRY glMultiModeDrawElementsIBM (const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, GLint modestride);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLMULTIMODEDRAWARRAYSIBMPROC) (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride);
+typedef void (APIENTRYP PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, GLint modestride);
+#endif
+
+#ifndef GL_IBM_vertex_array_lists
+#define GL_IBM_vertex_array_lists 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glColorPointerListIBM (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
+GLAPI void APIENTRY glSecondaryColorPointerListIBM (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
+GLAPI void APIENTRY glEdgeFlagPointerListIBM (GLint stride, const GLboolean* *pointer, GLint ptrstride);
+GLAPI void APIENTRY glFogCoordPointerListIBM (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
+GLAPI void APIENTRY glIndexPointerListIBM (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
+GLAPI void APIENTRY glNormalPointerListIBM (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
+GLAPI void APIENTRY glTexCoordPointerListIBM (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
+GLAPI void APIENTRY glVertexPointerListIBM (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
+typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
+typedef void (APIENTRYP PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean* *pointer, GLint ptrstride);
+typedef void (APIENTRYP PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
+typedef void (APIENTRYP PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
+typedef void (APIENTRYP PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
+typedef void (APIENTRYP PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
+typedef void (APIENTRYP PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
+#endif
+
+#ifndef GL_SGIX_subsample
+#define GL_SGIX_subsample 1
+#endif
+
+#ifndef GL_SGIX_ycrcba
+#define GL_SGIX_ycrcba 1
+#endif
+
+#ifndef GL_SGIX_ycrcb_subsample
+#define GL_SGIX_ycrcb_subsample 1
+#endif
+
+#ifndef GL_SGIX_depth_pass_instrument
+#define GL_SGIX_depth_pass_instrument 1
+#endif
+
+#ifndef GL_3DFX_texture_compression_FXT1
+#define GL_3DFX_texture_compression_FXT1 1
+#endif
+
+#ifndef GL_3DFX_multisample
+#define GL_3DFX_multisample 1
+#endif
+
+#ifndef GL_3DFX_tbuffer
+#define GL_3DFX_tbuffer 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTbufferMask3DFX (GLuint mask);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTBUFFERMASK3DFXPROC) (GLuint mask);
+#endif
+
+#ifndef GL_EXT_multisample
+#define GL_EXT_multisample 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glSampleMaskEXT (GLclampf value, GLboolean invert);
+GLAPI void APIENTRY glSamplePatternEXT (GLenum pattern);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert);
+typedef void (APIENTRYP PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern);
+#endif
+
+#ifndef GL_SGIX_vertex_preclip
+#define GL_SGIX_vertex_preclip 1
+#endif
+
+#ifndef GL_SGIX_convolution_accuracy
+#define GL_SGIX_convolution_accuracy 1
+#endif
+
+#ifndef GL_SGIX_resample
+#define GL_SGIX_resample 1
+#endif
+
+#ifndef GL_SGIS_point_line_texgen
+#define GL_SGIS_point_line_texgen 1
+#endif
+
+#ifndef GL_SGIS_texture_color_mask
+#define GL_SGIS_texture_color_mask 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTextureColorMaskSGIS (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTEXTURECOLORMASKSGISPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+#endif
+
+#ifndef GL_SGIX_igloo_interface
+#define GL_SGIX_igloo_interface 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glIglooInterfaceSGIX (GLenum pname, const GLvoid *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLIGLOOINTERFACESGIXPROC) (GLenum pname, const GLvoid *params);
+#endif
+
+#ifndef GL_EXT_texture_env_dot3
+#define GL_EXT_texture_env_dot3 1
+#endif
+
+#ifndef GL_ATI_texture_mirror_once
+#define GL_ATI_texture_mirror_once 1
+#endif
+
+#ifndef GL_NV_fence
+#define GL_NV_fence 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences);
+GLAPI void APIENTRY glGenFencesNV (GLsizei n, GLuint *fences);
+GLAPI GLboolean APIENTRY glIsFenceNV (GLuint fence);
+GLAPI GLboolean APIENTRY glTestFenceNV (GLuint fence);
+GLAPI void APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *params);
+GLAPI void APIENTRY glFinishFenceNV (GLuint fence);
+GLAPI void APIENTRY glSetFenceNV (GLuint fence, GLenum condition);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences);
+typedef void (APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences);
+typedef GLboolean (APIENTRYP PFNGLISFENCENVPROC) (GLuint fence);
+typedef GLboolean (APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence);
+typedef void (APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence);
+typedef void (APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
+#endif
+
+#ifndef GL_NV_evaluators
+#define GL_NV_evaluators 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glMapControlPointsNV (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const GLvoid *points);
+GLAPI void APIENTRY glMapParameterivNV (GLenum target, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glMapParameterfvNV (GLenum target, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glGetMapControlPointsNV (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, GLvoid *points);
+GLAPI void APIENTRY glGetMapParameterivNV (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetMapParameterfvNV (GLenum target, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetMapAttribParameterivNV (GLenum target, GLuint index, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetMapAttribParameterfvNV (GLenum target, GLuint index, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glEvalMapsNV (GLenum target, GLenum mode);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const GLvoid *points);
+typedef void (APIENTRYP PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, const GLfloat *params);
+typedef void (APIENTRYP PFNGLGETMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, GLvoid *points);
+typedef void (APIENTRYP PFNGLGETMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERIVNVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode);
+#endif
+
+#ifndef GL_NV_packed_depth_stencil
+#define GL_NV_packed_depth_stencil 1
+#endif
+
+#ifndef GL_NV_register_combiners2
+#define GL_NV_register_combiners2 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glCombinerStageParameterfvNV (GLenum stage, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum stage, GLenum pname, GLfloat *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat *params);
+typedef void (APIENTRYP PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat *params);
+#endif
+
+#ifndef GL_NV_texture_compression_vtc
+#define GL_NV_texture_compression_vtc 1
+#endif
+
+#ifndef GL_NV_texture_rectangle
+#define GL_NV_texture_rectangle 1
+#endif
+
+#ifndef GL_NV_texture_shader
+#define GL_NV_texture_shader 1
+#endif
+
+#ifndef GL_NV_texture_shader2
+#define GL_NV_texture_shader2 1
+#endif
+
+#ifndef GL_NV_vertex_array_range2
+#define GL_NV_vertex_array_range2 1
+#endif
+
+#ifndef GL_NV_vertex_program
+#define GL_NV_vertex_program 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI GLboolean APIENTRY glAreProgramsResidentNV (GLsizei n, const GLuint *programs, GLboolean *residences);
+GLAPI void APIENTRY glBindProgramNV (GLenum target, GLuint id);
+GLAPI void APIENTRY glDeleteProgramsNV (GLsizei n, const GLuint *programs);
+GLAPI void APIENTRY glExecuteProgramNV (GLenum target, GLuint id, const GLfloat *params);
+GLAPI void APIENTRY glGenProgramsNV (GLsizei n, GLuint *programs);
+GLAPI void APIENTRY glGetProgramParameterdvNV (GLenum target, GLuint index, GLenum pname, GLdouble *params);
+GLAPI void APIENTRY glGetProgramParameterfvNV (GLenum target, GLuint index, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetProgramivNV (GLuint id, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetProgramStringNV (GLuint id, GLenum pname, GLubyte *program);
+GLAPI void APIENTRY glGetTrackMatrixivNV (GLenum target, GLuint address, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetVertexAttribdvNV (GLuint index, GLenum pname, GLdouble *params);
+GLAPI void APIENTRY glGetVertexAttribfvNV (GLuint index, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetVertexAttribivNV (GLuint index, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetVertexAttribPointervNV (GLuint index, GLenum pname, GLvoid* *pointer);
+GLAPI GLboolean APIENTRY glIsProgramNV (GLuint id);
+GLAPI void APIENTRY glLoadProgramNV (GLenum target, GLuint id, GLsizei len, const GLubyte *program);
+GLAPI void APIENTRY glProgramParameter4dNV (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+GLAPI void APIENTRY glProgramParameter4dvNV (GLenum target, GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glProgramParameter4fNV (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GLAPI void APIENTRY glProgramParameter4fvNV (GLenum target, GLuint index, const GLfloat *v);
+GLAPI void APIENTRY glProgramParameters4dvNV (GLenum target, GLuint index, GLsizei count, const GLdouble *v);
+GLAPI void APIENTRY glProgramParameters4fvNV (GLenum target, GLuint index, GLsizei count, const GLfloat *v);
+GLAPI void APIENTRY glRequestResidentProgramsNV (GLsizei n, const GLuint *programs);
+GLAPI void APIENTRY glTrackMatrixNV (GLenum target, GLuint address, GLenum matrix, GLenum transform);
+GLAPI void APIENTRY glVertexAttribPointerNV (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer);
+GLAPI void APIENTRY glVertexAttrib1dNV (GLuint index, GLdouble x);
+GLAPI void APIENTRY glVertexAttrib1dvNV (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttrib1fNV (GLuint index, GLfloat x);
+GLAPI void APIENTRY glVertexAttrib1fvNV (GLuint index, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttrib1sNV (GLuint index, GLshort x);
+GLAPI void APIENTRY glVertexAttrib1svNV (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttrib2dNV (GLuint index, GLdouble x, GLdouble y);
+GLAPI void APIENTRY glVertexAttrib2dvNV (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttrib2fNV (GLuint index, GLfloat x, GLfloat y);
+GLAPI void APIENTRY glVertexAttrib2fvNV (GLuint index, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttrib2sNV (GLuint index, GLshort x, GLshort y);
+GLAPI void APIENTRY glVertexAttrib2svNV (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttrib3dNV (GLuint index, GLdouble x, GLdouble y, GLdouble z);
+GLAPI void APIENTRY glVertexAttrib3dvNV (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttrib3fNV (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glVertexAttrib3fvNV (GLuint index, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttrib3sNV (GLuint index, GLshort x, GLshort y, GLshort z);
+GLAPI void APIENTRY glVertexAttrib3svNV (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttrib4dNV (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+GLAPI void APIENTRY glVertexAttrib4dvNV (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttrib4fNV (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GLAPI void APIENTRY glVertexAttrib4fvNV (GLuint index, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttrib4sNV (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
+GLAPI void APIENTRY glVertexAttrib4svNV (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttrib4ubNV (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
+GLAPI void APIENTRY glVertexAttrib4ubvNV (GLuint index, const GLubyte *v);
+GLAPI void APIENTRY glVertexAttribs1dvNV (GLuint index, GLsizei count, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttribs1fvNV (GLuint index, GLsizei count, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttribs1svNV (GLuint index, GLsizei count, const GLshort *v);
+GLAPI void APIENTRY glVertexAttribs2dvNV (GLuint index, GLsizei count, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttribs2fvNV (GLuint index, GLsizei count, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttribs2svNV (GLuint index, GLsizei count, const GLshort *v);
+GLAPI void APIENTRY glVertexAttribs3dvNV (GLuint index, GLsizei count, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttribs3fvNV (GLuint index, GLsizei count, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttribs3svNV (GLuint index, GLsizei count, const GLshort *v);
+GLAPI void APIENTRY glVertexAttribs4dvNV (GLuint index, GLsizei count, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttribs4fvNV (GLuint index, GLsizei count, const GLfloat *v);
+GLAPI void APIENTRY glVertexAttribs4svNV (GLuint index, GLsizei count, const GLshort *v);
+GLAPI void APIENTRY glVertexAttribs4ubvNV (GLuint index, GLsizei count, const GLubyte *v);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLboolean (APIENTRYP PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint *programs, GLboolean *residences);
+typedef void (APIENTRYP PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id);
+typedef void (APIENTRYP PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint *programs);
+typedef void (APIENTRYP PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat *params);
+typedef void (APIENTRYP PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint *programs);
+typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble *params);
+typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte *program);
+typedef void (APIENTRYP PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble *params);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, GLvoid* *pointer);
+typedef GLboolean (APIENTRYP PFNGLISPROGRAMNVPROC) (GLuint id);
+typedef void (APIENTRYP PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte *program);
+typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat *v);
+typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLdouble *v);
+typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *v);
+typedef void (APIENTRYP PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, const GLuint *programs);
+typedef void (APIENTRYP PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBNVPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei count, const GLubyte *v);
+#endif
+
+#ifndef GL_SGIX_texture_coordinate_clamp
+#define GL_SGIX_texture_coordinate_clamp 1
+#endif
+
+#ifndef GL_SGIX_scalebias_hint
+#define GL_SGIX_scalebias_hint 1
+#endif
+
+#ifndef GL_OML_interlace
+#define GL_OML_interlace 1
+#endif
+
+#ifndef GL_OML_subsample
+#define GL_OML_subsample 1
+#endif
+
+#ifndef GL_OML_resample
+#define GL_OML_resample 1
+#endif
+
+#ifndef GL_NV_copy_depth_to_color
+#define GL_NV_copy_depth_to_color 1
+#endif
+
+#ifndef GL_ATI_envmap_bumpmap
+#define GL_ATI_envmap_bumpmap 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTexBumpParameterivATI (GLenum pname, const GLint *param);
+GLAPI void APIENTRY glTexBumpParameterfvATI (GLenum pname, const GLfloat *param);
+GLAPI void APIENTRY glGetTexBumpParameterivATI (GLenum pname, GLint *param);
+GLAPI void APIENTRY glGetTexBumpParameterfvATI (GLenum pname, GLfloat *param);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERIVATIPROC) (GLenum pname, const GLint *param);
+typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERFVATIPROC) (GLenum pname, const GLfloat *param);
+typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param);
+typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param);
+#endif
+
+#ifndef GL_ATI_fragment_shader
+#define GL_ATI_fragment_shader 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI GLuint APIENTRY glGenFragmentShadersATI (GLuint range);
+GLAPI void APIENTRY glBindFragmentShaderATI (GLuint id);
+GLAPI void APIENTRY glDeleteFragmentShaderATI (GLuint id);
+GLAPI void APIENTRY glBeginFragmentShaderATI (void);
+GLAPI void APIENTRY glEndFragmentShaderATI (void);
+GLAPI void APIENTRY glPassTexCoordATI (GLuint dst, GLuint coord, GLenum swizzle);
+GLAPI void APIENTRY glSampleMapATI (GLuint dst, GLuint interp, GLenum swizzle);
+GLAPI void APIENTRY glColorFragmentOp1ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);
+GLAPI void APIENTRY glColorFragmentOp2ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);
+GLAPI void APIENTRY glColorFragmentOp3ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);
+GLAPI void APIENTRY glAlphaFragmentOp1ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);
+GLAPI void APIENTRY glAlphaFragmentOp2ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);
+GLAPI void APIENTRY glAlphaFragmentOp3ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);
+GLAPI void APIENTRY glSetFragmentShaderConstantATI (GLuint dst, const GLfloat *value);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLuint (APIENTRYP PFNGLGENFRAGMENTSHADERSATIPROC) (GLuint range);
+typedef void (APIENTRYP PFNGLBINDFRAGMENTSHADERATIPROC) (GLuint id);
+typedef void (APIENTRYP PFNGLDELETEFRAGMENTSHADERATIPROC) (GLuint id);
+typedef void (APIENTRYP PFNGLBEGINFRAGMENTSHADERATIPROC) (void);
+typedef void (APIENTRYP PFNGLENDFRAGMENTSHADERATIPROC) (void);
+typedef void (APIENTRYP PFNGLPASSTEXCOORDATIPROC) (GLuint dst, GLuint coord, GLenum swizzle);
+typedef void (APIENTRYP PFNGLSAMPLEMAPATIPROC) (GLuint dst, GLuint interp, GLenum swizzle);
+typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);
+typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);
+typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);
+typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);
+typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);
+typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);
+typedef void (APIENTRYP PFNGLSETFRAGMENTSHADERCONSTANTATIPROC) (GLuint dst, const GLfloat *value);
+#endif
+
+#ifndef GL_ATI_pn_triangles
+#define GL_ATI_pn_triangles 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glPNTrianglesiATI (GLenum pname, GLint param);
+GLAPI void APIENTRY glPNTrianglesfATI (GLenum pname, GLfloat param);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param);
+typedef void (APIENTRYP PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param);
+#endif
+
+#ifndef GL_ATI_vertex_array_object
+#define GL_ATI_vertex_array_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI GLuint APIENTRY glNewObjectBufferATI (GLsizei size, const GLvoid *pointer, GLenum usage);
+GLAPI GLboolean APIENTRY glIsObjectBufferATI (GLuint buffer);
+GLAPI void APIENTRY glUpdateObjectBufferATI (GLuint buffer, GLuint offset, GLsizei size, const GLvoid *pointer, GLenum preserve);
+GLAPI void APIENTRY glGetObjectBufferfvATI (GLuint buffer, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetObjectBufferivATI (GLuint buffer, GLenum pname, GLint *params);
+GLAPI void APIENTRY glFreeObjectBufferATI (GLuint buffer);
+GLAPI void APIENTRY glArrayObjectATI (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);
+GLAPI void APIENTRY glGetArrayObjectfvATI (GLenum array, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetArrayObjectivATI (GLenum array, GLenum pname, GLint *params);
+GLAPI void APIENTRY glVariantArrayObjectATI (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);
+GLAPI void APIENTRY glGetVariantArrayObjectfvATI (GLuint id, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetVariantArrayObjectivATI (GLuint id, GLenum pname, GLint *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLuint (APIENTRYP PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const GLvoid *pointer, GLenum usage);
+typedef GLboolean (APIENTRYP PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer);
+typedef void (APIENTRYP PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const GLvoid *pointer, GLenum preserve);
+typedef void (APIENTRYP PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLFREEOBJECTBUFFERATIPROC) (GLuint buffer);
+typedef void (APIENTRYP PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);
+typedef void (APIENTRYP PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);
+typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint *params);
+#endif
+
+#ifndef GL_EXT_vertex_shader
+#define GL_EXT_vertex_shader 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBeginVertexShaderEXT (void);
+GLAPI void APIENTRY glEndVertexShaderEXT (void);
+GLAPI void APIENTRY glBindVertexShaderEXT (GLuint id);
+GLAPI GLuint APIENTRY glGenVertexShadersEXT (GLuint range);
+GLAPI void APIENTRY glDeleteVertexShaderEXT (GLuint id);
+GLAPI void APIENTRY glShaderOp1EXT (GLenum op, GLuint res, GLuint arg1);
+GLAPI void APIENTRY glShaderOp2EXT (GLenum op, GLuint res, GLuint arg1, GLuint arg2);
+GLAPI void APIENTRY glShaderOp3EXT (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3);
+GLAPI void APIENTRY glSwizzleEXT (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW);
+GLAPI void APIENTRY glWriteMaskEXT (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW);
+GLAPI void APIENTRY glInsertComponentEXT (GLuint res, GLuint src, GLuint num);
+GLAPI void APIENTRY glExtractComponentEXT (GLuint res, GLuint src, GLuint num);
+GLAPI GLuint APIENTRY glGenSymbolsEXT (GLenum datatype, GLenum storagetype, GLenum range, GLuint components);
+GLAPI void APIENTRY glSetInvariantEXT (GLuint id, GLenum type, const GLvoid *addr);
+GLAPI void APIENTRY glSetLocalConstantEXT (GLuint id, GLenum type, const GLvoid *addr);
+GLAPI void APIENTRY glVariantbvEXT (GLuint id, const GLbyte *addr);
+GLAPI void APIENTRY glVariantsvEXT (GLuint id, const GLshort *addr);
+GLAPI void APIENTRY glVariantivEXT (GLuint id, const GLint *addr);
+GLAPI void APIENTRY glVariantfvEXT (GLuint id, const GLfloat *addr);
+GLAPI void APIENTRY glVariantdvEXT (GLuint id, const GLdouble *addr);
+GLAPI void APIENTRY glVariantubvEXT (GLuint id, const GLubyte *addr);
+GLAPI void APIENTRY glVariantusvEXT (GLuint id, const GLushort *addr);
+GLAPI void APIENTRY glVariantuivEXT (GLuint id, const GLuint *addr);
+GLAPI void APIENTRY glVariantPointerEXT (GLuint id, GLenum type, GLuint stride, const GLvoid *addr);
+GLAPI void APIENTRY glEnableVariantClientStateEXT (GLuint id);
+GLAPI void APIENTRY glDisableVariantClientStateEXT (GLuint id);
+GLAPI GLuint APIENTRY glBindLightParameterEXT (GLenum light, GLenum value);
+GLAPI GLuint APIENTRY glBindMaterialParameterEXT (GLenum face, GLenum value);
+GLAPI GLuint APIENTRY glBindTexGenParameterEXT (GLenum unit, GLenum coord, GLenum value);
+GLAPI GLuint APIENTRY glBindTextureUnitParameterEXT (GLenum unit, GLenum value);
+GLAPI GLuint APIENTRY glBindParameterEXT (GLenum value);
+GLAPI GLboolean APIENTRY glIsVariantEnabledEXT (GLuint id, GLenum cap);
+GLAPI void APIENTRY glGetVariantBooleanvEXT (GLuint id, GLenum value, GLboolean *data);
+GLAPI void APIENTRY glGetVariantIntegervEXT (GLuint id, GLenum value, GLint *data);
+GLAPI void APIENTRY glGetVariantFloatvEXT (GLuint id, GLenum value, GLfloat *data);
+GLAPI void APIENTRY glGetVariantPointervEXT (GLuint id, GLenum value, GLvoid* *data);
+GLAPI void APIENTRY glGetInvariantBooleanvEXT (GLuint id, GLenum value, GLboolean *data);
+GLAPI void APIENTRY glGetInvariantIntegervEXT (GLuint id, GLenum value, GLint *data);
+GLAPI void APIENTRY glGetInvariantFloatvEXT (GLuint id, GLenum value, GLfloat *data);
+GLAPI void APIENTRY glGetLocalConstantBooleanvEXT (GLuint id, GLenum value, GLboolean *data);
+GLAPI void APIENTRY glGetLocalConstantIntegervEXT (GLuint id, GLenum value, GLint *data);
+GLAPI void APIENTRY glGetLocalConstantFloatvEXT (GLuint id, GLenum value, GLfloat *data);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBEGINVERTEXSHADEREXTPROC) (void);
+typedef void (APIENTRYP PFNGLENDVERTEXSHADEREXTPROC) (void);
+typedef void (APIENTRYP PFNGLBINDVERTEXSHADEREXTPROC) (GLuint id);
+typedef GLuint (APIENTRYP PFNGLGENVERTEXSHADERSEXTPROC) (GLuint range);
+typedef void (APIENTRYP PFNGLDELETEVERTEXSHADEREXTPROC) (GLuint id);
+typedef void (APIENTRYP PFNGLSHADEROP1EXTPROC) (GLenum op, GLuint res, GLuint arg1);
+typedef void (APIENTRYP PFNGLSHADEROP2EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2);
+typedef void (APIENTRYP PFNGLSHADEROP3EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3);
+typedef void (APIENTRYP PFNGLSWIZZLEEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW);
+typedef void (APIENTRYP PFNGLWRITEMASKEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW);
+typedef void (APIENTRYP PFNGLINSERTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num);
+typedef void (APIENTRYP PFNGLEXTRACTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num);
+typedef GLuint (APIENTRYP PFNGLGENSYMBOLSEXTPROC) (GLenum datatype, GLenum storagetype, GLenum range, GLuint components);
+typedef void (APIENTRYP PFNGLSETINVARIANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr);
+typedef void (APIENTRYP PFNGLSETLOCALCONSTANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr);
+typedef void (APIENTRYP PFNGLVARIANTBVEXTPROC) (GLuint id, const GLbyte *addr);
+typedef void (APIENTRYP PFNGLVARIANTSVEXTPROC) (GLuint id, const GLshort *addr);
+typedef void (APIENTRYP PFNGLVARIANTIVEXTPROC) (GLuint id, const GLint *addr);
+typedef void (APIENTRYP PFNGLVARIANTFVEXTPROC) (GLuint id, const GLfloat *addr);
+typedef void (APIENTRYP PFNGLVARIANTDVEXTPROC) (GLuint id, const GLdouble *addr);
+typedef void (APIENTRYP PFNGLVARIANTUBVEXTPROC) (GLuint id, const GLubyte *addr);
+typedef void (APIENTRYP PFNGLVARIANTUSVEXTPROC) (GLuint id, const GLushort *addr);
+typedef void (APIENTRYP PFNGLVARIANTUIVEXTPROC) (GLuint id, const GLuint *addr);
+typedef void (APIENTRYP PFNGLVARIANTPOINTEREXTPROC) (GLuint id, GLenum type, GLuint stride, const GLvoid *addr);
+typedef void (APIENTRYP PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id);
+typedef void (APIENTRYP PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id);
+typedef GLuint (APIENTRYP PFNGLBINDLIGHTPARAMETEREXTPROC) (GLenum light, GLenum value);
+typedef GLuint (APIENTRYP PFNGLBINDMATERIALPARAMETEREXTPROC) (GLenum face, GLenum value);
+typedef GLuint (APIENTRYP PFNGLBINDTEXGENPARAMETEREXTPROC) (GLenum unit, GLenum coord, GLenum value);
+typedef GLuint (APIENTRYP PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) (GLenum unit, GLenum value);
+typedef GLuint (APIENTRYP PFNGLBINDPARAMETEREXTPROC) (GLenum value);
+typedef GLboolean (APIENTRYP PFNGLISVARIANTENABLEDEXTPROC) (GLuint id, GLenum cap);
+typedef void (APIENTRYP PFNGLGETVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data);
+typedef void (APIENTRYP PFNGLGETVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data);
+typedef void (APIENTRYP PFNGLGETVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data);
+typedef void (APIENTRYP PFNGLGETVARIANTPOINTERVEXTPROC) (GLuint id, GLenum value, GLvoid* *data);
+typedef void (APIENTRYP PFNGLGETINVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data);
+typedef void (APIENTRYP PFNGLGETINVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data);
+typedef void (APIENTRYP PFNGLGETINVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data);
+typedef void (APIENTRYP PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data);
+typedef void (APIENTRYP PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data);
+typedef void (APIENTRYP PFNGLGETLOCALCONSTANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data);
+#endif
+
+#ifndef GL_ATI_vertex_streams
+#define GL_ATI_vertex_streams 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glVertexStream1sATI (GLenum stream, GLshort x);
+GLAPI void APIENTRY glVertexStream1svATI (GLenum stream, const GLshort *coords);
+GLAPI void APIENTRY glVertexStream1iATI (GLenum stream, GLint x);
+GLAPI void APIENTRY glVertexStream1ivATI (GLenum stream, const GLint *coords);
+GLAPI void APIENTRY glVertexStream1fATI (GLenum stream, GLfloat x);
+GLAPI void APIENTRY glVertexStream1fvATI (GLenum stream, const GLfloat *coords);
+GLAPI void APIENTRY glVertexStream1dATI (GLenum stream, GLdouble x);
+GLAPI void APIENTRY glVertexStream1dvATI (GLenum stream, const GLdouble *coords);
+GLAPI void APIENTRY glVertexStream2sATI (GLenum stream, GLshort x, GLshort y);
+GLAPI void APIENTRY glVertexStream2svATI (GLenum stream, const GLshort *coords);
+GLAPI void APIENTRY glVertexStream2iATI (GLenum stream, GLint x, GLint y);
+GLAPI void APIENTRY glVertexStream2ivATI (GLenum stream, const GLint *coords);
+GLAPI void APIENTRY glVertexStream2fATI (GLenum stream, GLfloat x, GLfloat y);
+GLAPI void APIENTRY glVertexStream2fvATI (GLenum stream, const GLfloat *coords);
+GLAPI void APIENTRY glVertexStream2dATI (GLenum stream, GLdouble x, GLdouble y);
+GLAPI void APIENTRY glVertexStream2dvATI (GLenum stream, const GLdouble *coords);
+GLAPI void APIENTRY glVertexStream3sATI (GLenum stream, GLshort x, GLshort y, GLshort z);
+GLAPI void APIENTRY glVertexStream3svATI (GLenum stream, const GLshort *coords);
+GLAPI void APIENTRY glVertexStream3iATI (GLenum stream, GLint x, GLint y, GLint z);
+GLAPI void APIENTRY glVertexStream3ivATI (GLenum stream, const GLint *coords);
+GLAPI void APIENTRY glVertexStream3fATI (GLenum stream, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glVertexStream3fvATI (GLenum stream, const GLfloat *coords);
+GLAPI void APIENTRY glVertexStream3dATI (GLenum stream, GLdouble x, GLdouble y, GLdouble z);
+GLAPI void APIENTRY glVertexStream3dvATI (GLenum stream, const GLdouble *coords);
+GLAPI void APIENTRY glVertexStream4sATI (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w);
+GLAPI void APIENTRY glVertexStream4svATI (GLenum stream, const GLshort *coords);
+GLAPI void APIENTRY glVertexStream4iATI (GLenum stream, GLint x, GLint y, GLint z, GLint w);
+GLAPI void APIENTRY glVertexStream4ivATI (GLenum stream, const GLint *coords);
+GLAPI void APIENTRY glVertexStream4fATI (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GLAPI void APIENTRY glVertexStream4fvATI (GLenum stream, const GLfloat *coords);
+GLAPI void APIENTRY glVertexStream4dATI (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+GLAPI void APIENTRY glVertexStream4dvATI (GLenum stream, const GLdouble *coords);
+GLAPI void APIENTRY glNormalStream3bATI (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz);
+GLAPI void APIENTRY glNormalStream3bvATI (GLenum stream, const GLbyte *coords);
+GLAPI void APIENTRY glNormalStream3sATI (GLenum stream, GLshort nx, GLshort ny, GLshort nz);
+GLAPI void APIENTRY glNormalStream3svATI (GLenum stream, const GLshort *coords);
+GLAPI void APIENTRY glNormalStream3iATI (GLenum stream, GLint nx, GLint ny, GLint nz);
+GLAPI void APIENTRY glNormalStream3ivATI (GLenum stream, const GLint *coords);
+GLAPI void APIENTRY glNormalStream3fATI (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz);
+GLAPI void APIENTRY glNormalStream3fvATI (GLenum stream, const GLfloat *coords);
+GLAPI void APIENTRY glNormalStream3dATI (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz);
+GLAPI void APIENTRY glNormalStream3dvATI (GLenum stream, const GLdouble *coords);
+GLAPI void APIENTRY glClientActiveVertexStreamATI (GLenum stream);
+GLAPI void APIENTRY glVertexBlendEnviATI (GLenum pname, GLint param);
+GLAPI void APIENTRY glVertexBlendEnvfATI (GLenum pname, GLfloat param);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLVERTEXSTREAM1SATIPROC) (GLenum stream, GLshort x);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM1SVATIPROC) (GLenum stream, const GLshort *coords);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM1IATIPROC) (GLenum stream, GLint x);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM1IVATIPROC) (GLenum stream, const GLint *coords);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM1FATIPROC) (GLenum stream, GLfloat x);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM1FVATIPROC) (GLenum stream, const GLfloat *coords);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM1DATIPROC) (GLenum stream, GLdouble x);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM1DVATIPROC) (GLenum stream, const GLdouble *coords);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM2SATIPROC) (GLenum stream, GLshort x, GLshort y);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM2SVATIPROC) (GLenum stream, const GLshort *coords);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM2IATIPROC) (GLenum stream, GLint x, GLint y);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM2IVATIPROC) (GLenum stream, const GLint *coords);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM2FATIPROC) (GLenum stream, GLfloat x, GLfloat y);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM2FVATIPROC) (GLenum stream, const GLfloat *coords);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM2DATIPROC) (GLenum stream, GLdouble x, GLdouble y);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM2DVATIPROC) (GLenum stream, const GLdouble *coords);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM3IVATIPROC) (GLenum stream, const GLint *coords);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM4SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GLshort *coords);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM4IATIPROC) (GLenum stream, GLint x, GLint y, GLint z, GLint w);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM4IVATIPROC) (GLenum stream, const GLint *coords);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM4FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM4FVATIPROC) (GLenum stream, const GLfloat *coords);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM4DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRYP PFNGLVERTEXSTREAM4DVATIPROC) (GLenum stream, const GLdouble *coords);
+typedef void (APIENTRYP PFNGLNORMALSTREAM3BATIPROC) (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz);
+typedef void (APIENTRYP PFNGLNORMALSTREAM3BVATIPROC) (GLenum stream, const GLbyte *coords);
+typedef void (APIENTRYP PFNGLNORMALSTREAM3SATIPROC) (GLenum stream, GLshort nx, GLshort ny, GLshort nz);
+typedef void (APIENTRYP PFNGLNORMALSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords);
+typedef void (APIENTRYP PFNGLNORMALSTREAM3IATIPROC) (GLenum stream, GLint nx, GLint ny, GLint nz);
+typedef void (APIENTRYP PFNGLNORMALSTREAM3IVATIPROC) (GLenum stream, const GLint *coords);
+typedef void (APIENTRYP PFNGLNORMALSTREAM3FATIPROC) (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz);
+typedef void (APIENTRYP PFNGLNORMALSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords);
+typedef void (APIENTRYP PFNGLNORMALSTREAM3DATIPROC) (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz);
+typedef void (APIENTRYP PFNGLNORMALSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords);
+typedef void (APIENTRYP PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC) (GLenum stream);
+typedef void (APIENTRYP PFNGLVERTEXBLENDENVIATIPROC) (GLenum pname, GLint param);
+typedef void (APIENTRYP PFNGLVERTEXBLENDENVFATIPROC) (GLenum pname, GLfloat param);
+#endif
+
+#ifndef GL_ATI_element_array
+#define GL_ATI_element_array 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glElementPointerATI (GLenum type, const GLvoid *pointer);
+GLAPI void APIENTRY glDrawElementArrayATI (GLenum mode, GLsizei count);
+GLAPI void APIENTRY glDrawRangeElementArrayATI (GLenum mode, GLuint start, GLuint end, GLsizei count);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLELEMENTPOINTERATIPROC) (GLenum type, const GLvoid *pointer);
+typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYATIPROC) (GLenum mode, GLsizei count);
+typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYATIPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count);
+#endif
+
+#ifndef GL_SUN_mesh_array
+#define GL_SUN_mesh_array 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDrawMeshArraysSUN (GLenum mode, GLint first, GLsizei count, GLsizei width);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDRAWMESHARRAYSSUNPROC) (GLenum mode, GLint first, GLsizei count, GLsizei width);
+#endif
+
+#ifndef GL_SUN_slice_accum
+#define GL_SUN_slice_accum 1
+#endif
+
+#ifndef GL_NV_multisample_filter_hint
+#define GL_NV_multisample_filter_hint 1
+#endif
+
+#ifndef GL_NV_depth_clamp
+#define GL_NV_depth_clamp 1
+#endif
+
+#ifndef GL_NV_occlusion_query
+#define GL_NV_occlusion_query 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGenOcclusionQueriesNV (GLsizei n, GLuint *ids);
+GLAPI void APIENTRY glDeleteOcclusionQueriesNV (GLsizei n, const GLuint *ids);
+GLAPI GLboolean APIENTRY glIsOcclusionQueryNV (GLuint id);
+GLAPI void APIENTRY glBeginOcclusionQueryNV (GLuint id);
+GLAPI void APIENTRY glEndOcclusionQueryNV (void);
+GLAPI void APIENTRY glGetOcclusionQueryivNV (GLuint id, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetOcclusionQueryuivNV (GLuint id, GLenum pname, GLuint *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint *ids);
+typedef void (APIENTRYP PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint *ids);
+typedef GLboolean (APIENTRYP PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id);
+typedef void (APIENTRYP PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id);
+typedef void (APIENTRYP PFNGLENDOCCLUSIONQUERYNVPROC) (void);
+typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint *params);
+#endif
+
+#ifndef GL_NV_point_sprite
+#define GL_NV_point_sprite 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glPointParameteriNV (GLenum pname, GLint param);
+GLAPI void APIENTRY glPointParameterivNV (GLenum pname, const GLint *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPOINTPARAMETERINVPROC) (GLenum pname, GLint param);
+typedef void (APIENTRYP PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint *params);
+#endif
+
+#ifndef GL_NV_texture_shader3
+#define GL_NV_texture_shader3 1
+#endif
+
+#ifndef GL_NV_vertex_program1_1
+#define GL_NV_vertex_program1_1 1
+#endif
+
+#ifndef GL_EXT_shadow_funcs
+#define GL_EXT_shadow_funcs 1
+#endif
+
+#ifndef GL_EXT_stencil_two_side
+#define GL_EXT_stencil_two_side 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glActiveStencilFaceEXT (GLenum face);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face);
+#endif
+
+#ifndef GL_ATI_text_fragment_shader
+#define GL_ATI_text_fragment_shader 1
+#endif
+
+#ifndef GL_APPLE_client_storage
+#define GL_APPLE_client_storage 1
+#endif
+
+#ifndef GL_APPLE_element_array
+#define GL_APPLE_element_array 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glElementPointerAPPLE (GLenum type, const GLvoid *pointer);
+GLAPI void APIENTRY glDrawElementArrayAPPLE (GLenum mode, GLint first, GLsizei count);
+GLAPI void APIENTRY glDrawRangeElementArrayAPPLE (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count);
+GLAPI void APIENTRY glMultiDrawElementArrayAPPLE (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
+GLAPI void APIENTRY glMultiDrawRangeElementArrayAPPLE (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLELEMENTPOINTERAPPLEPROC) (GLenum type, const GLvoid *pointer);
+typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, GLint first, GLsizei count);
+typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count);
+typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
+typedef void (APIENTRYP PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount);
+#endif
+
+#ifndef GL_APPLE_fence
+#define GL_APPLE_fence 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGenFencesAPPLE (GLsizei n, GLuint *fences);
+GLAPI void APIENTRY glDeleteFencesAPPLE (GLsizei n, const GLuint *fences);
+GLAPI void APIENTRY glSetFenceAPPLE (GLuint fence);
+GLAPI GLboolean APIENTRY glIsFenceAPPLE (GLuint fence);
+GLAPI GLboolean APIENTRY glTestFenceAPPLE (GLuint fence);
+GLAPI void APIENTRY glFinishFenceAPPLE (GLuint fence);
+GLAPI GLboolean APIENTRY glTestObjectAPPLE (GLenum object, GLuint name);
+GLAPI void APIENTRY glFinishObjectAPPLE (GLenum object, GLint name);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGENFENCESAPPLEPROC) (GLsizei n, GLuint *fences);
+typedef void (APIENTRYP PFNGLDELETEFENCESAPPLEPROC) (GLsizei n, const GLuint *fences);
+typedef void (APIENTRYP PFNGLSETFENCEAPPLEPROC) (GLuint fence);
+typedef GLboolean (APIENTRYP PFNGLISFENCEAPPLEPROC) (GLuint fence);
+typedef GLboolean (APIENTRYP PFNGLTESTFENCEAPPLEPROC) (GLuint fence);
+typedef void (APIENTRYP PFNGLFINISHFENCEAPPLEPROC) (GLuint fence);
+typedef GLboolean (APIENTRYP PFNGLTESTOBJECTAPPLEPROC) (GLenum object, GLuint name);
+typedef void (APIENTRYP PFNGLFINISHOBJECTAPPLEPROC) (GLenum object, GLint name);
+#endif
+
+#ifndef GL_APPLE_vertex_array_object
+#define GL_APPLE_vertex_array_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBindVertexArrayAPPLE (GLuint array);
+GLAPI void APIENTRY glDeleteVertexArraysAPPLE (GLsizei n, const GLuint *arrays);
+GLAPI void APIENTRY glGenVertexArraysAPPLE (GLsizei n, GLuint *arrays);
+GLAPI GLboolean APIENTRY glIsVertexArrayAPPLE (GLuint array);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array);
+typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays);
+typedef void (APIENTRYP PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, GLuint *arrays);
+typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array);
+#endif
+
+#ifndef GL_APPLE_vertex_array_range
+#define GL_APPLE_vertex_array_range 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glVertexArrayRangeAPPLE (GLsizei length, GLvoid *pointer);
+GLAPI void APIENTRY glFlushVertexArrayRangeAPPLE (GLsizei length, GLvoid *pointer);
+GLAPI void APIENTRY glVertexArrayParameteriAPPLE (GLenum pname, GLint param);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer);
+typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer);
+typedef void (APIENTRYP PFNGLVERTEXARRAYPARAMETERIAPPLEPROC) (GLenum pname, GLint param);
+#endif
+
+#ifndef GL_APPLE_ycbcr_422
+#define GL_APPLE_ycbcr_422 1
+#endif
+
+#ifndef GL_S3_s3tc
+#define GL_S3_s3tc 1
+#endif
+
+#ifndef GL_ATI_draw_buffers
+#define GL_ATI_draw_buffers 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDrawBuffersATI (GLsizei n, const GLenum *bufs);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum *bufs);
+#endif
+
+#ifndef GL_ATI_pixel_format_float
+#define GL_ATI_pixel_format_float 1
+/* This is really a WGL extension, but defines some associated GL enums.
+ * ATI does not export "GL_ATI_pixel_format_float" in the GL_EXTENSIONS string.
+ */
+#endif
+
+#ifndef GL_ATI_texture_env_combine3
+#define GL_ATI_texture_env_combine3 1
+#endif
+
+#ifndef GL_ATI_texture_float
+#define GL_ATI_texture_float 1
+#endif
+
+#ifndef GL_NV_float_buffer
+#define GL_NV_float_buffer 1
+#endif
+
+#ifndef GL_NV_fragment_program
+#define GL_NV_fragment_program 1
+/* Some NV_fragment_program entry points are shared with ARB_vertex_program. */
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glProgramNamedParameter4fNV (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GLAPI void APIENTRY glProgramNamedParameter4dNV (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+GLAPI void APIENTRY glProgramNamedParameter4fvNV (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v);
+GLAPI void APIENTRY glProgramNamedParameter4dvNV (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v);
+GLAPI void APIENTRY glGetProgramNamedParameterfvNV (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params);
+GLAPI void APIENTRY glGetProgramNamedParameterdvNV (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v);
+typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v);
+typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params);
+#endif
+
+#ifndef GL_NV_half_float
+#define GL_NV_half_float 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glVertex2hNV (GLhalfNV x, GLhalfNV y);
+GLAPI void APIENTRY glVertex2hvNV (const GLhalfNV *v);
+GLAPI void APIENTRY glVertex3hNV (GLhalfNV x, GLhalfNV y, GLhalfNV z);
+GLAPI void APIENTRY glVertex3hvNV (const GLhalfNV *v);
+GLAPI void APIENTRY glVertex4hNV (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w);
+GLAPI void APIENTRY glVertex4hvNV (const GLhalfNV *v);
+GLAPI void APIENTRY glNormal3hNV (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz);
+GLAPI void APIENTRY glNormal3hvNV (const GLhalfNV *v);
+GLAPI void APIENTRY glColor3hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue);
+GLAPI void APIENTRY glColor3hvNV (const GLhalfNV *v);
+GLAPI void APIENTRY glColor4hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha);
+GLAPI void APIENTRY glColor4hvNV (const GLhalfNV *v);
+GLAPI void APIENTRY glTexCoord1hNV (GLhalfNV s);
+GLAPI void APIENTRY glTexCoord1hvNV (const GLhalfNV *v);
+GLAPI void APIENTRY glTexCoord2hNV (GLhalfNV s, GLhalfNV t);
+GLAPI void APIENTRY glTexCoord2hvNV (const GLhalfNV *v);
+GLAPI void APIENTRY glTexCoord3hNV (GLhalfNV s, GLhalfNV t, GLhalfNV r);
+GLAPI void APIENTRY glTexCoord3hvNV (const GLhalfNV *v);
+GLAPI void APIENTRY glTexCoord4hNV (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q);
+GLAPI void APIENTRY glTexCoord4hvNV (const GLhalfNV *v);
+GLAPI void APIENTRY glMultiTexCoord1hNV (GLenum target, GLhalfNV s);
+GLAPI void APIENTRY glMultiTexCoord1hvNV (GLenum target, const GLhalfNV *v);
+GLAPI void APIENTRY glMultiTexCoord2hNV (GLenum target, GLhalfNV s, GLhalfNV t);
+GLAPI void APIENTRY glMultiTexCoord2hvNV (GLenum target, const GLhalfNV *v);
+GLAPI void APIENTRY glMultiTexCoord3hNV (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r);
+GLAPI void APIENTRY glMultiTexCoord3hvNV (GLenum target, const GLhalfNV *v);
+GLAPI void APIENTRY glMultiTexCoord4hNV (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q);
+GLAPI void APIENTRY glMultiTexCoord4hvNV (GLenum target, const GLhalfNV *v);
+GLAPI void APIENTRY glFogCoordhNV (GLhalfNV fog);
+GLAPI void APIENTRY glFogCoordhvNV (const GLhalfNV *fog);
+GLAPI void APIENTRY glSecondaryColor3hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue);
+GLAPI void APIENTRY glSecondaryColor3hvNV (const GLhalfNV *v);
+GLAPI void APIENTRY glVertexWeighthNV (GLhalfNV weight);
+GLAPI void APIENTRY glVertexWeighthvNV (const GLhalfNV *weight);
+GLAPI void APIENTRY glVertexAttrib1hNV (GLuint index, GLhalfNV x);
+GLAPI void APIENTRY glVertexAttrib1hvNV (GLuint index, const GLhalfNV *v);
+GLAPI void APIENTRY glVertexAttrib2hNV (GLuint index, GLhalfNV x, GLhalfNV y);
+GLAPI void APIENTRY glVertexAttrib2hvNV (GLuint index, const GLhalfNV *v);
+GLAPI void APIENTRY glVertexAttrib3hNV (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z);
+GLAPI void APIENTRY glVertexAttrib3hvNV (GLuint index, const GLhalfNV *v);
+GLAPI void APIENTRY glVertexAttrib4hNV (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w);
+GLAPI void APIENTRY glVertexAttrib4hvNV (GLuint index, const GLhalfNV *v);
+GLAPI void APIENTRY glVertexAttribs1hvNV (GLuint index, GLsizei n, const GLhalfNV *v);
+GLAPI void APIENTRY glVertexAttribs2hvNV (GLuint index, GLsizei n, const GLhalfNV *v);
+GLAPI void APIENTRY glVertexAttribs3hvNV (GLuint index, GLsizei n, const GLhalfNV *v);
+GLAPI void APIENTRY glVertexAttribs4hvNV (GLuint index, GLsizei n, const GLhalfNV *v);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLVERTEX2HNVPROC) (GLhalfNV x, GLhalfNV y);
+typedef void (APIENTRYP PFNGLVERTEX2HVNVPROC) (const GLhalfNV *v);
+typedef void (APIENTRYP PFNGLVERTEX3HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z);
+typedef void (APIENTRYP PFNGLVERTEX3HVNVPROC) (const GLhalfNV *v);
+typedef void (APIENTRYP PFNGLVERTEX4HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w);
+typedef void (APIENTRYP PFNGLVERTEX4HVNVPROC) (const GLhalfNV *v);
+typedef void (APIENTRYP PFNGLNORMAL3HNVPROC) (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz);
+typedef void (APIENTRYP PFNGLNORMAL3HVNVPROC) (const GLhalfNV *v);
+typedef void (APIENTRYP PFNGLCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue);
+typedef void (APIENTRYP PFNGLCOLOR3HVNVPROC) (const GLhalfNV *v);
+typedef void (APIENTRYP PFNGLCOLOR4HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha);
+typedef void (APIENTRYP PFNGLCOLOR4HVNVPROC) (const GLhalfNV *v);
+typedef void (APIENTRYP PFNGLTEXCOORD1HNVPROC) (GLhalfNV s);
+typedef void (APIENTRYP PFNGLTEXCOORD1HVNVPROC) (const GLhalfNV *v);
+typedef void (APIENTRYP PFNGLTEXCOORD2HNVPROC) (GLhalfNV s, GLhalfNV t);
+typedef void (APIENTRYP PFNGLTEXCOORD2HVNVPROC) (const GLhalfNV *v);
+typedef void (APIENTRYP PFNGLTEXCOORD3HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r);
+typedef void (APIENTRYP PFNGLTEXCOORD3HVNVPROC) (const GLhalfNV *v);
+typedef void (APIENTRYP PFNGLTEXCOORD4HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q);
+typedef void (APIENTRYP PFNGLTEXCOORD4HVNVPROC) (const GLhalfNV *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalfNV s);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD1HVNVPROC) (GLenum target, const GLhalfNV *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD2HVNVPROC) (GLenum target, const GLhalfNV *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD3HVNVPROC) (GLenum target, const GLhalfNV *v);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q);
+typedef void (APIENTRYP PFNGLMULTITEXCOORD4HVNVPROC) (GLenum target, const GLhalfNV *v);
+typedef void (APIENTRYP PFNGLFOGCOORDHNVPROC) (GLhalfNV fog);
+typedef void (APIENTRYP PFNGLFOGCOORDHVNVPROC) (const GLhalfNV *fog);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue);
+typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HVNVPROC) (const GLhalfNV *v);
+typedef void (APIENTRYP PFNGLVERTEXWEIGHTHNVPROC) (GLhalfNV weight);
+typedef void (APIENTRYP PFNGLVERTEXWEIGHTHVNVPROC) (const GLhalfNV *weight);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB1HNVPROC) (GLuint index, GLhalfNV x);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB1HVNVPROC) (GLuint index, const GLhalfNV *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB2HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB2HVNVPROC) (GLuint index, const GLhalfNV *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB3HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB3HVNVPROC) (GLuint index, const GLhalfNV *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIB4HVNVPROC) (GLuint index, const GLhalfNV *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBS1HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBS2HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBS3HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v);
+#endif
+
+#ifndef GL_NV_pixel_data_range
+#define GL_NV_pixel_data_range 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glPixelDataRangeNV (GLenum target, GLsizei length, GLvoid *pointer);
+GLAPI void APIENTRY glFlushPixelDataRangeNV (GLenum target);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, GLvoid *pointer);
+typedef void (APIENTRYP PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target);
+#endif
+
+#ifndef GL_NV_primitive_restart
+#define GL_NV_primitive_restart 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glPrimitiveRestartNV (void);
+GLAPI void APIENTRY glPrimitiveRestartIndexNV (GLuint index);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPRIMITIVERESTARTNVPROC) (void);
+typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXNVPROC) (GLuint index);
+#endif
+
+#ifndef GL_NV_texture_expand_normal
+#define GL_NV_texture_expand_normal 1
+#endif
+
+#ifndef GL_NV_vertex_program2
+#define GL_NV_vertex_program2 1
+#endif
+
+#ifndef GL_ATI_map_object_buffer
+#define GL_ATI_map_object_buffer 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI GLvoid* APIENTRY glMapObjectBufferATI (GLuint buffer);
+GLAPI void APIENTRY glUnmapObjectBufferATI (GLuint buffer);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLvoid* (APIENTRYP PFNGLMAPOBJECTBUFFERATIPROC) (GLuint buffer);
+typedef void (APIENTRYP PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer);
+#endif
+
+#ifndef GL_ATI_separate_stencil
+#define GL_ATI_separate_stencil 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glStencilOpSeparateATI (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
+GLAPI void APIENTRY glStencilFuncSeparateATI (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEATIPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
+typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
+#endif
+
+#ifndef GL_ATI_vertex_attrib_array_object
+#define GL_ATI_vertex_attrib_array_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glVertexAttribArrayObjectATI (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset);
+GLAPI void APIENTRY glGetVertexAttribArrayObjectfvATI (GLuint index, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetVertexAttribArrayObjectivATI (GLuint index, GLenum pname, GLint *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLVERTEXATTRIBARRAYOBJECTATIPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC) (GLuint index, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC) (GLuint index, GLenum pname, GLint *params);
+#endif
+
+#ifndef GL_OES_read_format
+#define GL_OES_read_format 1
+#endif
+
+#ifndef GL_EXT_depth_bounds_test
+#define GL_EXT_depth_bounds_test 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDepthBoundsEXT (GLclampd zmin, GLclampd zmax);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zmax);
+#endif
+
+#ifndef GL_EXT_texture_mirror_clamp
+#define GL_EXT_texture_mirror_clamp 1
+#endif
+
+#ifndef GL_EXT_blend_equation_separate
+#define GL_EXT_blend_equation_separate 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBlendEquationSeparateEXT (GLenum modeRGB, GLenum modeAlpha);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLenum modeAlpha);
+#endif
+
+#ifndef GL_MESA_pack_invert
+#define GL_MESA_pack_invert 1
+#endif
+
+#ifndef GL_MESA_ycbcr_texture
+#define GL_MESA_ycbcr_texture 1
+#endif
+
+#ifndef GL_EXT_pixel_buffer_object
+#define GL_EXT_pixel_buffer_object 1
+#endif
+
+#ifndef GL_NV_fragment_program_option
+#define GL_NV_fragment_program_option 1
+#endif
+
+#ifndef GL_NV_fragment_program2
+#define GL_NV_fragment_program2 1
+#endif
+
+#ifndef GL_NV_vertex_program2_option
+#define GL_NV_vertex_program2_option 1
+#endif
+
+#ifndef GL_NV_vertex_program3
+#define GL_NV_vertex_program3 1
+#endif
+
+#ifndef GL_EXT_framebuffer_object
+#define GL_EXT_framebuffer_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI GLboolean APIENTRY glIsRenderbufferEXT (GLuint renderbuffer);
+GLAPI void APIENTRY glBindRenderbufferEXT (GLenum target, GLuint renderbuffer);
+GLAPI void APIENTRY glDeleteRenderbuffersEXT (GLsizei n, const GLuint *renderbuffers);
+GLAPI void APIENTRY glGenRenderbuffersEXT (GLsizei n, GLuint *renderbuffers);
+GLAPI void APIENTRY glRenderbufferStorageEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glGetRenderbufferParameterivEXT (GLenum target, GLenum pname, GLint *params);
+GLAPI GLboolean APIENTRY glIsFramebufferEXT (GLuint framebuffer);
+GLAPI void APIENTRY glBindFramebufferEXT (GLenum target, GLuint framebuffer);
+GLAPI void APIENTRY glDeleteFramebuffersEXT (GLsizei n, const GLuint *framebuffers);
+GLAPI void APIENTRY glGenFramebuffersEXT (GLsizei n, GLuint *framebuffers);
+GLAPI GLenum APIENTRY glCheckFramebufferStatusEXT (GLenum target);
+GLAPI void APIENTRY glFramebufferTexture1DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GLAPI void APIENTRY glFramebufferTexture2DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GLAPI void APIENTRY glFramebufferTexture3DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+GLAPI void APIENTRY glFramebufferRenderbufferEXT (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+GLAPI void APIENTRY glGetFramebufferAttachmentParameterivEXT (GLenum target, GLenum attachment, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGenerateMipmapEXT (GLenum target);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer);
+typedef void (APIENTRYP PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer);
+typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers);
+typedef void (APIENTRYP PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint *renderbuffers);
+typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
+typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer);
+typedef void (APIENTRYP PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer);
+typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint *framebuffers);
+typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint *framebuffers);
+typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGENERATEMIPMAPEXTPROC) (GLenum target);
+#endif
+
+#ifndef GL_GREMEDY_string_marker
+#define GL_GREMEDY_string_marker 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glStringMarkerGREMEDY (GLsizei len, const GLvoid *string);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const GLvoid *string);
+#endif
+
+#ifndef GL_EXT_packed_depth_stencil
+#define GL_EXT_packed_depth_stencil 1
+#endif
+
+#ifndef GL_EXT_stencil_clear_tag
+#define GL_EXT_stencil_clear_tag 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glStencilClearTagEXT (GLsizei stencilTagBits, GLuint stencilClearTag);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLSTENCILCLEARTAGEXTPROC) (GLsizei stencilTagBits, GLuint stencilClearTag);
+#endif
+
+#ifndef GL_EXT_texture_sRGB
+#define GL_EXT_texture_sRGB 1
+#endif
+
+#ifndef GL_EXT_framebuffer_blit
+#define GL_EXT_framebuffer_blit 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBlitFramebufferEXT (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBLITFRAMEBUFFEREXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#endif
+
+#ifndef GL_EXT_framebuffer_multisample
+#define GL_EXT_framebuffer_multisample 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+#endif
+
+#ifndef GL_MESAX_texture_stack
+#define GL_MESAX_texture_stack 1
+#endif
+
+#ifndef GL_EXT_timer_query
+#define GL_EXT_timer_query 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetQueryObjecti64vEXT (GLuint id, GLenum pname, GLint64EXT *params);
+GLAPI void APIENTRY glGetQueryObjectui64vEXT (GLuint id, GLenum pname, GLuint64EXT *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64EXT *params);
+typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64EXT *params);
+#endif
+
+#ifndef GL_EXT_gpu_program_parameters
+#define GL_EXT_gpu_program_parameters 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glProgramEnvParameters4fvEXT (GLenum target, GLuint index, GLsizei count, const GLfloat *params);
+GLAPI void APIENTRY glProgramLocalParameters4fvEXT (GLenum target, GLuint index, GLsizei count, const GLfloat *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params);
+typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params);
+#endif
+
+#ifndef GL_APPLE_flush_buffer_range
+#define GL_APPLE_flush_buffer_range 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBufferParameteriAPPLE (GLenum target, GLenum pname, GLint param);
+GLAPI void APIENTRY glFlushMappedBufferRangeAPPLE (GLenum target, GLintptr offset, GLsizeiptr size);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBUFFERPARAMETERIAPPLEPROC) (GLenum target, GLenum pname, GLint param);
+typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC) (GLenum target, GLintptr offset, GLsizeiptr size);
+#endif
+
+#ifndef GL_NV_gpu_program4
+#define GL_NV_gpu_program4 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glProgramLocalParameterI4iNV (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
+GLAPI void APIENTRY glProgramLocalParameterI4ivNV (GLenum target, GLuint index, const GLint *params);
+GLAPI void APIENTRY glProgramLocalParametersI4ivNV (GLenum target, GLuint index, GLsizei count, const GLint *params);
+GLAPI void APIENTRY glProgramLocalParameterI4uiNV (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+GLAPI void APIENTRY glProgramLocalParameterI4uivNV (GLenum target, GLuint index, const GLuint *params);
+GLAPI void APIENTRY glProgramLocalParametersI4uivNV (GLenum target, GLuint index, GLsizei count, const GLuint *params);
+GLAPI void APIENTRY glProgramEnvParameterI4iNV (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
+GLAPI void APIENTRY glProgramEnvParameterI4ivNV (GLenum target, GLuint index, const GLint *params);
+GLAPI void APIENTRY glProgramEnvParametersI4ivNV (GLenum target, GLuint index, GLsizei count, const GLint *params);
+GLAPI void APIENTRY glProgramEnvParameterI4uiNV (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+GLAPI void APIENTRY glProgramEnvParameterI4uivNV (GLenum target, GLuint index, const GLuint *params);
+GLAPI void APIENTRY glProgramEnvParametersI4uivNV (GLenum target, GLuint index, GLsizei count, const GLuint *params);
+GLAPI void APIENTRY glGetProgramLocalParameterIivNV (GLenum target, GLuint index, GLint *params);
+GLAPI void APIENTRY glGetProgramLocalParameterIuivNV (GLenum target, GLuint index, GLuint *params);
+GLAPI void APIENTRY glGetProgramEnvParameterIivNV (GLenum target, GLuint index, GLint *params);
+GLAPI void APIENTRY glGetProgramEnvParameterIuivNV (GLenum target, GLuint index, GLuint *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
+typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params);
+typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params);
+typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params);
+typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params);
+typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
+typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params);
+typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params);
+typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params);
+typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params);
+typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERIIVNVPROC) (GLenum target, GLuint index, GLint *params);
+typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERIUIVNVPROC) (GLenum target, GLuint index, GLuint *params);
+typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIIVNVPROC) (GLenum target, GLuint index, GLint *params);
+typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIUIVNVPROC) (GLenum target, GLuint index, GLuint *params);
+#endif
+
+#ifndef GL_NV_geometry_program4
+#define GL_NV_geometry_program4 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glProgramVertexLimitNV (GLenum target, GLint limit);
+GLAPI void APIENTRY glFramebufferTextureEXT (GLenum target, GLenum attachment, GLuint texture, GLint level);
+GLAPI void APIENTRY glFramebufferTextureLayerEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+GLAPI void APIENTRY glFramebufferTextureFaceEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPROGRAMVERTEXLIMITNVPROC) (GLenum target, GLint limit);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);
+#endif
+
+#ifndef GL_EXT_geometry_shader4
+#define GL_EXT_geometry_shader4 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value);
+#endif
+
+#ifndef GL_NV_vertex_program4
+#define GL_NV_vertex_program4 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glVertexAttribI1iEXT (GLuint index, GLint x);
+GLAPI void APIENTRY glVertexAttribI2iEXT (GLuint index, GLint x, GLint y);
+GLAPI void APIENTRY glVertexAttribI3iEXT (GLuint index, GLint x, GLint y, GLint z);
+GLAPI void APIENTRY glVertexAttribI4iEXT (GLuint index, GLint x, GLint y, GLint z, GLint w);
+GLAPI void APIENTRY glVertexAttribI1uiEXT (GLuint index, GLuint x);
+GLAPI void APIENTRY glVertexAttribI2uiEXT (GLuint index, GLuint x, GLuint y);
+GLAPI void APIENTRY glVertexAttribI3uiEXT (GLuint index, GLuint x, GLuint y, GLuint z);
+GLAPI void APIENTRY glVertexAttribI4uiEXT (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+GLAPI void APIENTRY glVertexAttribI1ivEXT (GLuint index, const GLint *v);
+GLAPI void APIENTRY glVertexAttribI2ivEXT (GLuint index, const GLint *v);
+GLAPI void APIENTRY glVertexAttribI3ivEXT (GLuint index, const GLint *v);
+GLAPI void APIENTRY glVertexAttribI4ivEXT (GLuint index, const GLint *v);
+GLAPI void APIENTRY glVertexAttribI1uivEXT (GLuint index, const GLuint *v);
+GLAPI void APIENTRY glVertexAttribI2uivEXT (GLuint index, const GLuint *v);
+GLAPI void APIENTRY glVertexAttribI3uivEXT (GLuint index, const GLuint *v);
+GLAPI void APIENTRY glVertexAttribI4uivEXT (GLuint index, const GLuint *v);
+GLAPI void APIENTRY glVertexAttribI4bvEXT (GLuint index, const GLbyte *v);
+GLAPI void APIENTRY glVertexAttribI4svEXT (GLuint index, const GLshort *v);
+GLAPI void APIENTRY glVertexAttribI4ubvEXT (GLuint index, const GLubyte *v);
+GLAPI void APIENTRY glVertexAttribI4usvEXT (GLuint index, const GLushort *v);
+GLAPI void APIENTRY glVertexAttribIPointerEXT (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+GLAPI void APIENTRY glGetVertexAttribIivEXT (GLuint index, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetVertexAttribIuivEXT (GLuint index, GLenum pname, GLuint *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IEXTPROC) (GLuint index, GLint x);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IEXTPROC) (GLuint index, GLint x, GLint y);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IEXTPROC) (GLuint index, GLint x, GLint y, GLint z);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IEXTPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIEXTPROC) (GLuint index, GLuint x);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIEXTPROC) (GLuint index, GLuint x, GLuint y);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVEXTPROC) (GLuint index, const GLint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVEXTPROC) (GLuint index, const GLint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVEXTPROC) (GLuint index, const GLint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVEXTPROC) (GLuint index, const GLint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVEXTPROC) (GLuint index, const GLuint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVEXTPROC) (GLuint index, const GLuint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVEXTPROC) (GLuint index, const GLuint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVEXTPROC) (GLuint index, const GLuint *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVEXTPROC) (GLuint index, const GLbyte *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVEXTPROC) (GLuint index, const GLshort *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVEXTPROC) (GLuint index, const GLubyte *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVEXTPROC) (GLuint index, const GLushort *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVEXTPROC) (GLuint index, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVEXTPROC) (GLuint index, GLenum pname, GLuint *params);
+#endif
+
+#ifndef GL_EXT_gpu_shader4
+#define GL_EXT_gpu_shader4 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetUniformuivEXT (GLuint program, GLint location, GLuint *params);
+GLAPI void APIENTRY glBindFragDataLocationEXT (GLuint program, GLuint color, const GLchar *name);
+GLAPI GLint APIENTRY glGetFragDataLocationEXT (GLuint program, const GLchar *name);
+GLAPI void APIENTRY glUniform1uiEXT (GLint location, GLuint v0);
+GLAPI void APIENTRY glUniform2uiEXT (GLint location, GLuint v0, GLuint v1);
+GLAPI void APIENTRY glUniform3uiEXT (GLint location, GLuint v0, GLuint v1, GLuint v2);
+GLAPI void APIENTRY glUniform4uiEXT (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+GLAPI void APIENTRY glUniform1uivEXT (GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glUniform2uivEXT (GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glUniform3uivEXT (GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glUniform4uivEXT (GLint location, GLsizei count, const GLuint *value);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETUNIFORMUIVEXTPROC) (GLuint program, GLint location, GLuint *params);
+typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name);
+typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONEXTPROC) (GLuint program, const GLchar *name);
+typedef void (APIENTRYP PFNGLUNIFORM1UIEXTPROC) (GLint location, GLuint v0);
+typedef void (APIENTRYP PFNGLUNIFORM2UIEXTPROC) (GLint location, GLuint v0, GLuint v1);
+typedef void (APIENTRYP PFNGLUNIFORM3UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2);
+typedef void (APIENTRYP PFNGLUNIFORM4UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+typedef void (APIENTRYP PFNGLUNIFORM1UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLUNIFORM2UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLUNIFORM3UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLUNIFORM4UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);
+#endif
+
+#ifndef GL_EXT_draw_instanced
+#define GL_EXT_draw_instanced 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDrawArraysInstancedEXT (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
+GLAPI void APIENTRY glDrawElementsInstancedEXT (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
+typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
+#endif
+
+#ifndef GL_EXT_packed_float
+#define GL_EXT_packed_float 1
+#endif
+
+#ifndef GL_EXT_texture_array
+#define GL_EXT_texture_array 1
+#endif
+
+#ifndef GL_EXT_texture_buffer_object
+#define GL_EXT_texture_buffer_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTexBufferEXT (GLenum target, GLenum internalformat, GLuint buffer);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer);
+#endif
+
+#ifndef GL_EXT_texture_compression_latc
+#define GL_EXT_texture_compression_latc 1
+#endif
+
+#ifndef GL_EXT_texture_compression_rgtc
+#define GL_EXT_texture_compression_rgtc 1
+#endif
+
+#ifndef GL_EXT_texture_shared_exponent
+#define GL_EXT_texture_shared_exponent 1
+#endif
+
+#ifndef GL_NV_depth_buffer_float
+#define GL_NV_depth_buffer_float 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDepthRangedNV (GLdouble zNear, GLdouble zFar);
+GLAPI void APIENTRY glClearDepthdNV (GLdouble depth);
+GLAPI void APIENTRY glDepthBoundsdNV (GLdouble zmin, GLdouble zmax);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDEPTHRANGEDNVPROC) (GLdouble zNear, GLdouble zFar);
+typedef void (APIENTRYP PFNGLCLEARDEPTHDNVPROC) (GLdouble depth);
+typedef void (APIENTRYP PFNGLDEPTHBOUNDSDNVPROC) (GLdouble zmin, GLdouble zmax);
+#endif
+
+#ifndef GL_NV_fragment_program4
+#define GL_NV_fragment_program4 1
+#endif
+
+#ifndef GL_NV_framebuffer_multisample_coverage
+#define GL_NV_framebuffer_multisample_coverage 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glRenderbufferStorageMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);
+#endif
+
+#ifndef GL_EXT_framebuffer_sRGB
+#define GL_EXT_framebuffer_sRGB 1
+#endif
+
+#ifndef GL_NV_geometry_shader4
+#define GL_NV_geometry_shader4 1
+#endif
+
+#ifndef GL_NV_parameter_buffer_object
+#define GL_NV_parameter_buffer_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glProgramBufferParametersfvNV (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLfloat *params);
+GLAPI void APIENTRY glProgramBufferParametersIivNV (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLint *params);
+GLAPI void APIENTRY glProgramBufferParametersIuivNV (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLuint *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLfloat *params);
+typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLint *params);
+typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLuint *params);
+#endif
+
+#ifndef GL_EXT_draw_buffers2
+#define GL_EXT_draw_buffers2 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glColorMaskIndexedEXT (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
+GLAPI void APIENTRY glGetBooleanIndexedvEXT (GLenum target, GLuint index, GLboolean *data);
+GLAPI void APIENTRY glGetIntegerIndexedvEXT (GLenum target, GLuint index, GLint *data);
+GLAPI void APIENTRY glEnableIndexedEXT (GLenum target, GLuint index);
+GLAPI void APIENTRY glDisableIndexedEXT (GLenum target, GLuint index);
+GLAPI GLboolean APIENTRY glIsEnabledIndexedEXT (GLenum target, GLuint index);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCOLORMASKINDEXEDEXTPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
+typedef void (APIENTRYP PFNGLGETBOOLEANINDEXEDVEXTPROC) (GLenum target, GLuint index, GLboolean *data);
+typedef void (APIENTRYP PFNGLGETINTEGERINDEXEDVEXTPROC) (GLenum target, GLuint index, GLint *data);
+typedef void (APIENTRYP PFNGLENABLEINDEXEDEXTPROC) (GLenum target, GLuint index);
+typedef void (APIENTRYP PFNGLDISABLEINDEXEDEXTPROC) (GLenum target, GLuint index);
+typedef GLboolean (APIENTRYP PFNGLISENABLEDINDEXEDEXTPROC) (GLenum target, GLuint index);
+#endif
+
+#ifndef GL_NV_transform_feedback
+#define GL_NV_transform_feedback 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBeginTransformFeedbackNV (GLenum primitiveMode);
+GLAPI void APIENTRY glEndTransformFeedbackNV (void);
+GLAPI void APIENTRY glTransformFeedbackAttribsNV (GLuint count, const GLint *attribs, GLenum bufferMode);
+GLAPI void APIENTRY glBindBufferRangeNV (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+GLAPI void APIENTRY glBindBufferOffsetNV (GLenum target, GLuint index, GLuint buffer, GLintptr offset);
+GLAPI void APIENTRY glBindBufferBaseNV (GLenum target, GLuint index, GLuint buffer);
+GLAPI void APIENTRY glTransformFeedbackVaryingsNV (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode);
+GLAPI void APIENTRY glActiveVaryingNV (GLuint program, const GLchar *name);
+GLAPI GLint APIENTRY glGetVaryingLocationNV (GLuint program, const GLchar *name);
+GLAPI void APIENTRY glGetActiveVaryingNV (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
+GLAPI void APIENTRY glGetTransformFeedbackVaryingNV (GLuint program, GLuint index, GLint *location);
+GLAPI void APIENTRY glTransformFeedbackStreamAttribsNV (GLsizei count, const GLint *attribs, GLsizei nbuffers, const GLint *bufstreams, GLenum bufferMode);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKNVPROC) (GLenum primitiveMode);
+typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKNVPROC) (void);
+typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC) (GLuint count, const GLint *attribs, GLenum bufferMode);
+typedef void (APIENTRYP PFNGLBINDBUFFERRANGENVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETNVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset);
+typedef void (APIENTRYP PFNGLBINDBUFFERBASENVPROC) (GLenum target, GLuint index, GLuint buffer);
+typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC) (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode);
+typedef void (APIENTRYP PFNGLACTIVEVARYINGNVPROC) (GLuint program, const GLchar *name);
+typedef GLint (APIENTRYP PFNGLGETVARYINGLOCATIONNVPROC) (GLuint program, const GLchar *name);
+typedef void (APIENTRYP PFNGLGETACTIVEVARYINGNVPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
+typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC) (GLuint program, GLuint index, GLint *location);
+typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKSTREAMATTRIBSNVPROC) (GLsizei count, const GLint *attribs, GLsizei nbuffers, const GLint *bufstreams, GLenum bufferMode);
+#endif
+
+#ifndef GL_EXT_bindable_uniform
+#define GL_EXT_bindable_uniform 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glUniformBufferEXT (GLuint program, GLint location, GLuint buffer);
+GLAPI GLint APIENTRY glGetUniformBufferSizeEXT (GLuint program, GLint location);
+GLAPI GLintptr APIENTRY glGetUniformOffsetEXT (GLuint program, GLint location);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLUNIFORMBUFFEREXTPROC) (GLuint program, GLint location, GLuint buffer);
+typedef GLint (APIENTRYP PFNGLGETUNIFORMBUFFERSIZEEXTPROC) (GLuint program, GLint location);
+typedef GLintptr (APIENTRYP PFNGLGETUNIFORMOFFSETEXTPROC) (GLuint program, GLint location);
+#endif
+
+#ifndef GL_EXT_texture_integer
+#define GL_EXT_texture_integer 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTexParameterIivEXT (GLenum target, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glTexParameterIuivEXT (GLenum target, GLenum pname, const GLuint *params);
+GLAPI void APIENTRY glGetTexParameterIivEXT (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetTexParameterIuivEXT (GLenum target, GLenum pname, GLuint *params);
+GLAPI void APIENTRY glClearColorIiEXT (GLint red, GLint green, GLint blue, GLint alpha);
+GLAPI void APIENTRY glClearColorIuiEXT (GLuint red, GLuint green, GLuint blue, GLuint alpha);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params);
+typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params);
+typedef void (APIENTRYP PFNGLCLEARCOLORIIEXTPROC) (GLint red, GLint green, GLint blue, GLint alpha);
+typedef void (APIENTRYP PFNGLCLEARCOLORIUIEXTPROC) (GLuint red, GLuint green, GLuint blue, GLuint alpha);
+#endif
+
+#ifndef GL_GREMEDY_frame_terminator
+#define GL_GREMEDY_frame_terminator 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glFrameTerminatorGREMEDY (void);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLFRAMETERMINATORGREMEDYPROC) (void);
+#endif
+
+#ifndef GL_NV_conditional_render
+#define GL_NV_conditional_render 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBeginConditionalRenderNV (GLuint id, GLenum mode);
+GLAPI void APIENTRY glEndConditionalRenderNV (void);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERNVPROC) (GLuint id, GLenum mode);
+typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERNVPROC) (void);
+#endif
+
+#ifndef GL_NV_present_video
+#define GL_NV_present_video 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glPresentFrameKeyedNV (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1);
+GLAPI void APIENTRY glPresentFrameDualFillNV (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3);
+GLAPI void APIENTRY glGetVideoivNV (GLuint video_slot, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetVideouivNV (GLuint video_slot, GLenum pname, GLuint *params);
+GLAPI void APIENTRY glGetVideoi64vNV (GLuint video_slot, GLenum pname, GLint64EXT *params);
+GLAPI void APIENTRY glGetVideoui64vNV (GLuint video_slot, GLenum pname, GLuint64EXT *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPRESENTFRAMEKEYEDNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1);
+typedef void (APIENTRYP PFNGLPRESENTFRAMEDUALFILLNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3);
+typedef void (APIENTRYP PFNGLGETVIDEOIVNVPROC) (GLuint video_slot, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETVIDEOUIVNVPROC) (GLuint video_slot, GLenum pname, GLuint *params);
+typedef void (APIENTRYP PFNGLGETVIDEOI64VNVPROC) (GLuint video_slot, GLenum pname, GLint64EXT *params);
+typedef void (APIENTRYP PFNGLGETVIDEOUI64VNVPROC) (GLuint video_slot, GLenum pname, GLuint64EXT *params);
+#endif
+
+#ifndef GL_EXT_transform_feedback
+#define GL_EXT_transform_feedback 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBeginTransformFeedbackEXT (GLenum primitiveMode);
+GLAPI void APIENTRY glEndTransformFeedbackEXT (void);
+GLAPI void APIENTRY glBindBufferRangeEXT (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+GLAPI void APIENTRY glBindBufferOffsetEXT (GLenum target, GLuint index, GLuint buffer, GLintptr offset);
+GLAPI void APIENTRY glBindBufferBaseEXT (GLenum target, GLuint index, GLuint buffer);
+GLAPI void APIENTRY glTransformFeedbackVaryingsEXT (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode);
+GLAPI void APIENTRY glGetTransformFeedbackVaryingEXT (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKEXTPROC) (GLenum primitiveMode);
+typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKEXTPROC) (void);
+typedef void (APIENTRYP PFNGLBINDBUFFERRANGEEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
+typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset);
+typedef void (APIENTRYP PFNGLBINDBUFFERBASEEXTPROC) (GLenum target, GLuint index, GLuint buffer);
+typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC) (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode);
+typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
+#endif
+
+#ifndef GL_EXT_direct_state_access
+#define GL_EXT_direct_state_access 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glClientAttribDefaultEXT (GLbitfield mask);
+GLAPI void APIENTRY glPushClientAttribDefaultEXT (GLbitfield mask);
+GLAPI void APIENTRY glMatrixLoadfEXT (GLenum mode, const GLfloat *m);
+GLAPI void APIENTRY glMatrixLoaddEXT (GLenum mode, const GLdouble *m);
+GLAPI void APIENTRY glMatrixMultfEXT (GLenum mode, const GLfloat *m);
+GLAPI void APIENTRY glMatrixMultdEXT (GLenum mode, const GLdouble *m);
+GLAPI void APIENTRY glMatrixLoadIdentityEXT (GLenum mode);
+GLAPI void APIENTRY glMatrixRotatefEXT (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glMatrixRotatedEXT (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
+GLAPI void APIENTRY glMatrixScalefEXT (GLenum mode, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glMatrixScaledEXT (GLenum mode, GLdouble x, GLdouble y, GLdouble z);
+GLAPI void APIENTRY glMatrixTranslatefEXT (GLenum mode, GLfloat x, GLfloat y, GLfloat z);
+GLAPI void APIENTRY glMatrixTranslatedEXT (GLenum mode, GLdouble x, GLdouble y, GLdouble z);
+GLAPI void APIENTRY glMatrixFrustumEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
+GLAPI void APIENTRY glMatrixOrthoEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
+GLAPI void APIENTRY glMatrixPopEXT (GLenum mode);
+GLAPI void APIENTRY glMatrixPushEXT (GLenum mode);
+GLAPI void APIENTRY glMatrixLoadTransposefEXT (GLenum mode, const GLfloat *m);
+GLAPI void APIENTRY glMatrixLoadTransposedEXT (GLenum mode, const GLdouble *m);
+GLAPI void APIENTRY glMatrixMultTransposefEXT (GLenum mode, const GLfloat *m);
+GLAPI void APIENTRY glMatrixMultTransposedEXT (GLenum mode, const GLdouble *m);
+GLAPI void APIENTRY glTextureParameterfEXT (GLuint texture, GLenum target, GLenum pname, GLfloat param);
+GLAPI void APIENTRY glTextureParameterfvEXT (GLuint texture, GLenum target, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glTextureParameteriEXT (GLuint texture, GLenum target, GLenum pname, GLint param);
+GLAPI void APIENTRY glTextureParameterivEXT (GLuint texture, GLenum target, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glCopyTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
+GLAPI void APIENTRY glCopyTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+GLAPI void APIENTRY glCopyTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
+GLAPI void APIENTRY glCopyTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glGetTextureImageEXT (GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
+GLAPI void APIENTRY glGetTextureParameterfvEXT (GLuint texture, GLenum target, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetTextureParameterivEXT (GLuint texture, GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetTextureLevelParameterfvEXT (GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetTextureLevelParameterivEXT (GLuint texture, GLenum target, GLint level, GLenum pname, GLint *params);
+GLAPI void APIENTRY glTextureImage3DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glCopyTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glMultiTexParameterfEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat param);
+GLAPI void APIENTRY glMultiTexParameterfvEXT (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glMultiTexParameteriEXT (GLenum texunit, GLenum target, GLenum pname, GLint param);
+GLAPI void APIENTRY glMultiTexParameterivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glCopyMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
+GLAPI void APIENTRY glCopyMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+GLAPI void APIENTRY glCopyMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
+GLAPI void APIENTRY glCopyMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glGetMultiTexImageEXT (GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
+GLAPI void APIENTRY glGetMultiTexParameterfvEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetMultiTexParameterivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetMultiTexLevelParameterfvEXT (GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetMultiTexLevelParameterivEXT (GLenum texunit, GLenum target, GLint level, GLenum pname, GLint *params);
+GLAPI void APIENTRY glMultiTexImage3DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
+GLAPI void APIENTRY glCopyMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glBindMultiTextureEXT (GLenum texunit, GLenum target, GLuint texture);
+GLAPI void APIENTRY glEnableClientStateIndexedEXT (GLenum array, GLuint index);
+GLAPI void APIENTRY glDisableClientStateIndexedEXT (GLenum array, GLuint index);
+GLAPI void APIENTRY glMultiTexCoordPointerEXT (GLenum texunit, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+GLAPI void APIENTRY glMultiTexEnvfEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat param);
+GLAPI void APIENTRY glMultiTexEnvfvEXT (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glMultiTexEnviEXT (GLenum texunit, GLenum target, GLenum pname, GLint param);
+GLAPI void APIENTRY glMultiTexEnvivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glMultiTexGendEXT (GLenum texunit, GLenum coord, GLenum pname, GLdouble param);
+GLAPI void APIENTRY glMultiTexGendvEXT (GLenum texunit, GLenum coord, GLenum pname, const GLdouble *params);
+GLAPI void APIENTRY glMultiTexGenfEXT (GLenum texunit, GLenum coord, GLenum pname, GLfloat param);
+GLAPI void APIENTRY glMultiTexGenfvEXT (GLenum texunit, GLenum coord, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glMultiTexGeniEXT (GLenum texunit, GLenum coord, GLenum pname, GLint param);
+GLAPI void APIENTRY glMultiTexGenivEXT (GLenum texunit, GLenum coord, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glGetMultiTexEnvfvEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetMultiTexEnvivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetMultiTexGendvEXT (GLenum texunit, GLenum coord, GLenum pname, GLdouble *params);
+GLAPI void APIENTRY glGetMultiTexGenfvEXT (GLenum texunit, GLenum coord, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetMultiTexGenivEXT (GLenum texunit, GLenum coord, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetFloatIndexedvEXT (GLenum target, GLuint index, GLfloat *data);
+GLAPI void APIENTRY glGetDoubleIndexedvEXT (GLenum target, GLuint index, GLdouble *data);
+GLAPI void APIENTRY glGetPointerIndexedvEXT (GLenum target, GLuint index, GLvoid* *data);
+GLAPI void APIENTRY glCompressedTextureImage3DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits);
+GLAPI void APIENTRY glCompressedTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits);
+GLAPI void APIENTRY glCompressedTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits);
+GLAPI void APIENTRY glCompressedTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits);
+GLAPI void APIENTRY glCompressedTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits);
+GLAPI void APIENTRY glCompressedTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits);
+GLAPI void APIENTRY glGetCompressedTextureImageEXT (GLuint texture, GLenum target, GLint lod, GLvoid *img);
+GLAPI void APIENTRY glCompressedMultiTexImage3DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits);
+GLAPI void APIENTRY glCompressedMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits);
+GLAPI void APIENTRY glCompressedMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits);
+GLAPI void APIENTRY glCompressedMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits);
+GLAPI void APIENTRY glCompressedMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits);
+GLAPI void APIENTRY glCompressedMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits);
+GLAPI void APIENTRY glGetCompressedMultiTexImageEXT (GLenum texunit, GLenum target, GLint lod, GLvoid *img);
+GLAPI void APIENTRY glNamedProgramStringEXT (GLuint program, GLenum target, GLenum format, GLsizei len, const GLvoid *string);
+GLAPI void APIENTRY glNamedProgramLocalParameter4dEXT (GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+GLAPI void APIENTRY glNamedProgramLocalParameter4dvEXT (GLuint program, GLenum target, GLuint index, const GLdouble *params);
+GLAPI void APIENTRY glNamedProgramLocalParameter4fEXT (GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GLAPI void APIENTRY glNamedProgramLocalParameter4fvEXT (GLuint program, GLenum target, GLuint index, const GLfloat *params);
+GLAPI void APIENTRY glGetNamedProgramLocalParameterdvEXT (GLuint program, GLenum target, GLuint index, GLdouble *params);
+GLAPI void APIENTRY glGetNamedProgramLocalParameterfvEXT (GLuint program, GLenum target, GLuint index, GLfloat *params);
+GLAPI void APIENTRY glGetNamedProgramivEXT (GLuint program, GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetNamedProgramStringEXT (GLuint program, GLenum target, GLenum pname, GLvoid *string);
+GLAPI void APIENTRY glNamedProgramLocalParameters4fvEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat *params);
+GLAPI void APIENTRY glNamedProgramLocalParameterI4iEXT (GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
+GLAPI void APIENTRY glNamedProgramLocalParameterI4ivEXT (GLuint program, GLenum target, GLuint index, const GLint *params);
+GLAPI void APIENTRY glNamedProgramLocalParametersI4ivEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLint *params);
+GLAPI void APIENTRY glNamedProgramLocalParameterI4uiEXT (GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+GLAPI void APIENTRY glNamedProgramLocalParameterI4uivEXT (GLuint program, GLenum target, GLuint index, const GLuint *params);
+GLAPI void APIENTRY glNamedProgramLocalParametersI4uivEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint *params);
+GLAPI void APIENTRY glGetNamedProgramLocalParameterIivEXT (GLuint program, GLenum target, GLuint index, GLint *params);
+GLAPI void APIENTRY glGetNamedProgramLocalParameterIuivEXT (GLuint program, GLenum target, GLuint index, GLuint *params);
+GLAPI void APIENTRY glTextureParameterIivEXT (GLuint texture, GLenum target, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glTextureParameterIuivEXT (GLuint texture, GLenum target, GLenum pname, const GLuint *params);
+GLAPI void APIENTRY glGetTextureParameterIivEXT (GLuint texture, GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetTextureParameterIuivEXT (GLuint texture, GLenum target, GLenum pname, GLuint *params);
+GLAPI void APIENTRY glMultiTexParameterIivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glMultiTexParameterIuivEXT (GLenum texunit, GLenum target, GLenum pname, const GLuint *params);
+GLAPI void APIENTRY glGetMultiTexParameterIivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetMultiTexParameterIuivEXT (GLenum texunit, GLenum target, GLenum pname, GLuint *params);
+GLAPI void APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat v0);
+GLAPI void APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1);
+GLAPI void APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+GLAPI void APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+GLAPI void APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint v0);
+GLAPI void APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint v0, GLint v1);
+GLAPI void APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
+GLAPI void APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+GLAPI void APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GLAPI void APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix2x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix3x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix2x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix4x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix3x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GLAPI void APIENTRY glProgramUniform1uiEXT (GLuint program, GLint location, GLuint v0);
+GLAPI void APIENTRY glProgramUniform2uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1);
+GLAPI void APIENTRY glProgramUniform3uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
+GLAPI void APIENTRY glProgramUniform4uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+GLAPI void APIENTRY glProgramUniform1uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glProgramUniform2uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glProgramUniform3uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glProgramUniform4uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
+GLAPI void APIENTRY glNamedBufferDataEXT (GLuint buffer, GLsizeiptr size, const GLvoid *data, GLenum usage);
+GLAPI void APIENTRY glNamedBufferSubDataEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, const GLvoid *data);
+GLAPI GLvoid* APIENTRY glMapNamedBufferEXT (GLuint buffer, GLenum access);
+GLAPI GLboolean APIENTRY glUnmapNamedBufferEXT (GLuint buffer);
+GLAPI GLvoid* APIENTRY glMapNamedBufferRangeEXT (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access);
+GLAPI void APIENTRY glFlushMappedNamedBufferRangeEXT (GLuint buffer, GLintptr offset, GLsizeiptr length);
+GLAPI void APIENTRY glNamedCopyBufferSubDataEXT (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+GLAPI void APIENTRY glGetNamedBufferParameterivEXT (GLuint buffer, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetNamedBufferPointervEXT (GLuint buffer, GLenum pname, GLvoid* *params);
+GLAPI void APIENTRY glGetNamedBufferSubDataEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, GLvoid *data);
+GLAPI void APIENTRY glTextureBufferEXT (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer);
+GLAPI void APIENTRY glMultiTexBufferEXT (GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer);
+GLAPI void APIENTRY glNamedRenderbufferStorageEXT (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glGetNamedRenderbufferParameterivEXT (GLuint renderbuffer, GLenum pname, GLint *params);
+GLAPI GLenum APIENTRY glCheckNamedFramebufferStatusEXT (GLuint framebuffer, GLenum target);
+GLAPI void APIENTRY glNamedFramebufferTexture1DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GLAPI void APIENTRY glNamedFramebufferTexture2DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GLAPI void APIENTRY glNamedFramebufferTexture3DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+GLAPI void APIENTRY glNamedFramebufferRenderbufferEXT (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+GLAPI void APIENTRY glGetNamedFramebufferAttachmentParameterivEXT (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGenerateTextureMipmapEXT (GLuint texture, GLenum target);
+GLAPI void APIENTRY glGenerateMultiTexMipmapEXT (GLenum texunit, GLenum target);
+GLAPI void APIENTRY glFramebufferDrawBufferEXT (GLuint framebuffer, GLenum mode);
+GLAPI void APIENTRY glFramebufferDrawBuffersEXT (GLuint framebuffer, GLsizei n, const GLenum *bufs);
+GLAPI void APIENTRY glFramebufferReadBufferEXT (GLuint framebuffer, GLenum mode);
+GLAPI void APIENTRY glGetFramebufferParameterivEXT (GLuint framebuffer, GLenum pname, GLint *params);
+GLAPI void APIENTRY glNamedRenderbufferStorageMultisampleEXT (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glNamedRenderbufferStorageMultisampleCoverageEXT (GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);
+GLAPI void APIENTRY glNamedFramebufferTextureEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level);
+GLAPI void APIENTRY glNamedFramebufferTextureLayerEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer);
+GLAPI void APIENTRY glNamedFramebufferTextureFaceEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face);
+GLAPI void APIENTRY glTextureRenderbufferEXT (GLuint texture, GLenum target, GLuint renderbuffer);
+GLAPI void APIENTRY glMultiTexRenderbufferEXT (GLenum texunit, GLenum target, GLuint renderbuffer);
+GLAPI void APIENTRY glProgramUniform1dEXT (GLuint program, GLint location, GLdouble x);
+GLAPI void APIENTRY glProgramUniform2dEXT (GLuint program, GLint location, GLdouble x, GLdouble y);
+GLAPI void APIENTRY glProgramUniform3dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z);
+GLAPI void APIENTRY glProgramUniform4dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+GLAPI void APIENTRY glProgramUniform1dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniform2dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniform3dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniform4dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix2x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix2x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix3x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix3x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix4x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+GLAPI void APIENTRY glProgramUniformMatrix4x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask);
+typedef void (APIENTRYP PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask);
+typedef void (APIENTRYP PFNGLMATRIXLOADFEXTPROC) (GLenum mode, const GLfloat *m);
+typedef void (APIENTRYP PFNGLMATRIXLOADDEXTPROC) (GLenum mode, const GLdouble *m);
+typedef void (APIENTRYP PFNGLMATRIXMULTFEXTPROC) (GLenum mode, const GLfloat *m);
+typedef void (APIENTRYP PFNGLMATRIXMULTDEXTPROC) (GLenum mode, const GLdouble *m);
+typedef void (APIENTRYP PFNGLMATRIXLOADIDENTITYEXTPROC) (GLenum mode);
+typedef void (APIENTRYP PFNGLMATRIXROTATEFEXTPROC) (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLMATRIXROTATEDEXTPROC) (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRYP PFNGLMATRIXSCALEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLMATRIXSCALEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRYP PFNGLMATRIXTRANSLATEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z);
+typedef void (APIENTRYP PFNGLMATRIXTRANSLATEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRYP PFNGLMATRIXFRUSTUMEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
+typedef void (APIENTRYP PFNGLMATRIXORTHOEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
+typedef void (APIENTRYP PFNGLMATRIXPOPEXTPROC) (GLenum mode);
+typedef void (APIENTRYP PFNGLMATRIXPUSHEXTPROC) (GLenum mode);
+typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m);
+typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m);
+typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m);
+typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m);
+typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat param);
+typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLfloat *params);
+typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint param);
+typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLCOPYTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
+typedef void (APIENTRYP PFNGLCOPYTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
+typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (APIENTRYP PFNGLGETTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
+typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (APIENTRYP PFNGLMULTITEXPARAMETERFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param);
+typedef void (APIENTRYP PFNGLMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params);
+typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param);
+typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLCOPYMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
+typedef void (APIENTRYP PFNGLCOPYMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
+typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (APIENTRYP PFNGLGETMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
+typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
+typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (APIENTRYP PFNGLBINDMULTITEXTUREEXTPROC) (GLenum texunit, GLenum target, GLuint texture);
+typedef void (APIENTRYP PFNGLENABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index);
+typedef void (APIENTRYP PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index);
+typedef void (APIENTRYP PFNGLMULTITEXCOORDPOINTEREXTPROC) (GLenum texunit, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+typedef void (APIENTRYP PFNGLMULTITEXENVFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param);
+typedef void (APIENTRYP PFNGLMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params);
+typedef void (APIENTRYP PFNGLMULTITEXENVIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param);
+typedef void (APIENTRYP PFNGLMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLMULTITEXGENDEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble param);
+typedef void (APIENTRYP PFNGLMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLdouble *params);
+typedef void (APIENTRYP PFNGLMULTITEXGENFEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat param);
+typedef void (APIENTRYP PFNGLMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLfloat *params);
+typedef void (APIENTRYP PFNGLMULTITEXGENIEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint param);
+typedef void (APIENTRYP PFNGLMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLGETMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble *params);
+typedef void (APIENTRYP PFNGLGETMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETFLOATINDEXEDVEXTPROC) (GLenum target, GLuint index, GLfloat *data);
+typedef void (APIENTRYP PFNGLGETDOUBLEINDEXEDVEXTPROC) (GLenum target, GLuint index, GLdouble *data);
+typedef void (APIENTRYP PFNGLGETPOINTERINDEXEDVEXTPROC) (GLenum target, GLuint index, GLvoid* *data);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits);
+typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits);
+typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint lod, GLvoid *img);
+typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits);
+typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits);
+typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits);
+typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits);
+typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits);
+typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits);
+typedef void (APIENTRYP PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint lod, GLvoid *img);
+typedef void (APIENTRYP PFNGLNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum format, GLsizei len, const GLvoid *string);
+typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLdouble *params);
+typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLfloat *params);
+typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble *params);
+typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMIVEXTPROC) (GLuint program, GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum pname, GLvoid *string);
+typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat *params);
+typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC) (GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
+typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLint *params);
+typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLint *params);
+typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLuint *params);
+typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint *params);
+typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLint *params);
+typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint *params);
+typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLuint *params);
+typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLuint *params);
+typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLuint *params);
+typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLuint *params);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
+typedef void (APIENTRYP PFNGLNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLsizeiptr size, const GLvoid *data, GLenum usage);
+typedef void (APIENTRYP PFNGLNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const GLvoid *data);
+typedef GLvoid* (APIENTRYP PFNGLMAPNAMEDBUFFEREXTPROC) (GLuint buffer, GLenum access);
+typedef GLboolean (APIENTRYP PFNGLUNMAPNAMEDBUFFEREXTPROC) (GLuint buffer);
+typedef GLvoid* (APIENTRYP PFNGLMAPNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access);
+typedef void (APIENTRYP PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length);
+typedef void (APIENTRYP PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC) (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC) (GLuint buffer, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPOINTERVEXTPROC) (GLuint buffer, GLenum pname, GLvoid* *params);
+typedef void (APIENTRYP PFNGLGETNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLvoid *data);
+typedef void (APIENTRYP PFNGLTEXTUREBUFFEREXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer);
+typedef void (APIENTRYP PFNGLMULTITEXBUFFEREXTPROC) (GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer);
+typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC) (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (APIENTRYP PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC) (GLuint renderbuffer, GLenum pname, GLint *params);
+typedef GLenum (APIENTRYP PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC) (GLuint framebuffer, GLenum target);
+typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC) (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGENERATETEXTUREMIPMAPEXTPROC) (GLuint texture, GLenum target);
+typedef void (APIENTRYP PFNGLGENERATEMULTITEXMIPMAPEXTPROC) (GLenum texunit, GLenum target);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC) (GLuint framebuffer, GLenum mode);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC) (GLuint framebuffer, GLsizei n, const GLenum *bufs);
+typedef void (APIENTRYP PFNGLFRAMEBUFFERREADBUFFEREXTPROC) (GLuint framebuffer, GLenum mode);
+typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC) (GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level);
+typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer);
+typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face);
+typedef void (APIENTRYP PFNGLTEXTURERENDERBUFFEREXTPROC) (GLuint texture, GLenum target, GLuint renderbuffer);
+typedef void (APIENTRYP PFNGLMULTITEXRENDERBUFFEREXTPROC) (GLenum texunit, GLenum target, GLuint renderbuffer);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DEXTPROC) (GLuint program, GLint location, GLdouble x);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
+#endif
+
+#ifndef GL_EXT_vertex_array_bgra
+#define GL_EXT_vertex_array_bgra 1
+#endif
+
+#ifndef GL_EXT_texture_swizzle
+#define GL_EXT_texture_swizzle 1
+#endif
+
+#ifndef GL_NV_explicit_multisample
+#define GL_NV_explicit_multisample 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetMultisamplefvNV (GLenum pname, GLuint index, GLfloat *val);
+GLAPI void APIENTRY glSampleMaskIndexedNV (GLuint index, GLbitfield mask);
+GLAPI void APIENTRY glTexRenderbufferNV (GLenum target, GLuint renderbuffer);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVNVPROC) (GLenum pname, GLuint index, GLfloat *val);
+typedef void (APIENTRYP PFNGLSAMPLEMASKINDEXEDNVPROC) (GLuint index, GLbitfield mask);
+typedef void (APIENTRYP PFNGLTEXRENDERBUFFERNVPROC) (GLenum target, GLuint renderbuffer);
+#endif
+
+#ifndef GL_NV_transform_feedback2
+#define GL_NV_transform_feedback2 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBindTransformFeedbackNV (GLenum target, GLuint id);
+GLAPI void APIENTRY glDeleteTransformFeedbacksNV (GLsizei n, const GLuint *ids);
+GLAPI void APIENTRY glGenTransformFeedbacksNV (GLsizei n, GLuint *ids);
+GLAPI GLboolean APIENTRY glIsTransformFeedbackNV (GLuint id);
+GLAPI void APIENTRY glPauseTransformFeedbackNV (void);
+GLAPI void APIENTRY glResumeTransformFeedbackNV (void);
+GLAPI void APIENTRY glDrawTransformFeedbackNV (GLenum mode, GLuint id);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKNVPROC) (GLenum target, GLuint id);
+typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSNVPROC) (GLsizei n, const GLuint *ids);
+typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSNVPROC) (GLsizei n, GLuint *ids);
+typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKNVPROC) (GLuint id);
+typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKNVPROC) (void);
+typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKNVPROC) (void);
+typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKNVPROC) (GLenum mode, GLuint id);
+#endif
+
+#ifndef GL_ATI_meminfo
+#define GL_ATI_meminfo 1
+#endif
+
+#ifndef GL_AMD_performance_monitor
+#define GL_AMD_performance_monitor 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
+GLAPI void APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
+GLAPI void APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
+GLAPI void APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
+GLAPI void APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, GLvoid *data);
+GLAPI void APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors);
+GLAPI void APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors);
+GLAPI void APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList);
+GLAPI void APIENTRY glBeginPerfMonitorAMD (GLuint monitor);
+GLAPI void APIENTRY glEndPerfMonitorAMD (GLuint monitor);
+GLAPI void APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
+typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
+typedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
+typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
+typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, GLvoid *data);
+typedef void (APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
+typedef void (APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
+typedef void (APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList);
+typedef void (APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor);
+typedef void (APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor);
+typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
+#endif
+
+#ifndef GL_AMD_texture_texture4
+#define GL_AMD_texture_texture4 1
+#endif
+
+#ifndef GL_AMD_vertex_shader_tesselator
+#define GL_AMD_vertex_shader_tesselator 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTessellationFactorAMD (GLfloat factor);
+GLAPI void APIENTRY glTessellationModeAMD (GLenum mode);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTESSELLATIONFACTORAMDPROC) (GLfloat factor);
+typedef void (APIENTRYP PFNGLTESSELLATIONMODEAMDPROC) (GLenum mode);
+#endif
+
+#ifndef GL_EXT_provoking_vertex
+#define GL_EXT_provoking_vertex 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glProvokingVertexEXT (GLenum mode);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPROVOKINGVERTEXEXTPROC) (GLenum mode);
+#endif
+
+#ifndef GL_EXT_texture_snorm
+#define GL_EXT_texture_snorm 1
+#endif
+
+#ifndef GL_AMD_draw_buffers_blend
+#define GL_AMD_draw_buffers_blend 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBlendFuncIndexedAMD (GLuint buf, GLenum src, GLenum dst);
+GLAPI void APIENTRY glBlendFuncSeparateIndexedAMD (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+GLAPI void APIENTRY glBlendEquationIndexedAMD (GLuint buf, GLenum mode);
+GLAPI void APIENTRY glBlendEquationSeparateIndexedAMD (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBLENDFUNCINDEXEDAMDPROC) (GLuint buf, GLenum src, GLenum dst);
+typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+typedef void (APIENTRYP PFNGLBLENDEQUATIONINDEXEDAMDPROC) (GLuint buf, GLenum mode);
+typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
+#endif
+
+#ifndef GL_APPLE_texture_range
+#define GL_APPLE_texture_range 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTextureRangeAPPLE (GLenum target, GLsizei length, const GLvoid *pointer);
+GLAPI void APIENTRY glGetTexParameterPointervAPPLE (GLenum target, GLenum pname, GLvoid* *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTEXTURERANGEAPPLEPROC) (GLenum target, GLsizei length, const GLvoid *pointer);
+typedef void (APIENTRYP PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC) (GLenum target, GLenum pname, GLvoid* *params);
+#endif
+
+#ifndef GL_APPLE_float_pixels
+#define GL_APPLE_float_pixels 1
+#endif
+
+#ifndef GL_APPLE_vertex_program_evaluators
+#define GL_APPLE_vertex_program_evaluators 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glEnableVertexAttribAPPLE (GLuint index, GLenum pname);
+GLAPI void APIENTRY glDisableVertexAttribAPPLE (GLuint index, GLenum pname);
+GLAPI GLboolean APIENTRY glIsVertexAttribEnabledAPPLE (GLuint index, GLenum pname);
+GLAPI void APIENTRY glMapVertexAttrib1dAPPLE (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
+GLAPI void APIENTRY glMapVertexAttrib1fAPPLE (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
+GLAPI void APIENTRY glMapVertexAttrib2dAPPLE (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
+GLAPI void APIENTRY glMapVertexAttrib2fAPPLE (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname);
+typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname);
+typedef GLboolean (APIENTRYP PFNGLISVERTEXATTRIBENABLEDAPPLEPROC) (GLuint index, GLenum pname);
+typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB1DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
+typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB1FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
+typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB2DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
+typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB2FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
+#endif
+
+#ifndef GL_APPLE_aux_depth_stencil
+#define GL_APPLE_aux_depth_stencil 1
+#endif
+
+#ifndef GL_APPLE_object_purgeable
+#define GL_APPLE_object_purgeable 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI GLenum APIENTRY glObjectPurgeableAPPLE (GLenum objectType, GLuint name, GLenum option);
+GLAPI GLenum APIENTRY glObjectUnpurgeableAPPLE (GLenum objectType, GLuint name, GLenum option);
+GLAPI void APIENTRY glGetObjectParameterivAPPLE (GLenum objectType, GLuint name, GLenum pname, GLint *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLenum (APIENTRYP PFNGLOBJECTPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option);
+typedef GLenum (APIENTRYP PFNGLOBJECTUNPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option);
+typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVAPPLEPROC) (GLenum objectType, GLuint name, GLenum pname, GLint *params);
+#endif
+
+#ifndef GL_APPLE_row_bytes
+#define GL_APPLE_row_bytes 1
+#endif
+
+#ifndef GL_APPLE_rgb_422
+#define GL_APPLE_rgb_422 1
+#endif
+
+#ifndef GL_NV_video_capture
+#define GL_NV_video_capture 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBeginVideoCaptureNV (GLuint video_capture_slot);
+GLAPI void APIENTRY glBindVideoCaptureStreamBufferNV (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset);
+GLAPI void APIENTRY glBindVideoCaptureStreamTextureNV (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture);
+GLAPI void APIENTRY glEndVideoCaptureNV (GLuint video_capture_slot);
+GLAPI void APIENTRY glGetVideoCaptureivNV (GLuint video_capture_slot, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetVideoCaptureStreamivNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetVideoCaptureStreamfvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat *params);
+GLAPI void APIENTRY glGetVideoCaptureStreamdvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble *params);
+GLAPI GLenum APIENTRY glVideoCaptureNV (GLuint video_capture_slot, GLuint *sequence_num, GLuint64EXT *capture_time);
+GLAPI void APIENTRY glVideoCaptureStreamParameterivNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint *params);
+GLAPI void APIENTRY glVideoCaptureStreamParameterfvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat *params);
+GLAPI void APIENTRY glVideoCaptureStreamParameterdvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBEGINVIDEOCAPTURENVPROC) (GLuint video_capture_slot);
+typedef void (APIENTRYP PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset);
+typedef void (APIENTRYP PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture);
+typedef void (APIENTRYP PFNGLENDVIDEOCAPTURENVPROC) (GLuint video_capture_slot);
+typedef void (APIENTRYP PFNGLGETVIDEOCAPTUREIVNVPROC) (GLuint video_capture_slot, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat *params);
+typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble *params);
+typedef GLenum (APIENTRYP PFNGLVIDEOCAPTURENVPROC) (GLuint video_capture_slot, GLuint *sequence_num, GLuint64EXT *capture_time);
+typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint *params);
+typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat *params);
+typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble *params);
+#endif
+
+#ifndef GL_NV_copy_image
+#define GL_NV_copy_image 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glCopyImageSubDataNV (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 width, GLsizei height, GLsizei depth);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATANVPROC) (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 width, GLsizei height, GLsizei depth);
+#endif
+
+#ifndef GL_EXT_separate_shader_objects
+#define GL_EXT_separate_shader_objects 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glUseShaderProgramEXT (GLenum type, GLuint program);
+GLAPI void APIENTRY glActiveProgramEXT (GLuint program);
+GLAPI GLuint APIENTRY glCreateShaderProgramEXT (GLenum type, const GLchar *string);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLUSESHADERPROGRAMEXTPROC) (GLenum type, GLuint program);
+typedef void (APIENTRYP PFNGLACTIVEPROGRAMEXTPROC) (GLuint program);
+typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMEXTPROC) (GLenum type, const GLchar *string);
+#endif
+
+#ifndef GL_NV_parameter_buffer_object2
+#define GL_NV_parameter_buffer_object2 1
+#endif
+
+#ifndef GL_NV_shader_buffer_load
+#define GL_NV_shader_buffer_load 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glMakeBufferResidentNV (GLenum target, GLenum access);
+GLAPI void APIENTRY glMakeBufferNonResidentNV (GLenum target);
+GLAPI GLboolean APIENTRY glIsBufferResidentNV (GLenum target);
+GLAPI void APIENTRY glMakeNamedBufferResidentNV (GLuint buffer, GLenum access);
+GLAPI void APIENTRY glMakeNamedBufferNonResidentNV (GLuint buffer);
+GLAPI GLboolean APIENTRY glIsNamedBufferResidentNV (GLuint buffer);
+GLAPI void APIENTRY glGetBufferParameterui64vNV (GLenum target, GLenum pname, GLuint64EXT *params);
+GLAPI void APIENTRY glGetNamedBufferParameterui64vNV (GLuint buffer, GLenum pname, GLuint64EXT *params);
+GLAPI void APIENTRY glGetIntegerui64vNV (GLenum value, GLuint64EXT *result);
+GLAPI void APIENTRY glUniformui64NV (GLint location, GLuint64EXT value);
+GLAPI void APIENTRY glUniformui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
+GLAPI void APIENTRY glGetUniformui64vNV (GLuint program, GLint location, GLuint64EXT *params);
+GLAPI void APIENTRY glProgramUniformui64NV (GLuint program, GLint location, GLuint64EXT value);
+GLAPI void APIENTRY glProgramUniformui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLMAKEBUFFERRESIDENTNVPROC) (GLenum target, GLenum access);
+typedef void (APIENTRYP PFNGLMAKEBUFFERNONRESIDENTNVPROC) (GLenum target);
+typedef GLboolean (APIENTRYP PFNGLISBUFFERRESIDENTNVPROC) (GLenum target);
+typedef void (APIENTRYP PFNGLMAKENAMEDBUFFERRESIDENTNVPROC) (GLuint buffer, GLenum access);
+typedef void (APIENTRYP PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC) (GLuint buffer);
+typedef GLboolean (APIENTRYP PFNGLISNAMEDBUFFERRESIDENTNVPROC) (GLuint buffer);
+typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERUI64VNVPROC) (GLenum target, GLenum pname, GLuint64EXT *params);
+typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC) (GLuint buffer, GLenum pname, GLuint64EXT *params);
+typedef void (APIENTRYP PFNGLGETINTEGERUI64VNVPROC) (GLenum value, GLuint64EXT *result);
+typedef void (APIENTRYP PFNGLUNIFORMUI64NVPROC) (GLint location, GLuint64EXT value);
+typedef void (APIENTRYP PFNGLUNIFORMUI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (APIENTRYP PFNGLGETUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLuint64EXT *params);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMUI64NVPROC) (GLuint program, GLint location, GLuint64EXT value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+#endif
+
+#ifndef GL_NV_vertex_buffer_unified_memory
+#define GL_NV_vertex_buffer_unified_memory 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBufferAddressRangeNV (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length);
+GLAPI void APIENTRY glVertexFormatNV (GLint size, GLenum type, GLsizei stride);
+GLAPI void APIENTRY glNormalFormatNV (GLenum type, GLsizei stride);
+GLAPI void APIENTRY glColorFormatNV (GLint size, GLenum type, GLsizei stride);
+GLAPI void APIENTRY glIndexFormatNV (GLenum type, GLsizei stride);
+GLAPI void APIENTRY glTexCoordFormatNV (GLint size, GLenum type, GLsizei stride);
+GLAPI void APIENTRY glEdgeFlagFormatNV (GLsizei stride);
+GLAPI void APIENTRY glSecondaryColorFormatNV (GLint size, GLenum type, GLsizei stride);
+GLAPI void APIENTRY glFogCoordFormatNV (GLenum type, GLsizei stride);
+GLAPI void APIENTRY glVertexAttribFormatNV (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride);
+GLAPI void APIENTRY glVertexAttribIFormatNV (GLuint index, GLint size, GLenum type, GLsizei stride);
+GLAPI void APIENTRY glGetIntegerui64i_vNV (GLenum value, GLuint index, GLuint64EXT *result);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBUFFERADDRESSRANGENVPROC) (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length);
+typedef void (APIENTRYP PFNGLVERTEXFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);
+typedef void (APIENTRYP PFNGLNORMALFORMATNVPROC) (GLenum type, GLsizei stride);
+typedef void (APIENTRYP PFNGLCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);
+typedef void (APIENTRYP PFNGLINDEXFORMATNVPROC) (GLenum type, GLsizei stride);
+typedef void (APIENTRYP PFNGLTEXCOORDFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);
+typedef void (APIENTRYP PFNGLEDGEFLAGFORMATNVPROC) (GLsizei stride);
+typedef void (APIENTRYP PFNGLSECONDARYCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);
+typedef void (APIENTRYP PFNGLFOGCOORDFORMATNVPROC) (GLenum type, GLsizei stride);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride);
+typedef void (APIENTRYP PFNGLGETINTEGERUI64I_VNVPROC) (GLenum value, GLuint index, GLuint64EXT *result);
+#endif
+
+#ifndef GL_NV_texture_barrier
+#define GL_NV_texture_barrier 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTextureBarrierNV (void);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTEXTUREBARRIERNVPROC) (void);
+#endif
+
+#ifndef GL_AMD_shader_stencil_export
+#define GL_AMD_shader_stencil_export 1
+#endif
+
+#ifndef GL_AMD_seamless_cubemap_per_texture
+#define GL_AMD_seamless_cubemap_per_texture 1
+#endif
+
+#ifndef GL_AMD_conservative_depth
+#define GL_AMD_conservative_depth 1
+#endif
+
+#ifndef GL_EXT_shader_image_load_store
+#define GL_EXT_shader_image_load_store 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBindImageTextureEXT (GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format);
+GLAPI void APIENTRY glMemoryBarrierEXT (GLbitfield barriers);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBINDIMAGETEXTUREEXTPROC) (GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format);
+typedef void (APIENTRYP PFNGLMEMORYBARRIEREXTPROC) (GLbitfield barriers);
+#endif
+
+#ifndef GL_EXT_vertex_attrib_64bit
+#define GL_EXT_vertex_attrib_64bit 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glVertexAttribL1dEXT (GLuint index, GLdouble x);
+GLAPI void APIENTRY glVertexAttribL2dEXT (GLuint index, GLdouble x, GLdouble y);
+GLAPI void APIENTRY glVertexAttribL3dEXT (GLuint index, GLdouble x, GLdouble y, GLdouble z);
+GLAPI void APIENTRY glVertexAttribL4dEXT (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+GLAPI void APIENTRY glVertexAttribL1dvEXT (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttribL2dvEXT (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttribL3dvEXT (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttribL4dvEXT (GLuint index, const GLdouble *v);
+GLAPI void APIENTRY glVertexAttribLPointerEXT (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+GLAPI void APIENTRY glGetVertexAttribLdvEXT (GLuint index, GLenum pname, GLdouble *params);
+GLAPI void APIENTRY glVertexArrayVertexAttribLOffsetEXT (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DEXTPROC) (GLuint index, GLdouble x);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DEXTPROC) (GLuint index, GLdouble x, GLdouble y);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVEXTPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVEXTPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVEXTPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVEXTPROC) (GLuint index, const GLdouble *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVEXTPROC) (GLuint index, GLenum pname, GLdouble *params);
+typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);
+#endif
+
+#ifndef GL_NV_gpu_program5
+#define GL_NV_gpu_program5 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glProgramSubroutineParametersuivNV (GLenum target, GLsizei count, const GLuint *params);
+GLAPI void APIENTRY glGetProgramSubroutineParameteruivNV (GLenum target, GLuint index, GLuint *param);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPROGRAMSUBROUTINEPARAMETERSUIVNVPROC) (GLenum target, GLsizei count, const GLuint *params);
+typedef void (APIENTRYP PFNGLGETPROGRAMSUBROUTINEPARAMETERUIVNVPROC) (GLenum target, GLuint index, GLuint *param);
+#endif
+
+#ifndef GL_NV_gpu_shader5
+#define GL_NV_gpu_shader5 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glUniform1i64NV (GLint location, GLint64EXT x);
+GLAPI void APIENTRY glUniform2i64NV (GLint location, GLint64EXT x, GLint64EXT y);
+GLAPI void APIENTRY glUniform3i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
+GLAPI void APIENTRY glUniform4i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
+GLAPI void APIENTRY glUniform1i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
+GLAPI void APIENTRY glUniform2i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
+GLAPI void APIENTRY glUniform3i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
+GLAPI void APIENTRY glUniform4i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
+GLAPI void APIENTRY glUniform1ui64NV (GLint location, GLuint64EXT x);
+GLAPI void APIENTRY glUniform2ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y);
+GLAPI void APIENTRY glUniform3ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
+GLAPI void APIENTRY glUniform4ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
+GLAPI void APIENTRY glUniform1ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
+GLAPI void APIENTRY glUniform2ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
+GLAPI void APIENTRY glUniform3ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
+GLAPI void APIENTRY glUniform4ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
+GLAPI void APIENTRY glGetUniformi64vNV (GLuint program, GLint location, GLint64EXT *params);
+GLAPI void APIENTRY glProgramUniform1i64NV (GLuint program, GLint location, GLint64EXT x);
+GLAPI void APIENTRY glProgramUniform2i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y);
+GLAPI void APIENTRY glProgramUniform3i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
+GLAPI void APIENTRY glProgramUniform4i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
+GLAPI void APIENTRY glProgramUniform1i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+GLAPI void APIENTRY glProgramUniform2i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+GLAPI void APIENTRY glProgramUniform3i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+GLAPI void APIENTRY glProgramUniform4i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+GLAPI void APIENTRY glProgramUniform1ui64NV (GLuint program, GLint location, GLuint64EXT x);
+GLAPI void APIENTRY glProgramUniform2ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y);
+GLAPI void APIENTRY glProgramUniform3ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
+GLAPI void APIENTRY glProgramUniform4ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
+GLAPI void APIENTRY glProgramUniform1ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+GLAPI void APIENTRY glProgramUniform2ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+GLAPI void APIENTRY glProgramUniform3ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+GLAPI void APIENTRY glProgramUniform4ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x);
+typedef void (APIENTRYP PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y);
+typedef void (APIENTRYP PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
+typedef void (APIENTRYP PFNGLUNIFORM4I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
+typedef void (APIENTRYP PFNGLUNIFORM1I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (APIENTRYP PFNGLUNIFORM2I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (APIENTRYP PFNGLUNIFORM3I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (APIENTRYP PFNGLUNIFORM4I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (APIENTRYP PFNGLUNIFORM1UI64NVPROC) (GLint location, GLuint64EXT x);
+typedef void (APIENTRYP PFNGLUNIFORM2UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y);
+typedef void (APIENTRYP PFNGLUNIFORM3UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
+typedef void (APIENTRYP PFNGLUNIFORM4UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
+typedef void (APIENTRYP PFNGLUNIFORM1UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (APIENTRYP PFNGLUNIFORM2UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (APIENTRYP PFNGLUNIFORM3UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (APIENTRYP PFNGLUNIFORM4UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (APIENTRYP PFNGLGETUNIFORMI64VNVPROC) (GLuint program, GLint location, GLint64EXT *params);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64NVPROC) (GLuint program, GLint location, GLint64EXT x);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
+#endif
+
+#ifndef GL_NV_shader_buffer_store
+#define GL_NV_shader_buffer_store 1
+#endif
+
+#ifndef GL_NV_tessellation_program5
+#define GL_NV_tessellation_program5 1
+#endif
+
+#ifndef GL_NV_vertex_attrib_integer_64bit
+#define GL_NV_vertex_attrib_integer_64bit 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glVertexAttribL1i64NV (GLuint index, GLint64EXT x);
+GLAPI void APIENTRY glVertexAttribL2i64NV (GLuint index, GLint64EXT x, GLint64EXT y);
+GLAPI void APIENTRY glVertexAttribL3i64NV (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z);
+GLAPI void APIENTRY glVertexAttribL4i64NV (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
+GLAPI void APIENTRY glVertexAttribL1i64vNV (GLuint index, const GLint64EXT *v);
+GLAPI void APIENTRY glVertexAttribL2i64vNV (GLuint index, const GLint64EXT *v);
+GLAPI void APIENTRY glVertexAttribL3i64vNV (GLuint index, const GLint64EXT *v);
+GLAPI void APIENTRY glVertexAttribL4i64vNV (GLuint index, const GLint64EXT *v);
+GLAPI void APIENTRY glVertexAttribL1ui64NV (GLuint index, GLuint64EXT x);
+GLAPI void APIENTRY glVertexAttribL2ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y);
+GLAPI void APIENTRY glVertexAttribL3ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
+GLAPI void APIENTRY glVertexAttribL4ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
+GLAPI void APIENTRY glVertexAttribL1ui64vNV (GLuint index, const GLuint64EXT *v);
+GLAPI void APIENTRY glVertexAttribL2ui64vNV (GLuint index, const GLuint64EXT *v);
+GLAPI void APIENTRY glVertexAttribL3ui64vNV (GLuint index, const GLuint64EXT *v);
+GLAPI void APIENTRY glVertexAttribL4ui64vNV (GLuint index, const GLuint64EXT *v);
+GLAPI void APIENTRY glGetVertexAttribLi64vNV (GLuint index, GLenum pname, GLint64EXT *params);
+GLAPI void APIENTRY glGetVertexAttribLui64vNV (GLuint index, GLenum pname, GLuint64EXT *params);
+GLAPI void APIENTRY glVertexAttribLFormatNV (GLuint index, GLint size, GLenum type, GLsizei stride);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL1I64NVPROC) (GLuint index, GLint64EXT x);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL2I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL3I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL4I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL1I64VNVPROC) (GLuint index, const GLint64EXT *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL2I64VNVPROC) (GLuint index, const GLint64EXT *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL3I64VNVPROC) (GLuint index, const GLint64EXT *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL4I64VNVPROC) (GLuint index, const GLint64EXT *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64NVPROC) (GLuint index, GLuint64EXT x);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL2UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL3UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL4UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64VNVPROC) (GLuint index, const GLuint64EXT *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL2UI64VNVPROC) (GLuint index, const GLuint64EXT *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL3UI64VNVPROC) (GLuint index, const GLuint64EXT *v);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBL4UI64VNVPROC) (GLuint index, const GLuint64EXT *v);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLI64VNVPROC) (GLuint index, GLenum pname, GLint64EXT *params);
+typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLUI64VNVPROC) (GLuint index, GLenum pname, GLuint64EXT *params);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride);
+#endif
+
+#ifndef GL_NV_multisample_coverage
+#define GL_NV_multisample_coverage 1
+#endif
+
+#ifndef GL_AMD_name_gen_delete
+#define GL_AMD_name_gen_delete 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGenNamesAMD (GLenum identifier, GLuint num, GLuint *names);
+GLAPI void APIENTRY glDeleteNamesAMD (GLenum identifier, GLuint num, const GLuint *names);
+GLAPI GLboolean APIENTRY glIsNameAMD (GLenum identifier, GLuint name);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGENNAMESAMDPROC) (GLenum identifier, GLuint num, GLuint *names);
+typedef void (APIENTRYP PFNGLDELETENAMESAMDPROC) (GLenum identifier, GLuint num, const GLuint *names);
+typedef GLboolean (APIENTRYP PFNGLISNAMEAMDPROC) (GLenum identifier, GLuint name);
+#endif
+
+#ifndef GL_AMD_debug_output
+#define GL_AMD_debug_output 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDebugMessageEnableAMD (GLenum category, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
+GLAPI void APIENTRY glDebugMessageInsertAMD (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar *buf);
+GLAPI void APIENTRY glDebugMessageCallbackAMD (GLDEBUGPROCAMD callback, GLvoid *userParam);
+GLAPI GLuint APIENTRY glGetDebugMessageLogAMD (GLuint count, GLsizei bufsize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDEBUGMESSAGEENABLEAMDPROC) (GLenum category, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
+typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTAMDPROC) (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar *buf);
+typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKAMDPROC) (GLDEBUGPROCAMD callback, GLvoid *userParam);
+typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGAMDPROC) (GLuint count, GLsizei bufsize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message);
+#endif
+
+#ifndef GL_NV_vdpau_interop
+#define GL_NV_vdpau_interop 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glVDPAUInitNV (const GLvoid *vdpDevice, const GLvoid *getProcAddress);
+GLAPI void APIENTRY glVDPAUFiniNV (void);
+GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterVideoSurfaceNV (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);
+GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterOutputSurfaceNV (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);
+GLAPI void APIENTRY glVDPAUIsSurfaceNV (GLvdpauSurfaceNV surface);
+GLAPI void APIENTRY glVDPAUUnregisterSurfaceNV (GLvdpauSurfaceNV surface);
+GLAPI void APIENTRY glVDPAUGetSurfaceivNV (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+GLAPI void APIENTRY glVDPAUSurfaceAccessNV (GLvdpauSurfaceNV surface, GLenum access);
+GLAPI void APIENTRY glVDPAUMapSurfacesNV (GLsizei numSurfaces, const GLvdpauSurfaceNV *surfaces);
+GLAPI void APIENTRY glVDPAUUnmapSurfacesNV (GLsizei numSurface, const GLvdpauSurfaceNV *surfaces);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLVDPAUINITNVPROC) (const GLvoid *vdpDevice, const GLvoid *getProcAddress);
+typedef void (APIENTRYP PFNGLVDPAUFININVPROC) (void);
+typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTERVIDEOSURFACENVPROC) (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);
+typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC) (GLvoid *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);
+typedef void (APIENTRYP PFNGLVDPAUISSURFACENVPROC) (GLvdpauSurfaceNV surface);
+typedef void (APIENTRYP PFNGLVDPAUUNREGISTERSURFACENVPROC) (GLvdpauSurfaceNV surface);
+typedef void (APIENTRYP PFNGLVDPAUGETSURFACEIVNVPROC) (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
+typedef void (APIENTRYP PFNGLVDPAUSURFACEACCESSNVPROC) (GLvdpauSurfaceNV surface, GLenum access);
+typedef void (APIENTRYP PFNGLVDPAUMAPSURFACESNVPROC) (GLsizei numSurfaces, const GLvdpauSurfaceNV *surfaces);
+typedef void (APIENTRYP PFNGLVDPAUUNMAPSURFACESNVPROC) (GLsizei numSurface, const GLvdpauSurfaceNV *surfaces);
+#endif
+
+#ifndef GL_AMD_transform_feedback3_lines_triangles
+#define GL_AMD_transform_feedback3_lines_triangles 1
+#endif
+
+#ifndef GL_AMD_depth_clamp_separate
+#define GL_AMD_depth_clamp_separate 1
+#endif
+
+#ifndef GL_EXT_texture_sRGB_decode
+#define GL_EXT_texture_sRGB_decode 1
+#endif
+
+#ifndef GL_NV_texture_multisample
+#define GL_NV_texture_multisample 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTexImage2DMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
+GLAPI void APIENTRY glTexImage3DMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
+GLAPI void APIENTRY glTextureImage2DMultisampleNV (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
+GLAPI void APIENTRY glTextureImage3DMultisampleNV (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
+GLAPI void APIENTRY glTextureImage2DMultisampleCoverageNV (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
+GLAPI void APIENTRY glTextureImage3DMultisampleCoverageNV (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
+typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
+typedef void (APIENTRYP PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
+typedef void (APIENTRYP PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
+typedef void (APIENTRYP PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
+typedef void (APIENTRYP PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
+#endif
+
+#ifndef GL_AMD_blend_minmax_factor
+#define GL_AMD_blend_minmax_factor 1
+#endif
+
+#ifndef GL_AMD_sample_positions
+#define GL_AMD_sample_positions 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glSetMultisamplefvAMD (GLenum pname, GLuint index, const GLfloat *val);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLSETMULTISAMPLEFVAMDPROC) (GLenum pname, GLuint index, const GLfloat *val);
+#endif
+
+#ifndef GL_EXT_x11_sync_object
+#define GL_EXT_x11_sync_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI GLsync APIENTRY glImportSyncEXT (GLenum external_sync_type, GLintptr external_sync, GLbitfield flags);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLsync (APIENTRYP PFNGLIMPORTSYNCEXTPROC) (GLenum external_sync_type, GLintptr external_sync, GLbitfield flags);
+#endif
+
+#ifndef GL_AMD_multi_draw_indirect
+#define GL_AMD_multi_draw_indirect 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glMultiDrawArraysIndirectAMD (GLenum mode, const GLvoid *indirect, GLsizei primcount, GLsizei stride);
+GLAPI void APIENTRY glMultiDrawElementsIndirectAMD (GLenum mode, GLenum type, const GLvoid *indirect, GLsizei primcount, GLsizei stride);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC) (GLenum mode, const GLvoid *indirect, GLsizei primcount, GLsizei stride);
+typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC) (GLenum mode, GLenum type, const GLvoid *indirect, GLsizei primcount, GLsizei stride);
+#endif
+
+#ifndef GL_EXT_framebuffer_multisample_blit_scaled
+#define GL_EXT_framebuffer_multisample_blit_scaled 1
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null
+/*
+ * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
+ * Copyright (C) 1991-2000 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.
+ */
+
+#ifndef __glu_h__
+#define __glu_h__
+
+#if defined(USE_MGL_NAMESPACE)
+#include "glu_mangle.h"
+#endif
+
+#include <GL/gl.h>
+
+#ifndef GLAPIENTRY
+#if defined(_MSC_VER) || defined(__MINGW32__)
+#define GLAPIENTRY __stdcall
+#else
+#define GLAPIENTRY
+#endif
+#endif
+
+#ifndef GLAPIENTRYP
+#define GLAPIENTRYP GLAPIENTRY *
+#endif
+
+#if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GLU32)
+# undef GLAPI
+# define GLAPI __declspec(dllexport)
+#elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL)
+/* tag specifying we're building for DLL runtime support */
+# undef GLAPI
+# define GLAPI __declspec(dllimport)
+#elif !defined(GLAPI)
+/* for use with static link lib build of Win32 edition only */
+# define GLAPI extern
+#endif /* _STATIC_MESA support */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*************************************************************/
+
+/* Extensions */
+#define GLU_EXT_object_space_tess 1
+#define GLU_EXT_nurbs_tessellator 1
+
+/* Boolean */
+#define GLU_FALSE 0
+#define GLU_TRUE 1
+
+/* Version */
+#define GLU_VERSION_1_1 1
+#define GLU_VERSION_1_2 1
+#define GLU_VERSION_1_3 1
+
+/* StringName */
+#define GLU_VERSION 100800
+#define GLU_EXTENSIONS 100801
+
+/* ErrorCode */
+#define GLU_INVALID_ENUM 100900
+#define GLU_INVALID_VALUE 100901
+#define GLU_OUT_OF_MEMORY 100902
+#define GLU_INCOMPATIBLE_GL_VERSION 100903
+#define GLU_INVALID_OPERATION 100904
+
+/* NurbsDisplay */
+/* GLU_FILL */
+#define GLU_OUTLINE_POLYGON 100240
+#define GLU_OUTLINE_PATCH 100241
+
+/* NurbsCallback */
+#define GLU_NURBS_ERROR 100103
+#define GLU_ERROR 100103
+#define GLU_NURBS_BEGIN 100164
+#define GLU_NURBS_BEGIN_EXT 100164
+#define GLU_NURBS_VERTEX 100165
+#define GLU_NURBS_VERTEX_EXT 100165
+#define GLU_NURBS_NORMAL 100166
+#define GLU_NURBS_NORMAL_EXT 100166
+#define GLU_NURBS_COLOR 100167
+#define GLU_NURBS_COLOR_EXT 100167
+#define GLU_NURBS_TEXTURE_COORD 100168
+#define GLU_NURBS_TEX_COORD_EXT 100168
+#define GLU_NURBS_END 100169
+#define GLU_NURBS_END_EXT 100169
+#define GLU_NURBS_BEGIN_DATA 100170
+#define GLU_NURBS_BEGIN_DATA_EXT 100170
+#define GLU_NURBS_VERTEX_DATA 100171
+#define GLU_NURBS_VERTEX_DATA_EXT 100171
+#define GLU_NURBS_NORMAL_DATA 100172
+#define GLU_NURBS_NORMAL_DATA_EXT 100172
+#define GLU_NURBS_COLOR_DATA 100173
+#define GLU_NURBS_COLOR_DATA_EXT 100173
+#define GLU_NURBS_TEXTURE_COORD_DATA 100174
+#define GLU_NURBS_TEX_COORD_DATA_EXT 100174
+#define GLU_NURBS_END_DATA 100175
+#define GLU_NURBS_END_DATA_EXT 100175
+
+/* NurbsError */
+#define GLU_NURBS_ERROR1 100251
+#define GLU_NURBS_ERROR2 100252
+#define GLU_NURBS_ERROR3 100253
+#define GLU_NURBS_ERROR4 100254
+#define GLU_NURBS_ERROR5 100255
+#define GLU_NURBS_ERROR6 100256
+#define GLU_NURBS_ERROR7 100257
+#define GLU_NURBS_ERROR8 100258
+#define GLU_NURBS_ERROR9 100259
+#define GLU_NURBS_ERROR10 100260
+#define GLU_NURBS_ERROR11 100261
+#define GLU_NURBS_ERROR12 100262
+#define GLU_NURBS_ERROR13 100263
+#define GLU_NURBS_ERROR14 100264
+#define GLU_NURBS_ERROR15 100265
+#define GLU_NURBS_ERROR16 100266
+#define GLU_NURBS_ERROR17 100267
+#define GLU_NURBS_ERROR18 100268
+#define GLU_NURBS_ERROR19 100269
+#define GLU_NURBS_ERROR20 100270
+#define GLU_NURBS_ERROR21 100271
+#define GLU_NURBS_ERROR22 100272
+#define GLU_NURBS_ERROR23 100273
+#define GLU_NURBS_ERROR24 100274
+#define GLU_NURBS_ERROR25 100275
+#define GLU_NURBS_ERROR26 100276
+#define GLU_NURBS_ERROR27 100277
+#define GLU_NURBS_ERROR28 100278
+#define GLU_NURBS_ERROR29 100279
+#define GLU_NURBS_ERROR30 100280
+#define GLU_NURBS_ERROR31 100281
+#define GLU_NURBS_ERROR32 100282
+#define GLU_NURBS_ERROR33 100283
+#define GLU_NURBS_ERROR34 100284
+#define GLU_NURBS_ERROR35 100285
+#define GLU_NURBS_ERROR36 100286
+#define GLU_NURBS_ERROR37 100287
+
+/* NurbsProperty */
+#define GLU_AUTO_LOAD_MATRIX 100200
+#define GLU_CULLING 100201
+#define GLU_SAMPLING_TOLERANCE 100203
+#define GLU_DISPLAY_MODE 100204
+#define GLU_PARAMETRIC_TOLERANCE 100202
+#define GLU_SAMPLING_METHOD 100205
+#define GLU_U_STEP 100206
+#define GLU_V_STEP 100207
+#define GLU_NURBS_MODE 100160
+#define GLU_NURBS_MODE_EXT 100160
+#define GLU_NURBS_TESSELLATOR 100161
+#define GLU_NURBS_TESSELLATOR_EXT 100161
+#define GLU_NURBS_RENDERER 100162
+#define GLU_NURBS_RENDERER_EXT 100162
+
+/* NurbsSampling */
+#define GLU_OBJECT_PARAMETRIC_ERROR 100208
+#define GLU_OBJECT_PARAMETRIC_ERROR_EXT 100208
+#define GLU_OBJECT_PATH_LENGTH 100209
+#define GLU_OBJECT_PATH_LENGTH_EXT 100209
+#define GLU_PATH_LENGTH 100215
+#define GLU_PARAMETRIC_ERROR 100216
+#define GLU_DOMAIN_DISTANCE 100217
+
+/* NurbsTrim */
+#define GLU_MAP1_TRIM_2 100210
+#define GLU_MAP1_TRIM_3 100211
+
+/* QuadricDrawStyle */
+#define GLU_POINT 100010
+#define GLU_LINE 100011
+#define GLU_FILL 100012
+#define GLU_SILHOUETTE 100013
+
+/* QuadricCallback */
+/* GLU_ERROR */
+
+/* QuadricNormal */
+#define GLU_SMOOTH 100000
+#define GLU_FLAT 100001
+#define GLU_NONE 100002
+
+/* QuadricOrientation */
+#define GLU_OUTSIDE 100020
+#define GLU_INSIDE 100021
+
+/* TessCallback */
+#define GLU_TESS_BEGIN 100100
+#define GLU_BEGIN 100100
+#define GLU_TESS_VERTEX 100101
+#define GLU_VERTEX 100101
+#define GLU_TESS_END 100102
+#define GLU_END 100102
+#define GLU_TESS_ERROR 100103
+#define GLU_TESS_EDGE_FLAG 100104
+#define GLU_EDGE_FLAG 100104
+#define GLU_TESS_COMBINE 100105
+#define GLU_TESS_BEGIN_DATA 100106
+#define GLU_TESS_VERTEX_DATA 100107
+#define GLU_TESS_END_DATA 100108
+#define GLU_TESS_ERROR_DATA 100109
+#define GLU_TESS_EDGE_FLAG_DATA 100110
+#define GLU_TESS_COMBINE_DATA 100111
+
+/* TessContour */
+#define GLU_CW 100120
+#define GLU_CCW 100121
+#define GLU_INTERIOR 100122
+#define GLU_EXTERIOR 100123
+#define GLU_UNKNOWN 100124
+
+/* TessProperty */
+#define GLU_TESS_WINDING_RULE 100140
+#define GLU_TESS_BOUNDARY_ONLY 100141
+#define GLU_TESS_TOLERANCE 100142
+
+/* TessError */
+#define GLU_TESS_ERROR1 100151
+#define GLU_TESS_ERROR2 100152
+#define GLU_TESS_ERROR3 100153
+#define GLU_TESS_ERROR4 100154
+#define GLU_TESS_ERROR5 100155
+#define GLU_TESS_ERROR6 100156
+#define GLU_TESS_ERROR7 100157
+#define GLU_TESS_ERROR8 100158
+#define GLU_TESS_MISSING_BEGIN_POLYGON 100151
+#define GLU_TESS_MISSING_BEGIN_CONTOUR 100152
+#define GLU_TESS_MISSING_END_POLYGON 100153
+#define GLU_TESS_MISSING_END_CONTOUR 100154
+#define GLU_TESS_COORD_TOO_LARGE 100155
+#define GLU_TESS_NEED_COMBINE_CALLBACK 100156
+
+/* TessWinding */
+#define GLU_TESS_WINDING_ODD 100130
+#define GLU_TESS_WINDING_NONZERO 100131
+#define GLU_TESS_WINDING_POSITIVE 100132
+#define GLU_TESS_WINDING_NEGATIVE 100133
+#define GLU_TESS_WINDING_ABS_GEQ_TWO 100134
+
+/*************************************************************/
+
+
+#ifdef __cplusplus
+class GLUnurbs;
+class GLUquadric;
+class GLUtesselator;
+#else
+typedef struct GLUnurbs GLUnurbs;
+typedef struct GLUquadric GLUquadric;
+typedef struct GLUtesselator GLUtesselator;
+#endif
+
+typedef GLUnurbs GLUnurbsObj;
+typedef GLUquadric GLUquadricObj;
+typedef GLUtesselator GLUtesselatorObj;
+typedef GLUtesselator GLUtriangulatorObj;
+
+#define GLU_TESS_MAX_COORD 1.0e150
+
+/* Internal convenience typedefs */
+typedef void (GLAPIENTRYP _GLUfuncptr)(void);
+
+GLAPI void GLAPIENTRY gluBeginCurve (GLUnurbs* nurb);
+GLAPI void GLAPIENTRY gluBeginPolygon (GLUtesselator* tess);
+GLAPI void GLAPIENTRY gluBeginSurface (GLUnurbs* nurb);
+GLAPI void GLAPIENTRY gluBeginTrim (GLUnurbs* nurb);
+GLAPI GLint GLAPIENTRY gluBuild1DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data);
+GLAPI GLint GLAPIENTRY gluBuild1DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, const void *data);
+GLAPI GLint GLAPIENTRY gluBuild2DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data);
+GLAPI GLint GLAPIENTRY gluBuild2DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data);
+GLAPI GLint GLAPIENTRY gluBuild3DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data);
+GLAPI GLint GLAPIENTRY gluBuild3DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
+GLAPI GLboolean GLAPIENTRY gluCheckExtension (const GLubyte *extName, const GLubyte *extString);
+GLAPI void GLAPIENTRY gluCylinder (GLUquadric* quad, GLdouble base, GLdouble top, GLdouble height, GLint slices, GLint stacks);
+GLAPI void GLAPIENTRY gluDeleteNurbsRenderer (GLUnurbs* nurb);
+GLAPI void GLAPIENTRY gluDeleteQuadric (GLUquadric* quad);
+GLAPI void GLAPIENTRY gluDeleteTess (GLUtesselator* tess);
+GLAPI void GLAPIENTRY gluDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops);
+GLAPI void GLAPIENTRY gluEndCurve (GLUnurbs* nurb);
+GLAPI void GLAPIENTRY gluEndPolygon (GLUtesselator* tess);
+GLAPI void GLAPIENTRY gluEndSurface (GLUnurbs* nurb);
+GLAPI void GLAPIENTRY gluEndTrim (GLUnurbs* nurb);
+GLAPI const GLubyte * GLAPIENTRY gluErrorString (GLenum error);
+GLAPI void GLAPIENTRY gluGetNurbsProperty (GLUnurbs* nurb, GLenum property, GLfloat* data);
+GLAPI const GLubyte * GLAPIENTRY gluGetString (GLenum name);
+GLAPI void GLAPIENTRY gluGetTessProperty (GLUtesselator* tess, GLenum which, GLdouble* data);
+GLAPI void GLAPIENTRY gluLoadSamplingMatrices (GLUnurbs* nurb, const GLfloat *model, const GLfloat *perspective, const GLint *view);
+GLAPI void GLAPIENTRY gluLookAt (GLdouble eyeX, GLdouble eyeY, GLdouble eyeZ, GLdouble centerX, GLdouble centerY, GLdouble centerZ, GLdouble upX, GLdouble upY, GLdouble upZ);
+GLAPI GLUnurbs* GLAPIENTRY gluNewNurbsRenderer (void);
+GLAPI GLUquadric* GLAPIENTRY gluNewQuadric (void);
+GLAPI GLUtesselator* GLAPIENTRY gluNewTess (void);
+GLAPI void GLAPIENTRY gluNextContour (GLUtesselator* tess, GLenum type);
+GLAPI void GLAPIENTRY gluNurbsCallback (GLUnurbs* nurb, GLenum which, _GLUfuncptr CallBackFunc);
+GLAPI void GLAPIENTRY gluNurbsCallbackData (GLUnurbs* nurb, GLvoid* userData);
+GLAPI void GLAPIENTRY gluNurbsCallbackDataEXT (GLUnurbs* nurb, GLvoid* userData);
+GLAPI void GLAPIENTRY gluNurbsCurve (GLUnurbs* nurb, GLint knotCount, GLfloat *knots, GLint stride, GLfloat *control, GLint order, GLenum type);
+GLAPI void GLAPIENTRY gluNurbsProperty (GLUnurbs* nurb, GLenum property, GLfloat value);
+GLAPI void GLAPIENTRY gluNurbsSurface (GLUnurbs* nurb, GLint sKnotCount, GLfloat* sKnots, GLint tKnotCount, GLfloat* tKnots, GLint sStride, GLint tStride, GLfloat* control, GLint sOrder, GLint tOrder, GLenum type);
+GLAPI void GLAPIENTRY gluOrtho2D (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top);
+GLAPI void GLAPIENTRY gluPartialDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops, GLdouble start, GLdouble sweep);
+GLAPI void GLAPIENTRY gluPerspective (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar);
+GLAPI void GLAPIENTRY gluPickMatrix (GLdouble x, GLdouble y, GLdouble delX, GLdouble delY, GLint *viewport);
+GLAPI GLint GLAPIENTRY gluProject (GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* winX, GLdouble* winY, GLdouble* winZ);
+GLAPI void GLAPIENTRY gluPwlCurve (GLUnurbs* nurb, GLint count, GLfloat* data, GLint stride, GLenum type);
+GLAPI void GLAPIENTRY gluQuadricCallback (GLUquadric* quad, GLenum which, _GLUfuncptr CallBackFunc);
+GLAPI void GLAPIENTRY gluQuadricDrawStyle (GLUquadric* quad, GLenum draw);
+GLAPI void GLAPIENTRY gluQuadricNormals (GLUquadric* quad, GLenum normal);
+GLAPI void GLAPIENTRY gluQuadricOrientation (GLUquadric* quad, GLenum orientation);
+GLAPI void GLAPIENTRY gluQuadricTexture (GLUquadric* quad, GLboolean texture);
+GLAPI GLint GLAPIENTRY gluScaleImage (GLenum format, GLsizei wIn, GLsizei hIn, GLenum typeIn, const void *dataIn, GLsizei wOut, GLsizei hOut, GLenum typeOut, GLvoid* dataOut);
+GLAPI void GLAPIENTRY gluSphere (GLUquadric* quad, GLdouble radius, GLint slices, GLint stacks);
+GLAPI void GLAPIENTRY gluTessBeginContour (GLUtesselator* tess);
+GLAPI void GLAPIENTRY gluTessBeginPolygon (GLUtesselator* tess, GLvoid* data);
+GLAPI void GLAPIENTRY gluTessCallback (GLUtesselator* tess, GLenum which, _GLUfuncptr CallBackFunc);
+GLAPI void GLAPIENTRY gluTessEndContour (GLUtesselator* tess);
+GLAPI void GLAPIENTRY gluTessEndPolygon (GLUtesselator* tess);
+GLAPI void GLAPIENTRY gluTessNormal (GLUtesselator* tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ);
+GLAPI void GLAPIENTRY gluTessProperty (GLUtesselator* tess, GLenum which, GLdouble data);
+GLAPI void GLAPIENTRY gluTessVertex (GLUtesselator* tess, GLdouble *location, GLvoid* data);
+GLAPI GLint GLAPIENTRY gluUnProject (GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* objX, GLdouble* objY, GLdouble* objZ);
+GLAPI GLint GLAPIENTRY gluUnProject4 (GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble nearVal, GLdouble farVal, GLdouble* objX, GLdouble* objY, GLdouble* objZ, GLdouble* objW);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __glu_h__ */
--- /dev/null
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.0
+ * Copyright (C) 1995-1998 Brian Paul
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+
+#ifndef GLU_MANGLE_H
+#define GLU_MANGLE_H
+
+
+#define gluLookAt mgluLookAt
+#define gluOrtho2D mgluOrtho2D
+#define gluPerspective mgluPerspective
+#define gluPickMatrix mgluPickMatrix
+#define gluProject mgluProject
+#define gluUnProject mgluUnProject
+#define gluErrorString mgluErrorString
+#define gluScaleImage mgluScaleImage
+#define gluBuild1DMipmaps mgluBuild1DMipmaps
+#define gluBuild2DMipmaps mgluBuild2DMipmaps
+#define gluNewQuadric mgluNewQuadric
+#define gluDeleteQuadric mgluDeleteQuadric
+#define gluQuadricDrawStyle mgluQuadricDrawStyle
+#define gluQuadricOrientation mgluQuadricOrientation
+#define gluQuadricNormals mgluQuadricNormals
+#define gluQuadricTexture mgluQuadricTexture
+#define gluQuadricCallback mgluQuadricCallback
+#define gluCylinder mgluCylinder
+#define gluSphere mgluSphere
+#define gluDisk mgluDisk
+#define gluPartialDisk mgluPartialDisk
+#define gluNewNurbsRenderer mgluNewNurbsRenderer
+#define gluDeleteNurbsRenderer mgluDeleteNurbsRenderer
+#define gluLoadSamplingMatrices mgluLoadSamplingMatrices
+#define gluNurbsProperty mgluNurbsProperty
+#define gluGetNurbsProperty mgluGetNurbsProperty
+#define gluBeginCurve mgluBeginCurve
+#define gluEndCurve mgluEndCurve
+#define gluNurbsCurve mgluNurbsCurve
+#define gluBeginSurface mgluBeginSurface
+#define gluEndSurface mgluEndSurface
+#define gluNurbsSurface mgluNurbsSurface
+#define gluBeginTrim mgluBeginTrim
+#define gluEndTrim mgluEndTrim
+#define gluPwlCurve mgluPwlCurve
+#define gluNurbsCallback mgluNurbsCallback
+#define gluNewTess mgluNewTess
+#define gluDeleteTess mgluDeleteTess
+#define gluTessBeginPolygon mgluTessBeginPolygon
+#define gluTessBeginContour mgluTessBeginContour
+#define gluTessVertex mgluTessVertex
+#define gluTessEndPolygon mgluTessEndPolygon
+#define gluTessEndContour mgluTessEndContour
+#define gluTessProperty mgluTessProperty
+#define gluTessNormal mgluTessNormal
+#define gluTessCallback mgluTessCallback
+#define gluGetTessProperty mgluGetTessProperty
+#define gluBeginPolygon mgluBeginPolygon
+#define gluNextContour mgluNextContour
+#define gluEndPolygon mgluEndPolygon
+#define gluGetString mgluGetString
+#define gluBuild1DMipmapLevels mgluBuild1DMipmapLevels
+#define gluBuild2DMipmapLevels mgluBuild2DMipmapLevels
+#define gluBuild3DMipmapLevels mgluBuild3DMipmapLevels
+#define gluBuild3DMipmaps mgluBuild3DMipmaps
+#define gluCheckExtension mgluCheckExtension
+#define gluUnProject4 mgluUnProject4
+#define gluNurbsCallbackData mgluNurbsCallbackData
+#define gluNurbsCallbackDataEXT mgluNurbsCallbackDataEXT
+
+#endif
--- /dev/null
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.5
+ *
+ * Copyright (C) 1999-2006 Brian Paul 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 and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef GLX_H
+#define GLX_H
+
+
+#ifdef __VMS
+#include <GL/vms_x_fix.h>
+# ifdef __cplusplus
+/* VMS Xlib.h gives problems with C++.
+ * this avoids a bunch of trivial warnings */
+#pragma message disable nosimpint
+#endif
+#endif
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#ifdef __VMS
+# ifdef __cplusplus
+#pragma message enable nosimpint
+#endif
+#endif
+#include <GL/gl.h>
+
+
+#if defined(USE_MGL_NAMESPACE)
+#include "glx_mangle.h"
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#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;
+
+
+/*
+** Events.
+** __GLX_NUMBER_EVENTS is set to 17 to account for the BufferClobberSGIX
+** event - this helps initialization if the server supports the pbuffer
+** extension and the client doesn't.
+*/
+#define GLX_PbufferClobber 0
+#define GLX_BufferSwapComplete 1
+
+#define __GLX_NUMBER_EVENTS 17
+
+extern XVisualInfo* glXChooseVisual( Display *dpy, int screen,
+ int *attribList );
+
+extern GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis,
+ GLXContext shareList, Bool direct );
+
+extern void glXDestroyContext( Display *dpy, GLXContext ctx );
+
+extern Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable,
+ GLXContext ctx);
+
+extern void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
+ unsigned long mask );
+
+extern void glXSwapBuffers( Display *dpy, GLXDrawable drawable );
+
+extern GLXPixmap glXCreateGLXPixmap( Display *dpy, XVisualInfo *visual,
+ Pixmap pixmap );
+
+extern void glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap );
+
+extern Bool glXQueryExtension( Display *dpy, int *errorb, int *event );
+
+extern Bool glXQueryVersion( Display *dpy, int *maj, int *min );
+
+extern Bool glXIsDirect( Display *dpy, GLXContext ctx );
+
+extern int glXGetConfig( Display *dpy, XVisualInfo *visual,
+ int attrib, int *value );
+
+extern GLXContext glXGetCurrentContext( void );
+
+extern GLXDrawable glXGetCurrentDrawable( void );
+
+extern void glXWaitGL( void );
+
+extern void glXWaitX( void );
+
+extern void glXUseXFont( Font font, int first, int count, int list );
+
+
+
+/* GLX 1.1 and later */
+extern const char *glXQueryExtensionsString( Display *dpy, int screen );
+
+extern const char *glXQueryServerString( Display *dpy, int screen, int name );
+
+extern const char *glXGetClientString( Display *dpy, int name );
+
+
+/* GLX 1.2 and later */
+extern Display *glXGetCurrentDisplay( void );
+
+
+/* GLX 1.3 and later */
+extern GLXFBConfig *glXChooseFBConfig( Display *dpy, int screen,
+ const int *attribList, int *nitems );
+
+extern int glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config,
+ int attribute, int *value );
+
+extern GLXFBConfig *glXGetFBConfigs( Display *dpy, int screen,
+ int *nelements );
+
+extern XVisualInfo *glXGetVisualFromFBConfig( Display *dpy,
+ GLXFBConfig config );
+
+extern GLXWindow glXCreateWindow( Display *dpy, GLXFBConfig config,
+ Window win, const int *attribList );
+
+extern void glXDestroyWindow( Display *dpy, GLXWindow window );
+
+extern GLXPixmap glXCreatePixmap( Display *dpy, GLXFBConfig config,
+ Pixmap pixmap, const int *attribList );
+
+extern void glXDestroyPixmap( Display *dpy, GLXPixmap pixmap );
+
+extern GLXPbuffer glXCreatePbuffer( Display *dpy, GLXFBConfig config,
+ const int *attribList );
+
+extern void glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf );
+
+extern void glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute,
+ unsigned int *value );
+
+extern GLXContext glXCreateNewContext( Display *dpy, GLXFBConfig config,
+ int renderType, GLXContext shareList,
+ Bool direct );
+
+extern Bool glXMakeContextCurrent( Display *dpy, GLXDrawable draw,
+ GLXDrawable read, GLXContext ctx );
+
+extern GLXDrawable glXGetCurrentReadDrawable( void );
+
+extern int glXQueryContext( Display *dpy, GLXContext ctx, int attribute,
+ int *value );
+
+extern void glXSelectEvent( Display *dpy, GLXDrawable drawable,
+ unsigned long mask );
+
+extern void glXGetSelectedEvent( Display *dpy, GLXDrawable drawable,
+ unsigned long *mask );
+
+/* GLX 1.3 function pointer typedefs */
+typedef GLXFBConfig * (* PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements);
+typedef GLXFBConfig * (* PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);
+typedef int (* PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value);
+typedef XVisualInfo * (* PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config);
+typedef GLXWindow (* PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
+typedef void (* PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win);
+typedef GLXPixmap (* PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
+typedef void (* PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap);
+typedef GLXPbuffer (* PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list);
+typedef void (* PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf);
+typedef void (* PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
+typedef GLXContext (* PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
+typedef Bool (* PFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
+typedef GLXDrawable (* PFNGLXGETCURRENTREADDRAWABLEPROC) (void);
+typedef Display * (* PFNGLXGETCURRENTDISPLAYPROC) (void);
+typedef int (* PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value);
+typedef void (* PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask);
+typedef void (* PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask);
+
+
+/*
+ * ARB 2. GLX_ARB_get_proc_address
+ */
+#ifndef GLX_ARB_get_proc_address
+#define GLX_ARB_get_proc_address 1
+
+typedef void (*__GLXextFuncPtr)(void);
+extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *);
+
+#endif /* GLX_ARB_get_proc_address */
+
+
+
+/* GLX 1.4 and later */
+extern void (*glXGetProcAddress(const GLubyte *procname))( void );
+
+/* GLX 1.4 function pointer typedefs */
+typedef __GLXextFuncPtr (* PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName);
+
+
+#ifndef GLX_GLXEXT_LEGACY
+
+#include <GL/glxext.h>
+
+#endif /* GLX_GLXEXT_LEGACY */
+
+
+/**
+ ** The following aren't in glxext.h yet.
+ **/
+
+
+/*
+ * ???. GLX_NV_vertex_array_range
+ */
+#ifndef GLX_NV_vertex_array_range
+#define GLX_NV_vertex_array_range
+
+extern void *glXAllocateMemoryNV(GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
+extern void glXFreeMemoryNV(GLvoid *pointer);
+typedef void * ( * PFNGLXALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
+typedef void ( * PFNGLXFREEMEMORYNVPROC) (GLvoid *pointer);
+
+#endif /* GLX_NV_vertex_array_range */
+
+
+/*
+ * ARB ?. GLX_ARB_render_texture
+ * XXX This was never finalized!
+ */
+#ifndef GLX_ARB_render_texture
+#define GLX_ARB_render_texture 1
+
+extern Bool glXBindTexImageARB(Display *dpy, GLXPbuffer pbuffer, int buffer);
+extern Bool glXReleaseTexImageARB(Display *dpy, GLXPbuffer pbuffer, int buffer);
+extern Bool glXDrawableAttribARB(Display *dpy, GLXDrawable draw, const int *attribList);
+
+#endif /* GLX_ARB_render_texture */
+
+
+/*
+ * Remove this when glxext.h is updated.
+ */
+#ifndef GLX_NV_float_buffer
+#define GLX_NV_float_buffer 1
+
+#define GLX_FLOAT_COMPONENTS_NV 0x20B0
+
+#endif /* GLX_NV_float_buffer */
+
+
+
+/*
+ * #?. GLX_MESA_swap_frame_usage
+ */
+#ifndef GLX_MESA_swap_frame_usage
+#define GLX_MESA_swap_frame_usage 1
+
+extern int glXGetFrameUsageMESA(Display *dpy, GLXDrawable drawable, float *usage);
+extern int glXBeginFrameTrackingMESA(Display *dpy, GLXDrawable drawable);
+extern int glXEndFrameTrackingMESA(Display *dpy, GLXDrawable drawable);
+extern int glXQueryFrameTrackingMESA(Display *dpy, GLXDrawable drawable, int64_t *swapCount, int64_t *missedFrames, float *lastMissedUsage);
+
+typedef int (*PFNGLXGETFRAMEUSAGEMESAPROC) (Display *dpy, GLXDrawable drawable, float *usage);
+typedef int (*PFNGLXBEGINFRAMETRACKINGMESAPROC)(Display *dpy, GLXDrawable drawable);
+typedef int (*PFNGLXENDFRAMETRACKINGMESAPROC)(Display *dpy, GLXDrawable drawable);
+typedef int (*PFNGLXQUERYFRAMETRACKINGMESAPROC)(Display *dpy, GLXDrawable drawable, int64_t *swapCount, int64_t *missedFrames, float *lastMissedUsage);
+
+#endif /* GLX_MESA_swap_frame_usage */
+
+
+
+/*
+ * #?. GLX_MESA_swap_control
+ */
+#ifndef GLX_MESA_swap_control
+#define GLX_MESA_swap_control 1
+
+extern int glXSwapIntervalMESA(unsigned int interval);
+extern int glXGetSwapIntervalMESA(void);
+
+typedef int (*PFNGLXSWAPINTERVALMESAPROC)(unsigned int interval);
+typedef int (*PFNGLXGETSWAPINTERVALMESAPROC)(void);
+
+#endif /* GLX_MESA_swap_control */
+
+
+
+/*
+ * #?. 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
+
+extern void glXBindTexImageEXT(Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list);
+extern void glXReleaseTexImageEXT(Display *dpy, GLXDrawable drawable, int buffer);
+
+#endif /* GLX_EXT_texture_from_pixmap */
+
+
+
+
+/*** Should these go here, or in another header? */
+/*
+** GLX Events
+*/
+typedef struct {
+ int event_type; /* GLX_DAMAGED or GLX_SAVED */
+ int draw_type; /* GLX_WINDOW or GLX_PBUFFER */
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came for SendEvent request */
+ Display *display; /* display the event was read from */
+ GLXDrawable drawable; /* XID of Drawable */
+ unsigned int buffer_mask; /* mask indicating which buffers are affected */
+ unsigned int aux_buffer; /* which aux buffer was affected */
+ int x, y;
+ int width, height;
+ int count; /* if nonzero, at least this many more */
+} GLXPbufferClobberEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came from a SendEvent request */
+ Display *display; /* Display the event was read from */
+ GLXDrawable drawable; /* drawable on which event was requested in event mask */
+ int event_type;
+ int64_t ust;
+ int64_t msc;
+ int64_t sbc;
+} GLXBufferSwapComplete;
+
+typedef union __GLXEvent {
+ GLXPbufferClobberEvent glxpbufferclobber;
+ GLXBufferSwapComplete glxbufferswapcomplete;
+ long pad[24];
+} GLXEvent;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.5
+ *
+ * Copyright (C) 1999-2006 Brian Paul 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 and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef GLX_MANGLE_H
+#define GLX_MANGLE_H
+
+#define glXChooseVisual mglXChooseVisual
+#define glXCreateContext mglXCreateContext
+#define glXDestroyContext mglXDestroyContext
+#define glXMakeCurrent mglXMakeCurrent
+#define glXCopyContext mglXCopyContext
+#define glXSwapBuffers mglXSwapBuffers
+#define glXCreateGLXPixmap mglXCreateGLXPixmap
+#define glXDestroyGLXPixmap mglXDestroyGLXPixmap
+#define glXQueryExtension mglXQueryExtension
+#define glXQueryVersion mglXQueryVersion
+#define glXIsDirect mglXIsDirect
+#define glXGetConfig mglXGetConfig
+#define glXGetCurrentContext mglXGetCurrentContext
+#define glXGetCurrentDrawable mglXGetCurrentDrawable
+#define glXWaitGL mglXWaitGL
+#define glXWaitX mglXWaitX
+#define glXUseXFont mglXUseXFont
+#define glXQueryExtensionsString mglXQueryExtensionsString
+#define glXQueryServerString mglXQueryServerString
+#define glXGetClientString mglXGetClientString
+#define glXCreateGLXPixmapMESA mglXCreateGLXPixmapMESA
+#define glXReleaseBuffersMESA mglXReleaseBuffersMESA
+#define glXCopySubBufferMESA mglXCopySubBufferMESA
+#define glXGetVideoSyncSGI mglXGetVideoSyncSGI
+#define glXWaitVideoSyncSGI mglXWaitVideoSyncSGI
+
+/* GLX 1.2 */
+#define glXGetCurrentDisplay mglXGetCurrentDisplay
+
+/* GLX 1.3 */
+#define glXChooseFBConfig mglXChooseFBConfig
+#define glXGetFBConfigAttrib mglXGetFBConfigAttrib
+#define glXGetFBConfigs mglXGetFBConfigs
+#define glXGetVisualFromFBConfig mglXGetVisualFromFBConfig
+#define glXCreateWindow mglXCreateWindow
+#define glXDestroyWindow mglXDestroyWindow
+#define glXCreatePixmap mglXCreatePixmap
+#define glXDestroyPixmap mglXDestroyPixmap
+#define glXCreatePbuffer mglXCreatePbuffer
+#define glXDestroyPbuffer mglXDestroyPbuffer
+#define glXQueryDrawable mglXQueryDrawable
+#define glXCreateNewContext mglXCreateNewContext
+#define glXMakeContextCurrent mglXMakeContextCurrent
+#define glXGetCurrentReadDrawable mglXGetCurrentReadDrawable
+#define glXQueryContext mglXQueryContext
+#define glXSelectEvent mglXSelectEvent
+#define glXGetSelectedEvent mglXGetSelectedEvent
+
+/* GLX 1.4 */
+#define glXGetProcAddress mglXGetProcAddress
+#define glXGetProcAddressARB mglXGetProcAddressARB
+
+
+#endif
--- /dev/null
+#ifndef __glxext_h_
+#define __glxext_h_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2007-2010 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.
+*/
+
+/* Function declaration macros - to move into glplatform.h */
+
+#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
+#define WIN32_LEAN_AND_MEAN 1
+#include <windows.h>
+#endif
+
+#ifndef APIENTRY
+#define APIENTRY
+#endif
+#ifndef APIENTRYP
+#define APIENTRYP APIENTRY *
+#endif
+#ifndef GLAPI
+#define GLAPI extern
+#endif
+
+/*************************************************************/
+
+/* Header file version number, required by OpenGL ABI for Linux */
+/* glxext.h last updated 2010/08/06 */
+/* Current version at http://www.opengl.org/registry/ */
+#define GLX_GLXEXT_VERSION 32
+
+#ifndef GLX_VERSION_1_3
+#define GLX_WINDOW_BIT 0x00000001
+#define GLX_PIXMAP_BIT 0x00000002
+#define GLX_PBUFFER_BIT 0x00000004
+#define GLX_RGBA_BIT 0x00000001
+#define GLX_COLOR_INDEX_BIT 0x00000002
+#define GLX_PBUFFER_CLOBBER_MASK 0x08000000
+#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_AUX_BUFFERS_BIT 0x00000010
+#define GLX_DEPTH_BUFFER_BIT 0x00000020
+#define GLX_STENCIL_BUFFER_BIT 0x00000040
+#define GLX_ACCUM_BUFFER_BIT 0x00000080
+#define GLX_CONFIG_CAVEAT 0x20
+#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_DONT_CARE 0xFFFFFFFF
+#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
+#endif
+
+#ifndef GLX_VERSION_1_4
+#define GLX_SAMPLE_BUFFERS 100000
+#define GLX_SAMPLES 100001
+#endif
+
+#ifndef GLX_ARB_get_proc_address
+#endif
+
+#ifndef GLX_ARB_multisample
+#define GLX_SAMPLE_BUFFERS_ARB 100000
+#define GLX_SAMPLES_ARB 100001
+#endif
+
+#ifndef GLX_ARB_vertex_buffer_object
+#define GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB 0x2095
+#endif
+
+#ifndef GLX_ARB_fbconfig_float
+#define GLX_RGBA_FLOAT_TYPE_ARB 0x20B9
+#define GLX_RGBA_FLOAT_BIT_ARB 0x00000004
+#endif
+
+#ifndef GLX_ARB_framebuffer_sRGB
+#define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20B2
+#endif
+
+#ifndef GLX_ARB_create_context
+#define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001
+#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
+#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
+#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
+#define GLX_CONTEXT_FLAGS_ARB 0x2094
+#endif
+
+#ifndef GLX_ARB_create_context_profile
+#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
+#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
+#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126
+#endif
+
+#ifndef GLX_ARB_create_context_robustness
+#define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
+#define GLX_LOSE_CONTEXT_ON_RESET_ARB 0x8252
+#define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
+#define GLX_NO_RESET_NOTIFICATION_ARB 0x8261
+#endif
+
+#ifndef GLX_SGIS_multisample
+#define GLX_SAMPLE_BUFFERS_SGIS 100000
+#define GLX_SAMPLES_SGIS 100001
+#endif
+
+#ifndef GLX_EXT_visual_info
+#define GLX_X_VISUAL_TYPE_EXT 0x22
+#define GLX_TRANSPARENT_TYPE_EXT 0x23
+#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24
+#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25
+#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26
+#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27
+#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28
+#define GLX_NONE_EXT 0x8000
+#define GLX_TRUE_COLOR_EXT 0x8002
+#define GLX_DIRECT_COLOR_EXT 0x8003
+#define GLX_PSEUDO_COLOR_EXT 0x8004
+#define GLX_STATIC_COLOR_EXT 0x8005
+#define GLX_GRAY_SCALE_EXT 0x8006
+#define GLX_STATIC_GRAY_EXT 0x8007
+#define GLX_TRANSPARENT_RGB_EXT 0x8008
+#define GLX_TRANSPARENT_INDEX_EXT 0x8009
+#endif
+
+#ifndef GLX_SGI_swap_control
+#endif
+
+#ifndef GLX_SGI_video_sync
+#endif
+
+#ifndef GLX_SGI_make_current_read
+#endif
+
+#ifndef GLX_SGIX_video_source
+#endif
+
+#ifndef GLX_EXT_visual_rating
+#define GLX_VISUAL_CAVEAT_EXT 0x20
+#define GLX_SLOW_VISUAL_EXT 0x8001
+#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D
+/* reuse GLX_NONE_EXT */
+#endif
+
+#ifndef GLX_EXT_import_context
+#define GLX_SHARE_CONTEXT_EXT 0x800A
+#define GLX_VISUAL_ID_EXT 0x800B
+#define GLX_SCREEN_EXT 0x800C
+#endif
+
+#ifndef GLX_SGIX_fbconfig
+#define GLX_WINDOW_BIT_SGIX 0x00000001
+#define GLX_PIXMAP_BIT_SGIX 0x00000002
+#define GLX_RGBA_BIT_SGIX 0x00000001
+#define GLX_COLOR_INDEX_BIT_SGIX 0x00000002
+#define GLX_DRAWABLE_TYPE_SGIX 0x8010
+#define GLX_RENDER_TYPE_SGIX 0x8011
+#define GLX_X_RENDERABLE_SGIX 0x8012
+#define GLX_FBCONFIG_ID_SGIX 0x8013
+#define GLX_RGBA_TYPE_SGIX 0x8014
+#define GLX_COLOR_INDEX_TYPE_SGIX 0x8015
+/* reuse GLX_SCREEN_EXT */
+#endif
+
+#ifndef GLX_SGIX_pbuffer
+#define GLX_PBUFFER_BIT_SGIX 0x00000004
+#define GLX_BUFFER_CLOBBER_MASK_SGIX 0x08000000
+#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX 0x00000001
+#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX 0x00000002
+#define GLX_BACK_LEFT_BUFFER_BIT_SGIX 0x00000004
+#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX 0x00000008
+#define GLX_AUX_BUFFERS_BIT_SGIX 0x00000010
+#define GLX_DEPTH_BUFFER_BIT_SGIX 0x00000020
+#define GLX_STENCIL_BUFFER_BIT_SGIX 0x00000040
+#define GLX_ACCUM_BUFFER_BIT_SGIX 0x00000080
+#define GLX_SAMPLE_BUFFERS_BIT_SGIX 0x00000100
+#define GLX_MAX_PBUFFER_WIDTH_SGIX 0x8016
+#define GLX_MAX_PBUFFER_HEIGHT_SGIX 0x8017
+#define GLX_MAX_PBUFFER_PIXELS_SGIX 0x8018
+#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019
+#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A
+#define GLX_PRESERVED_CONTENTS_SGIX 0x801B
+#define GLX_LARGEST_PBUFFER_SGIX 0x801C
+#define GLX_WIDTH_SGIX 0x801D
+#define GLX_HEIGHT_SGIX 0x801E
+#define GLX_EVENT_MASK_SGIX 0x801F
+#define GLX_DAMAGED_SGIX 0x8020
+#define GLX_SAVED_SGIX 0x8021
+#define GLX_WINDOW_SGIX 0x8022
+#define GLX_PBUFFER_SGIX 0x8023
+#endif
+
+#ifndef GLX_SGI_cushion
+#endif
+
+#ifndef GLX_SGIX_video_resize
+#define GLX_SYNC_FRAME_SGIX 0x00000000
+#define GLX_SYNC_SWAP_SGIX 0x00000001
+#endif
+
+#ifndef GLX_SGIX_dmbuffer
+#define GLX_DIGITAL_MEDIA_PBUFFER_SGIX 0x8024
+#endif
+
+#ifndef GLX_SGIX_swap_group
+#endif
+
+#ifndef GLX_SGIX_swap_barrier
+#endif
+
+#ifndef GLX_SGIS_blended_overlay
+#define GLX_BLENDED_RGBA_SGIS 0x8025
+#endif
+
+#ifndef GLX_SGIS_shared_multisample
+#define GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS 0x8026
+#define GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS 0x8027
+#endif
+
+#ifndef GLX_SUN_get_transparent_index
+#endif
+
+#ifndef GLX_3DFX_multisample
+#define GLX_SAMPLE_BUFFERS_3DFX 0x8050
+#define GLX_SAMPLES_3DFX 0x8051
+#endif
+
+#ifndef GLX_MESA_copy_sub_buffer
+#endif
+
+#ifndef GLX_MESA_pixmap_colormap
+#endif
+
+#ifndef GLX_MESA_release_buffers
+#endif
+
+#ifndef GLX_MESA_set_3dfx_mode
+#define GLX_3DFX_WINDOW_MODE_MESA 0x1
+#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2
+#endif
+
+#ifndef GLX_SGIX_visual_select_group
+#define GLX_VISUAL_SELECT_GROUP_SGIX 0x8028
+#endif
+
+#ifndef GLX_OML_swap_method
+#define GLX_SWAP_METHOD_OML 0x8060
+#define GLX_SWAP_EXCHANGE_OML 0x8061
+#define GLX_SWAP_COPY_OML 0x8062
+#define GLX_SWAP_UNDEFINED_OML 0x8063
+#endif
+
+#ifndef GLX_OML_sync_control
+#endif
+
+#ifndef GLX_NV_float_buffer
+#define GLX_FLOAT_COMPONENTS_NV 0x20B0
+#endif
+
+#ifndef GLX_SGIX_hyperpipe
+#define GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX 80
+#define GLX_BAD_HYPERPIPE_CONFIG_SGIX 91
+#define GLX_BAD_HYPERPIPE_SGIX 92
+#define GLX_HYPERPIPE_DISPLAY_PIPE_SGIX 0x00000001
+#define GLX_HYPERPIPE_RENDER_PIPE_SGIX 0x00000002
+#define GLX_PIPE_RECT_SGIX 0x00000001
+#define GLX_PIPE_RECT_LIMITS_SGIX 0x00000002
+#define GLX_HYPERPIPE_STEREO_SGIX 0x00000003
+#define GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX 0x00000004
+#define GLX_HYPERPIPE_ID_SGIX 0x8030
+#endif
+
+#ifndef GLX_MESA_agp_offset
+#endif
+
+#ifndef GLX_EXT_fbconfig_packed_float
+#define GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT 0x20B1
+#define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT 0x00000008
+#endif
+
+#ifndef GLX_EXT_framebuffer_sRGB
+#define GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20B2
+#endif
+
+#ifndef GLX_EXT_texture_from_pixmap
+#define GLX_TEXTURE_1D_BIT_EXT 0x00000001
+#define GLX_TEXTURE_2D_BIT_EXT 0x00000002
+#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004
+#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_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
+
+#ifndef GLX_NV_present_video
+#define GLX_NUM_VIDEO_SLOTS_NV 0x20F0
+#endif
+
+#ifndef GLX_NV_video_out
+#define GLX_VIDEO_OUT_COLOR_NV 0x20C3
+#define GLX_VIDEO_OUT_ALPHA_NV 0x20C4
+#define GLX_VIDEO_OUT_DEPTH_NV 0x20C5
+#define GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6
+#define GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7
+#define GLX_VIDEO_OUT_FRAME_NV 0x20C8
+#define GLX_VIDEO_OUT_FIELD_1_NV 0x20C9
+#define GLX_VIDEO_OUT_FIELD_2_NV 0x20CA
+#define GLX_VIDEO_OUT_STACKED_FIELDS_1_2_NV 0x20CB
+#define GLX_VIDEO_OUT_STACKED_FIELDS_2_1_NV 0x20CC
+#endif
+
+#ifndef GLX_NV_swap_group
+#endif
+
+#ifndef GLX_NV_video_capture
+#define GLX_DEVICE_ID_NV 0x20CD
+#define GLX_UNIQUE_ID_NV 0x20CE
+#define GLX_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF
+#endif
+
+#ifndef GLX_EXT_swap_control
+#define GLX_SWAP_INTERVAL_EXT 0x20F1
+#define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2
+#endif
+
+#ifndef GLX_NV_copy_image
+#endif
+
+#ifndef GLX_INTEL_swap_event
+#define GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK 0x04000000
+#define GLX_EXCHANGE_COMPLETE_INTEL 0x8180
+#define GLX_COPY_COMPLETE_INTEL 0x8181
+#define GLX_FLIP_COMPLETE_INTEL 0x8182
+#endif
+
+#ifndef GLX_NV_multisample_coverage
+#define GLX_COVERAGE_SAMPLES_NV 100001
+#define GLX_COLOR_SAMPLES_NV 0x20B3
+#endif
+
+#ifndef GLX_AMD_gpu_association
+#define GLX_GPU_VENDOR_AMD 0x1F00
+#define GLX_GPU_RENDERER_STRING_AMD 0x1F01
+#define GLX_GPU_OPENGL_VERSION_STRING_AMD 0x1F02
+#define GLX_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2
+#define GLX_GPU_RAM_AMD 0x21A3
+#define GLX_GPU_CLOCK_AMD 0x21A4
+#define GLX_GPU_NUM_PIPES_AMD 0x21A5
+#define GLX_GPU_NUM_SIMD_AMD 0x21A6
+#define GLX_GPU_NUM_RB_AMD 0x21A7
+#define GLX_GPU_NUM_SPI_AMD 0x21A8
+#endif
+
+#ifndef GLX_EXT_create_context_es2_profile
+#define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
+#endif
+
+
+/*************************************************************/
+
+#ifndef GLX_ARB_get_proc_address
+typedef void (*__GLXextFuncPtr)(void);
+#endif
+
+#ifndef GLX_SGIX_video_source
+typedef XID GLXVideoSourceSGIX;
+#endif
+
+#ifndef GLX_SGIX_fbconfig
+typedef XID GLXFBConfigIDSGIX;
+typedef struct __GLXFBConfigRec *GLXFBConfigSGIX;
+#endif
+
+#ifndef GLX_SGIX_pbuffer
+typedef XID GLXPbufferSGIX;
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ Bool send_event; /* true if this came for SendEvent request */
+ Display *display; /* display the event was read from */
+ GLXDrawable drawable; /* i.d. of Drawable */
+ int event_type; /* GLX_DAMAGED_SGIX or GLX_SAVED_SGIX */
+ int draw_type; /* GLX_WINDOW_SGIX or GLX_PBUFFER_SGIX */
+ unsigned int mask; /* mask indicating which buffers are affected*/
+ int x, y;
+ int width, height;
+ int count; /* if nonzero, at least this many more */
+} GLXBufferClobberEventSGIX;
+#endif
+
+#ifndef GLX_NV_video_output
+typedef unsigned int GLXVideoDeviceNV;
+#endif
+
+#ifndef GLX_NV_video_capture
+typedef XID GLXVideoCaptureDeviceNV;
+#endif
+
+#ifndef GLEXT_64_TYPES_DEFINED
+/* This code block is duplicated in glext.h, so must be protected */
+#define GLEXT_64_TYPES_DEFINED
+/* Define int32_t, int64_t, and uint64_t types for UST/MSC */
+/* (as used in the GLX_OML_sync_control extension). */
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#include <inttypes.h>
+#elif defined(__sun__) || defined(__digital__)
+#include <inttypes.h>
+#if defined(__STDC__)
+#if defined(__arch64__) || defined(_LP64)
+typedef long int int64_t;
+typedef unsigned long int uint64_t;
+#else
+typedef long long int int64_t;
+typedef unsigned long long int uint64_t;
+#endif /* __arch64__ */
+#endif /* __STDC__ */
+#elif defined( __VMS ) || defined(__sgi)
+#include <inttypes.h>
+#elif defined(__SCO__) || defined(__USLC__)
+#include <stdint.h>
+#elif defined(__UNIXOS2__) || defined(__SOL64__)
+typedef long int int32_t;
+typedef long long int int64_t;
+typedef unsigned long long int uint64_t;
+#elif defined(_WIN32) && defined(__GNUC__)
+#include <stdint.h>
+#elif defined(_WIN32)
+typedef __int32 int32_t;
+typedef __int64 int64_t;
+typedef unsigned __int64 uint64_t;
+#else
+#include <inttypes.h> /* Fallback option */
+#endif
+#endif
+
+#ifndef GLX_VERSION_1_3
+#define GLX_VERSION_1_3 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern GLXFBConfig * glXGetFBConfigs (Display *dpy, int screen, int *nelements);
+extern GLXFBConfig * glXChooseFBConfig (Display *dpy, int screen, const int *attrib_list, int *nelements);
+extern int glXGetFBConfigAttrib (Display *dpy, GLXFBConfig config, int attribute, int *value);
+extern XVisualInfo * glXGetVisualFromFBConfig (Display *dpy, GLXFBConfig config);
+extern GLXWindow glXCreateWindow (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
+extern void glXDestroyWindow (Display *dpy, GLXWindow win);
+extern GLXPixmap glXCreatePixmap (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
+extern void glXDestroyPixmap (Display *dpy, GLXPixmap pixmap);
+extern GLXPbuffer glXCreatePbuffer (Display *dpy, GLXFBConfig config, const int *attrib_list);
+extern void glXDestroyPbuffer (Display *dpy, GLXPbuffer pbuf);
+extern void glXQueryDrawable (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
+extern GLXContext glXCreateNewContext (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
+extern Bool glXMakeContextCurrent (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
+extern GLXDrawable glXGetCurrentReadDrawable (void);
+extern Display * glXGetCurrentDisplay (void);
+extern int glXQueryContext (Display *dpy, GLXContext ctx, int attribute, int *value);
+extern void glXSelectEvent (Display *dpy, GLXDrawable draw, unsigned long event_mask);
+extern void glXGetSelectedEvent (Display *dpy, GLXDrawable draw, unsigned long *event_mask);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef GLXFBConfig * ( * PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements);
+typedef GLXFBConfig * ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);
+typedef int ( * PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value);
+typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config);
+typedef GLXWindow ( * PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
+typedef void ( * PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win);
+typedef GLXPixmap ( * PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
+typedef void ( * PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap);
+typedef GLXPbuffer ( * PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list);
+typedef void ( * PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf);
+typedef void ( * PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
+typedef GLXContext ( * PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
+typedef Bool ( * PFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
+typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLEPROC) (void);
+typedef Display * ( * PFNGLXGETCURRENTDISPLAYPROC) (void);
+typedef int ( * PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value);
+typedef void ( * PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask);
+typedef void ( * PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask);
+#endif
+
+#ifndef GLX_VERSION_1_4
+#define GLX_VERSION_1_4 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern __GLXextFuncPtr glXGetProcAddress (const GLubyte *procName);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName);
+#endif
+
+#ifndef GLX_ARB_get_proc_address
+#define GLX_ARB_get_proc_address 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *procName);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procName);
+#endif
+
+#ifndef GLX_ARB_multisample
+#define GLX_ARB_multisample 1
+#endif
+
+#ifndef GLX_ARB_fbconfig_float
+#define GLX_ARB_fbconfig_float 1
+#endif
+
+#ifndef GLX_ARB_framebuffer_sRGB
+#define GLX_ARB_framebuffer_sRGB 1
+#endif
+
+#ifndef GLX_ARB_create_context
+#define GLX_ARB_create_context 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern GLXContext glXCreateContextAttribsARB (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef GLXContext ( * PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
+#endif
+
+#ifndef GLX_ARB_create_context_profile
+#define GLX_ARB_create_context_profile 1
+#endif
+
+#ifndef GLX_ARB_create_context_robustness
+#define GLX_ARB_create_context_robustness 1
+#endif
+
+#ifndef GLX_SGIS_multisample
+#define GLX_SGIS_multisample 1
+#endif
+
+#ifndef GLX_EXT_visual_info
+#define GLX_EXT_visual_info 1
+#endif
+
+#ifndef GLX_SGI_swap_control
+#define GLX_SGI_swap_control 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern int glXSwapIntervalSGI (int interval);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval);
+#endif
+
+#ifndef GLX_SGI_video_sync
+#define GLX_SGI_video_sync 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern int glXGetVideoSyncSGI (unsigned int *count);
+extern int glXWaitVideoSyncSGI (int divisor, int remainder, unsigned int *count);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef int ( * PFNGLXGETVIDEOSYNCSGIPROC) (unsigned int *count);
+typedef int ( * PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigned int *count);
+#endif
+
+#ifndef GLX_SGI_make_current_read
+#define GLX_SGI_make_current_read 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern Bool glXMakeCurrentReadSGI (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
+extern GLXDrawable glXGetCurrentReadDrawableSGI (void);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef Bool ( * PFNGLXMAKECURRENTREADSGIPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
+typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLESGIPROC) (void);
+#endif
+
+#ifndef GLX_SGIX_video_source
+#define GLX_SGIX_video_source 1
+#ifdef _VL_H
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern GLXVideoSourceSGIX glXCreateGLXVideoSourceSGIX (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode);
+extern void glXDestroyGLXVideoSourceSGIX (Display *dpy, GLXVideoSourceSGIX glxvideosource);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef GLXVideoSourceSGIX ( * PFNGLXCREATEGLXVIDEOSOURCESGIXPROC) (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode);
+typedef void ( * PFNGLXDESTROYGLXVIDEOSOURCESGIXPROC) (Display *dpy, GLXVideoSourceSGIX glxvideosource);
+#endif /* _VL_H */
+#endif
+
+#ifndef GLX_EXT_visual_rating
+#define GLX_EXT_visual_rating 1
+#endif
+
+#ifndef GLX_EXT_import_context
+#define GLX_EXT_import_context 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern Display * glXGetCurrentDisplayEXT (void);
+extern int glXQueryContextInfoEXT (Display *dpy, GLXContext context, int attribute, int *value);
+extern GLXContextID glXGetContextIDEXT (const GLXContext context);
+extern GLXContext glXImportContextEXT (Display *dpy, GLXContextID contextID);
+extern void glXFreeContextEXT (Display *dpy, GLXContext context);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef Display * ( * PFNGLXGETCURRENTDISPLAYEXTPROC) (void);
+typedef int ( * PFNGLXQUERYCONTEXTINFOEXTPROC) (Display *dpy, GLXContext context, int attribute, int *value);
+typedef GLXContextID ( * PFNGLXGETCONTEXTIDEXTPROC) (const GLXContext context);
+typedef GLXContext ( * PFNGLXIMPORTCONTEXTEXTPROC) (Display *dpy, GLXContextID contextID);
+typedef void ( * PFNGLXFREECONTEXTEXTPROC) (Display *dpy, GLXContext context);
+#endif
+
+#ifndef GLX_SGIX_fbconfig
+#define GLX_SGIX_fbconfig 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern int glXGetFBConfigAttribSGIX (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value);
+extern GLXFBConfigSGIX * glXChooseFBConfigSGIX (Display *dpy, int screen, int *attrib_list, int *nelements);
+extern GLXPixmap glXCreateGLXPixmapWithConfigSGIX (Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap);
+extern GLXContext glXCreateContextWithConfigSGIX (Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct);
+extern XVisualInfo * glXGetVisualFromFBConfigSGIX (Display *dpy, GLXFBConfigSGIX config);
+extern GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX (Display *dpy, XVisualInfo *vis);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef int ( * PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value);
+typedef GLXFBConfigSGIX * ( * PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, int *attrib_list, int *nelements);
+typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap);
+typedef GLXContext ( * PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct);
+typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config);
+typedef GLXFBConfigSGIX ( * PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display *dpy, XVisualInfo *vis);
+#endif
+
+#ifndef GLX_SGIX_pbuffer
+#define GLX_SGIX_pbuffer 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern GLXPbufferSGIX glXCreateGLXPbufferSGIX (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list);
+extern void glXDestroyGLXPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuf);
+extern int glXQueryGLXPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value);
+extern void glXSelectEventSGIX (Display *dpy, GLXDrawable drawable, unsigned long mask);
+extern void glXGetSelectedEventSGIX (Display *dpy, GLXDrawable drawable, unsigned long *mask);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef GLXPbufferSGIX ( * PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list);
+typedef void ( * PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf);
+typedef int ( * PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value);
+typedef void ( * PFNGLXSELECTEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long mask);
+typedef void ( * PFNGLXGETSELECTEDEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long *mask);
+#endif
+
+#ifndef GLX_SGI_cushion
+#define GLX_SGI_cushion 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern void glXCushionSGI (Display *dpy, Window window, float cushion);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef void ( * PFNGLXCUSHIONSGIPROC) (Display *dpy, Window window, float cushion);
+#endif
+
+#ifndef GLX_SGIX_video_resize
+#define GLX_SGIX_video_resize 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern int glXBindChannelToWindowSGIX (Display *display, int screen, int channel, Window window);
+extern int glXChannelRectSGIX (Display *display, int screen, int channel, int x, int y, int w, int h);
+extern int glXQueryChannelRectSGIX (Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh);
+extern int glXQueryChannelDeltasSGIX (Display *display, int screen, int channel, int *x, int *y, int *w, int *h);
+extern int glXChannelRectSyncSGIX (Display *display, int screen, int channel, GLenum synctype);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef int ( * PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display *display, int screen, int channel, Window window);
+typedef int ( * PFNGLXCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int x, int y, int w, int h);
+typedef int ( * PFNGLXQUERYCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh);
+typedef int ( * PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display *display, int screen, int channel, int *x, int *y, int *w, int *h);
+typedef int ( * PFNGLXCHANNELRECTSYNCSGIXPROC) (Display *display, int screen, int channel, GLenum synctype);
+#endif
+
+#ifndef GLX_SGIX_dmbuffer
+#define GLX_SGIX_dmbuffer 1
+#ifdef _DM_BUFFER_H_
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern Bool glXAssociateDMPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef Bool ( * PFNGLXASSOCIATEDMPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer);
+#endif /* _DM_BUFFER_H_ */
+#endif
+
+#ifndef GLX_SGIX_swap_group
+#define GLX_SGIX_swap_group 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern void glXJoinSwapGroupSGIX (Display *dpy, GLXDrawable drawable, GLXDrawable member);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef void ( * PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member);
+#endif
+
+#ifndef GLX_SGIX_swap_barrier
+#define GLX_SGIX_swap_barrier 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern void glXBindSwapBarrierSGIX (Display *dpy, GLXDrawable drawable, int barrier);
+extern Bool glXQueryMaxSwapBarriersSGIX (Display *dpy, int screen, int *max);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef void ( * PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier);
+typedef Bool ( * PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max);
+#endif
+
+#ifndef GLX_SUN_get_transparent_index
+#define GLX_SUN_get_transparent_index 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern Status glXGetTransparentIndexSUN (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef Status ( * PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex);
+#endif
+
+#ifndef GLX_MESA_copy_sub_buffer
+#define GLX_MESA_copy_sub_buffer 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern void glXCopySubBufferMESA (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef void ( * PFNGLXCOPYSUBBUFFERMESAPROC) (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height);
+#endif
+
+#ifndef GLX_MESA_pixmap_colormap
+#define GLX_MESA_pixmap_colormap 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern GLXPixmap glXCreateGLXPixmapMESA (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPMESAPROC) (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap);
+#endif
+
+#ifndef GLX_MESA_release_buffers
+#define GLX_MESA_release_buffers 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern Bool glXReleaseBuffersMESA (Display *dpy, GLXDrawable drawable);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef Bool ( * PFNGLXRELEASEBUFFERSMESAPROC) (Display *dpy, GLXDrawable drawable);
+#endif
+
+#ifndef GLX_MESA_set_3dfx_mode
+#define GLX_MESA_set_3dfx_mode 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern Bool glXSet3DfxModeMESA (int mode);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef Bool ( * PFNGLXSET3DFXMODEMESAPROC) (int mode);
+#endif
+
+#ifndef GLX_SGIX_visual_select_group
+#define GLX_SGIX_visual_select_group 1
+#endif
+
+#ifndef GLX_OML_swap_method
+#define GLX_OML_swap_method 1
+#endif
+
+#ifndef GLX_OML_sync_control
+#define GLX_OML_sync_control 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern Bool glXGetSyncValuesOML (Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc);
+extern Bool glXGetMscRateOML (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator);
+extern int64_t glXSwapBuffersMscOML (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder);
+extern Bool glXWaitForMscOML (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc);
+extern Bool glXWaitForSbcOML (Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef Bool ( * PFNGLXGETSYNCVALUESOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc);
+typedef Bool ( * PFNGLXGETMSCRATEOMLPROC) (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator);
+typedef int64_t ( * PFNGLXSWAPBUFFERSMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder);
+typedef Bool ( * PFNGLXWAITFORMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc);
+typedef Bool ( * PFNGLXWAITFORSBCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc);
+#endif
+
+#ifndef GLX_NV_float_buffer
+#define GLX_NV_float_buffer 1
+#endif
+
+#ifndef GLX_SGIX_hyperpipe
+#define GLX_SGIX_hyperpipe 1
+
+typedef struct {
+ char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX];
+ int networkId;
+} GLXHyperpipeNetworkSGIX;
+
+typedef struct {
+ char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX];
+ int channel;
+ unsigned int
+ participationType;
+ int timeSlice;
+} GLXHyperpipeConfigSGIX;
+
+typedef struct {
+ char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX];
+ int srcXOrigin, srcYOrigin, srcWidth, srcHeight;
+ int destXOrigin, destYOrigin, destWidth, destHeight;
+} GLXPipeRect;
+
+typedef struct {
+ char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX];
+ int XOrigin, YOrigin, maxHeight, maxWidth;
+} GLXPipeRectLimits;
+
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern GLXHyperpipeNetworkSGIX * glXQueryHyperpipeNetworkSGIX (Display *dpy, int *npipes);
+extern int glXHyperpipeConfigSGIX (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId);
+extern GLXHyperpipeConfigSGIX * glXQueryHyperpipeConfigSGIX (Display *dpy, int hpId, int *npipes);
+extern int glXDestroyHyperpipeConfigSGIX (Display *dpy, int hpId);
+extern int glXBindHyperpipeSGIX (Display *dpy, int hpId);
+extern int glXQueryHyperpipeBestAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList);
+extern int glXHyperpipeAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *attribList);
+extern int glXQueryHyperpipeAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef GLXHyperpipeNetworkSGIX * ( * PFNGLXQUERYHYPERPIPENETWORKSGIXPROC) (Display *dpy, int *npipes);
+typedef int ( * PFNGLXHYPERPIPECONFIGSGIXPROC) (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId);
+typedef GLXHyperpipeConfigSGIX * ( * PFNGLXQUERYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId, int *npipes);
+typedef int ( * PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId);
+typedef int ( * PFNGLXBINDHYPERPIPESGIXPROC) (Display *dpy, int hpId);
+typedef int ( * PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList);
+typedef int ( * PFNGLXHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList);
+typedef int ( * PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList);
+#endif
+
+#ifndef GLX_MESA_agp_offset
+#define GLX_MESA_agp_offset 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern unsigned int glXGetAGPOffsetMESA (const void *pointer);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef unsigned int ( * PFNGLXGETAGPOFFSETMESAPROC) (const void *pointer);
+#endif
+
+#ifndef GLX_EXT_fbconfig_packed_float
+#define GLX_EXT_fbconfig_packed_float 1
+#endif
+
+#ifndef GLX_EXT_framebuffer_sRGB
+#define GLX_EXT_framebuffer_sRGB 1
+#endif
+
+#ifndef GLX_EXT_texture_from_pixmap
+#define GLX_EXT_texture_from_pixmap 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern void glXBindTexImageEXT (Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list);
+extern void glXReleaseTexImageEXT (Display *dpy, GLXDrawable drawable, int buffer);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef void ( * PFNGLXBINDTEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list);
+typedef void ( * PFNGLXRELEASETEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawable, int buffer);
+#endif
+
+#ifndef GLX_NV_present_video
+#define GLX_NV_present_video 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern unsigned int * glXEnumerateVideoDevicesNV (Display *dpy, int screen, int *nelements);
+extern int glXBindVideoDeviceNV (Display *dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef unsigned int * ( * PFNGLXENUMERATEVIDEODEVICESNVPROC) (Display *dpy, int screen, int *nelements);
+typedef int ( * PFNGLXBINDVIDEODEVICENVPROC) (Display *dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list);
+#endif
+
+#ifndef GLX_NV_video_output
+#define GLX_NV_video_output 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern int glXGetVideoDeviceNV (Display *dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice);
+extern int glXReleaseVideoDeviceNV (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice);
+extern int glXBindVideoImageNV (Display *dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer);
+extern int glXReleaseVideoImageNV (Display *dpy, GLXPbuffer pbuf);
+extern int glXSendPbufferToVideoNV (Display *dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock);
+extern int glXGetVideoInfoNV (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef int ( * PFNGLXGETVIDEODEVICENVPROC) (Display *dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice);
+typedef int ( * PFNGLXRELEASEVIDEODEVICENVPROC) (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice);
+typedef int ( * PFNGLXBINDVIDEOIMAGENVPROC) (Display *dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer);
+typedef int ( * PFNGLXRELEASEVIDEOIMAGENVPROC) (Display *dpy, GLXPbuffer pbuf);
+typedef int ( * PFNGLXSENDPBUFFERTOVIDEONVPROC) (Display *dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock);
+typedef int ( * PFNGLXGETVIDEOINFONVPROC) (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
+#endif
+
+#ifndef GLX_NV_swap_group
+#define GLX_NV_swap_group 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern Bool glXJoinSwapGroupNV (Display *dpy, GLXDrawable drawable, GLuint group);
+extern Bool glXBindSwapBarrierNV (Display *dpy, GLuint group, GLuint barrier);
+extern Bool glXQuerySwapGroupNV (Display *dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier);
+extern Bool glXQueryMaxSwapGroupsNV (Display *dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers);
+extern Bool glXQueryFrameCountNV (Display *dpy, int screen, GLuint *count);
+extern Bool glXResetFrameCountNV (Display *dpy, int screen);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef Bool ( * PFNGLXJOINSWAPGROUPNVPROC) (Display *dpy, GLXDrawable drawable, GLuint group);
+typedef Bool ( * PFNGLXBINDSWAPBARRIERNVPROC) (Display *dpy, GLuint group, GLuint barrier);
+typedef Bool ( * PFNGLXQUERYSWAPGROUPNVPROC) (Display *dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier);
+typedef Bool ( * PFNGLXQUERYMAXSWAPGROUPSNVPROC) (Display *dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers);
+typedef Bool ( * PFNGLXQUERYFRAMECOUNTNVPROC) (Display *dpy, int screen, GLuint *count);
+typedef Bool ( * PFNGLXRESETFRAMECOUNTNVPROC) (Display *dpy, int screen);
+#endif
+
+#ifndef GLX_NV_video_capture
+#define GLX_NV_video_capture 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern int glXBindVideoCaptureDeviceNV (Display *dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device);
+extern GLXVideoCaptureDeviceNV * glXEnumerateVideoCaptureDevicesNV (Display *dpy, int screen, int *nelements);
+extern void glXLockVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV device);
+extern int glXQueryVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value);
+extern void glXReleaseVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV device);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef int ( * PFNGLXBINDVIDEOCAPTUREDEVICENVPROC) (Display *dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device);
+typedef GLXVideoCaptureDeviceNV * ( * PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC) (Display *dpy, int screen, int *nelements);
+typedef void ( * PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device);
+typedef int ( * PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value);
+typedef void ( * PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device);
+#endif
+
+#ifndef GLX_EXT_swap_control
+#define GLX_EXT_swap_control 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern int glXSwapIntervalEXT (Display *dpy, GLXDrawable drawable, int interval);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef int ( * PFNGLXSWAPINTERVALEXTPROC) (Display *dpy, GLXDrawable drawable, int interval);
+#endif
+
+#ifndef GLX_NV_copy_image
+#define GLX_NV_copy_image 1
+#ifdef GLX_GLXEXT_PROTOTYPES
+extern void glXCopyImageSubDataNV (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef void ( * PFNGLXCOPYIMAGESUBDATANVPROC) (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
+#endif
+
+#ifndef GLX_INTEL_swap_event
+#define GLX_INTEL_swap_event 1
+#endif
+
+#ifndef GLX_NV_multisample_coverage
+#define GLX_NV_multisample_coverage 1
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null
+/*
+ * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2007-2008 Red Hat, Inc.
+ * (C) Copyright IBM Corporation 2004
+ * 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS AND/OR THEIR SUPPLIERS 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.
+ */
+
+/**
+ * \file dri_interface.h
+ *
+ * This file contains all the types and functions that define the interface
+ * between a DRI driver and driver loader. Currently, the most common driver
+ * loader is the XFree86 libGL.so. However, other loaders do exist, and in
+ * the future the server-side libglx.a will also be a loader.
+ *
+ * \author Kevin E. Martin <kevin@precisioninsight.com>
+ * \author Ian Romanick <idr@us.ibm.com>
+ * \author Kristian Høgsberg <krh@redhat.com>
+ */
+
+#ifndef DRI_INTERFACE_H
+#define DRI_INTERFACE_H
+
+/* For archs with no drm.h */
+#if defined(__APPLE__) || defined(__CYGWIN__) || defined(__GNU__)
+#ifndef __NOT_HAVE_DRM_H
+#define __NOT_HAVE_DRM_H
+#endif
+#endif
+
+#ifndef __NOT_HAVE_DRM_H
+#include <drm.h>
+#else
+typedef unsigned int drm_context_t;
+typedef unsigned int drm_drawable_t;
+typedef struct drm_clip_rect drm_clip_rect_t;
+#endif
+
+/**
+ * \name DRI interface structures
+ *
+ * The following structures define the interface between the GLX client
+ * side library and the DRI (direct rendering infrastructure).
+ */
+/*@{*/
+typedef struct __DRIdisplayRec __DRIdisplay;
+typedef struct __DRIscreenRec __DRIscreen;
+typedef struct __DRIcontextRec __DRIcontext;
+typedef struct __DRIdrawableRec __DRIdrawable;
+typedef struct __DRIconfigRec __DRIconfig;
+typedef struct __DRIframebufferRec __DRIframebuffer;
+typedef struct __DRIversionRec __DRIversion;
+
+typedef struct __DRIcoreExtensionRec __DRIcoreExtension;
+typedef struct __DRIextensionRec __DRIextension;
+typedef struct __DRIcopySubBufferExtensionRec __DRIcopySubBufferExtension;
+typedef struct __DRIswapControlExtensionRec __DRIswapControlExtension;
+typedef struct __DRIframeTrackingExtensionRec __DRIframeTrackingExtension;
+typedef struct __DRImediaStreamCounterExtensionRec __DRImediaStreamCounterExtension;
+typedef struct __DRItexOffsetExtensionRec __DRItexOffsetExtension;
+typedef struct __DRItexBufferExtensionRec __DRItexBufferExtension;
+typedef struct __DRIlegacyExtensionRec __DRIlegacyExtension;
+typedef struct __DRIswrastExtensionRec __DRIswrastExtension;
+typedef struct __DRIbufferRec __DRIbuffer;
+typedef struct __DRIdri2ExtensionRec __DRIdri2Extension;
+typedef struct __DRIdri2LoaderExtensionRec __DRIdri2LoaderExtension;
+typedef struct __DRI2flushExtensionRec __DRI2flushExtension;
+typedef struct __DRI2throttleExtensionRec __DRI2throttleExtension;
+
+/*@}*/
+
+
+/**
+ * Extension struct. Drivers 'inherit' from this struct by embedding
+ * it as the first element in the extension struct.
+ *
+ * We never break API in for a DRI extension. If we need to change
+ * the way things work in a non-backwards compatible manner, we
+ * introduce a new extension. During a transition period, we can
+ * leave both the old and the new extension in the driver, which
+ * allows us to move to the new interface without having to update the
+ * loader(s) in lock step.
+ *
+ * However, we can add entry points to an extension over time as long
+ * as we don't break the old ones. As we add entry points to an
+ * extension, we increase the version number. The corresponding
+ * #define can be used to guard code that accesses the new entry
+ * points at compile time and the version field in the extension
+ * struct can be used at run-time to determine how to use the
+ * extension.
+ */
+struct __DRIextensionRec {
+ const char *name;
+ int version;
+};
+
+/**
+ * The first set of extension are the screen extensions, returned by
+ * __DRIcore::getExtensions(). This entry point will return a list of
+ * extensions and the loader can use the ones it knows about by
+ * casting them to more specific extensions and advertising any GLX
+ * extensions the DRI extensions enables.
+ */
+
+/**
+ * Used by drivers to indicate support for setting the read drawable.
+ */
+#define __DRI_READ_DRAWABLE "DRI_ReadDrawable"
+#define __DRI_READ_DRAWABLE_VERSION 1
+
+/**
+ * Used by drivers that implement the GLX_MESA_copy_sub_buffer extension.
+ */
+#define __DRI_COPY_SUB_BUFFER "DRI_CopySubBuffer"
+#define __DRI_COPY_SUB_BUFFER_VERSION 1
+struct __DRIcopySubBufferExtensionRec {
+ __DRIextension base;
+ void (*copySubBuffer)(__DRIdrawable *drawable, int x, int y, int w, int h);
+};
+
+/**
+ * Used by drivers that implement the GLX_SGI_swap_control or
+ * GLX_MESA_swap_control extension.
+ */
+#define __DRI_SWAP_CONTROL "DRI_SwapControl"
+#define __DRI_SWAP_CONTROL_VERSION 1
+struct __DRIswapControlExtensionRec {
+ __DRIextension base;
+ void (*setSwapInterval)(__DRIdrawable *drawable, unsigned int inteval);
+ unsigned int (*getSwapInterval)(__DRIdrawable *drawable);
+};
+
+/**
+ * Used by drivers that implement the GLX_MESA_swap_frame_usage extension.
+ */
+#define __DRI_FRAME_TRACKING "DRI_FrameTracking"
+#define __DRI_FRAME_TRACKING_VERSION 1
+struct __DRIframeTrackingExtensionRec {
+ __DRIextension base;
+
+ /**
+ * Enable or disable frame usage tracking.
+ *
+ * \since Internal API version 20030317.
+ */
+ int (*frameTracking)(__DRIdrawable *drawable, GLboolean enable);
+
+ /**
+ * Retrieve frame usage information.
+ *
+ * \since Internal API version 20030317.
+ */
+ int (*queryFrameTracking)(__DRIdrawable *drawable,
+ int64_t * sbc, int64_t * missedFrames,
+ float * lastMissedUsage, float * usage);
+};
+
+
+/**
+ * Used by drivers that implement the GLX_SGI_video_sync extension.
+ */
+#define __DRI_MEDIA_STREAM_COUNTER "DRI_MediaStreamCounter"
+#define __DRI_MEDIA_STREAM_COUNTER_VERSION 1
+struct __DRImediaStreamCounterExtensionRec {
+ __DRIextension base;
+
+ /**
+ * Wait for the MSC to equal target_msc, or, if that has already passed,
+ * the next time (MSC % divisor) is equal to remainder. If divisor is
+ * zero, the function will return as soon as MSC is greater than or equal
+ * to target_msc.
+ */
+ int (*waitForMSC)(__DRIdrawable *drawable,
+ int64_t target_msc, int64_t divisor, int64_t remainder,
+ int64_t * msc, int64_t * sbc);
+
+ /**
+ * Get the number of vertical refreshes since some point in time before
+ * this function was first called (i.e., system start up).
+ */
+ int (*getDrawableMSC)(__DRIscreen *screen, __DRIdrawable *drawable,
+ int64_t *msc);
+};
+
+
+#define __DRI_TEX_OFFSET "DRI_TexOffset"
+#define __DRI_TEX_OFFSET_VERSION 1
+struct __DRItexOffsetExtensionRec {
+ __DRIextension base;
+
+ /**
+ * Method to override base texture image with a driver specific 'offset'.
+ * The depth passed in allows e.g. to ignore the alpha channel of texture
+ * images where the non-alpha components don't occupy a whole texel.
+ *
+ * For GLX_EXT_texture_from_pixmap with AIGLX.
+ */
+ void (*setTexOffset)(__DRIcontext *pDRICtx, GLint texname,
+ unsigned long long offset, GLint depth, GLuint pitch);
+};
+
+
+/* Valid values for format in the setTexBuffer2 function below. These
+ * values match the GLX tokens for compatibility reasons, but we
+ * define them here since the DRI interface can't depend on GLX. */
+#define __DRI_TEXTURE_FORMAT_NONE 0x20D8
+#define __DRI_TEXTURE_FORMAT_RGB 0x20D9
+#define __DRI_TEXTURE_FORMAT_RGBA 0x20DA
+
+#define __DRI_TEX_BUFFER "DRI_TexBuffer"
+#define __DRI_TEX_BUFFER_VERSION 2
+struct __DRItexBufferExtensionRec {
+ __DRIextension base;
+
+ /**
+ * Method to override base texture image with the contents of a
+ * __DRIdrawable.
+ *
+ * For GLX_EXT_texture_from_pixmap with AIGLX. Deprecated in favor of
+ * setTexBuffer2 in version 2 of this interface
+ */
+ void (*setTexBuffer)(__DRIcontext *pDRICtx,
+ GLint target,
+ __DRIdrawable *pDraw);
+
+ /**
+ * Method to override base texture image with the contents of a
+ * __DRIdrawable, including the required texture format attribute.
+ *
+ * For GLX_EXT_texture_from_pixmap with AIGLX.
+ */
+ void (*setTexBuffer2)(__DRIcontext *pDRICtx,
+ GLint target,
+ GLint format,
+ __DRIdrawable *pDraw);
+ /**
+ * Method to release texture buffer in case some special platform
+ * need this.
+ *
+ * For GLX_EXT_texture_from_pixmap with AIGLX.
+ */
+ void (*releaseTexBuffer)(__DRIcontext *pDRICtx,
+ GLint target,
+ __DRIdrawable *pDraw);
+};
+
+/**
+ * Used by drivers that implement DRI2
+ */
+#define __DRI2_FLUSH "DRI2_Flush"
+#define __DRI2_FLUSH_VERSION 3
+struct __DRI2flushExtensionRec {
+ __DRIextension base;
+ void (*flush)(__DRIdrawable *drawable);
+
+ /**
+ * Ask the driver to call getBuffers/getBuffersWithFormat before
+ * it starts rendering again.
+ *
+ * \param drawable the drawable to invalidate
+ *
+ * \since 3
+ */
+ void (*invalidate)(__DRIdrawable *drawable);
+};
+
+
+/**
+ * Extension that the driver uses to request
+ * throttle callbacks.
+ */
+
+#define __DRI2_THROTTLE "DRI2_Throttle"
+#define __DRI2_THROTTLE_VERSION 1
+
+enum __DRI2throttleReason {
+ __DRI2_THROTTLE_SWAPBUFFER,
+ __DRI2_THROTTLE_COPYSUBBUFFER,
+ __DRI2_THROTTLE_FLUSHFRONT
+};
+
+struct __DRI2throttleExtensionRec {
+ __DRIextension base;
+ void (*throttle)(__DRIcontext *ctx,
+ __DRIdrawable *drawable,
+ enum __DRI2throttleReason reason);
+};
+
+/**
+ * XML document describing the configuration options supported by the
+ * driver.
+ */
+extern const char __driConfigOptions[];
+
+/*@}*/
+
+/**
+ * The following extensions describe loader features that the DRI
+ * driver can make use of. Some of these are mandatory, such as the
+ * getDrawableInfo extension for DRI and the DRI Loader extensions for
+ * DRI2, while others are optional, and if present allow the driver to
+ * expose certain features. The loader pass in a NULL terminated
+ * array of these extensions to the driver in the createNewScreen
+ * constructor.
+ */
+
+typedef struct __DRIgetDrawableInfoExtensionRec __DRIgetDrawableInfoExtension;
+typedef struct __DRIsystemTimeExtensionRec __DRIsystemTimeExtension;
+typedef struct __DRIdamageExtensionRec __DRIdamageExtension;
+typedef struct __DRIloaderExtensionRec __DRIloaderExtension;
+typedef struct __DRIswrastLoaderExtensionRec __DRIswrastLoaderExtension;
+
+
+/**
+ * Callback to getDrawableInfo protocol
+ */
+#define __DRI_GET_DRAWABLE_INFO "DRI_GetDrawableInfo"
+#define __DRI_GET_DRAWABLE_INFO_VERSION 1
+struct __DRIgetDrawableInfoExtensionRec {
+ __DRIextension base;
+
+ /**
+ * This function is used to get information about the position, size, and
+ * clip rects of a drawable.
+ */
+ GLboolean (* getDrawableInfo) ( __DRIdrawable *drawable,
+ unsigned int * index, unsigned int * stamp,
+ int * x, int * y, int * width, int * height,
+ int * numClipRects, drm_clip_rect_t ** pClipRects,
+ int * backX, int * backY,
+ int * numBackClipRects, drm_clip_rect_t ** pBackClipRects,
+ void *loaderPrivate);
+};
+
+/**
+ * Callback to get system time for media stream counter extensions.
+ */
+#define __DRI_SYSTEM_TIME "DRI_SystemTime"
+#define __DRI_SYSTEM_TIME_VERSION 1
+struct __DRIsystemTimeExtensionRec {
+ __DRIextension base;
+
+ /**
+ * Get the 64-bit unadjusted system time (UST).
+ */
+ int (*getUST)(int64_t * ust);
+
+ /**
+ * Get the media stream counter (MSC) rate.
+ *
+ * Matching the definition in GLX_OML_sync_control, this function returns
+ * the rate of the "media stream counter". In practical terms, this is
+ * the frame refresh rate of the display.
+ */
+ GLboolean (*getMSCRate)(__DRIdrawable *draw,
+ int32_t * numerator, int32_t * denominator,
+ void *loaderPrivate);
+};
+
+/**
+ * Damage reporting
+ */
+#define __DRI_DAMAGE "DRI_Damage"
+#define __DRI_DAMAGE_VERSION 1
+struct __DRIdamageExtensionRec {
+ __DRIextension base;
+
+ /**
+ * Reports areas of the given drawable which have been modified by the
+ * driver.
+ *
+ * \param drawable which the drawing was done to.
+ * \param rects rectangles affected, with the drawable origin as the
+ * origin.
+ * \param x X offset of the drawable within the screen (used in the
+ * front_buffer case)
+ * \param y Y offset of the drawable within the screen.
+ * \param front_buffer boolean flag for whether the drawing to the
+ * drawable was actually done directly to the front buffer (instead
+ * of backing storage, for example)
+ * \param loaderPrivate the data passed in at createNewDrawable time
+ */
+ void (*reportDamage)(__DRIdrawable *draw,
+ int x, int y,
+ drm_clip_rect_t *rects, int num_rects,
+ GLboolean front_buffer,
+ void *loaderPrivate);
+};
+
+#define __DRI_SWRAST_IMAGE_OP_DRAW 1
+#define __DRI_SWRAST_IMAGE_OP_CLEAR 2
+#define __DRI_SWRAST_IMAGE_OP_SWAP 3
+
+/**
+ * SWRast Loader extension.
+ */
+#define __DRI_SWRAST_LOADER "DRI_SWRastLoader"
+#define __DRI_SWRAST_LOADER_VERSION 1
+struct __DRIswrastLoaderExtensionRec {
+ __DRIextension base;
+
+ /*
+ * Drawable position and size
+ */
+ void (*getDrawableInfo)(__DRIdrawable *drawable,
+ int *x, int *y, int *width, int *height,
+ void *loaderPrivate);
+
+ /**
+ * Put image to drawable
+ */
+ void (*putImage)(__DRIdrawable *drawable, int op,
+ int x, int y, int width, int height,
+ char *data, void *loaderPrivate);
+
+ /**
+ * Get image from readable
+ */
+ void (*getImage)(__DRIdrawable *readable,
+ int x, int y, int width, int height,
+ char *data, void *loaderPrivate);
+};
+
+/**
+ * Invalidate loader extension. The presence of this extension
+ * indicates to the DRI driver that the loader will call invalidate in
+ * the __DRI2_FLUSH extension, whenever the needs to query for new
+ * buffers. This means that the DRI driver can drop the polling in
+ * glViewport().
+ *
+ * The extension doesn't provide any functionality, it's only use to
+ * indicate to the driver that it can use the new semantics. A DRI
+ * driver can use this to switch between the different semantics or
+ * just refuse to initialize if this extension isn't present.
+ */
+#define __DRI_USE_INVALIDATE "DRI_UseInvalidate"
+#define __DRI_USE_INVALIDATE_VERSION 1
+
+typedef struct __DRIuseInvalidateExtensionRec __DRIuseInvalidateExtension;
+struct __DRIuseInvalidateExtensionRec {
+ __DRIextension base;
+};
+
+/**
+ * The remaining extensions describe driver extensions, immediately
+ * available interfaces provided by the driver. To start using the
+ * driver, dlsym() for the __DRI_DRIVER_EXTENSIONS symbol and look for
+ * the extension you need in the array.
+ */
+#define __DRI_DRIVER_EXTENSIONS "__driDriverExtensions"
+
+/**
+ * Tokens for __DRIconfig attribs. A number of attributes defined by
+ * GLX or EGL standards are not in the table, as they must be provided
+ * by the loader. For example, FBConfig ID or visual ID, drawable type.
+ */
+
+#define __DRI_ATTRIB_BUFFER_SIZE 1
+#define __DRI_ATTRIB_LEVEL 2
+#define __DRI_ATTRIB_RED_SIZE 3
+#define __DRI_ATTRIB_GREEN_SIZE 4
+#define __DRI_ATTRIB_BLUE_SIZE 5
+#define __DRI_ATTRIB_LUMINANCE_SIZE 6
+#define __DRI_ATTRIB_ALPHA_SIZE 7
+#define __DRI_ATTRIB_ALPHA_MASK_SIZE 8
+#define __DRI_ATTRIB_DEPTH_SIZE 9
+#define __DRI_ATTRIB_STENCIL_SIZE 10
+#define __DRI_ATTRIB_ACCUM_RED_SIZE 11
+#define __DRI_ATTRIB_ACCUM_GREEN_SIZE 12
+#define __DRI_ATTRIB_ACCUM_BLUE_SIZE 13
+#define __DRI_ATTRIB_ACCUM_ALPHA_SIZE 14
+#define __DRI_ATTRIB_SAMPLE_BUFFERS 15
+#define __DRI_ATTRIB_SAMPLES 16
+#define __DRI_ATTRIB_RENDER_TYPE 17
+#define __DRI_ATTRIB_CONFIG_CAVEAT 18
+#define __DRI_ATTRIB_CONFORMANT 19
+#define __DRI_ATTRIB_DOUBLE_BUFFER 20
+#define __DRI_ATTRIB_STEREO 21
+#define __DRI_ATTRIB_AUX_BUFFERS 22
+#define __DRI_ATTRIB_TRANSPARENT_TYPE 23
+#define __DRI_ATTRIB_TRANSPARENT_INDEX_VALUE 24
+#define __DRI_ATTRIB_TRANSPARENT_RED_VALUE 25
+#define __DRI_ATTRIB_TRANSPARENT_GREEN_VALUE 26
+#define __DRI_ATTRIB_TRANSPARENT_BLUE_VALUE 27
+#define __DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE 28
+#define __DRI_ATTRIB_FLOAT_MODE 29
+#define __DRI_ATTRIB_RED_MASK 30
+#define __DRI_ATTRIB_GREEN_MASK 31
+#define __DRI_ATTRIB_BLUE_MASK 32
+#define __DRI_ATTRIB_ALPHA_MASK 33
+#define __DRI_ATTRIB_MAX_PBUFFER_WIDTH 34
+#define __DRI_ATTRIB_MAX_PBUFFER_HEIGHT 35
+#define __DRI_ATTRIB_MAX_PBUFFER_PIXELS 36
+#define __DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH 37
+#define __DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT 38
+#define __DRI_ATTRIB_VISUAL_SELECT_GROUP 39
+#define __DRI_ATTRIB_SWAP_METHOD 40
+#define __DRI_ATTRIB_MAX_SWAP_INTERVAL 41
+#define __DRI_ATTRIB_MIN_SWAP_INTERVAL 42
+#define __DRI_ATTRIB_BIND_TO_TEXTURE_RGB 43
+#define __DRI_ATTRIB_BIND_TO_TEXTURE_RGBA 44
+#define __DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE 45
+#define __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS 46
+#define __DRI_ATTRIB_YINVERTED 47
+#define __DRI_ATTRIB_FRAMEBUFFER_SRGB_CAPABLE 48
+
+/* __DRI_ATTRIB_RENDER_TYPE */
+#define __DRI_ATTRIB_RGBA_BIT 0x01
+#define __DRI_ATTRIB_COLOR_INDEX_BIT 0x02
+#define __DRI_ATTRIB_LUMINANCE_BIT 0x04
+
+/* __DRI_ATTRIB_CONFIG_CAVEAT */
+#define __DRI_ATTRIB_SLOW_BIT 0x01
+#define __DRI_ATTRIB_NON_CONFORMANT_CONFIG 0x02
+
+/* __DRI_ATTRIB_TRANSPARENT_TYPE */
+#define __DRI_ATTRIB_TRANSPARENT_RGB 0x00
+#define __DRI_ATTRIB_TRANSPARENT_INDEX 0x01
+
+/* __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS */
+#define __DRI_ATTRIB_TEXTURE_1D_BIT 0x01
+#define __DRI_ATTRIB_TEXTURE_2D_BIT 0x02
+#define __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT 0x04
+
+/**
+ * This extension defines the core DRI functionality.
+ */
+#define __DRI_CORE "DRI_Core"
+#define __DRI_CORE_VERSION 1
+
+struct __DRIcoreExtensionRec {
+ __DRIextension base;
+
+ __DRIscreen *(*createNewScreen)(int screen, int fd,
+ unsigned int sarea_handle,
+ const __DRIextension **extensions,
+ const __DRIconfig ***driverConfigs,
+ void *loaderPrivate);
+
+ void (*destroyScreen)(__DRIscreen *screen);
+
+ const __DRIextension **(*getExtensions)(__DRIscreen *screen);
+
+ int (*getConfigAttrib)(const __DRIconfig *config,
+ unsigned int attrib,
+ unsigned int *value);
+
+ int (*indexConfigAttrib)(const __DRIconfig *config, int index,
+ unsigned int *attrib, unsigned int *value);
+
+ __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
+ const __DRIconfig *config,
+ unsigned int drawable_id,
+ unsigned int head,
+ void *loaderPrivate);
+
+ void (*destroyDrawable)(__DRIdrawable *drawable);
+
+ void (*swapBuffers)(__DRIdrawable *drawable);
+
+ __DRIcontext *(*createNewContext)(__DRIscreen *screen,
+ const __DRIconfig *config,
+ __DRIcontext *shared,
+ void *loaderPrivate);
+
+ int (*copyContext)(__DRIcontext *dest,
+ __DRIcontext *src,
+ unsigned long mask);
+
+ void (*destroyContext)(__DRIcontext *context);
+
+ int (*bindContext)(__DRIcontext *ctx,
+ __DRIdrawable *pdraw,
+ __DRIdrawable *pread);
+
+ int (*unbindContext)(__DRIcontext *ctx);
+};
+
+/**
+ * Stored version of some component (i.e., server-side DRI module, kernel-side
+ * DRM, etc.).
+ *
+ * \todo
+ * There are several data structures that explicitly store a major version,
+ * minor version, and patch level. These structures should be modified to
+ * have a \c __DRIversionRec instead.
+ */
+struct __DRIversionRec {
+ int major; /**< Major version number. */
+ int minor; /**< Minor version number. */
+ int patch; /**< Patch-level. */
+};
+
+/**
+ * Framebuffer information record. Used by libGL to communicate information
+ * about the framebuffer to the driver's \c __driCreateNewScreen function.
+ *
+ * In XFree86, most of this information is derrived from data returned by
+ * calling \c XF86DRIGetDeviceInfo.
+ *
+ * \sa XF86DRIGetDeviceInfo __DRIdisplayRec::createNewScreen
+ * __driUtilCreateNewScreen CallCreateNewScreen
+ *
+ * \bug This structure could be better named.
+ */
+struct __DRIframebufferRec {
+ unsigned char *base; /**< Framebuffer base address in the CPU's
+ * address space. This value is calculated by
+ * calling \c drmMap on the framebuffer handle
+ * returned by \c XF86DRIGetDeviceInfo (or a
+ * similar function).
+ */
+ int size; /**< Framebuffer size, in bytes. */
+ int stride; /**< Number of bytes from one line to the next. */
+ int width; /**< Pixel width of the framebuffer. */
+ int height; /**< Pixel height of the framebuffer. */
+ int dev_priv_size; /**< Size of the driver's dev-priv structure. */
+ void *dev_priv; /**< Pointer to the driver's dev-priv structure. */
+};
+
+
+/**
+ * This extension provides alternative screen, drawable and context
+ * constructors for legacy DRI functionality. This is used in
+ * conjunction with the core extension.
+ */
+#define __DRI_LEGACY "DRI_Legacy"
+#define __DRI_LEGACY_VERSION 1
+
+struct __DRIlegacyExtensionRec {
+ __DRIextension base;
+
+ __DRIscreen *(*createNewScreen)(int screen,
+ const __DRIversion *ddx_version,
+ const __DRIversion *dri_version,
+ const __DRIversion *drm_version,
+ const __DRIframebuffer *frame_buffer,
+ void *pSAREA, int fd,
+ const __DRIextension **extensions,
+ const __DRIconfig ***driver_configs,
+ void *loaderPrivate);
+
+ __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
+ const __DRIconfig *config,
+ drm_drawable_t hwDrawable,
+ int renderType, const int *attrs,
+ void *loaderPrivate);
+
+ __DRIcontext *(*createNewContext)(__DRIscreen *screen,
+ const __DRIconfig *config,
+ int render_type,
+ __DRIcontext *shared,
+ drm_context_t hwContext,
+ void *loaderPrivate);
+};
+
+/**
+ * This extension provides alternative screen, drawable and context
+ * constructors for swrast DRI functionality. This is used in
+ * conjunction with the core extension.
+ */
+#define __DRI_SWRAST "DRI_SWRast"
+#define __DRI_SWRAST_VERSION 3
+
+struct __DRIswrastExtensionRec {
+ __DRIextension base;
+
+ __DRIscreen *(*createNewScreen)(int screen,
+ const __DRIextension **extensions,
+ const __DRIconfig ***driver_configs,
+ void *loaderPrivate);
+
+ __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
+ const __DRIconfig *config,
+ void *loaderPrivate);
+
+ /* Since version 2 */
+ __DRIcontext *(*createNewContextForAPI)(__DRIscreen *screen,
+ int api,
+ const __DRIconfig *config,
+ __DRIcontext *shared,
+ void *data);
+
+ /**
+ * Create a context for a particular API with a set of attributes
+ *
+ * \since version 3
+ *
+ * \sa __DRIdri2ExtensionRec::createContextAttribs
+ */
+ __DRIcontext *(*createContextAttribs)(__DRIscreen *screen,
+ int api,
+ const __DRIconfig *config,
+ __DRIcontext *shared,
+ unsigned num_attribs,
+ const uint32_t *attribs,
+ unsigned *error,
+ void *loaderPrivate);
+};
+
+/**
+ * DRI2 Loader extension.
+ */
+#define __DRI_BUFFER_FRONT_LEFT 0
+#define __DRI_BUFFER_BACK_LEFT 1
+#define __DRI_BUFFER_FRONT_RIGHT 2
+#define __DRI_BUFFER_BACK_RIGHT 3
+#define __DRI_BUFFER_DEPTH 4
+#define __DRI_BUFFER_STENCIL 5
+#define __DRI_BUFFER_ACCUM 6
+#define __DRI_BUFFER_FAKE_FRONT_LEFT 7
+#define __DRI_BUFFER_FAKE_FRONT_RIGHT 8
+#define __DRI_BUFFER_DEPTH_STENCIL 9 /**< Only available with DRI2 1.1 */
+#define __DRI_BUFFER_HIZ 10
+
+/* Inofficial and for internal use. Increase when adding a new buffer token. */
+#define __DRI_BUFFER_COUNT 11
+
+struct __DRIbufferRec {
+ unsigned int attachment;
+ unsigned int name;
+ unsigned int pitch;
+ unsigned int cpp;
+ unsigned int flags;
+};
+
+#define __DRI_DRI2_LOADER "DRI_DRI2Loader"
+#define __DRI_DRI2_LOADER_VERSION 3
+struct __DRIdri2LoaderExtensionRec {
+ __DRIextension base;
+
+ __DRIbuffer *(*getBuffers)(__DRIdrawable *driDrawable,
+ int *width, int *height,
+ unsigned int *attachments, int count,
+ int *out_count, void *loaderPrivate);
+
+ /**
+ * Flush pending front-buffer rendering
+ *
+ * Any rendering that has been performed to the
+ * \c __DRI_BUFFER_FAKE_FRONT_LEFT will be flushed to the
+ * \c __DRI_BUFFER_FRONT_LEFT.
+ *
+ * \param driDrawable Drawable whose front-buffer is to be flushed
+ * \param loaderPrivate Loader's private data that was previously passed
+ * into __DRIdri2ExtensionRec::createNewDrawable
+ */
+ void (*flushFrontBuffer)(__DRIdrawable *driDrawable, void *loaderPrivate);
+
+
+ /**
+ * Get list of buffers from the server
+ *
+ * Gets a list of buffer for the specified set of attachments. Unlike
+ * \c ::getBuffers, this function takes a list of attachments paired with
+ * opaque \c unsigned \c int value describing the format of the buffer.
+ * It is the responsibility of the caller to know what the service that
+ * allocates the buffers will expect to receive for the format.
+ *
+ * \param driDrawable Drawable whose buffers are being queried.
+ * \param width Output where the width of the buffers is stored.
+ * \param height Output where the height of the buffers is stored.
+ * \param attachments List of pairs of attachment ID and opaque format
+ * requested for the drawable.
+ * \param count Number of attachment / format pairs stored in
+ * \c attachments.
+ * \param loaderPrivate Loader's private data that was previously passed
+ * into __DRIdri2ExtensionRec::createNewDrawable.
+ */
+ __DRIbuffer *(*getBuffersWithFormat)(__DRIdrawable *driDrawable,
+ int *width, int *height,
+ unsigned int *attachments, int count,
+ int *out_count, void *loaderPrivate);
+};
+
+/**
+ * This extension provides alternative screen, drawable and context
+ * constructors for DRI2.
+ */
+#define __DRI_DRI2 "DRI_DRI2"
+#define __DRI_DRI2_VERSION 3
+
+#define __DRI_API_OPENGL 0 /**< OpenGL compatibility profile */
+#define __DRI_API_GLES 1
+#define __DRI_API_GLES2 2
+#define __DRI_API_OPENGL_CORE 3 /**< OpenGL 3.2+ core profile */
+
+#define __DRI_CTX_ATTRIB_MAJOR_VERSION 0
+#define __DRI_CTX_ATTRIB_MINOR_VERSION 1
+#define __DRI_CTX_ATTRIB_FLAGS 2
+
+#define __DRI_CTX_FLAG_DEBUG 0x00000001
+#define __DRI_CTX_FLAG_FORWARD_COMPATIBLE 0x00000002
+
+/**
+ * \name Reasons that __DRIdri2Extension::createContextAttribs might fail
+ */
+/*@{*/
+/** Success! */
+#define __DRI_CTX_ERROR_SUCCESS 0
+
+/** Memory allocation failure */
+#define __DRI_CTX_ERROR_NO_MEMORY 1
+
+/** Client requested an API (e.g., OpenGL ES 2.0) that the driver can't do. */
+#define __DRI_CTX_ERROR_BAD_API 2
+
+/** Client requested an API version that the driver can't do. */
+#define __DRI_CTX_ERROR_BAD_VERSION 3
+
+/** Client requested a flag or combination of flags the driver can't do. */
+#define __DRI_CTX_ERROR_BAD_FLAG 4
+
+/** Client requested an attribute the driver doesn't understand. */
+#define __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE 5
+
+/** Client requested a flag the driver doesn't understand. */
+#define __DRI_CTX_ERROR_UNKNOWN_FLAG 6
+/*@}*/
+
+struct __DRIdri2ExtensionRec {
+ __DRIextension base;
+
+ __DRIscreen *(*createNewScreen)(int screen, int fd,
+ const __DRIextension **extensions,
+ const __DRIconfig ***driver_configs,
+ void *loaderPrivate);
+
+ __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
+ const __DRIconfig *config,
+ void *loaderPrivate);
+
+ __DRIcontext *(*createNewContext)(__DRIscreen *screen,
+ const __DRIconfig *config,
+ __DRIcontext *shared,
+ void *loaderPrivate);
+
+ /* Since version 2 */
+ unsigned int (*getAPIMask)(__DRIscreen *screen);
+
+ __DRIcontext *(*createNewContextForAPI)(__DRIscreen *screen,
+ int api,
+ const __DRIconfig *config,
+ __DRIcontext *shared,
+ void *data);
+
+ __DRIbuffer *(*allocateBuffer)(__DRIscreen *screen,
+ unsigned int attachment,
+ unsigned int format,
+ int width,
+ int height);
+ void (*releaseBuffer)(__DRIscreen *screen,
+ __DRIbuffer *buffer);
+
+ /**
+ * Create a context for a particular API with a set of attributes
+ *
+ * \since version 3
+ *
+ * \sa __DRIswrastExtensionRec::createContextAttribs
+ */
+ __DRIcontext *(*createContextAttribs)(__DRIscreen *screen,
+ int api,
+ const __DRIconfig *config,
+ __DRIcontext *shared,
+ unsigned num_attribs,
+ const uint32_t *attribs,
+ unsigned *error,
+ void *loaderPrivate);
+};
+
+
+/**
+ * This extension provides functionality to enable various EGLImage
+ * extensions.
+ */
+#define __DRI_IMAGE "DRI_IMAGE"
+#define __DRI_IMAGE_VERSION 1
+
+/**
+ * These formats correspond to the similarly named MESA_FORMAT_*
+ * tokens, except in the native endian of the CPU. For example, on
+ * little endian __DRI_IMAGE_FORMAT_XRGB8888 corresponds to
+ * MESA_FORMAT_XRGB8888, but MESA_FORMAT_XRGB8888_REV on big endian.
+ */
+#define __DRI_IMAGE_FORMAT_RGB565 0x1001
+#define __DRI_IMAGE_FORMAT_XRGB8888 0x1002
+#define __DRI_IMAGE_FORMAT_ARGB8888 0x1003
+#define __DRI_IMAGE_FORMAT_ABGR8888 0x1004
+
+#define __DRI_IMAGE_USE_SHARE 0x0001
+#define __DRI_IMAGE_USE_SCANOUT 0x0002
+#define __DRI_IMAGE_USE_CURSOR 0x0004
+
+/**
+ * queryImage attributes
+ */
+
+#define __DRI_IMAGE_ATTRIB_STRIDE 0x2000
+#define __DRI_IMAGE_ATTRIB_HANDLE 0x2001
+#define __DRI_IMAGE_ATTRIB_NAME 0x2002
+
+typedef struct __DRIimageRec __DRIimage;
+typedef struct __DRIimageExtensionRec __DRIimageExtension;
+struct __DRIimageExtensionRec {
+ __DRIextension base;
+
+ __DRIimage *(*createImageFromName)(__DRIscreen *screen,
+ int width, int height, int format,
+ int name, int pitch,
+ void *loaderPrivate);
+
+ __DRIimage *(*createImageFromRenderbuffer)(__DRIcontext *context,
+ int renderbuffer,
+ void *loaderPrivate);
+
+ void (*destroyImage)(__DRIimage *image);
+
+ __DRIimage *(*createImage)(__DRIscreen *screen,
+ int width, int height, int format,
+ unsigned int use,
+ void *loaderPrivate);
+
+ GLboolean (*queryImage)(__DRIimage *image, int attrib, int *value);
+
+ /**
+ * The new __DRIimage will share the content with the old one, see dup(2).
+ */
+ __DRIimage *(*dupImage)(__DRIimage *image, void *loaderPrivate);
+};
+
+
+/**
+ * This extension must be implemented by the loader and passed to the
+ * driver at screen creation time. The EGLImage entry points in the
+ * various client APIs take opaque EGLImage handles and use this
+ * extension to map them to a __DRIimage. At version 1, this
+ * extensions allows mapping EGLImage pointers to __DRIimage pointers,
+ * but future versions could support other EGLImage-like, opaque types
+ * with new lookup functions.
+ */
+#define __DRI_IMAGE_LOOKUP "DRI_IMAGE_LOOKUP"
+#define __DRI_IMAGE_LOOKUP_VERSION 1
+
+typedef struct __DRIimageLookupExtensionRec __DRIimageLookupExtension;
+struct __DRIimageLookupExtensionRec {
+ __DRIextension base;
+
+ __DRIimage *(*lookupEGLImage)(__DRIscreen *screen, void *image,
+ void *loaderPrivate);
+};
+
+/**
+ * This extension allows for common DRI2 options
+ */
+#define __DRI2_CONFIG_QUERY "DRI_CONFIG_QUERY"
+#define __DRI2_CONFIG_QUERY_VERSION 1
+
+typedef struct __DRI2configQueryExtensionRec __DRI2configQueryExtension;
+struct __DRI2configQueryExtensionRec {
+ __DRIextension base;
+
+ int (*configQueryb)(__DRIscreen *screen, const char *var, GLboolean *val);
+ int (*configQueryi)(__DRIscreen *screen, const char *var, GLint *val);
+ int (*configQueryf)(__DRIscreen *screen, const char *var, GLfloat *val);
+};
+#endif
--- /dev/null
+/**
+ * \file sarea.h
+ * SAREA definitions.
+ *
+ * \author Kevin E. Martin <kevin@precisioninsight.com>
+ * \author Jens Owen <jens@tungstengraphics.com>
+ * \author Rickard E. (Rik) Faith <faith@valinux.com>
+ */
+
+/*
+ * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+ * Copyright 2000 VA Linux Systems, 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, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) 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 NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS 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.
+ */
+
+
+#ifndef _SAREA_H_
+#define _SAREA_H_
+
+#include "xf86drm.h"
+
+/* SAREA area needs to be at least a page */
+#if defined(__alpha__)
+#define SAREA_MAX 0x2000
+#elif defined(__ia64__)
+#define SAREA_MAX 0x10000 /* 64kB */
+#else
+/* Intel 830M driver needs at least 8k SAREA */
+#define SAREA_MAX 0x2000
+#endif
+
+#define SAREA_MAX_DRAWABLES 256
+
+#define SAREA_DRAWABLE_CLAIMED_ENTRY 0x80000000
+
+/**
+ * SAREA per drawable information.
+ *
+ * \sa _XF86DRISAREA.
+ */
+typedef struct _XF86DRISAREADrawable {
+ unsigned int stamp;
+ unsigned int flags;
+} XF86DRISAREADrawableRec, *XF86DRISAREADrawablePtr;
+
+/**
+ * SAREA frame information.
+ *
+ * \sa _XF86DRISAREA.
+ */
+typedef struct _XF86DRISAREAFrame {
+ unsigned int x;
+ unsigned int y;
+ unsigned int width;
+ unsigned int height;
+ unsigned int fullscreen;
+} XF86DRISAREAFrameRec, *XF86DRISAREAFramePtr;
+
+/**
+ * SAREA definition.
+ */
+typedef struct _XF86DRISAREA {
+ /** first thing is always the DRM locking structure */
+ drmLock lock;
+ /** \todo Use readers/writer lock for drawable_lock */
+ drmLock drawable_lock;
+ XF86DRISAREADrawableRec drawableTable[SAREA_MAX_DRAWABLES];
+ XF86DRISAREAFrameRec frame;
+ drm_context_t dummy_context;
+} XF86DRISAREARec, *XF86DRISAREAPtr;
+
+#endif
--- /dev/null
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.5
+ *
+ * Copyright (C) 1999-2005 Brian Paul 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 and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/*
+ * Mesa Off-Screen rendering interface.
+ *
+ * This is an operating system and window system independent interface to
+ * Mesa which allows one to render images into a client-supplied buffer in
+ * main memory. Such images may manipulated or saved in whatever way the
+ * client wants.
+ *
+ * These are the API functions:
+ * OSMesaCreateContext - create a new Off-Screen Mesa rendering context
+ * OSMesaMakeCurrent - bind an OSMesaContext to a client's image buffer
+ * and make the specified context the current one.
+ * OSMesaDestroyContext - destroy an OSMesaContext
+ * OSMesaGetCurrentContext - return thread's current context ID
+ * OSMesaPixelStore - controls how pixels are stored in image buffer
+ * OSMesaGetIntegerv - return OSMesa state parameters
+ *
+ *
+ * The limits on the width and height of an image buffer are MAX_WIDTH and
+ * MAX_HEIGHT as defined in Mesa/src/config.h. Defaults are 1280 and 1024.
+ * You can increase them as needed but beware that many temporary arrays in
+ * Mesa are dimensioned by MAX_WIDTH or MAX_HEIGHT.
+ */
+
+
+#ifndef OSMESA_H
+#define OSMESA_H
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include <GL/gl.h>
+
+
+#define OSMESA_MAJOR_VERSION 6
+#define OSMESA_MINOR_VERSION 5
+#define OSMESA_PATCH_VERSION 0
+
+
+
+/*
+ * Values for the format parameter of OSMesaCreateContext()
+ * New in version 2.0.
+ */
+#define OSMESA_COLOR_INDEX GL_COLOR_INDEX
+#define OSMESA_RGBA GL_RGBA
+#define OSMESA_BGRA 0x1
+#define OSMESA_ARGB 0x2
+#define OSMESA_RGB GL_RGB
+#define OSMESA_BGR 0x4
+#define OSMESA_RGB_565 0x5
+
+
+/*
+ * OSMesaPixelStore() parameters:
+ * New in version 2.0.
+ */
+#define OSMESA_ROW_LENGTH 0x10
+#define OSMESA_Y_UP 0x11
+
+
+/*
+ * Accepted by OSMesaGetIntegerv:
+ */
+#define OSMESA_WIDTH 0x20
+#define OSMESA_HEIGHT 0x21
+#define OSMESA_FORMAT 0x22
+#define OSMESA_TYPE 0x23
+#define OSMESA_MAX_WIDTH 0x24 /* new in 4.0 */
+#define OSMESA_MAX_HEIGHT 0x25 /* new in 4.0 */
+
+
+typedef struct osmesa_context *OSMesaContext;
+
+
+#if defined(__QUICKDRAW__)
+#pragma export on
+#endif
+
+
+/*
+ * Create an Off-Screen Mesa rendering context. The only attribute needed is
+ * an RGBA vs Color-Index mode flag.
+ *
+ * Input: format - one of OSMESA_COLOR_INDEX, OSMESA_RGBA, OSMESA_BGRA,
+ * OSMESA_ARGB, OSMESA_RGB, or OSMESA_BGR.
+ * sharelist - specifies another OSMesaContext with which to share
+ * display lists. NULL indicates no sharing.
+ * Return: an OSMesaContext or 0 if error
+ */
+GLAPI OSMesaContext GLAPIENTRY
+OSMesaCreateContext( GLenum format, OSMesaContext sharelist );
+
+
+
+/*
+ * Create an Off-Screen Mesa rendering context and specify desired
+ * size of depth buffer, stencil buffer and accumulation buffer.
+ * If you specify zero for depthBits, stencilBits, accumBits you
+ * can save some memory.
+ *
+ * New in Mesa 3.5
+ */
+GLAPI OSMesaContext GLAPIENTRY
+OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
+ GLint accumBits, OSMesaContext sharelist);
+
+
+/*
+ * Destroy an Off-Screen Mesa rendering context.
+ *
+ * Input: ctx - the context to destroy
+ */
+GLAPI void GLAPIENTRY
+OSMesaDestroyContext( OSMesaContext ctx );
+
+
+
+/*
+ * Bind an OSMesaContext to an image buffer. The image buffer is just a
+ * block of memory which the client provides. Its size must be at least
+ * as large as width*height*sizeof(type). Its address should be a multiple
+ * of 4 if using RGBA mode.
+ *
+ * Image data is stored in the order of glDrawPixels: row-major order
+ * with the lower-left image pixel stored in the first array position
+ * (ie. bottom-to-top).
+ *
+ * Since the only type initially supported is GL_UNSIGNED_BYTE, if the
+ * context is in RGBA mode, each pixel will be stored as a 4-byte RGBA
+ * value. If the context is in color indexed mode, each pixel will be
+ * stored as a 1-byte value.
+ *
+ * If the context's viewport hasn't been initialized yet, it will now be
+ * initialized to (0,0,width,height).
+ *
+ * Input: ctx - the rendering context
+ * buffer - the image buffer memory
+ * type - data type for pixel components, only GL_UNSIGNED_BYTE
+ * supported now
+ * width, height - size of image buffer in pixels, at least 1
+ * Return: GL_TRUE if success, GL_FALSE if error because of invalid ctx,
+ * invalid buffer address, type!=GL_UNSIGNED_BYTE, width<1, height<1,
+ * width>internal limit or height>internal limit.
+ */
+GLAPI GLboolean GLAPIENTRY
+OSMesaMakeCurrent( OSMesaContext ctx, void *buffer, GLenum type,
+ GLsizei width, GLsizei height );
+
+
+
+
+/*
+ * Return the current Off-Screen Mesa rendering context handle.
+ */
+GLAPI OSMesaContext GLAPIENTRY
+OSMesaGetCurrentContext( void );
+
+
+
+/*
+ * Set pixel store/packing parameters for the current context.
+ * This is similar to glPixelStore.
+ * Input: pname - OSMESA_ROW_LENGTH
+ * specify actual pixels per row in image buffer
+ * 0 = same as image width (default)
+ * OSMESA_Y_UP
+ * zero = Y coordinates increase downward
+ * non-zero = Y coordinates increase upward (default)
+ * value - the value for the parameter pname
+ *
+ * New in version 2.0.
+ */
+GLAPI void GLAPIENTRY
+OSMesaPixelStore( GLint pname, GLint value );
+
+
+
+/*
+ * Return an integer value like glGetIntegerv.
+ * Input: pname -
+ * OSMESA_WIDTH return current image width
+ * OSMESA_HEIGHT return current image height
+ * OSMESA_FORMAT return image format
+ * OSMESA_TYPE return color component data type
+ * OSMESA_ROW_LENGTH return row length in pixels
+ * OSMESA_Y_UP returns 1 or 0 to indicate Y axis direction
+ * value - pointer to integer in which to return result.
+ */
+GLAPI void GLAPIENTRY
+OSMesaGetIntegerv( GLint pname, GLint *value );
+
+
+
+/*
+ * Return the depth buffer associated with an OSMesa context.
+ * Input: c - the OSMesa context
+ * Output: width, height - size of buffer in pixels
+ * bytesPerValue - bytes per depth value (2 or 4)
+ * buffer - pointer to depth buffer values
+ * Return: GL_TRUE or GL_FALSE to indicate success or failure.
+ *
+ * New in Mesa 2.4.
+ */
+GLAPI GLboolean GLAPIENTRY
+OSMesaGetDepthBuffer( OSMesaContext c, GLint *width, GLint *height,
+ GLint *bytesPerValue, void **buffer );
+
+
+
+/*
+ * Return the color buffer associated with an OSMesa context.
+ * Input: c - the OSMesa context
+ * Output: width, height - size of buffer in pixels
+ * format - buffer format (OSMESA_FORMAT)
+ * buffer - pointer to depth buffer values
+ * Return: GL_TRUE or GL_FALSE to indicate success or failure.
+ *
+ * New in Mesa 3.3.
+ */
+GLAPI GLboolean GLAPIENTRY
+OSMesaGetColorBuffer( OSMesaContext c, GLint *width, GLint *height,
+ GLint *format, void **buffer );
+
+
+
+/**
+ * This typedef is new in Mesa 6.3.
+ */
+typedef void (*OSMESAproc)();
+
+
+/*
+ * Return pointer to the named function.
+ * New in Mesa 4.1
+ * Return OSMESAproc in 6.3.
+ */
+GLAPI OSMESAproc GLAPIENTRY
+OSMesaGetProcAddress( const char *funcName );
+
+
+
+/**
+ * Enable/disable color clamping, off by default.
+ * New in Mesa 6.4.2
+ */
+GLAPI void GLAPIENTRY
+OSMesaColorClamp(GLboolean enable);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
--- /dev/null
+/***************************************************************************
+ * *
+ * Author : Jouk Jansen (joukj@hrem.nano.tudelft.nl) *
+ * *
+ * Last revision : 31 August 2006 *
+ * *
+ * Repair definitions of Runtime library functions when compiling with *
+ * /name=(as_is) on OpenVMS *
+ * *
+ ***************************************************************************/
+
+#ifndef VMS_X_FIX
+#define VMS_X_FIX
+
+#define decw$_select DECW$_SELECT
+#define DtSaverGetWindows DTSAVERGETWINDOWS
+#define MrmFetchWidget MRMFETCHWIDGET
+#define MrmInitialize MRMINITIALIZE
+#define MrmOpenHierarchy MRMOPENHIERARCHY
+#define MrmRegisterNames MRMREGISTERNAMES
+#define XAddExtension XADDEXTENSION
+#define XAddHosts XADDHOSTS
+#define XAllocClassHint XALLOCCLASSHINT
+#define XAllocColor XALLOCCOLOR
+#define XAllocColorCells XALLOCCOLORCELLS
+#define XAllocIconSize XALLOCICONSIZE
+#define XAllocNamedColor XALLOCNAMEDCOLOR
+#define XAllocSizeHints XALLOCSIZEHINTS
+#define XAllocStandardColormap XALLOCSTANDARDCOLORMAP
+#define XAllocWMHints XALLOCWMHINTS
+#define XAllowEvents XALLOWEVENTS
+#define XAutoRepeatOff XAUTOREPEATOFF
+#define XAutoRepeatOn XAUTOREPEATON
+#define XBaseFontNameListOfFontSet XBASEFONTNAMELISTOFFONTSET
+#define XBell XBELL
+#define XBitmapPad XBITMAPPAD
+#define XBlackPixel XBLACKPIXEL
+#define XBlackPixelOfScreen XBLACKPIXELOFSCREEN
+#define XCellsOfScreen XCELLSOFSCREEN
+#define XChangeActivePointerGrab XCHANGEACTIVEPOINTERGRAB
+#define XChangeGC XCHANGEGC
+#define XChangeKeyboardControl XCHANGEKEYBOARDCONTROL
+#define XChangePointerControl XCHANGEPOINTERCONTROL
+#define XChangeProperty XCHANGEPROPERTY
+#define XChangeWindowAttributes XCHANGEWINDOWATTRIBUTES
+#define XCheckIfEvent XCHECKIFEVENT
+#define XCheckMaskEvent XCHECKMASKEVENT
+#define XCheckTypedEvent XCHECKTYPEDEVENT
+#define XCheckTypedWindowEvent XCHECKTYPEDWINDOWEVENT
+#define XCheckWindowEvent XCHECKWINDOWEVENT
+#define XClearArea XCLEARAREA
+#define XClearWindow XCLEARWINDOW
+#define XClipBox XCLIPBOX
+#define XCloseDisplay XCLOSEDISPLAY
+#define XCloseIM XCLOSEIM
+#define XConfigureWindow XCONFIGUREWINDOW
+#define XConvertSelection XCONVERTSELECTION
+#define XCopyArea XCOPYAREA
+#define XCopyColormapAndFree XCOPYCOLORMAPANDFREE
+#define XCopyGC XCOPYGC
+#define XCopyPlane XCOPYPLANE
+#define XCreateBitmapFromData XCREATEBITMAPFROMDATA
+#define XCreateColormap XCREATECOLORMAP
+#define XCreateFontCursor XCREATEFONTCURSOR
+#define XCreateFontSet XCREATEFONTSET
+#define XCreateGC XCREATEGC
+#define XCreateGlyphCursor XCREATEGLYPHCURSOR
+#define XCreateIC XCREATEIC
+#define XCreateImage XCREATEIMAGE
+#define XCreatePixmap XCREATEPIXMAP
+#define XCreatePixmapCursor XCREATEPIXMAPCURSOR
+#define XCreatePixmapFromBitmapData XCREATEPIXMAPFROMBITMAPDATA
+#define XCreateRegion XCREATEREGION
+#define XCreateSimpleWindow XCREATESIMPLEWINDOW
+#define XCreateWindow XCREATEWINDOW
+#define XDefaultColormap XDEFAULTCOLORMAP
+#define XDefaultColormapOfScreen XDEFAULTCOLORMAPOFSCREEN
+#define XDefaultDepth XDEFAULTDEPTH
+#define XDefaultDepthOfScreen XDEFAULTDEPTHOFSCREEN
+#define XDefaultGC XDEFAULTGC
+#define XDefaultRootWindow XDEFAULTROOTWINDOW
+#define XDefaultScreen XDEFAULTSCREEN
+#define XDefaultScreenOfDisplay XDEFAULTSCREENOFDISPLAY
+#define XDefaultVisual XDEFAULTVISUAL
+#define XDefaultVisualOfScreen XDEFAULTVISUALOFSCREEN
+#define XDefineCursor XDEFINECURSOR
+#define XDeleteContext XDELETECONTEXT
+#define XDeleteProperty XDELETEPROPERTY
+#define XDestroyIC XDESTROYIC
+#define XDestroyRegion XDESTROYREGION
+#define XDestroySubwindows XDESTROYSUBWINDOWS
+#define XDestroyWindow XDESTROYWINDOW
+#define XDisableAccessControl XDISABLEACCESSCONTROL
+#define XDisplayCells XDISPLAYCELLS
+#define XDisplayHeight XDISPLAYHEIGHT
+#define XDisplayKeycodes XDISPLAYKEYCODES
+#define XDisplayName XDISPLAYNAME
+#define XDisplayOfIM XDISPLAYOFIM
+#define XDisplayOfScreen XDISPLAYOFSCREEN
+#define XDisplayString XDISPLAYSTRING
+#define XDisplayWidth XDISPLAYWIDTH
+#define XDoesBackingStore XDOESBACKINGSTORE
+#define XDrawArc XDRAWARC
+#define XDrawArcs XDRAWARCS
+#define XDrawImageString XDRAWIMAGESTRING
+#define XDrawImageString16 XDRAWIMAGESTRING16
+#define XDrawLine XDRAWLINE
+#define XDrawLines XDRAWLINES
+#define XDrawPoint XDRAWPOINT
+#define XDrawPoints XDRAWPOINTS
+#define XDrawRectangle XDRAWRECTANGLE
+#define XDrawRectangles XDRAWRECTANGLES
+#define XDrawSegments XDRAWSEGMENTS
+#define XDrawString XDRAWSTRING
+#define XDrawString16 XDRAWSTRING16
+#define XDrawText XDRAWTEXT
+#define XDrawText16 XDRAWTEXT16
+#define XESetCloseDisplay XESETCLOSEDISPLAY
+#define XEmptyRegion XEMPTYREGION
+#define XEnableAccessControl XENABLEACCESSCONTROL
+#define XEqualRegion XEQUALREGION
+#define XEventsQueued XEVENTSQUEUED
+#define XExtendedMaxRequestSize XEXTENDEDMAXREQUESTSIZE
+#define XExtentsOfFontSet XEXTENTSOFFONTSET
+#define XFetchBuffer XFETCHBUFFER
+#define XFetchBytes XFETCHBYTES
+#define XFetchName XFETCHNAME
+#define XFillArc XFILLARC
+#define XFillArcs XFILLARCS
+#define XFillPolygon XFILLPOLYGON
+#define XFillRectangle XFILLRECTANGLE
+#define XFillRectangles XFILLRECTANGLES
+#define XFilterEvent XFILTEREVENT
+#define XFindContext XFINDCONTEXT
+#define XFlush XFLUSH
+#define XFontsOfFontSet XFONTSOFFONTSET
+#define XForceScreenSaver XFORCESCREENSAVER
+#define XFree XFREE
+#define XFreeColormap XFREECOLORMAP
+#define XFreeColors XFREECOLORS
+#define XFreeCursor XFREECURSOR
+#define XFreeDeviceList XFREEDEVICELIST
+#define XFreeDeviceState XFREEDEVICESTATE
+#define XFreeFont XFREEFONT
+#define XFreeFontInfo XFREEFONTINFO
+#define XFreeFontNames XFREEFONTNAMES
+#define XFreeFontSet XFREEFONTSET
+#define XFreeGC XFREEGC
+#define XFreeModifiermap XFREEMODIFIERMAP
+#define XFreePixmap XFREEPIXMAP
+#define XFreeStringList XFREESTRINGLIST
+#define XGContextFromGC XGCONTEXTFROMGC
+#define XGeometry XGEOMETRY
+#define XGetAtomName XGETATOMNAME
+#define XGetClassHint XGETCLASSHINT
+#define XGetCommand XGETCOMMAND
+#define XGetDefault XGETDEFAULT
+#define XGetErrorDatabaseText XGETERRORDATABASETEXT
+#define XGetErrorText XGETERRORTEXT
+#define XGetExtensionVersion XGETEXTENSIONVERSION
+#define XGetFontProperty XGETFONTPROPERTY
+#define XGetGCValues XGETGCVALUES
+#define XGetGeometry XGETGEOMETRY
+#define XGetICValues XGETICVALUES
+#define XGetIMValues XGETIMVALUES
+#define XGetIconName XGETICONNAME
+#define XGetIconSizes XGETICONSIZES
+#define XGetImage XGETIMAGE
+#define XGetInputFocus XGETINPUTFOCUS
+#define XGetKeyboardControl XGETKEYBOARDCONTROL
+#define XGetKeyboardMapping XGETKEYBOARDMAPPING
+#define XGetModifierMapping XGETMODIFIERMAPPING
+#define XGetMotionEvents XGETMOTIONEVENTS
+#define XGetNormalHints XGETNORMALHINTS
+#define XGetPointerControl XGETPOINTERCONTROL
+#define XGetPointerMapping XGETPOINTERMAPPING
+#define XGetRGBColormaps XGETRGBCOLORMAPS
+#define XGetScreenSaver XGETSCREENSAVER
+#define XGetSelectionOwner XGETSELECTIONOWNER
+#define XGetStandardColormap XGETSTANDARDCOLORMAP
+#define XGetSubImage XGETSUBIMAGE
+#define XGetTextProperty XGETTEXTPROPERTY
+#define XGetVisualInfo XGETVISUALINFO
+#define XGetWMColormapWindows XGETWMCOLORMAPWINDOWS
+#define XGetWMHints XGETWMHINTS
+#define XGetWMIconName XGETWMICONNAME
+#define XGetWMName XGETWMNAME
+#define XGetWMNormalHints XGETWMNORMALHINTS
+#define XGetWindowAttributes XGETWINDOWATTRIBUTES
+#define XGetWindowProperty XGETWINDOWPROPERTY
+#define XGrabButton XGRABBUTTON
+#define XGrabKeyboard XGRABKEYBOARD
+#define XGrabPointer XGRABPOINTER
+#define XGrabServer XGRABSERVER
+#define XHeightMMOfScreen XHEIGHTMMOFSCREEN
+#define XHeightOfScreen XHEIGHTOFSCREEN
+#define XIconifyWindow XICONIFYWINDOW
+#define XIfEvent XIFEVENT
+#define XInitExtension XINITEXTENSION
+#define XInitImage XINITIMAGE
+#define XInstallColormap XINSTALLCOLORMAP
+#define XInternAtom XINTERNATOM
+#define XInternAtoms XINTERNATOMS
+#define XIntersectRegion XINTERSECTREGION
+#define XKeycodeToKeysym XKEYCODETOKEYSYM
+#define XKeysymToKeycode XKEYSYMTOKEYCODE
+#define XKeysymToString XKEYSYMTOSTRING
+#define XKillClient XKILLCLIENT
+#define XListDepths XLISTDEPTHS
+#define XListFonts XLISTFONTS
+#define XListFontsWithInfo XLISTFONTSWITHINFO
+#define XListHosts XLISTHOSTS
+#define XListInputDevices XLISTINPUTDEVICES
+#define XListInstalledColormaps XLISTINSTALLEDCOLORMAPS
+#define XListPixmapFormats XLISTPIXMAPFORMATS
+#define XListProperties XLISTPROPERTIES
+#define XLoadFont XLOADFONT
+#define XLoadQueryFont XLOADQUERYFONT
+#define XLookupColor XLOOKUPCOLOR
+#define XLookupKeysym XLOOKUPKEYSYM
+#define XLookupString XLOOKUPSTRING
+#define XLowerWindow XLOWERWINDOW
+#define XMapRaised XMAPRAISED
+#define XMapSubwindows XMAPSUBWINDOWS
+#define XMapWindow XMAPWINDOW
+#define XMaskEvent XMASKEVENT
+#define XMatchVisualInfo XMATCHVISUALINFO
+#define XMaxRequestSize XMAXREQUESTSIZE
+#define XMissingExtension XMISSINGEXTENSION
+#define XMoveResizeWindow XMOVERESIZEWINDOW
+#define XMoveWindow XMOVEWINDOW
+#define XNextEvent XNEXTEVENT
+#define XNextRequest XNEXTREQUEST
+#define XNoOp XNOOP
+#define XOffsetRegion XOFFSETREGION
+#define XOpenDevice XOPENDEVICE
+#define XOpenDisplay XOPENDISPLAY
+#define XOpenIM XOPENIM
+#define XParseColor XPARSECOLOR
+#define XParseGeometry XPARSEGEOMETRY
+#define XPeekEvent XPEEKEVENT
+#define XPeekIfEvent XPEEKIFEVENT
+#define XPending XPENDING
+#define XPointInRegion XPOINTINREGION
+#define XPolygonRegion XPOLYGONREGION
+#define XPutBackEvent XPUTBACKEVENT
+#define XPutImage XPUTIMAGE
+#define XQLength XQLENGTH
+#define XQueryBestCursor XQUERYBESTCURSOR
+#define XQueryBestStipple XQUERYBESTSTIPPLE
+#define XQueryColor XQUERYCOLOR
+#define XQueryColors XQUERYCOLORS
+#define XQueryDeviceState XQUERYDEVICESTATE
+#define XQueryExtension XQUERYEXTENSION
+#define XQueryFont XQUERYFONT
+#define XQueryKeymap XQUERYKEYMAP
+#define XQueryPointer XQUERYPOINTER
+#define XQueryTree XQUERYTREE
+#define XRaiseWindow XRAISEWINDOW
+#define XReadBitmapFile XREADBITMAPFILE
+#define XRecolorCursor XRECOLORCURSOR
+#define XReconfigureWMWindow XRECONFIGUREWMWINDOW
+#define XRectInRegion XRECTINREGION
+#define XRefreshKeyboardMapping XREFRESHKEYBOARDMAPPING
+#define XRemoveHosts XREMOVEHOSTS
+#define XReparentWindow XREPARENTWINDOW
+#define XResetScreenSaver XRESETSCREENSAVER
+#define XResizeWindow XRESIZEWINDOW
+#define XResourceManagerString XRESOURCEMANAGERSTRING
+#define XRestackWindows XRESTACKWINDOWS
+#define XRotateBuffers XROTATEBUFFERS
+#define XRootWindow XROOTWINDOW
+#define XRootWindowOfScreen XROOTWINDOWOFSCREEN
+#define XSaveContext XSAVECONTEXT
+#define XScreenNumberOfScreen XSCREENNUMBEROFSCREEN
+#define XScreenOfDisplay XSCREENOFDISPLAY
+#define XSelectAsyncEvent XSELECTASYNCEVENT
+#define XSelectAsyncInput XSELECTASYNCINPUT
+#define XSelectExtensionEvent XSELECTEXTENSIONEVENT
+#define XSelectInput XSELECTINPUT
+#define XSendEvent XSENDEVENT
+#define XServerVendor XSERVERVENDOR
+#define XSetArcMode XSETARCMODE
+#define XSetBackground XSETBACKGROUND
+#define XSetClassHint XSETCLASSHINT
+#define XSetClipMask XSETCLIPMASK
+#define XSetClipOrigin XSETCLIPORIGIN
+#define XSetClipRectangles XSETCLIPRECTANGLES
+#define XSetCloseDownMode XSETCLOSEDOWNMODE
+#define XSetCommand XSETCOMMAND
+#define XSetDashes XSETDASHES
+#define XSetErrorHandler XSETERRORHANDLER
+#define XSetExtensionErrorHandler XSETEXTENSIONERRORHANDLER
+#define XSetFillRule XSETFILLRULE
+#define XSetFillStyle XSETFILLSTYLE
+#define XSetFont XSETFONT
+#define XSetForeground XSETFOREGROUND
+#define XSetFunction XSETFUNCTION
+#define XSetGraphicsExposures XSETGRAPHICSEXPOSURES
+#define XSetICFocus XSETICFOCUS
+#define XSetICValues XSETICVALUES
+#define XSetIOErrorHandler XSETIOERRORHANDLER
+#define XSetIconName XSETICONNAME
+#define XSetInputFocus XSETINPUTFOCUS
+#define XSetLineAttributes XSETLINEATTRIBUTES
+#define XSetLocaleModifiers XSETLOCALEMODIFIERS
+#define XSetNormalHints XSETNORMALHINTS
+#define XSetPlaneMask XSETPLANEMASK
+#define XSetRegion XSETREGION
+#define XSetRGBColormaps XSETRGBCOLORMAPS
+#define XSetScreenSaver XSETSCREENSAVER
+#define XSetSelectionOwner XSETSELECTIONOWNER
+#define XSetStandardProperties XSETSTANDARDPROPERTIES
+#define XSetState XSETSTATE
+#define XSetStipple XSETSTIPPLE
+#define XSetSubwindowMode XSETSUBWINDOWMODE
+#define XSetTSOrigin XSETTSORIGIN
+#define XSetTextProperty XSETTEXTPROPERTY
+#define XSetTile XSETTILE
+#define XSetTransientForHint XSETTRANSIENTFORHINT
+#define XSetWMClientMachine XSETWMCLIENTMACHINE
+#define XSetWMColormapWindows XSETWMCOLORMAPWINDOWS
+#define XSetWMHints XSETWMHINTS
+#define XSetWMIconName XSETWMICONNAME
+#define XSetWMName XSETWMNAME
+#define XSetWMNormalHints XSETWMNORMALHINTS
+#define XSetWMProperties XSETWMPROPERTIES
+#define XSetWMProtocols XSETWMPROTOCOLS
+#define XSetWMSizeHints XSETWMSIZEHINTS
+#define XSetWindowBackground XSETWINDOWBACKGROUND
+#define XSetWindowBackgroundPixmap XSETWINDOWBACKGROUNDPIXMAP
+#define XSetWindowBorder XSETWINDOWBORDER
+#define XSetWindowBorderPixmap XSETWINDOWBORDERPIXMAP
+#define XSetWindowBorderWidth XSETWINDOWBORDERWIDTH
+#define XSetWindowColormap XSETWINDOWCOLORMAP
+#define XShapeCombineMask XSHAPECOMBINEMASK
+#define XShapeCombineRectangles XSHAPECOMBINERECTANGLES
+#define XShapeGetRectangles XSHAPEGETRECTANGLES
+#define XShapeQueryExtension XSHAPEQUERYEXTENSION
+#define XShmAttach XSHMATTACH
+#define XShmCreateImage XSHMCREATEIMAGE
+#define XShmCreatePixmap XSHMCREATEPIXMAP
+#define XShmDetach XSHMDETACH
+#define XShmGetEventBase XSHMGETEVENTBASE
+#define XShmPutImage XSHMPUTIMAGE
+#define XShmQueryExtension XSHMQUERYEXTENSION
+#define XShmQueryVersion XSHMQUERYVERSION
+#define XShrinkRegion XSHRINKREGION
+#define XStoreBuffer XSTOREBUFFER
+#define XStoreBytes XSTOREBYTES
+#define XStoreColor XSTORECOLOR
+#define XStoreColors XSTORECOLORS
+#define XStoreName XSTORENAME
+#define XStringListToTextProperty XSTRINGLISTTOTEXTPROPERTY
+#define XStringToKeysym XSTRINGTOKEYSYM
+#define XSubtractRegion XSUBTRACTREGION
+#define XSupportsLocale XSUPPORTSLOCALE
+#define XSync XSYNC
+#define XSynchronize XSYNCHRONIZE
+#define XTextExtents XTEXTEXTENTS
+#define XTextExtents16 XTEXTEXTENTS16
+#define XTextPropertyToStringList XTEXTPROPERTYTOSTRINGLIST
+#define XTextWidth XTEXTWIDTH
+#define XTextWidth16 XTEXTWIDTH16
+#define XTranslateCoordinates XTRANSLATECOORDINATES
+#define XUndefineCursor XUNDEFINECURSOR
+#define XUngrabButton XUNGRABBUTTON
+#define XUngrabKeyboard XUNGRABKEYBOARD
+#define XUngrabPointer XUNGRABPOINTER
+#define XUngrabServer XUNGRABSERVER
+#define XUninstallColormap XUNINSTALLCOLORMAP
+#define XUnionRectWithRegion XUNIONRECTWITHREGION
+#define XUnionRegion XUNIONREGION
+#define XUniqueContext XUNIQUECONTEXT
+#define XUnloadFont XUNLOADFONT
+#define XUnmapWindow XUNMAPWINDOW
+#define XUnsetICFocus XUNSETICFOCUS
+#define XVaCreateNestedList XVACREATENESTEDLIST
+#define XVisualIDFromVisual XVISUALIDFROMVISUAL
+#define XWMGeometry XWMGEOMETRY
+#define XWarpPointer XWARPPOINTER
+#define XWhitePixel XWHITEPIXEL
+#define XWhitePixelOfScreen XWHITEPIXELOFSCREEN
+#define XWidthMMOfScreen XWIDTHMMOFSCREEN
+#define XWidthOfScreen XWIDTHOFSCREEN
+#define XWindowEvent XWINDOWEVENT
+#define XWithdrawWindow XWITHDRAWWINDOW
+#define XXorRegion XXORREGION
+#define XcmsQueryColor XCMSQUERYCOLOR
+#define XdbeAllocateBackBufferName XDBEALLOCATEBACKBUFFERNAME
+#define XdbeFreeVisualInfo XDBEFREEVISUALINFO
+#define XdbeGetVisualInfo XDBEGETVISUALINFO
+#define XdbeQueryExtension XDBEQUERYEXTENSION
+#define XdbeSwapBuffers XDBESWAPBUFFERS
+#define XextAddDisplay XEXTADDDISPLAY
+#define XextFindDisplay XEXTFINDDISPLAY
+#define XextRemoveDisplay XEXTREMOVEDISPLAY
+#define XkbSetDetectableAutoRepeat XKBSETDETECTABLEAUTOREPEAT
+#define XmActivateProtocol XMACTIVATEPROTOCOL
+#define XmAddProtocolCallback XMADDPROTOCOLCALLBACK
+#define XmAddProtocols XMADDPROTOCOLS
+#define XmChangeColor XMCHANGECOLOR
+#define XmClipboardCopy XMCLIPBOARDCOPY
+#define XmClipboardCopyByName XMCLIPBOARDCOPYBYNAME
+#define XmClipboardEndCopy XMCLIPBOARDENDCOPY
+#define XmClipboardEndRetrieve XMCLIPBOARDENDRETRIEVE
+#define XmClipboardInquireCount XMCLIPBOARDINQUIRECOUNT
+#define XmClipboardInquireFormat XMCLIPBOARDINQUIREFORMAT
+#define XmClipboardInquireLength XMCLIPBOARDINQUIRELENGTH
+#define XmClipboardLock XMCLIPBOARDLOCK
+#define XmClipboardRetrieve XMCLIPBOARDRETRIEVE
+#define XmClipboardStartCopy XMCLIPBOARDSTARTCOPY
+#define XmClipboardStartRetrieve XMCLIPBOARDSTARTRETRIEVE
+#define XmClipboardUnlock XMCLIPBOARDUNLOCK
+#define XmCommandError XMCOMMANDERROR
+#define XmCommandGetChild XMCOMMANDGETCHILD
+#define XmCommandSetValue XMCOMMANDSETVALUE
+#define XmCreateArrowButton XMCREATEARROWBUTTON
+#define XmCreateArrowButtonGadget XMCREATEARROWBUTTONGADGET
+#define XmCreateBulletinBoardDialog XMCREATEBULLETINBOARDDIALOG
+#define XmCreateCascadeButton XMCREATECASCADEBUTTON
+#define XmCreateCascadeButtonGadget XMCREATECASCADEBUTTONGADGET
+#define XmCreateDialogShell XMCREATEDIALOGSHELL
+#define XmCreateDragIcon XMCREATEDRAGICON
+#define XmCreateDrawingArea XMCREATEDRAWINGAREA
+#define XmCreateDrawnButton XMCREATEDRAWNBUTTON
+#define XmCreateErrorDialog XMCREATEERRORDIALOG
+#define XmCreateFileSelectionBox XMCREATEFILESELECTIONBOX
+#define XmCreateFileSelectionDialog XMCREATEFILESELECTIONDIALOG
+#define XmCreateForm XMCREATEFORM
+#define XmCreateFormDialog XMCREATEFORMDIALOG
+#define XmCreateFrame XMCREATEFRAME
+#define XmCreateInformationDialog XMCREATEINFORMATIONDIALOG
+#define XmCreateLabel XMCREATELABEL
+#define XmCreateLabelGadget XMCREATELABELGADGET
+#define XmCreateList XMCREATELIST
+#define XmCreateMainWindow XMCREATEMAINWINDOW
+#define XmCreateMenuBar XMCREATEMENUBAR
+#define XmCreateMessageBox XMCREATEMESSAGEBOX
+#define XmCreateMessageDialog XMCREATEMESSAGEDIALOG
+#define XmCreateOptionMenu XMCREATEOPTIONMENU
+#define XmCreatePanedWindow XMCREATEPANEDWINDOW
+#define XmCreatePopupMenu XMCREATEPOPUPMENU
+#define XmCreatePromptDialog XMCREATEPROMPTDIALOG
+#define XmCreatePulldownMenu XMCREATEPULLDOWNMENU
+#define XmCreatePushButton XMCREATEPUSHBUTTON
+#define XmCreatePushButtonGadget XMCREATEPUSHBUTTONGADGET
+#define XmCreateQuestionDialog XMCREATEQUESTIONDIALOG
+#define XmCreateRadioBox XMCREATERADIOBOX
+#define XmCreateRowColumn XMCREATEROWCOLUMN
+#define XmCreateScale XMCREATESCALE
+#define XmCreateScrollBar XMCREATESCROLLBAR
+#define XmCreateScrolledList XMCREATESCROLLEDLIST
+#define XmCreateScrolledText XMCREATESCROLLEDTEXT
+#define XmCreateScrolledWindow XMCREATESCROLLEDWINDOW
+#define XmCreateSelectionDialog XMCREATESELECTIONDIALOG
+#define XmCreateSeparator XMCREATESEPARATOR
+#define XmCreateSeparatorGadget XMCREATESEPARATORGADGET
+#define XmCreateSimpleMenuBar XMCREATESIMPLEMENUBAR
+#define XmCreateTemplateDialog XMCREATETEMPLATEDIALOG
+#define XmCreateText XMCREATETEXT
+#define XmCreateTextField XMCREATETEXTFIELD
+#define XmCreateToggleButton XMCREATETOGGLEBUTTON
+#define XmCreateToggleButtonGadget XMCREATETOGGLEBUTTONGADGET
+#define XmCreateWarningDialog XMCREATEWARNINGDIALOG
+#define XmCvtCTToXmString XMCVTCTTOXMSTRING
+#define XmDestroyPixmap XMDESTROYPIXMAP
+#define XmDragStart XMDRAGSTART
+#define XmDropSiteRegister XMDROPSITEREGISTER
+#define XmDropSiteUnregister XMDROPSITEUNREGISTER
+#define XmDropSiteUpdate XMDROPSITEUPDATE
+#define XmDropTransferStart XMDROPTRANSFERSTART
+#define XmFileSelectionBoxGetChild XMFILESELECTIONBOXGETCHILD
+#define XmFileSelectionDoSearch XMFILESELECTIONDOSEARCH
+#define XmFontListAppendEntry XMFONTLISTAPPENDENTRY
+#define XmFontListCopy XMFONTLISTCOPY
+#define XmFontListCreate XMFONTLISTCREATE
+#define XmFontListEntryCreate XMFONTLISTENTRYCREATE
+#define XmFontListEntryFree XMFONTLISTENTRYFREE
+#define XmFontListEntryGetFont XMFONTLISTENTRYGETFONT
+#define XmFontListEntryGetTag XMFONTLISTENTRYGETTAG
+#define XmFontListEntryLoad XMFONTLISTENTRYLOAD
+#define XmFontListFree XMFONTLISTFREE
+#define XmFontListFreeFontContext XMFONTLISTFREEFONTCONTEXT
+#define XmFontListGetNextFont XMFONTLISTGETNEXTFONT
+#define XmFontListInitFontContext XMFONTLISTINITFONTCONTEXT
+#define XmFontListNextEntry XMFONTLISTNEXTENTRY
+#define XmGetColors XMGETCOLORS
+#define XmGetColorCalculation XMGETCOLORCALCULATION
+#define XmGetFocusWidget XMGETFOCUSWIDGET
+#define XmGetMenuCursor XMGETMENUCURSOR
+#define XmGetPixmap XMGETPIXMAP
+#define XmGetPixmapByDepth XMGETPIXMAPBYDEPTH
+#define XmGetTearOffControl XMGETTEAROFFCONTROL
+#define XmGetXmDisplay XMGETXMDISPLAY
+#define XmImMbLookupString XMIMMBLOOKUPSTRING
+#define XmImRegister XMIMREGISTER
+#define XmImSetFocusValues XMIMSETFOCUSVALUES
+#define XmImSetValues XMIMSETVALUES
+#define XmImUnregister XMIMUNREGISTER
+#define XmImUnsetFocus XMIMUNSETFOCUS
+#define XmInstallImage XMINSTALLIMAGE
+#define XmInternAtom XMINTERNATOM
+#define XmIsMotifWMRunning XMISMOTIFWMRUNNING
+#define XmListAddItem XMLISTADDITEM
+#define XmListAddItemUnselected XMLISTADDITEMUNSELECTED
+#define XmListAddItems XMLISTADDITEMS
+#define XmListAddItemsUnselected XMLISTADDITEMSUNSELECTED
+#define XmListDeleteAllItems XMLISTDELETEALLITEMS
+#define XmListDeleteItem XMLISTDELETEITEM
+#define XmListDeleteItemsPos XMLISTDELETEITEMSPOS
+#define XmListDeletePos XMLISTDELETEPOS
+#define XmListDeselectAllItems XMLISTDESELECTALLITEMS
+#define XmListDeselectPos XMLISTDESELECTPOS
+#define XmListGetKbdItemPos XMLISTGETKBDITEMPOS
+#define XmListGetMatchPos XMLISTGETMATCHPOS
+#define XmListGetSelectedPos XMLISTGETSELECTEDPOS
+#define XmListItemExists XMLISTITEMEXISTS
+#define XmListItemPos XMLISTITEMPOS
+#define XmListPosSelected XMLISTPOSSELECTED
+#define XmListReplaceItems XMLISTREPLACEITEMS
+#define XmListReplaceItemsPos XMLISTREPLACEITEMSPOS
+#define XmListSelectItem XMLISTSELECTITEM
+#define XmListSelectPos XMLISTSELECTPOS
+#define XmListSetBottomPos XMLISTSETBOTTOMPOS
+#define XmListSetItem XMLISTSETITEM
+#define XmListSetKbdItemPos XMLISTSETKBDITEMPOS
+#define XmListSetPos XMLISTSETPOS
+#define XmMainWindowSetAreas XMMAINWINDOWSETAREAS
+#define XmMenuPosition XMMENUPOSITION
+#define XmMessageBoxGetChild XMMESSAGEBOXGETCHILD
+#define XmOptionButtonGadget XMOPTIONBUTTONGADGET
+#define XmOptionLabelGadget XMOPTIONLABELGADGET
+#define XmProcessTraversal XMPROCESSTRAVERSAL
+#define XmQmotif XMQMOTIF
+#define XmRemoveProtocolCallback XMREMOVEPROTOCOLCALLBACK
+#define XmRemoveProtocols XMREMOVEPROTOCOLS
+#define XmRemoveTabGroup XMREMOVETABGROUP
+#define XmRepTypeGetId XMREPTYPEGETID
+#define XmRepTypeGetRecord XMREPTYPEGETRECORD
+#define XmRepTypeInstallTearOffModelCon XMREPTYPEINSTALLTEAROFFMODELCON
+#define XmRepTypeRegister XMREPTYPEREGISTER
+#define XmRepTypeValidValue XMREPTYPEVALIDVALUE
+#define XmScrollBarGetValues XMSCROLLBARGETVALUES
+#define XmScrollBarSetValues XMSCROLLBARSETVALUES
+#define XmScrolledWindowSetAreas XMSCROLLEDWINDOWSETAREAS
+#define XmSelectionBoxGetChild XMSELECTIONBOXGETCHILD
+#define XmSetColorCalculation XMSETCOLORCALCULATION
+#define XmStringByteCompare XMSTRINGBYTECOMPARE
+#define XmStringCompare XMSTRINGCOMPARE
+#define XmStringConcat XMSTRINGCONCAT
+#define XmStringCopy XMSTRINGCOPY
+#define XmStringCreate XMSTRINGCREATE
+#define XmStringCreateLocalized XMSTRINGCREATELOCALIZED
+#define XmStringCreateLtoR XMSTRINGCREATELTOR
+#define XmStringCreateSimple XMSTRINGCREATESIMPLE
+#define XmStringDraw XMSTRINGDRAW
+#define XmStringDrawUnderline XMSTRINGDRAWUNDERLINE
+#define XmStringExtent XMSTRINGEXTENT
+#define XmStringFree XMSTRINGFREE
+#define XmStringFreeContext XMSTRINGFREECONTEXT
+#define XmStringGetLtoR XMSTRINGGETLTOR
+#define XmStringGetNextComponent XMSTRINGGETNEXTCOMPONENT
+#define XmStringGetNextSegment XMSTRINGGETNEXTSEGMENT
+#define XmStringInitContext XMSTRINGINITCONTEXT
+#define XmStringLength XMSTRINGLENGTH
+#define XmStringLtoRCreate XMSTRINGLTORCREATE
+#define XmStringNConcat XMSTRINGNCONCAT
+#define XmStringSegmentCreate XMSTRINGSEGMENTCREATE
+#define XmStringSeparatorCreate XMSTRINGSEPARATORCREATE
+#define XmStringWidth XMSTRINGWIDTH
+#define XmTextClearSelection XMTEXTCLEARSELECTION
+#define XmTextCopy XMTEXTCOPY
+#define XmTextCut XMTEXTCUT
+#define XmTextFieldClearSelection XMTEXTFIELDCLEARSELECTION
+#define XmTextFieldCopy XMTEXTFIELDCOPY
+#define XmTextFieldCut XMTEXTFIELDCUT
+#define XmTextFieldGetEditable XMTEXTFIELDGETEDITABLE
+#define XmTextFieldGetInsertionPosition XMTEXTFIELDGETINSERTIONPOSITION
+#define XmTextFieldGetLastPosition XMTEXTFIELDGETLASTPOSITION
+#define XmTextFieldGetMaxLength XMTEXTFIELDGETMAXLENGTH
+#define XmTextFieldGetSelection XMTEXTFIELDGETSELECTION
+#define XmTextFieldGetSelectionPosition XMTEXTFIELDGETSELECTIONPOSITION
+#define XmTextFieldGetString XMTEXTFIELDGETSTRING
+#define XmTextFieldInsert XMTEXTFIELDINSERT
+#define XmTextFieldPaste XMTEXTFIELDPASTE
+#define XmTextFieldRemove XMTEXTFIELDREMOVE
+#define XmTextFieldReplace XMTEXTFIELDREPLACE
+#define XmTextFieldSetAddMode XMTEXTFIELDSETADDMODE
+#define XmTextFieldSetHighlight XMTEXTFIELDSETHIGHLIGHT
+#define XmTextFieldSetInsertionPosition XMTEXTFIELDSETINSERTIONPOSITION
+#define XmTextFieldSetMaxLength XMTEXTFIELDSETMAXLENGTH
+#define XmTextFieldSetSelection XMTEXTFIELDSETSELECTION
+#define XmTextFieldSetString XMTEXTFIELDSETSTRING
+#define XmTextFieldShowPosition XMTEXTFIELDSHOWPOSITION
+#define XmTextGetCursorPosition XMTEXTGETCURSORPOSITION
+#define XmTextGetEditable XMTEXTGETEDITABLE
+#define XmTextGetInsertionPosition XMTEXTGETINSERTIONPOSITION
+#define XmTextGetLastPosition XMTEXTGETLASTPOSITION
+#define XmTextGetMaxLength XMTEXTGETMAXLENGTH
+#define XmTextGetSelection XMTEXTGETSELECTION
+#define XmTextGetSelectionPosition XMTEXTGETSELECTIONPOSITION
+#define XmTextGetString XMTEXTGETSTRING
+#define XmTextInsert XMTEXTINSERT
+#define XmTextPaste XMTEXTPASTE
+#define XmTextPosToXY XMTEXTPOSTOXY
+#define XmTextRemove XMTEXTREMOVE
+#define XmTextReplace XMTEXTREPLACE
+#define XmTextSetCursorPosition XMTEXTSETCURSORPOSITION
+#define XmTextSetEditable XMTEXTSETEDITABLE
+#define XmTextSetHighlight XMTEXTSETHIGHLIGHT
+#define XmTextSetInsertionPosition XMTEXTSETINSERTIONPOSITION
+#define XmTextSetSelection XMTEXTSETSELECTION
+#define XmTextSetString XMTEXTSETSTRING
+#define XmTextSetTopCharacter XMTEXTSETTOPCHARACTER
+#define XmTextShowPosition XMTEXTSHOWPOSITION
+#define XmToggleButtonGadgetGetState XMTOGGLEBUTTONGADGETGETSTATE
+#define XmToggleButtonGadgetSetState XMTOGGLEBUTTONGADGETSETSTATE
+#define XmToggleButtonGetState XMTOGGLEBUTTONGETSTATE
+#define XmToggleButtonSetState XMTOGGLEBUTTONSETSTATE
+#define XmUninstallImage XMUNINSTALLIMAGE
+#define XmUpdateDisplay XMUPDATEDISPLAY
+#define XmVaCreateSimpleRadioBox XMVACREATESIMPLERADIOBOX
+#define XmbDrawString XMBDRAWSTRING
+#define XmbLookupString XMBLOOKUPSTRING
+#define XmbResetIC XMBRESETIC
+#define XmbSetWMProperties XMBSETWMPROPERTIES
+#define XmbTextEscapement XMBTEXTESCAPEMENT
+#define XmbTextExtents XMBTEXTEXTENTS
+#define XmbTextListToTextProperty XMBTEXTLISTTOTEXTPROPERTY
+#define XmbTextPropertyToTextList XMBTEXTPROPERTYTOTEXTLIST
+#define XmbufCreateBuffers XMBUFCREATEBUFFERS
+#define XmbufDestroyBuffers XMBUFDESTROYBUFFERS
+#define XmbufDisplayBuffers XMBUFDISPLAYBUFFERS
+#define XmbufQueryExtension XMBUFQUERYEXTENSION
+#define Xmemory_free XMEMORY_FREE
+#define Xmemory_malloc XMEMORY_MALLOC
+#define XmuClientWindow XMUCLIENTWINDOW
+#define XmuConvertStandardSelection XMUCONVERTSTANDARDSELECTION
+#define XmuCvtStringToBitmap XMUCVTSTRINGTOBITMAP
+#define XmuInternAtom XMUINTERNATOM
+#define XmuInternStrings XMUINTERNSTRINGS
+#define XmuLookupStandardColormap XMULOOKUPSTANDARDCOLORMAP
+#define XmuPrintDefaultErrorMessage XMUPRINTDEFAULTERRORMESSAGE
+#define XrmCombineDatabase XRMCOMBINEDATABASE
+#define XrmCombineFileDatabase XRMCOMBINEFILEDATABASE
+#define XrmDestroyDatabase XRMDESTROYDATABASE
+#define XrmGetDatabase XRMGETDATABASE
+#define XrmGetFileDatabase XRMGETFILEDATABASE
+#define XrmGetResource XRMGETRESOURCE
+#define XrmGetStringDatabase XRMGETSTRINGDATABASE
+#define XrmInitialize XRMINITIALIZE
+#define XrmMergeDatabases XRMMERGEDATABASES
+#define XrmParseCommand XRMPARSECOMMAND
+#define XrmPermStringToQuark XRMPERMSTRINGTOQUARK
+#define XrmPutFileDatabase XRMPUTFILEDATABASE
+#define XrmPutLineResource XRMPUTLINERESOURCE
+#define XrmPutStringResource XRMPUTSTRINGRESOURCE
+#define XrmQGetResource XRMQGETRESOURCE
+#define XrmQPutStringResource XRMQPUTSTRINGRESOURCE
+#define XrmQuarkToString XRMQUARKTOSTRING
+#define XrmSetDatabase XRMSETDATABASE
+#define XrmStringToBindingQuarkList XRMSTRINGTOBINDINGQUARKLIST
+#define XrmStringToQuark XRMSTRINGTOQUARK
+#define XtAddCallback XTADDCALLBACK
+#define XtAddCallbacks XTADDCALLBACKS
+#define XtAddConverter XTADDCONVERTER
+#define XtAddEventHandler XTADDEVENTHANDLER
+#define XtAddExposureToRegion XTADDEXPOSURETOREGION
+#define XtAddGrab XTADDGRAB
+#define XtAddRawEventHandler XTADDRAWEVENTHANDLER
+#define XtAllocateGC XTALLOCATEGC
+#define XtAppAddActions XTAPPADDACTIONS
+#define XtAppAddInput XTAPPADDINPUT
+#define XtAppAddTimeOut XTAPPADDTIMEOUT
+#define XtAppAddWorkProc XTAPPADDWORKPROC
+#define XtAppCreateShell XTAPPCREATESHELL
+#define XtAppError XTAPPERROR
+#define XtAppErrorMsg XTAPPERRORMSG
+#define XtAppGetErrorDatabase XTAPPGETERRORDATABASE
+#define XtAppGetErrorDatabaseText XTAPPGETERRORDATABASETEXT
+#define XtAppSetErrorMsgHandler XTAPPSETERRORMSGHANDLER
+#define XtAppInitialize XTAPPINITIALIZE
+#define XtAppMainLoop XTAPPMAINLOOP
+#define XtAppNextEvent XTAPPNEXTEVENT
+#define XtAppPeekEvent XTAPPPEEKEVENT
+#define XtAppPending XTAPPPENDING
+#define XtAppProcessEvent XTAPPPROCESSEVENT
+#define XtAppSetErrorHandler XTAPPSETERRORHANDLER
+#define XtAppSetFallbackResources XTAPPSETFALLBACKRESOURCES
+#define XtAppSetTypeConverter XTAPPSETTYPECONVERTER
+#define XtAppSetWarningHandler XTAPPSETWARNINGHANDLER
+#define XtAppWarningMsg XTAPPWARNINGMSG
+#define XtAppSetWarningMsgHandler XTAPPSETWARNINGMSGHANDLER
+#define XtAppWarning XTAPPWARNING
+#define XtAugmentTranslations XTAUGMENTTRANSLATIONS
+#define XtCallActionProc XTCALLACTIONPROC
+#define XtCallCallbackList XTCALLCALLBACKLIST
+#define XtCallCallbacks XTCALLCALLBACKS
+#define XtCallConverter XTCALLCONVERTER
+#define XtCalloc XTCALLOC
+#ifndef NOXTDISPLAY
+#define XtClass XTCLASS
+#endif
+#define XtCloseDisplay XTCLOSEDISPLAY
+#define XtConfigureWidget XTCONFIGUREWIDGET
+#define XtConvert XTCONVERT
+#define XtConvertAndStore XTCONVERTANDSTORE
+#define XtCreateApplicationContext XTCREATEAPPLICATIONCONTEXT
+#define XtCreateManagedWidget XTCREATEMANAGEDWIDGET
+#define XtCreatePopupShell XTCREATEPOPUPSHELL
+#define XtCreateWidget XTCREATEWIDGET
+#define XtCreateWindow XTCREATEWINDOW
+#define XtCvtStringToFont XTCVTSTRINGTOFONT
+#define XtDatabase XTDATABASE
+#define XtDestroyApplicationContext XTDESTROYAPPLICATIONCONTEXT
+#define XtDestroyWidget XTDESTROYWIDGET
+#define XtDisownSelection XTDISOWNSELECTION
+#define XtDispatchEvent XTDISPATCHEVENT
+#ifndef NOXTDISPLAY
+#define XtDisplay XTDISPLAY
+#endif
+#define XtDisplayInitialize XTDISPLAYINITIALIZE
+#define XtDisplayOfObject XTDISPLAYOFOBJECT
+#define XtDisplayStringConvWarning XTDISPLAYSTRINGCONVWARNING
+#define XtDisplayToApplicationContext XTDISPLAYTOAPPLICATIONCONTEXT
+#define XtError XTERROR
+#define XtErrorMsg XTERRORMSG
+#define XtFree XTFREE
+#define XtGetActionKeysym XTGETACTIONKEYSYM
+#define XtGetActionList XTGETACTIONLIST
+#define XtGetApplicationNameAndClass XTGETAPPLICATIONNAMEANDCLASS
+#define XtGetApplicationResources XTGETAPPLICATIONRESOURCES
+#define XtGetClassExtension XTGETCLASSEXTENSION
+#define XtGetConstraintResourceList XTGETCONSTRAINTRESOURCELIST
+#define XtGetGC XTGETGC
+#define XtGetMultiClickTime XTGETMULTICLICKTIME
+#define XtGetResourceList XTGETRESOURCELIST
+#define XtGetSelectionValue XTGETSELECTIONVALUE
+#define XtGetSelectionValues XTGETSELECTIONVALUES
+#define XtGetSubresources XTGETSUBRESOURCES
+#define XtGetValues XTGETVALUES
+#define XtGrabButton XTGRABBUTTON
+#define XtGrabKeyboard XTGRABKEYBOARD
+#define XtGrabPointer XTGRABPOINTER
+#define XtHasCallbacks XTHASCALLBACKS
+#define XtInitialize XTINITIALIZE
+#define XtInitializeWidgetClass XTINITIALIZEWIDGETCLASS
+#define XtInsertEventHandler XTINSERTEVENTHANDLER
+#define XtInsertRawEventHandler XTINSERTRAWEVENTHANDLER
+#define XtInstallAccelerators XTINSTALLACCELERATORS
+#define XtIsManaged XTISMANAGED
+#define XtIsObject XTISOBJECT
+#ifndef NOXTDISPLAY
+#define XtIsRealized XTISREALIZED
+#endif
+#define XtIsSensitive XTISSENSITIVE
+#define XtIsSubclass XTISSUBCLASS
+#define XtLastTimestampProcessed XTLASTTIMESTAMPPROCESSED
+#define XtMainLoop XTMAINLOOP
+#define XtMakeGeometryRequest XTMAKEGEOMETRYREQUEST
+#define XtMakeResizeRequest XTMAKERESIZEREQUEST
+#define XtMalloc XTMALLOC
+#define XtManageChild XTMANAGECHILD
+#define XtManageChildren XTMANAGECHILDREN
+#define XtMergeArgLists XTMERGEARGLISTS
+#define XtMoveWidget XTMOVEWIDGET
+#define XtName XTNAME
+#define XtNameToWidget XTNAMETOWIDGET
+#define XtOpenApplication XTOPENAPPLICATION
+#define XtOpenDisplay XTOPENDISPLAY
+#define XtOverrideTranslations XTOVERRIDETRANSLATIONS
+#define XtOwnSelection XTOWNSELECTION
+#ifndef NOXTDISPLAY
+#define XtParent XTPARENT
+#endif
+#define XtParseAcceleratorTable XTPARSEACCELERATORTABLE
+#define XtParseTranslationTable XTPARSETRANSLATIONTABLE
+#define XtPopdown XTPOPDOWN
+#define XtPopup XTPOPUP
+#define XtPopupSpringLoaded XTPOPUPSPRINGLOADED
+#define XtQueryGeometry XTQUERYGEOMETRY
+#define XtRealizeWidget XTREALIZEWIDGET
+#define XtRealloc XTREALLOC
+#define XtRegisterDrawable _XTREGISTERWINDOW
+#define XtRegisterGrabAction XTREGISTERGRABACTION
+#define XtReleaseGC XTRELEASEGC
+#define XtRemoveAllCallbacks XTREMOVEALLCALLBACKS
+#define XtRemoveCallback XTREMOVECALLBACK
+#define XtRemoveEventHandler XTREMOVEEVENTHANDLER
+#define XtRemoveGrab XTREMOVEGRAB
+#define XtRemoveInput XTREMOVEINPUT
+#define XtRemoveTimeOut XTREMOVETIMEOUT
+#define XtRemoveWorkProc XTREMOVEWORKPROC
+#define XtResizeWidget XTRESIZEWIDGET
+#define XtResolvePathname XTRESOLVEPATHNAME
+#ifndef NOXTDISPLAY
+#define XtScreen XTSCREEN
+#endif
+#define XtScreenDatabase XTSCREENDATABASE
+#define XtScreenOfObject XTSCREENOFOBJECT
+#define XtSessionReturnToken XTSESSIONRETURNTOKEN
+#define XtSetErrorHandler XTSETERRORHANDLER
+#define XtSetKeyboardFocus XTSETKEYBOARDFOCUS
+#define XtSetLanguageProc XTSETLANGUAGEPROC
+#define XtSetMappedWhenManaged XTSETMAPPEDWHENMANAGED
+#define XtSetSensitive XTSETSENSITIVE
+#define XtSetTypeConverter XTSETTYPECONVERTER
+#define XtSetValues XTSETVALUES
+#define XtShellStrings XTSHELLSTRINGS
+#define XtStringConversionWarning XTSTRINGCONVERSIONWARNING
+#define XtStrings XTSTRINGS
+#define XtToolkitInitialize XTTOOLKITINITIALIZE
+#define XtTranslateCoords XTTRANSLATECOORDS
+#define XtTranslateKeycode XTTRANSLATEKEYCODE
+#define XtUngrabButton XTUNGRABBUTTON
+#define XtUngrabKeyboard XTUNGRABKEYBOARD
+#define XtUngrabPointer XTUNGRABPOINTER
+#define XtUnmanageChild XTUNMANAGECHILD
+#define XtUnmanageChildren XTUNMANAGECHILDREN
+#define XtUnrealizeWidget XTUNREALIZEWIDGET
+#define XtUnregisterDrawable _XTUNREGISTERWINDOW
+#define XtVaAppCreateShell XTVAAPPCREATESHELL
+#define XtVaCreateManagedWidget XTVACREATEMANAGEDWIDGET
+#define XtVaCreatePopupShell XTVACREATEPOPUPSHELL
+#define XtVaCreateWidget XTVACREATEWIDGET
+#define XtVaGetApplicationResources XTVAGETAPPLICATIONRESOURCES
+#define XtVaGetValues XTVAGETVALUES
+#define XtVaSetValues XTVASETVALUES
+#define XtWarning XTWARNING
+#define XtWarningMsg XTWARNINGMSG
+#define XtWidgetToApplicationContext XTWIDGETTOAPPLICATIONCONTEXT
+#ifndef NOXTDISPLAY
+#define XtWindow XTWINDOW
+#endif
+#define XtWindowOfObject XTWINDOWOFOBJECT
+#define XtWindowToWidget XTWINDOWTOWIDGET
+#define XwcDrawImageString XWCDRAWIMAGESTRING
+#define XwcDrawString XWCDRAWSTRING
+#define XwcFreeStringList XWCFREESTRINGLIST
+#define XwcTextEscapement XWCTEXTESCAPEMENT
+#define XwcTextExtents XWCTEXTEXTENTS
+#define XwcTextListToTextProperty XWCTEXTLISTTOTEXTPROPERTY
+#define XwcLookupString XWCLOOKUPSTRING
+#define XwcTextPropertyToTextList XWCTEXTPROPERTYTOTEXTLIST
+#define _XAllocTemp _XALLOCTEMP
+#define _XDeqAsyncHandler _XDEQASYNCHANDLER
+#define _XEatData _XEATDATA
+#define _XFlush _XFLUSH
+#define _XFreeTemp _XFREETEMP
+#define _XGetAsyncReply _XGETASYNCREPLY
+#define _XInitImageFuncPtrs _XINITIMAGEFUNCPTRS
+#define _XRead _XREAD
+#define _XReadPad _XREADPAD
+#define _XRegisterFilterByType _XREGISTERFILTERBYTYPE
+#define _XReply _XREPLY
+#define _XSend _XSEND
+#define _XUnregisterFilter _XUNREGISTERFILTER
+#define _XVIDtoVisual _XVIDTOVISUAL
+#define _XmBottomShadowColorDefault _XMBOTTOMSHADOWCOLORDEFAULT
+#define _XmClearBorder _XMCLEARBORDER
+#define _XmConfigureObject _XMCONFIGUREOBJECT
+#define _XmDestroyParentCallback _XMDESTROYPARENTCALLBACK
+#define _XmDrawArrow _XMDRAWARROW
+#define _XmDrawShadows _XMDRAWSHADOWS
+#define _XmFontListGetDefaultFont _XMFONTLISTGETDEFAULTFONT
+#define _XmFromHorizontalPixels _XMFROMHORIZONTALPIXELS
+#define _XmFromVerticalPixels _XMFROMVERTICALPIXELS
+#define _XmGetClassExtensionPtr _XMGETCLASSEXTENSIONPTR
+#define _XmGetDefaultFontList _XMGETDEFAULTFONTLIST
+#define _XmGetTextualDragIcon _XMGETTEXTUALDRAGICON
+#define _XmGetWidgetExtData _XMGETWIDGETEXTDATA
+#define _XmGrabKeyboard _XMGRABKEYBOARD
+#define _XmGrabPointer _XMGRABPOINTER
+#define _XmInheritClass _XMINHERITCLASS
+#define _XmInputForGadget _XMINPUTFORGADGET
+#define _XmInputInGadget _XMINPUTINGADGET
+#define _XmMakeGeometryRequest _XMMAKEGEOMETRYREQUEST
+#define _XmMenuPopDown _XMMENUPOPDOWN
+#define _XmMoveObject _XMMOVEOBJECT
+#define _XmNavigChangeManaged _XMNAVIGCHANGEMANAGED
+#define _XmOSBuildFileList _XMOSBUILDFILELIST
+#define _XmOSFileCompare _XMOSFILECOMPARE
+#define _XmOSFindPatternPart _XMOSFINDPATTERNPART
+#define _XmOSQualifyFileSpec _XMOSQUALIFYFILESPEC
+#define _XmPostPopupMenu _XMPOSTPOPUPMENU
+#define _XmPrimitiveEnter _XMPRIMITIVEENTER
+#define _XmPrimitiveLeave _XMPRIMITIVELEAVE
+#define _XmRedisplayGadgets _XMREDISPLAYGADGETS
+#define _XmShellIsExclusive _XMSHELLISEXCLUSIVE
+#define _XmStringDraw _XMSTRINGDRAW
+#define _XmStringGetTextConcat _XMSTRINGGETTEXTCONCAT
+#define _XmStrings _XMSTRINGS
+#define _XmToHorizontalPixels _XMTOHORIZONTALPIXELS
+#define _XmToVerticalPixels _XMTOVERTICALPIXELS
+#define _XmTopShadowColorDefault _XMTOPSHADOWCOLORDEFAULT
+#define _Xm_fastPtr _XM_FASTPTR
+#define _XtCheckSubclassFlag _XTCHECKSUBCLASSFLAG
+#define _XtCopyFromArg _XTCOPYFROMARG
+#define _XtCountVaList _XTCOUNTVALIST
+#define _XtInherit _XTINHERIT
+#define _XtInheritTranslations _XTINHERITTRANSLATIONS
+#define _XtIsSubclassOf _XTISSUBCLASSOF
+#define _XtVaToArgList _XTVATOARGLIST
+#define applicationShellWidgetClass APPLICATIONSHELLWIDGETCLASS
+#define cli$dcl_parse CLI$DCL_PARSE
+#define cli$get_value CLI$GET_VALUE
+#define cli$present CLI$PRESENT
+#define compositeClassRec COMPOSITECLASSREC
+#define compositeWidgetClass COMPOSITEWIDGETCLASS
+#define constraintClassRec CONSTRAINTCLASSREC
+#define constraintWidgetClass CONSTRAINTWIDGETCLASS
+#define coreWidgetClass COREWIDGETCLASS
+#define exe$getspi EXE$GETSPI
+#define lbr$close LBR$CLOSE
+#define lbr$get_header LBR$GET_HEADER
+#define lbr$get_index LBR$GET_INDEX
+#define lbr$get_record LBR$GET_RECORD
+#define lbr$ini_control LBR$INI_CONTROL
+#define lbr$lookup_key LBR$LOOKUP_KEY
+#define lbr$open LBR$OPEN
+#define lbr$output_help LBR$OUTPUT_HELP
+#define lib$add_times LIB$ADD_TIMES
+#define lib$addx LIB$ADDX
+#define lib$create_dir LIB$CREATE_DIR
+#define lib$create_vm_zone LIB$CREATE_VM_ZONE
+#define lib$cvt_from_internal_time LIB$CVT_FROM_INTERNAL_TIME
+#define lib$cvt_htb LIB$CVT_HTB
+#define lib$cvt_vectim LIB$CVT_VECTIM
+#define lib$day LIB$DAY
+#define lib$day_of_week LIB$DAY_OF_WEEK
+#define lib$delete_symbol LIB$DELETE_SYMBOL
+#define lib$delete_vm_zone LIB$DELETE_VM_ZONE
+#define lib$disable_ctrl LIB$DISABLE_CTRL
+#define lib$ediv LIB$EDIV
+#define lib$emul LIB$EMUL
+#define lib$enable_ctrl LIB$ENABLE_CTRL
+#define lib$find_vm_zone LIB$FIND_VM_ZONE
+#define lib$format_date_time LIB$FORMAT_DATE_TIME
+#define lib$free_timer LIB$FREE_TIMER
+#define lib$free_vm LIB$FREE_VM
+#define lib$get_ef LIB$GET_EF
+#define lib$get_foreign LIB$GET_FOREIGN
+#define lib$get_input LIB$GET_INPUT
+#define lib$get_users_language LIB$GET_USERS_LANGUAGE
+#define lib$get_vm LIB$GET_VM
+#define lib$get_symbol LIB$GET_SYMBOL
+#define lib$getdvi LIB$GETDVI
+#define lib$init_date_time_context LIB$INIT_DATE_TIME_CONTEXT
+#define lib$init_timer LIB$INIT_TIMER
+#define lib$find_file LIB$FIND_FILE
+#define lib$find_file_end LIB$FIND_FILE_END
+#define lib$find_image_symbol LIB$FIND_IMAGE_SYMBOL
+#define lib$mult_delta_time LIB$MULT_DELTA_TIME
+#define lib$put_output LIB$PUT_OUTPUT
+#define lib$rename_file LIB$RENAME_FILE
+#define lib$reset_vm_zone LIB$RESET_VM_ZONE
+#define lib$set_symbol LIB$SET_SYMBOL
+#define lib$sfree1_dd LIB$SFREE1_DD
+#define lib$show_vm LIB$SHOW_VM
+#define lib$show_vm_zone LIB$SHOW_VM_ZONE
+#define lib$spawn LIB$SPAWN
+#define lib$stat_timer LIB$STAT_TIMER
+#define lib$subx LIB$SUBX
+#define lib$sub_times LIB$SUB_TIMES
+#define lib$wait LIB$WAIT
+#define mail$send_add_address MAIL$SEND_ADD_ADDRESS
+#define mail$send_add_attribute MAIL$SEND_ADD_ATTRIBUTE
+#define mail$send_add_bodypart MAIL$SEND_ADD_BODYPART
+#define mail$send_begin MAIL$SEND_BEGIN
+#define mail$send_end MAIL$SEND_END
+#define mail$send_message MAIL$SEND_MESSAGE
+#define ncs$convert NCS$CONVERT
+#define ncs$get_cf NCS$GET_CF
+#define objectClass OBJECTCLASS
+#define objectClassRec OBJECTCLASSREC
+#define overrideShellClassRec OVERRIDESHELLCLASSREC
+#define overrideShellWidgetClass OVERRIDESHELLWIDGETCLASS
+#define pthread_attr_create PTHREAD_ATTR_CREATE
+#define pthread_attr_delete PTHREAD_ATTR_DELETE
+#define pthread_attr_destroy PTHREAD_ATTR_DESTROY
+#define pthread_attr_getdetach_np PTHREAD_ATTR_GETDETACH_NP
+#define pthread_attr_getguardsize_np PTHREAD_ATTR_GETGUARDSIZE_NP
+#define pthread_attr_getinheritsched PTHREAD_ATTR_GETINHERITSCHED
+#define pthread_attr_getprio PTHREAD_ATTR_GETPRIO
+#define pthread_attr_getsched PTHREAD_ATTR_GETSCHED
+#define pthread_attr_getschedparam PTHREAD_ATTR_GETSCHEDPARAM
+#define pthread_attr_getschedpolicy PTHREAD_ATTR_GETSCHEDPOLICY
+#define pthread_attr_getstacksize PTHREAD_ATTR_GETSTACKSIZE
+#define pthread_attr_init PTHREAD_ATTR_INIT
+#define pthread_attr_setdetach_np PTHREAD_ATTR_SETDETACH_NP
+#define pthread_attr_setdetachstate PTHREAD_ATTR_SETDETACHSTATE
+#define pthread_attr_setguardsize_np PTHREAD_ATTR_SETGUARDSIZE_NP
+#define pthread_attr_setinheritsched PTHREAD_ATTR_SETINHERITSCHED
+#define pthread_attr_setprio PTHREAD_ATTR_SETPRIO
+#define pthread_attr_setsched PTHREAD_ATTR_SETSCHED
+#define pthread_attr_setschedparam PTHREAD_ATTR_SETSCHEDPARAM
+#define pthread_attr_setschedpolicy PTHREAD_ATTR_SETSCHEDPOLICY
+#ifndef pthread_attr_setscope
+# define pthread_attr_setscope PTHREAD_ATTR_SETSCOPE
+#endif
+#define pthread_attr_setstacksize PTHREAD_ATTR_SETSTACKSIZE
+#define pthread_cancel PTHREAD_CANCEL
+#define pthread_cancel_e PTHREAD_CANCEL_E
+#define pthread_cond_broadcast PTHREAD_COND_BROADCAST
+#define pthread_cond_destroy PTHREAD_COND_DESTROY
+#define pthread_cond_init PTHREAD_COND_INIT
+#define pthread_cond_sig_preempt_int_np PTHREAD_COND_SIG_PREEMPT_INT_NP
+#define pthread_cond_signal PTHREAD_COND_SIGNAL
+#define pthread_cond_signal_int_np PTHREAD_COND_SIGNAL_INT_NP
+#define pthread_cond_timedwait PTHREAD_COND_TIMEDWAIT
+#define pthread_cond_wait PTHREAD_COND_WAIT
+#define pthread_condattr_create PTHREAD_CONDATTR_CREATE
+#define pthread_condattr_delete PTHREAD_CONDATTR_DELETE
+#define pthread_condattr_init PTHREAD_CONDATTR_INIT
+#define pthread_create PTHREAD_CREATE
+#define pthread_delay_np PTHREAD_DELAY_NP
+#define pthread_detach PTHREAD_DETACH
+#define pthread_equal PTHREAD_EQUAL
+#define pthread_exc_fetch_fp_np PTHREAD_EXC_FETCH_FP_NP
+#define pthread_exc_handler_np PTHREAD_EXC_HANDLER_NP
+#define pthread_exc_matches_np PTHREAD_EXC_MATCHES_NP
+#define pthread_exc_pop_ctx_np PTHREAD_EXC_POP_CTX_NP
+#define pthread_exc_push_ctx_np PTHREAD_EXC_PUSH_CTX_NP
+#define pthread_exc_raise_np PTHREAD_EXC_RAISE_NP
+#define pthread_exc_savecontext_np PTHREAD_EXC_SAVECONTEXT_NP
+#define pthread_exit PTHREAD_EXIT
+#define pthread_get_expiration_np PTHREAD_GET_EXPIRATION_NP
+#define pthread_getprio PTHREAD_GETPRIO
+#define pthread_getschedparam PTHREAD_GETSCHEDPARAM
+#define pthread_getscheduler PTHREAD_GETSCHEDULER
+#define pthread_getspecific PTHREAD_GETSPECIFIC
+#define pthread_getunique_np PTHREAD_GETUNIQUE_NP
+#define pthread_join PTHREAD_JOIN
+#define pthread_join32 PTHREAD_JOIN32
+#define pthread_key_create PTHREAD_KEY_CREATE
+#define pthread_key_delete PTHREAD_KEY_DELETE
+#define pthread_keycreate PTHREAD_KEYCREATE
+#define pthread_kill PTHREAD_KILL
+#define pthread_lock_global_np PTHREAD_LOCK_GLOBAL_NP
+#define pthread_mutex_destroy PTHREAD_MUTEX_DESTROY
+#define pthread_mutex_init PTHREAD_MUTEX_INIT
+#define pthread_mutex_lock PTHREAD_MUTEX_LOCK
+#define pthread_mutex_trylock PTHREAD_MUTEX_TRYLOCK
+#define pthread_mutex_unlock PTHREAD_MUTEX_UNLOCK
+#define pthread_mutexattr_create PTHREAD_MUTEXATTR_CREATE
+#define pthread_mutexattr_delete PTHREAD_MUTEXATTR_DELETE
+#define pthread_mutexattr_destroy PTHREAD_MUTEXATTR_DESTROY
+#define pthread_mutexattr_getkind_np PTHREAD_MUTEXATTR_GETKIND_NP
+#define pthread_mutexattr_init PTHREAD_MUTEXATTR_INIT
+#define pthread_mutexattr_setkind_np PTHREAD_MUTEXATTR_SETKIND_NP
+#define pthread_mutexattr_settype_np PTHREAD_MUTEXATTR_SETTYPE_NP
+#define pthread_once PTHREAD_ONCE
+#define pthread_resume_np PTHREAD_RESUME_NP
+#define pthread_self PTHREAD_SELF
+#define pthread_setasynccancel PTHREAD_SETASYNCCANCEL
+#define pthread_setcancel PTHREAD_SETCANCEL
+#define pthread_setcancelstate PTHREAD_SETCANCELSTATE
+#define pthread_setcanceltype PTHREAD_SETCANCELTYPE
+#define pthread_setprio PTHREAD_SETPRIO
+#define pthread_setschedparam PTHREAD_SETSCHEDPARAM
+#define pthread_setscheduler PTHREAD_SETSCHEDULER
+#define pthread_setspecific PTHREAD_SETSPECIFIC
+#define pthread_suspend_np PTHREAD_SUSPEND_NP
+#define pthread_testcancel PTHREAD_TESTCANCEL
+#define pthread_unlock_global_np PTHREAD_UNLOCK_GLOBAL_NP
+#define pthread_yield PTHREAD_YIELD
+#define pthread_yield_np PTHREAD_YIELD_NP
+#define rectObjClass RECTOBJCLASS
+#define rectObjClassRec RECTOBJCLASSREC
+#define sessionShellWidgetClass SESSIONSHELLWIDGETCLASS
+#define shellWidgetClass SHELLWIDGETCLASS
+#define shmat SHMAT
+#define shmctl SHMCTL
+#define shmdt SHMDT
+#define shmget SHMGET
+#define smg$create_key_table SMG$CREATE_KEY_TABLE
+#define smg$create_virtual_keyboard SMG$CREATE_VIRTUAL_KEYBOARD
+#define smg$read_composed_line SMG$READ_COMPOSED_LINE
+#define sys$add_ident SYS$ADD_IDENT
+#define sys$asctoid SYS$ASCTOID
+#define sys$assign SYS$ASSIGN
+#define sys$bintim SYS$BINTIM
+#define sys$cancel SYS$CANCEL
+#define sys$cantim SYS$CANTIM
+#define sys$check_access SYS$CHECK_ACCESS
+#define sys$close SYS$CLOSE
+#define sys$connect SYS$CONNECT
+#define sys$create SYS$CREATE
+#define sys$create_user_profile SYS$CREATE_USER_PROFILE
+#define sys$crembx SYS$CREMBX
+#define sys$creprc SYS$CREPRC
+#define sys$crmpsc SYS$CRMPSC
+#define sys$dassgn SYS$DASSGN
+#define sys$dclast SYS$DCLAST
+#define sys$dclexh SYS$DCLEXH
+#define sys$delprc SYS$DELPRC
+#define sys$deq SYS$DEQ
+#define sys$dgblsc SYS$DGBLSC
+#define sys$display SYS$DISPLAY
+#define sys$enq SYS$ENQ
+#define sys$enqw SYS$ENQW
+#define sys$erase SYS$ERASE
+#define sys$fao SYS$FAO
+#define sys$faol SYS$FAOL
+#define sys$find_held SYS$FIND_HELD
+#define sys$finish_rdb SYS$FINISH_RDB
+#define sys$flush SYS$FLUSH
+#define sys$forcex SYS$FORCEX
+#define sys$get SYS$GET
+#define sys$get_security SYS$GET_SECURITY
+#define sys$getdviw SYS$GETDVIW
+#define sys$getjpi SYS$GETJPI
+#define sys$getjpiw SYS$GETJPIW
+#define sys$getlkiw SYS$GETLKIW
+#define sys$getmsg SYS$GETMSG
+#define sys$getsyi SYS$GETSYI
+#define sys$getsyiw SYS$GETSYIW
+#define sys$gettim SYS$GETTIM
+#define sys$getuai SYS$GETUAI
+#define sys$grantid SYS$GRANTID
+#define sys$hash_password SYS$HASH_PASSWORD
+#define sys$hiber SYS$HIBER
+#define sys$mgblsc SYS$MGBLSC
+#define sys$numtim SYS$NUMTIM
+#define sys$open SYS$OPEN
+#define sys$parse SYS$PARSE
+#define sys$parse_acl SYS$PARSE_ACL
+#define sys$parse_acl SYS$PARSE_ACL
+#define sys$persona_assume SYS$PERSONA_ASSUME
+#define sys$persona_create SYS$PERSONA_CREATE
+#define sys$persona_delete SYS$PERSONA_DELETE
+#define sys$process_scan SYS$PROCESS_SCAN
+#define sys$put SYS$PUT
+#define sys$qio SYS$QIO
+#define sys$qiow SYS$QIOW
+#define sys$read SYS$READ
+#define sys$resched SYS$RESCHED
+#define sys$rewind SYS$REWIND
+#define sys$search SYS$SEARCH
+#define sys$set_security SYS$SET_SECURITY
+#define sys$setast SYS$SETAST
+#define sys$setef SYS$SETEF
+#define sys$setimr SYS$SETIMR
+#define sys$setpri SYS$SETPRI
+#define sys$setprn SYS$SETPRN
+#define sys$setprv SYS$SETPRV
+#define sys$setswm SYS$SETSWM
+#define sys$setuai SYS$SETUAI
+#define sys$sndopr SYS$SNDOPR
+#define sys$synch SYS$SYNCH
+#define sys$trnlnm SYS$TRNLNM
+#define sys$update SYS$UPDATE
+#define sys$wake SYS$WAKE
+#define sys$write SYS$WRITE
+#define topLevelShellClassRec TOPLEVELSHELLCLASSREC
+#define topLevelShellWidgetClass TOPLEVELSHELLWIDGETCLASS
+#define transientShellWidgetClass TRANSIENTSHELLWIDGETCLASS
+#define vendorShellClassRec VENDORSHELLCLASSREC
+#define vendorShellWidgetClass VENDORSHELLWIDGETCLASS
+#define widgetClass WIDGETCLASS
+#define widgetClassRec WIDGETCLASSREC
+#define wmShellClassRec WMSHELLCLASSREC
+#define wmShellWidgetClass WMSHELLWIDGETCLASS
+#define x$soft_ast_lib_lock X$SOFT_AST_LIB_LOCK
+#define x$soft_ast_lock_depth X$SOFT_AST_LOCK_DEPTH
+#define x$soft_reenable_asts X$SOFT_REENABLE_ASTS
+#define xmArrowButtonWidgetClass XMARROWBUTTONWIDGETCLASS
+#define xmBulletinBoardWidgetClass XMBULLETINBOARDWIDGETCLASS
+#define xmCascadeButtonClassRec XMCASCADEBUTTONCLASSREC
+#define xmCascadeButtonGadgetClass XMCASCADEBUTTONGADGETCLASS
+#define xmCascadeButtonWidgetClass XMCASCADEBUTTONWIDGETCLASS
+#define xmCommandWidgetClass XMCOMMANDWIDGETCLASS
+#define xmDialogShellWidgetClass XMDIALOGSHELLWIDGETCLASS
+#define xmDrawingAreaWidgetClass XMDRAWINGAREAWIDGETCLASS
+#define xmDrawnButtonWidgetClass XMDRAWNBUTTONWIDGETCLASS
+#define xmFileSelectionBoxWidgetClass XMFILESELECTIONBOXWIDGETCLASS
+#define xmFormWidgetClass XMFORMWIDGETCLASS
+#define xmFrameWidgetClass XMFRAMEWIDGETCLASS
+#define xmGadgetClass XMGADGETCLASS
+#define xmLabelGadgetClass XMLABELGADGETCLASS
+#define xmLabelWidgetClass XMLABELWIDGETCLASS
+#define xmListWidgetClass XMLISTWIDGETCLASS
+#define xmMainWindowWidgetClass XMMAINWINDOWWIDGETCLASS
+#define xmManagerClassRec XMMANAGERCLASSREC
+#define xmManagerWidgetClass XMMANAGERWIDGETCLASS
+#define xmMenuShellWidgetClass XMMENUSHELLWIDGETCLASS
+#define xmMessageBoxWidgetClass XMMESSAGEBOXWIDGETCLASS
+#define xmPrimitiveClassRec XMPRIMITIVECLASSREC
+#define xmPrimitiveWidgetClass XMPRIMITIVEWIDGETCLASS
+#define xmPushButtonClassRec XMPUSHBUTTONCLASSREC
+#define xmPushButtonGadgetClass XMPUSHBUTTONGADGETCLASS
+#define xmPushButtonWidgetClass XMPUSHBUTTONWIDGETCLASS
+#define xmRowColumnWidgetClass XMROWCOLUMNWIDGETCLASS
+#define xmSashWidgetClass XMSASHWIDGETCLASS
+#define xmScaleWidgetClass XMSCALEWIDGETCLASS
+#define xmScrollBarWidgetClass XMSCROLLBARWIDGETCLASS
+#define xmScrolledWindowClassRec XMSCROLLEDWINDOWCLASSREC
+#define xmScrolledWindowWidgetClass XMSCROLLEDWINDOWWIDGETCLASS
+#define xmSeparatorGadgetClass XMSEPARATORGADGETCLASS
+#define xmSeparatorWidgetClass XMSEPARATORWIDGETCLASS
+#define xmTextFieldWidgetClass XMTEXTFIELDWIDGETCLASS
+#define xmTextWidgetClass XMTEXTWIDGETCLASS
+#define xmToggleButtonGadgetClass XMTOGGLEBUTTONGADGETCLASS
+#define xmToggleButtonWidgetClass XMTOGGLEBUTTONWIDGETCLASS
+
+#if (__VMS_VER < 80200000)
+# define SetReqLen(req,n,badlen) \
+ if ((req->length + n) > (unsigned)65535) { \
+ n = badlen; \
+ req->length += n; \
+ } else \
+ req->length += n
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern void XtFree(char*);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null
+#ifndef __wglext_h_
+#define __wglext_h_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2007-2010 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.
+*/
+
+/* Function declaration macros - to move into glplatform.h */
+
+#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
+#define WIN32_LEAN_AND_MEAN 1
+#include <windows.h>
+#endif
+
+#ifndef APIENTRY
+#define APIENTRY
+#endif
+#ifndef APIENTRYP
+#define APIENTRYP APIENTRY *
+#endif
+#ifndef GLAPI
+#define GLAPI extern
+#endif
+
+/*************************************************************/
+
+/* Header file version number */
+/* wglext.h last updated 2010/08/06 */
+/* Current version at http://www.opengl.org/registry/ */
+#define WGL_WGLEXT_VERSION 22
+
+#ifndef WGL_ARB_buffer_region
+#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001
+#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002
+#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004
+#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008
+#endif
+
+#ifndef WGL_ARB_multisample
+#define WGL_SAMPLE_BUFFERS_ARB 0x2041
+#define WGL_SAMPLES_ARB 0x2042
+#endif
+
+#ifndef WGL_ARB_extensions_string
+#endif
+
+#ifndef WGL_ARB_pixel_format
+#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
+#define WGL_DRAW_TO_WINDOW_ARB 0x2001
+#define WGL_DRAW_TO_BITMAP_ARB 0x2002
+#define WGL_ACCELERATION_ARB 0x2003
+#define WGL_NEED_PALETTE_ARB 0x2004
+#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
+#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
+#define WGL_SWAP_METHOD_ARB 0x2007
+#define WGL_NUMBER_OVERLAYS_ARB 0x2008
+#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
+#define WGL_TRANSPARENT_ARB 0x200A
+#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
+#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
+#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
+#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
+#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
+#define WGL_SHARE_DEPTH_ARB 0x200C
+#define WGL_SHARE_STENCIL_ARB 0x200D
+#define WGL_SHARE_ACCUM_ARB 0x200E
+#define WGL_SUPPORT_GDI_ARB 0x200F
+#define WGL_SUPPORT_OPENGL_ARB 0x2010
+#define WGL_DOUBLE_BUFFER_ARB 0x2011
+#define WGL_STEREO_ARB 0x2012
+#define WGL_PIXEL_TYPE_ARB 0x2013
+#define WGL_COLOR_BITS_ARB 0x2014
+#define WGL_RED_BITS_ARB 0x2015
+#define WGL_RED_SHIFT_ARB 0x2016
+#define WGL_GREEN_BITS_ARB 0x2017
+#define WGL_GREEN_SHIFT_ARB 0x2018
+#define WGL_BLUE_BITS_ARB 0x2019
+#define WGL_BLUE_SHIFT_ARB 0x201A
+#define WGL_ALPHA_BITS_ARB 0x201B
+#define WGL_ALPHA_SHIFT_ARB 0x201C
+#define WGL_ACCUM_BITS_ARB 0x201D
+#define WGL_ACCUM_RED_BITS_ARB 0x201E
+#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
+#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
+#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
+#define WGL_DEPTH_BITS_ARB 0x2022
+#define WGL_STENCIL_BITS_ARB 0x2023
+#define WGL_AUX_BUFFERS_ARB 0x2024
+#define WGL_NO_ACCELERATION_ARB 0x2025
+#define WGL_GENERIC_ACCELERATION_ARB 0x2026
+#define WGL_FULL_ACCELERATION_ARB 0x2027
+#define WGL_SWAP_EXCHANGE_ARB 0x2028
+#define WGL_SWAP_COPY_ARB 0x2029
+#define WGL_SWAP_UNDEFINED_ARB 0x202A
+#define WGL_TYPE_RGBA_ARB 0x202B
+#define WGL_TYPE_COLORINDEX_ARB 0x202C
+#endif
+
+#ifndef WGL_ARB_make_current_read
+#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043
+#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
+#endif
+
+#ifndef WGL_ARB_pbuffer
+#define WGL_DRAW_TO_PBUFFER_ARB 0x202D
+#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E
+#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F
+#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030
+#define WGL_PBUFFER_LARGEST_ARB 0x2033
+#define WGL_PBUFFER_WIDTH_ARB 0x2034
+#define WGL_PBUFFER_HEIGHT_ARB 0x2035
+#define WGL_PBUFFER_LOST_ARB 0x2036
+#endif
+
+#ifndef WGL_ARB_render_texture
+#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070
+#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071
+#define WGL_TEXTURE_FORMAT_ARB 0x2072
+#define WGL_TEXTURE_TARGET_ARB 0x2073
+#define WGL_MIPMAP_TEXTURE_ARB 0x2074
+#define WGL_TEXTURE_RGB_ARB 0x2075
+#define WGL_TEXTURE_RGBA_ARB 0x2076
+#define WGL_NO_TEXTURE_ARB 0x2077
+#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078
+#define WGL_TEXTURE_1D_ARB 0x2079
+#define WGL_TEXTURE_2D_ARB 0x207A
+#define WGL_MIPMAP_LEVEL_ARB 0x207B
+#define WGL_CUBE_MAP_FACE_ARB 0x207C
+#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D
+#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E
+#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F
+#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080
+#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081
+#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082
+#define WGL_FRONT_LEFT_ARB 0x2083
+#define WGL_FRONT_RIGHT_ARB 0x2084
+#define WGL_BACK_LEFT_ARB 0x2085
+#define WGL_BACK_RIGHT_ARB 0x2086
+#define WGL_AUX0_ARB 0x2087
+#define WGL_AUX1_ARB 0x2088
+#define WGL_AUX2_ARB 0x2089
+#define WGL_AUX3_ARB 0x208A
+#define WGL_AUX4_ARB 0x208B
+#define WGL_AUX5_ARB 0x208C
+#define WGL_AUX6_ARB 0x208D
+#define WGL_AUX7_ARB 0x208E
+#define WGL_AUX8_ARB 0x208F
+#define WGL_AUX9_ARB 0x2090
+#endif
+
+#ifndef WGL_ARB_pixel_format_float
+#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0
+#endif
+
+#ifndef WGL_ARB_framebuffer_sRGB
+#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9
+#endif
+
+#ifndef WGL_ARB_create_context
+#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
+#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
+#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
+#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
+#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
+#define WGL_CONTEXT_FLAGS_ARB 0x2094
+#define ERROR_INVALID_VERSION_ARB 0x2095
+#endif
+
+#ifndef WGL_ARB_create_context_profile
+#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
+#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
+#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
+#define ERROR_INVALID_PROFILE_ARB 0x2096
+#endif
+
+#ifndef WGL_ARB_create_context_robustness
+#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
+#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
+#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
+#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261
+#endif
+
+#ifndef WGL_EXT_make_current_read
+#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043
+#endif
+
+#ifndef WGL_EXT_pixel_format
+#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000
+#define WGL_DRAW_TO_WINDOW_EXT 0x2001
+#define WGL_DRAW_TO_BITMAP_EXT 0x2002
+#define WGL_ACCELERATION_EXT 0x2003
+#define WGL_NEED_PALETTE_EXT 0x2004
+#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005
+#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006
+#define WGL_SWAP_METHOD_EXT 0x2007
+#define WGL_NUMBER_OVERLAYS_EXT 0x2008
+#define WGL_NUMBER_UNDERLAYS_EXT 0x2009
+#define WGL_TRANSPARENT_EXT 0x200A
+#define WGL_TRANSPARENT_VALUE_EXT 0x200B
+#define WGL_SHARE_DEPTH_EXT 0x200C
+#define WGL_SHARE_STENCIL_EXT 0x200D
+#define WGL_SHARE_ACCUM_EXT 0x200E
+#define WGL_SUPPORT_GDI_EXT 0x200F
+#define WGL_SUPPORT_OPENGL_EXT 0x2010
+#define WGL_DOUBLE_BUFFER_EXT 0x2011
+#define WGL_STEREO_EXT 0x2012
+#define WGL_PIXEL_TYPE_EXT 0x2013
+#define WGL_COLOR_BITS_EXT 0x2014
+#define WGL_RED_BITS_EXT 0x2015
+#define WGL_RED_SHIFT_EXT 0x2016
+#define WGL_GREEN_BITS_EXT 0x2017
+#define WGL_GREEN_SHIFT_EXT 0x2018
+#define WGL_BLUE_BITS_EXT 0x2019
+#define WGL_BLUE_SHIFT_EXT 0x201A
+#define WGL_ALPHA_BITS_EXT 0x201B
+#define WGL_ALPHA_SHIFT_EXT 0x201C
+#define WGL_ACCUM_BITS_EXT 0x201D
+#define WGL_ACCUM_RED_BITS_EXT 0x201E
+#define WGL_ACCUM_GREEN_BITS_EXT 0x201F
+#define WGL_ACCUM_BLUE_BITS_EXT 0x2020
+#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021
+#define WGL_DEPTH_BITS_EXT 0x2022
+#define WGL_STENCIL_BITS_EXT 0x2023
+#define WGL_AUX_BUFFERS_EXT 0x2024
+#define WGL_NO_ACCELERATION_EXT 0x2025
+#define WGL_GENERIC_ACCELERATION_EXT 0x2026
+#define WGL_FULL_ACCELERATION_EXT 0x2027
+#define WGL_SWAP_EXCHANGE_EXT 0x2028
+#define WGL_SWAP_COPY_EXT 0x2029
+#define WGL_SWAP_UNDEFINED_EXT 0x202A
+#define WGL_TYPE_RGBA_EXT 0x202B
+#define WGL_TYPE_COLORINDEX_EXT 0x202C
+#endif
+
+#ifndef WGL_EXT_pbuffer
+#define WGL_DRAW_TO_PBUFFER_EXT 0x202D
+#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E
+#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F
+#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030
+#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031
+#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032
+#define WGL_PBUFFER_LARGEST_EXT 0x2033
+#define WGL_PBUFFER_WIDTH_EXT 0x2034
+#define WGL_PBUFFER_HEIGHT_EXT 0x2035
+#endif
+
+#ifndef WGL_EXT_depth_float
+#define WGL_DEPTH_FLOAT_EXT 0x2040
+#endif
+
+#ifndef WGL_3DFX_multisample
+#define WGL_SAMPLE_BUFFERS_3DFX 0x2060
+#define WGL_SAMPLES_3DFX 0x2061
+#endif
+
+#ifndef WGL_EXT_multisample
+#define WGL_SAMPLE_BUFFERS_EXT 0x2041
+#define WGL_SAMPLES_EXT 0x2042
+#endif
+
+#ifndef WGL_I3D_digital_video_control
+#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050
+#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051
+#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052
+#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053
+#endif
+
+#ifndef WGL_I3D_gamma
+#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E
+#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F
+#endif
+
+#ifndef WGL_I3D_genlock
+#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044
+#define WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D 0x2045
+#define WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D 0x2046
+#define WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D 0x2047
+#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048
+#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049
+#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A
+#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B
+#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C
+#endif
+
+#ifndef WGL_I3D_image_buffer
+#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001
+#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002
+#endif
+
+#ifndef WGL_I3D_swap_frame_lock
+#endif
+
+#ifndef WGL_NV_render_depth_texture
+#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4
+#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5
+#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6
+#define WGL_DEPTH_COMPONENT_NV 0x20A7
+#endif
+
+#ifndef WGL_NV_render_texture_rectangle
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1
+#define WGL_TEXTURE_RECTANGLE_NV 0x20A2
+#endif
+
+#ifndef WGL_ATI_pixel_format_float
+#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0
+#endif
+
+#ifndef WGL_NV_float_buffer
+#define WGL_FLOAT_COMPONENTS_NV 0x20B0
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3
+#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4
+#define WGL_TEXTURE_FLOAT_R_NV 0x20B5
+#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6
+#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7
+#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8
+#endif
+
+#ifndef WGL_3DL_stereo_control
+#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055
+#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056
+#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057
+#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058
+#endif
+
+#ifndef WGL_EXT_pixel_format_packed_float
+#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8
+#endif
+
+#ifndef WGL_EXT_framebuffer_sRGB
+#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9
+#endif
+
+#ifndef WGL_NV_present_video
+#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0
+#endif
+
+#ifndef WGL_NV_video_out
+#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0
+#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1
+#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2
+#define WGL_VIDEO_OUT_COLOR_NV 0x20C3
+#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4
+#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5
+#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6
+#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7
+#define WGL_VIDEO_OUT_FRAME 0x20C8
+#define WGL_VIDEO_OUT_FIELD_1 0x20C9
+#define WGL_VIDEO_OUT_FIELD_2 0x20CA
+#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB
+#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC
+#endif
+
+#ifndef WGL_NV_swap_group
+#endif
+
+#ifndef WGL_NV_gpu_affinity
+#define WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0
+#define WGL_ERROR_MISSING_AFFINITY_MASK_NV 0x20D1
+#endif
+
+#ifndef WGL_AMD_gpu_association
+#define WGL_GPU_VENDOR_AMD 0x1F00
+#define WGL_GPU_RENDERER_STRING_AMD 0x1F01
+#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02
+#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2
+#define WGL_GPU_RAM_AMD 0x21A3
+#define WGL_GPU_CLOCK_AMD 0x21A4
+#define WGL_GPU_NUM_PIPES_AMD 0x21A5
+#define WGL_GPU_NUM_SIMD_AMD 0x21A6
+#define WGL_GPU_NUM_RB_AMD 0x21A7
+#define WGL_GPU_NUM_SPI_AMD 0x21A8
+#endif
+
+#ifndef WGL_NV_video_capture
+#define WGL_UNIQUE_ID_NV 0x20CE
+#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF
+#endif
+
+#ifndef WGL_NV_copy_image
+#endif
+
+#ifndef WGL_NV_multisample_coverage
+#define WGL_COVERAGE_SAMPLES_NV 0x2042
+#define WGL_COLOR_SAMPLES_NV 0x20B9
+#endif
+
+#ifndef WGL_EXT_create_context_es2_profile
+#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
+#endif
+
+
+/*************************************************************/
+
+#ifndef WGL_ARB_pbuffer
+DECLARE_HANDLE(HPBUFFERARB);
+#endif
+#ifndef WGL_EXT_pbuffer
+DECLARE_HANDLE(HPBUFFEREXT);
+#endif
+#ifndef WGL_NV_present_video
+DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);
+#endif
+#ifndef WGL_NV_video_output
+DECLARE_HANDLE(HPVIDEODEV);
+#endif
+#ifndef WGL_NV_gpu_affinity
+DECLARE_HANDLE(HPGPUNV);
+DECLARE_HANDLE(HGPUNV);
+
+typedef struct _GPU_DEVICE {
+ DWORD cb;
+ CHAR DeviceName[32];
+ CHAR DeviceString[128];
+ DWORD Flags;
+ RECT rcVirtualScreen;
+} GPU_DEVICE, *PGPU_DEVICE;
+#endif
+#ifndef WGL_NV_video_capture
+DECLARE_HANDLE(HVIDEOINPUTDEVICENV);
+#endif
+
+#ifndef WGL_ARB_buffer_region
+#define WGL_ARB_buffer_region 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern HANDLE WINAPI wglCreateBufferRegionARB (HDC hDC, int iLayerPlane, UINT uType);
+extern VOID WINAPI wglDeleteBufferRegionARB (HANDLE hRegion);
+extern BOOL WINAPI wglSaveBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height);
+extern BOOL WINAPI wglRestoreBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);
+typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);
+typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);
+typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
+#endif
+
+#ifndef WGL_ARB_multisample
+#define WGL_ARB_multisample 1
+#endif
+
+#ifndef WGL_ARB_extensions_string
+#define WGL_ARB_extensions_string 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern const char * WINAPI wglGetExtensionsStringARB (HDC hdc);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);
+#endif
+
+#ifndef WGL_ARB_pixel_format
+#define WGL_ARB_pixel_format 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglGetPixelFormatAttribivARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
+extern BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
+extern BOOL WINAPI wglChoosePixelFormatARB (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
+typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
+typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
+#endif
+
+#ifndef WGL_ARB_make_current_read
+#define WGL_ARB_make_current_read 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglMakeContextCurrentARB (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
+extern HDC WINAPI wglGetCurrentReadDCARB (void);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
+typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void);
+#endif
+
+#ifndef WGL_ARB_pbuffer
+#define WGL_ARB_pbuffer 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern HPBUFFERARB WINAPI wglCreatePbufferARB (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
+extern HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB hPbuffer);
+extern int WINAPI wglReleasePbufferDCARB (HPBUFFERARB hPbuffer, HDC hDC);
+extern BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB hPbuffer);
+extern BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
+typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);
+typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);
+typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);
+typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
+#endif
+
+#ifndef WGL_ARB_render_texture
+#define WGL_ARB_render_texture 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglBindTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
+extern BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
+extern BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB hPbuffer, const int *piAttribList);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
+typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
+typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList);
+#endif
+
+#ifndef WGL_ARB_pixel_format_float
+#define WGL_ARB_pixel_format_float 1
+#endif
+
+#ifndef WGL_ARB_framebuffer_sRGB
+#define WGL_ARB_framebuffer_sRGB 1
+#endif
+
+#ifndef WGL_ARB_create_context
+#define WGL_ARB_create_context 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern HGLRC WINAPI wglCreateContextAttribsARB (HDC hDC, HGLRC hShareContext, const int *attribList);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList);
+#endif
+
+#ifndef WGL_ARB_create_context_profile
+#define WGL_ARB_create_context_profile 1
+#endif
+
+#ifndef WGL_ARB_create_context_robustness
+#define WGL_ARB_create_context_robustness 1
+#endif
+
+#ifndef WGL_EXT_display_color_table
+#define WGL_EXT_display_color_table 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort id);
+extern GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *table, GLuint length);
+extern GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort id);
+extern VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort id);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);
+typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length);
+typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);
+typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);
+#endif
+
+#ifndef WGL_EXT_extensions_string
+#define WGL_EXT_extensions_string 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern const char * WINAPI wglGetExtensionsStringEXT (void);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);
+#endif
+
+#ifndef WGL_EXT_make_current_read
+#define WGL_EXT_make_current_read 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglMakeContextCurrentEXT (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
+extern HDC WINAPI wglGetCurrentReadDCEXT (void);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
+typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void);
+#endif
+
+#ifndef WGL_EXT_pbuffer
+#define WGL_EXT_pbuffer 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
+extern HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT hPbuffer);
+extern int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT hPbuffer, HDC hDC);
+extern BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT hPbuffer);
+extern BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
+typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);
+typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);
+typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);
+typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
+#endif
+
+#ifndef WGL_EXT_pixel_format
+#define WGL_EXT_pixel_format 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
+extern BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
+extern BOOL WINAPI wglChoosePixelFormatEXT (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
+typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
+typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
+#endif
+
+#ifndef WGL_EXT_swap_control
+#define WGL_EXT_swap_control 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglSwapIntervalEXT (int interval);
+extern int WINAPI wglGetSwapIntervalEXT (void);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
+typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);
+#endif
+
+#ifndef WGL_EXT_depth_float
+#define WGL_EXT_depth_float 1
+#endif
+
+#ifndef WGL_NV_vertex_array_range
+#define WGL_NV_vertex_array_range 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern void* WINAPI wglAllocateMemoryNV (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
+extern void WINAPI wglFreeMemoryNV (void *pointer);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef void* (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
+typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);
+#endif
+
+#ifndef WGL_3DFX_multisample
+#define WGL_3DFX_multisample 1
+#endif
+
+#ifndef WGL_EXT_multisample
+#define WGL_EXT_multisample 1
+#endif
+
+#ifndef WGL_OML_sync_control
+#define WGL_OML_sync_control 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglGetSyncValuesOML (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
+extern BOOL WINAPI wglGetMscRateOML (HDC hdc, INT32 *numerator, INT32 *denominator);
+extern INT64 WINAPI wglSwapBuffersMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
+extern INT64 WINAPI wglSwapLayerBuffersMscOML (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
+extern BOOL WINAPI wglWaitForMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
+extern BOOL WINAPI wglWaitForSbcOML (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
+typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator);
+typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
+typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
+typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
+typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
+#endif
+
+#ifndef WGL_I3D_digital_video_control
+#define WGL_I3D_digital_video_control 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC hDC, int iAttribute, int *piValue);
+extern BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC hDC, int iAttribute, const int *piValue);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
+typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
+#endif
+
+#ifndef WGL_I3D_gamma
+#define WGL_I3D_gamma 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglGetGammaTableParametersI3D (HDC hDC, int iAttribute, int *piValue);
+extern BOOL WINAPI wglSetGammaTableParametersI3D (HDC hDC, int iAttribute, const int *piValue);
+extern BOOL WINAPI wglGetGammaTableI3D (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
+extern BOOL WINAPI wglSetGammaTableI3D (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
+typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
+typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
+typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
+#endif
+
+#ifndef WGL_I3D_genlock
+#define WGL_I3D_genlock 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglEnableGenlockI3D (HDC hDC);
+extern BOOL WINAPI wglDisableGenlockI3D (HDC hDC);
+extern BOOL WINAPI wglIsEnabledGenlockI3D (HDC hDC, BOOL *pFlag);
+extern BOOL WINAPI wglGenlockSourceI3D (HDC hDC, UINT uSource);
+extern BOOL WINAPI wglGetGenlockSourceI3D (HDC hDC, UINT *uSource);
+extern BOOL WINAPI wglGenlockSourceEdgeI3D (HDC hDC, UINT uEdge);
+extern BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC hDC, UINT *uEdge);
+extern BOOL WINAPI wglGenlockSampleRateI3D (HDC hDC, UINT uRate);
+extern BOOL WINAPI wglGetGenlockSampleRateI3D (HDC hDC, UINT *uRate);
+extern BOOL WINAPI wglGenlockSourceDelayI3D (HDC hDC, UINT uDelay);
+extern BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC hDC, UINT *uDelay);
+extern BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);
+typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);
+typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag);
+typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);
+typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource);
+typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);
+typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge);
+typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);
+typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate);
+typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);
+typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay);
+typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
+#endif
+
+#ifndef WGL_I3D_image_buffer
+#define WGL_I3D_image_buffer 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern LPVOID WINAPI wglCreateImageBufferI3D (HDC hDC, DWORD dwSize, UINT uFlags);
+extern BOOL WINAPI wglDestroyImageBufferI3D (HDC hDC, LPVOID pAddress);
+extern BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
+extern BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC hDC, const LPVOID *pAddress, UINT count);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);
+typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);
+typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
+typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count);
+#endif
+
+#ifndef WGL_I3D_swap_frame_lock
+#define WGL_I3D_swap_frame_lock 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglEnableFrameLockI3D (void);
+extern BOOL WINAPI wglDisableFrameLockI3D (void);
+extern BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *pFlag);
+extern BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *pFlag);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void);
+typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void);
+typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag);
+typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag);
+#endif
+
+#ifndef WGL_I3D_swap_frame_usage
+#define WGL_I3D_swap_frame_usage 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglGetFrameUsageI3D (float *pUsage);
+extern BOOL WINAPI wglBeginFrameTrackingI3D (void);
+extern BOOL WINAPI wglEndFrameTrackingI3D (void);
+extern BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage);
+typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);
+typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);
+typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
+#endif
+
+#ifndef WGL_ATI_pixel_format_float
+#define WGL_ATI_pixel_format_float 1
+#endif
+
+#ifndef WGL_NV_float_buffer
+#define WGL_NV_float_buffer 1
+#endif
+
+#ifndef WGL_3DL_stereo_control
+#define WGL_3DL_stereo_control 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglSetStereoEmitterState3DL (HDC hDC, UINT uState);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);
+#endif
+
+#ifndef WGL_EXT_pixel_format_packed_float
+#define WGL_EXT_pixel_format_packed_float 1
+#endif
+
+#ifndef WGL_EXT_framebuffer_sRGB
+#define WGL_EXT_framebuffer_sRGB 1
+#endif
+
+#ifndef WGL_NV_present_video
+#define WGL_NV_present_video 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern int WINAPI wglEnumerateVideoDevicesNV (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
+extern BOOL WINAPI wglBindVideoDeviceNV (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
+extern BOOL WINAPI wglQueryCurrentContextNV (int iAttribute, int *piValue);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
+typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
+typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue);
+#endif
+
+#ifndef WGL_NV_video_output
+#define WGL_NV_video_output 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglGetVideoDeviceNV (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
+extern BOOL WINAPI wglReleaseVideoDeviceNV (HPVIDEODEV hVideoDevice);
+extern BOOL WINAPI wglBindVideoImageNV (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
+extern BOOL WINAPI wglReleaseVideoImageNV (HPBUFFERARB hPbuffer, int iVideoBuffer);
+extern BOOL WINAPI wglSendPbufferToVideoNV (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
+extern BOOL WINAPI wglGetVideoInfoNV (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
+typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice);
+typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
+typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer);
+typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
+typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
+#endif
+
+#ifndef WGL_NV_swap_group
+#define WGL_NV_swap_group 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglJoinSwapGroupNV (HDC hDC, GLuint group);
+extern BOOL WINAPI wglBindSwapBarrierNV (GLuint group, GLuint barrier);
+extern BOOL WINAPI wglQuerySwapGroupNV (HDC hDC, GLuint *group, GLuint *barrier);
+extern BOOL WINAPI wglQueryMaxSwapGroupsNV (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
+extern BOOL WINAPI wglQueryFrameCountNV (HDC hDC, GLuint *count);
+extern BOOL WINAPI wglResetFrameCountNV (HDC hDC);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group);
+typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier);
+typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint *group, GLuint *barrier);
+typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
+typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint *count);
+typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC);
+#endif
+
+#ifndef WGL_NV_gpu_affinity
+#define WGL_NV_gpu_affinity 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglEnumGpusNV (UINT iGpuIndex, HGPUNV *phGpu);
+extern BOOL WINAPI wglEnumGpuDevicesNV (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
+extern HDC WINAPI wglCreateAffinityDCNV (const HGPUNV *phGpuList);
+extern BOOL WINAPI wglEnumGpusFromAffinityDCNV (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
+extern BOOL WINAPI wglDeleteDCNV (HDC hdc);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu);
+typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
+typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList);
+typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
+typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc);
+#endif
+
+#ifndef WGL_AMD_gpu_association
+#define WGL_AMD_gpu_association 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern UINT WINAPI wglGetGPUIDsAMD (UINT maxCount, UINT *ids);
+extern INT WINAPI wglGetGPUInfoAMD (UINT id, int property, GLenum dataType, UINT size, void *data);
+extern UINT WINAPI wglGetContextGPUIDAMD (HGLRC hglrc);
+extern HGLRC WINAPI wglCreateAssociatedContextAMD (UINT id);
+extern HGLRC WINAPI wglCreateAssociatedContextAttribsAMD (UINT id, HGLRC hShareContext, const int *attribList);
+extern BOOL WINAPI wglDeleteAssociatedContextAMD (HGLRC hglrc);
+extern BOOL WINAPI wglMakeAssociatedContextCurrentAMD (HGLRC hglrc);
+extern HGLRC WINAPI wglGetCurrentAssociatedContextAMD (void);
+extern VOID WINAPI wglBlitContextFramebufferAMD (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT *ids);
+typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, int property, GLenum dataType, UINT size, void *data);
+typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc);
+typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id);
+typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int *attribList);
+typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc);
+typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc);
+typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);
+typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#endif
+
+#ifndef WGL_NV_video_capture
+#define WGL_NV_video_capture 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglBindVideoCaptureDeviceNV (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
+extern UINT WINAPI wglEnumerateVideoCaptureDevicesNV (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
+extern BOOL WINAPI wglLockVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
+extern BOOL WINAPI wglQueryVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
+extern BOOL WINAPI wglReleaseVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
+typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
+typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
+typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
+typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
+#endif
+
+#ifndef WGL_NV_copy_image
+#define WGL_NV_copy_image 1
+#ifdef WGL_WGLEXT_PROTOTYPES
+extern BOOL WINAPI wglCopyImageSubDataNV (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
+#endif /* WGL_WGLEXT_PROTOTYPES */
+typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
+#endif
+
+#ifndef WGL_NV_multisample_coverage
+#define WGL_NV_multisample_coverage 1
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.0
+ * Copyright (C) 1995-1998 Brian Paul
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+/*
+ * Windows driver by: Mark E. Peterson (markp@ic.mankato.mn.us)
+ * Updated by Li Wei (liwei@aiar.xjtu.edu.cn)
+ *
+ *
+ ***************************************************************
+ * WMesa *
+ * version 2.3 *
+ * *
+ * By *
+ * Li Wei *
+ * Institute of Artificial Intelligence & Robotics *
+ * Xi'an Jiaotong University *
+ * Email: liwei@aiar.xjtu.edu.cn *
+ * Web page: http://sun.aiar.xjtu.edu.cn *
+ * *
+ * July 7th, 1997 *
+ ***************************************************************
+ */
+
+
+#ifndef WMESA_H
+#define WMESA_H
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include "GL/gl.h"
+
+#if defined(_MSV_VER) && !defined(__GNUC__)
+# pragma warning (disable:4273)
+# pragma warning( disable : 4244 ) /* '=' : conversion from 'const double ' to 'float ', possible loss of data */
+# pragma warning( disable : 4018 ) /* '<' : signed/unsigned mismatch */
+# pragma warning( disable : 4305 ) /* '=' : truncation from 'const double ' to 'float ' */
+# pragma warning( disable : 4013 ) /* 'function' undefined; assuming extern returning int */
+# pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */
+# pragma warning( disable : 4273 ) /* 'identifier' : inconsistent DLL linkage. dllexport assumed */
+# if (MESA_WARNQUIET>1)
+# pragma warning( disable : 4146 ) /* unary minus operator applied to unsigned type, result still unsigned */
+# endif
+#endif
+
+/*
+ * This is the WMesa context 'handle':
+ */
+typedef struct wmesa_context *WMesaContext;
+
+
+
+/*
+ * Create a new WMesaContext for rendering into a window. You must
+ * have already created the window of correct visual type and with an
+ * appropriate colormap.
+ *
+ * Input:
+ * hDC - Windows device or memory context
+ * Pal - Palette to use
+ * rgb_flag - GL_TRUE = RGB mode,
+ * GL_FALSE = color index mode
+ * db_flag - GL_TRUE = double-buffered,
+ * GL_FALSE = single buffered
+ * alpha_flag - GL_TRUE = create software alpha buffer,
+ * GL_FALSE = no software alpha buffer
+ *
+ * Note: Indexed mode requires double buffering under Windows.
+ *
+ * Return: a WMesa_context or NULL if error.
+ */
+extern WMesaContext WMesaCreateContext(HDC hDC,HPALETTE* pPal,
+ GLboolean rgb_flag,
+ GLboolean db_flag,
+ GLboolean alpha_flag);
+
+
+/*
+ * Destroy a rendering context as returned by WMesaCreateContext()
+ */
+extern void WMesaDestroyContext( WMesaContext ctx );
+
+
+
+/*
+ * Make the specified context the current one.
+ */
+extern void WMesaMakeCurrent( WMesaContext ctx, HDC hdc );
+
+
+/*
+ * Return a handle to the current context.
+ */
+extern WMesaContext WMesaGetCurrentContext( void );
+
+
+/*
+ * Swap the front and back buffers for the current context. No action
+ * taken if the context is not double buffered.
+ */
+extern void WMesaSwapBuffers(HDC hdc);
+
+
+/*
+ * In indexed color mode we need to know when the palette changes.
+ */
+extern void WMesaPaletteChange(HPALETTE Pal);
+
+extern void WMesaMove(void);
+
+void WMesaShareLists(WMesaContext ctx_to_share, WMesaContext ctx);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
+
--- /dev/null
+/*
+ * 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_ */
--- /dev/null
+#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_ */
+
--- /dev/null
+#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
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __glext_h_ */
+
--- /dev/null
+#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_ */
--- /dev/null
+#ifndef __gl2_h_
+#define __gl2_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 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.
+*/
+/*
+** 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: 23422 $ on $Date: 2013-10-08 15:40:45 -0700 (Tue, 08 Oct 2013) $
+*/
+
+#include <GLES2/gl2platform.h>
+
+/* 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_INDEX 0x1901
+#define GL_STENCIL_INDEX8 0x8D48
+#define GL_RENDERBUFFER_WIDTH 0x8D42
+#define GL_RENDERBUFFER_HEIGHT 0x8D43
+#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
+#define GL_RENDERBUFFER_RED_SIZE 0x8D50
+#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
+#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
+#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
+#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
+#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
+#define GL_COLOR_ATTACHMENT0 0x8CE0
+#define GL_DEPTH_ATTACHMENT 0x8D00
+#define GL_STENCIL_ATTACHMENT 0x8D20
+#define GL_NONE 0
+#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
+#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
+#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
+#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
+#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
+#define GL_FRAMEBUFFER_BINDING 0x8CA6
+#define GL_RENDERBUFFER_BINDING 0x8CA7
+#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
+#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
+GL_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 *params);
+GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL GLenum GL_APIENTRY glGetError (void);
+GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
+GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
+GL_APICALL const GLubyte *GL_APIENTRY glGetString (GLenum name);
+GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params);
+GL_APICALL 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 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null
+#ifndef __gl2ext_h_
+#define __gl2ext_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 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.
+*/
+/*
+** 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: 23422 $ on $Date: 2013-10-08 15:40:45 -0700 (Tue, 08 Oct 2013) $
+*/
+
+#ifndef GL_APIENTRYP
+#define GL_APIENTRYP GL_APIENTRY*
+#endif
+
+/* 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_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_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_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_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
+#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_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_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_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_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_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_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_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_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_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
+#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_integer_mix
+#define GL_EXT_shader_integer_mix 1
+#endif /* GL_EXT_shader_integer_mix */
+
+#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_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_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_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_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 */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null
+#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_ */
--- /dev/null
+#ifndef __gl3_h_
+#define __gl3_h_ 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 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.
+*/
+/*
+** 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: 23422 $ on $Date: 2013-10-08 15:40:45 -0700 (Tue, 08 Oct 2013) $
+*/
+
+#include <GLES3/gl3platform.h>
+
+/* Generated C header for:
+ * API: gles2
+ * Profile: common
+ * Versions considered: [23]\.[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 *params);
+GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL GLenum GL_APIENTRY glGetError (void);
+GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
+GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
+GL_APICALL const GLubyte *GL_APIENTRY glGetString (GLenum name);
+GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params);
+GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params);
+GL_APICALL 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 mode);
+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 *params);
+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
--- /dev/null
+#ifndef __gl3ext_h_
+#define __gl3ext_h_
+
+/* $Revision: 17809 $ on $Date:: 2012-05-14 08:03:36 -0700 #$ */
+
+/*
+ * This document is licensed under the SGI Free Software B License Version
+ * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
+ */
+
+/* OpenGL ES 3 Extensions
+ *
+ * After an OES extension's interactions with OpenGl ES 3.0 have been documented,
+ * its tokens and function definitions should be added to this file in a manner
+ * that does not conflict with gl2ext.h or gl3.h.
+ *
+ * Tokens and function definitions for extensions that have become standard
+ * features in OpenGL ES 3.0 will not be added to this file.
+ *
+ * Applications using OpenGL-ES-2-only extensions should include gl2ext.h
+ */
+
+#endif /* __gl3ext_h_ */
+
--- /dev/null
+#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_ */
--- /dev/null
+#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_ */
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _WAYLAND_DRM_H_
+#define _WAYLAND_DRM_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+
+struct wl_drm;
+struct wl_resource;
+struct wl_display;
+struct wl_drm_buffer;
+struct vigs_drm_surface;
+
+struct wayland_drm_callbacks
+{
+ int (*authenticate)(void */*user_data*/,
+ uint32_t /*id*/);
+
+ struct vigs_drm_surface *(*acquire_buffer)(void */*user_data*/,
+ uint32_t /*name*/);
+};
+
+struct wl_drm *wayland_drm_create(struct wl_display *display,
+ char *device_name,
+ struct wayland_drm_callbacks *callbacks,
+ void *user_data);
+
+void wayland_drm_destroy(struct wl_drm *drm);
+
+struct wl_drm_buffer *wayland_drm_get_buffer(struct wl_resource *resource);
+
+struct vigs_drm_surface *wayland_drm_buffer_get_sfc(struct wl_drm_buffer *buffer);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_CLIENT_CONTEXT_H_
+#define _YAGL_CLIENT_CONTEXT_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+
+struct yagl_sharegroup;
+struct yagl_client_image;
+struct yagl_tex_image_binding;
+
+struct yagl_client_context
+{
+ yagl_client_api client_api;
+
+ struct yagl_sharegroup *sg;
+
+ void (*prepare)(struct yagl_client_context */*ctx*/);
+
+ int (*bind_tex_image)(struct yagl_client_context */*ctx*/,
+ struct yagl_client_image */*image*/,
+ struct yagl_tex_image_binding */*binding*/);
+
+ void (*destroy)(struct yagl_client_context */*ctx*/);
+};
+
+YAGL_API struct yagl_client_context *yagl_get_client_context(void);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_CLIENT_IMAGE_H_
+#define _YAGL_CLIENT_IMAGE_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+#include "yagl_object.h"
+
+struct yagl_client_image
+{
+ struct yagl_object base;
+
+ void (*update)(struct yagl_client_image */*image*/,
+ uint32_t /*width*/,
+ uint32_t /*height*/,
+ uint32_t /*bpp*/,
+ const void */*pixels*/);
+};
+
+YAGL_API void yagl_client_image_init(struct yagl_client_image *image,
+ yagl_ref_destroy_func destroy_func);
+
+YAGL_API void yagl_client_image_cleanup(struct yagl_client_image *image);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+YAGL_API void yagl_client_image_acquire(struct yagl_client_image *image);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+YAGL_API void yagl_client_image_release(struct yagl_client_image *image);
+
+YAGL_API struct yagl_client_image *yagl_acquire_client_image(yagl_host_handle handle);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_CLIENT_INTERFACE_H_
+#define _YAGL_CLIENT_INTERFACE_H_
+
+#include "yagl_types.h"
+
+struct yagl_client_context;
+struct yagl_client_image;
+struct yagl_sharegroup;
+
+struct yagl_client_interface
+{
+ struct yagl_client_context *(*create_ctx)(struct yagl_client_interface */*iface*/,
+ yagl_client_api /*client_api*/,
+ struct yagl_sharegroup */*sg*/);
+
+ struct yagl_client_image
+ *(*create_image)(struct yagl_client_interface */*iface*/,
+ yagl_object_name /*tex_global_name*/);
+
+ void (*release_tex_image)(struct yagl_client_interface */*iface*/,
+ void */*cookie*/);
+};
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_EGL_FENCE_H_
+#define _YAGL_EGL_FENCE_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+#include "yagl_resource.h"
+
+struct yagl_egl_fence
+{
+ struct yagl_resource res;
+
+ int (*wait)(struct yagl_egl_fence */*egl_fence*/);
+
+ int (*signaled)(struct yagl_egl_fence */*egl_fence*/);
+};
+
+YAGL_API int yagl_egl_fence_supported(void);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+YAGL_API void yagl_egl_fence_acquire(struct yagl_egl_fence *egl_fence);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+YAGL_API void yagl_egl_fence_release(struct yagl_egl_fence *egl_fence);
+
+YAGL_API struct yagl_egl_fence *yagl_create_egl_fence(void);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_EXPORT_H_
+#define _YAGL_EXPORT_H_
+
+#include "yagl_types.h"
+
+#define YAGL_API __attribute__ ((visibility("default")))
+
+#define YAGL_ALIAS(name, aliasname) \
+ extern __typeof (name) aliasname __attribute__ ((alias (#name)))
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_GBM_H_
+#define _YAGL_GBM_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+#include <gbm.h>
+
+struct vigs_drm_device;
+struct vigs_drm_surface;
+
+struct gbm_device
+{
+ /*
+ * Hack to make gbm_device detectable by its first element.
+ */
+ struct gbm_device *(*dummy)(int);
+
+ struct vigs_drm_device *drm_dev;
+};
+
+struct gbm_bo
+{
+ struct gbm_device *gbm;
+
+ struct vigs_drm_surface *drm_sfc;
+
+ uint32_t depth;
+};
+
+struct gbm_surface
+{
+ struct gbm_device *gbm;
+
+ uint32_t width;
+ uint32_t height;
+ uint32_t depth;
+ uint32_t format;
+ uint32_t flags;
+
+ struct vigs_drm_surface *(*acquire_back)(struct gbm_surface */*sfc*/);
+
+ void (*swap_buffers)(struct gbm_surface */*sfc*/);
+
+ int (*get_buffer_age)(struct gbm_surface */*sfc*/);
+};
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_IMPL_H_
+#define _YAGL_IMPL_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+#include "yagl_log.h"
+
+/*
+ * Some macros to help implement bare passthrough.
+ */
+
+#define YAGL_IMPLEMENT_API_RET0(ret_type, func) \
+ YAGL_API ret_type func() \
+ { \
+ ret_type tmp; \
+ YAGL_LOG_FUNC_ENTER_SPLIT0(func); \
+ tmp = yagl_host_##func(); \
+ YAGL_LOG_FUNC_EXIT_SPLIT(ret_type, tmp); \
+ return tmp; \
+ }
+
+#define YAGL_IMPLEMENT_API_NORET0(func) \
+ YAGL_API void func() \
+ { \
+ YAGL_LOG_FUNC_ENTER_SPLIT0(func); \
+ yagl_host_##func(); \
+ YAGL_LOG_FUNC_EXIT(NULL); \
+ }
+
+#define YAGL_IMPLEMENT_API_RET1(ret_type, func, a0_type, a0) \
+ YAGL_API ret_type func(a0_type a0) \
+ { \
+ ret_type tmp; \
+ YAGL_LOG_FUNC_ENTER_SPLIT1(func, a0_type, a0); \
+ tmp = yagl_host_##func(a0); \
+ YAGL_LOG_FUNC_EXIT_SPLIT(ret_type, tmp); \
+ return tmp; \
+ }
+
+#define YAGL_IMPLEMENT_API_NORET1(func, a0_type, a0) \
+ YAGL_API void func(a0_type a0) \
+ { \
+ YAGL_LOG_FUNC_ENTER_SPLIT1(func, a0_type, a0); \
+ yagl_host_##func(a0); \
+ YAGL_LOG_FUNC_EXIT(NULL); \
+ }
+
+#define YAGL_IMPLEMENT_API_RET2(ret_type, func, a0_type, a1_type, a0, a1) \
+ YAGL_API ret_type func(a0_type a0, a1_type a1) \
+ { \
+ ret_type tmp; \
+ YAGL_LOG_FUNC_ENTER_SPLIT2(func, a0_type, a1_type, a0, a1); \
+ tmp = yagl_host_##func(a0, a1); \
+ YAGL_LOG_FUNC_EXIT_SPLIT(ret_type, tmp); \
+ return tmp; \
+ }
+
+#define YAGL_IMPLEMENT_API_NORET2(func, a0_type, a1_type, a0, a1) \
+ YAGL_API void func(a0_type a0, a1_type a1) \
+ { \
+ YAGL_LOG_FUNC_ENTER_SPLIT2(func, a0_type, a1_type, a0, a1); \
+ yagl_host_##func(a0, a1); \
+ YAGL_LOG_FUNC_EXIT(NULL); \
+ }
+
+#define YAGL_IMPLEMENT_API_RET3(ret_type, func, a0_type, a1_type, a2_type, a0, a1, a2) \
+ YAGL_API ret_type func(a0_type a0, a1_type a1, a2_type a2) \
+ { \
+ ret_type tmp; \
+ YAGL_LOG_FUNC_ENTER_SPLIT3(func, a0_type, a1_type, a2_type, a0, a1, a2); \
+ tmp = yagl_host_##func(a0, a1, a2); \
+ YAGL_LOG_FUNC_EXIT_SPLIT(ret_type, tmp); \
+ return tmp; \
+ }
+
+#define YAGL_IMPLEMENT_API_NORET3(func, a0_type, a1_type, a2_type, a0, a1, a2) \
+ YAGL_API void func(a0_type a0, a1_type a1, a2_type a2) \
+ { \
+ YAGL_LOG_FUNC_ENTER_SPLIT3(func, a0_type, a1_type, a2_type, a0, a1, a2); \
+ yagl_host_##func(a0, a1, a2); \
+ YAGL_LOG_FUNC_EXIT(NULL); \
+ }
+
+#define YAGL_IMPLEMENT_API_RET4(ret_type, func, a0_type, a1_type, a2_type, a3_type, a0, a1, a2, a3) \
+ YAGL_API ret_type func(a0_type a0, a1_type a1, a2_type a2, a3_type a3) \
+ { \
+ ret_type tmp; \
+ YAGL_LOG_FUNC_ENTER_SPLIT4(func, a0_type, a1_type, a2_type, a3_type, a0, a1, a2, a3); \
+ tmp = yagl_host_##func(a0, a1, a2, a3); \
+ YAGL_LOG_FUNC_EXIT_SPLIT(ret_type, tmp); \
+ return tmp; \
+ }
+
+#define YAGL_IMPLEMENT_API_NORET4(func, a0_type, a1_type, a2_type, a3_type, a0, a1, a2, a3) \
+ YAGL_API void func(a0_type a0, a1_type a1, a2_type a2, a3_type a3) \
+ { \
+ YAGL_LOG_FUNC_ENTER_SPLIT4(func, a0_type, a1_type, a2_type, a3_type, a0, a1, a2, a3); \
+ yagl_host_##func(a0, a1, a2, a3); \
+ YAGL_LOG_FUNC_EXIT(NULL); \
+ }
+
+#define YAGL_IMPLEMENT_API_RET5(ret_type, func, a0_type, a1_type, a2_type, a3_type, a4_type, a0, a1, a2, a3, a4) \
+ YAGL_API ret_type func(a0_type a0, a1_type a1, a2_type a2, a3_type a3, a4_type a4) \
+ { \
+ ret_type tmp; \
+ YAGL_LOG_FUNC_ENTER_SPLIT5(func, a0_type, a1_type, a2_type, a3_type, a4_type, a0, a1, a2, a3, a4); \
+ tmp = yagl_host_##func(a0, a1, a2, a3, a4); \
+ YAGL_LOG_FUNC_EXIT_SPLIT(ret_type, tmp); \
+ return tmp; \
+ }
+
+#define YAGL_IMPLEMENT_API_NORET5(func, a0_type, a1_type, a2_type, a3_type, a4_type, a0, a1, a2, a3, a4) \
+ YAGL_API void func(a0_type a0, a1_type a1, a2_type a2, a3_type a3, a4_type a4) \
+ { \
+ YAGL_LOG_FUNC_ENTER_SPLIT5(func, a0_type, a1_type, a2_type, a3_type, a4_type, a0, a1, a2, a3, a4); \
+ yagl_host_##func(a0, a1, a2, a3, a4); \
+ YAGL_LOG_FUNC_EXIT(NULL); \
+ }
+
+#define YAGL_IMPLEMENT_API_RET6(ret_type, func, a0_type, a1_type, a2_type, a3_type, a4_type, a5_type, a0, a1, a2, a3, a4, a5) \
+ YAGL_API ret_type func(a0_type a0, a1_type a1, a2_type a2, a3_type a3, a4_type a4, a5_type a5) \
+ { \
+ ret_type tmp; \
+ YAGL_LOG_FUNC_ENTER_SPLIT6(func, a0_type, a1_type, a2_type, a3_type, a4_type, a5_type, a0, a1, a2, a3, a4, a5); \
+ tmp = yagl_host_##func(a0, a1, a2, a3, a4, a5); \
+ YAGL_LOG_FUNC_EXIT_SPLIT(ret_type, tmp); \
+ return tmp; \
+ }
+
+#define YAGL_IMPLEMENT_API_NORET6(func, a0_type, a1_type, a2_type, a3_type, a4_type, a5_type, a0, a1, a2, a3, a4, a5) \
+ YAGL_API void func(a0_type a0, a1_type a1, a2_type a2, a3_type a3, a4_type a4, a5_type a5) \
+ { \
+ YAGL_LOG_FUNC_ENTER_SPLIT6(func, a0_type, a1_type, a2_type, a3_type, a4_type, a5_type, a0, a1, a2, a3, a4, a5); \
+ yagl_host_##func(a0, a1, a2, a3, a4, a5); \
+ YAGL_LOG_FUNC_EXIT(NULL); \
+ }
+
+#define YAGL_IMPLEMENT_API_RET7(ret_type, func, a0_type, a1_type, a2_type, a3_type, a4_type, a5_type, a6_type, a0, a1, a2, a3, a4, a5, a6) \
+ YAGL_API ret_type func(a0_type a0, a1_type a1, a2_type a2, a3_type a3, a4_type a4, a5_type a5, a6_type a6) \
+ { \
+ ret_type tmp; \
+ YAGL_LOG_FUNC_ENTER_SPLIT7(func, a0_type, a1_type, a2_type, a3_type, a4_type, a5_type, a6_type, a0, a1, a2, a3, a4, a5, a6); \
+ tmp = yagl_host_##func(a0, a1, a2, a3, a4, a5, a6); \
+ YAGL_LOG_FUNC_EXIT_SPLIT(ret_type, tmp); \
+ return tmp; \
+ }
+
+#define YAGL_IMPLEMENT_API_NORET7(func, a0_type, a1_type, a2_type, a3_type, a4_type, a5_type, a6_type, a0, a1, a2, a3, a4, a5, a6) \
+ YAGL_API void func(a0_type a0, a1_type a1, a2_type a2, a3_type a3, a4_type a4, a5_type a5, a6_type a6) \
+ { \
+ YAGL_LOG_FUNC_ENTER_SPLIT7(func, a0_type, a1_type, a2_type, a3_type, a4_type, a5_type, a6_type, a0, a1, a2, a3, a4, a5, a6); \
+ yagl_host_##func(a0, a1, a2, a3, a4, a5, a6); \
+ YAGL_LOG_FUNC_EXIT(NULL); \
+ }
+
+#define YAGL_IMPLEMENT_API_RET8(ret_type, func, a0_type, a1_type, a2_type, a3_type, a4_type, a5_type, a6_type, a7_type, a0, a1, a2, a3, a4, a5, a6, a7) \
+ YAGL_API ret_type func(a0_type a0, a1_type a1, a2_type a2, a3_type a3, a4_type a4, a5_type a5, a6_type a6, a7_type a7) \
+ { \
+ ret_type tmp; \
+ YAGL_LOG_FUNC_ENTER_SPLIT8(func, a0_type, a1_type, a2_type, a3_type, a4_type, a5_type, a6_type, a7_type, a0, a1, a2, a3, a4, a5, a6, a7); \
+ tmp = yagl_host_##func(a0, a1, a2, a3, a4, a5, a6, a7); \
+ YAGL_LOG_FUNC_EXIT_SPLIT(ret_type, tmp); \
+ return tmp; \
+ }
+
+#define YAGL_IMPLEMENT_API_NORET8(func, a0_type, a1_type, a2_type, a3_type, a4_type, a5_type, a6_type, a7_type, a0, a1, a2, a3, a4, a5, a6, a7) \
+ YAGL_API void func(a0_type a0, a1_type a1, a2_type a2, a3_type a3, a4_type a4, a5_type a5, a6_type a6, a7_type a7) \
+ { \
+ YAGL_LOG_FUNC_ENTER_SPLIT8(func, a0_type, a1_type, a2_type, a3_type, a4_type, a5_type, a6_type, a7_type, a0, a1, a2, a3, a4, a5, a6, a7); \
+ yagl_host_##func(a0, a1, a2, a3, a4, a5, a6, a7); \
+ YAGL_LOG_FUNC_EXIT(NULL); \
+ }
+
+#define YAGL_IMPLEMENT_API_RET9(ret_type, func, a0_type, a1_type, a2_type, a3_type, a4_type, a5_type, a6_type, a7_type, a8_type, a0, a1, a2, a3, a4, a5, a6, a7, a8) \
+ YAGL_API ret_type func(a0_type a0, a1_type a1, a2_type a2, a3_type a3, a4_type a4, a5_type a5, a6_type a6, a7_type a7, a8_type a8) \
+ { \
+ ret_type tmp; \
+ YAGL_LOG_FUNC_ENTER_SPLIT9(func, a0_type, a1_type, a2_type, a3_type, a4_type, a5_type, a6_type, a7_type, a8_type, a0, a1, a2, a3, a4, a5, a6, a7, a8); \
+ tmp = yagl_host_##func(a0, a1, a2, a3, a4, a5, a6, a7, a8); \
+ YAGL_LOG_FUNC_EXIT_SPLIT(ret_type, tmp); \
+ return tmp; \
+ }
+
+#define YAGL_IMPLEMENT_API_NORET9(func, a0_type, a1_type, a2_type, a3_type, a4_type, a5_type, a6_type, a7_type, a8_type, a0, a1, a2, a3, a4, a5, a6, a7, a8) \
+ YAGL_API void func(a0_type a0, a1_type a1, a2_type a2, a3_type a3, a4_type a4, a5_type a5, a6_type a6, a7_type a7, a8_type a8) \
+ { \
+ YAGL_LOG_FUNC_ENTER_SPLIT9(func, a0_type, a1_type, a2_type, a3_type, a4_type, a5_type, a6_type, a7_type, a8_type, a0, a1, a2, a3, a4, a5, a6, a7, a8); \
+ yagl_host_##func(a0, a1, a2, a3, a4, a5, a6, a7, a8); \
+ YAGL_LOG_FUNC_EXIT(NULL); \
+ }
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_IOCTL_H_
+#define _YAGL_IOCTL_H_
+
+#include <linux/ioctl.h>
+
+/*
+ * Version number.
+ */
+#define YAGL_VERSION 23
+
+/*
+ * Device control codes magic.
+ */
+#define YAGL_IOC_MAGIC 'Y'
+
+/*
+ * Get version number.
+ */
+#define YAGL_IOC_GET_VERSION _IOR(YAGL_IOC_MAGIC, 0, unsigned int)
+
+/*
+ * Get user info.
+ */
+struct yagl_user_info
+{
+ unsigned int index;
+ unsigned int render_type;
+ unsigned int gl_version;
+};
+
+#define YAGL_IOC_GET_USER_INFO _IOR(YAGL_IOC_MAGIC, 1, struct yagl_user_info)
+
+/*
+ * Locks/unlocks memory. Exists solely
+ * for offscreen backend's backing images.
+ * @{
+ */
+
+struct yagl_mlock_arg
+{
+ unsigned long address;
+ unsigned int size;
+};
+
+#define YAGL_IOC_MLOCK _IOW(YAGL_IOC_MAGIC, 2, struct yagl_mlock_arg)
+
+#define YAGL_IOC_MUNLOCK _IOW(YAGL_IOC_MAGIC, 3, unsigned long)
+
+/*
+ * @}
+ */
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_LIST_H_
+#define _YAGL_LIST_H_
+
+#include "yagl_types.h"
+
+struct yagl_list
+{
+ struct yagl_list* prev;
+ struct yagl_list* next;
+};
+
+/*
+ * Private interface.
+ */
+
+static __inline void __yagl_list_add( struct yagl_list* nw,
+ struct yagl_list* prev,
+ struct yagl_list* next )
+{
+ next->prev = nw;
+ nw->next = next;
+ nw->prev = prev;
+ prev->next = nw;
+}
+
+static __inline void __yagl_list_remove( struct yagl_list* prev,
+ struct yagl_list* next )
+{
+ next->prev = prev;
+ prev->next = next;
+}
+
+/*
+ * Public interface.
+ */
+
+#define YAGL_DECLARE_LIST(name) struct yagl_list name = { &(name), &(name) }
+
+static __inline void yagl_list_init(struct yagl_list* list)
+{
+ list->next = list;
+ list->prev = list;
+}
+
+static __inline void yagl_list_add(struct yagl_list* head, struct yagl_list* nw)
+{
+ __yagl_list_add(nw, head, head->next);
+}
+
+static __inline void yagl_list_add_tail(struct yagl_list* head, struct yagl_list* nw)
+{
+ __yagl_list_add(nw, head->prev, head);
+}
+
+static __inline void yagl_list_remove(struct yagl_list* entry)
+{
+ __yagl_list_remove(entry->prev, entry->next);
+ yagl_list_init(entry);
+}
+
+static __inline int yagl_list_empty(const struct yagl_list* head)
+{
+ return ( (head->next == head) && (head->prev == head) );
+}
+
+#define yagl_list_first(container_type, iter, head, member) iter = yagl_containerof((head)->next, container_type, member)
+
+#define yagl_list_last(container_type, iter, head, member) iter = yagl_containerof((head)->prev, container_type, member)
+
+/*
+ * Iterate over list in direct and reverse order.
+ */
+
+#define yagl_list_for_each(container_type, iter, head, member) \
+ for ( iter = yagl_containerof((head)->next, container_type, member); \
+ &iter->member != (head); \
+ iter = yagl_containerof(iter->member.next, container_type, member) )
+
+#define yagl_list_for_each_reverse(container_type, iter, head, member) \
+ for ( iter = yagl_containerof((head)->prev, container_type, member); \
+ &iter->member != (head); \
+ iter = yagl_containerof(iter->member.prev, container_type, member) )
+
+/*
+ * Iterate over list in direct and reverse order, safe to list entries removal.
+ */
+
+#define yagl_list_for_each_safe(container_type, iter, tmp_iter, head, member) \
+ for ( iter = yagl_containerof((head)->next, container_type, member), \
+ tmp_iter = yagl_containerof(iter->member.next, container_type, member); \
+ &iter->member != (head); \
+ iter = tmp_iter, tmp_iter = yagl_containerof(tmp_iter->member.next, container_type, member) )
+
+#define yagl_list_for_each_safe_reverse(container_type, iter, tmp_iter, head, member) \
+ for ( iter = yagl_containerof((head)->prev, container_type, member), \
+ tmp_iter = yagl_containerof(iter->member.prev, container_type, member); \
+ &iter->member != (head); \
+ iter = tmp_iter, tmp_iter = yagl_containerof(tmp_iter->member.prev, container_type, member) )
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_LOG_H_
+#define _YAGL_LOG_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+#include <sys/types.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+
+typedef enum
+{
+ yagl_log_level_off = 0,
+ yagl_log_level_error = 1,
+ yagl_log_level_warn = 2,
+ yagl_log_level_info = 3,
+ yagl_log_level_debug = 4,
+ yagl_log_level_trace = 5
+} yagl_log_level;
+
+#define yagl_log_level_max 5
+
+YAGL_API void yagl_log_init(void);
+
+YAGL_API void yagl_log_event(yagl_log_level log_level,
+ pid_t process_id,
+ pid_t thread_id,
+ const char* facility,
+ int line,
+ const char* format, ...);
+
+YAGL_API void yagl_log_func_enter(pid_t process_id,
+ pid_t thread_id,
+ const char* func,
+ int line,
+ const char* format, ...);
+
+YAGL_API void yagl_log_func_exit(pid_t process_id,
+ pid_t thread_id,
+ const char* func,
+ int line,
+ const char* format, ...);
+
+/*
+ * Convenience function that uses datatypes instead of format strings, one for each
+ * function argument.
+ *
+ * 'num_args' is number of arguments to the function, then come 'num_args'
+ * (datatype, arg) strings, then come 'num_args' arguments. i.e. the call is
+ * like this:
+ * yagl_log_func_enter_split(0, 0, "my_func", 123, 2, "EGLint", "arg_1", "EGLDisplay", "arg_2", 12, my_ptr);
+ *
+ * This function uses constant size storage for final format string creation,
+ * be sure not to pass too many arguments, the overall size must not
+ * exceed 1024 characters.
+ *
+ * If one of the argument datatypes is not a supported datatype, then argument
+ * formatting is skipped and "..." is printed instead.
+ */
+YAGL_API void yagl_log_func_enter_split(pid_t process_id,
+ pid_t thread_id,
+ const char* func,
+ int line,
+ int num_args, ...);
+
+/*
+ * Same as above, but only one datatype is required and only one argument
+ * is needed. i.e.:
+ * yagl_log_func_exit_split(0, 0, "my_func", 234, "EGLint", 123);
+ */
+YAGL_API void yagl_log_func_exit_split(pid_t process_id,
+ pid_t thread_id,
+ const char* func,
+ int line,
+ const char* datatype, ...);
+
+YAGL_API int yagl_log_is_enabled_for_level(yagl_log_level log_level);
+
+YAGL_API int yagl_log_is_enabled_for_facility(const char* facility);
+
+YAGL_API int yagl_log_is_enabled_for_func_tracing(void);
+
+#ifndef NDEBUG
+#define YAGL_LOG_EVENT(log_level, pid, tid, facility, format, ...) \
+ do \
+ { \
+ if ( yagl_log_is_enabled_for_level(yagl_log_level_##log_level) && \
+ yagl_log_is_enabled_for_facility(facility) ) \
+ { \
+ yagl_log_event(yagl_log_level_##log_level, pid, tid, facility, __LINE__, format,##__VA_ARGS__); \
+ } \
+ } while(0)
+
+#define YAGL_LOG_FUNC_SET(func) \
+ const char* _yagl_log_current_func = #func; \
+ pid_t _yagl_log_current_pid = getpid(); \
+ pid_t _yagl_log_current_tid = syscall(SYS_gettid)
+
+#define YAGL_LOG_FUNC_ENTER(func, format, ...) \
+ YAGL_LOG_FUNC_SET(func); \
+ do \
+ { \
+ if ( yagl_log_is_enabled_for_func_tracing() && \
+ yagl_log_is_enabled_for_facility(_yagl_log_current_func) ) \
+ { \
+ yagl_log_func_enter(_yagl_log_current_pid, _yagl_log_current_tid, _yagl_log_current_func, __LINE__, format,##__VA_ARGS__); \
+ } \
+ } while(0)
+
+#define YAGL_LOG_FUNC_ENTER_SPLIT(func, num_args, ...) \
+ YAGL_LOG_FUNC_SET(func); \
+ do \
+ { \
+ if ( yagl_log_is_enabled_for_func_tracing() && \
+ yagl_log_is_enabled_for_facility(_yagl_log_current_func) ) \
+ { \
+ yagl_log_func_enter_split(_yagl_log_current_pid, _yagl_log_current_tid, _yagl_log_current_func, __LINE__, num_args,##__VA_ARGS__); \
+ } \
+ } while(0)
+
+#define YAGL_LOG_FUNC_EXIT(format, ...) \
+ do \
+ { \
+ if ( yagl_log_is_enabled_for_func_tracing() && \
+ yagl_log_is_enabled_for_facility(_yagl_log_current_func) ) \
+ { \
+ yagl_log_func_exit(_yagl_log_current_pid, _yagl_log_current_tid, _yagl_log_current_func, __LINE__, format,##__VA_ARGS__); \
+ } \
+ } while(0)
+
+#define YAGL_LOG_FUNC_EXIT_SPLIT(ret_type, ret) \
+ do \
+ { \
+ if ( yagl_log_is_enabled_for_func_tracing() && \
+ yagl_log_is_enabled_for_facility(_yagl_log_current_func) ) \
+ { \
+ yagl_log_func_exit_split(_yagl_log_current_pid, _yagl_log_current_tid, _yagl_log_current_func, __LINE__, #ret_type, ret); \
+ } \
+ } while(0)
+#else
+#define YAGL_LOG_EVENT(log_level, pid, tid, facility, format, ...)
+#define YAGL_LOG_FUNC_SET(func)
+#define YAGL_LOG_FUNC_ENTER(func, format, ...)
+#define YAGL_LOG_FUNC_ENTER_SPLIT(func, num_args, ...)
+#define YAGL_LOG_FUNC_EXIT(format, ...)
+#define YAGL_LOG_FUNC_EXIT_SPLIT(ret_type, ret)
+#endif
+
+#define YAGL_LOG_FUNC_ENTER_SPLIT0(func) YAGL_LOG_FUNC_ENTER_SPLIT(func, 0)
+
+#define YAGL_LOG_FUNC_ENTER_SPLIT1(func, arg0_type, arg0) \
+ YAGL_LOG_FUNC_ENTER_SPLIT(func, 1, #arg0_type, #arg0, arg0)
+
+#define YAGL_LOG_FUNC_ENTER_SPLIT2(func, arg0_type, arg1_type, arg0, arg1) \
+ YAGL_LOG_FUNC_ENTER_SPLIT(func, 2, #arg0_type, #arg0, #arg1_type, #arg1, arg0, arg1)
+
+#define YAGL_LOG_FUNC_ENTER_SPLIT3( func, \
+ arg0_type, arg1_type, arg2_type, \
+ arg0, arg1, arg2 ) \
+ YAGL_LOG_FUNC_ENTER_SPLIT( func, 3, \
+ #arg0_type, #arg0, #arg1_type, #arg1, #arg2_type, #arg2, \
+ arg0, arg1, arg2 )
+
+#define YAGL_LOG_FUNC_ENTER_SPLIT4( func, \
+ arg0_type, arg1_type, arg2_type, arg3_type, \
+ arg0, arg1, arg2, arg3 ) \
+ YAGL_LOG_FUNC_ENTER_SPLIT( func, 4, \
+ #arg0_type, #arg0, #arg1_type, #arg1, #arg2_type, #arg2, #arg3_type, #arg3, \
+ arg0, arg1, arg2, arg3 )
+
+#define YAGL_LOG_FUNC_ENTER_SPLIT5( func, \
+ arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, \
+ arg0, arg1, arg2, arg3, arg4 ) \
+ YAGL_LOG_FUNC_ENTER_SPLIT( func, 5, \
+ #arg0_type, #arg0, #arg1_type, #arg1, #arg2_type, #arg2, #arg3_type, #arg3, #arg4_type, #arg4, \
+ arg0, arg1, arg2, arg3, arg4 )
+
+#define YAGL_LOG_FUNC_ENTER_SPLIT6( func, \
+ arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, \
+ arg0, arg1, arg2, arg3, arg4, arg5 ) \
+ YAGL_LOG_FUNC_ENTER_SPLIT( func, 6, \
+ #arg0_type, #arg0, #arg1_type, #arg1, #arg2_type, #arg2, #arg3_type, #arg3, #arg4_type, #arg4, #arg5_type, #arg5, \
+ arg0, arg1, arg2, arg3, arg4, arg5 )
+
+#define YAGL_LOG_FUNC_ENTER_SPLIT7( func, \
+ arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, \
+ arg0, arg1, arg2, arg3, arg4, arg5, arg6 ) \
+ YAGL_LOG_FUNC_ENTER_SPLIT( func, 7, \
+ #arg0_type, #arg0, #arg1_type, #arg1, #arg2_type, #arg2, #arg3_type, #arg3, #arg4_type, #arg4, #arg5_type, #arg5, #arg6_type, #arg6, \
+ arg0, arg1, arg2, arg3, arg4, arg5, arg6 )
+
+#define YAGL_LOG_FUNC_ENTER_SPLIT8( func, \
+ arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, \
+ arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 ) \
+ YAGL_LOG_FUNC_ENTER_SPLIT( func, 8, \
+ #arg0_type, #arg0, #arg1_type, #arg1, #arg2_type, #arg2, #arg3_type, #arg3, #arg4_type, #arg4, #arg5_type, #arg5, #arg6_type, #arg6, #arg7_type, #arg7, \
+ arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 )
+
+#define YAGL_LOG_FUNC_ENTER_SPLIT9( func, \
+ arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, \
+ arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 ) \
+ YAGL_LOG_FUNC_ENTER_SPLIT( func, 9, \
+ #arg0_type, #arg0, #arg1_type, #arg1, #arg2_type, #arg2, #arg3_type, #arg3, #arg4_type, #arg4, #arg5_type, #arg5, #arg6_type, #arg6, #arg7_type, #arg7, #arg8_type, #arg8, \
+ arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 )
+
+#define YAGL_LOG_FUNC_ENTER_SPLIT10( func, \
+ arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, arg9_type, \
+ arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 ) \
+ YAGL_LOG_FUNC_ENTER_SPLIT( func, 10, \
+ #arg0_type, #arg0, #arg1_type, #arg1, #arg2_type, #arg2, #arg3_type, #arg3, #arg4_type, #arg4, #arg5_type, #arg5, #arg6_type, #arg6, #arg7_type, #arg7, #arg8_type, #arg8, #arg9_type, #arg9, \
+ arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 )
+
+#define YAGL_LOG_FUNC_ENTER_SPLIT11( func, \
+ arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, arg9_type, arg10_type, \
+ arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 ) \
+ YAGL_LOG_FUNC_ENTER_SPLIT( func, 11, \
+ #arg0_type, #arg0, #arg1_type, #arg1, #arg2_type, #arg2, #arg3_type, #arg3, #arg4_type, #arg4, #arg5_type, #arg5, #arg6_type, #arg6, #arg7_type, #arg7, #arg8_type, #arg8, #arg9_type, #arg9, #arg10_type, #arg10, \
+ arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 )
+
+#define YAGL_LOG_TRACE(format, ...) YAGL_LOG_EVENT(trace, _yagl_log_current_pid, _yagl_log_current_tid, _yagl_log_current_func, format,##__VA_ARGS__)
+#define YAGL_LOG_DEBUG(format, ...) YAGL_LOG_EVENT(debug, _yagl_log_current_pid, _yagl_log_current_tid, _yagl_log_current_func, format,##__VA_ARGS__)
+#define YAGL_LOG_INFO(format, ...) YAGL_LOG_EVENT(info, _yagl_log_current_pid, _yagl_log_current_tid, _yagl_log_current_func, format,##__VA_ARGS__)
+#define YAGL_LOG_WARN(format, ...) YAGL_LOG_EVENT(warn, _yagl_log_current_pid, _yagl_log_current_tid, _yagl_log_current_func, format,##__VA_ARGS__)
+#define YAGL_LOG_ERROR(format, ...) YAGL_LOG_EVENT(error, _yagl_log_current_pid, _yagl_log_current_tid, _yagl_log_current_func, format,##__VA_ARGS__)
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_MALLOC_H_
+#define _YAGL_MALLOC_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+
+YAGL_API void *yagl_malloc(size_t size);
+
+YAGL_API void *yagl_malloc0(size_t size);
+
+YAGL_API void *yagl_realloc(void *ptr, size_t size);
+
+YAGL_API void yagl_free(void* ptr);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_NAMESPACE_H_
+#define _YAGL_NAMESPACE_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+
+struct yagl_object;
+struct yagl_avl_table;
+
+struct yagl_namespace
+{
+ struct yagl_avl_table *entries;
+
+ yagl_object_name next_local_name;
+};
+
+YAGL_API void yagl_namespace_init(struct yagl_namespace *ns);
+
+YAGL_API void yagl_namespace_cleanup(struct yagl_namespace *ns);
+
+/*
+ * Adds an object to namespace and sets its local name,
+ * this acquires 'obj', so the
+ * caller should release 'obj' if he doesn't want to use it and wants
+ * it to belong to this namespace alone.
+ */
+YAGL_API void yagl_namespace_add(struct yagl_namespace *ns,
+ struct yagl_object *obj);
+
+/*
+ * Same as the above, but adds an object with local_name.
+ * If an object with such local name already exists then 'obj' will be
+ * released and the existing object will be acquired and returned.
+ * Otherwise, 'obj' is acquired and returned.
+ * Typical use-case for this function is:
+ *
+ * yagl_object *obj;
+ * obj = yagl_namespace_acquire(ns, local_name);
+ * if (!obj) {
+ * obj = yagl_xxx_create(...);
+ * obj = yagl_namespace_add_named(ns, local_name, obj);
+ * }
+ * // use 'obj'.
+ * yagl_object_release(obj);
+ */
+YAGL_API struct yagl_object *yagl_namespace_add_named(struct yagl_namespace *ns,
+ yagl_object_name local_name,
+ struct yagl_object *obj);
+
+/*
+ * Removes an object from the namespace, this also releases the
+ * object.
+ */
+YAGL_API void yagl_namespace_remove(struct yagl_namespace *ns,
+ yagl_object_name local_name);
+
+/*
+ * Acquires an object by its local name. Be sure to release the object when
+ * you're done.
+ */
+YAGL_API struct yagl_object *yagl_namespace_acquire(struct yagl_namespace *ns,
+ yagl_object_name local_name);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_OBJECT_H_
+#define _YAGL_OBJECT_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+#include "yagl_ref.h"
+
+/*
+ * This represents OpenGL client object such as buffer, texture, etc.
+ * An object can have a "local name", i.e. name that is visible to an
+ * OpenGL user, that name is unique only within a particular namespace
+ * inside a particular context (or sharegroup to be more precise).
+ * Object implementation will typically also have one or more
+ * "global name"s, which are unique per-process, these names are
+ * used for target <-> host interactions, they're not visible to
+ * OpenGL user, they're implementation details.
+ * It's possible to have an object without a local name, such object
+ * won't be visible to OpenGL user, but can be used internally.
+ *
+ * In OpenGL one can often spot the following scenario:
+ * N = glGenXXX(...) - creates object, returns its name N
+ * glBindXXX(N, ...) - binds name N
+ * glDeleteXXX(N, ...) - frees name N
+ * glGetIntegerv(GL_XXX_BINDING, ...) - must return N though it's free
+ * Thus, local name for an object must be available even after object
+ * is removed from a namespace.
+ */
+
+struct yagl_object
+{
+ struct yagl_ref ref;
+
+ yagl_object_name local_name;
+};
+
+/*
+ * For implementations.
+ * @{
+ */
+
+YAGL_API void yagl_object_init(struct yagl_object *obj,
+ yagl_ref_destroy_func destroy);
+YAGL_API void yagl_object_cleanup(struct yagl_object *obj);
+
+/*
+ * @}
+ */
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+YAGL_API void yagl_object_acquire(struct yagl_object *obj);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+YAGL_API void yagl_object_release(struct yagl_object *obj);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_RANGE_LIST_H_
+#define _YAGL_RANGE_LIST_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+#include "yagl_vector.h"
+
+struct yagl_range_list
+{
+ struct yagl_vector ranges;
+};
+
+YAGL_API void yagl_range_list_init(struct yagl_range_list *range_list);
+
+YAGL_API void yagl_range_list_cleanup(struct yagl_range_list *range_list);
+
+YAGL_API void yagl_range_list_add(struct yagl_range_list *range_list,
+ int start,
+ int size);
+
+YAGL_API int yagl_range_list_size(struct yagl_range_list *range_list);
+
+YAGL_API void yagl_range_list_get(struct yagl_range_list *range_list,
+ int i,
+ int *start,
+ int *size);
+
+YAGL_API void yagl_range_list_clear(struct yagl_range_list *range_list);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_REF_H_
+#define _YAGL_REF_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+#include <pthread.h>
+
+struct yagl_ref;
+
+typedef void (*yagl_ref_destroy_func)(struct yagl_ref */*ref*/);
+
+struct yagl_ref
+{
+ yagl_ref_destroy_func destroy;
+
+ pthread_mutex_t mutex;
+ volatile uint32_t count;
+};
+
+/*
+ * Initializes ref count to 1.
+ */
+YAGL_API void yagl_ref_init(struct yagl_ref *ref, yagl_ref_destroy_func destroy);
+
+YAGL_API void yagl_ref_cleanup(struct yagl_ref *ref);
+
+/*
+ * Increments ref count.
+ */
+YAGL_API void yagl_ref_acquire(struct yagl_ref *ref);
+
+/*
+ * Decrements ref count and releases when 0.
+ */
+YAGL_API void yagl_ref_release(struct yagl_ref *ref);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_RENDER_H_
+#define _YAGL_RENDER_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+
+/*
+ * From http://www.x.org/wiki/DRI2:
+ * "When and how does a client detect that a new front buffer has
+ * been attached? The Gallium Design frowns on the SAREA timestamp mechanism
+ * because it greatly complicates the DRI driver implementation, but only
+ * checking on glXSwapBuffers() isn't sufficient. Consider an application that
+ * (unlike, say, glxgears) doesn't render as many frames per second as
+ * possible, but uses OpenGL as a way to redraw it's interface in response
+ * to X events (mouse clicks, window resizing). When resizing the window of
+ * such an application in a composited environment, the front buffer is
+ * reallocated and attached and the application is sent an expose event.
+ * The application will re-layout the interface and re-render it, however,
+ * the DRI driver won't update its back buffers until glXSwapBuffer() is called
+ * at which point it's too late. This application will always be a frame behind.
+ *
+ * This is somewhat of an implementation problem for the 3d client and/or
+ * gallium architecture design -- it looks like there will be times when it is
+ * necessary to check window dimensions apart from swapbuffers, and in the case
+ * of the above scenario the application will give us a very good hint by
+ * adjusting the viewport parameters. More generally we can say we want to
+ * check at two places -- SwapBuffers, and immediately before the very first
+ * piece of rendering after swapbuffers. This will catch the application-redraw
+ * case, and won't hurt performance as long as the mechanism for
+ * checking window size continues to be fast."
+ *
+ * This function is intended to be called "immediately before the very first
+ * piece of rendering after swapbuffers".
+ */
+YAGL_API void yagl_render_invalidate(int throttle);
+
+
+/*
+ * This must be called when client API finished rendering part of
+ * the geometry and now it's guaranteed that by that point the rendering
+ * results will be visible to direct rendering clients and X.Org. Callers
+ * of this should probably include glFinish, eglWaitClient, eglWaitGL, etc.
+ */
+YAGL_API void yagl_render_finish();
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_RESOURCE_H_
+#define _YAGL_RESOURCE_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+#include "yagl_ref.h"
+#include "yagl_list.h"
+
+struct yagl_resource
+{
+ struct yagl_ref ref;
+
+ struct yagl_list list;
+
+ yagl_host_handle handle;
+};
+
+/*
+ * For implementations.
+ * @{
+ */
+
+YAGL_API void yagl_resource_init(struct yagl_resource *res,
+ yagl_ref_destroy_func destroy,
+ yagl_host_handle handle);
+YAGL_API void yagl_resource_cleanup(struct yagl_resource *res);
+
+/*
+ * @}
+ */
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+YAGL_API void yagl_resource_acquire(struct yagl_resource *res);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+YAGL_API void yagl_resource_release(struct yagl_resource *res);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_SHAREGROUP_H_
+#define _YAGL_SHAREGROUP_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+#include "yagl_ref.h"
+#include "yagl_namespace.h"
+
+#define YAGL_NUM_NAMESPACES 6
+
+#define YAGL_NUM_TEXTURE_TARGETS 4
+
+struct yagl_sharegroup
+{
+ struct yagl_ref ref;
+
+ struct yagl_namespace namespaces[YAGL_NUM_NAMESPACES];
+
+ struct yagl_object *texture_zero[YAGL_NUM_TEXTURE_TARGETS];
+};
+
+YAGL_API struct yagl_sharegroup *yagl_sharegroup_create(void);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+YAGL_API void yagl_sharegroup_acquire(struct yagl_sharegroup *sg);
+
+/*
+ * Passing NULL won't hurt, this is for convenience.
+ */
+YAGL_API void yagl_sharegroup_release(struct yagl_sharegroup *sg);
+
+/*
+ * Adds an object to share group and sets its local name,
+ * this acquires 'obj', so the
+ * caller should release 'obj' if he doesn't want to use it and wants
+ * it to belong to this share group alone.
+ */
+YAGL_API void yagl_sharegroup_add(struct yagl_sharegroup *sg,
+ int ns,
+ struct yagl_object *obj);
+
+/*
+ * Same as the above, but adds an object with local_name.
+ * If an object with such local name already exists then 'obj' will be
+ * released and the existing object will be acquired and returned.
+ * Otherwise, 'obj' is acquired and returned.
+ * Typical use-case for this function is:
+ *
+ * yagl_object *obj;
+ * obj = yagl_sharegroup_acquire_object(sg, ns, local_name);
+ * if (!obj) {
+ * obj = yagl_xxx_create(...);
+ * obj = yagl_sharegroup_add_named(sg, ns, local_name, obj);
+ * }
+ * // use 'obj'.
+ * yagl_object_release(obj);
+ */
+YAGL_API struct yagl_object *yagl_sharegroup_add_named(struct yagl_sharegroup *sg,
+ int ns,
+ yagl_object_name local_name,
+ struct yagl_object *obj);
+
+/*
+ * Removes an object from the share group, this also releases the
+ * object.
+ */
+YAGL_API void yagl_sharegroup_remove(struct yagl_sharegroup *sg,
+ int ns,
+ yagl_object_name local_name);
+
+/*
+ * Acquires an object by its local name. Be sure to release the object when
+ * you're done.
+ */
+YAGL_API struct yagl_object *yagl_sharegroup_acquire_object(struct yagl_sharegroup *sg,
+ int ns,
+ yagl_object_name local_name);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_STATE_H_
+#define _YAGL_STATE_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+
+struct yagl_transport;
+
+YAGL_API struct yagl_transport *yagl_get_transport();
+
+YAGL_API uint8_t *yagl_get_tmp_buffer(uint32_t size);
+
+YAGL_API uint8_t *yagl_get_tmp_buffer2(uint32_t size);
+
+YAGL_API uint8_t *yagl_get_tmp_buffer3(uint32_t size);
+
+YAGL_API yagl_object_name yagl_get_global_name();
+
+YAGL_API yagl_gl_version yagl_get_host_gl_version();
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_TEX_IMAGE_BINDING_H_
+#define _YAGL_TEX_IMAGE_BINDING_H_
+
+#include "yagl_types.h"
+
+struct yagl_tex_image_binding
+{
+ void (*unbind)(struct yagl_tex_image_binding */*binding*/);
+
+ void *cookie;
+};
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_TRANSPORT_H_
+#define _YAGL_TRANSPORT_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+#include <string.h>
+#include <assert.h>
+
+#define YAGL_TRANSPORT_MAX_IN_ARGS 8
+#define YAGL_TRANSPORT_MAX_IN_ARRAYS 8
+
+#define YAGL_TRANSPORT_MAX_IN_DA 8
+#define YAGL_TRANSPORT_MAX_OUT_DA 8
+
+struct yagl_egl_fence;
+
+struct yagl_transport_ops
+{
+ void *(*resize)(void */*ops_data*/, uint32_t /*size*/);
+
+ void (*commit)(void */*ops_data*/, int /*sync*/);
+
+ uint32_t (*flush)(void */*ops_data*/, struct yagl_egl_fence **/*fence*/);
+};
+
+struct yagl_transport_in_arg
+{
+ uint8_t *arg_ptr;
+ uint8_t *buff_ptr;
+ uint32_t size;
+};
+
+struct yagl_transport_in_array
+{
+ uint8_t *arg_ptr;
+ uint8_t *buff_ptr;
+ uint32_t el_size;
+ int32_t *count;
+ int32_t *ret_count;
+};
+
+struct yagl_transport_da
+{
+ void *data;
+ int32_t size;
+};
+
+struct yagl_transport
+{
+ /*
+ * per-transport.
+ * @{
+ */
+
+ struct yagl_transport_ops *ops;
+ void *ops_data;
+
+ uint32_t max_buff_size;
+ uint32_t max_call_size;
+
+ uint8_t *buff;
+ uint32_t buff_size;
+
+ uint8_t *ptr;
+
+ /*
+ * @}
+ */
+
+ /*
+ * per-call.
+ * @{
+ */
+
+ int direct;
+
+ uint32_t num_in_args;
+ uint32_t num_in_arrays;
+
+ uint32_t num_in_da;
+ uint32_t num_out_da;
+
+ struct yagl_transport_in_arg in_args[YAGL_TRANSPORT_MAX_IN_ARGS];
+ struct yagl_transport_in_array in_arrays[YAGL_TRANSPORT_MAX_IN_ARRAYS];
+
+ struct yagl_transport_da in_da[YAGL_TRANSPORT_MAX_IN_DA];
+ struct yagl_transport_da out_da[YAGL_TRANSPORT_MAX_OUT_DA];
+
+ /*
+ * @}
+ */
+};
+
+YAGL_API struct yagl_transport
+ *yagl_transport_create(struct yagl_transport_ops *ops,
+ void *ops_data,
+ uint32_t max_buff_size,
+ uint32_t max_call_size);
+
+YAGL_API void yagl_transport_destroy(struct yagl_transport *t);
+
+YAGL_API void yagl_transport_begin(struct yagl_transport *t,
+ yagl_api_id api,
+ uint32_t func_id,
+ uint32_t min_data_size,
+ uint32_t max_data_size);
+
+YAGL_API void yagl_transport_end(struct yagl_transport *t);
+
+YAGL_API void yagl_transport_flush(struct yagl_transport *t,
+ struct yagl_egl_fence *fence);
+
+/*
+ * Waits until all commands for this transport
+ * are done on host. The wait is ON HOST, not very nice,
+ * but it supposed to be used in offscreen backend only,
+ * so we don't care.
+ */
+YAGL_API void yagl_transport_wait(struct yagl_transport *t);
+
+/*
+ * All marshalling/unmarshalling must be done with 8-byte alignment,
+ * since this is the maximum alignment possible. This way we can
+ * just do assignments without "memcpy" calls and can be sure that
+ * the code won't fail on architectures that don't support unaligned
+ * memory access.
+ */
+
+static __inline void yagl_transport_put_out_uint8_t(struct yagl_transport *t,
+ uint8_t value)
+{
+ *t->ptr = value;
+ t->ptr += 8;
+}
+
+static __inline void yagl_transport_put_out_uint32_t(struct yagl_transport *t,
+ uint32_t value)
+{
+ *(uint32_t*)t->ptr = value;
+ t->ptr += 8;
+}
+
+static __inline void yagl_transport_put_out_float(struct yagl_transport *t,
+ float value)
+{
+ *(float*)t->ptr = value;
+ t->ptr += 8;
+}
+
+static __inline void yagl_transport_put_in_arg_helper(struct yagl_transport *t,
+ void *value,
+ uint32_t size)
+{
+ yagl_transport_put_out_uint32_t(t, (uint32_t)value);
+
+ t->in_args[t->num_in_args].arg_ptr = value;
+ t->in_args[t->num_in_args].buff_ptr = t->ptr;
+ t->in_args[t->num_in_args].size = size;
+
+ ++t->num_in_args;
+}
+
+static __inline void yagl_transport_put_in_uint8_t(struct yagl_transport *t,
+ uint8_t *value)
+{
+ yagl_transport_put_in_arg_helper(t, value, sizeof(*value));
+ if (value) {
+ yagl_transport_put_out_uint8_t(t, *value);
+ }
+}
+
+static __inline void yagl_transport_put_in_uint32_t(struct yagl_transport *t,
+ uint32_t *value)
+{
+ yagl_transport_put_in_arg_helper(t, value, sizeof(*value));
+ if (value) {
+ yagl_transport_put_out_uint32_t(t, *value);
+ }
+}
+
+static __inline void yagl_transport_put_in_float(struct yagl_transport *t,
+ float *value)
+{
+ yagl_transport_put_in_arg_helper(t, value, sizeof(*value));
+ if (value) {
+ yagl_transport_put_out_float(t, *value);
+ }
+}
+
+static __inline uint32_t yagl_transport_array_size(const void *data,
+ int32_t count,
+ int32_t el_size)
+{
+ if (data && (count > 0)) {
+ return 2 * 8 + ((count * el_size + 7U) & ~7U);
+ } else {
+ return 2 * 8;
+ }
+}
+
+static __inline void yagl_transport_put_out_array(struct yagl_transport *t,
+ const void *data,
+ int32_t count,
+ int32_t el_size)
+{
+ yagl_transport_put_out_uint32_t(t, (uint32_t)data);
+ yagl_transport_put_out_uint32_t(t, count);
+
+ if (!data || (count <= 0)) {
+ return;
+ }
+
+ if (t->direct) {
+ t->out_da[t->num_out_da].data = (void*)data;
+ t->out_da[t->num_out_da].size = count * el_size;
+
+ ++t->num_out_da;
+ } else {
+ memcpy(t->ptr, data, count * el_size);
+ t->ptr += (count * el_size + 7U) & ~7U;
+ }
+}
+
+static __inline void yagl_transport_put_in_array(struct yagl_transport *t,
+ void *data,
+ int32_t maxcount,
+ int32_t *ret_count,
+ int32_t el_size)
+{
+ int32_t *count;
+
+ yagl_transport_put_out_uint32_t(t, (uint32_t)data);
+ count = (int32_t*)t->ptr;
+ yagl_transport_put_out_uint32_t(t, maxcount);
+
+ t->in_arrays[t->num_in_arrays].arg_ptr = data;
+ t->in_arrays[t->num_in_arrays].buff_ptr = t->ptr;
+ t->in_arrays[t->num_in_arrays].el_size = el_size;
+ t->in_arrays[t->num_in_arrays].count = count;
+ t->in_arrays[t->num_in_arrays].ret_count = ret_count;
+
+ ++t->num_in_arrays;
+
+ if (!data || (maxcount <= 0)) {
+ return;
+ }
+
+ if (t->direct) {
+ t->in_da[t->num_in_da].data = data;
+ t->in_da[t->num_in_da].size = maxcount * el_size;
+
+ ++t->num_in_da;
+ } else {
+ t->ptr += (maxcount * el_size + 7U) & ~7U;
+ }
+}
+
+/*
+ * We're forced to fault in memory before calling some of the host YaGL
+ * functions. This is needed in order to guarantee that
+ * virtual <-> physical mapping will exist when host reads/writes
+ * target's virtual memory directly.
+ */
+
+static __inline void yagl_transport_probe_read(const void *data, int32_t size)
+{
+ if (data) {
+ int32_t i;
+ volatile uint8_t tmp;
+
+ if (size > 0) {
+ tmp = ((const uint8_t*)data)[0];
+ }
+
+ for (i = 4096 - ((uintptr_t)data & (4096 - 1)); i < size; i += 4096) {
+ tmp = ((const uint8_t*)data)[i];
+ }
+
+ (void)tmp;
+ }
+}
+
+static __inline void yagl_transport_probe_write(void *data, int32_t size)
+{
+ if (data) {
+ int32_t i;
+ volatile uint8_t tmp;
+
+ if (size > 0) {
+ tmp = ((const uint8_t*)data)[0];
+ ((uint8_t*)data)[0] = tmp;
+ }
+
+ for (i = 4096 - ((uintptr_t)data & (4096 - 1)); i < size; i += 4096) {
+ tmp = ((const uint8_t*)data)[i];
+ ((uint8_t*)data)[i] = tmp;
+ }
+ }
+}
+
+static __inline void yagl_transport_put_out_yagl_host_handle(struct yagl_transport *t,
+ yagl_host_handle value)
+{
+ yagl_transport_put_out_uint32_t(t, value);
+}
+
+static __inline void yagl_transport_put_out_yagl_winsys_id(struct yagl_transport *t,
+ yagl_winsys_id value)
+{
+ yagl_transport_put_out_uint32_t(t, value);
+}
+
+static __inline void yagl_transport_put_out_va(struct yagl_transport *t,
+ const void *value)
+{
+ yagl_transport_put_out_uint32_t(t, (uint32_t)value);
+}
+
+static __inline void yagl_transport_put_in_yagl_host_handle(struct yagl_transport *t,
+ yagl_host_handle *value)
+{
+ yagl_transport_put_in_uint32_t(t, value);
+}
+
+static __inline void yagl_transport_put_in_int(struct yagl_transport *t,
+ int *value)
+{
+ yagl_transport_put_in_uint32_t(t, (uint32_t*)value);
+}
+
+static __inline void yagl_transport_put_in_va(struct yagl_transport *t,
+ void **value)
+{
+ yagl_transport_put_in_uint32_t(t, (uint32_t*)value);
+}
+
+static __inline int32_t yagl_transport_string_count(const char *str)
+{
+ return str ? (strlen(str) + 1) : 0;
+}
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_TYPES_H_
+#define _YAGL_TYPES_H_
+
+#include <stdint.h>
+#include <stddef.h>
+
+#if defined(__i386) || defined(_M_IX86)
+#define YAGL_LITTLE_ENDIAN
+#elif defined(__x86_64) || defined(_M_X64) || defined(_M_IA64)
+#define YAGL_LITTLE_ENDIAN
+#elif defined(__arm__)
+#define YAGL_LITTLE_ENDIAN
+#else
+#error Unknown architecture
+#endif
+
+#if defined(__x86_64) || defined(_M_X64) || defined(_M_IA64) || defined(__LP64__)
+#define YAGL_64
+#else
+#define YAGL_32
+#endif
+
+#if !defined(YAGL_64) && !defined(YAGL_32)
+#error 32 or 64 bit mode must be set
+#endif
+
+typedef enum
+{
+ yagl_render_type_offscreen = 1,
+ yagl_render_type_onscreen = 2,
+} yagl_render_type;
+
+typedef enum
+{
+ yagl_api_id_egl = 1,
+ yagl_api_id_gles = 2,
+} yagl_api_id;
+
+typedef enum
+{
+ yagl_client_api_ogl = (1 << 0),
+ yagl_client_api_gles1 = (1 << 1),
+ yagl_client_api_gles2 = (1 << 2),
+ yagl_client_api_gles3 = (1 << 3),
+ yagl_client_api_ovg = (1 << 4)
+} yagl_client_api;
+
+typedef enum
+{
+ /* OpenGL 2.1 or OpenGL >= 3.1 compatibility. */
+ yagl_gl_2 = 0,
+ /* OpenGL >= 3.1 core. */
+ yagl_gl_3_1 = 1,
+ /* OpenGL >= 3.1 core, GL_ARB_ES3_compatibility support. */
+ yagl_gl_3_1_es3 = 2,
+ /* OpenGL >= 3.2 core, no GL_ARB_ES3_compatibility support. */
+ yagl_gl_3_2 = 3
+} yagl_gl_version;
+
+typedef uint32_t yagl_host_handle;
+typedef uint32_t yagl_winsys_id;
+typedef uint32_t yagl_object_name;
+
+#define yagl_offsetof(type, member) ((size_t)&((type*)0)->member)
+
+#define yagl_containerof(ptr, type, member) ((type*)((char*)(ptr) - yagl_offsetof(type, member)))
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_UTILS_H_
+#define _YAGL_UTILS_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+#include <pthread.h>
+
+YAGL_API void yagl_mutex_init(pthread_mutex_t* mutex);
+
+YAGL_API void yagl_recursive_mutex_init(pthread_mutex_t* mutex);
+
+static __inline float yagl_fixed_to_float(int32_t x)
+{
+ return (float)x * (1.0f / 65536.0f);
+}
+
+static __inline int32_t yagl_fixed_to_int(int32_t x)
+{
+ return (x + 0x0800) >> 16;
+}
+
+static __inline int32_t yagl_float_to_fixed(float f)
+{
+ return (int32_t)(f * 65536.0f + 0.5f);
+}
+
+static __inline int32_t yagl_double_to_fixed(double d)
+{
+ return (int32_t)(d * 65536.0f + 0.5f);
+}
+
+static __inline int32_t yagl_int_to_fixed(int32_t i)
+{
+ return i << 16;
+}
+
+static __inline float yagl_clampf(float f)
+{
+ if (f < 0.0f) {
+ return 0.0f;
+ } else if (f > 1.0f) {
+ return 1.0f;
+ } else {
+ return f;
+ }
+}
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_VECTOR_H_
+#define _YAGL_VECTOR_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+
+struct yagl_vector
+{
+ void *data;
+ int elem_size;
+ int size;
+ int capacity;
+};
+
+YAGL_API void yagl_vector_init(struct yagl_vector *v,
+ int elem_size,
+ int initial_capacity);
+
+/*
+ * Cleans up the vector, you must call 'yagl_vector_init' again to be able
+ * to use it.
+ */
+YAGL_API void yagl_vector_cleanup(struct yagl_vector *v);
+
+/*
+ * Detaches the buffer from vector. vector will automatically clean up,
+ * you must call 'yagl_vector_init' again to be able to use it.
+ */
+YAGL_API void *yagl_vector_detach(struct yagl_vector *v);
+
+YAGL_API int yagl_vector_size(struct yagl_vector *v);
+
+YAGL_API int yagl_vector_capacity(struct yagl_vector *v);
+
+YAGL_API void yagl_vector_push_back(struct yagl_vector *v, const void *elem);
+
+YAGL_API void yagl_vector_resize(struct yagl_vector *v, int new_size);
+
+YAGL_API void *yagl_vector_data(struct yagl_vector *v);
+
+#endif
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _YAGL_WAYLAND_EGL_H_
+#define _YAGL_WAYLAND_EGL_H_
+
+#include "yagl_export.h"
+#include "yagl_types.h"
+#include <wayland-egl.h>
+
+struct wl_egl_window
+{
+ struct wl_surface *surface;
+
+ int width;
+ int height;
+ int dx;
+ int dy;
+
+ int attached_width;
+ int attached_height;
+
+ void *user_data;
+ void (*resize_callback)(struct wl_egl_window */*egl_window*/,
+ void */*user_data*/);
+};
+
+#endif
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
--- /dev/null
+%bcond_with wayland
+
+Name: emulator-yagl
+Summary: YaGL - OpenGLES acceleration module for emulator
+Version: 1.4
+Release: 2
+License: MIT and LPGL-3.0
+#URL: http://www.khronos.org
+ExclusiveArch: %{ix86}
+Source0: %{name}-%{version}.tar.gz
+Source1001: emulator-yagl.manifest
+BuildRequires: cmake
+BuildRequires: pkgconfig(libdrm)
+BuildRequires: flex
+BuildRequires: bison
+%if %{with wayland}
+BuildRequires: pkgconfig(gbm)
+BuildRequires: pkgconfig(libudev)
+BuildRequires: pkgconfig(wayland-client)
+BuildRequires: pkgconfig(wayland-server)
+%else
+BuildRequires: pkgconfig(xfixes)
+BuildRequires: pkgconfig(x11)
+BuildRequires: pkgconfig(x11-xcb)
+BuildRequires: pkgconfig(xext)
+BuildRequires: pkgconfig(dri2proto)
+%endif
+Provides: opengl-es-drv
+
+%description
+YaGL - OpenGLES acceleration module for emulator.
+This package contains shared libraries libEGL, libGLES_CM, libGLESv2.
+
+%package devel
+Summary: YaGL - OpenGLES acceleration module for emulator (devel)
+Provides: opengl-es-drv-devel
+Requires: %{name} = %{version}-%{release}
+Requires: pkgconfig(x11)
+
+%description devel
+YaGL - OpenGLES acceleration module for emulator (devel)
+
+%prep
+%setup -q
+
+%build
+cp %{SOURCE1001} .
+%if %{with wayland}
+cmake -DCMAKE_INSTALL_PREFIX=%{buildroot}/usr -DPLATFORM_X11=0 -DPLATFORM_GBM=1 -DPLATFORM_WAYLAND=1
+%else
+cmake -DCMAKE_INSTALL_PREFIX=%{buildroot}/usr -DINSTALL_LIB_DIR=lib/yagl -DDUMMY_LIBS=1
+%endif
+make
+
+%install
+make install
+%if %{with wayland}
+ln -s libEGL.so.1.0 %{buildroot}/usr/lib/libEGL.so.1.0.0
+ln -s libGLESv2.so.2.0 %{buildroot}/usr/lib/libGLESv2.so.2.0.0
+ln -s libGLESv2.so.2.0.0 %{buildroot}/usr/lib/libGL.so.1.2.0
+%else
+ln -s libGLESv2.so.2.0 %{buildroot}/usr/lib/yagl/libGLESv2.so.1.0
+ln -s libGLESv2.so.1.0 %{buildroot}/usr/lib/yagl/libGLESv2.so.1
+
+ln -s yagl/libEGL.so.1.0 %{buildroot}%{_libdir}/libEGL.so.1
+ln -s libEGL.so.1 %{buildroot}%{_libdir}/libEGL.so
+ln -s yagl/libGLESv1_CM.so.1.0 %{buildroot}%{_libdir}/libGLESv1_CM.so.1
+ln -s libGLESv1_CM.so.1 %{buildroot}%{_libdir}/libGLESv1_CM.so
+ln -s yagl/libGLESv2.so.1.0 %{buildroot}%{_libdir}/libGLESv2.so.1
+ln -s libGLESv2.so.1 %{buildroot}%{_libdir}/libGLESv2.so
+
+mkdir -p %{buildroot}/etc/emulator
+cp packaging/opengl-es-setup-yagl-env.sh %{buildroot}/etc/emulator
+
+mkdir -p %{buildroot}/usr/share/license
+cp COPYING %{buildroot}/usr/share/license/%{name}
+%endif
+
+mkdir -p %{buildroot}/usr/include
+cp -r include/EGL %{buildroot}/usr/include/
+cp -r include/GL %{buildroot}/usr/include/
+cp -r include/GLES %{buildroot}/usr/include/
+cp -r include/GLES2 %{buildroot}/usr/include/
+cp -r include/GLES3 %{buildroot}/usr/include/
+cp -r include/KHR %{buildroot}/usr/include/
+
+mkdir -p %{buildroot}/usr/lib/pkgconfig
+cp pkgconfig/* %{buildroot}/usr/lib/pkgconfig/
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files
+%manifest %{name}.manifest
+%defattr(-,root,root,-)
+%if %{with wayland}
+/usr/lib/*.so*
+%else
+/usr/lib/libEGL*
+/usr/lib/libGLES*
+/usr/lib/yagl/*
+/usr/lib/dummy-gl/*
+%attr(777,root,root)/etc/emulator/opengl-es-setup-yagl-env.sh
+/usr/share/license/%{name}
+%endif
+
+%files devel
+%manifest %{name}.manifest
+%defattr(-,root,root,-)
+/usr/include/EGL
+/usr/include/GL
+/usr/include/GLES
+/usr/include/GLES2
+/usr/include/GLES3
+/usr/include/KHR
+/usr/lib/pkgconfig
--- /dev/null
+ #!/bin/sh
+
+echo -e "[${_G} Opengl-es acceleration module setting. ${C_}]"
+if grep "yagl=1" /proc/cmdline ; then
+ echo -e "[${_G} Emulator support gles hw acceleration. ${C_}]"
+ echo -e "[${_G} Change permission of /dev/yagl. ${C_}]"
+ chown root:video /dev/dri/card0
+ chown root:video /dev/yagl
+ chown root:video /dev/slp_global_lock
+ chmod 660 /dev/dri/card0
+ chmod 660 /dev/yagl
+ chmod 660 /dev/slp_global_lock
+ chsmack -a "*" /dev/dri/card0
+ chsmack -a "*" /dev/yagl
+ chsmack -a "*" /dev/slp_global_lock
+ echo -e "[${_G} Apply to use hw gles library. ${C_}]"
+ ln -s -f /usr/lib/yagl/libEGL.so.1.0 /usr/lib/libEGL.so
+ ln -s -f /usr/lib/yagl/libEGL.so.1.0 /usr/lib/libEGL.so.1
+ ln -s -f /usr/lib/yagl/libGLESv1_CM.so.1.0 /usr/lib/libGLESv1_CM.so
+ ln -s -f /usr/lib/yagl/libGLESv1_CM.so.1.0 /usr/lib/libGLESv1_CM.so.1
+ ln -s -f /usr/lib/yagl/libGLESv2.so.1.0 /usr/lib/libGLESv2.so
+ ln -s -f /usr/lib/yagl/libGLESv2.so.1.0 /usr/lib/libGLESv2.so.1
+else
+ echo -e "[${_G} Emulator does not support gles hw acceleration. ${C_}]"
+ echo -e "[${_G} Apply to use gles stub library. ${C_}]"
+ ln -s -f /usr/lib/dummy-gl/libEGL_dummy.so /usr/lib/libEGL.so
+ ln -s -f /usr/lib/dummy-gl/libEGL_dummy.so /usr/lib/libEGL.so.1
+ ln -s -f /usr/lib/dummy-gl/libGLESv1_dummy.so /usr/lib/libGLESv1_CM.so
+ ln -s -f /usr/lib/dummy-gl/libGLESv1_dummy.so /usr/lib/libGLESv1_CM.so.1
+ ln -s -f /usr/lib/dummy-gl/libGLESv2_dummy.so /usr/lib/libGLESv2.so
+ ln -s -f /usr/lib/dummy-gl/libGLESv2_dummy.so /usr/lib/libGLESv2.so.1
+fi
--- /dev/null
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: Desktop OpenGL ES
+Description: Desktop OpenGL ES Library
+Version:0.5
+
+Libs: -L${libdir} -lEGL -lGLESv1_CM -lX11 -ldl -lm
+Cflags: -I${includedir}
--- /dev/null
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: Desktop OpenGL ES 2.0
+Description: Desktop OpenGL ES 2.0 Library
+Version:0.5
+
+Libs: -L${libdir} -lEGL -lGLESv2 -lX11 -ldl -lm
+Cflags: -I${includedir}
--- /dev/null
+#!/usr/bin/env python
+
+import re, os, glob, time, sys, binascii, optparse, random
+
+def copyrightStr():
+ out = """/*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+"""
+ return out
+
+def usageStr():
+ usage = ""
+ usage += "usage: gen-yagl-calls.py [inputs] [api] [target-guard] [target-header-include-files] [target-source-include-files] [target-output-basename] [host-guard] [host-symbol-prefix] [host-source-include-files] [host-output-basename]"
+ return usage
+
+def parseInputFileLine(line):
+ entry = {}
+ if (line[0] == "@"):
+ entry["force_sync"] = True
+ line = line.replace("@", "")
+ else:
+ entry["force_sync"] = False
+ tmp = re.match(r"([^\s]+)\s+([^\s]+)\s*\(([^\)]+)?\)", line)
+ entry["ret"] = tmp.group(1)
+ entry["name"] = tmp.group(2)
+ entry["have_ptrs"] = False
+ if (tmp.group(3) == None):
+ args = []
+ else:
+ args = tmp.group(3).strip().split(",")
+ in_args = []
+ out_args = []
+ all_args = []
+ for arg in args:
+ arg = arg.strip()
+ tmp = re.match(r"(?:(const)\s+)?([^\s\*\&\^]+)\s*([\*\&\^]+)?\s*(.+)", arg)
+ is_out = (tmp.group(1) == "const")
+
+ arg = {}
+ arg["name"] = tmp.group(4)
+ arg["type"] = tmp.group(2)
+ arg["array"] = 0
+ arg["va"] = False
+ arg["const"] = is_out
+
+ if (tmp.group(3) == "&"):
+ if is_out:
+ print "const & not allowed"
+ sys.exit(1)
+ elif (tmp.group(3) == "*"):
+ arg["array"] = 1
+ entry["have_ptrs"] = True
+ elif (tmp.group(3) == "^"):
+ arg["va"] = True
+ is_out = True
+ elif (tmp.group(3) == "^&"):
+ arg["va"] = True
+ arg["type"] = arg["type"] + " *"
+ is_out = False
+ elif (tmp.group(3) == None):
+ if is_out:
+ print "const without array qualifier not allowed"
+ sys.exit(1)
+ is_out = True
+ else:
+ print "bad array qualifier - " + tmp.group(3)
+ sys.exit(1)
+ if is_out:
+ out_args += [arg]
+ else:
+ in_args += [arg]
+ arg["out"] = is_out
+ arg["in"] = not is_out
+ all_args += [arg]
+ entry["in_args"] = in_args
+ entry["out_args"] = out_args
+ entry["args"] = all_args
+ return entry
+
+def processInputFiles(input_files):
+ lines = []
+ for input_file in input_files:
+ f = open(input_file, "r")
+ text = f.read()
+ f.close()
+ lines += text.splitlines()
+ entries = []
+ entry_id = 1
+ for line in lines:
+ line = line.strip();
+ if ((len(line) == 0) or (line[0] == "#")):
+ continue
+ entry = parseInputFileLine(line)
+ entry["id"] = entry_id
+ entries += [entry]
+ entry_id += 1
+ return entries
+
+def argCType(arg, target):
+ if arg["out"]:
+ if arg["array"] == 1:
+ return "const " + arg["type"] + " *"
+ elif arg["va"]:
+ if target:
+ if arg["const"]:
+ return "const " + arg["type"] + " *"
+ else:
+ return arg["type"] + " *"
+ else:
+ return "target_ulong "
+ else:
+ return arg["type"] + " "
+ else:
+ if arg["va"]:
+ if target:
+ if arg["const"]:
+ return "const " + arg["type"] + "*"
+ else:
+ return arg["type"] + "*"
+ else:
+ return "target_ulong *"
+ else:
+ if arg["array"] <= 1:
+ return arg["type"] + " *"
+
+def argCDecl(arg, target):
+ out = argCType(arg, target) + arg["name"]
+ if arg["array"] == 1:
+ if arg["in"]:
+ out += ", int32_t " + arg["name"] + "_maxcount, int32_t *" + arg["name"] + "_count"
+ else:
+ out += ", int32_t " + arg["name"] + "_count"
+ return out
+
+def typeSize(type_str):
+ if ((type_str == "void") or (type_str == "GLvoid")):
+ return "1"
+ else:
+ return "sizeof(" + type_str + ")"
+
+def entryMinMaxSize(entry):
+ out_max = ""
+ num_simple_min = num_simple_max = 0
+ for arg in entry["args"]:
+ if (arg["array"] == 0):
+ num_simple_min += 1
+ num_simple_max += 1
+ if (arg["in"]):
+ num_simple_min += 1
+ num_simple_max += 1
+ elif (arg["array"] == 1):
+ num_simple_min += 2 # data_ptr + count
+ if arg["in"]:
+ out_max += " + yagl_transport_array_size(" + arg["name"] + ", " + arg["name"] + "_maxcount, " + typeSize(arg["type"]) + ")"
+ else:
+ out_max += " + yagl_transport_array_size(" + arg["name"] + ", " + arg["name"] + "_count, " + typeSize(arg["type"]) + ")"
+ if (entry["ret"] != "void"):
+ num_simple_min += 2
+ num_simple_max += 2
+ out_min = str(num_simple_min) + " * 8"
+ out_max = str(num_simple_max) + " * 8" + out_max;
+ return out_min, out_max;
+
+def generateTargetHeader(output_file, guard, includes, entries):
+ out = """/*
+ * Generated by gen-yagl-calls.py, do not modify!
+ */
+#ifndef _%s_H_
+#define _%s_H_
+
+#include "yagl_export.h"
+""" % (guard, guard)
+
+ for include in includes:
+ out += "#include \"" + include + "\"\n";
+
+ out += "\n"
+
+ for entry in entries:
+ out += """/*
+ * %s wrapper. id = %d
+ */
+""" % (entry["name"], entry["id"])
+ out += entry["ret"] + " yagl_host_" + entry["name"] + "("
+ first_arg = True
+ for arg in entry["args"]:
+ if first_arg:
+ first_arg = False
+ else:
+ out += ", "
+ out += argCDecl(arg, True)
+ out += ");\n\n"
+
+ out += "#endif\n"
+
+ f = open(output_file, "w")
+ f.write(out)
+ f.close()
+
+def generateTargetSource(output_file, api, includes, entries):
+ out = """/*
+ * Generated by gen-yagl-calls.py, do not modify!
+ */
+"""
+ for include in includes:
+ out += "#include \"" + include + "\"\n";
+
+ out += """#include "yagl_state.h"
+#include <assert.h>
+"""
+
+ for entry in entries:
+ out += """
+/*
+ * %s wrapper. id = %d
+ */
+""" % (entry["name"], entry["id"])
+ out += entry["ret"] + " yagl_host_" + entry["name"] + "("
+
+ first_arg = True
+ for arg in entry["args"]:
+ if first_arg:
+ first_arg = False
+ else:
+ out += ", "
+ out += argCDecl(arg, True)
+
+ out += ")\n{\n"
+
+ min_size, max_size = entryMinMaxSize(entry)
+
+ out += " struct yagl_transport *t = yagl_get_transport();\n"
+
+ if (entry["ret"] != "void"):
+ out += " " + entry["ret"] + " retval = 0;\n\n"
+ else:
+ out += "\n"
+
+ out += " yagl_transport_begin(t, " + api + ", " + str(entry["id"]) + ", " + min_size + ", " + max_size + ");\n"
+
+ for arg in entry["out_args"]:
+ if (arg["array"] == 0):
+ if arg["va"]:
+ out += " yagl_transport_put_out_va(t, " + arg["name"] + ");\n"
+ else:
+ out += " yagl_transport_put_out_" + arg["type"] + "(t, " + arg["name"] + ");\n"
+ elif (arg["array"] == 1):
+ out += " yagl_transport_put_out_array(t, " + arg["name"] + ", " + arg["name"] + "_count, " + typeSize(arg["type"]) + ");\n"
+ for arg in entry["in_args"]:
+ if (arg["array"] == 0):
+ if arg["va"]:
+ out += " yagl_transport_put_in_va(t, (void**)" + arg["name"] + ");\n"
+ else:
+ out += " yagl_transport_put_in_" + arg["type"] + "(t, " + arg["name"] + ");\n"
+ elif (arg["array"] == 1):
+ out += " yagl_transport_put_in_array(t, " + arg["name"] + ", " + arg["name"] + "_maxcount, " + arg["name"] + "_count, " + typeSize(arg["type"]) + ");\n"
+
+ if (entry["ret"] != "void"):
+ out += " yagl_transport_put_in_" + entry["ret"] + "(t, &retval);\n"
+
+ out += " yagl_transport_end(t);\n"
+
+ if (len(entry["in_args"]) == 0) and (entry["ret"] == "void") and entry["force_sync"]:
+ out += " yagl_transport_flush(t, NULL);\n"
+
+ if (entry["ret"] != "void"):
+ out += "\n return retval;\n"
+
+ out += "}\n"
+
+ f = open(output_file, "w")
+ f.write(out)
+ f.close()
+
+def generateHostHeader(output_file, guard, sym_prefix):
+ out = copyrightStr()
+ out += """/*
+ * Generated by gen-yagl-calls.py, do not modify!
+ */
+#ifndef _%s_H_
+#define _%s_H_
+
+#include "yagl_types.h"
+
+""" % (guard, guard)
+
+ out += "extern const uint32_t " + sym_prefix + "_num_funcs;\n\n"
+ out += "extern yagl_api_func " + sym_prefix + "_funcs[];\n\n"
+
+ out += "#endif\n"
+
+ f = open(output_file, "w")
+ f.write(out)
+ f.close()
+
+def generateHostSource(output_file, sym_prefix, includes, entries):
+ out = copyrightStr()
+ out += """/*
+ * Generated by gen-yagl-calls.py, do not modify!
+ */
+"""
+ for include in includes:
+ out += "#include \"" + include + "\"\n";
+
+ out += """#include "yagl_thread.h"
+#include "yagl_process.h"
+#include "yagl_log.h"
+"""
+
+ for entry in entries:
+ out += """
+/*
+ * %s dispatcher. id = %d
+ */
+""" % (entry["name"], entry["id"])
+ out += "static void yagl_func_" + entry["name"] + "(struct yagl_transport *t)\n{\n"
+
+ for arg in entry["args"]:
+ out += " " + argCType(arg, False) + arg["name"] + ";\n"
+ if (arg["array"] >= 1):
+ if arg["in"]:
+ out += " int32_t " + arg["name"] + "_maxcount;\n"
+ out += " int32_t *" + arg["name"] + "_count;\n"
+ else:
+ out += " int32_t " + arg["name"] + "_count;\n"
+
+ if (entry["ret"] != "void"):
+ out += " " + entry["ret"] + " *retval;\n"
+
+ for arg in entry["out_args"]:
+ if (arg["array"] == 0):
+ if arg["va"]:
+ out += " " + arg["name"] + " = yagl_transport_get_out_va(t);\n"
+ else:
+ out += " " + arg["name"] + " = yagl_transport_get_out_" + arg["type"] + "(t);\n"
+ elif (arg["array"] == 1):
+ out += " yagl_transport_get_out_array(t, " + typeSize(arg["type"]) + ", (const void**)&" + arg["name"] + ", &" + arg["name"] + "_count);\n"
+
+ for arg in entry["in_args"]:
+ if (arg["array"] == 0):
+ out += " yagl_transport_get_in_arg(t, (void**)&" + arg["name"] + ");\n"
+ elif (arg["array"] == 1):
+ out += " yagl_transport_get_in_array(t, " + typeSize(arg["type"]) + ", (void**)&" + arg["name"] + ", &" + arg["name"] + "_maxcount" ", &" + arg["name"] + "_count);\n"
+
+ if (entry["ret"] != "void"):
+ out += " yagl_transport_get_in_arg(t, (void**)&retval);\n"
+
+ out += " YAGL_LOG_FUNC_ENTER_SPLIT" + str(len(entry["args"])) + "(" + entry["name"]
+
+ for arg in entry["args"]:
+ if ((arg["array"] > 0) or arg["in"]):
+ if arg["va"]:
+ out += ", target_ulong*"
+ else:
+ out += ", void*"
+ else:
+ if arg["va"]:
+ out += ", target_ulong"
+ else:
+ out += ", " + arg["type"]
+
+ for arg in entry["args"]:
+ out += ", " + arg["name"]
+
+ out += ");\n"
+
+ for arg in entry["in_args"]:
+ if (arg["array"] == 1):
+ out += " *" + arg["name"] + "_count = 0;\n"
+
+ if (entry["ret"] != "void"):
+ out += " *retval = "
+ else:
+ out += " (void)"
+
+ out += "yagl_host_" + entry["name"] + "("
+
+ first_arg = True
+ for arg in entry["args"]:
+ if first_arg:
+ first_arg = False
+ else:
+ out += ", "
+ if (arg["array"] == 0):
+ out += arg["name"]
+ elif (arg["array"] == 1):
+ if arg["in"]:
+ out += arg["name"] + ", " + arg["name"] + "_maxcount, " + arg["name"] + "_count"
+ else:
+ out += arg["name"] + ", " + arg["name"] + "_count"
+
+ out += ");\n"
+
+ if (entry["ret"] != "void"):
+ out += " YAGL_LOG_FUNC_EXIT_SPLIT(" + entry["ret"] + ", *retval);\n"
+ else:
+ out += " YAGL_LOG_FUNC_EXIT(NULL);\n"
+
+ out += "}\n"
+
+ out += "\nconst uint32_t " + sym_prefix + "_num_funcs = " + str(len(entries)) + ";\n\n"
+ out += "yagl_api_func " + sym_prefix + "_funcs[] = {\n"
+
+ for entry in entries:
+ out += " &yagl_func_" + entry["name"] + ",\n"
+
+ out += "};\n"
+
+ f = open(output_file, "w")
+ f.write(out)
+ f.close()
+
+def generateHostDecls(output_file, entries):
+ out = ""
+ for entry in entries:
+ out += entry["ret"] + " yagl_host_" + entry["name"] + "("
+
+ first_arg = True
+ for arg in entry["args"]:
+ if first_arg:
+ first_arg = False
+ else:
+ out += ",\n "
+ out += argCDecl(arg, False)
+ if first_arg:
+ out += "void"
+
+ out += ");\n"
+
+ f = open(output_file, "w")
+ f.write(out)
+ f.close()
+
+if __name__ == '__main__':
+ parser = optparse.OptionParser(usage = usageStr())
+ opts, args = parser.parse_args()
+
+ argc = len(args)
+ if argc < 10:
+ parser.print_help()
+ sys.exit(1)
+
+ input_files = args[0].split(",")
+ api = args[1]
+ target_guard = args[2]
+ target_h_includes = args[3].split(",")
+ target_s_includes = args[4].split(",")
+ target_header = args[5] + ".h"
+ target_source = args[5] + ".c"
+ host_guard = args[6]
+ host_sym_prefix = args[7]
+ host_s_includes = args[8].split(",")
+ host_header = args[9] + ".h"
+ host_source = args[9] + ".c"
+ host_decls = args[9] + ".txt"
+
+ entries = processInputFiles(input_files)
+ generateTargetHeader(target_header, target_guard, target_h_includes, entries)
+ generateTargetSource(target_source, api, target_s_includes, entries)
+ generateHostHeader(host_header, host_guard, host_sym_prefix)
+ generateHostSource(host_source, host_sym_prefix, host_s_includes, entries)
+ generateHostDecls(host_decls, entries)
--- /dev/null
+#!/bin/bash
+
+echo "Generating GLES marshalling code..."
+./gen-yagl-calls.py ../GLES_common/yagl_gles_calls.in yagl_api_id_gles \
+ YAGL_HOST_GLES_CALLS yagl_types.h GL/gl.h,yagl_host_gles_calls.h,yagl_transport_gl.h ../GLES_common/yagl_host_gles_calls \
+ QEMU_YAGL_GLES_CALLS yagl_gles_api yagl_gles_calls.h,yagl_host_gles_calls.h,yagl_transport_gl.h yagl_gles_calls
+
+echo "Generating EGL marshalling code..."
+./gen-yagl-calls.py ../EGL/yagl_egl_calls.in yagl_api_id_egl \
+ YAGL_HOST_EGL_CALLS yagl_types.h,EGL/egl.h yagl_host_egl_calls.h,yagl_transport_egl.h ../EGL/yagl_host_egl_calls \
+ QEMU_YAGL_EGL_CALLS yagl_egl_api yagl_egl_calls.h,yagl_host_egl_calls.h,yagl_transport_egl.h yagl_egl_calls
--- /dev/null
+include (WPCodegenTarget)
+
+set(SOURCES
+ ${CMAKE_CURRENT_BINARY_DIR}/wayland-drm-server-protocol.h
+ ${YAGL_OUT_DIR}/include/wayland-drm-client-protocol.h
+ ${CMAKE_CURRENT_BINARY_DIR}/wayland-drm-protocol.c
+ wayland-drm.c
+)
+
+wp_codegen_target(wayland-drm
+ ${CMAKE_CURRENT_SOURCE_DIR}/wayland-drm.xml
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${YAGL_OUT_DIR}/include
+ ${CMAKE_CURRENT_BINARY_DIR})
+
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+include_directories(.)
+
+add_library(wayland-drm STATIC ${SOURCES})
+
+target_link_libraries(wayland-drm ${CMAKE_THREAD_LIBS_INIT} ${WAYLAND_SERVER_LIBRARIES})
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "wayland-drm.h"
+#include <wayland-server.h>
+#include "wayland-drm-server-protocol.h"
+#include "vigs.h"
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+struct wl_drm
+{
+ struct wl_display *display;
+ char *device_name;
+ struct wayland_drm_callbacks *callbacks;
+ void *user_data;
+};
+
+struct wl_drm_buffer
+{
+ struct wl_resource resource;
+
+ struct wl_drm *drm;
+
+ struct vigs_drm_surface *drm_sfc;
+};
+
+static void buffer_destroy(struct wl_resource *resource)
+{
+ struct wl_drm_buffer *buffer = resource->data;
+
+ vigs_drm_gem_unref(&buffer->drm_sfc->gem);
+
+ free(buffer);
+}
+
+static void drm_buffer_destroy(struct wl_client *client,
+ struct wl_resource *resource)
+{
+ wl_resource_destroy(resource);
+}
+
+static struct wl_buffer_interface drm_buffer_interface =
+{
+ drm_buffer_destroy
+};
+
+static void drm_create_buffer(struct wl_client *client,
+ struct wl_resource *resource,
+ uint32_t id, uint32_t name,
+ int32_t width, int32_t height,
+ uint32_t stride, uint32_t format)
+{
+ struct wl_drm *drm = resource->data;
+ struct wl_drm_buffer *buffer;
+
+ switch (format) {
+ case WL_DRM_FORMAT_ARGB8888:
+ case WL_DRM_FORMAT_XRGB8888:
+ break;
+ default:
+ wl_resource_post_error(resource,
+ WL_DRM_ERROR_INVALID_FORMAT,
+ "invalid format");
+ return;
+ }
+
+ buffer = malloc(sizeof(*buffer));
+
+ if (!buffer) {
+ wl_resource_post_no_memory(resource);
+ return;
+ }
+
+ memset(buffer, 0, sizeof(*buffer));
+
+ buffer->drm_sfc = drm->callbacks->acquire_buffer(drm->user_data, name);
+
+ if (!buffer->drm_sfc) {
+ wl_resource_post_error(resource,
+ WL_DRM_ERROR_INVALID_NAME,
+ "invalid name");
+ free(buffer);
+ return;
+ }
+
+ buffer->drm = drm;
+
+ buffer->resource.object.id = id;
+ buffer->resource.object.interface = &wl_buffer_interface;
+ buffer->resource.object.implementation = (void(**)(void))&drm_buffer_interface;
+ buffer->resource.data = buffer;
+
+ buffer->resource.destroy = buffer_destroy;
+ buffer->resource.client = resource->client;
+
+ wl_client_add_resource(resource->client, &buffer->resource);
+}
+
+static void drm_create_planar_buffer(struct wl_client *client,
+ struct wl_resource *resource,
+ uint32_t id, uint32_t name,
+ int32_t width, int32_t height,
+ uint32_t format,
+ int32_t offset0, int32_t stride0,
+ int32_t offset1, int32_t stride1,
+ int32_t offset2, int32_t stride2)
+{
+ wl_resource_post_error(resource,
+ WL_DRM_ERROR_INVALID_FORMAT,
+ "invalid format");
+}
+
+static void drm_authenticate(struct wl_client *client,
+ struct wl_resource *resource,
+ uint32_t id)
+{
+ struct wl_drm *drm = resource->data;
+
+ if (drm->callbacks->authenticate(drm->user_data, id) < 0) {
+ wl_resource_post_error(resource,
+ WL_DRM_ERROR_AUTHENTICATE_FAIL,
+ "authenicate failed");
+ } else {
+ wl_drm_send_authenticated(resource);
+ }
+}
+
+static struct wl_drm_interface drm_interface =
+{
+ drm_authenticate,
+ drm_create_buffer,
+ drm_create_planar_buffer
+};
+
+static void bind_drm(struct wl_client *client,
+ void *data,
+ uint32_t version,
+ uint32_t id)
+{
+ struct wl_drm *drm = data;
+ struct wl_resource *resource;
+
+ resource = wl_resource_create(client,
+ &wl_drm_interface,
+ 1,
+ id);
+
+ if (!resource) {
+ wl_client_post_no_memory(client);
+ return;
+ }
+
+ wl_resource_set_implementation(resource, &drm_interface, data, NULL);
+
+ wl_drm_send_device(resource, drm->device_name);
+ wl_drm_send_format(resource, WL_DRM_FORMAT_ARGB8888);
+ wl_drm_send_format(resource, WL_DRM_FORMAT_XRGB8888);
+}
+
+struct wl_drm *wayland_drm_create(struct wl_display *display,
+ char *device_name,
+ struct wayland_drm_callbacks *callbacks,
+ void *user_data)
+{
+ struct wl_drm *drm;
+
+ drm = malloc(sizeof(*drm));
+
+ if (!drm) {
+ fprintf(stderr, "wayland-drm: Critical error! Unable to allocate wl_drm!\n");
+ exit(1);
+ return NULL;
+ }
+
+ memset(drm, 0, sizeof(*drm));
+
+ drm->display = display;
+ drm->device_name = strdup(device_name);
+ drm->callbacks = callbacks;
+ drm->user_data = user_data;
+
+ wl_global_create(display, &wl_drm_interface, 1, drm, bind_drm);
+
+ return drm;
+}
+
+void wayland_drm_destroy(struct wl_drm *drm)
+{
+ free(drm->device_name);
+
+ free(drm);
+}
+
+struct wl_drm_buffer *wayland_drm_get_buffer(struct wl_resource *resource)
+{
+ if (!resource) {
+ return NULL;
+ }
+
+ if (wl_resource_instance_of(resource,
+ &wl_buffer_interface,
+ &drm_buffer_interface)) {
+ return wl_resource_get_user_data(resource);
+ } else {
+ return NULL;
+ }
+}
+
+struct vigs_drm_surface *wayland_drm_buffer_get_sfc(struct wl_drm_buffer *buffer)
+{
+ return buffer->drm_sfc;
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="drm">
+
+ <copyright>
+ Copyright © 2008-2011 Kristian Høgsberg
+ Copyright © 2010-2011 Intel Corporation
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that\n the above copyright notice appear in
+ all copies and that both that copyright notice and this permission
+ notice appear in supporting documentation, and that the name of
+ the copyright holders not be used in advertising or publicity
+ pertaining to distribution of the software without specific,
+ written prior permission. The copyright holders make no
+ representations about the suitability of this software for any
+ purpose. It is provided "as is" without express or implied
+ warranty.
+
+ THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ THIS SOFTWARE.
+ </copyright>
+
+ <!-- drm support. This object is created by the server and published
+ using the display's global event. -->
+ <interface name="wl_drm" version="1">
+ <enum name="error">
+ <entry name="authenticate_fail" value="0"/>
+ <entry name="invalid_format" value="1"/>
+ <entry name="invalid_name" value="2"/>
+ </enum>
+
+ <enum name="format">
+ <!-- The drm format codes match the #defines in drm_fourcc.h.
+ The formats actually supported by the compositor will be
+ reported by the format event. -->
+ <entry name="c8" value="0x20203843"/>
+ <entry name="rgb332" value="0x38424752"/>
+ <entry name="bgr233" value="0x38524742"/>
+ <entry name="xrgb4444" value="0x32315258"/>
+ <entry name="xbgr4444" value="0x32314258"/>
+ <entry name="rgbx4444" value="0x32315852"/>
+ <entry name="bgrx4444" value="0x32315842"/>
+ <entry name="argb4444" value="0x32315241"/>
+ <entry name="abgr4444" value="0x32314241"/>
+ <entry name="rgba4444" value="0x32314152"/>
+ <entry name="bgra4444" value="0x32314142"/>
+ <entry name="xrgb1555" value="0x35315258"/>
+ <entry name="xbgr1555" value="0x35314258"/>
+ <entry name="rgbx5551" value="0x35315852"/>
+ <entry name="bgrx5551" value="0x35315842"/>
+ <entry name="argb1555" value="0x35315241"/>
+ <entry name="abgr1555" value="0x35314241"/>
+ <entry name="rgba5551" value="0x35314152"/>
+ <entry name="bgra5551" value="0x35314142"/>
+ <entry name="rgb565" value="0x36314752"/>
+ <entry name="bgr565" value="0x36314742"/>
+ <entry name="rgb888" value="0x34324752"/>
+ <entry name="bgr888" value="0x34324742"/>
+ <entry name="xrgb8888" value="0x34325258"/>
+ <entry name="xbgr8888" value="0x34324258"/>
+ <entry name="rgbx8888" value="0x34325852"/>
+ <entry name="bgrx8888" value="0x34325842"/>
+ <entry name="argb8888" value="0x34325241"/>
+ <entry name="abgr8888" value="0x34324241"/>
+ <entry name="rgba8888" value="0x34324152"/>
+ <entry name="bgra8888" value="0x34324142"/>
+ <entry name="xrgb2101010" value="0x30335258"/>
+ <entry name="xbgr2101010" value="0x30334258"/>
+ <entry name="rgbx1010102" value="0x30335852"/>
+ <entry name="bgrx1010102" value="0x30335842"/>
+ <entry name="argb2101010" value="0x30335241"/>
+ <entry name="abgr2101010" value="0x30334241"/>
+ <entry name="rgba1010102" value="0x30334152"/>
+ <entry name="bgra1010102" value="0x30334142"/>
+ <entry name="yuyv" value="0x56595559"/>
+ <entry name="yvyu" value="0x55595659"/>
+ <entry name="uyvy" value="0x59565955"/>
+ <entry name="vyuy" value="0x59555956"/>
+ <entry name="ayuv" value="0x56555941"/>
+ <entry name="nv12" value="0x3231564e"/>
+ <entry name="nv21" value="0x3132564e"/>
+ <entry name="nv16" value="0x3631564e"/>
+ <entry name="nv61" value="0x3136564e"/>
+ <entry name="yuv410" value="0x39565559"/>
+ <entry name="yvu410" value="0x39555659"/>
+ <entry name="yuv411" value="0x31315559"/>
+ <entry name="yvu411" value="0x31315659"/>
+ <entry name="yuv420" value="0x32315559"/>
+ <entry name="yvu420" value="0x32315659"/>
+ <entry name="yuv422" value="0x36315559"/>
+ <entry name="yvu422" value="0x36315659"/>
+ <entry name="yuv444" value="0x34325559"/>
+ <entry name="yvu444" value="0x34325659"/>
+ </enum>
+
+ <!-- Call this request with the magic received from drmGetMagic().
+ It will be passed on to the drmAuthMagic() or
+ DRIAuthConnection() call. This authentication must be
+ completed before create_buffer could be used. -->
+ <request name="authenticate">
+ <arg name="id" type="uint"/>
+ </request>
+
+ <!-- Create a wayland buffer for the named DRM buffer. The DRM
+ surface must have a name using the flink ioctl -->
+ <request name="create_buffer">
+ <arg name="id" type="new_id" interface="wl_buffer"/>
+ <arg name="name" type="uint"/>
+ <arg name="width" type="int"/>
+ <arg name="height" type="int"/>
+ <arg name="stride" type="uint"/>
+ <arg name="format" type="uint"/>
+ </request>
+
+ <!-- Create a wayland buffer for the named DRM buffer. The DRM
+ surface must have a name using the flink ioctl -->
+ <request name="create_planar_buffer">
+ <arg name="id" type="new_id" interface="wl_buffer"/>
+ <arg name="name" type="uint"/>
+ <arg name="width" type="int"/>
+ <arg name="height" type="int"/>
+ <arg name="format" type="uint"/>
+ <arg name="offset0" type="int"/>
+ <arg name="stride0" type="int"/>
+ <arg name="offset1" type="int"/>
+ <arg name="stride1" type="int"/>
+ <arg name="offset2" type="int"/>
+ <arg name="stride2" type="int"/>
+ </request>
+
+ <!-- Notification of the path of the drm device which is used by
+ the server. The client should use this device for creating
+ local buffers. Only buffers created from this device should
+ be be passed to the server using this drm object's
+ create_buffer request. -->
+ <event name="device">
+ <arg name="name" type="string"/>
+ </event>
+
+ <event name="format">
+ <arg name="format" type="uint"/>
+ </event>
+
+ <!-- Raised if the authenticate request succeeded -->
+ <event name="authenticated"/>
+ </interface>
+
+</protocol>
--- /dev/null
+set(SOURCES
+ yagl_wayland_egl.c
+)
+
+add_library(wayland-egl-yagl SHARED ${SOURCES})
+set_target_properties(wayland-egl-yagl PROPERTIES VERSION 1.0.0 SOVERSION 1)
+set_target_properties(wayland-egl-yagl PROPERTIES OUTPUT_NAME wayland-egl)
+
+target_link_libraries(wayland-egl-yagl ${CMAKE_THREAD_LIBS_INIT})
+
+install(
+ TARGETS wayland-egl-yagl
+ LIBRARY DESTINATION ${INSTALL_LIB_DIR}
+)
--- /dev/null
+/*
+ * YaGL
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact :
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_export.h"
+#include "yagl_wayland_egl.h"
+#include <stdlib.h>
+#include <string.h>
+
+YAGL_API struct wl_egl_window *wl_egl_window_create(struct wl_surface *surface,
+ int width, int height)
+{
+ struct wl_egl_window *egl_window;
+
+ egl_window = malloc(sizeof(*egl_window));
+
+ if (!egl_window) {
+ return NULL;
+ }
+
+ memset(egl_window, 0, sizeof(*egl_window));
+
+ egl_window->surface = surface;
+
+ wl_egl_window_resize(egl_window, width, height, 0, 0);
+
+ return egl_window;
+}
+
+YAGL_API void wl_egl_window_destroy(struct wl_egl_window *egl_window)
+{
+ free(egl_window);
+}
+
+YAGL_API void wl_egl_window_resize(struct wl_egl_window *egl_window,
+ int width, int height,
+ int dx, int dy)
+{
+ egl_window->width = width;
+ egl_window->height = height;
+ egl_window->dx = dx;
+ egl_window->dy = dy;
+
+ if (egl_window->resize_callback) {
+ egl_window->resize_callback(egl_window, egl_window->user_data);
+ }
+}
+
+YAGL_API void wl_egl_window_get_attached_size(struct wl_egl_window *egl_window,
+ int *width, int *height)
+{
+ if (width) {
+ *width = egl_window->attached_width;
+ }
+ if (height) {
+ *height = egl_window->attached_height;
+ }
+}