--- /dev/null
+Makefile.in
+Makefile
+*.o
+*.lo
+*.loT
+*.la
+.*.swp
+*.stamp
+*.gir
+*.lineno
+.deps
+.libs
+.dirstamp
+
+config.*
+aclocal.m4
+autom4te.cache
+configure
+depcomp
+libtool
+install-sh
+missing
+ltmain.sh
+ylwrap
+compile
+stamp-h1
+
+aclocal-copy
+arm-*-linux-gnueabi-libtool
+
+hybris/tests/test_egl
+hybris/tests/test_glesv2
+hybris/tests/test_lights
+hybris/tests/test_offscreen_rendering
+hybris/tests/test_sensors
+hybris/tests/test_ui
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+HYBRIS_PATH := $(LOCAL_PATH)/../../hybris
+
+LOCAL_SRC_FILES := camera_compatibility_layer.cpp
+
+LOCAL_MODULE := libcamera_compat_layer
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_C_INCLUDES := \
+ $(HYBRIS_PATH)/include
+
+LOCAL_SHARED_LIBRARIES := \
+ libcutils \
+ libcamera_client \
+ libutils \
+ libbinder \
+ libhardware \
+ libui \
+ libgui
+
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+
+HYBRIS_PATH := $(LOCAL_PATH)/../../hybris
+
+LOCAL_SRC_FILES := direct_camera_test.cpp
+
+LOCAL_MODULE := direct_camera_test
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_C_INCLUDES := \
+ $(HYBRIS_PATH)/include \
+ bionic \
+ bionic/libstdc++/include \
+ external/gtest/include \
+ external/stlport/stlport \
+ external/skia/include/core \
+
+LOCAL_SHARED_LIBRARIES := \
+ libis_compat_layer \
+ libsf_compat_layer \
+ libcamera_compat_layer \
+ libcutils \
+ libcamera_client \
+ libutils \
+ libbinder \
+ libhardware \
+ libui \
+ libgui \
+ libEGL \
+ libGLESv2
+
+include $(BUILD_EXECUTABLE)
--- /dev/null
+/*
+ * Copyright (C) 2013 Canonical Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
+ * Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
+ */
+
+#include <hybris/internal/camera_control.h>
+#include <hybris/camera/camera_compatibility_layer.h>
+#include <hybris/camera/camera_compatibility_layer_capabilities.h>
+#include <hybris/camera/camera_compatibility_layer_configuration_translator.h>
+
+#include <hybris/internal/surface_flinger_compatibility_layer_internal.h>
+
+#include <binder/ProcessState.h>
+#include <camera/Camera.h>
+#include <camera/CameraParameters.h>
+#include <gui/SurfaceTexture.h>
+#include <ui/GraphicBuffer.h>
+
+#undef LOG_TAG
+#define LOG_TAG "CameraCompatibilityLayer"
+#include <utils/KeyedVector.h>
+#include <utils/Log.h>
+
+#define REPORT_FUNCTION() ALOGV("%s \n", __PRETTY_FUNCTION__)
+
+// From android::SurfaceTexture::FrameAvailableListener
+void CameraControl::onFrameAvailable()
+{
+ REPORT_FUNCTION();
+ if (listener)
+ listener->on_preview_texture_needs_update_cb(listener->context);
+}
+
+// From android::CameraListener
+void CameraControl::notify(int32_t msg_type, int32_t ext1, int32_t ext2)
+{
+ REPORT_FUNCTION();
+ printf("\text1: %d, ext2: %d \n", ext1, ext2);
+
+ if (!listener)
+ return;
+
+ switch (msg_type) {
+ case CAMERA_MSG_ERROR:
+ if (listener->on_msg_error_cb)
+ listener->on_msg_error_cb(listener->context);
+ break;
+ case CAMERA_MSG_SHUTTER:
+ if (listener->on_msg_shutter_cb)
+ listener->on_msg_shutter_cb(listener->context);
+ break;
+ case CAMERA_MSG_ZOOM:
+ if (listener->on_msg_zoom_cb)
+ listener->on_msg_zoom_cb(listener->context, ext1);
+ break;
+ case CAMERA_MSG_FOCUS:
+ if (listener->on_msg_focus_cb)
+ listener->on_msg_focus_cb(listener->context);
+ break;
+ default:
+ break;
+ }
+}
+
+void CameraControl::postData(
+ int32_t msg_type,
+ const android::sp<android::IMemory>& data,
+ camera_frame_metadata_t* metadata)
+{
+ REPORT_FUNCTION();
+
+ if (!listener)
+ return;
+
+ switch (msg_type) {
+ case CAMERA_MSG_RAW_IMAGE:
+ if (listener->on_data_raw_image_cb)
+ listener->on_data_raw_image_cb(data->pointer(), data->size(), listener->context);
+ break;
+ case CAMERA_MSG_COMPRESSED_IMAGE:
+ if (listener->on_data_compressed_image_cb)
+ listener->on_data_compressed_image_cb(data->pointer(), data->size(), listener->context);
+ break;
+ default:
+ break;
+ }
+}
+
+void CameraControl::postDataTimestamp(
+ nsecs_t timestamp,
+ int32_t msg_type,
+ const android::sp<android::IMemory>& data)
+{
+ REPORT_FUNCTION();
+ (void) timestamp;
+ (void) msg_type;
+ (void) data;
+}
+
+namespace android
+{
+NativeBufferAlloc::NativeBufferAlloc() {
+}
+
+NativeBufferAlloc::~NativeBufferAlloc() {
+}
+
+sp<GraphicBuffer> NativeBufferAlloc::createGraphicBuffer(uint32_t w, uint32_t h,
+ PixelFormat format, uint32_t usage, status_t* error) {
+ sp<GraphicBuffer> graphicBuffer(new GraphicBuffer(w, h, format, usage));
+ status_t err = graphicBuffer->initCheck();
+ *error = err;
+ if (err != 0 || graphicBuffer->handle == 0) {
+ if (err == NO_MEMORY) {
+ GraphicBuffer::dumpAllocationsToSystemLog();
+ }
+ ALOGI("GraphicBufferAlloc::createGraphicBuffer(w=%d, h=%d) "
+ "failed (%s), handle=%p",
+ w, h, strerror(-err), graphicBuffer->handle);
+ return 0;
+ }
+ return graphicBuffer;
+}
+}
+
+namespace
+{
+
+android::sp<CameraControl> camera_control_instance;
+
+}
+
+int android_camera_get_number_of_devices()
+{
+ REPORT_FUNCTION();
+ return android::Camera::getNumberOfCameras();
+}
+
+CameraControl* android_camera_connect_to(CameraType camera_type, CameraControlListener* listener)
+{
+ REPORT_FUNCTION();
+
+ int32_t camera_id;
+ int32_t camera_count = camera_id = android::Camera::getNumberOfCameras();
+
+ for (camera_id = 0; camera_id < camera_count; camera_id++) {
+ android::CameraInfo ci;
+ android::Camera::getCameraInfo(camera_id, &ci);
+
+ if (ci.facing == camera_type)
+ break;
+ }
+
+ if (camera_id == camera_count)
+ return NULL;
+
+ CameraControl* cc = new CameraControl();
+ cc->listener = listener;
+ cc->camera = android::Camera::connect(camera_id);
+
+ if (cc->camera == NULL)
+ return NULL;
+
+ cc->camera_parameters = android::CameraParameters(cc->camera->getParameters());
+
+ camera_control_instance = cc;
+ cc->camera->setListener(camera_control_instance);
+ cc->camera->lock();
+
+ // TODO: Move this to a more generic component
+ android::ProcessState::self()->startThreadPool();
+
+ return cc;
+}
+
+void android_camera_disconnect(CameraControl* control)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+
+ if (control->preview_texture != NULL)
+ control->preview_texture->abandon();
+
+ control->camera->disconnect();
+ control->camera->unlock();
+}
+
+int android_camera_lock(CameraControl* control)
+{
+ android::Mutex::Autolock al(control->guard);
+ return control->camera->lock();
+}
+
+int android_camera_unlock(CameraControl* control)
+{
+ android::Mutex::Autolock al(control->guard);
+ return control->camera->unlock();
+}
+
+void android_camera_delete(CameraControl* control)
+{
+ delete control;
+}
+
+void android_camera_dump_parameters(CameraControl* control)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ printf("%s \n", control->camera->getParameters().string());
+}
+
+void android_camera_set_flash_mode(CameraControl* control, FlashMode mode)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+ control->camera_parameters.set(
+ android::CameraParameters::KEY_FLASH_MODE,
+ flash_modes[mode]);
+ control->camera->setParameters(control->camera_parameters.flatten());
+}
+
+void android_camera_get_flash_mode(CameraControl* control, FlashMode* mode)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+ static const char* flash_mode = control->camera_parameters.get(
+ android::CameraParameters::KEY_FLASH_MODE);
+ if (flash_mode)
+ *mode = flash_modes_lut.valueFor(android::String8(flash_mode));
+ else
+ *mode = FLASH_MODE_OFF;
+}
+
+void android_camera_set_white_balance_mode(CameraControl* control, WhiteBalanceMode mode)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+
+ control->camera_parameters.set(
+ android::CameraParameters::KEY_WHITE_BALANCE,
+ white_balance_modes[mode]);
+ control->camera->setParameters(control->camera_parameters.flatten());
+}
+
+void android_camera_get_white_balance_mode(CameraControl* control, WhiteBalanceMode* mode)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+
+ *mode = white_balance_modes_lut.valueFor(
+ android::String8(
+ control->camera_parameters.get(
+ android::CameraParameters::KEY_WHITE_BALANCE)));
+}
+
+void android_camera_set_scene_mode(CameraControl* control, SceneMode mode)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+
+ control->camera_parameters.set(
+ android::CameraParameters::KEY_SCENE_MODE,
+ scene_modes[mode]);
+ control->camera->setParameters(control->camera_parameters.flatten());
+}
+
+void android_camera_get_scene_mode(CameraControl* control, SceneMode* mode)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+
+ *mode = scene_modes_lut.valueFor(
+ android::String8(
+ control->camera_parameters.get(
+ android::CameraParameters::KEY_SCENE_MODE)));
+}
+
+void android_camera_set_auto_focus_mode(CameraControl* control, AutoFocusMode mode)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+
+ control->camera_parameters.set(
+ android::CameraParameters::KEY_FOCUS_MODE,
+ auto_focus_modes[mode]);
+ control->camera->setParameters(control->camera_parameters.flatten());
+}
+
+void android_camera_get_auto_focus_mode(CameraControl* control, AutoFocusMode* mode)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+
+ *mode = auto_focus_modes_lut.valueFor(
+ android::String8(
+ control->camera_parameters.get(
+ android::CameraParameters::KEY_FOCUS_MODE)));
+}
+
+
+void android_camera_set_effect_mode(CameraControl* control, EffectMode mode)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+
+ control->camera_parameters.set(
+ android::CameraParameters::KEY_EFFECT,
+ effect_modes[mode]);
+ control->camera->setParameters(control->camera_parameters.flatten());
+}
+
+void android_camera_get_effect_mode(CameraControl* control, EffectMode* mode)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+
+ *mode = effect_modes_lut.valueFor(
+ android::String8(
+ control->camera_parameters.get(
+ android::CameraParameters::KEY_EFFECT)));
+}
+
+void android_camera_get_preview_fps_range(CameraControl* control, int* min, int* max)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+
+ control->camera_parameters.getPreviewFpsRange(min, max);
+}
+
+void android_camera_set_preview_fps(CameraControl* control, int fps)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+ control->camera_parameters.setPreviewFrameRate(fps);
+ control->camera->setParameters(control->camera_parameters.flatten());
+}
+
+void android_camera_get_preview_fps(CameraControl* control, int* fps)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+ *fps = control->camera_parameters.getPreviewFrameRate();
+}
+
+void android_camera_enumerate_supported_preview_sizes(CameraControl* control, size_callback cb, void* ctx)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+ android::Vector<android::Size> sizes;
+ control->camera_parameters.getSupportedPreviewSizes(sizes);
+
+ for (unsigned int i = 0; i < sizes.size(); i++) {
+ cb(ctx, sizes[i].width, sizes[i].height);
+ }
+}
+
+void android_camera_enumerate_supported_picture_sizes(CameraControl* control, size_callback cb, void* ctx)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+ android::Vector<android::Size> sizes;
+ control->camera_parameters.getSupportedPictureSizes(sizes);
+
+ for (unsigned int i = 0; i < sizes.size(); i++) {
+ cb(ctx, sizes[i].width, sizes[i].height);
+ }
+}
+
+void android_camera_get_preview_size(CameraControl* control, int* width, int* height)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+
+ control->camera_parameters.getPreviewSize(width, height);
+}
+
+void android_camera_set_preview_size(CameraControl* control, int width, int height)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+
+ control->camera_parameters.setPreviewSize(width, height);
+ control->camera->setParameters(control->camera_parameters.flatten());
+}
+
+void android_camera_get_picture_size(CameraControl* control, int* width, int* height)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+
+ control->camera_parameters.getPictureSize(width, height);
+}
+
+void android_camera_set_picture_size(CameraControl* control, int width, int height)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+
+ control->camera_parameters.setPictureSize(width, height);
+ control->camera->setParameters(control->camera_parameters.flatten());
+}
+
+void android_camera_get_current_zoom(CameraControl* control, int* zoom)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+
+ *zoom = control->camera_parameters.getInt(android::CameraParameters::KEY_ZOOM);
+}
+
+void android_camera_get_max_zoom(CameraControl* control, int* zoom)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+
+ *zoom = control->camera_parameters.getInt(android::CameraParameters::KEY_MAX_ZOOM);
+}
+
+void android_camera_set_display_orientation(CameraControl* control, int32_t clockwise_rotation_degree)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+ static const int32_t ignored_parameter = 0;
+ control->camera->sendCommand(CAMERA_CMD_SET_DISPLAY_ORIENTATION, clockwise_rotation_degree, ignored_parameter);
+}
+
+void android_camera_get_preview_texture_transformation(CameraControl* control, float m[16])
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ if (control->preview_texture == NULL)
+ return;
+
+ control->preview_texture->getTransformMatrix(m);
+}
+
+void android_camera_update_preview_texture(CameraControl* control)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ control->preview_texture->updateTexImage();
+}
+
+void android_camera_set_preview_texture(CameraControl* control, int texture_id)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ static const bool allow_synchronous_mode = false;
+
+ android::sp<android::NativeBufferAlloc> native_alloc(
+ new android::NativeBufferAlloc()
+ );
+
+ android::sp<android::BufferQueue> buffer_queue(
+ new android::BufferQueue(false, NULL, native_alloc)
+ );
+
+ if (control->preview_texture == NULL) {
+ control->preview_texture = android::sp<android::SurfaceTexture>(
+ new android::SurfaceTexture(
+ texture_id,
+ allow_synchronous_mode,
+ GL_TEXTURE_EXTERNAL_OES,
+ true,
+ buffer_queue));
+ }
+
+ control->preview_texture->setFrameAvailableListener(
+ android::sp<android::SurfaceTexture::FrameAvailableListener>(control));
+ control->camera->setPreviewTexture(control->preview_texture->getBufferQueue());
+}
+
+void android_camera_set_preview_surface(CameraControl* control, SfSurface* surface)
+{
+ REPORT_FUNCTION();
+ assert(control);
+ assert(surface);
+
+ android::Mutex::Autolock al(control->guard);
+ control->camera->setPreviewDisplay(surface->surface);
+}
+
+void android_camera_start_preview(CameraControl* control)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+ control->camera->startPreview();
+}
+
+void android_camera_stop_preview(CameraControl* control)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+ control->camera->stopPreview();
+}
+
+void android_camera_start_autofocus(CameraControl* control)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+ control->camera->autoFocus();
+}
+
+void android_camera_stop_autofocus(CameraControl* control)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+ control->camera->cancelAutoFocus();
+}
+
+void android_camera_start_zoom(CameraControl* control, int32_t zoom)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ static const int ignored_argument = 0;
+
+ android::Mutex::Autolock al(control->guard);
+ control->camera->sendCommand(CAMERA_CMD_START_SMOOTH_ZOOM,
+ zoom,
+ ignored_argument);
+}
+
+// Adjust the zoom level immediately as opposed to smoothly zoomin gin.
+void android_camera_set_zoom(CameraControl* control, int32_t zoom)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+
+ control->camera_parameters.set(
+ android::CameraParameters::KEY_ZOOM,
+ zoom);
+
+ control->camera->setParameters(control->camera_parameters.flatten());
+}
+
+void android_camera_stop_zoom(CameraControl* control)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ static const int ignored_argument = 0;
+
+ android::Mutex::Autolock al(control->guard);
+ control->camera->sendCommand(CAMERA_CMD_STOP_SMOOTH_ZOOM,
+ ignored_argument,
+ ignored_argument);
+}
+
+void android_camera_take_snapshot(CameraControl* control)
+{
+ REPORT_FUNCTION();
+ assert(control);
+ android::Mutex::Autolock al(control->guard);
+ control->camera->takePicture(CAMERA_MSG_SHUTTER | CAMERA_MSG_COMPRESSED_IMAGE);
+}
+
+void android_camera_set_preview_format(CameraControl* control, CameraPixelFormat pf)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+
+ control->camera_parameters.set(
+ android::CameraParameters::KEY_PREVIEW_FORMAT,
+ camera_pixel_formats[pf]);
+
+ control->camera->setParameters(control->camera_parameters.flatten());
+}
+
+void android_camera_get_preview_format(CameraControl* control, CameraPixelFormat* pf)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+
+ *pf = pixel_formats_lut.valueFor(
+ android::String8(
+ control->camera_parameters.get(
+ android::CameraParameters::KEY_PREVIEW_FORMAT)));
+}
+
+void android_camera_set_focus_region(
+ CameraControl* control,
+ FocusRegion* region)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+ static const char* focus_region_pattern = "(%d,%d,%d,%d,%d)";
+ static char focus_region[256];
+ snprintf(focus_region,
+ sizeof(focus_region),
+ focus_region_pattern,
+ region->left,
+ region->top,
+ region->right,
+ region->bottom,
+ region->weight);
+
+ control->camera_parameters.set(
+ android::CameraParameters::KEY_FOCUS_AREAS,
+ focus_region);
+
+ control->camera->setParameters(control->camera_parameters.flatten());
+}
+
+void android_camera_reset_focus_region(CameraControl* control)
+{
+ static FocusRegion region = { 0, 0, 0, 0, 0 };
+
+ android_camera_set_focus_region(control, ®ion);
+}
+
+void android_camera_set_rotation(CameraControl* control, int rotation)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+ control->camera_parameters.set(
+ android::CameraParameters::KEY_ROTATION,
+ rotation);
+ control->camera->setParameters(control->camera_parameters.flatten());
+}
+
+void android_camera_enumerate_supported_video_sizes(CameraControl* control, size_callback cb, void* ctx)
+{
+ REPORT_FUNCTION();
+ assert(control);
+ assert(cb);
+
+ android::Mutex::Autolock al(control->guard);
+ android::Vector<android::Size> sizes;
+ control->camera_parameters.getSupportedVideoSizes(sizes);
+
+ for (unsigned int i = 0; i < sizes.size(); i++) {
+ cb(ctx, sizes[i].width, sizes[i].height);
+ }
+}
+
+void android_camera_get_video_size(CameraControl* control, int* width, int* height)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+
+ control->camera_parameters.getVideoSize(width, height);
+}
+
+void android_camera_set_video_size(CameraControl* control, int width, int height)
+{
+ REPORT_FUNCTION();
+ assert(control);
+
+ android::Mutex::Autolock al(control->guard);
+
+ control->camera_parameters.setVideoSize(width, height);
+ control->camera->setParameters(control->camera_parameters.flatten());
+}
--- /dev/null
+/*
+ * Copyright (C) 2013 Canonical Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
+ * Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
+ */
+
+#include <hybris/camera/camera_compatibility_layer.h>
+#include <hybris/camera/camera_compatibility_layer_capabilities.h>
+
+#include <hybris/input/input_stack_compatibility_layer.h>
+#include <hybris/input/input_stack_compatibility_layer_codes_key.h>
+#include <hybris/input/input_stack_compatibility_layer_flags_key.h>
+#include <hybris/input/input_stack_compatibility_layer_flags_motion.h>
+
+#include <hybris/surface_flinger/surface_flinger_compatibility_layer.h>
+
+#include <gui/ISurfaceComposer.h>
+
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <cassert>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+
+int shot_counter = 1;
+int32_t current_zoom_level = 1;
+bool new_camera_frame_available = true;
+
+EffectMode next_effect()
+{
+ static EffectMode current_effect = EFFECT_MODE_NONE;
+
+ EffectMode next = current_effect;
+
+ switch (current_effect) {
+ case EFFECT_MODE_NONE:
+ next = EFFECT_MODE_MONO;
+ break;
+ case EFFECT_MODE_MONO:
+ next = EFFECT_MODE_NEGATIVE;
+ break;
+ case EFFECT_MODE_NEGATIVE:
+ next = EFFECT_MODE_SOLARIZE;
+ break;
+ case EFFECT_MODE_SOLARIZE:
+ next = EFFECT_MODE_SEPIA;
+ break;
+ case EFFECT_MODE_SEPIA:
+ next = EFFECT_MODE_POSTERIZE;
+ break;
+ case EFFECT_MODE_POSTERIZE:
+ next = EFFECT_MODE_WHITEBOARD;
+ break;
+ case EFFECT_MODE_WHITEBOARD:
+ next = EFFECT_MODE_BLACKBOARD;
+ break;
+ case EFFECT_MODE_BLACKBOARD:
+ next = EFFECT_MODE_AQUA;
+ break;
+ case EFFECT_MODE_AQUA:
+ next = EFFECT_MODE_NONE;
+ break;
+ }
+
+ current_effect = next;
+ return next;
+}
+
+void error_msg_cb(void* context)
+{
+ printf("%s \n", __PRETTY_FUNCTION__);
+}
+
+void shutter_msg_cb(void* context)
+{
+ printf("%s \n", __PRETTY_FUNCTION__);
+}
+
+void zoom_msg_cb(void* context, int32_t new_zoom_level)
+{
+ printf("%s \n", __PRETTY_FUNCTION__);
+
+ CameraControl* cc = static_cast<CameraControl*>(context);
+ static int zoom;
+ android_camera_get_current_zoom(cc, &zoom);
+ printf("\t Current zoom: %d\n", zoom);
+ current_zoom_level = new_zoom_level;
+}
+
+void autofocus_msg_cb(void* context)
+{
+ printf("%s \n", __PRETTY_FUNCTION__);
+}
+
+void raw_data_cb(void* data, uint32_t data_size, void* context)
+{
+ printf("%s: %d \n", __PRETTY_FUNCTION__, data_size);
+}
+
+void jpeg_data_cb(void* data, uint32_t data_size, void* context)
+{
+ printf("%s: %d \n", __PRETTY_FUNCTION__, data_size);
+
+ char fn[256];
+ sprintf(fn, "/data/shot_%d.jpeg", shot_counter);
+ int fd = open(fn, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
+ write(fd, data, data_size);
+ close(fd);
+ shot_counter++;
+
+ CameraControl* cc = static_cast<CameraControl*>(context);
+ android_camera_start_preview(cc);
+}
+
+void size_cb(void* ctx, int width, int height)
+{
+ printf("Supported size: [%d,%d]\n", width, height);
+}
+
+void preview_texture_needs_update_cb(void* ctx)
+{
+ new_camera_frame_available = true;
+}
+
+void on_new_input_event(Event* event, void* context)
+{
+ assert(context);
+
+ if (event->type == KEY_EVENT_TYPE && event->action == ISCL_KEY_EVENT_ACTION_UP) {
+ printf("We have got a key event: %d \n", event->details.key.key_code);
+
+ CameraControl* cc = static_cast<CameraControl*>(context);
+
+ switch(event->details.key.key_code) {
+ case ISCL_KEYCODE_VOLUME_UP:
+ printf("\tZooming in now.\n");
+ android_camera_start_zoom(cc, current_zoom_level+1);
+ break;
+ case ISCL_KEYCODE_VOLUME_DOWN:
+ printf("\tZooming out now.\n");
+ android_camera_start_zoom(cc, current_zoom_level-1);
+ break;
+ case ISCL_KEYCODE_POWER:
+ printf("\tTaking a photo now.\n");
+ android_camera_take_snapshot(cc);
+ break;
+ case ISCL_KEYCODE_HEADSETHOOK:
+ printf("\tSwitching effect.\n");
+ android_camera_set_effect_mode(cc, next_effect());
+ }
+ } else if (event->type == MOTION_EVENT_TYPE &&
+ event->details.motion.pointer_count == 1) {
+ if ((event->action & ISCL_MOTION_EVENT_ACTION_MASK) == ISCL_MOTION_EVENT_ACTION_UP) {
+ printf("\tMotion event(Action up): (%f, %f) \n",
+ event->details.motion.pointer_coordinates[0].x,
+ event->details.motion.pointer_coordinates[0].y);
+ }
+
+ if ((event->action & ISCL_MOTION_EVENT_ACTION_MASK) == ISCL_MOTION_EVENT_ACTION_DOWN) {
+ printf("\tMotion event(Action down): (%f, %f) \n",
+ event->details.motion.pointer_coordinates[0].x,
+ event->details.motion.pointer_coordinates[0].y);
+ }
+ }
+}
+
+struct ClientWithSurface
+{
+ SfClient* client;
+ SfSurface* surface;
+};
+
+ClientWithSurface client_with_surface(bool setup_surface_with_egl)
+{
+ ClientWithSurface cs = ClientWithSurface();
+
+ cs.client = sf_client_create();
+
+ if (!cs.client) {
+ printf("Problem creating client ... aborting now.");
+ return cs;
+ }
+
+ static const size_t primary_display = 0;
+
+ SfSurfaceCreationParameters params = {
+ 0,
+ 0,
+ (int) sf_get_display_width(primary_display),
+ (int) sf_get_display_height(primary_display),
+ -1, //PIXEL_FORMAT_RGBA_8888,
+ 15000,
+ 0.5f,
+ setup_surface_with_egl, // Do not associate surface with egl, will be done by camera HAL
+ "CameraCompatLayerTestSurface"
+ };
+
+ cs.surface = sf_surface_create(cs.client, ¶ms);
+
+ if (!cs.surface) {
+ printf("Problem creating surface ... aborting now.");
+ return cs;
+ }
+
+ sf_surface_make_current(cs.surface);
+
+ return cs;
+}
+
+#define PRINT_GLERROR() printf("GL error@%d: %x\n", __LINE__, glGetError());
+
+struct RenderData
+{
+ static const char* vertex_shader()
+ {
+ return
+ "#extension GL_OES_EGL_image_external : require \n"
+ "attribute vec4 a_position; \n"
+ "attribute vec2 a_texCoord; \n"
+ "uniform mat4 m_texMatrix; \n"
+ "varying vec2 v_texCoord; \n"
+ "varying float topDown; \n"
+ "void main() \n"
+ "{ \n"
+ " gl_Position = a_position; \n"
+ " v_texCoord = a_texCoord; \n"
+ // " v_texCoord = (m_texMatrix * vec4(a_texCoord, 0.0, 1.0)).xy;\n"
+ //" topDown = v_texCoord.y; \n"
+ "} \n";
+ }
+
+ static const char* fragment_shader()
+ {
+ return
+ "#extension GL_OES_EGL_image_external : require \n"
+ "precision mediump float; \n"
+ "varying vec2 v_texCoord; \n"
+ "uniform samplerExternalOES s_texture; \n"
+ "void main() \n"
+ "{ \n"
+ " gl_FragColor = texture2D( s_texture, v_texCoord );\n"
+ "} \n";
+ }
+
+ static GLuint loadShader(GLenum shaderType, const char* pSource)
+ {
+ GLuint shader = glCreateShader(shaderType);
+
+ if (shader) {
+ glShaderSource(shader, 1, &pSource, NULL);
+ glCompileShader(shader);
+ GLint compiled = 0;
+ glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
+
+ if (!compiled) {
+ GLint infoLen = 0;
+ glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
+ if (infoLen) {
+ char* buf = (char*) malloc(infoLen);
+ if (buf) {
+ glGetShaderInfoLog(shader, infoLen, NULL, buf);
+ fprintf(stderr, "Could not compile shader %d:\n%s\n",
+ shaderType, buf);
+ free(buf);
+ }
+ glDeleteShader(shader);
+ shader = 0;
+ }
+ }
+ } else {
+ printf("Error, during shader creation: %i\n", glGetError());
+ }
+
+ return shader;
+ }
+
+ static GLuint create_program(const char* pVertexSource, const char* pFragmentSource)
+ {
+ GLuint vertexShader = loadShader(GL_VERTEX_SHADER, pVertexSource);
+ if (!vertexShader) {
+ printf("vertex shader not compiled\n");
+ return 0;
+ }
+
+ GLuint pixelShader = loadShader(GL_FRAGMENT_SHADER, pFragmentSource);
+ if (!pixelShader) {
+ printf("frag shader not compiled\n");
+ return 0;
+ }
+
+ GLuint program = glCreateProgram();
+ if (program) {
+ glAttachShader(program, vertexShader);
+ glAttachShader(program, pixelShader);
+ glLinkProgram(program);
+ GLint linkStatus = GL_FALSE;
+ glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
+
+ if (linkStatus != GL_TRUE) {
+ GLint bufLength = 0;
+ glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength);
+ if (bufLength) {
+ char* buf = (char*) malloc(bufLength);
+ if (buf) {
+ glGetProgramInfoLog(program, bufLength, NULL, buf);
+ fprintf(stderr, "Could not link program:\n%s\n", buf);
+ free(buf);
+ }
+ }
+ glDeleteProgram(program);
+ program = 0;
+ }
+ }
+
+ return program;
+ }
+
+ RenderData() : program_object(create_program(vertex_shader(), fragment_shader()))
+ {
+ position_loc = glGetAttribLocation(program_object, "a_position");
+ tex_coord_loc = glGetAttribLocation(program_object, "a_texCoord");
+ sampler_loc = glGetUniformLocation(program_object, "s_texture");
+ matrix_loc = glGetUniformLocation(program_object, "m_texMatrix");
+ }
+
+ // Handle to a program object
+ GLuint program_object;
+ // Attribute locations
+ GLint position_loc;
+ GLint tex_coord_loc;
+ // Sampler location
+ GLint sampler_loc;
+ // Matrix location
+ GLint matrix_loc;
+};
+
+int main(int argc, char** argv)
+{
+ CameraControlListener listener;
+ memset(&listener, 0, sizeof(listener));
+ listener.on_msg_error_cb = error_msg_cb;
+ listener.on_msg_shutter_cb = shutter_msg_cb;
+ listener.on_msg_focus_cb = autofocus_msg_cb;
+ listener.on_msg_zoom_cb = zoom_msg_cb;
+
+ listener.on_data_raw_image_cb = raw_data_cb;
+ listener.on_data_compressed_image_cb = jpeg_data_cb;
+ listener.on_preview_texture_needs_update_cb = preview_texture_needs_update_cb;
+ CameraControl* cc = android_camera_connect_to(FRONT_FACING_CAMERA_TYPE,
+ &listener);
+
+ if (cc == NULL) {
+ printf("Problem connecting to camera");
+ return 1;
+ }
+
+ listener.context = cc;
+
+ AndroidEventListener event_listener;
+ event_listener.on_new_event = on_new_input_event;
+ event_listener.context = cc;
+
+ InputStackConfiguration input_configuration = { true, 25000 };
+
+ android_input_stack_initialize(&event_listener, &input_configuration);
+ android_input_stack_start();
+
+ android_camera_dump_parameters(cc);
+ android_camera_enumerate_supported_picture_sizes(cc, size_cb, NULL);
+ android_camera_enumerate_supported_preview_sizes(cc, size_cb, NULL);
+
+ int min_fps, max_fps, current_fps;
+ android_camera_get_preview_fps_range(cc, &min_fps, &max_fps);
+ printf("Preview fps range: [%d,%d]\n", min_fps, max_fps);
+ android_camera_get_preview_fps(cc, ¤t_fps);
+ printf("Current preview fps range: %d\n", current_fps);
+
+ android_camera_set_preview_size(cc, 960, 720);
+
+ int width, height;
+ android_camera_get_preview_size(cc, &width, &height);
+ printf("Current preview size: [%d,%d]\n", width, height);
+ android_camera_get_picture_size(cc, &width, &height);
+ printf("Current picture size: [%d,%d]\n", width, height);
+ int zoom;
+ android_camera_get_current_zoom(cc, &zoom);
+ printf("Current zoom: %d \n", zoom);
+ android_camera_get_max_zoom(cc, &zoom);
+ printf("Max zoom: %d \n", zoom);
+
+ EffectMode effect_mode;
+ FlashMode flash_mode;
+ WhiteBalanceMode wb_mode;
+ SceneMode scene_mode;
+ AutoFocusMode af_mode;
+ CameraPixelFormat pixel_format;
+ android_camera_get_effect_mode(cc, &effect_mode);
+ android_camera_get_flash_mode(cc, &flash_mode);
+ android_camera_get_white_balance_mode(cc, &wb_mode);
+ android_camera_get_scene_mode(cc, &scene_mode);
+ android_camera_get_auto_focus_mode(cc, &af_mode);
+ android_camera_get_preview_format(cc, &pixel_format);
+ printf("Current effect mode: %d \n", effect_mode);
+ printf("Current flash mode: %d \n", flash_mode);
+ printf("Current wb mode: %d \n", wb_mode);
+ printf("Current scene mode: %d \n", scene_mode);
+ printf("Current af mode: %d \n", af_mode);
+ printf("Current preview pixel format: %d \n", pixel_format);
+ //android_camera_set_focus_region(cc, -200, -200, 200, 200, 300);
+
+ ClientWithSurface cs = client_with_surface(true /* Associate surface with egl. */);
+
+ if (!cs.surface) {
+ printf("Problem acquiring surface for preview");
+ return 1;
+ }
+
+ EGLDisplay disp = sf_client_get_egl_display(cs.client);
+ EGLSurface surface = sf_surface_get_egl_surface(cs.surface);
+
+ RenderData render_data;
+ GLuint preview_texture_id;
+ glGenTextures(1, &preview_texture_id);
+ glClearColor(1.0, 0., 0.5, 1.);
+ glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(
+ GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(
+ GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ android_camera_set_preview_texture(cc, preview_texture_id);
+ android_camera_set_effect_mode(cc, EFFECT_MODE_SEPIA);
+ android_camera_set_flash_mode(cc, FLASH_MODE_AUTO);
+ android_camera_set_auto_focus_mode(cc, AUTO_FOCUS_MODE_CONTINUOUS_PICTURE);
+ android_camera_start_preview(cc);
+
+ GLfloat transformation_matrix[16];
+ android_camera_get_preview_texture_transformation(cc, transformation_matrix);
+ glUniformMatrix4fv(render_data.matrix_loc, 1, GL_FALSE, transformation_matrix);
+
+ printf("Started camera preview.\n");
+
+ while (true) {
+ /*if (new_camera_frame_available)
+ {
+ printf("Updating texture");
+ new_camera_frame_available = false;
+ }*/
+ static GLfloat vVertices[] = { 0.0f, 0.0f, 0.0f, // Position 0
+ 0.0f, 0.0f, // TexCoord 0
+ 0.0f, 1.0f, 0.0f, // Position 1
+ 0.0f, 1.0f, // TexCoord 1
+ 1.0f, 1.0f, 0.0f, // Position 2
+ 1.0f, 1.0f, // TexCoord 2
+ 1.0f, 0.0f, 0.0f, // Position 3
+ 1.0f, 0.0f // TexCoord 3
+ };
+
+ GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
+
+ // Set the viewport
+ // Clear the color buffer
+ glClear(GL_COLOR_BUFFER_BIT);
+ // Use the program object
+ glUseProgram(render_data.program_object);
+ // Enable attributes
+ glEnableVertexAttribArray(render_data.position_loc);
+ glEnableVertexAttribArray(render_data.tex_coord_loc);
+ // Load the vertex position
+ glVertexAttribPointer(render_data.position_loc,
+ 3,
+ GL_FLOAT,
+ GL_FALSE,
+ 5 * sizeof(GLfloat),
+ vVertices);
+ // Load the texture coordinate
+ glVertexAttribPointer(render_data.tex_coord_loc,
+ 2,
+ GL_FLOAT,
+ GL_FALSE,
+ 5 * sizeof(GLfloat),
+ vVertices+3);
+
+ glActiveTexture(GL_TEXTURE0);
+ // Set the sampler texture unit to 0
+ glUniform1i(render_data.sampler_loc, 0);
+ glUniform1i(render_data.matrix_loc, 0);
+ android_camera_update_preview_texture(cc);
+ glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
+ glDisableVertexAttribArray(render_data.position_loc);
+ glDisableVertexAttribArray(render_data.tex_coord_loc);
+
+ eglSwapBuffers(disp, surface);
+ }
+}
--- /dev/null
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+HYBRIS_PATH := $(LOCAL_PATH)/../../hybris
+
+LOCAL_CFLAGS += -std=gnu++0x
+
+LOCAL_SRC_FILES:= input_compatibility_layer.cpp
+
+LOCAL_MODULE:= libis_compat_layer
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SHARED_LIBRARIES := \
+ libinput \
+ libcutils \
+ libutils \
+ libskia \
+ libgui \
+ libandroidfw
+
+LOCAL_C_INCLUDES := \
+ $(HYBRIS_PATH)/include \
+ external/skia/include/core \
+ frameworks/base/services/input
+
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+
+HYBRIS_PATH := $(LOCAL_PATH)/../../hybris
+
+LOCAL_CFLAGS += -std=gnu++0x
+
+LOCAL_SRC_FILES:= \
+ direct_input_test.cpp
+
+LOCAL_MODULE:= direct_input_test
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_C_INCLUDES := \
+ $(HYBRIS_PATH)/include \
+ bionic \
+ bionic/libstdc++/include \
+ external/gtest/include \
+ external/stlport/stlport \
+ external/skia/include/core
+
+LOCAL_SHARED_LIBRARIES := \
+ libis_compat_layer \
+ libcutils \
+ libutils \
+ libskia \
+ libgui \
+ libandroidfw
+
+static_libraries := \
+ libgtest \
+ libgtest_main
+
+include $(BUILD_EXECUTABLE)
--- /dev/null
+/*
+ * Copyright (C) 2013 Canonical Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
+ * Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
+ */
+
+#include <hybris/input/input_stack_compatibility_layer.h>
+
+#include <gtest/gtest.h>
+#include <utils/threads.h>
+
+#include <signal.h>
+
+namespace
+{
+
+bool g_stop = false;
+
+void signal_handler(int)
+{
+ g_stop = true;
+}
+
+void on_new_event(Event* event, void* context)
+{
+ printf("%s", __PRETTY_FUNCTION__);
+
+ printf("\tEventType: %d \n", event->type);
+ printf("\tdevice_id: %d \n", event->device_id);
+ printf("\tsource_id: %d \n", event->source_id);
+ printf("\taction: %d \n", event->action);
+ printf("\tflags: %d \n", event->flags);
+ printf("\tmeta_state: %d \n", event->meta_state);
+
+ switch (event->type) {
+ case MOTION_EVENT_TYPE:
+ printf("\tdetails.motion.event_time: %lld\n",
+ event->details.motion.event_time);
+ printf("\tdetails.motion.pointer_coords.x: %f\n",
+ event->details.motion.pointer_coordinates[0].x);
+ printf("\tdetails.motion.pointer_coords.y: %f\n",
+ event->details.motion.pointer_coordinates[0].y);
+ break;
+ default:
+ break;
+ }
+}
+
+}
+
+int main(int argc, char** argv)
+{
+ g_stop = false;
+ signal(SIGINT, signal_handler);
+
+ AndroidEventListener listener;
+ listener.on_new_event = on_new_event;
+ listener.context = NULL;
+
+ InputStackConfiguration config = {
+ enable_touch_point_visualization : true,
+ default_layer_for_touch_point_visualization : 10000,
+ input_area_width : 1024,
+ input_area_height : 1024
+ };
+
+ android_input_stack_initialize(&listener, &config);
+ android_input_stack_start_waiting_for_flag(&g_stop);
+
+ android_input_stack_stop();
+ android_input_stack_shutdown();
+}
--- /dev/null
+/*
+ * Copyright (C) 2013 Canonical Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
+ * Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
+ */
+
+#include <hybris/input/input_stack_compatibility_layer.h>
+
+#include "InputListener.h"
+#include "InputReader.h"
+#include "PointerController.h"
+#include "SpriteController.h"
+#include <gui/ISurfaceComposer.h>
+#include <gui/SurfaceComposerClient.h>
+
+#undef LOG_TAG
+#define LOG_TAG "InputStackCompatibilityLayer"
+#include <utils/Log.h>
+
+namespace
+{
+static bool enable_verbose_function_reporting = false;
+}
+
+#define REPORT_FUNCTION() ALOGV("%s\n", __PRETTY_FUNCTION__);
+
+namespace
+{
+
+class DefaultPointerControllerPolicy : public android::PointerControllerPolicyInterface
+{
+public:
+ static const size_t bitmap_width = 64;
+ static const size_t bitmap_height = 64;
+
+ DefaultPointerControllerPolicy()
+ {
+ bitmap.setConfig(
+ SkBitmap::kARGB_8888_Config,
+ bitmap_width,
+ bitmap_height);
+ bitmap.allocPixels();
+
+ // Icon for spot touches
+ bitmap.eraseARGB(125, 0, 255, 0);
+ spotTouchIcon = android::SpriteIcon(
+ bitmap,
+ bitmap_width/2,
+ bitmap_height/2);
+
+ // Icon for anchor touches
+ bitmap.eraseARGB(125, 0, 0, 255);
+ spotAnchorIcon = android::SpriteIcon(
+ bitmap,
+ bitmap_width/2,
+ bitmap_height/2);
+
+ // Icon for hovering touches
+ bitmap.eraseARGB(125, 255, 0, 0);
+ spotHoverIcon = android::SpriteIcon(
+ bitmap,
+ bitmap_width/2,
+ bitmap_height/2);
+ }
+
+ void loadPointerResources(android::PointerResources* outResources)
+ {
+ outResources->spotHover = spotHoverIcon.copy();
+ outResources->spotTouch = spotTouchIcon.copy();
+ outResources->spotAnchor = spotAnchorIcon.copy();
+ }
+
+ android::SpriteIcon spotHoverIcon;
+ android::SpriteIcon spotTouchIcon;
+ android::SpriteIcon spotAnchorIcon;
+ SkBitmap bitmap;
+};
+
+class DefaultInputReaderPolicyInterface : public android::InputReaderPolicyInterface
+{
+public:
+ static const int32_t internal_display_id = android::ISurfaceComposer::eDisplayIdMain;
+ static const int32_t external_display_id = android::ISurfaceComposer::eDisplayIdHdmi;
+
+ DefaultInputReaderPolicyInterface(
+ InputStackConfiguration* configuration,
+ const android::sp<android::Looper>& looper)
+ : looper(looper),
+ default_layer_for_touch_point_visualization(configuration->default_layer_for_touch_point_visualization),
+ input_area_width(configuration->input_area_width),
+ input_area_height(configuration->input_area_height)
+ {
+ default_configuration.showTouches = configuration->enable_touch_point_visualization;
+
+ android::DisplayViewport viewport;
+ viewport.setNonDisplayViewport(input_area_width, input_area_height);
+ viewport.displayId = android::ISurfaceComposer::eDisplayIdMain;
+ default_configuration.setDisplayInfo(
+ false, /* external */
+ viewport);
+ }
+
+ void getReaderConfiguration(android::InputReaderConfiguration* outConfig)
+ {
+ *outConfig = default_configuration;
+ }
+
+ android::sp<android::PointerControllerInterface> obtainPointerController(int32_t deviceId)
+ {
+ (void) deviceId;
+
+ android::sp<android::SpriteController> sprite_controller(
+ new android::SpriteController(
+ looper,
+ default_layer_for_touch_point_visualization));
+ android::sp<android::PointerController> pointer_controller(
+ new android::PointerController(
+ android::sp<DefaultPointerControllerPolicy>(new DefaultPointerControllerPolicy()),
+ looper,
+ sprite_controller));
+ pointer_controller->setPresentation(
+ android::PointerControllerInterface::PRESENTATION_SPOT);
+
+ pointer_controller->setDisplayViewport(input_area_width, input_area_height, 0);
+ return pointer_controller;
+ }
+
+ virtual void notifyInputDevicesChanged(const android::Vector<android::InputDeviceInfo>& inputDevices) {
+ mInputDevices = inputDevices;
+ }
+
+ virtual android::sp<android::KeyCharacterMap> getKeyboardLayoutOverlay(const android::String8& inputDeviceDescriptor) {
+ return NULL;
+ }
+
+ virtual android::String8 getDeviceAlias(const android::InputDeviceIdentifier& identifier) {
+ return android::String8::empty();
+ }
+
+private:
+ android::sp<android::Looper> looper;
+ int default_layer_for_touch_point_visualization;
+ android::InputReaderConfiguration default_configuration;
+ android::Vector<android::InputDeviceInfo> mInputDevices;
+ int input_area_width;
+ int input_area_height;
+};
+
+class ExportedInputListener : public android::InputListenerInterface
+{
+public:
+ ExportedInputListener(AndroidEventListener* external_listener) : external_listener(external_listener)
+ {
+ }
+
+ void notifyConfigurationChanged(const android::NotifyConfigurationChangedArgs* args)
+ {
+ REPORT_FUNCTION();
+ (void) args;
+ }
+
+ void notifyKey(const android::NotifyKeyArgs* args)
+ {
+ REPORT_FUNCTION();
+
+ current_event.type = KEY_EVENT_TYPE;
+ current_event.device_id = args->deviceId;
+ current_event.source_id = args->source;
+ current_event.action = args->action;
+ current_event.flags = args->flags;
+ current_event.meta_state = args->metaState;
+
+ current_event.details.key.key_code = args->keyCode;
+ current_event.details.key.scan_code = args->scanCode;
+ current_event.details.key.down_time = args->downTime;
+ current_event.details.key.event_time = args->eventTime;
+
+ current_event.details.key.is_system_key = false;
+
+ external_listener->on_new_event(¤t_event, external_listener->context);
+ }
+
+ void notifyMotion(const android::NotifyMotionArgs* args)
+ {
+ REPORT_FUNCTION();
+
+ current_event.type = MOTION_EVENT_TYPE;
+ current_event.device_id = args->deviceId;
+ current_event.source_id = args->source;
+ current_event.action = args->action;
+ current_event.flags = args->flags;
+ current_event.meta_state = args->metaState;
+
+ current_event.details.motion.button_state = args->buttonState;
+ current_event.details.motion.down_time = args->downTime;
+ current_event.details.motion.event_time = args->eventTime;
+ current_event.details.motion.edge_flags = args->edgeFlags;
+ current_event.details.motion.x_precision = args->xPrecision;
+ current_event.details.motion.y_precision = args->yPrecision;
+ current_event.details.motion.pointer_count = args->pointerCount;
+
+ for (unsigned int i = 0; i < current_event.details.motion.pointer_count; i++) {
+ current_event.details.motion.pointer_coordinates[i].id = args->pointerProperties[i].id;
+ current_event.details.motion.pointer_coordinates[i].x
+ = current_event.details.motion.pointer_coordinates[i].raw_x
+ = args->pointerCoords[i].getX();
+ current_event.details.motion.pointer_coordinates[i].y
+ = current_event.details.motion.pointer_coordinates[i].raw_y
+ = args->pointerCoords[i].getY();
+ current_event.details.motion.pointer_coordinates[i].touch_major
+ = args->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR);
+ current_event.details.motion.pointer_coordinates[i].touch_minor
+ = args->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR);
+ current_event.details.motion.pointer_coordinates[i].pressure
+ = args->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_PRESSURE);
+ current_event.details.motion.pointer_coordinates[i].size
+ = args->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_SIZE);
+ current_event.details.motion.pointer_coordinates[i].orientation
+ = args->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_ORIENTATION);
+
+ }
+
+ external_listener->on_new_event(¤t_event, external_listener->context);
+ }
+
+ void notifySwitch(const android::NotifySwitchArgs* args)
+ {
+ REPORT_FUNCTION();
+ current_event.type = HW_SWITCH_EVENT_TYPE;
+
+ current_event.details.hw_switch.event_time = args->eventTime;
+ current_event.details.hw_switch.policy_flags = args->policyFlags;
+ current_event.details.hw_switch.switch_values = args->switchValues;
+ current_event.details.hw_switch.switch_mask = args->switchMask;
+
+ external_listener->on_new_event(¤t_event, external_listener->context);
+ }
+
+ void notifyDeviceReset(const android::NotifyDeviceResetArgs* args)
+ {
+ REPORT_FUNCTION();
+ (void) args;
+ }
+
+private:
+ AndroidEventListener* external_listener;
+ Event current_event;
+};
+
+class LooperThread : public android::Thread
+{
+public:
+ static const int default_poll_timeout_ms = -1;
+
+ LooperThread(const android::sp<android::Looper>& looper) : looper(looper)
+ {
+ }
+
+private:
+ bool threadLoop()
+ {
+ if (ALOOPER_POLL_ERROR == looper->pollAll(default_poll_timeout_ms))
+ return false;
+ return true;
+ }
+
+ android::sp<android::Looper> looper;
+};
+
+struct State : public android::RefBase
+{
+ State(AndroidEventListener* listener,
+ InputStackConfiguration* configuration)
+ : looper(new android::Looper(false)),
+ looper_thread(new LooperThread(looper)),
+ event_hub(new android::EventHub()),
+ input_reader_policy(new DefaultInputReaderPolicyInterface(configuration, looper)),
+ input_listener(new ExportedInputListener(listener)),
+ input_reader(new android::InputReader(
+ event_hub,
+ input_reader_policy,
+ input_listener)),
+ input_reader_thread(new android::InputReaderThread(input_reader))
+ {
+ }
+
+ ~State()
+ {
+ input_reader_thread->requestExit();
+ }
+
+ android::sp<android::Looper> looper;
+ android::sp<LooperThread> looper_thread;
+
+ android::sp<android::EventHubInterface> event_hub;
+ android::sp<android::InputReaderPolicyInterface> input_reader_policy;
+ android::sp<android::InputListenerInterface> input_listener;
+ android::sp<android::InputReaderInterface> input_reader;
+ android::sp<android::InputReaderThread> input_reader_thread;
+
+ android::Condition wait_condition;
+ android::Mutex wait_guard;
+};
+
+android::sp<State> global_state;
+
+}
+
+void android_input_stack_initialize(AndroidEventListener* listener, InputStackConfiguration* config)
+{
+ global_state = new State(listener, config);
+}
+
+void android_input_stack_loop_once()
+{
+ global_state->input_reader->loopOnce();
+}
+
+void android_input_stack_start()
+{
+ global_state->input_reader_thread->run();
+ global_state->looper_thread->run();
+}
+
+void android_input_stack_start_waiting_for_flag(bool* flag)
+{
+ global_state->input_reader_thread->run();
+ global_state->looper_thread->run();
+
+ while (!*flag) {
+ global_state->wait_condition.waitRelative(
+ global_state->wait_guard,
+ 10 * 1000 * 1000);
+ }
+}
+
+void android_input_stack_stop()
+{
+ global_state->input_reader_thread->requestExit();
+}
+
+void android_input_stack_shutdown()
+{
+ global_state = NULL;
+}
--- /dev/null
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+HYBRIS_PATH := $(LOCAL_PATH)/../../hybris
+
+LOCAL_SRC_FILES:= \
+ surface_flinger_compatibility_layer.cpp
+
+LOCAL_MODULE:= libsf_compat_layer
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_C_INCLUDES := \
+ $(HYBRIS_PATH)/include
+
+LOCAL_SHARED_LIBRARIES := \
+ libui \
+ libutils \
+ libgui \
+ libEGL \
+ libGLESv2
+
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+
+HYBRIS_PATH := $(LOCAL_PATH)/../../hybris
+
+LOCAL_SRC_FILES:= \
+ direct_sf_test.cpp
+
+LOCAL_MODULE:= direct_sf_test
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_C_INCLUDES := \
+ $(HYBRIS_PATH)/include
+
+LOCAL_SHARED_LIBRARIES := \
+ libui \
+ libutils \
+ libEGL \
+ libGLESv2 \
+ libsf_compat_layer
+
+include $(BUILD_EXECUTABLE)
--- /dev/null
+/*
+ * Copyright (C) 2013 Canonical Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
+ * Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
+ */
+
+#include <hybris/surface_flinger/surface_flinger_compatibility_layer.h>
+
+#include <cstdio>
+#include <unistd.h>
+
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+
+/* animation state variables */
+GLfloat rotation_angle = 0.0f;
+
+static GLuint gProgram;
+static GLuint gvPositionHandle, gvColorHandle;
+static GLuint rotation_uniform;
+static GLint num_vertex = 3;
+static const GLfloat triangle[] = {
+ -0.125f, -0.125f, 0.0f, 0.5f,
+ 0.0f, 0.125f, 0.0f, 0.5f,
+ 0.125f, -0.125f, 0.0f, 0.5f
+};
+static const GLfloat color_triangle[] = {
+ 0.0f, 0.0f, 1.0f, 1.0f,
+ 0.0f, 1.0f, 0.0f, 1.0f,
+ 1.0f, 0.0f, 0.0f, 0.0f
+};
+const GLfloat * vertex_data;
+const GLfloat * color_data;
+static const char gVertexShader[] =
+ "attribute vec4 vPosition;\n"
+ "attribute vec4 vColor;\n"
+ "uniform float angle;\n"
+ "varying vec4 colorinfo;\n"
+ "void main() {\n"
+ " mat3 rot_z = mat3( vec3( cos(angle), sin(angle), 0.0),\n"
+ " vec3(-sin(angle), cos(angle), 0.0),\n"
+ " vec3( 0.0, 0.0, 1.0));\n"
+ " gl_Position = vec4(rot_z * vPosition.xyz, 1.0);\n"
+ " colorinfo = vColor;\n"
+ "}\n";
+
+static const char gFragmentShader[] = "precision mediump float;\n"
+ "varying vec4 colorinfo;\n"
+ "void main() {\n"
+ " gl_FragColor = colorinfo;\n"
+ "}\n";
+
+/* util functions */
+GLuint loadShader(GLenum shaderType, const char* pSource)
+{
+ GLuint shader = glCreateShader(shaderType);
+ if (shader) {
+ glShaderSource(shader, 1, &pSource, NULL);
+ glCompileShader(shader);
+ GLint compiled = 0;
+ glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
+
+ if (!compiled) {
+ GLint infoLen = 0;
+ glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
+ if (infoLen) {
+ char* buf = (char*) malloc(infoLen);
+ if (buf) {
+ glGetShaderInfoLog(shader, infoLen, NULL, buf);
+ fprintf(stderr, "Could not compile shader %d:\n%s\n",
+ shaderType, buf);
+ free(buf);
+ }
+ glDeleteShader(shader);
+ shader = 0;
+ }
+ }
+ } else {
+ printf("Error, during shader creation: %i\n", glGetError());
+ }
+
+ return shader;
+}
+
+GLuint createProgram(const char* pVertexSource, const char* pFragmentSource)
+{
+ GLuint vertexShader = loadShader(GL_VERTEX_SHADER, pVertexSource);
+ if (!vertexShader) {
+ printf("vertex shader not compiled\n");
+ return 0;
+ }
+
+ GLuint pixelShader = loadShader(GL_FRAGMENT_SHADER, pFragmentSource);
+ if (!pixelShader) {
+ printf("frag shader not compiled\n");
+ return 0;
+ }
+
+ GLuint program = glCreateProgram();
+ if (program) {
+ glAttachShader(program, vertexShader);
+ glAttachShader(program, pixelShader);
+ glLinkProgram(program);
+ GLint linkStatus = GL_FALSE;
+ glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
+
+ if (linkStatus != GL_TRUE) {
+ GLint bufLength = 0;
+ glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength);
+ if (bufLength) {
+ char* buf = (char*) malloc(bufLength);
+ if (buf) {
+ glGetProgramInfoLog(program, bufLength, NULL, buf);
+ fprintf(stderr, "Could not link program:\n%s\n", buf);
+ free(buf);
+ }
+ }
+ glDeleteProgram(program);
+ program = 0;
+ }
+ }
+
+ return program;
+}
+
+bool setupGraphics()
+{
+ vertex_data = triangle;
+ color_data = color_triangle;
+
+ gProgram = createProgram(gVertexShader, gFragmentShader);
+ if (!gProgram) {
+ printf("error making program\n");
+ return 0;
+ }
+
+ gvPositionHandle = glGetAttribLocation(gProgram, "vPosition");
+ gvColorHandle = glGetAttribLocation(gProgram, "vColor");
+
+ rotation_uniform = glGetUniformLocation(gProgram, "angle");
+
+ return true;
+}
+
+void hw_render(EGLDisplay displ, EGLSurface surface)
+{
+ glUseProgram(gProgram);
+
+ glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
+
+ glUniform1fv(rotation_uniform,1, &rotation_angle);
+
+ glVertexAttribPointer(gvColorHandle, num_vertex, GL_FLOAT, GL_FALSE, sizeof(GLfloat)*4, color_data);
+ glVertexAttribPointer(gvPositionHandle, num_vertex, GL_FLOAT, GL_FALSE, 0, vertex_data);
+ glEnableVertexAttribArray(gvPositionHandle);
+ glEnableVertexAttribArray(gvColorHandle);
+
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, num_vertex);
+ glDisableVertexAttribArray(gvPositionHandle);
+ glDisableVertexAttribArray(gvColorHandle);
+
+ eglSwapBuffers(displ, surface);
+}
+
+void hw_step()
+{
+ rotation_angle += 0.01;
+ return;
+}
+
+int main(int argc, char** argv)
+{
+ SfClient* sf_client = sf_client_create();
+
+ if (!sf_client) {
+ printf("Problem creating client ... aborting now.");
+ return 1;
+ }
+
+ SfSurfaceCreationParameters params = {
+ 200,
+ 200,
+ 500,
+ 500,
+ -1, //PIXEL_FORMAT_RGBA_8888,
+ INT_MAX,
+ 0.5f,
+ true, // Associate surface with egl
+ "A test surface"
+ };
+
+ SfSurface* sf_surface = sf_surface_create(sf_client, ¶ms);
+
+ if (!sf_surface) {
+ printf("Problem creating surface ... aborting now.");
+ return 1;
+ }
+
+ sf_surface_make_current(sf_surface);
+
+ EGLDisplay disp = sf_client_get_egl_display(sf_client);
+ EGLSurface surface = sf_surface_get_egl_surface(sf_surface);
+
+ setupGraphics();
+
+ printf("Turning off screen\n");
+ sf_blank(0);
+
+ sleep(1);
+
+ printf("Turning on screen\n");
+ sf_unblank(0);
+
+ for(;;) {
+ hw_render(disp, surface);
+ hw_step();
+ }
+}
+
+
--- /dev/null
+/*
+ * Copyright (C) 2013 Canonical Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authored by: Thomas Voss <thomas.voss@canonical.com>
+ * Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
+ */
+
+#include <hybris/surface_flinger/surface_flinger_compatibility_layer.h>
+#include <hybris/internal/surface_flinger_compatibility_layer_internal.h>
+
+#include <utils/misc.h>
+
+#include <gui/SurfaceComposerClient.h>
+#include <gui/ISurfaceComposer.h>
+#include <ui/DisplayInfo.h>
+#include <ui/PixelFormat.h>
+#include <ui/Region.h>
+#include <ui/Rect.h>
+
+#include <cassert>
+#include <cstdio>
+
+namespace
+{
+void report_failed_to_allocate_surface_flinger_composer_client_on_creation()
+{
+ printf("Problem allocating an object of type SurfaceComposerClient during client creation");
+}
+
+void report_failed_to_get_egl_default_display_on_creation()
+{
+ printf("Problem accessing default egl display during client creation");
+}
+
+void report_failed_to_initialize_egl_on_creation()
+{
+ printf("Problem initializing egl during client creation");
+}
+
+void report_failed_to_choose_egl_config_on_creation()
+{
+ printf("Problem choosing egl config on creation");
+}
+
+void report_surface_control_is_null_during_creation()
+{
+ printf("Could not acquire surface control object during surface creation");
+}
+
+void report_surface_is_null_during_creation()
+{
+ printf("Could not acquire surface from surface control during surface creation");
+}
+}
+
+void sf_blank(size_t display_id)
+{
+ android::sp<android::IBinder> display;
+
+ if (display_id == 0) {
+ display = android::SurfaceComposerClient::getBuiltInDisplay(
+ android::ISurfaceComposer::eDisplayIdMain);
+ } else if (display_id == 1) {
+ display = android::SurfaceComposerClient::getBuiltInDisplay(
+ android::ISurfaceComposer::eDisplayIdHdmi);
+ } else {
+ fprintf(stderr, "Warning: sf_blank invalid display_id (0 || 1)\n");
+ return;
+ }
+
+ android::SurfaceComposerClient::blankDisplay(display);
+}
+
+void sf_unblank(size_t display_id)
+{
+ android::sp<android::IBinder> display;
+
+ if (display_id == 0) {
+ display = android::SurfaceComposerClient::getBuiltInDisplay(
+ android::ISurfaceComposer::eDisplayIdMain);
+ } else if (display_id == 1) {
+ display = android::SurfaceComposerClient::getBuiltInDisplay(
+ android::ISurfaceComposer::eDisplayIdHdmi);
+ } else {
+ fprintf(stderr, "Warning: sf_unblank invalid display_id (0 || 1)\n");
+ return;
+ }
+
+ android::SurfaceComposerClient::unblankDisplay(display);
+}
+
+size_t sf_get_display_width(size_t display_id)
+{
+ android::sp<android::IBinder> display;
+
+ if (display_id == 0) {
+ display = android::SurfaceComposerClient::getBuiltInDisplay(
+ android::ISurfaceComposer::eDisplayIdMain);
+ } else if (display_id == 1) {
+ display = android::SurfaceComposerClient::getBuiltInDisplay(
+ android::ISurfaceComposer::eDisplayIdHdmi);
+ } else {
+ fprintf(stderr, "Warning: sf_get_display_width invalid display_id (0 || 1)\n");
+ return -1;
+ }
+
+ android::DisplayInfo info;
+ android::SurfaceComposerClient::getDisplayInfo(display, &info);
+ return info.w;
+}
+
+size_t sf_get_display_height(size_t display_id)
+{
+ android::sp<android::IBinder> display;
+
+ if (display_id == 0) {
+ display = android::SurfaceComposerClient::getBuiltInDisplay(
+ android::ISurfaceComposer::eDisplayIdMain);
+ } else if (display_id == 1) {
+ display = android::SurfaceComposerClient::getBuiltInDisplay(
+ android::ISurfaceComposer::eDisplayIdHdmi);
+ } else {
+ fprintf(stderr, "Warning: sf_get_display_height invalid display_id (0 || 1)\n");
+ return -1;
+ }
+
+ android::DisplayInfo info;
+ android::SurfaceComposerClient::getDisplayInfo(display, &info);
+ return info.h;
+}
+
+SfClient* sf_client_create_full(bool egl_support)
+{
+ SfClient* client = new SfClient();
+
+ client->client = new android::SurfaceComposerClient();
+ if (client->client == NULL) {
+ report_failed_to_allocate_surface_flinger_composer_client_on_creation();
+ delete client;
+ return NULL;
+ }
+
+ client->egl_support = egl_support;
+ if (egl_support) {
+ client->egl_display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+ if (client->egl_display == EGL_NO_DISPLAY) {
+ report_failed_to_get_egl_default_display_on_creation();
+ delete client;
+ return NULL;
+ }
+
+ int major, minor;
+ int rc = eglInitialize(client->egl_display, &major, &minor);
+ if (rc == EGL_FALSE) {
+ report_failed_to_initialize_egl_on_creation();
+ delete client;
+ return NULL;
+ }
+
+ EGLint attribs[] = {
+ EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
+ EGL_NONE
+ };
+
+ int n;
+ if (eglChooseConfig(client->egl_display,
+ attribs,
+ &client->egl_config, 1,
+ &n) == EGL_FALSE) {
+ report_failed_to_choose_egl_config_on_creation();
+ delete client;
+ return NULL;
+ }
+
+ EGLint context_attribs[] = {
+ EGL_CONTEXT_CLIENT_VERSION, 2,
+ EGL_NONE
+ };
+
+ client->egl_context = eglCreateContext(
+ client->egl_display,
+ client->egl_config,
+ EGL_NO_CONTEXT,
+ context_attribs);
+ }
+
+ return client;
+}
+
+SfClient* sf_client_create()
+{
+ return sf_client_create_full(true);
+}
+
+EGLDisplay sf_client_get_egl_display(SfClient* client)
+{
+ assert(client);
+
+ if (client->egl_support)
+ return client->egl_display;
+ else {
+ fprintf(stderr, "Warning: sf_client_get_egl_display not supported, EGL "
+ "support disabled\n");
+ return NULL;
+ }
+}
+
+EGLConfig sf_client_get_egl_config(SfClient* client)
+{
+ assert(client);
+
+ if (client->egl_support)
+ return client->egl_config;
+ else {
+ fprintf(stderr, "Warning: sf_client_get_egl_config not supported, EGL "
+ "support disabled\n");
+ return NULL;
+ }
+}
+
+void sf_client_begin_transaction(SfClient* client)
+{
+ assert(client);
+ client->client->openGlobalTransaction();
+}
+
+void sf_client_end_transaction(SfClient* client)
+{
+ assert(client);
+ client->client->closeGlobalTransaction();
+}
+
+SfSurface* sf_surface_create(SfClient* client, SfSurfaceCreationParameters* params)
+{
+ assert(client);
+ assert(params);
+
+ SfSurface* surface = new SfSurface();
+ surface->client = client;
+ surface->surface_control = surface->client->client->createSurface(
+ android::String8(params->name),
+ params->w,
+ params->h,
+ android::PIXEL_FORMAT_RGBA_8888,
+ 0x300);
+
+ if (surface->surface_control == NULL) {
+ report_surface_control_is_null_during_creation();
+ delete(surface);
+ return NULL;
+ }
+
+ surface->surface = surface->surface_control->getSurface();
+
+ if (surface->surface == NULL) {
+ report_surface_is_null_during_creation();
+ delete(surface);
+ return NULL;
+ }
+
+ sf_client_begin_transaction(client);
+ {
+ surface->surface_control->setPosition(params->x, params->y);
+ surface->surface_control->setLayer(params->layer);
+ surface->surface_control->setAlpha(params->alpha);
+ }
+ sf_client_end_transaction(client);
+
+ if (params->create_egl_window_surface) {
+ if (client->egl_support) {
+ android::sp<ANativeWindow> anw(surface->surface);
+ surface->egl_surface = eglCreateWindowSurface(
+ surface->client->egl_display,
+ surface->client->egl_config,
+ anw.get(),
+ NULL);
+ } else
+ fprintf(stderr, "Warning: params->create_egl_window_surface not "
+ "supported, EGL support disabled\n");
+ }
+
+ return surface;
+}
+
+EGLSurface sf_surface_get_egl_surface(SfSurface* surface)
+{
+ assert(surface);
+
+ if (surface->client->egl_support)
+ return surface->egl_surface;
+ else {
+ fprintf(stderr, "Warning: sf_surface_get_egl_surface not supported, "
+ "EGL support disabled\n");
+ return NULL;
+ }
+}
+
+EGLNativeWindowType sf_surface_get_egl_native_window(SfSurface* surface)
+{
+ assert(surface);
+ return surface->surface.get();
+}
+
+void sf_surface_make_current(SfSurface* surface)
+{
+ assert(surface);
+
+ if (surface->client->egl_support) {
+ eglMakeCurrent(
+ surface->client->egl_display,
+ surface->egl_surface,
+ surface->egl_surface,
+ surface->client->egl_context);
+ } else {
+ fprintf(stderr, "Warning: sf_surface_make_current not supported, EGL "
+ "support disabled\n");
+ }
+}
+
+void sf_surface_move_to(SfSurface* surface, int x, int y)
+{
+ assert(surface);
+ surface->surface_control->setPosition(x, y);
+}
+
+void sf_surface_set_size(SfSurface* surface, int w, int h)
+{
+ assert(surface);
+ surface->surface_control->setSize(w, h);
+}
+
+void sf_surface_set_layer(SfSurface* surface, int layer)
+{
+ assert(surface);
+ surface->surface_control->setLayer(layer);
+}
+
+void sf_surface_set_alpha(SfSurface* surface, float alpha)
+{
+ assert(surface);
+ surface->surface_control->setAlpha(alpha);
+}
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+HYBRIS_PATH := $(LOCAL_PATH)/../../hybris
+
+LOCAL_SRC_FILES:= \
+ ui_compatibility_layer.cpp
+
+LOCAL_MODULE:= libui_compat_layer
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_C_INCLUDES := \
+ $(HYBRIS_PATH)/include \
+ frameworks/native/include
+
+LOCAL_SHARED_LIBRARIES := \
+ libcutils \
+ libutils \
+ libbinder \
+ libhardware \
+ libui
+
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
--- /dev/null
+/*
+ * Copyright (C) 2013 Simon Busch <morphis@gravedo.de>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <fcntl.h>
+#include <sys/stat.h>
+
+#include <ui/GraphicBuffer.h>
+#include <ui/GraphicBufferMapper.h>
+#include <ui/GraphicBufferAllocator.h>
+
+#include <hybris/ui/ui_compatibility_layer.h>
+
+struct graphic_buffer
+{
+ android::GraphicBuffer *self;
+};
+
+struct graphic_buffer* graphic_buffer_new(void)
+{
+ struct graphic_buffer *buffer = NULL;
+
+ buffer = (struct graphic_buffer*) malloc(sizeof(struct graphic_buffer));
+ if (!buffer)
+ return NULL;
+
+ buffer->self = new android::GraphicBuffer();
+
+ return buffer;
+}
+
+struct graphic_buffer* graphic_buffer_new_sized(uint32_t w, uint32_t h,
+ int32_t format, uint32_t usage)
+{
+ struct graphic_buffer *buffer = NULL;
+
+ buffer = (struct graphic_buffer*) malloc(sizeof(struct graphic_buffer));
+ if (!buffer)
+ return NULL;
+
+ buffer->self = new android::GraphicBuffer(w, h, format, usage);
+
+ return buffer;
+}
+
+struct graphic_buffer* graphic_buffer_new_existing(uint32_t w, uint32_t h,
+ int32_t format, uint32_t usage,
+ uint32_t stride, void *handle,
+ bool keepOwnership)
+{
+ struct graphic_buffer *buffer = NULL;
+
+ buffer = (struct graphic_buffer*) malloc(sizeof(struct graphic_buffer));
+ if (!buffer)
+ return NULL;
+
+ buffer->self = new android::GraphicBuffer(w, h, format, usage, stride, (native_handle_t*) handle, keepOwnership);
+
+ return buffer;
+
+}
+
+void graphic_buffer_free(struct graphic_buffer *buffer)
+{
+ if (!buffer)
+ return;
+
+ free(buffer);
+}
+
+uint32_t graphic_buffer_get_width(struct graphic_buffer *buffer)
+{
+ return buffer->self->getWidth();
+}
+
+uint32_t graphic_buffer_get_height(struct graphic_buffer *buffer)
+{
+ return buffer->self->getHeight();
+}
+
+uint32_t graphic_buffer_get_stride(struct graphic_buffer *buffer)
+{
+ return buffer->self->getStride();
+}
+
+uint32_t graphic_buffer_get_usage(struct graphic_buffer *buffer)
+{
+ return buffer->self->getUsage();
+}
+
+int32_t graphic_buffer_get_pixel_format(struct graphic_buffer *buffer)
+{
+ return buffer->self->getPixelFormat();
+}
+
+uint32_t graphic_buffer_reallocate(struct graphic_buffer *buffer, uint32_t w,
+ uint32_t h, int32_t f, uint32_t usage)
+{
+ return buffer->self->reallocate(w, h, f, usage);
+}
+
+uint32_t graphic_buffer_lock(struct graphic_buffer *buffer, uint32_t usage, void **vaddr)
+{
+ return buffer->self->lock(usage, vaddr);
+}
+
+uint32_t graphic_buffer_unlock(struct graphic_buffer *buffer)
+{
+ return buffer->self->unlock();
+}
+
+void* graphic_buffer_get_native_buffer(struct graphic_buffer *buffer)
+{
+ return buffer->self->getNativeBuffer();
+}
+
+void graphic_buffer_set_index(struct graphic_buffer *buffer, int index)
+{
+ return buffer->self->setIndex(index);
+}
+
+int graphic_buffer_get_index(struct graphic_buffer *buffer)
+{
+ return buffer->self->getIndex();
+}
+
+int graphic_buffer_init_check(struct graphic_buffer *buffer)
+{
+ return buffer->self->initCheck();
+}
--- /dev/null
+Carsten Munk <carsten.munk@gmail.com>
+Simon Busch <morphis@gravedo.de>
+Thomas Perl <m@thp.io>
+Christophe Chapuis <chris.chapuis@gmail.com>
+Aaron McCarthy <aaron.mccarthy@jollamobile.com>
+Adrian Marius Negreanu <adrian.m.negreanu@intel.com>
+Florian Haenel <florian.hanel@lge.com>
+Jason Ekstrand <jason@jlekstrand.net>
+Kalle Vahlman <kalle.vahlman@movial.com>
+Marko Saukko <marko.saukko@jollamobile.com>
+Martin Brook <martin.brook100@googlemail.com>
+Martin Jansa <martin.jansa@gmail.com>
+Mohammed Hassan <mohammed.hassan@jollamobile.com>
+Nicolas Aguirre <aguirre.nicolas@gmail.com>
+Philippe De Swert <philippe.deswert@jollamobile.com>
+Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
+Teemu Virolainen <teemu.virolainen@gmail.com>
--- /dev/null
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
--- /dev/null
+Installation Instructions
+*************************
+
+Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation,
+Inc.
+
+ Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved. This file is offered as-is,
+without warranty of any kind.
+
+Basic Installation
+==================
+
+ Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package. The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package. Some packages provide this
+`INSTALL' file but do not implement all of the features documented
+below. The lack of an optional feature in a given package is not
+necessarily a bug. More recommendations for GNU packages can be found
+in *note Makefile Conventions: (standards)Makefile Conventions.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+ It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring. Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+ The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'. You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
+
+ The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system.
+
+ Running `configure' might take a while. While running, it prints
+ some messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Optionally, type `make check' to run any self-tests that come with
+ the package, generally using the just-built uninstalled binaries.
+
+ 4. Type `make install' to install the programs and any data files and
+ documentation. When installing into a prefix owned by root, it is
+ recommended that the package be configured and built as a regular
+ user, and only the `make install' phase executed with root
+ privileges.
+
+ 5. Optionally, type `make installcheck' to repeat any self-tests, but
+ this time using the binaries in their final installed location.
+ This target does not install anything. Running this target as a
+ regular user, particularly if the prior `make install' required
+ root privileges, verifies that the installation completed
+ correctly.
+
+ 6. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'. To also remove the
+ files that `configure' created (so you can compile the package for
+ a different kind of computer), type `make distclean'. There is
+ also a `make maintainer-clean' target, but that is intended mainly
+ for the package's developers. If you use it, you may have to get
+ all sorts of other programs in order to regenerate files that came
+ with the distribution.
+
+ 7. Often, you can also type `make uninstall' to remove the installed
+ files again. In practice, not all packages have tested that
+ uninstallation works correctly, even though it is required by the
+ GNU Coding Standards.
+
+ 8. Some packages, particularly those that use Automake, provide `make
+ distcheck', which can by used by developers to test that all other
+ targets like `make install' and `make uninstall' work correctly.
+ This target is generally not run by end users.
+
+Compilers and Options
+=====================
+
+ Some systems require unusual options for compilation or linking that
+the `configure' script does not know about. Run `./configure --help'
+for details on some of the pertinent environment variables.
+
+ You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment. Here
+is an example:
+
+ ./configure CC=c99 CFLAGS=-g LIBS=-lposix
+
+ *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+ You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you can use GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'. This
+is known as a "VPATH" build.
+
+ With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory. After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
+
+ On MacOS X 10.5 and later systems, you can create libraries and
+executables that work on multiple system types--known as "fat" or
+"universal" binaries--by specifying multiple `-arch' options to the
+compiler but only a single `-arch' option to the preprocessor. Like
+this:
+
+ ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+ CPP="gcc -E" CXXCPP="g++ -E"
+
+ This is not guaranteed to produce working output in all cases, you
+may have to build one architecture at a time and combine the results
+using the `lipo' tool if you have problems.
+
+Installation Names
+==================
+
+ By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc. You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX', where PREFIX must be an
+absolute file name.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+ In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files. Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them. In general, the
+default for these options is expressed in terms of `${prefix}', so that
+specifying just `--prefix' will affect all of the other directory
+specifications that were not explicitly provided.
+
+ The most portable way to affect installation locations is to pass the
+correct locations to `configure'; however, many packages provide one or
+both of the following shortcuts of passing variable assignments to the
+`make install' command line to change installation locations without
+having to reconfigure or recompile.
+
+ The first method involves providing an override variable for each
+affected directory. For example, `make install
+prefix=/alternate/directory' will choose an alternate location for all
+directory configuration variables that were expressed in terms of
+`${prefix}'. Any directories that were specified during `configure',
+but not in terms of `${prefix}', must each be overridden at install
+time for the entire installation to be relocated. The approach of
+makefile variable overrides for each directory variable is required by
+the GNU Coding Standards, and ideally causes no recompilation.
+However, some platforms have known limitations with the semantics of
+shared libraries that end up requiring recompilation when using this
+method, particularly noticeable in packages that use GNU Libtool.
+
+ The second method involves providing the `DESTDIR' variable. For
+example, `make install DESTDIR=/alternate/directory' will prepend
+`/alternate/directory' before all installation names. The approach of
+`DESTDIR' overrides is not required by the GNU Coding Standards, and
+does not work on platforms that have drive letters. On the other hand,
+it does better at avoiding recompilation issues, and works well even
+when some directory options were not specified in terms of `${prefix}'
+at `configure' time.
+
+Optional Features
+=================
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+ Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+ Some packages offer the ability to configure how verbose the
+execution of `make' will be. For these packages, running `./configure
+--enable-silent-rules' sets the default to minimal output, which can be
+overridden with `make V=1'; while running `./configure
+--disable-silent-rules' sets the default to verbose, which can be
+overridden with `make V=0'.
+
+Particular systems
+==================
+
+ On HP-UX, the default C compiler is not ANSI C compatible. If GNU
+CC is not installed, it is recommended to use the following options in
+order to use an ANSI C compiler:
+
+ ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
+
+and if that doesn't work, install pre-built binaries of GCC for HP-UX.
+
+ HP-UX `make' updates targets which have the same time stamps as
+their prerequisites, which makes it generally unusable when shipped
+generated files such as `configure' are involved. Use GNU `make'
+instead.
+
+ On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
+parse its `<wchar.h>' header file. The option `-nodtk' can be used as
+a workaround. If GNU CC is not installed, it is therefore recommended
+to try
+
+ ./configure CC="cc"
+
+and if that doesn't work, try
+
+ ./configure CC="cc -nodtk"
+
+ On Solaris, don't put `/usr/ucb' early in your `PATH'. This
+directory contains several dysfunctional programs; working variants of
+these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
+in your `PATH', put it _after_ `/usr/bin'.
+
+ On Haiku, software installed for all users goes in `/boot/common',
+not `/usr/local'. It is recommended to use the following options:
+
+ ./configure --prefix=/boot/common
+
+Specifying the System Type
+==========================
+
+ There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on. Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
+`--build=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+ CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+ OS
+ KERNEL-OS
+
+ See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+ If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+ If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+ If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+ Variables not defined in a site shell script can be set in the
+environment passed to `configure'. However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost. In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'. For example:
+
+ ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug. Until the bug is fixed you can use this workaround:
+
+ CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+`configure' Invocation
+======================
+
+ `configure' recognizes the following options to control how it
+operates.
+
+`--help'
+`-h'
+ Print a summary of all of the options to `configure', and exit.
+
+`--help=short'
+`--help=recursive'
+ Print a summary of the options unique to this package's
+ `configure', and exit. The `short' variant lists options used
+ only in the top level, while the `recursive' variant lists options
+ also present in any nested packages.
+
+`--version'
+`-V'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`--cache-file=FILE'
+ Enable the cache: use and save the results of the tests in FILE,
+ traditionally `config.cache'. FILE defaults to `/dev/null' to
+ disable caching.
+
+`--config-cache'
+`-C'
+ Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made. To
+ suppress all normal output, redirect it to `/dev/null' (any error
+ messages will still be shown).
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`--prefix=DIR'
+ Use DIR as the installation prefix. *note Installation Names::
+ for more details, including other options available for fine-tuning
+ the installation locations.
+
+`--no-create'
+`-n'
+ Run the configure checks, but stop before creating any output
+ files.
+
+`configure' also accepts some other, not widely useful, options. Run
+`configure --help' for more details.
+
--- /dev/null
+SUBDIRS = include properties common hardware
+
+if HAS_ANDROID_4_2_0
+SUBDIRS += libsync
+endif
+
+SUBDIRS += egl glesv1 glesv2 ui sf input camera
+if HAS_LIBNFC_NXP_HEADERS
+SUBDIRS += libnfc_nxp libnfc_ndef_nxp
+endif
+SUBDIRS += utils tests
+
+
+MAINTAINERCLEANFILES = \
+ aclocal.m4 compile config.guess config.sub \
+ configure depcomp install-sh ltmain.sh \
+ Makefile.in missing config.h.in \
+ mkinstalldirs *~ \
+ $(NULL)
--- /dev/null
+#!/bin/sh
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+ORIGDIR=`pwd`
+cd $srcdir
+
+autoreconf -v --install || exit 1
+cd $ORIGDIR || exit $?
+
+if [ x$NOCONFIGURE = x ]; then
+ $srcdir/configure "$@"
+fi
--- /dev/null
+lib_LTLIBRARIES = \
+ libcamera.la
+
+libcamera_la_SOURCES = camera.c
+libcamera_la_CFLAGS = -I$(top_srcdir)/include
+if WANT_TRACE
+libcamera_la_CFLAGS += -DDEBUG
+endif
+if WANT_DEBUG
+libcamera_la_CFLAGS += -ggdb -O0
+endif
+libcamera_la_LDFLAGS = \
+ $(top_builddir)/common/libhybris-common.la \
+ -version-info "1":"0":"0"
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libcamera.pc
--- /dev/null
+/*
+ * Copyright (C) 2013 Canonical Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authored by: Michael Frey <michael.frey@canonical.com>
+ * Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
+ */
+
+#include <dlfcn.h>
+#include <stddef.h>
+
+#include <hybris/internal/binding.h>
+#include <hybris/camera/camera_compatibility_layer.h>
+#include <hybris/camera/camera_compatibility_layer_capabilities.h>
+#include <hybris/surface_flinger/surface_flinger_compatibility_layer.h>
+
+#define COMPAT_LIBRARY_PATH "/system/lib/libcamera_compat_layer.so"
+
+HYBRIS_LIBRARY_INITIALIZE(camera, COMPAT_LIBRARY_PATH);
+
+HYBRIS_IMPLEMENT_FUNCTION0(camera, int, android_camera_get_number_of_devices);
+HYBRIS_IMPLEMENT_FUNCTION2(camera, struct CameraControl*, android_camera_connect_to,
+ CameraType, struct CameraControlListener*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(camera, android_camera_disconnect,
+ struct CameraControl*);
+HYBRIS_IMPLEMENT_FUNCTION1(camera, int, android_camera_lock, struct CameraControl*);
+HYBRIS_IMPLEMENT_FUNCTION1(camera, int, android_camera_unlock, struct CameraControl*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(camera, android_camera_delete, struct CameraControl*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(camera, android_camera_dump_parameters,
+ struct CameraControl*);
+
+// Setters
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(camera, android_camera_set_effect_mode,
+ struct CameraControl*, EffectMode);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(camera, android_camera_set_flash_mode,
+ struct CameraControl*, FlashMode);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(camera, android_camera_set_white_balance_mode,
+ struct CameraControl*, WhiteBalanceMode);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(camera, android_camera_set_scene_mode,
+ struct CameraControl*, SceneMode);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(camera, android_camera_set_auto_focus_mode,
+ struct CameraControl*, AutoFocusMode);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(camera, android_camera_set_picture_size,
+ struct CameraControl*, int, int);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(camera, android_camera_set_preview_size,
+ struct CameraControl*, int, int);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(camera, android_camera_set_display_orientation,
+ struct CameraControl*, int32_t);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(camera, android_camera_set_preview_texture,
+ struct CameraControl*, int);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(camera, android_camera_set_preview_surface,
+ struct CameraControl*, struct SfSurface*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(camera, android_camera_set_focus_region,
+ struct CameraControl*, FocusRegion*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(camera, android_camera_reset_focus_region,
+ struct CameraControl*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(camera, android_camera_set_preview_fps,
+ struct CameraControl*, int);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(camera, android_camera_set_rotation,
+ struct CameraControl*, int);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(camera, android_camera_set_video_size,
+ struct CameraControl*, int, int);
+
+// Getters
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(camera, android_camera_get_effect_mode,
+ struct CameraControl*, EffectMode*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(camera, android_camera_get_flash_mode,
+ struct CameraControl*, FlashMode*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(camera, android_camera_get_white_balance_mode,
+ struct CameraControl*, WhiteBalanceMode*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(camera, android_camera_get_scene_mode,
+ struct CameraControl*, SceneMode*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(camera, android_camera_get_auto_focus_mode,
+ struct CameraControl*, AutoFocusMode*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(camera, android_camera_get_max_zoom,
+ struct CameraControl*, int*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(camera, android_camera_get_picture_size,
+ struct CameraControl*, int*, int*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(camera, android_camera_get_preview_size,
+ struct CameraControl*, int*, int*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(camera, android_camera_get_preview_fps_range,
+ struct CameraControl*, int*, int*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(camera, android_camera_get_preview_fps,
+ struct CameraControl*, int*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(camera, android_camera_get_preview_texture_transformation,
+ struct CameraControl*, float*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(camera, android_camera_get_video_size,
+ struct CameraControl*, int*, int*);
+
+// Enumerators
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(camera, android_camera_enumerate_supported_picture_sizes,
+ struct CameraControl*, size_callback, void*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(camera, android_camera_enumerate_supported_preview_sizes,
+ struct CameraControl*, size_callback, void*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(camera, android_camera_enumerate_supported_video_sizes,
+ struct CameraControl*, size_callback, void*);
+
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(camera, android_camera_update_preview_texture, struct CameraControl*);
+
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(camera, android_camera_start_preview, struct CameraControl*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(camera, android_camera_stop_preview, struct CameraControl*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(camera, android_camera_start_autofocus, struct CameraControl*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(camera, android_camera_stop_autofocus, struct CameraControl*);
+
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(camera, android_camera_start_zoom, struct CameraControl*, int32_t);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(camera, android_camera_set_zoom, struct CameraControl*, int32_t);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(camera, android_camera_stop_zoom, struct CameraControl*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(camera, android_camera_take_snapshot, struct CameraControl*);
--- /dev/null
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=@includedir@
+
+Name: hybris-camera
+Description: libhybris camera library
+Version: @VERSION@
+Libs: -L${libdir} -lhybris-common -lcamera
+Cflags: -I${includedir}
--- /dev/null
+lib_LTLIBRARIES = \
+ libhybris-common.la
+
+# JB linker works fine for ICS
+if HAS_ANDROID_4_0_0
+SUBDIRS = jb
+libhybris_common_la_LIBADD= jb/libandroid-linker.la
+else
+if HAS_ANDROID_2_3_0
+SUBDIRS = gingerbread
+libhybris_common_la_LIBADD= gingerbread/libandroid-linker.la
+else
+ERROR
+endif
+endif
+
+libhybris_common_la_SOURCES = \
+ hooks.c \
+ hooks_shm.c \
+ strlcpy.c \
+ dlfcn.c \
+ logging.c
+libhybris_common_la_CFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/common
+if WANT_TRACE
+libhybris_common_la_CFLAGS += -DDEBUG
+endif
+if WANT_DEBUG
+libhybris_common_la_CFLAGS += -ggdb -O0
+endif
+libhybris_common_la_LDFLAGS = \
+ -ldl \
+ -lrt \
+ -pthread \
+ $(top_builddir)/properties/libandroid-properties.la \
+ -version-info "$(LT_CURRENT)":"$(LT_REVISION)":"$(LT_AGE)"
--- /dev/null
+/*
+ * Copyright (c) 2013 Intel Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <../include/hybris/dlfcn/dlfcn.h>
+#include <../include/hybris/internal/binding.h>
+
+void *hybris_dlopen(const char *filename, int flag)
+{
+ return android_dlopen(filename,flag);
+}
+
+
+void *hybris_dlsym(void *handle, const char *symbol)
+{
+ return android_dlsym(handle,symbol);
+}
+
+
+int hybris_dlclose(void *handle)
+{
+ return android_dlclose(handle);
+}
+
+
+char *hybris_dlerror(void)
+{
+ return android_dlerror();
+}
+
+// vim: noai:ts=4:sw=4:ss=4:expandtab
--- /dev/null
+if WANT_ARCH_ARM
+ARCHFLAGS = -DHAVE_ARM_TLS_REGISTER -DANDROID_ARM_LINKER
+endif
+
+if WANT_ARCH_X86
+ARCHFLAGS = -DANDROID_X86_LINKER
+endif
+
+noinst_LTLIBRARIES = \
+ libandroid-linker.la
+libandroid_linker_la_SOURCES = \
+ dlfcn.c \
+ linker.c \
+ linker_environ.c \
+ linker_format.c \
+ rt.c
+libandroid_linker_la_CFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/common \
+ -DLINKER_TEXT_BASE=0xB0000100 \
+ -DLINKER_AREA_SIZE=0x01000000 \
+ $(ARCHFLAGS)
+
+if WANT_DEBUG
+libandroid_linker_la_CFLAGS += -DLINKER_DEBUG=1
+else
+libandroid_linker_la_CFLAGS += -DLINKER_DEBUG=0
+endif
--- /dev/null
+
+ Copyright (c) 2005-2008, The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
--- /dev/null
+Android Dynamic Linker Design Notes
+===================================
+
+Introduction:
+-------------
+
+This document provides several notes related to the design of the Android
+dynamic linker.
+
+
+Prelinking:
+-----------
+
+System libraries in Android are internally prelinked, which means that
+any internal relocations within them are stripped from the corresponding
+shared object, in order to reduce size and speed up loading.
+
+Such libraries can only be loaded at the very specific virtual memory address
+they have been prelinked to (during the build process). The list of prelinked
+system libraries and their corresponding virtual memory address is found in
+the file:
+
+ build/core/prelink-linux-<arch>.map
+
+It should be updated each time a new system library is added to the
+system.
+
+The prelink step happens at build time, and uses the 'soslim' and 'apriori'
+tools:
+
+ - 'apriori' is the real prelink tool which removes relocations from the
+ shared object, however, it must be given a list of symbols to remove
+ from the file.
+
+ - 'soslim' is used to find symbols in an executable ELF file
+ and generate a list that can be passed to 'apriori'.
+
+By default, these tools are only used to remove internal symbols from
+libraries, though they have been designed to allow more aggressive
+optimizations (e.g. 'global' prelinking and symbol stripping, which
+prevent replacing individual system libraries though).
+
+You can disable prelinking at build time by modifying your Android.mk with
+a line like:
+
+ LOCAL_PRELINK_MODULE := false
+
+
+Initialization and Termination functions:
+-----------------------------------------
+
+The Unix Sys V Binary Interface standard states that an
+executable can have the following entries in its .dynamic
+section:
+
+ DT_INIT
+ Points to the address of an initialization function
+ that must be called when the file is loaded.
+
+ DT_INIT_ARRAY
+ Points to an array of function addresses that must be
+ called, in-order, to perform initialization. Some of
+ the entries in the array can be 0 or -1, and should
+ be ignored.
+
+ Note: this is generally stored in a .init_array section
+
+ DT_INIT_ARRAYSZ
+ The size of the DT_INITARRAY, if any
+
+ DT_FINI
+ Points to the address of a finalization function which
+ must be called when the file is unloaded or the process
+ terminated.
+
+ DT_FINI_ARRAY
+ Same as DT_INITARRAY but for finalizers. Note that the
+ functions must be called in reverse-order though
+
+ Note: this is generally stored in a .fini_array section
+
+ DT_FINI_ARRAYSZ
+ Size of FT_FINIARRAY
+
+ DT_PREINIT_ARRAY
+ An array similar to DT_INIT_ARRAY which must *only* be
+ present in executables, not shared libraries, which contains
+ a list of functions that need to be called before any other
+ initialization function (i.e. DT_INIT and/or DT_INIT_ARRAY)
+ in the executable or any of its libraries.
+
+ Note: this is generally stored in a .preinit_array section
+
+ DT_PREINIT_ARRAYSZ
+ The size of DT_PREINIT_ARRAY
+
+If both a DT_INIT and DT_INITARRAY entry are present, the DT_INIT
+function must be called before the DT_INITARRAY functions.
+
+Consequently, the DT_FINIARRAY must be parsed in reverse order before
+the DT_FINI function, if both are available.
+
+Note that the implementation of static C++ constructors is very
+much processor dependent, and may use different ELF sections.
+
+On the ARM (see "C++ ABI for ARM" document), the static constructors
+must be called explicitly from the DT_INIT_ARRAY, and each one of them
+shall register a destructor by calling the special __eabi_atexit()
+function (provided by the C library). The DT_FINI_ARRAY is not used
+by static C++ destructors.
+
+On x86, the lists of constructors and destructors are placed in special
+sections named ".ctors" and ".dtors", and the DT_INIT / DT_FINI functions
+are in charge of calling them explicitly.
+
+
+Debugging:
+----------
+
+It is possible to enable debug output in the dynamic linker. To do so,
+follow these steps:
+
+1/ Modify the line in Android.mk that says:
+
+ LOCAL_CFLAGS += -DLINKER_DEBUG=0
+
+ Into the following:
+
+ LOCAL_CFLAGS += -DLINKER_DEBUG=1
+
+2/ Force-rebuild the dynamic linker:
+
+ cd bionic/linker
+ mm -B
+
+3/ Rebuild a new system image.
+
+You can increase the verbosity of debug traces by defining the DEBUG
+environment variable to a numeric value from 0 to 2. This will only
+affect new processes being launched.
+
+By default, traces are sent to logcat, with the "linker" tag. You can
+change this to go to stdout instead by setting the definition of
+LINKER_DEBUG_TO_LOG to 0 in "linker_debug.h".
--- /dev/null
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+ .text
+ .align 4
+ .type _start,#function
+ .globl _start
+
+_start:
+ mov r0, sp
+ mov r1, #0
+ bl __linker_init
+
+ /* linker init returns the _entry address in the main image */
+ mov pc, r0
+
+ .section .ctors, "wa"
+ .globl __CTOR_LIST__
+__CTOR_LIST__:
+ .long -1
--- /dev/null
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+.text
+.align 4
+.type _start, @function
+.globl _start
+
+_start:
+ /* save the elfdata ptr to %eax, AND push it onto the stack */
+ mov %esp, %eax
+ pushl %esp
+
+ pushl %eax
+ call __linker_init
+
+ /* linker init returns (%eax) the _entry address in the main image */
+ /* entry point expects sp to point to elfdata */
+ popl %esp
+ jmp *%eax
+
--- /dev/null
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _SYS_TLS_H
+#define _SYS_TLS_H
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
+/** WARNING WARNING WARNING
+ **
+ ** This header file is *NOT* part of the public Bionic ABI/API
+ ** and should not be used/included by user-serviceable parts of
+ ** the system (e.g. applications).
+ **
+ ** It is only provided here for the benefit of the system dynamic
+ ** linker and the OpenGL sub-system (which needs to access the
+ ** pre-allocated slot directly for performance reason).
+ **/
+
+/* maximum number of elements in the TLS array */
+#define BIONIC_TLS_SLOTS 64
+
+/* note that slot 0, called TLS_SLOT_SELF must point to itself.
+ * this is required to implement thread-local storage with the x86
+ * Linux kernel, that reads the TLS from fs:[0], where 'fs' is a
+ * thread-specific segment descriptor...
+ */
+
+/* Well known TLS slots */
+#define TLS_SLOT_SELF 0
+#define TLS_SLOT_THREAD_ID 1
+#define TLS_SLOT_ERRNO 2
+
+#define TLS_SLOT_OPENGL_API 3
+#define TLS_SLOT_OPENGL 4
+
+/* this slot is only used to pass information from the dynamic linker to
+ * libc.so when the C library is loaded in to memory. The C runtime init
+ * function will then clear it. Since its use is extremely temporary,
+ * we reuse an existing location.
+ */
+#define TLS_SLOT_BIONIC_PREINIT (TLS_SLOT_ERRNO+1)
+
+/* small technical note: it is not possible to call pthread_setspecific
+ * on keys that are <= TLS_SLOT_MAX_WELL_KNOWN, which is why it is set to
+ * TLS_SLOT_ERRNO.
+ *
+ * later slots like TLS_SLOT_OPENGL are pre-allocated through the use of
+ * TLS_DEFAULT_ALLOC_MAP. this means that there is no need to use
+ * pthread_key_create() to initialize them. on the other hand, there is
+ * no destructor associated to them (we might need to implement this later)
+ */
+#define TLS_SLOT_MAX_WELL_KNOWN TLS_SLOT_ERRNO
+
+#define TLS_DEFAULT_ALLOC_MAP 0x0000001F
+
+/* set the Thread Local Storage, must contain at least BIONIC_TLS_SLOTS pointers */
+extern void __init_tls(void** tls, void* thread_info);
+
+/* syscall only, do not call directly */
+extern int __set_tls(void *ptr);
+
+/* get the TLS */
+#ifdef __arm__
+/* The standard way to get the TLS is to call a kernel helper
+ * function (i.e. a function provided at a fixed address in a
+ * "magic page" mapped in all user-space address spaces ), which
+ * contains the most appropriate code path for the target device.
+ *
+ * However, for performance reasons, we're going to use our own
+ * machine code for the system's C shared library.
+ *
+ * We cannot use this optimization in the static version of the
+ * C library, because we don't know where the corresponding code
+ * is going to run.
+ */
+# ifdef LIBC_STATIC
+
+/* Use the kernel helper in static C library. */
+ typedef volatile void* (__kernel_get_tls_t)(void);
+# define __get_tls() (*(__kernel_get_tls_t *)0xffff0fe0)()
+
+# else /* !LIBC_STATIC */
+/* Use optimized code path.
+ * Note that HAVE_ARM_TLS_REGISTER is build-specific
+ * (it must match your kernel configuration)
+ */
+# ifdef HAVE_ARM_TLS_REGISTER
+ /* We can read the address directly from a coprocessor
+ * register, which avoids touching the data cache
+ * completely.
+ */
+# define __get_tls() \
+ ({ register unsigned int __val asm("r0"); \
+ asm ("mrc p15, 0, r0, c13, c0, 3" : "=r"(__val) ); \
+ (volatile void*)__val; })
+# else /* !HAVE_ARM_TLS_REGISTER */
+ /* The kernel provides the address of the TLS at a fixed
+ * address of the magic page too.
+ */
+# define __get_tls() ( *((volatile void **) 0xffff0ff0) )
+# endif
+# endif /* !LIBC_STATIC */
+#else /* !ARM */
+extern void* __get_tls( void );
+#endif /* !ARM */
+
+/* return the stack base and size, used by our malloc debugger */
+extern void* __get_stack_base(int *p_stack_size);
+
+__END_DECLS
+
+#endif /* _SYS_TLS_H */
--- /dev/null
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <signal.h>
+#include <sys/mman.h>
+#include <sys/prctl.h>
+#include <errno.h>
+
+#include "linker.h"
+
+#include <sys/socket.h>
+#include <sys/un.h>
+
+extern int tgkill(int tgid, int tid, int sig);
+
+void notify_gdb_of_libraries();
+
+#define DEBUGGER_SOCKET_NAME "android:debuggerd"
+
+typedef enum {
+ // dump a crash
+ DEBUGGER_ACTION_CRASH,
+ // dump a tombstone file
+ DEBUGGER_ACTION_DUMP_TOMBSTONE,
+ // dump a backtrace only back to the socket
+ DEBUGGER_ACTION_DUMP_BACKTRACE,
+} debugger_action_t;
+
+/* message sent over the socket */
+typedef struct {
+ debugger_action_t action;
+ pid_t tid;
+} debugger_msg_t;
+
+#define RETRY_ON_EINTR(ret,cond) \
+ do { \
+ ret = (cond); \
+ } while (ret < 0 && errno == EINTR)
+
+// see man(2) prctl, specifically the section about PR_GET_NAME
+#define MAX_TASK_NAME_LEN (16)
+
+static int socket_abstract_client(const char *name, int type)
+{
+ struct sockaddr_un addr;
+ size_t namelen;
+ socklen_t alen;
+ int s, err;
+
+ namelen = strlen(name);
+
+ // Test with length +1 for the *initial* '\0'.
+ if ((namelen + 1) > sizeof(addr.sun_path)) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ /* This is used for abstract socket namespace, we need
+ * an initial '\0' at the start of the Unix socket path.
+ *
+ * Note: The path in this case is *not* supposed to be
+ * '\0'-terminated. ("man 7 unix" for the gory details.)
+ */
+ memset (&addr, 0, sizeof addr);
+ addr.sun_family = AF_LOCAL;
+ addr.sun_path[0] = 0;
+ memcpy(addr.sun_path + 1, name, namelen);
+
+ alen = namelen + offsetof(struct sockaddr_un, sun_path) + 1;
+
+ s = socket(AF_LOCAL, type, 0);
+ if(s < 0) return -1;
+
+ RETRY_ON_EINTR(err,connect(s, (struct sockaddr *) &addr, alen));
+ if (err < 0) {
+ close(s);
+ s = -1;
+ }
+
+ return s;
+}
+
+#include "linker_format.h"
+#include <../libc/private/logd.h>
+
+/*
+ * Writes a summary of the signal to the log file.
+ *
+ * We could be here as a result of native heap corruption, or while a
+ * mutex is being held, so we don't want to use any libc functions that
+ * could allocate memory or hold a lock.
+ */
+static void logSignalSummary(int signum, const siginfo_t* info)
+{
+ char buffer[128];
+ char threadname[MAX_TASK_NAME_LEN + 1]; // one more for termination
+
+ char* signame;
+ switch (signum) {
+ case SIGILL: signame = "SIGILL"; break;
+ case SIGABRT: signame = "SIGABRT"; break;
+ case SIGBUS: signame = "SIGBUS"; break;
+ case SIGFPE: signame = "SIGFPE"; break;
+ case SIGSEGV: signame = "SIGSEGV"; break;
+ case SIGSTKFLT: signame = "SIGSTKFLT"; break;
+ case SIGPIPE: signame = "SIGPIPE"; break;
+ default: signame = "???"; break;
+ }
+
+ if (prctl(PR_GET_NAME, (unsigned long)threadname, 0, 0, 0) != 0) {
+ strcpy(threadname, "<name unknown>");
+ } else {
+ // short names are null terminated by prctl, but the manpage
+ // implies that 16 byte names are not.
+ threadname[MAX_TASK_NAME_LEN] = 0;
+ }
+ format_buffer(buffer, sizeof(buffer),
+ "Fatal signal %d (%s) at 0x%08x (code=%d), thread %d (%s)",
+ signum, signame, info->si_addr, info->si_code, gettid(), threadname);
+
+ __libc_android_log_write(ANDROID_LOG_FATAL, "libc", buffer);
+}
+
+/*
+ * Catches fatal signals so we can ask debuggerd to ptrace us before
+ * we crash.
+ */
+void debugger_signal_handler(int n, siginfo_t* info, void* unused)
+{
+ char msgbuf[128];
+ unsigned tid;
+ int s;
+
+ logSignalSummary(n, info);
+
+ tid = gettid();
+ s = socket_abstract_client(DEBUGGER_SOCKET_NAME, SOCK_STREAM);
+
+ if (s >= 0) {
+ /* debugger knows our pid from the credentials on the
+ * local socket but we need to tell it our tid. It
+ * is paranoid and will verify that we are giving a tid
+ * that's actually in our process
+ */
+ int ret;
+ debugger_msg_t msg;
+ msg.action = DEBUGGER_ACTION_CRASH;
+ msg.tid = tid;
+ RETRY_ON_EINTR(ret, write(s, &msg, sizeof(msg)));
+ if (ret == sizeof(msg)) {
+ /* if the write failed, there is no point to read on
+ * the file descriptor. */
+ RETRY_ON_EINTR(ret, read(s, &tid, 1));
+ int savedErrno = errno;
+ notify_gdb_of_libraries();
+ errno = savedErrno;
+ }
+
+ if (ret < 0) {
+ /* read or write failed -- broken connection? */
+ format_buffer(msgbuf, sizeof(msgbuf),
+ "Failed while talking to debuggerd: %s", strerror(errno));
+ __libc_android_log_write(ANDROID_LOG_FATAL, "libc", msgbuf);
+ }
+
+ close(s);
+ } else {
+ /* socket failed; maybe process ran out of fds */
+ format_buffer(msgbuf, sizeof(msgbuf),
+ "Unable to open connection to debuggerd: %s", strerror(errno));
+ __libc_android_log_write(ANDROID_LOG_FATAL, "libc", msgbuf);
+ }
+
+ /* remove our net so we fault for real when we return */
+ signal(n, SIG_DFL);
+
+ /*
+ * These signals are not re-thrown when we resume. This means that
+ * crashing due to (say) SIGPIPE doesn't work the way you'd expect it
+ * to. We work around this by throwing them manually. We don't want
+ * to do this for *all* signals because it'll screw up the address for
+ * faults like SIGSEGV.
+ */
+ switch (n) {
+ case SIGABRT:
+ case SIGFPE:
+ case SIGPIPE:
+ case SIGSTKFLT:
+ (void) tgkill(getpid(), gettid(), n);
+ break;
+ default: // SIGILL, SIGBUS, SIGSEGV
+ break;
+ }
+}
+
+void debugger_init()
+{
+ struct sigaction act;
+ memset(&act, 0, sizeof(act));
+ act.sa_sigaction = debugger_signal_handler;
+ act.sa_flags = SA_RESTART | SA_SIGINFO;
+ sigemptyset(&act.sa_mask);
+
+ sigaction(SIGILL, &act, NULL);
+ sigaction(SIGABRT, &act, NULL);
+ sigaction(SIGBUS, &act, NULL);
+ sigaction(SIGFPE, &act, NULL);
+ sigaction(SIGSEGV, &act, NULL);
+ sigaction(SIGSTKFLT, &act, NULL);
+ sigaction(SIGPIPE, &act, NULL);
+}
--- /dev/null
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#define _GNU_SOURCE
+#include <dlfcn.h>
+#include <pthread.h>
+#include <time.h>
+#include <stdio.h>
+#include <string.h>
+#include "linker.h"
+#include "linker_format.h"
+
+/* This file hijacks the symbols stubbed out in libdl.so. */
+
+#define DL_SUCCESS 0
+#define DL_ERR_CANNOT_LOAD_LIBRARY 1
+#define DL_ERR_INVALID_LIBRARY_HANDLE 2
+#define DL_ERR_BAD_SYMBOL_NAME 3
+#define DL_ERR_SYMBOL_NOT_FOUND 4
+#define DL_ERR_SYMBOL_NOT_GLOBAL 5
+
+static char dl_err_buf[1024];
+static const char *dl_err_str;
+
+static const char *dl_errors[] = {
+ [DL_ERR_CANNOT_LOAD_LIBRARY] = "Cannot load library",
+ [DL_ERR_INVALID_LIBRARY_HANDLE] = "Invalid library handle",
+ [DL_ERR_BAD_SYMBOL_NAME] = "Invalid symbol name",
+ [DL_ERR_SYMBOL_NOT_FOUND] = "Symbol not found",
+ [DL_ERR_SYMBOL_NOT_GLOBAL] = "Symbol is not global",
+};
+
+#define likely(expr) __builtin_expect (expr, 1)
+#define unlikely(expr) __builtin_expect (expr, 0)
+
+pthread_mutex_t dl_lock = PTHREAD_MUTEX_INITIALIZER;
+
+static void set_dlerror(int err)
+{
+ format_buffer(dl_err_buf, sizeof(dl_err_buf), "%s: %s", dl_errors[err],
+ linker_get_error());
+ dl_err_str = (const char *)&dl_err_buf[0];
+};
+
+void *android_dlopen(const char *filename, int flag)
+{
+ soinfo *ret;
+
+ pthread_mutex_lock(&dl_lock);
+ ret = find_library(filename);
+ if (unlikely(ret == NULL)) {
+ set_dlerror(DL_ERR_CANNOT_LOAD_LIBRARY);
+ } else {
+ call_constructors_recursive(ret);
+ ret->refcount++;
+ }
+ pthread_mutex_unlock(&dl_lock);
+ return ret;
+}
+
+const char *android_dlerror(void)
+{
+ const char *tmp = dl_err_str;
+ dl_err_str = NULL;
+ return (const char *)tmp;
+}
+
+void *android_dlsym(void *handle, const char *symbol)
+{
+ soinfo *found;
+ Elf32_Sym *sym;
+ unsigned bind;
+
+ pthread_mutex_lock(&dl_lock);
+
+ if(unlikely(handle == 0)) {
+ set_dlerror(DL_ERR_INVALID_LIBRARY_HANDLE);
+ goto err;
+ }
+ if(unlikely(symbol == 0)) {
+ set_dlerror(DL_ERR_BAD_SYMBOL_NAME);
+ goto err;
+ }
+
+ if(handle == RTLD_DEFAULT) {
+ sym = lookup(symbol, &found, NULL);
+ } else if(handle == RTLD_NEXT) {
+ void *ret_addr = __builtin_return_address(0);
+ soinfo *si = find_containing_library(ret_addr);
+
+ sym = NULL;
+ if(si && si->next) {
+ sym = lookup(symbol, &found, si->next);
+ }
+ } else {
+ found = (soinfo*)handle;
+ sym = lookup_in_library(found, symbol);
+ }
+
+ if(likely(sym != 0)) {
+ bind = ELF32_ST_BIND(sym->st_info);
+
+ if(likely((bind == STB_GLOBAL) && (sym->st_shndx != 0))) {
+ unsigned ret = sym->st_value + found->base;
+ pthread_mutex_unlock(&dl_lock);
+ return (void*)ret;
+ }
+
+ set_dlerror(DL_ERR_SYMBOL_NOT_GLOBAL);
+ }
+ else
+ set_dlerror(DL_ERR_SYMBOL_NOT_FOUND);
+
+err:
+ pthread_mutex_unlock(&dl_lock);
+ return 0;
+}
+
+int android_dladdr(const void *addr, Dl_info *info)
+{
+ int ret = 0;
+
+ pthread_mutex_lock(&dl_lock);
+
+ /* Determine if this address can be found in any library currently mapped */
+ soinfo *si = find_containing_library(addr);
+
+ if(si) {
+ memset(info, 0, sizeof(Dl_info));
+
+ info->dli_fname = si->name;
+ info->dli_fbase = (void*)si->base;
+
+ /* Determine if any symbol in the library contains the specified address */
+ Elf32_Sym *sym = find_containing_symbol(addr, si);
+
+ if(sym != NULL) {
+ info->dli_sname = si->strtab + sym->st_name;
+ info->dli_saddr = (void*)(si->base + sym->st_value);
+ }
+
+ ret = 1;
+ }
+
+ pthread_mutex_unlock(&dl_lock);
+
+ return ret;
+}
+
+int android_dlclose(void *handle)
+{
+ pthread_mutex_lock(&dl_lock);
+ (void)unload_library((soinfo*)handle);
+ pthread_mutex_unlock(&dl_lock);
+ return 0;
+}
+
+
+#if defined(ANDROID_ARM_LINKER)
+// 0000000 00011111 111112 22222222 2333333 333344444444445555555
+// 0123456 78901234 567890 12345678 9012345 678901234567890123456
+#define ANDROID_LIBDL_STRTAB \
+ "dlopen\0dlclose\0dlsym\0dlerror\0dladdr\0dl_unwind_find_exidx\0"
+
+_Unwind_Ptr android_dl_unwind_find_exidx(_Unwind_Ptr pc, int *pcount);
+
+#elif defined(ANDROID_X86_LINKER)
+// 0000000 00011111 111112 22222222 2333333 3333444444444455
+// 0123456 78901234 567890 12345678 9012345 6789012345678901
+#define ANDROID_LIBDL_STRTAB \
+ "dlopen\0dlclose\0dlsym\0dlerror\0dladdr\0dl_iterate_phdr\0"
+int
+android_dl_iterate_phdr(int (*cb)(struct dl_phdr_info *info, size_t size, void *data),
+ void *data);
+
+#else
+#error Unsupported architecture. Only ARM and x86 are presently supported.
+#endif
+
+
+static Elf32_Sym libdl_symtab[] = {
+ // total length of libdl_info.strtab, including trailing 0
+ // This is actually the the STH_UNDEF entry. Technically, it's
+ // supposed to have st_name == 0, but instead, it points to an index
+ // in the strtab with a \0 to make iterating through the symtab easier.
+ { st_name: sizeof(ANDROID_LIBDL_STRTAB) - 1,
+ },
+ { st_name: 0, // starting index of the name in libdl_info.strtab
+ st_value: (Elf32_Addr) &android_dlopen,
+ st_info: STB_GLOBAL << 4,
+ st_shndx: 1,
+ },
+ { st_name: 7,
+ st_value: (Elf32_Addr) &android_dlclose,
+ st_info: STB_GLOBAL << 4,
+ st_shndx: 1,
+ },
+ { st_name: 15,
+ st_value: (Elf32_Addr) &android_dlsym,
+ st_info: STB_GLOBAL << 4,
+ st_shndx: 1,
+ },
+ { st_name: 21,
+ st_value: (Elf32_Addr) &android_dlerror,
+ st_info: STB_GLOBAL << 4,
+ st_shndx: 1,
+ },
+ { st_name: 29,
+ st_value: (Elf32_Addr) &android_dladdr,
+ st_info: STB_GLOBAL << 4,
+ st_shndx: 1,
+ },
+#ifdef ANDROID_ARM_LINKER
+ { st_name: 36,
+ st_value: (Elf32_Addr) &android_dl_unwind_find_exidx,
+ st_info: STB_GLOBAL << 4,
+ st_shndx: 1,
+ },
+#elif defined(ANDROID_X86_LINKER)
+ { st_name: 36,
+ st_value: (Elf32_Addr) &android_dl_iterate_phdr,
+ st_info: STB_GLOBAL << 4,
+ st_shndx: 1,
+ },
+#endif
+};
+
+/* Fake out a hash table with a single bucket.
+ * A search of the hash table will look through
+ * libdl_symtab starting with index [1], then
+ * use libdl_chains to find the next index to
+ * look at. libdl_chains should be set up to
+ * walk through every element in libdl_symtab,
+ * and then end with 0 (sentinel value).
+ *
+ * I.e., libdl_chains should look like
+ * { 0, 2, 3, ... N, 0 } where N is the number
+ * of actual symbols, or nelems(libdl_symtab)-1
+ * (since the first element of libdl_symtab is not
+ * a real symbol).
+ *
+ * (see _elf_lookup())
+ *
+ * Note that adding any new symbols here requires
+ * stubbing them out in libdl.
+ */
+static unsigned libdl_buckets[1] = { 1 };
+static unsigned libdl_chains[7] = { 0, 2, 3, 4, 5, 6, 0 };
+
+soinfo libdl_info = {
+ name: "libdl.so",
+ flags: FLAG_LINKED,
+
+ strtab: ANDROID_LIBDL_STRTAB,
+ symtab: libdl_symtab,
+
+ nbucket: 1,
+ nchain: 7,
+ bucket: libdl_buckets,
+ chain: libdl_chains,
+};
+
--- /dev/null
+/*
+ * Copyright (C) 2008, 2009 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <linux/auxvec.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <dlfcn.h>
+#include <sys/stat.h>
+
+#include <pthread.h>
+
+#include <sys/mman.h>
+
+/* special private C library header - see Android.mk */
+#include "bionic_tls.h"
+
+#include "linker.h"
+#include "linker_debug.h"
+#include "linker_environ.h"
+#include "linker_format.h"
+
+#define ALLOW_SYMBOLS_FROM_MAIN 1
+#define SO_MAX 128
+
+/* Assume average path length of 64 and max 8 paths */
+#define LDPATH_BUFSIZE 512
+#define LDPATH_MAX 8
+
+#define LDPRELOAD_BUFSIZE 512
+#define LDPRELOAD_MAX 8
+
+/* >>> IMPORTANT NOTE - READ ME BEFORE MODIFYING <<<
+ *
+ * Do NOT use malloc() and friends or pthread_*() code here.
+ * Don't use printf() either; it's caused mysterious memory
+ * corruption in the past.
+ * The linker runs before we bring up libc and it's easiest
+ * to make sure it does not depend on any complex libc features
+ *
+ * open issues / todo:
+ *
+ * - are we doing everything we should for ARM_COPY relocations?
+ * - cleaner error reporting
+ * - after linking, set as much stuff as possible to READONLY
+ * and NOEXEC
+ * - linker hardcodes PAGE_SIZE and PAGE_MASK because the kernel
+ * headers provide versions that are negative...
+ * - allocate space for soinfo structs dynamically instead of
+ * having a hard limit (64)
+*/
+
+
+static int link_image(soinfo *si, unsigned wr_offset);
+
+static int socount = 0;
+static soinfo sopool[SO_MAX];
+static soinfo *freelist = NULL;
+static soinfo *solist = &libdl_info;
+static soinfo *sonext = &libdl_info;
+#if ALLOW_SYMBOLS_FROM_MAIN
+static soinfo *somain; /* main process, always the one after libdl_info */
+#endif
+
+
+static inline int validate_soinfo(soinfo *si)
+{
+ return (si >= sopool && si < sopool + SO_MAX) ||
+ si == &libdl_info;
+}
+
+static char ldpaths_buf[LDPATH_BUFSIZE];
+static const char *ldpaths[LDPATH_MAX + 1];
+
+static char ldpreloads_buf[LDPRELOAD_BUFSIZE];
+static const char *ldpreload_names[LDPRELOAD_MAX + 1];
+
+static soinfo *preloads[LDPRELOAD_MAX + 1];
+
+#if LINKER_DEBUG
+int debug_verbosity;
+#endif
+
+static int pid;
+
+/* This boolean is set if the program being loaded is setuid */
+static int program_is_setuid;
+
+#if STATS
+struct _link_stats linker_stats;
+#endif
+
+#if COUNT_PAGES
+unsigned bitmask[4096];
+#endif
+
+#ifndef PT_ARM_EXIDX
+#define PT_ARM_EXIDX 0x70000001 /* .ARM.exidx segment */
+#endif
+
+static char tmp_err_buf[768];
+static char __linker_dl_err_buf[768];
+#define DL_ERR(fmt, x...) \
+ do { \
+ format_buffer(__linker_dl_err_buf, sizeof(__linker_dl_err_buf), \
+ "%s[%d]: " fmt, __func__, __LINE__, ##x); \
+ ERROR(fmt "\n", ##x); \
+ } while(0)
+
+const char *linker_get_error(void)
+{
+ return (const char *)&__linker_dl_err_buf[0];
+}
+
+/*
+ * This function is an empty stub where GDB locates a breakpoint to get notified
+ * about linker activity.
+ */
+extern void __attribute__((noinline)) rtld_db_dlactivity(void);
+
+static struct r_debug _r_debug = {1, NULL, &rtld_db_dlactivity,
+ RT_CONSISTENT, 0};
+static struct link_map *r_debug_tail = 0;
+
+static pthread_mutex_t _r_debug_lock = PTHREAD_MUTEX_INITIALIZER;
+
+static void insert_soinfo_into_debug_map(soinfo * info)
+{
+ struct link_map * map;
+
+ /* Copy the necessary fields into the debug structure.
+ */
+ map = &(info->linkmap);
+ map->l_addr = info->base;
+ map->l_name = (char*) info->name;
+ map->l_ld = (uintptr_t)info->dynamic;
+
+ /* Stick the new library at the end of the list.
+ * gdb tends to care more about libc than it does
+ * about leaf libraries, and ordering it this way
+ * reduces the back-and-forth over the wire.
+ */
+ if (r_debug_tail) {
+ r_debug_tail->l_next = map;
+ map->l_prev = r_debug_tail;
+ map->l_next = 0;
+ } else {
+ _r_debug.r_map = map;
+ map->l_prev = 0;
+ map->l_next = 0;
+ }
+ r_debug_tail = map;
+}
+
+static void remove_soinfo_from_debug_map(soinfo * info)
+{
+ struct link_map * map = &(info->linkmap);
+
+ if (r_debug_tail == map)
+ r_debug_tail = map->l_prev;
+
+ if (map->l_prev) map->l_prev->l_next = map->l_next;
+ if (map->l_next) map->l_next->l_prev = map->l_prev;
+}
+
+void notify_gdb_of_load(soinfo * info)
+{
+ if (info->flags & FLAG_EXE) {
+ // GDB already knows about the main executable
+ return;
+ }
+
+ pthread_mutex_lock(&_r_debug_lock);
+
+ _r_debug.r_state = RT_ADD;
+ rtld_db_dlactivity();
+
+ insert_soinfo_into_debug_map(info);
+
+ _r_debug.r_state = RT_CONSISTENT;
+ rtld_db_dlactivity();
+
+ pthread_mutex_unlock(&_r_debug_lock);
+}
+
+void notify_gdb_of_unload(soinfo * info)
+{
+ if (info->flags & FLAG_EXE) {
+ // GDB already knows about the main executable
+ return;
+ }
+
+ pthread_mutex_lock(&_r_debug_lock);
+
+ _r_debug.r_state = RT_DELETE;
+ rtld_db_dlactivity();
+
+ remove_soinfo_from_debug_map(info);
+
+ _r_debug.r_state = RT_CONSISTENT;
+ rtld_db_dlactivity();
+
+ pthread_mutex_unlock(&_r_debug_lock);
+}
+
+void notify_gdb_of_libraries()
+{
+ _r_debug.r_state = RT_ADD;
+ rtld_db_dlactivity();
+ _r_debug.r_state = RT_CONSISTENT;
+ rtld_db_dlactivity();
+}
+
+static soinfo *alloc_info(const char *name)
+{
+ soinfo *si;
+
+ if(strlen(name) >= SOINFO_NAME_LEN) {
+ DL_ERR("%5d library name %s too long", pid, name);
+ return NULL;
+ }
+
+ /* The freelist is populated when we call free_info(), which in turn is
+ done only by dlclose(), which is not likely to be used.
+ */
+ if (!freelist) {
+ if(socount == SO_MAX) {
+ DL_ERR("%5d too many libraries when loading %s", pid, name);
+ return NULL;
+ }
+ freelist = sopool + socount++;
+ freelist->next = NULL;
+ }
+
+ si = freelist;
+ freelist = freelist->next;
+
+ /* Make sure we get a clean block of soinfo */
+ memset(si, 0, sizeof(soinfo));
+ strlcpy((char*) si->name, name, sizeof(si->name));
+ sonext->next = si;
+ si->next = NULL;
+ si->refcount = 0;
+ sonext = si;
+
+ TRACE("%5d name %s: allocated soinfo @ %p\n", pid, name, si);
+ return si;
+}
+
+static void free_info(soinfo *si)
+{
+ soinfo *prev = NULL, *trav;
+
+ TRACE("%5d name %s: freeing soinfo @ %p\n", pid, si->name, si);
+
+ for(trav = solist; trav != NULL; trav = trav->next){
+ if (trav == si)
+ break;
+ prev = trav;
+ }
+ if (trav == NULL) {
+ /* si was not ni solist */
+ DL_ERR("%5d name %s is not in solist!", pid, si->name);
+ return;
+ }
+
+ /* prev will never be NULL, because the first entry in solist is
+ always the static libdl_info.
+ */
+ prev->next = si->next;
+ if (si == sonext) sonext = prev;
+ si->next = freelist;
+ freelist = si;
+}
+
+const char *addr_to_name(unsigned addr)
+{
+ soinfo *si;
+
+ for(si = solist; si != 0; si = si->next){
+ if((addr >= si->base) && (addr < (si->base + si->size))) {
+ return si->name;
+ }
+ }
+
+ return "";
+}
+
+/* For a given PC, find the .so that it belongs to.
+ * Returns the base address of the .ARM.exidx section
+ * for that .so, and the number of 8-byte entries
+ * in that section (via *pcount).
+ *
+ * Intended to be called by libc's __gnu_Unwind_Find_exidx().
+ *
+ * This function is exposed via dlfcn.c and libdl.so.
+ */
+#ifdef ANDROID_ARM_LINKER
+_Unwind_Ptr android_dl_unwind_find_exidx(_Unwind_Ptr pc, int *pcount)
+{
+ soinfo *si;
+ unsigned addr = (unsigned)pc;
+
+ for (si = solist; si != 0; si = si->next){
+ if ((addr >= si->base) && (addr < (si->base + si->size))) {
+ *pcount = si->ARM_exidx_count;
+ return (_Unwind_Ptr)(si->base + (unsigned long)si->ARM_exidx);
+ }
+ }
+ *pcount = 0;
+ return NULL;
+}
+#elif defined(ANDROID_X86_LINKER)
+/* Here, we only have to provide a callback to iterate across all the
+ * loaded libraries. gcc_eh does the rest. */
+int
+android_dl_iterate_phdr(int (*cb)(struct dl_phdr_info *info, size_t size, void *data),
+ void *data)
+{
+ soinfo *si;
+ struct dl_phdr_info dl_info;
+ int rv = 0;
+
+ for (si = solist; si != NULL; si = si->next) {
+ dl_info.dlpi_addr = si->linkmap.l_addr;
+ dl_info.dlpi_name = si->linkmap.l_name;
+ dl_info.dlpi_phdr = si->phdr;
+ dl_info.dlpi_phnum = si->phnum;
+ rv = cb(&dl_info, sizeof (struct dl_phdr_info), data);
+ if (rv != 0)
+ break;
+ }
+ return rv;
+}
+#endif
+
+static Elf32_Sym *_elf_lookup(soinfo *si, unsigned hash, const char *name)
+{
+ Elf32_Sym *s;
+ Elf32_Sym *symtab = si->symtab;
+ const char *strtab = si->strtab;
+ unsigned n;
+
+ TRACE_TYPE(LOOKUP, "%5d SEARCH %s in %s@0x%08x %08x %d\n", pid,
+ name, si->name, si->base, hash, hash % si->nbucket);
+ if (si->nbucket == 0) {
+ return NULL;
+ }
+ n = hash % si->nbucket;
+
+ for(n = si->bucket[hash % si->nbucket]; n != 0; n = si->chain[n]){
+ s = symtab + n;
+ if(strcmp(strtab + s->st_name, name)) continue;
+
+ /* only concern ourselves with global and weak symbol definitions */
+ switch(ELF32_ST_BIND(s->st_info)){
+ case STB_GLOBAL:
+ case STB_WEAK:
+ /* no section == undefined */
+ if(s->st_shndx == 0) continue;
+
+ TRACE_TYPE(LOOKUP, "%5d FOUND %s in %s (%08x) %d\n", pid,
+ name, si->name, s->st_value, s->st_size);
+ return s;
+ }
+ }
+
+ return NULL;
+}
+
+static unsigned elfhash(const char *_name)
+{
+ const unsigned char *name = (const unsigned char *) _name;
+ unsigned h = 0, g;
+
+ while(*name) {
+ h = (h << 4) + *name++;
+ g = h & 0xf0000000;
+ h ^= g;
+ h ^= g >> 24;
+ }
+ return h;
+}
+
+static Elf32_Sym *
+_do_lookup(soinfo *si, const char *name, unsigned *base)
+{
+ unsigned elf_hash = elfhash(name);
+ Elf32_Sym *s;
+ unsigned *d;
+ soinfo *lsi = si;
+ int i;
+
+ /* Look for symbols in the local scope (the object who is
+ * searching). This happens with C++ templates on i386 for some
+ * reason.
+ *
+ * Notes on weak symbols:
+ * The ELF specs are ambigious about treatment of weak definitions in
+ * dynamic linking. Some systems return the first definition found
+ * and some the first non-weak definition. This is system dependent.
+ * Here we return the first definition found for simplicity. */
+
+ s = _elf_lookup(si, elf_hash, name);
+ if(s != NULL)
+ goto done;
+
+ /* Next, look for it in the preloads list */
+ for(i = 0; preloads[i] != NULL; i++) {
+ lsi = preloads[i];
+ s = _elf_lookup(lsi, elf_hash, name);
+ if(s != NULL)
+ goto done;
+ }
+
+ for(d = si->dynamic; *d; d += 2) {
+ if(d[0] == DT_NEEDED){
+ lsi = (soinfo *)d[1];
+ if (!validate_soinfo(lsi)) {
+ DL_ERR("%5d bad DT_NEEDED pointer in %s",
+ pid, si->name);
+ return NULL;
+ }
+
+ DEBUG("%5d %s: looking up %s in %s\n",
+ pid, si->name, name, lsi->name);
+ s = _elf_lookup(lsi, elf_hash, name);
+ if ((s != NULL) && (s->st_shndx != SHN_UNDEF))
+ goto done;
+ }
+ }
+
+#if ALLOW_SYMBOLS_FROM_MAIN
+ /* If we are resolving relocations while dlopen()ing a library, it's OK for
+ * the library to resolve a symbol that's defined in the executable itself,
+ * although this is rare and is generally a bad idea.
+ */
+ if (somain) {
+ lsi = somain;
+ DEBUG("%5d %s: looking up %s in executable %s\n",
+ pid, si->name, name, lsi->name);
+ s = _elf_lookup(lsi, elf_hash, name);
+ }
+#endif
+
+done:
+ if(s != NULL) {
+ TRACE_TYPE(LOOKUP, "%5d si %s sym %s s->st_value = 0x%08x, "
+ "found in %s, base = 0x%08x\n",
+ pid, si->name, name, s->st_value, lsi->name, lsi->base);
+ *base = lsi->base;
+ return s;
+ }
+
+ return NULL;
+}
+
+/* This is used by dl_sym(). It performs symbol lookup only within the
+ specified soinfo object and not in any of its dependencies.
+ */
+Elf32_Sym *lookup_in_library(soinfo *si, const char *name)
+{
+ return _elf_lookup(si, elfhash(name), name);
+}
+
+/* This is used by dl_sym(). It performs a global symbol lookup.
+ */
+Elf32_Sym *lookup(const char *name, soinfo **found, soinfo *start)
+{
+ unsigned elf_hash = elfhash(name);
+ Elf32_Sym *s = NULL;
+ soinfo *si;
+
+ if(start == NULL) {
+ start = solist;
+ }
+
+ for(si = start; (s == NULL) && (si != NULL); si = si->next)
+ {
+ if(si->flags & FLAG_ERROR)
+ continue;
+ s = _elf_lookup(si, elf_hash, name);
+ if (s != NULL) {
+ *found = si;
+ break;
+ }
+ }
+
+ if(s != NULL) {
+ TRACE_TYPE(LOOKUP, "%5d %s s->st_value = 0x%08x, "
+ "si->base = 0x%08x\n", pid, name, s->st_value, si->base);
+ return s;
+ }
+
+ return NULL;
+}
+
+soinfo *find_containing_library(const void *addr)
+{
+ soinfo *si;
+
+ for(si = solist; si != NULL; si = si->next)
+ {
+ if((unsigned)addr >= si->base && (unsigned)addr - si->base < si->size) {
+ return si;
+ }
+ }
+
+ return NULL;
+}
+
+Elf32_Sym *find_containing_symbol(const void *addr, soinfo *si)
+{
+ unsigned int i;
+ unsigned soaddr = (unsigned)addr - si->base;
+
+ /* Search the library's symbol table for any defined symbol which
+ * contains this address */
+ for(i=0; i<si->nchain; i++) {
+ Elf32_Sym *sym = &si->symtab[i];
+
+ if(sym->st_shndx != SHN_UNDEF &&
+ soaddr >= sym->st_value &&
+ soaddr < sym->st_value + sym->st_size) {
+ return sym;
+ }
+ }
+
+ return NULL;
+}
+
+#if 0
+static void dump(soinfo *si)
+{
+ Elf32_Sym *s = si->symtab;
+ unsigned n;
+
+ for(n = 0; n < si->nchain; n++) {
+ TRACE("%5d %04d> %08x: %02x %04x %08x %08x %s\n", pid, n, s,
+ s->st_info, s->st_shndx, s->st_value, s->st_size,
+ si->strtab + s->st_name);
+ s++;
+ }
+}
+#endif
+
+static const char *sopaths[] = {
+ "/vendor/lib",
+ "/system/lib",
+ 0
+};
+
+static int _open_lib(const char *name)
+{
+ int fd;
+ struct stat filestat;
+
+ if ((stat(name, &filestat) >= 0) && S_ISREG(filestat.st_mode)) {
+ if ((fd = open(name, O_RDONLY)) >= 0)
+ return fd;
+ }
+
+ return -1;
+}
+
+static int open_library(const char *name)
+{
+ int fd;
+ char buf[512];
+ const char **path;
+ int n;
+
+ TRACE("[ %5d opening %s ]\n", pid, name);
+
+ if(name == 0) return -1;
+ if(strlen(name) > 256) return -1;
+
+ if ((name[0] == '/') && ((fd = _open_lib(name)) >= 0))
+ return fd;
+
+ for (path = ldpaths; *path; path++) {
+ n = format_buffer(buf, sizeof(buf), "%s/%s", *path, name);
+ if (n < 0 || n >= (int)sizeof(buf)) {
+ WARN("Ignoring very long library path: %s/%s\n", *path, name);
+ continue;
+ }
+ if ((fd = _open_lib(buf)) >= 0)
+ return fd;
+ }
+ for (path = sopaths; *path; path++) {
+ n = format_buffer(buf, sizeof(buf), "%s/%s", *path, name);
+ if (n < 0 || n >= (int)sizeof(buf)) {
+ WARN("Ignoring very long library path: %s/%s\n", *path, name);
+ continue;
+ }
+ if ((fd = _open_lib(buf)) >= 0)
+ return fd;
+ }
+
+ return -1;
+}
+
+/* temporary space for holding the first page of the shared lib
+ * which contains the elf header (with the pht). */
+static unsigned char __header[PAGE_SIZE];
+
+typedef struct {
+ long mmap_addr;
+ char tag[4]; /* 'P', 'R', 'E', ' ' */
+} prelink_info_t;
+
+/* Returns the requested base address if the library is prelinked,
+ * and 0 otherwise. */
+static unsigned long
+is_prelinked(int fd, const char *name)
+{
+ off_t sz;
+ prelink_info_t info;
+
+ sz = lseek(fd, -sizeof(prelink_info_t), SEEK_END);
+ if (sz < 0) {
+ DL_ERR("lseek() failed!");
+ return 0;
+ }
+
+ if (read(fd, &info, sizeof(info)) != sizeof(info)) {
+ WARN("Could not read prelink_info_t structure for `%s`\n", name);
+ return 0;
+ }
+
+ if (strncmp(info.tag, "PRE ", 4)) {
+ WARN("`%s` is not a prelinked library\n", name);
+ return 0;
+ }
+
+ return (unsigned long)info.mmap_addr;
+}
+
+/* verify_elf_object
+ * Verifies if the object @ base is a valid ELF object
+ *
+ * Args:
+ *
+ * Returns:
+ * 0 on success
+ * -1 if no valid ELF object is found @ base.
+ */
+static int
+verify_elf_object(void *base, const char *name)
+{
+ Elf32_Ehdr *hdr = (Elf32_Ehdr *) base;
+
+ if (hdr->e_ident[EI_MAG0] != ELFMAG0) return -1;
+ if (hdr->e_ident[EI_MAG1] != ELFMAG1) return -1;
+ if (hdr->e_ident[EI_MAG2] != ELFMAG2) return -1;
+ if (hdr->e_ident[EI_MAG3] != ELFMAG3) return -1;
+
+ /* TODO: Should we verify anything else in the header? */
+#ifdef ANDROID_ARM_LINKER
+ if (hdr->e_machine != EM_ARM) return -1;
+#elif defined(ANDROID_X86_LINKER)
+ if (hdr->e_machine != EM_386) return -1;
+#endif
+ return 0;
+}
+
+
+/* get_lib_extents
+ * Retrieves the base (*base) address where the ELF object should be
+ * mapped and its overall memory size (*total_sz).
+ *
+ * Args:
+ * fd: Opened file descriptor for the library
+ * name: The name of the library
+ * _hdr: Pointer to the header page of the library
+ * total_sz: Total size of the memory that should be allocated for
+ * this library
+ *
+ * Returns:
+ * -1 if there was an error while trying to get the lib extents.
+ * The possible reasons are:
+ * - Could not determine if the library was prelinked.
+ * - The library provided is not a valid ELF object
+ * 0 if the library did not request a specific base offset (normal
+ * for non-prelinked libs)
+ * > 0 if the library requests a specific address to be mapped to.
+ * This indicates a pre-linked library.
+ */
+static unsigned
+get_lib_extents(int fd, const char *name, void *__hdr, unsigned *total_sz)
+{
+ unsigned req_base;
+ unsigned min_vaddr = 0xffffffff;
+ unsigned max_vaddr = 0;
+ unsigned char *_hdr = (unsigned char *)__hdr;
+ Elf32_Ehdr *ehdr = (Elf32_Ehdr *)_hdr;
+ Elf32_Phdr *phdr;
+ int cnt;
+
+ TRACE("[ %5d Computing extents for '%s'. ]\n", pid, name);
+ if (verify_elf_object(_hdr, name) < 0) {
+ DL_ERR("%5d - %s is not a valid ELF object", pid, name);
+ return (unsigned)-1;
+ }
+
+ req_base = (unsigned) is_prelinked(fd, name);
+ if (req_base == (unsigned)-1)
+ return -1;
+ else if (req_base != 0) {
+ TRACE("[ %5d - Prelinked library '%s' requesting base @ 0x%08x ]\n",
+ pid, name, req_base);
+ } else {
+ TRACE("[ %5d - Non-prelinked library '%s' found. ]\n", pid, name);
+ }
+
+ phdr = (Elf32_Phdr *)(_hdr + ehdr->e_phoff);
+
+ /* find the min/max p_vaddrs from all the PT_LOAD segments so we can
+ * get the range. */
+ for (cnt = 0; cnt < ehdr->e_phnum; ++cnt, ++phdr) {
+ if (phdr->p_type == PT_LOAD) {
+ if ((phdr->p_vaddr + phdr->p_memsz) > max_vaddr)
+ max_vaddr = phdr->p_vaddr + phdr->p_memsz;
+ if (phdr->p_vaddr < min_vaddr)
+ min_vaddr = phdr->p_vaddr;
+ }
+ }
+
+ if ((min_vaddr == 0xffffffff) && (max_vaddr == 0)) {
+ DL_ERR("%5d - No loadable segments found in %s.", pid, name);
+ return (unsigned)-1;
+ }
+
+ /* truncate min_vaddr down to page boundary */
+ min_vaddr &= ~PAGE_MASK;
+
+ /* round max_vaddr up to the next page */
+ max_vaddr = (max_vaddr + PAGE_SIZE - 1) & ~PAGE_MASK;
+
+ *total_sz = (max_vaddr - min_vaddr);
+ return (unsigned)req_base;
+}
+
+/* reserve_mem_region
+ *
+ * This function reserves a chunk of memory to be used for mapping in
+ * a prelinked shared library. We reserve the entire memory region here, and
+ * then the rest of the linker will relocate the individual loadable
+ * segments into the correct locations within this memory range.
+ *
+ * Args:
+ * si->base: The requested base of the allocation.
+ * si->size: The size of the allocation.
+ *
+ * Returns:
+ * -1 on failure, and 0 on success. On success, si->base will contain
+ * the virtual address at which the library will be mapped.
+ */
+
+static int reserve_mem_region(soinfo *si)
+{
+ void *base = mmap((void *)si->base, si->size, PROT_NONE,
+ MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ if (base == MAP_FAILED) {
+ DL_ERR("%5d can NOT map (%sprelinked) library '%s' at 0x%08x "
+ "as requested, will try general pool: %d (%s)",
+ pid, (si->base ? "" : "non-"), si->name, si->base,
+ errno, strerror(errno));
+ return -1;
+ } else if (base != (void *)si->base) {
+ DL_ERR("OOPS: %5d %sprelinked library '%s' mapped at 0x%08x, "
+ "not at 0x%08x", pid, (si->base ? "" : "non-"),
+ si->name, (unsigned)base, si->base);
+ munmap(base, si->size);
+ return -1;
+ }
+ return 0;
+}
+
+static int alloc_mem_region(soinfo *si)
+{
+ if (si->base) {
+ /* Attempt to mmap a prelinked library. */
+ return reserve_mem_region(si);
+ }
+
+ /* This is not a prelinked library, so we use the kernel's default
+ allocator.
+ */
+
+ void *base = mmap(NULL, si->size, PROT_NONE,
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ if (base == MAP_FAILED) {
+ DL_ERR("%5d mmap of library '%s' failed: %d (%s)\n",
+ pid, si->name,
+ errno, strerror(errno));
+ goto err;
+ }
+ si->base = (unsigned) base;
+ PRINT("%5d mapped library '%s' to %08x via kernel allocator.\n",
+ pid, si->name, si->base);
+ return 0;
+
+err:
+ DL_ERR("OOPS: %5d cannot map library '%s'. no vspace available.",
+ pid, si->name);
+ return -1;
+}
+
+#define MAYBE_MAP_FLAG(x,from,to) (((x) & (from)) ? (to) : 0)
+#define PFLAGS_TO_PROT(x) (MAYBE_MAP_FLAG((x), PF_X, PROT_EXEC) | \
+ MAYBE_MAP_FLAG((x), PF_R, PROT_READ) | \
+ MAYBE_MAP_FLAG((x), PF_W, PROT_WRITE))
+/* load_segments
+ *
+ * This function loads all the loadable (PT_LOAD) segments into memory
+ * at their appropriate memory offsets off the base address.
+ *
+ * Args:
+ * fd: Open file descriptor to the library to load.
+ * header: Pointer to a header page that contains the ELF header.
+ * This is needed since we haven't mapped in the real file yet.
+ * si: ptr to soinfo struct describing the shared object.
+ *
+ * Returns:
+ * 0 on success, -1 on failure.
+ */
+static int
+load_segments(int fd, void *header, soinfo *si)
+{
+ Elf32_Ehdr *ehdr = (Elf32_Ehdr *)header;
+ Elf32_Phdr *phdr = (Elf32_Phdr *)((unsigned char *)header + ehdr->e_phoff);
+ Elf32_Addr base = (Elf32_Addr) si->base;
+ int cnt;
+ unsigned len;
+ Elf32_Addr tmp;
+ unsigned char *pbase;
+ unsigned char *extra_base;
+ unsigned extra_len;
+ unsigned total_sz = 0;
+
+ si->wrprotect_start = 0xffffffff;
+ si->wrprotect_end = 0;
+
+ TRACE("[ %5d - Begin loading segments for '%s' @ 0x%08x ]\n",
+ pid, si->name, (unsigned)si->base);
+ /* Now go through all the PT_LOAD segments and map them into memory
+ * at the appropriate locations. */
+ for (cnt = 0; cnt < ehdr->e_phnum; ++cnt, ++phdr) {
+ if (phdr->p_type == PT_LOAD) {
+ DEBUG_DUMP_PHDR(phdr, "PT_LOAD", pid);
+ /* we want to map in the segment on a page boundary */
+ tmp = base + (phdr->p_vaddr & (~PAGE_MASK));
+ /* add the # of bytes we masked off above to the total length. */
+ len = phdr->p_filesz + (phdr->p_vaddr & PAGE_MASK);
+
+ TRACE("[ %d - Trying to load segment from '%s' @ 0x%08x "
+ "(0x%08x). p_vaddr=0x%08x p_offset=0x%08x ]\n", pid, si->name,
+ (unsigned)tmp, len, phdr->p_vaddr, phdr->p_offset);
+ pbase = mmap((void *)tmp, len, PFLAGS_TO_PROT(phdr->p_flags),
+ MAP_PRIVATE | MAP_FIXED, fd,
+ phdr->p_offset & (~PAGE_MASK));
+ if (pbase == MAP_FAILED) {
+ DL_ERR("%d failed to map segment from '%s' @ 0x%08x (0x%08x). "
+ "p_vaddr=0x%08x p_offset=0x%08x", pid, si->name,
+ (unsigned)tmp, len, phdr->p_vaddr, phdr->p_offset);
+ goto fail;
+ }
+
+ /* If 'len' didn't end on page boundary, and it's a writable
+ * segment, zero-fill the rest. */
+ if ((len & PAGE_MASK) && (phdr->p_flags & PF_W))
+ memset((void *)(pbase + len), 0, PAGE_SIZE - (len & PAGE_MASK));
+
+ /* Check to see if we need to extend the map for this segment to
+ * cover the diff between filesz and memsz (i.e. for bss).
+ *
+ * base _+---------------------+ page boundary
+ * . .
+ * | |
+ * . .
+ * pbase _+---------------------+ page boundary
+ * | |
+ * . .
+ * base + p_vaddr _| |
+ * . \ \ .
+ * . | filesz | .
+ * pbase + len _| / | |
+ * <0 pad> . . .
+ * extra_base _+------------|--------+ page boundary
+ * / . . .
+ * | . . .
+ * | +------------|--------+ page boundary
+ * extra_len-> | | | |
+ * | . | memsz .
+ * | . | .
+ * \ _| / |
+ * . .
+ * | |
+ * _+---------------------+ page boundary
+ */
+ tmp = (Elf32_Addr)(((unsigned)pbase + len + PAGE_SIZE - 1) &
+ (~PAGE_MASK));
+ if (tmp < (base + phdr->p_vaddr + phdr->p_memsz)) {
+ extra_len = base + phdr->p_vaddr + phdr->p_memsz - tmp;
+ TRACE("[ %5d - Need to extend segment from '%s' @ 0x%08x "
+ "(0x%08x) ]\n", pid, si->name, (unsigned)tmp, extra_len);
+ /* map in the extra page(s) as anonymous into the range.
+ * This is probably not necessary as we already mapped in
+ * the entire region previously, but we just want to be
+ * sure. This will also set the right flags on the region
+ * (though we can probably accomplish the same thing with
+ * mprotect).
+ */
+ extra_base = mmap((void *)tmp, extra_len,
+ PFLAGS_TO_PROT(phdr->p_flags),
+ MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS,
+ -1, 0);
+ if (extra_base == MAP_FAILED) {
+ DL_ERR("[ %5d - failed to extend segment from '%s' @ 0x%08x"
+ " (0x%08x) ]", pid, si->name, (unsigned)tmp,
+ extra_len);
+ goto fail;
+ }
+ /* TODO: Check if we need to memset-0 this region.
+ * Anonymous mappings are zero-filled copy-on-writes, so we
+ * shouldn't need to. */
+ TRACE("[ %5d - Segment from '%s' extended @ 0x%08x "
+ "(0x%08x)\n", pid, si->name, (unsigned)extra_base,
+ extra_len);
+ }
+ /* set the len here to show the full extent of the segment we
+ * just loaded, mostly for debugging */
+ len = (((unsigned)base + phdr->p_vaddr + phdr->p_memsz +
+ PAGE_SIZE - 1) & (~PAGE_MASK)) - (unsigned)pbase;
+ TRACE("[ %5d - Successfully loaded segment from '%s' @ 0x%08x "
+ "(0x%08x). p_vaddr=0x%08x p_offset=0x%08x\n", pid, si->name,
+ (unsigned)pbase, len, phdr->p_vaddr, phdr->p_offset);
+ total_sz += len;
+ /* Make the section writable just in case we'll have to write to
+ * it during relocation (i.e. text segment). However, we will
+ * remember what range of addresses should be write protected.
+ *
+ */
+ if (!(phdr->p_flags & PF_W)) {
+ if ((unsigned)pbase < si->wrprotect_start)
+ si->wrprotect_start = (unsigned)pbase;
+ if (((unsigned)pbase + len) > si->wrprotect_end)
+ si->wrprotect_end = (unsigned)pbase + len;
+ mprotect(pbase, len,
+ PFLAGS_TO_PROT(phdr->p_flags) | PROT_WRITE);
+ }
+ } else if (phdr->p_type == PT_DYNAMIC) {
+ DEBUG_DUMP_PHDR(phdr, "PT_DYNAMIC", pid);
+ /* this segment contains the dynamic linking information */
+ si->dynamic = (unsigned *)(base + phdr->p_vaddr);
+ } else if (phdr->p_type == PT_GNU_RELRO) {
+ if ((phdr->p_vaddr >= si->size)
+ || ((phdr->p_vaddr + phdr->p_memsz) > si->size)
+ || ((base + phdr->p_vaddr + phdr->p_memsz) < base)) {
+ DL_ERR("%d invalid GNU_RELRO in '%s' "
+ "p_vaddr=0x%08x p_memsz=0x%08x", pid, si->name,
+ phdr->p_vaddr, phdr->p_memsz);
+ goto fail;
+ }
+ si->gnu_relro_start = (Elf32_Addr) (base + phdr->p_vaddr);
+ si->gnu_relro_len = (unsigned) phdr->p_memsz;
+ } else {
+#ifdef ANDROID_ARM_LINKER
+ if (phdr->p_type == PT_ARM_EXIDX) {
+ DEBUG_DUMP_PHDR(phdr, "PT_ARM_EXIDX", pid);
+ /* exidx entries (used for stack unwinding) are 8 bytes each.
+ */
+ si->ARM_exidx = (unsigned *)phdr->p_vaddr;
+ si->ARM_exidx_count = phdr->p_memsz / 8;
+ }
+#endif
+ }
+
+ }
+
+ /* Sanity check */
+ if (total_sz > si->size) {
+ DL_ERR("%5d - Total length (0x%08x) of mapped segments from '%s' is "
+ "greater than what was allocated (0x%08x). THIS IS BAD!",
+ pid, total_sz, si->name, si->size);
+ goto fail;
+ }
+
+ TRACE("[ %5d - Finish loading segments for '%s' @ 0x%08x. "
+ "Total memory footprint: 0x%08x bytes ]\n", pid, si->name,
+ (unsigned)si->base, si->size);
+ return 0;
+
+fail:
+ /* We can just blindly unmap the entire region even though some things
+ * were mapped in originally with anonymous and others could have been
+ * been mapped in from the file before we failed. The kernel will unmap
+ * all the pages in the range, irrespective of how they got there.
+ */
+ munmap((void *)si->base, si->size);
+ si->flags |= FLAG_ERROR;
+ return -1;
+}
+
+/* TODO: Implement this to take care of the fact that Android ARM
+ * ELF objects shove everything into a single loadable segment that has the
+ * write bit set. wr_offset is then used to set non-(data|bss) pages to be
+ * non-writable.
+ */
+#if 0
+static unsigned
+get_wr_offset(int fd, const char *name, Elf32_Ehdr *ehdr)
+{
+ Elf32_Shdr *shdr_start;
+ Elf32_Shdr *shdr;
+ int shdr_sz = ehdr->e_shnum * sizeof(Elf32_Shdr);
+ int cnt;
+ unsigned wr_offset = 0xffffffff;
+
+ shdr_start = mmap(0, shdr_sz, PROT_READ, MAP_PRIVATE, fd,
+ ehdr->e_shoff & (~PAGE_MASK));
+ if (shdr_start == MAP_FAILED) {
+ WARN("%5d - Could not read section header info from '%s'. Will not "
+ "not be able to determine write-protect offset.\n", pid, name);
+ return (unsigned)-1;
+ }
+
+ for(cnt = 0, shdr = shdr_start; cnt < ehdr->e_shnum; ++cnt, ++shdr) {
+ if ((shdr->sh_type != SHT_NULL) && (shdr->sh_flags & SHF_WRITE) &&
+ (shdr->sh_addr < wr_offset)) {
+ wr_offset = shdr->sh_addr;
+ }
+ }
+
+ munmap(shdr_start, shdr_sz);
+ return wr_offset;
+}
+#endif
+
+static soinfo *
+load_library(const char *name)
+{
+ int fd = open_library(name);
+ int cnt;
+ unsigned ext_sz;
+ unsigned req_base;
+ const char *bname;
+ soinfo *si = NULL;
+ Elf32_Ehdr *hdr;
+
+ if(fd == -1) {
+ DL_ERR("Library '%s' not found", name);
+ return NULL;
+ }
+
+ /* We have to read the ELF header to figure out what to do with this image
+ */
+ if (lseek(fd, 0, SEEK_SET) < 0) {
+ DL_ERR("lseek() failed!");
+ goto fail;
+ }
+
+ if ((cnt = read(fd, &__header[0], PAGE_SIZE)) < 0) {
+ DL_ERR("read() failed!");
+ goto fail;
+ }
+
+ /* Parse the ELF header and get the size of the memory footprint for
+ * the library */
+ req_base = get_lib_extents(fd, name, &__header[0], &ext_sz);
+ if (req_base == (unsigned)-1)
+ goto fail;
+ TRACE("[ %5d - '%s' (%s) wants base=0x%08x sz=0x%08x ]\n", pid, name,
+ (req_base ? "prelinked" : "not pre-linked"), req_base, ext_sz);
+
+ /* Now configure the soinfo struct where we'll store all of our data
+ * for the ELF object. If the loading fails, we waste the entry, but
+ * same thing would happen if we failed during linking. Configuring the
+ * soinfo struct here is a lot more convenient.
+ */
+ bname = strrchr(name, '/');
+ si = alloc_info(bname ? bname + 1 : name);
+ if (si == NULL)
+ goto fail;
+
+ /* Carve out a chunk of memory where we will map in the individual
+ * segments */
+ si->base = req_base;
+ si->size = ext_sz;
+ si->flags = 0;
+ si->entry = 0;
+ si->dynamic = (unsigned *)-1;
+ if (alloc_mem_region(si) < 0)
+ goto fail;
+
+ TRACE("[ %5d allocated memory for %s @ %p (0x%08x) ]\n",
+ pid, name, (void *)si->base, (unsigned) ext_sz);
+
+ /* Now actually load the library's segments into right places in memory */
+ if (load_segments(fd, &__header[0], si) < 0) {
+ goto fail;
+ }
+
+ /* this might not be right. Technically, we don't even need this info
+ * once we go through 'load_segments'. */
+ hdr = (Elf32_Ehdr *)si->base;
+ si->phdr = (Elf32_Phdr *)((unsigned char *)si->base + hdr->e_phoff);
+ si->phnum = hdr->e_phnum;
+ /**/
+
+ close(fd);
+ return si;
+
+fail:
+ if (si) free_info(si);
+ close(fd);
+ return NULL;
+}
+
+static soinfo *
+init_library(soinfo *si)
+{
+ unsigned wr_offset = 0xffffffff;
+
+ /* At this point we know that whatever is loaded @ base is a valid ELF
+ * shared library whose segments are properly mapped in. */
+ TRACE("[ %5d init_library base=0x%08x sz=0x%08x name='%s') ]\n",
+ pid, si->base, si->size, si->name);
+
+ if(link_image(si, wr_offset)) {
+ /* We failed to link. However, we can only restore libbase
+ ** if no additional libraries have moved it since we updated it.
+ */
+ munmap((void *)si->base, si->size);
+ return NULL;
+ }
+
+ return si;
+}
+
+soinfo *find_library(const char *name)
+{
+ soinfo *si;
+ const char *bname;
+
+#if ALLOW_SYMBOLS_FROM_MAIN
+ if (name == NULL)
+ return somain;
+#else
+ if (name == NULL)
+ return NULL;
+#endif
+
+ bname = strrchr(name, '/');
+ bname = bname ? bname + 1 : name;
+
+ for(si = solist; si != 0; si = si->next){
+ if(!strcmp(bname, si->name)) {
+ if(si->flags & FLAG_ERROR) {
+ DL_ERR("%5d '%s' failed to load previously", pid, bname);
+ return NULL;
+ }
+ if(si->flags & FLAG_LINKED) return si;
+ DL_ERR("OOPS: %5d recursive link to '%s'", pid, si->name);
+ return NULL;
+ }
+ }
+
+ TRACE("[ %5d '%s' has not been loaded yet. Locating...]\n", pid, name);
+ si = load_library(name);
+ if(si == NULL)
+ return NULL;
+ return init_library(si);
+}
+
+/* TODO:
+ * notify gdb of unload
+ * for non-prelinked libraries, find a way to decrement libbase
+ */
+static void call_destructors(soinfo *si);
+unsigned unload_library(soinfo *si)
+{
+ unsigned *d;
+ if (si->refcount == 1) {
+ TRACE("%5d unloading '%s'\n", pid, si->name);
+ call_destructors(si);
+
+ /*
+ * Make sure that we undo the PT_GNU_RELRO protections we added
+ * in link_image. This is needed to undo the DT_NEEDED hack below.
+ */
+ if ((si->gnu_relro_start != 0) && (si->gnu_relro_len != 0)) {
+ Elf32_Addr start = (si->gnu_relro_start & ~PAGE_MASK);
+ unsigned len = (si->gnu_relro_start - start) + si->gnu_relro_len;
+ if (mprotect((void *) start, len, PROT_READ | PROT_WRITE) < 0)
+ DL_ERR("%5d %s: could not undo GNU_RELRO protections. "
+ "Expect a crash soon. errno=%d (%s)",
+ pid, si->name, errno, strerror(errno));
+
+ }
+
+ for(d = si->dynamic; *d; d += 2) {
+ if(d[0] == DT_NEEDED){
+ soinfo *lsi = (soinfo *)d[1];
+
+ // The next line will segfault if the we don't undo the
+ // PT_GNU_RELRO protections (see comments above and in
+ // link_image().
+ d[1] = 0;
+
+ if (validate_soinfo(lsi)) {
+ TRACE("%5d %s needs to unload %s\n", pid,
+ si->name, lsi->name);
+ unload_library(lsi);
+ }
+ else
+ DL_ERR("%5d %s: could not unload dependent library",
+ pid, si->name);
+ }
+ }
+
+ munmap((char *)si->base, si->size);
+ notify_gdb_of_unload(si);
+ free_info(si);
+ si->refcount = 0;
+ }
+ else {
+ si->refcount--;
+ PRINT("%5d not unloading '%s', decrementing refcount to %d\n",
+ pid, si->name, si->refcount);
+ }
+ return si->refcount;
+}
+
+/* TODO: don't use unsigned for addrs below. It works, but is not
+ * ideal. They should probably be either uint32_t, Elf32_Addr, or unsigned
+ * long.
+ */
+static int reloc_library(soinfo *si, Elf32_Rel *rel, unsigned count)
+{
+ Elf32_Sym *symtab = si->symtab;
+ const char *strtab = si->strtab;
+ Elf32_Sym *s;
+ unsigned base;
+ Elf32_Rel *start = rel;
+ unsigned idx;
+
+ for (idx = 0; idx < count; ++idx) {
+ unsigned type = ELF32_R_TYPE(rel->r_info);
+ unsigned sym = ELF32_R_SYM(rel->r_info);
+ unsigned reloc = (unsigned)(rel->r_offset + si->base);
+ unsigned sym_addr = 0;
+ char *sym_name = NULL;
+
+ DEBUG("%5d Processing '%s' relocation at index %d\n", pid,
+ si->name, idx);
+ if(sym != 0) {
+ sym_name = (char *)(strtab + symtab[sym].st_name);
+ sym_addr = NULL;
+ if ((sym_addr = get_hooked_symbol(sym_name)) != NULL) {
+ DEBUG("hooked symbol %s to %x\n", sym_name, sym_addr);
+ }
+ else
+ {
+ s = _do_lookup(si, sym_name, &base);
+ }
+ if(sym_addr != NULL)
+ {
+ } else
+ if(s == NULL) {
+ /* We only allow an undefined symbol if this is a weak
+ reference.. */
+ s = &symtab[sym];
+ if (ELF32_ST_BIND(s->st_info) != STB_WEAK) {
+ DL_ERR("%5d cannot locate '%s'...\n", pid, sym_name);
+ return -1;
+ }
+
+ /* IHI0044C AAELF 4.5.1.1:
+
+ Libraries are not searched to resolve weak references.
+ It is not an error for a weak reference to remain
+ unsatisfied.
+
+ During linking, the value of an undefined weak reference is:
+ - Zero if the relocation type is absolute
+ - The address of the place if the relocation is pc-relative
+ - The address of nominial base address if the relocation
+ type is base-relative.
+ */
+
+ switch (type) {
+#if defined(ANDROID_ARM_LINKER)
+ case R_ARM_JUMP_SLOT:
+ case R_ARM_GLOB_DAT:
+ case R_ARM_ABS32:
+ case R_ARM_RELATIVE: /* Don't care. */
+ case R_ARM_NONE: /* Don't care. */
+#elif defined(ANDROID_X86_LINKER)
+ case R_386_JUMP_SLOT:
+ case R_386_GLOB_DAT:
+ case R_386_32:
+ case R_386_RELATIVE: /* Dont' care. */
+#endif /* ANDROID_*_LINKER */
+ /* sym_addr was initialized to be zero above or relocation
+ code below does not care about value of sym_addr.
+ No need to do anything. */
+ break;
+
+#if defined(ANDROID_X86_LINKER)
+ case R_386_PC32:
+ sym_addr = reloc;
+ break;
+#endif /* ANDROID_X86_LINKER */
+
+#if defined(ANDROID_ARM_LINKER)
+ case R_ARM_COPY:
+ /* Fall through. Can't really copy if weak symbol is
+ not found in run-time. */
+#endif /* ANDROID_ARM_LINKER */
+ default:
+ DL_ERR("%5d unknown weak reloc type %d @ %p (%d)\n",
+ pid, type, rel, (int) (rel - start));
+ return -1;
+ }
+ } else {
+ /* We got a definition. */
+#if 0
+ if((base == 0) && (si->base != 0)){
+ /* linking from libraries to main image is bad */
+ DL_ERR("%5d cannot locate '%s'...",
+ pid, strtab + symtab[sym].st_name);
+ return -1;
+ }
+#endif
+ sym_addr = (unsigned)(s->st_value + base);
+ }
+ COUNT_RELOC(RELOC_SYMBOL);
+ } else {
+ s = NULL;
+ }
+
+/* TODO: This is ugly. Split up the relocations by arch into
+ * different files.
+ */
+ switch(type){
+#if defined(ANDROID_ARM_LINKER)
+ case R_ARM_JUMP_SLOT:
+ COUNT_RELOC(RELOC_ABSOLUTE);
+ MARK(rel->r_offset);
+ TRACE_TYPE(RELO, "%5d RELO JMP_SLOT %08x <- %08x %s\n", pid,
+ reloc, sym_addr, sym_name);
+ *((unsigned*)reloc) = sym_addr;
+ break;
+ case R_ARM_GLOB_DAT:
+ COUNT_RELOC(RELOC_ABSOLUTE);
+ MARK(rel->r_offset);
+ TRACE_TYPE(RELO, "%5d RELO GLOB_DAT %08x <- %08x %s\n", pid,
+ reloc, sym_addr, sym_name);
+ *((unsigned*)reloc) = sym_addr;
+ break;
+ case R_ARM_ABS32:
+ COUNT_RELOC(RELOC_ABSOLUTE);
+ MARK(rel->r_offset);
+ TRACE_TYPE(RELO, "%5d RELO ABS %08x <- %08x %s\n", pid,
+ reloc, sym_addr, sym_name);
+ *((unsigned*)reloc) += sym_addr;
+ break;
+ case R_ARM_REL32:
+ COUNT_RELOC(RELOC_RELATIVE);
+ MARK(rel->r_offset);
+ TRACE_TYPE(RELO, "%5d RELO REL32 %08x <- %08x - %08x %s\n", pid,
+ reloc, sym_addr, rel->r_offset, sym_name);
+ *((unsigned*)reloc) += sym_addr - rel->r_offset;
+ break;
+#elif defined(ANDROID_X86_LINKER)
+ case R_386_JUMP_SLOT:
+ COUNT_RELOC(RELOC_ABSOLUTE);
+ MARK(rel->r_offset);
+ TRACE_TYPE(RELO, "%5d RELO JMP_SLOT %08x <- %08x %s\n", pid,
+ reloc, sym_addr, sym_name);
+ *((unsigned*)reloc) = sym_addr;
+ break;
+ case R_386_GLOB_DAT:
+ COUNT_RELOC(RELOC_ABSOLUTE);
+ MARK(rel->r_offset);
+ TRACE_TYPE(RELO, "%5d RELO GLOB_DAT %08x <- %08x %s\n", pid,
+ reloc, sym_addr, sym_name);
+ *((unsigned*)reloc) = sym_addr;
+ break;
+#endif /* ANDROID_*_LINKER */
+
+#if defined(ANDROID_ARM_LINKER)
+ case R_ARM_RELATIVE:
+#elif defined(ANDROID_X86_LINKER)
+ case R_386_RELATIVE:
+#endif /* ANDROID_*_LINKER */
+ COUNT_RELOC(RELOC_RELATIVE);
+ MARK(rel->r_offset);
+ if(sym){
+ DL_ERR("%5d odd RELATIVE form...", pid);
+ return -1;
+ }
+ TRACE_TYPE(RELO, "%5d RELO RELATIVE %08x <- +%08x\n", pid,
+ reloc, si->base);
+ *((unsigned*)reloc) += si->base;
+ break;
+
+#if defined(ANDROID_X86_LINKER)
+ case R_386_32:
+ COUNT_RELOC(RELOC_RELATIVE);
+ MARK(rel->r_offset);
+
+ TRACE_TYPE(RELO, "%5d RELO R_386_32 %08x <- +%08x %s\n", pid,
+ reloc, sym_addr, sym_name);
+ *((unsigned *)reloc) += (unsigned)sym_addr;
+ break;
+
+ case R_386_PC32:
+ COUNT_RELOC(RELOC_RELATIVE);
+ MARK(rel->r_offset);
+ TRACE_TYPE(RELO, "%5d RELO R_386_PC32 %08x <- "
+ "+%08x (%08x - %08x) %s\n", pid, reloc,
+ (sym_addr - reloc), sym_addr, reloc, sym_name);
+ *((unsigned *)reloc) += (unsigned)(sym_addr - reloc);
+ break;
+#endif /* ANDROID_X86_LINKER */
+
+#ifdef ANDROID_ARM_LINKER
+ case R_ARM_COPY:
+ COUNT_RELOC(RELOC_COPY);
+ MARK(rel->r_offset);
+ TRACE_TYPE(RELO, "%5d RELO %08x <- %d @ %08x %s\n", pid,
+ reloc, s->st_size, sym_addr, sym_name);
+ memcpy((void*)reloc, (void*)sym_addr, s->st_size);
+ break;
+ case R_ARM_NONE:
+ break;
+#endif /* ANDROID_ARM_LINKER */
+
+ default:
+ DL_ERR("%5d unknown reloc type %d @ %p (%d)",
+ pid, type, rel, (int) (rel - start));
+ return -1;
+ }
+ rel++;
+ }
+ return 0;
+}
+
+/* Please read the "Initialization and Termination functions" functions.
+ * of the linker design note in bionic/linker/README.TXT to understand
+ * what the following code is doing.
+ *
+ * The important things to remember are:
+ *
+ * DT_PREINIT_ARRAY must be called first for executables, and should
+ * not appear in shared libraries.
+ *
+ * DT_INIT should be called before DT_INIT_ARRAY if both are present
+ *
+ * DT_FINI should be called after DT_FINI_ARRAY if both are present
+ *
+ * DT_FINI_ARRAY must be parsed in reverse order.
+ */
+
+static void call_array(unsigned *ctor, int count, int reverse)
+{
+ int n, inc = 1;
+
+ if (reverse) {
+ ctor += (count-1);
+ inc = -1;
+ }
+
+ for(n = count; n > 0; n--) {
+ TRACE("[ %5d Looking at %s *0x%08x == 0x%08x ]\n", pid,
+ reverse ? "dtor" : "ctor",
+ (unsigned)ctor, (unsigned)*ctor);
+ void (*func)() = (void (*)()) *ctor;
+ ctor += inc;
+ if(((int) func == 0) || ((int) func == -1)) continue;
+ TRACE("[ %5d Calling func @ 0x%08x ]\n", pid, (unsigned)func);
+ func();
+ }
+}
+
+void call_constructors_recursive(soinfo *si)
+{
+ if (si->constructors_called)
+ return;
+ if (strcmp(si->name, "libc.so") == 0)
+ return;
+ // Set this before actually calling the constructors, otherwise it doesn't
+ // protect against recursive constructor calls. One simple example of
+ // constructor recursion is the libc debug malloc, which is implemented in
+ // libc_malloc_debug_leak.so:
+ // 1. The program depends on libc, so libc's constructor is called here.
+ // 2. The libc constructor calls dlopen() to load libc_malloc_debug_leak.so.
+ // 3. dlopen() calls call_constructors_recursive() with the newly created
+ // soinfo for libc_malloc_debug_leak.so.
+ // 4. The debug so depends on libc, so call_constructors_recursive() is
+ // called again with the libc soinfo. If it doesn't trigger the early-
+ // out above, the libc constructor will be called again (recursively!).
+ si->constructors_called = 1;
+
+ if (si->flags & FLAG_EXE) {
+ TRACE("[ %5d Calling preinit_array @ 0x%08x [%d] for '%s' ]\n",
+ pid, (unsigned)si->preinit_array, si->preinit_array_count,
+ si->name);
+ call_array(si->preinit_array, si->preinit_array_count, 0);
+ TRACE("[ %5d Done calling preinit_array for '%s' ]\n", pid, si->name);
+ } else {
+ if (si->preinit_array) {
+ DL_ERR("%5d Shared library '%s' has a preinit_array table @ 0x%08x."
+ " This is INVALID.", pid, si->name,
+ (unsigned)si->preinit_array);
+ }
+ }
+
+ if (si->dynamic) {
+ unsigned *d;
+ for(d = si->dynamic; *d; d += 2) {
+ if(d[0] == DT_NEEDED){
+ soinfo* lsi = (soinfo *)d[1];
+ if (!validate_soinfo(lsi)) {
+ DL_ERR("%5d bad DT_NEEDED pointer in %s",
+ pid, si->name);
+ } else {
+ call_constructors_recursive(lsi);
+ }
+ }
+ }
+ }
+
+ if (si->init_func) {
+ TRACE("[ %5d Calling init_func @ 0x%08x for '%s' ]\n", pid,
+ (unsigned)si->init_func, si->name);
+ si->init_func();
+ TRACE("[ %5d Done calling init_func for '%s' ]\n", pid, si->name);
+ }
+
+ if (si->init_array) {
+ TRACE("[ %5d Calling init_array @ 0x%08x [%d] for '%s' ]\n", pid,
+ (unsigned)si->init_array, si->init_array_count, si->name);
+ call_array(si->init_array, si->init_array_count, 0);
+ TRACE("[ %5d Done calling init_array for '%s' ]\n", pid, si->name);
+ }
+
+}
+
+static void call_destructors(soinfo *si)
+{
+ if (si->fini_array) {
+ TRACE("[ %5d Calling fini_array @ 0x%08x [%d] for '%s' ]\n", pid,
+ (unsigned)si->fini_array, si->fini_array_count, si->name);
+ call_array(si->fini_array, si->fini_array_count, 1);
+ TRACE("[ %5d Done calling fini_array for '%s' ]\n", pid, si->name);
+ }
+
+ if (si->fini_func) {
+ TRACE("[ %5d Calling fini_func @ 0x%08x for '%s' ]\n", pid,
+ (unsigned)si->fini_func, si->name);
+ si->fini_func();
+ TRACE("[ %5d Done calling fini_func for '%s' ]\n", pid, si->name);
+ }
+}
+
+/* Force any of the closed stdin, stdout and stderr to be associated with
+ /dev/null. */
+static int nullify_closed_stdio (void)
+{
+ int dev_null, i, status;
+ int return_value = 0;
+
+ dev_null = open("/dev/null", O_RDWR);
+ if (dev_null < 0) {
+ DL_ERR("Cannot open /dev/null.");
+ return -1;
+ }
+ TRACE("[ %5d Opened /dev/null file-descriptor=%d]\n", pid, dev_null);
+
+ /* If any of the stdio file descriptors is valid and not associated
+ with /dev/null, dup /dev/null to it. */
+ for (i = 0; i < 3; i++) {
+ /* If it is /dev/null already, we are done. */
+ if (i == dev_null)
+ continue;
+
+ TRACE("[ %5d Nullifying stdio file descriptor %d]\n", pid, i);
+ /* The man page of fcntl does not say that fcntl(..,F_GETFL)
+ can be interrupted but we do this just to be safe. */
+ do {
+ status = fcntl(i, F_GETFL);
+ } while (status < 0 && errno == EINTR);
+
+ /* If file is openned, we are good. */
+ if (status >= 0)
+ continue;
+
+ /* The only error we allow is that the file descriptor does not
+ exist, in which case we dup /dev/null to it. */
+ if (errno != EBADF) {
+ DL_ERR("nullify_stdio: unhandled error %s", strerror(errno));
+ return_value = -1;
+ continue;
+ }
+
+ /* Try dupping /dev/null to this stdio file descriptor and
+ repeat if there is a signal. Note that any errors in closing
+ the stdio descriptor are lost. */
+ do {
+ status = dup2(dev_null, i);
+ } while (status < 0 && errno == EINTR);
+
+ if (status < 0) {
+ DL_ERR("nullify_stdio: dup2 error %s", strerror(errno));
+ return_value = -1;
+ continue;
+ }
+ }
+
+ /* If /dev/null is not one of the stdio file descriptors, close it. */
+ if (dev_null > 2) {
+ TRACE("[ %5d Closing /dev/null file-descriptor=%d]\n", pid, dev_null);
+ do {
+ status = close(dev_null);
+ } while (status < 0 && errno == EINTR);
+
+ if (status < 0) {
+ DL_ERR("nullify_stdio: close error %s", strerror(errno));
+ return_value = -1;
+ }
+ }
+
+ return return_value;
+}
+
+static int link_image(soinfo *si, unsigned wr_offset)
+{
+ unsigned *d;
+ Elf32_Phdr *phdr = si->phdr;
+ int phnum = si->phnum;
+
+ INFO("[ %5d linking %s ]\n", pid, si->name);
+ DEBUG("%5d si->base = 0x%08x si->flags = 0x%08x\n", pid,
+ si->base, si->flags);
+
+ if (si->flags & (FLAG_EXE | FLAG_LINKER)) {
+ /* Locate the needed program segments (DYNAMIC/ARM_EXIDX) for
+ * linkage info if this is the executable or the linker itself.
+ * If this was a dynamic lib, that would have been done at load time.
+ *
+ * TODO: It's unfortunate that small pieces of this are
+ * repeated from the load_library routine. Refactor this just
+ * slightly to reuse these bits.
+ */
+ si->size = 0;
+ for(; phnum > 0; --phnum, ++phdr) {
+#ifdef ANDROID_ARM_LINKER
+ if(phdr->p_type == PT_ARM_EXIDX) {
+ /* exidx entries (used for stack unwinding) are 8 bytes each.
+ */
+ si->ARM_exidx = (unsigned *)phdr->p_vaddr;
+ si->ARM_exidx_count = phdr->p_memsz / 8;
+ }
+#endif
+ if (phdr->p_type == PT_LOAD) {
+ /* For the executable, we use the si->size field only in
+ dl_unwind_find_exidx(), so the meaning of si->size
+ is not the size of the executable; it is the distance
+ between the load location of the executable and the last
+ address of the loadable part of the executable.
+ We use the range [si->base, si->base + si->size) to
+ determine whether a PC value falls within the executable
+ section. Of course, if a value is between si->base and
+ (si->base + phdr->p_vaddr), it's not in the executable
+ section, but a) we shouldn't be asking for such a value
+ anyway, and b) if we have to provide an EXIDX for such a
+ value, then the executable's EXIDX is probably the better
+ choice.
+ */
+ DEBUG_DUMP_PHDR(phdr, "PT_LOAD", pid);
+ if (phdr->p_vaddr + phdr->p_memsz > si->size)
+ si->size = phdr->p_vaddr + phdr->p_memsz;
+ /* try to remember what range of addresses should be write
+ * protected */
+ if (!(phdr->p_flags & PF_W)) {
+ unsigned _end;
+
+ if (si->base + phdr->p_vaddr < si->wrprotect_start)
+ si->wrprotect_start = si->base + phdr->p_vaddr;
+ _end = (((si->base + phdr->p_vaddr + phdr->p_memsz + PAGE_SIZE - 1) &
+ (~PAGE_MASK)));
+ if (_end > si->wrprotect_end)
+ si->wrprotect_end = _end;
+ /* Make the section writable just in case we'll have to
+ * write to it during relocation (i.e. text segment).
+ * However, we will remember what range of addresses
+ * should be write protected.
+ */
+ mprotect((void *) (si->base + phdr->p_vaddr),
+ phdr->p_memsz,
+ PFLAGS_TO_PROT(phdr->p_flags) | PROT_WRITE);
+ }
+ } else if (phdr->p_type == PT_DYNAMIC) {
+ if (si->dynamic != (unsigned *)-1) {
+ DL_ERR("%5d multiple PT_DYNAMIC segments found in '%s'. "
+ "Segment at 0x%08x, previously one found at 0x%08x",
+ pid, si->name, si->base + phdr->p_vaddr,
+ (unsigned)si->dynamic);
+ goto fail;
+ }
+ DEBUG_DUMP_PHDR(phdr, "PT_DYNAMIC", pid);
+ si->dynamic = (unsigned *) (si->base + phdr->p_vaddr);
+ } else if (phdr->p_type == PT_GNU_RELRO) {
+ if ((phdr->p_vaddr >= si->size)
+ || ((phdr->p_vaddr + phdr->p_memsz) > si->size)
+ || ((si->base + phdr->p_vaddr + phdr->p_memsz) < si->base)) {
+ DL_ERR("%d invalid GNU_RELRO in '%s' "
+ "p_vaddr=0x%08x p_memsz=0x%08x", pid, si->name,
+ phdr->p_vaddr, phdr->p_memsz);
+ goto fail;
+ }
+ si->gnu_relro_start = (Elf32_Addr) (si->base + phdr->p_vaddr);
+ si->gnu_relro_len = (unsigned) phdr->p_memsz;
+ }
+ }
+ }
+
+ if (si->dynamic == (unsigned *)-1) {
+ DL_ERR("%5d missing PT_DYNAMIC?!", pid);
+ goto fail;
+ }
+
+ DEBUG("%5d dynamic = %p\n", pid, si->dynamic);
+
+ /* extract useful information from dynamic section */
+ for(d = si->dynamic; *d; d++){
+ DEBUG("%5d d = %p, d[0] = 0x%08x d[1] = 0x%08x\n", pid, d, d[0], d[1]);
+ switch(*d++){
+ case DT_HASH:
+ si->nbucket = ((unsigned *) (si->base + *d))[0];
+ si->nchain = ((unsigned *) (si->base + *d))[1];
+ si->bucket = (unsigned *) (si->base + *d + 8);
+ si->chain = (unsigned *) (si->base + *d + 8 + si->nbucket * 4);
+ break;
+ case DT_STRTAB:
+ si->strtab = (const char *) (si->base + *d);
+ break;
+ case DT_SYMTAB:
+ si->symtab = (Elf32_Sym *) (si->base + *d);
+ break;
+ case DT_PLTREL:
+ if(*d != DT_REL) {
+ DL_ERR("DT_RELA not supported");
+ goto fail;
+ }
+ break;
+ case DT_JMPREL:
+ si->plt_rel = (Elf32_Rel*) (si->base + *d);
+ break;
+ case DT_PLTRELSZ:
+ si->plt_rel_count = *d / 8;
+ break;
+ case DT_REL:
+ si->rel = (Elf32_Rel*) (si->base + *d);
+ break;
+ case DT_RELSZ:
+ si->rel_count = *d / 8;
+ break;
+ case DT_PLTGOT:
+ /* Save this in case we decide to do lazy binding. We don't yet. */
+ si->plt_got = (unsigned *)(si->base + *d);
+ break;
+ case DT_DEBUG:
+ // Set the DT_DEBUG entry to the addres of _r_debug for GDB
+ *d = (int) &_r_debug;
+ break;
+ case DT_RELA:
+ DL_ERR("%5d DT_RELA not supported", pid);
+ goto fail;
+ case DT_INIT:
+ si->init_func = (void (*)(void))(si->base + *d);
+ DEBUG("%5d %s constructors (init func) found at %p\n",
+ pid, si->name, si->init_func);
+ break;
+ case DT_FINI:
+ si->fini_func = (void (*)(void))(si->base + *d);
+ DEBUG("%5d %s destructors (fini func) found at %p\n",
+ pid, si->name, si->fini_func);
+ break;
+ case DT_INIT_ARRAY:
+ si->init_array = (unsigned *)(si->base + *d);
+ DEBUG("%5d %s constructors (init_array) found at %p\n",
+ pid, si->name, si->init_array);
+ break;
+ case DT_INIT_ARRAYSZ:
+ si->init_array_count = ((unsigned)*d) / sizeof(Elf32_Addr);
+ break;
+ case DT_FINI_ARRAY:
+ si->fini_array = (unsigned *)(si->base + *d);
+ DEBUG("%5d %s destructors (fini_array) found at %p\n",
+ pid, si->name, si->fini_array);
+ break;
+ case DT_FINI_ARRAYSZ:
+ si->fini_array_count = ((unsigned)*d) / sizeof(Elf32_Addr);
+ break;
+ case DT_PREINIT_ARRAY:
+ si->preinit_array = (unsigned *)(si->base + *d);
+ DEBUG("%5d %s constructors (preinit_array) found at %p\n",
+ pid, si->name, si->preinit_array);
+ break;
+ case DT_PREINIT_ARRAYSZ:
+ si->preinit_array_count = ((unsigned)*d) / sizeof(Elf32_Addr);
+ break;
+ case DT_TEXTREL:
+ /* TODO: make use of this. */
+ /* this means that we might have to write into where the text
+ * segment was loaded during relocation... Do something with
+ * it.
+ */
+ DEBUG("%5d Text segment should be writable during relocation.\n",
+ pid);
+ break;
+ }
+ }
+
+ DEBUG("%5d si->base = 0x%08x, si->strtab = %p, si->symtab = %p\n",
+ pid, si->base, si->strtab, si->symtab);
+
+ if((si->strtab == 0) || (si->symtab == 0)) {
+ DL_ERR("%5d missing essential tables", pid);
+ goto fail;
+ }
+
+ /* if this is the main executable, then load all of the preloads now */
+ if(si->flags & FLAG_EXE) {
+ int i;
+ memset(preloads, 0, sizeof(preloads));
+ for(i = 0; ldpreload_names[i] != NULL; i++) {
+ soinfo *lsi = find_library(ldpreload_names[i]);
+ if(lsi == 0) {
+ strlcpy(tmp_err_buf, linker_get_error(), sizeof(tmp_err_buf));
+ DL_ERR("%5d could not load needed library '%s' for '%s' (%s)",
+ pid, ldpreload_names[i], si->name, tmp_err_buf);
+ goto fail;
+ }
+ lsi->refcount++;
+ preloads[i] = lsi;
+ }
+ }
+
+ for(d = si->dynamic; *d; d += 2) {
+ if(d[0] == DT_NEEDED){
+ DEBUG("%5d %s needs %s\n", pid, si->name, si->strtab + d[1]);
+ soinfo *lsi = find_library(si->strtab + d[1]);
+ if(lsi == 0) {
+ strlcpy(tmp_err_buf, linker_get_error(), sizeof(tmp_err_buf));
+ DL_ERR("%5d could not load needed library '%s' for '%s' (%s)",
+ pid, si->strtab + d[1], si->name, tmp_err_buf);
+ goto fail;
+ }
+ /* Save the soinfo of the loaded DT_NEEDED library in the payload
+ of the DT_NEEDED entry itself, so that we can retrieve the
+ soinfo directly later from the dynamic segment. This is a hack,
+ but it allows us to map from DT_NEEDED to soinfo efficiently
+ later on when we resolve relocations, trying to look up a symbol
+ with dlsym().
+ */
+ d[1] = (unsigned)lsi;
+ lsi->refcount++;
+ }
+ }
+
+ if(si->plt_rel) {
+ DEBUG("[ %5d relocating %s plt ]\n", pid, si->name );
+ if(reloc_library(si, si->plt_rel, si->plt_rel_count))
+ goto fail;
+ }
+ if(si->rel) {
+ DEBUG("[ %5d relocating %s ]\n", pid, si->name );
+ if(reloc_library(si, si->rel, si->rel_count))
+ goto fail;
+ }
+
+ si->flags |= FLAG_LINKED;
+ DEBUG("[ %5d finished linking %s ]\n", pid, si->name);
+
+#if 0
+ /* This is the way that the old dynamic linker did protection of
+ * non-writable areas. It would scan section headers and find where
+ * .text ended (rather where .data/.bss began) and assume that this is
+ * the upper range of the non-writable area. This is too coarse,
+ * and is kept here for reference until we fully move away from single
+ * segment elf objects. See the code in get_wr_offset (also #if'd 0)
+ * that made this possible.
+ */
+ if(wr_offset < 0xffffffff){
+ mprotect((void*) si->base, wr_offset, PROT_READ | PROT_EXEC);
+ }
+#else
+ /* TODO: Verify that this does the right thing in all cases, as it
+ * presently probably does not. It is possible that an ELF image will
+ * come with multiple read-only segments. What we ought to do is scan
+ * the program headers again and mprotect all the read-only segments.
+ * To prevent re-scanning the program header, we would have to build a
+ * list of loadable segments in si, and then scan that instead. */
+ if (si->wrprotect_start != 0xffffffff && si->wrprotect_end != 0) {
+ mprotect((void *)si->wrprotect_start,
+ si->wrprotect_end - si->wrprotect_start,
+ PROT_READ | PROT_EXEC);
+ }
+#endif
+
+ if (si->gnu_relro_start != 0 && si->gnu_relro_len != 0) {
+ Elf32_Addr start = (si->gnu_relro_start & ~PAGE_MASK);
+ unsigned len = (si->gnu_relro_start - start) + si->gnu_relro_len;
+ if (mprotect((void *) start, len, PROT_READ) < 0) {
+ DL_ERR("%5d GNU_RELRO mprotect of library '%s' failed: %d (%s)\n",
+ pid, si->name, errno, strerror(errno));
+ goto fail;
+ }
+ }
+
+ /* If this is a SET?ID program, dup /dev/null to opened stdin,
+ stdout and stderr to close a security hole described in:
+
+ ftp://ftp.freebsd.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-02:23.stdio.asc
+
+ */
+ if (program_is_setuid)
+ nullify_closed_stdio ();
+ notify_gdb_of_load(si);
+ return 0;
+
+fail:
+ ERROR("failed to link %s\n", si->name);
+ si->flags |= FLAG_ERROR;
+ return -1;
+}
+
+static void parse_library_path(const char *path, char *delim)
+{
+ size_t len;
+ char *ldpaths_bufp = ldpaths_buf;
+ int i = 0;
+
+ len = strlcpy(ldpaths_buf, path, sizeof(ldpaths_buf));
+
+ while (i < LDPATH_MAX && (ldpaths[i] = strsep(&ldpaths_bufp, delim))) {
+ if (*ldpaths[i] != '\0')
+ ++i;
+ }
+
+ /* Forget the last path if we had to truncate; this occurs if the 2nd to
+ * last char isn't '\0' (i.e. not originally a delim). */
+ if (i > 0 && len >= sizeof(ldpaths_buf) &&
+ ldpaths_buf[sizeof(ldpaths_buf) - 2] != '\0') {
+ ldpaths[i - 1] = NULL;
+ } else {
+ ldpaths[i] = NULL;
+ }
+}
+
+static void parse_preloads(const char *path, char *delim)
+{
+ size_t len;
+ char *ldpreloads_bufp = ldpreloads_buf;
+ int i = 0;
+
+ len = strlcpy(ldpreloads_buf, path, sizeof(ldpreloads_buf));
+
+ while (i < LDPRELOAD_MAX && (ldpreload_names[i] = strsep(&ldpreloads_bufp, delim))) {
+ if (*ldpreload_names[i] != '\0') {
+ ++i;
+ }
+ }
+
+ /* Forget the last path if we had to truncate; this occurs if the 2nd to
+ * last char isn't '\0' (i.e. not originally a delim). */
+ if (i > 0 && len >= sizeof(ldpreloads_buf) &&
+ ldpreloads_buf[sizeof(ldpreloads_buf) - 2] != '\0') {
+ ldpreload_names[i - 1] = NULL;
+ } else {
+ ldpreload_names[i] = NULL;
+ }
+}
+
+/*
+ * This code is called after the linker has linked itself and
+ * fixed it's own GOT. It is safe to make references to externs
+ * and other non-local data at this point.
+ */
+static unsigned __linker_init_post_relocation(unsigned **elfdata)
+{
+ static soinfo linker_soinfo;
+
+ int argc = (int) *elfdata;
+ char **argv = (char**) (elfdata + 1);
+ unsigned *vecs = (unsigned*) (argv + argc + 1);
+ unsigned *v;
+ soinfo *si;
+ struct link_map * map;
+ const char *ldpath_env = NULL;
+ const char *ldpreload_env = NULL;
+
+ /* NOTE: we store the elfdata pointer on a special location
+ * of the temporary TLS area in order to pass it to
+ * the C Library's runtime initializer.
+ *
+ * The initializer must clear the slot and reset the TLS
+ * to point to a different location to ensure that no other
+ * shared library constructor can access it.
+ */
+#if 0
+ __libc_init_tls(elfdata);
+#endif
+
+ pid = getpid();
+
+#if TIMING
+ struct timeval t0, t1;
+ gettimeofday(&t0, 0);
+#endif
+
+ /* Initialize environment functions, and get to the ELF aux vectors table */
+ vecs = linker_env_init(vecs);
+
+ /* Check auxv for AT_SECURE first to see if program is setuid, setgid,
+ has file caps, or caused a SELinux/AppArmor domain transition. */
+ for (v = vecs; v[0]; v += 2) {
+ if (v[0] == AT_SECURE) {
+ /* kernel told us whether to enable secure mode */
+ program_is_setuid = v[1];
+ goto sanitize;
+ }
+ }
+
+ /* Kernel did not provide AT_SECURE - fall back on legacy test. */
+ program_is_setuid = (getuid() != geteuid()) || (getgid() != getegid());
+
+sanitize:
+ /* Sanitize environment if we're loading a setuid program */
+ if (program_is_setuid)
+ linker_env_secure();
+
+#if 0
+ debugger_init();
+#endif
+
+ /* Get a few environment variables */
+ {
+#if LINKER_DEBUG
+ const char* env;
+ env = linker_env_get("DEBUG"); /* XXX: TODO: Change to LD_DEBUG */
+ if (env)
+ debug_verbosity = atoi(env);
+#endif
+
+ /* Normally, these are cleaned by linker_env_secure, but the test
+ * against program_is_setuid doesn't cost us anything */
+ if (!program_is_setuid) {
+ ldpath_env = getenv("LD_LIBRARY_PATH");
+ ldpreload_env = getenv("LD_PRELOAD");
+ }
+ }
+
+ INFO("[ android linker & debugger ]\n");
+ DEBUG("%5d elfdata @ 0x%08x\n", pid, (unsigned)elfdata);
+
+ si = alloc_info(argv[0]);
+ if(si == 0) {
+ exit(-1);
+ }
+
+ /* bootstrap the link map, the main exe always needs to be first */
+ si->flags |= FLAG_EXE;
+ map = &(si->linkmap);
+
+ map->l_addr = 0;
+ map->l_name = argv[0];
+ map->l_prev = NULL;
+ map->l_next = NULL;
+
+ _r_debug.r_map = map;
+ r_debug_tail = map;
+
+ /* gdb expects the linker to be in the debug shared object list,
+ * and we need to make sure that the reported load address is zero.
+ * Without this, gdb gets the wrong idea of where rtld_db_dlactivity()
+ * is. Don't use alloc_info(), because the linker shouldn't
+ * be on the soinfo list.
+ */
+ strlcpy((char*) linker_soinfo.name, "/system/bin/linker", sizeof linker_soinfo.name);
+ linker_soinfo.flags = 0;
+ linker_soinfo.base = 0; // This is the important part; must be zero.
+ insert_soinfo_into_debug_map(&linker_soinfo);
+
+ /* extract information passed from the kernel */
+ while(vecs[0] != 0){
+ switch(vecs[0]){
+ case AT_PHDR:
+ si->phdr = (Elf32_Phdr*) vecs[1];
+ break;
+ case AT_PHNUM:
+ si->phnum = (int) vecs[1];
+ break;
+ case AT_ENTRY:
+ si->entry = vecs[1];
+ break;
+ }
+ vecs += 2;
+ }
+
+ /* Compute the value of si->base. We can't rely on the fact that
+ * the first entry is the PHDR because this will not be true
+ * for certain executables (e.g. some in the NDK unit test suite)
+ */
+ int nn;
+ si->base = 0;
+ for ( nn = 0; nn < si->phnum; nn++ ) {
+ if (si->phdr[nn].p_type == PT_PHDR) {
+ si->base = (Elf32_Addr) si->phdr - si->phdr[nn].p_vaddr;
+ break;
+ }
+ }
+ si->dynamic = (unsigned *)-1;
+ si->wrprotect_start = 0xffffffff;
+ si->wrprotect_end = 0;
+ si->refcount = 1;
+ si->gnu_relro_start = 0;
+ si->gnu_relro_len = 0;
+
+ /* Use LD_LIBRARY_PATH if we aren't setuid/setgid */
+ if (ldpath_env)
+ parse_library_path(ldpath_env, ":");
+
+ if (ldpreload_env) {
+ parse_preloads(ldpreload_env, " :");
+ }
+
+ if(link_image(si, 0)) {
+ char errmsg[] = "CANNOT LINK EXECUTABLE\n";
+ write(2, __linker_dl_err_buf, strlen(__linker_dl_err_buf));
+ write(2, errmsg, sizeof(errmsg));
+ exit(-1);
+ }
+
+ call_constructors_recursive(si);
+
+#if ALLOW_SYMBOLS_FROM_MAIN
+ /* Set somain after we've loaded all the libraries in order to prevent
+ * linking of symbols back to the main image, which is not set up at that
+ * point yet.
+ */
+ somain = si;
+#endif
+
+#if TIMING
+ gettimeofday(&t1,NULL);
+ PRINT("LINKER TIME: %s: %d microseconds\n", argv[0], (int) (
+ (((long long)t1.tv_sec * 1000000LL) + (long long)t1.tv_usec) -
+ (((long long)t0.tv_sec * 1000000LL) + (long long)t0.tv_usec)
+ ));
+#endif
+#if STATS
+ PRINT("RELO STATS: %s: %d abs, %d rel, %d copy, %d symbol\n", argv[0],
+ linker_stats.reloc[RELOC_ABSOLUTE],
+ linker_stats.reloc[RELOC_RELATIVE],
+ linker_stats.reloc[RELOC_COPY],
+ linker_stats.reloc[RELOC_SYMBOL]);
+#endif
+#if COUNT_PAGES
+ {
+ unsigned n;
+ unsigned i;
+ unsigned count = 0;
+ for(n = 0; n < 4096; n++){
+ if(bitmask[n]){
+ unsigned x = bitmask[n];
+ for(i = 0; i < 8; i++){
+ if(x & 1) count++;
+ x >>= 1;
+ }
+ }
+ }
+ PRINT("PAGES MODIFIED: %s: %d (%dKB)\n", argv[0], count, count * 4);
+ }
+#endif
+
+#if TIMING || STATS || COUNT_PAGES
+ fflush(stdout);
+#endif
+
+ TRACE("[ %5d Ready to execute '%s' @ 0x%08x ]\n", pid, si->name,
+ si->entry);
+ return si->entry;
+}
+
+/*
+ * Find the value of AT_BASE passed to us by the kernel. This is the load
+ * location of the linker.
+ */
+static unsigned find_linker_base(unsigned **elfdata) {
+ int argc = (int) *elfdata;
+ char **argv = (char**) (elfdata + 1);
+ unsigned *vecs = (unsigned*) (argv + argc + 1);
+ while (vecs[0] != 0) {
+ vecs++;
+ }
+
+ /* The end of the environment block is marked by two NULL pointers */
+ vecs++;
+
+ while(vecs[0]) {
+ if (vecs[0] == AT_BASE) {
+ return vecs[1];
+ }
+ vecs += 2;
+ }
+
+ return 0; // should never happen
+}
+
+/*
+ * This is the entry point for the linker, called from begin.S. This
+ * method is responsible for fixing the linker's own relocations, and
+ * then calling __linker_init_post_relocation().
+ *
+ * Because this method is called before the linker has fixed it's own
+ * relocations, any attempt to reference an extern variable, extern
+ * function, or other GOT reference will generate a segfault.
+ */
+unsigned __linker_init(unsigned **elfdata) {
+ unsigned linker_addr = find_linker_base(elfdata);
+ Elf32_Ehdr *elf_hdr = (Elf32_Ehdr *) linker_addr;
+ Elf32_Phdr *phdr =
+ (Elf32_Phdr *)((unsigned char *) linker_addr + elf_hdr->e_phoff);
+
+ soinfo linker_so;
+ memset(&linker_so, 0, sizeof(soinfo));
+
+ linker_so.base = linker_addr;
+ linker_so.dynamic = (unsigned *) -1;
+ linker_so.phdr = phdr;
+ linker_so.phnum = elf_hdr->e_phnum;
+ linker_so.flags |= FLAG_LINKER;
+ linker_so.wrprotect_start = 0xffffffff;
+ linker_so.wrprotect_end = 0;
+ linker_so.gnu_relro_start = 0;
+ linker_so.gnu_relro_len = 0;
+
+ if (link_image(&linker_so, 0)) {
+ // It would be nice to print an error message, but if the linker
+ // can't link itself, there's no guarantee that we'll be able to
+ // call write() (because it involves a GOT reference).
+ //
+ // This situation should never occur unless the linker itself
+ // is corrupt.
+ exit(-1);
+ }
+
+ // We have successfully fixed our own relocations. It's safe to run
+ // the main part of the linker now.
+ return __linker_init_post_relocation(elfdata);
+}
--- /dev/null
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _LINKER_H_
+#define _LINKER_H_
+
+#include <unistd.h>
+#include <sys/types.h>
+#include <elf.h>
+
+#undef PAGE_MASK
+#undef PAGE_SIZE
+#define PAGE_SIZE 4096
+#define PAGE_MASK 4095
+
+void debugger_init();
+const char *addr_to_name(unsigned addr);
+
+/* magic shared structures that GDB knows about */
+
+struct link_map
+{
+ uintptr_t l_addr;
+ char * l_name;
+ uintptr_t l_ld;
+ struct link_map * l_next;
+ struct link_map * l_prev;
+};
+
+/* needed for dl_iterate_phdr to be passed to the callbacks provided */
+struct dl_phdr_info
+{
+ Elf32_Addr dlpi_addr;
+ const char *dlpi_name;
+ const Elf32_Phdr *dlpi_phdr;
+ Elf32_Half dlpi_phnum;
+};
+
+
+// Values for r_debug->state
+enum {
+ RT_CONSISTENT,
+ RT_ADD,
+ RT_DELETE
+};
+
+struct r_debug
+{
+ int32_t r_version;
+ struct link_map * r_map;
+ void (*r_brk)(void);
+ int32_t r_state;
+ uintptr_t r_ldbase;
+};
+
+typedef struct soinfo soinfo;
+
+#define FLAG_LINKED 0x00000001
+#define FLAG_ERROR 0x00000002
+#define FLAG_EXE 0x00000004 // The main executable
+#define FLAG_LINKER 0x00000010 // The linker itself
+
+#define SOINFO_NAME_LEN 128
+
+struct soinfo
+{
+ const char name[SOINFO_NAME_LEN];
+ Elf32_Phdr *phdr;
+ int phnum;
+ unsigned entry;
+ unsigned base;
+ unsigned size;
+
+ int unused; // DO NOT USE, maintained for compatibility.
+
+ unsigned *dynamic;
+
+ unsigned wrprotect_start;
+ unsigned wrprotect_end;
+
+ soinfo *next;
+ unsigned flags;
+
+ const char *strtab;
+ Elf32_Sym *symtab;
+
+ unsigned nbucket;
+ unsigned nchain;
+ unsigned *bucket;
+ unsigned *chain;
+
+ unsigned *plt_got;
+
+ Elf32_Rel *plt_rel;
+ unsigned plt_rel_count;
+
+ Elf32_Rel *rel;
+ unsigned rel_count;
+
+ unsigned *preinit_array;
+ unsigned preinit_array_count;
+
+ unsigned *init_array;
+ unsigned init_array_count;
+ unsigned *fini_array;
+ unsigned fini_array_count;
+
+ void (*init_func)(void);
+ void (*fini_func)(void);
+
+#ifdef ANDROID_ARM_LINKER
+ /* ARM EABI section used for stack unwinding. */
+ unsigned *ARM_exidx;
+ unsigned ARM_exidx_count;
+#endif
+
+ unsigned refcount;
+ struct link_map linkmap;
+
+ int constructors_called;
+
+ Elf32_Addr gnu_relro_start;
+ unsigned gnu_relro_len;
+
+};
+
+
+extern soinfo libdl_info;
+
+#ifdef ANDROID_ARM_LINKER
+
+#define R_ARM_COPY 20
+#define R_ARM_GLOB_DAT 21
+#define R_ARM_JUMP_SLOT 22
+#define R_ARM_RELATIVE 23
+
+/* According to the AAPCS specification, we only
+ * need the above relocations. However, in practice,
+ * the following ones turn up from time to time.
+ */
+#define R_ARM_ABS32 2
+#define R_ARM_REL32 3
+
+#elif defined(ANDROID_X86_LINKER)
+
+#define R_386_32 1
+#define R_386_PC32 2
+#define R_386_GLOB_DAT 6
+#define R_386_JUMP_SLOT 7
+#define R_386_RELATIVE 8
+
+#endif
+
+#ifndef DT_INIT_ARRAY
+#define DT_INIT_ARRAY 25
+#endif
+
+#ifndef DT_FINI_ARRAY
+#define DT_FINI_ARRAY 26
+#endif
+
+#ifndef DT_INIT_ARRAYSZ
+#define DT_INIT_ARRAYSZ 27
+#endif
+
+#ifndef DT_FINI_ARRAYSZ
+#define DT_FINI_ARRAYSZ 28
+#endif
+
+#ifndef DT_PREINIT_ARRAY
+#define DT_PREINIT_ARRAY 32
+#endif
+
+#ifndef DT_PREINIT_ARRAYSZ
+#define DT_PREINIT_ARRAYSZ 33
+#endif
+
+soinfo *find_library(const char *name);
+unsigned unload_library(soinfo *si);
+Elf32_Sym *lookup_in_library(soinfo *si, const char *name);
+Elf32_Sym *lookup(const char *name, soinfo **found, soinfo *start);
+soinfo *find_containing_library(const void *addr);
+Elf32_Sym *find_containing_symbol(const void *addr, soinfo *si);
+const char *linker_get_error(void);
+void call_constructors_recursive(soinfo *si);
+
+#ifdef ANDROID_ARM_LINKER
+typedef long unsigned int *_Unwind_Ptr;
+_Unwind_Ptr dl_unwind_find_exidx(_Unwind_Ptr pc, int *pcount);
+#elif defined(ANDROID_X86_LINKER)
+int dl_iterate_phdr(int (*cb)(struct dl_phdr_info *, size_t, void *), void *);
+#endif
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008-2010 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _LINKER_DEBUG_H_
+#define _LINKER_DEBUG_H_
+
+#include <stdio.h>
+
+#ifndef LINKER_DEBUG
+#error LINKER_DEBUG should be defined to either 1 or 0 in Android.mk
+#endif
+
+/* set LINKER_DEBUG_TO_LOG to 1 to send the logs to logcat,
+ * or 0 to use stdout instead.
+ */
+#define LINKER_DEBUG_TO_LOG 0
+#define TRACE_DEBUG 1
+#define DO_TRACE_LOOKUP 1
+#define DO_TRACE_RELO 1
+#define TIMING 0
+#define STATS 0
+#define COUNT_PAGES 0
+
+/*********************************************************************
+ * You shouldn't need to modify anything below unless you are adding
+ * more debugging information.
+ *
+ * To enable/disable specific debug options, change the defines above
+ *********************************************************************/
+
+
+/*********************************************************************/
+#undef TRUE
+#undef FALSE
+#define TRUE 1
+#define FALSE 0
+
+/* Only use printf() during debugging. We have seen occasional memory
+ * corruption when the linker uses printf().
+ */
+#if LINKER_DEBUG
+#include "linker_format.h"
+extern int debug_verbosity;
+#if LINKER_DEBUG_TO_LOG
+extern int format_log(int, const char *, const char *, ...);
+#define _PRINTVF(v,f,x...) \
+ do { \
+ if (debug_verbosity > (v)) format_log(5-(v),"linker",x); \
+ } while (0)
+#else /* !LINKER_DEBUG_TO_LOG */
+extern int format_fd(int, const char *, ...);
+#define _PRINTVF(v,f,x...) \
+ do { \
+ if (debug_verbosity > (v)) format_fd(1, x); \
+ } while (0)
+#endif /* !LINKER_DEBUG_TO_LOG */
+#else /* !LINKER_DEBUG */
+#define _PRINTVF(v,f,x...) do {} while(0)
+#endif /* LINKER_DEBUG */
+
+#define PRINT(x...) _PRINTVF(-1, FALSE, x)
+#define INFO(x...) _PRINTVF(1, TRUE, x)
+#define TRACE(x...) _PRINTVF(1, TRUE, x)
+#define WARN(fmt,args...) \
+ _PRINTVF(-1, TRUE, "%s:%d| WARNING: " fmt, __FILE__, __LINE__, ## args)
+#define ERROR(fmt,args...) \
+ _PRINTVF(-1, TRUE, "%s:%d| ERROR: " fmt, __FILE__, __LINE__, ## args)
+
+
+#if TRACE_DEBUG
+#define DEBUG(x...) _PRINTVF(2, TRUE, "DEBUG: " x)
+#else /* !TRACE_DEBUG */
+#define DEBUG(x...) do {} while (0)
+#endif /* TRACE_DEBUG */
+
+#if LINKER_DEBUG
+#define TRACE_TYPE(t,x...) do { if (DO_TRACE_##t) { TRACE(x); } } while (0)
+#else /* !LINKER_DEBUG */
+#define TRACE_TYPE(t,x...) do {} while (0)
+#endif /* LINKER_DEBUG */
+
+#if STATS
+#define RELOC_ABSOLUTE 0
+#define RELOC_RELATIVE 1
+#define RELOC_COPY 2
+#define RELOC_SYMBOL 3
+#define NUM_RELOC_STATS 4
+
+struct _link_stats {
+ int reloc[NUM_RELOC_STATS];
+};
+extern struct _link_stats linker_stats;
+
+#define COUNT_RELOC(type) \
+ do { if (type >= 0 && type < NUM_RELOC_STATS) { \
+ linker_stats.reloc[type] += 1; \
+ } else { \
+ PRINT("Unknown reloc stat requested\n"); \
+ } \
+ } while(0)
+#else /* !STATS */
+#define COUNT_RELOC(type) do {} while(0)
+#endif /* STATS */
+
+#if TIMING
+#undef WARN
+#define WARN(x...) do {} while (0)
+#endif /* TIMING */
+
+#if COUNT_PAGES
+extern unsigned bitmask[];
+#define MARK(offset) do { \
+ bitmask[((offset) >> 12) >> 3] |= (1 << (((offset) >> 12) & 7)); \
+ } while(0)
+#else
+#define MARK(x) do {} while (0)
+#endif
+
+#define DEBUG_DUMP_PHDR(phdr, name, pid) do { \
+ DEBUG("%5d %s (phdr = 0x%08x)\n", (pid), (name), (unsigned)(phdr)); \
+ DEBUG("\t\tphdr->offset = 0x%08x\n", (unsigned)((phdr)->p_offset)); \
+ DEBUG("\t\tphdr->p_vaddr = 0x%08x\n", (unsigned)((phdr)->p_vaddr)); \
+ DEBUG("\t\tphdr->p_paddr = 0x%08x\n", (unsigned)((phdr)->p_paddr)); \
+ DEBUG("\t\tphdr->p_filesz = 0x%08x\n", (unsigned)((phdr)->p_filesz)); \
+ DEBUG("\t\tphdr->p_memsz = 0x%08x\n", (unsigned)((phdr)->p_memsz)); \
+ DEBUG("\t\tphdr->p_flags = 0x%08x\n", (unsigned)((phdr)->p_flags)); \
+ DEBUG("\t\tphdr->p_align = 0x%08x\n", (unsigned)((phdr)->p_align)); \
+ } while (0)
+
+#endif /* _LINKER_DEBUG_H_ */
--- /dev/null
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#include "linker_environ.h"
+#include <stddef.h>
+
+static char** _envp;
+
+/* Returns 1 if 'str' points to a valid environment variable definition.
+ * For now, we check that:
+ * - It is smaller than MAX_ENV_LEN (to detect non-zero terminated strings)
+ * - It contains at least one equal sign that is not the first character
+ */
+static int
+_is_valid_definition(const char* str)
+{
+ int pos = 0;
+ int first_equal_pos = -1;
+
+ /* According to its sources, the kernel uses 32*PAGE_SIZE by default
+ * as the maximum size for an env. variable definition.
+ */
+ const int MAX_ENV_LEN = 32*4096;
+
+ if (str == NULL)
+ return 0;
+
+ /* Parse the string, looking for the first '=' there, and its size */
+ do {
+ if (str[pos] == '\0')
+ break;
+ if (str[pos] == '=' && first_equal_pos < 0)
+ first_equal_pos = pos;
+ pos++;
+ } while (pos < MAX_ENV_LEN);
+
+ if (pos >= MAX_ENV_LEN) /* Too large */
+ return 0;
+
+ if (first_equal_pos < 1) /* No equal sign, or it is the first character */
+ return 0;
+
+ return 1;
+}
+
+unsigned*
+linker_env_init(unsigned* vecs)
+{
+ /* Store environment pointer - can't be NULL */
+ _envp = (char**) vecs;
+
+ /* Skip over all definitions */
+ while (vecs[0] != 0)
+ vecs++;
+ /* The end of the environment block is marked by two NULL pointers */
+ vecs++;
+
+ /* As a sanity check, we're going to remove all invalid variable
+ * definitions from the environment array.
+ */
+ {
+ char** readp = _envp;
+ char** writep = _envp;
+ for ( ; readp[0] != NULL; readp++ ) {
+ if (!_is_valid_definition(readp[0]))
+ continue;
+ writep[0] = readp[0];
+ writep++;
+ }
+ writep[0] = NULL;
+ }
+
+ /* Return the address of the aux vectors table */
+ return vecs;
+}
+
+/* Check if the environment variable definition at 'envstr'
+ * starts with '<name>=', and if so return the address of the
+ * first character after the equal sign. Otherwise return NULL.
+ */
+static char*
+env_match(char* envstr, const char* name)
+{
+ size_t cnt = 0;
+
+ while (envstr[cnt] == name[cnt] && name[cnt] != '\0')
+ cnt++;
+
+ if (name[cnt] == '\0' && envstr[cnt] == '=')
+ return envstr + cnt + 1;
+
+ return NULL;
+}
+
+#define MAX_ENV_LEN (16*4096)
+
+const char*
+linker_env_get(const char* name)
+{
+ char** readp = _envp;
+
+ if (name == NULL || name[0] == '\0')
+ return NULL;
+
+ for ( ; readp[0] != NULL; readp++ ) {
+ char* val = env_match(readp[0], name);
+ if (val != NULL) {
+ /* Return NULL for empty strings, or if it is too large */
+ if (val[0] == '\0')
+ val = NULL;
+ return val;
+ }
+ }
+ return NULL;
+}
+
+
+void
+linker_env_unset(const char* name)
+{
+ char** readp = _envp;
+ char** writep = readp;
+
+ if (name == NULL || name[0] == '\0')
+ return;
+
+ for ( ; readp[0] != NULL; readp++ ) {
+ if (env_match(readp[0], name))
+ continue;
+ writep[0] = readp[0];
+ writep++;
+ }
+ /* end list with a NULL */
+ writep[0] = NULL;
+}
+
+
+
+/* Remove unsafe environment variables. This should be used when
+ * running setuid programs. */
+void
+linker_env_secure(void)
+{
+ /* The same list than GLibc at this point */
+ static const char* const unsec_vars[] = {
+ "GCONV_PATH",
+ "GETCONF_DIR",
+ "HOSTALIASES",
+ "LD_AUDIT",
+ "LD_DEBUG",
+ "LD_DEBUG_OUTPUT",
+ "LD_DYNAMIC_WEAK",
+ "LD_LIBRARY_PATH",
+ "LD_ORIGIN_PATH",
+ "LD_PRELOAD",
+ "LD_PROFILE",
+ "LD_SHOW_AUXV",
+ "LD_USE_LOAD_BIAS",
+ "LOCALDOMAIN",
+ "LOCPATH",
+ "MALLOC_TRACE",
+ "MALLOC_CHECK_",
+ "NIS_PATH",
+ "NLSPATH",
+ "RESOLV_HOST_CONF",
+ "RES_OPTIONS",
+ "TMPDIR",
+ "TZDIR",
+ "LD_AOUT_LIBRARY_PATH",
+ "LD_AOUT_PRELOAD",
+ };
+
+ const char* const* cp = unsec_vars;
+ const char* const* endp = cp + sizeof(unsec_vars)/sizeof(unsec_vars[0]);
+
+ while (cp < endp) {
+ linker_env_unset(*cp);
+ cp++;
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef LINKER_ENVIRON_H
+#define LINKER_ENVIRON_H
+
+/* Call this function before anything else. 'vecs' must be the pointer
+ * to the environment block in the ELF data block. The function returns
+ * the start of the aux vectors after the env block.
+ */
+extern unsigned* linker_env_init(unsigned* vecs);
+
+/* Unset a given environment variable. In case the variable is defined
+ * multiple times, unset all instances. This modifies the environment
+ * block, so any pointer returned by linker_env_get() after this call
+ * might become invalid */
+extern void linker_env_unset(const char* name);
+
+
+/* Returns the value of environment variable 'name' if defined and not
+ * empty, or NULL otherwise. Note that the returned pointer may become
+ * invalid if linker_env_unset() or linker_env_secure() are called
+ * after this function. */
+extern const char* linker_env_get(const char* name);
+
+/* Remove unsecure environment variables. This should be used when
+ * running setuid programs. */
+extern void linker_env_secure(void);
+
+#endif /* LINKER_ENVIRON_H */
--- /dev/null
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <stdarg.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <stddef.h>
+#include "linker_format.h"
+#include "linker_debug.h"
+
+/* define UNIT_TESTS to build this file as a single executable that runs
+ * the formatter's unit tests
+ */
+#define xxUNIT_TESTS
+
+/*** Generic output sink
+ ***/
+
+typedef struct {
+ void *opaque;
+ void (*send)(void *opaque, const char *data, int len);
+} Out;
+
+static void
+out_send(Out *o, const void *data, size_t len)
+{
+ o->send(o->opaque, data, (int)len);
+}
+
+static void
+out_send_repeat(Out *o, char ch, int count)
+{
+ char pad[8];
+ const int padSize = (int)sizeof(pad);
+
+ memset(pad, ch, sizeof(pad));
+ while (count > 0) {
+ int avail = count;
+ if (avail > padSize) {
+ avail = padSize;
+ }
+ o->send(o->opaque, pad, avail);
+ count -= avail;
+ }
+}
+
+/* forward declaration */
+static void
+out_vformat(Out *o, const char *format, va_list args);
+
+/*** Bounded buffer output
+ ***/
+
+typedef struct {
+ Out out[1];
+ char *buffer;
+ char *pos;
+ char *end;
+ int total;
+} BufOut;
+
+static void
+buf_out_send(void *opaque, const char *data, int len)
+{
+ BufOut *bo = opaque;
+
+ if (len < 0)
+ len = strlen(data);
+
+ bo->total += len;
+
+ while (len > 0) {
+ int avail = bo->end - bo->pos;
+ if (avail == 0)
+ break;
+ if (avail > len)
+ avail = len;
+ memcpy(bo->pos, data, avail);
+ bo->pos += avail;
+ bo->pos[0] = '\0';
+ len -= avail;
+ }
+}
+
+static Out*
+buf_out_init(BufOut *bo, char *buffer, size_t size)
+{
+ if (size == 0)
+ return NULL;
+
+ bo->out->opaque = bo;
+ bo->out->send = buf_out_send;
+ bo->buffer = buffer;
+ bo->end = buffer + size - 1;
+ bo->pos = bo->buffer;
+ bo->pos[0] = '\0';
+ bo->total = 0;
+
+ return bo->out;
+}
+
+static int
+buf_out_length(BufOut *bo)
+{
+ return bo->total;
+}
+
+static int
+vformat_buffer(char *buff, size_t buffsize, const char *format, va_list args)
+{
+ BufOut bo;
+ Out *out;
+
+ out = buf_out_init(&bo, buff, buffsize);
+ if (out == NULL)
+ return 0;
+
+ out_vformat(out, format, args);
+
+ return buf_out_length(&bo);
+}
+
+int
+format_buffer(char *buff, size_t buffsize, const char *format, ...)
+{
+ va_list args;
+ int ret;
+
+ va_start(args, format);
+ ret = vformat_buffer(buff, buffsize, format, args);
+ va_end(args);
+
+ return ret;
+}
+
+/* The __stack_chk_fail() function calls __libc_android_log_print()
+ * which calls vsnprintf().
+ *
+ * We define our version of the function here to avoid dragging
+ * about 25 KB of C library routines related to formatting.
+ */
+#if 0
+int
+vsnprintf(char *buff, size_t bufsize, const char *format, va_list args)
+{
+ return format_buffer(buff, bufsize, format, args);
+}
+#endif
+
+#if LINKER_DEBUG
+
+#if !LINKER_DEBUG_TO_LOG
+
+/*** File descriptor output
+ ***/
+
+typedef struct {
+ Out out[1];
+ int fd;
+ int total;
+} FdOut;
+
+static void
+fd_out_send(void *opaque, const char *data, int len)
+{
+ FdOut *fdo = opaque;
+
+ if (len < 0)
+ len = strlen(data);
+
+ while (len > 0) {
+ int ret = write(fdo->fd, data, len);
+ if (ret < 0) {
+ if (errno == EINTR)
+ continue;
+ break;
+ }
+ data += ret;
+ len -= ret;
+ fdo->total += ret;
+ }
+}
+
+static Out*
+fd_out_init(FdOut *fdo, int fd)
+{
+ fdo->out->opaque = fdo;
+ fdo->out->send = fd_out_send;
+ fdo->fd = fd;
+ fdo->total = 0;
+
+ return fdo->out;
+}
+
+static int
+fd_out_length(FdOut *fdo)
+{
+ return fdo->total;
+}
+
+
+int
+format_fd(int fd, const char *format, ...)
+{
+ FdOut fdo;
+ Out* out;
+ va_list args;
+
+ out = fd_out_init(&fdo, fd);
+ if (out == NULL)
+ return 0;
+
+ va_start(args, format);
+ out_vformat(out, format, args);
+ va_end(args);
+
+ return fd_out_length(&fdo);
+}
+
+#else /* LINKER_DEBUG_TO_LOG */
+
+/*** Log output
+ ***/
+
+/* We need our own version of __libc_android_log_vprint, otherwise
+ * the log output is completely broken. Probably due to the fact
+ * that the C library is not initialized yet.
+ *
+ * You can test that by setting CUSTOM_LOG_VPRINT to 0
+ */
+#define CUSTOM_LOG_VPRINT 1
+
+#if CUSTOM_LOG_VPRINT
+
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/uio.h>
+
+static int log_vprint(int prio, const char *tag, const char *fmt, va_list args)
+{
+ char buf[1024];
+ int result;
+ static int log_fd = -1;
+
+ result = vformat_buffer(buf, sizeof buf, fmt, args);
+
+ if (log_fd < 0) {
+ log_fd = open("/dev/log/main", O_WRONLY);
+ if (log_fd < 0)
+ return result;
+ }
+
+ {
+ ssize_t ret;
+ struct iovec vec[3];
+
+ vec[0].iov_base = (unsigned char *) &prio;
+ vec[0].iov_len = 1;
+ vec[1].iov_base = (void *) tag;
+ vec[1].iov_len = strlen(tag) + 1;
+ vec[2].iov_base = (void *) buf;
+ vec[2].iov_len = strlen(buf) + 1;
+
+ do {
+ ret = writev(log_fd, vec, 3);
+ } while ((ret < 0) && (errno == EINTR));
+ }
+ return result;
+}
+
+#define __libc_android_log_vprint log_vprint
+
+#else /* !CUSTOM_LOG_VPRINT */
+
+extern int __libc_android_log_vprint(int prio, const char* tag, const char* format, va_list ap);
+
+#endif /* !CUSTOM_LOG_VPRINT */
+
+int
+format_log(int prio, const char *tag, const char *format, ...)
+{
+ int ret;
+ va_list args;
+ va_start(args, format);
+ ret = __libc_android_log_vprint(prio, tag, format, args);
+ va_end(args);
+ return ret;
+}
+
+#endif /* LINKER_DEBUG_TO_LOG */
+
+#endif /* LINKER_DEBUG */
+
+/*** formatted output implementation
+ ***/
+
+/* Parse a decimal string from 'format + *ppos',
+ * return the value, and writes the new position past
+ * the decimal string in '*ppos' on exit.
+ *
+ * NOTE: Does *not* handle a sign prefix.
+ */
+static unsigned
+parse_decimal(const char *format, int *ppos)
+{
+ const char* p = format + *ppos;
+ unsigned result = 0;
+
+ for (;;) {
+ int ch = *p;
+ unsigned d = (unsigned)(ch - '0');
+
+ if (d >= 10U)
+ break;
+
+ result = result*10 + d;
+ p++;
+ }
+ *ppos = p - format;
+ return result;
+}
+
+/* write an octal/decimal/number into a bounded buffer.
+ * assumes that bufsize > 0, and 'digits' is a string of
+ * digits of at least 'base' values.
+ */
+static void
+format_number(char *buffer, size_t bufsize, uint64_t value, int base, const char *digits)
+{
+ char *pos = buffer;
+ char *end = buffer + bufsize - 1;
+
+ /* generate digit string in reverse order */
+ while (value) {
+ unsigned d = value % base;
+ value /= base;
+ if (pos < end) {
+ *pos++ = digits[d];
+ }
+ }
+
+ /* special case for 0 */
+ if (pos == buffer) {
+ if (pos < end) {
+ *pos++ = '0';
+ }
+ }
+ pos[0] = '\0';
+
+ /* now reverse digit string in-place */
+ end = pos - 1;
+ pos = buffer;
+ while (pos < end) {
+ int ch = pos[0];
+ pos[0] = end[0];
+ end[0] = (char) ch;
+ pos++;
+ end--;
+ }
+}
+
+/* Write an integer (octal or decimal) into a buffer, assumes buffsize > 2 */
+static void
+format_integer(char *buffer, size_t buffsize, uint64_t value, int base, int isSigned)
+{
+ if (isSigned && (int64_t)value < 0) {
+ buffer[0] = '-';
+ buffer += 1;
+ buffsize -= 1;
+ value = (uint64_t)(-(int64_t)value);
+ }
+
+ format_number(buffer, buffsize, value, base, "0123456789");
+}
+
+/* Write an octal into a buffer, assumes buffsize > 2 */
+static void
+format_octal(char *buffer, size_t buffsize, uint64_t value, int isSigned)
+{
+ format_integer(buffer, buffsize, value, 8, isSigned);
+}
+
+/* Write a decimal into a buffer, assumes buffsize > 2 */
+static void
+format_decimal(char *buffer, size_t buffsize, uint64_t value, int isSigned)
+{
+ format_integer(buffer, buffsize, value, 10, isSigned);
+}
+
+/* Write an hexadecimal into a buffer, isCap is true for capital alphas.
+ * Assumes bufsize > 2 */
+static void
+format_hex(char *buffer, size_t buffsize, uint64_t value, int isCap)
+{
+ const char *digits = isCap ? "0123456789ABCDEF" : "0123456789abcdef";
+
+ format_number(buffer, buffsize, value, 16, digits);
+}
+
+
+/* Perform formatted output to an output target 'o' */
+static void
+out_vformat(Out *o, const char *format, va_list args)
+{
+ int nn = 0;
+
+ for (;;) {
+ int mm;
+ int padZero = 0;
+ int padLeft = 0;
+ char sign = '\0';
+ int width = -1;
+ int prec = -1;
+ size_t bytelen = sizeof(int);
+ const char* str;
+ int slen;
+ char buffer[32]; /* temporary buffer used to format numbers */
+
+ char c;
+
+ /* first, find all characters that are not 0 or '%' */
+ /* then send them to the output directly */
+ mm = nn;
+ do {
+ c = format[mm];
+ if (c == '\0' || c == '%')
+ break;
+ mm++;
+ } while (1);
+
+ if (mm > nn) {
+ out_send(o, format+nn, mm-nn);
+ nn = mm;
+ }
+
+ /* is this it ? then exit */
+ if (c == '\0')
+ break;
+
+ /* nope, we are at a '%' modifier */
+ nn++; // skip it
+
+ /* parse flags */
+ for (;;) {
+ c = format[nn++];
+ if (c == '\0') { /* single trailing '%' ? */
+ c = '%';
+ out_send(o, &c, 1);
+ return;
+ }
+ else if (c == '0') {
+ padZero = 1;
+ continue;
+ }
+ else if (c == '-') {
+ padLeft = 1;
+ continue;
+ }
+ else if (c == ' ' || c == '+') {
+ sign = c;
+ continue;
+ }
+ break;
+ }
+
+ /* parse field width */
+ if ((c >= '0' && c <= '9')) {
+ nn --;
+ width = (int)parse_decimal(format, &nn);
+ c = format[nn++];
+ }
+
+ /* parse precision */
+ if (c == '.') {
+ prec = (int)parse_decimal(format, &nn);
+ c = format[nn++];
+ }
+
+ /* length modifier */
+ switch (c) {
+ case 'h':
+ bytelen = sizeof(short);
+ if (format[nn] == 'h') {
+ bytelen = sizeof(char);
+ nn += 1;
+ }
+ c = format[nn++];
+ break;
+ case 'l':
+ bytelen = sizeof(long);
+ if (format[nn] == 'l') {
+ bytelen = sizeof(long long);
+ nn += 1;
+ }
+ c = format[nn++];
+ break;
+ case 'z':
+ bytelen = sizeof(size_t);
+ c = format[nn++];
+ break;
+ case 't':
+ bytelen = sizeof(ptrdiff_t);
+ c = format[nn++];
+ break;
+ default:
+ ;
+ }
+
+ /* conversion specifier */
+ if (c == 's') {
+ /* string */
+ str = va_arg(args, const char*);
+ } else if (c == 'c') {
+ /* character */
+ /* NOTE: char is promoted to int when passed through the stack */
+ buffer[0] = (char) va_arg(args, int);
+ buffer[1] = '\0';
+ str = buffer;
+ } else if (c == 'p') {
+ uint64_t value = (uintptr_t) va_arg(args, void*);
+ buffer[0] = '0';
+ buffer[1] = 'x';
+ format_hex(buffer + 2, sizeof buffer-2, value, 0);
+ str = buffer;
+ } else {
+ /* integers - first read value from stack */
+ uint64_t value;
+ int isSigned = (c == 'd' || c == 'i' || c == 'o');
+
+ /* NOTE: int8_t and int16_t are promoted to int when passed
+ * through the stack
+ */
+ switch (bytelen) {
+ case 1: value = (uint8_t) va_arg(args, int); break;
+ case 2: value = (uint16_t) va_arg(args, int); break;
+ case 4: value = va_arg(args, uint32_t); break;
+ case 8: value = va_arg(args, uint64_t); break;
+ default: return; /* should not happen */
+ }
+
+ /* sign extension, if needed */
+ if (isSigned) {
+ int shift = 64 - 8*bytelen;
+ value = (uint64_t)(((int64_t)(value << shift)) >> shift);
+ }
+
+ /* format the number properly into our buffer */
+ switch (c) {
+ case 'i': case 'd':
+ format_integer(buffer, sizeof buffer, value, 10, isSigned);
+ break;
+ case 'o':
+ format_integer(buffer, sizeof buffer, value, 8, isSigned);
+ break;
+ case 'x': case 'X':
+ format_hex(buffer, sizeof buffer, value, (c == 'X'));
+ break;
+ default:
+ buffer[0] = '\0';
+ }
+ /* then point to it */
+ str = buffer;
+ }
+
+ /* if we are here, 'str' points to the content that must be
+ * outputted. handle padding and alignment now */
+
+ slen = strlen(str);
+
+ if (slen < width && !padLeft) {
+ char padChar = padZero ? '0' : ' ';
+ out_send_repeat(o, padChar, width - slen);
+ }
+
+ out_send(o, str, slen);
+
+ if (slen < width && padLeft) {
+ char padChar = padZero ? '0' : ' ';
+ out_send_repeat(o, padChar, width - slen);
+ }
+ }
+}
+
+
+#ifdef UNIT_TESTS
+
+#include <stdio.h>
+
+static int gFails = 0;
+
+#define MARGIN 40
+
+#define UTEST_CHECK(condition,message) \
+ printf("Checking %-*s: ", MARGIN, message); fflush(stdout); \
+ if (!(condition)) { \
+ printf("KO\n"); \
+ gFails += 1; \
+ } else { \
+ printf("ok\n"); \
+ }
+
+static void
+utest_BufOut(void)
+{
+ char buffer[16];
+ BufOut bo[1];
+ Out* out;
+ int ret;
+
+ buffer[0] = '1';
+ out = buf_out_init(bo, buffer, sizeof buffer);
+ UTEST_CHECK(buffer[0] == '\0', "buf_out_init clears initial byte");
+ out_send(out, "abc", 3);
+ UTEST_CHECK(!memcmp(buffer, "abc", 4), "out_send() works with BufOut");
+ out_send_repeat(out, 'X', 4);
+ UTEST_CHECK(!memcmp(buffer, "abcXXXX", 8), "out_send_repeat() works with BufOut");
+ buffer[sizeof buffer-1] = 'x';
+ out_send_repeat(out, 'Y', 2*sizeof(buffer));
+ UTEST_CHECK(buffer[sizeof buffer-1] == '\0', "overflows always zero-terminates");
+
+ out = buf_out_init(bo, buffer, sizeof buffer);
+ out_send_repeat(out, 'X', 2*sizeof(buffer));
+ ret = buf_out_length(bo);
+ UTEST_CHECK(ret == 2*sizeof(buffer), "correct size returned on overflow");
+}
+
+static void
+utest_expect(const char* result, const char* format, ...)
+{
+ va_list args;
+ BufOut bo[1];
+ char buffer[256];
+ Out* out = buf_out_init(bo, buffer, sizeof buffer);
+
+ printf("Checking %-*s: ", MARGIN, format); fflush(stdout);
+ va_start(args, format);
+ out_vformat(out, format, args);
+ va_end(args);
+
+ if (strcmp(result, buffer)) {
+ printf("KO. got '%s' expecting '%s'\n", buffer, result);
+ gFails += 1;
+ } else {
+ printf("ok. got '%s'\n", result);
+ }
+}
+
+int main(void)
+{
+ utest_BufOut();
+ utest_expect("", "");
+ utest_expect("a", "a");
+ utest_expect("01234", "01234", "");
+ utest_expect("01234", "%s", "01234");
+ utest_expect("aabbcc", "aa%scc", "bb");
+ utest_expect("a", "%c", 'a');
+ utest_expect("1234", "%d", 1234);
+ utest_expect("-8123", "%d", -8123);
+ utest_expect("16", "%hd", 0x7fff0010);
+ utest_expect("16", "%hhd", 0x7fffff10);
+ utest_expect("68719476736", "%lld", 0x1000000000LL);
+ utest_expect("70000", "%ld", 70000);
+ utest_expect("0xb0001234", "%p", (void*)0xb0001234);
+ utest_expect("12ab", "%x", 0x12ab);
+ utest_expect("12AB", "%X", 0x12ab);
+ utest_expect("00123456", "%08x", 0x123456);
+ utest_expect("01234", "0%d", 1234);
+ utest_expect(" 1234", "%5d", 1234);
+ utest_expect("01234", "%05d", 1234);
+ utest_expect(" 1234", "%8d", 1234);
+ utest_expect("1234 ", "%-8d", 1234);
+ utest_expect("abcdef ", "%-11s", "abcdef");
+ utest_expect("something:1234", "%s:%d", "something", 1234);
+ utest_expect("005:5:05", "%03d:%d:%02d", 5, 5, 5);
+ utest_expect("5,0x0", "%d,%p", 5, NULL);
+ utest_expect("68719476736,6,7,8", "%lld,%d,%d,%d", 0x1000000000LL, 6, 7, 8);
+ return gFails != 0;
+}
+
+#endif /* UNIT_TESTS */
--- /dev/null
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _LINKER_FORMAT_H
+#define _LINKER_FORMAT_H
+
+#include <stdarg.h>
+#include <stddef.h>
+
+/* Formatting routines for the dynamic linker's debug traces */
+/* We want to avoid dragging the whole C library fprintf() */
+/* implementation into the dynamic linker since this creates */
+/* issues (it uses malloc()/free()) and increases code size */
+
+int format_buffer(char *buffer, size_t bufsize, const char *format, ...);
+
+#endif /* _LINKER_FORMAT_H */
--- /dev/null
+diff --git a/libc/bionic/__errno.c b/libc/bionic/__errno.c
+index 8f33cce..34664c6 100644
+--- a/libc/bionic/__errno.c
++++ b/libc/bionic/__errno.c
+@@ -28,7 +28,4 @@
+ #include <errno.h>
+ #include <bionic_tls.h>
+
+-volatile int* __errno( void )
+-{
+- return &((volatile int*)__get_tls())[TLS_SLOT_ERRNO];
+-}
++
+diff --git a/libc/bionic/__set_errno.c b/libc/bionic/__set_errno.c
+index c72d4f7..529a4ef 100644
+--- a/libc/bionic/__set_errno.c
++++ b/libc/bionic/__set_errno.c
+@@ -28,13 +28,6 @@
+
+ #include <errno.h>
+
+-
+-int __set_errno(int n)
+-{
+- errno = n;
+- return -1;
+-}
+-
+ /*
+ * this function is called from syscall stubs,
+ * (tail-called in the case of 0-4 arg versions)
+diff --git a/libc/bionic/pthread-rwlocks.c b/libc/bionic/pthread-rwlocks.c
+index ca3e95c..1494523 100644
+--- a/libc/bionic/pthread-rwlocks.c
++++ b/libc/bionic/pthread-rwlocks.c
+@@ -69,6 +69,8 @@ static int __get_thread_id(void)
+
+ int pthread_rwlockattr_init(pthread_rwlockattr_t *attr)
+ {
++
++ abort();
+ if (!attr)
+ return EINVAL;
+
+@@ -77,8 +79,9 @@ int pthread_rwlockattr_init(pthread_rwlockattr_t *attr)
+ }
+
+ int pthread_rwlockattr_destroy(pthread_rwlockattr_t *attr)
+-{
+- if (!attr)
++{
++ abort();
++ if (!attr)
+ return EINVAL;
+
+ *attr = -1;
+@@ -87,6 +90,7 @@ int pthread_rwlockattr_destroy(pthread_rwlockattr_t *attr)
+
+ int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *attr, int pshared)
+ {
++ abort();
+ if (!attr)
+ return EINVAL;
+
+@@ -102,6 +106,8 @@ int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *attr, int pshared)
+
+ int pthread_rwlockattr_getpshared(pthread_rwlockattr_t *attr, int *pshared)
+ {
++ abort();
++
+ if (!attr || !pshared)
+ return EINVAL;
+
+@@ -111,6 +117,7 @@ int pthread_rwlockattr_getpshared(pthread_rwlockattr_t *attr, int *pshared)
+
+ int pthread_rwlock_init(pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr)
+ {
++ abort();
+ pthread_mutexattr_t* lock_attr = NULL;
+ pthread_condattr_t* cond_attr = NULL;
+ pthread_mutexattr_t lock_attr0;
+@@ -150,6 +157,10 @@ int pthread_rwlock_init(pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *at
+
+ int pthread_rwlock_destroy(pthread_rwlock_t *rwlock)
+ {
++ abort();
++
++
++
+ int ret;
+
+ if (rwlock == NULL)
+@@ -209,11 +220,14 @@ static void _pthread_rwlock_pulse(pthread_rwlock_t *rwlock)
+
+ int pthread_rwlock_rdlock(pthread_rwlock_t *rwlock)
+ {
++ abort();
+ return pthread_rwlock_timedrdlock(rwlock, NULL);
+ }
+
+ int pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock)
+ {
++ abort();
++
+ int ret = 0;
+
+ if (rwlock == NULL)
+@@ -231,6 +245,7 @@ int pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock)
+
+ int pthread_rwlock_timedrdlock(pthread_rwlock_t *rwlock, const struct timespec *abs_timeout)
+ {
++ abort();
+ int thread_id, ret = 0;
+
+ if (rwlock == NULL)
+@@ -256,11 +271,14 @@ EXIT:
+
+ int pthread_rwlock_wrlock(pthread_rwlock_t *rwlock)
+ {
++ abort();
++
+ return pthread_rwlock_timedwrlock(rwlock, NULL);
+ }
+
+ int pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock)
+ {
++ abort();
+ int thread_id, ret = 0;
+
+ if (rwlock == NULL)
+@@ -280,6 +298,7 @@ int pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock)
+
+ int pthread_rwlock_timedwrlock(pthread_rwlock_t *rwlock, const struct timespec *abs_timeout)
+ {
++ abort();
+ int thread_id, ret = 0;
+
+ if (rwlock == NULL)
+@@ -310,6 +329,8 @@ EXIT:
+
+ int pthread_rwlock_unlock(pthread_rwlock_t *rwlock)
+ {
++ abort();
++
+ int ret = 0;
+
+ if (rwlock == NULL)
+diff --git a/libc/bionic/pthread.c b/libc/bionic/pthread.c
+index 6b01830..490c39f 100644
+--- a/libc/bionic/pthread.c
++++ b/libc/bionic/pthread.c
+@@ -177,7 +177,8 @@ __get_stack_base(int *p_stack_size)
+
+ void __init_tls(void** tls, void* thread)
+ {
+- int nn;
++ *((int *) 0) = -1;
++/* int nn;
+
+ ((pthread_internal_t*)thread)->tls = tls;
+
+@@ -188,7 +189,7 @@ void __init_tls(void** tls, void* thread)
+ for (nn = TLS_SLOT_ERRNO; nn < BIONIC_TLS_SLOTS; nn++)
+ tls[nn] = 0;
+
+- __set_tls( (void*)tls );
++ __set_tls( (void*)tls ); */
+ }
+
+
+@@ -1662,6 +1663,7 @@ static int tlsmap_alloc(tlsmap_t* m, tls_dtor_t dtor)
+
+ int pthread_key_create(pthread_key_t *key, void (*destructor_function)(void *))
+ {
++ abort();
+ uint32_t err = ENOMEM;
+ tlsmap_t* map = tlsmap_lock();
+ int k = tlsmap_alloc(map, destructor_function);
+@@ -1686,6 +1688,7 @@ int pthread_key_create(pthread_key_t *key, void (*destructor_function)(void *))
+ */
+ int pthread_key_delete(pthread_key_t key)
+ {
++ abort();
+ uint32_t err;
+ pthread_internal_t* thr;
+ tlsmap_t* map;
+@@ -1730,6 +1733,7 @@ err1:
+
+ int pthread_setspecific(pthread_key_t key, const void *ptr)
+ {
++ abort();
+ int err = EINVAL;
+ tlsmap_t* map;
+
+@@ -1747,6 +1751,7 @@ int pthread_setspecific(pthread_key_t key, const void *ptr)
+
+ void * pthread_getspecific(pthread_key_t key)
+ {
++ abort();
+ if (!TLSMAP_VALIDATE_KEY(key)) {
+ return NULL;
+ }
+@@ -1775,6 +1780,7 @@ void * pthread_getspecific(pthread_key_t key)
+ */
+ static void pthread_key_clean_all(void)
+ {
++ abort();
+ tlsmap_t* map;
+ void** tls = (void**)__get_tls();
+ int rounds = PTHREAD_DESTRUCTOR_ITERATIONS;
+@@ -1830,6 +1836,7 @@ extern int tkill(int tid, int sig);
+
+ int pthread_kill(pthread_t tid, int sig)
+ {
++ abort();
+ int ret;
+ int old_errno = errno;
+ pthread_internal_t * thread = (pthread_internal_t *)tid;
+@@ -1847,6 +1854,7 @@ extern int __rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t);
+
+ int pthread_sigmask(int how, const sigset_t *set, sigset_t *oset)
+ {
++ abort();
+ /* pthread_sigmask must return the error code, but the syscall
+ * will set errno instead and return 0/-1
+ */
+@@ -1863,6 +1871,7 @@ int pthread_sigmask(int how, const sigset_t *set, sigset_t *oset)
+
+ int pthread_getcpuclockid(pthread_t tid, clockid_t *clockid)
+ {
++ abort();
+ const int CLOCK_IDTYPE_BITS = 3;
+ pthread_internal_t* thread = (pthread_internal_t*)tid;
+
+@@ -1879,6 +1888,7 @@ int pthread_getcpuclockid(pthread_t tid, clockid_t *clockid)
+ */
+ int pthread_once( pthread_once_t* once_control, void (*init_routine)(void) )
+ {
++ abort();
+ static pthread_mutex_t once_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER;
+
+ if (*once_control == PTHREAD_ONCE_INIT) {
+@@ -1898,6 +1908,7 @@ int pthread_once( pthread_once_t* once_control, void (*init_routine)(void) )
+
+ int pthread_setname_np(pthread_t thid, const char *thname)
+ {
++ abort();
+ size_t thname_len;
+ int saved_errno, ret;
+
+diff --git a/libc/private/bionic_tls.h b/libc/private/bionic_tls.h
+index 94a81cd..81c5e16 100644
+--- a/libc/private/bionic_tls.h
++++ b/libc/private/bionic_tls.h
+@@ -55,17 +55,17 @@ __BEGIN_DECLS
+ /* Well known TLS slots */
+ #define TLS_SLOT_SELF 0
+ #define TLS_SLOT_THREAD_ID 1
+-#define TLS_SLOT_ERRNO 2
++#define TLS_SLOT_ERRNO 4
+
+-#define TLS_SLOT_OPENGL_API 3
+-#define TLS_SLOT_OPENGL 4
++#define TLS_SLOT_OPENGL_API 5
++#define TLS_SLOT_OPENGL 6
+
+ /* this slot is only used to pass information from the dynamic linker to
+ * libc.so when the C library is loaded in to memory. The C runtime init
+ * function will then clear it. Since its use is extremely temporary,
+ * we reuse an existing location.
+ */
+-#define TLS_SLOT_BIONIC_PREINIT (TLS_SLOT_ERRNO+1)
++#define TLS_SLOT_BIONIC_PREINIT 3
+
+ /* small technical note: it is not possible to call pthread_setspecific
+ * on keys that are <= TLS_SLOT_MAX_WELL_KNOWN, which is why it is set to
+@@ -76,7 +76,7 @@ __BEGIN_DECLS
+ * pthread_key_create() to initialize them. on the other hand, there is
+ * no destructor associated to them (we might need to implement this later)
+ */
+-#define TLS_SLOT_MAX_WELL_KNOWN TLS_SLOT_ERRNO
++#define TLS_SLOT_MAX_WELL_KNOWN 2
+
+ #define TLS_DEFAULT_ALLOC_MAP 0x0000001F
+
+diff --git a/libdl/libdl.c b/libdl/libdl.c
+index b36af16..ad6d4b4 100644
+--- a/libdl/libdl.c
++++ b/libdl/libdl.c
+@@ -24,6 +24,8 @@ void *dlsym(void *handle, const char *symbol) { return 0; }
+ int dladdr(void *addr, Dl_info *info) { return 0; }
+ int dlclose(void *handle) { return 0; }
+
++int *__errno() { return 0; };
++void __set_errno(int f) {};
+ #ifdef __arm__
+ void *dl_unwind_find_exidx(void *pc, int *pcount) { return 0; }
+ #elif defined(__i386__) || defined(__sh__)
--- /dev/null
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * This function is an empty stub where GDB locates a breakpoint to get notified
+ * about linker activity.
+ */
+void __attribute__((noinline)) rtld_db_dlactivity(void)
+{
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2012 Carsten Munk <carsten.munk@gmail.com>
+ * Copyright (c) 2012 Canonical Ltd
+ * Copyright (c) 2013 Christophe Chapuis <chris.chapuis@gmail.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <hybris/internal/floating_point_abi.h>
+
+#include "hooks_shm.h"
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdio_ext.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <malloc.h>
+#include <string.h>
+#include <strings.h>
+#include <dlfcn.h>
+#include <pthread.h>
+#include <signal.h>
+#include <errno.h>
+#include <dirent.h>
+#include <sys/types.h>
+#include <sys/xattr.h>
+#include <grp.h>
+
+#include <sys/ipc.h>
+#include <sys/shm.h>
+
+#include <netdb.h>
+#include <unistd.h>
+#include <syslog.h>
+#include <locale.h>
+
+#include <hybris/properties/properties.h>
+
+static locale_t hybris_locale;
+static int locale_inited = 0;
+/* TODO:
+* - Check if the int arguments at attr_set/get match the ones at Android
+* - Check how to deal with memory leaks (specially with static initializers)
+* - Check for shared rwlock
+*/
+
+/* Base address to check for Android specifics */
+#define ANDROID_TOP_ADDR_VALUE_MUTEX 0xFFFF
+#define ANDROID_TOP_ADDR_VALUE_COND 0xFFFF
+#define ANDROID_TOP_ADDR_VALUE_RWLOCK 0xFFFF
+
+#define ANDROID_MUTEX_SHARED_MASK 0x2000
+#define ANDROID_COND_SHARED_MASK 0x0001
+#define ANDROID_RWLOCKATTR_SHARED_MASK 0x0010
+
+/* For the static initializer types */
+#define ANDROID_PTHREAD_MUTEX_INITIALIZER 0
+#define ANDROID_PTHREAD_RECURSIVE_MUTEX_INITIALIZER 0x4000
+#define ANDROID_PTHREAD_ERRORCHECK_MUTEX_INITIALIZER 0x8000
+#define ANDROID_PTHREAD_COND_INITIALIZER 0
+#define ANDROID_PTHREAD_RWLOCK_INITIALIZER 0
+
+/* Debug */
+#include "logging.h"
+#define LOGD(message, ...) HYBRIS_DEBUG_LOG(HOOKS, message, ##__VA_ARGS__)
+
+/* we have a value p:
+ * - if p <= ANDROID_TOP_ADDR_VALUE_MUTEX then it is an android mutex, not one we processed
+ * - if p > VMALLOC_END, then the pointer is not a result of malloc ==> it is an shm offset
+ */
+
+struct _hook {
+ const char *name;
+ void *func;
+};
+
+/* Helpers */
+static int hybris_check_android_shared_mutex(unsigned int mutex_addr)
+{
+ /* If not initialized or initialized by Android, it should contain a low
+ * address, which is basically just the int values for Android's own
+ * pthread_mutex_t */
+ if ((mutex_addr <= ANDROID_TOP_ADDR_VALUE_MUTEX) &&
+ (mutex_addr & ANDROID_MUTEX_SHARED_MASK))
+ return 1;
+
+ return 0;
+}
+
+static int hybris_check_android_shared_cond(unsigned int cond_addr)
+{
+ /* If not initialized or initialized by Android, it should contain a low
+ * address, which is basically just the int values for Android's own
+ * pthread_cond_t */
+ if ((cond_addr <= ANDROID_TOP_ADDR_VALUE_COND) &&
+ (cond_addr & ANDROID_COND_SHARED_MASK))
+ return 1;
+
+ return 0;
+}
+
+static void hybris_set_mutex_attr(unsigned int android_value, pthread_mutexattr_t *attr)
+{
+ /* Init already sets as PTHREAD_MUTEX_NORMAL */
+ pthread_mutexattr_init(attr);
+
+ if (android_value & ANDROID_PTHREAD_RECURSIVE_MUTEX_INITIALIZER) {
+ pthread_mutexattr_settype(attr, PTHREAD_MUTEX_RECURSIVE);
+ } else if (android_value & ANDROID_PTHREAD_ERRORCHECK_MUTEX_INITIALIZER) {
+ pthread_mutexattr_settype(attr, PTHREAD_MUTEX_ERRORCHECK);
+ }
+}
+
+static pthread_mutex_t* hybris_alloc_init_mutex(unsigned int android_mutex)
+{
+ pthread_mutex_t *realmutex = malloc(sizeof(pthread_mutex_t));
+ pthread_mutexattr_t attr;
+ hybris_set_mutex_attr(android_mutex, &attr);
+ pthread_mutex_init(realmutex, &attr);
+ return realmutex;
+}
+
+static pthread_cond_t* hybris_alloc_init_cond(void)
+{
+ pthread_cond_t *realcond = malloc(sizeof(pthread_cond_t));
+ pthread_condattr_t attr;
+ pthread_condattr_init(&attr);
+ pthread_cond_init(realcond, &attr);
+ return realcond;
+}
+
+static pthread_rwlock_t* hybris_alloc_init_rwlock(void)
+{
+ pthread_rwlock_t *realrwlock = malloc(sizeof(pthread_rwlock_t));
+ pthread_rwlockattr_t attr;
+ pthread_rwlockattr_init(&attr);
+ pthread_rwlock_init(realrwlock, &attr);
+ return realrwlock;
+}
+
+/*
+ * utils, such as malloc, memcpy
+ *
+ * Useful to handle hacks such as the one applied for Nvidia, and to
+ * avoid crashes.
+ *
+ * */
+
+static void *my_malloc(size_t size)
+{
+ return malloc(size);
+}
+
+static void *my_memcpy(void *dst, const void *src, size_t len)
+{
+ if (src == NULL || dst == NULL)
+ return NULL;
+
+ return memcpy(dst, src, len);
+}
+
+static size_t my_strlen(const char *s)
+{
+
+ if (s == NULL)
+ return -1;
+
+ return strlen(s);
+}
+
+/*
+ * Main pthread functions
+ *
+ * Custom implementations to workaround difference between Bionic and Glibc.
+ * Our own pthread_create helps avoiding direct handling of TLS.
+ *
+ * */
+
+static int my_pthread_create(pthread_t *thread, const pthread_attr_t *__attr,
+ void *(*start_routine)(void*), void *arg)
+{
+ pthread_attr_t *realattr = NULL;
+
+ if (__attr != NULL)
+ realattr = (pthread_attr_t *) *(unsigned int *) __attr;
+
+ return pthread_create(thread, realattr, start_routine, arg);
+}
+
+/*
+ * pthread_attr_* functions
+ *
+ * Specific implementations to workaround the differences between at the
+ * pthread_attr_t struct differences between Bionic and Glibc.
+ *
+ * */
+
+static int my_pthread_attr_init(pthread_attr_t *__attr)
+{
+ pthread_attr_t *realattr;
+
+ realattr = malloc(sizeof(pthread_attr_t));
+ *((unsigned int *)__attr) = (unsigned int) realattr;
+
+ return pthread_attr_init(realattr);
+}
+
+static int my_pthread_attr_destroy(pthread_attr_t *__attr)
+{
+ int ret;
+ pthread_attr_t *realattr = (pthread_attr_t *) *(unsigned int *) __attr;
+
+ ret = pthread_attr_destroy(realattr);
+ /* We need to release the memory allocated at my_pthread_attr_init
+ * Possible side effects if destroy is called without our init */
+ free(realattr);
+
+ return ret;
+}
+
+static int my_pthread_attr_setdetachstate(pthread_attr_t *__attr, int state)
+{
+ pthread_attr_t *realattr = (pthread_attr_t *) *(unsigned int *) __attr;
+ return pthread_attr_setdetachstate(realattr, state);
+}
+
+static int my_pthread_attr_getdetachstate(pthread_attr_t const *__attr, int *state)
+{
+ pthread_attr_t *realattr = (pthread_attr_t *) *(unsigned int *) __attr;
+ return pthread_attr_getdetachstate(realattr, state);
+}
+
+static int my_pthread_attr_setschedpolicy(pthread_attr_t *__attr, int policy)
+{
+ pthread_attr_t *realattr = (pthread_attr_t *) *(unsigned int *) __attr;
+ return pthread_attr_setschedpolicy(realattr, policy);
+}
+
+static int my_pthread_attr_getschedpolicy(pthread_attr_t const *__attr, int *policy)
+{
+ pthread_attr_t *realattr = (pthread_attr_t *) *(unsigned int *) __attr;
+ return pthread_attr_getschedpolicy(realattr, policy);
+}
+
+static int my_pthread_attr_setschedparam(pthread_attr_t *__attr, struct sched_param const *param)
+{
+ pthread_attr_t *realattr = (pthread_attr_t *) *(unsigned int *) __attr;
+ return pthread_attr_setschedparam(realattr, param);
+}
+
+static int my_pthread_attr_getschedparam(pthread_attr_t const *__attr, struct sched_param *param)
+{
+ pthread_attr_t *realattr = (pthread_attr_t *) *(unsigned int *) __attr;
+ return pthread_attr_getschedparam(realattr, param);
+}
+
+static int my_pthread_attr_setstacksize(pthread_attr_t *__attr, size_t stack_size)
+{
+ pthread_attr_t *realattr = (pthread_attr_t *) *(unsigned int *) __attr;
+ return pthread_attr_setstacksize(realattr, stack_size);
+}
+
+static int my_pthread_attr_getstacksize(pthread_attr_t const *__attr, size_t *stack_size)
+{
+ pthread_attr_t *realattr = (pthread_attr_t *) *(unsigned int *) __attr;
+ return pthread_attr_getstacksize(realattr, stack_size);
+}
+
+static int my_pthread_attr_setstackaddr(pthread_attr_t *__attr, void *stack_addr)
+{
+ pthread_attr_t *realattr = (pthread_attr_t *) *(unsigned int *) __attr;
+ return pthread_attr_setstackaddr(realattr, stack_addr);
+}
+
+static int my_pthread_attr_getstackaddr(pthread_attr_t const *__attr, void **stack_addr)
+{
+ pthread_attr_t *realattr = (pthread_attr_t *) *(unsigned int *) __attr;
+ return pthread_attr_getstackaddr(realattr, stack_addr);
+}
+
+static int my_pthread_attr_setstack(pthread_attr_t *__attr, void *stack_base, size_t stack_size)
+{
+ pthread_attr_t *realattr = (pthread_attr_t *) *(unsigned int *) __attr;
+ return pthread_attr_setstack(realattr, stack_base, stack_size);
+}
+
+static int my_pthread_attr_getstack(pthread_attr_t const *__attr, void **stack_base, size_t *stack_size)
+{
+ pthread_attr_t *realattr = (pthread_attr_t *) *(unsigned int *) __attr;
+ return pthread_attr_getstack(realattr, stack_base, stack_size);
+}
+
+static int my_pthread_attr_setguardsize(pthread_attr_t *__attr, size_t guard_size)
+{
+ pthread_attr_t *realattr = (pthread_attr_t *) *(unsigned int *) __attr;
+ return pthread_attr_setguardsize(realattr, guard_size);
+}
+
+static int my_pthread_attr_getguardsize(pthread_attr_t const *__attr, size_t *guard_size)
+{
+ pthread_attr_t *realattr = (pthread_attr_t *) *(unsigned int *) __attr;
+ return pthread_attr_getguardsize(realattr, guard_size);
+}
+
+static int my_pthread_attr_setscope(pthread_attr_t *__attr, int scope)
+{
+ pthread_attr_t *realattr = (pthread_attr_t *) *(unsigned int *) __attr;
+ return pthread_attr_setscope(realattr, scope);
+}
+
+static int my_pthread_attr_getscope(pthread_attr_t const *__attr)
+{
+ int scope;
+ pthread_attr_t *realattr = (pthread_attr_t *) *(unsigned int *) __attr;
+
+ /* Android doesn't have the scope attribute because it always
+ * returns PTHREAD_SCOPE_SYSTEM */
+ pthread_attr_getscope(realattr, &scope);
+
+ return scope;
+}
+
+static int my_pthread_getattr_np(pthread_t thid, pthread_attr_t *__attr)
+{
+ pthread_attr_t *realattr;
+
+ realattr = malloc(sizeof(pthread_attr_t));
+ *((unsigned int *)__attr) = (unsigned int) realattr;
+
+ return pthread_getattr_np(thid, realattr);
+}
+
+/*
+ * pthread_mutex* functions
+ *
+ * Specific implementations to workaround the differences between at the
+ * pthread_mutex_t struct differences between Bionic and Glibc.
+ *
+ * */
+
+static int my_pthread_mutex_init(pthread_mutex_t *__mutex,
+ __const pthread_mutexattr_t *__mutexattr)
+{
+ pthread_mutex_t *realmutex = NULL;
+
+ int pshared = 0;
+ if (__mutexattr)
+ pthread_mutexattr_getpshared(__mutexattr, &pshared);
+
+ if (!pshared) {
+ /* non shared, standard mutex: use malloc */
+ realmutex = malloc(sizeof(pthread_mutex_t));
+
+ *((unsigned int *)__mutex) = (unsigned int) realmutex;
+ }
+ else {
+ /* process-shared mutex: use the shared memory segment */
+ hybris_shm_pointer_t handle = hybris_shm_alloc(sizeof(pthread_mutex_t));
+
+ *((hybris_shm_pointer_t *)__mutex) = handle;
+
+ if (handle)
+ realmutex = (pthread_mutex_t *)hybris_get_shmpointer(handle);
+ }
+
+ return pthread_mutex_init(realmutex, __mutexattr);
+}
+
+static int my_pthread_mutex_destroy(pthread_mutex_t *__mutex)
+{
+ int ret;
+
+ if (!__mutex)
+ return EINVAL;
+
+ pthread_mutex_t *realmutex = (pthread_mutex_t *) *(unsigned int *) __mutex;
+
+ if (!realmutex)
+ return EINVAL;
+
+ if (!hybris_is_pointer_in_shm((void*)realmutex)) {
+ ret = pthread_mutex_destroy(realmutex);
+ free(realmutex);
+ }
+ else {
+ realmutex = (pthread_mutex_t *)hybris_get_shmpointer((hybris_shm_pointer_t)realmutex);
+ ret = pthread_mutex_destroy(realmutex);
+ }
+
+ *((unsigned int *)__mutex) = 0;
+
+ return ret;
+}
+
+static int my_pthread_mutex_lock(pthread_mutex_t *__mutex)
+{
+ if (!__mutex) {
+ LOGD("Null mutex lock, not locking.");
+ return 0;
+ }
+
+ unsigned int value = (*(unsigned int *) __mutex);
+ if (hybris_check_android_shared_mutex(value)) {
+ LOGD("Shared mutex with Android, not locking.");
+ return 0;
+ }
+
+ pthread_mutex_t *realmutex = (pthread_mutex_t *) value;
+ if (hybris_is_pointer_in_shm((void*)value))
+ realmutex = (pthread_mutex_t *)hybris_get_shmpointer((hybris_shm_pointer_t)value);
+
+ if (value <= ANDROID_TOP_ADDR_VALUE_MUTEX) {
+ realmutex = hybris_alloc_init_mutex(value);
+ *((unsigned int *)__mutex) = (unsigned int) realmutex;
+ }
+
+ return pthread_mutex_lock(realmutex);
+}
+
+static int my_pthread_mutex_trylock(pthread_mutex_t *__mutex)
+{
+ unsigned int value = (*(unsigned int *) __mutex);
+
+ if (hybris_check_android_shared_mutex(value)) {
+ LOGD("Shared mutex with Android, not try locking.");
+ return 0;
+ }
+
+ pthread_mutex_t *realmutex = (pthread_mutex_t *) value;
+ if (hybris_is_pointer_in_shm((void*)value))
+ realmutex = (pthread_mutex_t *)hybris_get_shmpointer((hybris_shm_pointer_t)value);
+
+ if (value <= ANDROID_TOP_ADDR_VALUE_MUTEX) {
+ realmutex = hybris_alloc_init_mutex(value);
+ *((unsigned int *)__mutex) = (unsigned int) realmutex;
+ }
+
+ return pthread_mutex_trylock(realmutex);
+}
+
+static int my_pthread_mutex_unlock(pthread_mutex_t *__mutex)
+{
+ if (!__mutex) {
+ LOGD("Null mutex lock, not unlocking.");
+ return 0;
+ }
+
+ unsigned int value = (*(unsigned int *) __mutex);
+ if (hybris_check_android_shared_mutex(value)) {
+ LOGD("Shared mutex with Android, not unlocking.");
+ return 0;
+ }
+
+ if (value <= ANDROID_TOP_ADDR_VALUE_MUTEX) {
+ LOGD("Trying to unlock a lock that's not locked/initialized"
+ " by Hybris, not unlocking.");
+ return 0;
+ }
+
+ pthread_mutex_t *realmutex = (pthread_mutex_t *) value;
+ if (hybris_is_pointer_in_shm((void*)value))
+ realmutex = (pthread_mutex_t *)hybris_get_shmpointer((hybris_shm_pointer_t)value);
+
+ return pthread_mutex_unlock(realmutex);
+}
+
+static int my_pthread_mutex_lock_timeout_np(pthread_mutex_t *__mutex, unsigned __msecs)
+{
+ struct timespec tv;
+ pthread_mutex_t *realmutex;
+ unsigned int value = (*(unsigned int *) __mutex);
+
+ if (hybris_check_android_shared_mutex(value)) {
+ LOGD("Shared mutex with Android, not lock timeout np.");
+ return 0;
+ }
+
+ realmutex = (pthread_mutex_t *) value;
+
+ if (value <= ANDROID_TOP_ADDR_VALUE_MUTEX) {
+ realmutex = hybris_alloc_init_mutex(value);
+ *((int *)__mutex) = (int) realmutex;
+ }
+
+ /* TODO: Android uses CLOCK_MONOTONIC here but I am not sure which one to use */
+ clock_gettime(CLOCK_REALTIME, &tv);
+ tv.tv_sec += __msecs/1000;
+ tv.tv_nsec += (__msecs % 1000) * 1000000;
+ if (tv.tv_nsec >= 1000000000) {
+ tv.tv_sec++;
+ tv.tv_nsec -= 1000000000;
+ }
+
+ return pthread_mutex_timedlock(realmutex, &tv);
+}
+
+static int my_pthread_mutexattr_setpshared(pthread_mutexattr_t *__attr,
+ int pshared)
+{
+ return pthread_mutexattr_setpshared(__attr, pshared);
+}
+
+/*
+ * pthread_cond* functions
+ *
+ * Specific implementations to workaround the differences between at the
+ * pthread_cond_t struct differences between Bionic and Glibc.
+ *
+ * */
+
+static int my_pthread_cond_init(pthread_cond_t *cond,
+ const pthread_condattr_t *attr)
+{
+ pthread_cond_t *realcond = NULL;
+
+ int pshared = 0;
+
+ if (attr)
+ pthread_condattr_getpshared(attr, &pshared);
+
+ if (!pshared) {
+ /* non shared, standard cond: use malloc */
+ realcond = malloc(sizeof(pthread_cond_t));
+
+ *((unsigned int *) cond) = (unsigned int) realcond;
+ }
+ else {
+ /* process-shared condition: use the shared memory segment */
+ hybris_shm_pointer_t handle = hybris_shm_alloc(sizeof(pthread_cond_t));
+
+ *((unsigned int *)cond) = (unsigned int) handle;
+
+ if (handle)
+ realcond = (pthread_cond_t *)hybris_get_shmpointer(handle);
+ }
+
+ return pthread_cond_init(realcond, attr);
+}
+
+static int my_pthread_cond_destroy(pthread_cond_t *cond)
+{
+ int ret;
+ pthread_cond_t *realcond = (pthread_cond_t *) *(unsigned int *) cond;
+
+ if (!realcond) {
+ return EINVAL;
+ }
+
+ if (!hybris_is_pointer_in_shm((void*)realcond)) {
+ ret = pthread_cond_destroy(realcond);
+ free(realcond);
+ }
+ else {
+ realcond = (pthread_cond_t *)hybris_get_shmpointer((hybris_shm_pointer_t)realcond);
+ ret = pthread_cond_destroy(realcond);
+ }
+
+ *((unsigned int *)cond) = 0;
+
+ return ret;
+}
+
+static int my_pthread_cond_broadcast(pthread_cond_t *cond)
+{
+ unsigned int value = (*(unsigned int *) cond);
+ if (hybris_check_android_shared_cond(value)) {
+ LOGD("shared condition with Android, not broadcasting.");
+ return 0;
+ }
+
+ pthread_cond_t *realcond = (pthread_cond_t *) value;
+ if (hybris_is_pointer_in_shm((void*)value))
+ realcond = (pthread_cond_t *)hybris_get_shmpointer((hybris_shm_pointer_t)value);
+
+ if (value <= ANDROID_TOP_ADDR_VALUE_COND) {
+ realcond = hybris_alloc_init_cond();
+ *((unsigned int *) cond) = (unsigned int) realcond;
+ }
+
+ return pthread_cond_broadcast(realcond);
+}
+
+static int my_pthread_cond_signal(pthread_cond_t *cond)
+{
+ unsigned int value = (*(unsigned int *) cond);
+
+ if (hybris_check_android_shared_cond(value)) {
+ LOGD("Shared condition with Android, not signaling.");
+ return 0;
+ }
+
+ pthread_cond_t *realcond = (pthread_cond_t *) value;
+ if (hybris_is_pointer_in_shm((void*)value))
+ realcond = (pthread_cond_t *)hybris_get_shmpointer((hybris_shm_pointer_t)value);
+
+ if (value <= ANDROID_TOP_ADDR_VALUE_COND) {
+ realcond = hybris_alloc_init_cond();
+ *((unsigned int *) cond) = (unsigned int) realcond;
+ }
+
+ return pthread_cond_signal(realcond);
+}
+
+static int my_pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
+{
+ /* Both cond and mutex can be statically initialized, check for both */
+ unsigned int cvalue = (*(unsigned int *) cond);
+ unsigned int mvalue = (*(unsigned int *) mutex);
+
+ if (hybris_check_android_shared_cond(cvalue) ||
+ hybris_check_android_shared_mutex(mvalue)) {
+ LOGD("Shared condition/mutex with Android, not waiting.");
+ return 0;
+ }
+
+ pthread_cond_t *realcond = (pthread_cond_t *) cvalue;
+ if (hybris_is_pointer_in_shm((void*)cvalue))
+ realcond = (pthread_cond_t *)hybris_get_shmpointer((hybris_shm_pointer_t)cvalue);
+
+ if (cvalue <= ANDROID_TOP_ADDR_VALUE_COND) {
+ realcond = hybris_alloc_init_cond();
+ *((unsigned int *) cond) = (unsigned int) realcond;
+ }
+
+ pthread_mutex_t *realmutex = (pthread_mutex_t *) mvalue;
+ if (hybris_is_pointer_in_shm((void*)mvalue))
+ realmutex = (pthread_mutex_t *)hybris_get_shmpointer((hybris_shm_pointer_t)mvalue);
+
+ if (mvalue <= ANDROID_TOP_ADDR_VALUE_MUTEX) {
+ realmutex = hybris_alloc_init_mutex(mvalue);
+ *((unsigned int *) mutex) = (unsigned int) realmutex;
+ }
+
+ return pthread_cond_wait(realcond, realmutex);
+}
+
+static int my_pthread_cond_timedwait(pthread_cond_t *cond,
+ pthread_mutex_t *mutex, const struct timespec *abstime)
+{
+ /* Both cond and mutex can be statically initialized, check for both */
+ unsigned int cvalue = (*(unsigned int *) cond);
+ unsigned int mvalue = (*(unsigned int *) mutex);
+
+ if (hybris_check_android_shared_cond(cvalue) ||
+ hybris_check_android_shared_mutex(mvalue)) {
+ LOGD("Shared condition/mutex with Android, not waiting.");
+ return 0;
+ }
+
+ pthread_cond_t *realcond = (pthread_cond_t *) cvalue;
+ if (hybris_is_pointer_in_shm((void*)cvalue))
+ realcond = (pthread_cond_t *)hybris_get_shmpointer((hybris_shm_pointer_t)cvalue);
+
+ if (cvalue <= ANDROID_TOP_ADDR_VALUE_COND) {
+ realcond = hybris_alloc_init_cond();
+ *((unsigned int *) cond) = (unsigned int) realcond;
+ }
+
+ pthread_mutex_t *realmutex = (pthread_mutex_t *) mvalue;
+ if (hybris_is_pointer_in_shm((void*)mvalue))
+ realmutex = (pthread_mutex_t *)hybris_get_shmpointer((hybris_shm_pointer_t)mvalue);
+
+ if (mvalue <= ANDROID_TOP_ADDR_VALUE_MUTEX) {
+ realmutex = hybris_alloc_init_mutex(mvalue);
+ *((unsigned int *) mutex) = (unsigned int) realmutex;
+ }
+
+ return pthread_cond_timedwait(realcond, realmutex, abstime);
+}
+
+static int my_pthread_cond_timedwait_relative_np(pthread_cond_t *cond,
+ pthread_mutex_t *mutex, const struct timespec *reltime)
+{
+ /* Both cond and mutex can be statically initialized, check for both */
+ unsigned int cvalue = (*(unsigned int *) cond);
+ unsigned int mvalue = (*(unsigned int *) mutex);
+
+ if (hybris_check_android_shared_cond(cvalue) ||
+ hybris_check_android_shared_mutex(mvalue)) {
+ LOGD("Shared condition/mutex with Android, not waiting.");
+ return 0;
+ }
+
+ pthread_cond_t *realcond = (pthread_cond_t *) cvalue;
+ if( hybris_is_pointer_in_shm((void*)cvalue) )
+ realcond = (pthread_cond_t *)hybris_get_shmpointer((hybris_shm_pointer_t)cvalue);
+
+ if (cvalue <= ANDROID_TOP_ADDR_VALUE_COND) {
+ realcond = hybris_alloc_init_cond();
+ *((unsigned int *) cond) = (unsigned int) realcond;
+ }
+
+ pthread_mutex_t *realmutex = (pthread_mutex_t *) mvalue;
+ if (hybris_is_pointer_in_shm((void*)mvalue))
+ realmutex = (pthread_mutex_t *)hybris_get_shmpointer((hybris_shm_pointer_t)mvalue);
+
+ if (mvalue <= ANDROID_TOP_ADDR_VALUE_MUTEX) {
+ realmutex = hybris_alloc_init_mutex(mvalue);
+ *((unsigned int *) mutex) = (unsigned int) realmutex;
+ }
+
+ /* TODO: Android uses CLOCK_MONOTONIC here but I am not sure which one to use */
+ struct timespec tv;
+ clock_gettime(CLOCK_REALTIME, &tv);
+ tv.tv_sec += reltime->tv_sec;
+ tv.tv_nsec += reltime->tv_nsec;
+ if (tv.tv_nsec >= 1000000000) {
+ tv.tv_sec++;
+ tv.tv_nsec -= 1000000000;
+ }
+ return pthread_cond_timedwait(realcond, realmutex, &tv);
+}
+
+/*
+ * pthread_rwlockattr_* functions
+ *
+ * Specific implementations to workaround the differences between at the
+ * pthread_rwlockattr_t struct differences between Bionic and Glibc.
+ *
+ * */
+
+static int my_pthread_rwlockattr_init(pthread_rwlockattr_t *__attr)
+{
+ pthread_rwlockattr_t *realattr;
+
+ realattr = malloc(sizeof(pthread_rwlockattr_t));
+ *((unsigned int *)__attr) = (unsigned int) realattr;
+
+ return pthread_rwlockattr_init(realattr);
+}
+
+static int my_pthread_rwlockattr_destroy(pthread_rwlockattr_t *__attr)
+{
+ int ret;
+ pthread_rwlockattr_t *realattr = (pthread_rwlockattr_t *) *(unsigned int *) __attr;
+
+ ret = pthread_rwlockattr_destroy(realattr);
+ free(realattr);
+
+ return ret;
+}
+
+static int my_pthread_rwlockattr_setpshared(pthread_rwlockattr_t *__attr,
+ int pshared)
+{
+ pthread_rwlockattr_t *realattr = (pthread_rwlockattr_t *) *(unsigned int *) __attr;
+ return pthread_rwlockattr_setpshared(realattr, pshared);
+}
+
+static int my_pthread_rwlockattr_getpshared(pthread_rwlockattr_t *__attr,
+ int *pshared)
+{
+ pthread_rwlockattr_t *realattr = (pthread_rwlockattr_t *) *(unsigned int *) __attr;
+ return pthread_rwlockattr_getpshared(realattr, pshared);
+}
+
+/*
+ * pthread_rwlock_* functions
+ *
+ * Specific implementations to workaround the differences between at the
+ * pthread_rwlock_t struct differences between Bionic and Glibc.
+ *
+ * */
+
+static int my_pthread_rwlock_init(pthread_rwlock_t *__rwlock,
+ __const pthread_rwlockattr_t *__attr)
+{
+ pthread_rwlock_t *realrwlock = NULL;
+ pthread_rwlockattr_t *realattr = NULL;
+ int pshared = 0;
+
+ if (__attr != NULL)
+ realattr = (pthread_rwlockattr_t *) *(unsigned int *) __attr;
+
+ if (realattr)
+ pthread_rwlockattr_getpshared(realattr, &pshared);
+
+ if (!pshared) {
+ /* non shared, standard rwlock: use malloc */
+ realrwlock = malloc(sizeof(pthread_rwlock_t));
+
+ *((unsigned int *) __rwlock) = (unsigned int) realrwlock;
+ }
+ else {
+ /* process-shared condition: use the shared memory segment */
+ hybris_shm_pointer_t handle = hybris_shm_alloc(sizeof(pthread_rwlock_t));
+
+ *((unsigned int *)__rwlock) = (unsigned int) handle;
+
+ if (handle)
+ realrwlock = (pthread_rwlock_t *)hybris_get_shmpointer(handle);
+ }
+
+ return pthread_rwlock_init(realrwlock, realattr);
+}
+
+static int my_pthread_rwlock_destroy(pthread_rwlock_t *__rwlock)
+{
+ int ret;
+ pthread_rwlock_t *realrwlock = (pthread_rwlock_t *) *(unsigned int *) __rwlock;
+
+ if (!hybris_is_pointer_in_shm((void*)realrwlock)) {
+ ret = pthread_rwlock_destroy(realrwlock);
+ free(realrwlock);
+ }
+ else {
+ ret = pthread_rwlock_destroy(realrwlock);
+ realrwlock = (pthread_rwlock_t *)hybris_get_shmpointer((hybris_shm_pointer_t)realrwlock);
+ }
+
+ return ret;
+}
+
+static pthread_rwlock_t* hybris_set_realrwlock(pthread_rwlock_t *rwlock)
+{
+ unsigned int value = (*(unsigned int *) rwlock);
+ pthread_rwlock_t *realrwlock = (pthread_rwlock_t *) value;
+ if (hybris_is_pointer_in_shm((void*)value))
+ realrwlock = (pthread_rwlock_t *)hybris_get_shmpointer((hybris_shm_pointer_t)value);
+
+ if (realrwlock <= ANDROID_TOP_ADDR_VALUE_RWLOCK) {
+ realrwlock = hybris_alloc_init_rwlock();
+ *((unsigned int *)rwlock) = (unsigned int) realrwlock;
+ }
+ return realrwlock;
+}
+
+static int my_pthread_rwlock_rdlock(pthread_rwlock_t *__rwlock)
+{
+ pthread_rwlock_t *realrwlock = hybris_set_realrwlock(__rwlock);
+ return pthread_rwlock_rdlock(realrwlock);
+}
+
+static int my_pthread_rwlock_tryrdlock(pthread_rwlock_t *__rwlock)
+{
+ pthread_rwlock_t *realrwlock = hybris_set_realrwlock(__rwlock);
+ return pthread_rwlock_tryrdlock(realrwlock);
+}
+
+static int my_pthread_rwlock_timedrdlock(pthread_rwlock_t *__rwlock,
+ __const struct timespec *abs_timeout)
+{
+ pthread_rwlock_t *realrwlock = hybris_set_realrwlock(__rwlock);
+ return pthread_rwlock_timedrdlock(realrwlock, abs_timeout);
+}
+
+static int my_pthread_rwlock_wrlock(pthread_rwlock_t *__rwlock)
+{
+ pthread_rwlock_t *realrwlock = hybris_set_realrwlock(__rwlock);
+ return pthread_rwlock_wrlock(realrwlock);
+}
+
+static int my_pthread_rwlock_trywrlock(pthread_rwlock_t *__rwlock)
+{
+ pthread_rwlock_t *realrwlock = hybris_set_realrwlock(__rwlock);
+ return pthread_rwlock_trywrlock(realrwlock);
+}
+
+static int my_pthread_rwlock_timedwrlock(pthread_rwlock_t *__rwlock,
+ __const struct timespec *abs_timeout)
+{
+ pthread_rwlock_t *realrwlock = hybris_set_realrwlock(__rwlock);
+ return pthread_rwlock_timedwrlock(realrwlock, abs_timeout);
+}
+
+static int my_pthread_rwlock_unlock(pthread_rwlock_t *__rwlock)
+{
+ unsigned int value = (*(unsigned int *) __rwlock);
+ if (value <= ANDROID_TOP_ADDR_VALUE_RWLOCK) {
+ LOGD("Trying to unlock a rwlock that's not locked/initialized"
+ " by Hybris, not unlocking.");
+ return 0;
+ }
+ pthread_rwlock_t *realrwlock = (pthread_rwlock_t *) value;
+ if (hybris_is_pointer_in_shm((void*)value))
+ realrwlock = (pthread_rwlock_t *)hybris_get_shmpointer((hybris_shm_pointer_t)value);
+
+ return pthread_rwlock_unlock(realrwlock);
+}
+
+
+static int my_set_errno(int oi_errno)
+{
+ errno = oi_errno;
+ return -1;
+}
+
+/*
+ * __isthreaded is used in bionic's stdio.h to choose between a fast internal implementation
+ * and a more classic stdio function call.
+ * For example:
+ * #define __sfeof(p) (((p)->_flags & __SEOF) != 0)
+ * #define feof(p) (!__isthreaded ? __sfeof(p) : (feof)(p))
+ *
+ * We see here that if __isthreaded is false, then it will use directly the bionic's FILE structure
+ * instead of calling one of the hooked methods.
+ * Therefore we need to set __isthreaded to true, even if we are not in a multi-threaded context.
+ */
+static int __my_isthreaded = 1;
+
+/*
+ * redirection for bionic's __sF, which is defined as:
+ * FILE __sF[3];
+ * #define stdin &__sF[0];
+ * #define stdout &__sF[1];
+ * #define stderr &__sF[2];
+ * So the goal here is to catch the call to file methods where the FILE* pointer
+ * is either stdin, stdout or stderr, and translate that pointer to a valid glibc
+ * pointer.
+ * Currently, only fputs is managed.
+ */
+#define BIONIC_SIZEOF_FILE 84
+static char my_sF[3*BIONIC_SIZEOF_FILE] = {0};
+static FILE *_get_actual_fp(FILE *fp)
+{
+ char *c_fp = (char*)fp;
+ if (c_fp == &my_sF[0])
+ return stdin;
+ else if (c_fp == &my_sF[BIONIC_SIZEOF_FILE])
+ return stdout;
+ else if (c_fp == &my_sF[BIONIC_SIZEOF_FILE*2])
+ return stderr;
+
+ return fp;
+}
+
+static void my_clearerr(FILE *fp)
+{
+ clearerr(_get_actual_fp(fp));
+}
+
+static int my_fclose(FILE *fp)
+{
+ return fclose(_get_actual_fp(fp));
+}
+
+static int my_feof(FILE *fp)
+{
+ return feof(_get_actual_fp(fp));
+}
+
+static int my_ferror(FILE *fp)
+{
+ return ferror(_get_actual_fp(fp));
+}
+
+static int my_fflush(FILE *fp)
+{
+ return fflush(_get_actual_fp(fp));
+}
+
+static int my_fgetc(FILE *fp)
+{
+ return fgetc(_get_actual_fp(fp));
+}
+
+static int my_fgetpos(FILE *fp, fpos_t *pos)
+{
+ return fgetpos(_get_actual_fp(fp), pos);
+}
+
+static char* my_fgets(char *s, int n, FILE *fp)
+{
+ return fgets(s, n, _get_actual_fp(fp));
+}
+
+FP_ATTRIB static int my_fprintf(FILE *fp, const char *fmt, ...)
+{
+ int ret = 0;
+
+ va_list args;
+ va_start(args,fmt);
+ ret = vfprintf(_get_actual_fp(fp), fmt, args);
+ va_end(args);
+
+ return ret;
+}
+
+static int my_fputc(int c, FILE *fp)
+{
+ return fputc(c, _get_actual_fp(fp));
+}
+
+static int my_fputs(const char *s, FILE *fp)
+{
+ return fputs(s, _get_actual_fp(fp));
+}
+
+static size_t my_fread(void *ptr, size_t size, size_t nmemb, FILE *fp)
+{
+ return fread(ptr, size, nmemb, _get_actual_fp(fp));
+}
+
+static FILE* my_freopen(const char *filename, const char *mode, FILE *fp)
+{
+ return freopen(filename, mode, _get_actual_fp(fp));
+}
+
+FP_ATTRIB static int my_fscanf(FILE *fp, const char *fmt, ...)
+{
+ int ret = 0;
+
+ va_list args;
+ va_start(args,fmt);
+ ret = vfscanf(_get_actual_fp(fp), fmt, args);
+ va_end(args);
+
+ return ret;
+}
+
+static int my_fseek(FILE *fp, long offset, int whence)
+{
+ return fseek(_get_actual_fp(fp), offset, whence);
+}
+
+static int my_fseeko(FILE *fp, off_t offset, int whence)
+{
+ return fseeko(_get_actual_fp(fp), offset, whence);
+}
+
+static int my_fsetpos(FILE *fp, const fpos_t *pos)
+{
+ return fsetpos(_get_actual_fp(fp), pos);
+}
+
+static long my_ftell(FILE *fp)
+{
+ return ftell(_get_actual_fp(fp));
+}
+
+static off_t my_ftello(FILE *fp)
+{
+ return ftello(_get_actual_fp(fp));
+}
+
+static size_t my_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *fp)
+{
+ return fwrite(ptr, size, nmemb, _get_actual_fp(fp));
+}
+
+static int my_getc(FILE *fp)
+{
+ return getc(_get_actual_fp(fp));
+}
+
+static ssize_t my_getdelim(char ** lineptr, size_t *n, int delimiter, FILE * fp)
+{
+ return getdelim(lineptr, n, delimiter, _get_actual_fp(fp));
+}
+
+static ssize_t my_getline(char **lineptr, size_t *n, FILE *fp)
+{
+ return getline(lineptr, n, _get_actual_fp(fp));
+}
+
+
+static int my_putc(int c, FILE *fp)
+{
+ return putc(c, _get_actual_fp(fp));
+}
+
+static void my_rewind(FILE *fp)
+{
+ rewind(_get_actual_fp(fp));
+}
+
+static void my_setbuf(FILE *fp, char *buf)
+{
+ setbuf(_get_actual_fp(fp), buf);
+}
+
+static int my_setvbuf(FILE *fp, char *buf, int mode, size_t size)
+{
+ return setvbuf(_get_actual_fp(fp), buf, mode, size);
+}
+
+static int my_ungetc(int c, FILE *fp)
+{
+ return ungetc(c, _get_actual_fp(fp));
+}
+
+static int my_vfprintf(FILE *fp, const char *fmt, va_list arg)
+{
+ return vfprintf(_get_actual_fp(fp), fmt, arg);
+}
+
+
+static int my_vfscanf(FILE *fp, const char *fmt, va_list arg)
+{
+ return vfscanf(_get_actual_fp(fp), fmt, arg);
+}
+
+static int my_fileno(FILE *fp)
+{
+ return fileno(_get_actual_fp(fp));
+}
+
+
+static int my_pclose(FILE *fp)
+{
+ return pclose(_get_actual_fp(fp));
+}
+
+static void my_flockfile(FILE *fp)
+{
+ return flockfile(_get_actual_fp(fp));
+}
+
+static int my_ftrylockfile(FILE *fp)
+{
+ return ftrylockfile(_get_actual_fp(fp));
+}
+
+static void my_funlockfile(FILE *fp)
+{
+ return funlockfile(_get_actual_fp(fp));
+}
+
+
+static int my_getc_unlocked(FILE *fp)
+{
+ return getc_unlocked(_get_actual_fp(fp));
+}
+
+static int my_putc_unlocked(int c, FILE *fp)
+{
+ return putc_unlocked(c, _get_actual_fp(fp));
+}
+
+/* exists only on the BSD platform
+static char* my_fgetln(FILE *fp, size_t *len)
+{
+ return fgetln(_get_actual_fp(fp), len);
+}
+*/
+static int my_fpurge(FILE *fp)
+{
+ __fpurge(_get_actual_fp(fp));
+
+ return 0;
+}
+
+static int my_getw(FILE *fp)
+{
+ return getw(_get_actual_fp(fp));
+}
+
+static int my_putw(int w, FILE *fp)
+{
+ return putw(w, _get_actual_fp(fp));
+}
+
+static void my_setbuffer(FILE *fp, char *buf, int size)
+{
+ setbuffer(_get_actual_fp(fp), buf, size);
+}
+
+static int my_setlinebuf(FILE *fp)
+{
+ setlinebuf(_get_actual_fp(fp));
+
+ return 0;
+}
+
+long my_sysconf(int name)
+{
+ /*
+ * bionic has different values for the values below.
+ * TODO: compare the values between glibc and bionic and complete the mapping
+ */
+ switch (name) {
+ case 0x27:
+ return sysconf(_SC_PAGESIZE);
+ case 0x28:
+ return sysconf(_SC_PAGE_SIZE);
+ case 0x60:
+ return sysconf(_SC_NPROCESSORS_CONF);
+ case 0x61:
+ return sysconf(_SC_NPROCESSORS_ONLN);
+ default:
+ break;
+ }
+
+
+ long rv = sysconf(name);
+
+#ifdef DEBUG
+ if (rv == -1) {
+ printf("sysconf failed for %li\n", name);
+ exit(-1);
+ }
+#endif
+
+ return rv;
+}
+
+FP_ATTRIB static double my_strtod(const char *nptr, char **endptr)
+{
+ if (locale_inited == 0)
+ {
+ hybris_locale = newlocale(LC_ALL_MASK, "C", 0);
+ locale_inited = 1;
+ }
+ return strtod_l(nptr, endptr, hybris_locale);
+}
+
+extern int __cxa_atexit(void (*)(void*), void*, void*);
+
+static struct _hook hooks[] = {
+ {"property_get", property_get },
+ {"property_set", property_set },
+ {"getenv", getenv },
+ {"printf", printf },
+ {"malloc", my_malloc },
+ {"free", free },
+ {"calloc", calloc },
+ {"cfree", cfree },
+ {"realloc", realloc },
+ {"memalign", memalign },
+ {"valloc", valloc },
+ {"pvalloc", pvalloc },
+ {"fread", fread },
+ {"getxattr", getxattr},
+ /* string.h */
+ {"memccpy",memccpy},
+ {"memchr",memchr},
+ {"memrchr",memrchr},
+ {"memcmp",memcmp},
+ {"memcpy",my_memcpy},
+ {"memmove",memmove},
+ {"memset",memset},
+ {"memmem",memmem},
+ // {"memswap",memswap},
+ {"index",index},
+ {"rindex",rindex},
+ {"strchr",strchr},
+ {"strrchr",strrchr},
+ {"strlen",my_strlen},
+ {"strcmp",strcmp},
+ {"strcpy",strcpy},
+ {"strcat",strcat},
+ {"strcasecmp",strcasecmp},
+ {"strncasecmp",strncasecmp},
+ {"strdup",strdup},
+ {"strstr",strstr},
+ {"strtok",strtok},
+ {"strtok_r",strtok_r},
+ {"strerror",strerror},
+ {"strerror_r",strerror_r},
+ {"strnlen",strnlen},
+ {"strncat",strncat},
+ {"strndup",strndup},
+ {"strncmp",strncmp},
+ {"strncpy",strncpy},
+ {"strtod", my_strtod},
+ //{"strlcat",strlcat},
+ //{"strlcpy",strlcpy},
+ {"strcspn",strcspn},
+ {"strpbrk",strpbrk},
+ {"strsep",strsep},
+ {"strspn",strspn},
+ {"strsignal",strsignal},
+ {"getgrnam", getgrnam},
+ {"strcoll",strcoll},
+ {"strxfrm",strxfrm},
+ /* strings.h */
+ {"bcmp",bcmp},
+ {"bcopy",bcopy},
+ {"bzero",bzero},
+ {"ffs",ffs},
+ {"index",index},
+ {"rindex",rindex},
+ {"strcasecmp",strcasecmp},
+ {"strncasecmp",strncasecmp},
+ /* dirent.h */
+ {"opendir", opendir},
+ {"closedir", closedir},
+ /* pthread.h */
+ {"pthread_atfork", pthread_atfork},
+ {"pthread_create", my_pthread_create},
+ {"pthread_kill", pthread_kill},
+ {"pthread_exit", pthread_exit},
+ {"pthread_join", pthread_join},
+ {"pthread_detach", pthread_detach},
+ {"pthread_self", pthread_self},
+ {"pthread_equal", pthread_equal},
+ {"pthread_getschedparam", pthread_getschedparam},
+ {"pthread_setschedparam", pthread_setschedparam},
+ {"pthread_mutex_init", my_pthread_mutex_init},
+ {"pthread_mutex_destroy", my_pthread_mutex_destroy},
+ {"pthread_mutex_lock", my_pthread_mutex_lock},
+ {"pthread_mutex_unlock", my_pthread_mutex_unlock},
+ {"pthread_mutex_trylock", my_pthread_mutex_trylock},
+ {"pthread_mutex_lock_timeout_np", my_pthread_mutex_lock_timeout_np},
+ {"pthread_mutexattr_init", pthread_mutexattr_init},
+ {"pthread_mutexattr_destroy", pthread_mutexattr_destroy},
+ {"pthread_mutexattr_getttype", pthread_mutexattr_gettype},
+ {"pthread_mutexattr_settype", pthread_mutexattr_settype},
+ {"pthread_mutexattr_getpshared", pthread_mutexattr_getpshared},
+ {"pthread_mutexattr_setpshared", my_pthread_mutexattr_setpshared},
+ {"pthread_condattr_init", pthread_condattr_init},
+ {"pthread_condattr_getpshared", pthread_condattr_getpshared},
+ {"pthread_condattr_setpshared", pthread_condattr_setpshared},
+ {"pthread_condattr_destroy", pthread_condattr_destroy},
+ {"pthread_cond_init", my_pthread_cond_init},
+ {"pthread_cond_destroy", my_pthread_cond_destroy},
+ {"pthread_cond_broadcast", my_pthread_cond_broadcast},
+ {"pthread_cond_signal", my_pthread_cond_signal},
+ {"pthread_cond_wait", my_pthread_cond_wait},
+ {"pthread_cond_timedwait", my_pthread_cond_timedwait},
+ {"pthread_cond_timedwait_monotonic", my_pthread_cond_timedwait},
+ {"pthread_cond_timedwait_monotonic_np", my_pthread_cond_timedwait},
+ {"pthread_cond_timedwait_relative_np", my_pthread_cond_timedwait_relative_np},
+ {"pthread_key_delete", pthread_key_delete},
+ {"pthread_setname_np", pthread_setname_np},
+ {"pthread_once", pthread_once},
+ {"pthread_key_create", pthread_key_create},
+ {"pthread_setspecific", pthread_setspecific},
+ {"pthread_getspecific", pthread_getspecific},
+ {"pthread_attr_init", my_pthread_attr_init},
+ {"pthread_attr_destroy", my_pthread_attr_destroy},
+ {"pthread_attr_setdetachstate", my_pthread_attr_setdetachstate},
+ {"pthread_attr_getdetachstate", my_pthread_attr_getdetachstate},
+ {"pthread_attr_setschedpolicy", my_pthread_attr_setschedpolicy},
+ {"pthread_attr_getschedpolicy", my_pthread_attr_getschedpolicy},
+ {"pthread_attr_setschedparam", my_pthread_attr_setschedparam},
+ {"pthread_attr_getschedparam", my_pthread_attr_getschedparam},
+ {"pthread_attr_setstacksize", my_pthread_attr_setstacksize},
+ {"pthread_attr_getstacksize", my_pthread_attr_getstacksize},
+ {"pthread_attr_setstackaddr", my_pthread_attr_setstackaddr},
+ {"pthread_attr_getstackaddr", my_pthread_attr_getstackaddr},
+ {"pthread_attr_setstack", my_pthread_attr_setstack},
+ {"pthread_attr_getstack", my_pthread_attr_getstack},
+ {"pthread_attr_setguardsize", my_pthread_attr_setguardsize},
+ {"pthread_attr_getguardsize", my_pthread_attr_getguardsize},
+ {"pthread_attr_setscope", my_pthread_attr_setscope},
+ {"pthread_attr_setscope", my_pthread_attr_getscope},
+ {"pthread_getattr_np", my_pthread_getattr_np},
+ {"pthread_rwlockattr_init", my_pthread_rwlockattr_init},
+ {"pthread_rwlockattr_destroy", my_pthread_rwlockattr_destroy},
+ {"pthread_rwlockattr_setpshared", my_pthread_rwlockattr_setpshared},
+ {"pthread_rwlockattr_getpshared", my_pthread_rwlockattr_getpshared},
+ {"pthread_rwlock_init", my_pthread_rwlock_init},
+ {"pthread_rwlock_destroy", my_pthread_rwlock_destroy},
+ {"pthread_rwlock_unlock", my_pthread_rwlock_unlock},
+ {"pthread_rwlock_wrlock", my_pthread_rwlock_wrlock},
+ {"pthread_rwlock_rdlock", my_pthread_rwlock_rdlock},
+ {"pthread_rwlock_tryrdlock", my_pthread_rwlock_tryrdlock},
+ {"pthread_rwlock_trywrlock", my_pthread_rwlock_trywrlock},
+ {"pthread_rwlock_timedrdlock", my_pthread_rwlock_timedrdlock},
+ {"pthread_rwlock_timedwrlock", my_pthread_rwlock_timedwrlock},
+ /* stdio.h */
+ {"__isthreaded", &__my_isthreaded},
+ {"__sF", &my_sF},
+ {"fopen", fopen},
+ {"fdopen", fdopen},
+ {"popen", popen},
+ {"puts", puts},
+ {"sprintf", sprintf},
+ {"asprintf", asprintf},
+ {"vasprintf", vasprintf},
+ {"snprintf", snprintf},
+ {"vsprintf", vsprintf},
+ {"vsnprintf", vsnprintf},
+ {"clearerr", my_clearerr},
+ {"fclose", my_fclose},
+ {"feof", my_feof},
+ {"ferror", my_ferror},
+ {"fflush", my_fflush},
+ {"fgetc", my_fgetc},
+ {"fgetpos", my_fgetpos},
+ {"fgets", my_fgets},
+ {"fprintf", my_fprintf},
+ {"fputc", my_fputc},
+ {"fputs", my_fputs},
+ {"fread", my_fread},
+ {"freopen", my_freopen},
+ {"fscanf", my_fscanf},
+ {"fseek", my_fseek},
+ {"fseeko", my_fseeko},
+ {"fsetpos", my_fsetpos},
+ {"ftell", my_ftell},
+ {"ftello", my_ftello},
+ {"fwrite", my_fwrite},
+ {"getc", my_getc},
+ {"getdelim", my_getdelim},
+ {"getline", my_getline},
+ {"putc", my_putc},
+ {"rewind", my_rewind},
+ {"setbuf", my_setbuf},
+ {"setvbuf", my_setvbuf},
+ {"ungetc", my_ungetc},
+ {"vasprintf", vasprintf},
+ {"vfprintf", my_vfprintf},
+ {"vfscanf", my_vfscanf},
+ {"fileno", my_fileno},
+ {"pclose", my_pclose},
+ {"flockfile", my_flockfile},
+ {"ftrylockfile", my_ftrylockfile},
+ {"funlockfile", my_funlockfile},
+ {"getc_unlocked", my_getc_unlocked},
+ {"putc_unlocked", my_putc_unlocked},
+ //{"fgetln", my_fgetln},
+ {"fpurge", my_fpurge},
+ {"getw", my_getw},
+ {"putw", my_putw},
+ {"setbuffer", my_setbuffer},
+ {"setlinebuf", my_setlinebuf},
+ {"__errno", __errno_location},
+ {"__set_errno", my_set_errno},
+ /* net specifics, to avoid __res_get_state */
+ {"getaddrinfo", getaddrinfo},
+ {"gethostbyaddr", gethostbyaddr},
+ {"gethostbyname", gethostbyname},
+ {"gethostbyname2", gethostbyname2},
+ {"gethostent", gethostent},
+ {"strftime", strftime},
+ {"sysconf", my_sysconf},
+ {"sscanf", sscanf},
+ {"scanf", scanf},
+ {"vscanf", vscanf},
+ {"vsscanf", vsscanf},
+ {"openlog", openlog},
+ {"syslog", syslog},
+ {"closelog", closelog},
+ {"vsyslog", vsyslog},
+ {"timer_create", timer_create},
+ {"timer_settime", timer_settime},
+ {"timer_gettime", timer_gettime},
+ {"timer_delete", timer_delete},
+ {"timer_getoverrun", timer_getoverrun},
+ {"abort", abort},
+ {"writev", writev},
+ /* unistd.h */
+ {"access", access},
+ /* grp.h */
+ {"getgrgid", getgrgid},
+ {"__cxa_atexit", __cxa_atexit},
+ {NULL, NULL},
+};
+
+void *get_hooked_symbol(char *sym)
+{
+ struct _hook *ptr = &hooks[0];
+ static int counter = -1;
+
+ while (ptr->name != NULL)
+ {
+ if (strcmp(sym, ptr->name) == 0){
+ return ptr->func;
+ }
+ ptr++;
+ }
+ if (strstr(sym, "pthread") != NULL)
+ {
+ /* safe */
+ if (strcmp(sym, "pthread_sigmask") == 0)
+ return NULL;
+ /* not safe */
+ counter--;
+ LOGD("%s %i\n", sym, counter);
+ return (void *) counter;
+ }
+ return NULL;
+}
+
+void android_linker_init()
+{
+}
--- /dev/null
+/*
+ * Copyright (c) 2012 Carsten Munk <carsten.munk@gmail.com>
+ * Copyright (c) 2013 Christophe Chapuis <chris.chapuis@gmail.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "hooks_shm.h"
+
+#define _GNU_SOURCE
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <errno.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#include <sys/mman.h>
+
+/* Debug */
+#include "logging.h"
+#define LOGD(message, ...) HYBRIS_DEBUG_LOG(HOOKS, message, ##__VA_ARGS__)
+
+#define HYBRIS_DATA_SIZE 4000
+#define HYBRIS_SHM_MASK 0xFF000000UL
+#define HYBRIS_SHM_PATH "/hybris_shm_data"
+
+/* Structure of a shared memory region */
+typedef struct _hybris_shm_data_t {
+ pthread_mutex_t access_mutex;
+ int current_offset;
+ int max_offset;
+ unsigned char data;
+} hybris_shm_data_t;
+
+/* A helper to switch between the size of the data and the size of the shm object */
+const int HYBRIS_SHM_DATA_HEADER_SIZE = (sizeof(hybris_shm_data_t) - sizeof(unsigned char));
+
+/* pointer to the shared memory region */
+static hybris_shm_data_t *_hybris_shm_data = NULL;
+
+/* the SHM mem_id of the shared memory region */
+static int _hybris_shm_fd = -1;
+
+/* the size of the shared memory region that is currently mmap'ed to this process */
+static int _current_mapped_size = 0;
+
+/* forward-declare the internal static methods */
+static void _release_shm(void);
+static void _sync_mmap_with_shm(void);
+static void _hybris_shm_init(void);
+static void _hybris_shm_extend_region(void);
+
+/*
+ * Detach the allocated memory region, and mark it for deletion
+ */
+static void _release_shm(void)
+{
+ if (_hybris_shm_data) {
+ munmap(_hybris_shm_data, _current_mapped_size); /* unmap from this process */
+ _hybris_shm_data = NULL; /* pointer is no more valid */
+ }
+ if (_hybris_shm_fd >= 0) {
+ close(_hybris_shm_fd); /* close the shm file descriptor */
+ _hybris_shm_fd = -1;
+ }
+ shm_unlink(HYBRIS_SHM_PATH); /* request the deletion of the shm region */
+}
+
+/*
+ * Synchronize the size of the mmap with the size of the shm region
+ */
+static void _sync_mmap_with_shm()
+{
+ if (_hybris_shm_fd >= 0 && _hybris_shm_data) {
+ if (_current_mapped_size < _hybris_shm_data->max_offset + HYBRIS_SHM_DATA_HEADER_SIZE) {
+ /* Note that mremap may change the address pointed by _hybris_shm_data.
+ * But as we never point directly into _hybris_shm_data, it's fine.
+ * */
+ _hybris_shm_data = (hybris_shm_data_t *)mremap( _hybris_shm_data, _current_mapped_size,
+ _hybris_shm_data->max_offset + HYBRIS_SHM_DATA_HEADER_SIZE,
+ MREMAP_MAYMOVE );
+
+ _current_mapped_size = _hybris_shm_data->max_offset + HYBRIS_SHM_DATA_HEADER_SIZE;
+ }
+ }
+}
+
+/*
+ * Initialize the shared memory region for hybris, in order to store
+ * pshared mutex, condition and rwlock
+ */
+static void _hybris_shm_init()
+{
+ if (_hybris_shm_fd < 0) {
+ const size_t size_to_map = HYBRIS_SHM_DATA_HEADER_SIZE + HYBRIS_DATA_SIZE; /* 4000 bytes for the data, plus the header size */
+
+ /* initialize or get shared memory segment */
+ _hybris_shm_fd = shm_open(HYBRIS_SHM_PATH, O_RDWR, 0660);
+ if (_hybris_shm_fd >= 0) {
+ /* Map the memory object */
+ _hybris_shm_data = (hybris_shm_data_t *)mmap( NULL, size_to_map,
+ PROT_READ | PROT_WRITE, MAP_SHARED,
+ _hybris_shm_fd, 0 );
+ _current_mapped_size = size_to_map;
+
+ _sync_mmap_with_shm();
+ }
+ else {
+ LOGD("Creating a new shared memory segment.");
+
+ _hybris_shm_fd = shm_open(HYBRIS_SHM_PATH, O_RDWR | O_CREAT, 0660);
+ if (_hybris_shm_fd >= 0) {
+ ftruncate( _hybris_shm_fd, size_to_map );
+ /* Map the memory object */
+ _hybris_shm_data = (hybris_shm_data_t *)mmap( NULL, size_to_map,
+ PROT_READ | PROT_WRITE, MAP_SHARED,
+ _hybris_shm_fd, 0 );
+ if (_hybris_shm_data == MAP_FAILED) {
+ HYBRIS_ERROR_LOG(HOOKS, "ERROR: mmap failed: %s\n", strerror(errno));
+ _release_shm();
+ }
+ else {
+ _current_mapped_size = size_to_map;
+ /* Initialize the memory object */
+ memset((void*)_hybris_shm_data, 0, size_to_map);
+ _hybris_shm_data->max_offset = HYBRIS_DATA_SIZE;
+
+ pthread_mutexattr_t attr;
+ pthread_mutexattr_init(&attr);
+ pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
+ pthread_mutex_init(&_hybris_shm_data->access_mutex, &attr);
+ pthread_mutexattr_destroy(&attr);
+
+ atexit(_release_shm);
+ }
+ }
+ else {
+ HYBRIS_ERROR_LOG(HOOKS, "ERROR: Couldn't create shared memory segment !");
+ }
+ }
+ }
+}
+
+/*
+ * Extend the SHM region's size
+ */
+static void _hybris_shm_extend_region()
+{
+ ftruncate( _hybris_shm_fd, _current_mapped_size + HYBRIS_DATA_SIZE );
+ _hybris_shm_data->max_offset += HYBRIS_DATA_SIZE;
+
+ _sync_mmap_with_shm();
+}
+
+/************ public functions *******************/
+
+ /*
+ * Determine if the pointer that has been extracted by hybris is
+ * pointing to an address in the shared memory
+ */
+int hybris_is_pointer_in_shm(void *ptr)
+{
+ if ((unsigned int)ptr >= HYBRIS_SHM_MASK)
+ return 1;
+
+ return 0;
+}
+
+/*
+ * Convert this offset pointer to the shared memory to an
+ * absolute pointer that can be used in user space
+ */
+void *hybris_get_shmpointer(hybris_shm_pointer_t handle)
+{
+ void *realpointer = NULL;
+ if (hybris_is_pointer_in_shm((void*)handle)) {
+ if (_hybris_shm_fd < 0) {
+ /* if we are not yet attached to any shm region, then do it now */
+ _hybris_shm_init();
+ }
+
+ pthread_mutex_lock(&_hybris_shm_data->access_mutex);
+
+ _sync_mmap_with_shm(); /* make sure our mmap is sync'ed */
+
+ if (_hybris_shm_data != NULL) {
+ unsigned int offset = handle & (~HYBRIS_SHM_MASK);
+ realpointer = &(_hybris_shm_data->data) + offset;
+
+ /* Be careful when activating this trace: this method is called *a lot* !
+ LOGD("handle = %x, offset = %d, realpointer = %x)", handle, offset, realpointer);
+ */
+ }
+
+ pthread_mutex_unlock(&_hybris_shm_data->access_mutex);
+ }
+
+ return realpointer;
+}
+
+/*
+ * Allocate a space in the shared memory region of hybris
+ */
+hybris_shm_pointer_t hybris_shm_alloc(size_t size)
+{
+ hybris_shm_pointer_t location = 0;
+
+ if (_hybris_shm_fd < 0) {
+ /* if we are not yet attached to any shm region, then do it now */
+ _hybris_shm_init();
+ }
+
+ pthread_mutex_lock(&_hybris_shm_data->access_mutex);
+
+ /* Make sure our mmap is sync'ed */
+ _sync_mmap_with_shm();
+
+ if (_hybris_shm_data == NULL || _hybris_shm_fd < 0)
+ return 0;
+
+ if (_hybris_shm_data->current_offset + size >= _hybris_shm_data->max_offset) {
+ /* the current buffer if full: extend it a little bit more */
+ _hybris_shm_extend_region();
+ _sync_mmap_with_shm();
+ }
+
+ /* there is now enough place in this pool */
+ location = _hybris_shm_data->current_offset | HYBRIS_SHM_MASK;
+ LOGD("Allocated a shared object (size = %d, at offset %d)", size, _hybris_shm_data->current_offset);
+
+ _hybris_shm_data->current_offset += size;
+
+ pthread_mutex_unlock(&_hybris_shm_data->access_mutex);
+
+ return location;
+}
--- /dev/null
+/*
+ * Copyright (c) 2012 Carsten Munk <carsten.munk@gmail.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef HOOKS_SHM_H_
+#define HOOKS_SHM_H_
+
+#include <stddef.h>
+
+typedef unsigned int hybris_shm_pointer_t;
+
+/*
+ * Allocate a space in the shared memory region of hybris
+ */
+hybris_shm_pointer_t hybris_shm_alloc(size_t size);
+/*
+ * Test if the pointers points to the shm region
+ */
+int hybris_is_pointer_in_shm(void *ptr);
+/*
+ * Convert an offset pointer to the shared memory to an absolute pointer that can be used in user space
+ * This function will return a NULL pointer if the handle does not actually point to the shm region
+ */
+void *hybris_get_shmpointer(hybris_shm_pointer_t handle);
+
+#endif
+
+// vim:ts=4:sw=4:noexpandtab
--- /dev/null
+if WANT_ARCH_ARM
+ARCHFLAGS = -DHAVE_ARM_TLS_REGISTER -DANDROID_ARM_LINKER
+endif
+
+if WANT_ARCH_X86
+ARCHFLAGS = -DANDROID_X86_LINKER
+endif
+
+noinst_LTLIBRARIES = \
+ libandroid-linker.la
+libandroid_linker_la_SOURCES = \
+ dlfcn.c \
+ linker.c \
+ linker_environ.c \
+ linker_format.c \
+ rt.c
+libandroid_linker_la_CFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/common \
+ -DLINKER_TEXT_BASE=0xB0000100 \
+ -DLINKER_AREA_SIZE=0x01000000 \
+ $(ARCHFLAGS)
+
+if WANT_DEBUG
+libandroid_linker_la_CFLAGS += -DLINKER_DEBUG=1
+else
+libandroid_linker_la_CFLAGS += -DLINKER_DEBUG=0
+endif
--- /dev/null
+
+ Copyright (c) 2005-2008, The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
--- /dev/null
+Android Dynamic Linker Design Notes
+===================================
+
+Introduction:
+-------------
+
+This document provides several notes related to the design of the Android
+dynamic linker.
+
+
+Prelinking:
+-----------
+
+System libraries in Android are internally prelinked, which means that
+any internal relocations within them are stripped from the corresponding
+shared object, in order to reduce size and speed up loading.
+
+Such libraries can only be loaded at the very specific virtual memory address
+they have been prelinked to (during the build process). The list of prelinked
+system libraries and their corresponding virtual memory address is found in
+the file:
+
+ build/core/prelink-linux-<arch>.map
+
+It should be updated each time a new system library is added to the
+system.
+
+The prelink step happens at build time, and uses the 'soslim' and 'apriori'
+tools:
+
+ - 'apriori' is the real prelink tool which removes relocations from the
+ shared object, however, it must be given a list of symbols to remove
+ from the file.
+
+ - 'soslim' is used to find symbols in an executable ELF file
+ and generate a list that can be passed to 'apriori'.
+
+By default, these tools are only used to remove internal symbols from
+libraries, though they have been designed to allow more aggressive
+optimizations (e.g. 'global' prelinking and symbol stripping, which
+prevent replacing individual system libraries though).
+
+You can disable prelinking at build time by modifying your Android.mk with
+a line like:
+
+ LOCAL_PRELINK_MODULE := false
+
+
+Initialization and Termination functions:
+-----------------------------------------
+
+The Unix Sys V Binary Interface standard states that an
+executable can have the following entries in its .dynamic
+section:
+
+ DT_INIT
+ Points to the address of an initialization function
+ that must be called when the file is loaded.
+
+ DT_INIT_ARRAY
+ Points to an array of function addresses that must be
+ called, in-order, to perform initialization. Some of
+ the entries in the array can be 0 or -1, and should
+ be ignored.
+
+ Note: this is generally stored in a .init_array section
+
+ DT_INIT_ARRAYSZ
+ The size of the DT_INITARRAY, if any
+
+ DT_FINI
+ Points to the address of a finalization function which
+ must be called when the file is unloaded or the process
+ terminated.
+
+ DT_FINI_ARRAY
+ Same as DT_INITARRAY but for finalizers. Note that the
+ functions must be called in reverse-order though
+
+ Note: this is generally stored in a .fini_array section
+
+ DT_FINI_ARRAYSZ
+ Size of FT_FINIARRAY
+
+ DT_PREINIT_ARRAY
+ An array similar to DT_INIT_ARRAY which must *only* be
+ present in executables, not shared libraries, which contains
+ a list of functions that need to be called before any other
+ initialization function (i.e. DT_INIT and/or DT_INIT_ARRAY)
+
+ Note: this is generally stored in a .preinit_array section
+
+ DT_PREINIT_ARRAYSZ
+ The size of DT_PREINIT_ARRAY
+
+If both a DT_INIT and DT_INITARRAY entry are present, the DT_INIT
+function must be called before the DT_INITARRAY functions.
+
+Consequently, the DT_FINIARRAY must be parsed in reverse order before
+the DT_FINI function, if both are available.
+
+Note that the implementation of static C++ constructors is very
+much processor dependent, and may use different ELF sections.
+
+On the ARM (see "C++ ABI for ARM" document), the static constructors
+must be called explicitly from the DT_INIT_ARRAY, and each one of them
+shall register a destructor by calling the special __eabi_atexit()
+function (provided by the C library). The DT_FINI_ARRAY is not used
+by static C++ destructors.
+
+On x86, the lists of constructors and destructors are placed in special
+sections named ".ctors" and ".dtors", and the DT_INIT / DT_FINI functions
+are in charge of calling them explicitly.
+
+
+Debugging:
+----------
+
+It is possible to enable debug output in the dynamic linker. To do so,
+follow these steps:
+
+1/ Modify the line in Android.mk that says:
+
+ LOCAL_CFLAGS += -DLINKER_DEBUG=0
+
+ Into the following:
+
+ LOCAL_CFLAGS += -DLINKER_DEBUG=1
+
+2/ Force-rebuild the dynamic linker:
+
+ cd bionic/linker
+ mm -B
+
+3/ Rebuild a new system image.
+
+You can increase the verbosity of debug traces by defining the DEBUG
+environment variable to a numeric value from 0 to 2. This will only
+affect new processes being launched.
+
+By default, traces are sent to logcat, with the "linker" tag. You can
+change this to go to stdout instead by setting the definition of
+LINKER_DEBUG_TO_LOG to 0 in "linker_debug.h".
--- /dev/null
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+ .text
+ .align 4
+ .type _start,#function
+ .globl _start
+
+_start:
+ mov r0, sp
+ mov r1, #0
+ bl __linker_init
+
+ /* linker init returns the _entry address in the main image */
+ mov pc, r0
+
+ .section .ctors, "wa"
+ .globl __CTOR_LIST__
+__CTOR_LIST__:
+ .long -1
--- /dev/null
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ; LOSS
+ * OF USE, DATA, OR PROFITS ; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+.text
+.align 4
+.type _start,#function
+.globl _start
+
+_start:
+ mov r15, r4
+
+ mov.l 0f, r0
+ jsr @r0
+ nop
+
+ /* linker init returns the _entry address in the main image */
+ jmp @r0
+ nop
+
+ .balign 4
+0: .long __linker_init
+
+ .section .ctors, "wa"
+ .globl __CTOR_LIST__
+__CTOR_LIST__:
+ .long -1
--- /dev/null
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+.text
+.align 4
+.type _start, @function
+.globl _start
+
+_start:
+ /* save the elfdata ptr to %eax, AND push it onto the stack */
+ mov %esp, %eax
+ pushl %esp
+
+ pushl %eax
+ call __linker_init
+
+ /* linker init returns (%eax) the _entry address in the main image */
+ /* entry point expects sp to point to elfdata */
+ popl %esp
+ jmp *%eax
+
--- /dev/null
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <signal.h>
+#include <sys/mman.h>
+#include <errno.h>
+
+#include "linker.h"
+
+#include <sys/socket.h>
+#include <sys/un.h>
+
+void notify_gdb_of_libraries();
+
+#define RETRY_ON_EINTR(ret,cond) \
+ do { \
+ ret = (cond); \
+ } while (ret < 0 && errno == EINTR)
+
+
+static int socket_abstract_client(const char *name, int type)
+{
+ struct sockaddr_un addr;
+ size_t namelen;
+ socklen_t alen;
+ int s, err;
+
+ namelen = strlen(name);
+
+ // Test with length +1 for the *initial* '\0'.
+ if ((namelen + 1) > sizeof(addr.sun_path)) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ /* This is used for abstract socket namespace, we need
+ * an initial '\0' at the start of the Unix socket path.
+ *
+ * Note: The path in this case is *not* supposed to be
+ * '\0'-terminated. ("man 7 unix" for the gory details.)
+ */
+ memset (&addr, 0, sizeof addr);
+ addr.sun_family = AF_LOCAL;
+ addr.sun_path[0] = 0;
+ memcpy(addr.sun_path + 1, name, namelen);
+
+ alen = namelen + offsetof(struct sockaddr_un, sun_path) + 1;
+
+ s = socket(AF_LOCAL, type, 0);
+ if(s < 0) return -1;
+
+ RETRY_ON_EINTR(err,connect(s, (struct sockaddr *) &addr, alen));
+ if (err < 0) {
+ close(s);
+ s = -1;
+ }
+
+ return s;
+}
+
+#include "linker_format.h"
+#include <../libc/private/logd.h>
+
+/*
+ * Writes a summary of the signal to the log file.
+ *
+ * We could be here as a result of native heap corruption, or while a
+ * mutex is being held, so we don't want to use any libc functions that
+ * could allocate memory or hold a lock.
+ */
+static void logSignalSummary(int signum, const siginfo_t* info)
+{
+ char buffer[128];
+
+ char* signame;
+ switch (signum) {
+ case SIGILL: signame = "SIGILL"; break;
+ case SIGABRT: signame = "SIGABRT"; break;
+ case SIGBUS: signame = "SIGBUS"; break;
+ case SIGFPE: signame = "SIGFPE"; break;
+ case SIGSEGV: signame = "SIGSEGV"; break;
+ case SIGSTKFLT: signame = "SIGSTKFLT"; break;
+ case SIGPIPE: signame = "SIGPIPE"; break;
+ default: signame = "???"; break;
+ }
+
+ format_buffer(buffer, sizeof(buffer),
+ "Fatal signal %d (%s) at 0x%08x (code=%d)",
+ signum, signame, info->si_addr, info->si_code);
+
+ __libc_android_log_write(ANDROID_LOG_FATAL, "libc", buffer);
+}
+
+/*
+ * Catches fatal signals so we can ask debuggerd to ptrace us before
+ * we crash.
+ */
+void debugger_signal_handler(int n, siginfo_t* info, void* unused)
+{
+ unsigned tid;
+ int s;
+
+ logSignalSummary(n, info);
+
+ tid = gettid();
+ s = socket_abstract_client("android:debuggerd", SOCK_STREAM);
+
+ if(s >= 0) {
+ /* debugger knows our pid from the credentials on the
+ * local socket but we need to tell it our tid. It
+ * is paranoid and will verify that we are giving a tid
+ * that's actually in our process
+ */
+ int ret;
+
+ RETRY_ON_EINTR(ret, write(s, &tid, sizeof(unsigned)));
+ if (ret == sizeof(unsigned)) {
+ /* if the write failed, there is no point to read on
+ * the file descriptor. */
+ RETRY_ON_EINTR(ret, read(s, &tid, 1));
+ notify_gdb_of_libraries();
+ }
+ close(s);
+ }
+
+ /* remove our net so we fault for real when we return */
+ signal(n, SIG_DFL);
+}
+
+void debugger_init()
+{
+ struct sigaction act;
+ memset(&act, 0, sizeof(act));
+ act.sa_sigaction = debugger_signal_handler;
+ act.sa_flags = SA_RESTART | SA_SIGINFO;
+ sigemptyset(&act.sa_mask);
+
+ sigaction(SIGILL, &act, NULL);
+ sigaction(SIGABRT, &act, NULL);
+ sigaction(SIGBUS, &act, NULL);
+ sigaction(SIGFPE, &act, NULL);
+ sigaction(SIGSEGV, &act, NULL);
+ sigaction(SIGSTKFLT, &act, NULL);
+ sigaction(SIGPIPE, &act, NULL);
+}
--- /dev/null
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#define _GNU_SOURCE
+#include <dlfcn.h>
+#include <pthread.h>
+#include <time.h>
+#include <stdio.h>
+#include <string.h>
+#include "linker.h"
+#include "linker_format.h"
+
+/* This file hijacks the symbols stubbed out in libdl.so. */
+
+#define DL_SUCCESS 0
+#define DL_ERR_CANNOT_LOAD_LIBRARY 1
+#define DL_ERR_INVALID_LIBRARY_HANDLE 2
+#define DL_ERR_BAD_SYMBOL_NAME 3
+#define DL_ERR_SYMBOL_NOT_FOUND 4
+#define DL_ERR_SYMBOL_NOT_GLOBAL 5
+
+static char dl_err_buf[1024];
+static const char *dl_err_str;
+
+static const char *dl_errors[] = {
+ [DL_ERR_CANNOT_LOAD_LIBRARY] = "Cannot load library",
+ [DL_ERR_INVALID_LIBRARY_HANDLE] = "Invalid library handle",
+ [DL_ERR_BAD_SYMBOL_NAME] = "Invalid symbol name",
+ [DL_ERR_SYMBOL_NOT_FOUND] = "Symbol not found",
+ [DL_ERR_SYMBOL_NOT_GLOBAL] = "Symbol is not global",
+};
+
+#define likely(expr) __builtin_expect (expr, 1)
+#define unlikely(expr) __builtin_expect (expr, 0)
+
+static pthread_mutex_t dl_lock = PTHREAD_MUTEX_INITIALIZER;
+
+static void set_dlerror(int err)
+{
+ format_buffer(dl_err_buf, sizeof(dl_err_buf), "%s: %s", dl_errors[err],
+ linker_get_error());
+ dl_err_str = (const char *)&dl_err_buf[0];
+};
+
+void *android_dlopen(const char *filename, int flag)
+{
+ soinfo *ret;
+
+ pthread_mutex_lock(&dl_lock);
+ ret = find_library(filename);
+ if (unlikely(ret == NULL)) {
+ set_dlerror(DL_ERR_CANNOT_LOAD_LIBRARY);
+ } else {
+ ret->refcount++;
+ }
+ pthread_mutex_unlock(&dl_lock);
+ return ret;
+}
+
+const char *android_dlerror(void)
+{
+ const char *tmp = dl_err_str;
+ dl_err_str = NULL;
+ return (const char *)tmp;
+}
+
+void *android_dlsym(void *handle, const char *symbol)
+{
+ soinfo *found;
+ Elf32_Sym *sym;
+ unsigned bind;
+
+ pthread_mutex_lock(&dl_lock);
+
+ if(unlikely(handle == 0)) {
+ set_dlerror(DL_ERR_INVALID_LIBRARY_HANDLE);
+ goto err;
+ }
+ if(unlikely(symbol == 0)) {
+ set_dlerror(DL_ERR_BAD_SYMBOL_NAME);
+ goto err;
+ }
+
+ if(handle == RTLD_DEFAULT) {
+ sym = lookup(symbol, &found, NULL);
+ } else if(handle == RTLD_NEXT) {
+ void *ret_addr = __builtin_return_address(0);
+ soinfo *si = find_containing_library(ret_addr);
+
+ sym = NULL;
+ if(si && si->next) {
+ sym = lookup(symbol, &found, si->next);
+ }
+ } else {
+ found = (soinfo*)handle;
+ sym = lookup_in_library(found, symbol);
+ }
+
+ if(likely(sym != 0)) {
+ bind = ELF32_ST_BIND(sym->st_info);
+
+ if(likely((bind == STB_GLOBAL) && (sym->st_shndx != 0))) {
+ unsigned ret = sym->st_value + found->base;
+ pthread_mutex_unlock(&dl_lock);
+ return (void*)ret;
+ }
+
+ set_dlerror(DL_ERR_SYMBOL_NOT_GLOBAL);
+ }
+ else
+ set_dlerror(DL_ERR_SYMBOL_NOT_FOUND);
+
+err:
+ pthread_mutex_unlock(&dl_lock);
+ return 0;
+}
+
+int android_dladdr(const void *addr, Dl_info *info)
+{
+ int ret = 0;
+
+ pthread_mutex_lock(&dl_lock);
+
+ /* Determine if this address can be found in any library currently mapped */
+ soinfo *si = find_containing_library(addr);
+
+ if(si) {
+ memset(info, 0, sizeof(Dl_info));
+
+ info->dli_fname = si->name;
+ info->dli_fbase = (void*)si->base;
+
+ /* Determine if any symbol in the library contains the specified address */
+ Elf32_Sym *sym = find_containing_symbol(addr, si);
+
+ if(sym != NULL) {
+ info->dli_sname = si->strtab + sym->st_name;
+ info->dli_saddr = (void*)(si->base + sym->st_value);
+ }
+
+ ret = 1;
+ }
+
+ pthread_mutex_unlock(&dl_lock);
+
+ return ret;
+}
+
+int android_dlclose(void *handle)
+{
+ pthread_mutex_lock(&dl_lock);
+ (void)unload_library((soinfo*)handle);
+ pthread_mutex_unlock(&dl_lock);
+ return 0;
+}
+
+#if defined(ANDROID_ARM_LINKER)
+// 0000000 00011111 111112 22222222 2333333 333344444444445555555
+// 0123456 78901234 567890 12345678 9012345 678901234567890123456
+#define ANDROID_LIBDL_STRTAB \
+ "dlopen\0dlclose\0dlsym\0dlerror\0dladdr\0dl_unwind_find_exidx\0"
+
+_Unwind_Ptr android_dl_unwind_find_exidx(_Unwind_Ptr pc, int *pcount);
+
+#elif defined(ANDROID_X86_LINKER)
+// 0000000 00011111 111112 22222222 2333333 3333444444444455
+// 0123456 78901234 567890 12345678 9012345 6789012345678901
+#define ANDROID_LIBDL_STRTAB \
+ "dlopen\0dlclose\0dlsym\0dlerror\0dladdr\0dl_iterate_phdr\0"
+
+int android_dl_iterate_phdr(int (*cb)(struct dl_phdr_info *info, size_t size, void *data),void *data);
+
+#elif defined(ANDROID_SH_LINKER)
+// 0000000 00011111 111112 22222222 2333333 3333444444444455
+// 0123456 78901234 567890 12345678 9012345 6789012345678901
+#define ANDROID_LIBDL_STRTAB \
+ "dlopen\0dlclose\0dlsym\0dlerror\0dladdr\0dl_iterate_phdr\0"
+
+#else /* !defined(ANDROID_ARM_LINKER) && !defined(ANDROID_X86_LINKER) */
+#error Unsupported architecture. Only ARM and x86 are presently supported.
+#endif
+
+
+static Elf32_Sym libdl_symtab[] = {
+ // total length of libdl_info.strtab, including trailing 0
+ // This is actually the the STH_UNDEF entry. Technically, it's
+ // supposed to have st_name == 0, but instead, it points to an index
+ // in the strtab with a \0 to make iterating through the symtab easier.
+ { st_name: sizeof(ANDROID_LIBDL_STRTAB) - 1,
+ },
+ { st_name: 0, // starting index of the name in libdl_info.strtab
+ st_value: (Elf32_Addr) &android_dlopen,
+ st_info: STB_GLOBAL << 4,
+ st_shndx: 1,
+ },
+ { st_name: 7,
+ st_value: (Elf32_Addr) &android_dlclose,
+ st_info: STB_GLOBAL << 4,
+ st_shndx: 1,
+ },
+ { st_name: 15,
+ st_value: (Elf32_Addr) &android_dlsym,
+ st_info: STB_GLOBAL << 4,
+ st_shndx: 1,
+ },
+ { st_name: 21,
+ st_value: (Elf32_Addr) &android_dlerror,
+ st_info: STB_GLOBAL << 4,
+ st_shndx: 1,
+ },
+ { st_name: 29,
+ st_value: (Elf32_Addr) &android_dladdr,
+ st_info: STB_GLOBAL << 4,
+ st_shndx: 1,
+ },
+#ifdef ANDROID_ARM_LINKER
+ { st_name: 36,
+ st_value: (Elf32_Addr) &android_dl_unwind_find_exidx,
+ st_info: STB_GLOBAL << 4,
+ st_shndx: 1,
+ },
+#elif defined(ANDROID_X86_LINKER)
+ { st_name: 36,
+ st_value: (Elf32_Addr) &android_dl_iterate_phdr,
+ st_info: STB_GLOBAL << 4,
+ st_shndx: 1,
+ },
+#elif defined(ANDROID_SH_LINKER)
+ { st_name: 36,
+ st_value: (Elf32_Addr) &android_dl_iterate_phdr,
+ st_info: STB_GLOBAL << 4,
+ st_shndx: 1,
+ },
+#endif
+};
+
+/* Fake out a hash table with a single bucket.
+ * A search of the hash table will look through
+ * libdl_symtab starting with index [1], then
+ * use libdl_chains to find the next index to
+ * look at. libdl_chains should be set up to
+ * walk through every element in libdl_symtab,
+ * and then end with 0 (sentinel value).
+ *
+ * I.e., libdl_chains should look like
+ * { 0, 2, 3, ... N, 0 } where N is the number
+ * of actual symbols, or nelems(libdl_symtab)-1
+ * (since the first element of libdl_symtab is not
+ * a real symbol).
+ *
+ * (see _elf_lookup())
+ *
+ * Note that adding any new symbols here requires
+ * stubbing them out in libdl.
+ */
+static unsigned libdl_buckets[1] = { 1 };
+static unsigned libdl_chains[7] = { 0, 2, 3, 4, 5, 6, 0 };
+
+soinfo libdl_info = {
+ name: "libdl.so",
+ flags: FLAG_LINKED,
+
+ strtab: ANDROID_LIBDL_STRTAB,
+ symtab: libdl_symtab,
+
+ nbucket: 1,
+ nchain: 7,
+ bucket: libdl_buckets,
+ chain: libdl_chains,
+};
+
--- /dev/null
+/*
+ * Copyright (C) 2008, 2009 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <linux/auxvec.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <dlfcn.h>
+#include <sys/stat.h>
+
+#include <pthread.h>
+
+#include <sys/mman.h>
+
+/* special private C library header - see Android.mk */
+#include "bionic_tls.h"
+
+#include "linker.h"
+#include "linker_debug.h"
+#include "linker_environ.h"
+#include "linker_format.h"
+
+#define ALLOW_SYMBOLS_FROM_MAIN 1
+#define SO_MAX 128
+
+/* Assume average path length of 64 and max 8 paths */
+#define LDPATH_BUFSIZE 512
+#define LDPATH_MAX 8
+
+#define LDPRELOAD_BUFSIZE 512
+#define LDPRELOAD_MAX 8
+
+/* >>> IMPORTANT NOTE - READ ME BEFORE MODIFYING <<<
+ *
+ * Do NOT use malloc() and friends or pthread_*() code here.
+ * Don't use printf() either; it's caused mysterious memory
+ * corruption in the past.
+ * The linker runs before we bring up libc and it's easiest
+ * to make sure it does not depend on any complex libc features
+ *
+ * open issues / todo:
+ *
+ * - are we doing everything we should for ARM_COPY relocations?
+ * - cleaner error reporting
+ * - after linking, set as much stuff as possible to READONLY
+ * and NOEXEC
+ * - linker hardcodes PAGE_SIZE and PAGE_MASK because the kernel
+ * headers provide versions that are negative...
+ * - allocate space for soinfo structs dynamically instead of
+ * having a hard limit (64)
+*/
+
+
+static int link_image(soinfo *si, unsigned wr_offset);
+
+static int socount = 0;
+static soinfo sopool[SO_MAX];
+static soinfo *freelist = NULL;
+static soinfo *solist = &libdl_info;
+static soinfo *sonext = &libdl_info;
+#if ALLOW_SYMBOLS_FROM_MAIN
+static soinfo *somain; /* main process, always the one after libdl_info */
+#endif
+
+
+static inline int validate_soinfo(soinfo *si)
+{
+ return (si >= sopool && si < sopool + SO_MAX) ||
+ si == &libdl_info;
+}
+
+static char ldpaths_buf[LDPATH_BUFSIZE];
+static const char *ldpaths[LDPATH_MAX + 1];
+
+static char ldpreloads_buf[LDPRELOAD_BUFSIZE];
+static const char *ldpreload_names[LDPRELOAD_MAX + 1];
+
+static soinfo *preloads[LDPRELOAD_MAX + 1];
+
+#if LINKER_DEBUG
+int debug_verbosity;
+#endif
+
+static int pid;
+
+/* This boolean is set if the program being loaded is setuid */
+static int program_is_setuid;
+
+#if STATS
+struct _link_stats linker_stats;
+#endif
+
+#if COUNT_PAGES
+unsigned bitmask[4096];
+#endif
+
+#ifndef PT_ARM_EXIDX
+#define PT_ARM_EXIDX 0x70000001 /* .ARM.exidx segment */
+#endif
+
+static char tmp_err_buf[768];
+static char __linker_dl_err_buf[768];
+#define DL_ERR(fmt, x...) \
+ do { \
+ format_buffer(__linker_dl_err_buf, sizeof(__linker_dl_err_buf), \
+ "%s[%d]: " fmt, __func__, __LINE__, ##x); \
+ ERROR(fmt "\n", ##x); \
+ } while(0)
+
+const char *linker_get_error(void)
+{
+ return (const char *)&__linker_dl_err_buf[0];
+}
+
+/*
+ * This function is an empty stub where GDB locates a breakpoint to get notified
+ * about linker activity.
+ */
+extern void __attribute__((noinline)) rtld_db_dlactivity(void);
+
+static struct r_debug _r_debug = {1, NULL, &rtld_db_dlactivity,
+ RT_CONSISTENT, 0};
+static struct link_map *r_debug_tail = 0;
+
+static pthread_mutex_t _r_debug_lock = PTHREAD_MUTEX_INITIALIZER;
+
+static void insert_soinfo_into_debug_map(soinfo * info)
+{
+ struct link_map * map;
+
+ /* Copy the necessary fields into the debug structure.
+ */
+ map = &(info->linkmap);
+ map->l_addr = info->base;
+ map->l_name = (char*) info->name;
+ map->l_ld = (uintptr_t)info->dynamic;
+
+ /* Stick the new library at the end of the list.
+ * gdb tends to care more about libc than it does
+ * about leaf libraries, and ordering it this way
+ * reduces the back-and-forth over the wire.
+ */
+ if (r_debug_tail) {
+ r_debug_tail->l_next = map;
+ map->l_prev = r_debug_tail;
+ map->l_next = 0;
+ } else {
+ _r_debug.r_map = map;
+ map->l_prev = 0;
+ map->l_next = 0;
+ }
+ r_debug_tail = map;
+}
+
+static void remove_soinfo_from_debug_map(soinfo * info)
+{
+ struct link_map * map = &(info->linkmap);
+
+ if (r_debug_tail == map)
+ r_debug_tail = map->l_prev;
+
+ if (map->l_prev) map->l_prev->l_next = map->l_next;
+ if (map->l_next) map->l_next->l_prev = map->l_prev;
+}
+
+void notify_gdb_of_load(soinfo * info)
+{
+ if (info->flags & FLAG_EXE) {
+ // GDB already knows about the main executable
+ return;
+ }
+
+ pthread_mutex_lock(&_r_debug_lock);
+
+ _r_debug.r_state = RT_ADD;
+ rtld_db_dlactivity();
+
+ insert_soinfo_into_debug_map(info);
+
+ _r_debug.r_state = RT_CONSISTENT;
+ rtld_db_dlactivity();
+
+ pthread_mutex_unlock(&_r_debug_lock);
+}
+
+void notify_gdb_of_unload(soinfo * info)
+{
+ if (info->flags & FLAG_EXE) {
+ // GDB already knows about the main executable
+ return;
+ }
+
+ pthread_mutex_lock(&_r_debug_lock);
+
+ _r_debug.r_state = RT_DELETE;
+ rtld_db_dlactivity();
+
+ remove_soinfo_from_debug_map(info);
+
+ _r_debug.r_state = RT_CONSISTENT;
+ rtld_db_dlactivity();
+
+ pthread_mutex_unlock(&_r_debug_lock);
+}
+
+void notify_gdb_of_libraries()
+{
+ _r_debug.r_state = RT_ADD;
+ rtld_db_dlactivity();
+ _r_debug.r_state = RT_CONSISTENT;
+ rtld_db_dlactivity();
+}
+
+static soinfo *alloc_info(const char *name)
+{
+ soinfo *si;
+
+ if(strlen(name) >= SOINFO_NAME_LEN) {
+ DL_ERR("%5d library name %s too long", pid, name);
+ return NULL;
+ }
+
+ /* The freelist is populated when we call free_info(), which in turn is
+ done only by dlclose(), which is not likely to be used.
+ */
+ if (!freelist) {
+ if(socount == SO_MAX) {
+ DL_ERR("%5d too many libraries when loading %s", pid, name);
+ return NULL;
+ }
+ freelist = sopool + socount++;
+ freelist->next = NULL;
+ }
+
+ si = freelist;
+ freelist = freelist->next;
+
+ /* Make sure we get a clean block of soinfo */
+ memset(si, 0, sizeof(soinfo));
+ strlcpy((char*) si->name, name, sizeof(si->name));
+ sonext->next = si;
+ si->next = NULL;
+ si->refcount = 0;
+ sonext = si;
+
+ TRACE("%5d name %s: allocated soinfo @ %p\n", pid, name, si);
+ return si;
+}
+
+static void free_info(soinfo *si)
+{
+ soinfo *prev = NULL, *trav;
+
+ TRACE("%5d name %s: freeing soinfo @ %p\n", pid, si->name, si);
+
+ for(trav = solist; trav != NULL; trav = trav->next){
+ if (trav == si)
+ break;
+ prev = trav;
+ }
+ if (trav == NULL) {
+ /* si was not ni solist */
+ DL_ERR("%5d name %s is not in solist!", pid, si->name);
+ return;
+ }
+
+ /* prev will never be NULL, because the first entry in solist is
+ always the static libdl_info.
+ */
+ prev->next = si->next;
+ if (si == sonext) sonext = prev;
+ si->next = freelist;
+ freelist = si;
+}
+
+const char *addr_to_name(unsigned addr)
+{
+ soinfo *si;
+
+ for(si = solist; si != 0; si = si->next){
+ if((addr >= si->base) && (addr < (si->base + si->size))) {
+ return si->name;
+ }
+ }
+
+ return "";
+}
+
+/* For a given PC, find the .so that it belongs to.
+ * Returns the base address of the .ARM.exidx section
+ * for that .so, and the number of 8-byte entries
+ * in that section (via *pcount).
+ *
+ * Intended to be called by libc's __gnu_Unwind_Find_exidx().
+ *
+ * This function is exposed via dlfcn.c and libdl.so.
+ */
+#ifdef ANDROID_ARM_LINKER
+_Unwind_Ptr android_dl_unwind_find_exidx(_Unwind_Ptr pc, int *pcount)
+{
+ soinfo *si;
+ unsigned addr = (unsigned)pc;
+
+ for (si = solist; si != 0; si = si->next){
+ if ((addr >= si->base) && (addr < (si->base + si->size))) {
+ *pcount = si->ARM_exidx_count;
+ return (_Unwind_Ptr)(si->base + (unsigned long)si->ARM_exidx);
+ }
+ }
+ *pcount = 0;
+ return NULL;
+}
+#elif defined(ANDROID_X86_LINKER)
+/* Here, we only have to provide a callback to iterate across all the
+ * loaded libraries. gcc_eh does the rest. */
+int
+android_dl_iterate_phdr(int (*cb)(struct dl_phdr_info *info, size_t size, void *data),
+ void *data)
+{
+ soinfo *si;
+ struct dl_phdr_info dl_info;
+ int rv = 0;
+
+ for (si = solist; si != NULL; si = si->next) {
+ dl_info.dlpi_addr = si->linkmap.l_addr;
+ dl_info.dlpi_name = si->linkmap.l_name;
+ dl_info.dlpi_phdr = si->phdr;
+ dl_info.dlpi_phnum = si->phnum;
+ rv = cb(&dl_info, sizeof (struct dl_phdr_info), data);
+ if (rv != 0)
+ break;
+ }
+ return rv;
+}
+#endif
+
+static Elf32_Sym *_elf_lookup(soinfo *si, unsigned hash, const char *name)
+{
+ Elf32_Sym *s;
+ Elf32_Sym *symtab = si->symtab;
+ const char *strtab = si->strtab;
+ unsigned n;
+
+ TRACE_TYPE(LOOKUP, "%5d SEARCH %s in %s@0x%08x %08x %d\n", pid,
+ name, si->name, si->base, hash, hash % si->nbucket);
+ n = hash % si->nbucket;
+
+ for(n = si->bucket[hash % si->nbucket]; n != 0; n = si->chain[n]){
+ s = symtab + n;
+ if(strcmp(strtab + s->st_name, name)) continue;
+
+ /* only concern ourselves with global and weak symbol definitions */
+ switch(ELF32_ST_BIND(s->st_info)){
+ case STB_GLOBAL:
+ case STB_WEAK:
+ /* no section == undefined */
+ if(s->st_shndx == 0) continue;
+
+ TRACE_TYPE(LOOKUP, "%5d FOUND %s in %s (%08x) %d\n", pid,
+ name, si->name, s->st_value, s->st_size);
+ return s;
+ }
+ }
+
+ return NULL;
+}
+
+static unsigned elfhash(const char *_name)
+{
+ const unsigned char *name = (const unsigned char *) _name;
+ unsigned h = 0, g;
+
+ while(*name) {
+ h = (h << 4) + *name++;
+ g = h & 0xf0000000;
+ h ^= g;
+ h ^= g >> 24;
+ }
+ return h;
+}
+
+static Elf32_Sym *
+_do_lookup(soinfo *si, const char *name, unsigned *base)
+{
+ unsigned elf_hash = elfhash(name);
+ Elf32_Sym *s;
+ unsigned *d;
+ soinfo *lsi = si;
+ int i;
+
+ /* Look for symbols in the local scope first (the object who is
+ * searching). This happens with C++ templates on i386 for some
+ * reason.
+ *
+ * Notes on weak symbols:
+ * The ELF specs are ambigious about treatment of weak definitions in
+ * dynamic linking. Some systems return the first definition found
+ * and some the first non-weak definition. This is system dependent.
+ * Here we return the first definition found for simplicity. */
+ s = _elf_lookup(si, elf_hash, name);
+ if(s != NULL)
+ goto done;
+
+ /* Next, look for it in the preloads list */
+ for(i = 0; preloads[i] != NULL; i++) {
+ lsi = preloads[i];
+ s = _elf_lookup(lsi, elf_hash, name);
+ if(s != NULL)
+ goto done;
+ }
+
+ for(d = si->dynamic; *d; d += 2) {
+ if(d[0] == DT_NEEDED){
+ lsi = (soinfo *)d[1];
+ if (!validate_soinfo(lsi)) {
+ DL_ERR("%5d bad DT_NEEDED pointer in %s",
+ pid, si->name);
+ return NULL;
+ }
+
+ DEBUG("%5d %s: looking up %s in %s\n",
+ pid, si->name, name, lsi->name);
+ s = _elf_lookup(lsi, elf_hash, name);
+ if ((s != NULL) && (s->st_shndx != SHN_UNDEF))
+ goto done;
+ }
+ }
+
+#if ALLOW_SYMBOLS_FROM_MAIN
+ /* If we are resolving relocations while dlopen()ing a library, it's OK for
+ * the library to resolve a symbol that's defined in the executable itself,
+ * although this is rare and is generally a bad idea.
+ */
+ if (somain) {
+ lsi = somain;
+ DEBUG("%5d %s: looking up %s in executable %s\n",
+ pid, si->name, name, lsi->name);
+ s = _elf_lookup(lsi, elf_hash, name);
+ }
+#endif
+
+done:
+ if(s != NULL) {
+ TRACE_TYPE(LOOKUP, "%5d si %s sym %s s->st_value = 0x%08x, "
+ "found in %s, base = 0x%08x\n",
+ pid, si->name, name, s->st_value, lsi->name, lsi->base);
+ *base = lsi->base;
+ return s;
+ }
+
+ return NULL;
+}
+
+/* This is used by dl_sym(). It performs symbol lookup only within the
+ specified soinfo object and not in any of its dependencies.
+ */
+Elf32_Sym *lookup_in_library(soinfo *si, const char *name)
+{
+ return _elf_lookup(si, elfhash(name), name);
+}
+
+/* This is used by dl_sym(). It performs a global symbol lookup.
+ */
+Elf32_Sym *lookup(const char *name, soinfo **found, soinfo *start)
+{
+ unsigned elf_hash = elfhash(name);
+ Elf32_Sym *s = NULL;
+ soinfo *si;
+
+ if(start == NULL) {
+ start = solist;
+ }
+
+ for(si = start; (s == NULL) && (si != NULL); si = si->next)
+ {
+ if(si->flags & FLAG_ERROR)
+ continue;
+ s = _elf_lookup(si, elf_hash, name);
+ if (s != NULL) {
+ *found = si;
+ break;
+ }
+ }
+
+ if(s != NULL) {
+ TRACE_TYPE(LOOKUP, "%5d %s s->st_value = 0x%08x, "
+ "si->base = 0x%08x\n", pid, name, s->st_value, si->base);
+ return s;
+ }
+
+ return NULL;
+}
+
+soinfo *find_containing_library(const void *addr)
+{
+ soinfo *si;
+
+ for(si = solist; si != NULL; si = si->next)
+ {
+ if((unsigned)addr >= si->base && (unsigned)addr - si->base < si->size) {
+ return si;
+ }
+ }
+
+ return NULL;
+}
+
+Elf32_Sym *find_containing_symbol(const void *addr, soinfo *si)
+{
+ unsigned int i;
+ unsigned soaddr = (unsigned)addr - si->base;
+
+ /* Search the library's symbol table for any defined symbol which
+ * contains this address */
+ for(i=0; i<si->nchain; i++) {
+ Elf32_Sym *sym = &si->symtab[i];
+
+ if(sym->st_shndx != SHN_UNDEF &&
+ soaddr >= sym->st_value &&
+ soaddr < sym->st_value + sym->st_size) {
+ return sym;
+ }
+ }
+
+ return NULL;
+}
+
+#if 0
+static void dump(soinfo *si)
+{
+ Elf32_Sym *s = si->symtab;
+ unsigned n;
+
+ for(n = 0; n < si->nchain; n++) {
+ TRACE("%5d %04d> %08x: %02x %04x %08x %08x %s\n", pid, n, s,
+ s->st_info, s->st_shndx, s->st_value, s->st_size,
+ si->strtab + s->st_name);
+ s++;
+ }
+}
+#endif
+
+static const char *sopaths[] = {
+ "/vendor/lib",
+ "/system/lib",
+ 0
+};
+
+static int _open_lib(const char *name)
+{
+ int fd;
+ struct stat filestat;
+
+ if ((stat(name, &filestat) >= 0) && S_ISREG(filestat.st_mode)) {
+ if ((fd = open(name, O_RDONLY)) >= 0)
+ return fd;
+ }
+
+ return -1;
+}
+
+static int open_library(const char *name)
+{
+ int fd;
+ char buf[512];
+ const char **path;
+ int n;
+
+ TRACE("[ %5d opening %s ]\n", pid, name);
+
+ if(name == 0) return -1;
+ if(strlen(name) > 256) return -1;
+
+ if ((name[0] == '/') && ((fd = _open_lib(name)) >= 0))
+ return fd;
+
+ for (path = ldpaths; *path; path++) {
+ n = format_buffer(buf, sizeof(buf), "%s/%s", *path, name);
+ if (n < 0 || n >= (int)sizeof(buf)) {
+ WARN("Ignoring very long library path: %s/%s\n", *path, name);
+ continue;
+ }
+ if ((fd = _open_lib(buf)) >= 0)
+ return fd;
+ }
+ for (path = sopaths; *path; path++) {
+ n = format_buffer(buf, sizeof(buf), "%s/%s", *path, name);
+ if (n < 0 || n >= (int)sizeof(buf)) {
+ WARN("Ignoring very long library path: %s/%s\n", *path, name);
+ continue;
+ }
+ if ((fd = _open_lib(buf)) >= 0)
+ return fd;
+ }
+
+ return -1;
+}
+
+/* temporary space for holding the first page of the shared lib
+ * which contains the elf header (with the pht). */
+static unsigned char __header[PAGE_SIZE];
+
+typedef struct {
+ long mmap_addr;
+ char tag[4]; /* 'P', 'R', 'E', ' ' */
+} prelink_info_t;
+
+/* Returns the requested base address if the library is prelinked,
+ * and 0 otherwise. */
+static unsigned long
+is_prelinked(int fd, const char *name)
+{
+ off_t sz;
+ prelink_info_t info;
+
+ sz = lseek(fd, -sizeof(prelink_info_t), SEEK_END);
+ if (sz < 0) {
+ DL_ERR("lseek() failed!");
+ return 0;
+ }
+
+ if (read(fd, &info, sizeof(info)) != sizeof(info)) {
+ WARN("Could not read prelink_info_t structure for `%s`\n", name);
+ return 0;
+ }
+
+ if (strncmp(info.tag, "PRE ", 4)) {
+ WARN("`%s` is not a prelinked library\n", name);
+ return 0;
+ }
+
+ return (unsigned long)info.mmap_addr;
+}
+
+/* verify_elf_object
+ * Verifies if the object @ base is a valid ELF object
+ *
+ * Args:
+ *
+ * Returns:
+ * 0 on success
+ * -1 if no valid ELF object is found @ base.
+ */
+static int
+verify_elf_object(void *base, const char *name)
+{
+ Elf32_Ehdr *hdr = (Elf32_Ehdr *) base;
+
+ if (hdr->e_ident[EI_MAG0] != ELFMAG0) return -1;
+ if (hdr->e_ident[EI_MAG1] != ELFMAG1) return -1;
+ if (hdr->e_ident[EI_MAG2] != ELFMAG2) return -1;
+ if (hdr->e_ident[EI_MAG3] != ELFMAG3) return -1;
+
+ /* TODO: Should we verify anything else in the header? */
+#ifdef ANDROID_ARM_LINKER
+ if (hdr->e_machine != EM_ARM) return -1;
+#elif defined(ANDROID_X86_LINKER)
+ if (hdr->e_machine != EM_386) return -1;
+#endif
+ return 0;
+}
+
+
+/* get_lib_extents
+ * Retrieves the base (*base) address where the ELF object should be
+ * mapped and its overall memory size (*total_sz).
+ *
+ * Args:
+ * fd: Opened file descriptor for the library
+ * name: The name of the library
+ * _hdr: Pointer to the header page of the library
+ * total_sz: Total size of the memory that should be allocated for
+ * this library
+ *
+ * Returns:
+ * -1 if there was an error while trying to get the lib extents.
+ * The possible reasons are:
+ * - Could not determine if the library was prelinked.
+ * - The library provided is not a valid ELF object
+ * 0 if the library did not request a specific base offset (normal
+ * for non-prelinked libs)
+ * > 0 if the library requests a specific address to be mapped to.
+ * This indicates a pre-linked library.
+ */
+static unsigned
+get_lib_extents(int fd, const char *name, void *__hdr, unsigned *total_sz)
+{
+ unsigned req_base;
+ unsigned min_vaddr = 0xffffffff;
+ unsigned max_vaddr = 0;
+ unsigned char *_hdr = (unsigned char *)__hdr;
+ Elf32_Ehdr *ehdr = (Elf32_Ehdr *)_hdr;
+ Elf32_Phdr *phdr;
+ int cnt;
+
+ TRACE("[ %5d Computing extents for '%s'. ]\n", pid, name);
+ if (verify_elf_object(_hdr, name) < 0) {
+ DL_ERR("%5d - %s is not a valid ELF object", pid, name);
+ return (unsigned)-1;
+ }
+
+ req_base = (unsigned) is_prelinked(fd, name);
+ if (req_base == (unsigned)-1)
+ return -1;
+ else if (req_base != 0) {
+ TRACE("[ %5d - Prelinked library '%s' requesting base @ 0x%08x ]\n",
+ pid, name, req_base);
+ } else {
+ TRACE("[ %5d - Non-prelinked library '%s' found. ]\n", pid, name);
+ }
+
+ phdr = (Elf32_Phdr *)(_hdr + ehdr->e_phoff);
+
+ /* find the min/max p_vaddrs from all the PT_LOAD segments so we can
+ * get the range. */
+ for (cnt = 0; cnt < ehdr->e_phnum; ++cnt, ++phdr) {
+ if (phdr->p_type == PT_LOAD) {
+ if ((phdr->p_vaddr + phdr->p_memsz) > max_vaddr)
+ max_vaddr = phdr->p_vaddr + phdr->p_memsz;
+ if (phdr->p_vaddr < min_vaddr)
+ min_vaddr = phdr->p_vaddr;
+ }
+ }
+
+ if ((min_vaddr == 0xffffffff) && (max_vaddr == 0)) {
+ DL_ERR("%5d - No loadable segments found in %s.", pid, name);
+ return (unsigned)-1;
+ }
+
+ /* truncate min_vaddr down to page boundary */
+ min_vaddr &= ~PAGE_MASK;
+
+ /* round max_vaddr up to the next page */
+ max_vaddr = (max_vaddr + PAGE_SIZE - 1) & ~PAGE_MASK;
+
+ *total_sz = (max_vaddr - min_vaddr);
+ return (unsigned)req_base;
+}
+
+/* alloc_mem_region
+ *
+ * This function reserves a chunk of memory to be used for mapping in
+ * the shared library. We reserve the entire memory region here, and
+ * then the rest of the linker will relocate the individual loadable
+ * segments into the correct locations within this memory range.
+ *
+ * Args:
+ * si->base: The requested base of the allocation. If 0, a sane one will be
+ * chosen in the range LIBBASE <= base < LIBLAST.
+ * si->size: The size of the allocation.
+ *
+ * Returns:
+ * -1 on failure, and 0 on success. On success, si->base will contain
+ * the virtual address at which the library will be mapped.
+ */
+
+static int reserve_mem_region(soinfo *si)
+{
+ void *base = mmap((void *)si->base, si->size, PROT_READ | PROT_EXEC,
+ MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ if (base == MAP_FAILED) {
+ DL_ERR("%5d can NOT map (%sprelinked) library '%s' at 0x%08x "
+ "as requested, will try general pool: %d (%s)",
+ pid, (si->base ? "" : "non-"), si->name, si->base,
+ errno, strerror(errno));
+ return -1;
+ } else if (base != (void *)si->base) {
+ DL_ERR("OOPS: %5d %sprelinked library '%s' mapped at 0x%08x, "
+ "not at 0x%08x", pid, (si->base ? "" : "non-"),
+ si->name, (unsigned)base, si->base);
+ munmap(base, si->size);
+ return -1;
+ }
+ return 0;
+}
+
+static int
+alloc_mem_region(soinfo *si)
+{
+ if (si->base) {
+ /* Attempt to mmap a prelinked library. */
+ return reserve_mem_region(si);
+ }
+
+ /* This is not a prelinked library, so we use the kernel's default
+ allocator.
+ */
+
+ void *base = mmap(NULL, si->size, PROT_READ | PROT_EXEC,
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ if (base == MAP_FAILED) {
+ DL_ERR("%5d mmap of library '%s' failed: %d (%s)\n",
+ pid, si->name,
+ errno, strerror(errno));
+ goto err;
+ }
+ si->base = (unsigned) base;
+ PRINT("%5d mapped library '%s' to %08x via kernel allocator.\n",
+ pid, si->name, si->base);
+ return 0;
+
+err:
+ DL_ERR("OOPS: %5d cannot map library '%s'. no vspace available.",
+ pid, si->name);
+ return -1;
+}
+
+#define MAYBE_MAP_FLAG(x,from,to) (((x) & (from)) ? (to) : 0)
+#define PFLAGS_TO_PROT(x) (MAYBE_MAP_FLAG((x), PF_X, PROT_EXEC) | \
+ MAYBE_MAP_FLAG((x), PF_R, PROT_READ) | \
+ MAYBE_MAP_FLAG((x), PF_W, PROT_WRITE))
+/* load_segments
+ *
+ * This function loads all the loadable (PT_LOAD) segments into memory
+ * at their appropriate memory offsets off the base address.
+ *
+ * Args:
+ * fd: Open file descriptor to the library to load.
+ * header: Pointer to a header page that contains the ELF header.
+ * This is needed since we haven't mapped in the real file yet.
+ * si: ptr to soinfo struct describing the shared object.
+ *
+ * Returns:
+ * 0 on success, -1 on failure.
+ */
+static int
+load_segments(int fd, void *header, soinfo *si)
+{
+ Elf32_Ehdr *ehdr = (Elf32_Ehdr *)header;
+ Elf32_Phdr *phdr = (Elf32_Phdr *)((unsigned char *)header + ehdr->e_phoff);
+ unsigned char *base = (Elf32_Addr) si->base;
+ int cnt;
+ unsigned len;
+ unsigned char *tmp;
+ unsigned char *pbase;
+ unsigned char *extra_base;
+ unsigned extra_len;
+ unsigned total_sz = 0;
+
+ si->wrprotect_start = 0xffffffff;
+ si->wrprotect_end = 0;
+
+ TRACE("[ %5d - Begin loading segments for '%s' @ 0x%08x ]\n",
+ pid, si->name, (unsigned)si->base);
+ /* Now go through all the PT_LOAD segments and map them into memory
+ * at the appropriate locations. */
+ for (cnt = 0; cnt < ehdr->e_phnum; ++cnt, ++phdr) {
+ if (phdr->p_type == PT_LOAD) {
+ DEBUG_DUMP_PHDR(phdr, "PT_LOAD", pid);
+ /* we want to map in the segment on a page boundary */
+ tmp = base + (phdr->p_vaddr & (~PAGE_MASK));
+ /* add the # of bytes we masked off above to the total length. */
+ len = phdr->p_filesz + (phdr->p_vaddr & PAGE_MASK);
+
+ TRACE("[ %d - Trying to load segment from '%s' @ 0x%08x "
+ "(0x%08x). p_vaddr=0x%08x p_offset=0x%08x ]\n", pid, si->name,
+ (unsigned)tmp, len, phdr->p_vaddr, phdr->p_offset);
+ pbase = mmap(tmp, len, PFLAGS_TO_PROT(phdr->p_flags),
+ MAP_PRIVATE | MAP_FIXED, fd,
+ phdr->p_offset & (~PAGE_MASK));
+ if (pbase == MAP_FAILED) {
+ DL_ERR("%d failed to map segment from '%s' @ 0x%08x (0x%08x). "
+ "p_vaddr=0x%08x p_offset=0x%08x", pid, si->name,
+ (unsigned)tmp, len, phdr->p_vaddr, phdr->p_offset);
+ goto fail;
+ }
+
+ /* If 'len' didn't end on page boundary, and it's a writable
+ * segment, zero-fill the rest. */
+ if ((len & PAGE_MASK) && (phdr->p_flags & PF_W))
+ memset((void *)(pbase + len), 0, PAGE_SIZE - (len & PAGE_MASK));
+
+ /* Check to see if we need to extend the map for this segment to
+ * cover the diff between filesz and memsz (i.e. for bss).
+ *
+ * base _+---------------------+ page boundary
+ * . .
+ * | |
+ * . .
+ * pbase _+---------------------+ page boundary
+ * | |
+ * . .
+ * base + p_vaddr _| |
+ * . \ \ .
+ * . | filesz | .
+ * pbase + len _| / | |
+ * <0 pad> . . .
+ * extra_base _+------------|--------+ page boundary
+ * / . . .
+ * | . . .
+ * | +------------|--------+ page boundary
+ * extra_len-> | | | |
+ * | . | memsz .
+ * | . | .
+ * \ _| / |
+ * . .
+ * | |
+ * _+---------------------+ page boundary
+ */
+ tmp = (Elf32_Addr)(((unsigned)pbase + len + PAGE_SIZE - 1) &
+ (~PAGE_MASK));
+ if (tmp < (base + phdr->p_vaddr + phdr->p_memsz)) {
+ extra_len = base + phdr->p_vaddr + phdr->p_memsz - tmp;
+ TRACE("[ %5d - Need to extend segment from '%s' @ 0x%08x "
+ "(0x%08x) ]\n", pid, si->name, (unsigned)tmp, extra_len);
+ /* map in the extra page(s) as anonymous into the range.
+ * This is probably not necessary as we already mapped in
+ * the entire region previously, but we just want to be
+ * sure. This will also set the right flags on the region
+ * (though we can probably accomplish the same thing with
+ * mprotect).
+ */
+ extra_base = mmap((void *)tmp, extra_len,
+ PFLAGS_TO_PROT(phdr->p_flags),
+ MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS,
+ -1, 0);
+ if (extra_base == MAP_FAILED) {
+ DL_ERR("[ %5d - failed to extend segment from '%s' @ 0x%08x"
+ " (0x%08x) ]", pid, si->name, (unsigned)tmp,
+ extra_len);
+ goto fail;
+ }
+ /* TODO: Check if we need to memset-0 this region.
+ * Anonymous mappings are zero-filled copy-on-writes, so we
+ * shouldn't need to. */
+ TRACE("[ %5d - Segment from '%s' extended @ 0x%08x "
+ "(0x%08x)\n", pid, si->name, (unsigned)extra_base,
+ extra_len);
+ }
+ /* set the len here to show the full extent of the segment we
+ * just loaded, mostly for debugging */
+ len = (((unsigned)base + phdr->p_vaddr + phdr->p_memsz +
+ PAGE_SIZE - 1) & (~PAGE_MASK)) - (unsigned)pbase;
+ TRACE("[ %5d - Successfully loaded segment from '%s' @ 0x%08x "
+ "(0x%08x). p_vaddr=0x%08x p_offset=0x%08x\n", pid, si->name,
+ (unsigned)pbase, len, phdr->p_vaddr, phdr->p_offset);
+ total_sz += len;
+ /* Make the section writable just in case we'll have to write to
+ * it during relocation (i.e. text segment). However, we will
+ * remember what range of addresses should be write protected.
+ *
+ */
+ if (!(phdr->p_flags & PF_W)) {
+ if ((unsigned)pbase < si->wrprotect_start)
+ si->wrprotect_start = (unsigned)pbase;
+ if (((unsigned)pbase + len) > si->wrprotect_end)
+ si->wrprotect_end = (unsigned)pbase + len;
+ mprotect(pbase, len,
+ PFLAGS_TO_PROT(phdr->p_flags) | PROT_WRITE);
+ }
+ } else if (phdr->p_type == PT_DYNAMIC) {
+ DEBUG_DUMP_PHDR(phdr, "PT_DYNAMIC", pid);
+ /* this segment contains the dynamic linking information */
+ si->dynamic = (unsigned *)(base + phdr->p_vaddr);
+ } else {
+#ifdef ANDROID_ARM_LINKER
+ if (phdr->p_type == PT_ARM_EXIDX) {
+ DEBUG_DUMP_PHDR(phdr, "PT_ARM_EXIDX", pid);
+ /* exidx entries (used for stack unwinding) are 8 bytes each.
+ */
+ si->ARM_exidx = (unsigned *)phdr->p_vaddr;
+ si->ARM_exidx_count = phdr->p_memsz / 8;
+ }
+#endif
+ }
+
+ }
+
+ /* Sanity check */
+ if (total_sz > si->size) {
+ DL_ERR("%5d - Total length (0x%08x) of mapped segments from '%s' is "
+ "greater than what was allocated (0x%08x). THIS IS BAD!",
+ pid, total_sz, si->name, si->size);
+ goto fail;
+ }
+
+ TRACE("[ %5d - Finish loading segments for '%s' @ 0x%08x. "
+ "Total memory footprint: 0x%08x bytes ]\n", pid, si->name,
+ (unsigned)si->base, si->size);
+ return 0;
+
+fail:
+ /* We can just blindly unmap the entire region even though some things
+ * were mapped in originally with anonymous and others could have been
+ * been mapped in from the file before we failed. The kernel will unmap
+ * all the pages in the range, irrespective of how they got there.
+ */
+ munmap((void *)si->base, si->size);
+ si->flags |= FLAG_ERROR;
+ return -1;
+}
+
+/* TODO: Implement this to take care of the fact that Android ARM
+ * ELF objects shove everything into a single loadable segment that has the
+ * write bit set. wr_offset is then used to set non-(data|bss) pages to be
+ * non-writable.
+ */
+#if 0
+static unsigned
+get_wr_offset(int fd, const char *name, Elf32_Ehdr *ehdr)
+{
+ Elf32_Shdr *shdr_start;
+ Elf32_Shdr *shdr;
+ int shdr_sz = ehdr->e_shnum * sizeof(Elf32_Shdr);
+ int cnt;
+ unsigned wr_offset = 0xffffffff;
+
+ shdr_start = mmap(0, shdr_sz, PROT_READ, MAP_PRIVATE, fd,
+ ehdr->e_shoff & (~PAGE_MASK));
+ if (shdr_start == MAP_FAILED) {
+ WARN("%5d - Could not read section header info from '%s'. Will not "
+ "not be able to determine write-protect offset.\n", pid, name);
+ return (unsigned)-1;
+ }
+
+ for(cnt = 0, shdr = shdr_start; cnt < ehdr->e_shnum; ++cnt, ++shdr) {
+ if ((shdr->sh_type != SHT_NULL) && (shdr->sh_flags & SHF_WRITE) &&
+ (shdr->sh_addr < wr_offset)) {
+ wr_offset = shdr->sh_addr;
+ }
+ }
+
+ munmap(shdr_start, shdr_sz);
+ return wr_offset;
+}
+#endif
+
+static soinfo *
+load_library(const char *name)
+{
+ int fd = open_library(name);
+ int cnt;
+ unsigned ext_sz;
+ unsigned req_base;
+ const char *bname;
+ soinfo *si = NULL;
+ Elf32_Ehdr *hdr;
+
+ if(fd == -1) {
+ DL_ERR("Library '%s' not found", name);
+ return NULL;
+ }
+
+ /* We have to read the ELF header to figure out what to do with this image
+ */
+ if (lseek(fd, 0, SEEK_SET) < 0) {
+ DL_ERR("lseek() failed!");
+ goto fail;
+ }
+
+ if ((cnt = read(fd, &__header[0], PAGE_SIZE)) < 0) {
+ DL_ERR("read() failed!");
+ goto fail;
+ }
+
+ /* Parse the ELF header and get the size of the memory footprint for
+ * the library */
+ req_base = get_lib_extents(fd, name, &__header[0], &ext_sz);
+ if (req_base == (unsigned)-1)
+ goto fail;
+ TRACE("[ %5d - '%s' (%s) wants base=0x%08x sz=0x%08x ]\n", pid, name,
+ (req_base ? "prelinked" : "not pre-linked"), req_base, ext_sz);
+
+ /* Now configure the soinfo struct where we'll store all of our data
+ * for the ELF object. If the loading fails, we waste the entry, but
+ * same thing would happen if we failed during linking. Configuring the
+ * soinfo struct here is a lot more convenient.
+ */
+ bname = strrchr(name, '/');
+ si = alloc_info(bname ? bname + 1 : name);
+ if (si == NULL)
+ goto fail;
+
+ /* Carve out a chunk of memory where we will map in the individual
+ * segments */
+ si->base = req_base;
+ si->size = ext_sz;
+ si->flags = 0;
+ si->entry = 0;
+ si->dynamic = (unsigned *)-1;
+ if (alloc_mem_region(si) < 0)
+ goto fail;
+
+ TRACE("[ %5d allocated memory for %s @ %p (0x%08x) ]\n",
+ pid, name, (void *)si->base, (unsigned) ext_sz);
+
+ /* Now actually load the library's segments into right places in memory */
+ if (load_segments(fd, &__header[0], si) < 0) {
+ goto fail;
+ }
+
+ /* this might not be right. Technically, we don't even need this info
+ * once we go through 'load_segments'. */
+ hdr = (Elf32_Ehdr *)si->base;
+ si->phdr = (Elf32_Phdr *)((unsigned char *)si->base + hdr->e_phoff);
+ si->phnum = hdr->e_phnum;
+ /**/
+
+ close(fd);
+ return si;
+
+fail:
+ if (si) free_info(si);
+ close(fd);
+ return NULL;
+}
+
+static soinfo *
+init_library(soinfo *si)
+{
+ unsigned wr_offset = 0xffffffff;
+
+ /* At this point we know that whatever is loaded @ base is a valid ELF
+ * shared library whose segments are properly mapped in. */
+ TRACE("[ %5d init_library base=0x%08x sz=0x%08x name='%s') ]\n",
+ pid, si->base, si->size, si->name);
+
+ if(link_image(si, wr_offset)) {
+ /* We failed to link. However, we can only restore libbase
+ ** if no additional libraries have moved it since we updated it.
+ */
+ munmap((void *)si->base, si->size);
+ return NULL;
+ }
+
+ return si;
+}
+
+soinfo *find_library(const char *name)
+{
+ soinfo *si;
+ const char *bname;
+
+#if ALLOW_SYMBOLS_FROM_MAIN
+ if (name == NULL)
+ return somain;
+#else
+ if (name == NULL)
+ return NULL;
+#endif
+
+ bname = strrchr(name, '/');
+ bname = bname ? bname + 1 : name;
+
+ for(si = solist; si != 0; si = si->next){
+ if(!strcmp(bname, si->name)) {
+ if(si->flags & FLAG_ERROR) {
+ DL_ERR("%5d '%s' failed to load previously", pid, bname);
+ return NULL;
+ }
+ if(si->flags & FLAG_LINKED) return si;
+ DL_ERR("OOPS: %5d recursive link to '%s'", pid, si->name);
+ return NULL;
+ }
+ }
+
+ TRACE("[ %5d '%s' has not been loaded yet. Locating...]\n", pid, name);
+ si = load_library(name);
+ if(si == NULL)
+ return NULL;
+ return init_library(si);
+}
+
+/* TODO:
+ * notify gdb of unload
+ * for non-prelinked libraries, find a way to decrement libbase
+ */
+static void call_destructors(soinfo *si);
+unsigned unload_library(soinfo *si)
+{
+ unsigned *d;
+ if (si->refcount == 1) {
+ TRACE("%5d unloading '%s'\n", pid, si->name);
+ call_destructors(si);
+
+
+ for(d = si->dynamic; *d; d += 2) {
+ if(d[0] == DT_NEEDED){
+ soinfo *lsi = (soinfo *)d[1];
+ d[1] = 0;
+ if (validate_soinfo(lsi)) {
+ TRACE("%5d %s needs to unload %s\n", pid,
+ si->name, lsi->name);
+ unload_library(lsi);
+ }
+ else
+ DL_ERR("%5d %s: could not unload dependent library",
+ pid, si->name);
+ }
+ }
+
+ munmap((char *)si->base, si->size);
+ notify_gdb_of_unload(si);
+ free_info(si);
+ si->refcount = 0;
+ }
+ else {
+ si->refcount--;
+ PRINT("%5d not unloading '%s', decrementing refcount to %d\n",
+ pid, si->name, si->refcount);
+ }
+ return si->refcount;
+}
+
+/* TODO: don't use unsigned for addrs below. It works, but is not
+ * ideal. They should probably be either uint32_t, Elf32_Addr, or unsigned
+ * long.
+ */
+static int reloc_library(soinfo *si, Elf32_Rel *rel, unsigned count)
+{
+ Elf32_Sym *symtab = si->symtab;
+ const char *strtab = si->strtab;
+ Elf32_Sym *s;
+ unsigned base;
+ Elf32_Rel *start = rel;
+ unsigned idx;
+
+ for (idx = 0; idx < count; ++idx) {
+ unsigned type = ELF32_R_TYPE(rel->r_info);
+ unsigned sym = ELF32_R_SYM(rel->r_info);
+ unsigned reloc = (unsigned)(rel->r_offset + si->base);
+ unsigned sym_addr = 0;
+ char *sym_name = NULL;
+
+ //printf("%5d Processing '%s' relocation at index %d\n", pid,
+ // si->name, idx);
+ if(sym != 0) {
+ sym_name = (char *)(strtab + symtab[sym].st_name);
+ //printf("Sym name =%s\n",sym_name);
+ sym_addr = NULL;
+ if ((sym_addr = get_hooked_symbol(sym_name)) != NULL) {
+ //printf("hooked symbol %s to %x\n", sym_name, sym_addr);
+ }
+ else
+ {
+ s = _do_lookup(si, sym_name, &base);
+ }
+ if(sym_addr != NULL)
+ {
+ } else
+ if(s == NULL) {
+ /* We only allow an undefined symbol if this is a weak
+ reference.. */
+ s = &symtab[sym];
+ if (ELF32_ST_BIND(s->st_info) != STB_WEAK) {
+ DL_ERR("%5d cannot locate '%s'...\n", pid, sym_name);
+ return -1;
+ }
+
+ /* IHI0044C AAELF 4.5.1.1:
+
+ Libraries are not searched to resolve weak references.
+ It is not an error for a weak reference to remain
+ unsatisfied.
+
+ During linking, the value of an undefined weak reference is:
+ - Zero if the relocation type is absolute
+ - The address of the place if the relocation is pc-relative
+ - The address of nominial base address if the relocation
+ type is base-relative.
+ */
+
+ switch (type) {
+#if defined(ANDROID_ARM_LINKER)
+ case R_ARM_JUMP_SLOT:
+ case R_ARM_GLOB_DAT:
+ case R_ARM_ABS32:
+ case R_ARM_RELATIVE: /* Don't care. */
+ case R_ARM_NONE: /* Don't care. */
+#elif defined(ANDROID_X86_LINKER)
+ case R_386_JUMP_SLOT:
+ case R_386_GLOB_DAT:
+ case R_386_32:
+ case R_386_RELATIVE: /* Dont' care. */
+#endif /* ANDROID_*_LINKER */
+ /* sym_addr was initialized to be zero above or relocation
+ code below does not care about value of sym_addr.
+ No need to do anything. */
+ break;
+
+#if defined(ANDROID_X86_LINKER)
+ case R_386_PC32:
+ sym_addr = reloc;
+ break;
+#endif /* ANDROID_X86_LINKER */
+
+#if defined(ANDROID_ARM_LINKER)
+ case R_ARM_COPY:
+ /* Fall through. Can't really copy if weak symbol is
+ not found in run-time. */
+#endif /* ANDROID_ARM_LINKER */
+ default:
+ DL_ERR("%5d unknown weak reloc type %d @ %p (%d)\n",
+ pid, type, rel, (int) (rel - start));
+ return -1;
+ }
+ } else {
+ /* We got a definition. */
+#if 0
+ if((base == 0) && (si->base != 0)){
+ /* linking from libraries to main image is bad */
+ DL_ERR("%5d cannot locate '%s'...",
+ pid, strtab + symtab[sym].st_name);
+ return -1;
+ }
+#endif
+ sym_addr = (unsigned)(s->st_value + base);
+ }
+ COUNT_RELOC(RELOC_SYMBOL);
+ } else {
+ s = NULL;
+ }
+
+/* TODO: This is ugly. Split up the relocations by arch into
+ * different files.
+ */
+ switch(type){
+#if defined(ANDROID_ARM_LINKER)
+ case R_ARM_JUMP_SLOT:
+ COUNT_RELOC(RELOC_ABSOLUTE);
+ MARK(rel->r_offset);
+ TRACE_TYPE(RELO, "%5d RELO JMP_SLOT %08x <- %08x %s\n", pid,
+ reloc, sym_addr, sym_name);
+ *((unsigned*)reloc) = sym_addr;
+ break;
+ case R_ARM_GLOB_DAT:
+ COUNT_RELOC(RELOC_ABSOLUTE);
+ MARK(rel->r_offset);
+ TRACE_TYPE(RELO, "%5d RELO GLOB_DAT %08x <- %08x %s\n", pid,
+ reloc, sym_addr, sym_name);
+ *((unsigned*)reloc) = sym_addr;
+ break;
+ case R_ARM_ABS32:
+ COUNT_RELOC(RELOC_ABSOLUTE);
+ MARK(rel->r_offset);
+ TRACE_TYPE(RELO, "%5d RELO ABS %08x <- %08x %s\n", pid,
+ reloc, sym_addr, sym_name);
+ *((unsigned*)reloc) += sym_addr;
+ break;
+ case R_ARM_REL32:
+ COUNT_RELOC(RELOC_RELATIVE);
+ MARK(rel->r_offset);
+ TRACE_TYPE(RELO, "%5d RELO REL32 %08x <- %08x - %08x %s\n", pid,
+ reloc, sym_addr, rel->r_offset, sym_name);
+ *((unsigned*)reloc) += sym_addr - rel->r_offset;
+ break;
+#elif defined(ANDROID_X86_LINKER)
+ case R_386_JUMP_SLOT:
+ COUNT_RELOC(RELOC_ABSOLUTE);
+ MARK(rel->r_offset);
+ TRACE_TYPE(RELO, "%5d RELO JMP_SLOT %08x <- %08x %s\n", pid,
+ reloc, sym_addr, sym_name);
+ *((unsigned*)reloc) = sym_addr;
+ break;
+ case R_386_GLOB_DAT:
+ COUNT_RELOC(RELOC_ABSOLUTE);
+ MARK(rel->r_offset);
+ TRACE_TYPE(RELO, "%5d RELO GLOB_DAT %08x <- %08x %s\n", pid,
+ reloc, sym_addr, sym_name);
+ *((unsigned*)reloc) = sym_addr;
+ break;
+#endif /* ANDROID_*_LINKER */
+
+#if defined(ANDROID_ARM_LINKER)
+ case R_ARM_RELATIVE:
+#elif defined(ANDROID_X86_LINKER)
+ case R_386_RELATIVE:
+#endif /* ANDROID_*_LINKER */
+ COUNT_RELOC(RELOC_RELATIVE);
+ MARK(rel->r_offset);
+ if(sym){
+ DL_ERR("%5d odd RELATIVE form...", pid);
+ return -1;
+ }
+ TRACE_TYPE(RELO, "%5d RELO RELATIVE %08x <- +%08x\n", pid,
+ reloc, si->base);
+ *((unsigned*)reloc) += si->base;
+ break;
+
+#if defined(ANDROID_X86_LINKER)
+ case R_386_32:
+ COUNT_RELOC(RELOC_RELATIVE);
+ MARK(rel->r_offset);
+
+ TRACE_TYPE(RELO, "%5d RELO R_386_32 %08x <- +%08x %s\n", pid,
+ reloc, sym_addr, sym_name);
+ *((unsigned *)reloc) += (unsigned)sym_addr;
+ break;
+
+ case R_386_PC32:
+ COUNT_RELOC(RELOC_RELATIVE);
+ MARK(rel->r_offset);
+ TRACE_TYPE(RELO, "%5d RELO R_386_PC32 %08x <- "
+ "+%08x (%08x - %08x) %s\n", pid, reloc,
+ (sym_addr - reloc), sym_addr, reloc, sym_name);
+ *((unsigned *)reloc) += (unsigned)(sym_addr - reloc);
+ break;
+#endif /* ANDROID_X86_LINKER */
+
+#ifdef ANDROID_ARM_LINKER
+ case R_ARM_COPY:
+ COUNT_RELOC(RELOC_COPY);
+ MARK(rel->r_offset);
+ TRACE_TYPE(RELO, "%5d RELO %08x <- %d @ %08x %s\n", pid,
+ reloc, s->st_size, sym_addr, sym_name);
+ memcpy((void*)reloc, (void*)sym_addr, s->st_size);
+ break;
+ case R_ARM_NONE:
+ break;
+#endif /* ANDROID_ARM_LINKER */
+
+ default:
+ DL_ERR("%5d unknown reloc type %d @ %p (%d)",
+ pid, type, rel, (int) (rel - start));
+ return -1;
+ }
+ rel++;
+ }
+ return 0;
+}
+
+#if defined(ANDROID_SH_LINKER)
+static int reloc_library_a(soinfo *si, Elf32_Rela *rela, unsigned count)
+{
+ Elf32_Sym *symtab = si->symtab;
+ const char *strtab = si->strtab;
+ Elf32_Sym *s;
+ unsigned base;
+ Elf32_Rela *start = rela;
+ unsigned idx;
+
+ for (idx = 0; idx < count; ++idx) {
+ unsigned type = ELF32_R_TYPE(rela->r_info);
+ unsigned sym = ELF32_R_SYM(rela->r_info);
+ unsigned reloc = (unsigned)(rela->r_offset + si->base);
+ unsigned sym_addr = 0;
+ char *sym_name = NULL;
+
+ DEBUG("%5d Processing '%s' relocation at index %d\n", pid,
+ si->name, idx);
+ if(sym != 0) {
+ sym_name = (char *)(strtab + symtab[sym].st_name);
+ s = _do_lookup(si, sym_name, &base);
+ if(s == 0) {
+ DL_ERR("%5d cannot locate '%s'...", pid, sym_name);
+ return -1;
+ }
+#if 0
+ if((base == 0) && (si->base != 0)){
+ /* linking from libraries to main image is bad */
+ DL_ERR("%5d cannot locate '%s'...",
+ pid, strtab + symtab[sym].st_name);
+ return -1;
+ }
+#endif
+ if ((s->st_shndx == SHN_UNDEF) && (s->st_value != 0)) {
+ DL_ERR("%5d In '%s', shndx=%d && value=0x%08x. We do not "
+ "handle this yet", pid, si->name, s->st_shndx,
+ s->st_value);
+ return -1;
+ }
+ sym_addr = (unsigned)(s->st_value + base);
+ COUNT_RELOC(RELOC_SYMBOL);
+ } else {
+ s = 0;
+ }
+
+/* TODO: This is ugly. Split up the relocations by arch into
+ * different files.
+ */
+ switch(type){
+ case R_SH_JUMP_SLOT:
+ COUNT_RELOC(RELOC_ABSOLUTE);
+ MARK(rela->r_offset);
+ TRACE_TYPE(RELO, "%5d RELO JMP_SLOT %08x <- %08x %s\n", pid,
+ reloc, sym_addr, sym_name);
+ *((unsigned*)reloc) = sym_addr;
+ break;
+ case R_SH_GLOB_DAT:
+ COUNT_RELOC(RELOC_ABSOLUTE);
+ MARK(rela->r_offset);
+ TRACE_TYPE(RELO, "%5d RELO GLOB_DAT %08x <- %08x %s\n", pid,
+ reloc, sym_addr, sym_name);
+ *((unsigned*)reloc) = sym_addr;
+ break;
+ case R_SH_DIR32:
+ COUNT_RELOC(RELOC_ABSOLUTE);
+ MARK(rela->r_offset);
+ TRACE_TYPE(RELO, "%5d RELO DIR32 %08x <- %08x %s\n", pid,
+ reloc, sym_addr, sym_name);
+ *((unsigned*)reloc) += sym_addr;
+ break;
+ case R_SH_RELATIVE:
+ COUNT_RELOC(RELOC_RELATIVE);
+ MARK(rela->r_offset);
+ if(sym){
+ DL_ERR("%5d odd RELATIVE form...", pid);
+ return -1;
+ }
+ TRACE_TYPE(RELO, "%5d RELO RELATIVE %08x <- +%08x\n", pid,
+ reloc, si->base);
+ *((unsigned*)reloc) += si->base;
+ break;
+
+ default:
+ DL_ERR("%5d unknown reloc type %d @ %p (%d)",
+ pid, type, rela, (int) (rela - start));
+ return -1;
+ }
+ rela++;
+ }
+ return 0;
+}
+#endif /* ANDROID_SH_LINKER */
+
+
+/* Please read the "Initialization and Termination functions" functions.
+ * of the linker design note in bionic/linker/README.TXT to understand
+ * what the following code is doing.
+ *
+ * The important things to remember are:
+ *
+ * DT_PREINIT_ARRAY must be called first for executables, and should
+ * not appear in shared libraries.
+ *
+ * DT_INIT should be called before DT_INIT_ARRAY if both are present
+ *
+ * DT_FINI should be called after DT_FINI_ARRAY if both are present
+ *
+ * DT_FINI_ARRAY must be parsed in reverse order.
+ */
+
+static void call_array(unsigned *ctor, int count, int reverse)
+{
+ int n, inc = 1;
+
+ if (reverse) {
+ ctor += (count-1);
+ inc = -1;
+ }
+
+ for(n = count; n > 0; n--) {
+ TRACE("[ %5d Looking at %s *0x%08x == 0x%08x ]\n", pid,
+ reverse ? "dtor" : "ctor",
+ (unsigned)ctor, (unsigned)*ctor);
+ void (*func)() = (void (*)()) *ctor;
+ ctor += inc;
+ if(((int) func == 0) || ((int) func == -1)) continue;
+ TRACE("[ %5d Calling func @ 0x%08x ]\n", pid, (unsigned)func);
+ func();
+ }
+}
+
+static void call_constructors(soinfo *si)
+{
+#if 0
+ if (strcmp(si->name,"libc.so") == 0) {
+ printf("=============> Skipping libc.so\n");
+ return;
+ }
+#endif
+
+ if (si->flags & FLAG_EXE) {
+ TRACE("[ %5d Calling preinit_array @ 0x%08x [%d] for '%s' ]\n",
+ pid, (unsigned)si->preinit_array, si->preinit_array_count,
+ si->name);
+ call_array(si->preinit_array, si->preinit_array_count, 0);
+ TRACE("[ %5d Done calling preinit_array for '%s' ]\n", pid, si->name);
+ } else {
+ if (si->preinit_array) {
+ DL_ERR("%5d Shared library '%s' has a preinit_array table @ 0x%08x."
+ " This is INVALID.", pid, si->name,
+ (unsigned)si->preinit_array);
+ }
+ }
+
+ if (si->init_func) {
+ TRACE("[ %5d Calling init_func @ 0x%08x for '%s' ]\n", pid,
+ (unsigned)si->init_func, si->name);
+ si->init_func();
+ TRACE("[ %5d Done calling init_func for '%s' ]\n", pid, si->name);
+ }
+
+ if (si->init_array) {
+ TRACE("[ %5d Calling init_array @ 0x%08x [%d] for '%s' ]\n", pid,
+ (unsigned)si->init_array, si->init_array_count, si->name);
+ call_array(si->init_array, si->init_array_count, 0);
+ TRACE("[ %5d Done calling init_array for '%s' ]\n", pid, si->name);
+ }
+}
+
+
+static void call_destructors(soinfo *si)
+{
+ if (si->fini_array) {
+ TRACE("[ %5d Calling fini_array @ 0x%08x [%d] for '%s' ]\n", pid,
+ (unsigned)si->fini_array, si->fini_array_count, si->name);
+ call_array(si->fini_array, si->fini_array_count, 1);
+ TRACE("[ %5d Done calling fini_array for '%s' ]\n", pid, si->name);
+ }
+
+ if (si->fini_func) {
+ TRACE("[ %5d Calling fini_func @ 0x%08x for '%s' ]\n", pid,
+ (unsigned)si->fini_func, si->name);
+ si->fini_func();
+ TRACE("[ %5d Done calling fini_func for '%s' ]\n", pid, si->name);
+ }
+}
+
+/* Force any of the closed stdin, stdout and stderr to be associated with
+ /dev/null. */
+static int nullify_closed_stdio (void)
+{
+ int dev_null, i, status;
+ int return_value = 0;
+
+ dev_null = open("/dev/null", O_RDWR);
+ if (dev_null < 0) {
+ DL_ERR("Cannot open /dev/null.");
+ return -1;
+ }
+ TRACE("[ %5d Opened /dev/null file-descriptor=%d]\n", pid, dev_null);
+
+ /* If any of the stdio file descriptors is valid and not associated
+ with /dev/null, dup /dev/null to it. */
+ for (i = 0; i < 3; i++) {
+ /* If it is /dev/null already, we are done. */
+ if (i == dev_null)
+ continue;
+
+ TRACE("[ %5d Nullifying stdio file descriptor %d]\n", pid, i);
+ /* The man page of fcntl does not say that fcntl(..,F_GETFL)
+ can be interrupted but we do this just to be safe. */
+ do {
+ status = fcntl(i, F_GETFL);
+ } while (status < 0 && errno == EINTR);
+
+ /* If file is openned, we are good. */
+ if (status >= 0)
+ continue;
+
+ /* The only error we allow is that the file descriptor does not
+ exist, in which case we dup /dev/null to it. */
+ if (errno != EBADF) {
+ DL_ERR("nullify_stdio: unhandled error %s", strerror(errno));
+ return_value = -1;
+ continue;
+ }
+
+ /* Try dupping /dev/null to this stdio file descriptor and
+ repeat if there is a signal. Note that any errors in closing
+ the stdio descriptor are lost. */
+ do {
+ status = dup2(dev_null, i);
+ } while (status < 0 && errno == EINTR);
+
+ if (status < 0) {
+ DL_ERR("nullify_stdio: dup2 error %s", strerror(errno));
+ return_value = -1;
+ continue;
+ }
+ }
+
+ /* If /dev/null is not one of the stdio file descriptors, close it. */
+ if (dev_null > 2) {
+ TRACE("[ %5d Closing /dev/null file-descriptor=%d]\n", pid, dev_null);
+ do {
+ status = close(dev_null);
+ } while (status < 0 && errno == EINTR);
+
+ if (status < 0) {
+ DL_ERR("nullify_stdio: close error %s", strerror(errno));
+ return_value = -1;
+ }
+ }
+
+ return return_value;
+}
+
+static int link_image(soinfo *si, unsigned wr_offset)
+{
+ unsigned *d;
+ Elf32_Phdr *phdr = si->phdr;
+ int phnum = si->phnum;
+
+ INFO("[ %5d linking %s ]\n", pid, si->name);
+ DEBUG("%5d si->base = 0x%08x si->flags = 0x%08x\n", pid,
+ si->base, si->flags);
+
+ if (si->flags & FLAG_EXE) {
+ /* Locate the needed program segments (DYNAMIC/ARM_EXIDX) for
+ * linkage info if this is the executable. If this was a
+ * dynamic lib, that would have been done at load time.
+ *
+ * TODO: It's unfortunate that small pieces of this are
+ * repeated from the load_library routine. Refactor this just
+ * slightly to reuse these bits.
+ */
+ si->size = 0;
+ for(; phnum > 0; --phnum, ++phdr) {
+#ifdef ANDROID_ARM_LINKER
+ if(phdr->p_type == PT_ARM_EXIDX) {
+ /* exidx entries (used for stack unwinding) are 8 bytes each.
+ */
+ si->ARM_exidx = (unsigned *)phdr->p_vaddr;
+ si->ARM_exidx_count = phdr->p_memsz / 8;
+ }
+#endif
+ if (phdr->p_type == PT_LOAD) {
+ /* For the executable, we use the si->size field only in
+ dl_unwind_find_exidx(), so the meaning of si->size
+ is not the size of the executable; it is the last
+ virtual address of the loadable part of the executable;
+ since si->base == 0 for an executable, we use the
+ range [0, si->size) to determine whether a PC value
+ falls within the executable section. Of course, if
+ a value is below phdr->p_vaddr, it's not in the
+ executable section, but a) we shouldn't be asking for
+ such a value anyway, and b) if we have to provide
+ an EXIDX for such a value, then the executable's
+ EXIDX is probably the better choice.
+ */
+ DEBUG_DUMP_PHDR(phdr, "PT_LOAD", pid);
+ if (phdr->p_vaddr + phdr->p_memsz > si->size)
+ si->size = phdr->p_vaddr + phdr->p_memsz;
+ /* try to remember what range of addresses should be write
+ * protected */
+ if (!(phdr->p_flags & PF_W)) {
+ unsigned _end;
+
+ if (phdr->p_vaddr < si->wrprotect_start)
+ si->wrprotect_start = phdr->p_vaddr;
+ _end = (((phdr->p_vaddr + phdr->p_memsz + PAGE_SIZE - 1) &
+ (~PAGE_MASK)));
+ if (_end > si->wrprotect_end)
+ si->wrprotect_end = _end;
+ }
+ } else if (phdr->p_type == PT_DYNAMIC) {
+ if (si->dynamic != (unsigned *)-1) {
+ DL_ERR("%5d multiple PT_DYNAMIC segments found in '%s'. "
+ "Segment at 0x%08x, previously one found at 0x%08x",
+ pid, si->name, si->base + phdr->p_vaddr,
+ (unsigned)si->dynamic);
+ goto fail;
+ }
+ DEBUG_DUMP_PHDR(phdr, "PT_DYNAMIC", pid);
+ si->dynamic = (unsigned *) (si->base + phdr->p_vaddr);
+ }
+ }
+ }
+
+ if (si->dynamic == (unsigned *)-1) {
+ DL_ERR("%5d missing PT_DYNAMIC?!", pid);
+ goto fail;
+ }
+
+ DEBUG("%5d dynamic = %p\n", pid, si->dynamic);
+
+ /* extract useful information from dynamic section */
+ for(d = si->dynamic; *d; d++){
+ DEBUG("%5d d = %p, d[0] = 0x%08x d[1] = 0x%08x\n", pid, d, d[0], d[1]);
+ switch(*d++){
+ case DT_HASH:
+ si->nbucket = ((unsigned *) (si->base + *d))[0];
+ si->nchain = ((unsigned *) (si->base + *d))[1];
+ si->bucket = (unsigned *) (si->base + *d + 8);
+ si->chain = (unsigned *) (si->base + *d + 8 + si->nbucket * 4);
+ break;
+ case DT_STRTAB:
+ si->strtab = (const char *) (si->base + *d);
+ break;
+ case DT_SYMTAB:
+ si->symtab = (Elf32_Sym *) (si->base + *d);
+ break;
+#if !defined(ANDROID_SH_LINKER)
+ case DT_PLTREL:
+ if(*d != DT_REL) {
+ DL_ERR("DT_RELA not supported");
+ goto fail;
+ }
+ break;
+#endif
+#ifdef ANDROID_SH_LINKER
+ case DT_JMPREL:
+ si->plt_rela = (Elf32_Rela*) (si->base + *d);
+ break;
+ case DT_PLTRELSZ:
+ si->plt_rela_count = *d / sizeof(Elf32_Rela);
+ break;
+#else
+ case DT_JMPREL:
+ si->plt_rel = (Elf32_Rel*) (si->base + *d);
+ break;
+ case DT_PLTRELSZ:
+ si->plt_rel_count = *d / 8;
+ break;
+#endif
+ case DT_REL:
+ si->rel = (Elf32_Rel*) (si->base + *d);
+ break;
+ case DT_RELSZ:
+ si->rel_count = *d / 8;
+ break;
+#ifdef ANDROID_SH_LINKER
+ case DT_RELASZ:
+ si->rela_count = *d / sizeof(Elf32_Rela);
+ break;
+#endif
+ case DT_PLTGOT:
+ /* Save this in case we decide to do lazy binding. We don't yet. */
+ si->plt_got = (unsigned *)(si->base + *d);
+ break;
+ case DT_DEBUG:
+ // Set the DT_DEBUG entry to the addres of _r_debug for GDB
+ *d = (int) &_r_debug;
+ break;
+#ifdef ANDROID_SH_LINKER
+ case DT_RELA:
+ si->rela = (Elf32_Rela *) (si->base + *d);
+ break;
+#else
+ case DT_RELA:
+ DL_ERR("%5d DT_RELA not supported", pid);
+ goto fail;
+#endif
+ case DT_INIT:
+ si->init_func = (void (*)(void))(si->base + *d);
+ DEBUG("%5d %s constructors (init func) found at %p\n",
+ pid, si->name, si->init_func);
+ break;
+ case DT_FINI:
+ si->fini_func = (void (*)(void))(si->base + *d);
+ DEBUG("%5d %s destructors (fini func) found at %p\n",
+ pid, si->name, si->fini_func);
+ break;
+ case DT_INIT_ARRAY:
+ si->init_array = (unsigned *)(si->base + *d);
+ DEBUG("%5d %s constructors (init_array) found at %p\n",
+ pid, si->name, si->init_array);
+ break;
+ case DT_INIT_ARRAYSZ:
+ si->init_array_count = ((unsigned)*d) / sizeof(Elf32_Addr);
+ break;
+ case DT_FINI_ARRAY:
+ si->fini_array = (unsigned *)(si->base + *d);
+ DEBUG("%5d %s destructors (fini_array) found at %p\n",
+ pid, si->name, si->fini_array);
+ break;
+ case DT_FINI_ARRAYSZ:
+ si->fini_array_count = ((unsigned)*d) / sizeof(Elf32_Addr);
+ break;
+ case DT_PREINIT_ARRAY:
+ si->preinit_array = (unsigned *)(si->base + *d);
+ DEBUG("%5d %s constructors (preinit_array) found at %p\n",
+ pid, si->name, si->preinit_array);
+ break;
+ case DT_PREINIT_ARRAYSZ:
+ si->preinit_array_count = ((unsigned)*d) / sizeof(Elf32_Addr);
+ break;
+ case DT_TEXTREL:
+ /* TODO: make use of this. */
+ /* this means that we might have to write into where the text
+ * segment was loaded during relocation... Do something with
+ * it.
+ */
+ DEBUG("%5d Text segment should be writable during relocation.\n",
+ pid);
+ break;
+ }
+ }
+
+ DEBUG("%5d si->base = 0x%08x, si->strtab = %p, si->symtab = %p\n",
+ pid, si->base, si->strtab, si->symtab);
+
+ if((si->strtab == 0) || (si->symtab == 0)) {
+ DL_ERR("%5d missing essential tables", pid);
+ goto fail;
+ }
+
+ /* if this is the main executable, then load all of the preloads now */
+ if(si->flags & FLAG_EXE) {
+ int i;
+ memset(preloads, 0, sizeof(preloads));
+ for(i = 0; ldpreload_names[i] != NULL; i++) {
+ soinfo *lsi = find_library(ldpreload_names[i]);
+ if(lsi == 0) {
+ strlcpy(tmp_err_buf, linker_get_error(), sizeof(tmp_err_buf));
+ DL_ERR("%5d could not load needed library '%s' for '%s' (%s)",
+ pid, ldpreload_names[i], si->name, tmp_err_buf);
+ goto fail;
+ }
+ lsi->refcount++;
+ preloads[i] = lsi;
+ }
+ }
+
+ for(d = si->dynamic; *d; d += 2) {
+ if(d[0] == DT_NEEDED){
+ DEBUG("%5d %s needs %s\n", pid, si->name, si->strtab + d[1]);
+ soinfo *lsi = find_library(si->strtab + d[1]);
+ if(lsi == 0) {
+ strlcpy(tmp_err_buf, linker_get_error(), sizeof(tmp_err_buf));
+ DL_ERR("%5d could not load needed library '%s' for '%s' (%s)",
+ pid, si->strtab + d[1], si->name, tmp_err_buf);
+ goto fail;
+ }
+ /* Save the soinfo of the loaded DT_NEEDED library in the payload
+ of the DT_NEEDED entry itself, so that we can retrieve the
+ soinfo directly later from the dynamic segment. This is a hack,
+ but it allows us to map from DT_NEEDED to soinfo efficiently
+ later on when we resolve relocations, trying to look up a symgol
+ with dlsym().
+ */
+ d[1] = (unsigned)lsi;
+ lsi->refcount++;
+ }
+ }
+
+ if(si->plt_rel) {
+ DEBUG("[ %5d relocating %s plt ]\n", pid, si->name );
+ if(reloc_library(si, si->plt_rel, si->plt_rel_count))
+ goto fail;
+ }
+ if(si->rel) {
+ DEBUG("[ %5d relocating %s ]\n", pid, si->name );
+ if(reloc_library(si, si->rel, si->rel_count))
+ goto fail;
+ }
+
+#ifdef ANDROID_SH_LINKER
+ if(si->plt_rela) {
+ DEBUG("[ %5d relocating %s plt ]\n", pid, si->name );
+ if(reloc_library_a(si, si->plt_rela, si->plt_rela_count))
+ goto fail;
+ }
+ if(si->rela) {
+ DEBUG("[ %5d relocating %s ]\n", pid, si->name );
+ if(reloc_library_a(si, si->rela, si->rela_count))
+ goto fail;
+ }
+#endif /* ANDROID_SH_LINKER */
+
+ si->flags |= FLAG_LINKED;
+ DEBUG("[ %5d finished linking %s ]\n", pid, si->name);
+
+#if 0
+ /* This is the way that the old dynamic linker did protection of
+ * non-writable areas. It would scan section headers and find where
+ * .text ended (rather where .data/.bss began) and assume that this is
+ * the upper range of the non-writable area. This is too coarse,
+ * and is kept here for reference until we fully move away from single
+ * segment elf objects. See the code in get_wr_offset (also #if'd 0)
+ * that made this possible.
+ */
+ if(wr_offset < 0xffffffff){
+ mprotect((void*) si->base, wr_offset, PROT_READ | PROT_EXEC);
+ }
+#else
+ /* TODO: Verify that this does the right thing in all cases, as it
+ * presently probably does not. It is possible that an ELF image will
+ * come with multiple read-only segments. What we ought to do is scan
+ * the program headers again and mprotect all the read-only segments.
+ * To prevent re-scanning the program header, we would have to build a
+ * list of loadable segments in si, and then scan that instead. */
+ if (si->wrprotect_start != 0xffffffff && si->wrprotect_end != 0) {
+ mprotect((void *)si->wrprotect_start,
+ si->wrprotect_end - si->wrprotect_start,
+ PROT_READ | PROT_EXEC);
+ }
+#endif
+
+ /* If this is a SET?ID program, dup /dev/null to opened stdin,
+ stdout and stderr to close a security hole described in:
+
+ ftp://ftp.freebsd.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-02:23.stdio.asc
+
+ */
+ if (program_is_setuid)
+ nullify_closed_stdio ();
+ notify_gdb_of_load(si);
+ call_constructors(si);
+ return 0;
+
+fail:
+ ERROR("failed to link %s\n", si->name);
+ si->flags |= FLAG_ERROR;
+ return -1;
+}
+
+static void parse_library_path(const char *path, char *delim)
+{
+ size_t len;
+ char *ldpaths_bufp = ldpaths_buf;
+ int i = 0;
+
+ len = strlcpy(ldpaths_buf, path, sizeof(ldpaths_buf));
+
+ while (i < LDPATH_MAX && (ldpaths[i] = strsep(&ldpaths_bufp, delim))) {
+ if (*ldpaths[i] != '\0')
+ ++i;
+ }
+
+ /* Forget the last path if we had to truncate; this occurs if the 2nd to
+ * last char isn't '\0' (i.e. not originally a delim). */
+ if (i > 0 && len >= sizeof(ldpaths_buf) &&
+ ldpaths_buf[sizeof(ldpaths_buf) - 2] != '\0') {
+ ldpaths[i - 1] = NULL;
+ } else {
+ ldpaths[i] = NULL;
+ }
+}
+
+static void parse_preloads(const char *path, char *delim)
+{
+ size_t len;
+ char *ldpreloads_bufp = ldpreloads_buf;
+ int i = 0;
+
+ len = strlcpy(ldpreloads_buf, path, sizeof(ldpreloads_buf));
+
+ while (i < LDPRELOAD_MAX && (ldpreload_names[i] = strsep(&ldpreloads_bufp, delim))) {
+ if (*ldpreload_names[i] != '\0') {
+ ++i;
+ }
+ }
+
+ /* Forget the last path if we had to truncate; this occurs if the 2nd to
+ * last char isn't '\0' (i.e. not originally a delim). */
+ if (i > 0 && len >= sizeof(ldpreloads_buf) &&
+ ldpreloads_buf[sizeof(ldpreloads_buf) - 2] != '\0') {
+ ldpreload_names[i - 1] = NULL;
+ } else {
+ ldpreload_names[i] = NULL;
+ }
+}
+
+int main(int argc, char **argv)
+{
+ return 0;
+}
+
+#define ANDROID_TLS_SLOTS BIONIC_TLS_SLOTS
+
+static void * __tls_area[ANDROID_TLS_SLOTS];
+
+unsigned __linker_init(unsigned **elfdata)
+{
+ static soinfo linker_soinfo;
+
+ int argc = (int) *elfdata;
+ char **argv = (char**) (elfdata + 1);
+ unsigned *vecs = (unsigned*) (argv + argc + 1);
+ soinfo *si;
+ struct link_map * map;
+ const char *ldpath_env = NULL;
+ const char *ldpreload_env = NULL;
+
+ /* Setup a temporary TLS area that is used to get a working
+ * errno for system calls.
+ */
+ //__set_tls(__tls_area);
+
+ pid = getpid();
+
+#if TIMING
+ struct timeval t0, t1;
+ gettimeofday(&t0, 0);
+#endif
+
+ /* NOTE: we store the elfdata pointer on a special location
+ * of the temporary TLS area in order to pass it to
+ * the C Library's runtime initializer.
+ *
+ * The initializer must clear the slot and reset the TLS
+ * to point to a different location to ensure that no other
+ * shared library constructor can access it.
+ */
+#if 0
+ __libc_init_tls(elfdata);
+#endif
+
+ pid = getpid();
+
+#if TIMING
+ struct timeval t0, t1;
+ gettimeofday(&t0, 0);
+#endif
+
+ /* Initialize environment functions, and get to the ELF aux vectors table */
+ vecs = linker_env_init(vecs);
+
+ /* Sanitize environment if we're loading a setuid program */
+ if (program_is_setuid)
+ linker_env_secure();
+
+ //debugger_init();
+
+ /* Get a few environment variables */
+ {
+ const char* env;
+ env = linker_env_get("DEBUG"); /* XXX: TODO: Change to LD_DEBUG */
+ if (env)
+ debug_verbosity = atoi(env);
+
+ /* Normally, these are cleaned by linker_env_secure, but the test
+ * against program_is_setuid doesn't cost us anything */
+ if (!program_is_setuid) {
+ ldpath_env = linker_env_get("LD_LIBRARY_PATH");
+ ldpreload_env = linker_env_get("LD_PRELOAD");
+ }
+ }
+
+ INFO("[ android linker & debugger ]\n");
+ DEBUG("%5d elfdata @ 0x%08x\n", pid, (unsigned)elfdata);
+
+ si = alloc_info(argv[0]);
+ if(si == 0) {
+ exit(-1);
+ }
+
+ /* bootstrap the link map, the main exe always needs to be first */
+ si->flags |= FLAG_EXE;
+ map = &(si->linkmap);
+
+ map->l_addr = 0;
+ map->l_name = argv[0];
+ map->l_prev = NULL;
+ map->l_next = NULL;
+
+ _r_debug.r_map = map;
+ r_debug_tail = map;
+
+ /* gdb expects the linker to be in the debug shared object list,
+ * and we need to make sure that the reported load address is zero.
+ * Without this, gdb gets the wrong idea of where rtld_db_dlactivity()
+ * is. Don't use alloc_info(), because the linker shouldn't
+ * be on the soinfo list.
+ */
+ strlcpy((char*) linker_soinfo.name, "/system/bin/linker", sizeof linker_soinfo.name);
+ linker_soinfo.flags = 0;
+ linker_soinfo.base = 0; // This is the important part; must be zero.
+ insert_soinfo_into_debug_map(&linker_soinfo);
+
+ /* extract information passed from the kernel */
+ while(vecs[0] != 0){
+ switch(vecs[0]){
+ case AT_PHDR:
+ si->phdr = (Elf32_Phdr*) vecs[1];
+ break;
+ case AT_PHNUM:
+ si->phnum = (int) vecs[1];
+ break;
+ case AT_ENTRY:
+ si->entry = vecs[1];
+ break;
+ }
+ vecs += 2;
+ }
+
+ si->base = 0;
+ si->dynamic = (unsigned *)-1;
+ si->wrprotect_start = 0xffffffff;
+ si->wrprotect_end = 0;
+ si->refcount = 1;
+
+ /* Use LD_LIBRARY_PATH if we aren't setuid/setgid */
+ if (ldpath_env)
+ parse_library_path(ldpath_env, ":");
+
+ if (ldpreload_env) {
+ parse_preloads(ldpreload_env, " :");
+ }
+
+ if(link_image(si, 0)) {
+ char errmsg[] = "CANNOT LINK EXECUTABLE\n";
+ write(2, __linker_dl_err_buf, strlen(__linker_dl_err_buf));
+ write(2, errmsg, sizeof(errmsg));
+ exit(-1);
+ }
+
+#if ALLOW_SYMBOLS_FROM_MAIN
+ /* Set somain after we've loaded all the libraries in order to prevent
+ * linking of symbols back to the main image, which is not set up at that
+ * point yet.
+ */
+ somain = si;
+#endif
+
+#if TIMING
+ gettimeofday(&t1,NULL);
+ PRINT("LINKER TIME: %s: %d microseconds\n", argv[0], (int) (
+ (((long long)t1.tv_sec * 1000000LL) + (long long)t1.tv_usec) -
+ (((long long)t0.tv_sec * 1000000LL) + (long long)t0.tv_usec)
+ ));
+#endif
+#if STATS
+ PRINT("RELO STATS: %s: %d abs, %d rel, %d copy, %d symbol\n", argv[0],
+ linker_stats.reloc[RELOC_ABSOLUTE],
+ linker_stats.reloc[RELOC_RELATIVE],
+ linker_stats.reloc[RELOC_COPY],
+ linker_stats.reloc[RELOC_SYMBOL]);
+#endif
+#if COUNT_PAGES
+ {
+ unsigned n;
+ unsigned i;
+ unsigned count = 0;
+ for(n = 0; n < 4096; n++){
+ if(bitmask[n]){
+ unsigned x = bitmask[n];
+ for(i = 0; i < 8; i++){
+ if(x & 1) count++;
+ x >>= 1;
+ }
+ }
+ }
+ PRINT("PAGES MODIFIED: %s: %d (%dKB)\n", argv[0], count, count * 4);
+ }
+#endif
+
+#if TIMING || STATS || COUNT_PAGES
+ fflush(stdout);
+#endif
+
+ TRACE("[ %5d Ready to execute '%s' @ 0x%08x ]\n", pid, si->name,
+ si->entry);
+ return si->entry;
+}
--- /dev/null
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _LINKER_H_
+#define _LINKER_H_
+
+#include <unistd.h>
+#include <sys/types.h>
+#include <elf.h>
+
+#undef PAGE_MASK
+#undef PAGE_SIZE
+#define PAGE_SIZE 4096
+#define PAGE_MASK 4095
+
+void debugger_init();
+const char *addr_to_name(unsigned addr);
+
+/* magic shared structures that GDB knows about */
+
+struct link_map
+{
+ uintptr_t l_addr;
+ char * l_name;
+ uintptr_t l_ld;
+ struct link_map * l_next;
+ struct link_map * l_prev;
+};
+
+/* needed for dl_iterate_phdr to be passed to the callbacks provided */
+struct dl_phdr_info
+{
+ Elf32_Addr dlpi_addr;
+ const char *dlpi_name;
+ const Elf32_Phdr *dlpi_phdr;
+ Elf32_Half dlpi_phnum;
+};
+
+
+// Values for r_debug->state
+enum {
+ RT_CONSISTENT,
+ RT_ADD,
+ RT_DELETE
+};
+
+struct r_debug
+{
+ int32_t r_version;
+ struct link_map * r_map;
+ void (*r_brk)(void);
+ int32_t r_state;
+ uintptr_t r_ldbase;
+};
+
+typedef struct soinfo soinfo;
+
+#define FLAG_LINKED 0x00000001
+#define FLAG_ERROR 0x00000002
+#define FLAG_EXE 0x00000004 // The main executable
+
+#define SOINFO_NAME_LEN 128
+
+struct soinfo
+{
+ const char name[SOINFO_NAME_LEN];
+ Elf32_Phdr *phdr;
+ int phnum;
+ unsigned entry;
+ unsigned base;
+ unsigned size;
+
+ int unused; // DO NOT USE, maintained for compatibility.
+
+ unsigned *dynamic;
+
+ unsigned wrprotect_start;
+ unsigned wrprotect_end;
+
+ soinfo *next;
+ unsigned flags;
+
+ const char *strtab;
+ Elf32_Sym *symtab;
+
+ unsigned nbucket;
+ unsigned nchain;
+ unsigned *bucket;
+ unsigned *chain;
+
+ unsigned *plt_got;
+
+ Elf32_Rel *plt_rel;
+ unsigned plt_rel_count;
+
+ Elf32_Rel *rel;
+ unsigned rel_count;
+
+#ifdef ANDROID_SH_LINKER
+ Elf32_Rela *plt_rela;
+ unsigned plt_rela_count;
+
+ Elf32_Rela *rela;
+ unsigned rela_count;
+#endif /* ANDROID_SH_LINKER */
+
+ unsigned *preinit_array;
+ unsigned preinit_array_count;
+
+ unsigned *init_array;
+ unsigned init_array_count;
+ unsigned *fini_array;
+ unsigned fini_array_count;
+
+ void (*init_func)(void);
+ void (*fini_func)(void);
+
+#ifdef ANDROID_ARM_LINKER
+ /* ARM EABI section used for stack unwinding. */
+ unsigned *ARM_exidx;
+ unsigned ARM_exidx_count;
+#endif
+
+ unsigned refcount;
+ struct link_map linkmap;
+};
+
+
+extern soinfo libdl_info;
+
+#ifdef ANDROID_ARM_LINKER
+
+#define R_ARM_COPY 20
+#define R_ARM_GLOB_DAT 21
+#define R_ARM_JUMP_SLOT 22
+#define R_ARM_RELATIVE 23
+
+/* According to the AAPCS specification, we only
+ * need the above relocations. However, in practice,
+ * the following ones turn up from time to time.
+ */
+#define R_ARM_ABS32 2
+#define R_ARM_REL32 3
+
+#elif defined(ANDROID_X86_LINKER)
+
+#define R_386_32 1
+#define R_386_PC32 2
+#define R_386_GLOB_DAT 6
+#define R_386_JUMP_SLOT 7
+#define R_386_RELATIVE 8
+
+#elif defined(ANDROID_SH_LINKER)
+
+#define R_SH_DIR32 1
+#define R_SH_GLOB_DAT 163
+#define R_SH_JUMP_SLOT 164
+#define R_SH_RELATIVE 165
+
+#endif /* ANDROID_*_LINKER */
+
+
+#ifndef DT_INIT_ARRAY
+#define DT_INIT_ARRAY 25
+#endif
+
+#ifndef DT_FINI_ARRAY
+#define DT_FINI_ARRAY 26
+#endif
+
+#ifndef DT_INIT_ARRAYSZ
+#define DT_INIT_ARRAYSZ 27
+#endif
+
+#ifndef DT_FINI_ARRAYSZ
+#define DT_FINI_ARRAYSZ 28
+#endif
+
+#ifndef DT_PREINIT_ARRAY
+#define DT_PREINIT_ARRAY 32
+#endif
+
+#ifndef DT_PREINIT_ARRAYSZ
+#define DT_PREINIT_ARRAYSZ 33
+#endif
+
+soinfo *find_library(const char *name);
+unsigned unload_library(soinfo *si);
+Elf32_Sym *lookup_in_library(soinfo *si, const char *name);
+Elf32_Sym *lookup(const char *name, soinfo **found, soinfo *start);
+soinfo *find_containing_library(const void *addr);
+Elf32_Sym *find_containing_symbol(const void *addr, soinfo *si);
+const char *linker_get_error(void);
+
+#ifdef ANDROID_ARM_LINKER
+typedef long unsigned int *_Unwind_Ptr;
+_Unwind_Ptr dl_unwind_find_exidx(_Unwind_Ptr pc, int *pcount);
+#elif defined(ANDROID_X86_LINKER) || defined(ANDROID_SH_LINKER)
+int dl_iterate_phdr(int (*cb)(struct dl_phdr_info *, size_t, void *), void *);
+#endif
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008-2010 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _LINKER_DEBUG_H_
+#define _LINKER_DEBUG_H_
+
+#include <stdio.h>
+
+#ifndef LINKER_DEBUG
+#error LINKER_DEBUG should be defined to either 1 or 0 in Android.mk
+#endif
+
+/* set LINKER_DEBUG_TO_LOG to 1 to send the logs to logcat,
+ * or 0 to use stdout instead.
+ */
+#define LINKER_DEBUG_TO_LOG 1
+#define TRACE_DEBUG 1
+#define DO_TRACE_LOOKUP 1
+#define DO_TRACE_RELO 1
+#define TIMING 0
+#define STATS 0
+#define COUNT_PAGES 0
+
+/*********************************************************************
+ * You shouldn't need to modify anything below unless you are adding
+ * more debugging information.
+ *
+ * To enable/disable specific debug options, change the defines above
+ *********************************************************************/
+
+
+/*********************************************************************/
+#undef TRUE
+#undef FALSE
+#define TRUE 1
+#define FALSE 0
+
+/* Only use printf() during debugging. We have seen occasional memory
+ * corruption when the linker uses printf().
+ */
+#if LINKER_DEBUG
+#include "linker_format.h"
+extern int debug_verbosity;
+#if LINKER_DEBUG_TO_LOG
+extern int format_log(int, const char *, const char *, ...);
+#define _PRINTVF(v,f,x...) \
+ do { \
+ if (debug_verbosity > (v)) format_log(5-(v),"linker",x); \
+ } while (0)
+#else /* !LINKER_DEBUG_TO_LOG */
+extern int format_fd(int, const char *, ...);
+#define _PRINTVF(v,f,x...) \
+ do { \
+ if (debug_verbosity > (v)) format_fd(1, x); \
+ } while (0)
+#endif /* !LINKER_DEBUG_TO_LOG */
+#else /* !LINKER_DEBUG */
+#define _PRINTVF(v,f,x...) do {} while(0)
+#endif /* LINKER_DEBUG */
+
+#define PRINT(x...) _PRINTVF(-1, FALSE, x)
+#define INFO(x...) _PRINTVF(0, TRUE, x)
+#define TRACE(x...) _PRINTVF(1, TRUE, x)
+#define WARN(fmt,args...) \
+ _PRINTVF(-1, TRUE, "%s:%d| WARNING: " fmt, __FILE__, __LINE__, ## args)
+#define ERROR(fmt,args...) \
+ _PRINTVF(-1, TRUE, "%s:%d| ERROR: " fmt, __FILE__, __LINE__, ## args)
+
+
+#if TRACE_DEBUG
+#define DEBUG(x...) _PRINTVF(2, TRUE, "DEBUG: " x)
+#else /* !TRACE_DEBUG */
+#define DEBUG(x...) do {} while (0)
+#endif /* TRACE_DEBUG */
+
+#if LINKER_DEBUG
+#define TRACE_TYPE(t,x...) do { if (DO_TRACE_##t) { TRACE(x); } } while (0)
+#else /* !LINKER_DEBUG */
+#define TRACE_TYPE(t,x...) do {} while (0)
+#endif /* LINKER_DEBUG */
+
+#if STATS
+#define RELOC_ABSOLUTE 0
+#define RELOC_RELATIVE 1
+#define RELOC_COPY 2
+#define RELOC_SYMBOL 3
+#define NUM_RELOC_STATS 4
+
+struct _link_stats {
+ int reloc[NUM_RELOC_STATS];
+};
+extern struct _link_stats linker_stats;
+
+#define COUNT_RELOC(type) \
+ do { if (type >= 0 && type < NUM_RELOC_STATS) { \
+ linker_stats.reloc[type] += 1; \
+ } else { \
+ PRINT("Unknown reloc stat requested\n"); \
+ } \
+ } while(0)
+#else /* !STATS */
+#define COUNT_RELOC(type) do {} while(0)
+#endif /* STATS */
+
+#if TIMING
+#undef WARN
+#define WARN(x...) do {} while (0)
+#endif /* TIMING */
+
+#if COUNT_PAGES
+extern unsigned bitmask[];
+#define MARK(offset) do { \
+ bitmask[((offset) >> 12) >> 3] |= (1 << (((offset) >> 12) & 7)); \
+ } while(0)
+#else
+#define MARK(x) do {} while (0)
+#endif
+
+#define DEBUG_DUMP_PHDR(phdr, name, pid) do { \
+ DEBUG("%5d %s (phdr = 0x%08x)\n", (pid), (name), (unsigned)(phdr)); \
+ DEBUG("\t\tphdr->offset = 0x%08x\n", (unsigned)((phdr)->p_offset)); \
+ DEBUG("\t\tphdr->p_vaddr = 0x%08x\n", (unsigned)((phdr)->p_vaddr)); \
+ DEBUG("\t\tphdr->p_paddr = 0x%08x\n", (unsigned)((phdr)->p_paddr)); \
+ DEBUG("\t\tphdr->p_filesz = 0x%08x\n", (unsigned)((phdr)->p_filesz)); \
+ DEBUG("\t\tphdr->p_memsz = 0x%08x\n", (unsigned)((phdr)->p_memsz)); \
+ DEBUG("\t\tphdr->p_flags = 0x%08x\n", (unsigned)((phdr)->p_flags)); \
+ DEBUG("\t\tphdr->p_align = 0x%08x\n", (unsigned)((phdr)->p_align)); \
+ } while (0)
+
+#endif /* _LINKER_DEBUG_H_ */
--- /dev/null
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#include "linker_environ.h"
+#include <stddef.h>
+
+static char** _envp;
+
+/* Returns 1 if 'str' points to a valid environment variable definition.
+ * For now, we check that:
+ * - It is smaller than MAX_ENV_LEN (to detect non-zero terminated strings)
+ * - It contains at least one equal sign that is not the first character
+ */
+static int
+_is_valid_definition(const char* str)
+{
+ int pos = 0;
+ int first_equal_pos = -1;
+
+ /* According to its sources, the kernel uses 32*PAGE_SIZE by default
+ * as the maximum size for an env. variable definition.
+ */
+ const int MAX_ENV_LEN = 32*4096;
+
+ if (str == NULL)
+ return 0;
+
+ /* Parse the string, looking for the first '=' there, and its size */
+ do {
+ if (str[pos] == '\0')
+ break;
+ if (str[pos] == '=' && first_equal_pos < 0)
+ first_equal_pos = pos;
+ pos++;
+ } while (pos < MAX_ENV_LEN);
+
+ if (pos >= MAX_ENV_LEN) /* Too large */
+ return 0;
+
+ if (first_equal_pos < 1) /* No equal sign, or it is the first character */
+ return 0;
+
+ return 1;
+}
+
+unsigned*
+linker_env_init(unsigned* vecs)
+{
+ /* Store environment pointer - can't be NULL */
+ _envp = (char**) vecs;
+
+ /* Skip over all definitions */
+ while (vecs[0] != 0)
+ vecs++;
+ /* The end of the environment block is marked by two NULL pointers */
+ vecs++;
+
+ /* As a sanity check, we're going to remove all invalid variable
+ * definitions from the environment array.
+ */
+ {
+ char** readp = _envp;
+ char** writep = _envp;
+ for ( ; readp[0] != NULL; readp++ ) {
+ if (!_is_valid_definition(readp[0]))
+ continue;
+ writep[0] = readp[0];
+ writep++;
+ }
+ writep[0] = NULL;
+ }
+
+ /* Return the address of the aux vectors table */
+ return vecs;
+}
+
+/* Check if the environment variable definition at 'envstr'
+ * starts with '<name>=', and if so return the address of the
+ * first character after the equal sign. Otherwise return NULL.
+ */
+static char*
+env_match(char* envstr, const char* name)
+{
+ size_t cnt = 0;
+
+ while (envstr[cnt] == name[cnt] && name[cnt] != '\0')
+ cnt++;
+
+ if (name[cnt] == '\0' && envstr[cnt] == '=')
+ return envstr + cnt + 1;
+
+ return NULL;
+}
+
+#define MAX_ENV_LEN (16*4096)
+
+const char*
+linker_env_get(const char* name)
+{
+ char** readp = _envp;
+
+ if (name == NULL || name[0] == '\0')
+ return NULL;
+
+ for ( ; readp[0] != NULL; readp++ ) {
+ char* val = env_match(readp[0], name);
+ if (val != NULL) {
+ /* Return NULL for empty strings, or if it is too large */
+ if (val[0] == '\0')
+ val = NULL;
+ return val;
+ }
+ }
+ return NULL;
+}
+
+
+void
+linker_env_unset(const char* name)
+{
+ char** readp = _envp;
+ char** writep = readp;
+
+ if (name == NULL || name[0] == '\0')
+ return;
+
+ for ( ; readp[0] != NULL; readp++ ) {
+ if (env_match(readp[0], name))
+ continue;
+ writep[0] = readp[0];
+ writep++;
+ }
+ /* end list with a NULL */
+ writep[0] = NULL;
+}
+
+
+
+/* Remove unsafe environment variables. This should be used when
+ * running setuid programs. */
+void
+linker_env_secure(void)
+{
+ /* The same list than GLibc at this point */
+ static const char* const unsec_vars[] = {
+ "GCONV_PATH",
+ "GETCONF_DIR",
+ "HOSTALIASES",
+ "LD_AUDIT",
+ "LD_DEBUG",
+ "LD_DEBUG_OUTPUT",
+ "LD_DYNAMIC_WEAK",
+ "LD_LIBRARY_PATH",
+ "LD_ORIGIN_PATH",
+ "LD_PRELOAD",
+ "LD_PROFILE",
+ "LD_SHOW_AUXV",
+ "LD_USE_LOAD_BIAS",
+ "LOCALDOMAIN",
+ "LOCPATH",
+ "MALLOC_TRACE",
+ "MALLOC_CHECK_",
+ "NIS_PATH",
+ "NLSPATH",
+ "RESOLV_HOST_CONF",
+ "RES_OPTIONS",
+ "TMPDIR",
+ "TZDIR",
+ "LD_AOUT_LIBRARY_PATH",
+ "LD_AOUT_PRELOAD",
+ };
+
+ const char* const* cp = unsec_vars;
+ const char* const* endp = cp + sizeof(unsec_vars)/sizeof(unsec_vars[0]);
+
+ while (cp < endp) {
+ linker_env_unset(*cp);
+ cp++;
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef LINKER_ENVIRON_H
+#define LINKER_ENVIRON_H
+
+/* Call this function before anything else. 'vecs' must be the pointer
+ * to the environment block in the ELF data block. The function returns
+ * the start of the aux vectors after the env block.
+ */
+extern unsigned* linker_env_init(unsigned* vecs);
+
+/* Unset a given environment variable. In case the variable is defined
+ * multiple times, unset all instances. This modifies the environment
+ * block, so any pointer returned by linker_env_get() after this call
+ * might become invalid */
+extern void linker_env_unset(const char* name);
+
+
+/* Returns the value of environment variable 'name' if defined and not
+ * empty, or NULL otherwise. Note that the returned pointer may become
+ * invalid if linker_env_unset() or linker_env_secure() are called
+ * after this function. */
+extern const char* linker_env_get(const char* name);
+
+/* Remove unsecure environment variables. This should be used when
+ * running setuid programs. */
+extern void linker_env_secure(void);
+
+#endif /* LINKER_ENVIRON_H */
--- /dev/null
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <stdarg.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <stddef.h>
+#include "linker_format.h"
+#include "linker_debug.h"
+
+/* define UNIT_TESTS to build this file as a single executable that runs
+ * the formatter's unit tests
+ */
+#define xxUNIT_TESTS
+
+/*** Generic output sink
+ ***/
+
+typedef struct {
+ void *opaque;
+ void (*send)(void *opaque, const char *data, int len);
+} Out;
+
+static void
+out_send(Out *o, const void *data, size_t len)
+{
+ o->send(o->opaque, data, (int)len);
+}
+
+static void
+out_send_repeat(Out *o, char ch, int count)
+{
+ char pad[8];
+ const int padSize = (int)sizeof(pad);
+
+ memset(pad, ch, sizeof(pad));
+ while (count > 0) {
+ int avail = count;
+ if (avail > padSize) {
+ avail = padSize;
+ }
+ o->send(o->opaque, pad, avail);
+ count -= avail;
+ }
+}
+
+/* forward declaration */
+static void
+out_vformat(Out *o, const char *format, va_list args);
+
+/*** Bounded buffer output
+ ***/
+
+typedef struct {
+ Out out[1];
+ char *buffer;
+ char *pos;
+ char *end;
+ int total;
+} BufOut;
+
+static void
+buf_out_send(void *opaque, const char *data, int len)
+{
+ BufOut *bo = opaque;
+
+ if (len < 0)
+ len = strlen(data);
+
+ bo->total += len;
+
+ while (len > 0) {
+ int avail = bo->end - bo->pos;
+ if (avail == 0)
+ break;
+ if (avail > len)
+ avail = len;
+ memcpy(bo->pos, data, avail);
+ bo->pos += avail;
+ bo->pos[0] = '\0';
+ len -= avail;
+ }
+}
+
+static Out*
+buf_out_init(BufOut *bo, char *buffer, size_t size)
+{
+ if (size == 0)
+ return NULL;
+
+ bo->out->opaque = bo;
+ bo->out->send = buf_out_send;
+ bo->buffer = buffer;
+ bo->end = buffer + size - 1;
+ bo->pos = bo->buffer;
+ bo->pos[0] = '\0';
+ bo->total = 0;
+
+ return bo->out;
+}
+
+static int
+buf_out_length(BufOut *bo)
+{
+ return bo->total;
+}
+
+static int
+vformat_buffer(char *buff, size_t buffsize, const char *format, va_list args)
+{
+ BufOut bo;
+ Out *out;
+
+ out = buf_out_init(&bo, buff, buffsize);
+ if (out == NULL)
+ return 0;
+
+ out_vformat(out, format, args);
+
+ return buf_out_length(&bo);
+}
+
+int
+format_buffer(char *buff, size_t buffsize, const char *format, ...)
+{
+ va_list args;
+ int ret;
+
+ va_start(args, format);
+ ret = vformat_buffer(buff, buffsize, format, args);
+ va_end(args);
+
+ return ret;
+}
+
+/* The __stack_chk_fail() function calls __libc_android_log_print()
+ * which calls vsnprintf().
+ *
+ * We define our version of the function here to avoid dragging
+ * about 25 KB of C library routines related to formatting.
+ */
+#if 0
+int
+vsnprintf(char *buff, size_t bufsize, const char *format, va_list args)
+{
+ return format_buffer(buff, bufsize, format, args);
+}
+#endif
+
+#if LINKER_DEBUG
+
+#if !LINKER_DEBUG_TO_LOG
+
+/*** File descriptor output
+ ***/
+
+typedef struct {
+ Out out[1];
+ int fd;
+ int total;
+} FdOut;
+
+static void
+fd_out_send(void *opaque, const char *data, int len)
+{
+ FdOut *fdo = opaque;
+
+ if (len < 0)
+ len = strlen(data);
+
+ while (len > 0) {
+ int ret = write(fdo->fd, data, len);
+ if (ret < 0) {
+ if (errno == EINTR)
+ continue;
+ break;
+ }
+ data += ret;
+ len -= ret;
+ fdo->total += ret;
+ }
+}
+
+static Out*
+fd_out_init(FdOut *fdo, int fd)
+{
+ fdo->out->opaque = fdo;
+ fdo->out->send = fd_out_send;
+ fdo->fd = fd;
+ fdo->total = 0;
+
+ return fdo->out;
+}
+
+static int
+fd_out_length(FdOut *fdo)
+{
+ return fdo->total;
+}
+
+
+int
+format_fd(int fd, const char *format, ...)
+{
+ FdOut fdo;
+ Out* out;
+ va_list args;
+
+ out = fd_out_init(&fdo, fd);
+ if (out == NULL)
+ return 0;
+
+ va_start(args, format);
+ out_vformat(out, format, args);
+ va_end(args);
+
+ return fd_out_length(&fdo);
+}
+
+#else /* LINKER_DEBUG_TO_LOG */
+
+/*** Log output
+ ***/
+
+/* We need our own version of __libc_android_log_vprint, otherwise
+ * the log output is completely broken. Probably due to the fact
+ * that the C library is not initialized yet.
+ *
+ * You can test that by setting CUSTOM_LOG_VPRINT to 0
+ */
+#define CUSTOM_LOG_VPRINT 1
+
+#if CUSTOM_LOG_VPRINT
+
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/uio.h>
+
+static int log_vprint(int prio, const char *tag, const char *fmt, va_list args)
+{
+ char buf[1024];
+ int result;
+ static int log_fd = -1;
+
+ result = vformat_buffer(buf, sizeof buf, fmt, args);
+
+ if (log_fd < 0) {
+ log_fd = open("/dev/log/main", O_WRONLY);
+ if (log_fd < 0)
+ return result;
+ }
+
+ {
+ ssize_t ret;
+ struct iovec vec[3];
+
+ vec[0].iov_base = (unsigned char *) &prio;
+ vec[0].iov_len = 1;
+ vec[1].iov_base = (void *) tag;
+ vec[1].iov_len = strlen(tag) + 1;
+ vec[2].iov_base = (void *) buf;
+ vec[2].iov_len = strlen(buf) + 1;
+
+ do {
+ ret = writev(log_fd, vec, 3);
+ } while ((ret < 0) && (errno == EINTR));
+ }
+ return result;
+}
+
+#define __libc_android_log_vprint log_vprint
+
+#else /* !CUSTOM_LOG_VPRINT */
+
+extern int __libc_android_log_vprint(int prio, const char* tag, const char* format, va_list ap);
+
+#endif /* !CUSTOM_LOG_VPRINT */
+
+int
+format_log(int prio, const char *tag, const char *format, ...)
+{
+ int ret;
+ va_list args;
+ va_start(args, format);
+ ret = __libc_android_log_vprint(prio, tag, format, args);
+ va_end(args);
+ return ret;
+}
+
+#endif /* LINKER_DEBUG_TO_LOG */
+
+#endif /* LINKER_DEBUG */
+
+/*** formatted output implementation
+ ***/
+
+/* Parse a decimal string from 'format + *ppos',
+ * return the value, and writes the new position past
+ * the decimal string in '*ppos' on exit.
+ *
+ * NOTE: Does *not* handle a sign prefix.
+ */
+static unsigned
+parse_decimal(const char *format, int *ppos)
+{
+ const char* p = format + *ppos;
+ unsigned result = 0;
+
+ for (;;) {
+ int ch = *p;
+ unsigned d = (unsigned)(ch - '0');
+
+ if (d >= 10U)
+ break;
+
+ result = result*10 + d;
+ p++;
+ }
+ *ppos = p - format;
+ return result;
+}
+
+/* write an octal/decimal/number into a bounded buffer.
+ * assumes that bufsize > 0, and 'digits' is a string of
+ * digits of at least 'base' values.
+ */
+static void
+format_number(char *buffer, size_t bufsize, uint64_t value, int base, const char *digits)
+{
+ char *pos = buffer;
+ char *end = buffer + bufsize - 1;
+
+ /* generate digit string in reverse order */
+ while (value) {
+ unsigned d = value % base;
+ value /= base;
+ if (pos < end) {
+ *pos++ = digits[d];
+ }
+ }
+
+ /* special case for 0 */
+ if (pos == buffer) {
+ if (pos < end) {
+ *pos++ = '0';
+ }
+ }
+ pos[0] = '\0';
+
+ /* now reverse digit string in-place */
+ end = pos - 1;
+ pos = buffer;
+ while (pos < end) {
+ int ch = pos[0];
+ pos[0] = end[0];
+ end[0] = (char) ch;
+ pos++;
+ end--;
+ }
+}
+
+/* Write an integer (octal or decimal) into a buffer, assumes buffsize > 2 */
+static void
+format_integer(char *buffer, size_t buffsize, uint64_t value, int base, int isSigned)
+{
+ if (isSigned && (int64_t)value < 0) {
+ buffer[0] = '-';
+ buffer += 1;
+ buffsize -= 1;
+ value = (uint64_t)(-(int64_t)value);
+ }
+
+ format_number(buffer, buffsize, value, base, "0123456789");
+}
+
+/* Write an octal into a buffer, assumes buffsize > 2 */
+static void
+format_octal(char *buffer, size_t buffsize, uint64_t value, int isSigned)
+{
+ format_integer(buffer, buffsize, value, 8, isSigned);
+}
+
+/* Write a decimal into a buffer, assumes buffsize > 2 */
+static void
+format_decimal(char *buffer, size_t buffsize, uint64_t value, int isSigned)
+{
+ format_integer(buffer, buffsize, value, 10, isSigned);
+}
+
+/* Write an hexadecimal into a buffer, isCap is true for capital alphas.
+ * Assumes bufsize > 2 */
+static void
+format_hex(char *buffer, size_t buffsize, uint64_t value, int isCap)
+{
+ const char *digits = isCap ? "0123456789ABCDEF" : "0123456789abcdef";
+
+ format_number(buffer, buffsize, value, 16, digits);
+}
+
+
+/* Perform formatted output to an output target 'o' */
+static void
+out_vformat(Out *o, const char *format, va_list args)
+{
+ int nn = 0;
+
+ for (;;) {
+ int mm;
+ int padZero = 0;
+ int padLeft = 0;
+ char sign = '\0';
+ int width = -1;
+ int prec = -1;
+ size_t bytelen = sizeof(int);
+ const char* str;
+ int slen;
+ char buffer[32]; /* temporary buffer used to format numbers */
+
+ char c;
+
+ /* first, find all characters that are not 0 or '%' */
+ /* then send them to the output directly */
+ mm = nn;
+ do {
+ c = format[mm];
+ if (c == '\0' || c == '%')
+ break;
+ mm++;
+ } while (1);
+
+ if (mm > nn) {
+ out_send(o, format+nn, mm-nn);
+ nn = mm;
+ }
+
+ /* is this it ? then exit */
+ if (c == '\0')
+ break;
+
+ /* nope, we are at a '%' modifier */
+ nn++; // skip it
+
+ /* parse flags */
+ for (;;) {
+ c = format[nn++];
+ if (c == '\0') { /* single trailing '%' ? */
+ c = '%';
+ out_send(o, &c, 1);
+ return;
+ }
+ else if (c == '0') {
+ padZero = 1;
+ continue;
+ }
+ else if (c == '-') {
+ padLeft = 1;
+ continue;
+ }
+ else if (c == ' ' || c == '+') {
+ sign = c;
+ continue;
+ }
+ break;
+ }
+
+ /* parse field width */
+ if ((c >= '0' && c <= '9')) {
+ nn --;
+ width = (int)parse_decimal(format, &nn);
+ c = format[nn++];
+ }
+
+ /* parse precision */
+ if (c == '.') {
+ prec = (int)parse_decimal(format, &nn);
+ c = format[nn++];
+ }
+
+ /* length modifier */
+ switch (c) {
+ case 'h':
+ bytelen = sizeof(short);
+ if (format[nn] == 'h') {
+ bytelen = sizeof(char);
+ nn += 1;
+ }
+ c = format[nn++];
+ break;
+ case 'l':
+ bytelen = sizeof(long);
+ if (format[nn] == 'l') {
+ bytelen = sizeof(long long);
+ nn += 1;
+ }
+ c = format[nn++];
+ break;
+ case 'z':
+ bytelen = sizeof(size_t);
+ c = format[nn++];
+ break;
+ case 't':
+ bytelen = sizeof(ptrdiff_t);
+ c = format[nn++];
+ break;
+ default:
+ ;
+ }
+
+ /* conversion specifier */
+ if (c == 's') {
+ /* string */
+ str = va_arg(args, const char*);
+ } else if (c == 'c') {
+ /* character */
+ /* NOTE: char is promoted to int when passed through the stack */
+ buffer[0] = (char) va_arg(args, int);
+ buffer[1] = '\0';
+ str = buffer;
+ } else if (c == 'p') {
+ uint64_t value = (uintptr_t) va_arg(args, void*);
+ buffer[0] = '0';
+ buffer[1] = 'x';
+ format_hex(buffer + 2, sizeof buffer-2, value, 0);
+ str = buffer;
+ } else {
+ /* integers - first read value from stack */
+ uint64_t value;
+ int isSigned = (c == 'd' || c == 'i' || c == 'o');
+
+ /* NOTE: int8_t and int16_t are promoted to int when passed
+ * through the stack
+ */
+ switch (bytelen) {
+ case 1: value = (uint8_t) va_arg(args, int); break;
+ case 2: value = (uint16_t) va_arg(args, int); break;
+ case 4: value = va_arg(args, uint32_t); break;
+ case 8: value = va_arg(args, uint64_t); break;
+ default: return; /* should not happen */
+ }
+
+ /* sign extension, if needed */
+ if (isSigned) {
+ int shift = 64 - 8*bytelen;
+ value = (uint64_t)(((int64_t)(value << shift)) >> shift);
+ }
+
+ /* format the number properly into our buffer */
+ switch (c) {
+ case 'i': case 'd':
+ format_integer(buffer, sizeof buffer, value, 10, isSigned);
+ break;
+ case 'o':
+ format_integer(buffer, sizeof buffer, value, 8, isSigned);
+ break;
+ case 'x': case 'X':
+ format_hex(buffer, sizeof buffer, value, (c == 'X'));
+ break;
+ default:
+ buffer[0] = '\0';
+ }
+ /* then point to it */
+ str = buffer;
+ }
+
+ /* if we are here, 'str' points to the content that must be
+ * outputted. handle padding and alignment now */
+
+ slen = strlen(str);
+
+ if (slen < width && !padLeft) {
+ char padChar = padZero ? '0' : ' ';
+ out_send_repeat(o, padChar, width - slen);
+ }
+
+ out_send(o, str, slen);
+
+ if (slen < width && padLeft) {
+ char padChar = padZero ? '0' : ' ';
+ out_send_repeat(o, padChar, width - slen);
+ }
+ }
+}
+
+
+#ifdef UNIT_TESTS
+
+#include <stdio.h>
+
+static int gFails = 0;
+
+#define MARGIN 40
+
+#define UTEST_CHECK(condition,message) \
+ printf("Checking %-*s: ", MARGIN, message); fflush(stdout); \
+ if (!(condition)) { \
+ printf("KO\n"); \
+ gFails += 1; \
+ } else { \
+ printf("ok\n"); \
+ }
+
+static void
+utest_BufOut(void)
+{
+ char buffer[16];
+ BufOut bo[1];
+ Out* out;
+ int ret;
+
+ buffer[0] = '1';
+ out = buf_out_init(bo, buffer, sizeof buffer);
+ UTEST_CHECK(buffer[0] == '\0', "buf_out_init clears initial byte");
+ out_send(out, "abc", 3);
+ UTEST_CHECK(!memcmp(buffer, "abc", 4), "out_send() works with BufOut");
+ out_send_repeat(out, 'X', 4);
+ UTEST_CHECK(!memcmp(buffer, "abcXXXX", 8), "out_send_repeat() works with BufOut");
+ buffer[sizeof buffer-1] = 'x';
+ out_send_repeat(out, 'Y', 2*sizeof(buffer));
+ UTEST_CHECK(buffer[sizeof buffer-1] == '\0', "overflows always zero-terminates");
+
+ out = buf_out_init(bo, buffer, sizeof buffer);
+ out_send_repeat(out, 'X', 2*sizeof(buffer));
+ ret = buf_out_length(bo);
+ UTEST_CHECK(ret == 2*sizeof(buffer), "correct size returned on overflow");
+}
+
+static void
+utest_expect(const char* result, const char* format, ...)
+{
+ va_list args;
+ BufOut bo[1];
+ char buffer[256];
+ Out* out = buf_out_init(bo, buffer, sizeof buffer);
+
+ printf("Checking %-*s: ", MARGIN, format); fflush(stdout);
+ va_start(args, format);
+ out_vformat(out, format, args);
+ va_end(args);
+
+ if (strcmp(result, buffer)) {
+ printf("KO. got '%s' expecting '%s'\n", buffer, result);
+ gFails += 1;
+ } else {
+ printf("ok. got '%s'\n", result);
+ }
+}
+
+int main(void)
+{
+ utest_BufOut();
+ utest_expect("", "");
+ utest_expect("a", "a");
+ utest_expect("01234", "01234", "");
+ utest_expect("01234", "%s", "01234");
+ utest_expect("aabbcc", "aa%scc", "bb");
+ utest_expect("a", "%c", 'a');
+ utest_expect("1234", "%d", 1234);
+ utest_expect("-8123", "%d", -8123);
+ utest_expect("16", "%hd", 0x7fff0010);
+ utest_expect("16", "%hhd", 0x7fffff10);
+ utest_expect("68719476736", "%lld", 0x1000000000LL);
+ utest_expect("70000", "%ld", 70000);
+ utest_expect("0xb0001234", "%p", (void*)0xb0001234);
+ utest_expect("12ab", "%x", 0x12ab);
+ utest_expect("12AB", "%X", 0x12ab);
+ utest_expect("00123456", "%08x", 0x123456);
+ utest_expect("01234", "0%d", 1234);
+ utest_expect(" 1234", "%5d", 1234);
+ utest_expect("01234", "%05d", 1234);
+ utest_expect(" 1234", "%8d", 1234);
+ utest_expect("1234 ", "%-8d", 1234);
+ utest_expect("abcdef ", "%-11s", "abcdef");
+ utest_expect("something:1234", "%s:%d", "something", 1234);
+ utest_expect("005:5:05", "%03d:%d:%02d", 5, 5, 5);
+ utest_expect("5,0x0", "%d,%p", 5, NULL);
+ utest_expect("68719476736,6,7,8", "%lld,%d,%d,%d", 0x1000000000LL, 6, 7, 8);
+ return gFails != 0;
+}
+
+#endif /* UNIT_TESTS */
--- /dev/null
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _LINKER_FORMAT_H
+#define _LINKER_FORMAT_H
+
+#include <stdarg.h>
+#include <stddef.h>
+
+/* Formatting routines for the dynamic linker's debug traces */
+/* We want to avoid dragging the whole C library fprintf() */
+/* implementation into the dynamic linker since this creates */
+/* issues (it uses malloc()/free()) and increases code size */
+
+int format_buffer(char *buffer, size_t bufsize, const char *format, ...);
+
+#endif /* _LINKER_FORMAT_H */
--- /dev/null
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * This function is an empty stub where GDB locates a breakpoint to get notified
+ * about linker activity.
+ */
+void __attribute__((noinline)) rtld_db_dlactivity(void)
+{
+}
+
--- /dev/null
+if WANT_ARCH_ARM
+ARCHFLAGS = -DHAVE_ARM_TLS_REGISTER -DANDROID_ARM_LINKER
+endif
+
+if WANT_ARCH_X86
+ARCHFLAGS = -DANDROID_X86_LINKER
+endif
+
+noinst_LTLIBRARIES = \
+ libandroid-linker.la
+libandroid_linker_la_SOURCES = \
+ dlfcn.c \
+ linker.c \
+ linker_environ.c \
+ linker_format.c \
+ rt.c
+libandroid_linker_la_CFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/common \
+ -DLINKER_TEXT_BASE=0xB0000100 \
+ -DLINKER_AREA_SIZE=0x01000000 \
+ -DDEFAULT_HYBRIS_LD_LIBRARY_PATH="\"@DEFAULT_HYBRIS_LD_LIBRARY_PATH@\"" \
+ $(ARCHFLAGS)
+
+if WANT_DEBUG
+libandroid_linker_la_CFLAGS += -DLINKER_DEBUG=1
+else
+libandroid_linker_la_CFLAGS += -DLINKER_DEBUG=0
+endif
--- /dev/null
+
+ Copyright (c) 2005-2008, The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
--- /dev/null
+Android Dynamic Linker Design Notes
+===================================
+
+Introduction:
+-------------
+
+This document provides several notes related to the design of the Android
+dynamic linker.
+
+
+Prelinking:
+-----------
+
+System libraries in Android are internally prelinked, which means that
+any internal relocations within them are stripped from the corresponding
+shared object, in order to reduce size and speed up loading.
+
+Such libraries can only be loaded at the very specific virtual memory address
+they have been prelinked to (during the build process). The list of prelinked
+system libraries and their corresponding virtual memory address is found in
+the file:
+
+ build/core/prelink-linux-<arch>.map
+
+It should be updated each time a new system library is added to the
+system.
+
+The prelink step happens at build time, and uses the 'soslim' and 'apriori'
+tools:
+
+ - 'apriori' is the real prelink tool which removes relocations from the
+ shared object, however, it must be given a list of symbols to remove
+ from the file.
+
+ - 'soslim' is used to find symbols in an executable ELF file
+ and generate a list that can be passed to 'apriori'.
+
+By default, these tools are only used to remove internal symbols from
+libraries, though they have been designed to allow more aggressive
+optimizations (e.g. 'global' prelinking and symbol stripping, which
+prevent replacing individual system libraries though).
+
+You can disable prelinking at build time by modifying your Android.mk with
+a line like:
+
+ LOCAL_PRELINK_MODULE := false
+
+
+Initialization and Termination functions:
+-----------------------------------------
+
+The Unix Sys V Binary Interface standard states that an
+executable can have the following entries in its .dynamic
+section:
+
+ DT_INIT
+ Points to the address of an initialization function
+ that must be called when the file is loaded.
+
+ DT_INIT_ARRAY
+ Points to an array of function addresses that must be
+ called, in-order, to perform initialization. Some of
+ the entries in the array can be 0 or -1, and should
+ be ignored.
+
+ Note: this is generally stored in a .init_array section
+
+ DT_INIT_ARRAYSZ
+ The size of the DT_INITARRAY, if any
+
+ DT_FINI
+ Points to the address of a finalization function which
+ must be called when the file is unloaded or the process
+ terminated.
+
+ DT_FINI_ARRAY
+ Same as DT_INITARRAY but for finalizers. Note that the
+ functions must be called in reverse-order though
+
+ Note: this is generally stored in a .fini_array section
+
+ DT_FINI_ARRAYSZ
+ Size of FT_FINIARRAY
+
+ DT_PREINIT_ARRAY
+ An array similar to DT_INIT_ARRAY which must *only* be
+ present in executables, not shared libraries, which contains
+ a list of functions that need to be called before any other
+ initialization function (i.e. DT_INIT and/or DT_INIT_ARRAY)
+ in the executable or any of its libraries.
+
+ Note: this is generally stored in a .preinit_array section
+
+ DT_PREINIT_ARRAYSZ
+ The size of DT_PREINIT_ARRAY
+
+If both a DT_INIT and DT_INITARRAY entry are present, the DT_INIT
+function must be called before the DT_INITARRAY functions.
+
+Consequently, the DT_FINIARRAY must be parsed in reverse order before
+the DT_FINI function, if both are available.
+
+Note that the implementation of static C++ constructors is very
+much processor dependent, and may use different ELF sections.
+
+On the ARM (see "C++ ABI for ARM" document), the static constructors
+must be called explicitly from the DT_INIT_ARRAY, and each one of them
+shall register a destructor by calling the special __eabi_atexit()
+function (provided by the C library). The DT_FINI_ARRAY is not used
+by static C++ destructors.
+
+On x86, the lists of constructors and destructors are placed in special
+sections named ".ctors" and ".dtors", and the DT_INIT / DT_FINI functions
+are in charge of calling them explicitly.
+
+
+Debugging:
+----------
+
+It is possible to enable debug output in the dynamic linker. To do so,
+follow these steps:
+
+1/ Modify the line in Android.mk that says:
+
+ LOCAL_CFLAGS += -DLINKER_DEBUG=0
+
+ Into the following:
+
+ LOCAL_CFLAGS += -DLINKER_DEBUG=1
+
+2/ Force-rebuild the dynamic linker:
+
+ cd bionic/linker
+ mm -B
+
+3/ Rebuild a new system image.
+
+You can increase the verbosity of debug traces by defining the DEBUG
+environment variable to a numeric value from 0 to 2. This will only
+affect new processes being launched.
+
+By default, traces are sent to logcat, with the "linker" tag. You can
+change this to go to stdout instead by setting the definition of
+LINKER_DEBUG_TO_LOG to 0 in "linker_debug.h".
--- /dev/null
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+ .text
+ .align 4
+ .type _start,#function
+ .globl _start
+
+_start:
+ mov r0, sp
+ mov r1, #0
+ bl __linker_init
+
+ /* linker init returns the _entry address in the main image */
+ mov pc, r0
+
+ .section .ctors, "wa"
+ .globl __CTOR_LIST__
+__CTOR_LIST__:
+ .long -1
--- /dev/null
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+.text
+.align 4
+.type _start, @function
+.globl _start
+
+_start:
+ /* save the elfdata ptr to %eax, AND push it onto the stack */
+ mov %esp, %eax
+ pushl %esp
+
+ pushl %eax
+ call __linker_init
+
+ /* linker init returns (%eax) the _entry address in the main image */
+ /* entry point expects sp to point to elfdata */
+ popl %esp
+ jmp *%eax
+
--- /dev/null
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <signal.h>
+#include <sys/mman.h>
+#include <sys/prctl.h>
+#include <errno.h>
+
+#include "linker.h"
+
+#include <sys/socket.h>
+#include <sys/un.h>
+
+extern int tgkill(int tgid, int tid, int sig);
+
+void notify_gdb_of_libraries();
+
+#define DEBUGGER_SOCKET_NAME "android:debuggerd"
+
+typedef enum {
+ // dump a crash
+ DEBUGGER_ACTION_CRASH,
+ // dump a tombstone file
+ DEBUGGER_ACTION_DUMP_TOMBSTONE,
+ // dump a backtrace only back to the socket
+ DEBUGGER_ACTION_DUMP_BACKTRACE,
+} debugger_action_t;
+
+/* message sent over the socket */
+typedef struct {
+ debugger_action_t action;
+ pid_t tid;
+} debugger_msg_t;
+
+#define RETRY_ON_EINTR(ret,cond) \
+ do { \
+ ret = (cond); \
+ } while (ret < 0 && errno == EINTR)
+
+// see man(2) prctl, specifically the section about PR_GET_NAME
+#define MAX_TASK_NAME_LEN (16)
+
+static int socket_abstract_client(const char *name, int type)
+{
+ struct sockaddr_un addr;
+ size_t namelen;
+ socklen_t alen;
+ int s, err;
+
+ namelen = strlen(name);
+
+ // Test with length +1 for the *initial* '\0'.
+ if ((namelen + 1) > sizeof(addr.sun_path)) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ /* This is used for abstract socket namespace, we need
+ * an initial '\0' at the start of the Unix socket path.
+ *
+ * Note: The path in this case is *not* supposed to be
+ * '\0'-terminated. ("man 7 unix" for the gory details.)
+ */
+ memset (&addr, 0, sizeof addr);
+ addr.sun_family = AF_LOCAL;
+ addr.sun_path[0] = 0;
+ memcpy(addr.sun_path + 1, name, namelen);
+
+ alen = namelen + offsetof(struct sockaddr_un, sun_path) + 1;
+
+ s = socket(AF_LOCAL, type, 0);
+ if(s < 0) return -1;
+
+ RETRY_ON_EINTR(err,connect(s, (struct sockaddr *) &addr, alen));
+ if (err < 0) {
+ close(s);
+ s = -1;
+ }
+
+ return s;
+}
+
+#include "linker_format.h"
+#include <../libc/private/logd.h>
+
+/*
+ * Writes a summary of the signal to the log file.
+ *
+ * We could be here as a result of native heap corruption, or while a
+ * mutex is being held, so we don't want to use any libc functions that
+ * could allocate memory or hold a lock.
+ */
+static void logSignalSummary(int signum, const siginfo_t* info)
+{
+ char buffer[128];
+ char threadname[MAX_TASK_NAME_LEN + 1]; // one more for termination
+
+ char* signame;
+ switch (signum) {
+ case SIGILL: signame = "SIGILL"; break;
+ case SIGABRT: signame = "SIGABRT"; break;
+ case SIGBUS: signame = "SIGBUS"; break;
+ case SIGFPE: signame = "SIGFPE"; break;
+ case SIGSEGV: signame = "SIGSEGV"; break;
+ case SIGSTKFLT: signame = "SIGSTKFLT"; break;
+ case SIGPIPE: signame = "SIGPIPE"; break;
+ default: signame = "???"; break;
+ }
+
+ if (prctl(PR_GET_NAME, (unsigned long)threadname, 0, 0, 0) != 0) {
+ strcpy(threadname, "<name unknown>");
+ } else {
+ // short names are null terminated by prctl, but the manpage
+ // implies that 16 byte names are not.
+ threadname[MAX_TASK_NAME_LEN] = 0;
+ }
+ format_buffer(buffer, sizeof(buffer),
+ "Fatal signal %d (%s) at 0x%08x (code=%d), thread %d (%s)",
+ signum, signame, info->si_addr, info->si_code, gettid(), threadname);
+
+ __libc_android_log_write(ANDROID_LOG_FATAL, "libc", buffer);
+}
+
+/*
+ * Catches fatal signals so we can ask debuggerd to ptrace us before
+ * we crash.
+ */
+void debugger_signal_handler(int n, siginfo_t* info, void* unused)
+{
+ char msgbuf[128];
+ unsigned tid;
+ int s;
+
+ logSignalSummary(n, info);
+
+ tid = gettid();
+ s = socket_abstract_client(DEBUGGER_SOCKET_NAME, SOCK_STREAM);
+
+ if (s >= 0) {
+ /* debugger knows our pid from the credentials on the
+ * local socket but we need to tell it our tid. It
+ * is paranoid and will verify that we are giving a tid
+ * that's actually in our process
+ */
+ int ret;
+ debugger_msg_t msg;
+ msg.action = DEBUGGER_ACTION_CRASH;
+ msg.tid = tid;
+ RETRY_ON_EINTR(ret, write(s, &msg, sizeof(msg)));
+ if (ret == sizeof(msg)) {
+ /* if the write failed, there is no point to read on
+ * the file descriptor. */
+ RETRY_ON_EINTR(ret, read(s, &tid, 1));
+ int savedErrno = errno;
+ notify_gdb_of_libraries();
+ errno = savedErrno;
+ }
+
+ if (ret < 0) {
+ /* read or write failed -- broken connection? */
+ format_buffer(msgbuf, sizeof(msgbuf),
+ "Failed while talking to debuggerd: %s", strerror(errno));
+ __libc_android_log_write(ANDROID_LOG_FATAL, "libc", msgbuf);
+ }
+
+ close(s);
+ } else {
+ /* socket failed; maybe process ran out of fds */
+ format_buffer(msgbuf, sizeof(msgbuf),
+ "Unable to open connection to debuggerd: %s", strerror(errno));
+ __libc_android_log_write(ANDROID_LOG_FATAL, "libc", msgbuf);
+ }
+
+ /* remove our net so we fault for real when we return */
+ signal(n, SIG_DFL);
+
+ /*
+ * These signals are not re-thrown when we resume. This means that
+ * crashing due to (say) SIGPIPE doesn't work the way you'd expect it
+ * to. We work around this by throwing them manually. We don't want
+ * to do this for *all* signals because it'll screw up the address for
+ * faults like SIGSEGV.
+ */
+ switch (n) {
+ case SIGABRT:
+ case SIGFPE:
+ case SIGPIPE:
+ case SIGSTKFLT:
+ (void) tgkill(getpid(), gettid(), n);
+ break;
+ default: // SIGILL, SIGBUS, SIGSEGV
+ break;
+ }
+}
+
+void debugger_init()
+{
+ struct sigaction act;
+ memset(&act, 0, sizeof(act));
+ act.sa_sigaction = debugger_signal_handler;
+ act.sa_flags = SA_RESTART | SA_SIGINFO;
+ sigemptyset(&act.sa_mask);
+
+ sigaction(SIGILL, &act, NULL);
+ sigaction(SIGABRT, &act, NULL);
+ sigaction(SIGBUS, &act, NULL);
+ sigaction(SIGFPE, &act, NULL);
+ sigaction(SIGSEGV, &act, NULL);
+ sigaction(SIGSTKFLT, &act, NULL);
+ sigaction(SIGPIPE, &act, NULL);
+}
--- /dev/null
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#define _GNU_SOURCE
+#include <dlfcn.h>
+#include <pthread.h>
+#include <stdio.h>
+#include "linker.h"
+#include "linker_format.h"
+
+/* This file hijacks the symbols stubbed out in libdl.so. */
+
+#define DL_SUCCESS 0
+#define DL_ERR_CANNOT_LOAD_LIBRARY 1
+#define DL_ERR_INVALID_LIBRARY_HANDLE 2
+#define DL_ERR_BAD_SYMBOL_NAME 3
+#define DL_ERR_SYMBOL_NOT_FOUND 4
+#define DL_ERR_SYMBOL_NOT_GLOBAL 5
+
+static char dl_err_buf[1024];
+static const char *dl_err_str;
+
+static const char *dl_errors[] = {
+ [DL_ERR_CANNOT_LOAD_LIBRARY] = "Cannot load library",
+ [DL_ERR_INVALID_LIBRARY_HANDLE] = "Invalid library handle",
+ [DL_ERR_BAD_SYMBOL_NAME] = "Invalid symbol name",
+ [DL_ERR_SYMBOL_NOT_FOUND] = "Symbol not found",
+ [DL_ERR_SYMBOL_NOT_GLOBAL] = "Symbol is not global",
+};
+
+#define likely(expr) __builtin_expect (expr, 1)
+#define unlikely(expr) __builtin_expect (expr, 0)
+
+static pthread_mutex_t dl_lock = PTHREAD_MUTEX_INITIALIZER;
+
+static void set_dlerror(int err)
+{
+ format_buffer(dl_err_buf, sizeof(dl_err_buf), "%s: %s", dl_errors[err],
+ linker_get_error());
+ dl_err_str = (const char *)&dl_err_buf[0];
+};
+
+void *android_dlopen(const char *filename, int flag)
+{
+ soinfo *ret;
+
+ pthread_mutex_lock(&dl_lock);
+ ret = find_library(filename);
+ if (unlikely(ret == NULL)) {
+ set_dlerror(DL_ERR_CANNOT_LOAD_LIBRARY);
+ } else {
+ call_constructors_recursive(ret);
+ ret->refcount++;
+ }
+ pthread_mutex_unlock(&dl_lock);
+ return ret;
+}
+
+const char *android_dlerror(void)
+{
+ const char *tmp = dl_err_str;
+ dl_err_str = NULL;
+ return (const char *)tmp;
+}
+
+void *android_dlsym(void *handle, const char *symbol)
+{
+ soinfo *found;
+ Elf32_Sym *sym;
+ unsigned bind;
+
+ pthread_mutex_lock(&dl_lock);
+
+ if(unlikely(handle == 0)) {
+ set_dlerror(DL_ERR_INVALID_LIBRARY_HANDLE);
+ goto err;
+ }
+ if(unlikely(symbol == 0)) {
+ set_dlerror(DL_ERR_BAD_SYMBOL_NAME);
+ goto err;
+ }
+
+ if(handle == RTLD_DEFAULT) {
+ sym = lookup(symbol, &found, NULL);
+ } else if(handle == RTLD_NEXT) {
+ void *ret_addr = __builtin_return_address(0);
+ soinfo *si = find_containing_library(ret_addr);
+
+ sym = NULL;
+ if(si && si->next) {
+ sym = lookup(symbol, &found, si->next);
+ }
+ } else {
+ found = (soinfo*)handle;
+ sym = lookup_in_library(found, symbol);
+ }
+
+ if(likely(sym != 0)) {
+ bind = ELF32_ST_BIND(sym->st_info);
+
+ if(likely((bind == STB_GLOBAL) && (sym->st_shndx != 0))) {
+ unsigned ret = sym->st_value + found->base;
+ pthread_mutex_unlock(&dl_lock);
+ return (void*)ret;
+ }
+
+ set_dlerror(DL_ERR_SYMBOL_NOT_GLOBAL);
+ }
+ else
+ set_dlerror(DL_ERR_SYMBOL_NOT_FOUND);
+
+err:
+ pthread_mutex_unlock(&dl_lock);
+ return 0;
+}
+
+int android_dladdr(const void *addr, Dl_info *info)
+{
+ int ret = 0;
+
+ pthread_mutex_lock(&dl_lock);
+
+ /* Determine if this address can be found in any library currently mapped */
+ soinfo *si = find_containing_library(addr);
+
+ if(si) {
+ memset(info, 0, sizeof(Dl_info));
+
+ info->dli_fname = si->name;
+ info->dli_fbase = (void*)si->base;
+
+ /* Determine if any symbol in the library contains the specified address */
+ Elf32_Sym *sym = find_containing_symbol(addr, si);
+
+ if(sym != NULL) {
+ info->dli_sname = si->strtab + sym->st_name;
+ info->dli_saddr = (void*)(si->base + sym->st_value);
+ }
+
+ ret = 1;
+ }
+
+ pthread_mutex_unlock(&dl_lock);
+
+ return ret;
+}
+
+int android_dlclose(void *handle)
+{
+ pthread_mutex_lock(&dl_lock);
+ (void)unload_library((soinfo*)handle);
+ pthread_mutex_unlock(&dl_lock);
+ return 0;
+}
+
+#if defined(ANDROID_ARM_LINKER)
+// 0000000 00011111 111112 22222222 2333333 333344444444445555555
+// 0123456 78901234 567890 12345678 9012345 678901234567890123456
+#define ANDROID_LIBDL_STRTAB \
+ "dlopen\0dlclose\0dlsym\0dlerror\0dladdr\0dl_unwind_find_exidx\0"
+
+_Unwind_Ptr android_dl_unwind_find_exidx(_Unwind_Ptr pc, int *pcount);
+
+#elif defined(ANDROID_X86_LINKER)
+// 0000000 00011111 111112 22222222 2333333 3333444444444455
+// 0123456 78901234 567890 12345678 9012345 6789012345678901
+#define ANDROID_LIBDL_STRTAB \
+ "dlopen\0dlclose\0dlsym\0dlerror\0dladdr\0dl_iterate_phdr\0"
+
+int android_dl_iterate_phdr(int (*cb)(struct dl_phdr_info *info, size_t size, void *data),void *data);
+
+#elif defined(ANDROID_SH_LINKER)
+// 0000000 00011111 111112 22222222 2333333 3333444444444455
+// 0123456 78901234 567890 12345678 9012345 6789012345678901
+#define ANDROID_LIBDL_STRTAB \
+ "dlopen\0dlclose\0dlsym\0dlerror\0dladdr\0dl_iterate_phdr\0"
+
+#else /* !defined(ANDROID_ARM_LINKER) && !defined(ANDROID_X86_LINKER) */
+#error Unsupported architecture. Only ARM and x86 are presently supported.
+#endif
+
+
+static Elf32_Sym libdl_symtab[] = {
+ // total length of libdl_info.strtab, including trailing 0
+ // This is actually the the STH_UNDEF entry. Technically, it's
+ // supposed to have st_name == 0, but instead, it points to an index
+ // in the strtab with a \0 to make iterating through the symtab easier.
+ { st_name: sizeof(ANDROID_LIBDL_STRTAB) - 1,
+ },
+ { st_name: 0, // starting index of the name in libdl_info.strtab
+ st_value: (Elf32_Addr) &android_dlopen,
+ st_info: STB_GLOBAL << 4,
+ st_shndx: 1,
+ },
+ { st_name: 7,
+ st_value: (Elf32_Addr) &android_dlclose,
+ st_info: STB_GLOBAL << 4,
+ st_shndx: 1,
+ },
+ { st_name: 15,
+ st_value: (Elf32_Addr) &android_dlsym,
+ st_info: STB_GLOBAL << 4,
+ st_shndx: 1,
+ },
+ { st_name: 21,
+ st_value: (Elf32_Addr) &android_dlerror,
+ st_info: STB_GLOBAL << 4,
+ st_shndx: 1,
+ },
+ { st_name: 29,
+ st_value: (Elf32_Addr) &android_dladdr,
+ st_info: STB_GLOBAL << 4,
+ st_shndx: 1,
+ },
+#ifdef ANDROID_ARM_LINKER
+ { st_name: 36,
+ st_value: (Elf32_Addr) &android_dl_unwind_find_exidx,
+ st_info: STB_GLOBAL << 4,
+ st_shndx: 1,
+ },
+#elif defined(ANDROID_X86_LINKER)
+ { st_name: 36,
+ st_value: (Elf32_Addr) &android_dl_iterate_phdr,
+ st_info: STB_GLOBAL << 4,
+ st_shndx: 1,
+ },
+#elif defined(ANDROID_SH_LINKER)
+ { st_name: 36,
+ st_value: (Elf32_Addr) &android_dl_iterate_phdr,
+ st_info: STB_GLOBAL << 4,
+ st_shndx: 1,
+ },
+#endif
+};
+
+/* Fake out a hash table with a single bucket.
+ * A search of the hash table will look through
+ * libdl_symtab starting with index [1], then
+ * use libdl_chains to find the next index to
+ * look at. libdl_chains should be set up to
+ * walk through every element in libdl_symtab,
+ * and then end with 0 (sentinel value).
+ *
+ * I.e., libdl_chains should look like
+ * { 0, 2, 3, ... N, 0 } where N is the number
+ * of actual symbols, or nelems(libdl_symtab)-1
+ * (since the first element of libdl_symtab is not
+ * a real symbol).
+ *
+ * (see _elf_lookup())
+ *
+ * Note that adding any new symbols here requires
+ * stubbing them out in libdl.
+ */
+static unsigned libdl_buckets[1] = { 1 };
+static unsigned libdl_chains[7] = { 0, 2, 3, 4, 5, 6, 0 };
+
+soinfo libdl_info = {
+ name: "libdl.so",
+ flags: FLAG_LINKED,
+
+ strtab: ANDROID_LIBDL_STRTAB,
+ symtab: libdl_symtab,
+
+ nbucket: 1,
+ nchain: 7,
+ bucket: libdl_buckets,
+ chain: libdl_chains,
+};
+
--- /dev/null
+/*
+ * Copyright (C) 2008, 2009 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <linux/auxvec.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <dlfcn.h>
+#include <sys/stat.h>
+
+#include <pthread.h>
+
+#include <sys/mman.h>
+
+/* special private C library header - see Android.mk */
+//#include "bionic_tls.h"
+
+#include "linker.h"
+#include "linker_debug.h"
+#include "linker_environ.h"
+#include "linker_format.h"
+
+#define ALLOW_SYMBOLS_FROM_MAIN 1
+#define SO_MAX 128
+
+/* Assume average path length of 64 and max 8 paths */
+#define LDPATH_BUFSIZE 512
+#define LDPATH_MAX 8
+
+#define LDPRELOAD_BUFSIZE 512
+#define LDPRELOAD_MAX 8
+
+/* >>> IMPORTANT NOTE - READ ME BEFORE MODIFYING <<<
+ *
+ * Do NOT use malloc() and friends or pthread_*() code here.
+ * Don't use printf() either; it's caused mysterious memory
+ * corruption in the past.
+ * The linker runs before we bring up libc and it's easiest
+ * to make sure it does not depend on any complex libc features
+ *
+ * open issues / todo:
+ *
+ * - are we doing everything we should for ARM_COPY relocations?
+ * - cleaner error reporting
+ * - after linking, set as much stuff as possible to READONLY
+ * and NOEXEC
+ * - linker hardcodes PAGE_SIZE and PAGE_MASK because the kernel
+ * headers provide versions that are negative...
+ * - allocate space for soinfo structs dynamically instead of
+ * having a hard limit (64)
+*/
+
+
+static int link_image(soinfo *si, unsigned wr_offset);
+
+static int socount = 0;
+static soinfo sopool[SO_MAX];
+static soinfo *freelist = NULL;
+static soinfo *solist = &libdl_info;
+static soinfo *sonext = &libdl_info;
+#if ALLOW_SYMBOLS_FROM_MAIN
+static soinfo *somain; /* main process, always the one after libdl_info */
+#endif
+
+
+static inline int validate_soinfo(soinfo *si)
+{
+ return (si >= sopool && si < sopool + SO_MAX) ||
+ si == &libdl_info;
+}
+
+static char ldpaths_buf[LDPATH_BUFSIZE];
+static const char *ldpaths[LDPATH_MAX + 1];
+
+static char ldpreloads_buf[LDPRELOAD_BUFSIZE];
+static const char *ldpreload_names[LDPRELOAD_MAX + 1];
+
+static soinfo *preloads[LDPRELOAD_MAX + 1];
+
+#if LINKER_DEBUG
+int debug_verbosity = 0;
+int debug_stdout = 0;
+#endif
+
+static int pid;
+
+/* This boolean is set if the program being loaded is setuid */
+static int program_is_setuid;
+
+#if STATS
+struct _link_stats linker_stats;
+#endif
+
+#if COUNT_PAGES
+unsigned bitmask[4096];
+#endif
+
+#ifndef PT_ARM_EXIDX
+#define PT_ARM_EXIDX 0x70000001 /* .ARM.exidx segment */
+#endif
+
+#if 0
+// disable abort() since this is not a linker anymore
+#define HOODLUM(name, ret, ...) \
+ ret name __VA_ARGS__ \
+ { \
+ char errstr[] = "ERROR: " #name " called from the dynamic linker!\n"; \
+ write(2, errstr, sizeof(errstr)); \
+ abort(); \
+ }
+HOODLUM(malloc, void *, (size_t size));
+HOODLUM(free, void, (void *ptr));
+HOODLUM(realloc, void *, (void *ptr, size_t size));
+HOODLUM(calloc, void *, (size_t cnt, size_t size));
+#endif
+
+static char tmp_err_buf[768];
+static char __linker_dl_err_buf[768];
+#define DL_ERR(fmt, x...) \
+ do { \
+ format_buffer(__linker_dl_err_buf, sizeof(__linker_dl_err_buf), \
+ "%s[%d]: " fmt, __func__, __LINE__, ##x); \
+ ERROR(fmt "\n", ##x); \
+ } while(0)
+
+const char *linker_get_error(void)
+{
+ return (const char *)&__linker_dl_err_buf[0];
+}
+
+/*
+ * This function is an empty stub where GDB locates a breakpoint to get notified
+ * about linker activity.
+ */
+extern void __attribute__((noinline)) rtld_db_dlactivity(void);
+
+static struct r_debug _r_debug = {1, NULL, &rtld_db_dlactivity,
+ RT_CONSISTENT, 0};
+static struct link_map *r_debug_tail = 0;
+
+static pthread_mutex_t _r_debug_lock = PTHREAD_MUTEX_INITIALIZER;
+
+static void insert_soinfo_into_debug_map(soinfo * info)
+{
+ struct link_map * map;
+
+ /* Copy the necessary fields into the debug structure.
+ */
+ map = &(info->linkmap);
+ map->l_addr = info->base;
+ map->l_name = (char*) info->name;
+ map->l_ld = (uintptr_t)info->dynamic;
+
+ /* Stick the new library at the end of the list.
+ * gdb tends to care more about libc than it does
+ * about leaf libraries, and ordering it this way
+ * reduces the back-and-forth over the wire.
+ */
+ if (r_debug_tail) {
+ r_debug_tail->l_next = map;
+ map->l_prev = r_debug_tail;
+ map->l_next = 0;
+ } else {
+ _r_debug.r_map = map;
+ map->l_prev = 0;
+ map->l_next = 0;
+ }
+ r_debug_tail = map;
+}
+
+static void remove_soinfo_from_debug_map(soinfo * info)
+{
+ struct link_map * map = &(info->linkmap);
+
+ if (r_debug_tail == map)
+ r_debug_tail = map->l_prev;
+
+ if (map->l_prev) map->l_prev->l_next = map->l_next;
+ if (map->l_next) map->l_next->l_prev = map->l_prev;
+}
+
+void notify_gdb_of_load(soinfo * info)
+{
+ if (info->flags & FLAG_EXE) {
+ // GDB already knows about the main executable
+ return;
+ }
+
+ pthread_mutex_lock(&_r_debug_lock);
+
+ _r_debug.r_state = RT_ADD;
+ rtld_db_dlactivity();
+
+ insert_soinfo_into_debug_map(info);
+
+ _r_debug.r_state = RT_CONSISTENT;
+ rtld_db_dlactivity();
+
+ pthread_mutex_unlock(&_r_debug_lock);
+}
+
+void notify_gdb_of_unload(soinfo * info)
+{
+ if (info->flags & FLAG_EXE) {
+ // GDB already knows about the main executable
+ return;
+ }
+
+ pthread_mutex_lock(&_r_debug_lock);
+
+ _r_debug.r_state = RT_DELETE;
+ rtld_db_dlactivity();
+
+ remove_soinfo_from_debug_map(info);
+
+ _r_debug.r_state = RT_CONSISTENT;
+ rtld_db_dlactivity();
+
+ pthread_mutex_unlock(&_r_debug_lock);
+}
+
+void notify_gdb_of_libraries()
+{
+ pthread_mutex_lock(&_r_debug_lock);
+ _r_debug.r_state = RT_ADD;
+ rtld_db_dlactivity();
+ _r_debug.r_state = RT_CONSISTENT;
+ rtld_db_dlactivity();
+ pthread_mutex_unlock(&_r_debug_lock);
+}
+
+static soinfo *alloc_info(const char *name)
+{
+ soinfo *si;
+
+ if(strlen(name) >= SOINFO_NAME_LEN) {
+ DL_ERR("%5d library name %s too long", pid, name);
+ return NULL;
+ }
+
+ /* The freelist is populated when we call free_info(), which in turn is
+ done only by dlclose(), which is not likely to be used.
+ */
+ if (!freelist) {
+ if(socount == SO_MAX) {
+ DL_ERR("%5d too many libraries when loading %s", pid, name);
+ return NULL;
+ }
+ freelist = sopool + socount++;
+ freelist->next = NULL;
+ }
+
+ si = freelist;
+ freelist = freelist->next;
+
+ /* Make sure we get a clean block of soinfo */
+ memset(si, 0, sizeof(soinfo));
+ strlcpy((char*) si->name, name, sizeof(si->name));
+ sonext->next = si;
+ si->next = NULL;
+ si->refcount = 0;
+ sonext = si;
+
+ TRACE("%5d name %s: allocated soinfo @ %p\n", pid, name, si);
+ return si;
+}
+
+static void free_info(soinfo *si)
+{
+ soinfo *prev = NULL, *trav;
+
+ TRACE("%5d name %s: freeing soinfo @ %p\n", pid, si->name, si);
+
+ for(trav = solist; trav != NULL; trav = trav->next){
+ if (trav == si)
+ break;
+ prev = trav;
+ }
+ if (trav == NULL) {
+ /* si was not ni solist */
+ DL_ERR("%5d name %s is not in solist!", pid, si->name);
+ return;
+ }
+
+ /* prev will never be NULL, because the first entry in solist is
+ always the static libdl_info.
+ */
+ prev->next = si->next;
+ if (si == sonext) sonext = prev;
+ si->next = freelist;
+ freelist = si;
+}
+
+const char *addr_to_name(unsigned addr)
+{
+ soinfo *si;
+
+ for(si = solist; si != 0; si = si->next){
+ if((addr >= si->base) && (addr < (si->base + si->size))) {
+ return si->name;
+ }
+ }
+
+ return "";
+}
+
+/* For a given PC, find the .so that it belongs to.
+ * Returns the base address of the .ARM.exidx section
+ * for that .so, and the number of 8-byte entries
+ * in that section (via *pcount).
+ *
+ * Intended to be called by libc's __gnu_Unwind_Find_exidx().
+ *
+ * This function is exposed via dlfcn.c and libdl.so.
+ */
+#ifdef ANDROID_ARM_LINKER
+_Unwind_Ptr android_dl_unwind_find_exidx(_Unwind_Ptr pc, int *pcount)
+{
+ soinfo *si;
+ unsigned addr = (unsigned)pc;
+
+ for (si = solist; si != 0; si = si->next){
+ if ((addr >= si->base) && (addr < (si->base + si->size))) {
+ *pcount = si->ARM_exidx_count;
+ return (_Unwind_Ptr)(si->base + (unsigned long)si->ARM_exidx);
+ }
+ }
+ *pcount = 0;
+ return NULL;
+}
+#elif defined(ANDROID_X86_LINKER)
+/* Here, we only have to provide a callback to iterate across all the
+ * loaded libraries. gcc_eh does the rest. */
+int
+android_dl_iterate_phdr(int (*cb)(struct dl_phdr_info *info, size_t size, void *data),
+ void *data)
+{
+ soinfo *si;
+ struct dl_phdr_info dl_info;
+ int rv = 0;
+
+ for (si = solist; si != NULL; si = si->next) {
+ dl_info.dlpi_addr = si->linkmap.l_addr;
+ dl_info.dlpi_name = si->linkmap.l_name;
+ dl_info.dlpi_phdr = si->phdr;
+ dl_info.dlpi_phnum = si->phnum;
+ rv = cb(&dl_info, sizeof (struct dl_phdr_info), data);
+ if (rv != 0)
+ break;
+ }
+ return rv;
+}
+#endif
+
+static Elf32_Sym *_elf_lookup(soinfo *si, unsigned hash, const char *name)
+{
+ Elf32_Sym *s;
+ Elf32_Sym *symtab = si->symtab;
+ const char *strtab = si->strtab;
+ unsigned n;
+
+ TRACE_TYPE(LOOKUP, "%5d SEARCH %s in %s@0x%08x %08x %d\n", pid,
+ name, si->name, si->base, hash, hash % si->nbucket);
+ n = hash % si->nbucket;
+
+ for(n = si->bucket[hash % si->nbucket]; n != 0; n = si->chain[n]){
+ s = symtab + n;
+ if(strcmp(strtab + s->st_name, name)) continue;
+
+ /* only concern ourselves with global and weak symbol definitions */
+ switch(ELF32_ST_BIND(s->st_info)){
+ case STB_GLOBAL:
+ case STB_WEAK:
+ /* no section == undefined */
+ if(s->st_shndx == 0) continue;
+
+ TRACE_TYPE(LOOKUP, "%5d FOUND %s in %s (%08x) %d\n", pid,
+ name, si->name, s->st_value, s->st_size);
+ return s;
+ }
+ }
+
+ return NULL;
+}
+
+static unsigned elfhash(const char *_name)
+{
+ const unsigned char *name = (const unsigned char *) _name;
+ unsigned h = 0, g;
+
+ while(*name) {
+ h = (h << 4) + *name++;
+ g = h & 0xf0000000;
+ h ^= g;
+ h ^= g >> 24;
+ }
+ return h;
+}
+
+static Elf32_Sym *
+_do_lookup(soinfo *si, const char *name, unsigned *base)
+{
+ unsigned elf_hash = elfhash(name);
+ Elf32_Sym *s;
+ unsigned *d;
+ soinfo *lsi = si;
+ int i;
+
+ /* Look for symbols in the local scope (the object who is
+ * searching). This happens with C++ templates on i386 for some
+ * reason.
+ *
+ * Notes on weak symbols:
+ * The ELF specs are ambigious about treatment of weak definitions in
+ * dynamic linking. Some systems return the first definition found
+ * and some the first non-weak definition. This is system dependent.
+ * Here we return the first definition found for simplicity. */
+
+ s = _elf_lookup(si, elf_hash, name);
+ if(s != NULL)
+ goto done;
+
+ /* Next, look for it in the preloads list */
+ for(i = 0; preloads[i] != NULL; i++) {
+ lsi = preloads[i];
+ s = _elf_lookup(lsi, elf_hash, name);
+ if(s != NULL)
+ goto done;
+ }
+
+ for(d = si->dynamic; *d; d += 2) {
+ if(d[0] == DT_NEEDED){
+ lsi = (soinfo *)d[1];
+ if (!validate_soinfo(lsi)) {
+ DL_ERR("%5d bad DT_NEEDED pointer in %s",
+ pid, si->name);
+ return NULL;
+ }
+
+ DEBUG("%5d %s: looking up %s in %s\n",
+ pid, si->name, name, lsi->name);
+ s = _elf_lookup(lsi, elf_hash, name);
+ if ((s != NULL) && (s->st_shndx != SHN_UNDEF))
+ goto done;
+ }
+ }
+
+#if ALLOW_SYMBOLS_FROM_MAIN
+ /* If we are resolving relocations while dlopen()ing a library, it's OK for
+ * the library to resolve a symbol that's defined in the executable itself,
+ * although this is rare and is generally a bad idea.
+ */
+ if (somain) {
+ lsi = somain;
+ DEBUG("%5d %s: looking up %s in executable %s\n",
+ pid, si->name, name, lsi->name);
+ s = _elf_lookup(lsi, elf_hash, name);
+ }
+#endif
+
+done:
+ if(s != NULL) {
+ TRACE_TYPE(LOOKUP, "%5d si %s sym %s s->st_value = 0x%08x, "
+ "found in %s, base = 0x%08x\n",
+ pid, si->name, name, s->st_value, lsi->name, lsi->base);
+ *base = lsi->base;
+ return s;
+ }
+
+ return NULL;
+}
+
+/* This is used by dl_sym(). It performs symbol lookup only within the
+ specified soinfo object and not in any of its dependencies.
+ */
+Elf32_Sym *lookup_in_library(soinfo *si, const char *name)
+{
+ return _elf_lookup(si, elfhash(name), name);
+}
+
+/* This is used by dl_sym(). It performs a global symbol lookup.
+ */
+Elf32_Sym *lookup(const char *name, soinfo **found, soinfo *start)
+{
+ unsigned elf_hash = elfhash(name);
+ Elf32_Sym *s = NULL;
+ soinfo *si;
+
+ if(start == NULL) {
+ start = solist;
+ }
+
+ for(si = start; (s == NULL) && (si != NULL); si = si->next)
+ {
+ if(si->flags & FLAG_ERROR)
+ continue;
+ s = _elf_lookup(si, elf_hash, name);
+ if (s != NULL) {
+ *found = si;
+ break;
+ }
+ }
+
+ if(s != NULL) {
+ TRACE_TYPE(LOOKUP, "%5d %s s->st_value = 0x%08x, "
+ "si->base = 0x%08x\n", pid, name, s->st_value, si->base);
+ return s;
+ }
+
+ return NULL;
+}
+
+soinfo *find_containing_library(const void *addr)
+{
+ soinfo *si;
+
+ for(si = solist; si != NULL; si = si->next)
+ {
+ if((unsigned)addr >= si->base && (unsigned)addr - si->base < si->size) {
+ return si;
+ }
+ }
+
+ return NULL;
+}
+
+Elf32_Sym *find_containing_symbol(const void *addr, soinfo *si)
+{
+ unsigned int i;
+ unsigned soaddr = (unsigned)addr - si->base;
+
+ /* Search the library's symbol table for any defined symbol which
+ * contains this address */
+ for(i=0; i<si->nchain; i++) {
+ Elf32_Sym *sym = &si->symtab[i];
+
+ if(sym->st_shndx != SHN_UNDEF &&
+ soaddr >= sym->st_value &&
+ soaddr < sym->st_value + sym->st_size) {
+ return sym;
+ }
+ }
+
+ return NULL;
+}
+
+#if 0
+static void dump(soinfo *si)
+{
+ Elf32_Sym *s = si->symtab;
+ unsigned n;
+
+ for(n = 0; n < si->nchain; n++) {
+ TRACE("%5d %04d> %08x: %02x %04x %08x %08x %s\n", pid, n, s,
+ s->st_info, s->st_shndx, s->st_value, s->st_size,
+ si->strtab + s->st_name);
+ s++;
+ }
+}
+#endif
+
+static const char *sopaths[] = {
+ "/vendor/lib",
+ "/system/lib",
+ 0
+};
+
+static int _open_lib(const char *name)
+{
+ int fd;
+ struct stat filestat;
+
+ if ((stat(name, &filestat) >= 0) && S_ISREG(filestat.st_mode)) {
+ if ((fd = open(name, O_RDONLY)) >= 0)
+ return fd;
+ }
+
+ return -1;
+}
+
+static void parse_library_path(const char *path, char *delim);
+
+static int open_library(const char *name)
+{
+ int fd;
+ char buf[512];
+ const char **path;
+ int n;
+
+ TRACE("[ %5d opening %s ]\n", pid, name);
+
+ if(name == 0) return -1;
+ if(strlen(name) > 256) return -1;
+
+ if ((name[0] == '/') && ((fd = _open_lib(name)) >= 0))
+ return fd;
+
+#ifdef DEFAULT_HYBRIS_LD_LIBRARY_PATH
+ if (getenv("HYBRIS_LD_LIBRARY_PATH") == NULL && *ldpaths == 0)
+ {
+ parse_library_path(DEFAULT_HYBRIS_LD_LIBRARY_PATH, ":");
+ }
+#endif
+ if (getenv("HYBRIS_LD_LIBRARY_PATH") != NULL && *ldpaths == 0)
+ {
+ parse_library_path(getenv("HYBRIS_LD_LIBRARY_PATH"), ":");
+ }
+
+ for (path = ldpaths; *path; path++) {
+ n = format_buffer(buf, sizeof(buf), "%s/%s", *path, name);
+ if (n < 0 || n >= (int)sizeof(buf)) {
+ WARN("Ignoring very long library path: %s/%s\n", *path, name);
+ continue;
+ }
+ if ((fd = _open_lib(buf)) >= 0)
+ return fd;
+ }
+ for (path = sopaths; *path; path++) {
+ n = format_buffer(buf, sizeof(buf), "%s/%s", *path, name);
+ if (n < 0 || n >= (int)sizeof(buf)) {
+ WARN("Ignoring very long library path: %s/%s\n", *path, name);
+ continue;
+ }
+ if ((fd = _open_lib(buf)) >= 0)
+ return fd;
+ }
+
+ return -1;
+}
+
+/* temporary space for holding the first page of the shared lib
+ * which contains the elf header (with the pht). */
+static unsigned char __header[PAGE_SIZE];
+
+typedef struct {
+ long mmap_addr;
+ char tag[4]; /* 'P', 'R', 'E', ' ' */
+} prelink_info_t;
+
+/* Returns the requested base address if the library is prelinked,
+ * and 0 otherwise. */
+static unsigned long
+is_prelinked(int fd, const char *name)
+{
+ off_t sz;
+ prelink_info_t info;
+
+ sz = lseek(fd, -sizeof(prelink_info_t), SEEK_END);
+ if (sz < 0) {
+ DL_ERR("lseek() failed!");
+ return 0;
+ }
+
+ if (read(fd, &info, sizeof(info)) != sizeof(info)) {
+ INFO("Could not read prelink_info_t structure for `%s`\n", name);
+ return 0;
+ }
+
+ if (strncmp(info.tag, "PRE ", 4)) {
+ INFO("`%s` is not a prelinked library\n", name);
+ return 0;
+ }
+
+ return (unsigned long)info.mmap_addr;
+}
+
+/* verify_elf_object
+ * Verifies if the object @ base is a valid ELF object
+ *
+ * Args:
+ *
+ * Returns:
+ * 0 on success
+ * -1 if no valid ELF object is found @ base.
+ */
+static int
+verify_elf_object(void *base, const char *name)
+{
+ Elf32_Ehdr *hdr = (Elf32_Ehdr *) base;
+
+ if (hdr->e_ident[EI_MAG0] != ELFMAG0) return -1;
+ if (hdr->e_ident[EI_MAG1] != ELFMAG1) return -1;
+ if (hdr->e_ident[EI_MAG2] != ELFMAG2) return -1;
+ if (hdr->e_ident[EI_MAG3] != ELFMAG3) return -1;
+
+ /* TODO: Should we verify anything else in the header? */
+#ifdef ANDROID_ARM_LINKER
+ if (hdr->e_machine != EM_ARM) return -1;
+#elif defined(ANDROID_X86_LINKER)
+ if (hdr->e_machine != EM_386) return -1;
+#endif
+ return 0;
+}
+
+
+/* get_lib_extents
+ * Retrieves the base (*base) address where the ELF object should be
+ * mapped and its overall memory size (*total_sz).
+ *
+ * Args:
+ * fd: Opened file descriptor for the library
+ * name: The name of the library
+ * _hdr: Pointer to the header page of the library
+ * total_sz: Total size of the memory that should be allocated for
+ * this library
+ *
+ * Returns:
+ * -1 if there was an error while trying to get the lib extents.
+ * The possible reasons are:
+ * - Could not determine if the library was prelinked.
+ * - The library provided is not a valid ELF object
+ * 0 if the library did not request a specific base offset (normal
+ * for non-prelinked libs)
+ * > 0 if the library requests a specific address to be mapped to.
+ * This indicates a pre-linked library.
+ */
+static unsigned
+get_lib_extents(int fd, const char *name, void *__hdr, unsigned *total_sz)
+{
+ unsigned req_base;
+ unsigned min_vaddr = 0xffffffff;
+ unsigned max_vaddr = 0;
+ unsigned char *_hdr = (unsigned char *)__hdr;
+ Elf32_Ehdr *ehdr = (Elf32_Ehdr *)_hdr;
+ Elf32_Phdr *phdr;
+ int cnt;
+
+ TRACE("[ %5d Computing extents for '%s'. ]\n", pid, name);
+ if (verify_elf_object(_hdr, name) < 0) {
+ DL_ERR("%5d - %s is not a valid ELF object", pid, name);
+ return (unsigned)-1;
+ }
+
+ req_base = (unsigned) is_prelinked(fd, name);
+ if (req_base == (unsigned)-1)
+ return -1;
+ else if (req_base != 0) {
+ TRACE("[ %5d - Prelinked library '%s' requesting base @ 0x%08x ]\n",
+ pid, name, req_base);
+ } else {
+ TRACE("[ %5d - Non-prelinked library '%s' found. ]\n", pid, name);
+ }
+
+ phdr = (Elf32_Phdr *)(_hdr + ehdr->e_phoff);
+
+ /* find the min/max p_vaddrs from all the PT_LOAD segments so we can
+ * get the range. */
+ for (cnt = 0; cnt < ehdr->e_phnum; ++cnt, ++phdr) {
+ if (phdr->p_type == PT_LOAD) {
+ if ((phdr->p_vaddr + phdr->p_memsz) > max_vaddr)
+ max_vaddr = phdr->p_vaddr + phdr->p_memsz;
+ if (phdr->p_vaddr < min_vaddr)
+ min_vaddr = phdr->p_vaddr;
+ }
+ }
+
+ if ((min_vaddr == 0xffffffff) && (max_vaddr == 0)) {
+ DL_ERR("%5d - No loadable segments found in %s.", pid, name);
+ return (unsigned)-1;
+ }
+
+ /* truncate min_vaddr down to page boundary */
+ min_vaddr &= ~PAGE_MASK;
+
+ /* round max_vaddr up to the next page */
+ max_vaddr = (max_vaddr + PAGE_SIZE - 1) & ~PAGE_MASK;
+
+ *total_sz = (max_vaddr - min_vaddr);
+ return (unsigned)req_base;
+}
+
+/* reserve_mem_region
+ *
+ * This function reserves a chunk of memory to be used for mapping in
+ * a prelinked shared library. We reserve the entire memory region here, and
+ * then the rest of the linker will relocate the individual loadable
+ * segments into the correct locations within this memory range.
+ *
+ * Args:
+ * si->base: The requested base of the allocation.
+ * si->size: The size of the allocation.
+ *
+ * Returns:
+ * -1 on failure, and 0 on success. On success, si->base will contain
+ * the virtual address at which the library will be mapped.
+ */
+
+static int reserve_mem_region(soinfo *si)
+{
+ void *base = mmap((void *)si->base, si->size, PROT_NONE,
+ MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ if (base == MAP_FAILED) {
+ DL_ERR("%5d can NOT map (%sprelinked) library '%s' at 0x%08x "
+ "as requested, will try general pool: %d (%s)",
+ pid, (si->base ? "" : "non-"), si->name, si->base,
+ errno, strerror(errno));
+ return -1;
+ } else if (base != (void *)si->base) {
+ DL_ERR("OOPS: %5d %sprelinked library '%s' mapped at 0x%08x, "
+ "not at 0x%08x", pid, (si->base ? "" : "non-"),
+ si->name, (unsigned)base, si->base);
+ munmap(base, si->size);
+ return -1;
+ }
+ return 0;
+}
+
+static int alloc_mem_region(soinfo *si)
+{
+ if (si->base) {
+ /* Attempt to mmap a prelinked library. */
+ return reserve_mem_region(si);
+ }
+
+ /* This is not a prelinked library, so we use the kernel's default
+ allocator.
+ */
+
+ void *base = mmap(NULL, si->size, PROT_NONE,
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ if (base == MAP_FAILED) {
+ DL_ERR("%5d mmap of library '%s' failed: %d (%s)\n",
+ pid, si->name,
+ errno, strerror(errno));
+ goto err;
+ }
+ si->base = (unsigned) base;
+ INFO("%5d mapped library '%s' to %08x via kernel allocator.\n",
+ pid, si->name, si->base);
+ return 0;
+
+err:
+ DL_ERR("OOPS: %5d cannot map library '%s'. no vspace available.",
+ pid, si->name);
+ return -1;
+}
+
+#define MAYBE_MAP_FLAG(x,from,to) (((x) & (from)) ? (to) : 0)
+#define PFLAGS_TO_PROT(x) (MAYBE_MAP_FLAG((x), PF_X, PROT_EXEC) | \
+ MAYBE_MAP_FLAG((x), PF_R, PROT_READ) | \
+ MAYBE_MAP_FLAG((x), PF_W, PROT_WRITE))
+/* load_segments
+ *
+ * This function loads all the loadable (PT_LOAD) segments into memory
+ * at their appropriate memory offsets off the base address.
+ *
+ * Args:
+ * fd: Open file descriptor to the library to load.
+ * header: Pointer to a header page that contains the ELF header.
+ * This is needed since we haven't mapped in the real file yet.
+ * si: ptr to soinfo struct describing the shared object.
+ *
+ * Returns:
+ * 0 on success, -1 on failure.
+ */
+static int
+load_segments(int fd, void *header, soinfo *si)
+{
+ Elf32_Ehdr *ehdr = (Elf32_Ehdr *)header;
+ Elf32_Phdr *phdr = (Elf32_Phdr *)((unsigned char *)header + ehdr->e_phoff);
+ Elf32_Addr base = (Elf32_Addr) si->base;
+ int cnt;
+ unsigned len;
+ Elf32_Addr tmp;
+ unsigned char *pbase;
+ unsigned char *extra_base;
+ unsigned extra_len;
+ unsigned total_sz = 0;
+
+ si->wrprotect_start = 0xffffffff;
+ si->wrprotect_end = 0;
+
+ TRACE("[ %5d - Begin loading segments for '%s' @ 0x%08x ]\n",
+ pid, si->name, (unsigned)si->base);
+ /* Now go through all the PT_LOAD segments and map them into memory
+ * at the appropriate locations. */
+ for (cnt = 0; cnt < ehdr->e_phnum; ++cnt, ++phdr) {
+ if (phdr->p_type == PT_LOAD) {
+ DEBUG_DUMP_PHDR(phdr, "PT_LOAD", pid);
+ /* we want to map in the segment on a page boundary */
+ tmp = base + (phdr->p_vaddr & (~PAGE_MASK));
+ /* add the # of bytes we masked off above to the total length. */
+ len = phdr->p_filesz + (phdr->p_vaddr & PAGE_MASK);
+
+ TRACE("[ %d - Trying to load segment from '%s' @ 0x%08x "
+ "(0x%08x). p_vaddr=0x%08x p_offset=0x%08x ]\n", pid, si->name,
+ (unsigned)tmp, len, phdr->p_vaddr, phdr->p_offset);
+ pbase = mmap((void *)tmp, len, PFLAGS_TO_PROT(phdr->p_flags),
+ MAP_PRIVATE | MAP_FIXED, fd,
+ phdr->p_offset & (~PAGE_MASK));
+ if (pbase == MAP_FAILED) {
+ DL_ERR("%d failed to map segment from '%s' @ 0x%08x (0x%08x). "
+ "p_vaddr=0x%08x p_offset=0x%08x", pid, si->name,
+ (unsigned)tmp, len, phdr->p_vaddr, phdr->p_offset);
+ goto fail;
+ }
+
+ /* If 'len' didn't end on page boundary, and it's a writable
+ * segment, zero-fill the rest. */
+ if ((len & PAGE_MASK) && (phdr->p_flags & PF_W))
+ memset((void *)(pbase + len), 0, PAGE_SIZE - (len & PAGE_MASK));
+
+ /* Check to see if we need to extend the map for this segment to
+ * cover the diff between filesz and memsz (i.e. for bss).
+ *
+ * base _+---------------------+ page boundary
+ * . .
+ * | |
+ * . .
+ * pbase _+---------------------+ page boundary
+ * | |
+ * . .
+ * base + p_vaddr _| |
+ * . \ \ .
+ * . | filesz | .
+ * pbase + len _| / | |
+ * <0 pad> . . .
+ * extra_base _+------------|--------+ page boundary
+ * / . . .
+ * | . . .
+ * | +------------|--------+ page boundary
+ * extra_len-> | | | |
+ * | . | memsz .
+ * | . | .
+ * \ _| / |
+ * . .
+ * | |
+ * _+---------------------+ page boundary
+ */
+ tmp = (Elf32_Addr)(((unsigned)pbase + len + PAGE_SIZE - 1) &
+ (~PAGE_MASK));
+ if (tmp < (base + phdr->p_vaddr + phdr->p_memsz)) {
+ extra_len = base + phdr->p_vaddr + phdr->p_memsz - tmp;
+ TRACE("[ %5d - Need to extend segment from '%s' @ 0x%08x "
+ "(0x%08x) ]\n", pid, si->name, (unsigned)tmp, extra_len);
+ /* map in the extra page(s) as anonymous into the range.
+ * This is probably not necessary as we already mapped in
+ * the entire region previously, but we just want to be
+ * sure. This will also set the right flags on the region
+ * (though we can probably accomplish the same thing with
+ * mprotect).
+ */
+ extra_base = mmap((void *)tmp, extra_len,
+ PFLAGS_TO_PROT(phdr->p_flags),
+ MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS,
+ -1, 0);
+ if (extra_base == MAP_FAILED) {
+ DL_ERR("[ %5d - failed to extend segment from '%s' @ 0x%08x"
+ " (0x%08x) ]", pid, si->name, (unsigned)tmp,
+ extra_len);
+ goto fail;
+ }
+ /* TODO: Check if we need to memset-0 this region.
+ * Anonymous mappings are zero-filled copy-on-writes, so we
+ * shouldn't need to. */
+ TRACE("[ %5d - Segment from '%s' extended @ 0x%08x "
+ "(0x%08x)\n", pid, si->name, (unsigned)extra_base,
+ extra_len);
+ }
+ /* set the len here to show the full extent of the segment we
+ * just loaded, mostly for debugging */
+ len = (((unsigned)base + phdr->p_vaddr + phdr->p_memsz +
+ PAGE_SIZE - 1) & (~PAGE_MASK)) - (unsigned)pbase;
+ TRACE("[ %5d - Successfully loaded segment from '%s' @ 0x%08x "
+ "(0x%08x). p_vaddr=0x%08x p_offset=0x%08x\n", pid, si->name,
+ (unsigned)pbase, len, phdr->p_vaddr, phdr->p_offset);
+ total_sz += len;
+ /* Make the section writable just in case we'll have to write to
+ * it during relocation (i.e. text segment). However, we will
+ * remember what range of addresses should be write protected.
+ *
+ */
+ if (!(phdr->p_flags & PF_W)) {
+ if ((unsigned)pbase < si->wrprotect_start)
+ si->wrprotect_start = (unsigned)pbase;
+ if (((unsigned)pbase + len) > si->wrprotect_end)
+ si->wrprotect_end = (unsigned)pbase + len;
+ mprotect(pbase, len,
+ PFLAGS_TO_PROT(phdr->p_flags) | PROT_WRITE);
+ }
+ } else if (phdr->p_type == PT_DYNAMIC) {
+ DEBUG_DUMP_PHDR(phdr, "PT_DYNAMIC", pid);
+ /* this segment contains the dynamic linking information */
+ si->dynamic = (unsigned *)(base + phdr->p_vaddr);
+ } else if (phdr->p_type == PT_GNU_RELRO) {
+ if ((phdr->p_vaddr >= si->size)
+ || ((phdr->p_vaddr + phdr->p_memsz) > si->size)
+ || ((base + phdr->p_vaddr + phdr->p_memsz) < base)) {
+ DL_ERR("%d invalid GNU_RELRO in '%s' "
+ "p_vaddr=0x%08x p_memsz=0x%08x", pid, si->name,
+ phdr->p_vaddr, phdr->p_memsz);
+ goto fail;
+ }
+ si->gnu_relro_start = (Elf32_Addr) (base + phdr->p_vaddr);
+ si->gnu_relro_len = (unsigned) phdr->p_memsz;
+ } else {
+#ifdef ANDROID_ARM_LINKER
+ if (phdr->p_type == PT_ARM_EXIDX) {
+ DEBUG_DUMP_PHDR(phdr, "PT_ARM_EXIDX", pid);
+ /* exidx entries (used for stack unwinding) are 8 bytes each.
+ */
+ si->ARM_exidx = (unsigned *)phdr->p_vaddr;
+ si->ARM_exidx_count = phdr->p_memsz / 8;
+ }
+#endif
+ }
+
+ }
+
+ /* Sanity check */
+ if (total_sz > si->size) {
+ DL_ERR("%5d - Total length (0x%08x) of mapped segments from '%s' is "
+ "greater than what was allocated (0x%08x). THIS IS BAD!",
+ pid, total_sz, si->name, si->size);
+ goto fail;
+ }
+
+ TRACE("[ %5d - Finish loading segments for '%s' @ 0x%08x. "
+ "Total memory footprint: 0x%08x bytes ]\n", pid, si->name,
+ (unsigned)si->base, si->size);
+ return 0;
+
+fail:
+ /* We can just blindly unmap the entire region even though some things
+ * were mapped in originally with anonymous and others could have been
+ * been mapped in from the file before we failed. The kernel will unmap
+ * all the pages in the range, irrespective of how they got there.
+ */
+ munmap((void *)si->base, si->size);
+ si->flags |= FLAG_ERROR;
+ return -1;
+}
+
+/* TODO: Implement this to take care of the fact that Android ARM
+ * ELF objects shove everything into a single loadable segment that has the
+ * write bit set. wr_offset is then used to set non-(data|bss) pages to be
+ * non-writable.
+ */
+#if 0
+static unsigned
+get_wr_offset(int fd, const char *name, Elf32_Ehdr *ehdr)
+{
+ Elf32_Shdr *shdr_start;
+ Elf32_Shdr *shdr;
+ int shdr_sz = ehdr->e_shnum * sizeof(Elf32_Shdr);
+ int cnt;
+ unsigned wr_offset = 0xffffffff;
+
+ shdr_start = mmap(0, shdr_sz, PROT_READ, MAP_PRIVATE, fd,
+ ehdr->e_shoff & (~PAGE_MASK));
+ if (shdr_start == MAP_FAILED) {
+ WARN("%5d - Could not read section header info from '%s'. Will not "
+ "not be able to determine write-protect offset.\n", pid, name);
+ return (unsigned)-1;
+ }
+
+ for(cnt = 0, shdr = shdr_start; cnt < ehdr->e_shnum; ++cnt, ++shdr) {
+ if ((shdr->sh_type != SHT_NULL) && (shdr->sh_flags & SHF_WRITE) &&
+ (shdr->sh_addr < wr_offset)) {
+ wr_offset = shdr->sh_addr;
+ }
+ }
+
+ munmap(shdr_start, shdr_sz);
+ return wr_offset;
+}
+#endif
+
+static soinfo *
+load_library(const char *name)
+{
+ int fd = open_library(name);
+ int cnt;
+ unsigned ext_sz;
+ unsigned req_base;
+ const char *bname;
+ soinfo *si = NULL;
+ Elf32_Ehdr *hdr;
+
+ if(fd == -1) {
+ DL_ERR("Library '%s' not found", name);
+ return NULL;
+ }
+
+ /* We have to read the ELF header to figure out what to do with this image
+ */
+ if (lseek(fd, 0, SEEK_SET) < 0) {
+ DL_ERR("lseek() failed!");
+ goto fail;
+ }
+
+ if ((cnt = read(fd, &__header[0], PAGE_SIZE)) < 0) {
+ DL_ERR("read() failed!");
+ goto fail;
+ }
+
+ /* Parse the ELF header and get the size of the memory footprint for
+ * the library */
+ req_base = get_lib_extents(fd, name, &__header[0], &ext_sz);
+ if (req_base == (unsigned)-1)
+ goto fail;
+ TRACE("[ %5d - '%s' (%s) wants base=0x%08x sz=0x%08x ]\n", pid, name,
+ (req_base ? "prelinked" : "not pre-linked"), req_base, ext_sz);
+
+ /* Now configure the soinfo struct where we'll store all of our data
+ * for the ELF object. If the loading fails, we waste the entry, but
+ * same thing would happen if we failed during linking. Configuring the
+ * soinfo struct here is a lot more convenient.
+ */
+ bname = strrchr(name, '/');
+ si = alloc_info(bname ? bname + 1 : name);
+ if (si == NULL)
+ goto fail;
+
+ /* Carve out a chunk of memory where we will map in the individual
+ * segments */
+ si->base = req_base;
+ si->size = ext_sz;
+ si->flags = 0;
+ si->entry = 0;
+ si->dynamic = (unsigned *)-1;
+ if (alloc_mem_region(si) < 0)
+ goto fail;
+
+ TRACE("[ %5d allocated memory for %s @ %p (0x%08x) ]\n",
+ pid, name, (void *)si->base, (unsigned) ext_sz);
+
+ /* Now actually load the library's segments into right places in memory */
+ if (load_segments(fd, &__header[0], si) < 0) {
+ goto fail;
+ }
+
+ /* this might not be right. Technically, we don't even need this info
+ * once we go through 'load_segments'. */
+ hdr = (Elf32_Ehdr *)si->base;
+ si->phdr = (Elf32_Phdr *)((unsigned char *)si->base + hdr->e_phoff);
+ si->phnum = hdr->e_phnum;
+ /**/
+
+ close(fd);
+ return si;
+
+fail:
+ if (si) free_info(si);
+ close(fd);
+ return NULL;
+}
+
+static soinfo *
+init_library(soinfo *si)
+{
+ unsigned wr_offset = 0xffffffff;
+
+#if LINKER_DEBUG
+ /* Has to be set via init_library as we don't get called via the
+ * traditional android init library path */
+ const char* env;
+ env = getenv("HYBRIS_LINKER_DEBUG");
+ if (env)
+ debug_verbosity = atoi(env);
+ if (getenv("HYBRIS_LINKER_STDOUT"))
+ debug_stdout = 1;
+
+ INFO("[ HYBRIS: initializing library '%s']\n", si->name);
+#endif
+
+ /* At this point we know that whatever is loaded @ base is a valid ELF
+ * shared library whose segments are properly mapped in. */
+ TRACE("[ %5d init_library base=0x%08x sz=0x%08x name='%s') ]\n",
+ pid, si->base, si->size, si->name);
+
+ if(link_image(si, wr_offset)) {
+ /* We failed to link. However, we can only restore libbase
+ ** if no additional libraries have moved it since we updated it.
+ */
+ munmap((void *)si->base, si->size);
+ return NULL;
+ }
+
+ return si;
+}
+
+soinfo *find_library(const char *name)
+{
+ soinfo *si;
+ const char *bname;
+
+#if ALLOW_SYMBOLS_FROM_MAIN
+ if (name == NULL)
+ return somain;
+#else
+ if (name == NULL)
+ return NULL;
+#endif
+
+ bname = strrchr(name, '/');
+ bname = bname ? bname + 1 : name;
+
+ for(si = solist; si != 0; si = si->next){
+ if(!strcmp(bname, si->name)) {
+ if(si->flags & FLAG_ERROR) {
+ DL_ERR("%5d '%s' failed to load previously", pid, bname);
+ return NULL;
+ }
+ if(si->flags & FLAG_LINKED) return si;
+ DL_ERR("OOPS: %5d recursive link to '%s'", pid, si->name);
+ return NULL;
+ }
+ }
+
+ TRACE("[ %5d '%s' has not been loaded yet. Locating...]\n", pid, name);
+ si = load_library(name);
+ if(si == NULL)
+ return NULL;
+ return init_library(si);
+}
+
+/* TODO:
+ * notify gdb of unload
+ * for non-prelinked libraries, find a way to decrement libbase
+ */
+static void call_destructors(soinfo *si);
+unsigned unload_library(soinfo *si)
+{
+ unsigned *d;
+ if (si->refcount == 1) {
+ TRACE("%5d unloading '%s'\n", pid, si->name);
+ call_destructors(si);
+
+ /*
+ * Make sure that we undo the PT_GNU_RELRO protections we added
+ * in link_image. This is needed to undo the DT_NEEDED hack below.
+ */
+ if ((si->gnu_relro_start != 0) && (si->gnu_relro_len != 0)) {
+ Elf32_Addr start = (si->gnu_relro_start & ~PAGE_MASK);
+ unsigned len = (si->gnu_relro_start - start) + si->gnu_relro_len;
+ if (mprotect((void *) start, len, PROT_READ | PROT_WRITE) < 0)
+ DL_ERR("%5d %s: could not undo GNU_RELRO protections. "
+ "Expect a crash soon. errno=%d (%s)",
+ pid, si->name, errno, strerror(errno));
+
+ }
+
+ for(d = si->dynamic; *d; d += 2) {
+ if(d[0] == DT_NEEDED){
+ soinfo *lsi = (soinfo *)d[1];
+
+ // The next line will segfault if the we don't undo the
+ // PT_GNU_RELRO protections (see comments above and in
+ // link_image().
+ d[1] = 0;
+
+ if (validate_soinfo(lsi)) {
+ TRACE("%5d %s needs to unload %s\n", pid,
+ si->name, lsi->name);
+ unload_library(lsi);
+ }
+ else
+ DL_ERR("%5d %s: could not unload dependent library",
+ pid, si->name);
+ }
+ }
+
+ munmap((char *)si->base, si->size);
+ notify_gdb_of_unload(si);
+ free_info(si);
+ si->refcount = 0;
+ }
+ else {
+ si->refcount--;
+ INFO("%5d not unloading '%s', decrementing refcount to %d\n",
+ pid, si->name, si->refcount);
+ }
+ return si->refcount;
+}
+
+/* TODO: don't use unsigned for addrs below. It works, but is not
+ * ideal. They should probably be either uint32_t, Elf32_Addr, or unsigned
+ * long.
+ */
+static int reloc_library(soinfo *si, Elf32_Rel *rel, unsigned count)
+{
+ Elf32_Sym *symtab = si->symtab;
+ const char *strtab = si->strtab;
+ Elf32_Sym *s;
+ unsigned base;
+ Elf32_Rel *start = rel;
+ unsigned idx;
+
+ for (idx = 0; idx < count; ++idx) {
+ unsigned type = ELF32_R_TYPE(rel->r_info);
+ unsigned sym = ELF32_R_SYM(rel->r_info);
+ unsigned reloc = (unsigned)(rel->r_offset + si->base);
+ unsigned sym_addr = 0;
+ char *sym_name = NULL;
+
+ DEBUG("%5d Processing '%s' relocation at index %d\n", pid,
+ si->name, idx);
+ if(sym != 0) {
+ sym_name = (char *)(strtab + symtab[sym].st_name);
+ INFO("HYBRIS: '%s' checking hooks for sym '%s'\n", si->name, sym_name);
+ sym_addr = get_hooked_symbol(sym_name);
+ if (sym_addr != NULL) {
+ INFO("HYBRIS: '%s' hooked symbol %s to %x\n", si->name,
+ sym_name, sym_addr);
+ } else {
+ s = _do_lookup(si, sym_name, &base);
+ }
+ if(sym_addr == NULL)
+ if(s == NULL) {
+ /* We only allow an undefined symbol if this is a weak
+ reference.. */
+ s = &symtab[sym];
+ if (ELF32_ST_BIND(s->st_info) != STB_WEAK) {
+ DL_ERR("%5d cannot locate '%s'...\n", pid, sym_name);
+ return -1;
+ }
+
+ /* IHI0044C AAELF 4.5.1.1:
+
+ Libraries are not searched to resolve weak references.
+ It is not an error for a weak reference to remain
+ unsatisfied.
+
+ During linking, the value of an undefined weak reference is:
+ - Zero if the relocation type is absolute
+ - The address of the place if the relocation is pc-relative
+ - The address of nominial base address if the relocation
+ type is base-relative.
+ */
+
+ switch (type) {
+#if defined(ANDROID_ARM_LINKER)
+ case R_ARM_JUMP_SLOT:
+ case R_ARM_GLOB_DAT:
+ case R_ARM_ABS32:
+ case R_ARM_RELATIVE: /* Don't care. */
+ case R_ARM_NONE: /* Don't care. */
+#elif defined(ANDROID_X86_LINKER)
+ case R_386_JUMP_SLOT:
+ case R_386_GLOB_DAT:
+ case R_386_32:
+ case R_386_RELATIVE: /* Dont' care. */
+#endif /* ANDROID_*_LINKER */
+ /* sym_addr was initialized to be zero above or relocation
+ code below does not care about value of sym_addr.
+ No need to do anything. */
+ break;
+
+#if defined(ANDROID_X86_LINKER)
+ case R_386_PC32:
+ sym_addr = reloc;
+ break;
+#endif /* ANDROID_X86_LINKER */
+
+#if defined(ANDROID_ARM_LINKER)
+ case R_ARM_COPY:
+ /* Fall through. Can't really copy if weak symbol is
+ not found in run-time. */
+#endif /* ANDROID_ARM_LINKER */
+ default:
+ DL_ERR("%5d unknown weak reloc type %d @ %p (%d)\n",
+ pid, type, rel, (int) (rel - start));
+ return -1;
+ }
+ } else {
+ /* We got a definition. */
+#if 0
+ if((base == 0) && (si->base != 0)){
+ /* linking from libraries to main image is bad */
+ DL_ERR("%5d cannot locate '%s'...",
+ pid, strtab + symtab[sym].st_name);
+ return -1;
+ }
+#endif
+ sym_addr = (unsigned)(s->st_value + base);
+ }
+ COUNT_RELOC(RELOC_SYMBOL);
+ } else {
+ s = NULL;
+ }
+
+/* TODO: This is ugly. Split up the relocations by arch into
+ * different files.
+ */
+ switch(type){
+#if defined(ANDROID_ARM_LINKER)
+ case R_ARM_JUMP_SLOT:
+ COUNT_RELOC(RELOC_ABSOLUTE);
+ MARK(rel->r_offset);
+ TRACE_TYPE(RELO, "%5d RELO JMP_SLOT %08x <- %08x %s\n", pid,
+ reloc, sym_addr, sym_name);
+ *((unsigned*)reloc) = sym_addr;
+ break;
+ case R_ARM_GLOB_DAT:
+ COUNT_RELOC(RELOC_ABSOLUTE);
+ MARK(rel->r_offset);
+ TRACE_TYPE(RELO, "%5d RELO GLOB_DAT %08x <- %08x %s\n", pid,
+ reloc, sym_addr, sym_name);
+ *((unsigned*)reloc) = sym_addr;
+ break;
+ case R_ARM_ABS32:
+ COUNT_RELOC(RELOC_ABSOLUTE);
+ MARK(rel->r_offset);
+ TRACE_TYPE(RELO, "%5d RELO ABS %08x <- %08x %s\n", pid,
+ reloc, sym_addr, sym_name);
+ *((unsigned*)reloc) += sym_addr;
+ break;
+ case R_ARM_REL32:
+ COUNT_RELOC(RELOC_RELATIVE);
+ MARK(rel->r_offset);
+ TRACE_TYPE(RELO, "%5d RELO REL32 %08x <- %08x - %08x %s\n", pid,
+ reloc, sym_addr, rel->r_offset, sym_name);
+ *((unsigned*)reloc) += sym_addr - rel->r_offset;
+ break;
+#elif defined(ANDROID_X86_LINKER)
+ case R_386_JUMP_SLOT:
+ COUNT_RELOC(RELOC_ABSOLUTE);
+ MARK(rel->r_offset);
+ TRACE_TYPE(RELO, "%5d RELO JMP_SLOT %08x <- %08x %s\n", pid,
+ reloc, sym_addr, sym_name);
+ *((unsigned*)reloc) = sym_addr;
+ break;
+ case R_386_GLOB_DAT:
+ COUNT_RELOC(RELOC_ABSOLUTE);
+ MARK(rel->r_offset);
+ TRACE_TYPE(RELO, "%5d RELO GLOB_DAT %08x <- %08x %s\n", pid,
+ reloc, sym_addr, sym_name);
+ *((unsigned*)reloc) = sym_addr;
+ break;
+#endif /* ANDROID_*_LINKER */
+
+#if defined(ANDROID_ARM_LINKER)
+ case R_ARM_RELATIVE:
+#elif defined(ANDROID_X86_LINKER)
+ case R_386_RELATIVE:
+#endif /* ANDROID_*_LINKER */
+ COUNT_RELOC(RELOC_RELATIVE);
+ MARK(rel->r_offset);
+ if(sym){
+ DL_ERR("%5d odd RELATIVE form...", pid);
+ return -1;
+ }
+ TRACE_TYPE(RELO, "%5d RELO RELATIVE %08x <- +%08x\n", pid,
+ reloc, si->base);
+ *((unsigned*)reloc) += si->base;
+ break;
+
+#if defined(ANDROID_X86_LINKER)
+ case R_386_32:
+ COUNT_RELOC(RELOC_RELATIVE);
+ MARK(rel->r_offset);
+
+ TRACE_TYPE(RELO, "%5d RELO R_386_32 %08x <- +%08x %s\n", pid,
+ reloc, sym_addr, sym_name);
+ *((unsigned *)reloc) += (unsigned)sym_addr;
+ break;
+
+ case R_386_PC32:
+ COUNT_RELOC(RELOC_RELATIVE);
+ MARK(rel->r_offset);
+ TRACE_TYPE(RELO, "%5d RELO R_386_PC32 %08x <- "
+ "+%08x (%08x - %08x) %s\n", pid, reloc,
+ (sym_addr - reloc), sym_addr, reloc, sym_name);
+ *((unsigned *)reloc) += (unsigned)(sym_addr - reloc);
+ break;
+#endif /* ANDROID_X86_LINKER */
+
+#ifdef ANDROID_ARM_LINKER
+ case R_ARM_COPY:
+ COUNT_RELOC(RELOC_COPY);
+ MARK(rel->r_offset);
+ TRACE_TYPE(RELO, "%5d RELO %08x <- %d @ %08x %s\n", pid,
+ reloc, s->st_size, sym_addr, sym_name);
+ memcpy((void*)reloc, (void*)sym_addr, s->st_size);
+ break;
+ case R_ARM_NONE:
+ break;
+#endif /* ANDROID_ARM_LINKER */
+
+ default:
+ DL_ERR("%5d unknown reloc type %d @ %p (%d)",
+ pid, type, rel, (int) (rel - start));
+ return -1;
+ }
+ rel++;
+ }
+ return 0;
+}
+
+/* Please read the "Initialization and Termination functions" functions.
+ * of the linker design note in bionic/linker/README.TXT to understand
+ * what the following code is doing.
+ *
+ * The important things to remember are:
+ *
+ * DT_PREINIT_ARRAY must be called first for executables, and should
+ * not appear in shared libraries.
+ *
+ * DT_INIT should be called before DT_INIT_ARRAY if both are present
+ *
+ * DT_FINI should be called after DT_FINI_ARRAY if both are present
+ *
+ * DT_FINI_ARRAY must be parsed in reverse order.
+ */
+
+static void call_array(unsigned *ctor, int count, int reverse)
+{
+ int n, inc = 1;
+
+ if (reverse) {
+ ctor += (count-1);
+ inc = -1;
+ }
+
+ for(n = count; n > 0; n--) {
+ TRACE("[ %5d Looking at %s *0x%08x == 0x%08x ]\n", pid,
+ reverse ? "dtor" : "ctor",
+ (unsigned)ctor, (unsigned)*ctor);
+ void (*func)() = (void (*)()) *ctor;
+ ctor += inc;
+ if(((int) func == 0) || ((int) func == -1)) continue;
+ TRACE("[ %5d Calling func @ 0x%08x ]\n", pid, (unsigned)func);
+ func();
+ }
+}
+
+void call_constructors_recursive(soinfo *si)
+{
+ if (si->constructors_called)
+ return;
+ if (strcmp(si->name,"libc.so") == 0) {
+ INFO("HYBRIS: =============> Skipping libc.so\n");
+ return;
+ }
+
+ // Set this before actually calling the constructors, otherwise it doesn't
+ // protect against recursive constructor calls. One simple example of
+ // constructor recursion is the libc debug malloc, which is implemented in
+ // libc_malloc_debug_leak.so:
+ // 1. The program depends on libc, so libc's constructor is called here.
+ // 2. The libc constructor calls dlopen() to load libc_malloc_debug_leak.so.
+ // 3. dlopen() calls call_constructors_recursive() with the newly created
+ // soinfo for libc_malloc_debug_leak.so.
+ // 4. The debug so depends on libc, so call_constructors_recursive() is
+ // called again with the libc soinfo. If it doesn't trigger the early-
+ // out above, the libc constructor will be called again (recursively!).
+ si->constructors_called = 1;
+
+ if (si->flags & FLAG_EXE) {
+ TRACE("[ %5d Calling preinit_array @ 0x%08x [%d] for '%s' ]\n",
+ pid, (unsigned)si->preinit_array, si->preinit_array_count,
+ si->name);
+ call_array(si->preinit_array, si->preinit_array_count, 0);
+ TRACE("[ %5d Done calling preinit_array for '%s' ]\n", pid, si->name);
+ } else {
+ if (si->preinit_array) {
+ DL_ERR("%5d Shared library '%s' has a preinit_array table @ 0x%08x."
+ " This is INVALID.", pid, si->name,
+ (unsigned)si->preinit_array);
+ }
+ }
+
+ if (si->dynamic) {
+ unsigned *d;
+ for(d = si->dynamic; *d; d += 2) {
+ if(d[0] == DT_NEEDED){
+ soinfo* lsi = (soinfo *)d[1];
+ if (!validate_soinfo(lsi)) {
+ DL_ERR("%5d bad DT_NEEDED pointer in %s",
+ pid, si->name);
+ } else {
+ call_constructors_recursive(lsi);
+ }
+ }
+ }
+ }
+
+ if (si->init_func) {
+ TRACE("[ %5d Calling init_func @ 0x%08x for '%s' ]\n", pid,
+ (unsigned)si->init_func, si->name);
+ si->init_func();
+ TRACE("[ %5d Done calling init_func for '%s' ]\n", pid, si->name);
+ }
+
+ if (si->init_array) {
+ TRACE("[ %5d Calling init_array @ 0x%08x [%d] for '%s' ]\n", pid,
+ (unsigned)si->init_array, si->init_array_count, si->name);
+ call_array(si->init_array, si->init_array_count, 0);
+ TRACE("[ %5d Done calling init_array for '%s' ]\n", pid, si->name);
+ }
+
+}
+
+static void call_destructors(soinfo *si)
+{
+ if (si->fini_array) {
+ TRACE("[ %5d Calling fini_array @ 0x%08x [%d] for '%s' ]\n", pid,
+ (unsigned)si->fini_array, si->fini_array_count, si->name);
+ call_array(si->fini_array, si->fini_array_count, 1);
+ TRACE("[ %5d Done calling fini_array for '%s' ]\n", pid, si->name);
+ }
+
+ if (si->fini_func) {
+ TRACE("[ %5d Calling fini_func @ 0x%08x for '%s' ]\n", pid,
+ (unsigned)si->fini_func, si->name);
+ si->fini_func();
+ TRACE("[ %5d Done calling fini_func for '%s' ]\n", pid, si->name);
+ }
+}
+
+/* Force any of the closed stdin, stdout and stderr to be associated with
+ /dev/null. */
+static int nullify_closed_stdio (void)
+{
+ int dev_null, i, status;
+ int return_value = 0;
+
+ dev_null = open("/dev/null", O_RDWR);
+ if (dev_null < 0) {
+ DL_ERR("Cannot open /dev/null.");
+ return -1;
+ }
+ TRACE("[ %5d Opened /dev/null file-descriptor=%d]\n", pid, dev_null);
+
+ /* If any of the stdio file descriptors is valid and not associated
+ with /dev/null, dup /dev/null to it. */
+ for (i = 0; i < 3; i++) {
+ /* If it is /dev/null already, we are done. */
+ if (i == dev_null)
+ continue;
+
+ TRACE("[ %5d Nullifying stdio file descriptor %d]\n", pid, i);
+ /* The man page of fcntl does not say that fcntl(..,F_GETFL)
+ can be interrupted but we do this just to be safe. */
+ do {
+ status = fcntl(i, F_GETFL);
+ } while (status < 0 && errno == EINTR);
+
+ /* If file is openned, we are good. */
+ if (status >= 0)
+ continue;
+
+ /* The only error we allow is that the file descriptor does not
+ exist, in which case we dup /dev/null to it. */
+ if (errno != EBADF) {
+ DL_ERR("nullify_stdio: unhandled error %s", strerror(errno));
+ return_value = -1;
+ continue;
+ }
+
+ /* Try dupping /dev/null to this stdio file descriptor and
+ repeat if there is a signal. Note that any errors in closing
+ the stdio descriptor are lost. */
+ do {
+ status = dup2(dev_null, i);
+ } while (status < 0 && errno == EINTR);
+
+ if (status < 0) {
+ DL_ERR("nullify_stdio: dup2 error %s", strerror(errno));
+ return_value = -1;
+ continue;
+ }
+ }
+
+ /* If /dev/null is not one of the stdio file descriptors, close it. */
+ if (dev_null > 2) {
+ TRACE("[ %5d Closing /dev/null file-descriptor=%d]\n", pid, dev_null);
+ do {
+ status = close(dev_null);
+ } while (status < 0 && errno == EINTR);
+
+ if (status < 0) {
+ DL_ERR("nullify_stdio: close error %s", strerror(errno));
+ return_value = -1;
+ }
+ }
+
+ close(dev_null);
+ return return_value;
+}
+
+static int link_image(soinfo *si, unsigned wr_offset)
+{
+ unsigned *d;
+ Elf32_Phdr *phdr = si->phdr;
+ int phnum = si->phnum;
+
+ INFO("[ %5d linking %s ]\n", pid, si->name);
+ DEBUG("%5d si->base = 0x%08x si->flags = 0x%08x\n", pid,
+ si->base, si->flags);
+
+ if (si->flags & (FLAG_EXE | FLAG_LINKER)) {
+ /* Locate the needed program segments (DYNAMIC/ARM_EXIDX) for
+ * linkage info if this is the executable or the linker itself.
+ * If this was a dynamic lib, that would have been done at load time.
+ *
+ * TODO: It's unfortunate that small pieces of this are
+ * repeated from the load_library routine. Refactor this just
+ * slightly to reuse these bits.
+ */
+ si->size = 0;
+ for(; phnum > 0; --phnum, ++phdr) {
+#ifdef ANDROID_ARM_LINKER
+ if(phdr->p_type == PT_ARM_EXIDX) {
+ /* exidx entries (used for stack unwinding) are 8 bytes each.
+ */
+ si->ARM_exidx = (unsigned *)phdr->p_vaddr;
+ si->ARM_exidx_count = phdr->p_memsz / 8;
+ }
+#endif
+ if (phdr->p_type == PT_LOAD) {
+ /* For the executable, we use the si->size field only in
+ dl_unwind_find_exidx(), so the meaning of si->size
+ is not the size of the executable; it is the distance
+ between the load location of the executable and the last
+ address of the loadable part of the executable.
+ We use the range [si->base, si->base + si->size) to
+ determine whether a PC value falls within the executable
+ section. Of course, if a value is between si->base and
+ (si->base + phdr->p_vaddr), it's not in the executable
+ section, but a) we shouldn't be asking for such a value
+ anyway, and b) if we have to provide an EXIDX for such a
+ value, then the executable's EXIDX is probably the better
+ choice.
+ */
+ DEBUG_DUMP_PHDR(phdr, "PT_LOAD", pid);
+ if (phdr->p_vaddr + phdr->p_memsz > si->size)
+ si->size = phdr->p_vaddr + phdr->p_memsz;
+ /* try to remember what range of addresses should be write
+ * protected */
+ if (!(phdr->p_flags & PF_W)) {
+ unsigned _end;
+
+ if (si->base + phdr->p_vaddr < si->wrprotect_start)
+ si->wrprotect_start = si->base + phdr->p_vaddr;
+ _end = (((si->base + phdr->p_vaddr + phdr->p_memsz + PAGE_SIZE - 1) &
+ (~PAGE_MASK)));
+ if (_end > si->wrprotect_end)
+ si->wrprotect_end = _end;
+ /* Make the section writable just in case we'll have to
+ * write to it during relocation (i.e. text segment).
+ * However, we will remember what range of addresses
+ * should be write protected.
+ */
+ mprotect((void *) (si->base + phdr->p_vaddr),
+ phdr->p_memsz,
+ PFLAGS_TO_PROT(phdr->p_flags) | PROT_WRITE);
+ }
+ } else if (phdr->p_type == PT_DYNAMIC) {
+ if (si->dynamic != (unsigned *)-1) {
+ DL_ERR("%5d multiple PT_DYNAMIC segments found in '%s'. "
+ "Segment at 0x%08x, previously one found at 0x%08x",
+ pid, si->name, si->base + phdr->p_vaddr,
+ (unsigned)si->dynamic);
+ goto fail;
+ }
+ DEBUG_DUMP_PHDR(phdr, "PT_DYNAMIC", pid);
+ si->dynamic = (unsigned *) (si->base + phdr->p_vaddr);
+ } else if (phdr->p_type == PT_GNU_RELRO) {
+ if ((phdr->p_vaddr >= si->size)
+ || ((phdr->p_vaddr + phdr->p_memsz) > si->size)
+ || ((si->base + phdr->p_vaddr + phdr->p_memsz) < si->base)) {
+ DL_ERR("%d invalid GNU_RELRO in '%s' "
+ "p_vaddr=0x%08x p_memsz=0x%08x", pid, si->name,
+ phdr->p_vaddr, phdr->p_memsz);
+ goto fail;
+ }
+ si->gnu_relro_start = (Elf32_Addr) (si->base + phdr->p_vaddr);
+ si->gnu_relro_len = (unsigned) phdr->p_memsz;
+ }
+ }
+ }
+
+ if (si->dynamic == (unsigned *)-1) {
+ DL_ERR("%5d missing PT_DYNAMIC?!", pid);
+ goto fail;
+ }
+
+ DEBUG("%5d dynamic = %p\n", pid, si->dynamic);
+
+ /* extract useful information from dynamic section */
+ for(d = si->dynamic; *d; d++){
+ DEBUG("%5d d = %p, d[0] = 0x%08x d[1] = 0x%08x\n", pid, d, d[0], d[1]);
+ switch(*d++){
+ case DT_HASH:
+ si->nbucket = ((unsigned *) (si->base + *d))[0];
+ si->nchain = ((unsigned *) (si->base + *d))[1];
+ si->bucket = (unsigned *) (si->base + *d + 8);
+ si->chain = (unsigned *) (si->base + *d + 8 + si->nbucket * 4);
+ break;
+ case DT_STRTAB:
+ si->strtab = (const char *) (si->base + *d);
+ break;
+ case DT_SYMTAB:
+ si->symtab = (Elf32_Sym *) (si->base + *d);
+ break;
+ case DT_PLTREL:
+ if(*d != DT_REL) {
+ DL_ERR("DT_RELA not supported");
+ goto fail;
+ }
+ break;
+ case DT_JMPREL:
+ si->plt_rel = (Elf32_Rel*) (si->base + *d);
+ break;
+ case DT_PLTRELSZ:
+ si->plt_rel_count = *d / 8;
+ break;
+ case DT_REL:
+ si->rel = (Elf32_Rel*) (si->base + *d);
+ break;
+ case DT_RELSZ:
+ si->rel_count = *d / 8;
+ break;
+ case DT_PLTGOT:
+ /* Save this in case we decide to do lazy binding. We don't yet. */
+ si->plt_got = (unsigned *)(si->base + *d);
+ break;
+ case DT_DEBUG:
+ // Set the DT_DEBUG entry to the addres of _r_debug for GDB
+ *d = (int) &_r_debug;
+ break;
+ case DT_RELA:
+ DL_ERR("%5d DT_RELA not supported", pid);
+ goto fail;
+ case DT_INIT:
+ si->init_func = (void (*)(void))(si->base + *d);
+ DEBUG("%5d %s constructors (init func) found at %p\n",
+ pid, si->name, si->init_func);
+ break;
+ case DT_FINI:
+ si->fini_func = (void (*)(void))(si->base + *d);
+ DEBUG("%5d %s destructors (fini func) found at %p\n",
+ pid, si->name, si->fini_func);
+ break;
+ case DT_INIT_ARRAY:
+ si->init_array = (unsigned *)(si->base + *d);
+ DEBUG("%5d %s constructors (init_array) found at %p\n",
+ pid, si->name, si->init_array);
+ break;
+ case DT_INIT_ARRAYSZ:
+ si->init_array_count = ((unsigned)*d) / sizeof(Elf32_Addr);
+ break;
+ case DT_FINI_ARRAY:
+ si->fini_array = (unsigned *)(si->base + *d);
+ DEBUG("%5d %s destructors (fini_array) found at %p\n",
+ pid, si->name, si->fini_array);
+ break;
+ case DT_FINI_ARRAYSZ:
+ si->fini_array_count = ((unsigned)*d) / sizeof(Elf32_Addr);
+ break;
+ case DT_PREINIT_ARRAY:
+ si->preinit_array = (unsigned *)(si->base + *d);
+ DEBUG("%5d %s constructors (preinit_array) found at %p\n",
+ pid, si->name, si->preinit_array);
+ break;
+ case DT_PREINIT_ARRAYSZ:
+ si->preinit_array_count = ((unsigned)*d) / sizeof(Elf32_Addr);
+ break;
+ case DT_TEXTREL:
+ /* TODO: make use of this. */
+ /* this means that we might have to write into where the text
+ * segment was loaded during relocation... Do something with
+ * it.
+ */
+ DEBUG("%5d Text segment should be writable during relocation.\n",
+ pid);
+ break;
+ }
+ }
+
+ DEBUG("%5d si->base = 0x%08x, si->strtab = %p, si->symtab = %p\n",
+ pid, si->base, si->strtab, si->symtab);
+
+ if((si->strtab == 0) || (si->symtab == 0)) {
+ DL_ERR("%5d missing essential tables", pid);
+ goto fail;
+ }
+
+ /* if this is the main executable, then load all of the preloads now */
+ if(si->flags & FLAG_EXE) {
+ int i;
+ memset(preloads, 0, sizeof(preloads));
+ for(i = 0; ldpreload_names[i] != NULL; i++) {
+ soinfo *lsi = find_library(ldpreload_names[i]);
+ if(lsi == 0) {
+ strlcpy(tmp_err_buf, linker_get_error(), sizeof(tmp_err_buf));
+ DL_ERR("%5d could not load needed library '%s' for '%s' (%s)",
+ pid, ldpreload_names[i], si->name, tmp_err_buf);
+ goto fail;
+ }
+ lsi->refcount++;
+ preloads[i] = lsi;
+ }
+ }
+
+ for(d = si->dynamic; *d; d += 2) {
+ if(d[0] == DT_NEEDED){
+ DEBUG("%5d %s needs %s\n", pid, si->name, si->strtab + d[1]);
+ soinfo *lsi = find_library(si->strtab + d[1]);
+ if(lsi == 0) {
+ strlcpy(tmp_err_buf, linker_get_error(), sizeof(tmp_err_buf));
+ DL_ERR("%5d could not load needed library '%s' for '%s' (%s)",
+ pid, si->strtab + d[1], si->name, tmp_err_buf);
+ goto fail;
+ }
+ /* Save the soinfo of the loaded DT_NEEDED library in the payload
+ of the DT_NEEDED entry itself, so that we can retrieve the
+ soinfo directly later from the dynamic segment. This is a hack,
+ but it allows us to map from DT_NEEDED to soinfo efficiently
+ later on when we resolve relocations, trying to look up a symbol
+ with dlsym().
+ */
+ d[1] = (unsigned)lsi;
+ lsi->refcount++;
+ }
+ }
+
+ if(si->plt_rel) {
+ DEBUG("[ %5d relocating %s plt ]\n", pid, si->name );
+ if(reloc_library(si, si->plt_rel, si->plt_rel_count))
+ goto fail;
+ }
+ if(si->rel) {
+ DEBUG("[ %5d relocating %s ]\n", pid, si->name );
+ if(reloc_library(si, si->rel, si->rel_count))
+ goto fail;
+ }
+
+ si->flags |= FLAG_LINKED;
+ DEBUG("[ %5d finished linking %s ]\n", pid, si->name);
+
+#if 0
+ /* This is the way that the old dynamic linker did protection of
+ * non-writable areas. It would scan section headers and find where
+ * .text ended (rather where .data/.bss began) and assume that this is
+ * the upper range of the non-writable area. This is too coarse,
+ * and is kept here for reference until we fully move away from single
+ * segment elf objects. See the code in get_wr_offset (also #if'd 0)
+ * that made this possible.
+ */
+ if(wr_offset < 0xffffffff){
+ mprotect((void*) si->base, wr_offset, PROT_READ | PROT_EXEC);
+ }
+#else
+ /* TODO: Verify that this does the right thing in all cases, as it
+ * presently probably does not. It is possible that an ELF image will
+ * come with multiple read-only segments. What we ought to do is scan
+ * the program headers again and mprotect all the read-only segments.
+ * To prevent re-scanning the program header, we would have to build a
+ * list of loadable segments in si, and then scan that instead. */
+ if (si->wrprotect_start != 0xffffffff && si->wrprotect_end != 0) {
+ mprotect((void *)si->wrprotect_start,
+ si->wrprotect_end - si->wrprotect_start,
+ PROT_READ | PROT_EXEC);
+ }
+#endif
+
+ if (si->gnu_relro_start != 0 && si->gnu_relro_len != 0) {
+ Elf32_Addr start = (si->gnu_relro_start & ~PAGE_MASK);
+ unsigned len = (si->gnu_relro_start - start) + si->gnu_relro_len;
+ if (mprotect((void *) start, len, PROT_READ) < 0) {
+ DL_ERR("%5d GNU_RELRO mprotect of library '%s' failed: %d (%s)\n",
+ pid, si->name, errno, strerror(errno));
+ goto fail;
+ }
+ }
+
+ /* If this is a SET?ID program, dup /dev/null to opened stdin,
+ stdout and stderr to close a security hole described in:
+
+ ftp://ftp.freebsd.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-02:23.stdio.asc
+
+ */
+ if (program_is_setuid)
+ nullify_closed_stdio ();
+ notify_gdb_of_load(si);
+ return 0;
+
+fail:
+ ERROR("failed to link %s\n", si->name);
+ si->flags |= FLAG_ERROR;
+ return -1;
+}
+
+static void parse_library_path(const char *path, char *delim)
+{
+ size_t len;
+ char *ldpaths_bufp = ldpaths_buf;
+ int i = 0;
+
+ len = strlcpy(ldpaths_buf, path, sizeof(ldpaths_buf));
+
+ while (i < LDPATH_MAX && (ldpaths[i] = strsep(&ldpaths_bufp, delim))) {
+ if (*ldpaths[i] != '\0')
+ ++i;
+ }
+
+ /* Forget the last path if we had to truncate; this occurs if the 2nd to
+ * last char isn't '\0' (i.e. not originally a delim). */
+ if (i > 0 && len >= sizeof(ldpaths_buf) &&
+ ldpaths_buf[sizeof(ldpaths_buf) - 2] != '\0') {
+ ldpaths[i - 1] = NULL;
+ } else {
+ ldpaths[i] = NULL;
+ }
+}
+
+static void parse_preloads(const char *path, char *delim)
+{
+ size_t len;
+ char *ldpreloads_bufp = ldpreloads_buf;
+ int i = 0;
+
+ len = strlcpy(ldpreloads_buf, path, sizeof(ldpreloads_buf));
+
+ while (i < LDPRELOAD_MAX && (ldpreload_names[i] = strsep(&ldpreloads_bufp, delim))) {
+ if (*ldpreload_names[i] != '\0') {
+ ++i;
+ }
+ }
+
+ /* Forget the last path if we had to truncate; this occurs if the 2nd to
+ * last char isn't '\0' (i.e. not originally a delim). */
+ if (i > 0 && len >= sizeof(ldpreloads_buf) &&
+ ldpreloads_buf[sizeof(ldpreloads_buf) - 2] != '\0') {
+ ldpreload_names[i - 1] = NULL;
+ } else {
+ ldpreload_names[i] = NULL;
+ }
+}
+
+/*
+ * This code is called after the linker has linked itself and
+ * fixed it's own GOT. It is safe to make references to externs
+ * and other non-local data at this point.
+ */
+static unsigned __linker_init_post_relocation(unsigned **elfdata)
+{
+ static soinfo linker_soinfo;
+
+ int argc = (int) *elfdata;
+ char **argv = (char**) (elfdata + 1);
+ unsigned *vecs = (unsigned*) (argv + argc + 1);
+ unsigned *v;
+ soinfo *si;
+ struct link_map * map;
+ const char *ldpath_env = NULL;
+ const char *ldpreload_env = NULL;
+
+ /* NOTE: we store the elfdata pointer on a special location
+ * of the temporary TLS area in order to pass it to
+ * the C Library's runtime initializer.
+ *
+ * The initializer must clear the slot and reset the TLS
+ * to point to a different location to ensure that no other
+ * shared library constructor can access it.
+ */
+ //__libc_init_tls(elfdata);
+
+ pid = getpid();
+
+#if TIMING
+ struct timeval t0, t1;
+ gettimeofday(&t0, 0);
+#endif
+
+ /* Initialize environment functions, and get to the ELF aux vectors table */
+ vecs = linker_env_init(vecs);
+
+ /* Check auxv for AT_SECURE first to see if program is setuid, setgid,
+ has file caps, or caused a SELinux/AppArmor domain transition. */
+ for (v = vecs; v[0]; v += 2) {
+ if (v[0] == AT_SECURE) {
+ /* kernel told us whether to enable secure mode */
+ program_is_setuid = v[1];
+ goto sanitize;
+ }
+ }
+
+ /* Kernel did not provide AT_SECURE - fall back on legacy test. */
+ program_is_setuid = (getuid() != geteuid()) || (getgid() != getegid());
+
+sanitize:
+ /* Sanitize environment if we're loading a setuid program */
+ if (program_is_setuid)
+ linker_env_secure();
+
+ //debugger_init();
+
+ /* Get a few environment variables */
+ {
+#if LINKER_DEBUG
+ const char* env;
+ env = linker_env_get("DEBUG"); /* XXX: TODO: Change to LD_DEBUG */
+ if (env)
+ debug_verbosity = atoi(env);
+#endif
+
+ /* Normally, these are cleaned by linker_env_secure, but the test
+ * against program_is_setuid doesn't cost us anything */
+ if (!program_is_setuid) {
+ ldpath_env = linker_env_get("LD_LIBRARY_PATH");
+ ldpreload_env = linker_env_get("LD_PRELOAD");
+ }
+ }
+
+ INFO("[ android linker & debugger ]\n");
+ DEBUG("%5d elfdata @ 0x%08x\n", pid, (unsigned)elfdata);
+
+ si = alloc_info(argv[0]);
+ if(si == 0) {
+ exit(-1);
+ }
+
+ /* bootstrap the link map, the main exe always needs to be first */
+ si->flags |= FLAG_EXE;
+ map = &(si->linkmap);
+
+ map->l_addr = 0;
+ map->l_name = argv[0];
+ map->l_prev = NULL;
+ map->l_next = NULL;
+
+ _r_debug.r_map = map;
+ r_debug_tail = map;
+
+ /* gdb expects the linker to be in the debug shared object list,
+ * and we need to make sure that the reported load address is zero.
+ * Without this, gdb gets the wrong idea of where rtld_db_dlactivity()
+ * is. Don't use alloc_info(), because the linker shouldn't
+ * be on the soinfo list.
+ */
+ strlcpy((char*) linker_soinfo.name, "/system/bin/linker", sizeof linker_soinfo.name);
+ linker_soinfo.flags = 0;
+ linker_soinfo.base = 0; // This is the important part; must be zero.
+ insert_soinfo_into_debug_map(&linker_soinfo);
+
+ /* extract information passed from the kernel */
+ while(vecs[0] != 0){
+ switch(vecs[0]){
+ case AT_PHDR:
+ si->phdr = (Elf32_Phdr*) vecs[1];
+ break;
+ case AT_PHNUM:
+ si->phnum = (int) vecs[1];
+ break;
+ case AT_ENTRY:
+ si->entry = vecs[1];
+ break;
+ }
+ vecs += 2;
+ }
+
+ /* Compute the value of si->base. We can't rely on the fact that
+ * the first entry is the PHDR because this will not be true
+ * for certain executables (e.g. some in the NDK unit test suite)
+ */
+ int nn;
+ si->base = 0;
+ for ( nn = 0; nn < si->phnum; nn++ ) {
+ if (si->phdr[nn].p_type == PT_PHDR) {
+ si->base = (Elf32_Addr) si->phdr - si->phdr[nn].p_vaddr;
+ break;
+ }
+ }
+ si->dynamic = (unsigned *)-1;
+ si->wrprotect_start = 0xffffffff;
+ si->wrprotect_end = 0;
+ si->refcount = 1;
+ si->gnu_relro_start = 0;
+ si->gnu_relro_len = 0;
+
+ /* Use LD_LIBRARY_PATH if we aren't setuid/setgid */
+ if (ldpath_env)
+ parse_library_path(ldpath_env, ":");
+
+ if (ldpreload_env) {
+ parse_preloads(ldpreload_env, " :");
+ }
+
+ if(link_image(si, 0)) {
+ char errmsg[] = "CANNOT LINK EXECUTABLE\n";
+ write(2, __linker_dl_err_buf, strlen(__linker_dl_err_buf));
+ write(2, errmsg, sizeof(errmsg));
+ exit(-1);
+ }
+
+ call_constructors_recursive(si);
+
+#if ALLOW_SYMBOLS_FROM_MAIN
+ /* Set somain after we've loaded all the libraries in order to prevent
+ * linking of symbols back to the main image, which is not set up at that
+ * point yet.
+ */
+ somain = si;
+#endif
+
+#if TIMING
+ gettimeofday(&t1,NULL);
+ PRINT("LINKER TIME: %s: %d microseconds\n", argv[0], (int) (
+ (((long long)t1.tv_sec * 1000000LL) + (long long)t1.tv_usec) -
+ (((long long)t0.tv_sec * 1000000LL) + (long long)t0.tv_usec)
+ ));
+#endif
+#if STATS
+ PRINT("RELO STATS: %s: %d abs, %d rel, %d copy, %d symbol\n", argv[0],
+ linker_stats.reloc[RELOC_ABSOLUTE],
+ linker_stats.reloc[RELOC_RELATIVE],
+ linker_stats.reloc[RELOC_COPY],
+ linker_stats.reloc[RELOC_SYMBOL]);
+#endif
+#if COUNT_PAGES
+ {
+ unsigned n;
+ unsigned i;
+ unsigned count = 0;
+ for(n = 0; n < 4096; n++){
+ if(bitmask[n]){
+ unsigned x = bitmask[n];
+ for(i = 0; i < 8; i++){
+ if(x & 1) count++;
+ x >>= 1;
+ }
+ }
+ }
+ PRINT("PAGES MODIFIED: %s: %d (%dKB)\n", argv[0], count, count * 4);
+ }
+#endif
+
+#if TIMING || STATS || COUNT_PAGES
+ fflush(stdout);
+#endif
+
+ TRACE("[ %5d Ready to execute '%s' @ 0x%08x ]\n", pid, si->name,
+ si->entry);
+ return si->entry;
+}
+
+/*
+ * Find the value of AT_BASE passed to us by the kernel. This is the load
+ * location of the linker.
+ */
+static unsigned find_linker_base(unsigned **elfdata) {
+ int argc = (int) *elfdata;
+ char **argv = (char**) (elfdata + 1);
+ unsigned *vecs = (unsigned*) (argv + argc + 1);
+ while (vecs[0] != 0) {
+ vecs++;
+ }
+
+ /* The end of the environment block is marked by two NULL pointers */
+ vecs++;
+
+ while(vecs[0]) {
+ if (vecs[0] == AT_BASE) {
+ return vecs[1];
+ }
+ vecs += 2;
+ }
+
+ return 0; // should never happen
+}
+
+/*
+ * This is the entry point for the linker, called from begin.S. This
+ * method is responsible for fixing the linker's own relocations, and
+ * then calling __linker_init_post_relocation().
+ *
+ * Because this method is called before the linker has fixed it's own
+ * relocations, any attempt to reference an extern variable, extern
+ * function, or other GOT reference will generate a segfault.
+ */
+unsigned __linker_init(unsigned **elfdata) {
+ unsigned linker_addr = find_linker_base(elfdata);
+ Elf32_Ehdr *elf_hdr = (Elf32_Ehdr *) linker_addr;
+ Elf32_Phdr *phdr =
+ (Elf32_Phdr *)((unsigned char *) linker_addr + elf_hdr->e_phoff);
+
+ soinfo linker_so;
+ memset(&linker_so, 0, sizeof(soinfo));
+
+ linker_so.base = linker_addr;
+ linker_so.dynamic = (unsigned *) -1;
+ linker_so.phdr = phdr;
+ linker_so.phnum = elf_hdr->e_phnum;
+ linker_so.flags |= FLAG_LINKER;
+ linker_so.wrprotect_start = 0xffffffff;
+ linker_so.wrprotect_end = 0;
+ linker_so.gnu_relro_start = 0;
+ linker_so.gnu_relro_len = 0;
+
+ if (link_image(&linker_so, 0)) {
+ // It would be nice to print an error message, but if the linker
+ // can't link itself, there's no guarantee that we'll be able to
+ // call write() (because it involves a GOT reference).
+ //
+ // This situation should never occur unless the linker itself
+ // is corrupt.
+ exit(-1);
+ }
+
+ // We have successfully fixed our own relocations. It's safe to run
+ // the main part of the linker now.
+ return __linker_init_post_relocation(elfdata);
+}
--- /dev/null
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _LINKER_H_
+#define _LINKER_H_
+
+#include <unistd.h>
+#include <sys/types.h>
+#include <elf.h>
+
+#undef PAGE_MASK
+#undef PAGE_SIZE
+#define PAGE_SIZE 4096
+#define PAGE_MASK 4095
+
+void debugger_init();
+const char *addr_to_name(unsigned addr);
+
+/* magic shared structures that GDB knows about */
+
+struct link_map
+{
+ uintptr_t l_addr;
+ char * l_name;
+ uintptr_t l_ld;
+ struct link_map * l_next;
+ struct link_map * l_prev;
+};
+
+/* needed for dl_iterate_phdr to be passed to the callbacks provided */
+struct dl_phdr_info
+{
+ Elf32_Addr dlpi_addr;
+ const char *dlpi_name;
+ const Elf32_Phdr *dlpi_phdr;
+ Elf32_Half dlpi_phnum;
+};
+
+
+// Values for r_debug->state
+enum {
+ RT_CONSISTENT,
+ RT_ADD,
+ RT_DELETE
+};
+
+struct r_debug
+{
+ int32_t r_version;
+ struct link_map * r_map;
+ void (*r_brk)(void);
+ int32_t r_state;
+ uintptr_t r_ldbase;
+};
+
+typedef struct soinfo soinfo;
+
+#define FLAG_LINKED 0x00000001
+#define FLAG_ERROR 0x00000002
+#define FLAG_EXE 0x00000004 // The main executable
+#define FLAG_LINKER 0x00000010 // The linker itself
+
+#define SOINFO_NAME_LEN 128
+
+struct soinfo
+{
+ const char name[SOINFO_NAME_LEN];
+ Elf32_Phdr *phdr;
+ int phnum;
+ unsigned entry;
+ unsigned base;
+ unsigned size;
+
+ int unused; // DO NOT USE, maintained for compatibility.
+
+ unsigned *dynamic;
+
+ unsigned wrprotect_start;
+ unsigned wrprotect_end;
+
+ soinfo *next;
+ unsigned flags;
+
+ const char *strtab;
+ Elf32_Sym *symtab;
+
+ unsigned nbucket;
+ unsigned nchain;
+ unsigned *bucket;
+ unsigned *chain;
+
+ unsigned *plt_got;
+
+ Elf32_Rel *plt_rel;
+ unsigned plt_rel_count;
+
+ Elf32_Rel *rel;
+ unsigned rel_count;
+
+ unsigned *preinit_array;
+ unsigned preinit_array_count;
+
+ unsigned *init_array;
+ unsigned init_array_count;
+ unsigned *fini_array;
+ unsigned fini_array_count;
+
+ void (*init_func)(void);
+ void (*fini_func)(void);
+
+#ifdef ANDROID_ARM_LINKER
+ /* ARM EABI section used for stack unwinding. */
+ unsigned *ARM_exidx;
+ unsigned ARM_exidx_count;
+#endif
+
+ unsigned refcount;
+ struct link_map linkmap;
+
+ int constructors_called;
+
+ Elf32_Addr gnu_relro_start;
+ unsigned gnu_relro_len;
+
+};
+
+
+extern soinfo libdl_info;
+
+#ifdef ANDROID_ARM_LINKER
+
+#define R_ARM_COPY 20
+#define R_ARM_GLOB_DAT 21
+#define R_ARM_JUMP_SLOT 22
+#define R_ARM_RELATIVE 23
+
+/* According to the AAPCS specification, we only
+ * need the above relocations. However, in practice,
+ * the following ones turn up from time to time.
+ */
+#define R_ARM_ABS32 2
+#define R_ARM_REL32 3
+
+#elif defined(ANDROID_X86_LINKER)
+
+#define R_386_32 1
+#define R_386_PC32 2
+#define R_386_GLOB_DAT 6
+#define R_386_JUMP_SLOT 7
+#define R_386_RELATIVE 8
+
+#endif
+
+#ifndef DT_INIT_ARRAY
+#define DT_INIT_ARRAY 25
+#endif
+
+#ifndef DT_FINI_ARRAY
+#define DT_FINI_ARRAY 26
+#endif
+
+#ifndef DT_INIT_ARRAYSZ
+#define DT_INIT_ARRAYSZ 27
+#endif
+
+#ifndef DT_FINI_ARRAYSZ
+#define DT_FINI_ARRAYSZ 28
+#endif
+
+#ifndef DT_PREINIT_ARRAY
+#define DT_PREINIT_ARRAY 32
+#endif
+
+#ifndef DT_PREINIT_ARRAYSZ
+#define DT_PREINIT_ARRAYSZ 33
+#endif
+
+soinfo *find_library(const char *name);
+unsigned unload_library(soinfo *si);
+Elf32_Sym *lookup_in_library(soinfo *si, const char *name);
+Elf32_Sym *lookup(const char *name, soinfo **found, soinfo *start);
+soinfo *find_containing_library(const void *addr);
+Elf32_Sym *find_containing_symbol(const void *addr, soinfo *si);
+const char *linker_get_error(void);
+void call_constructors_recursive(soinfo *si);
+
+#ifdef ANDROID_ARM_LINKER
+typedef long unsigned int *_Unwind_Ptr;
+_Unwind_Ptr dl_unwind_find_exidx(_Unwind_Ptr pc, int *pcount);
+#elif defined(ANDROID_X86_LINKER)
+int dl_iterate_phdr(int (*cb)(struct dl_phdr_info *, size_t, void *), void *);
+#endif
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2008-2010 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _LINKER_DEBUG_H_
+#define _LINKER_DEBUG_H_
+
+#include <stdio.h>
+
+#ifndef LINKER_DEBUG
+#error LINKER_DEBUG should be defined to either 1 or 0 in Android.mk
+#endif
+
+#define TRACE_DEBUG 1
+#define DO_TRACE_LOOKUP 1
+#define DO_TRACE_RELO 1
+#define TIMING 0
+#define STATS 0
+#define COUNT_PAGES 0
+
+/*********************************************************************
+ * You shouldn't need to modify anything below unless you are adding
+ * more debugging information.
+ *
+ * To enable/disable specific debug options, change the defines above
+ *********************************************************************/
+
+
+/*********************************************************************/
+#undef TRUE
+#undef FALSE
+#define TRUE 1
+#define FALSE 0
+
+/* Only use printf() during debugging. We have seen occasional memory
+ * corruption when the linker uses printf().
+ */
+#if LINKER_DEBUG
+#include "linker_format.h"
+extern int debug_verbosity;
+extern int debug_stdout;
+extern int format_log(int, const char *, const char *, ...);
+extern int format_fd(int, const char *, ...);
+#define _PRINTVF(v,f,x...) \
+ do { \
+ if (debug_verbosity > (v)) \
+ if (debug_stdout) \
+ format_fd(1, x); \
+ else \
+ format_log(5-(v),"linker",x); \
+ } while (0)
+#else /* !LINKER_DEBUG */
+#define _PRINTVF(v,f,x...) do {} while(0)
+#endif /* LINKER_DEBUG */
+
+#define PRINT(x...) _PRINTVF(-1, FALSE, x)
+#define INFO(x...) _PRINTVF(0, TRUE, x)
+#define TRACE(x...) _PRINTVF(1, TRUE, x)
+#define WARN(fmt,args...) \
+ _PRINTVF(-1, TRUE, "%s:%d| WARNING: " fmt, __FILE__, __LINE__, ## args)
+#define ERROR(fmt,args...) \
+ _PRINTVF(-1, TRUE, "%s:%d| ERROR: " fmt, __FILE__, __LINE__, ## args)
+
+
+#if TRACE_DEBUG
+#define DEBUG(x...) _PRINTVF(2, TRUE, "DEBUG: " x)
+#else /* !TRACE_DEBUG */
+#define DEBUG(x...) do {} while (0)
+#endif /* TRACE_DEBUG */
+
+#if LINKER_DEBUG
+#define TRACE_TYPE(t,x...) do { if (DO_TRACE_##t) { TRACE(x); } } while (0)
+#else /* !LINKER_DEBUG */
+#define TRACE_TYPE(t,x...) do {} while (0)
+#endif /* LINKER_DEBUG */
+
+#if STATS
+#define RELOC_ABSOLUTE 0
+#define RELOC_RELATIVE 1
+#define RELOC_COPY 2
+#define RELOC_SYMBOL 3
+#define NUM_RELOC_STATS 4
+
+struct _link_stats {
+ int reloc[NUM_RELOC_STATS];
+};
+extern struct _link_stats linker_stats;
+
+#define COUNT_RELOC(type) \
+ do { if (type >= 0 && type < NUM_RELOC_STATS) { \
+ linker_stats.reloc[type] += 1; \
+ } else { \
+ PRINT("Unknown reloc stat requested\n"); \
+ } \
+ } while(0)
+#else /* !STATS */
+#define COUNT_RELOC(type) do {} while(0)
+#endif /* STATS */
+
+#if TIMING
+#undef WARN
+#define WARN(x...) do {} while (0)
+#endif /* TIMING */
+
+#if COUNT_PAGES
+extern unsigned bitmask[];
+#define MARK(offset) do { \
+ bitmask[((offset) >> 12) >> 3] |= (1 << (((offset) >> 12) & 7)); \
+ } while(0)
+#else
+#define MARK(x) do {} while (0)
+#endif
+
+#define DEBUG_DUMP_PHDR(phdr, name, pid) do { \
+ DEBUG("%5d %s (phdr = 0x%08x)\n", (pid), (name), (unsigned)(phdr)); \
+ DEBUG("\t\tphdr->offset = 0x%08x\n", (unsigned)((phdr)->p_offset)); \
+ DEBUG("\t\tphdr->p_vaddr = 0x%08x\n", (unsigned)((phdr)->p_vaddr)); \
+ DEBUG("\t\tphdr->p_paddr = 0x%08x\n", (unsigned)((phdr)->p_paddr)); \
+ DEBUG("\t\tphdr->p_filesz = 0x%08x\n", (unsigned)((phdr)->p_filesz)); \
+ DEBUG("\t\tphdr->p_memsz = 0x%08x\n", (unsigned)((phdr)->p_memsz)); \
+ DEBUG("\t\tphdr->p_flags = 0x%08x\n", (unsigned)((phdr)->p_flags)); \
+ DEBUG("\t\tphdr->p_align = 0x%08x\n", (unsigned)((phdr)->p_align)); \
+ } while (0)
+
+#endif /* _LINKER_DEBUG_H_ */
--- /dev/null
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#include "linker_environ.h"
+#include <stddef.h>
+
+static char** _envp;
+
+/* Returns 1 if 'str' points to a valid environment variable definition.
+ * For now, we check that:
+ * - It is smaller than MAX_ENV_LEN (to detect non-zero terminated strings)
+ * - It contains at least one equal sign that is not the first character
+ */
+static int
+_is_valid_definition(const char* str)
+{
+ int pos = 0;
+ int first_equal_pos = -1;
+
+ /* According to its sources, the kernel uses 32*PAGE_SIZE by default
+ * as the maximum size for an env. variable definition.
+ */
+ const int MAX_ENV_LEN = 32*4096;
+
+ if (str == NULL)
+ return 0;
+
+ /* Parse the string, looking for the first '=' there, and its size */
+ do {
+ if (str[pos] == '\0')
+ break;
+ if (str[pos] == '=' && first_equal_pos < 0)
+ first_equal_pos = pos;
+ pos++;
+ } while (pos < MAX_ENV_LEN);
+
+ if (pos >= MAX_ENV_LEN) /* Too large */
+ return 0;
+
+ if (first_equal_pos < 1) /* No equal sign, or it is the first character */
+ return 0;
+
+ return 1;
+}
+
+unsigned*
+linker_env_init(unsigned* vecs)
+{
+ /* Store environment pointer - can't be NULL */
+ _envp = (char**) vecs;
+
+ /* Skip over all definitions */
+ while (vecs[0] != 0)
+ vecs++;
+ /* The end of the environment block is marked by two NULL pointers */
+ vecs++;
+
+ /* As a sanity check, we're going to remove all invalid variable
+ * definitions from the environment array.
+ */
+ {
+ char** readp = _envp;
+ char** writep = _envp;
+ for ( ; readp[0] != NULL; readp++ ) {
+ if (!_is_valid_definition(readp[0]))
+ continue;
+ writep[0] = readp[0];
+ writep++;
+ }
+ writep[0] = NULL;
+ }
+
+ /* Return the address of the aux vectors table */
+ return vecs;
+}
+
+/* Check if the environment variable definition at 'envstr'
+ * starts with '<name>=', and if so return the address of the
+ * first character after the equal sign. Otherwise return NULL.
+ */
+static char*
+env_match(char* envstr, const char* name)
+{
+ size_t cnt = 0;
+
+ while (envstr[cnt] == name[cnt] && name[cnt] != '\0')
+ cnt++;
+
+ if (name[cnt] == '\0' && envstr[cnt] == '=')
+ return envstr + cnt + 1;
+
+ return NULL;
+}
+
+#define MAX_ENV_LEN (16*4096)
+
+const char*
+linker_env_get(const char* name)
+{
+ char** readp = _envp;
+
+ if (name == NULL || name[0] == '\0')
+ return NULL;
+
+ for ( ; readp[0] != NULL; readp++ ) {
+ char* val = env_match(readp[0], name);
+ if (val != NULL) {
+ /* Return NULL for empty strings, or if it is too large */
+ if (val[0] == '\0')
+ val = NULL;
+ return val;
+ }
+ }
+ return NULL;
+}
+
+
+void
+linker_env_unset(const char* name)
+{
+ char** readp = _envp;
+ char** writep = readp;
+
+ if (name == NULL || name[0] == '\0')
+ return;
+
+ for ( ; readp[0] != NULL; readp++ ) {
+ if (env_match(readp[0], name))
+ continue;
+ writep[0] = readp[0];
+ writep++;
+ }
+ /* end list with a NULL */
+ writep[0] = NULL;
+}
+
+
+
+/* Remove unsafe environment variables. This should be used when
+ * running setuid programs. */
+void
+linker_env_secure(void)
+{
+ /* The same list than GLibc at this point */
+ static const char* const unsec_vars[] = {
+ "GCONV_PATH",
+ "GETCONF_DIR",
+ "HOSTALIASES",
+ "LD_AUDIT",
+ "LD_DEBUG",
+ "LD_DEBUG_OUTPUT",
+ "LD_DYNAMIC_WEAK",
+ "LD_LIBRARY_PATH",
+ "LD_ORIGIN_PATH",
+ "LD_PRELOAD",
+ "LD_PROFILE",
+ "LD_SHOW_AUXV",
+ "LD_USE_LOAD_BIAS",
+ "LOCALDOMAIN",
+ "LOCPATH",
+ "MALLOC_TRACE",
+ "MALLOC_CHECK_",
+ "NIS_PATH",
+ "NLSPATH",
+ "RESOLV_HOST_CONF",
+ "RES_OPTIONS",
+ "TMPDIR",
+ "TZDIR",
+ "LD_AOUT_LIBRARY_PATH",
+ "LD_AOUT_PRELOAD",
+ };
+
+ const char* const* cp = unsec_vars;
+ const char* const* endp = cp + sizeof(unsec_vars)/sizeof(unsec_vars[0]);
+
+ while (cp < endp) {
+ linker_env_unset(*cp);
+ cp++;
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef LINKER_ENVIRON_H
+#define LINKER_ENVIRON_H
+
+/* Call this function before anything else. 'vecs' must be the pointer
+ * to the environment block in the ELF data block. The function returns
+ * the start of the aux vectors after the env block.
+ */
+extern unsigned* linker_env_init(unsigned* vecs);
+
+/* Unset a given environment variable. In case the variable is defined
+ * multiple times, unset all instances. This modifies the environment
+ * block, so any pointer returned by linker_env_get() after this call
+ * might become invalid */
+extern void linker_env_unset(const char* name);
+
+
+/* Returns the value of environment variable 'name' if defined and not
+ * empty, or NULL otherwise. Note that the returned pointer may become
+ * invalid if linker_env_unset() or linker_env_secure() are called
+ * after this function. */
+extern const char* linker_env_get(const char* name);
+
+/* Remove unsecure environment variables. This should be used when
+ * running setuid programs. */
+extern void linker_env_secure(void);
+
+#endif /* LINKER_ENVIRON_H */
--- /dev/null
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <stdarg.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <stddef.h>
+#include "linker_format.h"
+#include "linker_debug.h"
+
+/* define UNIT_TESTS to build this file as a single executable that runs
+ * the formatter's unit tests
+ */
+#define xxUNIT_TESTS
+
+/*** Generic output sink
+ ***/
+
+typedef struct {
+ void *opaque;
+ void (*send)(void *opaque, const char *data, int len);
+} Out;
+
+static void
+out_send(Out *o, const void *data, size_t len)
+{
+ o->send(o->opaque, data, (int)len);
+}
+
+static void
+out_send_repeat(Out *o, char ch, int count)
+{
+ char pad[8];
+ const int padSize = (int)sizeof(pad);
+
+ memset(pad, ch, sizeof(pad));
+ while (count > 0) {
+ int avail = count;
+ if (avail > padSize) {
+ avail = padSize;
+ }
+ o->send(o->opaque, pad, avail);
+ count -= avail;
+ }
+}
+
+/* forward declaration */
+static void
+out_vformat(Out *o, const char *format, va_list args);
+
+/*** Bounded buffer output
+ ***/
+
+typedef struct {
+ Out out[1];
+ char *buffer;
+ char *pos;
+ char *end;
+ int total;
+} BufOut;
+
+static void
+buf_out_send(void *opaque, const char *data, int len)
+{
+ BufOut *bo = opaque;
+
+ if (len < 0)
+ len = strlen(data);
+
+ bo->total += len;
+
+ while (len > 0) {
+ int avail = bo->end - bo->pos;
+ if (avail == 0)
+ break;
+ if (avail > len)
+ avail = len;
+ memcpy(bo->pos, data, avail);
+ bo->pos += avail;
+ bo->pos[0] = '\0';
+ len -= avail;
+ }
+}
+
+static Out*
+buf_out_init(BufOut *bo, char *buffer, size_t size)
+{
+ if (size == 0)
+ return NULL;
+
+ bo->out->opaque = bo;
+ bo->out->send = buf_out_send;
+ bo->buffer = buffer;
+ bo->end = buffer + size - 1;
+ bo->pos = bo->buffer;
+ bo->pos[0] = '\0';
+ bo->total = 0;
+
+ return bo->out;
+}
+
+static int
+buf_out_length(BufOut *bo)
+{
+ return bo->total;
+}
+
+static int
+vformat_buffer(char *buff, size_t buffsize, const char *format, va_list args)
+{
+ BufOut bo;
+ Out *out;
+
+ out = buf_out_init(&bo, buff, buffsize);
+ if (out == NULL)
+ return 0;
+
+ out_vformat(out, format, args);
+
+ return buf_out_length(&bo);
+}
+
+int
+format_buffer(char *buff, size_t buffsize, const char *format, ...)
+{
+ va_list args;
+ int ret;
+
+ va_start(args, format);
+ ret = vformat_buffer(buff, buffsize, format, args);
+ va_end(args);
+
+ return ret;
+}
+
+/* The __stack_chk_fail() function calls __libc_android_log_print()
+ * which calls vsnprintf().
+ *
+ * We define our version of the function here to avoid dragging
+ * about 25 KB of C library routines related to formatting.
+ */
+#if 0
+int
+vsnprintf(char *buff, size_t bufsize, const char *format, va_list args)
+{
+ return format_buffer(buff, bufsize, format, args);
+}
+#endif
+
+#if LINKER_DEBUG
+
+/*** File descriptor output
+ ***/
+
+typedef struct {
+ Out out[1];
+ int fd;
+ int total;
+} FdOut;
+
+static void
+fd_out_send(void *opaque, const char *data, int len)
+{
+ FdOut *fdo = opaque;
+
+ if (len < 0)
+ len = strlen(data);
+
+ while (len > 0) {
+ int ret = write(fdo->fd, data, len);
+ if (ret < 0) {
+ if (errno == EINTR)
+ continue;
+ break;
+ }
+ data += ret;
+ len -= ret;
+ fdo->total += ret;
+ }
+}
+
+static Out*
+fd_out_init(FdOut *fdo, int fd)
+{
+ fdo->out->opaque = fdo;
+ fdo->out->send = fd_out_send;
+ fdo->fd = fd;
+ fdo->total = 0;
+
+ return fdo->out;
+}
+
+static int
+fd_out_length(FdOut *fdo)
+{
+ return fdo->total;
+}
+
+
+int
+format_fd(int fd, const char *format, ...)
+{
+ FdOut fdo;
+ Out* out;
+ va_list args;
+
+ out = fd_out_init(&fdo, fd);
+ if (out == NULL)
+ return 0;
+
+ va_start(args, format);
+ out_vformat(out, format, args);
+ va_end(args);
+
+ return fd_out_length(&fdo);
+}
+
+/*** Log output
+ ***/
+
+/* We need our own version of __libc_android_log_vprint, otherwise
+ * the log output is completely broken. Probably due to the fact
+ * that the C library is not initialized yet.
+ *
+ * You can test that by setting CUSTOM_LOG_VPRINT to 0
+ */
+#define CUSTOM_LOG_VPRINT 1
+
+#if CUSTOM_LOG_VPRINT
+
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/uio.h>
+
+static int log_vprint(int prio, const char *tag, const char *fmt, va_list args)
+{
+ char buf[1024];
+ int result;
+ static int log_fd = -1;
+
+ result = vformat_buffer(buf, sizeof buf, fmt, args);
+
+ if (log_fd < 0) {
+ log_fd = open("/dev/log/main", O_WRONLY);
+ if (log_fd < 0) {
+ log_fd = fileno(stdout); // kernel doesn't have android log
+ return result;
+ }
+ }
+
+ {
+ ssize_t ret;
+ struct iovec vec[3];
+
+ vec[0].iov_base = (unsigned char *) &prio;
+ vec[0].iov_len = 1;
+ vec[1].iov_base = (void *) tag;
+ vec[1].iov_len = strlen(tag) + 1;
+ vec[2].iov_base = (void *) buf;
+ vec[2].iov_len = strlen(buf) + 1;
+
+ do {
+ ret = writev(log_fd, vec, 3);
+ } while ((ret < 0) && (errno == EINTR));
+ }
+ return result;
+}
+
+#define __libc_android_log_vprint log_vprint
+
+#else /* !CUSTOM_LOG_VPRINT */
+
+extern int __libc_android_log_vprint(int prio, const char* tag, const char* format, va_list ap);
+
+#endif /* !CUSTOM_LOG_VPRINT */
+
+int
+format_log(int prio, const char *tag, const char *format, ...)
+{
+ int ret;
+ va_list args;
+ va_start(args, format);
+ ret = __libc_android_log_vprint(prio, tag, format, args);
+ va_end(args);
+ return ret;
+}
+
+#endif /* LINKER_DEBUG */
+
+/*** formatted output implementation
+ ***/
+
+/* Parse a decimal string from 'format + *ppos',
+ * return the value, and writes the new position past
+ * the decimal string in '*ppos' on exit.
+ *
+ * NOTE: Does *not* handle a sign prefix.
+ */
+static unsigned
+parse_decimal(const char *format, int *ppos)
+{
+ const char* p = format + *ppos;
+ unsigned result = 0;
+
+ for (;;) {
+ int ch = *p;
+ unsigned d = (unsigned)(ch - '0');
+
+ if (d >= 10U)
+ break;
+
+ result = result*10 + d;
+ p++;
+ }
+ *ppos = p - format;
+ return result;
+}
+
+/* write an octal/decimal/number into a bounded buffer.
+ * assumes that bufsize > 0, and 'digits' is a string of
+ * digits of at least 'base' values.
+ */
+static void
+format_number(char *buffer, size_t bufsize, uint64_t value, int base, const char *digits)
+{
+ char *pos = buffer;
+ char *end = buffer + bufsize - 1;
+
+ /* generate digit string in reverse order */
+ while (value) {
+ unsigned d = value % base;
+ value /= base;
+ if (pos < end) {
+ *pos++ = digits[d];
+ }
+ }
+
+ /* special case for 0 */
+ if (pos == buffer) {
+ if (pos < end) {
+ *pos++ = '0';
+ }
+ }
+ pos[0] = '\0';
+
+ /* now reverse digit string in-place */
+ end = pos - 1;
+ pos = buffer;
+ while (pos < end) {
+ int ch = pos[0];
+ pos[0] = end[0];
+ end[0] = (char) ch;
+ pos++;
+ end--;
+ }
+}
+
+/* Write an integer (octal or decimal) into a buffer, assumes buffsize > 2 */
+static void
+format_integer(char *buffer, size_t buffsize, uint64_t value, int base, int isSigned)
+{
+ if (isSigned && (int64_t)value < 0) {
+ buffer[0] = '-';
+ buffer += 1;
+ buffsize -= 1;
+ value = (uint64_t)(-(int64_t)value);
+ }
+
+ format_number(buffer, buffsize, value, base, "0123456789");
+}
+
+/* Write an octal into a buffer, assumes buffsize > 2 */
+static void
+format_octal(char *buffer, size_t buffsize, uint64_t value, int isSigned)
+{
+ format_integer(buffer, buffsize, value, 8, isSigned);
+}
+
+/* Write a decimal into a buffer, assumes buffsize > 2 */
+static void
+format_decimal(char *buffer, size_t buffsize, uint64_t value, int isSigned)
+{
+ format_integer(buffer, buffsize, value, 10, isSigned);
+}
+
+/* Write an hexadecimal into a buffer, isCap is true for capital alphas.
+ * Assumes bufsize > 2 */
+static void
+format_hex(char *buffer, size_t buffsize, uint64_t value, int isCap)
+{
+ const char *digits = isCap ? "0123456789ABCDEF" : "0123456789abcdef";
+
+ format_number(buffer, buffsize, value, 16, digits);
+}
+
+
+/* Perform formatted output to an output target 'o' */
+static void
+out_vformat(Out *o, const char *format, va_list args)
+{
+ int nn = 0;
+
+ for (;;) {
+ int mm;
+ int padZero = 0;
+ int padLeft = 0;
+ char sign = '\0';
+ int width = -1;
+ int prec = -1;
+ size_t bytelen = sizeof(int);
+ const char* str;
+ int slen;
+ char buffer[32]; /* temporary buffer used to format numbers */
+
+ char c;
+
+ /* first, find all characters that are not 0 or '%' */
+ /* then send them to the output directly */
+ mm = nn;
+ do {
+ c = format[mm];
+ if (c == '\0' || c == '%')
+ break;
+ mm++;
+ } while (1);
+
+ if (mm > nn) {
+ out_send(o, format+nn, mm-nn);
+ nn = mm;
+ }
+
+ /* is this it ? then exit */
+ if (c == '\0')
+ break;
+
+ /* nope, we are at a '%' modifier */
+ nn++; // skip it
+
+ /* parse flags */
+ for (;;) {
+ c = format[nn++];
+ if (c == '\0') { /* single trailing '%' ? */
+ c = '%';
+ out_send(o, &c, 1);
+ return;
+ }
+ else if (c == '0') {
+ padZero = 1;
+ continue;
+ }
+ else if (c == '-') {
+ padLeft = 1;
+ continue;
+ }
+ else if (c == ' ' || c == '+') {
+ sign = c;
+ continue;
+ }
+ break;
+ }
+
+ /* parse field width */
+ if ((c >= '0' && c <= '9')) {
+ nn --;
+ width = (int)parse_decimal(format, &nn);
+ c = format[nn++];
+ }
+
+ /* parse precision */
+ if (c == '.') {
+ prec = (int)parse_decimal(format, &nn);
+ c = format[nn++];
+ }
+
+ /* length modifier */
+ switch (c) {
+ case 'h':
+ bytelen = sizeof(short);
+ if (format[nn] == 'h') {
+ bytelen = sizeof(char);
+ nn += 1;
+ }
+ c = format[nn++];
+ break;
+ case 'l':
+ bytelen = sizeof(long);
+ if (format[nn] == 'l') {
+ bytelen = sizeof(long long);
+ nn += 1;
+ }
+ c = format[nn++];
+ break;
+ case 'z':
+ bytelen = sizeof(size_t);
+ c = format[nn++];
+ break;
+ case 't':
+ bytelen = sizeof(ptrdiff_t);
+ c = format[nn++];
+ break;
+ default:
+ ;
+ }
+
+ /* conversion specifier */
+ if (c == 's') {
+ /* string */
+ str = va_arg(args, const char*);
+ } else if (c == 'c') {
+ /* character */
+ /* NOTE: char is promoted to int when passed through the stack */
+ buffer[0] = (char) va_arg(args, int);
+ buffer[1] = '\0';
+ str = buffer;
+ } else if (c == 'p') {
+ uint64_t value = (uintptr_t) va_arg(args, void*);
+ buffer[0] = '0';
+ buffer[1] = 'x';
+ format_hex(buffer + 2, sizeof buffer-2, value, 0);
+ str = buffer;
+ } else {
+ /* integers - first read value from stack */
+ uint64_t value;
+ int isSigned = (c == 'd' || c == 'i' || c == 'o');
+
+ /* NOTE: int8_t and int16_t are promoted to int when passed
+ * through the stack
+ */
+ switch (bytelen) {
+ case 1: value = (uint8_t) va_arg(args, int); break;
+ case 2: value = (uint16_t) va_arg(args, int); break;
+ case 4: value = va_arg(args, uint32_t); break;
+ case 8: value = va_arg(args, uint64_t); break;
+ default: return; /* should not happen */
+ }
+
+ /* sign extension, if needed */
+ if (isSigned) {
+ int shift = 64 - 8*bytelen;
+ value = (uint64_t)(((int64_t)(value << shift)) >> shift);
+ }
+
+ /* format the number properly into our buffer */
+ switch (c) {
+ case 'i': case 'd':
+ format_integer(buffer, sizeof buffer, value, 10, isSigned);
+ break;
+ case 'o':
+ format_integer(buffer, sizeof buffer, value, 8, isSigned);
+ break;
+ case 'x': case 'X':
+ format_hex(buffer, sizeof buffer, value, (c == 'X'));
+ break;
+ default:
+ buffer[0] = '\0';
+ }
+ /* then point to it */
+ str = buffer;
+ }
+
+ /* if we are here, 'str' points to the content that must be
+ * outputted. handle padding and alignment now */
+
+ slen = strlen(str);
+
+ if (slen < width && !padLeft) {
+ char padChar = padZero ? '0' : ' ';
+ out_send_repeat(o, padChar, width - slen);
+ }
+
+ out_send(o, str, slen);
+
+ if (slen < width && padLeft) {
+ char padChar = padZero ? '0' : ' ';
+ out_send_repeat(o, padChar, width - slen);
+ }
+ }
+}
+
+
+#ifdef UNIT_TESTS
+
+#include <stdio.h>
+
+static int gFails = 0;
+
+#define MARGIN 40
+
+#define UTEST_CHECK(condition,message) \
+ printf("Checking %-*s: ", MARGIN, message); fflush(stdout); \
+ if (!(condition)) { \
+ printf("KO\n"); \
+ gFails += 1; \
+ } else { \
+ printf("ok\n"); \
+ }
+
+static void
+utest_BufOut(void)
+{
+ char buffer[16];
+ BufOut bo[1];
+ Out* out;
+ int ret;
+
+ buffer[0] = '1';
+ out = buf_out_init(bo, buffer, sizeof buffer);
+ UTEST_CHECK(buffer[0] == '\0', "buf_out_init clears initial byte");
+ out_send(out, "abc", 3);
+ UTEST_CHECK(!memcmp(buffer, "abc", 4), "out_send() works with BufOut");
+ out_send_repeat(out, 'X', 4);
+ UTEST_CHECK(!memcmp(buffer, "abcXXXX", 8), "out_send_repeat() works with BufOut");
+ buffer[sizeof buffer-1] = 'x';
+ out_send_repeat(out, 'Y', 2*sizeof(buffer));
+ UTEST_CHECK(buffer[sizeof buffer-1] == '\0', "overflows always zero-terminates");
+
+ out = buf_out_init(bo, buffer, sizeof buffer);
+ out_send_repeat(out, 'X', 2*sizeof(buffer));
+ ret = buf_out_length(bo);
+ UTEST_CHECK(ret == 2*sizeof(buffer), "correct size returned on overflow");
+}
+
+static void
+utest_expect(const char* result, const char* format, ...)
+{
+ va_list args;
+ BufOut bo[1];
+ char buffer[256];
+ Out* out = buf_out_init(bo, buffer, sizeof buffer);
+
+ printf("Checking %-*s: ", MARGIN, format); fflush(stdout);
+ va_start(args, format);
+ out_vformat(out, format, args);
+ va_end(args);
+
+ if (strcmp(result, buffer)) {
+ printf("KO. got '%s' expecting '%s'\n", buffer, result);
+ gFails += 1;
+ } else {
+ printf("ok. got '%s'\n", result);
+ }
+}
+
+int main(void)
+{
+ utest_BufOut();
+ utest_expect("", "");
+ utest_expect("a", "a");
+ utest_expect("01234", "01234", "");
+ utest_expect("01234", "%s", "01234");
+ utest_expect("aabbcc", "aa%scc", "bb");
+ utest_expect("a", "%c", 'a');
+ utest_expect("1234", "%d", 1234);
+ utest_expect("-8123", "%d", -8123);
+ utest_expect("16", "%hd", 0x7fff0010);
+ utest_expect("16", "%hhd", 0x7fffff10);
+ utest_expect("68719476736", "%lld", 0x1000000000LL);
+ utest_expect("70000", "%ld", 70000);
+ utest_expect("0xb0001234", "%p", (void*)0xb0001234);
+ utest_expect("12ab", "%x", 0x12ab);
+ utest_expect("12AB", "%X", 0x12ab);
+ utest_expect("00123456", "%08x", 0x123456);
+ utest_expect("01234", "0%d", 1234);
+ utest_expect(" 1234", "%5d", 1234);
+ utest_expect("01234", "%05d", 1234);
+ utest_expect(" 1234", "%8d", 1234);
+ utest_expect("1234 ", "%-8d", 1234);
+ utest_expect("abcdef ", "%-11s", "abcdef");
+ utest_expect("something:1234", "%s:%d", "something", 1234);
+ utest_expect("005:5:05", "%03d:%d:%02d", 5, 5, 5);
+ utest_expect("5,0x0", "%d,%p", 5, NULL);
+ utest_expect("68719476736,6,7,8", "%lld,%d,%d,%d", 0x1000000000LL, 6, 7, 8);
+ return gFails != 0;
+}
+
+#endif /* UNIT_TESTS */
--- /dev/null
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _LINKER_FORMAT_H
+#define _LINKER_FORMAT_H
+
+#include <stdarg.h>
+#include <stddef.h>
+
+/* Formatting routines for the dynamic linker's debug traces */
+/* We want to avoid dragging the whole C library fprintf() */
+/* implementation into the dynamic linker since this creates */
+/* issues (it uses malloc()/free()) and increases code size */
+
+int format_buffer(char *buffer, size_t bufsize, const char *format, ...);
+
+#endif /* _LINKER_FORMAT_H */
--- /dev/null
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * This function is an empty stub where GDB locates a breakpoint to get notified
+ * about linker activity.
+ */
+void __attribute__((noinline)) rtld_db_dlactivity(void)
+{
+}
+
--- /dev/null
+
+/*
+ * Copyright (c) 2013 Thomas Perl <m@thp.io>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+#include "logging.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <pthread.h>
+
+FILE *hybris_logging_target = NULL;
+
+pthread_mutex_t hybris_logging_mutex;
+
+static enum hybris_log_level
+hybris_minimum_log_level = HYBRIS_LOG_WARN;
+
+static enum hybris_log_format _hybris_logging_format = HYBRIS_LOG_FORMAT_NORMAL;
+
+static int _hybris_should_trace = 0;
+
+static int
+hybris_logging_initialized = 0;
+
+static void
+hybris_logging_initialize()
+{
+ const char *env = getenv("HYBRIS_LOGGING_LEVEL");
+
+ if (env == NULL) {
+ /* Nothing to do - use default level */
+ } else if (strcmp(env, "debug") == 0) {
+ hybris_minimum_log_level = HYBRIS_LOG_DEBUG;
+ } else if (strcmp(env, "info") == 0) {
+ hybris_minimum_log_level = HYBRIS_LOG_INFO;
+ } else if (strcmp(env, "warn") == 0) {
+ hybris_minimum_log_level = HYBRIS_LOG_WARN;
+ } else if (strcmp(env, "error") == 0) {
+ hybris_minimum_log_level = HYBRIS_LOG_ERROR;
+ } else if (strcmp(env, "disabled") == 0) {
+ hybris_minimum_log_level = HYBRIS_LOG_DISABLED;
+ }
+
+ env = getenv("HYBRIS_LOGGING_TARGET");
+ if (env != NULL)
+ {
+ hybris_logging_target = fopen(env, "a");
+ }
+ if (hybris_logging_target == NULL)
+ hybris_logging_target = stderr;
+
+ env = getenv("HYBRIS_LOGGING_FORMAT");
+ if (env != NULL)
+ {
+ if (strcmp(env, "systrace") == 0) {
+ _hybris_logging_format = HYBRIS_LOG_FORMAT_SYSTRACE;
+ }
+ else
+ _hybris_logging_format = HYBRIS_LOG_FORMAT_NORMAL;
+ }
+
+ env = getenv("HYBRIS_TRACE");
+ if (env != NULL)
+ {
+ if (strcmp(env, "1") == 0) {
+ _hybris_should_trace = 1;
+ }
+ }
+ pthread_mutex_init(&hybris_logging_mutex, NULL);
+}
+
+int
+hybris_should_log(enum hybris_log_level level)
+{
+ /* Initialize logging level from environment */
+ if (!hybris_logging_initialized) {
+ hybris_logging_initialized = 1;
+ hybris_logging_initialize();
+ }
+
+ return (level >= hybris_minimum_log_level);
+}
+
+void
+hybris_set_log_level(enum hybris_log_level level)
+{
+ hybris_minimum_log_level = level;
+}
+
+void *
+hybris_get_thread_id()
+{
+ return (void *)pthread_self();
+}
+
+int
+hybris_should_trace(const char *module, const char *tracepoint)
+{
+ return _hybris_should_trace;
+}
+
+enum hybris_log_format hybris_logging_format()
+{
+ return _hybris_logging_format;
+}
--- /dev/null
+
+/*
+ * Copyright (c) 2013 Thomas Perl <m@thp.io>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef HYBRIS_LOGGING_H
+#define HYBRIS_LOGGING_H
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum hybris_log_level {
+ /* Most verbose logging level */
+ HYBRIS_LOG_DEBUG = 0,
+
+ /* Normal logging levels */
+ HYBRIS_LOG_INFO,
+ HYBRIS_LOG_WARN,
+ HYBRIS_LOG_ERROR,
+
+ /**
+ * "Fake" level at which no messages are logged.
+ * Can be used with hybris_set_log_level().
+ **/
+ HYBRIS_LOG_DISABLED,
+};
+
+enum hybris_log_format {
+ HYBRIS_LOG_FORMAT_NORMAL,
+ HYBRIS_LOG_FORMAT_SYSTRACE
+};
+
+/**
+ * Returns nonzero if messages at level "level" should be logged.
+ * Only used by the HYBRIS_LOG() macro, no need to call it manually.
+ **/
+int
+hybris_should_log(enum hybris_log_level level);
+
+
+/**
+ * Sets the minimum log level that is logged, for example a minimum
+ * log level of HYBRIS_LOG_DEBUG would print all log messages, a
+ * minimum log level of HYBRIS_LOG_WARN would only print warnings and
+ * errors. The default log level is HYBRIS_LOG_WARN.
+ **/
+void
+hybris_set_log_level(enum hybris_log_level level);
+
+void *
+hybris_get_thread_id();
+
+enum hybris_log_format hybris_logging_format();
+
+int hybris_should_trace(const char *module, const char *tracepoint);
+
+extern pthread_mutex_t hybris_logging_mutex;
+
+#ifdef __cplusplus
+}
+#endif
+
+extern FILE *hybris_logging_target;
+
+#if defined(DEBUG)
+# define HYBRIS_LOG_(level, module, message, ...) do { \
+ if (hybris_should_log(level)) { \
+ pthread_mutex_lock(&hybris_logging_mutex); \
+ if (hybris_logging_format() == HYBRIS_LOG_FORMAT_NORMAL) \
+ { \
+ fprintf(hybris_logging_target, "%s %s:%d (%s) %s: " message "\n", \
+ module, __FILE__, __LINE__, __PRETTY_FUNCTION__, \
+ #level + 11 /* + 11 = strip leading "HYBRIS_LOG_" */, \
+ ##__VA_ARGS__); \
+ fflush(hybris_logging_target); \
+ } else if (hybris_logging_format() == HYBRIS_LOG_FORMAT_SYSTRACE) { \
+ fprintf(hybris_logging_target, "B|%i|%s(%s) %s:%d (%s) " message "\n", \
+ getpid(), module, __PRETTY_FUNCTION__, __FILE__, __LINE__, \
+ #level + 11 /* + 11 = strip leading "HYBRIS_LOG_" */, \
+ ##__VA_ARGS__); \
+ fflush(hybris_logging_target); \
+ fprintf(hybris_logging_target, "E|%i|%s(%s) %s:%d (%s) " message "\n", \
+ getpid(), module, __PRETTY_FUNCTION__, __FILE__, __LINE__, \
+ #level + 11 /* + 11 = strip leading "HYBRIS_LOG_" */, \
+ ##__VA_ARGS__); \
+ fflush(hybris_logging_target); \
+ } \
+ pthread_mutex_unlock(&hybris_logging_mutex); \
+ } \
+ } while(0)
+
+#define HYBRIS_TRACE_RECORD(module, what, tracepoint, message, ...) do { \
+ if (hybris_should_trace(module, tracepoint)) { \
+ pthread_mutex_lock(&hybris_logging_mutex); \
+ if (hybris_logging_format() == HYBRIS_LOG_FORMAT_NORMAL) \
+ { \
+ fprintf(hybris_logging_target, "PID: %i Tracepoint-%c/%s::%s" message "\n", \
+ getpid(), what, tracepoint, module, \
+ ##__VA_ARGS__); \
+ fflush(hybris_logging_target); \
+ } else if (hybris_logging_format() == HYBRIS_LOG_FORMAT_SYSTRACE) { \
+ if (what == 'B') \
+ fprintf(hybris_logging_target, "B|%i|%s::%s" message "", \
+ getpid(), tracepoint, module, ##__VA_ARGS__); \
+ else if (what == 'E') \
+ fprintf(hybris_logging_target, "E"); \
+ else \
+ fprintf(hybris_logging_target, "C|%i|%s::%s-%i|" message "", \
+ getpid(), tracepoint, module, getpid(), ##__VA_ARGS__); \
+ fflush(hybris_logging_target); \
+ } \
+ pthread_mutex_unlock(&hybris_logging_mutex); \
+ } \
+ } while(0)
+# define HYBRIS_TRACE_BEGIN(module, tracepoint, message, ...) HYBRIS_TRACE_RECORD(module, 'B', tracepoint, message, ##__VA_ARGS__)
+# define HYBRIS_TRACE_END(module, tracepoint, message, ...) HYBRIS_TRACE_RECORD(module, 'E', tracepoint, message, ##__VA_ARGS__)
+# define HYBRIS_TRACE_COUNTER(module, tracepoint, message, ...) HYBRIS_TRACE_RECORD(module, 'C', tracepoint, message, ##__VA_ARGS__)
+#else
+# define HYBRIS_LOG_(level, module, message, ...) while (0) {}
+# define HYBRIS_TRACE_BEGIN(module, tracepoint, message, ...) while (0) {}
+# define HYBRIS_TRACE_END(module, tracepoint, message, ...) while (0) {}
+# define HYBRIS_TRACE_COUNTER(module, tracepoint, message, ...) while (0) {}
+#endif
+
+
+/* Generic logging functions taking the module name and a message */
+#define HYBRIS_DEBUG_LOG(module, message, ...) HYBRIS_LOG_(HYBRIS_LOG_DEBUG, #module, message, ##__VA_ARGS__)
+#define HYBRIS_WARN_LOG(module, message, ...) HYBRIS_LOG_(HYBRIS_LOG_WARN, #module, message, ##__VA_ARGS__)
+#define HYBRIS_INFO_LOG(module, message, ...) HYBRIS_LOG_(HYBRIS_LOG_INFO, #module, message, ##__VA_ARGS__)
+#define HYBRIS_ERROR_LOG(module, message, ...) HYBRIS_LOG_(HYBRIS_LOG_ERROR, #module, message, ##__VA_ARGS__)
+
+
+/* Module-specific logging functions can be defined like this */
+#define HYBRIS_DEBUG(message, ...) HYBRIS_DEBUG_LOG(HYBRIS, message, ##__VA_ARGS__)
+#define HYBRIS_WARN(message, ...) HYBRIS_WARN_LOG(HYBRIS, message, ##__VA_ARGS__)
+#define HYBRIS_INFO(message, ...) HYBRIS_INFO_LOG(HYBRIS, message, ##__VA_ARGS__)
+#define HYBRIS_ERROR(message, ...) HYBRIS_ERROR_LOG(HYBRIS, message, ##__VA_ARGS__)
+
+/* for compatibility reasons */
+#define TRACE(message, ...) HYBRIS_DEBUG_LOG(EGL, message, ##__VA_ARGS__)
+
+#endif /* HYBRIS_LOGGING_H */
+// vim: noai:ts=4:sw=4:ss=4:expandtab
--- /dev/null
+/* $OpenBSD: strlcpy.c,v 1.11 2006/05/05 15:27:38 millert Exp $ */
+
+/*
+ * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, 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.
+ */
+
+#include <sys/types.h>
+#include <string.h>
+
+/*
+ * Copy src to string dst of size siz. At most siz-1 characters
+ * will be copied. Always NUL terminates (unless siz == 0).
+ * Returns strlen(src); if retval >= siz, truncation occurred.
+ */
+size_t
+strlcpy(char *dst, const char *src, size_t siz)
+{
+ char *d = dst;
+ const char *s = src;
+ size_t n = siz;
+
+ /* Copy as many bytes as will fit */
+ if (n != 0) {
+ while (--n != 0) {
+ if ((*d++ = *s++) == '\0')
+ break;
+ }
+ }
+
+ /* Not enough room in dst, add NUL and traverse rest of src */
+ if (n == 0) {
+ if (siz != 0)
+ *d = '\0'; /* NUL-terminate dst */
+ while (*s++)
+ ;
+ }
+
+ return(s - src - 1); /* count does not include NUL */
+}
--- /dev/null
+AC_INIT([libhybris], [0.1.0])
+AC_CONFIG_SRCDIR([Makefile.am])
+AC_CONFIG_HEADERS(config.h)
+AM_INIT_AUTOMAKE([dist-bzip2 subdir-objects])
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+
+# If library source has changed since last release, increment revision
+# If public symbols have been added, removed or changed since last release,
+# increment current and set revision to 0
+# If public symbols have been added since last release, increment age
+# If public symbols have been removed since last release, set age to 0
+m4_define([hybris_lt_current], [1])
+m4_define([hybris_lt_revision], [0])
+m4_define([hybris_lt_age], [0])
+
+AC_PROG_CC
+AC_PROG_CXX
+AM_PROG_CC_C_O
+AC_GNU_SOURCE
+AC_DISABLE_STATIC
+AC_PROG_LIBTOOL
+
+AC_SUBST(CFLAGS)
+AC_SUBST(CPPFLAGS)
+AC_SUBST(LDFLAGS)
+
+PKG_PROG_PKG_CONFIG
+
+LT_CURRENT=hybris_lt_current
+LT_REVISION=hybris_lt_revision
+LT_AGE=hybris_lt_age
+AC_SUBST([LT_CURRENT])
+AC_SUBST([LT_REVISION])
+AC_SUBST([LT_AGE])
+
+AC_CHECK_LIB(dl, dlopen, dummy=yes, AC_MSG_ERROR(dynamic linking loader is required))
+AC_CHECK_LIB(rt, clock_gettime, dummy=yes, AC_MSG_ERROR(librt is required))
+
+AC_ARG_ENABLE(debug,
+ [ --enable-debug Enable debug build (default=disabled)],
+ [debug=$enableval],
+ [debug="no"])
+AM_CONDITIONAL( [WANT_DEBUG], [test x"$debug" = x"yes"])
+
+AC_ARG_ENABLE(trace,
+ [ --enable-trace Enable TRACE statements (default=disabled)],
+ [trace=$enableval],
+ [trace="no"])
+AM_CONDITIONAL( [WANT_TRACE], [test x"$trace" = x"yes"])
+
+AC_ARG_ENABLE(mesa,
+ [ --enable-mesa Enable mesa headers (default=disabled)],
+ [mesa=$enableval],
+ [mesa="no"])
+AM_CONDITIONAL( [WANT_MESA], [test x"$mesa" = x"yes"])
+
+AC_ARG_ENABLE(wayland,
+ [ --enable-wayland Enable wayland support (default=disabled)],
+ [wayland=$enableval
+ PKG_CHECK_MODULES(WAYLAND_CLIENT, wayland-client,, exit)
+ PKG_CHECK_MODULES(WAYLAND_SERVER, wayland-server,, exit)
+ WAYLAND_PREFIX=`$PKG_CONFIG --variable=prefix wayland-client`
+
+ AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner],, [${WAYLAND_PREFIX}/bin$PATH_SEPARATOR$PATH])
+ AC_DEFINE(WANT_WAYLAND, [], [We want Wayland support])
+],
+ [wayland="no"])
+AM_CONDITIONAL( [WANT_WAYLAND], [test x"$wayland" = x"yes"])
+
+
+AC_ARG_ENABLE(arch,
+ [ --enable-arch[=arch] Compile specific CPU target(default=arm)
+ arm: compile for ARM
+ x86: Compile for x86],
+ [ if test "x$enableval" = "xarm" ; then
+ arch="arm"
+ elif test "x$enableval" = "xx86" ; then
+ arch="x86"
+ else
+ echo
+ echo "Error!"
+ echo "Unknown architecture' type"
+ exit 1
+ fi
+ ],
+ [arch="arm"]
+ )
+AM_CONDITIONAL([WANT_ARCH_ARM], [test x$arch = xarm])
+AM_CONDITIONAL([WANT_ARCH_X86], [test x$arch = xx86])
+
+DEFAULT_EGL_PLATFORM="null"
+AC_ARG_WITH(default-egl-platform,
+ [ --with-default-egl-platform=NAME Use NAME as default EGL platform if not specified by environment ],
+ [ DEFAULT_EGL_PLATFORM="$withval" ],
+ [ ])
+AC_SUBST(DEFAULT_EGL_PLATFORM)
+
+DEFAULT_HYBRIS_LD_LIBRARY_PATH="/vendor/lib:/system/lib"
+AC_ARG_WITH(default-hybris-ld-library-path,
+ [ --with-default-hybris-ld-library-path=PATH1:PATH2:... Use PATH1:PATH2 for default HYBRIS_LD_LIBRARY_PATH if not specified by environment ],
+ [ DEFAULT_HYBRIS_LD_LIBRARY_PATH="$withval" ],
+ [ ])
+AC_SUBST(DEFAULT_HYBRIS_LD_LIBRARY_PATH)
+
+
+android_headers_path=""
+AC_ARG_WITH(android-headers,
+ [ --with-android-headers=DIR Use android headers available in DIR. See utils/extract-headers.sh ],
+ [
+ if [ ! test -e $withval/android-version.h ]; then
+ echo "Error! missing android-version.h in android header path"
+ exit 1
+ fi
+ rm -f include/android
+ ln -sf $withval include/android
+ android_headers_path="$withval"
+
+ # According to http://en.wikipedia.org/wiki/Android_version_history#Version_history_by_API_level
+ android_headers_major=`grep -E "define ANDROID_VERSION_MAJOR " $android_headers_path/android-version.h | sed "s|^\#define ANDROID_VERSION_MAJOR \(.*\)$|\1|g"`
+
+ android_headers_minor=`grep -E "define ANDROID_VERSION_MINOR " $android_headers_path/android-version.h | sed "s|^\#define ANDROID_VERSION_MINOR \(.*\)$|\1|g"`
+
+ android_headers_patch=`grep -E "define ANDROID_VERSION_PATCH " $android_headers_path/android-version.h | sed "s|^\#define ANDROID_VERSION_PATCH \(.*\)$|\1|g"`
+
+ if [ test "x$android_headers_major" = x ]; then
+ echo "Error! Was unable to locate define ANDROID_VERSION_MAJOR in $android_headers_path/android-version.h"
+ fi
+
+ AC_SUBST(ANDROID_VERSION_MAJOR, [$android_headers_major])
+ AC_SUBST(ANDROID_VERSION_MINOR, [$android_headers_minor])
+ AC_SUBST(ANDROID_VERSION_PATCH, [$android_headers_patch])
+
+ echo "Android headers version is $android_headers_major.$android_headers_minor.$android_headers_patch"
+ ],
+ [
+ echo "Error! need to provide path to Android headers --with-android-headers=DIR. See utils/extract-headers.sh"
+ exit 1
+ ]
+ )
+
+# Add automake tests for version/API needs here that you need in code, including test .am's
+
+AM_CONDITIONAL([HAS_ANDROID_4_2_0], [test $android_headers_major -ge 4 -a $android_headers_minor -ge 2 ])
+AM_CONDITIONAL([HAS_ANDROID_4_1_0], [test $android_headers_major -ge 4 -a $android_headers_minor -ge 1 ])
+AM_CONDITIONAL([HAS_ANDROID_4_0_0], [test $android_headers_major -ge 4 -a $android_headers_minor -ge 0 ])
+AM_CONDITIONAL([HAS_ANDROID_2_3_0], [test $android_headers_major -ge 2 -a $android_headers_minor -ge 3 ])
+
+AM_CONDITIONAL([HAS_LIBNFC_NXP_HEADERS], [test -f ${android_headers_path}/libnfc-nxp/phLibNfc.h])
+
+AC_CONFIG_FILES([
+ Makefile
+ properties/Makefile
+ properties/libandroid-properties.pc
+ common/Makefile
+ common/gingerbread/Makefile
+ common/ics/Makefile
+ common/jb/Makefile
+ egl/egl.pc
+ egl/Makefile
+ egl/platforms/Makefile
+ egl/platforms/common/Makefile
+ egl/platforms/common/hybris-egl-platform.pc
+ egl/platforms/null/Makefile
+ egl/platforms/fbdev/Makefile
+ egl/platforms/wayland/Makefile
+ egl/platforms/hwcomposer/Makefile
+ egl/platforms/hwcomposer/hwcomposer-egl.pc
+ glesv1/glesv1_cm.pc
+ glesv1/Makefile
+ glesv2/glesv2.pc
+ glesv2/Makefile
+ hardware/Makefile
+ hardware/libhardware.pc
+ libnfc_nxp/Makefile
+ libnfc_nxp/libnfc_nxp.pc
+ libnfc_ndef_nxp/Makefile
+ libnfc_ndef_nxp/libnfc_ndef_nxp.pc
+ libsync/Makefile
+ libsync/libsync.pc
+ ui/Makefile
+ sf/Makefile
+ sf/libsf.pc
+ input/Makefile
+ input/libis.pc
+ camera/Makefile
+ camera/libcamera.pc
+ include/Makefile
+ utils/Makefile
+ tests/Makefile
+])
+
+AM_COND_IF([WANT_WAYLAND], [AC_CONFIG_FILES([egl/platforms/common/wayland-egl.pc])])
+AC_OUTPUT
+
+echo
+echo "------------------------------------------------------------------------"
+echo "$PACKAGE_NAME $PACKAGE_VERSION"
+echo "------------------------------------------------------------------------"
+echo
+echo "Configuration Options:"
+echo
+echo " debug build.............: $debug"
+echo
+echo " trace...................: $trace"
+echo
+echo " prefix..................: $prefix"
+echo
+echo " arch ..................: $arch"
+echo
+echo " headers path ...........: $android_headers_path"
+echo
+echo " default egl platform ...: $DEFAULT_EGL_PLATFORM"
+echo
+echo " default ld_library_path.: $DEFAULT_HYBRIS_LD_LIBRARY_PATH"
+echo
+echo "------------------------------------------------------------------------"
+echo
+echo "Now type 'make' to compile and 'make install' to install this package."
+
--- /dev/null
+SUBDIRS = platforms
+
+lib_LTLIBRARIES = \
+ libEGL.la
+
+libEGL_la_SOURCES = \
+ egl.c \
+ helper.cpp \
+ ws.c
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = egl.pc
+
+libEGL_la_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/include/android -DPKGLIBDIR="\"$(pkglibdir)/\"" -I$(top_srcdir)/common -DDEFAULT_EGL_PLATFORM="\"@DEFAULT_EGL_PLATFORM@\""
+if WANT_MESA
+libEGL_la_CFLAGS += -DLIBHYBRIS_WANTS_MESA_X11_HEADERS
+endif
+if WANT_TRACE
+libEGL_la_CFLAGS += -DDEBUG
+endif
+if WANT_DEBUG
+libEGL_la_CFLAGS += -ggdb -O0
+endif
+
+libEGL_la_CXXFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/include/android -I$(top_srcdir)/common -DPKGLIBDIR="\"$(pkglibdir)/\""
+if WANT_MESA
+libEGL_la_CXXFLAGS += -DLIBHYBRIS_WANTS_MESA_X11_HEADERS
+endif
+if WANT_TRACE
+libEGL_la_CXXFLAGS += -DDEBUG
+endif
+if WANT_DEBUG
+libEGL_la_CXXFLAGS += -ggdb -O0
+endif
+libEGL_la_LDFLAGS = \
+ -ldl \
+ $(top_builddir)/common/libhybris-common.la \
+ $(top_builddir)/hardware/libhardware.la \
+ -version-info "1":"0":"0"
+
+eglincludedir = $(includedir)/EGL
+eglinclude_HEADERS = \
+ eglhybris.h
+
+wsincludedir = $(includedir)/hybris/eglplatformcommon
+wsinclude_HEADERS = \
+ ws.h
--- /dev/null
+/*
+ * Copyright (c) 2012 Carsten Munk <carsten.munk@gmail.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/* EGL function pointers */
+#define EGL_EGLEXT_PROTOTYPES
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+#include <dlfcn.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <malloc.h>
+#include "ws.h"
+#include "helper.h"
+#include <assert.h>
+
+
+#include <hybris/internal/binding.h>
+#include <string.h>
+
+#include <android/system/window.h>
+#include "logging.h"
+
+static void *_libegl = NULL;
+static void *_libgles = NULL;
+
+static EGLint (*_eglGetError)(void) = NULL;
+
+static EGLDisplay (*_eglGetDisplay)(EGLNativeDisplayType display_id) = NULL;
+static EGLBoolean (*_eglInitialize)(EGLDisplay dpy, EGLint *major, EGLint *minor) = NULL;
+static EGLBoolean (*_eglTerminate)(EGLDisplay dpy) = NULL;
+
+static const char * (*_eglQueryString)(EGLDisplay dpy, EGLint name) = NULL;
+
+static EGLBoolean (*_eglGetConfigs)(EGLDisplay dpy, EGLConfig *configs,
+ EGLint config_size, EGLint *num_config) = NULL;
+static EGLBoolean (*_eglChooseConfig)(EGLDisplay dpy, const EGLint *attrib_list,
+ EGLConfig *configs, EGLint config_size,
+ EGLint *num_config) = NULL;
+static EGLBoolean (*_eglGetConfigAttrib)(EGLDisplay dpy, EGLConfig config,
+ EGLint attribute, EGLint *value) = NULL;
+
+static EGLSurface (*_eglCreateWindowSurface)(EGLDisplay dpy, EGLConfig config,
+ EGLNativeWindowType win,
+ const EGLint *attrib_list) = NULL;
+static EGLSurface (*_eglCreatePbufferSurface)(EGLDisplay dpy, EGLConfig config,
+ const EGLint *attrib_list) = NULL;
+static EGLSurface (*_eglCreatePixmapSurface)(EGLDisplay dpy, EGLConfig config,
+ EGLNativePixmapType pixmap,
+ const EGLint *attrib_list) = NULL;
+static EGLBoolean (*_eglDestroySurface)(EGLDisplay dpy, EGLSurface surface) = NULL;
+static EGLBoolean (*_eglQuerySurface)(EGLDisplay dpy, EGLSurface surface,
+ EGLint attribute, EGLint *value) = NULL;
+
+static EGLBoolean (*_eglBindAPI)(EGLenum api) = NULL;
+static EGLenum (*_eglQueryAPI)(void) = NULL;
+
+static EGLBoolean (*_eglWaitClient)(void) = NULL;
+
+static EGLBoolean (*_eglReleaseThread)(void) = NULL;
+
+static EGLSurface (*_eglCreatePbufferFromClientBuffer)(
+ EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
+ EGLConfig config, const EGLint *attrib_list) = NULL;
+
+static EGLBoolean (*_eglSurfaceAttrib)(EGLDisplay dpy, EGLSurface surface,
+ EGLint attribute, EGLint value) = NULL;
+static EGLBoolean (*_eglBindTexImage)(EGLDisplay dpy, EGLSurface surface, EGLint buffer) = NULL;
+static EGLBoolean (*_eglReleaseTexImage)(EGLDisplay dpy, EGLSurface surface, EGLint buffer) = NULL;
+
+
+static EGLBoolean (*_eglSwapInterval)(EGLDisplay dpy, EGLint interval) = NULL;
+
+
+static EGLContext (*_eglCreateContext)(EGLDisplay dpy, EGLConfig config,
+ EGLContext share_context,
+ const EGLint *attrib_list) = NULL;
+static EGLBoolean (*_eglDestroyContext)(EGLDisplay dpy, EGLContext ctx) = NULL;
+static EGLBoolean (*_eglMakeCurrent)(EGLDisplay dpy, EGLSurface draw,
+ EGLSurface read, EGLContext ctx) = NULL;
+
+static EGLContext (*_eglGetCurrentContext)(void) = NULL;
+static EGLSurface (*_eglGetCurrentSurface)(EGLint readdraw) = NULL;
+static EGLDisplay (*_eglGetCurrentDisplay)(void) = NULL;
+static EGLBoolean (*_eglQueryContext)(EGLDisplay dpy, EGLContext ctx,
+ EGLint attribute, EGLint *value) = NULL;
+
+static EGLBoolean (*_eglWaitGL)(void) = NULL;
+static EGLBoolean (*_eglWaitNative)(EGLint engine) = NULL;
+static EGLBoolean (*_eglSwapBuffers)(EGLDisplay dpy, EGLSurface surface) = NULL;
+static EGLBoolean (*_eglCopyBuffers)(EGLDisplay dpy, EGLSurface surface,
+ EGLNativePixmapType target) = NULL;
+
+
+static EGLImageKHR (*_eglCreateImageKHR)(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list) = NULL;
+static EGLBoolean (*_eglDestroyImageKHR) (EGLDisplay dpy, EGLImageKHR image) = NULL;
+
+static void (*_glEGLImageTargetTexture2DOES) (GLenum target, GLeglImageOES image) = NULL;
+
+static __eglMustCastToProperFunctionPointerType (*_eglGetProcAddress)(const char *procname) = NULL;
+
+static void _init_androidegl()
+{
+ _libegl = (void *) android_dlopen(getenv("LIBEGL") ? getenv("LIBEGL") : "libEGL.so", RTLD_LAZY);
+ _libgles = (void *) android_dlopen(getenv("LIBGLESV2") ? getenv("LIBGLESV2") : "libGLESv2.so", RTLD_LAZY);
+}
+
+#define EGL_DLSYM(fptr, sym) do { if (_libegl == NULL) { _init_androidegl(); }; if (*(fptr) == NULL) { *(fptr) = (void *) android_dlsym(_libegl, sym); } } while (0)
+#define GLESv2_DLSYM(fptr, sym) do { if (_libgles == NULL) { _init_androidegl(); }; if (*(fptr) == NULL) { *(fptr) = (void *) android_dlsym(_libgles, sym); } } while (0)
+
+EGLint eglGetError(void)
+{
+ EGL_DLSYM(&_eglGetError, "eglGetError");
+ return (*_eglGetError)();
+}
+
+struct _eglDisplayMapping {
+ EGLNativeDisplayType ndt;
+ EGLDisplay display;
+};
+
+#define _EGL_MAX_DISPLAYS 100
+
+struct _eglDisplayMapping *_displayMappings[_EGL_MAX_DISPLAYS];
+
+void _addMapping(EGLNativeDisplayType display_id, EGLDisplay display)
+{
+ int i;
+ for (i = 0; i < _EGL_MAX_DISPLAYS; i++)
+ {
+ if (_displayMappings[i] == NULL)
+ {
+ _displayMappings[i] = (struct _eglDisplayMapping *) malloc(sizeof(struct _eglDisplayMapping));
+ _displayMappings[i]->ndt = display_id;
+ _displayMappings[i]->display = display;
+ return;
+ }
+ }
+}
+
+EGLNativeDisplayType _egldisplay2NDT(EGLDisplay display)
+{
+ int i;
+ for (i = 0; i < _EGL_MAX_DISPLAYS; i++)
+ {
+ if (_displayMappings[i])
+ {
+ if (_displayMappings[i]->display == display)
+ {
+ return _displayMappings[i]->ndt;
+ }
+
+ }
+ }
+ return EGL_NO_DISPLAY;
+}
+
+EGLDisplay eglGetDisplay(EGLNativeDisplayType display_id)
+{
+ EGL_DLSYM(&_eglGetDisplay, "eglGetDisplay");
+ EGLNativeDisplayType real_display;
+
+ if (!ws_IsValidDisplay(display_id))
+ {
+ return EGL_NO_DISPLAY;
+ }
+
+ real_display = (*_eglGetDisplay)(EGL_DEFAULT_DISPLAY);
+ if (real_display == EGL_NO_DISPLAY)
+ {
+ return EGL_NO_DISPLAY;
+ }
+ _addMapping(display_id, real_display);
+ return real_display;
+}
+
+EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
+{
+ EGL_DLSYM(&_eglInitialize, "eglInitialize");
+ return (*_eglInitialize)(dpy, major, minor);
+}
+
+EGLBoolean eglTerminate(EGLDisplay dpy)
+{
+ EGL_DLSYM(&_eglTerminate, "eglTerminate");
+ return (*_eglTerminate)(dpy);
+}
+
+const char * eglQueryString(EGLDisplay dpy, EGLint name)
+{
+ EGL_DLSYM(&_eglQueryString, "eglQueryString");
+ return ws_eglQueryString(dpy, name, _eglQueryString);
+}
+
+EGLBoolean eglGetConfigs(EGLDisplay dpy, EGLConfig *configs,
+ EGLint config_size, EGLint *num_config)
+{
+ EGL_DLSYM(&_eglGetConfigs, "eglGetConfigs");
+ return (*_eglGetConfigs)(dpy, configs, config_size, num_config);
+}
+
+EGLBoolean eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list,
+ EGLConfig *configs, EGLint config_size,
+ EGLint *num_config)
+{
+ EGL_DLSYM(&_eglChooseConfig, "eglChooseConfig");
+ return (*_eglChooseConfig)(dpy, attrib_list,
+ configs, config_size,
+ num_config);
+}
+
+EGLBoolean eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config,
+ EGLint attribute, EGLint *value)
+{
+ EGL_DLSYM(&_eglGetConfigAttrib, "eglGetConfigAttrib");
+ return (*_eglGetConfigAttrib)(dpy, config,
+ attribute, value);
+}
+
+EGLSurface eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
+ EGLNativeWindowType win,
+ const EGLint *attrib_list)
+{
+ EGL_DLSYM(&_eglCreateWindowSurface, "eglCreateWindowSurface");
+
+ win = ws_CreateWindow(win, _egldisplay2NDT(dpy));
+
+ assert(((struct ANativeWindowBuffer *) win)->common.magic == ANDROID_NATIVE_WINDOW_MAGIC);
+
+ EGLSurface result = (*_eglCreateWindowSurface)(dpy, config, win, attrib_list);
+ egl_helper_push_mapping(result, win);
+ return result;
+}
+
+EGLSurface eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config,
+ const EGLint *attrib_list)
+{
+ EGL_DLSYM(&_eglCreatePbufferSurface, "eglCreatePbufferSurface");
+ return (*_eglCreatePbufferSurface)(dpy, config, attrib_list);
+}
+
+EGLSurface eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
+ EGLNativePixmapType pixmap,
+ const EGLint *attrib_list)
+{
+ EGL_DLSYM(&_eglCreatePixmapSurface, "eglCreatePixmapSurface");
+ return (*_eglCreatePixmapSurface)(dpy, config, pixmap, attrib_list);
+}
+
+EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
+{
+ EGL_DLSYM(&_eglDestroySurface, "eglDestroySurface");
+ EGLBoolean result = (*_eglDestroySurface)(dpy, surface);
+
+ /**
+ * If the surface was created via eglCreateWindowSurface, we must
+ * notify the ws about surface destruction for clean-up.
+ **/
+ if (egl_helper_has_mapping(surface)) {
+ ws_DestroyWindow(egl_helper_pop_mapping(surface));
+ }
+
+ return result;
+}
+
+EGLBoolean eglQuerySurface(EGLDisplay dpy, EGLSurface surface,
+ EGLint attribute, EGLint *value)
+{
+ EGL_DLSYM(&_eglQuerySurface, "eglQuerySurface");
+ return (*_eglQuerySurface)(dpy, surface, attribute, value);
+}
+
+
+EGLBoolean eglBindAPI(EGLenum api)
+{
+ EGL_DLSYM(&_eglBindAPI, "eglBindAPI");
+ return (*_eglBindAPI)(api);
+}
+
+EGLenum eglQueryAPI(void)
+{
+ EGL_DLSYM(&_eglQueryAPI, "eglQueryAPI");
+ return (*_eglQueryAPI)();
+}
+
+EGLBoolean eglWaitClient(void)
+{
+ EGL_DLSYM(&_eglWaitClient, "eglWaitClient");
+ return (*_eglWaitClient)();
+}
+
+EGLBoolean eglReleaseThread(void)
+{
+ EGL_DLSYM(&_eglReleaseThread, "eglReleaseThread");
+ return (*_eglReleaseThread)();
+}
+
+EGLSurface eglCreatePbufferFromClientBuffer(
+ EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
+ EGLConfig config, const EGLint *attrib_list)
+{
+ EGL_DLSYM(&_eglCreatePbufferFromClientBuffer, "eglCreatePbufferFromClientBuffer");
+ return (*_eglCreatePbufferFromClientBuffer)(dpy, buftype, buffer, config, attrib_list);
+}
+
+EGLBoolean eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface,
+ EGLint attribute, EGLint value)
+{
+ EGL_DLSYM(&_eglSurfaceAttrib, "eglSurfaceAttrib");
+ return (*_eglSurfaceAttrib)(dpy, surface, attribute, value);
+}
+
+EGLBoolean eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
+{
+ EGL_DLSYM(&_eglBindTexImage, "eglBindTexImage");
+ return (*_eglBindTexImage)(dpy, surface, buffer);
+}
+
+EGLBoolean eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
+{
+ EGL_DLSYM(&_eglReleaseTexImage, "eglReleaseTexImage");
+ return (*_eglReleaseTexImage)(dpy, surface, buffer);
+}
+
+EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval)
+{
+ EGL_DLSYM(&_eglSwapInterval, "eglSwapInterval");
+ return (*_eglSwapInterval)(dpy, interval);
+}
+
+EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config,
+ EGLContext share_context,
+ const EGLint *attrib_list)
+{
+ EGL_DLSYM(&_eglCreateContext, "eglCreateContext");
+ return (*_eglCreateContext)(dpy, config, share_context, attrib_list);
+}
+
+EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
+{
+ EGL_DLSYM(&_eglDestroyContext, "eglDestroyContext");
+ return (*_eglDestroyContext)(dpy, ctx);
+}
+
+EGLBoolean eglMakeCurrent(EGLDisplay dpy, EGLSurface draw,
+ EGLSurface read, EGLContext ctx)
+{
+ EGL_DLSYM(&_eglMakeCurrent, "eglMakeCurrent");
+ return (*_eglMakeCurrent)(dpy, draw, read, ctx);
+}
+
+EGLContext eglGetCurrentContext(void)
+{
+ EGL_DLSYM(&_eglGetCurrentContext, "eglGetCurrentContext");
+ return (*_eglGetCurrentContext)();
+}
+
+EGLSurface eglGetCurrentSurface(EGLint readdraw)
+{
+ EGL_DLSYM(&_eglGetCurrentSurface, "eglGetCurrentSurface");
+ return (*_eglGetCurrentSurface)(readdraw);
+}
+
+EGLDisplay eglGetCurrentDisplay(void)
+{
+ EGL_DLSYM(&_eglGetCurrentDisplay, "eglGetCurrentDisplay");
+ return (*_eglGetCurrentDisplay)();
+}
+
+EGLBoolean eglQueryContext(EGLDisplay dpy, EGLContext ctx,
+ EGLint attribute, EGLint *value)
+{
+ EGL_DLSYM(&_eglQueryContext, "eglQueryContext");
+ return (*_eglQueryContext)(dpy, ctx, attribute, value);
+}
+
+EGLBoolean eglWaitGL(void)
+{
+ EGL_DLSYM(&_eglWaitGL, "eglWaitGL");
+ return (*_eglWaitGL)();
+}
+
+EGLBoolean eglWaitNative(EGLint engine)
+{
+ EGL_DLSYM(&_eglWaitNative, "eglWaitNative");
+ return (*_eglWaitNative)(engine);
+}
+
+EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
+{
+ EGLBoolean ret;
+ HYBRIS_TRACE_BEGIN("hybris-egl", "eglSwapBuffers", "");
+ EGL_DLSYM(&_eglSwapBuffers, "eglSwapBuffers");
+ ret = (*_eglSwapBuffers)(dpy, surface);
+ HYBRIS_TRACE_END("hybris-egl", "eglSwapBuffers", "");
+ return ret;
+}
+
+EGLBoolean eglCopyBuffers(EGLDisplay dpy, EGLSurface surface,
+ EGLNativePixmapType target)
+{
+ EGL_DLSYM(&_eglCopyBuffers, "eglCopyBuffers");
+ return (*_eglCopyBuffers)(dpy, surface, target);
+}
+
+static EGLImageKHR _my_eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list)
+{
+ EGL_DLSYM(&_eglCreateImageKHR, "eglCreateImageKHR");
+ EGLContext newctx = ctx;
+ EGLenum newtarget = target;
+ EGLClientBuffer newbuffer = buffer;
+ const EGLint *newattrib_list = attrib_list;
+
+ ws_passthroughImageKHR(&newctx, &newtarget, &newbuffer, &newattrib_list);
+ return (*_eglCreateImageKHR)(dpy, newctx, newtarget, newbuffer, newattrib_list);
+}
+
+static void _my_glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
+{
+ GLESv2_DLSYM(&_glEGLImageTargetTexture2DOES, "glEGLImageTargetTexture2DOES");
+ (*_glEGLImageTargetTexture2DOES)(target, image);
+ return;
+}
+
+__eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname)
+{
+ EGL_DLSYM(&_eglGetProcAddress, "eglGetProcAddress");
+ if (strcmp(procname, "eglCreateImageKHR") == 0)
+ {
+ return _my_eglCreateImageKHR;
+ }
+ else if (strcmp(procname, "glEGLImageTargetTexture2DOES") == 0)
+ {
+ return _my_glEGLImageTargetTexture2DOES;
+ }
+ __eglMustCastToProperFunctionPointerType ret = ws_eglGetProcAddress(procname);
+ if (ret == NULL)
+ return (*_eglGetProcAddress)(procname);
+ else return ret;
+}
+
+EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)
+{
+ EGL_DLSYM(&_eglDestroyImageKHR, "eglDestroyImageKHR");
+ return (*_eglDestroyImageKHR)(dpy, image);
+}
+
+
+// vim:ts=4:sw=4:noexpandtab
--- /dev/null
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=@includedir@
+
+Name: egl
+Description: libhybris EGL library
+# Set to 7.10 because some package like weston are usually built
+# against mesa and because of that expect certain version from egl.
+Version: 7.10
+Libs: -L${libdir} -lEGL
+Cflags: -I${includedir}
--- /dev/null
+/*
+ * Copyright (c) 2012 Simon Busch <morphis@gravedo.de>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef EGL_HYBRIS_H_
+#define EGL_HYBRIS_H_
+
+#include <android/hardware/gralloc.h>
+/* Needed for ICS window.h */
+#include <string.h>
+#include <android/system/window.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int hybris_register_buffer_handle(buffer_handle_t handle);
+int hybris_unregister_buffer_handle(buffer_handle_t handle);
+void hybris_dump_buffer_to_file(struct ANativeWindowBuffer *buf);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null
+
+/*
+ * Copyright (c) 2013 Jolla Ltd.
+ * Contact: Thomas Perl <thomas.perl@jollamobile.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+#include "helper.h"
+
+#include <assert.h>
+#include <map>
+
+
+/* Keep track of active EGL window surfaces */
+static std::map<EGLSurface,EGLNativeWindowType> _surface_window_map;
+
+
+void egl_helper_push_mapping(EGLSurface surface, EGLNativeWindowType window)
+{
+ assert(!egl_helper_has_mapping(surface));
+
+ _surface_window_map[surface] = window;
+}
+
+int egl_helper_has_mapping(EGLSurface surface)
+{
+ return (_surface_window_map.find(surface) != _surface_window_map.end());
+}
+
+EGLNativeWindowType egl_helper_pop_mapping(EGLSurface surface)
+{
+ std::map<EGLSurface,EGLNativeWindowType>::iterator it;
+ it = _surface_window_map.find(surface);
+
+ /* Caller must check with egl_helper_has_mapping() before */
+ assert(it != _surface_window_map.end());
+
+ EGLNativeWindowType result = it->second;
+ _surface_window_map.erase(it);
+ return result;
+}
--- /dev/null
+
+/*
+ * Copyright (c) 2013 Jolla Ltd.
+ * Contact: Thomas Perl <thomas.perl@jollamobile.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+#ifndef LIBHYBRIS_EGL_HELPER_H
+#define LIBHYBRIS_EGL_HELPER_H
+
+
+#include <EGL/egl.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Add new mapping from surface to window */
+void egl_helper_push_mapping(EGLSurface surface, EGLNativeWindowType window);
+
+/* Check if a mapping for a surface exist */
+int egl_helper_has_mapping(EGLSurface surface);
+
+/* Return and remove the mapping for a surface */
+EGLNativeWindowType egl_helper_pop_mapping(EGLSurface surface);
+
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /* LIBHYBRIS_EGL_HELPER_H */
--- /dev/null
+
+SUBDIRS = common null fbdev
+if HAS_ANDROID_4_2_0
+SUBDIRS += hwcomposer
+endif
+
+if WANT_WAYLAND
+SUBDIRS += wayland
+endif
+
+
--- /dev/null
+lib_LTLIBRARIES = \
+ libhybris-eglplatformcommon.la
+
+libhybris_eglplatformcommon_la_SOURCES = \
+ native_handle.c \
+ nativewindowbase.cpp \
+ eglplatformcommon.cpp \
+ windowbuffer.cpp
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = hybris-egl-platform.pc
+
+if WANT_WAYLAND
+lib_LTLIBRARIES += libwayland-egl.la
+
+pkgconfig_DATA += wayland-egl.pc
+
+
+libhybris_eglplatformcommon_la_SOURCES += \
+ server_wlegl.cpp \
+ server_wlegl_handle.cpp \
+ server_wlegl_buffer.cpp \
+ wayland-android-protocol.c
+
+BUILT_SOURCES = wayland-android-protocol.c \
+ wayland-android-client-protocol.h \
+ wayland-android-server-protocol.h
+
+%-protocol.c : %.xml
+ $(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@
+
+%-server-protocol.h : %.xml
+ $(AM_V_GEN)$(WAYLAND_SCANNER) server-header < $< > $@
+
+%-client-protocol.h : %.xml
+ $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
+
+libwayland_egl_la_SOURCES = wayland-egl.c
+
+libwayland_egl_la_CFLAGS = -I. -I$(top_srcdir)/include -I$(top_srcdir)/include/android $(WAYLAND_CLIENT_CFLAGS) $(WAYLAND_SERVER_CFLAGS)
+if WANT_TRACE
+libwayland_egl_la_CFLAGS += -DDEBUG
+endif
+if WANT_DEBUG
+libwayland_egl_la_CFLAGS += -ggdb -O0
+endif
+
+libwayland_egl_la_CXXFLAGS = -I. -I$(top_srcdir)/include -I$(top_srcdir)/include/android $(WAYLAND_CLIENT_CFLAGS) $(WAYLAND_SERVER_CFLAGS)
+if WANT_TRACE
+libwayland_egl_la_CXXFLAGS += -DDEBUG
+endif
+if WANT_DEBUG
+libwayland_egl_la_CXXFLAGS += -ggdb -O0
+endif
+libwayland_egl_la_LDFLAGS = \
+ -version-info "1":"0"
+
+endif
+
+libhybris_eglplatformcommon_la_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/include/android -I$(top_srcdir)/egl -I$(top_srcdir)/common/
+if WANT_WAYLAND
+libhybris_eglplatformcommon_la_CFLAGS += $(WAYLAND_CLIENT_CFLAGS) $(WAYLAND_SERVER_CFLAGS) -I$(top_srcdir)/include/android
+endif
+
+if WANT_MESA
+libhybris_eglplatformcommon_la_CFLAGS += -DLIBHYBRIS_WANTS_MESA_X11_HEADERS
+endif
+if WANT_TRACE
+libhybris_eglplatformcommon_la_CFLAGS += -DDEBUG
+endif
+if WANT_DEBUG
+libhybris_eglplatformcommon_la_CFLAGS += -ggdb -O0
+endif
+
+
+libhybris_eglplatformcommon_la_CXXFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/egl -I$(top_srcdir)/include/android -I$(top_srcdir)/common/
+if WANT_MESA
+libhybris_eglplatformcommon_la_CXXFLAGS += -DLIBHYBRIS_WANTS_MESA_X11_HEADERS
+endif
+
+if WANT_WAYLAND
+libhybris_eglplatformcommon_la_CXXFLAGS += $(WAYLAND_CLIENT_CFLAGS) $(WAYLAND_SERVER_CFLAGS) -I$(top_srcdir)/include/android
+endif
+
+if WANT_TRACE
+libhybris_eglplatformcommon_la_CXXFLAGS += -DDEBUG
+endif
+if WANT_DEBUG
+libhybris_eglplatformcommon_la_CXXFLAGS += -ggdb -O0
+endif
+libhybris_eglplatformcommon_la_LDFLAGS = \
+ $(top_builddir)/common/libhybris-common.la \
+ -version-info "1":"0":"0"
+
+eglplatformcommondir = $(includedir)/hybris/eglplatformcommon
+eglplatformcommon_HEADERS = \
+ support.h \
+ nativewindowbase.h \
+ eglplatformcommon.h \
+ hybris_nativebufferext.h
+
+if WANT_WAYLAND
+libhybris_eglplatformcommon_la_LDFLAGS += \
+ $(WAYLAND_CLIENT_LIBS) \
+ $(WAYLAND_SERVER_LIBS)
+endif
--- /dev/null
+#include <ws.h>
+#include <stdlib.h>
+#include <dlfcn.h>
+#include <string.h>
+#include <android/hardware/gralloc.h>
+#include <stdio.h>
+#include <assert.h>
+#include "config.h"
+#include <time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include "logging.h"
+
+#ifdef WANT_WAYLAND
+#include <wayland-client.h>
+#include "server_wlegl.h"
+#include "server_wlegl_buffer.h"
+#endif
+
+#include "windowbuffer.h"
+
+static gralloc_module_t *my_gralloc = 0;
+static alloc_device_t *my_alloc = 0;
+
+extern "C" void eglplatformcommon_init(gralloc_module_t *gralloc, alloc_device_t *allocdevice)
+{
+ my_gralloc = gralloc;
+ my_alloc = allocdevice;
+}
+
+extern "C" int hybris_register_buffer_handle(buffer_handle_t handle)
+{
+ if (!my_gralloc)
+ return -1;
+
+ return my_gralloc->registerBuffer(my_gralloc, handle);
+}
+
+extern "C" int hybris_unregister_buffer_handle(buffer_handle_t handle)
+{
+ if (!my_gralloc)
+ return -1;
+
+ return my_gralloc->unregisterBuffer(my_gralloc, handle);
+}
+
+extern "C" void hybris_dump_buffer_to_file(ANativeWindowBuffer *buf)
+{
+ static int cnt = 0;
+ void *vaddr;
+ int ret = my_gralloc->lock(my_gralloc, buf->handle, buf->usage, 0, 0, buf->width, buf->height, &vaddr);
+ TRACE("buf:%p gralloc lock returns %i", buf, ret);
+ TRACE("buf:%p lock to vaddr %p", buf, vaddr);
+ char b[1024];
+ int bytes_pp = 0;
+
+ if (buf->format == HAL_PIXEL_FORMAT_RGBA_8888)
+ bytes_pp = 4;
+ else if (buf->format == HAL_PIXEL_FORMAT_RGB_565)
+ bytes_pp = 2;
+
+ snprintf(b, 1020, "vaddr.%p.%p.%i.%is%ix%ix%i", buf, vaddr, cnt, buf->width, buf->stride, buf->height, bytes_pp);
+ cnt++;
+ int fd = ::open(b, O_WRONLY|O_CREAT, S_IRWXU);
+
+ ::write(fd, vaddr, buf->stride * buf->height * bytes_pp);
+ ::close(fd);
+ my_gralloc->unlock(my_gralloc, buf->handle);
+}
+
+#ifdef WANT_WAYLAND
+
+extern "C" EGLBoolean eglplatformcommon_eglBindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display)
+{
+ assert(my_gralloc != NULL);
+ server_wlegl_create(display, my_gralloc);
+ return EGL_TRUE;
+}
+
+extern "C" EGLBoolean eglplatformcommon_eglUnbindWaylandDisplayWL(EGLDisplay dpy, struct wl_display *display)
+{
+ return EGL_TRUE;
+}
+
+extern "C" EGLBoolean eglplatformcommon_eglQueryWaylandBufferWL(EGLDisplay dpy,
+ struct wl_buffer *buffer, EGLint attribute, EGLint *value)
+{
+ server_wlegl_buffer *buf = server_wlegl_buffer_from(buffer);
+ ANativeWindowBuffer* anwb = (ANativeWindowBuffer *) buf->buf;
+
+ if (attribute == EGL_TEXTURE_FORMAT) {
+ switch(anwb->format) {
+ case HAL_PIXEL_FORMAT_RGB_565:
+ *value = EGL_TEXTURE_RGB;
+ break;
+ case HAL_PIXEL_FORMAT_RGBA_8888:
+ *value = EGL_TEXTURE_RGBA;
+ break;
+ default:
+ *value = EGL_TEXTURE_EXTERNAL_WL;
+ }
+ return EGL_TRUE;
+ }
+ if (attribute == EGL_WIDTH) {
+ *value = anwb->width;
+ return EGL_TRUE;
+ }
+ if (attribute == EGL_HEIGHT) {
+ *value = anwb->height;
+ return EGL_TRUE;
+ }
+ return EGL_FALSE ;
+}
+
+#endif
+
+extern "C" EGLBoolean eglplatformcommon_eglHybrisCreateNativeBuffer(EGLint width, EGLint height, EGLint usage, EGLint format, EGLint *stride, EGLClientBuffer *buffer)
+{
+ int ret;
+ buffer_handle_t _handle;
+ int _stride;
+
+ assert(my_gralloc != NULL);
+ assert(my_alloc != NULL);
+
+ ret = my_alloc->alloc(my_alloc, width, height, format, usage, &_handle, &_stride);
+
+ if (ret == 0)
+ {
+ RemoteWindowBuffer *buf = new RemoteWindowBuffer(width, height, _stride, format, usage, _handle, my_gralloc);
+ buf->common.incRef(&buf->common);
+ *buffer = (EGLClientBuffer) static_cast<ANativeWindowBuffer *>(buf);
+ *stride = _stride;
+ return EGL_TRUE;
+ }
+ else
+ return EGL_FALSE;
+}
+
+extern "C" EGLBoolean eglplatformcommon_eglHybrisLockNativeBuffer(EGLClientBuffer buffer, EGLint usage, EGLint l, EGLint t, EGLint w, EGLint h, void **vaddr)
+{
+ int ret;
+ RemoteWindowBuffer *buf = static_cast<RemoteWindowBuffer *>((ANativeWindowBuffer *) buffer);
+
+ assert(my_gralloc != NULL);
+
+ ret = my_gralloc->lock(my_gralloc, buf->handle, usage, l, t, w, h, vaddr);
+ if (ret == 0)
+ return EGL_TRUE;
+ else
+ return EGL_FALSE;
+}
+
+extern "C" EGLBoolean eglplatformcommon_eglHybrisUnlockNativeBuffer(EGLClientBuffer buffer)
+{
+ int ret;
+ RemoteWindowBuffer *buf = static_cast<RemoteWindowBuffer *>((ANativeWindowBuffer *) buffer);
+
+ assert(my_gralloc != NULL);
+
+ ret = my_gralloc->unlock(my_gralloc, buf->handle);
+ if (ret == 0)
+ return EGL_TRUE;
+ else
+ return EGL_FALSE;
+}
+
+
+extern "C" EGLBoolean eglplatformcommon_eglHybrisReleaseNativeBuffer(EGLClientBuffer buffer)
+{
+ RemoteWindowBuffer *buf = static_cast<RemoteWindowBuffer *>((ANativeWindowBuffer *) buffer);
+
+ buf->common.decRef(&buf->common);
+ return EGL_TRUE;
+}
+
+
+
+extern "C" void
+eglplatformcommon_passthroughImageKHR(EGLContext *ctx, EGLenum *target, EGLClientBuffer *buffer, const EGLint **attrib_list)
+{
+#ifdef WANT_WAYLAND
+ static int debugenvchecked = 0;
+ if (*target == EGL_WAYLAND_BUFFER_WL)
+ {
+ server_wlegl_buffer *buf = server_wlegl_buffer_from((struct wl_buffer *)*buffer);
+ HYBRIS_TRACE_BEGIN("eglplatformcommon", "Wayland_eglImageKHR", "-resource@%i", ((struct wl_buffer *)*buffer)->resource.object.id);
+ HYBRIS_TRACE_END("eglplatformcommon", "Wayland_eglImageKHR", "-resource@%i", ((struct wl_buffer *)*buffer)->resource.object.id);
+ if (debugenvchecked == 0)
+ {
+ if (getenv("HYBRIS_WAYLAND_KHR_DUMP_BUFFERS") != NULL)
+ debugenvchecked = 2;
+ else
+ debugenvchecked = 1;
+ } else if (debugenvchecked == 2)
+ {
+ hybris_dump_buffer_to_file((ANativeWindowBuffer *) buf->buf);
+ }
+ *buffer = (EGLClientBuffer) (ANativeWindowBuffer *) buf->buf;
+ *target = EGL_NATIVE_BUFFER_ANDROID;
+ *ctx = EGL_NO_CONTEXT;
+ *attrib_list = NULL;
+ }
+#endif
+}
+
+extern "C" __eglMustCastToProperFunctionPointerType eglplatformcommon_eglGetProcAddress(const char *procname)
+{
+#ifdef WANT_WAYLAND
+ if (strcmp(procname, "eglBindWaylandDisplayWL") == 0)
+ {
+ return (__eglMustCastToProperFunctionPointerType)eglplatformcommon_eglBindWaylandDisplayWL;
+ }
+ else
+ if (strcmp(procname, "eglUnbindWaylandDisplayWL") == 0)
+ {
+ return (__eglMustCastToProperFunctionPointerType)eglplatformcommon_eglUnbindWaylandDisplayWL;
+ }else
+ if (strcmp(procname, "eglQueryWaylandBufferWL") == 0)
+ {
+ return (__eglMustCastToProperFunctionPointerType)eglplatformcommon_eglQueryWaylandBufferWL;
+ }
+ else
+#endif
+ if (strcmp(procname, "eglHybrisCreateNativeBuffer") == 0)
+ {
+ return (__eglMustCastToProperFunctionPointerType)eglplatformcommon_eglHybrisCreateNativeBuffer;
+ }
+ else
+ if (strcmp(procname, "eglHybrisLockNativeBuffer") == 0)
+ {
+ return (__eglMustCastToProperFunctionPointerType)eglplatformcommon_eglHybrisLockNativeBuffer;
+ }
+ else
+ if (strcmp(procname, "eglHybrisUnlockNativeBuffer") == 0)
+ {
+ return (__eglMustCastToProperFunctionPointerType)eglplatformcommon_eglHybrisUnlockNativeBuffer;
+ }
+ else
+ if (strcmp(procname, "eglHybrisReleaseNativeBuffer") == 0)
+ {
+ return (__eglMustCastToProperFunctionPointerType)eglplatformcommon_eglHybrisReleaseNativeBuffer;
+ }
+ return NULL;
+}
+
+extern "C" const char *eglplatformcommon_eglQueryString(EGLDisplay dpy, EGLint name, const char *(*real_eglQueryString)(EGLDisplay dpy, EGLint name))
+{
+#ifdef WANT_WAYLAND
+ if (name == EGL_EXTENSIONS)
+ {
+ const char *ret = (*real_eglQueryString)(dpy, name);
+ static char eglextensionsbuf[512];
+ assert(ret != NULL);
+ snprintf(eglextensionsbuf, 510, "%sEGL_HYBRIS_native_buffer %s", ret,
+#ifdef WANT_WAYLAND
+ "EGL_WL_bind_wayland_display "
+#else
+ ""
+#endif
+ );
+ ret = eglextensionsbuf;
+ return ret;
+ }
+#endif
+ return (*real_eglQueryString)(dpy, name);
+}
--- /dev/null
+#ifndef __EGLPLATFORMCOMMON_H
+#define __EGLPLATFORMCOMMON_H
+#include <string.h>
+#include <android/hardware/gralloc.h>
+#include <EGL/egl.h>
+
+void eglplatformcommon_init(gralloc_module_t *gralloc, alloc_device_t *allocdevice);
+__eglMustCastToProperFunctionPointerType eglplatformcommon_eglGetProcAddress(const char *procname);
+void eglplatformcommon_passthroughImageKHR(EGLContext *ctx, EGLenum *target, EGLClientBuffer *buffer, const EGLint **attrib_list);
+const char *eglplatformcommon_eglQueryString(EGLDisplay dpy, EGLint name, const char *(*real_eglQueryString)(EGLDisplay dpy, EGLint name));
+#endif
--- /dev/null
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=@includedir@
+
+Name: hybris-egl-platform
+Description: libhybris EGL platform library
+Version: @VERSION@
+Requires: android-headers
+Libs: -L${libdir} -lhybris-common -lhybris-eglplatformcommon
+Cflags: -I${includedir} -I${includedir}/hybris/eglplatformcommon
+
--- /dev/null
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2013 Jolla Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef EGL_HYBRIS_native_buffer
+#define EGL_HYBRIS_native_buffer 1
+
+#define EGL_NATIVE_BUFFER_HYBRIS 0x3140
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLHYBRISCREATENATIVEBUFFERPROC)(EGLint width, EGLint height, EGLint usage, EGLint format, EGLint *stride, EGLClientBuffer *buffer);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLHYBRISLOCKNATIVEBUFFERPROC)(EGLClientBuffer buffer, EGLint usage, EGLint l, EGLint t, EGLint w, EGLint h, void **vaddr);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLHYBRISUNLOCKNATIVEBUFFERPROC)(EGLClientBuffer buffer);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLHYBRISRELEASENATIVEBUFFERPROC)(EGLClientBuffer buffer);
+
+enum {
+ /* buffer is never read in software */
+ HYBRIS_USAGE_SW_READ_NEVER = 0x00000000,
+ /* buffer is rarely read in software */
+ HYBRIS_USAGE_SW_READ_RARELY = 0x00000002,
+ /* buffer is often read in software */
+ HYBRIS_USAGE_SW_READ_OFTEN = 0x00000003,
+ /* mask for the software read values */
+ HYBRIS_USAGE_SW_READ_MASK = 0x0000000F,
+
+ /* buffer is never written in software */
+ HYBRIS_USAGE_SW_WRITE_NEVER = 0x00000000,
+ /* buffer is rarely written in software */
+ HYBRIS_USAGE_SW_WRITE_RARELY = 0x00000020,
+ /* buffer is often written in software */
+ HYBRIS_USAGE_SW_WRITE_OFTEN = 0x00000030,
+ /* mask for the software write values */
+ HYBRIS_USAGE_SW_WRITE_MASK = 0x000000F0,
+
+ /* buffer will be used as an OpenGL ES texture */
+ HYBRIS_USAGE_HW_TEXTURE = 0x00000100,
+ /* buffer will be used as an OpenGL ES render target */
+ HYBRIS_USAGE_HW_RENDER = 0x00000200,
+ /* buffer will be used by the 2D hardware blitter */
+ HYBRIS_USAGE_HW_2D = 0x00000400,
+ /* buffer will be used by the HWComposer HAL module */
+ HYBRIS_USAGE_HW_COMPOSER = 0x00000800,
+ /* buffer will be used with the framebuffer device */
+ HYBRIS_USAGE_HW_FB = 0x00001000,
+ /* buffer will be used with the HW video encoder */
+ HYBRIS_USAGE_HW_VIDEO_ENCODER = 0x00010000,
+ /* buffer will be written by the HW camera pipeline */
+ HYBRIS_USAGE_HW_CAMERA_WRITE = 0x00020000,
+ /* buffer will be read by the HW camera pipeline */
+ HYBRIS_USAGE_HW_CAMERA_READ = 0x00040000,
+ /* buffer will be used as part of zero-shutter-lag queue */
+ HYBRIS_USAGE_HW_CAMERA_ZSL = 0x00060000,
+ /* mask for the camera access values */
+ HYBRIS_USAGE_HW_CAMERA_MASK = 0x00060000,
+ /* mask for the software usage bit-mask */
+ HYBRIS_USAGE_HW_MASK = 0x00071F00,
+
+ /* buffer should be displayed full-screen on an external display when
+ * possible
+ */
+ HYBRIS_USAGE_EXTERNAL_DISP = 0x00002000,
+
+ /* Must have a hardware-protected path to external display sink for
+ * this buffer. If a hardware-protected path is not available, then
+ * either don't composite only this buffer (preferred) to the
+ * external sink, or (less desirable) do not route the entire
+ * composition to the external sink.
+ */
+ HYBRIS_USAGE_PROTECTED = 0x00004000,
+};
+
+/**
+ * pixel format definitions
+ */
+
+enum {
+ HYBRIS_PIXEL_FORMAT_RGBA_8888 = 1,
+ HYBRIS_PIXEL_FORMAT_RGBX_8888 = 2,
+ HYBRIS_PIXEL_FORMAT_RGB_888 = 3,
+ HYBRIS_PIXEL_FORMAT_RGB_565 = 4,
+ HYBRIS_PIXEL_FORMAT_BGRA_8888 = 5,
+ HYBRIS_PIXEL_FORMAT_RGBA_5551 = 6,
+ HYBRIS_PIXEL_FORMAT_RGBA_4444 = 7,
+
+ /* 0x8 - 0xFF range unavailable */
+
+ /*
+ * 0x100 - 0x1FF
+ *
+ * This range is reserved for pixel formats that are specific to the HAL
+ * implementation. Implementations can use any value in this range to
+ * communicate video pixel formats between their HAL modules. These formats
+ * must not have an alpha channel. Additionally, an EGLimage created from a
+ * gralloc buffer of one of these formats must be supported for use with the
+ * GL_OES_EGL_image_external OpenGL ES extension.
+ */
+
+ /*
+ * Android YUV format:
+ *
+ * This format is exposed outside of the HAL to software decoders and
+ * applications. EGLImageKHR must support it in conjunction with the
+ * OES_EGL_image_external extension.
+ *
+ * YV12 is a 4:2:0 YCrCb planar format comprised of a WxH Y plane followed
+ * by (W/2) x (H/2) Cr and Cb planes.
+ *
+ * This format assumes
+ * - an even width
+ * - an even height
+ * - a horizontal stride multiple of 16 pixels
+ * - a vertical stride equal to the height
+ *
+ * y_size = stride * height
+ * c_stride = ALIGN(stride/2, 16)
+ * c_size = c_stride * height/2
+ * size = y_size + c_size * 2
+ * cr_offset = y_size
+ * cb_offset = y_size + c_size
+ *
+ */
+ HYBRIS_PIXEL_FORMAT_YV12 = 0x32315659, // YCrCb 4:2:0 Planar
+
+
+ /*
+ * Android Y8 format:
+ *
+ * This format is exposed outside of the HAL to the framework.
+ * The expected gralloc usage flags are SW_* and HW_CAMERA_*,
+ * and no other HW_ flags will be used.
+ *
+ * Y8 is a YUV planar format comprised of a WxH Y plane,
+ * with each pixel being represented by 8 bits.
+ *
+ * It is equivalent to just the Y plane from YV12.
+ *
+ * This format assumes
+ * - an even width
+ * - an even height
+ * - a horizontal stride multiple of 16 pixels
+ * - a vertical stride equal to the height
+ *
+ * size = stride * height
+ *
+ */
+ HYBRIS_PIXEL_FORMAT_Y8 = 0x20203859,
+
+ /*
+ * Android Y16 format:
+ *
+ * This format is exposed outside of the HAL to the framework.
+ * The expected gralloc usage flags are SW_* and HW_CAMERA_*,
+ * and no other HW_ flags will be used.
+ *
+ * Y16 is a YUV planar format comprised of a WxH Y plane,
+ * with each pixel being represented by 16 bits.
+ *
+ * It is just like Y8, but has double the bits per pixel (little endian).
+ *
+ * This format assumes
+ * - an even width
+ * - an even height
+ * - a horizontal stride multiple of 16 pixels
+ * - a vertical stride equal to the height
+ * - strides are specified in pixels, not in bytes
+ *
+ * size = stride * height * 2
+ *
+ */
+ HYBRIS_PIXEL_FORMAT_Y16 = 0x20363159,
+
+ /*
+ * Android RAW sensor format:
+ *
+ * This format is exposed outside of the HAL to applications.
+ *
+ * RAW_SENSOR is a single-channel 16-bit format, typically representing raw
+ * Bayer-pattern images from an image sensor, with minimal processing.
+ *
+ * The exact pixel layout of the data in the buffer is sensor-dependent, and
+ * needs to be queried from the camera device.
+ *
+ * Generally, not all 16 bits are used; more common values are 10 or 12
+ * bits. All parameters to interpret the raw data (black and white points,
+ * color space, etc) must be queried from the camera device.
+ *
+ * This format assumes
+ * - an even width
+ * - an even height
+ * - a horizontal stride multiple of 16 pixels (32 bytes).
+ */
+ HYBRIS_PIXEL_FORMAT_RAW_SENSOR = 0x20,
+
+ /*
+ * Android binary blob graphics buffer format:
+ *
+ * This format is used to carry task-specific data which does not have a
+ * standard image structure. The details of the format are left to the two
+ * endpoints.
+ *
+ * A typical use case is for transporting JPEG-compressed images from the
+ * Camera HAL to the framework or to applications.
+ *
+ * Buffers of this format must have a height of 1, and width equal to their
+ * size in bytes.
+ */
+ HYBRIS_PIXEL_FORMAT_BLOB = 0x21,
+
+ /*
+ * Android format indicating that the choice of format is entirely up to the
+ * device-specific Gralloc implementation.
+ *
+ * The Gralloc implementation should examine the usage bits passed in when
+ * allocating a buffer with this format, and it should derive the pixel
+ * format from those usage flags. This format will never be used with any
+ * of the GRALLOC_USAGE_SW_* usage flags.
+ *
+ * If a buffer of this format is to be used as an OpenGL ES texture, the
+ * framework will assume that sampling the texture will always return an
+ * alpha value of 1.0 (i.e. the buffer contains only opaque pixel values).
+ *
+ */
+ HYBRIS_PIXEL_FORMAT_IMPLEMENTATION_DEFINED = 0x22,
+
+ /*
+ * Android flexible YCbCr formats
+ *
+ * This format allows platforms to use an efficient YCbCr/YCrCb buffer
+ * layout, while still describing the buffer layout in a way accessible to
+ * the CPU in a device-independent manner. While called YCbCr, it can be
+ * used to describe formats with either chromatic ordering, as well as
+ * whole planar or semiplanar layouts.
+ *
+ * struct android_ycbcr (below) is the the struct used to describe it.
+ *
+ * This format must be accepted by the gralloc module when
+ * USAGE_HW_CAMERA_WRITE and USAGE_SW_READ_* are set.
+ *
+ * This format is locked for use by gralloc's (*lock_ycbcr) method, and
+ * locking with the (*lock) method will return an error.
+ */
+ HYBRIS_PIXEL_FORMAT_YCbCr_420_888 = 0x23,
+
+ /* Legacy formats (deprecated), used by ImageFormat.java */
+ HYBRIS_PIXEL_FORMAT_YCbCr_422_SP = 0x10, // NV16
+ HYBRIS_PIXEL_FORMAT_YCrCb_420_SP = 0x11, // NV21
+ HYBRIS_PIXEL_FORMAT_YCbCr_422_I = 0x14, // YUY2
+};
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2007 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "NativeHandle"
+
+#include <stdint.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <android/cutils/native_handle.h>
+
+native_handle_t* native_handle_create(int numFds, int numInts)
+{
+ native_handle_t* h = malloc(
+ sizeof(native_handle_t) + sizeof(int)*(numFds+numInts));
+
+ h->version = sizeof(native_handle_t);
+ h->numFds = numFds;
+ h->numInts = numInts;
+ return h;
+}
+
+int native_handle_delete(native_handle_t* h)
+{
+ if (h) {
+ if (h->version != sizeof(native_handle_t))
+ return -EINVAL;
+ free(h);
+ }
+ return 0;
+}
+
+int native_handle_close(const native_handle_t* h)
+{
+ if (h->version != sizeof(native_handle_t))
+ return -EINVAL;
+
+ const int numFds = h->numFds;
+ int i;
+ for (i=0 ; i<numFds ; i++) {
+ close(h->data[i]);
+ }
+ return 0;
+}
--- /dev/null
+#include <string.h>
+#include <android/system/window.h>
+#include <android/hardware/gralloc.h>
+#include "support.h"
+#include <stdarg.h>
+
+#include "nativewindowbase.h"
+
+#include "logging.h"
+
+#include <android/android-version.h>
+
+#define TRACE(message, ...) HYBRIS_DEBUG_LOG(EGL, message, ##__VA_ARGS__)
+
+BaseNativeWindowBuffer::BaseNativeWindowBuffer()
+{
+ TRACE("%p", this);
+
+ // done in ANativeWindowBuffer::ANativeWindowBuffer
+ // common.magic = ANDROID_NATIVE_WINDOW_MAGIC;
+ // common.version = sizeof(ANativeWindow);
+ // memset(common.reserved, 0, sizeof(window->native.common.reserved));
+
+ ANativeWindowBuffer::common.decRef = _decRef;
+ ANativeWindowBuffer::common.incRef = _incRef;
+ ANativeWindowBuffer::width = 0;
+ ANativeWindowBuffer::height = 0;
+ ANativeWindowBuffer::stride = 0;
+ ANativeWindowBuffer::format = 0;
+ ANativeWindowBuffer::usage = 0;
+ ANativeWindowBuffer::handle = 0;
+
+ refcount = 0;
+}
+
+
+BaseNativeWindowBuffer::~BaseNativeWindowBuffer()
+{
+ TRACE("%p", this);
+
+ ANativeWindowBuffer::common.decRef = NULL;
+ ANativeWindowBuffer::common.incRef = NULL;
+ refcount = 0;
+}
+
+
+void BaseNativeWindowBuffer::_decRef(struct android_native_base_t* base)
+{
+ ANativeWindowBuffer* self = container_of(base, ANativeWindowBuffer, common);
+ BaseNativeWindowBuffer* bnwb = static_cast<BaseNativeWindowBuffer*>(self) ;
+
+ TRACE("%p refcount = %i",bnwb, bnwb->refcount - 1);
+
+ if (__sync_fetch_and_sub(&bnwb->refcount,1) == 1)
+ {
+ delete bnwb;
+ }
+}
+
+
+
+void BaseNativeWindowBuffer::_incRef(struct android_native_base_t* base)
+{
+ ANativeWindowBuffer* self = container_of(base, ANativeWindowBuffer, common);
+ BaseNativeWindowBuffer* bnwb= static_cast<BaseNativeWindowBuffer*>(self) ;
+
+ TRACE("%p refcount = %i", bnwb, bnwb->refcount + 1);
+ __sync_fetch_and_add(&bnwb->refcount,1);
+}
+
+ANativeWindowBuffer* BaseNativeWindowBuffer::getNativeBuffer() const
+{
+ return static_cast<ANativeWindowBuffer*>(const_cast<BaseNativeWindowBuffer*>(this));
+}
+
+BaseNativeWindow::BaseNativeWindow()
+{
+ TRACE("this=%p or A %p", this, (ANativeWindow*)this);
+ // done in ANativeWindow
+ // common.magic = ANDROID_NATIVE_WINDOW_MAGIC;
+ // common.version = sizeof(ANativeWindow);
+ // memset(common.reserved, 0, sizeof(window->native.common.reserved));
+ ANativeWindow::common.decRef = _decRef;
+ ANativeWindow::common.incRef = _incRef;
+
+ const_cast<uint32_t&>(ANativeWindow::flags) = 0;
+ const_cast<float&>(ANativeWindow::xdpi) = 0;
+ const_cast<float&>(ANativeWindow::ydpi) = 0;
+ const_cast<int&>(ANativeWindow::minSwapInterval) = 0;
+ const_cast<int&>(ANativeWindow::maxSwapInterval) = 0;
+
+ ANativeWindow::setSwapInterval = _setSwapInterval;
+
+#if ANDROID_VERSION_MAJOR>=4 && ANDROID_VERSION_MINOR>=2
+ ANativeWindow::lockBuffer_DEPRECATED = &_lockBuffer_DEPRECATED;
+ ANativeWindow::dequeueBuffer_DEPRECATED = &_dequeueBuffer_DEPRECATED;
+ ANativeWindow::queueBuffer_DEPRECATED = &_queueBuffer_DEPRECATED;
+ ANativeWindow::cancelBuffer_DEPRECATED = &_cancelBuffer_DEPRECATED;
+ ANativeWindow::queueBuffer = &_queueBuffer;
+ ANativeWindow::dequeueBuffer = &_dequeueBuffer;
+ ANativeWindow::cancelBuffer = &_cancelBuffer;
+#else
+ ANativeWindow::lockBuffer = &_lockBuffer_DEPRECATED;
+ ANativeWindow::dequeueBuffer = &_dequeueBuffer_DEPRECATED;
+ ANativeWindow::queueBuffer = &_queueBuffer_DEPRECATED;
+ ANativeWindow::cancelBuffer = &_cancelBuffer_DEPRECATED;
+#endif
+ ANativeWindow::query = &_query;
+ ANativeWindow::perform = &_perform;
+
+ refcount = 0;
+}
+
+BaseNativeWindow::~BaseNativeWindow()
+{
+ TRACE("");
+ ANativeWindow::common.decRef = NULL;
+ ANativeWindow::common.incRef = NULL;
+ refcount = 0;
+}
+
+void BaseNativeWindow::_decRef(struct android_native_base_t* base)
+{
+ ANativeWindow* self = container_of(base, ANativeWindow, common);
+ BaseNativeWindow* bnw = static_cast<BaseNativeWindow*>(self);
+
+ TRACE("%p refcount = %i", bnw, bnw->refcount - 1);
+
+ if (__sync_fetch_and_sub(&bnw->refcount,1) == 1)
+ {
+ delete bnw;
+ }
+}
+
+void BaseNativeWindow::_incRef(struct android_native_base_t* base)
+{
+ ANativeWindow* self = container_of(base, ANativeWindow, common);
+ BaseNativeWindow* bnw = static_cast<BaseNativeWindow*>(self);
+
+ TRACE("%p refcount = %i", bnw, bnw->refcount + 1);
+
+
+ __sync_fetch_and_add(&bnw->refcount,1);
+}
+
+int BaseNativeWindow::_setSwapInterval(struct ANativeWindow* window, int interval)
+{
+ return static_cast<BaseNativeWindow*>(window)->setSwapInterval(interval);
+}
+
+int BaseNativeWindow::_dequeueBuffer_DEPRECATED(ANativeWindow* window, ANativeWindowBuffer** buffer)
+{
+ BaseNativeWindowBuffer* temp = static_cast<BaseNativeWindowBuffer*>(*buffer);
+ int fenceFd = -1;
+ int ret = static_cast<BaseNativeWindow*>(window)->dequeueBuffer(&temp, &fenceFd);
+ *buffer = static_cast<ANativeWindowBuffer*>(temp);
+ return ret;
+}
+
+int BaseNativeWindow::_dequeueBuffer(struct ANativeWindow *window, ANativeWindowBuffer **buffer, int *fenceFd)
+{
+ BaseNativeWindowBuffer *nativeBuffer = static_cast<BaseNativeWindowBuffer*>(*buffer);
+ int ret = static_cast<BaseNativeWindow*>(window)->dequeueBuffer(&nativeBuffer, fenceFd);
+ *buffer = static_cast<ANativeWindowBuffer*>(nativeBuffer);
+ return ret;
+}
+
+int BaseNativeWindow::_queueBuffer_DEPRECATED(struct ANativeWindow* window, ANativeWindowBuffer* buffer)
+{
+ BaseNativeWindow *nativeWindow = static_cast<BaseNativeWindow*>(window);
+ BaseNativeWindowBuffer *nativeBuffer = static_cast<BaseNativeWindowBuffer*>(buffer);
+
+ return nativeWindow->queueBuffer(nativeBuffer, -1);
+}
+
+int BaseNativeWindow::_queueBuffer(struct ANativeWindow *window, ANativeWindowBuffer *buffer, int fenceFd)
+{
+ BaseNativeWindow *nativeWindow = static_cast<BaseNativeWindow*>(window);
+ BaseNativeWindowBuffer *nativeBuffer = static_cast<BaseNativeWindowBuffer*>(buffer);
+
+ return nativeWindow->queueBuffer(nativeBuffer, fenceFd);
+}
+
+int BaseNativeWindow::_cancelBuffer_DEPRECATED(struct ANativeWindow* window, ANativeWindowBuffer* buffer)
+{
+ BaseNativeWindow *nativeWindow = static_cast<BaseNativeWindow*>(window);
+ BaseNativeWindowBuffer *nativeBuffer = static_cast<BaseNativeWindowBuffer*>(buffer);
+
+ return nativeWindow->cancelBuffer(nativeBuffer, -1);
+}
+
+int BaseNativeWindow::_cancelBuffer(struct ANativeWindow *window, ANativeWindowBuffer *buffer, int fenceFd)
+{
+ BaseNativeWindow *nativeWindow = static_cast<BaseNativeWindow*>(window);
+ BaseNativeWindowBuffer *nativeBuffer = static_cast<BaseNativeWindowBuffer*>(buffer);
+
+ return nativeWindow->cancelBuffer(nativeBuffer, fenceFd);
+}
+
+int BaseNativeWindow::_lockBuffer_DEPRECATED(struct ANativeWindow* window, ANativeWindowBuffer* buffer)
+{
+ return static_cast<BaseNativeWindow*>(window)->lockBuffer(static_cast<BaseNativeWindowBuffer*>(buffer));
+}
+
+const char *BaseNativeWindow::_native_window_operation(int what)
+{
+ switch (what) {
+ case NATIVE_WINDOW_SET_USAGE: return "NATIVE_WINDOW_SET_USAGE";
+ case NATIVE_WINDOW_CONNECT: return "NATIVE_WINDOW_CONNECT";
+ case NATIVE_WINDOW_DISCONNECT: return "NATIVE_WINDOW_DISCONNECT";
+ case NATIVE_WINDOW_SET_CROP: return "NATIVE_WINDOW_SET_CROP";
+ case NATIVE_WINDOW_SET_BUFFER_COUNT: return "NATIVE_WINDOW_SET_BUFFER_COUNT";
+ case NATIVE_WINDOW_SET_BUFFERS_GEOMETRY: return "NATIVE_WINDOW_SET_BUFFERS_GEOMETRY";
+ case NATIVE_WINDOW_SET_BUFFERS_TRANSFORM: return "NATIVE_WINDOW_SET_BUFFERS_TRANSFORM";
+ case NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP: return "NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP";
+ case NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS: return "NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS";
+ case NATIVE_WINDOW_SET_BUFFERS_FORMAT: return "NATIVE_WINDOW_SET_BUFFERS_FORMAT";
+ case NATIVE_WINDOW_SET_SCALING_MODE: return "NATIVE_WINDOW_SET_SCALING_MODE";
+ case NATIVE_WINDOW_LOCK: return "NATIVE_WINDOW_LOCK";
+ case NATIVE_WINDOW_UNLOCK_AND_POST: return "NATIVE_WINDOW_UNLOCK_AND_POST";
+ case NATIVE_WINDOW_API_CONNECT: return "NATIVE_WINDOW_API_CONNECT";
+ case NATIVE_WINDOW_API_DISCONNECT: return "NATIVE_WINDOW_API_DISCONNECT";
+#if ANDROID_VERSION_MAJOR>=4 && ANDROID_VERSION_MINOR>=1
+ case NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS: return "NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS";
+ case NATIVE_WINDOW_SET_POST_TRANSFORM_CROP: return "NATIVE_WINDOW_SET_POST_TRANSFORM_CROP";
+#endif
+ default: return "NATIVE_UNKNOWN_OPERATION";
+ }
+}
+const char *BaseNativeWindow::_native_query_operation(int what)
+{
+ switch (what) {
+ case NATIVE_WINDOW_WIDTH: return "NATIVE_WINDOW_WIDTH";
+ case NATIVE_WINDOW_HEIGHT: return "NATIVE_WINDOW_HEIGHT";
+ case NATIVE_WINDOW_FORMAT: return "NATIVE_WINDOW_FORMAT";
+ case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS: return "NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS";
+ case NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER: return "NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER";
+ case NATIVE_WINDOW_CONCRETE_TYPE: return "NATIVE_WINDOW_CONCRETE_TYPE";
+ case NATIVE_WINDOW_DEFAULT_WIDTH: return "NATIVE_WINDOW_DEFAULT_WIDTH";
+ case NATIVE_WINDOW_DEFAULT_HEIGHT: return "NATIVE_WINDOW_DEFAULT_HEIGHT";
+ case NATIVE_WINDOW_TRANSFORM_HINT: return "NATIVE_WINDOW_TRANSFORM_HINT";
+#if ANDROID_VERSION_MAJOR>=4 && ANDROID_VERSION_MINOR>=1
+ case NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND: return "NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND";
+#endif
+ default: return "NATIVE_UNKNOWN_QUERY";
+ }
+}
+
+int BaseNativeWindow::_query(const struct ANativeWindow* window, int what, int* value)
+{
+ TRACE("window:%p %i %s %p", window, what, _native_query_operation(what), value);
+ const BaseNativeWindow* self=static_cast<const BaseNativeWindow*>(window);
+ switch (what) {
+ case NATIVE_WINDOW_WIDTH:
+ *value = self->width();
+ return NO_ERROR;
+ case NATIVE_WINDOW_HEIGHT:
+ *value = self->height();
+ return NO_ERROR;
+ case NATIVE_WINDOW_FORMAT:
+ *value = self->format();
+ return NO_ERROR;
+ case NATIVE_WINDOW_CONCRETE_TYPE:
+ *value = self->type();
+ return NO_ERROR;
+ case NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER:
+ *value = self->queueLength();
+ return NO_ERROR;
+ case NATIVE_WINDOW_DEFAULT_WIDTH:
+ *value = self->defaultWidth();
+ return NO_ERROR;
+ case NATIVE_WINDOW_DEFAULT_HEIGHT:
+ *value = self->defaultHeight();
+ return NO_ERROR;
+ case NATIVE_WINDOW_TRANSFORM_HINT:
+ *value = self->transformHint();
+ return NO_ERROR;
+ case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS:
+ *value = 1;
+ return NO_ERROR;
+ }
+ TRACE("EGL error: unkown window attribute! %i", what);
+ *value = 0;
+ return BAD_VALUE;
+}
+
+int BaseNativeWindow::_perform(struct ANativeWindow* window, int operation, ... )
+{
+ BaseNativeWindow* self = static_cast<BaseNativeWindow*>(window);
+ va_list args;
+ va_start(args, operation);
+
+ // FIXME
+ TRACE("operation = %s", _native_window_operation(operation));
+ switch(operation) {
+ case NATIVE_WINDOW_SET_USAGE : // 0,
+ {
+ int usage = va_arg(args, int);
+ va_end(args);
+ return self->setUsage(usage);
+ }
+ case NATIVE_WINDOW_CONNECT : // 1, /* deprecated */
+ TRACE("connect");
+ break;
+ case NATIVE_WINDOW_DISCONNECT : // 2, /* deprecated */
+ TRACE("disconnect");
+ break;
+ case NATIVE_WINDOW_SET_CROP : // 3, /* private */
+ TRACE("set crop");
+ break;
+ case NATIVE_WINDOW_SET_BUFFER_COUNT : // 4,
+ {
+ int cnt = va_arg(args, int);
+ TRACE("set buffer count %i", cnt);
+ va_end(args);
+ return self->setBufferCount(cnt);
+ break;
+ }
+ case NATIVE_WINDOW_SET_BUFFERS_GEOMETRY : // 5, /* deprecated */
+ TRACE("set buffers geometry");
+ break;
+ case NATIVE_WINDOW_SET_BUFFERS_TRANSFORM : // 6,
+ TRACE("set buffers transform");
+ break;
+ case NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP : // 7,
+ TRACE("set buffers timestamp");
+ break;
+ case NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS : // 8,
+ {
+ int width = va_arg(args, int);
+ int height = va_arg(args, int);
+ va_end(args);
+ return self->setBuffersDimensions(width, height);
+ }
+ case NATIVE_WINDOW_SET_BUFFERS_FORMAT : // 9,
+ {
+ int format = va_arg(args, int);
+ va_end(args);
+ return self->setBuffersFormat(format);
+ }
+ case NATIVE_WINDOW_SET_SCALING_MODE : // 10, /* private */
+ TRACE("set scaling mode");
+ break;
+ case NATIVE_WINDOW_LOCK : // 11, /* private */
+ TRACE("window lock");
+ break;
+ case NATIVE_WINDOW_UNLOCK_AND_POST : // 12, /* private */
+ TRACE("unlock and post");
+ break;
+ case NATIVE_WINDOW_API_CONNECT : // 13, /* private */
+ TRACE("api connect");
+ break;
+ case NATIVE_WINDOW_API_DISCONNECT : // 14, /* private */
+ TRACE("api disconnect");
+ break;
+#if ANDROID_VERSION_MAJOR>=4 && ANDROID_VERSION_MINOR>=1
+ case NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS : // 15, /* private */
+ TRACE("set buffers user dimensions");
+ break;
+ case NATIVE_WINDOW_SET_POST_TRANSFORM_CROP : // 16,
+ TRACE("set post transform crop");
+ break;
+#endif
+ }
+ va_end(args);
+ return NO_ERROR;
+}
--- /dev/null
+#ifndef NATIVEWINDOWBASE_H
+#define NATIVEWINDOWBASE_H
+
+/* for ICS window.h */
+#include <string.h>
+#include <android/system/window.h>
+#include <EGL/egl.h>
+#include "support.h"
+#include <stdarg.h>
+#include <assert.h>
+
+#ifdef DEBUG
+#include <stdio.h>
+#endif
+
+#define NO_ERROR 0L
+#define BAD_VALUE -1
+
+/**
+ * @brief A Class to do common ANativeBuffer initialization and thunk c-style
+ * callbacks into C++ method calls.
+ **/
+class BaseNativeWindowBuffer : public ANativeWindowBuffer
+{
+protected:
+ BaseNativeWindowBuffer();
+ virtual ~BaseNativeWindowBuffer() ;
+
+public:
+ /* When passing the buffer to EGL functions it's required to pass always the native
+ * buffer. This method takes care about proper casting. */
+ ANativeWindowBuffer* getNativeBuffer() const;
+
+private:
+ unsigned int refcount;
+ static void _decRef(struct android_native_base_t* base);
+ static void _incRef(struct android_native_base_t* base);
+};
+
+/**
+ * @brief A Class to do common ANativeWindow initialization and thunk c-style
+ * callbacks into C++ method calls.
+ **/
+class BaseNativeWindow : public ANativeWindow
+{
+public:
+ operator EGLNativeWindowType()
+ {
+ EGLNativeWindowType ret = reinterpret_cast<EGLNativeWindowType>(static_cast<ANativeWindow *>(this));
+ return ret;
+ }
+
+protected:
+ BaseNativeWindow();
+ virtual ~BaseNativeWindow();
+
+ // does this require more magic?
+ unsigned int refcount;
+ static void _decRef(struct android_native_base_t* base);
+ static void _incRef(struct android_native_base_t* base);
+
+ // these have to be implemented in the concrete implementation, eg. FBDEV or offscreen window
+ virtual int setSwapInterval(int interval) = 0;
+
+ virtual int dequeueBuffer(BaseNativeWindowBuffer **buffer, int *fenceFd) = 0;
+ virtual int queueBuffer(BaseNativeWindowBuffer *buffer, int fenceFd) = 0;
+ virtual int cancelBuffer(BaseNativeWindowBuffer *buffer, int fenceFd) = 0;
+ virtual int lockBuffer(BaseNativeWindowBuffer *buffer) = 0; // DEPRECATED
+
+ virtual unsigned int type() const = 0;
+ virtual unsigned int width() const = 0;
+ virtual unsigned int height() const = 0;
+ virtual unsigned int format() const = 0;
+ virtual unsigned int defaultWidth() const = 0;
+ virtual unsigned int defaultHeight() const = 0;
+ virtual unsigned int queueLength() const = 0;
+ virtual unsigned int transformHint() const = 0;
+ //perform interfaces
+ virtual int setBuffersFormat(int format) = 0;
+ virtual int setBuffersDimensions(int width, int height) = 0;
+ virtual int setUsage(int usage) = 0;
+ virtual int setBufferCount(int cnt) = 0;
+private:
+ static int _setSwapInterval(struct ANativeWindow* window, int interval);
+ static int _dequeueBuffer_DEPRECATED(ANativeWindow* window, ANativeWindowBuffer** buffer);
+ static const char *_native_window_operation(int what);
+ static const char *_native_query_operation(int what);
+ static int _lockBuffer_DEPRECATED(struct ANativeWindow* window, ANativeWindowBuffer* buffer);
+ static int _queueBuffer_DEPRECATED(struct ANativeWindow* window, ANativeWindowBuffer* buffer);
+ static int _query(const struct ANativeWindow* window, int what, int* value);
+ static int _perform(struct ANativeWindow* window, int operation, ... );
+ static int _cancelBuffer_DEPRECATED(struct ANativeWindow* window, ANativeWindowBuffer* buffer);
+ static int _queueBuffer(struct ANativeWindow *window, ANativeWindowBuffer *buffer, int fenceFd);
+ static int _dequeueBuffer(struct ANativeWindow *window, ANativeWindowBuffer **buffer, int *fenceFd);
+ static int _cancelBuffer(struct ANativeWindow *window, ANativeWindowBuffer *buffer, int fenceFd);
+};
+
+#endif
--- /dev/null
+/*
+ * Copyright © 2012 Collabora, Ltd.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that 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.
+ */
+
+#include <cstring>
+
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
+extern "C" {
+#include <cutils/native_handle.h>
+#include <hardware/gralloc.h>
+}
+
+#include <wayland-server.h>
+#include "wayland-android-server-protocol.h"
+#include "server_wlegl_private.h"
+#include "server_wlegl_handle.h"
+#include "server_wlegl_buffer.h"
+
+static inline server_wlegl *
+server_wlegl_from(struct wl_resource *resource)
+{
+ return reinterpret_cast<server_wlegl *>(resource->data);
+}
+
+static void
+server_wlegl_create_handle(struct wl_client *client,
+ struct wl_resource *resource,
+ uint32_t id,
+ int32_t num_fds,
+ struct wl_array *ints)
+{
+ server_wlegl *wlegl = server_wlegl_from(resource);
+ server_wlegl_handle *handle;
+
+ if (num_fds < 0) {
+ wl_resource_post_error(resource,
+ ANDROID_WLEGL_ERROR_BAD_VALUE,
+ "num_fds is negative: %d", num_fds);
+ return;
+ }
+
+ handle = server_wlegl_handle_create(id);
+ wl_array_copy(&handle->ints, ints);
+ handle->num_fds = num_fds;
+ wl_client_add_resource(client, &handle->resource);
+}
+
+static void
+server_wlegl_create_buffer(struct wl_client *client,
+ struct wl_resource *resource,
+ uint32_t id,
+ int32_t width,
+ int32_t height,
+ int32_t stride,
+ int32_t format,
+ int32_t usage,
+ struct wl_resource *hnd)
+{
+ server_wlegl *wlegl = server_wlegl_from(resource);
+ server_wlegl_handle *handle = server_wlegl_handle_from(hnd);
+ server_wlegl_buffer *buffer;
+ buffer_handle_t native;
+
+ if (width < 1 || height < 1) {
+ wl_resource_post_error(resource,
+ ANDROID_WLEGL_ERROR_BAD_VALUE,
+ "bad width (%d) or height (%d)",
+ width, height);
+ return;
+ }
+
+ native = server_wlegl_handle_to_native(handle);
+ if (!native) {
+ wl_resource_post_error(resource,
+ ANDROID_WLEGL_ERROR_BAD_HANDLE,
+ "fd count mismatch");
+ return;
+ }
+
+ buffer = server_wlegl_buffer_create(id, width, height, stride,
+ format, usage, native, wlegl);
+ if (!buffer) {
+ native_handle_close((native_handle_t *)native);
+ native_handle_delete((native_handle_t *)native);
+ wl_resource_post_error(resource,
+ ANDROID_WLEGL_ERROR_BAD_HANDLE,
+ "invalid native handle");
+ return;
+ }
+
+ wl_client_add_resource(client, &buffer->base.resource);
+}
+
+static const struct android_wlegl_interface server_wlegl_impl = {
+ server_wlegl_create_handle,
+ server_wlegl_create_buffer,
+};
+
+static void
+server_wlegl_bind(struct wl_client *client, void *data,
+ uint32_t version, uint32_t id)
+{
+ server_wlegl *wlegl = reinterpret_cast<server_wlegl *>(data);
+ struct wl_resource *resource;
+
+ resource = wl_client_add_object(client, &android_wlegl_interface,
+ &server_wlegl_impl, id, wlegl);
+}
+
+server_wlegl *
+server_wlegl_create(struct wl_display *display, gralloc_module_t *gralloc)
+{
+ struct server_wlegl *wlegl;
+ int ret;
+
+ wlegl = new server_wlegl;
+
+ wlegl->display = display;
+ wlegl->global = wl_display_add_global(display,
+ &android_wlegl_interface,
+ wlegl, server_wlegl_bind);
+ wlegl->gralloc = (const gralloc_module_t *)gralloc;
+
+ return wlegl;
+}
+
+void
+server_wlegl_destroy(server_wlegl *wlegl)
+{
+ /* FIXME: server_wlegl_buffer objects may exist */
+
+ /* no way to release wlegl->gralloc */
+
+ /* FIXME: remove global_ */
+
+ /* Better to leak than expose dtor segfaults, the server
+ * supposedly exits soon after. */
+ //LOGW("server_wlegl object leaked on UnbindWaylandDisplayWL");
+ /* delete wlegl; */
+}
+
--- /dev/null
+/*
+ * Copyright © 2012 Collabora, Ltd.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that 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.
+ */
+
+#ifndef SERVER_WLEGL_H
+#define SERVER_WLEGL_H
+
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+#include <hardware/gralloc.h>
+#include <system/window.h>
+extern "C" {
+
+struct wl_display;
+struct wl_buffer;
+
+}
+
+struct server_wlegl;
+
+server_wlegl *
+server_wlegl_create(struct wl_display *wldpy, gralloc_module_t *gralloc);
+
+void
+server_wlegl_destroy(server_wlegl *wlegl);
+
+EGLImageKHR
+egl_create_image_wl(EGLDisplay egldisplay,
+ struct wl_buffer *user_buffer,
+ const EGLint *attrib_list);
+
+#endif /* SERVER_WLEGL_H */
--- /dev/null
+/*
+ * Copyright © 2012 Collabora, Ltd.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that 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.
+ */
+
+#include <cstring>
+#include <cassert>
+
+#include "server_wlegl_buffer.h"
+#include "server_wlegl_private.h"
+
+static void
+destroy(struct wl_client *client, struct wl_resource *resource)
+{
+ wl_resource_destroy(resource);
+}
+
+static const struct wl_buffer_interface server_wlegl_buffer_impl = {
+ destroy
+};
+
+server_wlegl_buffer *
+server_wlegl_buffer_from(struct wl_buffer *buffer)
+{
+ if (buffer->resource.object.implementation !=
+ (void (**)(void)) &server_wlegl_buffer_impl)
+ return NULL;
+
+ return container_of(buffer, server_wlegl_buffer, base);
+}
+
+static void
+server_wlegl_buffer_dtor(struct wl_resource *resource)
+{
+ struct wl_buffer *base =
+ reinterpret_cast<struct wl_buffer*>(resource->data);
+ server_wlegl_buffer *buffer = server_wlegl_buffer_from(base);
+ buffer->buf->common.decRef(&buffer->buf->common);
+ delete buffer;
+}
+
+server_wlegl_buffer *
+server_wlegl_buffer_create(uint32_t id,
+ int32_t width,
+ int32_t height,
+ int32_t stride,
+ int32_t format,
+ int32_t usage,
+ buffer_handle_t handle,
+ server_wlegl *wlegl)
+{
+ server_wlegl_buffer *buffer = new server_wlegl_buffer;
+ int ret;
+
+ memset(buffer, 0, sizeof(*buffer));
+
+ buffer->wlegl = wlegl;
+
+ buffer->base.resource.object.id = id;
+ buffer->base.resource.object.interface = &wl_buffer_interface;
+ buffer->base.resource.object.implementation =
+ (void (**)(void)) &server_wlegl_buffer_impl;
+
+ buffer->base.resource.data = &buffer->base;
+ buffer->base.resource.destroy = server_wlegl_buffer_dtor;
+
+ buffer->base.width = width;
+ buffer->base.height = height;
+
+ ret = wlegl->gralloc->registerBuffer(wlegl->gralloc, handle);
+ if (ret) {
+ delete buffer;
+ return NULL;
+ }
+
+ buffer->buf = new RemoteWindowBuffer(
+ width, height, stride, format, usage, handle, wlegl->gralloc);
+ buffer->buf->common.incRef(&buffer->buf->common);
+ return buffer;
+}
+
--- /dev/null
+/*
+ * Copyright © 2012 Collabora, Ltd.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that 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.
+ */
+
+#ifndef SERVER_WLEGL_BUFFER_H
+#define SERVER_WLEGL_BUFFER_H
+
+#include <cutils/native_handle.h>
+#include <string.h>
+#include <system/window.h>
+#include <hardware/gralloc.h>
+#include <wayland-server.h>
+#include "windowbuffer.h"
+
+struct server_wlegl;
+
+struct server_wlegl_buffer {
+ struct wl_buffer base;
+ server_wlegl *wlegl;
+
+ RemoteWindowBuffer *buf;
+};
+
+server_wlegl_buffer *
+server_wlegl_buffer_create(uint32_t id, int32_t width, int32_t height,
+ int32_t stride, int32_t format, int32_t usage,
+ buffer_handle_t handle, server_wlegl *wlegl);
+
+server_wlegl_buffer *
+server_wlegl_buffer_from(struct wl_buffer *);
+
+#endif /* SERVER_WLEGL_BUFFER_H */
--- /dev/null
+/*
+ * Copyright © 2012 Collabora, Ltd.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that 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.
+ */
+
+#include <stdint.h>
+#include <cstring>
+#include <unistd.h>
+
+#include "server_wlegl_handle.h"
+#include "wayland-android-server-protocol.h"
+
+static void
+add_fd(struct wl_client *client, struct wl_resource *resource, int32_t fd)
+{
+ server_wlegl_handle *handle = server_wlegl_handle_from(resource);
+
+ if (handle->fds.size >= handle->num_fds * sizeof(int)) {
+ close(fd);
+ wl_resource_post_error(&handle->resource,
+ ANDROID_WLEGL_HANDLE_ERROR_TOO_MANY_FDS,
+ "too many file descriptors");
+ return;
+ }
+
+ int *ptr = (int *)wl_array_add(&handle->fds, sizeof(int));
+ *ptr = fd;
+}
+
+static void
+destroy(struct wl_client *client, struct wl_resource *resource)
+{
+ wl_resource_destroy(resource);
+}
+
+static const struct android_wlegl_handle_interface server_handle_impl = {
+ add_fd,
+ destroy
+};
+
+static void
+server_wlegl_handle_dtor(struct wl_resource *resource)
+{
+ server_wlegl_handle *handle = server_wlegl_handle_from(resource);
+
+ int *fd = (int *)handle->fds.data;
+ int *end = (int *)((char *)handle->fds.data + handle->fds.size);
+
+ for (; fd < end; ++fd)
+ close(*fd);
+
+ wl_array_release(&handle->fds);
+ wl_array_release(&handle->ints);
+
+ delete handle;
+}
+
+server_wlegl_handle *
+server_wlegl_handle_create(uint32_t id)
+{
+ server_wlegl_handle *handle = new server_wlegl_handle;
+
+ memset(handle, 0, sizeof(*handle));
+
+ handle->resource.object.id = id;
+ handle->resource.object.interface = &android_wlegl_handle_interface;
+ handle->resource.object.implementation =
+ (void (**)(void))&server_handle_impl;
+
+ handle->resource.destroy = server_wlegl_handle_dtor;
+ handle->resource.data = handle;
+
+ wl_array_init(&handle->ints);
+ wl_array_init(&handle->fds);
+
+ return handle;
+}
+
+buffer_handle_t
+server_wlegl_handle_to_native(server_wlegl_handle *handle)
+{
+ native_handle_t *native;
+ int numFds = handle->fds.size / sizeof(int);
+ int numInts = handle->ints.size / sizeof(int32_t);
+
+ if (numFds != handle->num_fds)
+ return NULL;
+
+ native = native_handle_create(numFds, numInts);
+
+ memcpy(&native->data[0], handle->fds.data, handle->fds.size);
+ memcpy(&native->data[numFds], handle->ints.data, handle->ints.size);
+ /* ownership of fds passed to native_handle_t */
+ handle->fds.size = 0;
+
+ return (buffer_handle_t) native;
+}
--- /dev/null
+/*
+ * Copyright © 2012 Collabora, Ltd.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that 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.
+ */
+
+#ifndef SERVER_WLEGL_HANDLE_H
+#define SERVER_WLEGL_HANDLE_H
+
+#include <stdint.h>
+#include <string.h>
+#include <wayland-server.h>
+#include <cutils/native_handle.h>
+#include <system/window.h>
+struct server_wlegl_handle {
+ struct wl_resource resource;
+
+ struct wl_array ints;
+ struct wl_array fds;
+ int num_fds;
+ int num_ints;
+};
+
+server_wlegl_handle *
+server_wlegl_handle_create(uint32_t id);
+
+static inline server_wlegl_handle *
+server_wlegl_handle_from(struct wl_resource *resource)
+{
+ return reinterpret_cast<server_wlegl_handle *>(resource->data);
+}
+
+buffer_handle_t
+server_wlegl_handle_to_native(server_wlegl_handle *handle);
+
+#endif /* SERVER_WLEGL_HANDLE_H */
--- /dev/null
+/*
+ * Copyright © 2012 Collabora, Ltd.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that 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.
+ */
+
+#ifndef SERVER_WLEGL_PRIVATE_H
+#define SERVER_WLEGL_PRIVATE_H
+
+#include <hardware/gralloc.h>
+#include <wayland-server.h>
+
+#include "server_wlegl.h"
+
+struct server_wlegl {
+ struct wl_display *display;
+
+ struct wl_global *global;
+
+ const gralloc_module_t *gralloc;
+};
+
+#endif /* SERVER_WLEGL_PRIVATE_H */
--- /dev/null
+#ifndef SUPPORT_H_
+#define SUPPORT_H_
+
+#include <stddef.h>
+
+/**
+ * container_of - cast a member of a structure out to the containing structure
+ * @ptr: the pointer to the member.
+ * @type: the type of the container struct this is embedded in.
+ * @member: the name of the member within the struct.
+ *
+ */
+#define container_of(ptr, type, member) ({ \
+ const typeof( ((type *)0)->member ) *__mptr = (ptr); \
+ (type *)( (char *)__mptr - offsetof(type,member) );})
+
+#endif
--- /dev/null
+/*
+ * Copyright © 2012 Collabora, Ltd.
+ *
+ * Permission to use, copy, modify, distribute, and sell this
+ * software and its documentation for any purpose is hereby granted
+ * without fee, provided that 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.
+ */
+
+#ifndef ANDROID_CLIENT_PROTOCOL_H
+#define ANDROID_CLIENT_PROTOCOL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <stddef.h>
+#include "wayland-client.h"
+
+struct wl_client;
+struct wl_resource;
+
+struct android_wlegl;
+struct android_wlegl_handle;
+
+extern const struct wl_interface android_wlegl_interface;
+extern const struct wl_interface android_wlegl_handle_interface;
+
+#ifndef ANDROID_WLEGL_ERROR_ENUM
+#define ANDROID_WLEGL_ERROR_ENUM
+enum android_wlegl_error {
+ ANDROID_WLEGL_ERROR_BAD_HANDLE = 0,
+ ANDROID_WLEGL_ERROR_BAD_VALUE = 1,
+};
+#endif /* ANDROID_WLEGL_ERROR_ENUM */
+
+#define ANDROID_WLEGL_CREATE_HANDLE 0
+#define ANDROID_WLEGL_CREATE_BUFFER 1
+
+static inline void
+android_wlegl_set_user_data(struct android_wlegl *android_wlegl, void *user_data)
+{
+ wl_proxy_set_user_data((struct wl_proxy *) android_wlegl, user_data);
+}
+
+static inline void *
+android_wlegl_get_user_data(struct android_wlegl *android_wlegl)
+{
+ return wl_proxy_get_user_data((struct wl_proxy *) android_wlegl);
+}
+
+static inline void
+android_wlegl_destroy(struct android_wlegl *android_wlegl)
+{
+ wl_proxy_destroy((struct wl_proxy *) android_wlegl);
+}
+
+static inline struct android_wlegl_handle *
+android_wlegl_create_handle(struct android_wlegl *android_wlegl, int32_t num_fds, struct wl_array *ints)
+{
+ struct wl_proxy *id;
+
+ id = wl_proxy_create((struct wl_proxy *) android_wlegl,
+ &android_wlegl_handle_interface);
+ if (!id)
+ return NULL;
+
+ wl_proxy_marshal((struct wl_proxy *) android_wlegl,
+ ANDROID_WLEGL_CREATE_HANDLE, id, num_fds, ints);
+
+ return (struct android_wlegl_handle *) id;
+}
+
+static inline struct wl_buffer *
+android_wlegl_create_buffer(struct android_wlegl *android_wlegl, int32_t width, int32_t height, int32_t stride, int32_t format, int32_t usage, struct android_wlegl_handle *native_handle)
+{
+ struct wl_proxy *id;
+
+ id = wl_proxy_create((struct wl_proxy *) android_wlegl,
+ &wl_buffer_interface);
+ if (!id)
+ return NULL;
+
+ wl_proxy_marshal((struct wl_proxy *) android_wlegl,
+ ANDROID_WLEGL_CREATE_BUFFER, id, width, height, stride, format, usage, native_handle);
+
+ return (struct wl_buffer *) id;
+}
+
+#ifndef ANDROID_WLEGL_HANDLE_ERROR_ENUM
+#define ANDROID_WLEGL_HANDLE_ERROR_ENUM
+enum android_wlegl_handle_error {
+ ANDROID_WLEGL_HANDLE_ERROR_TOO_MANY_FDS = 0,
+};
+#endif /* ANDROID_WLEGL_HANDLE_ERROR_ENUM */
+
+#define ANDROID_WLEGL_HANDLE_ADD_FD 0
+#define ANDROID_WLEGL_HANDLE_DESTROY 1
+
+static inline void
+android_wlegl_handle_set_user_data(struct android_wlegl_handle *android_wlegl_handle, void *user_data)
+{
+ wl_proxy_set_user_data((struct wl_proxy *) android_wlegl_handle, user_data);
+}
+
+static inline void *
+android_wlegl_handle_get_user_data(struct android_wlegl_handle *android_wlegl_handle)
+{
+ return wl_proxy_get_user_data((struct wl_proxy *) android_wlegl_handle);
+}
+
+static inline void
+android_wlegl_handle_add_fd(struct android_wlegl_handle *android_wlegl_handle, int32_t fd)
+{
+ wl_proxy_marshal((struct wl_proxy *) android_wlegl_handle,
+ ANDROID_WLEGL_HANDLE_ADD_FD, fd);
+}
+
+static inline void
+android_wlegl_handle_destroy(struct android_wlegl_handle *android_wlegl_handle)
+{
+ wl_proxy_marshal((struct wl_proxy *) android_wlegl_handle,
+ ANDROID_WLEGL_HANDLE_DESTROY);
+
+ wl_proxy_destroy((struct wl_proxy *) android_wlegl_handle);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null
+/*
+ * Copyright © 2012 Collabora, Ltd.
+ *
+ * Permission to use, copy, modify, distribute, and sell this
+ * software and its documentation for any purpose is hereby granted
+ * without fee, provided that 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.
+ */
+
+#include <stdlib.h>
+#include <stdint.h>
+#include "wayland-util.h"
+
+extern const struct wl_interface android_wlegl_handle_interface;
+extern const struct wl_interface wl_buffer_interface;
+extern const struct wl_interface android_wlegl_handle_interface;
+
+static const struct wl_interface *types[] = {
+ NULL,
+ &android_wlegl_handle_interface,
+ NULL,
+ NULL,
+ &wl_buffer_interface,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ &android_wlegl_handle_interface,
+};
+
+static const struct wl_message android_wlegl_requests[] = {
+ { "create_handle", "nia", types + 1 },
+ { "create_buffer", "niiiiio", types + 4 },
+};
+
+WL_EXPORT const struct wl_interface android_wlegl_interface = {
+ "android_wlegl", 1,
+ 2, android_wlegl_requests,
+ 0, NULL,
+};
+
+static const struct wl_message android_wlegl_handle_requests[] = {
+ { "add_fd", "h", types + 0 },
+ { "destroy", "", types + 0 },
+};
+
+WL_EXPORT const struct wl_interface android_wlegl_handle_interface = {
+ "android_wlegl_handle", 1,
+ 2, android_wlegl_handle_requests,
+ 0, NULL,
+};
+
--- /dev/null
+/*
+ * Copyright © 2012 Collabora, Ltd.
+ *
+ * Permission to use, copy, modify, distribute, and sell this
+ * software and its documentation for any purpose is hereby granted
+ * without fee, provided that 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.
+ */
+
+#ifndef ANDROID_SERVER_PROTOCOL_H
+#define ANDROID_SERVER_PROTOCOL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <stddef.h>
+#include "wayland-util.h"
+
+struct wl_client;
+struct wl_resource;
+
+struct android_wlegl;
+struct android_wlegl_handle;
+
+extern const struct wl_interface android_wlegl_interface;
+extern const struct wl_interface android_wlegl_handle_interface;
+
+#ifndef ANDROID_WLEGL_ERROR_ENUM
+#define ANDROID_WLEGL_ERROR_ENUM
+enum android_wlegl_error {
+ ANDROID_WLEGL_ERROR_BAD_HANDLE = 0,
+ ANDROID_WLEGL_ERROR_BAD_VALUE = 1,
+};
+#endif /* ANDROID_WLEGL_ERROR_ENUM */
+
+/**
+ * android_wlegl - Android EGL graphics buffer support
+ * @create_handle: Create an Android native_handle_t object
+ * @create_buffer: Create a wl_buffer from the native handle
+ *
+ * Interface used in the Android wrapper libEGL to share graphics buffers
+ * between the server and the client.
+ */
+struct android_wlegl_interface {
+ /**
+ * create_handle - Create an Android native_handle_t object
+ * @id: (none)
+ * @num_fds: (none)
+ * @ints: an array of int32_t
+ *
+ * This creator method initialises the native_handle_t object
+ * with everything except the file descriptors, which have to be
+ * submitted separately.
+ */
+ void (*create_handle)(struct wl_client *client,
+ struct wl_resource *resource,
+ uint32_t id,
+ int32_t num_fds,
+ struct wl_array *ints);
+ /**
+ * create_buffer - Create a wl_buffer from the native handle
+ * @id: (none)
+ * @width: (none)
+ * @height: (none)
+ * @stride: (none)
+ * @format: (none)
+ * @usage: (none)
+ * @native_handle: (none)
+ *
+ * Pass the Android native_handle_t to the server and attach it
+ * to the new wl_buffer object.
+ *
+ * The android_wlegl_handle object must be destroyed immediately
+ * after this request.
+ */
+ void (*create_buffer)(struct wl_client *client,
+ struct wl_resource *resource,
+ uint32_t id,
+ int32_t width,
+ int32_t height,
+ int32_t stride,
+ int32_t format,
+ int32_t usage,
+ struct wl_resource *native_handle);
+};
+
+#ifndef ANDROID_WLEGL_HANDLE_ERROR_ENUM
+#define ANDROID_WLEGL_HANDLE_ERROR_ENUM
+enum android_wlegl_handle_error {
+ ANDROID_WLEGL_HANDLE_ERROR_TOO_MANY_FDS = 0,
+};
+#endif /* ANDROID_WLEGL_HANDLE_ERROR_ENUM */
+
+/**
+ * android_wlegl_handle - An Android native_handle_t object
+ * @add_fd: (none)
+ * @destroy: (none)
+ *
+ * The Android native_handle_t is a semi-opaque object, that contains an
+ * EGL implementation specific number of int32 values and file descriptors.
+ *
+ * We cannot send a variable size array of file descriptors over the
+ * Wayland protocol, so we send them one by one.
+ */
+struct android_wlegl_handle_interface {
+ /**
+ * add_fd - (none)
+ * @fd: (none)
+ */
+ void (*add_fd)(struct wl_client *client,
+ struct wl_resource *resource,
+ int32_t fd);
+ /**
+ * destroy - (none)
+ */
+ void (*destroy)(struct wl_client *client,
+ struct wl_resource *resource);
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="android">
+
+ <copyright>
+ Copyright © 2012 Collabora, Ltd.
+
+ Permission to use, copy, modify, distribute, and sell this
+ software and its documentation for any purpose is hereby granted
+ without fee, provided that 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>
+
+ <interface name="android_wlegl" version="1">
+ <description summary="Android EGL graphics buffer support">
+ Interface used in the Android wrapper libEGL to share
+ graphics buffers between the server and the client.
+ </description>
+
+ <enum name="error">
+ <entry name="bad_handle" value="0" />
+ <entry name="bad_value" value="1" />
+ </enum>
+
+ <request name="create_handle">
+ <description summary="Create an Android native_handle_t object">
+ This creator method initialises the native_handle_t object
+ with everything except the file descriptors, which have to be
+ submitted separately.
+ </description>
+
+ <arg name="id" type="new_id" interface="android_wlegl_handle" />
+ <arg name="num_fds" type="int" />
+ <arg name="ints" type="array" summary="an array of int32_t" />
+ </request>
+
+ <request name="create_buffer">
+ <description summary="Create a wl_buffer from the native handle">
+ Pass the Android native_handle_t to the server and attach it
+ to the new wl_buffer object.
+
+ The android_wlegl_handle object must be destroyed immediately
+ after this request.
+ </description>
+
+ <arg name="id" type="new_id" interface="wl_buffer" />
+ <arg name="width" type="int" />
+ <arg name="height" type="int" />
+ <arg name="stride" type="int" />
+ <arg name="format" type="int" />
+ <arg name="usage" type="int" />
+ <arg name="native_handle" type="object" interface="android_wlegl_handle" />
+ </request>
+
+ </interface>
+
+ <interface name="android_wlegl_handle" version="1">
+ <description summary="An Android native_handle_t object">
+ The Android native_handle_t is a semi-opaque object, that
+ contains an EGL implementation specific number of int32
+ values and file descriptors.
+
+ We cannot send a variable size array of file descriptors
+ over the Wayland protocol, so we send them one by one.
+ </description>
+
+ <enum name="error">
+ <entry name="too_many_fds" value="0" />
+ </enum>
+
+ <request name="add_fd">
+ <arg name="fd" type="fd" />
+ </request>
+
+ <request name="destroy" type="destructor" />
+
+ </interface>
+
+</protocol>
--- /dev/null
+#ifndef _WAYLAND_EGL_PRIV_H
+#define _WAYLAND_EGL_PRIV_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* GCC visibility */
+#if defined(__GNUC__) && __GNUC__ >= 4
+#define WL_EGL_EXPORT __attribute__ ((visibility("default")))
+#else
+#define WL_EGL_EXPORT
+#endif
+
+#include <wayland-client.h>
+
+struct wl_egl_window {
+ struct wl_surface *surface;
+
+ int width;
+ int height;
+ int dx;
+ int dy;
+
+ int attached_width;
+ int attached_height;
+
+ void *nativewindow;
+ void (*resize_callback)(struct wl_egl_window *, void *);
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
--- /dev/null
+#include <stdlib.h>
+
+#include <wayland-client.h>
+#include <wayland-egl.h>
+#include "wayland-egl-priv.h"
+
+WL_EGL_EXPORT 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, NULL);
+}
+
+WL_EGL_EXPORT 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;
+
+ egl_window->surface = surface;
+ egl_window->resize_callback = NULL;
+ wl_egl_window_resize(egl_window, width, height, 0, 0);
+ egl_window->attached_width = 0;
+ egl_window->attached_height = 0;
+ egl_window->nativewindow = 0;
+
+ return egl_window;
+
+}
+
+WL_EGL_EXPORT void
+wl_egl_window_destroy(struct wl_egl_window *egl_window)
+{
+ free(egl_window);
+}
+
+WL_EGL_EXPORT 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;
+}
+
--- /dev/null
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=@includedir@
+
+Name: wayland-egl
+Description: libhybris wayland-egl library
+Version: @VERSION@
+Libs: -L${libdir} -lwayland-egl
+Cflags: -I${includedir}
--- /dev/null
+/*
+ * Copyright © 2012 Collabora, Ltd.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that 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.
+ */
+
+#include <cstring>
+#include <cassert>
+#include "windowbuffer.h"
+
+RemoteWindowBuffer::~RemoteWindowBuffer()
+{
+ this->m_gralloc->unregisterBuffer(this->m_gralloc, this->handle);
+ native_handle_close(this->handle);
+ native_handle_delete(const_cast<native_handle_t*>(this->handle));
+}
--- /dev/null
+/*
+ * Copyright © 2012 Collabora, Ltd.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that 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.
+ */
+
+#ifndef WINDOWBUFFER_H
+#define WINDOWBUFFER_H
+
+#include <cutils/native_handle.h>
+#include <string.h>
+#include <system/window.h>
+#include <hardware/gralloc.h>
+#include "nativewindowbase.h"
+
+class RemoteWindowBuffer : public BaseNativeWindowBuffer
+{
+ public:
+ RemoteWindowBuffer(unsigned int width,
+ unsigned int height,
+ unsigned int stride,
+ unsigned int format,
+ unsigned int usage,
+ buffer_handle_t handle,
+ const gralloc_module_t *gralloc
+ ) {
+ // Base members
+ ANativeWindowBuffer::width = width;
+ ANativeWindowBuffer::height = height;
+ ANativeWindowBuffer::format = format;
+ ANativeWindowBuffer::usage = usage;
+ ANativeWindowBuffer::stride = stride;
+ ANativeWindowBuffer::handle = handle;
+ this->m_gralloc = gralloc;
+ };
+ ~RemoteWindowBuffer();
+ private:
+ const gralloc_module_t *m_gralloc;
+};
+#endif /* WINDOWBUFFER_H */
--- /dev/null
+pkglib_LTLIBRARIES = eglplatform_fbdev.la
+
+eglplatform_fbdev_la_SOURCES = \
+ eglplatform_fbdev.cpp \
+ fbdev_window.cpp
+
+eglplatform_fbdev_la_CXXFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/common \
+ -I$(top_srcdir)/egl \
+ -I$(top_srcdir)/egl/platforms/common \
+ -I$(top_srcdir)/include/android
+
+if WANT_TRACE
+eglplatform_fbdev_la_CXXFLAGS += -DDEBUG
+endif
+if WANT_DEBUG
+eglplatform_fbdev_la_CXXFLAGS += -ggdb -O0
+endif
+
+eglplatform_fbdev_la_LDFLAGS = \
+ -avoid-version -module -shared -export-dynamic \
+ $(top_builddir)/egl/platforms/common/libhybris-eglplatformcommon.la \
+ $(top_builddir)/hardware/libhardware.la
--- /dev/null
+#include <ws.h>
+#include "fbdev_window.h"
+#include <malloc.h>
+#include <assert.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <assert.h>
+extern "C" {
+#include <eglplatformcommon.h>
+};
+
+#include "logging.h"
+
+static int inited = 0;
+static gralloc_module_t *gralloc = 0;
+static framebuffer_device_t *framebuffer = 0;
+static alloc_device_t *alloc = 0;
+static FbDevNativeWindow *_nativewindow = NULL;
+
+extern "C" int fbdevws_IsValidDisplay(EGLNativeDisplayType display)
+{
+ if (__sync_fetch_and_add(&inited,1)==0)
+ {
+ int err;
+ err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, (const hw_module_t **) &gralloc);
+ if (gralloc==NULL) {
+ fprintf(stderr, "failed to get gralloc module: (%s)\n",strerror(-err));
+ assert(0);
+ }
+
+ err = framebuffer_open((hw_module_t *) gralloc, &framebuffer);
+ if (err) {
+ fprintf(stderr, "ERROR: failed to open framebuffer: (%s)\n",strerror(-err));
+ assert(0);
+ }
+ TRACE("** framebuffer_open: status=(%s) format=x%x", strerror(-err), framebuffer->format);
+
+ err = gralloc_open((const hw_module_t *) gralloc, &alloc);
+ if (err) {
+ fprintf(stderr, "ERROR: failed to open gralloc: (%s)\n",strerror(-err));
+ assert(0);
+ }
+ TRACE("** gralloc_open %p status=%s", gralloc, strerror(-err));
+ eglplatformcommon_init(gralloc, alloc);
+ }
+
+ return display == EGL_DEFAULT_DISPLAY;
+}
+
+extern "C" EGLNativeWindowType fbdevws_CreateWindow(EGLNativeWindowType win, EGLNativeDisplayType display)
+{
+ assert (inited >= 1);
+ assert (_nativewindow == NULL);
+
+ _nativewindow = new FbDevNativeWindow(gralloc, alloc, framebuffer);
+ _nativewindow->common.incRef(&_nativewindow->common);
+ return (EGLNativeWindowType) static_cast<struct ANativeWindow *>(_nativewindow);
+}
+
+extern "C" void fbdevws_DestroyWindow(EGLNativeWindowType win)
+{
+ assert (_nativewindow != NULL);
+ assert (static_cast<FbDevNativeWindow *>((struct ANativeWindow *)win) == _nativewindow);
+
+ _nativewindow->common.decRef(&_nativewindow->common);
+ /* We are done with it, refcounting will delete the window when appropriate */
+ _nativewindow = NULL;
+}
+
+extern "C" __eglMustCastToProperFunctionPointerType fbdevws_eglGetProcAddress(const char *procname)
+{
+ return eglplatformcommon_eglGetProcAddress(procname);
+}
+
+extern "C" void fbdevws_passthroughImageKHR(EGLContext *ctx, EGLenum *target, EGLClientBuffer *buffer, const EGLint **attrib_list)
+{
+ eglplatformcommon_passthroughImageKHR(ctx, target, buffer, attrib_list);
+}
+
+struct ws_module ws_module_info = {
+ fbdevws_IsValidDisplay,
+ fbdevws_CreateWindow,
+ fbdevws_DestroyWindow,
+ fbdevws_eglGetProcAddress,
+ fbdevws_passthroughImageKHR,
+ eglplatformcommon_eglQueryString
+};
+
+// vim:ts=4:sw=4:noexpandtab
--- /dev/null
+/*
+ * Copyright (C) 2013 libhybris
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "fbdev_window.h"
+#include "logging.h"
+
+#include <errno.h>
+#include <assert.h>
+#include <pthread.h>
+#include <stdio.h>
+
+#include <android/android-version.h>
+
+#define FRAMEBUFFER_PARTITIONS 2
+
+static pthread_cond_t _cond = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t _mutex = PTHREAD_MUTEX_INITIALIZER;
+
+
+FbDevNativeWindowBuffer::FbDevNativeWindowBuffer(alloc_device_t* alloc_device,
+ unsigned int width,
+ unsigned int height,
+ unsigned int format,
+ unsigned int usage)
+{
+ ANativeWindowBuffer::width = width;
+ ANativeWindowBuffer::height = height;
+ ANativeWindowBuffer::format = format;
+ ANativeWindowBuffer::usage = usage;
+ busy = 0;
+ status = 0;
+ m_alloc = alloc_device;
+
+ if (m_alloc) {
+ status = m_alloc->alloc(m_alloc,
+ width, height, format, usage,
+ &handle, &stride);
+ }
+
+ TRACE("width=%d height=%d stride=%d format=x%x usage=x%x status=%s this=%p",
+ width, height, stride, format, usage, strerror(-status), this);
+}
+
+
+
+FbDevNativeWindowBuffer::~FbDevNativeWindowBuffer()
+{
+ TRACE("%p", this);
+ if (m_alloc && handle)
+ m_alloc->free(m_alloc, handle);
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+FbDevNativeWindow::FbDevNativeWindow(gralloc_module_t* gralloc,
+ alloc_device_t* alloc,
+ framebuffer_device_t* fbDev)
+{
+ m_alloc = alloc;
+ m_fbDev = fbDev;
+ m_bufFormat = m_fbDev->format;
+ m_usage = GRALLOC_USAGE_HW_FB;
+
+#if ANDROID_VERSION_MAJOR>=4 && ANDROID_VERSION_MINOR>=2
+ if (m_fbDev->numFramebuffers>0)
+ setBufferCount(m_fbDev->numFramebuffers);
+ else
+ setBufferCount(FRAMEBUFFER_PARTITIONS);
+#else
+ setBufferCount(FRAMEBUFFER_PARTITIONS);
+#endif
+
+}
+
+
+
+
+FbDevNativeWindow::~FbDevNativeWindow()
+{
+ destroyBuffers();
+}
+
+
+
+void FbDevNativeWindow::destroyBuffers()
+{
+ TRACE("");
+
+ std::list<FbDevNativeWindowBuffer*>::iterator it = m_bufList.begin();
+ for (; it!=m_bufList.end(); ++it)
+ {
+ FbDevNativeWindowBuffer* fbnb = *it;
+ fbnb->common.decRef(&fbnb->common);
+ }
+ m_bufList.clear();
+ m_freeBufs = 0;
+ m_frontBuf = NULL;
+}
+
+
+
+
+/*
+ * Set the swap interval for this surface.
+ *
+ * Returns 0 on success or -errno on error.
+ */
+int FbDevNativeWindow::setSwapInterval(int interval)
+{
+ TRACE("interval=%i", interval);
+ return m_fbDev->setSwapInterval(m_fbDev, interval);
+}
+
+
+/*
+ * Hook called by EGL to acquire a buffer. This call may block if no
+ * buffers are available.
+ *
+ * The window holds a reference to the buffer between dequeueBuffer and
+ * either queueBuffer or cancelBuffer, so clients only need their own
+ * reference if they might use the buffer after queueing or canceling it.
+ * Holding a reference to a buffer after queueing or canceling it is only
+ * allowed if a specific buffer count has been set.
+ *
+ * The libsync fence file descriptor returned in the int pointed to by the
+ * fenceFd argument will refer to the fence that must signal before the
+ * dequeued buffer may be written to. A value of -1 indicates that the
+ * caller may access the buffer immediately without waiting on a fence. If
+ * a valid file descriptor is returned (i.e. any value except -1) then the
+ * caller is responsible for closing the file descriptor.
+ *
+ * Returns 0 on success or -errno on error.
+ */
+int FbDevNativeWindow::dequeueBuffer(BaseNativeWindowBuffer** buffer, int *fenceFd)
+{
+ HYBRIS_TRACE_BEGIN("fbdev-platform", "dequeueBuffer", "");
+ FbDevNativeWindowBuffer* fbnb=NULL;
+
+ pthread_mutex_lock(&_mutex);
+
+ HYBRIS_TRACE_BEGIN("fbdev-platform", "dequeueBuffer-wait", "");
+#if defined(DEBUG)
+
+ if (m_frontBuf)
+ TRACE("Status: Has front buf %p", m_frontBuf);
+
+ std::list<FbDevNativeWindowBuffer*>::iterator cit = m_bufList.begin();
+ for (; cit != m_bufList.end(); ++cit)
+ {
+ TRACE("Status: Buffer %p with busy %i\n", (*cit), (*cit)->busy);
+ }
+#endif
+
+ while (m_freeBufs==0)
+ {
+ pthread_cond_wait(&_cond, &_mutex);
+ }
+
+ while (1)
+ {
+ std::list<FbDevNativeWindowBuffer*>::iterator it = m_bufList.begin();
+ for (; it != m_bufList.end(); ++it)
+ {
+ if (*it==m_frontBuf)
+ continue;
+ if ((*it)->busy==0)
+ {
+ TRACE("Found a free non-front buffer");
+ break;
+ }
+ }
+
+ if (it == m_bufList.end())
+ {
+#if ANDROID_VERSION_MAJOR<=4 && ANDROID_VERSION_MINOR<2
+ /*
+ * This is acceptable in case you are on a stack that calls lock() before starting to render into buffer
+ * When you are using fences (>= 2) you'll be waiting on the fence to signal instead.
+ *
+ * This optimization allows eglSwapBuffers to return and you can begin to utilize the GPU for rendering.
+ * The actual lock() probably first comes at glFlush/eglSwapBuffers
+ */
+ if (m_frontBuf && m_frontBuf->busy == 0)
+ {
+ TRACE("Used front buffer as buffer");
+ fbnb = m_frontBuf;
+ break;
+ }
+#endif
+ // have to wait once again
+ pthread_cond_wait(&_cond, &_mutex);
+ continue;
+ }
+
+ fbnb = *it;
+ break;
+ }
+
+ HYBRIS_TRACE_END("fbdev-platform", "dequeueBuffer-wait", "");
+ assert(fbnb!=NULL);
+ fbnb->busy = 1;
+ m_freeBufs--;
+
+ *buffer = fbnb;
+ *fenceFd = -1;
+
+ TRACE("%lu DONE --> %p", pthread_self(), fbnb);
+ pthread_mutex_unlock(&_mutex);
+ HYBRIS_TRACE_END("fbdev-platform", "dequeueBuffer", "");
+ return 0;
+}
+
+/*
+ * Hook called by EGL when modifications to the render buffer are done.
+ * This unlocks and post the buffer.
+ *
+ * The window holds a reference to the buffer between dequeueBuffer and
+ * either queueBuffer or cancelBuffer, so clients only need their own
+ * reference if they might use the buffer after queueing or canceling it.
+ * Holding a reference to a buffer after queueing or canceling it is only
+ * allowed if a specific buffer count has been set.
+ *
+ * The fenceFd argument specifies a libsync fence file descriptor for a
+ * fence that must signal before the buffer can be accessed. If the buffer
+ * can be accessed immediately then a value of -1 should be used. The
+ * caller must not use the file descriptor after it is passed to
+ * queueBuffer, and the ANativeWindow implementation is responsible for
+ * closing it.
+ *
+ * Returns 0 on success or -errno on error.
+ */
+int FbDevNativeWindow::queueBuffer(BaseNativeWindowBuffer* buffer, int fenceFd)
+{
+
+ FbDevNativeWindowBuffer* fbnb = (FbDevNativeWindowBuffer*) buffer;
+
+ HYBRIS_TRACE_BEGIN("fbdev-platform", "queueBuffer", "-%p", fbnb);
+
+ pthread_mutex_lock(&_mutex);
+
+ assert(fbnb->busy==1);
+
+ fbnb->busy = 2;
+
+ pthread_mutex_unlock(&_mutex);
+
+ HYBRIS_TRACE_BEGIN("fbdev-platform", "queueBuffer-post", "-%p", fbnb);
+
+ int rv = m_fbDev->post(m_fbDev, fbnb->handle);
+ if (rv!=0)
+ {
+ fprintf(stderr,"ERROR: fb->post(%s)\n",strerror(-rv));
+ }
+ HYBRIS_TRACE_END("fbdev-platform", "queueBuffer-post", "-%p", fbnb);
+
+ pthread_mutex_lock(&_mutex);
+
+ fbnb->busy=0;
+ m_frontBuf = fbnb;
+
+ m_freeBufs++;
+
+ TRACE("%lu %p %p",pthread_self(), m_frontBuf, fbnb);
+
+ pthread_cond_signal(&_cond);
+ pthread_mutex_unlock(&_mutex);
+
+ HYBRIS_TRACE_END("fbdev-platform", "queueBuffer", "-%p", fbnb);
+ return rv;
+}
+
+
+/*
+ * Hook used to cancel a buffer that has been dequeued.
+ * No synchronization is performed between dequeue() and cancel(), so
+ * either external synchronization is needed, or these functions must be
+ * called from the same thread.
+ *
+ * The window holds a reference to the buffer between dequeueBuffer and
+ * either queueBuffer or cancelBuffer, so clients only need their own
+ * reference if they might use the buffer after queueing or canceling it.
+ * Holding a reference to a buffer after queueing or canceling it is only
+ * allowed if a specific buffer count has been set.
+ *
+ * The fenceFd argument specifies a libsync fence file decsriptor for a
+ * fence that must signal before the buffer can be accessed. If the buffer
+ * can be accessed immediately then a value of -1 should be used.
+ *
+ * Note that if the client has not waited on the fence that was returned
+ * from dequeueBuffer, that same fence should be passed to cancelBuffer to
+ * ensure that future uses of the buffer are preceded by a wait on that
+ * fence. The caller must not use the file descriptor after it is passed
+ * to cancelBuffer, and the ANativeWindow implementation is responsible for
+ * closing it.
+ *
+ * Returns 0 on success or -errno on error.
+ */
+int FbDevNativeWindow::cancelBuffer(BaseNativeWindowBuffer* buffer, int fenceFd)
+{
+ TRACE("");
+ FbDevNativeWindowBuffer* fbnb = (FbDevNativeWindowBuffer*)buffer;
+
+ pthread_mutex_lock(&_mutex);
+
+ fbnb->busy=0;
+
+ m_freeBufs++;
+
+ pthread_cond_signal(&_cond);
+ pthread_mutex_unlock(&_mutex);
+
+ return 0;
+}
+
+
+
+int FbDevNativeWindow::lockBuffer(BaseNativeWindowBuffer* buffer)
+{
+
+ FbDevNativeWindowBuffer* fbnb = (FbDevNativeWindowBuffer*)buffer;
+
+ HYBRIS_TRACE_BEGIN("fbdev-platform", "lockBuffer", "-%p", fbnb);
+
+ pthread_mutex_lock(&_mutex);
+
+ // wait that the buffer we're locking is not front anymore
+ while (m_frontBuf==fbnb)
+ {
+ TRACE("waiting %p %p", m_frontBuf, fbnb);
+ pthread_cond_wait(&_cond, &_mutex);
+ }
+
+ pthread_mutex_unlock(&_mutex);
+ HYBRIS_TRACE_END("fbdev-platform", "lockBuffer", "-%p", fbnb);
+ return NO_ERROR;
+}
+
+
+/*
+ * see NATIVE_WINDOW_FORMAT
+ */
+unsigned int FbDevNativeWindow::width() const
+{
+ unsigned int rv = m_fbDev->width;
+ TRACE("width=%i", rv);
+ return rv;
+}
+
+
+/*
+ * see NATIVE_WINDOW_HEIGHT
+ */
+unsigned int FbDevNativeWindow::height() const
+{
+ unsigned int rv = m_fbDev->height;
+ TRACE("height=%i", rv);
+ return rv;
+}
+
+
+/*
+ * see NATIVE_WINDOW_FORMAT
+ */
+unsigned int FbDevNativeWindow::format() const
+{
+ unsigned int rv = m_fbDev->format;
+ TRACE("format=x%x", rv);
+ return rv;
+}
+
+
+/*
+ * Default width and height of ANativeWindow buffers, these are the
+ * dimensions of the window buffers irrespective of the
+ * NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS call and match the native window
+ * size unless overridden by NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS.
+ */
+/*
+ * see NATIVE_WINDOW_DEFAULT_HEIGHT
+ */
+unsigned int FbDevNativeWindow::defaultHeight() const
+{
+ unsigned int rv = m_fbDev->height;
+ TRACE("height=%i", rv);
+ return rv;
+}
+
+
+/*
+ * see BaseNativeWindow::_query(NATIVE_WINDOW_DEFAULT_WIDTH)
+ */
+unsigned int FbDevNativeWindow::defaultWidth() const
+{
+ unsigned int rv = m_fbDev->width;
+ TRACE("width=%i", rv);
+ return rv;
+}
+
+
+/*
+ * see NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER
+ */
+unsigned int FbDevNativeWindow::queueLength() const
+{
+ TRACE("");
+ return 0;
+}
+
+
+/*
+ * see NATIVE_WINDOW_CONCRETE_TYPE
+ */
+unsigned int FbDevNativeWindow::type() const
+{
+ TRACE("");
+ return NATIVE_WINDOW_FRAMEBUFFER;
+}
+
+
+/*
+ * see NATIVE_WINDOW_TRANSFORM_HINT
+ */
+unsigned int FbDevNativeWindow::transformHint() const
+{
+ TRACE("");
+ return 0;
+}
+
+
+
+/*
+ * native_window_set_usage(..., usage)
+ * Sets the intended usage flags for the next buffers
+ * acquired with (*lockBuffer)() and on.
+ * By default (if this function is never called), a usage of
+ * GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE
+ * is assumed.
+ * Calling this function will usually cause following buffers to be
+ * reallocated.
+ */
+int FbDevNativeWindow::setUsage(int usage)
+{
+ int need_realloc = (m_usage != usage);
+ TRACE("usage=x%x realloc=%d", usage, need_realloc);
+ m_usage = usage;
+ if (need_realloc)
+ this->setBufferCount(m_bufList.size());
+
+ return NO_ERROR;
+}
+
+
+/*
+ * native_window_set_buffers_format(..., int format)
+ * All buffers dequeued after this call will have the format specified.
+ *
+ * If the specified format is 0, the default buffer format will be used.
+ */
+int FbDevNativeWindow::setBuffersFormat(int format)
+{
+ int need_realloc = (format != m_bufFormat);
+ TRACE("format=x%x realloc=%d", format, need_realloc);
+ m_bufFormat = format;
+ if (need_realloc)
+ this->setBufferCount(m_bufList.size());
+ return NO_ERROR;
+}
+
+
+/*
+ * native_window_set_buffer_count(..., count)
+ * Sets the number of buffers associated with this native window.
+ */
+int FbDevNativeWindow::setBufferCount(int cnt)
+{
+ TRACE("cnt=%d", cnt);
+ int err=NO_ERROR;
+ pthread_mutex_lock(&_mutex);
+
+ destroyBuffers();
+
+ for(unsigned int i = 0; i < cnt; i++)
+ {
+ FbDevNativeWindowBuffer *fbnb = new FbDevNativeWindowBuffer(m_alloc,
+ m_fbDev->width, m_fbDev->height, m_fbDev->format,
+ m_usage|GRALLOC_USAGE_HW_FB );
+
+ fbnb->common.incRef(&fbnb->common);
+
+ TRACE("buffer %i is at %p (native %p) err=%s handle=%p stride=%i",
+ i, fbnb, (ANativeWindowBuffer*)fbnb,
+ strerror(-fbnb->status), fbnb->handle, fbnb->stride);
+
+ if (fbnb->status)
+ {
+ fbnb->common.decRef(&fbnb->common);
+ fprintf(stderr,"WARNING: %s: allocated only %d buffers out of %d\n", __PRETTY_FUNCTION__, m_freeBufs, cnt);
+ break;
+ }
+
+ m_freeBufs++;
+ m_bufList.push_back(fbnb);
+ }
+ pthread_mutex_unlock(&_mutex);
+
+ return err;
+}
+
+/*
+ * native_window_set_buffers_dimensions(..., int w, int h)
+ * All buffers dequeued after this call will have the dimensions specified.
+ * In particular, all buffers will have a fixed-size, independent from the
+ * native-window size. They will be scaled according to the scaling mode
+ * (see native_window_set_scaling_mode) upon window composition.
+ *
+ * If w and h are 0, the normal behavior is restored. That is, dequeued buffers
+ * following this call will be sized to match the window's size.
+ *
+ * Calling this function will reset the window crop to a NULL value, which
+ * disables cropping of the buffers.
+ */
+int FbDevNativeWindow::setBuffersDimensions(int width, int height)
+{
+ TRACE("WARN: stub. size=%ix%i", width, height);
+ return NO_ERROR;
+}
+// vim: noai:ts=4:sw=4:ss=4:expandtab
--- /dev/null
+/*
+ * Copyright (C) 2013 libhybris
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef FBDEV_WINDOW_H
+#define FBDEV_WINDOW_H
+
+#include "nativewindowbase.h"
+#include <linux/fb.h>
+#include <android/hardware/gralloc.h>
+
+#include <list>
+
+
+class FbDevNativeWindowBuffer : public BaseNativeWindowBuffer {
+friend class FbDevNativeWindow;
+
+protected:
+ FbDevNativeWindowBuffer(alloc_device_t* alloc,
+ unsigned int width,
+ unsigned int height,
+ unsigned int format,
+ unsigned int usage) ;
+ virtual ~FbDevNativeWindowBuffer() ;
+
+protected:
+ int busy;
+ int status;
+ alloc_device_t* m_alloc;
+};
+
+
+class FbDevNativeWindow : public BaseNativeWindow {
+public:
+ FbDevNativeWindow(gralloc_module_t* gralloc, alloc_device_t* alloc,
+ framebuffer_device_t* fbDev);
+ ~FbDevNativeWindow();
+
+protected:
+ // overloads from BaseNativeWindow
+ virtual int setSwapInterval(int interval);
+
+ virtual int dequeueBuffer(BaseNativeWindowBuffer** buffer, int* fenceFd);
+ virtual int queueBuffer(BaseNativeWindowBuffer* buffer, int fenceFd);
+ virtual int cancelBuffer(BaseNativeWindowBuffer* buffer, int fenceFd);
+ virtual int lockBuffer(BaseNativeWindowBuffer* buffer);
+
+ virtual unsigned int type() const;
+ virtual unsigned int width() const;
+ virtual unsigned int height() const;
+ virtual unsigned int format() const;
+ virtual unsigned int defaultWidth() const;
+ virtual unsigned int defaultHeight() const;
+ virtual unsigned int queueLength() const;
+ virtual unsigned int transformHint() const;
+ // perform calls
+ virtual int setUsage(int usage);
+ virtual int setBuffersFormat(int format);
+ virtual int setBuffersDimensions(int width, int height);
+ virtual int setBufferCount(int cnt);
+
+private:
+ void destroyBuffers();
+
+private:
+ framebuffer_device_t* m_fbDev;
+ alloc_device_t* m_alloc;
+ unsigned int m_usage;
+ unsigned int m_bufFormat;
+ int m_freeBufs;
+ std::list<FbDevNativeWindowBuffer*> m_bufList;
+ FbDevNativeWindowBuffer* m_frontBuf;
+};
+
+#endif
+// vim: noai:ts=4:sw=4:ss=4:expandtab
--- /dev/null
+lib_LTLIBRARIES = libhybris-hwcomposerwindow.la
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = hwcomposer-egl.pc
+
+hwcomposerwindowincludedir = $(includedir)/hybris/hwcomposerwindow
+hwcomposerwindowinclude_HEADERS = \
+ hwcomposer_window.h
+
+libhybris_hwcomposerwindow_la_SOURCES = \
+ hwcomposer_window.cpp
+
+libhybris_hwcomposerwindow_la_CXXFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/common \
+ -I$(top_srcdir)/egl \
+ -I$(top_srcdir)/egl/platforms/common \
+ -I$(top_srcdir)/include/android
+
+if WANT_TRACE
+libhybris_hwcomposerwindow_la_CXXFLAGS += -DDEBUG
+endif
+if WANT_DEBUG
+libhybris_hwcomposerwindow_la_CXXFLAGS += -ggdb -O0
+endif
+
+libhybris_hwcomposerwindow_la_LDFLAGS = \
+ -version-info "1":"0":"0" \
+ $(top_builddir)/egl/platforms/common/libhybris-eglplatformcommon.la \
+ $(top_builddir)/hardware/libhardware.la
+
+if HAS_ANDROID_4_2_0
+libhybris_hwcomposerwindow_la_LDFLAGS += $(top_builddir)/libsync/libsync.la
+endif
+
+pkglib_LTLIBRARIES = eglplatform_hwcomposer.la
+
+eglplatform_hwcomposer_la_SOURCES = \
+ eglplatform_hwcomposer.cpp
+
+eglplatform_hwcomposer_la_CXXFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/common \
+ -I$(top_srcdir)/egl \
+ -I$(top_srcdir)/egl/platforms/common \
+ -I$(top_srcdir)/include/android
+
+if WANT_TRACE
+eglplatform_hwcomposer_la_CXXFLAGS += -DDEBUG
+endif
+if WANT_DEBUG
+eglplatform_hwcomposer_la_CXXFLAGS += -ggdb -O0
+endif
+eglplatform_hwcomposer_la_LIBADD = libhybris-hwcomposerwindow.la
+eglplatform_hwcomposer_la_LDFLAGS = \
+ -avoid-version -module -shared -export-dynamic \
+ $(top_builddir)/egl/platforms/common/libhybris-eglplatformcommon.la \
+ $(top_builddir)/hardware/libhardware.la
+
--- /dev/null
+#include <ws.h>
+#include "hwcomposer_window.h"
+#include <malloc.h>
+#include <assert.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <assert.h>
+extern "C" {
+#include <eglplatformcommon.h>
+};
+
+#include "logging.h"
+
+static int inited = 0;
+static gralloc_module_t *gralloc = 0;
+static alloc_device_t *alloc = 0;
+static HWComposerNativeWindow *_nativewindow = NULL;
+
+extern "C" int hwcomposerws_IsValidDisplay(EGLNativeDisplayType display)
+{
+ if (__sync_fetch_and_add(&inited,1)==0)
+ {
+ int err;
+ err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, (const hw_module_t **) &gralloc);
+ if (gralloc==NULL) {
+ fprintf(stderr, "failed to get gralloc module: (%s)\n",strerror(-err));
+ assert(0);
+ }
+
+ err = gralloc_open((const hw_module_t *) gralloc, &alloc);
+ if (err) {
+ fprintf(stderr, "ERROR: failed to open gralloc: (%s)\n",strerror(-err));
+ assert(0);
+ }
+ TRACE("** gralloc_open %p status=%s", gralloc, strerror(-err));
+ eglplatformcommon_init(gralloc, alloc);
+ }
+
+ return display == EGL_DEFAULT_DISPLAY;
+}
+
+extern "C" EGLNativeWindowType hwcomposerws_CreateWindow(EGLNativeWindowType win, EGLNativeDisplayType display)
+{
+ assert (inited >= 1);
+ assert (_nativewindow == NULL);
+
+ HWComposerNativeWindow *window = static_cast<HWComposerNativeWindow *>((ANativeWindow *) win);
+ window->setup(gralloc, alloc);
+ _nativewindow = window;
+ _nativewindow->common.incRef(&_nativewindow->common);
+ return (EGLNativeWindowType) static_cast<struct ANativeWindow *>(_nativewindow);
+}
+
+extern "C" void hwcomposerws_DestroyWindow(EGLNativeWindowType win)
+{
+ assert (_nativewindow != NULL);
+ assert (static_cast<HWComposerNativeWindow *>((struct ANativeWindow *)win) == _nativewindow);
+
+ _nativewindow->common.decRef(&_nativewindow->common);
+ /* We are done with it, refcounting will delete the window when appropriate */
+ _nativewindow = NULL;
+}
+
+extern "C" __eglMustCastToProperFunctionPointerType hwcomposerws_eglGetProcAddress(const char *procname)
+{
+ return eglplatformcommon_eglGetProcAddress(procname);
+}
+
+extern "C" void hwcomposerws_passthroughImageKHR(EGLContext *ctx, EGLenum *target, EGLClientBuffer *buffer, const EGLint **attrib_list)
+{
+ eglplatformcommon_passthroughImageKHR(ctx, target, buffer, attrib_list);
+}
+
+struct ws_module ws_module_info = {
+ hwcomposerws_IsValidDisplay,
+ hwcomposerws_CreateWindow,
+ hwcomposerws_DestroyWindow,
+ hwcomposerws_eglGetProcAddress,
+ hwcomposerws_passthroughImageKHR,
+ eglplatformcommon_eglQueryString
+};
+
+// vim:ts=4:sw=4:noexpandtab
--- /dev/null
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=@includedir@
+
+Name: hwcomposer-egl
+Description: libhybris EGL platform library
+Version: @VERSION@
+Libs: -L${libdir} -lhybris-hwcomposerwindow
+Cflags: -I${includedir} -I${includedir}/hybris/hwcomposerwindow
+
--- /dev/null
+/*
+ * Copyright (C) 2013 libhybris
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "hwcomposer_window.h"
+#include "logging.h"
+
+#include <errno.h>
+#include <assert.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#include <android/android-version.h>
+
+extern "C" {
+#include <android/sync/sync.h>
+};
+
+static pthread_cond_t _cond = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t _mutex = PTHREAD_MUTEX_INITIALIZER;
+
+
+HWComposerNativeWindowBuffer::HWComposerNativeWindowBuffer(alloc_device_t* alloc_device,
+ unsigned int width,
+ unsigned int height,
+ unsigned int format,
+ unsigned int usage)
+{
+ ANativeWindowBuffer::width = width;
+ ANativeWindowBuffer::height = height;
+ ANativeWindowBuffer::format = format;
+ ANativeWindowBuffer::usage = usage;
+ fenceFd = -1;
+ busy = 0;
+ status = 0;
+ m_alloc = alloc_device;
+
+ if (m_alloc) {
+ status = m_alloc->alloc(m_alloc,
+ width, height, format, usage,
+ &handle, &stride);
+ }
+
+ TRACE("width=%d height=%d stride=%d format=x%x usage=x%x status=%s this=%p",
+ width, height, stride, format, usage, strerror(-status), this);
+}
+
+
+
+HWComposerNativeWindowBuffer::~HWComposerNativeWindowBuffer()
+{
+ TRACE("%p", this);
+ if (m_alloc && handle)
+ m_alloc->free(m_alloc, handle);
+
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+HWComposerNativeWindow::HWComposerNativeWindow(unsigned int width, unsigned int height, unsigned int format)
+{
+ m_alloc = NULL;
+ m_width = width;
+ m_height = height;
+ m_bufFormat = format;
+ m_usage = GRALLOC_USAGE_HW_COMPOSER;
+ m_frontBuf = NULL;
+}
+
+void HWComposerNativeWindow::setup(gralloc_module_t* gralloc, alloc_device_t* alloc)
+{
+ m_alloc = alloc;
+ setBufferCount(2);
+}
+
+HWComposerNativeWindow::~HWComposerNativeWindow()
+{
+ destroyBuffers();
+}
+
+
+
+void HWComposerNativeWindow::destroyBuffers()
+{
+ TRACE("");
+
+ std::list<HWComposerNativeWindowBuffer*>::iterator it = m_bufList.begin();
+ for (; it!=m_bufList.end(); ++it)
+ {
+ HWComposerNativeWindowBuffer* fbnb = *it;
+ fbnb->common.decRef(&fbnb->common);
+ }
+ m_bufList.clear();
+ m_freeBufs = 0;
+ m_frontBuf = NULL;
+}
+
+
+
+
+/*
+ * Set the swap interval for this surface.
+ *
+ * Returns 0 on success or -errno on error.
+ */
+int HWComposerNativeWindow::setSwapInterval(int interval)
+{
+ TRACE("interval=%i WARN STUB", interval);
+ return 0;
+}
+
+
+/*
+ * Hook called by EGL to acquire a buffer. This call may block if no
+ * buffers are available.
+ *
+ * The window holds a reference to the buffer between dequeueBuffer and
+ * either queueBuffer or cancelBuffer, so clients only need their own
+ * reference if they might use the buffer after queueing or canceling it.
+ * Holding a reference to a buffer after queueing or canceling it is only
+ * allowed if a specific buffer count has been set.
+ *
+ * The libsync fence file descriptor returned in the int pointed to by the
+ * fenceFd argument will refer to the fence that must signal before the
+ * dequeued buffer may be written to. A value of -1 indicates that the
+ * caller may access the buffer immediately without waiting on a fence. If
+ * a valid file descriptor is returned (i.e. any value except -1) then the
+ * caller is responsible for closing the file descriptor.
+ *
+ * Returns 0 on success or -errno on error.
+ */
+int HWComposerNativeWindow::dequeueBuffer(BaseNativeWindowBuffer** buffer, int *fenceFd)
+{
+ HYBRIS_TRACE_BEGIN("hwcomposer-platform", "dequeueBuffer", "");
+
+ HWComposerNativeWindowBuffer* fbnb=NULL;
+
+ pthread_mutex_lock(&_mutex);
+
+ HYBRIS_TRACE_BEGIN("hwcomposer-platform", "dequeueBuffer-wait", "");
+#if defined(DEBUG)
+
+ if (m_frontBuf)
+ TRACE("Status: Has front buf %p", m_frontBuf);
+
+ std::list<HWComposerNativeWindowBuffer*>::iterator cit = m_bufList.begin();
+ for (; cit != m_bufList.end(); ++cit)
+ {
+ TRACE("Status: Buffer %p with busy %i\n", (*cit), (*cit)->busy);
+ }
+#endif
+
+
+ while (m_freeBufs==0)
+ {
+ pthread_cond_wait(&_cond, &_mutex);
+ }
+
+ while (1)
+ {
+ std::list<HWComposerNativeWindowBuffer*>::iterator it = m_bufList.begin();
+ for (; it != m_bufList.end(); ++it)
+ {
+ if (*it==m_frontBuf)
+ continue;
+ if ((*it)->busy==0)
+ {
+ TRACE("Found a free non-front buffer");
+ break;
+ }
+ }
+ if (it == m_bufList.end())
+ {
+ // have to wait once again
+ pthread_cond_wait(&_cond, &_mutex);
+ continue;
+ }
+
+ fbnb = *it;
+ break;
+ }
+ HYBRIS_TRACE_END("hwcomposer-platform", "dequeueBuffer-wait", "");
+
+ assert(fbnb!=NULL);
+ fbnb->busy = 1;
+ m_freeBufs--;
+
+ *buffer = fbnb;
+ *fenceFd = -1;
+
+ TRACE("%lu DONE --> %p", pthread_self(), fbnb);
+ pthread_mutex_unlock(&_mutex);
+ HYBRIS_TRACE_END("hwcomposer-platform", "dequeueBuffer", "");
+
+ return 0;
+}
+
+/*
+ * Hook called by EGL when modifications to the render buffer are done.
+ * This unlocks and post the buffer.
+ *
+ * The window holds a reference to the buffer between dequeueBuffer and
+ * either queueBuffer or cancelBuffer, so clients only need their own
+ * reference if they might use the buffer after queueing or canceling it.
+ * Holding a reference to a buffer after queueing or canceling it is only
+ * allowed if a specific buffer count has been set.
+ *
+ * The fenceFd argument specifies a libsync fence file descriptor for a
+ * fence that must signal before the buffer can be accessed. If the buffer
+ * can be accessed immediately then a value of -1 should be used. The
+ * caller must not use the file descriptor after it is passed to
+ * queueBuffer, and the ANativeWindow implementation is responsible for
+ * closing it.
+ *
+ * Returns 0 on success or -errno on error.
+ */
+int HWComposerNativeWindow::queueBuffer(BaseNativeWindowBuffer* buffer, int fenceFd)
+{
+ TRACE("%lu %d", pthread_self(), fenceFd);
+ HWComposerNativeWindowBuffer* fbnb = (HWComposerNativeWindowBuffer*) buffer;
+
+ HYBRIS_TRACE_BEGIN("hwcomposer-platform", "queueBuffer", "-%p", fbnb);
+ fbnb->fenceFd = fenceFd;
+
+ pthread_mutex_lock(&_mutex);
+
+ /* Front buffer hasn't yet been picked up for posting */
+ while (m_frontBuf && m_frontBuf->busy >= 2)
+ {
+ pthread_cond_wait(&_cond, &_mutex);
+ }
+
+ assert(fbnb->busy==1);
+ fbnb->busy = 2;
+ m_frontBuf = fbnb;
+ m_freeBufs++;
+
+ sync_wait(fenceFd, -1);
+ ::close(fenceFd);
+
+ pthread_cond_signal(&_cond);
+
+ TRACE("%lu %p %p",pthread_self(), m_frontBuf, fbnb);
+ pthread_mutex_unlock(&_mutex);
+ HYBRIS_TRACE_END("hwcomposer-platform", "queueBuffer", "-%p", fbnb);
+
+ return 0;
+}
+
+void HWComposerNativeWindow::lockFrontBuffer(HWComposerNativeWindowBuffer **buffer)
+{
+ TRACE("");
+ HWComposerNativeWindowBuffer *buf;
+ pthread_mutex_lock(&_mutex);
+
+ while (!m_frontBuf)
+ {
+ pthread_cond_wait(&_cond, &_mutex);
+ }
+
+ assert(m_frontBuf->busy == 2);
+
+ m_frontBuf->busy = 3;
+ buf = m_frontBuf;
+ pthread_mutex_unlock(&_mutex);
+
+ *buffer = buf;
+ return;
+
+}
+
+void HWComposerNativeWindow::unlockFrontBuffer(HWComposerNativeWindowBuffer *buffer)
+{
+ TRACE("");
+ pthread_mutex_lock(&_mutex);
+
+ assert(buffer == m_frontBuf);
+ m_frontBuf->busy = 0;
+
+ pthread_cond_signal(&_cond);
+ pthread_mutex_unlock(&_mutex);
+
+ return;
+}
+
+/*
+ * Hook used to cancel a buffer that has been dequeued.
+ * No synchronization is performed between dequeue() and cancel(), so
+ * either external synchronization is needed, or these functions must be
+ * called from the same thread.
+ *
+ * The window holds a reference to the buffer between dequeueBuffer and
+ * either queueBuffer or cancelBuffer, so clients only need their own
+ * reference if they might use the buffer after queueing or canceling it.
+ * Holding a reference to a buffer after queueing or canceling it is only
+ * allowed if a specific buffer count has been set.
+ *
+ * The fenceFd argument specifies a libsync fence file decsriptor for a
+ * fence that must signal before the buffer can be accessed. If the buffer
+ * can be accessed immediately then a value of -1 should be used.
+ *
+ * Note that if the client has not waited on the fence that was returned
+ * from dequeueBuffer, that same fence should be passed to cancelBuffer to
+ * ensure that future uses of the buffer are preceded by a wait on that
+ * fence. The caller must not use the file descriptor after it is passed
+ * to cancelBuffer, and the ANativeWindow implementation is responsible for
+ * closing it.
+ *
+ * Returns 0 on success or -errno on error.
+ */
+int HWComposerNativeWindow::cancelBuffer(BaseNativeWindowBuffer* buffer, int fenceFd)
+{
+ TRACE("");
+ HWComposerNativeWindowBuffer* fbnb = (HWComposerNativeWindowBuffer*)buffer;
+
+ pthread_mutex_lock(&_mutex);
+
+ fbnb->busy=0;
+
+ m_freeBufs++;
+
+ pthread_cond_signal(&_cond);
+ pthread_mutex_unlock(&_mutex);
+
+ return 0;
+}
+
+
+
+int HWComposerNativeWindow::lockBuffer(BaseNativeWindowBuffer* buffer)
+{
+ TRACE("%lu STUB", pthread_self());
+ return NO_ERROR;
+}
+
+
+/*
+ * see NATIVE_WINDOW_FORMAT
+ */
+unsigned int HWComposerNativeWindow::width() const
+{
+ unsigned int rv = m_width;
+ TRACE("width=%i", rv);
+ return rv;
+}
+
+
+/*
+ * see NATIVE_WINDOW_HEIGHT
+ */
+unsigned int HWComposerNativeWindow::height() const
+{
+ unsigned int rv = m_height;
+ TRACE("height=%i", rv);
+ return rv;
+}
+
+
+/*
+ * see NATIVE_WINDOW_FORMAT
+ */
+unsigned int HWComposerNativeWindow::format() const
+{
+ unsigned int rv = m_bufFormat;
+ TRACE("format=x%x", rv);
+ return rv;
+}
+
+
+/*
+ * Default width and height of ANativeWindow buffers, these are the
+ * dimensions of the window buffers irrespective of the
+ * NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS call and match the native window
+ * size unless overridden by NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS.
+ */
+/*
+ * see NATIVE_WINDOW_DEFAULT_HEIGHT
+ */
+unsigned int HWComposerNativeWindow::defaultHeight() const
+{
+ unsigned int rv = m_height;
+ TRACE("height=%i", rv);
+ return rv;
+}
+
+
+/*
+ * see BaseNativeWindow::_query(NATIVE_WINDOW_DEFAULT_WIDTH)
+ */
+unsigned int HWComposerNativeWindow::defaultWidth() const
+{
+ unsigned int rv = m_width;
+ TRACE("width=%i", rv);
+ return rv;
+}
+
+
+/*
+ * see NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER
+ */
+unsigned int HWComposerNativeWindow::queueLength() const
+{
+ TRACE("");
+ return 0;
+}
+
+
+/*
+ * see NATIVE_WINDOW_CONCRETE_TYPE
+ */
+unsigned int HWComposerNativeWindow::type() const
+{
+ TRACE("");
+ return NATIVE_WINDOW_FRAMEBUFFER;
+}
+
+
+/*
+ * see NATIVE_WINDOW_TRANSFORM_HINT
+ */
+unsigned int HWComposerNativeWindow::transformHint() const
+{
+ TRACE("");
+ return 0;
+}
+
+
+
+/*
+ * native_window_set_usage(..., usage)
+ * Sets the intended usage flags for the next buffers
+ * acquired with (*lockBuffer)() and on.
+ * By default (if this function is never called), a usage of
+ * GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE
+ * is assumed.
+ * Calling this function will usually cause following buffers to be
+ * reallocated.
+ */
+int HWComposerNativeWindow::setUsage(int usage)
+{
+ int need_realloc = (m_usage != usage);
+ TRACE("usage=x%x realloc=%d", usage, need_realloc);
+ m_usage = usage;
+ if (need_realloc)
+ this->setBufferCount(m_bufList.size());
+
+ return NO_ERROR;
+}
+
+
+/*
+ * native_window_set_buffers_format(..., int format)
+ * All buffers dequeued after this call will have the format specified.
+ *
+ * If the specified format is 0, the default buffer format will be used.
+ */
+int HWComposerNativeWindow::setBuffersFormat(int format)
+{
+ int need_realloc = (format != m_bufFormat);
+ TRACE("format=x%x realloc=%d", format, need_realloc);
+ m_bufFormat = format;
+ if (need_realloc)
+ this->setBufferCount(m_bufList.size());
+ return NO_ERROR;
+}
+
+
+/*
+ * native_window_set_buffer_count(..., count)
+ * Sets the number of buffers associated with this native window.
+ */
+int HWComposerNativeWindow::setBufferCount(int cnt)
+{
+ TRACE("cnt=%d", cnt);
+ int err=NO_ERROR;
+ pthread_mutex_lock(&_mutex);
+
+ destroyBuffers();
+
+ for(unsigned int i = 0; i < cnt; i++)
+ {
+ HWComposerNativeWindowBuffer *fbnb = new HWComposerNativeWindowBuffer(m_alloc,
+ m_width, m_height, m_bufFormat,
+ m_usage|GRALLOC_USAGE_HW_COMPOSER);
+
+ fbnb->common.incRef(&fbnb->common);
+
+ TRACE("buffer %i is at %p (native %p),err=%s, handle=%p stride=%i",
+ i, fbnb, (ANativeWindowBuffer*)fbnb,
+ strerror(-fbnb->status), fbnb->handle, fbnb->stride);
+
+ if (fbnb->status)
+ {
+ fbnb->common.decRef(&fbnb->common);
+ fprintf(stderr,"WARNING: %s: allocated only %d buffers out of %d\n", __PRETTY_FUNCTION__, m_freeBufs, cnt);
+ break;
+ }
+
+ m_freeBufs++;
+ m_bufList.push_back(fbnb);
+ }
+ pthread_mutex_unlock(&_mutex);
+
+ return err;
+}
+
+/*
+ * native_window_set_buffers_dimensions(..., int w, int h)
+ * All buffers dequeued after this call will have the dimensions specified.
+ * In particular, all buffers will have a fixed-size, independent from the
+ * native-window size. They will be scaled according to the scaling mode
+ * (see native_window_set_scaling_mode) upon window composition.
+ *
+ * If w and h are 0, the normal behavior is restored. That is, dequeued buffers
+ * following this call will be sized to match the window's size.
+ *
+ * Calling this function will reset the window crop to a NULL value, which
+ * disables cropping of the buffers.
+ */
+int HWComposerNativeWindow::setBuffersDimensions(int width, int height)
+{
+ TRACE("WARN: stub. size=%ix%i", width, height);
+ return NO_ERROR;
+}
+// vim: noai:ts=4:sw=4:ss=4:expandtab
--- /dev/null
+/*
+ * Copyright (C) 2013 libhybris
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef FBDEV_WINDOW_H
+#define FBDEV_WINDOW_H
+
+#include "nativewindowbase.h"
+#include <linux/fb.h>
+#include <android/hardware/gralloc.h>
+
+#include <list>
+
+
+class HWComposerNativeWindowBuffer : public BaseNativeWindowBuffer {
+friend class HWComposerNativeWindow;
+
+protected:
+ HWComposerNativeWindowBuffer(alloc_device_t* alloc,
+ unsigned int width,
+ unsigned int height,
+ unsigned int format,
+ unsigned int usage) ;
+ virtual ~HWComposerNativeWindowBuffer() ;
+
+protected:
+ int busy;
+ int fenceFd;
+ int status;
+ alloc_device_t* m_alloc;
+};
+
+
+class HWComposerNativeWindow : public BaseNativeWindow {
+public:
+ HWComposerNativeWindow(unsigned int width, unsigned int height, unsigned int format);
+ ~HWComposerNativeWindow();
+ void setup(gralloc_module_t* gralloc, alloc_device_t* alloc);
+
+
+ void lockFrontBuffer(HWComposerNativeWindowBuffer **buffer);
+ void unlockFrontBuffer(HWComposerNativeWindowBuffer *buffer);
+
+protected:
+ // overloads from BaseNativeWindow
+ virtual int setSwapInterval(int interval);
+
+ virtual int dequeueBuffer(BaseNativeWindowBuffer** buffer, int* fenceFd);
+ virtual int queueBuffer(BaseNativeWindowBuffer* buffer, int fenceFd);
+ virtual int cancelBuffer(BaseNativeWindowBuffer* buffer, int fenceFd);
+ virtual int lockBuffer(BaseNativeWindowBuffer* buffer);
+
+ virtual unsigned int type() const;
+ virtual unsigned int width() const;
+ virtual unsigned int height() const;
+ virtual unsigned int format() const;
+ virtual unsigned int defaultWidth() const;
+ virtual unsigned int defaultHeight() const;
+ virtual unsigned int queueLength() const;
+ virtual unsigned int transformHint() const;
+ // perform calls
+ virtual int setUsage(int usage);
+ virtual int setBuffersFormat(int format);
+ virtual int setBuffersDimensions(int width, int height);
+ virtual int setBufferCount(int cnt);
+
+private:
+ void destroyBuffers();
+
+private:
+ framebuffer_device_t* m_fbDev;
+ alloc_device_t* m_alloc;
+ unsigned int m_usage;
+ unsigned int m_bufFormat;
+ int m_freeBufs;
+ std::list<HWComposerNativeWindowBuffer*> m_bufList;
+ HWComposerNativeWindowBuffer* m_frontBuf;
+
+ int m_width;
+ int m_height;
+
+};
+
+#endif
+// vim: noai:ts=4:sw=4:ss=4:expandtab
--- /dev/null
+pkglib_LTLIBRARIES = eglplatform_null.la
+
+
+eglplatform_null_la_SOURCES = eglplatform_null.c
+eglplatform_null_la_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/egl
+
+eglplatform_null_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
+
+
--- /dev/null
+#include <ws.h>
+#include <dlfcn.h>
+#include <stdlib.h>
+
+#include <hybris/internal/binding.h>
+
+static void * (*_androidCreateDisplaySurface)();
+
+static void *_libui = NULL;
+
+static void _init_androidui()
+{
+ _libui = (void *) android_dlopen("/system/lib/libui.so", RTLD_LAZY);
+}
+
+#define UI_DLSYM(fptr, sym) do { if (_libui == NULL) { _init_androidui(); }; if (*(fptr) == NULL) { *(fptr) = (void *) android_dlsym(_libui, sym); } } while (0)
+
+static EGLNativeWindowType android_createDisplaySurface()
+{
+ UI_DLSYM(&_androidCreateDisplaySurface, "android_createDisplaySurface");
+ return (EGLNativeWindowType) (*_androidCreateDisplaySurface)();
+}
+
+
+
+static int nullws_IsValidDisplay(EGLNativeDisplayType display)
+{
+ return 1;
+}
+
+static EGLNativeWindowType nullws_CreateWindow(EGLNativeWindowType win, EGLNativeDisplayType display)
+{
+ if (win == 0)
+ {
+ return android_createDisplaySurface();
+ }
+ else
+ return win;
+}
+
+static void nullws_DestroyWindow(EGLNativeWindowType win)
+{
+ // TODO: Cleanup?
+}
+
+static __eglMustCastToProperFunctionPointerType nullws_eglGetProcAddress(const char *procname)
+{
+ return NULL;
+}
+
+static void nullws_passthroughImageKHR(EGLContext *ctx, EGLenum *target, EGLClientBuffer *buffer, const EGLint **attrib_list)
+{
+}
+
+const char *nullws_eglQueryString(EGLDisplay dpy, EGLint name, const char *(*real_eglQueryString)(EGLDisplay dpy, EGLint name))
+{
+ return (*real_eglQueryString)(dpy, name);
+}
+
+
+struct ws_module ws_module_info = {
+ nullws_IsValidDisplay,
+ nullws_CreateWindow,
+ nullws_DestroyWindow,
+ nullws_eglGetProcAddress,
+ nullws_passthroughImageKHR,
+ nullws_eglQueryString
+};
+
--- /dev/null
+pkglib_LTLIBRARIES = eglplatform_wayland.la
+
+eglplatform_wayland_la_SOURCES = eglplatform_wayland.cpp wayland_window.cpp
+eglplatform_wayland_la_CXXFLAGS = \
+ -I$(top_srcdir)/common \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/egl \
+ -I$(top_srcdir)/egl/platforms/common \
+ -I$(top_srcdir)/include/android \
+ $(WAYLAND_CLIENT_CFLAGS)
+
+if WANT_DEBUG
+eglplatform_wayland_la_CXXFLAGS += -I$(top_srcdir)/common
+endif
+
+if WANT_TRACE
+eglplatform_wayland_la_CXXFLAGS += -DDEBUG
+endif
+
+if WANT_DEBUG
+eglplatform_wayland_la_CXXFLAGS += -ggdb -O0
+endif
+
+
+
+eglplatform_wayland_la_LDFLAGS = \
+ -avoid-version -module -shared -export-dynamic \
+ $(top_builddir)/egl/platforms/common/libhybris-eglplatformcommon.la \
+ $(top_builddir)/hardware/libhardware.la \
+ $(WAYLAND_CLIENT_LIBS)
+
+if HAS_ANDROID_4_2_0
+eglplatform_wayland_la_LDFLAGS += $(top_builddir)/libsync/libsync.la
+endif
--- /dev/null
+/****************************************************************************************
+ **
+ ** Copyright (C) 2013 Jolla Ltd.
+ ** Contact: Carsten Munk <carsten.munk@jollamobile.com>
+ ** All rights reserved.
+ **
+ ** This file is part of Wayland enablement for libhybris
+ **
+ ** You may use this file under the terms of the GNU Lesser General
+ ** Public License version 2.1 as published by the Free Software Foundation
+ ** and appearing in the file license.lgpl included in the packaging
+ ** of this file.
+ **
+ ** This library is free software; you can redistribute it and/or
+ ** modify it under the terms of the GNU Lesser General Public
+ ** License version 2.1 as published by the Free Software Foundation
+ ** and appearing in the file license.lgpl included in the packaging
+ ** of this file.
+ **
+ ** 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.
+ **
+ ****************************************************************************************/
+
+#include <ws.h>
+#include <malloc.h>
+#include <assert.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <assert.h>
+extern "C" {
+#include <eglplatformcommon.h>
+};
+
+extern "C" {
+#include <wayland-client.h>
+#include <wayland-egl.h>
+}
+
+#include "wayland_window.h"
+#include "logging.h"
+#include "wayland-egl-priv.h"
+
+static int inited = 0;
+static gralloc_module_t *gralloc = 0;
+static alloc_device_t *alloc = 0;
+
+extern "C" int waylandws_IsValidDisplay(EGLNativeDisplayType display)
+{
+ int err;
+ if ( __sync_fetch_and_add(&inited,1)==0)
+ {
+ hw_get_module(GRALLOC_HARDWARE_MODULE_ID, (const hw_module_t **) &gralloc);
+ err = gralloc_open((const hw_module_t *) gralloc, &alloc);
+ TRACE("++ %lu wayland: got gralloc %p err:%s", pthread_self(), gralloc, strerror(-err));
+ eglplatformcommon_init(gralloc, alloc);
+ }
+
+ return 1;
+}
+
+extern "C" EGLNativeWindowType waylandws_CreateWindow(EGLNativeWindowType win, EGLNativeDisplayType display)
+{
+ WaylandNativeWindow *window = new WaylandNativeWindow((struct wl_egl_window *) win, (struct wl_display *) display, gralloc, alloc);
+ window->common.incRef(&window->common);
+ return (EGLNativeWindowType) static_cast<struct ANativeWindow *>(window);
+}
+
+extern "C" void waylandws_DestroyWindow(EGLNativeWindowType win)
+{
+ WaylandNativeWindow *window = static_cast<WaylandNativeWindow *>((struct ANativeWindow *)win);
+ window->common.decRef(&window->common);
+}
+
+extern "C" int waylandws_post(EGLNativeWindowType win, void *buffer)
+{
+ struct wl_egl_window *eglwin = (struct wl_egl_window *) win;
+
+ return ((WaylandNativeWindow *) eglwin->nativewindow)->postBuffer((ANativeWindowBuffer *) buffer);
+}
+
+extern "C" __eglMustCastToProperFunctionPointerType waylandws_eglGetProcAddress(const char *procname)
+{
+ if (strcmp(procname, "eglHybrisWaylandPostBuffer") == 0)
+ {
+ return (__eglMustCastToProperFunctionPointerType) waylandws_post;
+ }
+ else
+ return eglplatformcommon_eglGetProcAddress(procname);
+}
+
+extern "C" void waylandws_passthroughImageKHR(EGLContext *ctx, EGLenum *target, EGLClientBuffer *buffer, const EGLint **attrib_list)
+{
+ eglplatformcommon_passthroughImageKHR(ctx, target, buffer, attrib_list);
+}
+
+struct ws_module ws_module_info = {
+ waylandws_IsValidDisplay,
+ waylandws_CreateWindow,
+ waylandws_DestroyWindow,
+ waylandws_eglGetProcAddress,
+ waylandws_passthroughImageKHR,
+ eglplatformcommon_eglQueryString
+};
+
+
+
+
+
+
+
--- /dev/null
+/****************************************************************************************
+ **
+ ** Copyright (C) 2013 Jolla Ltd.
+ ** Contact: Carsten Munk <carsten.munk@jollamobile.com>
+ ** All rights reserved.
+ **
+ ** This file is part of Wayland enablement for libhybris
+ **
+ ** You may use this file under the terms of the GNU Lesser General
+ ** Public License version 2.1 as published by the Free Software Foundation
+ ** and appearing in the file license.lgpl included in the packaging
+ ** of this file.
+ **
+ ** This library is free software; you can redistribute it and/or
+ ** modify it under the terms of the GNU Lesser General Public
+ ** License version 2.1 as published by the Free Software Foundation
+ ** and appearing in the file license.lgpl included in the packaging
+ ** of this file.
+ **
+ ** 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.
+ **
+ ****************************************************************************************/
+
+
+#include "wayland_window.h"
+#include "wayland-egl-priv.h"
+#include <assert.h>
+#include <stdlib.h>
+#include <errno.h>
+
+#include "logging.h"
+#include <android/android-version.h>
+#include <eglhybris.h>
+
+#if ANDROID_VERSION_MAJOR>=4 && ANDROID_VERSION_MINOR>=2
+extern "C" {
+#include <android/sync/sync.h>
+}
+#endif
+
+
+
+void WaylandNativeWindowBuffer::wlbuffer_from_native_handle(struct android_wlegl *android_wlegl)
+{
+ struct wl_array ints;
+ int *ints_data;
+ struct android_wlegl_handle *wlegl_handle;
+
+ wl_array_init(&ints);
+ ints_data = (int*) wl_array_add(&ints, handle->numInts*sizeof(int));
+ memcpy(ints_data, handle->data + handle->numFds, handle->numInts*sizeof(int));
+
+ wlegl_handle = android_wlegl_create_handle(android_wlegl, handle->numFds, &ints);
+
+ wl_array_release(&ints);
+
+ for (int i = 0; i < handle->numFds; i++) {
+ android_wlegl_handle_add_fd(wlegl_handle, handle->data[i]);
+ }
+
+ wlbuffer = android_wlegl_create_buffer(android_wlegl,
+ width, height, stride,
+ format, usage, wlegl_handle);
+
+ android_wlegl_handle_destroy(wlegl_handle);
+}
+
+void WaylandNativeWindow::resize_callback(struct wl_egl_window *egl_window, void *)
+{
+ TRACE("%dx%d",egl_window->width,egl_window->height);
+ native_window_set_buffers_dimensions(
+ (WaylandNativeWindow*)egl_window->nativewindow,
+ egl_window->width,egl_window->height);
+}
+
+void WaylandNativeWindow::lock()
+{
+ pthread_mutex_lock(&this->mutex);
+}
+
+void WaylandNativeWindow::unlock()
+{
+ pthread_mutex_unlock(&this->mutex);
+}
+
+ void
+WaylandNativeWindow::registry_handle_global(void *data, struct wl_registry *registry, uint32_t name,
+ const char *interface, uint32_t version)
+{
+ WaylandNativeWindow *nw = static_cast<WaylandNativeWindow *>(data);
+
+ if (strcmp(interface, "android_wlegl") == 0) {
+ nw->m_android_wlegl = static_cast<struct android_wlegl *>(wl_registry_bind(registry, name, &android_wlegl_interface, 1));
+ }
+}
+
+static const struct wl_registry_listener registry_listener = {
+ WaylandNativeWindow::registry_handle_global
+};
+
+
+ void
+WaylandNativeWindow::sync_callback(void *data, struct wl_callback *callback, uint32_t serial)
+{
+ int *done = static_cast<int *>(data);
+
+ *done = 1;
+ wl_callback_destroy(callback);
+}
+
+static const struct wl_callback_listener sync_listener = {
+ WaylandNativeWindow::sync_callback
+};
+
+ int
+WaylandNativeWindow::wayland_roundtrip(WaylandNativeWindow *display)
+{
+ struct wl_callback *callback;
+ int done = 0, ret = 0;
+ wl_display_dispatch_queue_pending(display->m_display, display->wl_queue);
+
+ callback = wl_display_sync(display->m_display);
+ wl_callback_add_listener(callback, &sync_listener, &done);
+ wl_proxy_set_queue((struct wl_proxy *) callback, display->wl_queue);
+ while (ret == 0 && !done)
+ ret = wl_display_dispatch_queue(display->m_display, display->wl_queue);
+
+ return ret;
+}
+
+static void check_fatal_error(struct wl_display *display)
+{
+ int error = wl_display_get_error(display);
+
+ if (error == 0)
+ return;
+
+ fprintf(stderr, "Wayland display got fatal error %i: %s\n", error, strerror(error));
+
+ if (errno != 0)
+ fprintf(stderr, "Additionally, errno was set to %i: %s\n", errno, strerror(errno));
+
+ fprintf(stderr, "The display is now unusable, aborting.\n");
+ abort();
+}
+
+ static void
+wayland_frame_callback(void *data, struct wl_callback *callback, uint32_t time)
+{
+ WaylandNativeWindow *surface = static_cast<WaylandNativeWindow *>(data);
+ surface->frame();
+ wl_callback_destroy(callback);
+}
+
+static const struct wl_callback_listener frame_listener = {
+ wayland_frame_callback
+};
+
+WaylandNativeWindow::WaylandNativeWindow(struct wl_egl_window *window, struct wl_display *display, const gralloc_module_t* gralloc, alloc_device_t* alloc_device)
+{
+ int wayland_ok;
+
+ HYBRIS_TRACE_BEGIN("wayland-platform", "create_window", "");
+ this->m_window = window;
+ this->m_window->nativewindow = (void *) this;
+ this->m_display = display;
+ this->m_width = window->width;
+ this->m_height = window->height;
+ this->m_defaultWidth = window->width;
+ this->m_defaultHeight = window->height;
+ this->m_window->resize_callback = resize_callback;
+ this->m_format = 1;
+ this->wl_queue = wl_display_create_queue(display);
+ this->frame_callback = NULL;
+ this->registry = wl_display_get_registry(display);
+ wl_proxy_set_queue((struct wl_proxy *) this->registry,
+ this->wl_queue);
+ wl_registry_add_listener(this->registry, ®istry_listener, this);
+
+ wayland_ok = wayland_roundtrip(this);
+ assert(wayland_ok >= 0);
+ assert(this->m_android_wlegl != NULL);
+
+ this->m_gralloc = gralloc;
+ this->m_alloc = alloc_device;
+
+ m_usage=GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE;
+ pthread_mutex_init(&mutex, NULL);
+ pthread_cond_init(&cond, NULL);
+ m_freeBufs = 0;
+ setBufferCount(3);
+ HYBRIS_TRACE_END("wayland-platform", "create_window", "");
+}
+
+WaylandNativeWindow::~WaylandNativeWindow()
+{
+ std::list<WaylandNativeWindowBuffer *>::iterator it = m_bufList.begin();
+ for (; it != m_bufList.end(); it++)
+ {
+ WaylandNativeWindowBuffer* buf=*it;
+ if (buf->wlbuffer)
+ wl_buffer_destroy(buf->wlbuffer);
+ buf->wlbuffer = NULL;
+ buf->common.decRef(&buf->common);
+ }
+ if (frame_callback)
+ wl_callback_destroy(frame_callback);
+ wl_registry_destroy(registry);
+ wl_event_queue_destroy(wl_queue);
+ android_wlegl_destroy(m_android_wlegl);
+}
+
+void WaylandNativeWindow::frame() {
+ HYBRIS_TRACE_BEGIN("wayland-platform", "frame_event", "");
+
+ this->frame_callback = NULL;
+
+ HYBRIS_TRACE_END("wayland-platform", "frame_event", "");
+}
+
+
+// overloads from BaseNativeWindow
+int WaylandNativeWindow::setSwapInterval(int interval) {
+ TRACE("interval:%i", interval);
+ return 0;
+}
+
+ static void
+wl_buffer_release(void *data, struct wl_buffer *buffer)
+{
+ WaylandNativeWindow *win = static_cast<WaylandNativeWindow *>(data);
+ win->releaseBuffer(buffer);
+}
+
+static struct wl_buffer_listener wl_buffer_listener = {
+ wl_buffer_release
+};
+
+void WaylandNativeWindow::releaseBuffer(struct wl_buffer *buffer)
+{
+ lock();
+ std::list<WaylandNativeWindowBuffer *>::iterator it = posted.begin();
+
+ for (; it != posted.end(); it++)
+ {
+ if ((*it)->wlbuffer == buffer)
+ break;
+ }
+
+ if (it != posted.end())
+ {
+ WaylandNativeWindowBuffer* pwnb = *it;
+ posted.erase(it);
+ TRACE("released posted buffer: %p", buffer);
+ pwnb->busy = 0;
+ pthread_cond_signal(&cond);
+ unlock();
+ return;
+ }
+
+ it = fronted.begin();
+
+ for (; it != fronted.end(); it++)
+ {
+ if ((*it)->wlbuffer == buffer)
+ break;
+ }
+ assert(it != fronted.end());
+
+
+
+ WaylandNativeWindowBuffer* wnb = *it;
+ fronted.erase(it);
+ HYBRIS_TRACE_COUNTER("wayland-platform", "fronted.size", "%i", fronted.size());
+
+ for (it = m_bufList.begin(); it != m_bufList.end(); it++)
+ {
+ if ((*it) == wnb)
+ break;
+ }
+ assert(it != m_bufList.end());
+ HYBRIS_TRACE_BEGIN("wayland-platform", "releaseBuffer", "-%p", wnb);
+ wnb->busy = 0;
+
+ ++m_freeBufs;
+ HYBRIS_TRACE_COUNTER("wayland-platform", "m_freeBufs", "%i", m_freeBufs);
+ for (it = m_bufList.begin(); it != m_bufList.end(); it++)
+ {
+ (*it)->youngest = 0;
+ }
+ wnb->youngest = 1;
+
+
+ pthread_cond_signal(&cond);
+ HYBRIS_TRACE_END("wayland-platform", "releaseBuffer", "-%p", wnb);
+ unlock();
+}
+
+
+int WaylandNativeWindow::dequeueBuffer(BaseNativeWindowBuffer **buffer, int *fenceFd){
+ HYBRIS_TRACE_BEGIN("wayland-platform", "dequeueBuffer", "");
+
+ WaylandNativeWindowBuffer *wnb=NULL;
+ TRACE("%p", buffer);
+
+ lock();
+ HYBRIS_TRACE_BEGIN("wayland-platform", "dequeueBuffer_wait_for_buffer", "");
+
+ HYBRIS_TRACE_COUNTER("wayland-platform", "m_freeBufs", "%i", m_freeBufs);
+
+ while (m_freeBufs==0) {
+ HYBRIS_TRACE_COUNTER("wayland-platform", "m_freeBufs", "%i", m_freeBufs);
+
+ pthread_cond_wait(&cond,&mutex);
+ }
+ std::list<WaylandNativeWindowBuffer *>::iterator it = m_bufList.begin();
+ for (; it != m_bufList.end(); it++)
+ {
+ if ((*it)->busy)
+ continue;
+ if ((*it)->youngest == 1)
+ continue;
+ break;
+ }
+
+ if (it==m_bufList.end()) {
+ HYBRIS_TRACE_BEGIN("wayland-platform", "dequeueBuffer_worst_case_scenario", "");
+ HYBRIS_TRACE_END("wayland-platform", "dequeueBuffer_worst_case_scenario", "");
+
+ it = m_bufList.begin();
+ for (; it != m_bufList.end() && (*it)->busy; it++)
+ {}
+
+ }
+ if (it==m_bufList.end()) {
+ unlock();
+ HYBRIS_TRACE_BEGIN("wayland-platform", "dequeueBuffer_no_free_buffers", "");
+ HYBRIS_TRACE_END("wayland-platform", "dequeueBuffer_no_free_buffers", "");
+ TRACE("%p: no free buffers", buffer);
+ return NO_ERROR;
+ }
+
+ wnb = *it;
+ assert(wnb!=NULL);
+ HYBRIS_TRACE_END("wayland-platform", "dequeueBuffer_wait_for_buffer", "");
+
+ /* If the buffer doesn't match the window anymore, re-allocate */
+ if (wnb->width != m_window->width || wnb->height != m_window->height
+ || wnb->format != m_format || wnb->usage != m_usage)
+ {
+ TRACE("wnb:%p,win:%p %i,%i %i,%i x%x,x%x x%x,x%x",
+ wnb,m_window,
+ wnb->width,m_window->width, wnb->height,m_window->height,
+ wnb->format,m_format, wnb->usage,m_usage);
+ destroyBuffer(wnb);
+ m_bufList.erase(it);
+ wnb = addBuffer();
+ }
+
+ wnb->busy = 1;
+ *buffer = wnb;
+ --m_freeBufs;
+
+ HYBRIS_TRACE_COUNTER("wayland-platform", "m_freeBufs", "%i", m_freeBufs);
+ HYBRIS_TRACE_BEGIN("wayland-platform", "dequeueBuffer_gotBuffer", "-%p", wnb);
+ HYBRIS_TRACE_END("wayland-platform", "dequeueBuffer_gotBuffer", "-%p", wnb);
+ HYBRIS_TRACE_END("wayland-platform", "dequeueBuffer_wait_for_buffer", "");
+
+ unlock();
+ return NO_ERROR;
+}
+
+int WaylandNativeWindow::lockBuffer(BaseNativeWindowBuffer* buffer){
+ WaylandNativeWindowBuffer *wnb = (WaylandNativeWindowBuffer*) buffer;
+ HYBRIS_TRACE_BEGIN("wayland-platform", "lockBuffer", "-%p", wnb);
+ HYBRIS_TRACE_END("wayland-platform", "lockBuffer", "-%p", wnb);
+ return NO_ERROR;
+}
+
+int WaylandNativeWindow::postBuffer(ANativeWindowBuffer* buffer)
+{
+ TRACE("");
+ WaylandNativeWindowBuffer *wnb = NULL;
+
+ lock();
+ std::list<WaylandNativeWindowBuffer *>::iterator it = post_registered.begin();
+ for (; it != post_registered.end(); it++)
+ {
+ if ((*it)->other == buffer)
+ {
+ wnb = (*it);
+ break;
+ }
+ }
+ unlock();
+ if (!wnb)
+ {
+ wnb = new WaylandNativeWindowBuffer(buffer);
+
+ wnb->common.incRef(&wnb->common);
+ buffer->common.incRef(&buffer->common);
+ }
+
+ int ret = 0;
+
+ lock();
+ wnb->busy = 1;
+ unlock();
+ /* XXX locking/something is a bit fishy here */
+ while (this->frame_callback && ret != -1) {
+ ret = wl_display_dispatch_queue(m_display, this->wl_queue);
+ }
+
+ if (ret < 0) {
+ TRACE("wl_display_dispatch_queue returned an error:%i", ret);
+ check_fatal_error(m_display);
+ return ret;
+ }
+
+ lock();
+ this->frame_callback = wl_surface_frame(m_window->surface);
+ wl_callback_add_listener(this->frame_callback, &frame_listener, this);
+ wl_proxy_set_queue((struct wl_proxy *) this->frame_callback, this->wl_queue);
+
+ if (wnb->wlbuffer == NULL)
+ {
+ wnb->wlbuffer_from_native_handle(m_android_wlegl);
+ TRACE("%p add listener with %p inside", wnb, wnb->wlbuffer);
+ wl_buffer_add_listener(wnb->wlbuffer, &wl_buffer_listener, this);
+ wl_proxy_set_queue((struct wl_proxy *) wnb->wlbuffer, this->wl_queue);
+ post_registered.push_back(wnb);
+ }
+ TRACE("%p DAMAGE AREA: %dx%d", wnb, wnb->width, wnb->height);
+ wl_surface_attach(m_window->surface, wnb->wlbuffer, 0, 0);
+ wl_surface_damage(m_window->surface, 0, 0, wnb->width, wnb->height);
+ wl_surface_commit(m_window->surface);
+ //--m_freeBufs;
+ //pthread_cond_signal(&cond);
+ posted.push_back(wnb);
+ unlock();
+
+ return NO_ERROR;
+}
+
+static int debugenvchecked = 0;
+
+int WaylandNativeWindow::queueBuffer(BaseNativeWindowBuffer* buffer, int fenceFd)
+{
+ WaylandNativeWindowBuffer *wnb = (WaylandNativeWindowBuffer*) buffer;
+ int ret = 0;
+
+ HYBRIS_TRACE_BEGIN("wayland-platform", "queueBuffer", "-%p", wnb);
+ lock();
+ wnb->busy = 1;
+ unlock();
+ /* XXX locking/something is a bit fishy here */
+ HYBRIS_TRACE_BEGIN("wayland-platform", "queueBuffer_wait_for_frame_callback", "-%p", wnb);
+
+ while (this->frame_callback && ret != -1) {
+ ret = wl_display_dispatch_queue(m_display, this->wl_queue);
+ }
+
+
+ if (ret < 0) {
+ TRACE("wl_display_dispatch_queue returned an error");
+ HYBRIS_TRACE_END("wayland-platform", "queueBuffer_wait_for_frame_callback", "-%p", wnb);
+ check_fatal_error(m_display);
+ return ret;
+ }
+
+ HYBRIS_TRACE_END("wayland-platform", "queueBuffer_wait_for_frame_callback", "-%p", wnb);
+
+
+ lock();
+
+ if (debugenvchecked == 0)
+ {
+ if (getenv("HYBRIS_WAYLAND_DUMP_BUFFERS") != NULL)
+ debugenvchecked = 2;
+ else
+ debugenvchecked = 1;
+ }
+ if (debugenvchecked == 2)
+ {
+ HYBRIS_TRACE_BEGIN("wayland-platform", "queueBuffer_dumping_buffer", "-%p", wnb);
+ hybris_dump_buffer_to_file(wnb->getNativeBuffer());
+ HYBRIS_TRACE_END("wayland-platform", "queueBuffer_dumping_buffer", "-%p", wnb);
+
+ }
+
+#if ANDROID_VERSION_MAJOR>=4 && ANDROID_VERSION_MINOR>=2
+ HYBRIS_TRACE_BEGIN("wayland-platform", "queueBuffer_waiting_for_fence", "-%p", wnb);
+ sync_wait(fenceFd, -1);
+ close(fenceFd);
+ HYBRIS_TRACE_END("wayland-platform", "queueBuffer_waiting_for_fence", "-%p", wnb);
+#endif
+
+ this->frame_callback = wl_surface_frame(m_window->surface);
+ wl_callback_add_listener(this->frame_callback, &frame_listener, this);
+ wl_proxy_set_queue((struct wl_proxy *) this->frame_callback, this->wl_queue);
+
+ if (wnb->wlbuffer == NULL)
+ {
+ wnb->wlbuffer_from_native_handle(m_android_wlegl);
+ TRACE("%p add listener with %p inside", wnb, wnb->wlbuffer);
+ wl_buffer_add_listener(wnb->wlbuffer, &wl_buffer_listener, this);
+ wl_proxy_set_queue((struct wl_proxy *) wnb->wlbuffer, this->wl_queue);
+ }
+ TRACE("%p DAMAGE AREA: %dx%d", wnb, wnb->width, wnb->height);
+ HYBRIS_TRACE_BEGIN("wayland-platform", "queueBuffer_attachdamagecommit", "-resource@%i", wl_proxy_get_id((struct wl_proxy *) wnb->wlbuffer));
+
+ wl_surface_attach(m_window->surface, wnb->wlbuffer, 0, 0);
+ wl_surface_damage(m_window->surface, 0, 0, wnb->width, wnb->height);
+ wl_surface_commit(m_window->surface);
+ wl_display_flush(m_display);
+ HYBRIS_TRACE_END("wayland-platform", "queueBuffer_attachdamagecommit", "-resource@%i", wl_proxy_get_id((struct wl_proxy *) wnb->wlbuffer));
+
+ //--m_freeBufs;
+ //pthread_cond_signal(&cond);
+ fronted.push_back(wnb);
+ HYBRIS_TRACE_COUNTER("wayland-platform", "fronted.size", "%i", fronted.size());
+
+ if (fronted.size() == m_bufList.size())
+ {
+ HYBRIS_TRACE_BEGIN("wayland-platform", "queueBuffer_wait_for_nonfronted_buffer", "-%p", wnb);
+
+ /* We have fronted all our buffers, let's wait for one of them to be free */
+ do {
+ unlock();
+ ret = wl_display_dispatch_queue(m_display, this->wl_queue);
+ lock();
+ if (ret == -1)
+ {
+ check_fatal_error(m_display);
+ break;
+ }
+ HYBRIS_TRACE_COUNTER("wayland-platform", "fronted.size", "%i", fronted.size());
+
+ if (fronted.size() != m_bufList.size())
+ break;
+ } while (1);
+ HYBRIS_TRACE_END("wayland-platform", "queueBuffer_wait_for_nonfronted_buffer", "-%p", wnb);
+ }
+ HYBRIS_TRACE_END("wayland-platform", "queueBuffer", "-%p", wnb);
+ unlock();
+
+ return NO_ERROR;
+}
+
+int WaylandNativeWindow::cancelBuffer(BaseNativeWindowBuffer* buffer, int fenceFd){
+ std::list<WaylandNativeWindowBuffer *>::iterator it;
+ WaylandNativeWindowBuffer *wnb = (WaylandNativeWindowBuffer*) buffer;
+
+ lock();
+ HYBRIS_TRACE_BEGIN("wayland-platform", "cancelBuffer", "-%p", wnb);
+
+ /* Check first that it really is our buffer */
+ for (it = m_bufList.begin(); it != m_bufList.end(); it++)
+ {
+ if ((*it) == wnb)
+ break;
+ }
+ assert(it != m_bufList.end());
+
+ wnb->busy = 0;
+ ++m_freeBufs;
+ HYBRIS_TRACE_COUNTER("wayland-platform", "m_freeBufs", "%i", m_freeBufs);
+
+ for (it = m_bufList.begin(); it != m_bufList.end(); it++)
+ {
+ (*it)->youngest = 0;
+ }
+ wnb->youngest = 1;
+
+ pthread_cond_signal(&cond);
+
+ HYBRIS_TRACE_END("wayland-platform", "cancelBuffer", "-%p", wnb);
+ unlock();
+ return 0;
+}
+
+unsigned int WaylandNativeWindow::width() const {
+ TRACE("value:%i", m_width);
+ return m_width;
+}
+
+unsigned int WaylandNativeWindow::height() const {
+ TRACE("value:%i", m_height);
+ return m_height;
+}
+
+unsigned int WaylandNativeWindow::format() const {
+ TRACE("value:%i", m_format);
+ return m_format;
+}
+
+unsigned int WaylandNativeWindow::defaultWidth() const {
+ TRACE("value:%i", m_defaultWidth);
+ return m_defaultWidth;
+}
+
+unsigned int WaylandNativeWindow::defaultHeight() const {
+ TRACE("value:%i", m_defaultHeight);
+ return m_defaultHeight;
+}
+
+unsigned int WaylandNativeWindow::queueLength() const {
+ TRACE("WARN: stub");
+ return 1;
+}
+
+unsigned int WaylandNativeWindow::type() const {
+ TRACE("");
+#if ANDROID_VERSION_MAJOR>=4 && ANDROID_VERSION_MINOR>=3
+ /* https://android.googlesource.com/platform/system/core/+/bcfa910611b42018db580b3459101c564f802552%5E!/ */
+ return NATIVE_WINDOW_SURFACE;
+#else
+ return NATIVE_WINDOW_SURFACE_TEXTURE_CLIENT;
+#endif
+}
+
+unsigned int WaylandNativeWindow::transformHint() const {
+ TRACE("WARN: stub");
+ return 0;
+}
+
+int WaylandNativeWindow::setBuffersFormat(int format) {
+ if (format != m_format)
+ {
+ TRACE("old-format:x%x new-format:x%x", m_format, format);
+ m_format = format;
+ /* Buffers will be re-allocated when dequeued */
+ } else {
+ TRACE("format:x%x", format);
+ }
+ return NO_ERROR;
+}
+
+void WaylandNativeWindow::destroyBuffer(WaylandNativeWindowBuffer* wnb)
+{
+ TRACE("wnb:%p", wnb);
+
+ assert(wnb != NULL);
+ if (wnb->wlbuffer)
+ wl_buffer_destroy(wnb->wlbuffer);
+ wnb->wlbuffer = NULL;
+ wnb->common.decRef(&wnb->common);
+ m_freeBufs--;
+}
+
+void WaylandNativeWindow::destroyBuffers()
+{
+ TRACE("");
+
+ std::list<WaylandNativeWindowBuffer*>::iterator it = m_bufList.begin();
+ for (; it!=m_bufList.end(); ++it)
+ {
+ destroyBuffer(*it);
+ }
+ m_bufList.clear();
+ m_freeBufs = 0;
+}
+
+WaylandNativeWindowBuffer *WaylandNativeWindow::addBuffer() {
+
+ WaylandNativeWindowBuffer *wnb = new WaylandNativeWindowBuffer(m_alloc, m_width, m_height, m_format, m_usage);
+ m_bufList.push_back(wnb);
+ wnb->common.incRef(&wnb->common);
+ ++m_freeBufs;
+
+ TRACE("wnb:%p width:%i height:%i format:x%x usage:x%x",
+ wnb, wnb->width, wnb->height, wnb->format, wnb->usage);
+
+ return wnb;
+}
+
+
+int WaylandNativeWindow::setBufferCount(int cnt) {
+ int start = 0;
+
+ TRACE("cnt:%d", cnt);
+
+ if (m_bufList.size() == cnt)
+ return NO_ERROR;
+
+ lock();
+
+ if (m_bufList.size() > cnt) {
+ /* Decreasing buffer count, remove from beginning */
+ std::list<WaylandNativeWindowBuffer*>::iterator it = m_bufList.begin();
+ for (int i = 0; i <= m_bufList.size() - cnt; i++ )
+ {
+ destroyBuffer(*it);
+ ++it;
+ m_bufList.pop_front();
+ }
+
+ } else {
+ /* Increasing buffer count, start from current size */
+ for (int i = m_bufList.size(); i < cnt; i++)
+ WaylandNativeWindowBuffer *unused = addBuffer();
+
+ }
+
+ unlock();
+
+ return NO_ERROR;
+}
+
+
+
+
+int WaylandNativeWindow::setBuffersDimensions(int width, int height) {
+ if (m_width != width || m_height != height)
+ {
+ TRACE("old-size:%ix%i new-size:%ix%i", m_width, m_height, width, height);
+ m_width = m_defaultWidth = width;
+ m_height = m_defaultHeight = height;
+ /* Buffers will be re-allocated when dequeued */
+ } else {
+ TRACE("size:%ix%i", width, height);
+ }
+ return NO_ERROR;
+}
+
+int WaylandNativeWindow::setUsage(int usage) {
+ if ((usage | GRALLOC_USAGE_HW_TEXTURE) != m_usage)
+ {
+ TRACE("old-usage:x%x new-usage:x%x", m_usage, usage);
+ m_usage = usage | GRALLOC_USAGE_HW_TEXTURE;
+ /* Buffers will be re-allocated when dequeued */
+ } else {
+ TRACE("usage:x%x", usage);
+ }
+ return NO_ERROR;
+}
+// vim: noai:ts=4:sw=4:ss=4:expandtab
--- /dev/null
+/****************************************************************************************
+ **
+ ** Copyright (C) 2013 Jolla Ltd.
+ ** Contact: Carsten Munk <carsten.munk@jollamobile.com>
+ ** All rights reserved.
+ **
+ ** This file is part of Wayland enablement for libhybris
+ **
+ ** You may use this file under the terms of the GNU Lesser General
+ ** Public License version 2.1 as published by the Free Software Foundation
+ ** and appearing in the file license.lgpl included in the packaging
+ ** of this file.
+ **
+ ** This library is free software; you can redistribute it and/or
+ ** modify it under the terms of the GNU Lesser General Public
+ ** License version 2.1 as published by the Free Software Foundation
+ ** and appearing in the file license.lgpl included in the packaging
+ ** of this file.
+ **
+ ** 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.
+ **
+ ****************************************************************************************/
+
+
+#ifndef Wayland_WINDOW_H
+#define Wayland_WINDOW_H
+#include "nativewindowbase.h"
+#include <linux/fb.h>
+#include <android/hardware/gralloc.h>
+extern "C" {
+
+#include <wayland-client.h>
+#include <wayland-egl.h>
+#include "wayland-android-client-protocol.h"
+#include <pthread.h>
+}
+#include <list>
+
+class WaylandNativeWindowBuffer : public BaseNativeWindowBuffer
+{
+friend class WaylandNativeWindow;
+protected:
+ WaylandNativeWindowBuffer(alloc_device_t* alloc_device,
+ unsigned int width,
+ unsigned int height,
+ unsigned int format,
+ unsigned int usage)
+ {
+ // Base members
+ ANativeWindowBuffer::width = width;
+ ANativeWindowBuffer::height = height;
+ ANativeWindowBuffer::format = format;
+ ANativeWindowBuffer::usage = usage;
+ this->wlbuffer = NULL;
+ this->busy = 0;
+ this->other = NULL;
+ this->m_alloc = alloc_device;
+ int alloc_ok = this->m_alloc->alloc(this->m_alloc,
+ this->width ? this->width : 1, this->height ? this->height : 1,
+ this->format, this->usage,
+ &this->handle, &this->stride);
+ assert(alloc_ok == 0);
+ this->youngest = 0;
+ }
+ WaylandNativeWindowBuffer(ANativeWindowBuffer *other)
+ {
+ ANativeWindowBuffer::width = other->width;
+ ANativeWindowBuffer::height = other->height;
+ ANativeWindowBuffer::format = other->format;
+ ANativeWindowBuffer::usage = other->usage;
+ ANativeWindowBuffer::handle = other->handle;
+ ANativeWindowBuffer::stride = other->stride;
+ this->wlbuffer = NULL;
+ this->busy = 0;
+ this->other = other;
+ this->m_alloc = NULL;
+ this->youngest = 0;
+ }
+ ~WaylandNativeWindowBuffer()
+ {
+ if (this->m_alloc)
+ m_alloc->free(m_alloc, this->handle);
+ }
+ void wlbuffer_from_native_handle(struct android_wlegl *android_wlegl);
+
+protected:
+ void* vaddr;
+ alloc_device_t* m_alloc;
+
+public:
+ struct wl_buffer *wlbuffer;
+ int busy;
+ int youngest;
+ ANativeWindowBuffer *other;
+};
+
+
+class WaylandNativeWindow : public BaseNativeWindow {
+public:
+ WaylandNativeWindow(struct wl_egl_window *win, struct wl_display *display, const gralloc_module_t* gralloc, alloc_device_t* alloc_device);
+ ~WaylandNativeWindow();
+
+ void lock();
+ void unlock();
+ void frame();
+ void releaseBuffer(struct wl_buffer *buffer);
+ int postBuffer(ANativeWindowBuffer *buffer);
+
+ static void sync_callback(void *data, struct wl_callback *callback, uint32_t serial);
+ static void registry_handle_global(void *data, struct wl_registry *registry, uint32_t name,
+ const char *interface, uint32_t version);
+ static void resize_callback(struct wl_egl_window *egl_window, void *);
+ struct wl_event_queue *wl_queue;
+
+protected:
+ // overloads from BaseNativeWindow
+ virtual int setSwapInterval(int interval);
+ virtual int dequeueBuffer(BaseNativeWindowBuffer **buffer, int *fenceFd);
+ virtual int lockBuffer(BaseNativeWindowBuffer* buffer);
+ virtual int queueBuffer(BaseNativeWindowBuffer* buffer, int fenceFd);
+ virtual int cancelBuffer(BaseNativeWindowBuffer* buffer, int fenceFd);
+ virtual unsigned int type() const;
+ virtual unsigned int width() const;
+ virtual unsigned int height() const;
+ virtual unsigned int format() const;
+ virtual unsigned int defaultWidth() const;
+ virtual unsigned int defaultHeight() const;
+ virtual unsigned int queueLength() const;
+ virtual unsigned int transformHint() const;
+ // perform calls
+ virtual int setUsage(int usage);
+ virtual int setBuffersFormat(int format);
+ virtual int setBuffersDimensions(int width, int height);
+ virtual int setBufferCount(int cnt);
+
+private:
+ WaylandNativeWindowBuffer *addBuffer();
+ void destroyBuffer(WaylandNativeWindowBuffer *);
+ void destroyBuffers();
+ std::list<WaylandNativeWindowBuffer *> m_bufList;
+ std::list<WaylandNativeWindowBuffer *> fronted;
+ std::list<WaylandNativeWindowBuffer *> posted;
+ std::list<WaylandNativeWindowBuffer *> post_registered;
+ struct wl_egl_window *m_window;
+ struct wl_display *m_display;
+ unsigned int m_width;
+ unsigned int m_height;
+ unsigned int m_format;
+ unsigned int m_defaultWidth;
+ unsigned int m_defaultHeight;
+ unsigned int m_usage;
+ struct android_wlegl *m_android_wlegl;
+ alloc_device_t* m_alloc;
+ struct wl_registry *registry;
+ const gralloc_module_t* m_gralloc;
+ pthread_mutex_t mutex;
+ pthread_cond_t cond;
+ int m_freeBufs;
+ struct wl_callback *frame_callback;
+ static int wayland_roundtrip(WaylandNativeWindow *display);
+};
+
+#endif
+// vim: noai:ts=4:sw=4:ss=4:expandtab
--- /dev/null
+/*
+ * Copyright (C) 2013 libhybris
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <ws.h>
+#include <stdlib.h>
+#include <dlfcn.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <stdio.h>
+
+static struct ws_module *ws = NULL;
+
+static void _init_ws()
+{
+ if (ws == NULL)
+ {
+ char ws_name[2048];
+ char *egl_platform;
+
+ // Mesa uses EGL_PLATFORM for its own purposes.
+ // Add HYBRIS_EGLPLATFORM to avoid the conflicts
+ egl_platform=getenv("HYBRIS_EGLPLATFORM");
+
+ if (egl_platform == NULL)
+ egl_platform=getenv("EGL_PLATFORM");
+
+ if (egl_platform == NULL)
+ egl_platform = DEFAULT_EGL_PLATFORM;
+
+ snprintf(ws_name, 2048, PKGLIBDIR "eglplatform_%s.so", egl_platform);
+
+ void *wsmod = (void *) dlopen(ws_name, RTLD_LAZY);
+ if (wsmod==NULL)
+ {
+ fprintf(stderr, "ERROR: %s\n\t%s\n", ws_name, dlerror());
+ assert(0);
+ }
+ ws = dlsym(wsmod, "ws_module_info");
+ assert(ws != NULL);
+ }
+}
+
+
+int ws_IsValidDisplay(EGLNativeDisplayType display)
+{
+ _init_ws();
+ return ws->IsValidDisplay(display);
+}
+
+EGLNativeWindowType ws_CreateWindow(EGLNativeWindowType win, EGLNativeDisplayType display)
+{
+ _init_ws();
+ return ws->CreateWindow(win, display);
+}
+
+void ws_DestroyWindow(EGLNativeWindowType win)
+{
+ _init_ws();
+ return ws->DestroyWindow(win);
+}
+
+__eglMustCastToProperFunctionPointerType ws_eglGetProcAddress(const char *procname)
+{
+ _init_ws();
+ return ws->eglGetProcAddress(procname);
+}
+
+void ws_passthroughImageKHR(EGLContext *ctx, EGLenum *target, EGLClientBuffer *buffer, const EGLint **attrib_list)
+{
+ _init_ws();
+ return ws->passthroughImageKHR(ctx, target, buffer, attrib_list);
+}
+
+const char *ws_eglQueryString(EGLDisplay dpy, EGLint name, const char *(*real_eglQueryString)(EGLDisplay dpy, EGLint name))
+{
+ _init_ws();
+ return ws->eglQueryString(dpy, name, real_eglQueryString);
+}
+
+// vim:ts=4:sw=4:noexpandtab
--- /dev/null
+#ifndef __LIBHYBRIS_WS_H
+#define __LIBHYBRIS_WS_H
+#include <EGL/egl.h>
+
+struct ws_module {
+ int (*IsValidDisplay)(EGLNativeDisplayType display_id);
+ EGLNativeWindowType (*CreateWindow)(EGLNativeWindowType win, EGLNativeDisplayType display);
+ void (*DestroyWindow)(EGLNativeWindowType win);
+ __eglMustCastToProperFunctionPointerType (*eglGetProcAddress)(const char *procname);
+ void (*passthroughImageKHR)(EGLContext *ctx, EGLenum *target, EGLClientBuffer *buffer, const EGLint **attrib_list);
+ const char *(*eglQueryString)(EGLDisplay dpy, EGLint name, const char *(*real_eglQueryString)(EGLDisplay dpy, EGLint name));
+};
+
+int ws_IsValidDisplay(EGLNativeDisplayType display);
+EGLNativeWindowType ws_CreateWindow(EGLNativeWindowType win, EGLNativeDisplayType display);
+void ws_DestroyWindow(EGLNativeWindowType win);
+__eglMustCastToProperFunctionPointerType ws_eglGetProcAddress(const char *procname);
+void ws_passthroughImageKHR(EGLContext *ctx, EGLenum *target, EGLClientBuffer *buffer, const EGLint **attrib_list);
+const char *ws_eglQueryString(EGLDisplay dpy, EGLint name, const char *(*real_eglQueryString)(EGLDisplay dpy, EGLint name));
+
+#endif
--- /dev/null
+lib_LTLIBRARIES = \
+ libGLESv1_CM.la
+
+libGLESv1_CM_la_SOURCES = glesv1_cm.c
+libGLESv1_CM_la_CFLAGS = -I$(top_srcdir)/include
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = glesv1_cm.pc
+
+if WANT_MESA
+libGLESv1_CM_la_CFLAGS += -DLIBHYBRIS_WANTS_MESA_X11_HEADERS
+endif
+if WANT_TRACE
+libGLESv1_CM_la_CFLAGS += -DDEBUG
+endif
+if WANT_DEBUG
+libGLESv1_CM_la_CFLAGS += -ggdb -O0
+endif
+libGLESv1_CM_la_LDFLAGS = \
+ $(top_builddir)/common/libhybris-common.la \
+ -version-info "1":"1":"0"
--- /dev/null
+/*
+ * Copyright (C) 2013 Jolla Ltd.
+ * Contact: Thomas Perl <thomas.perl@jollamobile.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#define GL_GLEXT_PROTOTYPES
+#include <GLES/gl.h>
+#include <GLES/glext.h>
+
+#include <dlfcn.h>
+#include <stddef.h>
+#include <stdlib.h>
+
+#include <hybris/internal/binding.h>
+
+#define GLESV1_CM_LIBRARY_PATH "/system/lib/libGLESv1_CM.so"
+
+HYBRIS_LIBRARY_INITIALIZE(glesv1_cm, GLESV1_CM_LIBRARY_PATH);
+
+/* Scripts to generate these bindings can be found in utils/generate_glesv1/ */
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glAlphaFunc, GLenum, GLclampf);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv1_cm, glClearColor, GLclampf, GLclampf, GLclampf, GLclampf);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glClearDepthf, GLclampf);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glClipPlanef, GLenum, const GLfloat *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv1_cm, glColor4f, GLfloat, GLfloat, GLfloat, GLfloat);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glDepthRangef, GLclampf, GLclampf);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glFogf, GLenum, GLfloat);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glFogfv, GLenum, const GLfloat *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION6(glesv1_cm, glFrustumf, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glGetClipPlanef, GLenum, GLfloat *); /* was: GLfloat[4] */
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glGetFloatv, GLenum, GLfloat *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glGetLightfv, GLenum, GLenum, GLfloat *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glGetMaterialfv, GLenum, GLenum, GLfloat *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glGetTexEnvfv, GLenum, GLenum, GLfloat *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glGetTexParameterfv, GLenum, GLenum, GLfloat *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glLightModelf, GLenum, GLfloat);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glLightModelfv, GLenum, const GLfloat *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glLightf, GLenum, GLenum, GLfloat);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glLightfv, GLenum, GLenum, const GLfloat *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glLineWidth, GLfloat);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glLoadMatrixf, const GLfloat *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glMaterialf, GLenum, GLenum, GLfloat);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glMaterialfv, GLenum, GLenum, const GLfloat *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glMultMatrixf, const GLfloat *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION5(glesv1_cm, glMultiTexCoord4f, GLenum, GLfloat, GLfloat, GLfloat, GLfloat);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glNormal3f, GLfloat, GLfloat, GLfloat);
+HYBRIS_IMPLEMENT_VOID_FUNCTION6(glesv1_cm, glOrthof, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glPointParameterf, GLenum, GLfloat);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glPointParameterfv, GLenum, const GLfloat *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glPointSize, GLfloat);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glPolygonOffset, GLfloat, GLfloat);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv1_cm, glRotatef, GLfloat, GLfloat, GLfloat, GLfloat);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glScalef, GLfloat, GLfloat, GLfloat);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glTexEnvf, GLenum, GLenum, GLfloat);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glTexEnvfv, GLenum, GLenum, const GLfloat *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glTexParameterf, GLenum, GLenum, GLfloat);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glTexParameterfv, GLenum, GLenum, const GLfloat *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glTranslatef, GLfloat, GLfloat, GLfloat);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glActiveTexture, GLenum);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glAlphaFuncx, GLenum, GLclampx);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glBindBuffer, GLenum, GLuint);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glBindTexture, GLenum, GLuint);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glBlendFunc, GLenum, GLenum);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv1_cm, glBufferData, GLenum, GLsizeiptr, const GLvoid *, GLenum);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv1_cm, glBufferSubData, GLenum, GLintptr, GLsizeiptr, const GLvoid *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glClear, GLbitfield);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv1_cm, glClearColorx, GLclampx, GLclampx, GLclampx, GLclampx);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glClearDepthx, GLclampx);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glClearStencil, GLint);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glClientActiveTexture, GLenum);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glClipPlanex, GLenum, const GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv1_cm, glColor4ub, GLubyte, GLubyte, GLubyte, GLubyte);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv1_cm, glColor4x, GLfixed, GLfixed, GLfixed, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv1_cm, glColorMask, GLboolean, GLboolean, GLboolean, GLboolean);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv1_cm, glColorPointer, GLint, GLenum, GLsizei, const GLvoid *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION8(glesv1_cm, glCompressedTexImage2D, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION9(glesv1_cm, glCompressedTexSubImage2D, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION8(glesv1_cm, glCopyTexImage2D, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint);
+HYBRIS_IMPLEMENT_VOID_FUNCTION8(glesv1_cm, glCopyTexSubImage2D, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glCullFace, GLenum);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glDeleteBuffers, GLsizei, const GLuint *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glDeleteTextures, GLsizei, const GLuint *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glDepthFunc, GLenum);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glDepthMask, GLboolean);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glDepthRangex, GLclampx, GLclampx);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glDisable, GLenum);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glDisableClientState, GLenum);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glDrawArrays, GLenum, GLint, GLsizei);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv1_cm, glDrawElements, GLenum, GLsizei, GLenum, const GLvoid *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glEnable, GLenum);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glEnableClientState, GLenum);
+HYBRIS_IMPLEMENT_VOID_FUNCTION0(glesv1_cm, glFinish);
+HYBRIS_IMPLEMENT_VOID_FUNCTION0(glesv1_cm, glFlush);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glFogx, GLenum, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glFogxv, GLenum, const GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glFrontFace, GLenum);
+HYBRIS_IMPLEMENT_VOID_FUNCTION6(glesv1_cm, glFrustumx, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glGetBooleanv, GLenum, GLboolean *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glGetBufferParameteriv, GLenum, GLenum, GLint *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glGetClipPlanex, GLenum, GLfixed *); /* was: GLfixed[4] */
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glGenBuffers, GLsizei, GLuint *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glGenTextures, GLsizei, GLuint *);
+HYBRIS_IMPLEMENT_FUNCTION0(glesv1_cm, GLenum, glGetError);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glGetFixedv, GLenum, GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glGetIntegerv, GLenum, GLint *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glGetLightxv, GLenum, GLenum, GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glGetMaterialxv, GLenum, GLenum, GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glGetPointerv, GLenum, GLvoid **);
+HYBRIS_IMPLEMENT_FUNCTION1(glesv1_cm, const GLubyte *, glGetString, GLenum);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glGetTexEnviv, GLenum, GLenum, GLint *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glGetTexEnvxv, GLenum, GLenum, GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glGetTexParameteriv, GLenum, GLenum, GLint *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glGetTexParameterxv, GLenum, GLenum, GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glHint, GLenum, GLenum);
+HYBRIS_IMPLEMENT_FUNCTION1(glesv1_cm, GLboolean, glIsBuffer, GLuint);
+HYBRIS_IMPLEMENT_FUNCTION1(glesv1_cm, GLboolean, glIsEnabled, GLenum);
+HYBRIS_IMPLEMENT_FUNCTION1(glesv1_cm, GLboolean, glIsTexture, GLuint);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glLightModelx, GLenum, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glLightModelxv, GLenum, const GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glLightx, GLenum, GLenum, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glLightxv, GLenum, GLenum, const GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glLineWidthx, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION0(glesv1_cm, glLoadIdentity);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glLoadMatrixx, const GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glLogicOp, GLenum);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glMaterialx, GLenum, GLenum, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glMaterialxv, GLenum, GLenum, const GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glMatrixMode, GLenum);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glMultMatrixx, const GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION5(glesv1_cm, glMultiTexCoord4x, GLenum, GLfixed, GLfixed, GLfixed, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glNormal3x, GLfixed, GLfixed, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glNormalPointer, GLenum, GLsizei, const GLvoid *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION6(glesv1_cm, glOrthox, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glPixelStorei, GLenum, GLint);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glPointParameterx, GLenum, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glPointParameterxv, GLenum, const GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glPointSizex, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glPolygonOffsetx, GLfixed, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION0(glesv1_cm, glPopMatrix);
+HYBRIS_IMPLEMENT_VOID_FUNCTION0(glesv1_cm, glPushMatrix);
+HYBRIS_IMPLEMENT_VOID_FUNCTION7(glesv1_cm, glReadPixels, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv1_cm, glRotatex, GLfixed, GLfixed, GLfixed, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glSampleCoverage, GLclampf, GLboolean);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glSampleCoveragex, GLclampx, GLboolean);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glScalex, GLfixed, GLfixed, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv1_cm, glScissor, GLint, GLint, GLsizei, GLsizei);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glShadeModel, GLenum);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glStencilFunc, GLenum, GLint, GLuint);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glStencilMask, GLuint);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glStencilOp, GLenum, GLenum, GLenum);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv1_cm, glTexCoordPointer, GLint, GLenum, GLsizei, const GLvoid *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glTexEnvi, GLenum, GLenum, GLint);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glTexEnvx, GLenum, GLenum, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glTexEnviv, GLenum, GLenum, const GLint *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glTexEnvxv, GLenum, GLenum, const GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION9(glesv1_cm, glTexImage2D, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glTexParameteri, GLenum, GLenum, GLint);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glTexParameterx, GLenum, GLenum, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glTexParameteriv, GLenum, GLenum, const GLint *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glTexParameterxv, GLenum, GLenum, const GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION9(glesv1_cm, glTexSubImage2D, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glTranslatex, GLfixed, GLfixed, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv1_cm, glVertexPointer, GLint, GLenum, GLsizei, const GLvoid *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv1_cm, glViewport, GLint, GLint, GLsizei, GLsizei);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glPointSizePointerOES, GLenum, GLsizei, const GLvoid *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glBlendEquationSeparateOES, GLenum, GLenum);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv1_cm, glBlendFuncSeparateOES, GLenum, GLenum, GLenum, GLenum);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glBlendEquationOES, GLenum);
+HYBRIS_IMPLEMENT_VOID_FUNCTION5(glesv1_cm, glDrawTexsOES, GLshort, GLshort, GLshort, GLshort, GLshort);
+HYBRIS_IMPLEMENT_VOID_FUNCTION5(glesv1_cm, glDrawTexiOES, GLint, GLint, GLint, GLint, GLint);
+HYBRIS_IMPLEMENT_VOID_FUNCTION5(glesv1_cm, glDrawTexxOES, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glDrawTexsvOES, const GLshort *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glDrawTexivOES, const GLint *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glDrawTexxvOES, const GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION5(glesv1_cm, glDrawTexfOES, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glDrawTexfvOES, const GLfloat *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glEGLImageTargetTexture2DOES, GLenum, GLeglImageOES);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glEGLImageTargetRenderbufferStorageOES, GLenum, GLeglImageOES);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glAlphaFuncxOES, GLenum, GLclampx);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv1_cm, glClearColorxOES, GLclampx, GLclampx, GLclampx, GLclampx);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glClearDepthxOES, GLclampx);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glClipPlanexOES, GLenum, const GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv1_cm, glColor4xOES, GLfixed, GLfixed, GLfixed, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glDepthRangexOES, GLclampx, GLclampx);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glFogxOES, GLenum, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glFogxvOES, GLenum, const GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION6(glesv1_cm, glFrustumxOES, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glGetClipPlanexOES, GLenum, GLfixed *); /* was: GLfixed[4] */
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glGetFixedvOES, GLenum, GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glGetLightxvOES, GLenum, GLenum, GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glGetMaterialxvOES, GLenum, GLenum, GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glGetTexEnvxvOES, GLenum, GLenum, GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glGetTexParameterxvOES, GLenum, GLenum, GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glLightModelxOES, GLenum, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glLightModelxvOES, GLenum, const GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glLightxOES, GLenum, GLenum, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glLightxvOES, GLenum, GLenum, const GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glLineWidthxOES, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glLoadMatrixxOES, const GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glMaterialxOES, GLenum, GLenum, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glMaterialxvOES, GLenum, GLenum, const GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glMultMatrixxOES, const GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION5(glesv1_cm, glMultiTexCoord4xOES, GLenum, GLfixed, GLfixed, GLfixed, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glNormal3xOES, GLfixed, GLfixed, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION6(glesv1_cm, glOrthoxOES, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glPointParameterxOES, GLenum, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glPointParameterxvOES, GLenum, const GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glPointSizexOES, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glPolygonOffsetxOES, GLfixed, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv1_cm, glRotatexOES, GLfixed, GLfixed, GLfixed, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glSampleCoveragexOES, GLclampx, GLboolean);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glScalexOES, GLfixed, GLfixed, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glTexEnvxOES, GLenum, GLenum, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glTexEnvxvOES, GLenum, GLenum, const GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glTexParameterxOES, GLenum, GLenum, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glTexParameterxvOES, GLenum, GLenum, const GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glTranslatexOES, GLfixed, GLfixed, GLfixed);
+HYBRIS_IMPLEMENT_FUNCTION1(glesv1_cm, GLboolean, glIsRenderbufferOES, GLuint);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glBindRenderbufferOES, GLenum, GLuint);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glDeleteRenderbuffersOES, GLsizei, const GLuint *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glGenRenderbuffersOES, GLsizei, GLuint *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv1_cm, glRenderbufferStorageOES, GLenum, GLenum, GLsizei, GLsizei);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glGetRenderbufferParameterivOES, GLenum, GLenum, GLint *);
+HYBRIS_IMPLEMENT_FUNCTION1(glesv1_cm, GLboolean, glIsFramebufferOES, GLuint);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glBindFramebufferOES, GLenum, GLuint);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glDeleteFramebuffersOES, GLsizei, const GLuint *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glGenFramebuffersOES, GLsizei, GLuint *);
+HYBRIS_IMPLEMENT_FUNCTION1(glesv1_cm, GLenum, glCheckFramebufferStatusOES, GLenum);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv1_cm, glFramebufferRenderbufferOES, GLenum, GLenum, GLenum, GLuint);
+HYBRIS_IMPLEMENT_VOID_FUNCTION5(glesv1_cm, glFramebufferTexture2DOES, GLenum, GLenum, GLenum, GLuint, GLint);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv1_cm, glGetFramebufferAttachmentParameterivOES, GLenum, GLenum, GLenum, GLint *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glGenerateMipmapOES, GLenum);
+HYBRIS_IMPLEMENT_FUNCTION2(glesv1_cm, void *, glMapBufferOES, GLenum, GLenum);
+HYBRIS_IMPLEMENT_FUNCTION1(glesv1_cm, GLboolean, glUnmapBufferOES, GLenum);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glGetBufferPointervOES, GLenum, GLenum, GLvoid **);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glCurrentPaletteMatrixOES, GLuint);
+HYBRIS_IMPLEMENT_VOID_FUNCTION0(glesv1_cm, glLoadPaletteFromModelViewMatrixOES);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv1_cm, glMatrixIndexPointerOES, GLint, GLenum, GLsizei, const GLvoid *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv1_cm, glWeightPointerOES, GLint, GLenum, GLsizei, const GLvoid *);
+HYBRIS_IMPLEMENT_FUNCTION2(glesv1_cm, GLbitfield, glQueryMatrixxOES, GLfixed *, GLint *); /* was: GLfixed[16], GLint[16] */
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glDepthRangefOES, GLclampf, GLclampf);
+HYBRIS_IMPLEMENT_VOID_FUNCTION6(glesv1_cm, glFrustumfOES, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
+HYBRIS_IMPLEMENT_VOID_FUNCTION6(glesv1_cm, glOrthofOES, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glClipPlanefOES, GLenum, const GLfloat *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glGetClipPlanefOES, GLenum, GLfloat *); /* was: GLfloat[4] */
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glClearDepthfOES, GLclampf);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glTexGenfOES, GLenum, GLenum, GLfloat);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glTexGenfvOES, GLenum, GLenum, const GLfloat *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glTexGeniOES, GLenum, GLenum, GLint);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glTexGenivOES, GLenum, GLenum, const GLint *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glTexGenxOES, GLenum, GLenum, GLfixed);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glTexGenxvOES, GLenum, GLenum, const GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glGetTexGenfvOES, GLenum, GLenum, GLfloat *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glGetTexGenivOES, GLenum, GLenum, GLint *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glGetTexGenxvOES, GLenum, GLenum, GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glBindVertexArrayOES, GLuint);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glDeleteVertexArraysOES, GLsizei, const GLuint *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glGenVertexArraysOES, GLsizei, GLuint *);
+HYBRIS_IMPLEMENT_FUNCTION1(glesv1_cm, GLboolean, glIsVertexArrayOES, GLuint);
+HYBRIS_IMPLEMENT_VOID_FUNCTION5(glesv1_cm, glRenderbufferStorageMultisampleAPPLE, GLenum, GLsizei, GLenum, GLsizei, GLsizei);
+HYBRIS_IMPLEMENT_VOID_FUNCTION0(glesv1_cm, glResolveMultisampleFramebufferAPPLE);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glDiscardFramebufferEXT, GLenum, GLsizei, const GLenum *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv1_cm, glMultiDrawArraysEXT, GLenum, GLint *, GLsizei *, GLsizei);
+HYBRIS_IMPLEMENT_VOID_FUNCTION5(glesv1_cm, glMultiDrawElementsEXT, GLenum, const GLsizei *, GLenum, const GLvoid **, GLsizei);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glClipPlanefIMG, GLenum, const GLfloat *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glClipPlanexIMG, GLenum, const GLfixed *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION5(glesv1_cm, glRenderbufferStorageMultisampleIMG, GLenum, GLsizei, GLenum, GLsizei, GLsizei);
+HYBRIS_IMPLEMENT_VOID_FUNCTION6(glesv1_cm, glFramebufferTexture2DMultisampleIMG, GLenum, GLenum, GLenum, GLuint, GLint, GLsizei);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glDeleteFencesNV, GLsizei, const GLuint *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glGenFencesNV, GLsizei, GLuint *);
+HYBRIS_IMPLEMENT_FUNCTION1(glesv1_cm, GLboolean, glIsFenceNV, GLuint);
+HYBRIS_IMPLEMENT_FUNCTION1(glesv1_cm, GLboolean, glTestFenceNV, GLuint);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glGetFenceivNV, GLuint, GLenum, GLint *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glFinishFenceNV, GLuint);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glSetFenceNV, GLuint, GLenum);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glGetDriverControlsQCOM, GLint *, GLsizei, GLuint *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv1_cm, glGetDriverControlStringQCOM, GLuint, GLsizei, GLsizei *, GLchar *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glEnableDriverControlQCOM, GLuint);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glDisableDriverControlQCOM, GLuint);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glExtGetTexturesQCOM, GLuint *, GLint, GLint *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glExtGetBuffersQCOM, GLuint *, GLint, GLint *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glExtGetRenderbuffersQCOM, GLuint *, GLint, GLint *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glExtGetFramebuffersQCOM, GLuint *, GLint, GLint *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION5(glesv1_cm, glExtGetTexLevelParameterivQCOM, GLuint, GLenum, GLint, GLenum, GLint *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glExtTexObjectStateOverrideiQCOM, GLenum, GLenum, GLint);
+HYBRIS_IMPLEMENT_VOID_FUNCTION11(glesv1_cm, glExtGetTexSubImageQCOM, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, GLvoid *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(glesv1_cm, glExtGetBufferPointervQCOM, GLenum, GLvoid **);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glExtGetShadersQCOM, GLuint *, GLint, GLint *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(glesv1_cm, glExtGetProgramsQCOM, GLuint *, GLint, GLint *);
+HYBRIS_IMPLEMENT_FUNCTION1(glesv1_cm, GLboolean, glExtIsProgramBinaryQCOM, GLuint);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(glesv1_cm, glExtGetProgramBinarySourceQCOM, GLuint, GLenum, GLchar *, GLint *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION5(glesv1_cm, glStartTilingQCOM, GLuint, GLuint, GLuint, GLuint, GLbitfield);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(glesv1_cm, glEndTilingQCOM, GLbitfield);
--- /dev/null
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=@includedir@
+
+Name: glesv1_cm
+Description: libhybris OpenGL ES 1.1 library
+Version: @VERSION@
+Libs: -L${libdir} -lGLESv1_CM
+Cflags: -I${includedir}
--- /dev/null
+lib_LTLIBRARIES = \
+ libGLESv2.la
+
+libGLESv2_la_SOURCES = glesv2.c
+libGLESv2_la_CFLAGS = -I$(top_srcdir)/include
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = glesv2.pc
+
+if WANT_MESA
+libGLESv2_la_CFLAGS += -DLIBHYBRIS_WANTS_MESA_X11_HEADERS
+endif
+if WANT_TRACE
+libGLESv2_la_CFLAGS += -DDEBUG
+endif
+if WANT_DEBUG
+libGLESv2_la_CFLAGS += -ggdb -O0
+endif
+libGLESv2_la_LDFLAGS = \
+ $(top_builddir)/common/libhybris-common.la \
+ -version-info "2":"0":"0"
--- /dev/null
+/*
+ * Copyright (c) 2012 Carsten Munk <carsten.munk@gmail.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#define GL_GLEXT_PROTOTYPES
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+#include <dlfcn.h>
+#include <stddef.h>
+#include <stdlib.h>
+
+#include <hybris/internal/binding.h>
+#include <hybris/internal/floating_point_abi.h>
+
+static void *_libglesv2 = NULL;
+
+static void (*_glActiveTexture)(GLenum texture) = NULL;
+static void (*_glAttachShader)(GLuint program, GLuint shader) = NULL;
+static void (*_glBindAttribLocation)(GLuint program, GLuint index, const GLchar* name) = NULL;
+static void (*_glBindBuffer)(GLenum target, GLuint buffer) = NULL;
+static void (*_glBindFramebuffer)(GLenum target, GLuint framebuffer) = NULL;
+static void (*_glBindRenderbuffer)(GLenum target, GLuint renderbuffer) = NULL;
+static void (*_glBindTexture)(GLenum target, GLuint texture) = NULL;
+static void (*_glBlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) FP_ATTRIB = NULL;
+static void (*_glBlendEquation)(GLenum mode ) = NULL;
+static void (*_glBlendEquationSeparate)(GLenum modeRGB, GLenum modeAlpha) = NULL;
+static void (*_glBlendFunc)(GLenum sfactor, GLenum dfactor) = NULL;
+static void (*_glBlendFuncSeparate)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) = NULL;
+static void (*_glBufferData)(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) = NULL;
+static void (*_glBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data) = NULL;
+static GLenum (*_glCheckFramebufferStatus)(GLenum target) = NULL;
+static void (*_glClear)(GLbitfield mask) = NULL;
+static void (*_glClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) FP_ATTRIB = NULL;
+static void (*_glClearDepthf)(GLclampf depth) FP_ATTRIB = NULL;
+static void (*_glClearStencil)(GLint s) = NULL;
+static void (*_glColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) = NULL;
+static void (*_glCompileShader)(GLuint shader) = NULL;
+static void (*_glCompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data) = NULL;
+static void (*_glCompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data) = NULL;
+static void (*_glCopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) = NULL;
+static void (*_glCopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) = NULL;
+static GLuint (*_glCreateProgram)(void) = NULL;
+static GLuint (*_glCreateShader)(GLenum type) = NULL;
+static void (*_glCullFace)(GLenum mode) = NULL;
+static void (*_glDeleteBuffers)(GLsizei n, const GLuint* buffers) = NULL;
+static void (*_glDeleteFramebuffers)(GLsizei n, const GLuint* framebuffers) = NULL;
+static void (*_glDeleteProgram)(GLuint program) = NULL;
+static void (*_glDeleteRenderbuffers)(GLsizei n, const GLuint* renderbuffers) = NULL;
+static void (*_glDeleteShader)(GLuint shader) = NULL;
+static void (*_glDeleteTextures)(GLsizei n, const GLuint* textures) = NULL;
+static void (*_glDepthFunc)(GLenum func) = NULL;
+static void (*_glDepthMask)(GLboolean flag) = NULL;
+static void (*_glDepthRangef)(GLclampf zNear, GLclampf zFar) FP_ATTRIB = NULL;
+static void (*_glDetachShader)(GLuint program, GLuint shader) = NULL;
+static void (*_glDisable)(GLenum cap) = NULL;
+static void (*_glDisableVertexAttribArray)(GLuint index) = NULL;
+static void (*_glDrawArrays)(GLenum mode, GLint first, GLsizei count) = NULL;
+static void (*_glDrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices) = NULL;
+static void (*_glEnable)(GLenum cap) = NULL;
+static void (*_glEnableVertexAttribArray)(GLuint index) = NULL;
+static void (*_glFinish)(void) = NULL;
+static void (*_glFlush)(void) = NULL;
+static void (*_glFramebufferRenderbuffer)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) = NULL;
+static void (*_glFramebufferTexture2D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) = NULL;
+static void (*_glFrontFace)(GLenum mode) = NULL;
+static void (*_glGenBuffers)(GLsizei n, GLuint* buffers) = NULL;
+static void (*_glGenerateMipmap)(GLenum target) = NULL;
+static void (*_glGenFramebuffers)(GLsizei n, GLuint* framebuffers) = NULL;
+static void (*_glGenRenderbuffers)(GLsizei n, GLuint* renderbuffers) = NULL;
+static void (*_glGenTextures)(GLsizei n, GLuint* textures) = NULL;
+static void (*_glGetActiveAttrib)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) = NULL;
+static void (*_glGetActiveUniform)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) = NULL;
+static void (*_glGetAttachedShaders)(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) = NULL;
+static int (*_glGetAttribLocation)(GLuint program, const GLchar* name) = NULL;
+static void (*_glGetBooleanv)(GLenum pname, GLboolean* params) = NULL;
+static void (*_glGetBufferParameteriv)(GLenum target, GLenum pname, GLint* params) = NULL;
+static GLenum (*_glGetError)(void) = NULL;
+static void (*_glGetFloatv)(GLenum pname, GLfloat* params) = NULL;
+static void (*_glGetFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint* params) = NULL;
+static void (*_glGetIntegerv)(GLenum pname, GLint* params) = NULL;
+static void (*_glGetProgramiv)(GLuint program, GLenum pname, GLint* params) = NULL;
+static void (*_glGetProgramInfoLog)(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog) = NULL;
+static void (*_glGetRenderbufferParameteriv)(GLenum target, GLenum pname, GLint* params) = NULL;
+static void (*_glGetShaderiv)(GLuint shader, GLenum pname, GLint* params) = NULL;
+static void (*_glGetShaderInfoLog)(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog) = NULL;
+static void (*_glGetShaderPrecisionFormat)(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) = NULL;
+static void (*_glGetShaderSource)(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source) = NULL;
+static const GLubyte* (*_glGetString)(GLenum name) = NULL;
+static void (*_glGetTexParameterfv)(GLenum target, GLenum pname, GLfloat* params) = NULL;
+static void (*_glGetTexParameteriv)(GLenum target, GLenum pname, GLint* params) = NULL;
+static void (*_glGetUniformfv)(GLuint program, GLint location, GLfloat* params) = NULL;
+static void (*_glGetUniformiv)(GLuint program, GLint location, GLint* params) = NULL;
+static int (*_glGetUniformLocation)(GLuint program, const GLchar* name) = NULL;
+static void (*_glGetVertexAttribfv)(GLuint index, GLenum pname, GLfloat* params) = NULL;
+static void (*_glGetVertexAttribiv)(GLuint index, GLenum pname, GLint* params) = NULL;
+static void (*_glGetVertexAttribPointerv)(GLuint index, GLenum pname, GLvoid** pointer) = NULL;
+static void (*_glHint)(GLenum target, GLenum mode) = NULL;
+static GLboolean (*_glIsBuffer)(GLuint buffer) = NULL;
+static GLboolean (*_glIsEnabled)(GLenum cap) = NULL;
+static GLboolean (*_glIsFramebuffer)(GLuint framebuffer) = NULL;
+static GLboolean (*_glIsProgram)(GLuint program) = NULL;
+static GLboolean (*_glIsRenderbuffer)(GLuint renderbuffer) = NULL;
+static GLboolean (*_glIsShader)(GLuint shader) = NULL;
+static GLboolean (*_glIsTexture)(GLuint texture) = NULL;
+static void (*_glLineWidth)(GLfloat width) FP_ATTRIB = NULL;
+static void (*_glLinkProgram)(GLuint program) = NULL;
+static void (*_glPixelStorei)(GLenum pname, GLint param) = NULL;
+static void (*_glPolygonOffset)(GLfloat factor, GLfloat units) FP_ATTRIB = NULL;
+static void (*_glReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels) = NULL;
+static void (*_glReleaseShaderCompiler)(void) = NULL;
+static void (*_glRenderbufferStorage)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) = NULL;
+static void (*_glSampleCoverage)(GLclampf value, GLboolean invert) FP_ATTRIB = NULL;
+static void (*_glScissor)(GLint x, GLint y, GLsizei width, GLsizei height) = NULL;
+static void (*_glShaderBinary)(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length) = NULL;
+static void (*_glShaderSource)(GLuint shader, GLsizei count, const GLchar** string, const GLint* length) = NULL;
+static void (*_glStencilFunc)(GLenum func, GLint ref, GLuint mask) = NULL;
+static void (*_glStencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask) = NULL;
+static void (*_glStencilMask)(GLuint mask) = NULL;
+static void (*_glStencilMaskSeparate)(GLenum face, GLuint mask) = NULL;
+static void (*_glStencilOp)(GLenum fail, GLenum zfail, GLenum zpass) = NULL;
+static void (*_glStencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) = NULL;
+static void (*_glTexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels) = NULL;
+static void (*_glTexParameterf)(GLenum target, GLenum pname, GLfloat param) FP_ATTRIB = NULL;
+static void (*_glTexParameterfv)(GLenum target, GLenum pname, const GLfloat* params) = NULL;
+static void (*_glTexParameteri)(GLenum target, GLenum pname, GLint param) = NULL;
+static void (*_glTexParameteriv)(GLenum target, GLenum pname, const GLint* params) = NULL;
+static void (*_glTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels) = NULL;
+static void (*_glUniform1f)(GLint location, GLfloat x) FP_ATTRIB = NULL;
+static void (*_glUniform1fv)(GLint location, GLsizei count, const GLfloat* v) = NULL;
+static void (*_glUniform1i)(GLint location, GLint x) = NULL;
+static void (*_glUniform1iv)(GLint location, GLsizei count, const GLint* v) = NULL;
+static void (*_glUniform2f)(GLint location, GLfloat x, GLfloat y) FP_ATTRIB = NULL;
+static void (*_glUniform2fv)(GLint location, GLsizei count, const GLfloat* v) = NULL;
+static void (*_glUniform2i)(GLint location, GLint x, GLint y) = NULL;
+static void (*_glUniform2iv)(GLint location, GLsizei count, const GLint* v) = NULL;
+static void (*_glUniform3f)(GLint location, GLfloat x, GLfloat y, GLfloat z) FP_ATTRIB = NULL;
+static void (*_glUniform3fv)(GLint location, GLsizei count, const GLfloat* v) = NULL;
+static void (*_glUniform3i)(GLint location, GLint x, GLint y, GLint z) = NULL;
+static void (*_glUniform3iv)(GLint location, GLsizei count, const GLint* v) = NULL;
+static void (*_glUniform4f)(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) FP_ATTRIB = NULL;
+static void (*_glUniform4fv)(GLint location, GLsizei count, const GLfloat* v) = NULL;
+static void (*_glUniform4i)(GLint location, GLint x, GLint y, GLint z, GLint w) = NULL;
+static void (*_glUniform4iv)(GLint location, GLsizei count, const GLint* v) = NULL;
+static void (*_glUniformMatrix2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) = NULL;
+static void (*_glUniformMatrix3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) = NULL;
+static void (*_glUniformMatrix4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) = NULL;
+static void (*_glUseProgram)(GLuint program) = NULL;
+static void (*_glValidateProgram)(GLuint program) = NULL;
+static void (*_glVertexAttrib1f)(GLuint indx, GLfloat x) FP_ATTRIB = NULL;
+static void (*_glVertexAttrib1fv)(GLuint indx, const GLfloat* values) = NULL;
+static void (*_glVertexAttrib2f)(GLuint indx, GLfloat x, GLfloat y) FP_ATTRIB = NULL;
+static void (*_glVertexAttrib2fv)(GLuint indx, const GLfloat* values) = NULL;
+static void (*_glVertexAttrib3f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z) FP_ATTRIB = NULL;
+static void (*_glVertexAttrib3fv)(GLuint indx, const GLfloat* values) = NULL;
+static void (*_glVertexAttrib4f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) FP_ATTRIB = NULL;
+static void (*_glVertexAttrib4fv)(GLuint indx, const GLfloat* values) = NULL;
+static void (*_glVertexAttribPointer)(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr) = NULL;
+static void (*_glViewport)(GLint x, GLint y, GLsizei width, GLsizei height) = NULL;
+static void (*_glEGLImageTargetTexture2DOES) (GLenum target, GLeglImageOES image) = NULL;
+
+
+#define GLES2_LOAD(sym) { *(&_ ## sym) = (void *) android_dlsym(_libglesv2, #sym); }
+
+static void __attribute__((constructor)) _init_androidglesv2() {
+ _libglesv2 = (void *) android_dlopen(getenv("LIBGLESV2") ? getenv("LIBGLESV2") : "libGLESv2.so", RTLD_NOW);
+ GLES2_LOAD(glActiveTexture);
+ GLES2_LOAD(glAttachShader);
+ GLES2_LOAD(glBindAttribLocation);
+ GLES2_LOAD(glBindBuffer);
+ GLES2_LOAD(glBindFramebuffer);
+ GLES2_LOAD(glBindRenderbuffer);
+ GLES2_LOAD(glBindTexture);
+ GLES2_LOAD(glBlendColor);
+ GLES2_LOAD(glBlendEquation);
+ GLES2_LOAD(glBlendEquationSeparate);
+ GLES2_LOAD(glBlendFunc);
+ GLES2_LOAD(glBlendFuncSeparate);
+ GLES2_LOAD(glBufferData);
+ GLES2_LOAD(glBufferSubData);
+ GLES2_LOAD(glCheckFramebufferStatus);
+ GLES2_LOAD(glClear);
+ GLES2_LOAD(glClearColor);
+ GLES2_LOAD(glClearDepthf);
+ GLES2_LOAD(glClearStencil);
+ GLES2_LOAD(glColorMask);
+ GLES2_LOAD(glCompileShader);
+ GLES2_LOAD(glCompressedTexImage2D);
+ GLES2_LOAD(glCompressedTexSubImage2D);
+ GLES2_LOAD(glCopyTexImage2D);
+ GLES2_LOAD(glCopyTexSubImage2D);
+ GLES2_LOAD(glCreateProgram);
+ GLES2_LOAD(glCreateShader);
+ GLES2_LOAD(glCullFace);
+ GLES2_LOAD(glDeleteBuffers);
+ GLES2_LOAD(glDeleteFramebuffers);
+ GLES2_LOAD(glDeleteProgram);
+ GLES2_LOAD(glDeleteRenderbuffers);
+ GLES2_LOAD(glDeleteShader);
+ GLES2_LOAD(glDeleteTextures);
+ GLES2_LOAD(glDepthFunc);
+ GLES2_LOAD(glDepthMask);
+ GLES2_LOAD(glDepthRangef);
+ GLES2_LOAD(glDetachShader);
+ GLES2_LOAD(glDisable);
+ GLES2_LOAD(glDisableVertexAttribArray);
+ GLES2_LOAD(glDrawArrays);
+ GLES2_LOAD(glDrawElements);
+ GLES2_LOAD(glEnable);
+ GLES2_LOAD(glEnableVertexAttribArray);
+ GLES2_LOAD(glFinish);
+ GLES2_LOAD(glFlush);
+ GLES2_LOAD(glFramebufferRenderbuffer);
+ GLES2_LOAD(glFramebufferTexture2D);
+ GLES2_LOAD(glFrontFace);
+ GLES2_LOAD(glGenBuffers);
+ GLES2_LOAD(glGenerateMipmap);
+ GLES2_LOAD(glGenFramebuffers);
+ GLES2_LOAD(glGenRenderbuffers);
+ GLES2_LOAD(glGenTextures);
+ GLES2_LOAD(glGetActiveAttrib);
+ GLES2_LOAD(glGetActiveUniform);
+ GLES2_LOAD(glGetAttachedShaders);
+ GLES2_LOAD(glGetAttribLocation);
+ GLES2_LOAD(glGetBooleanv);
+ GLES2_LOAD(glGetBufferParameteriv);
+ GLES2_LOAD(glGetError);
+ GLES2_LOAD(glGetFloatv);
+ GLES2_LOAD(glGetFramebufferAttachmentParameteriv);
+ GLES2_LOAD(glGetIntegerv);
+ GLES2_LOAD(glGetProgramiv);
+ GLES2_LOAD(glGetProgramInfoLog);
+ GLES2_LOAD(glGetRenderbufferParameteriv);
+ GLES2_LOAD(glGetShaderiv);
+ GLES2_LOAD(glGetShaderInfoLog);
+ GLES2_LOAD(glGetShaderPrecisionFormat);
+ GLES2_LOAD(glGetShaderSource);
+ GLES2_LOAD(glGetString);
+ GLES2_LOAD(glGetTexParameterfv);
+ GLES2_LOAD(glGetTexParameteriv);
+ GLES2_LOAD(glGetUniformfv);
+ GLES2_LOAD(glGetUniformiv);
+ GLES2_LOAD(glGetUniformLocation);
+ GLES2_LOAD(glGetVertexAttribfv);
+ GLES2_LOAD(glGetVertexAttribiv);
+ GLES2_LOAD(glGetVertexAttribPointerv);
+ GLES2_LOAD(glHint);
+ GLES2_LOAD(glIsBuffer);
+ GLES2_LOAD(glIsEnabled);
+ GLES2_LOAD(glIsFramebuffer);
+ GLES2_LOAD(glIsProgram);
+ GLES2_LOAD(glIsRenderbuffer);
+ GLES2_LOAD(glIsShader);
+ GLES2_LOAD(glIsTexture);
+ GLES2_LOAD(glLineWidth);
+ GLES2_LOAD(glLinkProgram);
+ GLES2_LOAD(glPixelStorei);
+ GLES2_LOAD(glPolygonOffset);
+ GLES2_LOAD(glReadPixels);
+ GLES2_LOAD(glReleaseShaderCompiler);
+ GLES2_LOAD(glRenderbufferStorage);
+ GLES2_LOAD(glSampleCoverage);
+ GLES2_LOAD(glScissor);
+ GLES2_LOAD(glShaderBinary);
+ GLES2_LOAD(glShaderSource);
+ GLES2_LOAD(glStencilFunc);
+ GLES2_LOAD(glStencilFuncSeparate);
+ GLES2_LOAD(glStencilMask);
+ GLES2_LOAD(glStencilMaskSeparate);
+ GLES2_LOAD(glStencilOp);
+ GLES2_LOAD(glStencilOpSeparate);
+ GLES2_LOAD(glTexImage2D);
+ GLES2_LOAD(glTexParameterf);
+ GLES2_LOAD(glTexParameterfv);
+ GLES2_LOAD(glTexParameteri);
+ GLES2_LOAD(glTexParameteriv);
+ GLES2_LOAD(glTexSubImage2D);
+ GLES2_LOAD(glUniform1f);
+ GLES2_LOAD(glUniform1fv);
+ GLES2_LOAD(glUniform1i);
+ GLES2_LOAD(glUniform1iv);
+ GLES2_LOAD(glUniform2f);
+ GLES2_LOAD(glUniform2fv);
+ GLES2_LOAD(glUniform2i);
+ GLES2_LOAD(glUniform2iv);
+ GLES2_LOAD(glUniform3f);
+ GLES2_LOAD(glUniform3fv);
+ GLES2_LOAD(glUniform3i);
+ GLES2_LOAD(glUniform3iv);
+ GLES2_LOAD(glUniform4f);
+ GLES2_LOAD(glUniform4fv);
+ GLES2_LOAD(glUniform4i);
+ GLES2_LOAD(glUniform4iv);
+ GLES2_LOAD(glUniformMatrix2fv);
+ GLES2_LOAD(glUniformMatrix3fv);
+ GLES2_LOAD(glUniformMatrix4fv);
+ GLES2_LOAD(glUseProgram);
+ GLES2_LOAD(glValidateProgram);
+ GLES2_LOAD(glVertexAttrib1f);
+ GLES2_LOAD(glVertexAttrib1fv);
+ GLES2_LOAD(glVertexAttrib2f);
+ GLES2_LOAD(glVertexAttrib2fv);
+ GLES2_LOAD(glVertexAttrib3f);
+ GLES2_LOAD(glVertexAttrib3fv);
+ GLES2_LOAD(glVertexAttrib4f);
+ GLES2_LOAD(glVertexAttrib4fv);
+ GLES2_LOAD(glVertexAttribPointer);
+ GLES2_LOAD(glViewport);
+ GLES2_LOAD(glEGLImageTargetTexture2DOES);
+
+}
+
+
+void glActiveTexture (GLenum texture)
+{
+ return (*_glActiveTexture)(texture);
+}
+
+void glAttachShader (GLuint program, GLuint shader)
+{
+ return (*_glAttachShader)(program, shader);
+}
+
+void glBindAttribLocation (GLuint program, GLuint index, const GLchar* name)
+{
+ return (*_glBindAttribLocation)(program, index, name);
+}
+
+void glBindBuffer (GLenum target, GLuint buffer)
+{
+ return (*_glBindBuffer)(target, buffer);
+}
+
+void glBindFramebuffer (GLenum target, GLuint framebuffer)
+{
+ return (*_glBindFramebuffer)(target, framebuffer);
+}
+
+void glBindRenderbuffer (GLenum target, GLuint renderbuffer)
+{
+ return (*_glBindRenderbuffer)(target, renderbuffer);
+}
+
+void glBindTexture (GLenum target, GLuint texture)
+{
+ return (*_glBindTexture)(target, texture);
+}
+
+void glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+{
+ return (*_glBlendColor)(red, green, blue, alpha);
+}
+
+void glBlendEquation ( GLenum mode )
+{
+ return (*_glBlendEquation)(mode);
+}
+
+void glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha)
+{
+ return (*_glBlendEquationSeparate)(modeRGB, modeAlpha);
+}
+
+void glBlendFunc (GLenum sfactor, GLenum dfactor)
+{
+ return (*_glBlendFunc)(sfactor, dfactor);
+}
+
+void glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
+{
+ return (*_glBlendFuncSeparate)(srcRGB, dstRGB, srcAlpha, dstAlpha);
+}
+
+void glBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage)
+{
+ return (*_glBufferData)(target, size, data, usage);
+}
+
+void glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data)
+{
+ return (*_glBufferSubData)(target, offset, size, data);
+}
+
+GLenum glCheckFramebufferStatus (GLenum target)
+{
+ return (*_glCheckFramebufferStatus)(target);
+}
+
+void glClear (GLbitfield mask)
+{
+ return (*_glClear)(mask);
+}
+
+void glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+{
+ return (*_glClearColor)(red, green, blue, alpha);
+}
+
+void glClearDepthf (GLclampf depth)
+{
+ return (*_glClearDepthf)(depth);
+}
+
+void glClearStencil (GLint s)
+{
+ return (*_glClearStencil)(s);
+}
+
+void glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
+{
+ return (*_glColorMask)(red, green, blue, alpha);
+}
+
+void glCompileShader (GLuint shader)
+{
+ return (*_glCompileShader)(shader);
+}
+
+void glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data)
+{
+ return (*_glCompressedTexImage2D)(target, level, internalformat, width, height, border, imageSize, data);
+}
+
+void glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data)
+{
+ return (*_glCompressedTexSubImage2D)(target, level, xoffset, yoffset, width, height, format, imageSize, data);
+}
+
+void glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
+{
+ return (*_glCopyTexImage2D)(target, level, internalformat, x, y, width, height, border);
+}
+
+void glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ return (*_glCopyTexSubImage2D)(target, level, xoffset, yoffset, x, y, width, height);
+}
+
+GLuint glCreateProgram (void)
+{
+ return (*_glCreateProgram)();
+}
+
+GLuint glCreateShader (GLenum type)
+{
+ return (*_glCreateShader)(type);
+}
+
+void glCullFace (GLenum mode)
+{
+ return (*_glCullFace)(mode);
+}
+
+void glDeleteBuffers (GLsizei n, const GLuint* buffers)
+{
+ return (*_glDeleteBuffers)(n, buffers);
+}
+
+void glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers)
+{
+ return (*_glDeleteFramebuffers)(n, framebuffers);
+}
+
+void glDeleteProgram (GLuint program)
+{
+ return (*_glDeleteProgram)(program);
+}
+
+void glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers)
+{
+ return (*_glDeleteRenderbuffers)(n, renderbuffers);
+}
+
+void glDeleteShader (GLuint shader)
+{
+ return (*_glDeleteShader)(shader);
+}
+
+void glDeleteTextures (GLsizei n, const GLuint* textures)
+{
+ return (*_glDeleteTextures)(n, textures);
+}
+
+void glDepthFunc (GLenum func)
+{
+ return (*_glDepthFunc)(func);
+}
+
+void glDepthMask (GLboolean flag)
+{
+ return (*_glDepthMask)(flag);
+}
+
+void glDepthRangef (GLclampf zNear, GLclampf zFar)
+{
+ return (*_glDepthRangef)(zNear, zFar);
+}
+
+void glDetachShader (GLuint program, GLuint shader)
+{
+ return (*_glDetachShader)(program, shader);
+}
+
+void glDisable (GLenum cap)
+{
+ return (*_glDisable)(cap);
+}
+
+void glDisableVertexAttribArray (GLuint index)
+{
+ return (*_glDisableVertexAttribArray)(index);
+}
+
+void glDrawArrays (GLenum mode, GLint first, GLsizei count)
+{
+ return (*_glDrawArrays)(mode, first, count);
+}
+
+void glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices)
+{
+ return (*_glDrawElements)(mode, count, type, indices);
+}
+
+void glEnable (GLenum cap)
+{
+ return (*_glEnable)(cap);
+}
+
+void glEnableVertexAttribArray (GLuint index)
+{
+ return (*_glEnableVertexAttribArray)(index);
+}
+
+void glFinish (void)
+{
+ return (*_glFinish)();
+}
+
+void glFlush (void)
+{
+ return (*_glFlush)();
+}
+
+void glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
+{
+ return (*_glFramebufferRenderbuffer)(target, attachment, renderbuffertarget, renderbuffer);
+}
+
+void glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
+{
+ return (*_glFramebufferTexture2D)(target, attachment, textarget, texture, level);
+}
+
+void glFrontFace (GLenum mode)
+{
+ return (*_glFrontFace)(mode);
+}
+
+void glGenBuffers (GLsizei n, GLuint* buffers)
+{
+ return (*_glGenBuffers)(n, buffers);
+}
+
+void glGenerateMipmap (GLenum target)
+{
+ return (*_glGenerateMipmap)(target);
+}
+
+void glGenFramebuffers (GLsizei n, GLuint* framebuffers)
+{
+ return (*_glGenFramebuffers)(n, framebuffers);
+}
+
+void glGenRenderbuffers (GLsizei n, GLuint* renderbuffers)
+{
+ return (*_glGenRenderbuffers)(n, renderbuffers);
+}
+
+void glGenTextures (GLsizei n, GLuint* textures)
+{
+ return (*_glGenTextures)(n, textures);
+}
+
+void glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
+{
+ return (*_glGetActiveAttrib)(program, index, bufsize, length, size, type, name);
+}
+
+void glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
+{
+ return (*_glGetActiveUniform)(program, index, bufsize, length, size, type, name);
+}
+
+void glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
+{
+ return (*_glGetAttachedShaders)(program, maxcount, count, shaders);
+}
+
+int glGetAttribLocation (GLuint program, const GLchar* name)
+{
+ return (*_glGetAttribLocation)(program, name);
+}
+
+void glGetBooleanv (GLenum pname, GLboolean* params)
+{
+ return (*_glGetBooleanv)(pname, params);
+}
+
+void glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params)
+{
+ return (*_glGetBufferParameteriv)(target, pname, params);
+}
+
+GLenum glGetError (void)
+{
+ return (*_glGetError)();
+}
+
+void glGetFloatv (GLenum pname, GLfloat* params)
+{
+ return (*_glGetFloatv)(pname, params);
+}
+
+void glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params)
+{
+ return (*_glGetFramebufferAttachmentParameteriv)(target, attachment, pname, params);
+}
+
+void glGetIntegerv (GLenum pname, GLint* params)
+{
+ return (*_glGetIntegerv)(pname, params);
+}
+
+void glGetProgramiv (GLuint program, GLenum pname, GLint* params)
+{
+ return (*_glGetProgramiv)(program, pname, params);
+}
+
+void glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog)
+{
+ return (*_glGetProgramInfoLog)(program, bufsize, length, infolog);
+}
+
+void glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params)
+{
+ return (*_glGetRenderbufferParameteriv)(target, pname, params);
+}
+
+void glGetShaderiv (GLuint shader, GLenum pname, GLint* params)
+{
+ return (*_glGetShaderiv)(shader, pname, params);
+}
+
+void glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog)
+{
+ return (*_glGetShaderInfoLog)(shader, bufsize, length, infolog);
+}
+
+void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
+{
+ return (*_glGetShaderPrecisionFormat)(shadertype, precisiontype, range, precision);
+}
+
+void glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source)
+{
+ return (*_glGetShaderSource)(shader, bufsize, length, source);
+}
+
+const GLubyte* glGetString (GLenum name)
+{
+ return (*_glGetString)(name);
+}
+
+void glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params)
+{
+ return (*_glGetTexParameterfv)(target, pname, params);
+}
+
+void glGetTexParameteriv (GLenum target, GLenum pname, GLint* params)
+{
+ return (*_glGetTexParameteriv)(target, pname, params);
+}
+
+void glGetUniformfv (GLuint program, GLint location, GLfloat* params)
+{
+ return (*_glGetUniformfv)(program, location, params);
+}
+
+void glGetUniformiv (GLuint program, GLint location, GLint* params)
+{
+ return (*_glGetUniformiv)(program, location, params);
+}
+
+int glGetUniformLocation (GLuint program, const GLchar* name)
+{
+ return (*_glGetUniformLocation)(program, name);
+}
+
+void glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params)
+{
+ return (*_glGetVertexAttribfv)(index, pname, params);
+}
+
+void glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params)
+{
+ return (*_glGetVertexAttribiv)(index, pname, params);
+}
+
+void glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer)
+{
+ return (*_glGetVertexAttribPointerv)(index, pname, pointer);
+}
+
+void glHint (GLenum target, GLenum mode)
+{
+ return (*_glHint)(target, mode);
+}
+
+GLboolean glIsBuffer (GLuint buffer)
+{
+ return (*_glIsBuffer)(buffer);
+}
+
+GLboolean glIsEnabled (GLenum cap)
+{
+ return (*_glIsEnabled)(cap);
+}
+
+GLboolean glIsFramebuffer (GLuint framebuffer)
+{
+ return (*_glIsFramebuffer)(framebuffer);
+}
+
+GLboolean glIsProgram (GLuint program)
+{
+ return (*_glIsProgram)(program);
+}
+
+GLboolean glIsRenderbuffer (GLuint renderbuffer)
+{
+ return (*_glIsRenderbuffer)(renderbuffer);
+}
+
+GLboolean glIsShader (GLuint shader)
+{
+ return (*_glIsShader)(shader);
+}
+
+GLboolean glIsTexture (GLuint texture)
+{
+ return (*_glIsTexture)(texture);
+}
+
+void glLineWidth (GLfloat width)
+{
+ return (*_glLineWidth)(width);
+}
+
+void glLinkProgram (GLuint program)
+{
+ return (*_glLinkProgram)(program);
+}
+
+void glPixelStorei (GLenum pname, GLint param)
+{
+ return (*_glPixelStorei)(pname, param);
+}
+
+void glPolygonOffset (GLfloat factor, GLfloat units)
+{
+ return (*_glPolygonOffset)(factor, units);
+}
+
+void glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
+{
+ return (*_glReadPixels)(x, y, width, height, format, type, pixels);
+
+}
+
+void glReleaseShaderCompiler (void)
+{
+ return (*_glReleaseShaderCompiler)();
+}
+
+void glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
+{
+ return (*_glRenderbufferStorage)(target, internalformat, width, height);
+}
+
+void glSampleCoverage (GLclampf value, GLboolean invert)
+{
+ return (*_glSampleCoverage)(value, invert);
+}
+
+void glScissor (GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ return (*_glScissor)(x, y, width, height);
+}
+
+void glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length)
+{
+ return (*_glShaderBinary)(n, shaders, binaryformat, binary, length);
+}
+
+void glShaderSource (GLuint shader, GLsizei count, const GLchar** string, const GLint* length)
+{
+ return (*_glShaderSource)(shader, count, string, length);
+}
+
+void glStencilFunc (GLenum func, GLint ref, GLuint mask)
+{
+ return (*_glStencilFunc)(func, ref, mask);
+}
+
+void glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask)
+{
+ return (*_glStencilFuncSeparate)(face, func, ref, mask);
+}
+
+void glStencilMask (GLuint mask)
+{
+ return (*_glStencilMask)(mask);
+}
+
+void glStencilMaskSeparate (GLenum face, GLuint mask)
+{
+ return (*_glStencilMaskSeparate)(face, mask);
+}
+
+void glStencilOp (GLenum fail, GLenum zfail, GLenum zpass)
+{
+ return (*_glStencilOp)(fail, zfail, zpass);
+}
+
+void glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
+{
+ return (*_glStencilOpSeparate)(face, fail, zfail, zpass);
+}
+
+void glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
+{
+ return (*_glTexImage2D)(target, level, internalformat, width, height, border, format, type, pixels);
+}
+
+void glTexParameterf (GLenum target, GLenum pname, GLfloat param)
+{
+ return (*_glTexParameterf)(target, pname, param);
+}
+
+void glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params)
+{
+ return (*_glTexParameterfv)(target, pname, params);
+}
+
+void glTexParameteri (GLenum target, GLenum pname, GLint param)
+{
+ return (*_glTexParameteri)(target, pname, param);
+}
+
+void glTexParameteriv (GLenum target, GLenum pname, const GLint* params)
+{
+ return (*_glTexParameteriv)(target, pname, params);
+}
+
+void glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels)
+{
+ return (*_glTexSubImage2D)(target, level, xoffset, yoffset, width, height, format, type, pixels);
+}
+
+void glUniform1f (GLint location, GLfloat x)
+{
+ return (*_glUniform1f)(location, x);
+}
+
+void glUniform1fv (GLint location, GLsizei count, const GLfloat* v)
+{
+ return (*_glUniform1fv)(location, count, v);
+}
+
+void glUniform1i (GLint location, GLint x)
+{
+ return (*_glUniform1i)(location, x);
+}
+
+void glUniform1iv (GLint location, GLsizei count, const GLint* v)
+{
+ return (*_glUniform1iv)(location, count, v);
+}
+
+void glUniform2f (GLint location, GLfloat x, GLfloat y)
+{
+ return (*_glUniform2f)(location, x, y);
+}
+
+void glUniform2fv (GLint location, GLsizei count, const GLfloat* v)
+{
+ return (*_glUniform2fv)(location, count, v);
+}
+
+void glUniform2i (GLint location, GLint x, GLint y)
+{
+ return (*_glUniform2i)(location, x, y);
+}
+
+void glUniform2iv (GLint location, GLsizei count, const GLint* v)
+{
+ return (*_glUniform2iv)(location, count, v);
+}
+
+void glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z)
+{
+ return (*_glUniform3f)(location, x, y, z);
+}
+
+void glUniform3fv (GLint location, GLsizei count, const GLfloat* v)
+{
+ return (*_glUniform3fv)(location, count, v);
+}
+
+void glUniform3i (GLint location, GLint x, GLint y, GLint z)
+{
+ return (*_glUniform3i)(location, x, y, z);
+}
+
+void glUniform3iv (GLint location, GLsizei count, const GLint* v)
+{
+ return (*_glUniform3iv)(location, count, v);
+}
+
+void glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ return (*_glUniform4f)(location, x, y, z, w);
+}
+
+void glUniform4fv (GLint location, GLsizei count, const GLfloat* v)
+{
+ return (*_glUniform4fv)(location, count, v);
+}
+
+void glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w)
+{
+ return (*_glUniform4i)(location, x, y, z, w);
+}
+
+void glUniform4iv (GLint location, GLsizei count, const GLint* v)
+{
+ return (*_glUniform4iv)(location, count, v);
+}
+
+void glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+ return (*_glUniformMatrix2fv)(location, count, transpose, value);
+}
+
+void glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+ return (*_glUniformMatrix3fv)(location, count, transpose, value);
+}
+
+void glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+{
+ return (*_glUniformMatrix4fv)(location, count, transpose, value);
+}
+
+void glUseProgram (GLuint program)
+{
+ return (*_glUseProgram)(program);
+}
+
+void glValidateProgram (GLuint program)
+{
+ return (*_glValidateProgram)(program);
+}
+
+void glVertexAttrib1f (GLuint indx, GLfloat x)
+{
+ return (*_glVertexAttrib1f)(indx, x);
+}
+
+void glVertexAttrib1fv (GLuint indx, const GLfloat* values)
+{
+ return (*_glVertexAttrib1fv)(indx, values);
+}
+
+void glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y)
+{
+ return (*_glVertexAttrib2f)(indx, x, y);
+}
+
+void glVertexAttrib2fv (GLuint indx, const GLfloat* values)
+{
+ return (*_glVertexAttrib2fv)(indx, values);
+}
+
+void glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z)
+{
+ return (*_glVertexAttrib3f)(indx, x, y, z);
+}
+
+void glVertexAttrib3fv (GLuint indx, const GLfloat* values)
+{
+ return (*_glVertexAttrib3fv)(indx, values);
+}
+
+void glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+{
+ return (*_glVertexAttrib4f)(indx, x, y, z, w);
+}
+
+void glVertexAttrib4fv (GLuint indx, const GLfloat* values)
+{
+ return (*_glVertexAttrib4fv)(indx, values);
+}
+
+void glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr)
+{
+ return (*_glVertexAttribPointer)(indx, size, type, normalized, stride, ptr);
+}
+
+void glViewport (GLint x, GLint y, GLsizei width, GLsizei height)
+{
+ return (*_glViewport)(x, y, width, height);
+}
+
+void glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image)
+{
+ (*_glEGLImageTargetTexture2DOES)(target, image);
+}
+
+
--- /dev/null
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=@includedir@
+
+Name: glesv2
+Description: libhybris OpenGL ES 2.0 library
+Version: @VERSION@
+Libs: -L${libdir} -lGLESv2
+Cflags: -I${includedir}
--- /dev/null
+lib_LTLIBRARIES = \
+ libhardware.la
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libhardware.pc
+
+libhardware_la_SOURCES = hardware.c
+libhardware_la_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/include/android
+if WANT_TRACE
+libhardware_la_CFLAGS += -DDEBUG
+endif
+if WANT_DEBUG
+libhardware_la_CFLAGS += -ggdb -O0
+endif
+libhardware_la_LDFLAGS = \
+ $(top_builddir)/common/libhybris-common.la \
+ -version-info "2":"0":"0"
--- /dev/null
+/*
+ * Copyright (c) 2012 Simon Busch <morphis@gravedo.de>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dlfcn.h>
+#include <stddef.h>
+#include <android/hardware/hardware.h>
+#include <hybris/internal/binding.h>
+
+static void *_libhardware = NULL;
+
+static int (*_hw_get_module)(const char *id, const struct hw_module_t **module) = NULL;
+
+static int (*_hw_get_module_by_class)(const char *class_id, const char *inst, const struct hw_module_t **module) = NULL;
+
+#define HARDWARE_DLSYM(fptr, sym) do { if (_libhardware == NULL) { _init_lib_hardware(); }; if (*(fptr) == NULL) { *(fptr) = (void *) android_dlsym(_libhardware, sym); } } while (0)
+
+static void _init_lib_hardware()
+{
+ _libhardware = (void *) android_dlopen("/system/lib/libhardware.so", RTLD_LAZY);
+}
+
+int hw_get_module(const char *id, const struct hw_module_t **module)
+{
+ HARDWARE_DLSYM(&_hw_get_module, "hw_get_module");
+ return (*_hw_get_module)(id, module);
+}
+
+int hw_get_module_by_class(const char *class_id, const char *inst,
+ const struct hw_module_t **module)
+{
+ HARDWARE_DLSYM(&_hw_get_module_by_class, "hw_get_module_by_class");
+ return (*_hw_get_module_by_class)(class_id, inst, module);
+}
+
+// vim:ts=4:sw=4:noexpandtab
--- /dev/null
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=@includedir@
+
+Name: hybris-hardware
+Description: libhybris hardware library
+Version: @VERSION@
+Requires: android-headers
+Libs: -L${libdir} -lhardware
+Cflags: -I${includedir}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2008-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.
+ ******************************************************************************/
+
+/* $Revision: 11985 $ on $Date: 2010-07-15 11:16:06 -0700 (Thu, 15 Jul 2010) $ */
+
+#ifndef __OPENCL_CL_H
+#define __OPENCL_CL_H
+
+#ifdef __APPLE__
+#include <OpenCL/cl_platform.h>
+#else
+#include <CL/cl_platform.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/******************************************************************************/
+
+typedef struct _cl_platform_id * cl_platform_id;
+typedef struct _cl_device_id * cl_device_id;
+typedef struct _cl_context * cl_context;
+typedef struct _cl_command_queue * cl_command_queue;
+typedef struct _cl_mem * cl_mem;
+typedef struct _cl_program * cl_program;
+typedef struct _cl_kernel * cl_kernel;
+typedef struct _cl_event * cl_event;
+typedef struct _cl_sampler * cl_sampler;
+
+typedef cl_uint cl_bool; /* WARNING! Unlike cl_ types in cl_platform.h, cl_bool is not guaranteed to be the same size as the bool in kernels. */
+typedef cl_ulong cl_bitfield;
+typedef cl_bitfield cl_device_type;
+typedef cl_uint cl_platform_info;
+typedef cl_uint cl_device_info;
+typedef cl_bitfield cl_device_fp_config;
+typedef cl_uint cl_device_mem_cache_type;
+typedef cl_uint cl_device_local_mem_type;
+typedef cl_bitfield cl_device_exec_capabilities;
+typedef cl_bitfield cl_command_queue_properties;
+
+typedef intptr_t cl_context_properties;
+typedef cl_uint cl_context_info;
+typedef cl_uint cl_command_queue_info;
+typedef cl_uint cl_channel_order;
+typedef cl_uint cl_channel_type;
+typedef cl_bitfield cl_mem_flags;
+typedef cl_uint cl_mem_object_type;
+typedef cl_uint cl_mem_info;
+typedef cl_uint cl_image_info;
+typedef cl_uint cl_buffer_create_type;
+typedef cl_uint cl_addressing_mode;
+typedef cl_uint cl_filter_mode;
+typedef cl_uint cl_sampler_info;
+typedef cl_bitfield cl_map_flags;
+typedef cl_uint cl_program_info;
+typedef cl_uint cl_program_build_info;
+typedef cl_int cl_build_status;
+typedef cl_uint cl_kernel_info;
+typedef cl_uint cl_kernel_work_group_info;
+typedef cl_uint cl_event_info;
+typedef cl_uint cl_command_type;
+typedef cl_uint cl_profiling_info;
+
+typedef struct _cl_image_format {
+ cl_channel_order image_channel_order;
+ cl_channel_type image_channel_data_type;
+} cl_image_format;
+
+
+typedef struct _cl_buffer_region {
+ size_t origin;
+ size_t size;
+} cl_buffer_region;
+
+/******************************************************************************/
+
+/* Error Codes */
+#define CL_SUCCESS 0
+#define CL_DEVICE_NOT_FOUND -1
+#define CL_DEVICE_NOT_AVAILABLE -2
+#define CL_COMPILER_NOT_AVAILABLE -3
+#define CL_MEM_OBJECT_ALLOCATION_FAILURE -4
+#define CL_OUT_OF_RESOURCES -5
+#define CL_OUT_OF_HOST_MEMORY -6
+#define CL_PROFILING_INFO_NOT_AVAILABLE -7
+#define CL_MEM_COPY_OVERLAP -8
+#define CL_IMAGE_FORMAT_MISMATCH -9
+#define CL_IMAGE_FORMAT_NOT_SUPPORTED -10
+#define CL_BUILD_PROGRAM_FAILURE -11
+#define CL_MAP_FAILURE -12
+#define CL_MISALIGNED_SUB_BUFFER_OFFSET -13
+#define CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST -14
+
+#define CL_INVALID_VALUE -30
+#define CL_INVALID_DEVICE_TYPE -31
+#define CL_INVALID_PLATFORM -32
+#define CL_INVALID_DEVICE -33
+#define CL_INVALID_CONTEXT -34
+#define CL_INVALID_QUEUE_PROPERTIES -35
+#define CL_INVALID_COMMAND_QUEUE -36
+#define CL_INVALID_HOST_PTR -37
+#define CL_INVALID_MEM_OBJECT -38
+#define CL_INVALID_IMAGE_FORMAT_DESCRIPTOR -39
+#define CL_INVALID_IMAGE_SIZE -40
+#define CL_INVALID_SAMPLER -41
+#define CL_INVALID_BINARY -42
+#define CL_INVALID_BUILD_OPTIONS -43
+#define CL_INVALID_PROGRAM -44
+#define CL_INVALID_PROGRAM_EXECUTABLE -45
+#define CL_INVALID_KERNEL_NAME -46
+#define CL_INVALID_KERNEL_DEFINITION -47
+#define CL_INVALID_KERNEL -48
+#define CL_INVALID_ARG_INDEX -49
+#define CL_INVALID_ARG_VALUE -50
+#define CL_INVALID_ARG_SIZE -51
+#define CL_INVALID_KERNEL_ARGS -52
+#define CL_INVALID_WORK_DIMENSION -53
+#define CL_INVALID_WORK_GROUP_SIZE -54
+#define CL_INVALID_WORK_ITEM_SIZE -55
+#define CL_INVALID_GLOBAL_OFFSET -56
+#define CL_INVALID_EVENT_WAIT_LIST -57
+#define CL_INVALID_EVENT -58
+#define CL_INVALID_OPERATION -59
+#define CL_INVALID_GL_OBJECT -60
+#define CL_INVALID_BUFFER_SIZE -61
+#define CL_INVALID_MIP_LEVEL -62
+#define CL_INVALID_GLOBAL_WORK_SIZE -63
+#define CL_INVALID_PROPERTY -64
+
+/* OpenCL Version */
+#define CL_VERSION_1_0 1
+#define CL_VERSION_1_1 1
+
+/* cl_bool */
+#define CL_FALSE 0
+#define CL_TRUE 1
+
+/* cl_platform_info */
+#define CL_PLATFORM_PROFILE 0x0900
+#define CL_PLATFORM_VERSION 0x0901
+#define CL_PLATFORM_NAME 0x0902
+#define CL_PLATFORM_VENDOR 0x0903
+#define CL_PLATFORM_EXTENSIONS 0x0904
+
+/* cl_device_type - bitfield */
+#define CL_DEVICE_TYPE_DEFAULT (1 << 0)
+#define CL_DEVICE_TYPE_CPU (1 << 1)
+#define CL_DEVICE_TYPE_GPU (1 << 2)
+#define CL_DEVICE_TYPE_ACCELERATOR (1 << 3)
+#define CL_DEVICE_TYPE_ALL 0xFFFFFFFF
+
+/* cl_device_info */
+#define CL_DEVICE_TYPE 0x1000
+#define CL_DEVICE_VENDOR_ID 0x1001
+#define CL_DEVICE_MAX_COMPUTE_UNITS 0x1002
+#define CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS 0x1003
+#define CL_DEVICE_MAX_WORK_GROUP_SIZE 0x1004
+#define CL_DEVICE_MAX_WORK_ITEM_SIZES 0x1005
+#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR 0x1006
+#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT 0x1007
+#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT 0x1008
+#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG 0x1009
+#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT 0x100A
+#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE 0x100B
+#define CL_DEVICE_MAX_CLOCK_FREQUENCY 0x100C
+#define CL_DEVICE_ADDRESS_BITS 0x100D
+#define CL_DEVICE_MAX_READ_IMAGE_ARGS 0x100E
+#define CL_DEVICE_MAX_WRITE_IMAGE_ARGS 0x100F
+#define CL_DEVICE_MAX_MEM_ALLOC_SIZE 0x1010
+#define CL_DEVICE_IMAGE2D_MAX_WIDTH 0x1011
+#define CL_DEVICE_IMAGE2D_MAX_HEIGHT 0x1012
+#define CL_DEVICE_IMAGE3D_MAX_WIDTH 0x1013
+#define CL_DEVICE_IMAGE3D_MAX_HEIGHT 0x1014
+#define CL_DEVICE_IMAGE3D_MAX_DEPTH 0x1015
+#define CL_DEVICE_IMAGE_SUPPORT 0x1016
+#define CL_DEVICE_MAX_PARAMETER_SIZE 0x1017
+#define CL_DEVICE_MAX_SAMPLERS 0x1018
+#define CL_DEVICE_MEM_BASE_ADDR_ALIGN 0x1019
+#define CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE 0x101A
+#define CL_DEVICE_SINGLE_FP_CONFIG 0x101B
+#define CL_DEVICE_GLOBAL_MEM_CACHE_TYPE 0x101C
+#define CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE 0x101D
+#define CL_DEVICE_GLOBAL_MEM_CACHE_SIZE 0x101E
+#define CL_DEVICE_GLOBAL_MEM_SIZE 0x101F
+#define CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE 0x1020
+#define CL_DEVICE_MAX_CONSTANT_ARGS 0x1021
+#define CL_DEVICE_LOCAL_MEM_TYPE 0x1022
+#define CL_DEVICE_LOCAL_MEM_SIZE 0x1023
+#define CL_DEVICE_ERROR_CORRECTION_SUPPORT 0x1024
+#define CL_DEVICE_PROFILING_TIMER_RESOLUTION 0x1025
+#define CL_DEVICE_ENDIAN_LITTLE 0x1026
+#define CL_DEVICE_AVAILABLE 0x1027
+#define CL_DEVICE_COMPILER_AVAILABLE 0x1028
+#define CL_DEVICE_EXECUTION_CAPABILITIES 0x1029
+#define CL_DEVICE_QUEUE_PROPERTIES 0x102A
+#define CL_DEVICE_NAME 0x102B
+#define CL_DEVICE_VENDOR 0x102C
+#define CL_DRIVER_VERSION 0x102D
+#define CL_DEVICE_PROFILE 0x102E
+#define CL_DEVICE_VERSION 0x102F
+#define CL_DEVICE_EXTENSIONS 0x1030
+#define CL_DEVICE_PLATFORM 0x1031
+/* 0x1032 reserved for CL_DEVICE_DOUBLE_FP_CONFIG */
+/* 0x1033 reserved for CL_DEVICE_HALF_FP_CONFIG */
+#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF 0x1034
+#define CL_DEVICE_HOST_UNIFIED_MEMORY 0x1035
+#define CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR 0x1036
+#define CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT 0x1037
+#define CL_DEVICE_NATIVE_VECTOR_WIDTH_INT 0x1038
+#define CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG 0x1039
+#define CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT 0x103A
+#define CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE 0x103B
+#define CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF 0x103C
+#define CL_DEVICE_OPENCL_C_VERSION 0x103D
+
+/* cl_device_fp_config - bitfield */
+#define CL_FP_DENORM (1 << 0)
+#define CL_FP_INF_NAN (1 << 1)
+#define CL_FP_ROUND_TO_NEAREST (1 << 2)
+#define CL_FP_ROUND_TO_ZERO (1 << 3)
+#define CL_FP_ROUND_TO_INF (1 << 4)
+#define CL_FP_FMA (1 << 5)
+#define CL_FP_SOFT_FLOAT (1 << 6)
+
+/* cl_device_mem_cache_type */
+#define CL_NONE 0x0
+#define CL_READ_ONLY_CACHE 0x1
+#define CL_READ_WRITE_CACHE 0x2
+
+/* cl_device_local_mem_type */
+#define CL_LOCAL 0x1
+#define CL_GLOBAL 0x2
+
+/* cl_device_exec_capabilities - bitfield */
+#define CL_EXEC_KERNEL (1 << 0)
+#define CL_EXEC_NATIVE_KERNEL (1 << 1)
+
+/* cl_command_queue_properties - bitfield */
+#define CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE (1 << 0)
+#define CL_QUEUE_PROFILING_ENABLE (1 << 1)
+
+/* cl_context_info */
+#define CL_CONTEXT_REFERENCE_COUNT 0x1080
+#define CL_CONTEXT_DEVICES 0x1081
+#define CL_CONTEXT_PROPERTIES 0x1082
+#define CL_CONTEXT_NUM_DEVICES 0x1083
+
+/* cl_context_info + cl_context_properties */
+#define CL_CONTEXT_PLATFORM 0x1084
+
+/* cl_command_queue_info */
+#define CL_QUEUE_CONTEXT 0x1090
+#define CL_QUEUE_DEVICE 0x1091
+#define CL_QUEUE_REFERENCE_COUNT 0x1092
+#define CL_QUEUE_PROPERTIES 0x1093
+
+/* cl_mem_flags - bitfield */
+#define CL_MEM_READ_WRITE (1 << 0)
+#define CL_MEM_WRITE_ONLY (1 << 1)
+#define CL_MEM_READ_ONLY (1 << 2)
+#define CL_MEM_USE_HOST_PTR (1 << 3)
+#define CL_MEM_ALLOC_HOST_PTR (1 << 4)
+#define CL_MEM_COPY_HOST_PTR (1 << 5)
+
+/* cl_channel_order */
+#define CL_R 0x10B0
+#define CL_A 0x10B1
+#define CL_RG 0x10B2
+#define CL_RA 0x10B3
+#define CL_RGB 0x10B4
+#define CL_RGBA 0x10B5
+#define CL_BGRA 0x10B6
+#define CL_ARGB 0x10B7
+#define CL_INTENSITY 0x10B8
+#define CL_LUMINANCE 0x10B9
+#define CL_Rx 0x10BA
+#define CL_RGx 0x10BB
+#define CL_RGBx 0x10BC
+
+/* cl_channel_type */
+#define CL_SNORM_INT8 0x10D0
+#define CL_SNORM_INT16 0x10D1
+#define CL_UNORM_INT8 0x10D2
+#define CL_UNORM_INT16 0x10D3
+#define CL_UNORM_SHORT_565 0x10D4
+#define CL_UNORM_SHORT_555 0x10D5
+#define CL_UNORM_INT_101010 0x10D6
+#define CL_SIGNED_INT8 0x10D7
+#define CL_SIGNED_INT16 0x10D8
+#define CL_SIGNED_INT32 0x10D9
+#define CL_UNSIGNED_INT8 0x10DA
+#define CL_UNSIGNED_INT16 0x10DB
+#define CL_UNSIGNED_INT32 0x10DC
+#define CL_HALF_FLOAT 0x10DD
+#define CL_FLOAT 0x10DE
+
+/* cl_mem_object_type */
+#define CL_MEM_OBJECT_BUFFER 0x10F0
+#define CL_MEM_OBJECT_IMAGE2D 0x10F1
+#define CL_MEM_OBJECT_IMAGE3D 0x10F2
+
+/* cl_mem_info */
+#define CL_MEM_TYPE 0x1100
+#define CL_MEM_FLAGS 0x1101
+#define CL_MEM_SIZE 0x1102
+#define CL_MEM_HOST_PTR 0x1103
+#define CL_MEM_MAP_COUNT 0x1104
+#define CL_MEM_REFERENCE_COUNT 0x1105
+#define CL_MEM_CONTEXT 0x1106
+#define CL_MEM_ASSOCIATED_MEMOBJECT 0x1107
+#define CL_MEM_OFFSET 0x1108
+
+/* cl_image_info */
+#define CL_IMAGE_FORMAT 0x1110
+#define CL_IMAGE_ELEMENT_SIZE 0x1111
+#define CL_IMAGE_ROW_PITCH 0x1112
+#define CL_IMAGE_SLICE_PITCH 0x1113
+#define CL_IMAGE_WIDTH 0x1114
+#define CL_IMAGE_HEIGHT 0x1115
+#define CL_IMAGE_DEPTH 0x1116
+
+/* cl_addressing_mode */
+#define CL_ADDRESS_NONE 0x1130
+#define CL_ADDRESS_CLAMP_TO_EDGE 0x1131
+#define CL_ADDRESS_CLAMP 0x1132
+#define CL_ADDRESS_REPEAT 0x1133
+#define CL_ADDRESS_MIRRORED_REPEAT 0x1134
+
+/* cl_filter_mode */
+#define CL_FILTER_NEAREST 0x1140
+#define CL_FILTER_LINEAR 0x1141
+
+/* cl_sampler_info */
+#define CL_SAMPLER_REFERENCE_COUNT 0x1150
+#define CL_SAMPLER_CONTEXT 0x1151
+#define CL_SAMPLER_NORMALIZED_COORDS 0x1152
+#define CL_SAMPLER_ADDRESSING_MODE 0x1153
+#define CL_SAMPLER_FILTER_MODE 0x1154
+
+/* cl_map_flags - bitfield */
+#define CL_MAP_READ (1 << 0)
+#define CL_MAP_WRITE (1 << 1)
+
+/* cl_program_info */
+#define CL_PROGRAM_REFERENCE_COUNT 0x1160
+#define CL_PROGRAM_CONTEXT 0x1161
+#define CL_PROGRAM_NUM_DEVICES 0x1162
+#define CL_PROGRAM_DEVICES 0x1163
+#define CL_PROGRAM_SOURCE 0x1164
+#define CL_PROGRAM_BINARY_SIZES 0x1165
+#define CL_PROGRAM_BINARIES 0x1166
+
+/* cl_program_build_info */
+#define CL_PROGRAM_BUILD_STATUS 0x1181
+#define CL_PROGRAM_BUILD_OPTIONS 0x1182
+#define CL_PROGRAM_BUILD_LOG 0x1183
+
+/* cl_build_status */
+#define CL_BUILD_SUCCESS 0
+#define CL_BUILD_NONE -1
+#define CL_BUILD_ERROR -2
+#define CL_BUILD_IN_PROGRESS -3
+
+/* cl_kernel_info */
+#define CL_KERNEL_FUNCTION_NAME 0x1190
+#define CL_KERNEL_NUM_ARGS 0x1191
+#define CL_KERNEL_REFERENCE_COUNT 0x1192
+#define CL_KERNEL_CONTEXT 0x1193
+#define CL_KERNEL_PROGRAM 0x1194
+
+/* cl_kernel_work_group_info */
+#define CL_KERNEL_WORK_GROUP_SIZE 0x11B0
+#define CL_KERNEL_COMPILE_WORK_GROUP_SIZE 0x11B1
+#define CL_KERNEL_LOCAL_MEM_SIZE 0x11B2
+#define CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE 0x11B3
+#define CL_KERNEL_PRIVATE_MEM_SIZE 0x11B4
+
+/* cl_event_info */
+#define CL_EVENT_COMMAND_QUEUE 0x11D0
+#define CL_EVENT_COMMAND_TYPE 0x11D1
+#define CL_EVENT_REFERENCE_COUNT 0x11D2
+#define CL_EVENT_COMMAND_EXECUTION_STATUS 0x11D3
+#define CL_EVENT_CONTEXT 0x11D4
+
+/* cl_command_type */
+#define CL_COMMAND_NDRANGE_KERNEL 0x11F0
+#define CL_COMMAND_TASK 0x11F1
+#define CL_COMMAND_NATIVE_KERNEL 0x11F2
+#define CL_COMMAND_READ_BUFFER 0x11F3
+#define CL_COMMAND_WRITE_BUFFER 0x11F4
+#define CL_COMMAND_COPY_BUFFER 0x11F5
+#define CL_COMMAND_READ_IMAGE 0x11F6
+#define CL_COMMAND_WRITE_IMAGE 0x11F7
+#define CL_COMMAND_COPY_IMAGE 0x11F8
+#define CL_COMMAND_COPY_IMAGE_TO_BUFFER 0x11F9
+#define CL_COMMAND_COPY_BUFFER_TO_IMAGE 0x11FA
+#define CL_COMMAND_MAP_BUFFER 0x11FB
+#define CL_COMMAND_MAP_IMAGE 0x11FC
+#define CL_COMMAND_UNMAP_MEM_OBJECT 0x11FD
+#define CL_COMMAND_MARKER 0x11FE
+#define CL_COMMAND_ACQUIRE_GL_OBJECTS 0x11FF
+#define CL_COMMAND_RELEASE_GL_OBJECTS 0x1200
+#define CL_COMMAND_READ_BUFFER_RECT 0x1201
+#define CL_COMMAND_WRITE_BUFFER_RECT 0x1202
+#define CL_COMMAND_COPY_BUFFER_RECT 0x1203
+#define CL_COMMAND_USER 0x1204
+
+/* command execution status */
+#define CL_COMPLETE 0x0
+#define CL_RUNNING 0x1
+#define CL_SUBMITTED 0x2
+#define CL_QUEUED 0x3
+
+/* cl_buffer_create_type */
+#define CL_BUFFER_CREATE_TYPE_REGION 0x1220
+
+/* cl_profiling_info */
+#define CL_PROFILING_COMMAND_QUEUED 0x1280
+#define CL_PROFILING_COMMAND_SUBMIT 0x1281
+#define CL_PROFILING_COMMAND_START 0x1282
+#define CL_PROFILING_COMMAND_END 0x1283
+
+/********************************************************************************************************/
+
+/* Platform API */
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetPlatformIDs(cl_uint /* num_entries */,
+ cl_platform_id * /* platforms */,
+ cl_uint * /* num_platforms */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetPlatformInfo(cl_platform_id /* platform */,
+ cl_platform_info /* param_name */,
+ size_t /* param_value_size */,
+ void * /* param_value */,
+ size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+/* Device APIs */
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetDeviceIDs(cl_platform_id /* platform */,
+ cl_device_type /* device_type */,
+ cl_uint /* num_entries */,
+ cl_device_id * /* devices */,
+ cl_uint * /* num_devices */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetDeviceInfo(cl_device_id /* device */,
+ cl_device_info /* param_name */,
+ size_t /* param_value_size */,
+ void * /* param_value */,
+ size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+/* Context APIs */
+extern CL_API_ENTRY cl_context CL_API_CALL
+clCreateContext(const cl_context_properties * /* properties */,
+ cl_uint /* num_devices */,
+ const cl_device_id * /* devices */,
+ void (CL_CALLBACK * /* pfn_notify */)(const char *, const void *, size_t, void *),
+ void * /* user_data */,
+ cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_context CL_API_CALL
+clCreateContextFromType(const cl_context_properties * /* properties */,
+ cl_device_type /* device_type */,
+ void (CL_CALLBACK * /* pfn_notify*/ )(const char *, const void *, size_t, void *),
+ void * /* user_data */,
+ cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainContext(cl_context /* context */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseContext(cl_context /* context */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetContextInfo(cl_context /* context */,
+ cl_context_info /* param_name */,
+ size_t /* param_value_size */,
+ void * /* param_value */,
+ size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+/* Command Queue APIs */
+extern CL_API_ENTRY cl_command_queue CL_API_CALL
+clCreateCommandQueue(cl_context /* context */,
+ cl_device_id /* device */,
+ cl_command_queue_properties /* properties */,
+ cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainCommandQueue(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseCommandQueue(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetCommandQueueInfo(cl_command_queue /* command_queue */,
+ cl_command_queue_info /* param_name */,
+ size_t /* param_value_size */,
+ void * /* param_value */,
+ size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+#ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
+#warning CL_USE_DEPRECATED_OPENCL_1_0_APIS is defined. These APIs are unsupported and untested in OpenCL 1.1!
+/*
+ * WARNING:
+ * This API introduces mutable state into the OpenCL implementation. It has been REMOVED
+ * to better facilitate thread safety. The 1.0 API is not thread safe. It is not tested by the
+ * OpenCL 1.1 conformance test, and consequently may not work or may not work dependably.
+ * It is likely to be non-performant. Use of this API is not advised. Use at your own risk.
+ *
+ * Software developers previously relying on this API are instructed to set the command queue
+ * properties when creating the queue, instead.
+ */
+extern CL_API_ENTRY cl_int CL_API_CALL
+clSetCommandQueueProperty(cl_command_queue /* command_queue */,
+ cl_command_queue_properties /* properties */,
+ cl_bool /* enable */,
+ cl_command_queue_properties * /* old_properties */) CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED;
+#endif /* CL_USE_DEPRECATED_OPENCL_1_0_APIS */
+
+/* Memory Object APIs */
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateBuffer(cl_context /* context */,
+ cl_mem_flags /* flags */,
+ size_t /* size */,
+ void * /* host_ptr */,
+ cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateSubBuffer(cl_mem /* buffer */,
+ cl_mem_flags /* flags */,
+ cl_buffer_create_type /* buffer_create_type */,
+ const void * /* buffer_create_info */,
+ cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_1;
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateImage2D(cl_context /* context */,
+ cl_mem_flags /* flags */,
+ const cl_image_format * /* image_format */,
+ size_t /* image_width */,
+ size_t /* image_height */,
+ size_t /* image_row_pitch */,
+ void * /* host_ptr */,
+ cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateImage3D(cl_context /* context */,
+ cl_mem_flags /* flags */,
+ const cl_image_format * /* image_format */,
+ size_t /* image_width */,
+ size_t /* image_height */,
+ size_t /* image_depth */,
+ size_t /* image_row_pitch */,
+ size_t /* image_slice_pitch */,
+ void * /* host_ptr */,
+ cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainMemObject(cl_mem /* memobj */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseMemObject(cl_mem /* memobj */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetSupportedImageFormats(cl_context /* context */,
+ cl_mem_flags /* flags */,
+ cl_mem_object_type /* image_type */,
+ cl_uint /* num_entries */,
+ cl_image_format * /* image_formats */,
+ cl_uint * /* num_image_formats */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetMemObjectInfo(cl_mem /* memobj */,
+ cl_mem_info /* param_name */,
+ size_t /* param_value_size */,
+ void * /* param_value */,
+ size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetImageInfo(cl_mem /* image */,
+ cl_image_info /* param_name */,
+ size_t /* param_value_size */,
+ void * /* param_value */,
+ size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clSetMemObjectDestructorCallback( cl_mem /* memobj */,
+ void (CL_CALLBACK * /*pfn_notify*/)( cl_mem /* memobj */, void* /*user_data*/),
+ void * /*user_data */ ) CL_API_SUFFIX__VERSION_1_1;
+
+/* Sampler APIs */
+extern CL_API_ENTRY cl_sampler CL_API_CALL
+clCreateSampler(cl_context /* context */,
+ cl_bool /* normalized_coords */,
+ cl_addressing_mode /* addressing_mode */,
+ cl_filter_mode /* filter_mode */,
+ cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainSampler(cl_sampler /* sampler */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseSampler(cl_sampler /* sampler */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetSamplerInfo(cl_sampler /* sampler */,
+ cl_sampler_info /* param_name */,
+ size_t /* param_value_size */,
+ void * /* param_value */,
+ size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+/* Program Object APIs */
+extern CL_API_ENTRY cl_program CL_API_CALL
+clCreateProgramWithSource(cl_context /* context */,
+ cl_uint /* count */,
+ const char ** /* strings */,
+ const size_t * /* lengths */,
+ cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_program CL_API_CALL
+clCreateProgramWithBinary(cl_context /* context */,
+ cl_uint /* num_devices */,
+ const cl_device_id * /* device_list */,
+ const size_t * /* lengths */,
+ const unsigned char ** /* binaries */,
+ cl_int * /* binary_status */,
+ cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainProgram(cl_program /* program */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseProgram(cl_program /* program */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clBuildProgram(cl_program /* program */,
+ cl_uint /* num_devices */,
+ const cl_device_id * /* device_list */,
+ const char * /* options */,
+ void (CL_CALLBACK * /* pfn_notify */)(cl_program /* program */, void * /* user_data */),
+ void * /* user_data */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clUnloadCompiler(void) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetProgramInfo(cl_program /* program */,
+ cl_program_info /* param_name */,
+ size_t /* param_value_size */,
+ void * /* param_value */,
+ size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetProgramBuildInfo(cl_program /* program */,
+ cl_device_id /* device */,
+ cl_program_build_info /* param_name */,
+ size_t /* param_value_size */,
+ void * /* param_value */,
+ size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+/* Kernel Object APIs */
+extern CL_API_ENTRY cl_kernel CL_API_CALL
+clCreateKernel(cl_program /* program */,
+ const char * /* kernel_name */,
+ cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clCreateKernelsInProgram(cl_program /* program */,
+ cl_uint /* num_kernels */,
+ cl_kernel * /* kernels */,
+ cl_uint * /* num_kernels_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainKernel(cl_kernel /* kernel */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseKernel(cl_kernel /* kernel */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clSetKernelArg(cl_kernel /* kernel */,
+ cl_uint /* arg_index */,
+ size_t /* arg_size */,
+ const void * /* arg_value */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetKernelInfo(cl_kernel /* kernel */,
+ cl_kernel_info /* param_name */,
+ size_t /* param_value_size */,
+ void * /* param_value */,
+ size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetKernelWorkGroupInfo(cl_kernel /* kernel */,
+ cl_device_id /* device */,
+ cl_kernel_work_group_info /* param_name */,
+ size_t /* param_value_size */,
+ void * /* param_value */,
+ size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+/* Event Object APIs */
+extern CL_API_ENTRY cl_int CL_API_CALL
+clWaitForEvents(cl_uint /* num_events */,
+ const cl_event * /* event_list */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetEventInfo(cl_event /* event */,
+ cl_event_info /* param_name */,
+ size_t /* param_value_size */,
+ void * /* param_value */,
+ size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_event CL_API_CALL
+clCreateUserEvent(cl_context /* context */,
+ cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_1;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clRetainEvent(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clReleaseEvent(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clSetUserEventStatus(cl_event /* event */,
+ cl_int /* execution_status */) CL_API_SUFFIX__VERSION_1_1;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clSetEventCallback( cl_event /* event */,
+ cl_int /* command_exec_callback_type */,
+ void (CL_CALLBACK * /* pfn_notify */)(cl_event, cl_int, void *),
+ void * /* user_data */) CL_API_SUFFIX__VERSION_1_1;
+
+/* Profiling APIs */
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetEventProfilingInfo(cl_event /* event */,
+ cl_profiling_info /* param_name */,
+ size_t /* param_value_size */,
+ void * /* param_value */,
+ size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+/* Flush and Finish APIs */
+extern CL_API_ENTRY cl_int CL_API_CALL
+clFlush(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clFinish(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
+
+/* Enqueued Commands APIs */
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueReadBuffer(cl_command_queue /* command_queue */,
+ cl_mem /* buffer */,
+ cl_bool /* blocking_read */,
+ size_t /* offset */,
+ size_t /* cb */,
+ void * /* ptr */,
+ cl_uint /* num_events_in_wait_list */,
+ const cl_event * /* event_wait_list */,
+ cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueReadBufferRect(cl_command_queue /* command_queue */,
+ cl_mem /* buffer */,
+ cl_bool /* blocking_read */,
+ const size_t * /* buffer_origin */,
+ const size_t * /* host_origin */,
+ const size_t * /* region */,
+ size_t /* buffer_row_pitch */,
+ size_t /* buffer_slice_pitch */,
+ size_t /* host_row_pitch */,
+ size_t /* host_slice_pitch */,
+ void * /* ptr */,
+ cl_uint /* num_events_in_wait_list */,
+ const cl_event * /* event_wait_list */,
+ cl_event * /* event */) CL_API_SUFFIX__VERSION_1_1;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueWriteBuffer(cl_command_queue /* command_queue */,
+ cl_mem /* buffer */,
+ cl_bool /* blocking_write */,
+ size_t /* offset */,
+ size_t /* cb */,
+ const void * /* ptr */,
+ cl_uint /* num_events_in_wait_list */,
+ const cl_event * /* event_wait_list */,
+ cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueWriteBufferRect(cl_command_queue /* command_queue */,
+ cl_mem /* buffer */,
+ cl_bool /* blocking_write */,
+ const size_t * /* buffer_origin */,
+ const size_t * /* host_origin */,
+ const size_t * /* region */,
+ size_t /* buffer_row_pitch */,
+ size_t /* buffer_slice_pitch */,
+ size_t /* host_row_pitch */,
+ size_t /* host_slice_pitch */,
+ const void * /* ptr */,
+ cl_uint /* num_events_in_wait_list */,
+ const cl_event * /* event_wait_list */,
+ cl_event * /* event */) CL_API_SUFFIX__VERSION_1_1;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueCopyBuffer(cl_command_queue /* command_queue */,
+ cl_mem /* src_buffer */,
+ cl_mem /* dst_buffer */,
+ size_t /* src_offset */,
+ size_t /* dst_offset */,
+ size_t /* cb */,
+ cl_uint /* num_events_in_wait_list */,
+ const cl_event * /* event_wait_list */,
+ cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueCopyBufferRect(cl_command_queue /* command_queue */,
+ cl_mem /* src_buffer */,
+ cl_mem /* dst_buffer */,
+ const size_t * /* src_origin */,
+ const size_t * /* dst_origin */,
+ const size_t * /* region */,
+ size_t /* src_row_pitch */,
+ size_t /* src_slice_pitch */,
+ size_t /* dst_row_pitch */,
+ size_t /* dst_slice_pitch */,
+ cl_uint /* num_events_in_wait_list */,
+ const cl_event * /* event_wait_list */,
+ cl_event * /* event */) CL_API_SUFFIX__VERSION_1_1;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueReadImage(cl_command_queue /* command_queue */,
+ cl_mem /* image */,
+ cl_bool /* blocking_read */,
+ const size_t * /* origin[3] */,
+ const size_t * /* region[3] */,
+ size_t /* row_pitch */,
+ size_t /* slice_pitch */,
+ void * /* ptr */,
+ cl_uint /* num_events_in_wait_list */,
+ const cl_event * /* event_wait_list */,
+ cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueWriteImage(cl_command_queue /* command_queue */,
+ cl_mem /* image */,
+ cl_bool /* blocking_write */,
+ const size_t * /* origin[3] */,
+ const size_t * /* region[3] */,
+ size_t /* input_row_pitch */,
+ size_t /* input_slice_pitch */,
+ const void * /* ptr */,
+ cl_uint /* num_events_in_wait_list */,
+ const cl_event * /* event_wait_list */,
+ cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueCopyImage(cl_command_queue /* command_queue */,
+ cl_mem /* src_image */,
+ cl_mem /* dst_image */,
+ const size_t * /* src_origin[3] */,
+ const size_t * /* dst_origin[3] */,
+ const size_t * /* region[3] */,
+ cl_uint /* num_events_in_wait_list */,
+ const cl_event * /* event_wait_list */,
+ cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueCopyImageToBuffer(cl_command_queue /* command_queue */,
+ cl_mem /* src_image */,
+ cl_mem /* dst_buffer */,
+ const size_t * /* src_origin[3] */,
+ const size_t * /* region[3] */,
+ size_t /* dst_offset */,
+ cl_uint /* num_events_in_wait_list */,
+ const cl_event * /* event_wait_list */,
+ cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueCopyBufferToImage(cl_command_queue /* command_queue */,
+ cl_mem /* src_buffer */,
+ cl_mem /* dst_image */,
+ size_t /* src_offset */,
+ const size_t * /* dst_origin[3] */,
+ const size_t * /* region[3] */,
+ cl_uint /* num_events_in_wait_list */,
+ const cl_event * /* event_wait_list */,
+ cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY void * CL_API_CALL
+clEnqueueMapBuffer(cl_command_queue /* command_queue */,
+ cl_mem /* buffer */,
+ cl_bool /* blocking_map */,
+ cl_map_flags /* map_flags */,
+ size_t /* offset */,
+ size_t /* cb */,
+ cl_uint /* num_events_in_wait_list */,
+ const cl_event * /* event_wait_list */,
+ cl_event * /* event */,
+ cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY void * CL_API_CALL
+clEnqueueMapImage(cl_command_queue /* command_queue */,
+ cl_mem /* image */,
+ cl_bool /* blocking_map */,
+ cl_map_flags /* map_flags */,
+ const size_t * /* origin[3] */,
+ const size_t * /* region[3] */,
+ size_t * /* image_row_pitch */,
+ size_t * /* image_slice_pitch */,
+ cl_uint /* num_events_in_wait_list */,
+ const cl_event * /* event_wait_list */,
+ cl_event * /* event */,
+ cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueUnmapMemObject(cl_command_queue /* command_queue */,
+ cl_mem /* memobj */,
+ void * /* mapped_ptr */,
+ cl_uint /* num_events_in_wait_list */,
+ const cl_event * /* event_wait_list */,
+ cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueNDRangeKernel(cl_command_queue /* command_queue */,
+ cl_kernel /* kernel */,
+ cl_uint /* work_dim */,
+ const size_t * /* global_work_offset */,
+ const size_t * /* global_work_size */,
+ const size_t * /* local_work_size */,
+ cl_uint /* num_events_in_wait_list */,
+ const cl_event * /* event_wait_list */,
+ cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueTask(cl_command_queue /* command_queue */,
+ cl_kernel /* kernel */,
+ cl_uint /* num_events_in_wait_list */,
+ const cl_event * /* event_wait_list */,
+ cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueNativeKernel(cl_command_queue /* command_queue */,
+ void (*user_func)(void *),
+ void * /* args */,
+ size_t /* cb_args */,
+ cl_uint /* num_mem_objects */,
+ const cl_mem * /* mem_list */,
+ const void ** /* args_mem_loc */,
+ cl_uint /* num_events_in_wait_list */,
+ const cl_event * /* event_wait_list */,
+ cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueMarker(cl_command_queue /* command_queue */,
+ cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueWaitForEvents(cl_command_queue /* command_queue */,
+ cl_uint /* num_events */,
+ const cl_event * /* event_list */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueBarrier(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
+
+/* Extension function access
+ *
+ * Returns the extension function address for the given function name,
+ * or NULL if a valid function can not be found. The client must
+ * check to make sure the address is not NULL, before using or
+ * calling the returned function address.
+ */
+extern CL_API_ENTRY void * CL_API_CALL clGetExtensionFunctionAddress(const char * /* func_name */) CL_API_SUFFIX__VERSION_1_0;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OPENCL_CL_H */
+
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2008-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.
+ ******************************************************************************/
+
+/*! \file
+ *
+ * \brief C++ bindings for OpenCL 1.0 (rev 48) and OpenCL 1.1 (rev 33)
+ * \author Benedict R. Gaster and Laurent Morichetti
+ *
+ * Additions and fixes from Brian Cole, March 3rd 2010.
+ *
+ * \version 1.1
+ * \date June 2010
+ *
+ * Optional extension support
+ *
+ * cl
+ * cl_ext_device_fission
+ * #define USE_CL_DEVICE_FISSION
+ */
+
+/*! \mainpage
+ * \section intro Introduction
+ * For many large applications C++ is the language of choice and so it seems
+ * reasonable to define C++ bindings for OpenCL.
+ *
+ *
+ * The interface is contained with a single C++ header file \em cl.hpp and all
+ * definitions are contained within the namespace \em cl. There is no additional
+ * requirement to include \em cl.h and to use either the C++ or original C
+ * bindings it is enough to simply include \em cl.hpp.
+ *
+ * The bindings themselves are lightweight and correspond closely to the
+ * underlying C API. Using the C++ bindings introduces no additional execution
+ * overhead.
+ *
+ * For detail documentation on the bindings see:
+ *
+ * The OpenCL C++ Wrapper API 1.1 (revision 04)
+ * http://www.khronos.org/registry/cl/specs/opencl-cplusplus-1.1.pdf
+ *
+ * \section example Example
+ *
+ * The following example shows a general use case for the C++
+ * bindings, including support for the optional exception feature and
+ * also the supplied vector and string classes, see following sections for
+ * decriptions of these features.
+ *
+ * \code
+ * #define __CL_ENABLE_EXCEPTIONS
+ *
+ * #if defined(__APPLE__) || defined(__MACOSX)
+ * #include <OpenCL/cl.hpp>
+ * #else
+ * #include <CL/cl.hpp>
+ * #endif
+ * #include <cstdio>
+ * #include <cstdlib>
+ * #include <iostream>
+ *
+ * const char * helloStr = "__kernel void "
+ * "hello(void) "
+ * "{ "
+ * " "
+ * "} ";
+ *
+ * int
+ * main(void)
+ * {
+ * cl_int err = CL_SUCCESS;
+ * try {
+ *
+ * std::vector<cl::Platform> platforms;
+ * cl::Platform::get(&platforms);
+ * if (platforms.size() == 0) {
+ * std::cout << "Platform size 0\n";
+ * return -1;
+ * }
+ *
+ * cl_context_properties properties[] =
+ * { CL_CONTEXT_PLATFORM, (cl_context_properties)(platforms[0])(), 0};
+ * cl::Context context(CL_DEVICE_TYPE_CPU, properties);
+ *
+ * std::vector<cl::Device> devices = context.getInfo<CL_CONTEXT_DEVICES>();
+ *
+ * cl::Program::Sources source(1,
+ * std::make_pair(helloStr,strlen(helloStr)));
+ * cl::Program program_ = cl::Program(context, source);
+ * program_.build(devices);
+ *
+ * cl::Kernel kernel(program_, "hello", &err);
+ *
+ * cl::Event event;
+ * cl::CommandQueue queue(context, devices[0], 0, &err);
+ * queue.enqueueNDRangeKernel(
+ * kernel,
+ * cl::NullRange,
+ * cl::NDRange(4,4),
+ * cl::NullRange,
+ * NULL,
+ * &event);
+ *
+ * event.wait();
+ * }
+ * catch (cl::Error err) {
+ * std::cerr
+ * << "ERROR: "
+ * << err.what()
+ * << "("
+ * << err.err()
+ * << ")"
+ * << std::endl;
+ * }
+ *
+ * return EXIT_SUCCESS;
+ * }
+ *
+ * \endcode
+ *
+ */
+#ifndef CL_HPP_
+#define CL_HPP_
+
+#ifdef _WIN32
+#include <windows.h>
+#include <malloc.h>
+#if defined(USE_DX_INTEROP)
+#include <CL/cl_d3d10.h>
+#endif
+#endif // _WIN32
+
+//
+#if defined(USE_CL_DEVICE_FISSION)
+#include <CL/cl_ext.h>
+#endif
+
+#if defined(__APPLE__) || defined(__MACOSX)
+#include <OpenGL/OpenGL.h>
+#include <OpenCL/opencl.h>
+#else
+#include <GL/gl.h>
+#include <CL/opencl.h>
+#endif // !__APPLE__
+
+#if !defined(CL_CALLBACK)
+#define CL_CALLBACK
+#endif //CL_CALLBACK
+
+#include <utility>
+
+#if !defined(__NO_STD_VECTOR)
+#include <vector>
+#endif
+
+#if !defined(__NO_STD_STRING)
+#include <string>
+#endif
+
+#if defined(linux) || defined(__APPLE__) || defined(__MACOSX)
+# include <alloca.h>
+#endif // linux
+
+#include <cstring>
+
+/*! \namespace cl
+ *
+ * \brief The OpenCL C++ bindings are defined within this namespace.
+ *
+ */
+namespace cl {
+
+#define __INIT_CL_EXT_FCN_PTR(name) \
+ if(!pfn_##name) { \
+ pfn_##name = (PFN_##name) \
+ clGetExtensionFunctionAddress(#name); \
+ if(!pfn_##name) { \
+ } \
+ }
+
+class Program;
+class Device;
+class Context;
+class CommandQueue;
+class Memory;
+
+#if defined(__CL_ENABLE_EXCEPTIONS)
+#include <exception>
+/*! \class Error
+ * \brief Exception class
+ */
+class Error : public std::exception
+{
+private:
+ cl_int err_;
+ const char * errStr_;
+public:
+ /*! Create a new CL error exception for a given error code
+ * and corresponding message.
+ */
+ Error(cl_int err, const char * errStr = NULL) : err_(err), errStr_(errStr)
+ {}
+
+ ~Error() throw() {}
+
+ /*! \brief Get error string associated with exception
+ *
+ * \return A memory pointer to the error message string.
+ */
+ virtual const char * what() const throw ()
+ {
+ if (errStr_ == NULL) {
+ return "empty";
+ }
+ else {
+ return errStr_;
+ }
+ }
+
+ /*! \brief Get error code associated with exception
+ *
+ * \return The error code.
+ */
+ const cl_int err(void) const { return err_; }
+};
+
+#define __ERR_STR(x) #x
+#else
+#define __ERR_STR(x) NULL
+#endif // __CL_ENABLE_EXCEPTIONS
+
+//! \cond DOXYGEN_DETAIL
+#if !defined(__CL_USER_OVERRIDE_ERROR_STRINGS)
+#define __GET_DEVICE_INFO_ERR __ERR_STR(clgetDeviceInfo)
+#define __GET_PLATFORM_INFO_ERR __ERR_STR(clGetPlatformInfo)
+#define __GET_DEVICE_IDS_ERR __ERR_STR(clGetDeviceIDs)
+#define __GET_PLATFORM_IDS_ERR __ERR_STR(clGetPlatformIDs)
+#define __GET_CONTEXT_INFO_ERR __ERR_STR(clGetContextInfo)
+#define __GET_EVENT_INFO_ERR __ERR_STR(clGetEventInfo)
+#define __GET_EVENT_PROFILE_INFO_ERR __ERR_STR(clGetEventProfileInfo)
+#define __GET_MEM_OBJECT_INFO_ERR __ERR_STR(clGetMemObjectInfo)
+#define __GET_IMAGE_INFO_ERR __ERR_STR(clGetImageInfo)
+#define __GET_SAMPLER_INFO_ERR __ERR_STR(clGetSamplerInfo)
+#define __GET_KERNEL_INFO_ERR __ERR_STR(clGetKernelInfo)
+#define __GET_KERNEL_WORK_GROUP_INFO_ERR __ERR_STR(clGetKernelWorkGroupInfo)
+#define __GET_PROGRAM_INFO_ERR __ERR_STR(clGetProgramInfo)
+#define __GET_PROGRAM_BUILD_INFO_ERR __ERR_STR(clGetProgramBuildInfo)
+#define __GET_COMMAND_QUEUE_INFO_ERR __ERR_STR(clGetCommandQueueInfo)
+
+#define __CREATE_CONTEXT_FROM_TYPE_ERR __ERR_STR(clCreateContextFromType)
+#define __GET_SUPPORTED_IMAGE_FORMATS_ERR __ERR_STR(clGetSupportedImageFormats)
+
+#define __CREATE_BUFFER_ERR __ERR_STR(clCreateBuffer)
+#define __CREATE_SUBBUFFER_ERR __ERR_STR(clCreateSubBuffer)
+#define __CREATE_GL_BUFFER_ERR __ERR_STR(clCreateFromGLBuffer)
+#define __GET_GL_OBJECT_INFO_ERR __ERR_STR(clGetGLObjectInfo)
+#define __CREATE_IMAGE2D_ERR __ERR_STR(clCreateImage2D)
+#define __CREATE_IMAGE3D_ERR __ERR_STR(clCreateImage3D)
+#define __CREATE_SAMPLER_ERR __ERR_STR(clCreateSampler)
+#define __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR __ERR_STR(clSetMemObjectDestructorCallback)
+
+#define __CREATE_USER_EVENT_ERR __ERR_STR(clCreateUserEvent)
+#define __SET_USER_EVENT_STATUS_ERR __ERR_STR(clSetUserEventStatus)
+#define __SET_EVENT_CALLBACK_ERR __ERR_STR(clSetEventCallback)
+#define __WAIT_FOR_EVENTS_ERR __ERR_STR(clWaitForEvents)
+
+#define __CREATE_KERNEL_ERR __ERR_STR(clCreateKernel)
+#define __SET_KERNEL_ARGS_ERR __ERR_STR(clSetKernelArg)
+#define __CREATE_PROGRAM_WITH_SOURCE_ERR __ERR_STR(clCreateProgramWithSource)
+#define __CREATE_PROGRAM_WITH_BINARY_ERR __ERR_STR(clCreateProgramWithBinary)
+#define __BUILD_PROGRAM_ERR __ERR_STR(clBuildProgram)
+#define __CREATE_KERNELS_IN_PROGRAM_ERR __ERR_STR(clCreateKernelsInProgram)
+
+#define __CREATE_COMMAND_QUEUE_ERR __ERR_STR(clCreateCommandQueue)
+#define __SET_COMMAND_QUEUE_PROPERTY_ERR __ERR_STR(clSetCommandQueueProperty)
+#define __ENQUEUE_READ_BUFFER_ERR __ERR_STR(clEnqueueReadBuffer)
+#define __ENQUEUE_READ_BUFFER_RECT_ERR __ERR_STR(clEnqueueReadBufferRect)
+#define __ENQUEUE_WRITE_BUFFER_ERR __ERR_STR(clEnqueueWriteBuffer)
+#define __ENQUEUE_WRITE_BUFFER_RECT_ERR __ERR_STR(clEnqueueWriteBufferRect)
+#define __ENQEUE_COPY_BUFFER_ERR __ERR_STR(clEnqueueCopyBuffer)
+#define __ENQEUE_COPY_BUFFER_RECT_ERR __ERR_STR(clEnqueueCopyBufferRect)
+#define __ENQUEUE_READ_IMAGE_ERR __ERR_STR(clEnqueueReadImage)
+#define __ENQUEUE_WRITE_IMAGE_ERR __ERR_STR(clEnqueueWriteImage)
+#define __ENQUEUE_COPY_IMAGE_ERR __ERR_STR(clEnqueueCopyImage)
+#define __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR __ERR_STR(clEnqueueCopyImageToBuffer)
+#define __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR __ERR_STR(clEnqueueCopyBufferToImage)
+#define __ENQUEUE_MAP_BUFFER_ERR __ERR_STR(clEnqueueMapBuffer)
+#define __ENQUEUE_MAP_IMAGE_ERR __ERR_STR(clEnqueueMapImage)
+#define __ENQUEUE_UNMAP_MEM_OBJECT_ERR __ERR_STR(clEnqueueUnMapMemObject)
+#define __ENQUEUE_NDRANGE_KERNEL_ERR __ERR_STR(clEnqueueNDRangeKernel)
+#define __ENQUEUE_TASK_ERR __ERR_STR(clEnqueueTask)
+#define __ENQUEUE_NATIVE_KERNEL __ERR_STR(clEnqueueNativeKernel)
+#define __ENQUEUE_MARKER_ERR __ERR_STR(clEnqueueMarker)
+#define __ENQUEUE_WAIT_FOR_EVENTS_ERR __ERR_STR(clEnqueueWaitForEvents)
+#define __ENQUEUE_BARRIER_ERR __ERR_STR(clEnqueueBarrier)
+
+#define __ENQUEUE_ACQUIRE_GL_ERR __ERR_STR(clEnqueueAcquireGLObjects)
+#define __ENQUEUE_RELEASE_GL_ERR __ERR_STR(clEnqueueReleaseGLObjects)
+
+#define __UNLOAD_COMPILER_ERR __ERR_STR(clUnloadCompiler)
+
+#define __FLUSH_ERR __ERR_STR(clFlush)
+#define __FINISH_ERR __ERR_STR(clFinish)
+
+#define __CREATE_SUB_DEVICES __ERR_STR(clCreateSubDevicesEXT)
+#endif // __CL_USER_OVERRIDE_ERROR_STRINGS
+//! \endcond
+
+/*! \class string
+ * \brief Simple string class, that provides a limited subset of std::string
+ * functionality but avoids many of the issues that come with that class.
+ */
+class string
+{
+private:
+ ::size_t size_;
+ char * str_;
+public:
+ string(void) : size_(0), str_(NULL)
+ {
+ }
+
+ string(char * str, ::size_t size) :
+ size_(size),
+ str_(NULL)
+ {
+ str_ = new char[size_+1];
+ if (str_ != NULL) {
+ memcpy(str_, str, size_ * sizeof(char));
+ str_[size_] = '\0';
+ }
+ else {
+ size_ = 0;
+ }
+ }
+
+ string(char * str) :
+ str_(NULL)
+ {
+ size_= ::strlen(str);
+ str_ = new char[size_ + 1];
+ if (str_ != NULL) {
+ memcpy(str_, str, (size_ + 1) * sizeof(char));
+ }
+ else {
+ size_ = 0;
+ }
+ }
+
+ string& operator=(const string& rhs)
+ {
+ if (this == &rhs) {
+ return *this;
+ }
+
+ if (rhs.size_ == 0 || rhs.str_ == NULL) {
+ size_ = 0;
+ str_ = NULL;
+ }
+ else {
+ size_ = rhs.size_;
+ str_ = new char[size_ + 1];
+ if (str_ != NULL) {
+ memcpy(str_, rhs.str_, (size_ + 1) * sizeof(char));
+ }
+ else {
+ size_ = 0;
+ }
+ }
+
+ return *this;
+ }
+
+ string(const string& rhs)
+ {
+ *this = rhs;
+ }
+
+ ~string()
+ {
+ if (str_ != NULL) {
+ delete[] str_;
+ }
+ }
+
+ ::size_t size(void) const { return size_; }
+ ::size_t length(void) const { return size(); }
+
+ const char * c_str(void) const { return (str_) ? str_ : "";}
+};
+
+#if !defined(__USE_DEV_STRING) && !defined(__NO_STD_STRING)
+#include <string>
+typedef std::string STRING_CLASS;
+#elif !defined(__USE_DEV_STRING)
+typedef cl::string STRING_CLASS;
+#endif
+
+#if !defined(__USE_DEV_VECTOR) && !defined(__NO_STD_VECTOR)
+#include <vector>
+#define VECTOR_CLASS std::vector
+#elif !defined(__USE_DEV_VECTOR)
+#define VECTOR_CLASS cl::vector
+#endif
+
+#if !defined(__MAX_DEFAULT_VECTOR_SIZE)
+#define __MAX_DEFAULT_VECTOR_SIZE 10
+#endif
+
+/*! \class vector
+ * \brief Fixed sized vector implementation that mirroring
+ * std::vector functionality.
+ */
+template <typename T, unsigned int N = __MAX_DEFAULT_VECTOR_SIZE>
+class vector
+{
+private:
+ T data_[N];
+ unsigned int size_;
+ bool empty_;
+public:
+ vector() :
+ size_(-1),
+ empty_(true)
+ {}
+
+ ~vector() {}
+
+ unsigned int size(void) const
+ {
+ return size_ + 1;
+ }
+
+ void clear()
+ {
+ size_ = -1;
+ empty_ = true;
+ }
+
+ void push_back (const T& x)
+ {
+ if (size() < N) {
+ size_++;
+ data_[size_] = x;
+ empty_ = false;
+ }
+ }
+
+ void pop_back(void)
+ {
+ if (!empty_) {
+ data_[size_].~T();
+ size_--;
+ if (size_ == -1) {
+ empty_ = true;
+ }
+ }
+ }
+
+ vector(const vector<T, N>& vec) :
+ size_(vec.size_),
+ empty_(vec.empty_)
+ {
+ if (!empty_) {
+ memcpy(&data_[0], &vec.data_[0], size() * sizeof(T));
+ }
+ }
+
+ vector(unsigned int size, const T& val = T()) :
+ size_(-1),
+ empty_(true)
+ {
+ for (unsigned int i = 0; i < size; i++) {
+ push_back(val);
+ }
+ }
+
+ vector<T, N>& operator=(const vector<T, N>& rhs)
+ {
+ if (this == &rhs) {
+ return *this;
+ }
+
+ size_ = rhs.size_;
+ empty_ = rhs.empty_;
+
+ if (!empty_) {
+ memcpy(&data_[0], &rhs.data_[0], size() * sizeof(T));
+ }
+
+ return *this;
+ }
+
+ bool operator==(vector<T,N> &vec)
+ {
+ if (empty_ && vec.empty_) {
+ return true;
+ }
+
+ if (size() != vec.size()) {
+ return false;
+ }
+
+ return memcmp(&data_[0], &vec.data_[0], size() * sizeof(T)) == 0 ? true : false;
+ }
+
+ operator T* () { return data_; }
+ operator const T* () const { return data_; }
+
+ bool empty (void) const
+ {
+ return empty_;
+ }
+
+ unsigned int max_size (void) const
+ {
+ return N;
+ }
+
+ unsigned int capacity () const
+ {
+ return sizeof(T) * N;
+ }
+
+ T& operator[](int index)
+ {
+ return data_[index];
+ }
+
+ T operator[](int index) const
+ {
+ return data_[index];
+ }
+
+ template<class I>
+ void assign(I start, I end)
+ {
+ clear();
+ while(start < end) {
+ push_back(*start);
+ start++;
+ }
+ }
+
+ /*! \class iterator
+ * \brief Iterator class for vectors
+ */
+ class iterator
+ {
+ private:
+ vector<T,N> vec_;
+ int index_;
+ bool initialized_;
+ public:
+ iterator(void) :
+ index_(-1),
+ initialized_(false)
+ {
+ index_ = -1;
+ initialized_ = false;
+ }
+
+ ~iterator(void) {}
+
+ static iterator begin(vector<T,N> &vec)
+ {
+ iterator i;
+
+ if (!vec.empty()) {
+ i.index_ = 0;
+ }
+
+ i.vec_ = vec;
+ i.initialized_ = true;
+ return i;
+ }
+
+ static iterator end(vector<T,N> &vec)
+ {
+ iterator i;
+
+ if (!vec.empty()) {
+ i.index_ = vec.size();
+ }
+ i.vec_ = vec;
+ i.initialized_ = true;
+ return i;
+ }
+
+ bool operator==(iterator i)
+ {
+ return ((vec_ == i.vec_) &&
+ (index_ == i.index_) &&
+ (initialized_ == i.initialized_));
+ }
+
+ bool operator!=(iterator i)
+ {
+ return (!(*this==i));
+ }
+
+ void operator++()
+ {
+ index_++;
+ }
+
+ void operator++(int x)
+ {
+ index_ += x;
+ }
+
+ void operator--()
+ {
+ index_--;
+ }
+
+ void operator--(int x)
+ {
+ index_ -= x;
+ }
+
+ T operator *()
+ {
+ return vec_[index_];
+ }
+ };
+
+ iterator begin(void)
+ {
+ return iterator::begin(*this);
+ }
+
+ iterator end(void)
+ {
+ return iterator::end(*this);
+ }
+
+ T& front(void)
+ {
+ return data_[0];
+ }
+
+ T& back(void)
+ {
+ return data_[size_];
+ }
+
+ const T& front(void) const
+ {
+ return data_[0];
+ }
+
+ const T& back(void) const
+ {
+ return data_[size_];
+ }
+};
+
+/*!
+ * \brief size_t class used to interface between C++ and
+ * OpenCL C calls that require arrays of size_t values, who's
+ * size is known statically.
+ */
+template <int N>
+struct size_t : public cl::vector< ::size_t, N> { };
+
+namespace detail {
+
+// GetInfo help struct
+template <typename Functor, typename T>
+struct GetInfoHelper
+{
+ static cl_int
+ get(Functor f, cl_uint name, T* param)
+ {
+ return f(name, sizeof(T), param, NULL);
+ }
+};
+
+// Specialized GetInfoHelper for VECTOR_CLASS params
+template <typename Func, typename T>
+struct GetInfoHelper<Func, VECTOR_CLASS<T> >
+{
+ static cl_int get(Func f, cl_uint name, VECTOR_CLASS<T>* param)
+ {
+ ::size_t required;
+ cl_int err = f(name, 0, NULL, &required);
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+
+ T* value = (T*) alloca(required);
+ err = f(name, required, value, NULL);
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+
+ param->assign(&value[0], &value[required/sizeof(T)]);
+ return CL_SUCCESS;
+ }
+};
+
+// Specialized for getInfo<CL_PROGRAM_BINARIES>
+template <typename Func>
+struct GetInfoHelper<Func, VECTOR_CLASS<char *> >
+{
+ static cl_int
+ get(Func f, cl_uint name, VECTOR_CLASS<char *>* param)
+ {
+ cl_uint err = f(name, param->size() * sizeof(char *), &(*param)[0], NULL);
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+
+ return CL_SUCCESS;
+ }
+};
+
+// Specialized GetInfoHelper for STRING_CLASS params
+template <typename Func>
+struct GetInfoHelper<Func, STRING_CLASS>
+{
+ static cl_int get(Func f, cl_uint name, STRING_CLASS* param)
+ {
+ ::size_t required;
+ cl_int err = f(name, 0, NULL, &required);
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+
+ char* value = (char*) alloca(required);
+ err = f(name, required, value, NULL);
+ if (err != CL_SUCCESS) {
+ return err;
+ }
+
+ *param = value;
+ return CL_SUCCESS;
+ }
+};
+
+#define __GET_INFO_HELPER_WITH_RETAIN(CPP_TYPE) \
+namespace detail { \
+template <typename Func> \
+struct GetInfoHelper<Func, CPP_TYPE> \
+{ \
+ static cl_int get(Func f, cl_uint name, CPP_TYPE* param) \
+ { \
+ cl_uint err = f(name, sizeof(CPP_TYPE), param, NULL); \
+ if (err != CL_SUCCESS) { \
+ return err; \
+ } \
+ \
+ return ReferenceHandler<CPP_TYPE::cl_type>::retain((*param)()); \
+ } \
+}; \
+}
+
+
+#define __PARAM_NAME_INFO_1_0(F) \
+ F(cl_platform_info, CL_PLATFORM_PROFILE, STRING_CLASS) \
+ F(cl_platform_info, CL_PLATFORM_VERSION, STRING_CLASS) \
+ F(cl_platform_info, CL_PLATFORM_NAME, STRING_CLASS) \
+ F(cl_platform_info, CL_PLATFORM_VENDOR, STRING_CLASS) \
+ F(cl_platform_info, CL_PLATFORM_EXTENSIONS, STRING_CLASS) \
+ \
+ F(cl_device_info, CL_DEVICE_TYPE, cl_device_type) \
+ F(cl_device_info, CL_DEVICE_VENDOR_ID, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MAX_COMPUTE_UNITS, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MAX_WORK_GROUP_SIZE, ::size_t) \
+ F(cl_device_info, CL_DEVICE_MAX_WORK_ITEM_SIZES, VECTOR_CLASS< ::size_t>) \
+ F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR, cl_uint) \
+ F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT, cl_uint) \
+ F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT, cl_uint) \
+ F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG, cl_uint) \
+ F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT, cl_uint) \
+ F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MAX_CLOCK_FREQUENCY, cl_uint) \
+ F(cl_device_info, CL_DEVICE_ADDRESS_BITS, cl_bitfield) \
+ F(cl_device_info, CL_DEVICE_MAX_READ_IMAGE_ARGS, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MAX_WRITE_IMAGE_ARGS, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MAX_MEM_ALLOC_SIZE, cl_ulong) \
+ F(cl_device_info, CL_DEVICE_IMAGE2D_MAX_WIDTH, ::size_t) \
+ F(cl_device_info, CL_DEVICE_IMAGE2D_MAX_HEIGHT, ::size_t) \
+ F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_WIDTH, ::size_t) \
+ F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_HEIGHT, ::size_t) \
+ F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_DEPTH, ::size_t) \
+ F(cl_device_info, CL_DEVICE_IMAGE_SUPPORT, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MAX_PARAMETER_SIZE, ::size_t) \
+ F(cl_device_info, CL_DEVICE_MAX_SAMPLERS, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MEM_BASE_ADDR_ALIGN, cl_uint) \
+ F(cl_device_info, CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE, cl_uint) \
+ F(cl_device_info, CL_DEVICE_SINGLE_FP_CONFIG, cl_device_fp_config) \
+ F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHE_TYPE, cl_device_mem_cache_type) \
+ F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE, cl_uint)\
+ F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHE_SIZE, cl_ulong) \
+ F(cl_device_info, CL_DEVICE_GLOBAL_MEM_SIZE, cl_ulong) \
+ F(cl_device_info, CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, cl_ulong) \
+ F(cl_device_info, CL_DEVICE_MAX_CONSTANT_ARGS, cl_uint) \
+ F(cl_device_info, CL_DEVICE_LOCAL_MEM_TYPE, cl_device_local_mem_type) \
+ F(cl_device_info, CL_DEVICE_LOCAL_MEM_SIZE, cl_ulong) \
+ F(cl_device_info, CL_DEVICE_ERROR_CORRECTION_SUPPORT, cl_bool) \
+ F(cl_device_info, CL_DEVICE_PROFILING_TIMER_RESOLUTION, ::size_t) \
+ F(cl_device_info, CL_DEVICE_ENDIAN_LITTLE, cl_bool) \
+ F(cl_device_info, CL_DEVICE_AVAILABLE, cl_bool) \
+ F(cl_device_info, CL_DEVICE_COMPILER_AVAILABLE, cl_bool) \
+ F(cl_device_info, CL_DEVICE_EXECUTION_CAPABILITIES, cl_device_exec_capabilities) \
+ F(cl_device_info, CL_DEVICE_QUEUE_PROPERTIES, cl_command_queue_properties) \
+ F(cl_device_info, CL_DEVICE_PLATFORM, cl_platform_id) \
+ F(cl_device_info, CL_DEVICE_NAME, STRING_CLASS) \
+ F(cl_device_info, CL_DEVICE_VENDOR, STRING_CLASS) \
+ F(cl_device_info, CL_DRIVER_VERSION, STRING_CLASS) \
+ F(cl_device_info, CL_DEVICE_PROFILE, STRING_CLASS) \
+ F(cl_device_info, CL_DEVICE_VERSION, STRING_CLASS) \
+ F(cl_device_info, CL_DEVICE_EXTENSIONS, STRING_CLASS) \
+ \
+ F(cl_context_info, CL_CONTEXT_REFERENCE_COUNT, cl_uint) \
+ F(cl_context_info, CL_CONTEXT_DEVICES, VECTOR_CLASS<Device>) \
+ F(cl_context_info, CL_CONTEXT_PROPERTIES, VECTOR_CLASS<cl_context_properties>) \
+ \
+ F(cl_event_info, CL_EVENT_COMMAND_QUEUE, cl::CommandQueue) \
+ F(cl_event_info, CL_EVENT_COMMAND_TYPE, cl_command_type) \
+ F(cl_event_info, CL_EVENT_REFERENCE_COUNT, cl_uint) \
+ F(cl_event_info, CL_EVENT_COMMAND_EXECUTION_STATUS, cl_uint) \
+ \
+ F(cl_profiling_info, CL_PROFILING_COMMAND_QUEUED, cl_ulong) \
+ F(cl_profiling_info, CL_PROFILING_COMMAND_SUBMIT, cl_ulong) \
+ F(cl_profiling_info, CL_PROFILING_COMMAND_START, cl_ulong) \
+ F(cl_profiling_info, CL_PROFILING_COMMAND_END, cl_ulong) \
+ \
+ F(cl_mem_info, CL_MEM_TYPE, cl_mem_object_type) \
+ F(cl_mem_info, CL_MEM_FLAGS, cl_mem_flags) \
+ F(cl_mem_info, CL_MEM_SIZE, ::size_t) \
+ F(cl_mem_info, CL_MEM_HOST_PTR, void*) \
+ F(cl_mem_info, CL_MEM_MAP_COUNT, cl_uint) \
+ F(cl_mem_info, CL_MEM_REFERENCE_COUNT, cl_uint) \
+ F(cl_mem_info, CL_MEM_CONTEXT, cl::Context) \
+ \
+ F(cl_image_info, CL_IMAGE_FORMAT, cl_image_format) \
+ F(cl_image_info, CL_IMAGE_ELEMENT_SIZE, ::size_t) \
+ F(cl_image_info, CL_IMAGE_ROW_PITCH, ::size_t) \
+ F(cl_image_info, CL_IMAGE_SLICE_PITCH, ::size_t) \
+ F(cl_image_info, CL_IMAGE_WIDTH, ::size_t) \
+ F(cl_image_info, CL_IMAGE_HEIGHT, ::size_t) \
+ F(cl_image_info, CL_IMAGE_DEPTH, ::size_t) \
+ \
+ F(cl_sampler_info, CL_SAMPLER_REFERENCE_COUNT, cl_uint) \
+ F(cl_sampler_info, CL_SAMPLER_CONTEXT, cl::Context) \
+ F(cl_sampler_info, CL_SAMPLER_NORMALIZED_COORDS, cl_addressing_mode) \
+ F(cl_sampler_info, CL_SAMPLER_ADDRESSING_MODE, cl_filter_mode) \
+ F(cl_sampler_info, CL_SAMPLER_FILTER_MODE, cl_bool) \
+ \
+ F(cl_program_info, CL_PROGRAM_REFERENCE_COUNT, cl_uint) \
+ F(cl_program_info, CL_PROGRAM_CONTEXT, cl::Context) \
+ F(cl_program_info, CL_PROGRAM_NUM_DEVICES, cl_uint) \
+ F(cl_program_info, CL_PROGRAM_DEVICES, VECTOR_CLASS<cl_device_id>) \
+ F(cl_program_info, CL_PROGRAM_SOURCE, STRING_CLASS) \
+ F(cl_program_info, CL_PROGRAM_BINARY_SIZES, VECTOR_CLASS< ::size_t>) \
+ F(cl_program_info, CL_PROGRAM_BINARIES, VECTOR_CLASS<char *>) \
+ \
+ F(cl_program_build_info, CL_PROGRAM_BUILD_STATUS, cl_build_status) \
+ F(cl_program_build_info, CL_PROGRAM_BUILD_OPTIONS, STRING_CLASS) \
+ F(cl_program_build_info, CL_PROGRAM_BUILD_LOG, STRING_CLASS) \
+ \
+ F(cl_kernel_info, CL_KERNEL_FUNCTION_NAME, STRING_CLASS) \
+ F(cl_kernel_info, CL_KERNEL_NUM_ARGS, cl_uint) \
+ F(cl_kernel_info, CL_KERNEL_REFERENCE_COUNT, cl_uint) \
+ F(cl_kernel_info, CL_KERNEL_CONTEXT, cl::Context) \
+ F(cl_kernel_info, CL_KERNEL_PROGRAM, cl::Program) \
+ \
+ F(cl_kernel_work_group_info, CL_KERNEL_WORK_GROUP_SIZE, ::size_t) \
+ F(cl_kernel_work_group_info, CL_KERNEL_COMPILE_WORK_GROUP_SIZE, cl::size_t<3>) \
+ F(cl_kernel_work_group_info, CL_KERNEL_LOCAL_MEM_SIZE, cl_ulong) \
+ \
+ F(cl_command_queue_info, CL_QUEUE_CONTEXT, cl::Context) \
+ F(cl_command_queue_info, CL_QUEUE_DEVICE, cl::Device) \
+ F(cl_command_queue_info, CL_QUEUE_REFERENCE_COUNT, cl_uint) \
+ F(cl_command_queue_info, CL_QUEUE_PROPERTIES, cl_command_queue_properties)
+
+#if defined(CL_VERSION_1_1)
+#define __PARAM_NAME_INFO_1_1(F) \
+ F(cl_context_info, CL_CONTEXT_NUM_DEVICES, cl_uint)\
+ F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF, cl_uint) \
+ F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR, cl_uint) \
+ F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT, cl_uint) \
+ F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT, cl_uint) \
+ F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG, cl_uint) \
+ F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT, cl_uint) \
+ F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE, cl_uint) \
+ F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF, cl_uint) \
+ F(cl_device_info, CL_DEVICE_DOUBLE_FP_CONFIG, cl_device_fp_config) \
+ F(cl_device_info, CL_DEVICE_HALF_FP_CONFIG, cl_device_fp_config) \
+ F(cl_device_info, CL_DEVICE_HOST_UNIFIED_MEMORY, cl_bool) \
+ \
+ F(cl_mem_info, CL_MEM_ASSOCIATED_MEMOBJECT, cl::Memory) \
+ F(cl_mem_info, CL_MEM_OFFSET, ::size_t) \
+ \
+ F(cl_kernel_work_group_info, CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE, ::size_t) \
+ F(cl_kernel_work_group_info, CL_KERNEL_PRIVATE_MEM_SIZE, cl_ulong) \
+ \
+ F(cl_event_info, CL_EVENT_CONTEXT, cl::Context)
+#endif // CL_VERSION_1_1
+
+#if defined(USE_CL_DEVICE_FISSION)
+#define __PARAM_NAME_DEVICE_FISSION(F) \
+ F(cl_device_info, CL_DEVICE_PARENT_DEVICE_EXT, cl_device_id) \
+ F(cl_device_info, CL_DEVICE_PARTITION_TYPES_EXT, VECTOR_CLASS<cl_device_partition_property_ext>) \
+ F(cl_device_info, CL_DEVICE_AFFINITY_DOMAINS_EXT, VECTOR_CLASS<cl_device_partition_property_ext>) \
+ F(cl_device_info, CL_DEVICE_REFERENCE_COUNT_EXT , cl_uint) \
+ F(cl_device_info, CL_DEVICE_PARTITION_STYLE_EXT, VECTOR_CLASS<cl_device_partition_property_ext>)
+#endif // USE_CL_DEVICE_FISSION
+
+template <typename enum_type, cl_int Name>
+struct param_traits {};
+
+#define __DECLARE_PARAM_TRAITS(token, param_name, T) \
+struct token; \
+template<> \
+struct param_traits<detail:: token,param_name> \
+{ \
+ enum { value = param_name }; \
+ typedef T param_type; \
+};
+
+__PARAM_NAME_INFO_1_0(__DECLARE_PARAM_TRAITS);
+#if defined(CL_VERSION_1_1)
+__PARAM_NAME_INFO_1_1(__DECLARE_PARAM_TRAITS);
+#endif // CL_VERSION_1_1
+
+#if defined(USE_CL_DEVICE_FISSION)
+__PARAM_NAME_DEVICE_FISSION(__DECLARE_PARAM_TRAITS);
+#endif // USE_CL_DEVICE_FISSION
+
+#undef __DECLARE_PARAM_TRAITS
+
+// Convenience functions
+
+template <typename Func, typename T>
+inline cl_int
+getInfo(Func f, cl_uint name, T* param)
+{
+ return GetInfoHelper<Func, T>::get(f, name, param);
+}
+
+template <typename Func, typename Arg0>
+struct GetInfoFunctor0
+{
+ Func f_; const Arg0& arg0_;
+ cl_int operator ()(
+ cl_uint param, ::size_t size, void* value, ::size_t* size_ret)
+ { return f_(arg0_, param, size, value, size_ret); }
+};
+
+template <typename Func, typename Arg0, typename Arg1>
+struct GetInfoFunctor1
+{
+ Func f_; const Arg0& arg0_; const Arg1& arg1_;
+ cl_int operator ()(
+ cl_uint param, ::size_t size, void* value, ::size_t* size_ret)
+ { return f_(arg0_, arg1_, param, size, value, size_ret); }
+};
+
+template <typename Func, typename Arg0, typename T>
+inline cl_int
+getInfo(Func f, const Arg0& arg0, cl_uint name, T* param)
+{
+ GetInfoFunctor0<Func, Arg0> f0 = { f, arg0 };
+ return GetInfoHelper<GetInfoFunctor0<Func, Arg0>, T>
+ ::get(f0, name, param);
+}
+
+template <typename Func, typename Arg0, typename Arg1, typename T>
+inline cl_int
+getInfo(Func f, const Arg0& arg0, const Arg1& arg1, cl_uint name, T* param)
+{
+ GetInfoFunctor1<Func, Arg0, Arg1> f0 = { f, arg0, arg1 };
+ return GetInfoHelper<GetInfoFunctor1<Func, Arg0, Arg1>, T>
+ ::get(f0, name, param);
+}
+
+template<typename T>
+struct ReferenceHandler
+{ };
+
+template <>
+struct ReferenceHandler<cl_device_id>
+{
+ // cl_device_id does not have retain().
+ static cl_int retain(cl_device_id)
+ { return CL_INVALID_DEVICE; }
+ // cl_device_id does not have release().
+ static cl_int release(cl_device_id)
+ { return CL_INVALID_DEVICE; }
+};
+
+template <>
+struct ReferenceHandler<cl_platform_id>
+{
+ // cl_platform_id does not have retain().
+ static cl_int retain(cl_platform_id)
+ { return CL_INVALID_PLATFORM; }
+ // cl_platform_id does not have release().
+ static cl_int release(cl_platform_id)
+ { return CL_INVALID_PLATFORM; }
+};
+
+template <>
+struct ReferenceHandler<cl_context>
+{
+ static cl_int retain(cl_context context)
+ { return ::clRetainContext(context); }
+ static cl_int release(cl_context context)
+ { return ::clReleaseContext(context); }
+};
+
+template <>
+struct ReferenceHandler<cl_command_queue>
+{
+ static cl_int retain(cl_command_queue queue)
+ { return ::clRetainCommandQueue(queue); }
+ static cl_int release(cl_command_queue queue)
+ { return ::clReleaseCommandQueue(queue); }
+};
+
+template <>
+struct ReferenceHandler<cl_mem>
+{
+ static cl_int retain(cl_mem memory)
+ { return ::clRetainMemObject(memory); }
+ static cl_int release(cl_mem memory)
+ { return ::clReleaseMemObject(memory); }
+};
+
+template <>
+struct ReferenceHandler<cl_sampler>
+{
+ static cl_int retain(cl_sampler sampler)
+ { return ::clRetainSampler(sampler); }
+ static cl_int release(cl_sampler sampler)
+ { return ::clReleaseSampler(sampler); }
+};
+
+template <>
+struct ReferenceHandler<cl_program>
+{
+ static cl_int retain(cl_program program)
+ { return ::clRetainProgram(program); }
+ static cl_int release(cl_program program)
+ { return ::clReleaseProgram(program); }
+};
+
+template <>
+struct ReferenceHandler<cl_kernel>
+{
+ static cl_int retain(cl_kernel kernel)
+ { return ::clRetainKernel(kernel); }
+ static cl_int release(cl_kernel kernel)
+ { return ::clReleaseKernel(kernel); }
+};
+
+template <>
+struct ReferenceHandler<cl_event>
+{
+ static cl_int retain(cl_event event)
+ { return ::clRetainEvent(event); }
+ static cl_int release(cl_event event)
+ { return ::clReleaseEvent(event); }
+};
+
+template <typename T>
+class Wrapper
+{
+public:
+ typedef T cl_type;
+
+protected:
+ cl_type object_;
+
+public:
+ Wrapper() : object_(NULL) { }
+
+ ~Wrapper()
+ {
+ if (object_ != NULL) { release(); }
+ }
+
+ Wrapper(const Wrapper<cl_type>& rhs)
+ {
+ object_ = rhs.object_;
+ if (object_ != NULL) { retain(); }
+ }
+
+ Wrapper<cl_type>& operator = (const Wrapper<cl_type>& rhs)
+ {
+ if (object_ != NULL) { release(); }
+ object_ = rhs.object_;
+ if (object_ != NULL) { retain(); }
+ return *this;
+ }
+
+ cl_type operator ()() const { return object_; }
+
+ cl_type& operator ()() { return object_; }
+
+protected:
+
+ cl_int retain() const
+ {
+ return ReferenceHandler<cl_type>::retain(object_);
+ }
+
+ cl_int release() const
+ {
+ return ReferenceHandler<cl_type>::release(object_);
+ }
+};
+
+#if defined(__CL_ENABLE_EXCEPTIONS)
+static inline cl_int errHandler (
+ cl_int err,
+ const char * errStr = NULL) throw(Error)
+{
+ if (err != CL_SUCCESS) {
+ throw Error(err, errStr);
+ }
+ return err;
+}
+#else
+static inline cl_int errHandler (cl_int err, const char * errStr = NULL)
+{
+ return err;
+}
+#endif // __CL_ENABLE_EXCEPTIONS
+
+} // namespace detail
+//! \endcond
+
+/*! \stuct ImageFormat
+ * \brief ImageFormat interface fro cl_image_format.
+ */
+struct ImageFormat : public cl_image_format
+{
+ ImageFormat(){}
+
+ ImageFormat(cl_channel_order order, cl_channel_type type)
+ {
+ image_channel_order = order;
+ image_channel_data_type = type;
+ }
+
+ ImageFormat& operator = (const ImageFormat& rhs)
+ {
+ if (this != &rhs) {
+ this->image_channel_data_type = rhs.image_channel_data_type;
+ this->image_channel_order = rhs.image_channel_order;
+ }
+ return *this;
+ }
+};
+
+/*! \class Device
+ * \brief Device interface for cl_device_id.
+ */
+class Device : public detail::Wrapper<cl_device_id>
+{
+public:
+ Device(cl_device_id device) { object_ = device; }
+
+ Device() : detail::Wrapper<cl_type>() { }
+
+ Device(const Device& device) : detail::Wrapper<cl_type>(device) { }
+
+ Device& operator = (const Device& rhs)
+ {
+ if (this != &rhs) {
+ detail::Wrapper<cl_type>::operator=(rhs);
+ }
+ return *this;
+ }
+
+ template <typename T>
+ cl_int getInfo(cl_device_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetDeviceInfo, object_, name, param),
+ __GET_DEVICE_INFO_ERR);
+ }
+
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_device_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_device_info, name>::param_type param;
+ cl_int result = getInfo(name, ¶m);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+#if defined(USE_CL_DEVICE_FISSION)
+ cl_int createSubDevices(
+ const cl_device_partition_property_ext * properties,
+ VECTOR_CLASS<Device>* devices)
+ {
+ typedef CL_API_ENTRY cl_int
+ ( CL_API_CALL * PFN_clCreateSubDevicesEXT)(
+ cl_device_id /*in_device*/,
+ const cl_device_partition_property_ext * /* properties */,
+ cl_uint /*num_entries*/,
+ cl_device_id * /*out_devices*/,
+ cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
+
+ static PFN_clCreateSubDevicesEXT pfn_clCreateSubDevicesEXT = NULL;
+ __INIT_CL_EXT_FCN_PTR(clCreateSubDevicesEXT);
+
+ cl_uint n = 0;
+ cl_int err = pfn_clCreateSubDevicesEXT(object_, properties, 0, NULL, &n);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __CREATE_SUB_DEVICES);
+ }
+
+ cl_device_id* ids = (cl_device_id*) alloca(n * sizeof(cl_device_id));
+ err = pfn_clCreateSubDevicesEXT(object_, properties, n, ids, NULL);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __CREATE_SUB_DEVICES);
+ }
+
+ devices->assign(&ids[0], &ids[n]);
+ return CL_SUCCESS;
+ }
+#endif
+};
+
+/*! \class Platform
+ * \brief Platform interface.
+ */
+class Platform : public detail::Wrapper<cl_platform_id>
+{
+public:
+ static const Platform null();
+
+ Platform(cl_platform_id platform) { object_ = platform; }
+
+ Platform() : detail::Wrapper<cl_type>() { }
+
+ Platform(const Platform& platform) : detail::Wrapper<cl_type>(platform) { }
+
+ Platform& operator = (const Platform& rhs)
+ {
+ if (this != &rhs) {
+ detail::Wrapper<cl_type>::operator=(rhs);
+ }
+ return *this;
+ }
+
+ cl_int getInfo(cl_platform_info name, STRING_CLASS* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetPlatformInfo, object_, name, param),
+ __GET_PLATFORM_INFO_ERR);
+ }
+
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_platform_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_platform_info, name>::param_type param;
+ cl_int result = getInfo(name, ¶m);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+ cl_int getDevices(
+ cl_device_type type,
+ VECTOR_CLASS<Device>* devices) const
+ {
+ cl_uint n = 0;
+ cl_int err = ::clGetDeviceIDs(object_, type, 0, NULL, &n);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
+ }
+
+ cl_device_id* ids = (cl_device_id*) alloca(n * sizeof(cl_device_id));
+ err = ::clGetDeviceIDs(object_, type, n, ids, NULL);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
+ }
+
+ devices->assign(&ids[0], &ids[n]);
+ return CL_SUCCESS;
+ }
+
+#if defined(USE_DX_INTEROP)
+ /*! \brief Get the list of available D3D10 devices.
+ *
+ * \param d3d_device_source.
+ *
+ * \param d3d_object.
+ *
+ * \param d3d_device_set.
+ *
+ * \param devices returns a vector of OpenCL D3D10 devices found. The cl::Device
+ * values returned in devices can be used to identify a specific OpenCL
+ * device. If \a devices argument is NULL, this argument is ignored.
+ *
+ * \return One of the following values:
+ * - CL_SUCCESS if the function is executed successfully.
+ *
+ * The application can query specific capabilities of the OpenCL device(s)
+ * returned by cl::getDevices. This can be used by the application to
+ * determine which device(s) to use.
+ *
+ * \note In the case that exceptions are enabled and a return value
+ * other than CL_SUCCESS is generated, then cl::Error exception is
+ * generated.
+ */
+ cl_int getDevices(
+ cl_d3d10_device_source_khr d3d_device_source,
+ void * d3d_object,
+ cl_d3d10_device_set_khr d3d_device_set,
+ VECTOR_CLASS<Device>* devices) const
+ {
+ typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clGetDeviceIDsFromD3D10KHR)(
+ cl_platform_id platform,
+ cl_d3d10_device_source_khr d3d_device_source,
+ void * d3d_object,
+ cl_d3d10_device_set_khr d3d_device_set,
+ cl_uint num_entries,
+ cl_device_id * devices,
+ cl_uint* num_devices);
+
+ static PFN_clGetDeviceIDsFromD3D10KHR pfn_clGetDeviceIDsFromD3D10KHR = NULL;
+ __INIT_CL_EXT_FCN_PTR(clGetDeviceIDsFromD3D10KHR);
+
+ cl_uint n = 0;
+ cl_int err = pfn_clGetDeviceIDsFromD3D10KHR(
+ object_,
+ d3d_device_source,
+ d3d_object,
+ d3d_device_set,
+ 0,
+ NULL,
+ &n);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
+ }
+
+ cl_device_id* ids = (cl_device_id*) alloca(n * sizeof(cl_device_id));
+ err = pfn_clGetDeviceIDsFromD3D10KHR(
+ object_,
+ d3d_device_source,
+ d3d_object,
+ d3d_device_set,
+ n,
+ ids,
+ NULL);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
+ }
+
+ devices->assign(&ids[0], &ids[n]);
+ return CL_SUCCESS;
+ }
+#endif
+
+ static cl_int get(
+ VECTOR_CLASS<Platform>* platforms)
+ {
+ cl_uint n = 0;
+ cl_int err = ::clGetPlatformIDs(0, NULL, &n);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
+ }
+
+ cl_platform_id* ids = (cl_platform_id*) alloca(
+ n * sizeof(cl_platform_id));
+ err = ::clGetPlatformIDs(n, ids, NULL);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
+ }
+
+ platforms->assign(&ids[0], &ids[n]);
+ return CL_SUCCESS;
+ }
+};
+
+static inline cl_int
+UnloadCompiler()
+{
+ return ::clUnloadCompiler();
+}
+
+class Context : public detail::Wrapper<cl_context>
+{
+public:
+ Context(
+ const VECTOR_CLASS<Device>& devices,
+ cl_context_properties* properties = NULL,
+ void (CL_CALLBACK * notifyFptr)(
+ const char *,
+ const void *,
+ ::size_t,
+ void *) = NULL,
+ void* data = NULL,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateContext(
+ properties, (cl_uint) devices.size(),
+ (cl_device_id*) &devices.front(),
+ notifyFptr, data, &error);
+
+ detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ Context(
+ cl_device_type type,
+ cl_context_properties* properties = NULL,
+ void (CL_CALLBACK * notifyFptr)(
+ const char *,
+ const void *,
+ ::size_t,
+ void *) = NULL,
+ void* data = NULL,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateContextFromType(
+ properties, type, notifyFptr, data, &error);
+
+ detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ Context() : detail::Wrapper<cl_type>() { }
+
+ Context(const Context& context) : detail::Wrapper<cl_type>(context) { }
+
+ Context& operator = (const Context& rhs)
+ {
+ if (this != &rhs) {
+ detail::Wrapper<cl_type>::operator=(rhs);
+ }
+ return *this;
+ }
+
+ template <typename T>
+ cl_int getInfo(cl_context_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetContextInfo, object_, name, param),
+ __GET_CONTEXT_INFO_ERR);
+ }
+
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_context_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_context_info, name>::param_type param;
+ cl_int result = getInfo(name, ¶m);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+ cl_int getSupportedImageFormats(
+ cl_mem_flags flags,
+ cl_mem_object_type type,
+ VECTOR_CLASS<ImageFormat>* formats) const
+ {
+ cl_uint numEntries;
+ cl_int err = ::clGetSupportedImageFormats(
+ object_,
+ flags,
+ type,
+ 0,
+ NULL,
+ &numEntries);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __GET_SUPPORTED_IMAGE_FORMATS_ERR);
+ }
+
+ ImageFormat* value = (ImageFormat*)
+ alloca(numEntries * sizeof(ImageFormat));
+ err = ::clGetSupportedImageFormats(
+ object_,
+ flags,
+ type,
+ numEntries,
+ (cl_image_format*) value,
+ NULL);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __GET_SUPPORTED_IMAGE_FORMATS_ERR);
+ }
+
+ formats->assign(&value[0], &value[numEntries]);
+ return CL_SUCCESS;
+ }
+};
+
+__GET_INFO_HELPER_WITH_RETAIN(cl::Context)
+
+/*! \class Event
+ * \brief Event interface for cl_event.
+ */
+class Event : public detail::Wrapper<cl_event>
+{
+public:
+ Event() : detail::Wrapper<cl_type>() { }
+
+ Event(const Event& event) : detail::Wrapper<cl_type>(event) { }
+
+ Event& operator = (const Event& rhs)
+ {
+ if (this != &rhs) {
+ detail::Wrapper<cl_type>::operator=(rhs);
+ }
+ return *this;
+ }
+
+ template <typename T>
+ cl_int getInfo(cl_event_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetEventInfo, object_, name, param),
+ __GET_EVENT_INFO_ERR);
+ }
+
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_event_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_event_info, name>::param_type param;
+ cl_int result = getInfo(name, ¶m);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+ template <typename T>
+ cl_int getProfilingInfo(cl_profiling_info name, T* param) const
+ {
+ return detail::errHandler(detail::getInfo(
+ &::clGetEventProfilingInfo, object_, name, param),
+ __GET_EVENT_PROFILE_INFO_ERR);
+ }
+
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_profiling_info, name>::param_type
+ getProfilingInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_profiling_info, name>::param_type param;
+ cl_int result = getProfilingInfo(name, ¶m);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+ cl_int wait() const
+ {
+ return detail::errHandler(
+ ::clWaitForEvents(1, &object_),
+ __WAIT_FOR_EVENTS_ERR);
+ }
+
+#if defined(CL_VERSION_1_1)
+ cl_int setCallback(
+ cl_int type,
+ void (CL_CALLBACK * pfn_notify)(cl_event, cl_int, void *),
+ void * user_data = NULL)
+ {
+ return detail::errHandler(
+ ::clSetEventCallback(
+ object_,
+ type,
+ pfn_notify,
+ user_data),
+ __SET_EVENT_CALLBACK_ERR);
+ }
+#endif
+
+ static cl_int
+ waitForEvents(const VECTOR_CLASS<Event>& events)
+ {
+ return detail::errHandler(
+ ::clWaitForEvents(
+ (cl_uint) events.size(), (cl_event*)&events.front()),
+ __WAIT_FOR_EVENTS_ERR);
+ }
+};
+
+__GET_INFO_HELPER_WITH_RETAIN(cl::Event)
+
+#if defined(CL_VERSION_1_1)
+/*! \class UserEvent
+ * \brief User event interface for cl_event.
+ */
+class UserEvent : public Event
+{
+public:
+ UserEvent(
+ const Context& context,
+ cl_int * err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateUserEvent(
+ context(),
+ &error);
+
+ detail::errHandler(error, __CREATE_USER_EVENT_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ UserEvent() : Event() { }
+
+ UserEvent(const UserEvent& event) : Event(event) { }
+
+ UserEvent& operator = (const UserEvent& rhs)
+ {
+ if (this != &rhs) {
+ Event::operator=(rhs);
+ }
+ return *this;
+ }
+
+ cl_int setStatus(cl_int status)
+ {
+ return detail::errHandler(
+ ::clSetUserEventStatus(object_,status),
+ __SET_USER_EVENT_STATUS_ERR);
+ }
+};
+#endif
+
+inline static cl_int
+WaitForEvents(const VECTOR_CLASS<Event>& events)
+{
+ return detail::errHandler(
+ ::clWaitForEvents(
+ (cl_uint) events.size(), (cl_event*)&events.front()),
+ __WAIT_FOR_EVENTS_ERR);
+}
+
+/*! \class Memory
+ * \brief Memory interface for cl_mem.
+ */
+class Memory : public detail::Wrapper<cl_mem>
+{
+public:
+ Memory() : detail::Wrapper<cl_type>() { }
+
+ Memory(const Memory& memory) : detail::Wrapper<cl_type>(memory) { }
+
+ Memory& operator = (const Memory& rhs)
+ {
+ if (this != &rhs) {
+ detail::Wrapper<cl_type>::operator=(rhs);
+ }
+ return *this;
+ }
+
+ template <typename T>
+ cl_int getInfo(cl_mem_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetMemObjectInfo, object_, name, param),
+ __GET_MEM_OBJECT_INFO_ERR);
+ }
+
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_mem_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_mem_info, name>::param_type param;
+ cl_int result = getInfo(name, ¶m);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+#if defined(CL_VERSION_1_1)
+ cl_int setDestructorCallback(
+ void (CL_CALLBACK * pfn_notify)(cl_mem, void *),
+ void * user_data = NULL)
+ {
+ return detail::errHandler(
+ ::clSetMemObjectDestructorCallback(
+ object_,
+ pfn_notify,
+ user_data),
+ __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR);
+ }
+#endif
+
+};
+
+__GET_INFO_HELPER_WITH_RETAIN(cl::Memory)
+
+/*! \class Buffer
+ * \brief Memory buffer interface.
+ */
+class Buffer : public Memory
+{
+public:
+ Buffer(
+ const Context& context,
+ cl_mem_flags flags,
+ ::size_t size,
+ void* host_ptr = NULL,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateBuffer(context(), flags, size, host_ptr, &error);
+
+ detail::errHandler(error, __CREATE_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ Buffer() : Memory() { }
+
+ Buffer(const Buffer& buffer) : Memory(buffer) { }
+
+ Buffer& operator = (const Buffer& rhs)
+ {
+ if (this != &rhs) {
+ Memory::operator=(rhs);
+ }
+ return *this;
+ }
+
+#if defined(CL_VERSION_1_1)
+ Buffer createSubBuffer(
+ cl_mem_flags flags,
+ cl_buffer_create_type buffer_create_type,
+ const void * buffer_create_info,
+ cl_int * err = NULL)
+ {
+ Buffer result;
+ cl_int error;
+ result.object_ = ::clCreateSubBuffer(
+ object_,
+ flags,
+ buffer_create_type,
+ buffer_create_info,
+ &error);
+
+ detail::errHandler(error, __CREATE_SUBBUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+
+ return result;
+ }
+#endif
+};
+
+#if defined (USE_DX_INTEROP)
+class BufferD3D10 : public Buffer
+{
+public:
+ typedef CL_API_ENTRY cl_mem (CL_API_CALL *PFN_clCreateFromD3D10BufferKHR)(
+ cl_context context, cl_mem_flags flags, ID3D10Buffer* buffer,
+ cl_int* errcode_ret);
+
+ BufferD3D10(
+ const Context& context,
+ cl_mem_flags flags,
+ ID3D10Buffer* bufobj,
+ cl_int * err = NULL)
+ {
+ static PFN_clCreateFromD3D10BufferKHR pfn_clCreateFromD3D10BufferKHR = NULL;
+ __INIT_CL_EXT_FCN_PTR(clCreateFromD3D10BufferKHR);
+
+ cl_int error;
+ object_ = pfn_clCreateFromD3D10BufferKHR(
+ context(),
+ flags,
+ bufobj,
+ &error);
+
+ detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ BufferD3D10() : Buffer() { }
+
+ BufferD3D10(const BufferD3D10& buffer) : Buffer(buffer) { }
+
+ BufferD3D10& operator = (const BufferD3D10& rhs)
+ {
+ if (this != &rhs) {
+ Buffer::operator=(rhs);
+ }
+ return *this;
+ }
+};
+#endif
+
+/*! \class BufferGL
+ * \brief Memory buffer interface for GL interop.
+ */
+class BufferGL : public Buffer
+{
+public:
+ BufferGL(
+ const Context& context,
+ cl_mem_flags flags,
+ GLuint bufobj,
+ cl_int * err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateFromGLBuffer(
+ context(),
+ flags,
+ bufobj,
+ &error);
+
+ detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ BufferGL() : Buffer() { }
+
+ BufferGL(const BufferGL& buffer) : Buffer(buffer) { }
+
+ BufferGL& operator = (const BufferGL& rhs)
+ {
+ if (this != &rhs) {
+ Buffer::operator=(rhs);
+ }
+ return *this;
+ }
+
+ cl_int getObjectInfo(
+ cl_gl_object_type *type,
+ GLuint * gl_object_name)
+ {
+ return detail::errHandler(
+ ::clGetGLObjectInfo(object_,type,gl_object_name),
+ __GET_GL_OBJECT_INFO_ERR);
+ }
+};
+
+/*! \class BufferRenderGL
+ * \brief Memory buffer interface for GL interop with renderbuffer.
+ */
+class BufferRenderGL : public Buffer
+{
+public:
+ BufferRenderGL(
+ const Context& context,
+ cl_mem_flags flags,
+ GLuint bufobj,
+ cl_int * err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateFromGLRenderbuffer(
+ context(),
+ flags,
+ bufobj,
+ &error);
+
+ detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ BufferRenderGL() : Buffer() { }
+
+ BufferRenderGL(const BufferGL& buffer) : Buffer(buffer) { }
+
+ BufferRenderGL& operator = (const BufferRenderGL& rhs)
+ {
+ if (this != &rhs) {
+ Buffer::operator=(rhs);
+ }
+ return *this;
+ }
+
+ cl_int getObjectInfo(
+ cl_gl_object_type *type,
+ GLuint * gl_object_name)
+ {
+ return detail::errHandler(
+ ::clGetGLObjectInfo(object_,type,gl_object_name),
+ __GET_GL_OBJECT_INFO_ERR);
+ }
+};
+
+/*! \class Image
+ * \brief Base class interface for all images.
+ */
+class Image : public Memory
+{
+protected:
+ Image() : Memory() { }
+
+ Image(const Image& image) : Memory(image) { }
+
+ Image& operator = (const Image& rhs)
+ {
+ if (this != &rhs) {
+ Memory::operator=(rhs);
+ }
+ return *this;
+ }
+public:
+ template <typename T>
+ cl_int getImageInfo(cl_image_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetImageInfo, object_, name, param),
+ __GET_IMAGE_INFO_ERR);
+ }
+
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_image_info, name>::param_type
+ getImageInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_image_info, name>::param_type param;
+ cl_int result = getImageInfo(name, ¶m);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+};
+
+/*! \class Image2D
+ * \brief Image interface for 2D images.
+ */
+class Image2D : public Image
+{
+public:
+ Image2D(
+ const Context& context,
+ cl_mem_flags flags,
+ ImageFormat format,
+ ::size_t width,
+ ::size_t height,
+ ::size_t row_pitch = 0,
+ void* host_ptr = NULL,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateImage2D(
+ context(), flags,&format, width, height, row_pitch, host_ptr, &error);
+
+ detail::errHandler(error, __CREATE_IMAGE2D_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ Image2D() { }
+
+ Image2D(const Image2D& image2D) : Image(image2D) { }
+
+ Image2D& operator = (const Image2D& rhs)
+ {
+ if (this != &rhs) {
+ Image::operator=(rhs);
+ }
+ return *this;
+ }
+};
+
+/*! \class Image2DGL
+ * \brief 2D image interface for GL interop.
+ */
+class Image2DGL : public Image2D
+{
+public:
+ Image2DGL(
+ const Context& context,
+ cl_mem_flags flags,
+ GLenum target,
+ GLint miplevel,
+ GLuint texobj,
+ cl_int * err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateFromGLTexture2D(
+ context(),
+ flags,
+ target,
+ miplevel,
+ texobj,
+ &error);
+
+ detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ Image2DGL() : Image2D() { }
+
+ Image2DGL(const Image2DGL& image) : Image2D(image) { }
+
+ Image2DGL& operator = (const Image2DGL& rhs)
+ {
+ if (this != &rhs) {
+ Image2D::operator=(rhs);
+ }
+ return *this;
+ }
+};
+
+/*! \class Image3D
+ * \brief Image interface for 3D images.
+ */
+class Image3D : public Image
+{
+public:
+ Image3D(
+ const Context& context,
+ cl_mem_flags flags,
+ ImageFormat format,
+ ::size_t width,
+ ::size_t height,
+ ::size_t depth,
+ ::size_t row_pitch = 0,
+ ::size_t slice_pitch = 0,
+ void* host_ptr = NULL,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateImage3D(
+ context(), flags, &format, width, height, depth, row_pitch,
+ slice_pitch, host_ptr, &error);
+
+ detail::errHandler(error, __CREATE_IMAGE3D_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ Image3D() { }
+
+ Image3D(const Image3D& image3D) : Image(image3D) { }
+
+ Image3D& operator = (const Image3D& rhs)
+ {
+ if (this != &rhs) {
+ Image::operator=(rhs);
+ }
+ return *this;
+ }
+};
+
+/*! \class Image2DGL
+ * \brief 2D image interface for GL interop.
+ */
+class Image3DGL : public Image3D
+{
+public:
+ Image3DGL(
+ const Context& context,
+ cl_mem_flags flags,
+ GLenum target,
+ GLint miplevel,
+ GLuint texobj,
+ cl_int * err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateFromGLTexture3D(
+ context(),
+ flags,
+ target,
+ miplevel,
+ texobj,
+ &error);
+
+ detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ Image3DGL() : Image3D() { }
+
+ Image3DGL(const Image3DGL& image) : Image3D(image) { }
+
+ Image3DGL& operator = (const Image3DGL& rhs)
+ {
+ if (this != &rhs) {
+ Image3D::operator=(rhs);
+ }
+ return *this;
+ }
+};
+
+/*! \class Sampler
+ * \brief Sampler interface for cl_sampler.
+ */
+class Sampler : public detail::Wrapper<cl_sampler>
+{
+public:
+ Sampler() { }
+
+ Sampler(
+ const Context& context,
+ cl_bool normalized_coords,
+ cl_addressing_mode addressing_mode,
+ cl_filter_mode filter_mode,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateSampler(
+ context(),
+ normalized_coords,
+ addressing_mode,
+ filter_mode,
+ &error);
+
+ detail::errHandler(error, __CREATE_SAMPLER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ Sampler(const Sampler& sampler) : detail::Wrapper<cl_type>(sampler) { }
+
+ Sampler& operator = (const Sampler& rhs)
+ {
+ if (this != &rhs) {
+ detail::Wrapper<cl_type>::operator=(rhs);
+ }
+ return *this;
+ }
+
+ template <typename T>
+ cl_int getInfo(cl_sampler_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetSamplerInfo, object_, name, param),
+ __GET_SAMPLER_INFO_ERR);
+ }
+
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_sampler_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_sampler_info, name>::param_type param;
+ cl_int result = getInfo(name, ¶m);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+};
+
+__GET_INFO_HELPER_WITH_RETAIN(cl::Sampler)
+
+class Program;
+class CommandQueue;
+class Kernel;
+
+/*! \class NDRange
+ * \brief NDRange interface
+ */
+class NDRange
+{
+private:
+ size_t<3> sizes_;
+ cl_uint dimensions_;
+
+public:
+ NDRange()
+ : dimensions_(0)
+ { }
+
+ NDRange(::size_t size0)
+ : dimensions_(1)
+ {
+ sizes_.push_back(size0);
+ }
+
+ NDRange(::size_t size0, ::size_t size1)
+ : dimensions_(2)
+ {
+ sizes_.push_back(size0);
+ sizes_.push_back(size1);
+ }
+
+ NDRange(::size_t size0, ::size_t size1, ::size_t size2)
+ : dimensions_(3)
+ {
+ sizes_.push_back(size0);
+ sizes_.push_back(size1);
+ sizes_.push_back(size2);
+ }
+
+ operator const ::size_t*() const { return (const ::size_t*) sizes_; }
+ ::size_t dimensions() const { return dimensions_; }
+};
+
+static const NDRange NullRange;
+
+/*!
+ * \struct LocalSpaceArg
+ * \brief Local address raper for use with Kernel::setArg
+ */
+struct LocalSpaceArg
+{
+ ::size_t size_;
+};
+
+namespace detail {
+
+template <typename T>
+struct KernelArgumentHandler
+{
+ static ::size_t size(const T&) { return sizeof(T); }
+ static T* ptr(T& value) { return &value; }
+};
+
+template <>
+struct KernelArgumentHandler<LocalSpaceArg>
+{
+ static ::size_t size(const LocalSpaceArg& value) { return value.size_; }
+ static void* ptr(LocalSpaceArg&) { return NULL; }
+};
+
+}
+//! \endcond
+
+inline LocalSpaceArg
+__local(::size_t size)
+{
+ LocalSpaceArg ret = { size };
+ return ret;
+}
+
+class KernelFunctor;
+
+/*! \class Kernel
+ * \brief Kernel interface that implements cl_kernel
+ */
+class Kernel : public detail::Wrapper<cl_kernel>
+{
+public:
+ inline Kernel(const Program& program, const char* name, cl_int* err = NULL);
+
+ Kernel() { }
+
+ Kernel(const Kernel& kernel) : detail::Wrapper<cl_type>(kernel) { }
+
+ Kernel& operator = (const Kernel& rhs)
+ {
+ if (this != &rhs) {
+ detail::Wrapper<cl_type>::operator=(rhs);
+ }
+ return *this;
+ }
+
+ template <typename T>
+ cl_int getInfo(cl_kernel_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetKernelInfo, object_, name, param),
+ __GET_KERNEL_INFO_ERR);
+ }
+
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_kernel_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_kernel_info, name>::param_type param;
+ cl_int result = getInfo(name, ¶m);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+ template <typename T>
+ cl_int getWorkGroupInfo(
+ const Device& device, cl_kernel_work_group_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(
+ &::clGetKernelWorkGroupInfo, object_, device(), name, param),
+ __GET_KERNEL_WORK_GROUP_INFO_ERR);
+ }
+
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_kernel_work_group_info, name>::param_type
+ getWorkGroupInfo(const Device& device, cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_kernel_work_group_info, name>::param_type param;
+ cl_int result = getWorkGroupInfo(device, name, ¶m);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+ template <typename T>
+ cl_int setArg(cl_uint index, T value)
+ {
+ return detail::errHandler(
+ ::clSetKernelArg(
+ object_,
+ index,
+ detail::KernelArgumentHandler<T>::size(value),
+ detail::KernelArgumentHandler<T>::ptr(value)),
+ __SET_KERNEL_ARGS_ERR);
+ }
+
+ cl_int setArg(cl_uint index, ::size_t size, void* argPtr)
+ {
+ return detail::errHandler(
+ ::clSetKernelArg(object_, index, size, argPtr),
+ __SET_KERNEL_ARGS_ERR);
+ }
+
+ KernelFunctor bind(
+ const CommandQueue& queue,
+ const NDRange& offset,
+ const NDRange& global,
+ const NDRange& local);
+
+ KernelFunctor bind(
+ const CommandQueue& queue,
+ const NDRange& global,
+ const NDRange& local);
+};
+
+__GET_INFO_HELPER_WITH_RETAIN(cl::Kernel)
+
+/*! \class Program
+ * \brief Program interface that implements cl_program.
+ */
+class Program : public detail::Wrapper<cl_program>
+{
+public:
+ typedef VECTOR_CLASS<std::pair<const void*, ::size_t> > Binaries;
+ typedef VECTOR_CLASS<std::pair<const char*, ::size_t> > Sources;
+
+ Program(
+ const Context& context,
+ const Sources& sources,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+
+ const ::size_t n = (::size_t)sources.size();
+ ::size_t* lengths = (::size_t*) alloca(n * sizeof(::size_t));
+ const char** strings = (const char**) alloca(n * sizeof(const char*));
+
+ for (::size_t i = 0; i < n; ++i) {
+ strings[i] = sources[(int)i].first;
+ lengths[i] = sources[(int)i].second;
+ }
+
+ object_ = ::clCreateProgramWithSource(
+ context(), (cl_uint)n, strings, lengths, &error);
+
+ detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ Program(
+ const Context& context,
+ const VECTOR_CLASS<Device>& devices,
+ const Binaries& binaries,
+ VECTOR_CLASS<cl_int>* binaryStatus = NULL,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+ const ::size_t n = binaries.size();
+ ::size_t* lengths = (::size_t*) alloca(n * sizeof(::size_t));
+ const unsigned char** images = (const unsigned char**) alloca(n * sizeof(const void*));
+
+ for (::size_t i = 0; i < n; ++i) {
+ images[i] = (const unsigned char*)binaries[(int)i].first;
+ lengths[i] = binaries[(int)i].second;
+ }
+
+ object_ = ::clCreateProgramWithBinary(
+ context(), (cl_uint) devices.size(),
+ (cl_device_id*)&devices.front(),
+ lengths, images, binaryStatus != NULL
+ ? (cl_int*) &binaryStatus->front()
+ : NULL, &error);
+
+ detail::errHandler(error, __CREATE_PROGRAM_WITH_BINARY_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ Program() { }
+
+ Program(const Program& program) : detail::Wrapper<cl_type>(program) { }
+
+ Program& operator = (const Program& rhs)
+ {
+ if (this != &rhs) {
+ detail::Wrapper<cl_type>::operator=(rhs);
+ }
+ return *this;
+ }
+
+ cl_int build(
+ const VECTOR_CLASS<Device>& devices,
+ const char* options = NULL,
+ void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL,
+ void* data = NULL) const
+ {
+ return detail::errHandler(
+ ::clBuildProgram(
+ object_,
+ (cl_uint)
+ devices.size(),
+ (cl_device_id*)&devices.front(),
+ options,
+ notifyFptr,
+ data),
+ __BUILD_PROGRAM_ERR);
+ }
+
+ template <typename T>
+ cl_int getInfo(cl_program_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(&::clGetProgramInfo, object_, name, param),
+ __GET_PROGRAM_INFO_ERR);
+ }
+
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_program_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_program_info, name>::param_type param;
+ cl_int result = getInfo(name, ¶m);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+ template <typename T>
+ cl_int getBuildInfo(
+ const Device& device, cl_program_build_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(
+ &::clGetProgramBuildInfo, object_, device(), name, param),
+ __GET_PROGRAM_BUILD_INFO_ERR);
+ }
+
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_program_build_info, name>::param_type
+ getBuildInfo(const Device& device, cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_program_build_info, name>::param_type param;
+ cl_int result = getBuildInfo(device, name, ¶m);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+ cl_int createKernels(VECTOR_CLASS<Kernel>* kernels)
+ {
+ cl_uint numKernels;
+ cl_int err = ::clCreateKernelsInProgram(object_, 0, NULL, &numKernels);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __CREATE_KERNELS_IN_PROGRAM_ERR);
+ }
+
+ Kernel* value = (Kernel*) alloca(numKernels * sizeof(Kernel));
+ err = ::clCreateKernelsInProgram(
+ object_, numKernels, (cl_kernel*) value, NULL);
+ if (err != CL_SUCCESS) {
+ return detail::errHandler(err, __CREATE_KERNELS_IN_PROGRAM_ERR);
+ }
+
+ kernels->assign(&value[0], &value[numKernels]);
+ return CL_SUCCESS;
+ }
+};
+
+__GET_INFO_HELPER_WITH_RETAIN(cl::Program)
+
+inline Kernel::Kernel(const Program& program, const char* name, cl_int* err)
+{
+ cl_int error;
+
+ object_ = ::clCreateKernel(program(), name, &error);
+ detail::errHandler(error, __CREATE_KERNEL_ERR);
+
+ if (err != NULL) {
+ *err = error;
+ }
+
+}
+
+/*! \class CommandQueue
+ * \brief CommandQueue interface for cl_command_queue.
+ */
+class CommandQueue : public detail::Wrapper<cl_command_queue>
+{
+public:
+ CommandQueue(
+ const Context& context,
+ const Device& device,
+ cl_command_queue_properties properties = 0,
+ cl_int* err = NULL)
+ {
+ cl_int error;
+ object_ = ::clCreateCommandQueue(
+ context(), device(), properties, &error);
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+
+ CommandQueue() { }
+
+ CommandQueue(const CommandQueue& commandQueue) : detail::Wrapper<cl_type>(commandQueue) { }
+
+ CommandQueue& operator = (const CommandQueue& rhs)
+ {
+ if (this != &rhs) {
+ detail::Wrapper<cl_type>::operator=(rhs);
+ }
+ return *this;
+ }
+
+ template <typename T>
+ cl_int getInfo(cl_command_queue_info name, T* param) const
+ {
+ return detail::errHandler(
+ detail::getInfo(
+ &::clGetCommandQueueInfo, object_, name, param),
+ __GET_COMMAND_QUEUE_INFO_ERR);
+ }
+
+ template <cl_int name> typename
+ detail::param_traits<detail::cl_command_queue_info, name>::param_type
+ getInfo(cl_int* err = NULL) const
+ {
+ typename detail::param_traits<
+ detail::cl_command_queue_info, name>::param_type param;
+ cl_int result = getInfo(name, ¶m);
+ if (err != NULL) {
+ *err = result;
+ }
+ return param;
+ }
+
+ cl_int enqueueReadBuffer(
+ const Buffer& buffer,
+ cl_bool blocking,
+ ::size_t offset,
+ ::size_t size,
+ void* ptr,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ return detail::errHandler(
+ ::clEnqueueReadBuffer(
+ object_, buffer(), blocking, offset, size,
+ ptr,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (cl_event*) event),
+ __ENQUEUE_READ_BUFFER_ERR);
+ }
+
+ cl_int enqueueWriteBuffer(
+ const Buffer& buffer,
+ cl_bool blocking,
+ ::size_t offset,
+ ::size_t size,
+ const void* ptr,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ return detail::errHandler(
+ ::clEnqueueWriteBuffer(
+ object_, buffer(), blocking, offset, size,
+ ptr,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (cl_event*) event),
+ __ENQUEUE_WRITE_BUFFER_ERR);
+ }
+
+ cl_int enqueueCopyBuffer(
+ const Buffer& src,
+ const Buffer& dst,
+ ::size_t src_offset,
+ ::size_t dst_offset,
+ ::size_t size,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ return detail::errHandler(
+ ::clEnqueueCopyBuffer(
+ object_, src(), dst(), src_offset, dst_offset, size,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (cl_event*) event),
+ __ENQEUE_COPY_BUFFER_ERR);
+ }
+
+#if defined(CL_VERSION_1_1)
+ cl_int enqueueReadBufferRect(
+ const Buffer& buffer,
+ cl_bool blocking,
+ const size_t<3>& buffer_offset,
+ const size_t<3>& host_offset,
+ const size_t<3>& region,
+ ::size_t buffer_row_pitch,
+ ::size_t buffer_slice_pitch,
+ ::size_t host_row_pitch,
+ ::size_t host_slice_pitch,
+ void *ptr,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ return detail::errHandler(
+ ::clEnqueueReadBufferRect(
+ object_,
+ buffer(),
+ blocking,
+ (const ::size_t *)buffer_offset,
+ (const ::size_t *)host_offset,
+ (const ::size_t *)region,
+ buffer_row_pitch,
+ buffer_slice_pitch,
+ host_row_pitch,
+ host_slice_pitch,
+ ptr,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (cl_event*) event),
+ __ENQUEUE_READ_BUFFER_RECT_ERR);
+ }
+
+
+ cl_int enqueueWriteBufferRect(
+ const Buffer& buffer,
+ cl_bool blocking,
+ const size_t<3>& buffer_offset,
+ const size_t<3>& host_offset,
+ const size_t<3>& region,
+ ::size_t buffer_row_pitch,
+ ::size_t buffer_slice_pitch,
+ ::size_t host_row_pitch,
+ ::size_t host_slice_pitch,
+ void *ptr,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ return detail::errHandler(
+ ::clEnqueueWriteBufferRect(
+ object_,
+ buffer(),
+ blocking,
+ (const ::size_t *)buffer_offset,
+ (const ::size_t *)host_offset,
+ (const ::size_t *)region,
+ buffer_row_pitch,
+ buffer_slice_pitch,
+ host_row_pitch,
+ host_slice_pitch,
+ ptr,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (cl_event*) event),
+ __ENQUEUE_WRITE_BUFFER_RECT_ERR);
+ }
+
+ cl_int enqueueCopyBufferRect(
+ const Buffer& src,
+ const Buffer& dst,
+ const size_t<3>& src_origin,
+ const size_t<3>& dst_origin,
+ const size_t<3>& region,
+ ::size_t src_row_pitch,
+ ::size_t src_slice_pitch,
+ ::size_t dst_row_pitch,
+ ::size_t dst_slice_pitch,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ return detail::errHandler(
+ ::clEnqueueCopyBufferRect(
+ object_,
+ src(),
+ dst(),
+ (const ::size_t *)src_origin,
+ (const ::size_t *)dst_origin,
+ (const ::size_t *)region,
+ src_row_pitch,
+ src_slice_pitch,
+ dst_row_pitch,
+ dst_slice_pitch,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (cl_event*) event),
+ __ENQEUE_COPY_BUFFER_RECT_ERR);
+ }
+#endif
+
+ cl_int enqueueReadImage(
+ const Image& image,
+ cl_bool blocking,
+ const size_t<3>& origin,
+ const size_t<3>& region,
+ ::size_t row_pitch,
+ ::size_t slice_pitch,
+ void* ptr,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ return detail::errHandler(
+ ::clEnqueueReadImage(
+ object_, image(), blocking, (const ::size_t *) origin,
+ (const ::size_t *) region, row_pitch, slice_pitch, ptr,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (cl_event*) event),
+ __ENQUEUE_READ_IMAGE_ERR);
+ }
+
+ cl_int enqueueWriteImage(
+ const Image& image,
+ cl_bool blocking,
+ const size_t<3>& origin,
+ const size_t<3>& region,
+ ::size_t row_pitch,
+ ::size_t slice_pitch,
+ void* ptr,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ return detail::errHandler(
+ ::clEnqueueWriteImage(
+ object_, image(), blocking, (const ::size_t *) origin,
+ (const ::size_t *) region, row_pitch, slice_pitch, ptr,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (cl_event*) event),
+ __ENQUEUE_WRITE_IMAGE_ERR);
+ }
+
+ cl_int enqueueCopyImage(
+ const Image& src,
+ const Image& dst,
+ const size_t<3>& src_origin,
+ const size_t<3>& dst_origin,
+ const size_t<3>& region,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ return detail::errHandler(
+ ::clEnqueueCopyImage(
+ object_, src(), dst(), (const ::size_t *) src_origin,
+ (const ::size_t *)dst_origin, (const ::size_t *) region,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (cl_event*) event),
+ __ENQUEUE_COPY_IMAGE_ERR);
+ }
+
+ cl_int enqueueCopyImageToBuffer(
+ const Image& src,
+ const Buffer& dst,
+ const size_t<3>& src_origin,
+ const size_t<3>& region,
+ ::size_t dst_offset,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ return detail::errHandler(
+ ::clEnqueueCopyImageToBuffer(
+ object_, src(), dst(), (const ::size_t *) src_origin,
+ (const ::size_t *) region, dst_offset,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (cl_event*) event),
+ __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR);
+ }
+
+ cl_int enqueueCopyBufferToImage(
+ const Buffer& src,
+ const Image& dst,
+ ::size_t src_offset,
+ const size_t<3>& dst_origin,
+ const size_t<3>& region,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ return detail::errHandler(
+ ::clEnqueueCopyBufferToImage(
+ object_, src(), dst(), src_offset,
+ (const ::size_t *) dst_origin, (const ::size_t *) region,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (cl_event*) event),
+ __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR);
+ }
+
+ void* enqueueMapBuffer(
+ const Buffer& buffer,
+ cl_bool blocking,
+ cl_map_flags flags,
+ ::size_t offset,
+ ::size_t size,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL,
+ cl_int* err = NULL) const
+ {
+ cl_int error;
+ void * result = ::clEnqueueMapBuffer(
+ object_, buffer(), blocking, flags, offset, size,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (cl_event*) event,
+ &error);
+
+ detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ return result;
+ }
+
+ void* enqueueMapImage(
+ const Image& buffer,
+ cl_bool blocking,
+ cl_map_flags flags,
+ const size_t<3>& origin,
+ const size_t<3>& region,
+ ::size_t * row_pitch,
+ ::size_t * slice_pitch,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL,
+ cl_int* err = NULL) const
+ {
+ cl_int error;
+ void * result = ::clEnqueueMapImage(
+ object_, buffer(), blocking, flags,
+ (const ::size_t *) origin, (const ::size_t *) region,
+ row_pitch, slice_pitch,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (cl_event*) event,
+ &error);
+
+ detail::errHandler(error, __ENQUEUE_MAP_IMAGE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ return result;
+ }
+
+ cl_int enqueueUnmapMemObject(
+ const Memory& memory,
+ void* mapped_ptr,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ return detail::errHandler(
+ ::clEnqueueUnmapMemObject(
+ object_, memory(), mapped_ptr,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (cl_event*) event),
+ __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
+ }
+
+ cl_int enqueueNDRangeKernel(
+ const Kernel& kernel,
+ const NDRange& offset,
+ const NDRange& global,
+ const NDRange& local,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ return detail::errHandler(
+ ::clEnqueueNDRangeKernel(
+ object_, kernel(), (cl_uint) global.dimensions(),
+ offset.dimensions() != 0 ? (const ::size_t*) offset : NULL,
+ (const ::size_t*) global,
+ local.dimensions() != 0 ? (const ::size_t*) local : NULL,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (cl_event*) event),
+ __ENQUEUE_NDRANGE_KERNEL_ERR);
+ }
+
+ cl_int enqueueTask(
+ const Kernel& kernel,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ return detail::errHandler(
+ ::clEnqueueTask(
+ object_, kernel(),
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (cl_event*) event),
+ __ENQUEUE_TASK_ERR);
+ }
+
+ cl_int enqueueNativeKernel(
+ void (*userFptr)(void *),
+ std::pair<void*, ::size_t> args,
+ const VECTOR_CLASS<Memory>* mem_objects = NULL,
+ const VECTOR_CLASS<const void*>* mem_locs = NULL,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ cl_mem * mems = (mem_objects != NULL && mem_objects->size() > 0)
+ ? (cl_mem*) alloca(mem_objects->size() * sizeof(cl_mem))
+ : NULL;
+
+ if (mems != NULL) {
+ for (unsigned int i = 0; i < mem_objects->size(); i++) {
+ mems[i] = ((*mem_objects)[i])();
+ }
+ }
+
+ return detail::errHandler(
+ ::clEnqueueNativeKernel(
+ object_, userFptr, args.first, args.second,
+ (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
+ mems,
+ (mem_locs != NULL) ? (const void **) &mem_locs->front() : NULL,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (cl_event*) event),
+ __ENQUEUE_NATIVE_KERNEL);
+ }
+
+ cl_int enqueueMarker(Event* event = NULL) const
+ {
+ return detail::errHandler(
+ ::clEnqueueMarker(object_, (cl_event*) event),
+ __ENQUEUE_MARKER_ERR);
+ }
+
+ cl_int enqueueWaitForEvents(const VECTOR_CLASS<Event>& events) const
+ {
+ return detail::errHandler(
+ ::clEnqueueWaitForEvents(
+ object_,
+ (cl_uint) events.size(),
+ (const cl_event*) &events.front()),
+ __ENQUEUE_WAIT_FOR_EVENTS_ERR);
+ }
+
+ cl_int enqueueAcquireGLObjects(
+ const VECTOR_CLASS<Memory>* mem_objects = NULL,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ return detail::errHandler(
+ ::clEnqueueAcquireGLObjects(
+ object_,
+ (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
+ (mem_objects != NULL) ? (const cl_mem *) &mem_objects->front(): NULL,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (cl_event*) event),
+ __ENQUEUE_ACQUIRE_GL_ERR);
+ }
+
+ cl_int enqueueReleaseGLObjects(
+ const VECTOR_CLASS<Memory>* mem_objects = NULL,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ return detail::errHandler(
+ ::clEnqueueReleaseGLObjects(
+ object_,
+ (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
+ (mem_objects != NULL) ? (const cl_mem *) &mem_objects->front(): NULL,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
+ (cl_event*) event),
+ __ENQUEUE_RELEASE_GL_ERR);
+ }
+
+#if defined (USE_DX_INTEROP)
+typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clEnqueueAcquireD3D10ObjectsKHR)(
+ cl_command_queue command_queue, cl_uint num_objects,
+ const cl_mem* mem_objects, cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list, cl_event* event);
+typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clEnqueueReleaseD3D10ObjectsKHR)(
+ cl_command_queue command_queue, cl_uint num_objects,
+ const cl_mem* mem_objects, cl_uint num_events_in_wait_list,
+ const cl_event* event_wait_list, cl_event* event);
+
+ cl_int enqueueAcquireD3D10Objects(
+ const VECTOR_CLASS<Memory>* mem_objects = NULL,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ static PFN_clEnqueueAcquireD3D10ObjectsKHR pfn_clEnqueueAcquireD3D10ObjectsKHR = NULL;
+ __INIT_CL_EXT_FCN_PTR(clEnqueueAcquireD3D10ObjectsKHR);
+
+ return detail::errHandler(
+ pfn_clEnqueueAcquireD3D10ObjectsKHR(
+ object_,
+ (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
+ (mem_objects != NULL) ? (const cl_mem *) &mem_objects->front(): NULL,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL) ? (cl_event*) &events->front() : NULL,
+ (cl_event*) event),
+ __ENQUEUE_ACQUIRE_GL_ERR);
+ }
+
+ cl_int enqueueReleaseD3D10Objects(
+ const VECTOR_CLASS<Memory>* mem_objects = NULL,
+ const VECTOR_CLASS<Event>* events = NULL,
+ Event* event = NULL) const
+ {
+ static PFN_clEnqueueReleaseD3D10ObjectsKHR pfn_clEnqueueReleaseD3D10ObjectsKHR = NULL;
+ __INIT_CL_EXT_FCN_PTR(clEnqueueReleaseD3D10ObjectsKHR);
+
+ return detail::errHandler(
+ pfn_clEnqueueReleaseD3D10ObjectsKHR(
+ object_,
+ (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
+ (mem_objects != NULL) ? (const cl_mem *) &mem_objects->front(): NULL,
+ (events != NULL) ? (cl_uint) events->size() : 0,
+ (events != NULL) ? (cl_event*) &events->front() : NULL,
+ (cl_event*) event),
+ __ENQUEUE_RELEASE_GL_ERR);
+ }
+#endif
+
+ cl_int enqueueBarrier() const
+ {
+ return detail::errHandler(
+ ::clEnqueueBarrier(object_),
+ __ENQUEUE_BARRIER_ERR);
+ }
+
+ cl_int flush() const
+ {
+ return detail::errHandler(::clFlush(object_), __FLUSH_ERR);
+ }
+
+ cl_int finish() const
+ {
+ return detail::errHandler(::clFinish(object_), __FINISH_ERR);
+ }
+};
+
+__GET_INFO_HELPER_WITH_RETAIN(cl::CommandQueue)
+
+/*! \class KernelFunctor
+ * \brief Kernel functor interface
+ *
+ * \note Currently only functors of zero to ten arguments are supported. It
+ * is straightforward to add more and a more general solution, similar to
+ * Boost.Lambda could be followed if required in the future.
+ */
+class KernelFunctor
+{
+private:
+ Kernel kernel_;
+ CommandQueue queue_;
+ NDRange offset_;
+ NDRange global_;
+ NDRange local_;
+
+ cl_int err_;
+public:
+ KernelFunctor() { }
+
+ KernelFunctor(
+ const Kernel& kernel,
+ const CommandQueue& queue,
+ const NDRange& offset,
+ const NDRange& global,
+ const NDRange& local) :
+ kernel_(kernel),
+ queue_(queue),
+ offset_(offset),
+ global_(global),
+ local_(local),
+ err_(CL_SUCCESS)
+ {}
+
+ KernelFunctor& operator=(const KernelFunctor& rhs);
+
+ KernelFunctor(const KernelFunctor& rhs);
+
+ cl_int getError() { return err_; }
+
+ inline Event operator()(const VECTOR_CLASS<Event>* events = NULL);
+
+ template<typename A1>
+ inline Event operator()(
+ const A1& a1,
+ const VECTOR_CLASS<Event>* events = NULL);
+
+ template<class A1, class A2>
+ inline Event operator()(
+ const A1& a1,
+ const A2& a2,
+ const VECTOR_CLASS<Event>* events = NULL);
+
+ template<class A1, class A2, class A3>
+ inline Event operator()(
+ const A1& a1,
+ const A2& a2,
+ const A3& a3,
+ const VECTOR_CLASS<Event>* events = NULL);
+
+ template<class A1, class A2, class A3, class A4>
+ inline Event operator()(
+ const A1& a1,
+ const A2& a2,
+ const A3& a3,
+ const A4& a4,
+ const VECTOR_CLASS<Event>* events = NULL);
+
+ template<class A1, class A2, class A3, class A4, class A5>
+ inline Event operator()(
+ const A1& a1,
+ const A2& a2,
+ const A3& a3,
+ const A4& a4,
+ const A5& a5,
+ const VECTOR_CLASS<Event>* events = NULL);
+
+ template<class A1, class A2, class A3, class A4, class A5, class A6>
+ inline Event operator()(
+ const A1& a1,
+ const A2& a2,
+ const A3& a3,
+ const A4& a4,
+ const A5& a5,
+ const A6& a6,
+ const VECTOR_CLASS<Event>* events = NULL);
+
+ template<class A1, class A2, class A3, class A4,
+ class A5, class A6, class A7>
+ inline Event operator()(
+ const A1& a1,
+ const A2& a2,
+ const A3& a3,
+ const A4& a4,
+ const A5& a5,
+ const A6& a6,
+ const A7& a7,
+ const VECTOR_CLASS<Event>* events = NULL);
+
+ template<class A1, class A2, class A3, class A4, class A5,
+ class A6, class A7, class A8>
+ inline Event operator()(
+ const A1& a1,
+ const A2& a2,
+ const A3& a3,
+ const A4& a4,
+ const A5& a5,
+ const A6& a6,
+ const A7& a7,
+ const A8& a8,
+ const VECTOR_CLASS<Event>* events = NULL);
+
+ template<class A1, class A2, class A3, class A4, class A5,
+ class A6, class A7, class A8, class A9>
+ inline Event operator()(
+ const A1& a1,
+ const A2& a2,
+ const A3& a3,
+ const A4& a4,
+ const A5& a5,
+ const A6& a6,
+ const A7& a7,
+ const A8& a8,
+ const A9& a9,
+ const VECTOR_CLASS<Event>* events = NULL);
+
+ template<class A1, class A2, class A3, class A4, class A5,
+ class A6, class A7, class A8, class A9, class A10>
+ inline Event operator()(
+ const A1& a1,
+ const A2& a2,
+ const A3& a3,
+ const A4& a4,
+ const A5& a5,
+ const A6& a6,
+ const A7& a7,
+ const A8& a8,
+ const A9& a9,
+ const A10& a10,
+ const VECTOR_CLASS<Event>* events = NULL);
+
+ template<class A1, class A2, class A3, class A4, class A5,
+ class A6, class A7, class A8, class A9, class A10,
+ class A11>
+ inline Event operator()(
+ const A1& a1,
+ const A2& a2,
+ const A3& a3,
+ const A4& a4,
+ const A5& a5,
+ const A6& a6,
+ const A7& a7,
+ const A8& a8,
+ const A9& a9,
+ const A10& a10,
+ const A11& a11,
+ const VECTOR_CLASS<Event>* events = NULL);
+
+ template<class A1, class A2, class A3, class A4, class A5,
+ class A6, class A7, class A8, class A9, class A10,
+ class A11, class A12>
+ inline Event operator()(
+ const A1& a1,
+ const A2& a2,
+ const A3& a3,
+ const A4& a4,
+ const A5& a5,
+ const A6& a6,
+ const A7& a7,
+ const A8& a8,
+ const A9& a9,
+ const A10& a10,
+ const A11& a11,
+ const A12& a12,
+ const VECTOR_CLASS<Event>* events = NULL);
+
+ template<class A1, class A2, class A3, class A4, class A5,
+ class A6, class A7, class A8, class A9, class A10,
+ class A11, class A12, class A13>
+ inline Event operator()(
+ const A1& a1,
+ const A2& a2,
+ const A3& a3,
+ const A4& a4,
+ const A5& a5,
+ const A6& a6,
+ const A7& a7,
+ const A8& a8,
+ const A9& a9,
+ const A10& a10,
+ const A11& a11,
+ const A12& a12,
+ const A13& a13,
+ const VECTOR_CLASS<Event>* events = NULL);
+
+ template<class A1, class A2, class A3, class A4, class A5,
+ class A6, class A7, class A8, class A9, class A10,
+ class A11, class A12, class A13, class A14>
+ inline Event operator()(
+ const A1& a1,
+ const A2& a2,
+ const A3& a3,
+ const A4& a4,
+ const A5& a5,
+ const A6& a6,
+ const A7& a7,
+ const A8& a8,
+ const A9& a9,
+ const A10& a10,
+ const A11& a11,
+ const A12& a12,
+ const A13& a13,
+ const A14& a14,
+ const VECTOR_CLASS<Event>* events = NULL);
+
+ template<class A1, class A2, class A3, class A4, class A5,
+ class A6, class A7, class A8, class A9, class A10,
+ class A11, class A12, class A13, class A14, class A15>
+ inline Event operator()(
+ const A1& a1,
+ const A2& a2,
+ const A3& a3,
+ const A4& a4,
+ const A5& a5,
+ const A6& a6,
+ const A7& a7,
+ const A8& a8,
+ const A9& a9,
+ const A10& a10,
+ const A11& a11,
+ const A12& a12,
+ const A13& a13,
+ const A14& a14,
+ const A15& a15,
+ const VECTOR_CLASS<Event>* events = NULL);
+};
+
+inline KernelFunctor Kernel::bind(
+ const CommandQueue& queue,
+ const NDRange& offset,
+ const NDRange& global,
+ const NDRange& local)
+{
+ return KernelFunctor(*this,queue,offset,global,local);
+}
+
+inline KernelFunctor Kernel::bind(
+ const CommandQueue& queue,
+ const NDRange& global,
+ const NDRange& local)
+{
+ return KernelFunctor(*this,queue,NullRange,global,local);
+}
+
+inline KernelFunctor& KernelFunctor::operator=(const KernelFunctor& rhs)
+{
+ if (this == &rhs) {
+ return *this;
+ }
+
+ kernel_ = rhs.kernel_;
+ queue_ = rhs.queue_;
+ offset_ = rhs.offset_;
+ global_ = rhs.global_;
+ local_ = rhs.local_;
+
+ return *this;
+}
+
+inline KernelFunctor::KernelFunctor(const KernelFunctor& rhs) :
+ kernel_(rhs.kernel_),
+ queue_(rhs.queue_),
+ offset_(rhs.offset_),
+ global_(rhs.global_),
+ local_(rhs.local_)
+{
+}
+
+Event KernelFunctor::operator()(const VECTOR_CLASS<Event>* events)
+{
+ Event event;
+
+ err_ = queue_.enqueueNDRangeKernel(
+ kernel_,
+ offset_,
+ global_,
+ local_,
+ NULL, // bgaster_fixme - do we want to allow wait event lists?
+ &event);
+
+ return event;
+}
+
+template<typename A1>
+Event KernelFunctor::operator()(
+ const A1& a1,
+ const VECTOR_CLASS<Event>* events)
+{
+ Event event;
+
+ kernel_.setArg(0,a1);
+
+ err_ = queue_.enqueueNDRangeKernel(
+ kernel_,
+ offset_,
+ global_,
+ local_,
+ NULL, // bgaster_fixme - do we want to allow wait event lists?
+ &event);
+
+ return event;
+}
+
+template<typename A1, typename A2>
+Event KernelFunctor::operator()(
+ const A1& a1,
+ const A2& a2,
+ const VECTOR_CLASS<Event>* events)
+{
+ Event event;
+
+ kernel_.setArg(0,a1);
+ kernel_.setArg(1,a2);
+
+ err_ = queue_.enqueueNDRangeKernel(
+ kernel_,
+ offset_,
+ global_,
+ local_,
+ NULL, // bgaster_fixme - do we want to allow wait event lists?
+ &event);
+
+ return event;
+}
+
+template<typename A1, typename A2, typename A3>
+Event KernelFunctor::operator()(
+ const A1& a1,
+ const A2& a2,
+ const A3& a3,
+ const VECTOR_CLASS<Event>* events)
+{
+ Event event;
+
+ kernel_.setArg(0,a1);
+ kernel_.setArg(1,a2);
+ kernel_.setArg(2,a3);
+
+ err_ = queue_.enqueueNDRangeKernel(
+ kernel_,
+ offset_,
+ global_,
+ local_,
+ NULL, // bgaster_fixme - do we want to allow wait event lists?
+ &event);
+
+ return event;
+}
+
+template<typename A1, typename A2, typename A3, typename A4>
+Event KernelFunctor::operator()(
+ const A1& a1,
+ const A2& a2,
+ const A3& a3,
+ const A4& a4,
+ const VECTOR_CLASS<Event>* events)
+{
+ Event event;
+
+ kernel_.setArg(0,a1);
+ kernel_.setArg(1,a2);
+ kernel_.setArg(2,a3);
+ kernel_.setArg(3,a4);
+
+ err_ = queue_.enqueueNDRangeKernel(
+ kernel_,
+ offset_,
+ global_,
+ local_,
+ NULL, // bgaster_fixme - do we want to allow wait event lists?
+ &event);
+
+ return event;
+}
+
+template<typename A1, typename A2, typename A3, typename A4, typename A5>
+Event KernelFunctor::operator()(
+ const A1& a1,
+ const A2& a2,
+ const A3& a3,
+ const A4& a4,
+ const A5& a5,
+ const VECTOR_CLASS<Event>* events)
+{
+ Event event;
+
+ kernel_.setArg(0,a1);
+ kernel_.setArg(1,a2);
+ kernel_.setArg(2,a3);
+ kernel_.setArg(3,a4);
+ kernel_.setArg(4,a5);
+
+ err_ = queue_.enqueueNDRangeKernel(
+ kernel_,
+ offset_,
+ global_,
+ local_,
+ NULL, // bgaster_fixme - do we want to allow wait event lists?
+ &event);
+
+ return event;
+}
+
+template<typename A1, typename A2, typename A3, typename A4, typename A5,
+ typename A6>
+Event KernelFunctor::operator()(
+ const A1& a1,
+ const A2& a2,
+ const A3& a3,
+ const A4& a4,
+ const A5& a5,
+ const A6& a6,
+ const VECTOR_CLASS<Event>* events)
+{
+ Event event;
+
+ kernel_.setArg(0,a1);
+ kernel_.setArg(1,a2);
+ kernel_.setArg(2,a3);
+ kernel_.setArg(3,a4);
+ kernel_.setArg(4,a5);
+ kernel_.setArg(5,a6);
+
+ err_ = queue_.enqueueNDRangeKernel(
+ kernel_,
+ offset_,
+ global_,
+ local_,
+ NULL, // bgaster_fixme - do we want to allow wait event lists?
+ &event);
+
+ return event;
+}
+
+template<typename A1, typename A2, typename A3, typename A4,
+ typename A5, typename A6, typename A7>
+Event KernelFunctor::operator()(
+ const A1& a1,
+ const A2& a2,
+ const A3& a3,
+ const A4& a4,
+ const A5& a5,
+ const A6& a6,
+ const A7& a7,
+ const VECTOR_CLASS<Event>* events)
+{
+ Event event;
+
+ kernel_.setArg(0,a1);
+ kernel_.setArg(1,a2);
+ kernel_.setArg(2,a3);
+ kernel_.setArg(3,a4);
+ kernel_.setArg(4,a5);
+ kernel_.setArg(5,a6);
+ kernel_.setArg(6,a7);
+
+ err_ = queue_.enqueueNDRangeKernel(
+ kernel_,
+ offset_,
+ global_,
+ local_,
+ NULL, // bgaster_fixme - do we want to allow wait event lists?
+ &event);
+
+ return event;
+}
+
+template<typename A1, typename A2, typename A3, typename A4, typename A5,
+ typename A6, typename A7, typename A8>
+Event KernelFunctor::operator()(
+ const A1& a1,
+ const A2& a2,
+ const A3& a3,
+ const A4& a4,
+ const A5& a5,
+ const A6& a6,
+ const A7& a7,
+ const A8& a8,
+ const VECTOR_CLASS<Event>* events)
+{
+ Event event;
+
+ kernel_.setArg(0,a1);
+ kernel_.setArg(1,a2);
+ kernel_.setArg(2,a3);
+ kernel_.setArg(3,a4);
+ kernel_.setArg(4,a5);
+ kernel_.setArg(5,a6);
+ kernel_.setArg(6,a7);
+ kernel_.setArg(7,a8);
+
+ err_ = queue_.enqueueNDRangeKernel(
+ kernel_,
+ offset_,
+ global_,
+ local_,
+ NULL, // bgaster_fixme - do we want to allow wait event lists?
+ &event);
+
+ return event;
+}
+
+template<typename A1, typename A2, typename A3, typename A4, typename A5,
+ typename A6, typename A7, typename A8, typename A9>
+Event KernelFunctor::operator()(
+ const A1& a1,
+ const A2& a2,
+ const A3& a3,
+ const A4& a4,
+ const A5& a5,
+ const A6& a6,
+ const A7& a7,
+ const A8& a8,
+ const A9& a9,
+ const VECTOR_CLASS<Event>* events)
+{
+ Event event;
+
+ kernel_.setArg(0,a1);
+ kernel_.setArg(1,a2);
+ kernel_.setArg(2,a3);
+ kernel_.setArg(3,a4);
+ kernel_.setArg(4,a5);
+ kernel_.setArg(5,a6);
+ kernel_.setArg(6,a7);
+ kernel_.setArg(7,a8);
+ kernel_.setArg(8,a9);
+
+ err_ = queue_.enqueueNDRangeKernel(
+ kernel_,
+ offset_,
+ global_,
+ local_,
+ NULL, // bgaster_fixme - do we want to allow wait event lists?
+ &event);
+
+ return event;
+}
+
+template<typename A1, typename A2, typename A3, typename A4, typename A5,
+ typename A6, typename A7, typename A8, typename A9, typename A10>
+Event KernelFunctor::operator()(
+ const A1& a1,
+ const A2& a2,
+ const A3& a3,
+ const A4& a4,
+ const A5& a5,
+ const A6& a6,
+ const A7& a7,
+ const A8& a8,
+ const A9& a9,
+ const A10& a10,
+ const VECTOR_CLASS<Event>* events)
+{
+ Event event;
+
+ kernel_.setArg(0,a1);
+ kernel_.setArg(1,a2);
+ kernel_.setArg(2,a3);
+ kernel_.setArg(3,a4);
+ kernel_.setArg(4,a5);
+ kernel_.setArg(5,a6);
+ kernel_.setArg(6,a7);
+ kernel_.setArg(7,a8);
+ kernel_.setArg(8,a9);
+ kernel_.setArg(9,a10);
+
+ err_ = queue_.enqueueNDRangeKernel(
+ kernel_,
+ offset_,
+ global_,
+ local_,
+ NULL, // bgaster_fixme - do we want to allow wait event lists?
+ &event);
+
+ return event;
+}
+
+template<class A1, class A2, class A3, class A4, class A5,
+ class A6, class A7, class A8, class A9, class A10,
+ class A11>
+Event KernelFunctor::operator()(
+ const A1& a1,
+ const A2& a2,
+ const A3& a3,
+ const A4& a4,
+ const A5& a5,
+ const A6& a6,
+ const A7& a7,
+ const A8& a8,
+ const A9& a9,
+ const A10& a10,
+ const A11& a11,
+ const VECTOR_CLASS<Event>* events)
+{
+ Event event;
+
+ kernel_.setArg(0,a1);
+ kernel_.setArg(1,a2);
+ kernel_.setArg(2,a3);
+ kernel_.setArg(3,a4);
+ kernel_.setArg(4,a5);
+ kernel_.setArg(5,a6);
+ kernel_.setArg(6,a7);
+ kernel_.setArg(7,a8);
+ kernel_.setArg(8,a9);
+ kernel_.setArg(9,a10);
+ kernel_.setArg(10,a11);
+
+ err_ = queue_.enqueueNDRangeKernel(
+ kernel_,
+ offset_,
+ global_,
+ local_,
+ NULL, // bgaster_fixme - do we want to allow wait event lists?
+ &event);
+
+ return event;
+}
+
+template<class A1, class A2, class A3, class A4, class A5,
+ class A6, class A7, class A8, class A9, class A10,
+ class A11, class A12>
+Event KernelFunctor::operator()(
+ const A1& a1,
+ const A2& a2,
+ const A3& a3,
+ const A4& a4,
+ const A5& a5,
+ const A6& a6,
+ const A7& a7,
+ const A8& a8,
+ const A9& a9,
+ const A10& a10,
+ const A11& a11,
+ const A12& a12,
+ const VECTOR_CLASS<Event>* events)
+{
+ Event event;
+
+ kernel_.setArg(0,a1);
+ kernel_.setArg(1,a2);
+ kernel_.setArg(2,a3);
+ kernel_.setArg(3,a4);
+ kernel_.setArg(4,a5);
+ kernel_.setArg(5,a6);
+ kernel_.setArg(6,a7);
+ kernel_.setArg(7,a8);
+ kernel_.setArg(8,a9);
+ kernel_.setArg(9,a10);
+ kernel_.setArg(10,a11);
+ kernel_.setArg(11,a12);
+
+ err_ = queue_.enqueueNDRangeKernel(
+ kernel_,
+ offset_,
+ global_,
+ local_,
+ NULL, // bgaster_fixme - do we want to allow wait event lists?
+ &event);
+
+ return event;
+}
+
+template<class A1, class A2, class A3, class A4, class A5,
+ class A6, class A7, class A8, class A9, class A10,
+ class A11, class A12, class A13>
+Event KernelFunctor::operator()(
+ const A1& a1,
+ const A2& a2,
+ const A3& a3,
+ const A4& a4,
+ const A5& a5,
+ const A6& a6,
+ const A7& a7,
+ const A8& a8,
+ const A9& a9,
+ const A10& a10,
+ const A11& a11,
+ const A12& a12,
+ const A13& a13,
+ const VECTOR_CLASS<Event>* events)
+{
+ Event event;
+
+ kernel_.setArg(0,a1);
+ kernel_.setArg(1,a2);
+ kernel_.setArg(2,a3);
+ kernel_.setArg(3,a4);
+ kernel_.setArg(4,a5);
+ kernel_.setArg(5,a6);
+ kernel_.setArg(6,a7);
+ kernel_.setArg(7,a8);
+ kernel_.setArg(8,a9);
+ kernel_.setArg(9,a10);
+ kernel_.setArg(10,a11);
+ kernel_.setArg(11,a12);
+ kernel_.setArg(12,a13);
+
+ err_ = queue_.enqueueNDRangeKernel(
+ kernel_,
+ offset_,
+ global_,
+ local_,
+ NULL, // bgaster_fixme - do we want to allow wait event lists?
+ &event);
+
+ return event;
+}
+
+template<class A1, class A2, class A3, class A4, class A5,
+ class A6, class A7, class A8, class A9, class A10,
+ class A11, class A12, class A13, class A14>
+Event KernelFunctor::operator()(
+ const A1& a1,
+ const A2& a2,
+ const A3& a3,
+ const A4& a4,
+ const A5& a5,
+ const A6& a6,
+ const A7& a7,
+ const A8& a8,
+ const A9& a9,
+ const A10& a10,
+ const A11& a11,
+ const A12& a12,
+ const A13& a13,
+ const A14& a14,
+ const VECTOR_CLASS<Event>* events)
+{
+ Event event;
+
+ kernel_.setArg(0,a1);
+ kernel_.setArg(1,a2);
+ kernel_.setArg(2,a3);
+ kernel_.setArg(3,a4);
+ kernel_.setArg(4,a5);
+ kernel_.setArg(5,a6);
+ kernel_.setArg(6,a7);
+ kernel_.setArg(7,a8);
+ kernel_.setArg(8,a9);
+ kernel_.setArg(9,a10);
+ kernel_.setArg(10,a11);
+ kernel_.setArg(11,a12);
+ kernel_.setArg(12,a13);
+ kernel_.setArg(13,a14);
+
+ err_ = queue_.enqueueNDRangeKernel(
+ kernel_,
+ offset_,
+ global_,
+ local_,
+ NULL, // bgaster_fixme - do we want to allow wait event lists?
+ &event);
+
+ return event;
+}
+
+template<class A1, class A2, class A3, class A4, class A5,
+ class A6, class A7, class A8, class A9, class A10,
+ class A11, class A12, class A13, class A14, class A15>
+Event KernelFunctor::operator()(
+ const A1& a1,
+ const A2& a2,
+ const A3& a3,
+ const A4& a4,
+ const A5& a5,
+ const A6& a6,
+ const A7& a7,
+ const A8& a8,
+ const A9& a9,
+ const A10& a10,
+ const A11& a11,
+ const A12& a12,
+ const A13& a13,
+ const A14& a14,
+ const A15& a15,
+ const VECTOR_CLASS<Event>* events)
+{
+ Event event;
+
+ kernel_.setArg(0,a1);
+ kernel_.setArg(1,a2);
+ kernel_.setArg(2,a3);
+ kernel_.setArg(3,a4);
+ kernel_.setArg(4,a5);
+ kernel_.setArg(5,a6);
+ kernel_.setArg(6,a7);
+ kernel_.setArg(7,a8);
+ kernel_.setArg(8,a9);
+ kernel_.setArg(9,a10);
+ kernel_.setArg(10,a11);
+ kernel_.setArg(11,a12);
+ kernel_.setArg(12,a13);
+ kernel_.setArg(13,a14);
+ kernel_.setArg(14,a15);
+
+ err_ = queue_.enqueueNDRangeKernel(
+ kernel_,
+ offset_,
+ global_,
+ local_,
+ NULL, // bgaster_fixme - do we want to allow wait event lists?
+ &event);
+
+ return event;
+}
+
+#undef __ERR_STR
+#if !defined(__CL_USER_OVERRIDE_ERROR_STRINGS)
+#undef __GET_DEVICE_INFO_ERR
+#undef __GET_PLATFORM_INFO_ERR
+#undef __GET_DEVICE_IDS_ERR
+#undef __GET_CONTEXT_INFO_ERR
+#undef __GET_EVENT_INFO_ERR
+#undef __GET_EVENT_PROFILE_INFO_ERR
+#undef __GET_MEM_OBJECT_INFO_ERR
+#undef __GET_IMAGE_INFO_ERR
+#undef __GET_SAMPLER_INFO_ERR
+#undef __GET_KERNEL_INFO_ERR
+#undef __GET_KERNEL_WORK_GROUP_INFO_ERR
+#undef __GET_PROGRAM_INFO_ERR
+#undef __GET_PROGRAM_BUILD_INFO_ERR
+#undef __GET_COMMAND_QUEUE_INFO_ERR
+
+#undef __CREATE_CONTEXT_FROM_TYPE_ERR
+#undef __GET_SUPPORTED_IMAGE_FORMATS_ERR
+
+#undef __CREATE_BUFFER_ERR
+#undef __CREATE_SUBBUFFER_ERR
+#undef __CREATE_IMAGE2D_ERR
+#undef __CREATE_IMAGE3D_ERR
+#undef __CREATE_SAMPLER_ERR
+#undef __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR
+
+#undef __CREATE_USER_EVENT_ERR
+#undef __SET_USER_EVENT_STATUS_ERR
+#undef __SET_EVENT_CALLBACK_ERR
+
+#undef __WAIT_FOR_EVENTS_ERR
+
+#undef __CREATE_KERNEL_ERR
+#undef __SET_KERNEL_ARGS_ERR
+#undef __CREATE_PROGRAM_WITH_SOURCE_ERR
+#undef __CREATE_PROGRAM_WITH_BINARY_ERR
+#undef __BUILD_PROGRAM_ERR
+#undef __CREATE_KERNELS_IN_PROGRAM_ERR
+
+#undef __CREATE_COMMAND_QUEUE_ERR
+#undef __SET_COMMAND_QUEUE_PROPERTY_ERR
+#undef __ENQUEUE_READ_BUFFER_ERR
+#undef __ENQUEUE_WRITE_BUFFER_ERR
+#undef __ENQUEUE_READ_BUFFER_RECT_ERR
+#undef __ENQUEUE_WRITE_BUFFER_RECT_ERR
+#undef __ENQEUE_COPY_BUFFER_ERR
+#undef __ENQEUE_COPY_BUFFER_RECT_ERR
+#undef __ENQUEUE_READ_IMAGE_ERR
+#undef __ENQUEUE_WRITE_IMAGE_ERR
+#undef __ENQUEUE_COPY_IMAGE_ERR
+#undef __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR
+#undef __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR
+#undef __ENQUEUE_MAP_BUFFER_ERR
+#undef __ENQUEUE_MAP_IMAGE_ERR
+#undef __ENQUEUE_UNMAP_MEM_OBJECT_ERR
+#undef __ENQUEUE_NDRANGE_KERNEL_ERR
+#undef __ENQUEUE_TASK_ERR
+#undef __ENQUEUE_NATIVE_KERNEL
+
+#undef __UNLOAD_COMPILER_ERR
+#endif //__CL_USER_OVERRIDE_ERROR_STRINGS
+
+#undef __GET_INFO_HELPER_WITH_RETAIN
+
+// Extensions
+#undef __INIT_CL_EXT_FCN_PTR
+#undef __CREATE_SUB_DEVICES
+
+#if defined(USE_CL_DEVICE_FISSION)
+#undef __PARAM_NAME_DEVICE_FISSION
+#endif // USE_CL_DEVICE_FISSION
+
+} // namespace cl
+
+#endif // CL_HPP_
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2008-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.
+ ******************************************************************************/
+
+/* $Revision: 11928 $ on $Date: 2010-07-13 09:04:56 -0700 (Tue, 13 Jul 2010) $ */
+
+/* cl_ext.h contains OpenCL extensions which don't have external */
+/* (OpenGL, D3D) dependencies. */
+
+#ifndef __CL_EXT_H
+#define __CL_EXT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __APPLE__
+ #include <OpenCL/cl.h>
+ #include <AvailabilityMacros.h>
+#else
+ #include <CL/cl.h>
+#endif
+
+/* cl_khr_fp64 extension - no extension #define since it has no functions */
+#define CL_DEVICE_DOUBLE_FP_CONFIG 0x1032
+
+/* cl_khr_fp16 extension - no extension #define since it has no functions */
+#define CL_DEVICE_HALF_FP_CONFIG 0x1033
+
+/* Memory object destruction
+ *
+ * Apple extension for use to manage externally allocated buffers used with cl_mem objects with CL_MEM_USE_HOST_PTR
+ *
+ * Registers a user callback function that will be called when the memory object is deleted and its resources
+ * freed. Each call to clSetMemObjectCallbackFn registers the specified user callback function on a callback
+ * stack associated with memobj. The registered user callback functions are called in the reverse order in
+ * which they were registered. The user callback functions are called and then the memory object is deleted
+ * and its resources freed. This provides a mechanism for the application (and libraries) using memobj to be
+ * notified when the memory referenced by host_ptr, specified when the memory object is created and used as
+ * the storage bits for the memory object, can be reused or freed.
+ *
+ * The application may not call CL api's with the cl_mem object passed to the pfn_notify.
+ *
+ * Please check for the "cl_APPLE_SetMemObjectDestructor" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS)
+ * before using.
+ */
+#define cl_APPLE_SetMemObjectDestructor 1
+cl_int CL_API_ENTRY clSetMemObjectDestructorAPPLE( cl_mem /* memobj */,
+ void (* /*pfn_notify*/)( cl_mem /* memobj */, void* /*user_data*/),
+ void * /*user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
+
+
+/* Context Logging Functions
+ *
+ * The next three convenience functions are intended to be used as the pfn_notify parameter to clCreateContext().
+ * Please check for the "cl_APPLE_ContextLoggingFunctions" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS)
+ * before using.
+ *
+ * clLogMessagesToSystemLog fowards on all log messages to the Apple System Logger
+ */
+#define cl_APPLE_ContextLoggingFunctions 1
+extern void CL_API_ENTRY clLogMessagesToSystemLogAPPLE( const char * /* errstr */,
+ const void * /* private_info */,
+ size_t /* cb */,
+ void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
+
+/* clLogMessagesToStdout sends all log messages to the file descriptor stdout */
+extern void CL_API_ENTRY clLogMessagesToStdoutAPPLE( const char * /* errstr */,
+ const void * /* private_info */,
+ size_t /* cb */,
+ void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
+
+/* clLogMessagesToStderr sends all log messages to the file descriptor stderr */
+extern void CL_API_ENTRY clLogMessagesToStderrAPPLE( const char * /* errstr */,
+ const void * /* private_info */,
+ size_t /* cb */,
+ void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
+
+
+/************************
+* cl_khr_icd extension *
+************************/
+#define cl_khr_icd 1
+
+/* cl_platform_info */
+#define CL_PLATFORM_ICD_SUFFIX_KHR 0x0920
+
+/* Additional Error Codes */
+#define CL_PLATFORM_NOT_FOUND_KHR -1001
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clIcdGetPlatformIDsKHR(cl_uint /* num_entries */,
+ cl_platform_id * /* platforms */,
+ cl_uint * /* num_platforms */);
+
+typedef CL_API_ENTRY cl_int (CL_API_CALL *clIcdGetPlatformIDsKHR_fn)(
+ cl_uint /* num_entries */,
+ cl_platform_id * /* platforms */,
+ cl_uint * /* num_platforms */);
+
+
+/******************************************
+* cl_nv_device_attribute_query extension *
+******************************************/
+/* cl_nv_device_attribute_query extension - no extension #define since it has no functions */
+#define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
+#define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
+#define CL_DEVICE_REGISTERS_PER_BLOCK_NV 0x4002
+#define CL_DEVICE_WARP_SIZE_NV 0x4003
+#define CL_DEVICE_GPU_OVERLAP_NV 0x4004
+#define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
+#define CL_DEVICE_INTEGRATED_MEMORY_NV 0x4006
+
+
+/*********************************
+* cl_amd_device_attribute_query *
+*********************************/
+#define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD 0x4036
+
+
+#ifdef CL_VERSION_1_1
+ /***********************************
+ * cl_ext_device_fission extension *
+ ***********************************/
+ #define cl_ext_device_fission 1
+
+ extern CL_API_ENTRY cl_int CL_API_CALL
+ clReleaseDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
+
+ typedef CL_API_ENTRY cl_int
+ (CL_API_CALL *clReleaseDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
+
+ extern CL_API_ENTRY cl_int CL_API_CALL
+ clRetainDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
+
+ typedef CL_API_ENTRY cl_int
+ (CL_API_CALL *clRetainDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
+
+ typedef cl_ulong cl_device_partition_property_ext;
+ extern CL_API_ENTRY cl_int CL_API_CALL
+ clCreateSubDevicesEXT( cl_device_id /*in_device*/,
+ const cl_device_partition_property_ext * /* properties */,
+ cl_uint /*num_entries*/,
+ cl_device_id * /*out_devices*/,
+ cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
+
+ typedef CL_API_ENTRY cl_int
+ ( CL_API_CALL * clCreateSubDevicesEXT_fn)( cl_device_id /*in_device*/,
+ const cl_device_partition_property_ext * /* properties */,
+ cl_uint /*num_entries*/,
+ cl_device_id * /*out_devices*/,
+ cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
+
+ /* cl_device_partition_property_ext */
+ #define CL_DEVICE_PARTITION_EQUALLY_EXT 0x4050
+ #define CL_DEVICE_PARTITION_BY_COUNTS_EXT 0x4051
+ #define CL_DEVICE_PARTITION_BY_NAMES_EXT 0x4052
+ #define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT 0x4053
+
+ /* clDeviceGetInfo selectors */
+ #define CL_DEVICE_PARENT_DEVICE_EXT 0x4054
+ #define CL_DEVICE_PARTITION_TYPES_EXT 0x4055
+ #define CL_DEVICE_AFFINITY_DOMAINS_EXT 0x4056
+ #define CL_DEVICE_REFERENCE_COUNT_EXT 0x4057
+ #define CL_DEVICE_PARTITION_STYLE_EXT 0x4058
+
+ /* error codes */
+ #define CL_DEVICE_PARTITION_FAILED_EXT -1057
+ #define CL_INVALID_PARTITION_COUNT_EXT -1058
+ #define CL_INVALID_PARTITION_NAME_EXT -1059
+
+ /* CL_AFFINITY_DOMAINs */
+ #define CL_AFFINITY_DOMAIN_L1_CACHE_EXT 0x1
+ #define CL_AFFINITY_DOMAIN_L2_CACHE_EXT 0x2
+ #define CL_AFFINITY_DOMAIN_L3_CACHE_EXT 0x3
+ #define CL_AFFINITY_DOMAIN_L4_CACHE_EXT 0x4
+ #define CL_AFFINITY_DOMAIN_NUMA_EXT 0x10
+ #define CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT 0x100
+
+ /* cl_device_partition_property_ext list terminators */
+ #define CL_PROPERTIES_LIST_END_EXT ((cl_device_partition_property_ext) 0)
+ #define CL_PARTITION_BY_COUNTS_LIST_END_EXT ((cl_device_partition_property_ext) 0)
+ #define CL_PARTITION_BY_NAMES_LIST_END_EXT ((cl_device_partition_property_ext) 0 - 1)
+
+
+
+#endif /* CL_VERSION_1_1 */
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* __CL_EXT_H */
--- /dev/null
+/**********************************************************************************
+ * Copyright (c) 2008-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.
+ **********************************************************************************/
+
+/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
+
+/*
+ * cl_gl.h contains Khronos-approved (KHR) OpenCL extensions which have
+ * OpenGL dependencies. The application is responsible for #including
+ * OpenGL or OpenGL ES headers before #including cl_gl.h.
+ */
+
+#ifndef __OPENCL_CL_GL_H
+#define __OPENCL_CL_GL_H
+
+#ifdef __APPLE__
+#include <OpenCL/cl.h>
+#include <OpenGL/CGLDevice.h>
+#else
+#include <CL/cl.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef cl_uint cl_gl_object_type;
+typedef cl_uint cl_gl_texture_info;
+typedef cl_uint cl_gl_platform_info;
+typedef struct __GLsync *cl_GLsync;
+
+/* cl_gl_object_type */
+#define CL_GL_OBJECT_BUFFER 0x2000
+#define CL_GL_OBJECT_TEXTURE2D 0x2001
+#define CL_GL_OBJECT_TEXTURE3D 0x2002
+#define CL_GL_OBJECT_RENDERBUFFER 0x2003
+
+/* cl_gl_texture_info */
+#define CL_GL_TEXTURE_TARGET 0x2004
+#define CL_GL_MIPMAP_LEVEL 0x2005
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateFromGLBuffer(cl_context /* context */,
+ cl_mem_flags /* flags */,
+ cl_GLuint /* bufobj */,
+ int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateFromGLTexture2D(cl_context /* context */,
+ cl_mem_flags /* flags */,
+ cl_GLenum /* target */,
+ cl_GLint /* miplevel */,
+ cl_GLuint /* texture */,
+ cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateFromGLTexture3D(cl_context /* context */,
+ cl_mem_flags /* flags */,
+ cl_GLenum /* target */,
+ cl_GLint /* miplevel */,
+ cl_GLuint /* texture */,
+ cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_mem CL_API_CALL
+clCreateFromGLRenderbuffer(cl_context /* context */,
+ cl_mem_flags /* flags */,
+ cl_GLuint /* renderbuffer */,
+ cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetGLObjectInfo(cl_mem /* memobj */,
+ cl_gl_object_type * /* gl_object_type */,
+ cl_GLuint * /* gl_object_name */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetGLTextureInfo(cl_mem /* memobj */,
+ cl_gl_texture_info /* param_name */,
+ size_t /* param_value_size */,
+ void * /* param_value */,
+ size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueAcquireGLObjects(cl_command_queue /* command_queue */,
+ cl_uint /* num_objects */,
+ const cl_mem * /* mem_objects */,
+ cl_uint /* num_events_in_wait_list */,
+ const cl_event * /* event_wait_list */,
+ cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clEnqueueReleaseGLObjects(cl_command_queue /* command_queue */,
+ cl_uint /* num_objects */,
+ const cl_mem * /* mem_objects */,
+ cl_uint /* num_events_in_wait_list */,
+ const cl_event * /* event_wait_list */,
+ cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
+
+/* cl_khr_gl_sharing extension */
+
+#define cl_khr_gl_sharing 1
+
+typedef cl_uint cl_gl_context_info;
+
+/* Additional Error Codes */
+#define CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR -1000
+
+/* cl_gl_context_info */
+#define CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR 0x2006
+#define CL_DEVICES_FOR_GL_CONTEXT_KHR 0x2007
+
+/* Additional cl_context_properties */
+#define CL_GL_CONTEXT_KHR 0x2008
+#define CL_EGL_DISPLAY_KHR 0x2009
+#define CL_GLX_DISPLAY_KHR 0x200A
+#define CL_WGL_HDC_KHR 0x200B
+#define CL_CGL_SHAREGROUP_KHR 0x200C
+
+extern CL_API_ENTRY cl_int CL_API_CALL
+clGetGLContextInfoKHR(const cl_context_properties * /* properties */,
+ cl_gl_context_info /* param_name */,
+ size_t /* param_value_size */,
+ void * /* param_value */,
+ size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
+
+typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)(
+ const cl_context_properties * properties,
+ cl_gl_context_info param_name,
+ size_t param_value_size,
+ void * param_value,
+ size_t * param_value_size_ret);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OPENCL_CL_GL_H */
--- /dev/null
+/**********************************************************************************
+ * Copyright (c) 2008-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.
+ **********************************************************************************/
+
+/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
+
+/* cl_gl_ext.h contains vendor (non-KHR) OpenCL extensions which have */
+/* OpenGL dependencies. */
+
+#ifndef __OPENCL_CL_GL_EXT_H
+#define __OPENCL_CL_GL_EXT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __APPLE__
+ #include <OpenCL/cl_gl.h>
+#else
+ #include <CL/cl_gl.h>
+#endif
+
+/*
+ * For each extension, follow this template
+ * /* cl_VEN_extname extension */
+/* #define cl_VEN_extname 1
+ * ... define new types, if any
+ * ... define new tokens, if any
+ * ... define new APIs, if any
+ *
+ * If you need GLtypes here, mirror them with a cl_GLtype, rather than including a GL header
+ * This allows us to avoid having to decide whether to include GL headers or GLES here.
+ */
+
+/*
+ * cl_khr_gl_event extension
+ * See section 9.9 in the OpenCL 1.1 spec for more information
+ */
+#define CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR 0x200D
+
+extern CL_API_ENTRY cl_event CL_API_CALL
+clCreateEventFromGLsyncKHR(cl_context /* context */,
+ cl_GLsync /* cl_GLsync */,
+ cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OPENCL_CL_GL_EXT_H */
--- /dev/null
+/**********************************************************************************
+ * Copyright (c) 2008-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.
+ **********************************************************************************/
+
+/* $Revision: 11803 $ on $Date: 2010-06-25 10:02:12 -0700 (Fri, 25 Jun 2010) $ */
+
+#ifndef __CL_PLATFORM_H
+#define __CL_PLATFORM_H
+
+#ifdef __APPLE__
+ /* Contains #defines for AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER below */
+ #include <AvailabilityMacros.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined(_WIN32)
+ #define CL_API_ENTRY
+ #define CL_API_CALL __stdcall
+ #define CL_CALLBACK __stdcall
+#else
+ #define CL_API_ENTRY
+ #define CL_API_CALL
+ #define CL_CALLBACK
+#endif
+
+#ifdef __APPLE__
+ #define CL_EXTENSION_WEAK_LINK __attribute__((weak_import))
+ #define CL_API_SUFFIX__VERSION_1_0 AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
+ #define CL_EXT_SUFFIX__VERSION_1_0 CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
+ #define CL_API_SUFFIX__VERSION_1_1 CL_EXTENSION_WEAK_LINK
+ #define CL_EXT_SUFFIX__VERSION_1_1 CL_EXTENSION_WEAK_LINK
+ #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER
+#else
+ #define CL_EXTENSION_WEAK_LINK
+ #define CL_API_SUFFIX__VERSION_1_0
+ #define CL_EXT_SUFFIX__VERSION_1_0
+ #define CL_API_SUFFIX__VERSION_1_1
+ #define CL_EXT_SUFFIX__VERSION_1_1
+ #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
+#endif
+
+#if (defined (_WIN32) && defined(_MSC_VER))
+
+/* scalar types */
+typedef signed __int8 cl_char;
+typedef unsigned __int8 cl_uchar;
+typedef signed __int16 cl_short;
+typedef unsigned __int16 cl_ushort;
+typedef signed __int32 cl_int;
+typedef unsigned __int32 cl_uint;
+typedef signed __int64 cl_long;
+typedef unsigned __int64 cl_ulong;
+
+typedef unsigned __int16 cl_half;
+typedef float cl_float;
+typedef double cl_double;
+
+/* Macro names and corresponding values defined by OpenCL */
+#define CL_CHAR_BIT 8
+#define CL_SCHAR_MAX 127
+#define CL_SCHAR_MIN (-127-1)
+#define CL_CHAR_MAX CL_SCHAR_MAX
+#define CL_CHAR_MIN CL_SCHAR_MIN
+#define CL_UCHAR_MAX 255
+#define CL_SHRT_MAX 32767
+#define CL_SHRT_MIN (-32767-1)
+#define CL_USHRT_MAX 65535
+#define CL_INT_MAX 2147483647
+#define CL_INT_MIN (-2147483647-1)
+#define CL_UINT_MAX 0xffffffffU
+#define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
+#define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
+#define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
+
+#define CL_FLT_DIG 6
+#define CL_FLT_MANT_DIG 24
+#define CL_FLT_MAX_10_EXP +38
+#define CL_FLT_MAX_EXP +128
+#define CL_FLT_MIN_10_EXP -37
+#define CL_FLT_MIN_EXP -125
+#define CL_FLT_RADIX 2
+#define CL_FLT_MAX 340282346638528859811704183484516925440.0f
+#define CL_FLT_MIN 1.175494350822287507969e-38f
+#define CL_FLT_EPSILON 0x1.0p-23f
+
+#define CL_DBL_DIG 15
+#define CL_DBL_MANT_DIG 53
+#define CL_DBL_MAX_10_EXP +308
+#define CL_DBL_MAX_EXP +1024
+#define CL_DBL_MIN_10_EXP -307
+#define CL_DBL_MIN_EXP -1021
+#define CL_DBL_RADIX 2
+#define CL_DBL_MAX 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0
+#define CL_DBL_MIN 2.225073858507201383090e-308
+#define CL_DBL_EPSILON 2.220446049250313080847e-16
+
+#define CL_M_E 2.718281828459045090796
+#define CL_M_LOG2E 1.442695040888963387005
+#define CL_M_LOG10E 0.434294481903251816668
+#define CL_M_LN2 0.693147180559945286227
+#define CL_M_LN10 2.302585092994045901094
+#define CL_M_PI 3.141592653589793115998
+#define CL_M_PI_2 1.570796326794896557999
+#define CL_M_PI_4 0.785398163397448278999
+#define CL_M_1_PI 0.318309886183790691216
+#define CL_M_2_PI 0.636619772367581382433
+#define CL_M_2_SQRTPI 1.128379167095512558561
+#define CL_M_SQRT2 1.414213562373095145475
+#define CL_M_SQRT1_2 0.707106781186547572737
+
+#define CL_M_E_F 2.71828174591064f
+#define CL_M_LOG2E_F 1.44269502162933f
+#define CL_M_LOG10E_F 0.43429449200630f
+#define CL_M_LN2_F 0.69314718246460f
+#define CL_M_LN10_F 2.30258512496948f
+#define CL_M_PI_F 3.14159274101257f
+#define CL_M_PI_2_F 1.57079637050629f
+#define CL_M_PI_4_F 0.78539818525314f
+#define CL_M_1_PI_F 0.31830987334251f
+#define CL_M_2_PI_F 0.63661974668503f
+#define CL_M_2_SQRTPI_F 1.12837922573090f
+#define CL_M_SQRT2_F 1.41421353816986f
+#define CL_M_SQRT1_2_F 0.70710676908493f
+
+#define CL_NAN (CL_INFINITY - CL_INFINITY)
+#define CL_HUGE_VALF ((cl_float) 1e50)
+#define CL_HUGE_VAL ((cl_double) 1e500)
+#define CL_MAXFLOAT CL_FLT_MAX
+#define CL_INFINITY CL_HUGE_VALF
+
+#else
+
+#include <stdint.h>
+
+/* scalar types */
+typedef int8_t cl_char;
+typedef uint8_t cl_uchar;
+typedef int16_t cl_short __attribute__((aligned(2)));
+typedef uint16_t cl_ushort __attribute__((aligned(2)));
+typedef int32_t cl_int __attribute__((aligned(4)));
+typedef uint32_t cl_uint __attribute__((aligned(4)));
+typedef int64_t cl_long __attribute__((aligned(8)));
+typedef uint64_t cl_ulong __attribute__((aligned(8)));
+
+typedef uint16_t cl_half __attribute__((aligned(2)));
+typedef float cl_float __attribute__((aligned(4)));
+typedef double cl_double __attribute__((aligned(8)));
+
+/* Macro names and corresponding values defined by OpenCL */
+#define CL_CHAR_BIT 8
+#define CL_SCHAR_MAX 127
+#define CL_SCHAR_MIN (-127-1)
+#define CL_CHAR_MAX CL_SCHAR_MAX
+#define CL_CHAR_MIN CL_SCHAR_MIN
+#define CL_UCHAR_MAX 255
+#define CL_SHRT_MAX 32767
+#define CL_SHRT_MIN (-32767-1)
+#define CL_USHRT_MAX 65535
+#define CL_INT_MAX 2147483647
+#define CL_INT_MIN (-2147483647-1)
+#define CL_UINT_MAX 0xffffffffU
+#define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
+#define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
+#define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
+
+#define CL_FLT_DIG 6
+#define CL_FLT_MANT_DIG 24
+#define CL_FLT_MAX_10_EXP +38
+#define CL_FLT_MAX_EXP +128
+#define CL_FLT_MIN_10_EXP -37
+#define CL_FLT_MIN_EXP -125
+#define CL_FLT_RADIX 2
+#define CL_FLT_MAX 0x1.fffffep127f
+#define CL_FLT_MIN 0x1.0p-126f
+#define CL_FLT_EPSILON 0x1.0p-23f
+
+#define CL_DBL_DIG 15
+#define CL_DBL_MANT_DIG 53
+#define CL_DBL_MAX_10_EXP +308
+#define CL_DBL_MAX_EXP +1024
+#define CL_DBL_MIN_10_EXP -307
+#define CL_DBL_MIN_EXP -1021
+#define CL_DBL_RADIX 2
+#define CL_DBL_MAX 0x1.fffffffffffffp1023
+#define CL_DBL_MIN 0x1.0p-1022
+#define CL_DBL_EPSILON 0x1.0p-52
+
+#define CL_M_E 2.718281828459045090796
+#define CL_M_LOG2E 1.442695040888963387005
+#define CL_M_LOG10E 0.434294481903251816668
+#define CL_M_LN2 0.693147180559945286227
+#define CL_M_LN10 2.302585092994045901094
+#define CL_M_PI 3.141592653589793115998
+#define CL_M_PI_2 1.570796326794896557999
+#define CL_M_PI_4 0.785398163397448278999
+#define CL_M_1_PI 0.318309886183790691216
+#define CL_M_2_PI 0.636619772367581382433
+#define CL_M_2_SQRTPI 1.128379167095512558561
+#define CL_M_SQRT2 1.414213562373095145475
+#define CL_M_SQRT1_2 0.707106781186547572737
+
+#define CL_M_E_F 2.71828174591064f
+#define CL_M_LOG2E_F 1.44269502162933f
+#define CL_M_LOG10E_F 0.43429449200630f
+#define CL_M_LN2_F 0.69314718246460f
+#define CL_M_LN10_F 2.30258512496948f
+#define CL_M_PI_F 3.14159274101257f
+#define CL_M_PI_2_F 1.57079637050629f
+#define CL_M_PI_4_F 0.78539818525314f
+#define CL_M_1_PI_F 0.31830987334251f
+#define CL_M_2_PI_F 0.63661974668503f
+#define CL_M_2_SQRTPI_F 1.12837922573090f
+#define CL_M_SQRT2_F 1.41421353816986f
+#define CL_M_SQRT1_2_F 0.70710676908493f
+
+#if defined( __GNUC__ )
+ #define CL_HUGE_VALF __builtin_huge_valf()
+ #define CL_HUGE_VAL __builtin_huge_val()
+ #define CL_NAN __builtin_nanf( "" )
+#else
+ #define CL_HUGE_VALF ((cl_float) 1e50)
+ #define CL_HUGE_VAL ((cl_double) 1e500)
+ float nanf( const char * );
+ #define CL_NAN nanf( "" )
+#endif
+#define CL_MAXFLOAT CL_FLT_MAX
+#define CL_INFINITY CL_HUGE_VALF
+
+#endif
+
+#include <stddef.h>
+
+/* Mirror types to GL types. Mirror types allow us to avoid deciding which headers to load based on whether we are using GL or GLES here. */
+typedef unsigned int cl_GLuint;
+typedef int cl_GLint;
+typedef unsigned int cl_GLenum;
+
+/*
+ * Vector types
+ *
+ * Note: OpenCL requires that all types be naturally aligned.
+ * This means that vector types must be naturally aligned.
+ * For example, a vector of four floats must be aligned to
+ * a 16 byte boundary (calculated as 4 * the natural 4-byte
+ * alignment of the float). The alignment qualifiers here
+ * will only function properly if your compiler supports them
+ * and if you don't actively work to defeat them. For example,
+ * in order for a cl_float4 to be 16 byte aligned in a struct,
+ * the start of the struct must itself be 16-byte aligned.
+ *
+ * Maintaining proper alignment is the user's responsibility.
+ */
+
+/* Define basic vector types */
+#if defined( __VEC__ )
+ #include <altivec.h> /* may be omitted depending on compiler. AltiVec spec provides no way to detect whether the header is required. */
+ typedef vector unsigned char __cl_uchar16;
+ typedef vector signed char __cl_char16;
+ typedef vector unsigned short __cl_ushort8;
+ typedef vector signed short __cl_short8;
+ typedef vector unsigned int __cl_uint4;
+ typedef vector signed int __cl_int4;
+ typedef vector float __cl_float4;
+ #define __CL_UCHAR16__ 1
+ #define __CL_CHAR16__ 1
+ #define __CL_USHORT8__ 1
+ #define __CL_SHORT8__ 1
+ #define __CL_UINT4__ 1
+ #define __CL_INT4__ 1
+ #define __CL_FLOAT4__ 1
+#endif
+
+#if defined( __SSE__ )
+ #if defined( __MINGW64__ )
+ #include <intrin.h>
+ #else
+ #include <xmmintrin.h>
+ #endif
+ #if defined( __GNUC__ )
+ typedef float __cl_float4 __attribute__((vector_size(16)));
+ #else
+ typedef __m128 __cl_float4;
+ #endif
+ #define __CL_FLOAT4__ 1
+#endif
+
+#if defined( __SSE2__ )
+ #if defined( __MINGW64__ )
+ #include <intrin.h>
+ #else
+ #include <emmintrin.h>
+ #endif
+ #if defined( __GNUC__ )
+ typedef cl_uchar __cl_uchar16 __attribute__((vector_size(16)));
+ typedef cl_char __cl_char16 __attribute__((vector_size(16)));
+ typedef cl_ushort __cl_ushort8 __attribute__((vector_size(16)));
+ typedef cl_short __cl_short8 __attribute__((vector_size(16)));
+ typedef cl_uint __cl_uint4 __attribute__((vector_size(16)));
+ typedef cl_int __cl_int4 __attribute__((vector_size(16)));
+ typedef cl_ulong __cl_ulong2 __attribute__((vector_size(16)));
+ typedef cl_long __cl_long2 __attribute__((vector_size(16)));
+ typedef cl_double __cl_double2 __attribute__((vector_size(16)));
+ #else
+ typedef __m128i __cl_uchar16;
+ typedef __m128i __cl_char16;
+ typedef __m128i __cl_ushort8;
+ typedef __m128i __cl_short8;
+ typedef __m128i __cl_uint4;
+ typedef __m128i __cl_int4;
+ typedef __m128i __cl_ulong2;
+ typedef __m128i __cl_long2;
+ typedef __m128d __cl_double2;
+ #endif
+ #define __CL_UCHAR16__ 1
+ #define __CL_CHAR16__ 1
+ #define __CL_USHORT8__ 1
+ #define __CL_SHORT8__ 1
+ #define __CL_INT4__ 1
+ #define __CL_UINT4__ 1
+ #define __CL_ULONG2__ 1
+ #define __CL_LONG2__ 1
+ #define __CL_DOUBLE2__ 1
+#endif
+
+#if defined( __MMX__ )
+ #include <mmintrin.h>
+ #if defined( __GNUC__ )
+ typedef cl_uchar __cl_uchar8 __attribute__((vector_size(8)));
+ typedef cl_char __cl_char8 __attribute__((vector_size(8)));
+ typedef cl_ushort __cl_ushort4 __attribute__((vector_size(8)));
+ typedef cl_short __cl_short4 __attribute__((vector_size(8)));
+ typedef cl_uint __cl_uint2 __attribute__((vector_size(8)));
+ typedef cl_int __cl_int2 __attribute__((vector_size(8)));
+ typedef cl_ulong __cl_ulong1 __attribute__((vector_size(8)));
+ typedef cl_long __cl_long1 __attribute__((vector_size(8)));
+ typedef cl_float __cl_float2 __attribute__((vector_size(8)));
+ #else
+ typedef __m64 __cl_uchar8;
+ typedef __m64 __cl_char8;
+ typedef __m64 __cl_ushort4;
+ typedef __m64 __cl_short4;
+ typedef __m64 __cl_uint2;
+ typedef __m64 __cl_int2;
+ typedef __m64 __cl_ulong1;
+ typedef __m64 __cl_long1;
+ typedef __m64 __cl_float2;
+ #endif
+ #define __CL_UCHAR8__ 1
+ #define __CL_CHAR8__ 1
+ #define __CL_USHORT4__ 1
+ #define __CL_SHORT4__ 1
+ #define __CL_INT2__ 1
+ #define __CL_UINT2__ 1
+ #define __CL_ULONG1__ 1
+ #define __CL_LONG1__ 1
+ #define __CL_FLOAT2__ 1
+#endif
+
+#if defined( __AVX__ )
+ #if defined( __MINGW64__ )
+ #include <intrin.h>
+ #else
+ #include <immintrin.h>
+ #endif
+ #if defined( __GNUC__ )
+ typedef cl_float __cl_float8 __attribute__((vector_size(32)));
+ typedef cl_double __cl_double4 __attribute__((vector_size(32)));
+ #else
+ typedef __m256 __cl_float8;
+ typedef __m256d __cl_double4;
+ #endif
+ #define __CL_FLOAT8__ 1
+ #define __CL_DOUBLE4__ 1
+#endif
+
+/* Define alignment keys */
+#if defined( __GNUC__ )
+ #define CL_ALIGNED(_x) __attribute__ ((aligned(_x)))
+#elif defined( _WIN32) && (_MSC_VER)
+ /* Alignment keys neutered on windows because MSVC can't swallow function arguments with alignment requirements */
+ /* http://msdn.microsoft.com/en-us/library/373ak2y1%28VS.71%29.aspx */
+ /* #include <crtdefs.h> */
+ /* #define CL_ALIGNED(_x) _CRT_ALIGN(_x) */
+ #define CL_ALIGNED(_x)
+#else
+ #warning Need to implement some method to align data here
+ #define CL_ALIGNED(_x)
+#endif
+
+/* Indicate whether .xyzw, .s0123 and .hi.lo are supported */
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ /* .xyzw and .s0123...{f|F} are supported */
+ #define CL_HAS_NAMED_VECTOR_FIELDS 1
+ /* .hi and .lo are supported */
+ #define CL_HAS_HI_LO_VECTOR_FIELDS 1
+#endif
+
+/* Define cl_vector types */
+
+/* ---- cl_charn ---- */
+typedef union
+{
+ cl_char CL_ALIGNED(2) s[2];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_char x, y; };
+ __extension__ struct{ cl_char s0, s1; };
+ __extension__ struct{ cl_char lo, hi; };
+#endif
+#if defined( __CL_CHAR2__)
+ __cl_char2 v2;
+#endif
+}cl_char2;
+
+typedef union
+{
+ cl_char CL_ALIGNED(4) s[4];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_char x, y, z, w; };
+ __extension__ struct{ cl_char s0, s1, s2, s3; };
+ __extension__ struct{ cl_char2 lo, hi; };
+#endif
+#if defined( __CL_CHAR2__)
+ __cl_char2 v2[2];
+#endif
+#if defined( __CL_CHAR4__)
+ __cl_char4 v4;
+#endif
+}cl_char4;
+
+/* cl_char3 is identical in size, alignment and behavior to cl_char4. See section 6.1.5. */
+typedef cl_char4 cl_char3;
+
+typedef union
+{
+ cl_char CL_ALIGNED(8) s[8];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_char x, y, z, w; };
+ __extension__ struct{ cl_char s0, s1, s2, s3, s4, s5, s6, s7; };
+ __extension__ struct{ cl_char4 lo, hi; };
+#endif
+#if defined( __CL_CHAR2__)
+ __cl_char2 v2[4];
+#endif
+#if defined( __CL_CHAR4__)
+ __cl_char4 v4[2];
+#endif
+#if defined( __CL_CHAR8__ )
+ __cl_char8 v8;
+#endif
+}cl_char8;
+
+typedef union
+{
+ cl_char CL_ALIGNED(16) s[16];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_char x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
+ __extension__ struct{ cl_char s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
+ __extension__ struct{ cl_char8 lo, hi; };
+#endif
+#if defined( __CL_CHAR2__)
+ __cl_char2 v2[8];
+#endif
+#if defined( __CL_CHAR4__)
+ __cl_char4 v4[4];
+#endif
+#if defined( __CL_CHAR8__ )
+ __cl_char8 v8[2];
+#endif
+#if defined( __CL_CHAR16__ )
+ __cl_char16 v16;
+#endif
+}cl_char16;
+
+
+/* ---- cl_ucharn ---- */
+typedef union
+{
+ cl_uchar CL_ALIGNED(2) s[2];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_uchar x, y; };
+ __extension__ struct{ cl_uchar s0, s1; };
+ __extension__ struct{ cl_uchar lo, hi; };
+#endif
+#if defined( __cl_uchar2__)
+ __cl_uchar2 v2;
+#endif
+}cl_uchar2;
+
+typedef union
+{
+ cl_uchar CL_ALIGNED(4) s[4];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_uchar x, y, z, w; };
+ __extension__ struct{ cl_uchar s0, s1, s2, s3; };
+ __extension__ struct{ cl_uchar2 lo, hi; };
+#endif
+#if defined( __CL_UCHAR2__)
+ __cl_uchar2 v2[2];
+#endif
+#if defined( __CL_UCHAR4__)
+ __cl_uchar4 v4;
+#endif
+}cl_uchar4;
+
+/* cl_uchar3 is identical in size, alignment and behavior to cl_uchar4. See section 6.1.5. */
+typedef cl_uchar4 cl_uchar3;
+
+typedef union
+{
+ cl_uchar CL_ALIGNED(8) s[8];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_uchar x, y, z, w; };
+ __extension__ struct{ cl_uchar s0, s1, s2, s3, s4, s5, s6, s7; };
+ __extension__ struct{ cl_uchar4 lo, hi; };
+#endif
+#if defined( __CL_UCHAR2__)
+ __cl_uchar2 v2[4];
+#endif
+#if defined( __CL_UCHAR4__)
+ __cl_uchar4 v4[2];
+#endif
+#if defined( __CL_UCHAR8__ )
+ __cl_uchar8 v8;
+#endif
+}cl_uchar8;
+
+typedef union
+{
+ cl_uchar CL_ALIGNED(16) s[16];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_uchar x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
+ __extension__ struct{ cl_uchar s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
+ __extension__ struct{ cl_uchar8 lo, hi; };
+#endif
+#if defined( __CL_UCHAR2__)
+ __cl_uchar2 v2[8];
+#endif
+#if defined( __CL_UCHAR4__)
+ __cl_uchar4 v4[4];
+#endif
+#if defined( __CL_UCHAR8__ )
+ __cl_uchar8 v8[2];
+#endif
+#if defined( __CL_UCHAR16__ )
+ __cl_uchar16 v16;
+#endif
+}cl_uchar16;
+
+
+/* ---- cl_shortn ---- */
+typedef union
+{
+ cl_short CL_ALIGNED(4) s[2];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_short x, y; };
+ __extension__ struct{ cl_short s0, s1; };
+ __extension__ struct{ cl_short lo, hi; };
+#endif
+#if defined( __CL_SHORT2__)
+ __cl_short2 v2;
+#endif
+}cl_short2;
+
+typedef union
+{
+ cl_short CL_ALIGNED(8) s[4];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_short x, y, z, w; };
+ __extension__ struct{ cl_short s0, s1, s2, s3; };
+ __extension__ struct{ cl_short2 lo, hi; };
+#endif
+#if defined( __CL_SHORT2__)
+ __cl_short2 v2[2];
+#endif
+#if defined( __CL_SHORT4__)
+ __cl_short4 v4;
+#endif
+}cl_short4;
+
+/* cl_short3 is identical in size, alignment and behavior to cl_short4. See section 6.1.5. */
+typedef cl_short4 cl_short3;
+
+typedef union
+{
+ cl_short CL_ALIGNED(16) s[8];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_short x, y, z, w; };
+ __extension__ struct{ cl_short s0, s1, s2, s3, s4, s5, s6, s7; };
+ __extension__ struct{ cl_short4 lo, hi; };
+#endif
+#if defined( __CL_SHORT2__)
+ __cl_short2 v2[4];
+#endif
+#if defined( __CL_SHORT4__)
+ __cl_short4 v4[2];
+#endif
+#if defined( __CL_SHORT8__ )
+ __cl_short8 v8;
+#endif
+}cl_short8;
+
+typedef union
+{
+ cl_short CL_ALIGNED(32) s[16];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_short x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
+ __extension__ struct{ cl_short s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
+ __extension__ struct{ cl_short8 lo, hi; };
+#endif
+#if defined( __CL_SHORT2__)
+ __cl_short2 v2[8];
+#endif
+#if defined( __CL_SHORT4__)
+ __cl_short4 v4[4];
+#endif
+#if defined( __CL_SHORT8__ )
+ __cl_short8 v8[2];
+#endif
+#if defined( __CL_SHORT16__ )
+ __cl_short16 v16;
+#endif
+}cl_short16;
+
+
+/* ---- cl_ushortn ---- */
+typedef union
+{
+ cl_ushort CL_ALIGNED(4) s[2];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_ushort x, y; };
+ __extension__ struct{ cl_ushort s0, s1; };
+ __extension__ struct{ cl_ushort lo, hi; };
+#endif
+#if defined( __CL_USHORT2__)
+ __cl_ushort2 v2;
+#endif
+}cl_ushort2;
+
+typedef union
+{
+ cl_ushort CL_ALIGNED(8) s[4];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_ushort x, y, z, w; };
+ __extension__ struct{ cl_ushort s0, s1, s2, s3; };
+ __extension__ struct{ cl_ushort2 lo, hi; };
+#endif
+#if defined( __CL_USHORT2__)
+ __cl_ushort2 v2[2];
+#endif
+#if defined( __CL_USHORT4__)
+ __cl_ushort4 v4;
+#endif
+}cl_ushort4;
+
+/* cl_ushort3 is identical in size, alignment and behavior to cl_ushort4. See section 6.1.5. */
+typedef cl_ushort4 cl_ushort3;
+
+typedef union
+{
+ cl_ushort CL_ALIGNED(16) s[8];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_ushort x, y, z, w; };
+ __extension__ struct{ cl_ushort s0, s1, s2, s3, s4, s5, s6, s7; };
+ __extension__ struct{ cl_ushort4 lo, hi; };
+#endif
+#if defined( __CL_USHORT2__)
+ __cl_ushort2 v2[4];
+#endif
+#if defined( __CL_USHORT4__)
+ __cl_ushort4 v4[2];
+#endif
+#if defined( __CL_USHORT8__ )
+ __cl_ushort8 v8;
+#endif
+}cl_ushort8;
+
+typedef union
+{
+ cl_ushort CL_ALIGNED(32) s[16];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_ushort x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
+ __extension__ struct{ cl_ushort s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
+ __extension__ struct{ cl_ushort8 lo, hi; };
+#endif
+#if defined( __CL_USHORT2__)
+ __cl_ushort2 v2[8];
+#endif
+#if defined( __CL_USHORT4__)
+ __cl_ushort4 v4[4];
+#endif
+#if defined( __CL_USHORT8__ )
+ __cl_ushort8 v8[2];
+#endif
+#if defined( __CL_USHORT16__ )
+ __cl_ushort16 v16;
+#endif
+}cl_ushort16;
+
+/* ---- cl_intn ---- */
+typedef union
+{
+ cl_int CL_ALIGNED(8) s[2];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_int x, y; };
+ __extension__ struct{ cl_int s0, s1; };
+ __extension__ struct{ cl_int lo, hi; };
+#endif
+#if defined( __CL_INT2__)
+ __cl_int2 v2;
+#endif
+}cl_int2;
+
+typedef union
+{
+ cl_int CL_ALIGNED(16) s[4];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_int x, y, z, w; };
+ __extension__ struct{ cl_int s0, s1, s2, s3; };
+ __extension__ struct{ cl_int2 lo, hi; };
+#endif
+#if defined( __CL_INT2__)
+ __cl_int2 v2[2];
+#endif
+#if defined( __CL_INT4__)
+ __cl_int4 v4;
+#endif
+}cl_int4;
+
+/* cl_int3 is identical in size, alignment and behavior to cl_int4. See section 6.1.5. */
+typedef cl_int4 cl_int3;
+
+typedef union
+{
+ cl_int CL_ALIGNED(32) s[8];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_int x, y, z, w; };
+ __extension__ struct{ cl_int s0, s1, s2, s3, s4, s5, s6, s7; };
+ __extension__ struct{ cl_int4 lo, hi; };
+#endif
+#if defined( __CL_INT2__)
+ __cl_int2 v2[4];
+#endif
+#if defined( __CL_INT4__)
+ __cl_int4 v4[2];
+#endif
+#if defined( __CL_INT8__ )
+ __cl_int8 v8;
+#endif
+}cl_int8;
+
+typedef union
+{
+ cl_int CL_ALIGNED(64) s[16];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_int x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
+ __extension__ struct{ cl_int s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
+ __extension__ struct{ cl_int8 lo, hi; };
+#endif
+#if defined( __CL_INT2__)
+ __cl_int2 v2[8];
+#endif
+#if defined( __CL_INT4__)
+ __cl_int4 v4[4];
+#endif
+#if defined( __CL_INT8__ )
+ __cl_int8 v8[2];
+#endif
+#if defined( __CL_INT16__ )
+ __cl_int16 v16;
+#endif
+}cl_int16;
+
+
+/* ---- cl_uintn ---- */
+typedef union
+{
+ cl_uint CL_ALIGNED(8) s[2];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_uint x, y; };
+ __extension__ struct{ cl_uint s0, s1; };
+ __extension__ struct{ cl_uint lo, hi; };
+#endif
+#if defined( __CL_UINT2__)
+ __cl_uint2 v2;
+#endif
+}cl_uint2;
+
+typedef union
+{
+ cl_uint CL_ALIGNED(16) s[4];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_uint x, y, z, w; };
+ __extension__ struct{ cl_uint s0, s1, s2, s3; };
+ __extension__ struct{ cl_uint2 lo, hi; };
+#endif
+#if defined( __CL_UINT2__)
+ __cl_uint2 v2[2];
+#endif
+#if defined( __CL_UINT4__)
+ __cl_uint4 v4;
+#endif
+}cl_uint4;
+
+/* cl_uint3 is identical in size, alignment and behavior to cl_uint4. See section 6.1.5. */
+typedef cl_uint4 cl_uint3;
+
+typedef union
+{
+ cl_uint CL_ALIGNED(32) s[8];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_uint x, y, z, w; };
+ __extension__ struct{ cl_uint s0, s1, s2, s3, s4, s5, s6, s7; };
+ __extension__ struct{ cl_uint4 lo, hi; };
+#endif
+#if defined( __CL_UINT2__)
+ __cl_uint2 v2[4];
+#endif
+#if defined( __CL_UINT4__)
+ __cl_uint4 v4[2];
+#endif
+#if defined( __CL_UINT8__ )
+ __cl_uint8 v8;
+#endif
+}cl_uint8;
+
+typedef union
+{
+ cl_uint CL_ALIGNED(64) s[16];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_uint x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
+ __extension__ struct{ cl_uint s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
+ __extension__ struct{ cl_uint8 lo, hi; };
+#endif
+#if defined( __CL_UINT2__)
+ __cl_uint2 v2[8];
+#endif
+#if defined( __CL_UINT4__)
+ __cl_uint4 v4[4];
+#endif
+#if defined( __CL_UINT8__ )
+ __cl_uint8 v8[2];
+#endif
+#if defined( __CL_UINT16__ )
+ __cl_uint16 v16;
+#endif
+}cl_uint16;
+
+/* ---- cl_longn ---- */
+typedef union
+{
+ cl_long CL_ALIGNED(16) s[2];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_long x, y; };
+ __extension__ struct{ cl_long s0, s1; };
+ __extension__ struct{ cl_long lo, hi; };
+#endif
+#if defined( __CL_LONG2__)
+ __cl_long2 v2;
+#endif
+}cl_long2;
+
+typedef union
+{
+ cl_long CL_ALIGNED(32) s[4];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_long x, y, z, w; };
+ __extension__ struct{ cl_long s0, s1, s2, s3; };
+ __extension__ struct{ cl_long2 lo, hi; };
+#endif
+#if defined( __CL_LONG2__)
+ __cl_long2 v2[2];
+#endif
+#if defined( __CL_LONG4__)
+ __cl_long4 v4;
+#endif
+}cl_long4;
+
+/* cl_long3 is identical in size, alignment and behavior to cl_long4. See section 6.1.5. */
+typedef cl_long4 cl_long3;
+
+typedef union
+{
+ cl_long CL_ALIGNED(64) s[8];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_long x, y, z, w; };
+ __extension__ struct{ cl_long s0, s1, s2, s3, s4, s5, s6, s7; };
+ __extension__ struct{ cl_long4 lo, hi; };
+#endif
+#if defined( __CL_LONG2__)
+ __cl_long2 v2[4];
+#endif
+#if defined( __CL_LONG4__)
+ __cl_long4 v4[2];
+#endif
+#if defined( __CL_LONG8__ )
+ __cl_long8 v8;
+#endif
+}cl_long8;
+
+typedef union
+{
+ cl_long CL_ALIGNED(128) s[16];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_long x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
+ __extension__ struct{ cl_long s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
+ __extension__ struct{ cl_long8 lo, hi; };
+#endif
+#if defined( __CL_LONG2__)
+ __cl_long2 v2[8];
+#endif
+#if defined( __CL_LONG4__)
+ __cl_long4 v4[4];
+#endif
+#if defined( __CL_LONG8__ )
+ __cl_long8 v8[2];
+#endif
+#if defined( __CL_LONG16__ )
+ __cl_long16 v16;
+#endif
+}cl_long16;
+
+
+/* ---- cl_ulongn ---- */
+typedef union
+{
+ cl_ulong CL_ALIGNED(16) s[2];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_ulong x, y; };
+ __extension__ struct{ cl_ulong s0, s1; };
+ __extension__ struct{ cl_ulong lo, hi; };
+#endif
+#if defined( __CL_ULONG2__)
+ __cl_ulong2 v2;
+#endif
+}cl_ulong2;
+
+typedef union
+{
+ cl_ulong CL_ALIGNED(32) s[4];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_ulong x, y, z, w; };
+ __extension__ struct{ cl_ulong s0, s1, s2, s3; };
+ __extension__ struct{ cl_ulong2 lo, hi; };
+#endif
+#if defined( __CL_ULONG2__)
+ __cl_ulong2 v2[2];
+#endif
+#if defined( __CL_ULONG4__)
+ __cl_ulong4 v4;
+#endif
+}cl_ulong4;
+
+/* cl_ulong3 is identical in size, alignment and behavior to cl_ulong4. See section 6.1.5. */
+typedef cl_ulong4 cl_ulong3;
+
+typedef union
+{
+ cl_ulong CL_ALIGNED(64) s[8];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_ulong x, y, z, w; };
+ __extension__ struct{ cl_ulong s0, s1, s2, s3, s4, s5, s6, s7; };
+ __extension__ struct{ cl_ulong4 lo, hi; };
+#endif
+#if defined( __CL_ULONG2__)
+ __cl_ulong2 v2[4];
+#endif
+#if defined( __CL_ULONG4__)
+ __cl_ulong4 v4[2];
+#endif
+#if defined( __CL_ULONG8__ )
+ __cl_ulong8 v8;
+#endif
+}cl_ulong8;
+
+typedef union
+{
+ cl_ulong CL_ALIGNED(128) s[16];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_ulong x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
+ __extension__ struct{ cl_ulong s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
+ __extension__ struct{ cl_ulong8 lo, hi; };
+#endif
+#if defined( __CL_ULONG2__)
+ __cl_ulong2 v2[8];
+#endif
+#if defined( __CL_ULONG4__)
+ __cl_ulong4 v4[4];
+#endif
+#if defined( __CL_ULONG8__ )
+ __cl_ulong8 v8[2];
+#endif
+#if defined( __CL_ULONG16__ )
+ __cl_ulong16 v16;
+#endif
+}cl_ulong16;
+
+
+/* --- cl_floatn ---- */
+
+typedef union
+{
+ cl_float CL_ALIGNED(8) s[2];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_float x, y; };
+ __extension__ struct{ cl_float s0, s1; };
+ __extension__ struct{ cl_float lo, hi; };
+#endif
+#if defined( __CL_FLOAT2__)
+ __cl_float2 v2;
+#endif
+}cl_float2;
+
+typedef union
+{
+ cl_float CL_ALIGNED(16) s[4];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_float x, y, z, w; };
+ __extension__ struct{ cl_float s0, s1, s2, s3; };
+ __extension__ struct{ cl_float2 lo, hi; };
+#endif
+#if defined( __CL_FLOAT2__)
+ __cl_float2 v2[2];
+#endif
+#if defined( __CL_FLOAT4__)
+ __cl_float4 v4;
+#endif
+}cl_float4;
+
+/* cl_float3 is identical in size, alignment and behavior to cl_float4. See section 6.1.5. */
+typedef cl_float4 cl_float3;
+
+typedef union
+{
+ cl_float CL_ALIGNED(32) s[8];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_float x, y, z, w; };
+ __extension__ struct{ cl_float s0, s1, s2, s3, s4, s5, s6, s7; };
+ __extension__ struct{ cl_float4 lo, hi; };
+#endif
+#if defined( __CL_FLOAT2__)
+ __cl_float2 v2[4];
+#endif
+#if defined( __CL_FLOAT4__)
+ __cl_float4 v4[2];
+#endif
+#if defined( __CL_FLOAT8__ )
+ __cl_float8 v8;
+#endif
+}cl_float8;
+
+typedef union
+{
+ cl_float CL_ALIGNED(64) s[16];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_float x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
+ __extension__ struct{ cl_float s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
+ __extension__ struct{ cl_float8 lo, hi; };
+#endif
+#if defined( __CL_FLOAT2__)
+ __cl_float2 v2[8];
+#endif
+#if defined( __CL_FLOAT4__)
+ __cl_float4 v4[4];
+#endif
+#if defined( __CL_FLOAT8__ )
+ __cl_float8 v8[2];
+#endif
+#if defined( __CL_FLOAT16__ )
+ __cl_float16 v16;
+#endif
+}cl_float16;
+
+/* --- cl_doublen ---- */
+
+typedef union
+{
+ cl_double CL_ALIGNED(16) s[2];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_double x, y; };
+ __extension__ struct{ cl_double s0, s1; };
+ __extension__ struct{ cl_double lo, hi; };
+#endif
+#if defined( __CL_DOUBLE2__)
+ __cl_double2 v2;
+#endif
+}cl_double2;
+
+typedef union
+{
+ cl_double CL_ALIGNED(32) s[4];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_double x, y, z, w; };
+ __extension__ struct{ cl_double s0, s1, s2, s3; };
+ __extension__ struct{ cl_double2 lo, hi; };
+#endif
+#if defined( __CL_DOUBLE2__)
+ __cl_double2 v2[2];
+#endif
+#if defined( __CL_DOUBLE4__)
+ __cl_double4 v4;
+#endif
+}cl_double4;
+
+/* cl_double3 is identical in size, alignment and behavior to cl_double4. See section 6.1.5. */
+typedef cl_double4 cl_double3;
+
+typedef union
+{
+ cl_double CL_ALIGNED(64) s[8];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_double x, y, z, w; };
+ __extension__ struct{ cl_double s0, s1, s2, s3, s4, s5, s6, s7; };
+ __extension__ struct{ cl_double4 lo, hi; };
+#endif
+#if defined( __CL_DOUBLE2__)
+ __cl_double2 v2[4];
+#endif
+#if defined( __CL_DOUBLE4__)
+ __cl_double4 v4[2];
+#endif
+#if defined( __CL_DOUBLE8__ )
+ __cl_double8 v8;
+#endif
+}cl_double8;
+
+typedef union
+{
+ cl_double CL_ALIGNED(128) s[16];
+#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+ __extension__ struct{ cl_double x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
+ __extension__ struct{ cl_double s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
+ __extension__ struct{ cl_double8 lo, hi; };
+#endif
+#if defined( __CL_DOUBLE2__)
+ __cl_double2 v2[8];
+#endif
+#if defined( __CL_DOUBLE4__)
+ __cl_double4 v4[4];
+#endif
+#if defined( __CL_DOUBLE8__ )
+ __cl_double8 v8[2];
+#endif
+#if defined( __CL_DOUBLE16__ )
+ __cl_double16 v16;
+#endif
+}cl_double16;
+
+/* Macro to facilitate debugging
+ * Usage:
+ * Place CL_PROGRAM_STRING_DEBUG_INFO on the line before the first line of your source.
+ * The first line ends with: CL_PROGRAM_STRING_BEGIN \"
+ * Each line thereafter of OpenCL C source must end with: \n\
+ * The last line ends in ";
+ *
+ * Example:
+ *
+ * const char *my_program = CL_PROGRAM_STRING_BEGIN "\
+ * kernel void foo( int a, float * b ) \n\
+ * { \n\
+ * // my comment \n\
+ * *b[ get_global_id(0)] = a; \n\
+ * } \n\
+ * ";
+ *
+ * This should correctly set up the line, (column) and file information for your source
+ * string so you can do source level debugging.
+ */
+#define __CL_STRINGIFY( _x ) # _x
+#define _CL_STRINGIFY( _x ) __CL_STRINGIFY( _x )
+#define CL_PROGRAM_STRING_DEBUG_INFO "#line " _CL_STRINGIFY(__LINE__) " \"" __FILE__ "\" \n\n"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CL_PLATFORM_H */
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2008-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.
+ ******************************************************************************/
+
+/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
+
+#ifndef __OPENCL_H
+#define __OPENCL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __APPLE__
+
+#include <OpenCL/cl.h>
+#include <OpenCL/cl_gl.h>
+#include <OpenCL/cl_gl_ext.h>
+#include <OpenCL/cl_ext.h>
+
+#else
+
+#include <CL/cl.h>
+#include <CL/cl_gl.h>
+#include <CL/cl_gl_ext.h>
+#include <CL/cl_ext.h>
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OPENCL_H */
+
--- /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_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** Copyright (c) 2007-2012 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+#include <EGL/eglplatform.h>
+
+/*************************************************************/
+
+/* Header file version number */
+/* Current version at http://www.khronos.org/registry/egl/ */
+/* $Revision: 18699 $ on $Date: 2012-07-31 03:04:59 -0700 (Tue, 31 Jul 2012) $ */
+#define EGL_EGLEXT_VERSION 14
+
+#ifndef EGL_KHR_config_attribs
+#define EGL_KHR_config_attribs 1
+#define EGL_CONFORMANT_KHR 0x3042 /* EGLConfig attribute */
+#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020 /* EGL_SURFACE_TYPE bitfield */
+#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040 /* EGL_SURFACE_TYPE bitfield */
+#endif
+
+#ifndef EGL_KHR_lock_surface
+#define EGL_KHR_lock_surface 1
+#define EGL_READ_SURFACE_BIT_KHR 0x0001 /* EGL_LOCK_USAGE_HINT_KHR bitfield */
+#define EGL_WRITE_SURFACE_BIT_KHR 0x0002 /* EGL_LOCK_USAGE_HINT_KHR bitfield */
+#define EGL_LOCK_SURFACE_BIT_KHR 0x0080 /* EGL_SURFACE_TYPE bitfield */
+#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 /* EGL_SURFACE_TYPE bitfield */
+#define EGL_MATCH_FORMAT_KHR 0x3043 /* EGLConfig attribute */
+#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0 /* EGL_MATCH_FORMAT_KHR value */
+#define EGL_FORMAT_RGB_565_KHR 0x30C1 /* EGL_MATCH_FORMAT_KHR value */
+#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2 /* EGL_MATCH_FORMAT_KHR value */
+#define EGL_FORMAT_RGBA_8888_KHR 0x30C3 /* EGL_MATCH_FORMAT_KHR value */
+#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 /* eglLockSurfaceKHR attribute */
+#define EGL_LOCK_USAGE_HINT_KHR 0x30C5 /* eglLockSurfaceKHR attribute */
+#define EGL_BITMAP_POINTER_KHR 0x30C6 /* eglQuerySurface attribute */
+#define EGL_BITMAP_PITCH_KHR 0x30C7 /* eglQuerySurface attribute */
+#define EGL_BITMAP_ORIGIN_KHR 0x30C8 /* eglQuerySurface attribute */
+#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9 /* eglQuerySurface attribute */
+#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA /* eglQuerySurface attribute */
+#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB /* eglQuerySurface attribute */
+#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC /* eglQuerySurface attribute */
+#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD /* eglQuerySurface attribute */
+#define EGL_LOWER_LEFT_KHR 0x30CE /* EGL_BITMAP_ORIGIN_KHR value */
+#define EGL_UPPER_LEFT_KHR 0x30CF /* EGL_BITMAP_ORIGIN_KHR value */
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay display, EGLSurface surface);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface);
+#endif
+
+#ifndef EGL_KHR_image
+#define EGL_KHR_image 1
+#define EGL_NATIVE_PIXMAP_KHR 0x30B0 /* eglCreateImageKHR target */
+typedef void *EGLImageKHR;
+#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
+#endif
+
+#ifndef EGL_KHR_vg_parent_image
+#define EGL_KHR_vg_parent_image 1
+#define EGL_VG_PARENT_IMAGE_KHR 0x30BA /* eglCreateImageKHR target */
+#endif
+
+#ifndef EGL_KHR_gl_texture_2D_image
+#define EGL_KHR_gl_texture_2D_image 1
+#define EGL_GL_TEXTURE_2D_KHR 0x30B1 /* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC /* eglCreateImageKHR attribute */
+#endif
+
+#ifndef EGL_KHR_gl_texture_cubemap_image
+#define EGL_KHR_gl_texture_cubemap_image 1
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3 /* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4 /* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5 /* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6 /* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7 /* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8 /* eglCreateImageKHR target */
+#endif
+
+#ifndef EGL_KHR_gl_texture_3D_image
+#define EGL_KHR_gl_texture_3D_image 1
+#define EGL_GL_TEXTURE_3D_KHR 0x30B2 /* eglCreateImageKHR target */
+#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD /* eglCreateImageKHR attribute */
+#endif
+
+#ifndef EGL_KHR_gl_renderbuffer_image
+#define EGL_KHR_gl_renderbuffer_image 1
+#define EGL_GL_RENDERBUFFER_KHR 0x30B9 /* eglCreateImageKHR target */
+#endif
+
+#if KHRONOS_SUPPORT_INT64 /* EGLTimeKHR requires 64-bit uint support */
+#ifndef EGL_KHR_reusable_sync
+#define EGL_KHR_reusable_sync 1
+
+typedef void* EGLSyncKHR;
+typedef khronos_utime_nanoseconds_t EGLTimeKHR;
+
+#define EGL_SYNC_STATUS_KHR 0x30F1
+#define EGL_SIGNALED_KHR 0x30F2
+#define EGL_UNSIGNALED_KHR 0x30F3
+#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5
+#define EGL_CONDITION_SATISFIED_KHR 0x30F6
+#define EGL_SYNC_TYPE_KHR 0x30F7
+#define EGL_SYNC_REUSABLE_KHR 0x30FA
+#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 /* eglClientWaitSyncKHR <flags> bitfield */
+#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
+#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0)
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
+EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync);
+EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
+EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
+EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
+typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
+#endif
+#endif
+
+#ifndef EGL_KHR_image_base
+#define EGL_KHR_image_base 1
+/* Most interfaces defined by EGL_KHR_image_pixmap above */
+#define EGL_IMAGE_PRESERVED_KHR 0x30D2 /* eglCreateImageKHR attribute */
+#endif
+
+#ifndef EGL_KHR_image_pixmap
+#define EGL_KHR_image_pixmap 1
+/* Interfaces defined by EGL_KHR_image above */
+#endif
+
+#ifndef EGL_IMG_context_priority
+#define EGL_IMG_context_priority 1
+#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100
+#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101
+#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102
+#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
+#endif
+
+#ifndef EGL_KHR_lock_surface2
+#define EGL_KHR_lock_surface2 1
+#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110
+#endif
+
+#ifndef EGL_NV_coverage_sample
+#define EGL_NV_coverage_sample 1
+#define EGL_COVERAGE_BUFFERS_NV 0x30E0
+#define EGL_COVERAGE_SAMPLES_NV 0x30E1
+#endif
+
+#ifndef EGL_NV_depth_nonlinear
+#define EGL_NV_depth_nonlinear 1
+#define EGL_DEPTH_ENCODING_NV 0x30E2
+#define EGL_DEPTH_ENCODING_NONE_NV 0
+#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
+#endif
+
+#if KHRONOS_SUPPORT_INT64 /* EGLTimeNV requires 64-bit uint support */
+#ifndef EGL_NV_sync
+#define EGL_NV_sync 1
+#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6
+#define EGL_SYNC_STATUS_NV 0x30E7
+#define EGL_SIGNALED_NV 0x30E8
+#define EGL_UNSIGNALED_NV 0x30E9
+#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001
+#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull
+#define EGL_ALREADY_SIGNALED_NV 0x30EA
+#define EGL_TIMEOUT_EXPIRED_NV 0x30EB
+#define EGL_CONDITION_SATISFIED_NV 0x30EC
+#define EGL_SYNC_TYPE_NV 0x30ED
+#define EGL_SYNC_CONDITION_NV 0x30EE
+#define EGL_SYNC_FENCE_NV 0x30EF
+#define EGL_NO_SYNC_NV ((EGLSyncNV)0)
+typedef void* EGLSyncNV;
+typedef khronos_utime_nanoseconds_t EGLTimeNV;
+#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 /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
+typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
+#endif
+#endif
+
+#if KHRONOS_SUPPORT_INT64 /* Dependent on EGL_KHR_reusable_sync which requires 64-bit uint support */
+#ifndef EGL_KHR_fence_sync
+#define EGL_KHR_fence_sync 1
+/* Reuses most tokens and entry points from EGL_KHR_reusable_sync */
+#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
+#define EGL_SYNC_CONDITION_KHR 0x30F8
+#define EGL_SYNC_FENCE_KHR 0x30F9
+#endif
+#endif
+
+#ifndef EGL_HI_clientpixmap
+#define EGL_HI_clientpixmap 1
+
+/* Surface Attribute */
+#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74
+/*
+ * Structure representing a client pixmap
+ * (pixmap's data is in client-space memory).
+ */
+struct EGLClientPixmapHI
+{
+ void* pData;
+ EGLint iWidth;
+ EGLint iHeight;
+ EGLint iStride;
+};
+
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI(EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap);
+#endif /* EGL_HI_clientpixmap */
+
+#ifndef EGL_HI_colorformats
+#define EGL_HI_colorformats 1
+/* Config Attribute */
+#define EGL_COLOR_FORMAT_HI 0x8F70
+/* Color Formats */
+#define EGL_COLOR_RGB_HI 0x8F71
+#define EGL_COLOR_RGBA_HI 0x8F72
+#define EGL_COLOR_ARGB_HI 0x8F73
+#endif /* EGL_HI_colorformats */
+
+#ifndef EGL_MESA_drm_image
+#define EGL_MESA_drm_image 1
+#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0 /* CreateDRMImageMESA attribute */
+#define EGL_DRM_BUFFER_USE_MESA 0x31D1 /* CreateDRMImageMESA attribute */
+#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2 /* EGL_IMAGE_FORMAT_MESA attribute value */
+#define EGL_DRM_BUFFER_MESA 0x31D3 /* eglCreateImageKHR target */
+#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4
+#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001 /* EGL_DRM_BUFFER_USE_MESA bits */
+#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002 /* EGL_DRM_BUFFER_USE_MESA bits */
+#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 /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
+#endif
+
+#ifndef EGL_NV_post_sub_buffer
+#define EGL_NV_post_sub_buffer 1
+#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
+#endif
+
+#ifndef EGL_ANGLE_query_surface_pointer
+#define EGL_ANGLE_query_surface_pointer 1
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean eglQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
+#endif
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
+#endif
+
+#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle
+#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1
+#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200
+#endif
+
+#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
+
+#if KHRONOS_SUPPORT_INT64 /* EGLuint64NV requires 64-bit uint support */
+#ifndef EGL_NV_system_time
+#define EGL_NV_system_time 1
+
+typedef khronos_utime_nanoseconds_t EGLuint64NV;
+
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV(void);
+EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV(void);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void);
+typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void);
+#endif
+#endif
+
+#if KHRONOS_SUPPORT_INT64 /* EGLuint64KHR requires 64-bit uint support */
+#ifndef EGL_KHR_stream
+#define EGL_KHR_stream 1
+typedef void* EGLStreamKHR;
+typedef khronos_uint64_t EGLuint64KHR;
+#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
+#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 /* EGL_EGLEXT_PROTOTYPES */
+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);
+#endif
+#endif
+
+#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
+#ifndef EGL_KHR_stream_consumer_gltexture
+#define EGL_KHR_stream_consumer_gltexture 1
+#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E
+#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 /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
+#endif
+#endif
+
+#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
+#ifndef EGL_KHR_stream_producer_eglsurface
+#define EGL_KHR_stream_producer_eglsurface 1
+#define EGL_STREAM_BIT_KHR 0x0800
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC)(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
+#endif
+#endif
+
+#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
+#ifndef EGL_KHR_stream_producer_aldatalocator
+#define EGL_KHR_stream_producer_aldatalocator 1
+#endif
+#endif
+
+#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
+#ifndef EGL_KHR_stream_fifo
+#define EGL_KHR_stream_fifo 1
+/* reuse EGLTimeKHR */
+#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
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
+#endif
+#endif
+
+#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
+
+#ifndef EGL_ANGLE_d3d_share_handle_client_buffer
+#define EGL_ANGLE_d3d_share_handle_client_buffer 1
+/* reuse EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE */
+#endif
+
+#ifndef EGL_KHR_create_context
+#define EGL_KHR_create_context 1
+#define EGL_CONTEXT_MAJOR_VERSION_KHR EGL_CONTEXT_CLIENT_VERSION
+#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
+#endif
+
+#ifndef EGL_KHR_surfaceless_context
+#define EGL_KHR_surfaceless_context 1
+/* No tokens/entry points, just relaxes an error condition */
+#endif
+
+#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
+#ifndef EGL_KHR_stream_cross_process_fd
+#define EGL_KHR_stream_cross_process_fd 1
+typedef int EGLNativeFileDescriptorKHR;
+#define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1))
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR(EGLDisplay dpy, EGLStreamKHR stream);
+EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR(EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
+#endif /* EGL_EGLEXT_PROTOTYPES */
+typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
+typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC)(EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
+#endif
+#endif
+
+#include <EGL/eglmesaext.h>
+
+#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
+#define EGL_TEXTURE_EXTERNAL_WL 0x31DA
+
+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_WL_create_wayland_buffer_from_image
+#define EGL_WL_create_wayland_buffer_from_image 1
+
+#ifdef EGL_EGLEXT_PROTOTYPES
+EGLAPI struct wl_buffer * EGLAPIENTRY eglCreateWaylandBufferFromImageWL(EGLDisplay dpy, EGLImageKHR image);
+#endif
+typedef struct wl_buffer * (EGLAPIENTRYP PFNEGLCREATEWAYLANDBUFFERFROMIMAGEWL) (EGLDisplay dpy, EGLImageKHR image);
+
+#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-2009 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+/* Platform-specific types and definitions for egl.h
+ * $Revision: 12306 $ on $Date: 2010-08-25 09:51:28 -0700 (Wed, 25 Aug 2010) $
+ *
+ * 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 LIBHYBRIS_WANTS_MESA_X11_HEADERS
+#define MESA_EGL_NO_X11_HEADERS
+#endif
+
+#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(WL_EGL_PLATFORM)
+
+typedef struct wl_display *EGLNativeDisplayType;
+typedef struct wl_egl_pixmap *EGLNativePixmapType;
+typedef struct wl_egl_window *EGLNativeWindowType;
+
+#elif defined(__GBM__)
+
+typedef struct gbm_device *EGLNativeDisplayType;
+typedef struct gbm_bo *EGLNativePixmapType;
+typedef void *EGLNativeWindowType;
+
+#elif defined(ANDROID) /* Android */
+
+struct ANativeWindow;
+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-2012 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: 2012-09-19 19:02:24 -0700 (Wed, 19 Sep 2012) $ */
+/* Current version at http://www.opengl.org/registry/ */
+#define GL_GLEXT_VERSION 85
+/* 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
+#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
+#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
+#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
+#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
+#define GL_SRC1_ALPHA 0x8589
+#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_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
+#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
+#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_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 */
+#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_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_SHADER_BINARY_FORMATS */
+/* reuse GL_NUM_SHADER_BINARY_FORMATS */
+/* reuse GL_MAX_VERTEX_UNIFORM_VECTORS */
+/* reuse GL_MAX_VARYING_VECTORS */
+/* reuse GL_MAX_FRAGMENT_UNIFORM_VECTORS */
+/* reuse GL_RGB565 */
+/* 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_VERSION_4_3
+#define GL_NUM_SHADING_LANGUAGE_VERSIONS 0x82E9
+#define GL_VERTEX_ATTRIB_ARRAY_LONG 0x874E
+/* Reuse tokens from ARB_arrays_of_arrays (none, GLSL only) */
+/* Reuse tokens from ARB_fragment_layer_viewport (none, GLSL only) */
+/* Reuse tokens from ARB_shader_image_size (none, GLSL only) */
+/* Reuse tokens from ARB_ES3_compatibility */
+/* reuse GL_COMPRESSED_RGB8_ETC2 */
+/* reuse GL_COMPRESSED_SRGB8_ETC2 */
+/* reuse GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 */
+/* reuse GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 */
+/* reuse GL_COMPRESSED_RGBA8_ETC2_EAC */
+/* reuse GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC */
+/* reuse GL_COMPRESSED_R11_EAC */
+/* reuse GL_COMPRESSED_SIGNED_R11_EAC */
+/* reuse GL_COMPRESSED_RG11_EAC */
+/* reuse GL_COMPRESSED_SIGNED_RG11_EAC */
+/* reuse GL_PRIMITIVE_RESTART_FIXED_INDEX */
+/* reuse GL_ANY_SAMPLES_PASSED_CONSERVATIVE */
+/* reuse GL_MAX_ELEMENT_INDEX */
+/* Reuse tokens from ARB_clear_buffer_object (none) */
+/* Reuse tokens from ARB_compute_shader */
+/* reuse GL_COMPUTE_SHADER */
+/* reuse GL_MAX_COMPUTE_UNIFORM_BLOCKS */
+/* reuse GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS */
+/* reuse GL_MAX_COMPUTE_IMAGE_UNIFORMS */
+/* reuse GL_MAX_COMPUTE_SHARED_MEMORY_SIZE */
+/* reuse GL_MAX_COMPUTE_UNIFORM_COMPONENTS */
+/* reuse GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS */
+/* reuse GL_MAX_COMPUTE_ATOMIC_COUNTERS */
+/* reuse GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS */
+/* reuse GL_MAX_COMPUTE_LOCAL_INVOCATIONS */
+/* reuse GL_MAX_COMPUTE_WORK_GROUP_COUNT */
+/* reuse GL_MAX_COMPUTE_WORK_GROUP_SIZE */
+/* reuse GL_COMPUTE_LOCAL_WORK_SIZE */
+/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER */
+/* reuse GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER */
+/* reuse GL_DISPATCH_INDIRECT_BUFFER */
+/* reuse GL_DISPATCH_INDIRECT_BUFFER_BINDING */
+/* Reuse tokens from ARB_copy_image (none) */
+/* Reuse tokens from KHR_debug */
+/* reuse GL_DEBUG_OUTPUT_SYNCHRONOUS */
+/* reuse GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH */
+/* reuse GL_DEBUG_CALLBACK_FUNCTION */
+/* reuse GL_DEBUG_CALLBACK_USER_PARAM */
+/* reuse GL_DEBUG_SOURCE_API */
+/* reuse GL_DEBUG_SOURCE_WINDOW_SYSTEM */
+/* reuse GL_DEBUG_SOURCE_SHADER_COMPILER */
+/* reuse GL_DEBUG_SOURCE_THIRD_PARTY */
+/* reuse GL_DEBUG_SOURCE_APPLICATION */
+/* reuse GL_DEBUG_SOURCE_OTHER */
+/* reuse GL_DEBUG_TYPE_ERROR */
+/* reuse GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR */
+/* reuse GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR */
+/* reuse GL_DEBUG_TYPE_PORTABILITY */
+/* reuse GL_DEBUG_TYPE_PERFORMANCE */
+/* reuse GL_DEBUG_TYPE_OTHER */
+/* reuse GL_MAX_DEBUG_MESSAGE_LENGTH */
+/* reuse GL_MAX_DEBUG_LOGGED_MESSAGES */
+/* reuse GL_DEBUG_LOGGED_MESSAGES */
+/* reuse GL_DEBUG_SEVERITY_HIGH */
+/* reuse GL_DEBUG_SEVERITY_MEDIUM */
+/* reuse GL_DEBUG_SEVERITY_LOW */
+/* reuse GL_DEBUG_TYPE_MARKER */
+/* reuse GL_DEBUG_TYPE_PUSH_GROUP */
+/* reuse GL_DEBUG_TYPE_POP_GROUP */
+/* reuse GL_DEBUG_SEVERITY_NOTIFICATION */
+/* reuse GL_MAX_DEBUG_GROUP_STACK_DEPTH */
+/* reuse GL_DEBUG_GROUP_STACK_DEPTH */
+/* reuse GL_BUFFER */
+/* reuse GL_SHADER */
+/* reuse GL_PROGRAM */
+/* reuse GL_QUERY */
+/* reuse GL_PROGRAM_PIPELINE */
+/* reuse GL_SAMPLER */
+/* reuse GL_DISPLAY_LIST */
+/* reuse GL_MAX_LABEL_LENGTH */
+/* reuse GL_DEBUG_OUTPUT */
+/* reuse GL_CONTEXT_FLAG_DEBUG_BIT */
+/* reuse GL_STACK_UNDERFLOW */
+/* reuse GL_STACK_OVERFLOW */
+/* Reuse tokens from ARB_explicit_uniform_location */
+/* reuse GL_MAX_UNIFORM_LOCATIONS */
+/* Reuse tokens from ARB_framebuffer_no_attachments */
+/* reuse GL_FRAMEBUFFER_DEFAULT_WIDTH */
+/* reuse GL_FRAMEBUFFER_DEFAULT_HEIGHT */
+/* reuse GL_FRAMEBUFFER_DEFAULT_LAYERS */
+/* reuse GL_FRAMEBUFFER_DEFAULT_SAMPLES */
+/* reuse GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS */
+/* reuse GL_MAX_FRAMEBUFFER_WIDTH */
+/* reuse GL_MAX_FRAMEBUFFER_HEIGHT */
+/* reuse GL_MAX_FRAMEBUFFER_LAYERS */
+/* reuse GL_MAX_FRAMEBUFFER_SAMPLES */
+/* Reuse tokens from ARB_internalformat_query2 */
+/* reuse GL_INTERNALFORMAT_SUPPORTED */
+/* reuse GL_INTERNALFORMAT_PREFERRED */
+/* reuse GL_INTERNALFORMAT_RED_SIZE */
+/* reuse GL_INTERNALFORMAT_GREEN_SIZE */
+/* reuse GL_INTERNALFORMAT_BLUE_SIZE */
+/* reuse GL_INTERNALFORMAT_ALPHA_SIZE */
+/* reuse GL_INTERNALFORMAT_DEPTH_SIZE */
+/* reuse GL_INTERNALFORMAT_STENCIL_SIZE */
+/* reuse GL_INTERNALFORMAT_SHARED_SIZE */
+/* reuse GL_INTERNALFORMAT_RED_TYPE */
+/* reuse GL_INTERNALFORMAT_GREEN_TYPE */
+/* reuse GL_INTERNALFORMAT_BLUE_TYPE */
+/* reuse GL_INTERNALFORMAT_ALPHA_TYPE */
+/* reuse GL_INTERNALFORMAT_DEPTH_TYPE */
+/* reuse GL_INTERNALFORMAT_STENCIL_TYPE */
+/* reuse GL_MAX_WIDTH */
+/* reuse GL_MAX_HEIGHT */
+/* reuse GL_MAX_DEPTH */
+/* reuse GL_MAX_LAYERS */
+/* reuse GL_MAX_COMBINED_DIMENSIONS */
+/* reuse GL_COLOR_COMPONENTS */
+/* reuse GL_DEPTH_COMPONENTS */
+/* reuse GL_STENCIL_COMPONENTS */
+/* reuse GL_COLOR_RENDERABLE */
+/* reuse GL_DEPTH_RENDERABLE */
+/* reuse GL_STENCIL_RENDERABLE */
+/* reuse GL_FRAMEBUFFER_RENDERABLE */
+/* reuse GL_FRAMEBUFFER_RENDERABLE_LAYERED */
+/* reuse GL_FRAMEBUFFER_BLEND */
+/* reuse GL_READ_PIXELS */
+/* reuse GL_READ_PIXELS_FORMAT */
+/* reuse GL_READ_PIXELS_TYPE */
+/* reuse GL_TEXTURE_IMAGE_FORMAT */
+/* reuse GL_TEXTURE_IMAGE_TYPE */
+/* reuse GL_GET_TEXTURE_IMAGE_FORMAT */
+/* reuse GL_GET_TEXTURE_IMAGE_TYPE */
+/* reuse GL_MIPMAP */
+/* reuse GL_MANUAL_GENERATE_MIPMAP */
+/* reuse GL_AUTO_GENERATE_MIPMAP */
+/* reuse GL_COLOR_ENCODING */
+/* reuse GL_SRGB_READ */
+/* reuse GL_SRGB_WRITE */
+/* reuse GL_FILTER */
+/* reuse GL_VERTEX_TEXTURE */
+/* reuse GL_TESS_CONTROL_TEXTURE */
+/* reuse GL_TESS_EVALUATION_TEXTURE */
+/* reuse GL_GEOMETRY_TEXTURE */
+/* reuse GL_FRAGMENT_TEXTURE */
+/* reuse GL_COMPUTE_TEXTURE */
+/* reuse GL_TEXTURE_SHADOW */
+/* reuse GL_TEXTURE_GATHER */
+/* reuse GL_TEXTURE_GATHER_SHADOW */
+/* reuse GL_SHADER_IMAGE_LOAD */
+/* reuse GL_SHADER_IMAGE_STORE */
+/* reuse GL_SHADER_IMAGE_ATOMIC */
+/* reuse GL_IMAGE_TEXEL_SIZE */
+/* reuse GL_IMAGE_COMPATIBILITY_CLASS */
+/* reuse GL_IMAGE_PIXEL_FORMAT */
+/* reuse GL_IMAGE_PIXEL_TYPE */
+/* reuse GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST */
+/* reuse GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST */
+/* reuse GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE */
+/* reuse GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE */
+/* reuse GL_TEXTURE_COMPRESSED_BLOCK_WIDTH */
+/* reuse GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT */
+/* reuse GL_TEXTURE_COMPRESSED_BLOCK_SIZE */
+/* reuse GL_CLEAR_BUFFER */
+/* reuse GL_TEXTURE_VIEW */
+/* reuse GL_VIEW_COMPATIBILITY_CLASS */
+/* reuse GL_FULL_SUPPORT */
+/* reuse GL_CAVEAT_SUPPORT */
+/* reuse GL_IMAGE_CLASS_4_X_32 */
+/* reuse GL_IMAGE_CLASS_2_X_32 */
+/* reuse GL_IMAGE_CLASS_1_X_32 */
+/* reuse GL_IMAGE_CLASS_4_X_16 */
+/* reuse GL_IMAGE_CLASS_2_X_16 */
+/* reuse GL_IMAGE_CLASS_1_X_16 */
+/* reuse GL_IMAGE_CLASS_4_X_8 */
+/* reuse GL_IMAGE_CLASS_2_X_8 */
+/* reuse GL_IMAGE_CLASS_1_X_8 */
+/* reuse GL_IMAGE_CLASS_11_11_10 */
+/* reuse GL_IMAGE_CLASS_10_10_10_2 */
+/* reuse GL_VIEW_CLASS_128_BITS */
+/* reuse GL_VIEW_CLASS_96_BITS */
+/* reuse GL_VIEW_CLASS_64_BITS */
+/* reuse GL_VIEW_CLASS_48_BITS */
+/* reuse GL_VIEW_CLASS_32_BITS */
+/* reuse GL_VIEW_CLASS_24_BITS */
+/* reuse GL_VIEW_CLASS_16_BITS */
+/* reuse GL_VIEW_CLASS_8_BITS */
+/* reuse GL_VIEW_CLASS_S3TC_DXT1_RGB */
+/* reuse GL_VIEW_CLASS_S3TC_DXT1_RGBA */
+/* reuse GL_VIEW_CLASS_S3TC_DXT3_RGBA */
+/* reuse GL_VIEW_CLASS_S3TC_DXT5_RGBA */
+/* reuse GL_VIEW_CLASS_RGTC1_RED */
+/* reuse GL_VIEW_CLASS_RGTC2_RG */
+/* reuse GL_VIEW_CLASS_BPTC_UNORM */
+/* reuse GL_VIEW_CLASS_BPTC_FLOAT */
+/* Reuse tokens from ARB_invalidate_subdata (none) */
+/* Reuse tokens from ARB_multi_draw_indirect (none) */
+/* Reuse tokens from ARB_program_interface_query */
+/* reuse GL_UNIFORM */
+/* reuse GL_UNIFORM_BLOCK */
+/* reuse GL_PROGRAM_INPUT */
+/* reuse GL_PROGRAM_OUTPUT */
+/* reuse GL_BUFFER_VARIABLE */
+/* reuse GL_SHADER_STORAGE_BLOCK */
+/* reuse GL_VERTEX_SUBROUTINE */
+/* reuse GL_TESS_CONTROL_SUBROUTINE */
+/* reuse GL_TESS_EVALUATION_SUBROUTINE */
+/* reuse GL_GEOMETRY_SUBROUTINE */
+/* reuse GL_FRAGMENT_SUBROUTINE */
+/* reuse GL_COMPUTE_SUBROUTINE */
+/* reuse GL_VERTEX_SUBROUTINE_UNIFORM */
+/* reuse GL_TESS_CONTROL_SUBROUTINE_UNIFORM */
+/* reuse GL_TESS_EVALUATION_SUBROUTINE_UNIFORM */
+/* reuse GL_GEOMETRY_SUBROUTINE_UNIFORM */
+/* reuse GL_FRAGMENT_SUBROUTINE_UNIFORM */
+/* reuse GL_COMPUTE_SUBROUTINE_UNIFORM */
+/* reuse GL_TRANSFORM_FEEDBACK_VARYING */
+/* reuse GL_ACTIVE_RESOURCES */
+/* reuse GL_MAX_NAME_LENGTH */
+/* reuse GL_MAX_NUM_ACTIVE_VARIABLES */
+/* reuse GL_MAX_NUM_COMPATIBLE_SUBROUTINES */
+/* reuse GL_NAME_LENGTH */
+/* reuse GL_TYPE */
+/* reuse GL_ARRAY_SIZE */
+/* reuse GL_OFFSET */
+/* reuse GL_BLOCK_INDEX */
+/* reuse GL_ARRAY_STRIDE */
+/* reuse GL_MATRIX_STRIDE */
+/* reuse GL_IS_ROW_MAJOR */
+/* reuse GL_ATOMIC_COUNTER_BUFFER_INDEX */
+/* reuse GL_BUFFER_BINDING */
+/* reuse GL_BUFFER_DATA_SIZE */
+/* reuse GL_NUM_ACTIVE_VARIABLES */
+/* reuse GL_ACTIVE_VARIABLES */
+/* reuse GL_REFERENCED_BY_VERTEX_SHADER */
+/* reuse GL_REFERENCED_BY_TESS_CONTROL_SHADER */
+/* reuse GL_REFERENCED_BY_TESS_EVALUATION_SHADER */
+/* reuse GL_REFERENCED_BY_GEOMETRY_SHADER */
+/* reuse GL_REFERENCED_BY_FRAGMENT_SHADER */
+/* reuse GL_REFERENCED_BY_COMPUTE_SHADER */
+/* reuse GL_TOP_LEVEL_ARRAY_SIZE */
+/* reuse GL_TOP_LEVEL_ARRAY_STRIDE */
+/* reuse GL_LOCATION */
+/* reuse GL_LOCATION_INDEX */
+/* reuse GL_IS_PER_PATCH */
+/* Reuse tokens from ARB_robust_buffer_access_behavior (none) */
+/* Reuse tokens from ARB_shader_storage_buffer_object */
+/* reuse GL_SHADER_STORAGE_BUFFER */
+/* reuse GL_SHADER_STORAGE_BUFFER_BINDING */
+/* reuse GL_SHADER_STORAGE_BUFFER_START */
+/* reuse GL_SHADER_STORAGE_BUFFER_SIZE */
+/* reuse GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS */
+/* reuse GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS */
+/* reuse GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS */
+/* reuse GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS */
+/* reuse GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS */
+/* reuse GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS */
+/* reuse GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS */
+/* reuse GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS */
+/* reuse GL_MAX_SHADER_STORAGE_BLOCK_SIZE */
+/* reuse GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT */
+/* reuse GL_SHADER_STORAGE_BARRIER_BIT */
+/* reuse GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES */
+/* Reuse tokens from ARB_stencil_texturing */
+/* reuse GL_DEPTH_STENCIL_TEXTURE_MODE */
+/* Reuse tokens from ARB_texture_buffer_range */
+/* reuse GL_TEXTURE_BUFFER_OFFSET */
+/* reuse GL_TEXTURE_BUFFER_SIZE */
+/* reuse GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT */
+/* Reuse tokens from ARB_texture_query_levels (none) */
+/* Reuse tokens from ARB_texture_storage_multisample (none) */
+/* Reuse tokens from ARB_texture_view */
+/* reuse GL_TEXTURE_VIEW_MIN_LEVEL */
+/* reuse GL_TEXTURE_VIEW_NUM_LEVELS */
+/* reuse GL_TEXTURE_VIEW_MIN_LAYER */
+/* reuse GL_TEXTURE_VIEW_NUM_LAYERS */
+/* reuse GL_TEXTURE_IMMUTABLE_LEVELS */
+/* Reuse tokens from ARB_vertex_attrib_binding */
+/* reuse GL_VERTEX_ATTRIB_BINDING */
+/* reuse GL_VERTEX_ATTRIB_RELATIVE_OFFSET */
+/* reuse GL_VERTEX_BINDING_DIVISOR */
+/* reuse GL_VERTEX_BINDING_OFFSET */
+/* reuse GL_VERTEX_BINDING_STRIDE */
+/* reuse GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET */
+/* reuse GL_MAX_VERTEX_ATTRIB_BINDINGS */
+#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
+#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_BINDING 0x8F36
+#define GL_COPY_READ_BUFFER GL_COPY_READ_BUFFER_BINDING
+#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37
+#define GL_COPY_WRITE_BUFFER GL_COPY_WRITE_BUFFER_BINDING
+#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
+#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB 0x8F9F
+#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_PAUSED 0x8E23
+#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED GL_TRANSFORM_FEEDBACK_PAUSED
+#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24
+#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE GL_TRANSFORM_FEEDBACK_ACTIVE
+#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_SHADER_BINARY_FORMATS 0x8DF8
+#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
+#define GL_RGB565 0x8D62
+#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_KHR_texture_compression_astc_ldr
+#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
+
+#ifndef GL_KHR_debug
+#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242
+#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243
+#define GL_DEBUG_CALLBACK_FUNCTION 0x8244
+#define GL_DEBUG_CALLBACK_USER_PARAM 0x8245
+#define GL_DEBUG_SOURCE_API 0x8246
+#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247
+#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248
+#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249
+#define GL_DEBUG_SOURCE_APPLICATION 0x824A
+#define GL_DEBUG_SOURCE_OTHER 0x824B
+#define GL_DEBUG_TYPE_ERROR 0x824C
+#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D
+#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E
+#define GL_DEBUG_TYPE_PORTABILITY 0x824F
+#define GL_DEBUG_TYPE_PERFORMANCE 0x8250
+#define GL_DEBUG_TYPE_OTHER 0x8251
+#define GL_DEBUG_TYPE_MARKER 0x8268
+#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269
+#define GL_DEBUG_TYPE_POP_GROUP 0x826A
+#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B
+#define GL_MAX_DEBUG_GROUP_STACK_DEPTH 0x826C
+#define GL_DEBUG_GROUP_STACK_DEPTH 0x826D
+#define GL_BUFFER 0x82E0
+#define GL_SHADER 0x82E1
+#define GL_PROGRAM 0x82E2
+#define GL_QUERY 0x82E3
+#define GL_PROGRAM_PIPELINE 0x82E4
+#define GL_SAMPLER 0x82E6
+#define GL_DISPLAY_LIST 0x82E7
+/* DISPLAY_LIST used in compatibility profile only */
+#define GL_MAX_LABEL_LENGTH 0x82E8
+#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143
+#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144
+#define GL_DEBUG_LOGGED_MESSAGES 0x9145
+#define GL_DEBUG_SEVERITY_HIGH 0x9146
+#define GL_DEBUG_SEVERITY_MEDIUM 0x9147
+#define GL_DEBUG_SEVERITY_LOW 0x9148
+#define GL_DEBUG_OUTPUT 0x92E0
+#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002
+/* reuse GL_STACK_UNDERFLOW */
+/* reuse GL_STACK_OVERFLOW */
+#endif
+
+#ifndef GL_ARB_arrays_of_arrays
+#endif
+
+#ifndef GL_ARB_clear_buffer_object
+#endif
+
+#ifndef GL_ARB_compute_shader
+#define GL_COMPUTE_SHADER 0x91B9
+#define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB
+#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC
+#define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD
+#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262
+#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263
+#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264
+#define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265
+#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266
+#define GL_MAX_COMPUTE_LOCAL_INVOCATIONS 0x90EB
+#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE
+#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF
+#define GL_COMPUTE_LOCAL_WORK_SIZE 0x8267
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER 0x90EC
+#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED
+#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE
+#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF
+#define GL_COMPUTE_SHADER_BIT 0x00000020
+#endif
+
+#ifndef GL_ARB_copy_image
+#endif
+
+#ifndef GL_ARB_texture_view
+#define GL_TEXTURE_VIEW_MIN_LEVEL 0x82DB
+#define GL_TEXTURE_VIEW_NUM_LEVELS 0x82DC
+#define GL_TEXTURE_VIEW_MIN_LAYER 0x82DD
+#define GL_TEXTURE_VIEW_NUM_LAYERS 0x82DE
+#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF
+#endif
+
+#ifndef GL_ARB_vertex_attrib_binding
+#define GL_VERTEX_ATTRIB_BINDING 0x82D4
+#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5
+#define GL_VERTEX_BINDING_DIVISOR 0x82D6
+#define GL_VERTEX_BINDING_OFFSET 0x82D7
+#define GL_VERTEX_BINDING_STRIDE 0x82D8
+#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9
+#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA
+#endif
+
+#ifndef GL_ARB_robustness_isolation
+#endif
+
+#ifndef GL_ARB_ES3_compatibility
+#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_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_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69
+#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A
+#define GL_MAX_ELEMENT_INDEX 0x8D6B
+#endif
+
+#ifndef GL_ARB_explicit_uniform_location
+#define GL_MAX_UNIFORM_LOCATIONS 0x826E
+#endif
+
+#ifndef GL_ARB_fragment_layer_viewport
+#endif
+
+#ifndef GL_ARB_framebuffer_no_attachments
+#define GL_FRAMEBUFFER_DEFAULT_WIDTH 0x9310
+#define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311
+#define GL_FRAMEBUFFER_DEFAULT_LAYERS 0x9312
+#define GL_FRAMEBUFFER_DEFAULT_SAMPLES 0x9313
+#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314
+#define GL_MAX_FRAMEBUFFER_WIDTH 0x9315
+#define GL_MAX_FRAMEBUFFER_HEIGHT 0x9316
+#define GL_MAX_FRAMEBUFFER_LAYERS 0x9317
+#define GL_MAX_FRAMEBUFFER_SAMPLES 0x9318
+#endif
+
+#ifndef GL_ARB_internalformat_query2
+/* reuse GL_IMAGE_FORMAT_COMPATIBILITY_TYPE */
+/* reuse GL_NUM_SAMPLE_COUNTS */
+/* reuse GL_RENDERBUFFER */
+/* reuse GL_SAMPLES */
+/* reuse GL_TEXTURE_1D */
+/* reuse GL_TEXTURE_1D_ARRAY */
+/* reuse GL_TEXTURE_2D */
+/* reuse GL_TEXTURE_2D_ARRAY */
+/* reuse GL_TEXTURE_3D */
+/* reuse GL_TEXTURE_CUBE_MAP */
+/* reuse GL_TEXTURE_CUBE_MAP_ARRAY */
+/* reuse GL_TEXTURE_RECTANGLE */
+/* reuse GL_TEXTURE_BUFFER */
+/* reuse GL_TEXTURE_2D_MULTISAMPLE */
+/* reuse GL_TEXTURE_2D_MULTISAMPLE_ARRAY */
+/* reuse GL_TEXTURE_COMPRESSED */
+#define GL_INTERNALFORMAT_SUPPORTED 0x826F
+#define GL_INTERNALFORMAT_PREFERRED 0x8270
+#define GL_INTERNALFORMAT_RED_SIZE 0x8271
+#define GL_INTERNALFORMAT_GREEN_SIZE 0x8272
+#define GL_INTERNALFORMAT_BLUE_SIZE 0x8273
+#define GL_INTERNALFORMAT_ALPHA_SIZE 0x8274
+#define GL_INTERNALFORMAT_DEPTH_SIZE 0x8275
+#define GL_INTERNALFORMAT_STENCIL_SIZE 0x8276
+#define GL_INTERNALFORMAT_SHARED_SIZE 0x8277
+#define GL_INTERNALFORMAT_RED_TYPE 0x8278
+#define GL_INTERNALFORMAT_GREEN_TYPE 0x8279
+#define GL_INTERNALFORMAT_BLUE_TYPE 0x827A
+#define GL_INTERNALFORMAT_ALPHA_TYPE 0x827B
+#define GL_INTERNALFORMAT_DEPTH_TYPE 0x827C
+#define GL_INTERNALFORMAT_STENCIL_TYPE 0x827D
+#define GL_MAX_WIDTH 0x827E
+#define GL_MAX_HEIGHT 0x827F
+#define GL_MAX_DEPTH 0x8280
+#define GL_MAX_LAYERS 0x8281
+#define GL_MAX_COMBINED_DIMENSIONS 0x8282
+#define GL_COLOR_COMPONENTS 0x8283
+#define GL_DEPTH_COMPONENTS 0x8284
+#define GL_STENCIL_COMPONENTS 0x8285
+#define GL_COLOR_RENDERABLE 0x8286
+#define GL_DEPTH_RENDERABLE 0x8287
+#define GL_STENCIL_RENDERABLE 0x8288
+#define GL_FRAMEBUFFER_RENDERABLE 0x8289
+#define GL_FRAMEBUFFER_RENDERABLE_LAYERED 0x828A
+#define GL_FRAMEBUFFER_BLEND 0x828B
+#define GL_READ_PIXELS 0x828C
+#define GL_READ_PIXELS_FORMAT 0x828D
+#define GL_READ_PIXELS_TYPE 0x828E
+#define GL_TEXTURE_IMAGE_FORMAT 0x828F
+#define GL_TEXTURE_IMAGE_TYPE 0x8290
+#define GL_GET_TEXTURE_IMAGE_FORMAT 0x8291
+#define GL_GET_TEXTURE_IMAGE_TYPE 0x8292
+#define GL_MIPMAP 0x8293
+#define GL_MANUAL_GENERATE_MIPMAP 0x8294
+#define GL_AUTO_GENERATE_MIPMAP 0x8295
+#define GL_COLOR_ENCODING 0x8296
+#define GL_SRGB_READ 0x8297
+#define GL_SRGB_WRITE 0x8298
+#define GL_SRGB_DECODE_ARB 0x8299
+#define GL_FILTER 0x829A
+#define GL_VERTEX_TEXTURE 0x829B
+#define GL_TESS_CONTROL_TEXTURE 0x829C
+#define GL_TESS_EVALUATION_TEXTURE 0x829D
+#define GL_GEOMETRY_TEXTURE 0x829E
+#define GL_FRAGMENT_TEXTURE 0x829F
+#define GL_COMPUTE_TEXTURE 0x82A0
+#define GL_TEXTURE_SHADOW 0x82A1
+#define GL_TEXTURE_GATHER 0x82A2
+#define GL_TEXTURE_GATHER_SHADOW 0x82A3
+#define GL_SHADER_IMAGE_LOAD 0x82A4
+#define GL_SHADER_IMAGE_STORE 0x82A5
+#define GL_SHADER_IMAGE_ATOMIC 0x82A6
+#define GL_IMAGE_TEXEL_SIZE 0x82A7
+#define GL_IMAGE_COMPATIBILITY_CLASS 0x82A8
+#define GL_IMAGE_PIXEL_FORMAT 0x82A9
+#define GL_IMAGE_PIXEL_TYPE 0x82AA
+#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST 0x82AC
+#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST 0x82AD
+#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE 0x82AE
+#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE 0x82AF
+#define GL_TEXTURE_COMPRESSED_BLOCK_WIDTH 0x82B1
+#define GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT 0x82B2
+#define GL_TEXTURE_COMPRESSED_BLOCK_SIZE 0x82B3
+#define GL_CLEAR_BUFFER 0x82B4
+#define GL_TEXTURE_VIEW 0x82B5
+#define GL_VIEW_COMPATIBILITY_CLASS 0x82B6
+#define GL_FULL_SUPPORT 0x82B7
+#define GL_CAVEAT_SUPPORT 0x82B8
+#define GL_IMAGE_CLASS_4_X_32 0x82B9
+#define GL_IMAGE_CLASS_2_X_32 0x82BA
+#define GL_IMAGE_CLASS_1_X_32 0x82BB
+#define GL_IMAGE_CLASS_4_X_16 0x82BC
+#define GL_IMAGE_CLASS_2_X_16 0x82BD
+#define GL_IMAGE_CLASS_1_X_16 0x82BE
+#define GL_IMAGE_CLASS_4_X_8 0x82BF
+#define GL_IMAGE_CLASS_2_X_8 0x82C0
+#define GL_IMAGE_CLASS_1_X_8 0x82C1
+#define GL_IMAGE_CLASS_11_11_10 0x82C2
+#define GL_IMAGE_CLASS_10_10_10_2 0x82C3
+#define GL_VIEW_CLASS_128_BITS 0x82C4
+#define GL_VIEW_CLASS_96_BITS 0x82C5
+#define GL_VIEW_CLASS_64_BITS 0x82C6
+#define GL_VIEW_CLASS_48_BITS 0x82C7
+#define GL_VIEW_CLASS_32_BITS 0x82C8
+#define GL_VIEW_CLASS_24_BITS 0x82C9
+#define GL_VIEW_CLASS_16_BITS 0x82CA
+#define GL_VIEW_CLASS_8_BITS 0x82CB
+#define GL_VIEW_CLASS_S3TC_DXT1_RGB 0x82CC
+#define GL_VIEW_CLASS_S3TC_DXT1_RGBA 0x82CD
+#define GL_VIEW_CLASS_S3TC_DXT3_RGBA 0x82CE
+#define GL_VIEW_CLASS_S3TC_DXT5_RGBA 0x82CF
+#define GL_VIEW_CLASS_RGTC1_RED 0x82D0
+#define GL_VIEW_CLASS_RGTC2_RG 0x82D1
+#define GL_VIEW_CLASS_BPTC_UNORM 0x82D2
+#define GL_VIEW_CLASS_BPTC_FLOAT 0x82D3
+#endif
+
+#ifndef GL_ARB_invalidate_subdata
+#endif
+
+#ifndef GL_ARB_multi_draw_indirect
+#endif
+
+#ifndef GL_ARB_program_interface_query
+#define GL_UNIFORM 0x92E1
+#define GL_UNIFORM_BLOCK 0x92E2
+#define GL_PROGRAM_INPUT 0x92E3
+#define GL_PROGRAM_OUTPUT 0x92E4
+#define GL_BUFFER_VARIABLE 0x92E5
+#define GL_SHADER_STORAGE_BLOCK 0x92E6
+/* reuse GL_ATOMIC_COUNTER_BUFFER */
+#define GL_VERTEX_SUBROUTINE 0x92E8
+#define GL_TESS_CONTROL_SUBROUTINE 0x92E9
+#define GL_TESS_EVALUATION_SUBROUTINE 0x92EA
+#define GL_GEOMETRY_SUBROUTINE 0x92EB
+#define GL_FRAGMENT_SUBROUTINE 0x92EC
+#define GL_COMPUTE_SUBROUTINE 0x92ED
+#define GL_VERTEX_SUBROUTINE_UNIFORM 0x92EE
+#define GL_TESS_CONTROL_SUBROUTINE_UNIFORM 0x92EF
+#define GL_TESS_EVALUATION_SUBROUTINE_UNIFORM 0x92F0
+#define GL_GEOMETRY_SUBROUTINE_UNIFORM 0x92F1
+#define GL_FRAGMENT_SUBROUTINE_UNIFORM 0x92F2
+#define GL_COMPUTE_SUBROUTINE_UNIFORM 0x92F3
+#define GL_TRANSFORM_FEEDBACK_VARYING 0x92F4
+#define GL_ACTIVE_RESOURCES 0x92F5
+#define GL_MAX_NAME_LENGTH 0x92F6
+#define GL_MAX_NUM_ACTIVE_VARIABLES 0x92F7
+#define GL_MAX_NUM_COMPATIBLE_SUBROUTINES 0x92F8
+#define GL_NAME_LENGTH 0x92F9
+#define GL_TYPE 0x92FA
+#define GL_ARRAY_SIZE 0x92FB
+#define GL_OFFSET 0x92FC
+#define GL_BLOCK_INDEX 0x92FD
+#define GL_ARRAY_STRIDE 0x92FE
+#define GL_MATRIX_STRIDE 0x92FF
+#define GL_IS_ROW_MAJOR 0x9300
+#define GL_ATOMIC_COUNTER_BUFFER_INDEX 0x9301
+#define GL_BUFFER_BINDING 0x9302
+#define GL_BUFFER_DATA_SIZE 0x9303
+#define GL_NUM_ACTIVE_VARIABLES 0x9304
+#define GL_ACTIVE_VARIABLES 0x9305
+#define GL_REFERENCED_BY_VERTEX_SHADER 0x9306
+#define GL_REFERENCED_BY_TESS_CONTROL_SHADER 0x9307
+#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER 0x9308
+#define GL_REFERENCED_BY_GEOMETRY_SHADER 0x9309
+#define GL_REFERENCED_BY_FRAGMENT_SHADER 0x930A
+#define GL_REFERENCED_BY_COMPUTE_SHADER 0x930B
+#define GL_TOP_LEVEL_ARRAY_SIZE 0x930C
+#define GL_TOP_LEVEL_ARRAY_STRIDE 0x930D
+#define GL_LOCATION 0x930E
+#define GL_LOCATION_INDEX 0x930F
+#define GL_IS_PER_PATCH 0x92E7
+/* reuse GL_NUM_COMPATIBLE_SUBROUTINES */
+/* reuse GL_COMPATIBLE_SUBROUTINES */
+#endif
+
+#ifndef GL_ARB_robust_buffer_access_behavior
+#endif
+
+#ifndef GL_ARB_shader_image_size
+#endif
+
+#ifndef GL_ARB_shader_storage_buffer_object
+#define GL_SHADER_STORAGE_BUFFER 0x90D2
+#define GL_SHADER_STORAGE_BUFFER_BINDING 0x90D3
+#define GL_SHADER_STORAGE_BUFFER_START 0x90D4
+#define GL_SHADER_STORAGE_BUFFER_SIZE 0x90D5
+#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6
+#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS 0x90D7
+#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS 0x90D8
+#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS 0x90D9
+#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA
+#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB
+#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC
+#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD
+#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE
+#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF
+#define GL_SHADER_STORAGE_BARRIER_BIT 0x2000
+#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS
+/* reuse GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS */
+#endif
+
+#ifndef GL_ARB_stencil_texturing
+#define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA
+#endif
+
+#ifndef GL_ARB_texture_buffer_range
+#define GL_TEXTURE_BUFFER_OFFSET 0x919D
+#define GL_TEXTURE_BUFFER_SIZE 0x919E
+#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT 0x919F
+#endif
+
+#ifndef GL_ARB_texture_query_levels
+#endif
+
+#ifndef GL_ARB_texture_storage_multisample
+#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
+#define GL_RGBA_DXT5_S3TC 0x83A4
+#define GL_RGBA4_DXT5_S3TC 0x83A5
+#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_RGBA_FLOAT_MODE_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_COMPONENTS_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_MESSAGE_LENGTH_AMD 0x9143
+#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
+
+#ifndef GL_NV_path_rendering
+#define GL_PATH_FORMAT_SVG_NV 0x9070
+#define GL_PATH_FORMAT_PS_NV 0x9071
+#define GL_STANDARD_FONT_NAME_NV 0x9072
+#define GL_SYSTEM_FONT_NAME_NV 0x9073
+#define GL_FILE_NAME_NV 0x9074
+#define GL_PATH_STROKE_WIDTH_NV 0x9075
+#define GL_PATH_END_CAPS_NV 0x9076
+#define GL_PATH_INITIAL_END_CAP_NV 0x9077
+#define GL_PATH_TERMINAL_END_CAP_NV 0x9078
+#define GL_PATH_JOIN_STYLE_NV 0x9079
+#define GL_PATH_MITER_LIMIT_NV 0x907A
+#define GL_PATH_DASH_CAPS_NV 0x907B
+#define GL_PATH_INITIAL_DASH_CAP_NV 0x907C
+#define GL_PATH_TERMINAL_DASH_CAP_NV 0x907D
+#define GL_PATH_DASH_OFFSET_NV 0x907E
+#define GL_PATH_CLIENT_LENGTH_NV 0x907F
+#define GL_PATH_FILL_MODE_NV 0x9080
+#define GL_PATH_FILL_MASK_NV 0x9081
+#define GL_PATH_FILL_COVER_MODE_NV 0x9082
+#define GL_PATH_STROKE_COVER_MODE_NV 0x9083
+#define GL_PATH_STROKE_MASK_NV 0x9084
+#define GL_PATH_SAMPLE_QUALITY_NV 0x9085
+#define GL_PATH_STROKE_BOUND_NV 0x9086
+#define GL_PATH_STROKE_OVERSAMPLE_COUNT_NV 0x9087
+#define GL_COUNT_UP_NV 0x9088
+#define GL_COUNT_DOWN_NV 0x9089
+#define GL_PATH_OBJECT_BOUNDING_BOX_NV 0x908A
+#define GL_CONVEX_HULL_NV 0x908B
+#define GL_MULTI_HULLS_NV 0x908C
+#define GL_BOUNDING_BOX_NV 0x908D
+#define GL_TRANSLATE_X_NV 0x908E
+#define GL_TRANSLATE_Y_NV 0x908F
+#define GL_TRANSLATE_2D_NV 0x9090
+#define GL_TRANSLATE_3D_NV 0x9091
+#define GL_AFFINE_2D_NV 0x9092
+#define GL_PROJECTIVE_2D_NV 0x9093
+#define GL_AFFINE_3D_NV 0x9094
+#define GL_PROJECTIVE_3D_NV 0x9095
+#define GL_TRANSPOSE_AFFINE_2D_NV 0x9096
+#define GL_TRANSPOSE_PROJECTIVE_2D_NV 0x9097
+#define GL_TRANSPOSE_AFFINE_3D_NV 0x9098
+#define GL_TRANSPOSE_PROJECTIVE_3D_NV 0x9099
+#define GL_UTF8_NV 0x909A
+#define GL_UTF16_NV 0x909B
+#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV 0x909C
+#define GL_PATH_COMMAND_COUNT_NV 0x909D
+#define GL_PATH_COORD_COUNT_NV 0x909E
+#define GL_PATH_DASH_ARRAY_COUNT_NV 0x909F
+#define GL_PATH_COMPUTED_LENGTH_NV 0x90A0
+#define GL_PATH_FILL_BOUNDING_BOX_NV 0x90A1
+#define GL_PATH_STROKE_BOUNDING_BOX_NV 0x90A2
+#define GL_SQUARE_NV 0x90A3
+#define GL_ROUND_NV 0x90A4
+#define GL_TRIANGULAR_NV 0x90A5
+#define GL_BEVEL_NV 0x90A6
+#define GL_MITER_REVERT_NV 0x90A7
+#define GL_MITER_TRUNCATE_NV 0x90A8
+#define GL_SKIP_MISSING_GLYPH_NV 0x90A9
+#define GL_USE_MISSING_GLYPH_NV 0x90AA
+#define GL_PATH_ERROR_POSITION_NV 0x90AB
+#define GL_PATH_FOG_GEN_MODE_NV 0x90AC
+#define GL_ACCUM_ADJACENT_PAIRS_NV 0x90AD
+#define GL_ADJACENT_PAIRS_NV 0x90AE
+#define GL_FIRST_TO_REST_NV 0x90AF
+#define GL_PATH_GEN_MODE_NV 0x90B0
+#define GL_PATH_GEN_COEFF_NV 0x90B1
+#define GL_PATH_GEN_COLOR_FORMAT_NV 0x90B2
+#define GL_PATH_GEN_COMPONENTS_NV 0x90B3
+#define GL_PATH_STENCIL_FUNC_NV 0x90B7
+#define GL_PATH_STENCIL_REF_NV 0x90B8
+#define GL_PATH_STENCIL_VALUE_MASK_NV 0x90B9
+#define GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV 0x90BD
+#define GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV 0x90BE
+#define GL_PATH_COVER_DEPTH_FUNC_NV 0x90BF
+#define GL_PATH_DASH_OFFSET_RESET_NV 0x90B4
+#define GL_MOVE_TO_RESETS_NV 0x90B5
+#define GL_MOVE_TO_CONTINUES_NV 0x90B6
+#define GL_CLOSE_PATH_NV 0x00
+#define GL_MOVE_TO_NV 0x02
+#define GL_RELATIVE_MOVE_TO_NV 0x03
+#define GL_LINE_TO_NV 0x04
+#define GL_RELATIVE_LINE_TO_NV 0x05
+#define GL_HORIZONTAL_LINE_TO_NV 0x06
+#define GL_RELATIVE_HORIZONTAL_LINE_TO_NV 0x07
+#define GL_VERTICAL_LINE_TO_NV 0x08
+#define GL_RELATIVE_VERTICAL_LINE_TO_NV 0x09
+#define GL_QUADRATIC_CURVE_TO_NV 0x0A
+#define GL_RELATIVE_QUADRATIC_CURVE_TO_NV 0x0B
+#define GL_CUBIC_CURVE_TO_NV 0x0C
+#define GL_RELATIVE_CUBIC_CURVE_TO_NV 0x0D
+#define GL_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0E
+#define GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0F
+#define GL_SMOOTH_CUBIC_CURVE_TO_NV 0x10
+#define GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV 0x11
+#define GL_SMALL_CCW_ARC_TO_NV 0x12
+#define GL_RELATIVE_SMALL_CCW_ARC_TO_NV 0x13
+#define GL_SMALL_CW_ARC_TO_NV 0x14
+#define GL_RELATIVE_SMALL_CW_ARC_TO_NV 0x15
+#define GL_LARGE_CCW_ARC_TO_NV 0x16
+#define GL_RELATIVE_LARGE_CCW_ARC_TO_NV 0x17
+#define GL_LARGE_CW_ARC_TO_NV 0x18
+#define GL_RELATIVE_LARGE_CW_ARC_TO_NV 0x19
+#define GL_RESTART_PATH_NV 0xF0
+#define GL_DUP_FIRST_CUBIC_CURVE_TO_NV 0xF2
+#define GL_DUP_LAST_CUBIC_CURVE_TO_NV 0xF4
+#define GL_RECT_NV 0xF6
+#define GL_CIRCULAR_CCW_ARC_TO_NV 0xF8
+#define GL_CIRCULAR_CW_ARC_TO_NV 0xFA
+#define GL_CIRCULAR_TANGENT_ARC_TO_NV 0xFC
+#define GL_ARC_TO_NV 0xFE
+#define GL_RELATIVE_ARC_TO_NV 0xFF
+#define GL_BOLD_BIT_NV 0x01
+#define GL_ITALIC_BIT_NV 0x02
+#define GL_GLYPH_WIDTH_BIT_NV 0x01
+#define GL_GLYPH_HEIGHT_BIT_NV 0x02
+#define GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV 0x04
+#define GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV 0x08
+#define GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV 0x10
+#define GL_GLYPH_VERTICAL_BEARING_X_BIT_NV 0x20
+#define GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV 0x40
+#define GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV 0x80
+#define GL_GLYPH_HAS_KERNING_NV 0x100
+#define GL_FONT_X_MIN_BOUNDS_NV 0x00010000
+#define GL_FONT_Y_MIN_BOUNDS_NV 0x00020000
+#define GL_FONT_X_MAX_BOUNDS_NV 0x00040000
+#define GL_FONT_Y_MAX_BOUNDS_NV 0x00080000
+#define GL_FONT_UNITS_PER_EM_NV 0x00100000
+#define GL_FONT_ASCENDER_NV 0x00200000
+#define GL_FONT_DESCENDER_NV 0x00400000
+#define GL_FONT_HEIGHT_NV 0x00800000
+#define GL_FONT_MAX_ADVANCE_WIDTH_NV 0x01000000
+#define GL_FONT_MAX_ADVANCE_HEIGHT_NV 0x02000000
+#define GL_FONT_UNDERLINE_POSITION_NV 0x04000000
+#define GL_FONT_UNDERLINE_THICKNESS_NV 0x08000000
+#define GL_FONT_HAS_KERNING_NV 0x10000000
+#endif
+
+#ifndef GL_AMD_pinned_memory
+#define GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD 0x9160
+#endif
+
+#ifndef GL_AMD_stencil_operation_extended
+#define GL_SET_AMD 0x874A
+#define GL_REPLACE_VALUE_AMD 0x874B
+#define GL_STENCIL_OP_VALUE_AMD 0x874C
+#define GL_STENCIL_BACK_OP_VALUE_AMD 0x874D
+#endif
+
+#ifndef GL_AMD_vertex_shader_viewport_index
+#endif
+
+#ifndef GL_AMD_vertex_shader_layer
+#endif
+
+#ifndef GL_NV_bindless_texture
+#endif
+
+#ifndef GL_NV_shader_atomic_float
+#endif
+
+#ifndef GL_AMD_query_buffer_object
+#define GL_QUERY_BUFFER_AMD 0x9192
+#define GL_QUERY_BUFFER_BINDING_AMD 0x9193
+#define GL_QUERY_RESULT_NO_WAIT_AMD 0x9194
+#endif
+
+#ifndef GL_AMD_sparse_texture
+#define GL_VIRTUAL_PAGE_SIZE_X_AMD 0x9195
+#define GL_VIRTUAL_PAGE_SIZE_Y_AMD 0x9196
+#define GL_VIRTUAL_PAGE_SIZE_Z_AMD 0x9197
+#define GL_MAX_SPARSE_TEXTURE_SIZE_AMD 0x9198
+#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_AMD 0x9199
+#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS 0x919A
+#define GL_MIN_SPARSE_LEVEL_AMD 0x919B
+#define GL_MIN_LOD_WARNING_AMD 0x919C
+#define GL_TEXTURE_STORAGE_SPARSE_BIT_AMD 0x00000001
+#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_KHR_debug
+typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,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 (GLfloat red, GLfloat green, GLfloat blue, GLfloat 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);
+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 PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat 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);
+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 (GLfloat 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);
+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 PFNGLACTIVETEXTUREPROC) (GLenum texture);
+typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat 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);
+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 drawcount);
+GLAPI void APIENTRY glMultiDrawElements (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount);
+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);
+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 PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
+typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
+typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount);
+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);
+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* const *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* const *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* const *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* const *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 instancecount);
+GLAPI void APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount);
+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 instancecount);
+typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount);
+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 (GLfloat 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) (GLfloat 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_VERSION_4_3
+#define GL_VERSION_4_3 1
+/* OpenGL 4.3 reuses entry points from these extensions: */
+/* ARB_arrays_of_arrays (no entry points, GLSL only) */
+/* ARB_fragment_layer_viewport (no entry points, GLSL only) */
+/* ARB_shader_image_size (no entry points, GLSL only) */
+/* ARB_ES3_compatibility (no entry points) */
+/* ARB_clear_buffer_object */
+/* ARB_compute_shader */
+/* ARB_copy_image */
+/* KHR_debug (includes ARB_debug_output commands promoted to KHR without suffixes) */
+/* ARB_explicit_uniform_location (no entry points) */
+/* ARB_framebuffer_no_attachments */
+/* ARB_internalformat_query2 */
+/* ARB_invalidate_subdata */
+/* ARB_multi_draw_indirect */
+/* ARB_program_interface_query */
+/* ARB_robust_buffer_access_behavior (no entry points) */
+/* ARB_shader_storage_buffer_object */
+/* ARB_stencil_texturing (no entry points) */
+/* ARB_texture_buffer_range */
+/* ARB_texture_query_levels (no entry points) */
+/* ARB_texture_storage_multisample */
+/* ARB_texture_view */
+/* ARB_vertex_attrib_binding */
+#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 (GLfloat value, GLboolean invert);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLSAMPLECOVERAGEARBPROC) (GLfloat 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* const *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* const *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 instancecount, GLint basevertex);
+GLAPI void APIENTRY glMultiDrawElementsBaseVertex (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, 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 instancecount, GLint basevertex);
+typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, 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 (GLfloat value);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLMINSAMPLESHADINGARBPROC) (GLfloat 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 (GLfloat n, GLfloat f);
+GLAPI void APIENTRY glClearDepthf (GLfloat 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) (GLfloat n, GLfloat f);
+typedef void (APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat 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* const *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* const *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 GLdouble *v);
+GLAPI void APIENTRY glDepthRangeIndexed (GLuint index, GLdouble n, GLdouble 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 GLdouble *v);
+typedef void (APIENTRYP PFNGLDEPTHRANGEINDEXEDPROC) (GLuint index, GLdouble n, GLdouble 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 instancecount, GLuint baseinstance);
+GLAPI void APIENTRY glDrawElementsInstancedBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);
+GLAPI void APIENTRY glDrawElementsInstancedBaseVertexBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);
+typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);
+typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, 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 instancecount);
+GLAPI void APIENTRY glDrawTransformFeedbackStreamInstanced (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC) (GLenum mode, GLuint id, GLsizei instancecount);
+typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount);
+#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_KHR_texture_compression_astc_ldr
+#define GL_KHR_texture_compression_astc_ldr 1
+#endif
+
+#ifndef GL_KHR_debug
+#define GL_KHR_debug 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDebugMessageControl (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
+GLAPI void APIENTRY glDebugMessageInsert (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
+GLAPI void APIENTRY glDebugMessageCallback (GLDEBUGPROC callback, const void *userParam);
+GLAPI GLuint APIENTRY glGetDebugMessageLog (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
+GLAPI void APIENTRY glPushDebugGroup (GLenum source, GLuint id, GLsizei length, const GLchar *message);
+GLAPI void APIENTRY glPopDebugGroup (void);
+GLAPI void APIENTRY glObjectLabel (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
+GLAPI void APIENTRY glGetObjectLabel (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
+GLAPI void APIENTRY glObjectPtrLabel (const void *ptr, GLsizei length, const GLchar *label);
+GLAPI void APIENTRY glGetObjectPtrLabel (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
+typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
+typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, const void *userParam);
+typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
+typedef void (APIENTRYP PFNGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message);
+typedef void (APIENTRYP PFNGLPOPDEBUGGROUPPROC) (void);
+typedef void (APIENTRYP PFNGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
+typedef void (APIENTRYP PFNGLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
+typedef void (APIENTRYP PFNGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar *label);
+typedef void (APIENTRYP PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
+#endif
+
+#ifndef GL_ARB_arrays_of_arrays
+#define GL_ARB_arrays_of_arrays 1
+#endif
+
+#ifndef GL_ARB_clear_buffer_object
+#define GL_ARB_clear_buffer_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glClearBufferData (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data);
+GLAPI void APIENTRY glClearBufferSubData (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
+GLAPI void APIENTRY glClearNamedBufferDataEXT (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data);
+GLAPI void APIENTRY glClearNamedBufferSubDataEXT (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, GLsizeiptr offset, GLsizeiptr size, const void *data);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCLEARBUFFERDATAPROC) (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data);
+typedef void (APIENTRYP PFNGLCLEARBUFFERSUBDATAPROC) (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
+typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data);
+typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, GLsizeiptr offset, GLsizeiptr size, const void *data);
+#endif
+
+#ifndef GL_ARB_compute_shader
+#define GL_ARB_compute_shader 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glDispatchCompute (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
+GLAPI void APIENTRY glDispatchComputeIndirect (GLintptr indirect);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
+typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect);
+#endif
+
+#ifndef GL_ARB_copy_image
+#define GL_ARB_copy_image 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glCopyImageSubData (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
+#endif
+
+#ifndef GL_ARB_texture_view
+#define GL_ARB_texture_view 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTextureView (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTEXTUREVIEWPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
+#endif
+
+#ifndef GL_ARB_vertex_attrib_binding
+#define GL_ARB_vertex_attrib_binding 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
+GLAPI void APIENTRY glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
+GLAPI void APIENTRY glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
+GLAPI void APIENTRY glVertexAttribLFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
+GLAPI void APIENTRY glVertexAttribBinding (GLuint attribindex, GLuint bindingindex);
+GLAPI void APIENTRY glVertexBindingDivisor (GLuint bindingindex, GLuint divisor);
+GLAPI void APIENTRY glVertexArrayBindVertexBufferEXT (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
+GLAPI void APIENTRY glVertexArrayVertexAttribFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
+GLAPI void APIENTRY glVertexArrayVertexAttribIFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
+GLAPI void APIENTRY glVertexArrayVertexAttribLFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
+GLAPI void APIENTRY glVertexArrayVertexAttribBindingEXT (GLuint vaobj, GLuint attribindex, GLuint bindingindex);
+GLAPI void APIENTRY glVertexArrayVertexBindingDivisorEXT (GLuint vaobj, GLuint bindingindex, GLuint divisor);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERPROC) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
+typedef void (APIENTRYP PFNGLVERTEXATTRIBBINDINGPROC) (GLuint attribindex, GLuint bindingindex);
+typedef void (APIENTRYP PFNGLVERTEXBINDINGDIVISORPROC) (GLuint bindingindex, GLuint divisor);
+typedef void (APIENTRYP PFNGLVERTEXARRAYBINDVERTEXBUFFEREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
+typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
+typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBIFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
+typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
+typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBBINDINGEXTPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex);
+typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBINDINGDIVISOREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor);
+#endif
+
+#ifndef GL_ARB_robustness_isolation
+#define GL_ARB_robustness_isolation 1
+#endif
+
+#ifndef GL_ARB_ES3_compatibility
+#define GL_ARB_ES3_compatibility 1
+#endif
+
+#ifndef GL_ARB_explicit_uniform_location
+#define GL_ARB_explicit_uniform_location 1
+#endif
+
+#ifndef GL_ARB_fragment_layer_viewport
+#define GL_ARB_fragment_layer_viewport 1
+#endif
+
+#ifndef GL_ARB_framebuffer_no_attachments
+#define GL_ARB_framebuffer_no_attachments 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glFramebufferParameteri (GLenum target, GLenum pname, GLint param);
+GLAPI void APIENTRY glGetFramebufferParameteriv (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glNamedFramebufferParameteriEXT (GLuint framebuffer, GLenum pname, GLint param);
+GLAPI void APIENTRY glGetNamedFramebufferParameterivEXT (GLuint framebuffer, GLenum pname, GLint *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLFRAMEBUFFERPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
+typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC) (GLuint framebuffer, GLenum pname, GLint param);
+typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint *params);
+#endif
+
+#ifndef GL_ARB_internalformat_query2
+#define GL_ARB_internalformat_query2 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetInternalformati64v (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETINTERNALFORMATI64VPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params);
+#endif
+
+#ifndef GL_ARB_invalidate_subdata
+#define GL_ARB_invalidate_subdata 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glInvalidateTexSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);
+GLAPI void APIENTRY glInvalidateTexImage (GLuint texture, GLint level);
+GLAPI void APIENTRY glInvalidateBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr length);
+GLAPI void APIENTRY glInvalidateBufferData (GLuint buffer);
+GLAPI void APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments);
+GLAPI void APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLINVALIDATETEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);
+typedef void (APIENTRYP PFNGLINVALIDATETEXIMAGEPROC) (GLuint texture, GLint level);
+typedef void (APIENTRYP PFNGLINVALIDATEBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length);
+typedef void (APIENTRYP PFNGLINVALIDATEBUFFERDATAPROC) (GLuint buffer);
+typedef void (APIENTRYP PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
+typedef void (APIENTRYP PFNGLINVALIDATESUBFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
+#endif
+
+#ifndef GL_ARB_multi_draw_indirect
+#define GL_ARB_multi_draw_indirect 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glMultiDrawArraysIndirect (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);
+GLAPI void APIENTRY glMultiDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);
+typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);
+#endif
+
+#ifndef GL_ARB_program_interface_query
+#define GL_ARB_program_interface_query 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetProgramInterfaceiv (GLuint program, GLenum programInterface, GLenum pname, GLint *params);
+GLAPI GLuint APIENTRY glGetProgramResourceIndex (GLuint program, GLenum programInterface, const GLchar *name);
+GLAPI void APIENTRY glGetProgramResourceName (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
+GLAPI void APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
+GLAPI GLint APIENTRY glGetProgramResourceLocation (GLuint program, GLenum programInterface, const GLchar *name);
+GLAPI GLint APIENTRY glGetProgramResourceLocationIndex (GLuint program, GLenum programInterface, const GLchar *name);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETPROGRAMINTERFACEIVPROC) (GLuint program, GLenum programInterface, GLenum pname, GLint *params);
+typedef GLuint (APIENTRYP PFNGLGETPROGRAMRESOURCEINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name);
+typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCENAMEPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
+typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
+typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint program, GLenum programInterface, const GLchar *name);
+typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name);
+#endif
+
+#ifndef GL_ARB_robust_buffer_access_behavior
+#define GL_ARB_robust_buffer_access_behavior 1
+#endif
+
+#ifndef GL_ARB_shader_image_size
+#define GL_ARB_shader_image_size 1
+#endif
+
+#ifndef GL_ARB_shader_storage_buffer_object
+#define GL_ARB_shader_storage_buffer_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glShaderStorageBlockBinding (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLSHADERSTORAGEBLOCKBINDINGPROC) (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding);
+#endif
+
+#ifndef GL_ARB_stencil_texturing
+#define GL_ARB_stencil_texturing 1
+#endif
+
+#ifndef GL_ARB_texture_buffer_range
+#define GL_ARB_texture_buffer_range 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTexBufferRange (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
+GLAPI void APIENTRY glTextureBufferRangeEXT (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTEXBUFFERRANGEPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
+typedef void (APIENTRYP PFNGLTEXTUREBUFFERRANGEEXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
+#endif
+
+#ifndef GL_ARB_texture_query_levels
+#define GL_ARB_texture_query_levels 1
+#endif
+
+#ifndef GL_ARB_texture_storage_multisample
+#define GL_ARB_texture_storage_multisample 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTexStorage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
+GLAPI void APIENTRY glTexStorage3DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
+GLAPI void APIENTRY glTextureStorage2DMultisampleEXT (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
+GLAPI void APIENTRY glTextureStorage3DMultisampleEXT (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTEXSTORAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
+typedef void (APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
+typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
+typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
+#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 (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLBLENDCOLOREXTPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat 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);
+GLAPI void APIENTRY glGetPixelTransformParameterivEXT (GLenum target, GLenum pname, GLint *params);
+GLAPI void APIENTRY glGetPixelTransformParameterfvEXT (GLenum target, GLenum pname, 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);
+typedef void (APIENTRYP PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, 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 (GLint 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) (GLint 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, const GLvoid *pointer);
+GLAPI void APIENTRY glFlushPixelDataRangeNV (GLenum target);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, const 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 (const 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) (const 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
+
+#ifndef GL_NV_path_rendering
+#define GL_NV_path_rendering 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI GLuint APIENTRY glGenPathsNV (GLsizei range);
+GLAPI void APIENTRY glDeletePathsNV (GLuint path, GLsizei range);
+GLAPI GLboolean APIENTRY glIsPathNV (GLuint path);
+GLAPI void APIENTRY glPathCommandsNV (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const GLvoid *coords);
+GLAPI void APIENTRY glPathCoordsNV (GLuint path, GLsizei numCoords, GLenum coordType, const GLvoid *coords);
+GLAPI void APIENTRY glPathSubCommandsNV (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const GLvoid *coords);
+GLAPI void APIENTRY glPathSubCoordsNV (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const GLvoid *coords);
+GLAPI void APIENTRY glPathStringNV (GLuint path, GLenum format, GLsizei length, const GLvoid *pathString);
+GLAPI void APIENTRY glPathGlyphsNV (GLuint firstPathName, GLenum fontTarget, const GLvoid *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const GLvoid *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
+GLAPI void APIENTRY glPathGlyphRangeNV (GLuint firstPathName, GLenum fontTarget, const GLvoid *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
+GLAPI void APIENTRY glWeightPathsNV (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights);
+GLAPI void APIENTRY glCopyPathNV (GLuint resultPath, GLuint srcPath);
+GLAPI void APIENTRY glInterpolatePathsNV (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight);
+GLAPI void APIENTRY glTransformPathNV (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues);
+GLAPI void APIENTRY glPathParameterivNV (GLuint path, GLenum pname, const GLint *value);
+GLAPI void APIENTRY glPathParameteriNV (GLuint path, GLenum pname, GLint value);
+GLAPI void APIENTRY glPathParameterfvNV (GLuint path, GLenum pname, const GLfloat *value);
+GLAPI void APIENTRY glPathParameterfNV (GLuint path, GLenum pname, GLfloat value);
+GLAPI void APIENTRY glPathDashArrayNV (GLuint path, GLsizei dashCount, const GLfloat *dashArray);
+GLAPI void APIENTRY glPathStencilFuncNV (GLenum func, GLint ref, GLuint mask);
+GLAPI void APIENTRY glPathStencilDepthOffsetNV (GLfloat factor, GLfloat units);
+GLAPI void APIENTRY glStencilFillPathNV (GLuint path, GLenum fillMode, GLuint mask);
+GLAPI void APIENTRY glStencilStrokePathNV (GLuint path, GLint reference, GLuint mask);
+GLAPI void APIENTRY glStencilFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues);
+GLAPI void APIENTRY glStencilStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues);
+GLAPI void APIENTRY glPathCoverDepthFuncNV (GLenum func);
+GLAPI void APIENTRY glPathColorGenNV (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs);
+GLAPI void APIENTRY glPathTexGenNV (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs);
+GLAPI void APIENTRY glPathFogGenNV (GLenum genMode);
+GLAPI void APIENTRY glCoverFillPathNV (GLuint path, GLenum coverMode);
+GLAPI void APIENTRY glCoverStrokePathNV (GLuint path, GLenum coverMode);
+GLAPI void APIENTRY glCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
+GLAPI void APIENTRY glCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
+GLAPI void APIENTRY glGetPathParameterivNV (GLuint path, GLenum pname, GLint *value);
+GLAPI void APIENTRY glGetPathParameterfvNV (GLuint path, GLenum pname, GLfloat *value);
+GLAPI void APIENTRY glGetPathCommandsNV (GLuint path, GLubyte *commands);
+GLAPI void APIENTRY glGetPathCoordsNV (GLuint path, GLfloat *coords);
+GLAPI void APIENTRY glGetPathDashArrayNV (GLuint path, GLfloat *dashArray);
+GLAPI void APIENTRY glGetPathMetricsNV (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics);
+GLAPI void APIENTRY glGetPathMetricRangeNV (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics);
+GLAPI void APIENTRY glGetPathSpacingNV (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing);
+GLAPI void APIENTRY glGetPathColorGenivNV (GLenum color, GLenum pname, GLint *value);
+GLAPI void APIENTRY glGetPathColorGenfvNV (GLenum color, GLenum pname, GLfloat *value);
+GLAPI void APIENTRY glGetPathTexGenivNV (GLenum texCoordSet, GLenum pname, GLint *value);
+GLAPI void APIENTRY glGetPathTexGenfvNV (GLenum texCoordSet, GLenum pname, GLfloat *value);
+GLAPI GLboolean APIENTRY glIsPointInFillPathNV (GLuint path, GLuint mask, GLfloat x, GLfloat y);
+GLAPI GLboolean APIENTRY glIsPointInStrokePathNV (GLuint path, GLfloat x, GLfloat y);
+GLAPI GLfloat APIENTRY glGetPathLengthNV (GLuint path, GLsizei startSegment, GLsizei numSegments);
+GLAPI GLboolean APIENTRY glPointAlongPathNV (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLuint (APIENTRYP PFNGLGENPATHSNVPROC) (GLsizei range);
+typedef void (APIENTRYP PFNGLDELETEPATHSNVPROC) (GLuint path, GLsizei range);
+typedef GLboolean (APIENTRYP PFNGLISPATHNVPROC) (GLuint path);
+typedef void (APIENTRYP PFNGLPATHCOMMANDSNVPROC) (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const GLvoid *coords);
+typedef void (APIENTRYP PFNGLPATHCOORDSNVPROC) (GLuint path, GLsizei numCoords, GLenum coordType, const GLvoid *coords);
+typedef void (APIENTRYP PFNGLPATHSUBCOMMANDSNVPROC) (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const GLvoid *coords);
+typedef void (APIENTRYP PFNGLPATHSUBCOORDSNVPROC) (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const GLvoid *coords);
+typedef void (APIENTRYP PFNGLPATHSTRINGNVPROC) (GLuint path, GLenum format, GLsizei length, const GLvoid *pathString);
+typedef void (APIENTRYP PFNGLPATHGLYPHSNVPROC) (GLuint firstPathName, GLenum fontTarget, const GLvoid *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const GLvoid *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
+typedef void (APIENTRYP PFNGLPATHGLYPHRANGENVPROC) (GLuint firstPathName, GLenum fontTarget, const GLvoid *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
+typedef void (APIENTRYP PFNGLWEIGHTPATHSNVPROC) (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights);
+typedef void (APIENTRYP PFNGLCOPYPATHNVPROC) (GLuint resultPath, GLuint srcPath);
+typedef void (APIENTRYP PFNGLINTERPOLATEPATHSNVPROC) (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight);
+typedef void (APIENTRYP PFNGLTRANSFORMPATHNVPROC) (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues);
+typedef void (APIENTRYP PFNGLPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, const GLint *value);
+typedef void (APIENTRYP PFNGLPATHPARAMETERINVPROC) (GLuint path, GLenum pname, GLint value);
+typedef void (APIENTRYP PFNGLPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, const GLfloat *value);
+typedef void (APIENTRYP PFNGLPATHPARAMETERFNVPROC) (GLuint path, GLenum pname, GLfloat value);
+typedef void (APIENTRYP PFNGLPATHDASHARRAYNVPROC) (GLuint path, GLsizei dashCount, const GLfloat *dashArray);
+typedef void (APIENTRYP PFNGLPATHSTENCILFUNCNVPROC) (GLenum func, GLint ref, GLuint mask);
+typedef void (APIENTRYP PFNGLPATHSTENCILDEPTHOFFSETNVPROC) (GLfloat factor, GLfloat units);
+typedef void (APIENTRYP PFNGLSTENCILFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask);
+typedef void (APIENTRYP PFNGLSTENCILSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask);
+typedef void (APIENTRYP PFNGLSTENCILFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues);
+typedef void (APIENTRYP PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues);
+typedef void (APIENTRYP PFNGLPATHCOVERDEPTHFUNCNVPROC) (GLenum func);
+typedef void (APIENTRYP PFNGLPATHCOLORGENNVPROC) (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs);
+typedef void (APIENTRYP PFNGLPATHTEXGENNVPROC) (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs);
+typedef void (APIENTRYP PFNGLPATHFOGGENNVPROC) (GLenum genMode);
+typedef void (APIENTRYP PFNGLCOVERFILLPATHNVPROC) (GLuint path, GLenum coverMode);
+typedef void (APIENTRYP PFNGLCOVERSTROKEPATHNVPROC) (GLuint path, GLenum coverMode);
+typedef void (APIENTRYP PFNGLCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
+typedef void (APIENTRYP PFNGLCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
+typedef void (APIENTRYP PFNGLGETPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, GLint *value);
+typedef void (APIENTRYP PFNGLGETPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, GLfloat *value);
+typedef void (APIENTRYP PFNGLGETPATHCOMMANDSNVPROC) (GLuint path, GLubyte *commands);
+typedef void (APIENTRYP PFNGLGETPATHCOORDSNVPROC) (GLuint path, GLfloat *coords);
+typedef void (APIENTRYP PFNGLGETPATHDASHARRAYNVPROC) (GLuint path, GLfloat *dashArray);
+typedef void (APIENTRYP PFNGLGETPATHMETRICSNVPROC) (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics);
+typedef void (APIENTRYP PFNGLGETPATHMETRICRANGENVPROC) (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics);
+typedef void (APIENTRYP PFNGLGETPATHSPACINGNVPROC) (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const GLvoid *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing);
+typedef void (APIENTRYP PFNGLGETPATHCOLORGENIVNVPROC) (GLenum color, GLenum pname, GLint *value);
+typedef void (APIENTRYP PFNGLGETPATHCOLORGENFVNVPROC) (GLenum color, GLenum pname, GLfloat *value);
+typedef void (APIENTRYP PFNGLGETPATHTEXGENIVNVPROC) (GLenum texCoordSet, GLenum pname, GLint *value);
+typedef void (APIENTRYP PFNGLGETPATHTEXGENFVNVPROC) (GLenum texCoordSet, GLenum pname, GLfloat *value);
+typedef GLboolean (APIENTRYP PFNGLISPOINTINFILLPATHNVPROC) (GLuint path, GLuint mask, GLfloat x, GLfloat y);
+typedef GLboolean (APIENTRYP PFNGLISPOINTINSTROKEPATHNVPROC) (GLuint path, GLfloat x, GLfloat y);
+typedef GLfloat (APIENTRYP PFNGLGETPATHLENGTHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments);
+typedef GLboolean (APIENTRYP PFNGLPOINTALONGPATHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY);
+#endif
+
+#ifndef GL_AMD_pinned_memory
+#define GL_AMD_pinned_memory 1
+#endif
+
+#ifndef GL_AMD_stencil_operation_extended
+#define GL_AMD_stencil_operation_extended 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glStencilOpValueAMD (GLenum face, GLuint value);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLSTENCILOPVALUEAMDPROC) (GLenum face, GLuint value);
+#endif
+
+#ifndef GL_AMD_vertex_shader_viewport_index
+#define GL_AMD_vertex_shader_viewport_index 1
+#endif
+
+#ifndef GL_AMD_vertex_shader_layer
+#define GL_AMD_vertex_shader_layer 1
+#endif
+
+#ifndef GL_NV_bindless_texture
+#define GL_NV_bindless_texture 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI GLuint64 APIENTRY glGetTextureHandleNV (GLuint texture);
+GLAPI GLuint64 APIENTRY glGetTextureSamplerHandleNV (GLuint texture, GLuint sampler);
+GLAPI void APIENTRY glMakeTextureHandleResidentNV (GLuint64 handle);
+GLAPI void APIENTRY glMakeTextureHandleNonResidentNV (GLuint64 handle);
+GLAPI GLuint64 APIENTRY glGetImageHandleNV (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);
+GLAPI void APIENTRY glMakeImageHandleResidentNV (GLuint64 handle, GLenum access);
+GLAPI void APIENTRY glMakeImageHandleNonResidentNV (GLuint64 handle);
+GLAPI void APIENTRY glUniformHandleui64NV (GLint location, GLuint64 value);
+GLAPI void APIENTRY glUniformHandleui64vNV (GLint location, GLsizei count, const GLuint64 *value);
+GLAPI void APIENTRY glProgramUniformHandleui64NV (GLuint program, GLint location, GLuint64 value);
+GLAPI void APIENTRY glProgramUniformHandleui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
+GLAPI GLboolean APIENTRY glIsTextureHandleResidentNV (GLuint64 handle);
+GLAPI GLboolean APIENTRY glIsImageHandleResidentNV (GLuint64 handle);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLENVPROC) (GLuint texture);
+typedef GLuint64 (APIENTRYP PFNGLGETTEXTURESAMPLERHANDLENVPROC) (GLuint texture, GLuint sampler);
+typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle);
+typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC) (GLuint64 handle);
+typedef GLuint64 (APIENTRYP PFNGLGETIMAGEHANDLENVPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);
+typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle, GLenum access);
+typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC) (GLuint64 handle);
+typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64NVPROC) (GLint location, GLuint64 value);
+typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64VNVPROC) (GLint location, GLsizei count, const GLuint64 *value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC) (GLuint program, GLint location, GLuint64 value);
+typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
+typedef GLboolean (APIENTRYP PFNGLISTEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle);
+typedef GLboolean (APIENTRYP PFNGLISIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle);
+#endif
+
+#ifndef GL_NV_shader_atomic_float
+#define GL_NV_shader_atomic_float 1
+#endif
+
+#ifndef GL_AMD_query_buffer_object
+#define GL_AMD_query_buffer_object 1
+#endif
+
+#ifndef GL_AMD_sparse_texture
+#define GL_AMD_sparse_texture 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTexStorageSparseAMD (GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags);
+GLAPI void APIENTRY glTextureStorageSparseAMD (GLuint texture, GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTEXSTORAGESPARSEAMDPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags);
+typedef void (APIENTRYP PFNGLTEXTURESTORAGESPARSEAMDPROC) (GLuint texture, GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags);
+#endif
+
+
+#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_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-2012 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 2012/02/29 */
+/* Current version at http://www.opengl.org/registry/ */
+#define GLX_GLXEXT_VERSION 33
+
+#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_EXT_swap_control_tear
+#define GLX_LATE_SWAPS_TEAR_EXT 0x20F3
+#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 void glXSwapIntervalEXT (Display *dpy, GLXDrawable drawable, int interval);
+#endif /* GLX_GLXEXT_PROTOTYPES */
+typedef void ( * 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
+
+#ifndef GLX_EXT_swap_control_tear
+#define GLX_EXT_swap_control_tear 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 /**< OpenGL ES 1.x */
+#define __DRI_API_GLES2 2 /**< OpenGL ES 2.0 or 3.0 */
+#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
+
+/**
+ * \requires __DRI2_ROBUSTNESS.
+ */
+#define __DRI_CTX_ATTRIB_RESET_STRATEGY 3
+
+#define __DRI_CTX_FLAG_DEBUG 0x00000001
+#define __DRI_CTX_FLAG_FORWARD_COMPATIBLE 0x00000002
+
+/**
+ * \requires __DRI2_ROBUSTNESS.
+ */
+#define __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS 0x00000004
+
+/**
+ * \name Context reset strategies.
+ */
+/*@{*/
+#define __DRI_CTX_RESET_NO_NOTIFICATION 0
+#define __DRI_CTX_RESET_LOSE_CONTEXT 1
+/*@}*/
+
+/**
+ * \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 5
+
+/**
+ * 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.
+ *
+ * __DRI_IMAGE_FORMAT_NONE is for images that aren't directly usable
+ * by the driver (YUV planar formats) but serve as a base image for
+ * creating sub-images for the different planes within the image.
+ *
+ * R8, GR88 and NONE should not be used with createImageFormName or
+ * createImage, and are returned by query from sub images created with
+ * createImageFromNames (NONE, see above) and fromPlane (R8 & GR88).
+ */
+#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_FORMAT_XBGR8888 0x1005
+#define __DRI_IMAGE_FORMAT_R8 0x1006 /* Since version 5 */
+#define __DRI_IMAGE_FORMAT_GR88 0x1007
+#define __DRI_IMAGE_FORMAT_NONE 0x1008
+
+#define __DRI_IMAGE_USE_SHARE 0x0001
+#define __DRI_IMAGE_USE_SCANOUT 0x0002
+#define __DRI_IMAGE_USE_CURSOR 0x0004 /* Depricated */
+
+
+/**
+ * Four CC formats that matches with WL_DRM_FORMAT_* from wayland_drm.h
+ * and GBM_FORMAT_* from gbm.h, used with createImageFromNames.
+ *
+ * \since 5
+ */
+
+#define __DRI_IMAGE_FOURCC_RGB565 0x36314752
+#define __DRI_IMAGE_FOURCC_ARGB8888 0x34325241
+#define __DRI_IMAGE_FOURCC_XRGB8888 0x34325258
+#define __DRI_IMAGE_FOURCC_ABGR8888 0x34324241
+#define __DRI_IMAGE_FOURCC_XBGR8888 0x34324258
+#define __DRI_IMAGE_FOURCC_YUV410 0x39565559
+#define __DRI_IMAGE_FOURCC_YUV411 0x31315559
+#define __DRI_IMAGE_FOURCC_YUV420 0x32315559
+#define __DRI_IMAGE_FOURCC_YUV422 0x36315559
+#define __DRI_IMAGE_FOURCC_YUV444 0x34325559
+#define __DRI_IMAGE_FOURCC_NV12 0x3231564e
+#define __DRI_IMAGE_FOURCC_NV16 0x3631564e
+#define __DRI_IMAGE_FOURCC_YUYV 0x56595559
+
+
+/**
+ * Queryable on images created by createImageFromNames.
+ *
+ * RGB and RGBA are may be usable directly as images but its still
+ * recommended to call fromPlanar with plane == 0.
+ *
+ * Y_U_V, Y_UV and Y_XUXV all requires call to fromPlanar to create
+ * usable sub-images, sampling from images return raw YUV data and
+ * color conversion needs to be done in the shader.
+ *
+ * \since 5
+ */
+
+#define __DRI_IMAGE_COMPONENTS_RGB 0x3001
+#define __DRI_IMAGE_COMPONENTS_RGBA 0x3002
+#define __DRI_IMAGE_COMPONENTS_Y_U_V 0x3003
+#define __DRI_IMAGE_COMPONENTS_Y_UV 0x3004
+#define __DRI_IMAGE_COMPONENTS_Y_XUXV 0x3005
+
+
+/**
+ * queryImage attributes
+ */
+
+#define __DRI_IMAGE_ATTRIB_STRIDE 0x2000
+#define __DRI_IMAGE_ATTRIB_HANDLE 0x2001
+#define __DRI_IMAGE_ATTRIB_NAME 0x2002
+#define __DRI_IMAGE_ATTRIB_FORMAT 0x2003 /* available in versions 3+ */
+#define __DRI_IMAGE_ATTRIB_WIDTH 0x2004 /* available in versions 4+ */
+#define __DRI_IMAGE_ATTRIB_HEIGHT 0x2005
+#define __DRI_IMAGE_ATTRIB_COMPONENTS 0x2006 /* available in versions 5+ */
+
+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);
+
+ /**
+ * Validate that a __DRIimage can be used a certain way.
+ *
+ * \since 2
+ */
+ GLboolean (*validateUsage)(__DRIimage *image, unsigned int use);
+
+ /**
+ * Unlike createImageFromName __DRI_IMAGE_FORMAT is not but instead
+ * __DRI_IMAGE_FOURCC and strides are in bytes not pixels. Stride is
+ * also per block and not per pixel (for non-RGB, see gallium blocks).
+ *
+ * \since 5
+ */
+ __DRIimage *(*createImageFromNames)(__DRIscreen *screen,
+ int width, int height, int fourcc,
+ int *names, int num_names,
+ int *strides, int *offsets,
+ void *loaderPrivate);
+
+ /**
+ * Create an image out of a sub-region of a parent image. This
+ * entry point lets us create individual __DRIimages for different
+ * planes in a planar buffer (typically yuv), for example. While a
+ * sub-image shares the underlying buffer object with the parent
+ * image and other sibling sub-images, the life times of parent and
+ * sub-images are not dependent. Destroying the parent or a
+ * sub-image doesn't affect other images. The underlying buffer
+ * object is free when no __DRIimage remains that references it.
+ *
+ * Sub-images may overlap, but rendering to overlapping sub-images
+ * is undefined.
+ *
+ * \since 5
+ */
+ __DRIimage *(*fromPlanar)(__DRIimage *image, int plane,
+ 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);
+};
+
+/**
+ * Robust context driver extension.
+ *
+ * Existence of this extension means the driver can accept the
+ * \c __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS flag and the
+ * \c __DRI_CTX_ATTRIB_RESET_STRATEGY attribute in
+ * \c __DRIdri2ExtensionRec::createContextAttribs.
+ */
+#define __DRI2_ROBUSTNESS "DRI_Robustness"
+#define __DRI2_ROBUSTNESS_VERSION 1
+
+typedef struct __DRIrobustnessExtensionRec __DRIrobustnessExtension;
+struct __DRIrobustnessExtensionRec {
+ __DRIextension base;
+};
+
+#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: 13240 $ on $Date:: 2010-12-17 15:16:00 -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_rgb8_rgba8 */
+#ifndef GL_OES_rgb8_rgba8
+#define GL_RGB8_OES 0x8051
+#define GL_RGBA8_OES 0x8058
+#endif
+
+/* GL_OES_stencil1 */
+#ifndef GL_OES_stencil1
+#define GL_STENCIL_INDEX1_OES 0x8D46
+#endif
+
+/* GL_OES_stencil4 */
+#ifndef GL_OES_stencil4
+#define GL_STENCIL_INDEX4_OES 0x8D47
+#endif
+
+/* GL_OES_stencil8 */
+#ifndef GL_OES_stencil8
+#define GL_STENCIL_INDEX8_OES 0x8D48
+#endif
+
+/* GL_OES_stencil_wrap */
+#ifndef GL_OES_stencil_wrap
+#define GL_INCR_WRAP_OES 0x8507
+#define GL_DECR_WRAP_OES 0x8508
+#endif
+
+/* GL_OES_texture_cube_map */
+#ifndef GL_OES_texture_cube_map
+#define GL_NORMAL_MAP_OES 0x8511
+#define GL_REFLECTION_MAP_OES 0x8512
+#define GL_TEXTURE_CUBE_MAP_OES 0x8513
+#define GL_TEXTURE_BINDING_CUBE_MAP_OES 0x8514
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES 0x8515
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES 0x8516
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES 0x8517
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES 0x8518
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES 0x8519
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES 0x851A
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES 0x851C
+#define GL_TEXTURE_GEN_MODE_OES 0x2500
+#define GL_TEXTURE_GEN_STR_OES 0x8D60
+#endif
+
+/* GL_OES_texture_mirrored_repeat */
+#ifndef GL_OES_texture_mirrored_repeat
+#define GL_MIRRORED_REPEAT_OES 0x8370
+#endif
+
+/* GL_OES_vertex_array_object */
+#ifndef GL_OES_vertex_array_object
+#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5
+#endif
+
+/*------------------------------------------------------------------------*
+ * AMD extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_AMD_compressed_3DC_texture */
+#ifndef GL_AMD_compressed_3DC_texture
+#define GL_3DC_X_AMD 0x87F9
+#define GL_3DC_XY_AMD 0x87FA
+#endif
+
+/* GL_AMD_compressed_ATC_texture */
+#ifndef GL_AMD_compressed_ATC_texture
+#define GL_ATC_RGB_AMD 0x8C92
+#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93
+#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE
+#endif
+
+/*------------------------------------------------------------------------*
+ * APPLE extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_APPLE_texture_2D_limited_npot */
+/* No new tokens introduced by this extension. */
+
+/* GL_APPLE_framebuffer_multisample */
+#ifndef GL_APPLE_framebuffer_multisample
+#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56
+#define GL_MAX_SAMPLES_APPLE 0x8D57
+#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8
+#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9
+#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6
+#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA
+#endif
+
+/* GL_APPLE_texture_format_BGRA8888 */
+#ifndef GL_APPLE_texture_format_BGRA8888
+#define GL_BGRA_EXT 0x80E1
+#endif
+
+/* GL_APPLE_texture_max_level */
+#ifndef GL_APPLE_texture_max_level
+#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D
+#endif
+
+/*------------------------------------------------------------------------*
+ * ARM extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_ARM_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_multi_draw_arrays */
+/* No new tokens introduced by this extension. */
+
+/* GL_EXT_read_format_bgra */
+#ifndef GL_EXT_read_format_bgra
+#define GL_BGRA_EXT 0x80E1
+#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365
+#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366
+#endif
+
+/* GL_EXT_texture_filter_anisotropic */
+#ifndef GL_EXT_texture_filter_anisotropic
+#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
+#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
+#endif
+
+/* GL_EXT_texture_format_BGRA8888 */
+#ifndef GL_EXT_texture_format_BGRA8888
+#define GL_BGRA_EXT 0x80E1
+#endif
+
+/* GL_EXT_texture_lod_bias */
+#ifndef GL_EXT_texture_lod_bias
+#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD
+#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500
+#define GL_TEXTURE_LOD_BIAS_EXT 0x8501
+#endif
+
+/*------------------------------------------------------------------------*
+ * IMG extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_IMG_read_format */
+#ifndef GL_IMG_read_format
+#define GL_BGRA_IMG 0x80E1
+#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365
+#endif
+
+/* GL_IMG_texture_compression_pvrtc */
+#ifndef GL_IMG_texture_compression_pvrtc
+#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
+#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
+#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
+#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
+#endif
+
+/* GL_IMG_texture_env_enhanced_fixed_function */
+#ifndef GL_IMG_texture_env_enhanced_fixed_function
+#define GL_MODULATE_COLOR_IMG 0x8C04
+#define GL_RECIP_ADD_SIGNED_ALPHA_IMG 0x8C05
+#define GL_TEXTURE_ALPHA_MODULATE_IMG 0x8C06
+#define GL_FACTOR_ALPHA_MODULATE_IMG 0x8C07
+#define GL_FRAGMENT_ALPHA_MODULATE_IMG 0x8C08
+#define GL_ADD_BLEND_IMG 0x8C09
+#define GL_DOT3_RGBA_IMG 0x86AF
+#endif
+
+/* GL_IMG_user_clip_plane */
+#ifndef GL_IMG_user_clip_plane
+#define GL_CLIP_PLANE0_IMG 0x3000
+#define GL_CLIP_PLANE1_IMG 0x3001
+#define GL_CLIP_PLANE2_IMG 0x3002
+#define GL_CLIP_PLANE3_IMG 0x3003
+#define GL_CLIP_PLANE4_IMG 0x3004
+#define GL_CLIP_PLANE5_IMG 0x3005
+#define GL_MAX_CLIP_PLANES_IMG 0x0D32
+#endif
+
+/* 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_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_texture_2D_limited_npot */
+#ifndef GL_APPLE_texture_2D_limited_npot
+#define GL_APPLE_texture_2D_limited_npot 1
+#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_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_multi_draw_arrays */
+#ifndef GL_EXT_multi_draw_arrays
+#define GL_EXT_multi_draw_arrays 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei);
+GL_API void GL_APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
+#endif
+
+/* GL_EXT_read_format_bgra */
+#ifndef GL_EXT_read_format_bgra
+#define GL_EXT_read_format_bgra 1
+#endif
+
+/* GL_EXT_texture_filter_anisotropic */
+#ifndef GL_EXT_texture_filter_anisotropic
+#define GL_EXT_texture_filter_anisotropic 1
+#endif
+
+/* GL_EXT_texture_format_BGRA8888 */
+#ifndef GL_EXT_texture_format_BGRA8888
+#define GL_EXT_texture_format_BGRA8888 1
+#endif
+
+/* GL_EXT_texture_lod_bias */
+#ifndef GL_EXT_texture_lod_bias
+#define GL_EXT_texture_lod_bias 1
+#endif
+
+/*------------------------------------------------------------------------*
+ * IMG extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_IMG_read_format */
+#ifndef GL_IMG_read_format
+#define GL_IMG_read_format 1
+#endif
+
+/* GL_IMG_texture_compression_pvrtc */
+#ifndef GL_IMG_texture_compression_pvrtc
+#define GL_IMG_texture_compression_pvrtc 1
+#endif
+
+/* GL_IMG_texture_env_enhanced_fixed_function */
+#ifndef GL_IMG_texture_env_enhanced_fixed_function
+#define GL_IMG_texture_env_enhanced_fixed_function 1
+#endif
+
+/* GL_IMG_user_clip_plane */
+#ifndef GL_IMG_user_clip_plane
+#define GL_IMG_user_clip_plane 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glClipPlanefIMG (GLenum, const GLfloat *);
+GL_API void GL_APIENTRY glClipPlanexIMG (GLenum, const GLfixed *);
+#endif
+typedef void (GL_APIENTRYP PFNGLCLIPPLANEFIMGPROC) (GLenum p, const GLfloat *eqn);
+typedef void (GL_APIENTRYP PFNGLCLIPPLANEXIMGPROC) (GLenum p, const GLfixed *eqn);
+#endif
+
+/* 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 PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMG) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
+#endif
+
+/*------------------------------------------------------------------------*
+ * NV extension functions
+ *------------------------------------------------------------------------*/
+
+/* 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_
+
+/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */
+
+#include <GLES2/gl2platform.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/ .
+ */
+
+/*-------------------------------------------------------------------------
+ * Data type definitions
+ *-----------------------------------------------------------------------*/
+
+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;
+
+/* GL types for handling large vertex buffer objects */
+typedef khronos_intptr_t GLintptr;
+typedef khronos_ssize_t GLsizeiptr;
+
+/* OpenGL ES core versions */
+#define GL_ES_VERSION_2_0 1
+
+/* ClearBufferMask */
+#define GL_DEPTH_BUFFER_BIT 0x00000100
+#define GL_STENCIL_BUFFER_BIT 0x00000400
+#define GL_COLOR_BUFFER_BIT 0x00004000
+
+/* Boolean */
+#define GL_FALSE 0
+#define GL_TRUE 1
+
+/* BeginMode */
+#define GL_POINTS 0x0000
+#define GL_LINES 0x0001
+#define GL_LINE_LOOP 0x0002
+#define GL_LINE_STRIP 0x0003
+#define GL_TRIANGLES 0x0004
+#define GL_TRIANGLE_STRIP 0x0005
+#define GL_TRIANGLE_FAN 0x0006
+
+/* AlphaFunction (not supported in ES20) */
+/* GL_NEVER */
+/* GL_LESS */
+/* GL_EQUAL */
+/* GL_LEQUAL */
+/* GL_GREATER */
+/* GL_NOTEQUAL */
+/* GL_GEQUAL */
+/* GL_ALWAYS */
+
+/* BlendingFactorDest */
+#define GL_ZERO 0
+#define GL_ONE 1
+#define GL_SRC_COLOR 0x0300
+#define GL_ONE_MINUS_SRC_COLOR 0x0301
+#define GL_SRC_ALPHA 0x0302
+#define GL_ONE_MINUS_SRC_ALPHA 0x0303
+#define GL_DST_ALPHA 0x0304
+#define GL_ONE_MINUS_DST_ALPHA 0x0305
+
+/* BlendingFactorSrc */
+/* GL_ZERO */
+/* GL_ONE */
+#define GL_DST_COLOR 0x0306
+#define GL_ONE_MINUS_DST_COLOR 0x0307
+#define GL_SRC_ALPHA_SATURATE 0x0308
+/* GL_SRC_ALPHA */
+/* GL_ONE_MINUS_SRC_ALPHA */
+/* GL_DST_ALPHA */
+/* GL_ONE_MINUS_DST_ALPHA */
+
+/* BlendEquationSeparate */
+#define GL_FUNC_ADD 0x8006
+#define GL_BLEND_EQUATION 0x8009
+#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */
+#define GL_BLEND_EQUATION_ALPHA 0x883D
+
+/* BlendSubtract */
+#define GL_FUNC_SUBTRACT 0x800A
+#define GL_FUNC_REVERSE_SUBTRACT 0x800B
+
+/* Separate Blend Functions */
+#define GL_BLEND_DST_RGB 0x80C8
+#define GL_BLEND_SRC_RGB 0x80C9
+#define GL_BLEND_DST_ALPHA 0x80CA
+#define GL_BLEND_SRC_ALPHA 0x80CB
+#define GL_CONSTANT_COLOR 0x8001
+#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
+#define GL_CONSTANT_ALPHA 0x8003
+#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
+#define GL_BLEND_COLOR 0x8005
+
+/* Buffer Objects */
+#define GL_ARRAY_BUFFER 0x8892
+#define GL_ELEMENT_ARRAY_BUFFER 0x8893
+#define GL_ARRAY_BUFFER_BINDING 0x8894
+#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
+
+#define GL_STREAM_DRAW 0x88E0
+#define GL_STATIC_DRAW 0x88E4
+#define GL_DYNAMIC_DRAW 0x88E8
+
+#define GL_BUFFER_SIZE 0x8764
+#define GL_BUFFER_USAGE 0x8765
+
+#define GL_CURRENT_VERTEX_ATTRIB 0x8626
+
+/* CullFaceMode */
+#define GL_FRONT 0x0404
+#define GL_BACK 0x0405
+#define GL_FRONT_AND_BACK 0x0408
+
+/* DepthFunction */
+/* GL_NEVER */
+/* GL_LESS */
+/* GL_EQUAL */
+/* GL_LEQUAL */
+/* GL_GREATER */
+/* GL_NOTEQUAL */
+/* GL_GEQUAL */
+/* GL_ALWAYS */
+
+/* EnableCap */
+#define GL_TEXTURE_2D 0x0DE1
+#define GL_CULL_FACE 0x0B44
+#define GL_BLEND 0x0BE2
+#define GL_DITHER 0x0BD0
+#define GL_STENCIL_TEST 0x0B90
+#define GL_DEPTH_TEST 0x0B71
+#define GL_SCISSOR_TEST 0x0C11
+#define GL_POLYGON_OFFSET_FILL 0x8037
+#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
+#define GL_SAMPLE_COVERAGE 0x80A0
+
+/* ErrorCode */
+#define GL_NO_ERROR 0
+#define GL_INVALID_ENUM 0x0500
+#define GL_INVALID_VALUE 0x0501
+#define GL_INVALID_OPERATION 0x0502
+#define GL_OUT_OF_MEMORY 0x0505
+
+/* FrontFaceDirection */
+#define GL_CW 0x0900
+#define GL_CCW 0x0901
+
+/* GetPName */
+#define GL_LINE_WIDTH 0x0B21
+#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
+#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
+#define GL_CULL_FACE_MODE 0x0B45
+#define GL_FRONT_FACE 0x0B46
+#define GL_DEPTH_RANGE 0x0B70
+#define GL_DEPTH_WRITEMASK 0x0B72
+#define GL_DEPTH_CLEAR_VALUE 0x0B73
+#define GL_DEPTH_FUNC 0x0B74
+#define GL_STENCIL_CLEAR_VALUE 0x0B91
+#define GL_STENCIL_FUNC 0x0B92
+#define GL_STENCIL_FAIL 0x0B94
+#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
+#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
+#define GL_STENCIL_REF 0x0B97
+#define GL_STENCIL_VALUE_MASK 0x0B93
+#define GL_STENCIL_WRITEMASK 0x0B98
+#define GL_STENCIL_BACK_FUNC 0x8800
+#define GL_STENCIL_BACK_FAIL 0x8801
+#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
+#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
+#define GL_STENCIL_BACK_REF 0x8CA3
+#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
+#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
+#define GL_VIEWPORT 0x0BA2
+#define GL_SCISSOR_BOX 0x0C10
+/* GL_SCISSOR_TEST */
+#define GL_COLOR_CLEAR_VALUE 0x0C22
+#define GL_COLOR_WRITEMASK 0x0C23
+#define GL_UNPACK_ALIGNMENT 0x0CF5
+#define GL_PACK_ALIGNMENT 0x0D05
+#define GL_MAX_TEXTURE_SIZE 0x0D33
+#define GL_MAX_VIEWPORT_DIMS 0x0D3A
+#define GL_SUBPIXEL_BITS 0x0D50
+#define GL_RED_BITS 0x0D52
+#define GL_GREEN_BITS 0x0D53
+#define GL_BLUE_BITS 0x0D54
+#define GL_ALPHA_BITS 0x0D55
+#define GL_DEPTH_BITS 0x0D56
+#define GL_STENCIL_BITS 0x0D57
+#define GL_POLYGON_OFFSET_UNITS 0x2A00
+/* GL_POLYGON_OFFSET_FILL */
+#define GL_POLYGON_OFFSET_FACTOR 0x8038
+#define GL_TEXTURE_BINDING_2D 0x8069
+#define GL_SAMPLE_BUFFERS 0x80A8
+#define GL_SAMPLES 0x80A9
+#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
+#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
+
+/* GetTextureParameter */
+/* GL_TEXTURE_MAG_FILTER */
+/* GL_TEXTURE_MIN_FILTER */
+/* GL_TEXTURE_WRAP_S */
+/* GL_TEXTURE_WRAP_T */
+
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
+
+/* HintMode */
+#define GL_DONT_CARE 0x1100
+#define GL_FASTEST 0x1101
+#define GL_NICEST 0x1102
+
+/* HintTarget */
+#define GL_GENERATE_MIPMAP_HINT 0x8192
+
+/* DataType */
+#define GL_BYTE 0x1400
+#define GL_UNSIGNED_BYTE 0x1401
+#define GL_SHORT 0x1402
+#define GL_UNSIGNED_SHORT 0x1403
+#define GL_INT 0x1404
+#define GL_UNSIGNED_INT 0x1405
+#define GL_FLOAT 0x1406
+#define GL_FIXED 0x140C
+
+/* PixelFormat */
+#define GL_DEPTH_COMPONENT 0x1902
+#define GL_ALPHA 0x1906
+#define GL_RGB 0x1907
+#define GL_RGBA 0x1908
+#define GL_LUMINANCE 0x1909
+#define GL_LUMINANCE_ALPHA 0x190A
+
+/* PixelType */
+/* GL_UNSIGNED_BYTE */
+#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
+#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
+#define GL_UNSIGNED_SHORT_5_6_5 0x8363
+
+/* Shaders */
+#define GL_FRAGMENT_SHADER 0x8B30
+#define GL_VERTEX_SHADER 0x8B31
+#define GL_MAX_VERTEX_ATTRIBS 0x8869
+#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
+#define GL_MAX_VARYING_VECTORS 0x8DFC
+#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
+#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
+#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
+#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
+#define GL_SHADER_TYPE 0x8B4F
+#define GL_DELETE_STATUS 0x8B80
+#define GL_LINK_STATUS 0x8B82
+#define GL_VALIDATE_STATUS 0x8B83
+#define GL_ATTACHED_SHADERS 0x8B85
+#define GL_ACTIVE_UNIFORMS 0x8B86
+#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
+#define GL_ACTIVE_ATTRIBUTES 0x8B89
+#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
+#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
+#define GL_CURRENT_PROGRAM 0x8B8D
+
+/* StencilFunction */
+#define GL_NEVER 0x0200
+#define GL_LESS 0x0201
+#define GL_EQUAL 0x0202
+#define GL_LEQUAL 0x0203
+#define GL_GREATER 0x0204
+#define GL_NOTEQUAL 0x0205
+#define GL_GEQUAL 0x0206
+#define GL_ALWAYS 0x0207
+
+/* StencilOp */
+/* GL_ZERO */
+#define GL_KEEP 0x1E00
+#define GL_REPLACE 0x1E01
+#define GL_INCR 0x1E02
+#define GL_DECR 0x1E03
+#define GL_INVERT 0x150A
+#define GL_INCR_WRAP 0x8507
+#define GL_DECR_WRAP 0x8508
+
+/* StringName */
+#define GL_VENDOR 0x1F00
+#define GL_RENDERER 0x1F01
+#define GL_VERSION 0x1F02
+#define GL_EXTENSIONS 0x1F03
+
+/* TextureMagFilter */
+#define GL_NEAREST 0x2600
+#define GL_LINEAR 0x2601
+
+/* TextureMinFilter */
+/* GL_NEAREST */
+/* GL_LINEAR */
+#define GL_NEAREST_MIPMAP_NEAREST 0x2700
+#define GL_LINEAR_MIPMAP_NEAREST 0x2701
+#define GL_NEAREST_MIPMAP_LINEAR 0x2702
+#define GL_LINEAR_MIPMAP_LINEAR 0x2703
+
+/* TextureParameterName */
+#define GL_TEXTURE_MAG_FILTER 0x2800
+#define GL_TEXTURE_MIN_FILTER 0x2801
+#define GL_TEXTURE_WRAP_S 0x2802
+#define GL_TEXTURE_WRAP_T 0x2803
+
+/* TextureTarget */
+/* GL_TEXTURE_2D */
+#define GL_TEXTURE 0x1702
+
+#define GL_TEXTURE_CUBE_MAP 0x8513
+#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
+
+/* TextureUnit */
+#define GL_TEXTURE0 0x84C0
+#define GL_TEXTURE1 0x84C1
+#define GL_TEXTURE2 0x84C2
+#define GL_TEXTURE3 0x84C3
+#define GL_TEXTURE4 0x84C4
+#define GL_TEXTURE5 0x84C5
+#define GL_TEXTURE6 0x84C6
+#define GL_TEXTURE7 0x84C7
+#define GL_TEXTURE8 0x84C8
+#define GL_TEXTURE9 0x84C9
+#define GL_TEXTURE10 0x84CA
+#define GL_TEXTURE11 0x84CB
+#define GL_TEXTURE12 0x84CC
+#define GL_TEXTURE13 0x84CD
+#define GL_TEXTURE14 0x84CE
+#define GL_TEXTURE15 0x84CF
+#define GL_TEXTURE16 0x84D0
+#define GL_TEXTURE17 0x84D1
+#define GL_TEXTURE18 0x84D2
+#define GL_TEXTURE19 0x84D3
+#define GL_TEXTURE20 0x84D4
+#define GL_TEXTURE21 0x84D5
+#define GL_TEXTURE22 0x84D6
+#define GL_TEXTURE23 0x84D7
+#define GL_TEXTURE24 0x84D8
+#define GL_TEXTURE25 0x84D9
+#define GL_TEXTURE26 0x84DA
+#define GL_TEXTURE27 0x84DB
+#define GL_TEXTURE28 0x84DC
+#define GL_TEXTURE29 0x84DD
+#define GL_TEXTURE30 0x84DE
+#define GL_TEXTURE31 0x84DF
+#define GL_ACTIVE_TEXTURE 0x84E0
+
+/* TextureWrapMode */
+#define GL_REPEAT 0x2901
+#define GL_CLAMP_TO_EDGE 0x812F
+#define GL_MIRRORED_REPEAT 0x8370
+
+/* Uniform Types */
+#define GL_FLOAT_VEC2 0x8B50
+#define GL_FLOAT_VEC3 0x8B51
+#define GL_FLOAT_VEC4 0x8B52
+#define GL_INT_VEC2 0x8B53
+#define GL_INT_VEC3 0x8B54
+#define GL_INT_VEC4 0x8B55
+#define GL_BOOL 0x8B56
+#define GL_BOOL_VEC2 0x8B57
+#define GL_BOOL_VEC3 0x8B58
+#define GL_BOOL_VEC4 0x8B59
+#define GL_FLOAT_MAT2 0x8B5A
+#define GL_FLOAT_MAT3 0x8B5B
+#define GL_FLOAT_MAT4 0x8B5C
+#define GL_SAMPLER_2D 0x8B5E
+#define GL_SAMPLER_CUBE 0x8B60
+
+/* Vertex Arrays */
+#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
+#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
+#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
+#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
+#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
+#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
+#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
+
+/* Read Format */
+#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
+#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
+
+/* Shader Source */
+#define GL_COMPILE_STATUS 0x8B81
+#define GL_INFO_LOG_LENGTH 0x8B84
+#define GL_SHADER_SOURCE_LENGTH 0x8B88
+#define GL_SHADER_COMPILER 0x8DFA
+
+/* Shader Binary */
+#define GL_SHADER_BINARY_FORMATS 0x8DF8
+#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
+
+/* Shader Precision-Specified Types */
+#define GL_LOW_FLOAT 0x8DF0
+#define GL_MEDIUM_FLOAT 0x8DF1
+#define GL_HIGH_FLOAT 0x8DF2
+#define GL_LOW_INT 0x8DF3
+#define GL_MEDIUM_INT 0x8DF4
+#define GL_HIGH_INT 0x8DF5
+
+/* Framebuffer Object. */
+#define GL_FRAMEBUFFER 0x8D40
+#define GL_RENDERBUFFER 0x8D41
+
+#define GL_RGBA4 0x8056
+#define GL_RGB5_A1 0x8057
+#define GL_RGB565 0x8D62
+#define GL_DEPTH_COMPONENT16 0x81A5
+#define GL_STENCIL_INDEX 0x1901
+#define GL_STENCIL_INDEX8 0x8D48
+
+#define GL_RENDERBUFFER_WIDTH 0x8D42
+#define GL_RENDERBUFFER_HEIGHT 0x8D43
+#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
+#define GL_RENDERBUFFER_RED_SIZE 0x8D50
+#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
+#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
+#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
+#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
+#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
+
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
+
+#define GL_COLOR_ATTACHMENT0 0x8CE0
+#define GL_DEPTH_ATTACHMENT 0x8D00
+#define GL_STENCIL_ATTACHMENT 0x8D20
+
+#define GL_NONE 0
+
+#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
+#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
+#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
+#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
+#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
+
+#define GL_FRAMEBUFFER_BINDING 0x8CA6
+#define GL_RENDERBUFFER_BINDING 0x8CA7
+#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
+
+#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
+
+/*-------------------------------------------------------------------------
+ * GL core functions.
+ *-----------------------------------------------------------------------*/
+
+GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
+GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
+GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar* name);
+GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
+GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
+GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
+GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
+GL_APICALL void GL_APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+GL_APICALL void GL_APIENTRY glBlendEquation ( GLenum mode );
+GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
+GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
+GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
+GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);
+GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
+GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
+GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth);
+GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
+GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader);
+GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data);
+GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
+GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type);
+GL_APICALL void GL_APIENTRY glCullFace (GLenum mode);
+GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers);
+GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers);
+GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers);
+GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader);
+GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures);
+GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func);
+GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
+GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar);
+GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader);
+GL_APICALL void GL_APIENTRY glDisable (GLenum cap);
+GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
+GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
+GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
+GL_APICALL void GL_APIENTRY glEnable (GLenum cap);
+GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
+GL_APICALL void GL_APIENTRY glFinish (void);
+GL_APICALL void GL_APIENTRY glFlush (void);
+GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode);
+GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers);
+GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
+GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers);
+GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers);
+GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures);
+GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
+GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
+GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
+GL_APICALL int GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name);
+GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params);
+GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL GLenum GL_APIENTRY glGetError (void);
+GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);
+GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);
+GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
+GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
+GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name);
+GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params);
+GL_APICALL int GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name);
+GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer);
+GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode);
+GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
+GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
+GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer);
+GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program);
+GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer);
+GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader);
+GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture);
+GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
+GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
+GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
+GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
+GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
+GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);
+GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar** string, const GLint* length);
+GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
+GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
+GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
+GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
+GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params);
+GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params);
+GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels);
+GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x);
+GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x);
+GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y);
+GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y);
+GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z);
+GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w);
+GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUseProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x);
+GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values);
+GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y);
+GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values);
+GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values);
+GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values);
+GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);
+GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gl2_h_ */
--- /dev/null
+#ifndef __gl2ext_h_
+#define __gl2ext_h_
+
+/* $Revision: 18099 $ on $Date:: 2012-06-06 09:16:19 -0700 #$ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * This document is licensed under the SGI Free Software B License Version
+ * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
+ */
+
+#ifndef GL_APIENTRYP
+# define GL_APIENTRYP GL_APIENTRY*
+#endif
+
+/*------------------------------------------------------------------------*
+ * OES extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_OES_compressed_ETC1_RGB8_texture */
+#ifndef GL_OES_compressed_ETC1_RGB8_texture
+#define GL_ETC1_RGB8_OES 0x8D64
+#endif
+
+/* GL_OES_compressed_paletted_texture */
+#ifndef GL_OES_compressed_paletted_texture
+#define GL_PALETTE4_RGB8_OES 0x8B90
+#define GL_PALETTE4_RGBA8_OES 0x8B91
+#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
+#define GL_PALETTE4_RGBA4_OES 0x8B93
+#define GL_PALETTE4_RGB5_A1_OES 0x8B94
+#define GL_PALETTE8_RGB8_OES 0x8B95
+#define GL_PALETTE8_RGBA8_OES 0x8B96
+#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
+#define GL_PALETTE8_RGBA4_OES 0x8B98
+#define GL_PALETTE8_RGB5_A1_OES 0x8B99
+#endif
+
+/* GL_OES_depth24 */
+#ifndef GL_OES_depth24
+#define GL_DEPTH_COMPONENT24_OES 0x81A6
+#endif
+
+/* GL_OES_depth32 */
+#ifndef GL_OES_depth32
+#define GL_DEPTH_COMPONENT32_OES 0x81A7
+#endif
+
+/* GL_OES_depth_texture */
+/* No new tokens introduced by this extension. */
+
+/* GL_OES_EGL_image */
+#ifndef GL_OES_EGL_image
+typedef void* GLeglImageOES;
+#endif
+
+/* GL_OES_EGL_image_external */
+#ifndef GL_OES_EGL_image_external
+/* GLeglImageOES defined in GL_OES_EGL_image already. */
+#define GL_TEXTURE_EXTERNAL_OES 0x8D65
+#define GL_SAMPLER_EXTERNAL_OES 0x8D66
+#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67
+#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68
+#endif
+
+/* GL_OES_element_index_uint */
+#ifndef GL_OES_element_index_uint
+#define GL_UNSIGNED_INT 0x1405
+#endif
+
+/* GL_OES_get_program_binary */
+#ifndef GL_OES_get_program_binary
+#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741
+#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE
+#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF
+#endif
+
+/* GL_OES_mapbuffer */
+#ifndef GL_OES_mapbuffer
+#define GL_WRITE_ONLY_OES 0x88B9
+#define GL_BUFFER_ACCESS_OES 0x88BB
+#define GL_BUFFER_MAPPED_OES 0x88BC
+#define GL_BUFFER_MAP_POINTER_OES 0x88BD
+#endif
+
+/* GL_OES_packed_depth_stencil */
+#ifndef GL_OES_packed_depth_stencil
+#define GL_DEPTH_STENCIL_OES 0x84F9
+#define GL_UNSIGNED_INT_24_8_OES 0x84FA
+#define GL_DEPTH24_STENCIL8_OES 0x88F0
+#endif
+
+/* GL_OES_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_standard_derivatives */
+#ifndef GL_OES_standard_derivatives
+#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B
+#endif
+
+/* GL_OES_stencil1 */
+#ifndef GL_OES_stencil1
+#define GL_STENCIL_INDEX1_OES 0x8D46
+#endif
+
+/* GL_OES_stencil4 */
+#ifndef GL_OES_stencil4
+#define GL_STENCIL_INDEX4_OES 0x8D47
+#endif
+
+/* GL_OES_texture_3D */
+#ifndef GL_OES_texture_3D
+#define GL_TEXTURE_WRAP_R_OES 0x8072
+#define GL_TEXTURE_3D_OES 0x806F
+#define GL_TEXTURE_BINDING_3D_OES 0x806A
+#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073
+#define GL_SAMPLER_3D_OES 0x8B5F
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4
+#endif
+
+/* GL_OES_texture_float */
+/* No new tokens introduced by this extension. */
+
+/* GL_OES_texture_float_linear */
+/* No new tokens introduced by this extension. */
+
+/* GL_OES_texture_half_float */
+#ifndef GL_OES_texture_half_float
+#define GL_HALF_FLOAT_OES 0x8D61
+#endif
+
+/* GL_OES_texture_half_float_linear */
+/* No new tokens introduced by this extension. */
+
+/* GL_OES_texture_npot */
+/* No new tokens introduced by this extension. */
+
+/* GL_OES_vertex_array_object */
+#ifndef GL_OES_vertex_array_object
+#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5
+#endif
+
+/* GL_OES_vertex_half_float */
+/* GL_HALF_FLOAT_OES defined in GL_OES_texture_half_float already. */
+
+/* GL_OES_vertex_type_10_10_10_2 */
+#ifndef GL_OES_vertex_type_10_10_10_2
+#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6
+#define GL_INT_10_10_10_2_OES 0x8DF7
+#endif
+
+/*------------------------------------------------------------------------*
+ * AMD extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_AMD_compressed_3DC_texture */
+#ifndef GL_AMD_compressed_3DC_texture
+#define GL_3DC_X_AMD 0x87F9
+#define GL_3DC_XY_AMD 0x87FA
+#endif
+
+/* GL_AMD_compressed_ATC_texture */
+#ifndef GL_AMD_compressed_ATC_texture
+#define GL_ATC_RGB_AMD 0x8C92
+#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93
+#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE
+#endif
+
+/* GL_AMD_performance_monitor */
+#ifndef GL_AMD_performance_monitor
+#define GL_COUNTER_TYPE_AMD 0x8BC0
+#define GL_COUNTER_RANGE_AMD 0x8BC1
+#define GL_UNSIGNED_INT64_AMD 0x8BC2
+#define GL_PERCENTAGE_AMD 0x8BC3
+#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4
+#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5
+#define GL_PERFMON_RESULT_AMD 0x8BC6
+#endif
+
+/* GL_AMD_program_binary_Z400 */
+#ifndef GL_AMD_program_binary_Z400
+#define GL_Z400_BINARY_AMD 0x8740
+#endif
+
+/*------------------------------------------------------------------------*
+ * ANGLE extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_ANGLE_framebuffer_blit */
+#ifndef GL_ANGLE_framebuffer_blit
+#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8
+#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9
+#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6
+#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA
+#endif
+
+/* GL_ANGLE_framebuffer_multisample */
+#ifndef GL_ANGLE_framebuffer_multisample
+#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56
+#define GL_MAX_SAMPLES_ANGLE 0x8D57
+#endif
+
+/* GL_ANGLE_instanced_arrays */
+#ifndef GL_ANGLE_instanced_arrays
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE
+#endif
+
+/* GL_ANGLE_pack_reverse_row_order */
+#ifndef GL_ANGLE_pack_reverse_row_order
+#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4
+#endif
+
+/* GL_ANGLE_texture_compression_dxt3 */
+#ifndef GL_ANGLE_texture_compression_dxt3
+#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2
+#endif
+
+/* GL_ANGLE_texture_compression_dxt5 */
+#ifndef GL_ANGLE_texture_compression_dxt5
+#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3
+#endif
+
+/* GL_ANGLE_texture_usage */
+#ifndef GL_ANGLE_texture_usage
+#define GL_TEXTURE_USAGE_ANGLE 0x93A2
+#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3
+#endif
+
+/* GL_ANGLE_translated_shader_source */
+#ifndef GL_ANGLE_translated_shader_source
+#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0
+#endif
+
+/*------------------------------------------------------------------------*
+ * APPLE extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_APPLE_rgb_422 */
+#ifndef GL_APPLE_rgb_422
+#define GL_RGB_422_APPLE 0x8A1F
+#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA
+#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB
+#endif
+
+/* GL_APPLE_framebuffer_multisample */
+#ifndef GL_APPLE_framebuffer_multisample
+#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56
+#define GL_MAX_SAMPLES_APPLE 0x8D57
+#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8
+#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9
+#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6
+#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA
+#endif
+
+/* GL_APPLE_texture_format_BGRA8888 */
+#ifndef GL_APPLE_texture_format_BGRA8888
+#define GL_BGRA_EXT 0x80E1
+#endif
+
+/* GL_APPLE_texture_max_level */
+#ifndef GL_APPLE_texture_max_level
+#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D
+#endif
+
+/*------------------------------------------------------------------------*
+ * ARM extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_ARM_mali_shader_binary */
+#ifndef GL_ARM_mali_shader_binary
+#define GL_MALI_SHADER_BINARY_ARM 0x8F60
+#endif
+
+/* GL_ARM_rgba8 */
+/* No new tokens introduced by this extension. */
+
+/*------------------------------------------------------------------------*
+ * EXT extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_EXT_blend_minmax */
+#ifndef GL_EXT_blend_minmax
+#define GL_MIN_EXT 0x8007
+#define GL_MAX_EXT 0x8008
+#endif
+
+/* GL_EXT_color_buffer_half_float */
+#ifndef GL_EXT_color_buffer_half_float
+#define GL_RGBA16F_EXT 0x881A
+#define GL_RGB16F_EXT 0x881B
+#define GL_RG16F_EXT 0x822F
+#define GL_R16F_EXT 0x822D
+#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT 0x8211
+#define GL_UNSIGNED_NORMALIZED_EXT 0x8C17
+#endif
+
+/* GL_EXT_debug_label */
+#ifndef GL_EXT_debug_label
+#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F
+#define GL_PROGRAM_OBJECT_EXT 0x8B40
+#define GL_SHADER_OBJECT_EXT 0x8B48
+#define GL_BUFFER_OBJECT_EXT 0x9151
+#define GL_QUERY_OBJECT_EXT 0x9153
+#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154
+#endif
+
+/* GL_EXT_debug_marker */
+/* No new tokens introduced by this extension. */
+
+/* GL_EXT_discard_framebuffer */
+#ifndef GL_EXT_discard_framebuffer
+#define GL_COLOR_EXT 0x1800
+#define GL_DEPTH_EXT 0x1801
+#define GL_STENCIL_EXT 0x1802
+#endif
+
+/* GL_EXT_multisampled_render_to_texture */
+#ifndef GL_EXT_multisampled_render_to_texture
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C
+#define GL_RENDERBUFFER_SAMPLES_EXT 0x9133
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x9134
+#define GL_MAX_SAMPLES_EXT 0x9135
+#endif
+
+/* GL_EXT_multi_draw_arrays */
+/* No new tokens introduced by this extension. */
+
+/* GL_EXT_occlusion_query_boolean */
+#ifndef GL_EXT_occlusion_query_boolean
+#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F
+#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A
+#define GL_CURRENT_QUERY_EXT 0x8865
+#define GL_QUERY_RESULT_EXT 0x8866
+#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867
+#endif
+
+/* GL_EXT_read_format_bgra */
+#ifndef GL_EXT_read_format_bgra
+#define GL_BGRA_EXT 0x80E1
+#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365
+#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366
+#endif
+
+/* GL_EXT_robustness */
+#ifndef GL_EXT_robustness
+/* reuse GL_NO_ERROR */
+#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253
+#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254
+#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255
+#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3
+#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256
+#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252
+#define GL_NO_RESET_NOTIFICATION_EXT 0x8261
+#endif
+
+/* GL_EXT_separate_shader_objects */
+#ifndef GL_EXT_separate_shader_objects
+#define GL_VERTEX_SHADER_BIT_EXT 0x00000001
+#define GL_FRAGMENT_SHADER_BIT_EXT 0x00000002
+#define GL_ALL_SHADER_BITS_EXT 0xFFFFFFFF
+#define GL_PROGRAM_SEPARABLE_EXT 0x8258
+#define GL_ACTIVE_PROGRAM_EXT 0x8259
+#define GL_PROGRAM_PIPELINE_BINDING_EXT 0x825A
+#endif
+
+/* GL_EXT_shader_texture_lod */
+/* No new tokens introduced by this extension. */
+
+/* GL_EXT_shadow_samplers */
+#ifndef GL_EXT_shadow_samplers
+#define GL_TEXTURE_COMPARE_MODE_EXT 0x884C
+#define GL_TEXTURE_COMPARE_FUNC_EXT 0x884D
+#define GL_COMPARE_REF_TO_TEXTURE_EXT 0x884E
+#define GL_SAMPLER_2D_SHADOW_EXT 0x8B62
+#endif
+
+/* GL_EXT_sRGB */
+#ifndef GL_EXT_sRGB
+#define GL_SRGB_EXT 0x8C40
+#define GL_SRGB_ALPHA_EXT 0x8C42
+#define GL_SRGB8_ALPHA8_EXT 0x8C43
+#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210
+#endif
+
+/* GL_EXT_texture_compression_dxt1 */
+#ifndef GL_EXT_texture_compression_dxt1
+#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
+#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
+#endif
+
+/* GL_EXT_texture_filter_anisotropic */
+#ifndef GL_EXT_texture_filter_anisotropic
+#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
+#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
+#endif
+
+/* GL_EXT_texture_format_BGRA8888 */
+#ifndef GL_EXT_texture_format_BGRA8888
+#define GL_BGRA_EXT 0x80E1
+#endif
+
+/* GL_EXT_texture_rg */
+#ifndef GL_EXT_texture_rg
+#define GL_RED_EXT 0x1903
+#define GL_RG_EXT 0x8227
+#define GL_R8_EXT 0x8229
+#define GL_RG8_EXT 0x822B
+#endif
+
+/* GL_EXT_texture_storage */
+#ifndef GL_EXT_texture_storage
+#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F
+#define GL_ALPHA8_EXT 0x803C
+#define GL_LUMINANCE8_EXT 0x8040
+#define GL_LUMINANCE8_ALPHA8_EXT 0x8045
+#define GL_RGBA32F_EXT 0x8814
+#define GL_RGB32F_EXT 0x8815
+#define GL_ALPHA32F_EXT 0x8816
+#define GL_LUMINANCE32F_EXT 0x8818
+#define GL_LUMINANCE_ALPHA32F_EXT 0x8819
+/* reuse GL_RGBA16F_EXT */
+/* reuse GL_RGB16F_EXT */
+#define GL_ALPHA16F_EXT 0x881C
+#define GL_LUMINANCE16F_EXT 0x881E
+#define GL_LUMINANCE_ALPHA16F_EXT 0x881F
+#define GL_RGB10_A2_EXT 0x8059
+#define GL_RGB10_EXT 0x8052
+#define GL_BGRA8_EXT 0x93A1
+#define GL_R8_EXT 0x8229
+#define GL_RG8_EXT 0x822B
+#define GL_R32F_EXT 0x822E
+#define GL_RG32F_EXT 0x8230
+#define GL_R16F_EXT 0x822D
+#define GL_RG16F_EXT 0x822F
+#endif
+
+/* GL_EXT_texture_type_2_10_10_10_REV */
+#ifndef GL_EXT_texture_type_2_10_10_10_REV
+#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368
+#endif
+
+/* GL_EXT_unpack_subimage */
+#ifndef GL_EXT_unpack_subimage
+#define GL_UNPACK_ROW_LENGTH 0x0CF2
+#define GL_UNPACK_SKIP_ROWS 0x0CF3
+#define GL_UNPACK_SKIP_PIXELS 0x0CF4
+#endif
+
+/*------------------------------------------------------------------------*
+ * DMP extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_DMP_shader_binary */
+#ifndef GL_DMP_shader_binary
+#define GL_SHADER_BINARY_DMP 0x9250
+#endif
+
+/*------------------------------------------------------------------------*
+ * FJ extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_FJ_shader_binary_GCCSO */
+#ifndef GL_FJ_shader_binary_GCCSO
+#define GCCSO_SHADER_BINARY_FJ 0x9260
+#endif
+
+/*------------------------------------------------------------------------*
+ * IMG extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_IMG_program_binary */
+#ifndef GL_IMG_program_binary
+#define GL_SGX_PROGRAM_BINARY_IMG 0x9130
+#endif
+
+/* GL_IMG_read_format */
+#ifndef GL_IMG_read_format
+#define GL_BGRA_IMG 0x80E1
+#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365
+#endif
+
+/* GL_IMG_shader_binary */
+#ifndef GL_IMG_shader_binary
+#define GL_SGX_BINARY_IMG 0x8C0A
+#endif
+
+/* GL_IMG_texture_compression_pvrtc */
+#ifndef GL_IMG_texture_compression_pvrtc
+#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
+#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
+#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
+#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
+#endif
+
+/* GL_IMG_multisampled_render_to_texture */
+#ifndef GL_IMG_multisampled_render_to_texture
+#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133
+#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134
+#define GL_MAX_SAMPLES_IMG 0x9135
+#define GL_TEXTURE_SAMPLES_IMG 0x9136
+#endif
+
+/*------------------------------------------------------------------------*
+ * NV extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_NV_coverage_sample */
+#ifndef GL_NV_coverage_sample
+#define GL_COVERAGE_COMPONENT_NV 0x8ED0
+#define GL_COVERAGE_COMPONENT4_NV 0x8ED1
+#define GL_COVERAGE_ATTACHMENT_NV 0x8ED2
+#define GL_COVERAGE_BUFFERS_NV 0x8ED3
+#define GL_COVERAGE_SAMPLES_NV 0x8ED4
+#define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8ED5
+#define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6
+#define GL_COVERAGE_AUTOMATIC_NV 0x8ED7
+#define GL_COVERAGE_BUFFER_BIT_NV 0x8000
+#endif
+
+/* GL_NV_depth_nonlinear */
+#ifndef GL_NV_depth_nonlinear
+#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C
+#endif
+
+/* GL_NV_draw_buffers */
+#ifndef GL_NV_draw_buffers
+#define GL_MAX_DRAW_BUFFERS_NV 0x8824
+#define GL_DRAW_BUFFER0_NV 0x8825
+#define GL_DRAW_BUFFER1_NV 0x8826
+#define GL_DRAW_BUFFER2_NV 0x8827
+#define GL_DRAW_BUFFER3_NV 0x8828
+#define GL_DRAW_BUFFER4_NV 0x8829
+#define GL_DRAW_BUFFER5_NV 0x882A
+#define GL_DRAW_BUFFER6_NV 0x882B
+#define GL_DRAW_BUFFER7_NV 0x882C
+#define GL_DRAW_BUFFER8_NV 0x882D
+#define GL_DRAW_BUFFER9_NV 0x882E
+#define GL_DRAW_BUFFER10_NV 0x882F
+#define GL_DRAW_BUFFER11_NV 0x8830
+#define GL_DRAW_BUFFER12_NV 0x8831
+#define GL_DRAW_BUFFER13_NV 0x8832
+#define GL_DRAW_BUFFER14_NV 0x8833
+#define GL_DRAW_BUFFER15_NV 0x8834
+#define GL_COLOR_ATTACHMENT0_NV 0x8CE0
+#define GL_COLOR_ATTACHMENT1_NV 0x8CE1
+#define GL_COLOR_ATTACHMENT2_NV 0x8CE2
+#define GL_COLOR_ATTACHMENT3_NV 0x8CE3
+#define GL_COLOR_ATTACHMENT4_NV 0x8CE4
+#define GL_COLOR_ATTACHMENT5_NV 0x8CE5
+#define GL_COLOR_ATTACHMENT6_NV 0x8CE6
+#define GL_COLOR_ATTACHMENT7_NV 0x8CE7
+#define GL_COLOR_ATTACHMENT8_NV 0x8CE8
+#define GL_COLOR_ATTACHMENT9_NV 0x8CE9
+#define GL_COLOR_ATTACHMENT10_NV 0x8CEA
+#define GL_COLOR_ATTACHMENT11_NV 0x8CEB
+#define GL_COLOR_ATTACHMENT12_NV 0x8CEC
+#define GL_COLOR_ATTACHMENT13_NV 0x8CED
+#define GL_COLOR_ATTACHMENT14_NV 0x8CEE
+#define GL_COLOR_ATTACHMENT15_NV 0x8CEF
+#endif
+
+/* GL_NV_fbo_color_attachments */
+#ifndef GL_NV_fbo_color_attachments
+#define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF
+/* GL_COLOR_ATTACHMENT{0-15}_NV defined in GL_NV_draw_buffers already. */
+#endif
+
+/* GL_NV_fence */
+#ifndef GL_NV_fence
+#define GL_ALL_COMPLETED_NV 0x84F2
+#define GL_FENCE_STATUS_NV 0x84F3
+#define GL_FENCE_CONDITION_NV 0x84F4
+#endif
+
+/* GL_NV_read_buffer */
+#ifndef GL_NV_read_buffer
+#define GL_READ_BUFFER_NV 0x0C02
+#endif
+
+/* GL_NV_read_buffer_front */
+/* No new tokens introduced by this extension. */
+
+/* GL_NV_read_depth */
+/* No new tokens introduced by this extension. */
+
+/* GL_NV_read_depth_stencil */
+/* No new tokens introduced by this extension. */
+
+/* GL_NV_read_stencil */
+/* No new tokens introduced by this extension. */
+
+/* GL_NV_texture_compression_s3tc_update */
+/* No new tokens introduced by this extension. */
+
+/* GL_NV_texture_npot_2D_mipmap */
+/* No new tokens introduced by this extension. */
+
+/*------------------------------------------------------------------------*
+ * QCOM extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_QCOM_alpha_test */
+#ifndef GL_QCOM_alpha_test
+#define GL_ALPHA_TEST_QCOM 0x0BC0
+#define GL_ALPHA_TEST_FUNC_QCOM 0x0BC1
+#define GL_ALPHA_TEST_REF_QCOM 0x0BC2
+#endif
+
+/* GL_QCOM_driver_control */
+/* No new tokens introduced by this extension. */
+
+/* GL_QCOM_extended_get */
+#ifndef GL_QCOM_extended_get
+#define GL_TEXTURE_WIDTH_QCOM 0x8BD2
+#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3
+#define GL_TEXTURE_DEPTH_QCOM 0x8BD4
+#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5
+#define GL_TEXTURE_FORMAT_QCOM 0x8BD6
+#define GL_TEXTURE_TYPE_QCOM 0x8BD7
+#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8
+#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9
+#define GL_TEXTURE_TARGET_QCOM 0x8BDA
+#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB
+#define GL_STATE_RESTORE 0x8BDC
+#endif
+
+/* GL_QCOM_extended_get2 */
+/* No new tokens introduced by this extension. */
+
+/* GL_QCOM_perfmon_global_mode */
+#ifndef GL_QCOM_perfmon_global_mode
+#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0
+#endif
+
+/* GL_QCOM_writeonly_rendering */
+#ifndef GL_QCOM_writeonly_rendering
+#define GL_WRITEONLY_RENDERING_QCOM 0x8823
+#endif
+
+/* GL_QCOM_tiled_rendering */
+#ifndef GL_QCOM_tiled_rendering
+#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001
+#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002
+#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004
+#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008
+#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010
+#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020
+#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040
+#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080
+#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100
+#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200
+#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400
+#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800
+#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000
+#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000
+#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000
+#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000
+#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000
+#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000
+#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000
+#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000
+#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000
+#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000
+#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000
+#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000
+#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000
+#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000
+#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000
+#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000
+#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000
+#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000
+#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000
+#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000
+#endif
+
+/*------------------------------------------------------------------------*
+ * VIV extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_VIV_shader_binary */
+#ifndef GL_VIV_shader_binary
+#define GL_SHADER_BINARY_VIV 0x8FC4
+#endif
+
+/*------------------------------------------------------------------------*
+ * End of extension tokens, start of corresponding extension functions
+ *------------------------------------------------------------------------*/
+
+/*------------------------------------------------------------------------*
+ * OES extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_OES_compressed_ETC1_RGB8_texture */
+#ifndef GL_OES_compressed_ETC1_RGB8_texture
+#define GL_OES_compressed_ETC1_RGB8_texture 1
+#endif
+
+/* GL_OES_compressed_paletted_texture */
+#ifndef GL_OES_compressed_paletted_texture
+#define GL_OES_compressed_paletted_texture 1
+#endif
+
+/* GL_OES_depth24 */
+#ifndef GL_OES_depth24
+#define GL_OES_depth24 1
+#endif
+
+/* GL_OES_depth32 */
+#ifndef GL_OES_depth32
+#define GL_OES_depth32 1
+#endif
+
+/* GL_OES_depth_texture */
+#ifndef GL_OES_depth_texture
+#define GL_OES_depth_texture 1
+#endif
+
+/* GL_OES_EGL_image */
+#ifndef GL_OES_EGL_image
+#define GL_OES_EGL_image 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image);
+GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image);
+#endif
+typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
+typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
+#endif
+
+/* GL_OES_EGL_image_external */
+#ifndef GL_OES_EGL_image_external
+#define GL_OES_EGL_image_external 1
+/* glEGLImageTargetTexture2DOES defined in GL_OES_EGL_image already. */
+#endif
+
+/* GL_OES_element_index_uint */
+#ifndef GL_OES_element_index_uint
+#define GL_OES_element_index_uint 1
+#endif
+
+/* GL_OES_fbo_render_mipmap */
+#ifndef GL_OES_fbo_render_mipmap
+#define GL_OES_fbo_render_mipmap 1
+#endif
+
+/* GL_OES_fragment_precision_high */
+#ifndef GL_OES_fragment_precision_high
+#define GL_OES_fragment_precision_high 1
+#endif
+
+/* GL_OES_get_program_binary */
+#ifndef GL_OES_get_program_binary
+#define GL_OES_get_program_binary 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
+GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length);
+#endif
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
+typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length);
+#endif
+
+/* GL_OES_mapbuffer */
+#ifndef GL_OES_mapbuffer
+#define GL_OES_mapbuffer 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access);
+GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target);
+GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, GLvoid** params);
+#endif
+typedef void* (GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
+typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, GLvoid** params);
+#endif
+
+/* GL_OES_packed_depth_stencil */
+#ifndef GL_OES_packed_depth_stencil
+#define GL_OES_packed_depth_stencil 1
+#endif
+
+/* GL_OES_required_internalformat */
+#ifndef GL_OES_required_internalformat
+#define GL_OES_required_internalformat 1
+#endif
+
+/* GL_OES_rgb8_rgba8 */
+#ifndef GL_OES_rgb8_rgba8
+#define GL_OES_rgb8_rgba8 1
+#endif
+
+/* GL_OES_standard_derivatives */
+#ifndef GL_OES_standard_derivatives
+#define GL_OES_standard_derivatives 1
+#endif
+
+/* GL_OES_stencil1 */
+#ifndef GL_OES_stencil1
+#define GL_OES_stencil1 1
+#endif
+
+/* GL_OES_stencil4 */
+#ifndef GL_OES_stencil4
+#define GL_OES_stencil4 1
+#endif
+
+/* GL_OES_texture_3D */
+#ifndef GL_OES_texture_3D
+#define GL_OES_texture_3D 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
+GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels);
+GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data);
+GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+#endif
+typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
+typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels);
+typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data);
+typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOES) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
+#endif
+
+/* GL_OES_texture_float */
+#ifndef GL_OES_texture_float
+#define GL_OES_texture_float 1
+#endif
+
+/* GL_OES_texture_float_linear */
+#ifndef GL_OES_texture_float_linear
+#define GL_OES_texture_float_linear 1
+#endif
+
+/* GL_OES_texture_half_float */
+#ifndef GL_OES_texture_half_float
+#define GL_OES_texture_half_float 1
+#endif
+
+/* GL_OES_texture_half_float_linear */
+#ifndef GL_OES_texture_half_float_linear
+#define GL_OES_texture_half_float_linear 1
+#endif
+
+/* GL_OES_texture_npot */
+#ifndef GL_OES_texture_npot
+#define GL_OES_texture_npot 1
+#endif
+
+/* GL_OES_vertex_array_object */
+#ifndef GL_OES_vertex_array_object
+#define GL_OES_vertex_array_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBindVertexArrayOES (GLuint array);
+GL_APICALL void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays);
+GL_APICALL void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays);
+GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array);
+#endif
+typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array);
+typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays);
+typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays);
+typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array);
+#endif
+
+/* GL_OES_vertex_half_float */
+#ifndef GL_OES_vertex_half_float
+#define GL_OES_vertex_half_float 1
+#endif
+
+/* GL_OES_vertex_type_10_10_10_2 */
+#ifndef GL_OES_vertex_type_10_10_10_2
+#define GL_OES_vertex_type_10_10_10_2 1
+#endif
+
+/*------------------------------------------------------------------------*
+ * AMD extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_AMD_compressed_3DC_texture */
+#ifndef GL_AMD_compressed_3DC_texture
+#define GL_AMD_compressed_3DC_texture 1
+#endif
+
+/* GL_AMD_compressed_ATC_texture */
+#ifndef GL_AMD_compressed_ATC_texture
+#define GL_AMD_compressed_ATC_texture 1
+#endif
+
+/* AMD_performance_monitor */
+#ifndef GL_AMD_performance_monitor
+#define GL_AMD_performance_monitor 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, GLvoid *data);
+GL_APICALL void GL_APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors);
+GL_APICALL void GL_APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors);
+GL_APICALL void GL_APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList);
+GL_APICALL void GL_APIENTRY glBeginPerfMonitorAMD (GLuint monitor);
+GL_APICALL void GL_APIENTRY glEndPerfMonitorAMD (GLuint monitor);
+GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
+#endif
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, GLvoid *data);
+typedef void (GL_APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
+typedef void (GL_APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
+typedef void (GL_APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList);
+typedef void (GL_APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor);
+typedef void (GL_APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor);
+typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
+#endif
+
+/* GL_AMD_program_binary_Z400 */
+#ifndef GL_AMD_program_binary_Z400
+#define GL_AMD_program_binary_Z400 1
+#endif
+
+/*------------------------------------------------------------------------*
+ * ANGLE extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_ANGLE_framebuffer_blit */
+#ifndef GL_ANGLE_framebuffer_blit
+#define GL_ANGLE_framebuffer_blit 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glBlitFramebufferANGLE (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#endif
+typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+#endif
+
+/* GL_ANGLE_framebuffer_multisample */
+#ifndef GL_ANGLE_framebuffer_multisample
+#define GL_ANGLE_framebuffer_multisample 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+#endif
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+#endif
+
+#ifndef GL_ANGLE_instanced_arrays
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE (GLuint index, GLuint divisor);
+#endif
+typedef void (GL_APIENTRYP PFLGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
+typedef void (GL_APIENTRYP PFLGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
+typedef void (GL_APIENTRYP PFLGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor);
+#endif
+
+/* GL_ANGLE_pack_reverse_row_order */
+#ifndef GL_ANGLE_pack_reverse_row_order
+#define GL_ANGLE_pack_reverse_row_order 1
+#endif
+
+/* GL_ANGLE_texture_compression_dxt3 */
+#ifndef GL_ANGLE_texture_compression_dxt3
+#define GL_ANGLE_texture_compression_dxt3 1
+#endif
+
+/* GL_ANGLE_texture_compression_dxt5 */
+#ifndef GL_ANGLE_texture_compression_dxt5
+#define GL_ANGLE_texture_compression_dxt5 1
+#endif
+
+/* GL_ANGLE_texture_usage */
+#ifndef GL_ANGLE_texture_usage
+#define GL_ANGLE_texture_usage 1
+#endif
+
+#ifndef GL_ANGLE_translated_shader_source
+#define GL_ANGLE_translated_shader_source 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
+#endif
+typedef void (GL_APIENTRYP PFLGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
+#endif
+
+/*------------------------------------------------------------------------*
+ * APPLE extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_APPLE_rgb_422 */
+#ifndef GL_APPLE_rgb_422
+#define GL_APPLE_rgb_422 1
+#endif
+
+/* GL_APPLE_framebuffer_multisample */
+#ifndef GL_APPLE_framebuffer_multisample
+#define GL_APPLE_framebuffer_multisample 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
+GL_APICALL void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void);
+#endif
+
+/* GL_APPLE_texture_format_BGRA8888 */
+#ifndef GL_APPLE_texture_format_BGRA8888
+#define GL_APPLE_texture_format_BGRA8888 1
+#endif
+
+/* GL_APPLE_texture_max_level */
+#ifndef GL_APPLE_texture_max_level
+#define GL_APPLE_texture_max_level 1
+#endif
+
+/*------------------------------------------------------------------------*
+ * ARM extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_ARM_mali_shader_binary */
+#ifndef GL_ARM_mali_shader_binary
+#define GL_ARM_mali_shader_binary 1
+#endif
+
+/* GL_ARM_rgba8 */
+#ifndef GL_ARM_rgba8
+#define GL_ARM_rgba8 1
+#endif
+
+/*------------------------------------------------------------------------*
+ * EXT extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_EXT_blend_minmax */
+#ifndef GL_EXT_blend_minmax
+#define GL_EXT_blend_minmax 1
+#endif
+
+/* GL_EXT_color_buffer_half_float */
+#ifndef GL_EXT_color_buffer_half_float
+#define GL_EXT_color_buffer_half_float 1
+#endif
+
+/* GL_EXT_debug_label */
+#ifndef GL_EXT_debug_label
+#define GL_EXT_debug_label 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label);
+GL_APICALL void GL_APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
+#endif
+typedef void (GL_APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label);
+typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
+#endif
+
+/* GL_EXT_debug_marker */
+#ifndef GL_EXT_debug_marker
+#define GL_EXT_debug_marker 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker);
+GL_APICALL void GL_APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker);
+GL_APICALL void GL_APIENTRY glPopGroupMarkerEXT (void);
+#endif
+typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker);
+typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker);
+typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void);
+#endif
+
+/* GL_EXT_discard_framebuffer */
+#ifndef GL_EXT_discard_framebuffer
+#define GL_EXT_discard_framebuffer 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments);
+#endif
+typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
+#endif
+
+/* GL_EXT_multisampled_render_to_texture */
+#ifndef GL_EXT_multisampled_render_to_texture
+#define GL_EXT_multisampled_render_to_texture 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
+GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei);
+#endif
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
+#endif
+
+#ifndef GL_EXT_multi_draw_arrays
+#define GL_EXT_multi_draw_arrays 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei);
+GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount);
+typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
+#endif
+
+/* GL_EXT_occlusion_query_boolean */
+#ifndef GL_EXT_occlusion_query_boolean
+#define GL_EXT_occlusion_query_boolean 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids);
+GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids);
+GL_APICALL GLboolean GL_APIENTRY glIsQueryEXT (GLuint id);
+GL_APICALL void GL_APIENTRY glBeginQueryEXT (GLenum target, GLuint id);
+GL_APICALL void GL_APIENTRY glEndQueryEXT (GLenum target);
+GL_APICALL void GL_APIENTRY glGetQueryivEXT (GLenum target, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params);
+#endif
+typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids);
+typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids);
+typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id);
+typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id);
+typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params);
+#endif
+
+/* GL_EXT_read_format_bgra */
+#ifndef GL_EXT_read_format_bgra
+#define GL_EXT_read_format_bgra 1
+#endif
+
+/* GL_EXT_robustness */
+#ifndef GL_EXT_robustness
+#define GL_EXT_robustness 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void);
+GL_APICALL void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+GL_APICALL void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, float *params);
+GL_APICALL void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+#endif
+typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void);
+typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, float *params);
+typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
+#endif
+
+/* GL_EXT_separate_shader_objects */
+#ifndef GL_EXT_separate_shader_objects
+#define GL_EXT_separate_shader_objects 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glUseProgramStagesEXT (GLuint pipeline, GLbitfield stages, GLuint program);
+GL_APICALL void GL_APIENTRY glActiveShaderProgramEXT (GLuint pipeline, GLuint program);
+GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvEXT (GLenum type, GLsizei count, const GLchar **strings);
+GL_APICALL void GL_APIENTRY glBindProgramPipelineEXT (GLuint pipeline);
+GL_APICALL void GL_APIENTRY glDeleteProgramPipelinesEXT (GLsizei n, const GLuint *pipelines);
+GL_APICALL void GL_APIENTRY glGenProgramPipelinesEXT (GLsizei n, GLuint *pipelines);
+GL_APICALL GLboolean GL_APIENTRY glIsProgramPipelineEXT (GLuint pipeline);
+GL_APICALL void GL_APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value);
+GL_APICALL void GL_APIENTRY glGetProgramPipelineivEXT (GLuint pipeline, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint x);
+GL_APICALL void GL_APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint x, GLint y);
+GL_APICALL void GL_APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z);
+GL_APICALL void GL_APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w);
+GL_APICALL void GL_APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat x);
+GL_APICALL void GL_APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat x, GLfloat y);
+GL_APICALL void GL_APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void GL_APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
+GL_APICALL void GL_APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+GL_APICALL void GL_APIENTRY glValidateProgramPipelineEXT (GLuint pipeline);
+GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogEXT (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+#endif
+typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program);
+typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program);
+typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings);
+typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
+typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines);
+typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines);
+typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
+typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint x);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint x, GLint y);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat x);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
+typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
+typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
+#endif
+
+/* GL_EXT_shader_texture_lod */
+#ifndef GL_EXT_shader_texture_lod
+#define GL_EXT_shader_texture_lod 1
+#endif
+
+/* GL_EXT_shadow_samplers */
+#ifndef GL_EXT_shadow_samplers
+#define GL_EXT_shadow_samplers 1
+#endif
+
+/* GL_EXT_sRGB */
+#ifndef GL_EXT_sRGB
+#define GL_EXT_sRGB 1
+#endif
+
+/* GL_EXT_texture_compression_dxt1 */
+#ifndef GL_EXT_texture_compression_dxt1
+#define GL_EXT_texture_compression_dxt1 1
+#endif
+
+/* GL_EXT_texture_filter_anisotropic */
+#ifndef GL_EXT_texture_filter_anisotropic
+#define GL_EXT_texture_filter_anisotropic 1
+#endif
+
+/* GL_EXT_texture_format_BGRA8888 */
+#ifndef GL_EXT_texture_format_BGRA8888
+#define GL_EXT_texture_format_BGRA8888 1
+#endif
+
+/* GL_EXT_texture_rg */
+#ifndef GL_EXT_texture_rg
+#define GL_EXT_texture_rg 1
+#endif
+
+/* GL_EXT_texture_storage */
+#ifndef GL_EXT_texture_storage
+#define GL_EXT_texture_storage 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+GL_APICALL void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+GL_APICALL void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+GL_APICALL void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+#endif
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
+#endif
+
+/* GL_EXT_texture_type_2_10_10_10_REV */
+#ifndef GL_EXT_texture_type_2_10_10_10_REV
+#define GL_EXT_texture_type_2_10_10_10_REV 1
+#endif
+
+/* GL_EXT_unpack_subimage */
+#ifndef GL_EXT_unpack_subimage
+#define GL_EXT_unpack_subimage 1
+#endif
+
+/*------------------------------------------------------------------------*
+ * DMP extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_DMP_shader_binary */
+#ifndef GL_DMP_shader_binary
+#define GL_DMP_shader_binary 1
+#endif
+
+/*------------------------------------------------------------------------*
+ * FJ extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_FJ_shader_binary_GCCSO */
+#ifndef GL_FJ_shader_binary_GCCSO
+#define GL_FJ_shader_binary_GCCSO 1
+#endif
+
+/*------------------------------------------------------------------------*
+ * IMG extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_IMG_program_binary */
+#ifndef GL_IMG_program_binary
+#define GL_IMG_program_binary 1
+#endif
+
+/* GL_IMG_read_format */
+#ifndef GL_IMG_read_format
+#define GL_IMG_read_format 1
+#endif
+
+/* GL_IMG_shader_binary */
+#ifndef GL_IMG_shader_binary
+#define GL_IMG_shader_binary 1
+#endif
+
+/* GL_IMG_texture_compression_pvrtc */
+#ifndef GL_IMG_texture_compression_pvrtc
+#define GL_IMG_texture_compression_pvrtc 1
+#endif
+
+/* GL_IMG_multisampled_render_to_texture */
+#ifndef GL_IMG_multisampled_render_to_texture
+#define GL_IMG_multisampled_render_to_texture 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum, GLsizei, GLenum, GLsizei, GLsizei);
+GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei);
+#endif
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMG) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
+#endif
+
+/*------------------------------------------------------------------------*
+ * NV extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_NV_coverage_sample */
+#ifndef GL_NV_coverage_sample
+#define GL_NV_coverage_sample 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask);
+GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation);
+#endif
+typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask);
+typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation);
+#endif
+
+/* GL_NV_depth_nonlinear */
+#ifndef GL_NV_depth_nonlinear
+#define GL_NV_depth_nonlinear 1
+#endif
+
+/* GL_NV_draw_buffers */
+#ifndef GL_NV_draw_buffers
+#define GL_NV_draw_buffers 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDrawBuffersNV (GLsizei n, const GLenum *bufs);
+#endif
+typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs);
+#endif
+
+/* GL_NV_fbo_color_attachments */
+#ifndef GL_NV_fbo_color_attachments
+#define GL_NV_fbo_color_attachments 1
+#endif
+
+/* GL_NV_fence */
+#ifndef GL_NV_fence
+#define GL_NV_fence 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glDeleteFencesNV (GLsizei, const GLuint *);
+GL_APICALL void GL_APIENTRY glGenFencesNV (GLsizei, GLuint *);
+GL_APICALL GLboolean GL_APIENTRY glIsFenceNV (GLuint);
+GL_APICALL GLboolean GL_APIENTRY glTestFenceNV (GLuint);
+GL_APICALL void GL_APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *);
+GL_APICALL void GL_APIENTRY glFinishFenceNV (GLuint);
+GL_APICALL void GL_APIENTRY glSetFenceNV (GLuint, GLenum);
+#endif
+typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences);
+typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences);
+typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence);
+typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence);
+typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence);
+typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
+#endif
+
+/* GL_NV_read_buffer */
+#ifndef GL_NV_read_buffer
+#define GL_NV_read_buffer 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glReadBufferNV (GLenum mode);
+#endif
+typedef void (GL_APIENTRYP PFNGLREADBUFFERNVPROC) (GLenum mode);
+#endif
+
+/* GL_NV_read_buffer_front */
+#ifndef GL_NV_read_buffer_front
+#define GL_NV_read_buffer_front 1
+#endif
+
+/* GL_NV_read_depth */
+#ifndef GL_NV_read_depth
+#define GL_NV_read_depth 1
+#endif
+
+/* GL_NV_read_depth_stencil */
+#ifndef GL_NV_read_depth_stencil
+#define GL_NV_read_depth_stencil 1
+#endif
+
+/* GL_NV_read_stencil */
+#ifndef GL_NV_read_stencil
+#define GL_NV_read_stencil 1
+#endif
+
+/* GL_NV_texture_compression_s3tc_update */
+#ifndef GL_NV_texture_compression_s3tc_update
+#define GL_NV_texture_compression_s3tc_update 1
+#endif
+
+/* GL_NV_texture_npot_2D_mipmap */
+#ifndef GL_NV_texture_npot_2D_mipmap
+#define GL_NV_texture_npot_2D_mipmap 1
+#endif
+
+/*------------------------------------------------------------------------*
+ * QCOM extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_QCOM_alpha_test */
+#ifndef GL_QCOM_alpha_test
+#define GL_QCOM_alpha_test 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glAlphaFuncQCOM (GLenum func, GLclampf ref);
+#endif
+typedef void (GL_APIENTRYP PFNGLALPHAFUNCQCOMPROC) (GLenum func, GLclampf ref);
+#endif
+
+/* GL_QCOM_driver_control */
+#ifndef GL_QCOM_driver_control
+#define GL_QCOM_driver_control 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls);
+GL_APICALL void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
+GL_APICALL void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl);
+GL_APICALL void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl);
+#endif
+typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls);
+typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
+typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
+typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
+#endif
+
+/* GL_QCOM_extended_get */
+#ifndef GL_QCOM_extended_get
+#define GL_QCOM_extended_get 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures);
+GL_APICALL void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
+GL_APICALL void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
+GL_APICALL void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
+GL_APICALL void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
+GL_APICALL void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels);
+GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, GLvoid **params);
+#endif
+typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures);
+typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
+typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
+typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
+typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels);
+typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, GLvoid **params);
+#endif
+
+/* GL_QCOM_extended_get2 */
+#ifndef GL_QCOM_extended_get2
+#define GL_QCOM_extended_get2 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders);
+GL_APICALL void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
+GL_APICALL GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program);
+GL_APICALL void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
+#endif
+typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders);
+typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
+typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program);
+typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
+#endif
+
+/* GL_QCOM_perfmon_global_mode */
+#ifndef GL_QCOM_perfmon_global_mode
+#define GL_QCOM_perfmon_global_mode 1
+#endif
+
+/* GL_QCOM_writeonly_rendering */
+#ifndef GL_QCOM_writeonly_rendering
+#define GL_QCOM_writeonly_rendering 1
+#endif
+
+/* GL_QCOM_tiled_rendering */
+#ifndef GL_QCOM_tiled_rendering
+#define GL_QCOM_tiled_rendering 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
+GL_APICALL void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask);
+#endif
+typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
+typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask);
+#endif
+
+/*------------------------------------------------------------------------*
+ * VIV extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_VIV_shader_binary */
+#ifndef GL_VIV_shader_binary
+#define GL_VIV_shader_binary 1
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gl2ext_h_ */
--- /dev/null
+#ifndef __gl2platform_h_
+#define __gl2platform_h_
+
+/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */
+
+/*
+ * This document is licensed under the SGI Free Software B License Version
+ * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
+ */
+
+/* Platform-specific types and definitions for OpenGL ES 2.X gl2.h
+ *
+ * Adopters may modify khrplatform.h and this file to suit their platform.
+ * You are encouraged to submit all modifications to the Khronos group so that
+ * they can be included in future versions of this file. Please submit changes
+ * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
+ * by filing a bug against product "OpenGL-ES" component "Registry".
+ */
+
+#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 __khrplatform_h_
+#define __khrplatform_h_
+
+/*
+** Copyright (c) 2008-2009 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+/* Khronos platform-specific types and definitions.
+ *
+ * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $
+ *
+ * Adopters may modify this file to suit their platform. Adopters are
+ * encouraged to submit platform specific modifications to the Khronos
+ * group so that they can be included in future versions of this file.
+ * Please submit changes by sending them to the public Khronos Bugzilla
+ * (http://khronos.org/bugzilla) by filing a bug against product
+ * "Khronos (general)" component "Registry".
+ *
+ * A predefined template which fills in some of the bug fields can be
+ * reached using http://tinyurl.com/khrplatform-h-bugreport, but you
+ * must create a Bugzilla login first.
+ *
+ *
+ * See the Implementer's Guidelines for information about where this file
+ * should be located on your system and for more details of its use:
+ * http://www.khronos.org/registry/implementers_guide.pdf
+ *
+ * This file should be included as
+ * #include <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__)
+# if defined(KHRONOS_DLL_EXPORTS)
+# define KHRONOS_APICALL __declspec(dllexport)
+# else
+# define KHRONOS_APICALL __declspec(dllimport)
+# endif
+#elif defined (__SYMBIAN32__)
+# define KHRONOS_APICALL IMPORT_C
+#elif (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303) \
+ || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+/* KHRONOS_APIATTRIBUTES is not used by the client API headers yet */
+# define KHRONOS_APICALL __attribute__((visibility("default")))
+#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;
+typedef signed long int khronos_intptr_t;
+typedef unsigned long int khronos_uintptr_t;
+typedef signed long int khronos_ssize_t;
+typedef unsigned long int khronos_usize_t;
+
+#if KHRONOS_SUPPORT_FLOAT
+/*
+ * Float type
+ */
+typedef float khronos_float_t;
+#endif
+
+#if KHRONOS_SUPPORT_INT64
+/* Time types
+ *
+ * These types can be used to represent a time interval in nanoseconds or
+ * an absolute Unadjusted System Time. Unadjusted System Time is the number
+ * of nanoseconds since some arbitrary system event (e.g. since the last
+ * time the system booted). The Unadjusted System Time is an unsigned
+ * 64 bit value that wraps back to 0 every 584 years. Time intervals
+ * may be either signed or unsigned.
+ */
+typedef khronos_uint64_t khronos_utime_nanoseconds_t;
+typedef khronos_int64_t khronos_stime_nanoseconds_t;
+#endif
+
+/*
+ * Dummy value used to pad enum types to 32 bits.
+ */
+#ifndef KHRONOS_MAX_ENUM
+#define KHRONOS_MAX_ENUM 0x7FFFFFFF
+#endif
+
+/*
+ * Enumerated boolean type
+ *
+ * Values other than zero should be considered to be true. Therefore
+ * comparisons should not be made against KHRONOS_TRUE.
+ */
+typedef enum {
+ KHRONOS_FALSE = 0,
+ KHRONOS_TRUE = 1,
+ KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
+} khronos_boolean_enum_t;
+
+#endif /* __khrplatform_h_ */
--- /dev/null
+eglincludedir = $(includedir)/EGL
+eglinclude_HEADERS = \
+ EGL/egl.h \
+ EGL/eglext.h \
+ EGL/eglmesaext.h \
+ EGL/eglplatform.h
+
+glesincludedir = $(includedir)/GLES
+glesinclude_HEADERS = \
+ GLES/egl.h \
+ GLES/gl.h \
+ GLES/glext.h \
+ GLES/glplatform.h
+
+gles2includedir = $(includedir)/GLES2
+gles2include_HEADERS = \
+ GLES2/gl2.h \
+ GLES2/gl2ext.h \
+ GLES2/gl2platform.h
+
+khrincludedir = $(includedir)/KHR
+khrinclude_HEADERS = \
+ KHR/khrplatform.h
+
+clincludedir = $(includedir)/CL
+clinclude_HEADERS = \
+ CL/cl_ext.h \
+ CL/cl_gl_ext.h \
+ CL/cl_gl.h \
+ CL/cl.h \
+ CL/cl.hpp \
+ CL/cl_platform.h \
+ CL/opencl.h
+
+vgincludedir = $(includedir)/VG
+vginclude_HEADERS = \
+ VG/openvg.h \
+ VG/vgext.h \
+ VG/vgplatform.h \
+ VG/vgu.h
+
+uiincludedir = $(includedir)/hybris/ui
+uiinclude_HEADERS = \
+ hybris/ui/ui_compatibility_layer.h
+
+surface_flingerincludedir = $(includedir)/hybris/surface_flinger
+surface_flingerinclude_HEADERS = \
+ hybris/surface_flinger/surface_flinger_compatibility_layer.h
+
+inputincludedir = $(includedir)/hybris/input
+inputinclude_HEADERS = \
+ hybris/input/input_stack_compatibility_layer_codes_key.h \
+ hybris/input/input_stack_compatibility_layer_flags.h \
+ hybris/input/input_stack_compatibility_layer_flags_key.h \
+ hybris/input/input_stack_compatibility_layer_flags_motion.h \
+ hybris/input/input_stack_compatibility_layer.h
+
+cameraincludedir = $(includedir)/hybris/camera
+camerainclude_HEADERS = \
+ hybris/camera/camera_compatibility_layer_capabilities.h \
+ hybris/camera/camera_compatibility_layer_configuration_translator.h \
+ hybris/camera/camera_compatibility_layer.h
+
+propertiesincludedir = $(includedir)/hybris/properties
+propertiesinclude_HEADERS = \
+ hybris/properties/properties.h
+
+dlfcnincludedir = $(includedir)/hybris/dlfcn
+dlfcninclude_HEADERS = \
+ hybris/dlfcn/dlfcn.h
--- /dev/null
+/* $Revision: 9203 $ on $Date:: 2009-10-07 02:21:52 -0700 #$ */
+
+/*------------------------------------------------------------------------
+ *
+ * OpenVG 1.1 Reference Implementation
+ * -------------------------------------
+ *
+ * Copyright (c) 2008 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and /or associated documentation files
+ * (the "Materials "), to deal in the Materials without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Materials,
+ * and to permit persons to whom the Materials are furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
+ * THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//**
+ * \file
+ * \brief OpenVG 1.1 API.
+ *//*-------------------------------------------------------------------*/
+
+#ifndef _OPENVG_H
+#define _OPENVG_H
+
+#include <VG/vgplatform.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define OPENVG_VERSION_1_0 1
+#define OPENVG_VERSION_1_0_1 1
+#define OPENVG_VERSION_1_1 2
+
+#ifndef VG_MAXSHORT
+#define VG_MAXSHORT 0x7FFF
+#endif
+
+#ifndef VG_MAXINT
+#define VG_MAXINT 0x7FFFFFFF
+#endif
+
+#ifndef VG_MAX_ENUM
+#define VG_MAX_ENUM 0x7FFFFFFF
+#endif
+
+typedef VGuint VGHandle;
+
+typedef VGHandle VGPath;
+typedef VGHandle VGImage;
+typedef VGHandle VGMaskLayer;
+typedef VGHandle VGFont;
+typedef VGHandle VGPaint;
+
+#define VG_INVALID_HANDLE ((VGHandle)0)
+
+typedef enum {
+ VG_FALSE = 0,
+ VG_TRUE = 1,
+
+ VG_BOOLEAN_FORCE_SIZE = VG_MAX_ENUM
+} VGboolean;
+
+typedef enum {
+ VG_NO_ERROR = 0,
+ VG_BAD_HANDLE_ERROR = 0x1000,
+ VG_ILLEGAL_ARGUMENT_ERROR = 0x1001,
+ VG_OUT_OF_MEMORY_ERROR = 0x1002,
+ VG_PATH_CAPABILITY_ERROR = 0x1003,
+ VG_UNSUPPORTED_IMAGE_FORMAT_ERROR = 0x1004,
+ VG_UNSUPPORTED_PATH_FORMAT_ERROR = 0x1005,
+ VG_IMAGE_IN_USE_ERROR = 0x1006,
+ VG_NO_CONTEXT_ERROR = 0x1007,
+
+ VG_ERROR_CODE_FORCE_SIZE = VG_MAX_ENUM
+} VGErrorCode;
+
+typedef enum {
+ /* Mode settings */
+ VG_MATRIX_MODE = 0x1100,
+ VG_FILL_RULE = 0x1101,
+ VG_IMAGE_QUALITY = 0x1102,
+ VG_RENDERING_QUALITY = 0x1103,
+ VG_BLEND_MODE = 0x1104,
+ VG_IMAGE_MODE = 0x1105,
+
+ /* Scissoring rectangles */
+ VG_SCISSOR_RECTS = 0x1106,
+
+ /* Color Transformation */
+ VG_COLOR_TRANSFORM = 0x1170,
+ VG_COLOR_TRANSFORM_VALUES = 0x1171,
+
+ /* Stroke parameters */
+ VG_STROKE_LINE_WIDTH = 0x1110,
+ VG_STROKE_CAP_STYLE = 0x1111,
+ VG_STROKE_JOIN_STYLE = 0x1112,
+ VG_STROKE_MITER_LIMIT = 0x1113,
+ VG_STROKE_DASH_PATTERN = 0x1114,
+ VG_STROKE_DASH_PHASE = 0x1115,
+ VG_STROKE_DASH_PHASE_RESET = 0x1116,
+
+ /* Edge fill color for VG_TILE_FILL tiling mode */
+ VG_TILE_FILL_COLOR = 0x1120,
+
+ /* Color for vgClear */
+ VG_CLEAR_COLOR = 0x1121,
+
+ /* Glyph origin */
+ VG_GLYPH_ORIGIN = 0x1122,
+
+ /* Enable/disable alpha masking and scissoring */
+ VG_MASKING = 0x1130,
+ VG_SCISSORING = 0x1131,
+
+ /* Pixel layout information */
+ VG_PIXEL_LAYOUT = 0x1140,
+ VG_SCREEN_LAYOUT = 0x1141,
+
+ /* Source format selection for image filters */
+ VG_FILTER_FORMAT_LINEAR = 0x1150,
+ VG_FILTER_FORMAT_PREMULTIPLIED = 0x1151,
+
+ /* Destination write enable mask for image filters */
+ VG_FILTER_CHANNEL_MASK = 0x1152,
+
+ /* Implementation limits (read-only) */
+ VG_MAX_SCISSOR_RECTS = 0x1160,
+ VG_MAX_DASH_COUNT = 0x1161,
+ VG_MAX_KERNEL_SIZE = 0x1162,
+ VG_MAX_SEPARABLE_KERNEL_SIZE = 0x1163,
+ VG_MAX_COLOR_RAMP_STOPS = 0x1164,
+ VG_MAX_IMAGE_WIDTH = 0x1165,
+ VG_MAX_IMAGE_HEIGHT = 0x1166,
+ VG_MAX_IMAGE_PIXELS = 0x1167,
+ VG_MAX_IMAGE_BYTES = 0x1168,
+ VG_MAX_FLOAT = 0x1169,
+ VG_MAX_GAUSSIAN_STD_DEVIATION = 0x116A,
+
+ VG_PARAM_TYPE_FORCE_SIZE = VG_MAX_ENUM
+} VGParamType;
+
+typedef enum {
+ VG_RENDERING_QUALITY_NONANTIALIASED = 0x1200,
+ VG_RENDERING_QUALITY_FASTER = 0x1201,
+ VG_RENDERING_QUALITY_BETTER = 0x1202, /* Default */
+
+ VG_RENDERING_QUALITY_FORCE_SIZE = VG_MAX_ENUM
+} VGRenderingQuality;
+
+typedef enum {
+ VG_PIXEL_LAYOUT_UNKNOWN = 0x1300,
+ VG_PIXEL_LAYOUT_RGB_VERTICAL = 0x1301,
+ VG_PIXEL_LAYOUT_BGR_VERTICAL = 0x1302,
+ VG_PIXEL_LAYOUT_RGB_HORIZONTAL = 0x1303,
+ VG_PIXEL_LAYOUT_BGR_HORIZONTAL = 0x1304,
+
+ VG_PIXEL_LAYOUT_FORCE_SIZE = VG_MAX_ENUM
+} VGPixelLayout;
+
+typedef enum {
+ VG_MATRIX_PATH_USER_TO_SURFACE = 0x1400,
+ VG_MATRIX_IMAGE_USER_TO_SURFACE = 0x1401,
+ VG_MATRIX_FILL_PAINT_TO_USER = 0x1402,
+ VG_MATRIX_STROKE_PAINT_TO_USER = 0x1403,
+ VG_MATRIX_GLYPH_USER_TO_SURFACE = 0x1404,
+
+ VG_MATRIX_MODE_FORCE_SIZE = VG_MAX_ENUM
+} VGMatrixMode;
+
+typedef enum {
+ VG_CLEAR_MASK = 0x1500,
+ VG_FILL_MASK = 0x1501,
+ VG_SET_MASK = 0x1502,
+ VG_UNION_MASK = 0x1503,
+ VG_INTERSECT_MASK = 0x1504,
+ VG_SUBTRACT_MASK = 0x1505,
+
+ VG_MASK_OPERATION_FORCE_SIZE = VG_MAX_ENUM
+} VGMaskOperation;
+
+#define VG_PATH_FORMAT_STANDARD 0
+
+typedef enum {
+ VG_PATH_DATATYPE_S_8 = 0,
+ VG_PATH_DATATYPE_S_16 = 1,
+ VG_PATH_DATATYPE_S_32 = 2,
+ VG_PATH_DATATYPE_F = 3,
+
+ VG_PATH_DATATYPE_FORCE_SIZE = VG_MAX_ENUM
+} VGPathDatatype;
+
+typedef enum {
+ VG_ABSOLUTE = 0,
+ VG_RELATIVE = 1,
+
+ VG_PATH_ABS_REL_FORCE_SIZE = VG_MAX_ENUM
+} VGPathAbsRel;
+
+typedef enum {
+ VG_CLOSE_PATH = ( 0 << 1),
+ VG_MOVE_TO = ( 1 << 1),
+ VG_LINE_TO = ( 2 << 1),
+ VG_HLINE_TO = ( 3 << 1),
+ VG_VLINE_TO = ( 4 << 1),
+ VG_QUAD_TO = ( 5 << 1),
+ VG_CUBIC_TO = ( 6 << 1),
+ VG_SQUAD_TO = ( 7 << 1),
+ VG_SCUBIC_TO = ( 8 << 1),
+ VG_SCCWARC_TO = ( 9 << 1),
+ VG_SCWARC_TO = (10 << 1),
+ VG_LCCWARC_TO = (11 << 1),
+ VG_LCWARC_TO = (12 << 1),
+
+ VG_PATH_SEGMENT_FORCE_SIZE = VG_MAX_ENUM
+} VGPathSegment;
+
+typedef enum {
+ VG_MOVE_TO_ABS = VG_MOVE_TO | VG_ABSOLUTE,
+ VG_MOVE_TO_REL = VG_MOVE_TO | VG_RELATIVE,
+ VG_LINE_TO_ABS = VG_LINE_TO | VG_ABSOLUTE,
+ VG_LINE_TO_REL = VG_LINE_TO | VG_RELATIVE,
+ VG_HLINE_TO_ABS = VG_HLINE_TO | VG_ABSOLUTE,
+ VG_HLINE_TO_REL = VG_HLINE_TO | VG_RELATIVE,
+ VG_VLINE_TO_ABS = VG_VLINE_TO | VG_ABSOLUTE,
+ VG_VLINE_TO_REL = VG_VLINE_TO | VG_RELATIVE,
+ VG_QUAD_TO_ABS = VG_QUAD_TO | VG_ABSOLUTE,
+ VG_QUAD_TO_REL = VG_QUAD_TO | VG_RELATIVE,
+ VG_CUBIC_TO_ABS = VG_CUBIC_TO | VG_ABSOLUTE,
+ VG_CUBIC_TO_REL = VG_CUBIC_TO | VG_RELATIVE,
+ VG_SQUAD_TO_ABS = VG_SQUAD_TO | VG_ABSOLUTE,
+ VG_SQUAD_TO_REL = VG_SQUAD_TO | VG_RELATIVE,
+ VG_SCUBIC_TO_ABS = VG_SCUBIC_TO | VG_ABSOLUTE,
+ VG_SCUBIC_TO_REL = VG_SCUBIC_TO | VG_RELATIVE,
+ VG_SCCWARC_TO_ABS = VG_SCCWARC_TO | VG_ABSOLUTE,
+ VG_SCCWARC_TO_REL = VG_SCCWARC_TO | VG_RELATIVE,
+ VG_SCWARC_TO_ABS = VG_SCWARC_TO | VG_ABSOLUTE,
+ VG_SCWARC_TO_REL = VG_SCWARC_TO | VG_RELATIVE,
+ VG_LCCWARC_TO_ABS = VG_LCCWARC_TO | VG_ABSOLUTE,
+ VG_LCCWARC_TO_REL = VG_LCCWARC_TO | VG_RELATIVE,
+ VG_LCWARC_TO_ABS = VG_LCWARC_TO | VG_ABSOLUTE,
+ VG_LCWARC_TO_REL = VG_LCWARC_TO | VG_RELATIVE,
+
+ VG_PATH_COMMAND_FORCE_SIZE = VG_MAX_ENUM
+} VGPathCommand;
+
+typedef enum {
+ VG_PATH_CAPABILITY_APPEND_FROM = (1 << 0),
+ VG_PATH_CAPABILITY_APPEND_TO = (1 << 1),
+ VG_PATH_CAPABILITY_MODIFY = (1 << 2),
+ VG_PATH_CAPABILITY_TRANSFORM_FROM = (1 << 3),
+ VG_PATH_CAPABILITY_TRANSFORM_TO = (1 << 4),
+ VG_PATH_CAPABILITY_INTERPOLATE_FROM = (1 << 5),
+ VG_PATH_CAPABILITY_INTERPOLATE_TO = (1 << 6),
+ VG_PATH_CAPABILITY_PATH_LENGTH = (1 << 7),
+ VG_PATH_CAPABILITY_POINT_ALONG_PATH = (1 << 8),
+ VG_PATH_CAPABILITY_TANGENT_ALONG_PATH = (1 << 9),
+ VG_PATH_CAPABILITY_PATH_BOUNDS = (1 << 10),
+ VG_PATH_CAPABILITY_PATH_TRANSFORMED_BOUNDS = (1 << 11),
+ VG_PATH_CAPABILITY_ALL = (1 << 12) - 1,
+
+ VG_PATH_CAPABILITIES_FORCE_SIZE = VG_MAX_ENUM
+} VGPathCapabilities;
+
+typedef enum {
+ VG_PATH_FORMAT = 0x1600,
+ VG_PATH_DATATYPE = 0x1601,
+ VG_PATH_SCALE = 0x1602,
+ VG_PATH_BIAS = 0x1603,
+ VG_PATH_NUM_SEGMENTS = 0x1604,
+ VG_PATH_NUM_COORDS = 0x1605,
+
+ VG_PATH_PARAM_TYPE_FORCE_SIZE = VG_MAX_ENUM
+} VGPathParamType;
+
+typedef enum {
+ VG_CAP_BUTT = 0x1700,
+ VG_CAP_ROUND = 0x1701,
+ VG_CAP_SQUARE = 0x1702,
+
+ VG_CAP_STYLE_FORCE_SIZE = VG_MAX_ENUM
+} VGCapStyle;
+
+typedef enum {
+ VG_JOIN_MITER = 0x1800,
+ VG_JOIN_ROUND = 0x1801,
+ VG_JOIN_BEVEL = 0x1802,
+
+ VG_JOIN_STYLE_FORCE_SIZE = VG_MAX_ENUM
+} VGJoinStyle;
+
+typedef enum {
+ VG_EVEN_ODD = 0x1900,
+ VG_NON_ZERO = 0x1901,
+
+ VG_FILL_RULE_FORCE_SIZE = VG_MAX_ENUM
+} VGFillRule;
+
+typedef enum {
+ VG_STROKE_PATH = (1 << 0),
+ VG_FILL_PATH = (1 << 1),
+
+ VG_PAINT_MODE_FORCE_SIZE = VG_MAX_ENUM
+} VGPaintMode;
+
+typedef enum {
+ /* Color paint parameters */
+ VG_PAINT_TYPE = 0x1A00,
+ VG_PAINT_COLOR = 0x1A01,
+ VG_PAINT_COLOR_RAMP_SPREAD_MODE = 0x1A02,
+ VG_PAINT_COLOR_RAMP_PREMULTIPLIED = 0x1A07,
+ VG_PAINT_COLOR_RAMP_STOPS = 0x1A03,
+
+ /* Linear gradient paint parameters */
+ VG_PAINT_LINEAR_GRADIENT = 0x1A04,
+
+ /* Radial gradient paint parameters */
+ VG_PAINT_RADIAL_GRADIENT = 0x1A05,
+
+ /* Pattern paint parameters */
+ VG_PAINT_PATTERN_TILING_MODE = 0x1A06,
+
+ VG_PAINT_PARAM_TYPE_FORCE_SIZE = VG_MAX_ENUM
+} VGPaintParamType;
+
+typedef enum {
+ VG_PAINT_TYPE_COLOR = 0x1B00,
+ VG_PAINT_TYPE_LINEAR_GRADIENT = 0x1B01,
+ VG_PAINT_TYPE_RADIAL_GRADIENT = 0x1B02,
+ VG_PAINT_TYPE_PATTERN = 0x1B03,
+
+ VG_PAINT_TYPE_FORCE_SIZE = VG_MAX_ENUM
+} VGPaintType;
+
+typedef enum {
+ VG_COLOR_RAMP_SPREAD_PAD = 0x1C00,
+ VG_COLOR_RAMP_SPREAD_REPEAT = 0x1C01,
+ VG_COLOR_RAMP_SPREAD_REFLECT = 0x1C02,
+
+ VG_COLOR_RAMP_SPREAD_MODE_FORCE_SIZE = VG_MAX_ENUM
+} VGColorRampSpreadMode;
+
+typedef enum {
+ VG_TILE_FILL = 0x1D00,
+ VG_TILE_PAD = 0x1D01,
+ VG_TILE_REPEAT = 0x1D02,
+ VG_TILE_REFLECT = 0x1D03,
+
+ VG_TILING_MODE_FORCE_SIZE = VG_MAX_ENUM
+} VGTilingMode;
+
+typedef enum {
+ /* RGB{A,X} channel ordering */
+ VG_sRGBX_8888 = 0,
+ VG_sRGBA_8888 = 1,
+ VG_sRGBA_8888_PRE = 2,
+ VG_sRGB_565 = 3,
+ VG_sRGBA_5551 = 4,
+ VG_sRGBA_4444 = 5,
+ VG_sL_8 = 6,
+ VG_lRGBX_8888 = 7,
+ VG_lRGBA_8888 = 8,
+ VG_lRGBA_8888_PRE = 9,
+ VG_lL_8 = 10,
+ VG_A_8 = 11,
+ VG_BW_1 = 12,
+ VG_A_1 = 13,
+ VG_A_4 = 14,
+
+ /* {A,X}RGB channel ordering */
+ VG_sXRGB_8888 = 0 | (1 << 6),
+ VG_sARGB_8888 = 1 | (1 << 6),
+ VG_sARGB_8888_PRE = 2 | (1 << 6),
+ VG_sARGB_1555 = 4 | (1 << 6),
+ VG_sARGB_4444 = 5 | (1 << 6),
+ VG_lXRGB_8888 = 7 | (1 << 6),
+ VG_lARGB_8888 = 8 | (1 << 6),
+ VG_lARGB_8888_PRE = 9 | (1 << 6),
+
+ /* BGR{A,X} channel ordering */
+ VG_sBGRX_8888 = 0 | (1 << 7),
+ VG_sBGRA_8888 = 1 | (1 << 7),
+ VG_sBGRA_8888_PRE = 2 | (1 << 7),
+ VG_sBGR_565 = 3 | (1 << 7),
+ VG_sBGRA_5551 = 4 | (1 << 7),
+ VG_sBGRA_4444 = 5 | (1 << 7),
+ VG_lBGRX_8888 = 7 | (1 << 7),
+ VG_lBGRA_8888 = 8 | (1 << 7),
+ VG_lBGRA_8888_PRE = 9 | (1 << 7),
+
+ /* {A,X}BGR channel ordering */
+ VG_sXBGR_8888 = 0 | (1 << 6) | (1 << 7),
+ VG_sABGR_8888 = 1 | (1 << 6) | (1 << 7),
+ VG_sABGR_8888_PRE = 2 | (1 << 6) | (1 << 7),
+ VG_sABGR_1555 = 4 | (1 << 6) | (1 << 7),
+ VG_sABGR_4444 = 5 | (1 << 6) | (1 << 7),
+ VG_lXBGR_8888 = 7 | (1 << 6) | (1 << 7),
+ VG_lABGR_8888 = 8 | (1 << 6) | (1 << 7),
+ VG_lABGR_8888_PRE = 9 | (1 << 6) | (1 << 7),
+
+ VG_IMAGE_FORMAT_FORCE_SIZE = VG_MAX_ENUM
+} VGImageFormat;
+
+typedef enum {
+ VG_IMAGE_QUALITY_NONANTIALIASED = (1 << 0),
+ VG_IMAGE_QUALITY_FASTER = (1 << 1),
+ VG_IMAGE_QUALITY_BETTER = (1 << 2),
+
+ VG_IMAGE_QUALITY_FORCE_SIZE = VG_MAX_ENUM
+} VGImageQuality;
+
+typedef enum {
+ VG_IMAGE_FORMAT = 0x1E00,
+ VG_IMAGE_WIDTH = 0x1E01,
+ VG_IMAGE_HEIGHT = 0x1E02,
+
+ VG_IMAGE_PARAM_TYPE_FORCE_SIZE = VG_MAX_ENUM
+} VGImageParamType;
+
+typedef enum {
+ VG_DRAW_IMAGE_NORMAL = 0x1F00,
+ VG_DRAW_IMAGE_MULTIPLY = 0x1F01,
+ VG_DRAW_IMAGE_STENCIL = 0x1F02,
+
+ VG_IMAGE_MODE_FORCE_SIZE = VG_MAX_ENUM
+} VGImageMode;
+
+typedef enum {
+ VG_RED = (1 << 3),
+ VG_GREEN = (1 << 2),
+ VG_BLUE = (1 << 1),
+ VG_ALPHA = (1 << 0),
+
+ VG_IMAGE_CHANNEL_FORCE_SIZE = VG_MAX_ENUM
+} VGImageChannel;
+
+typedef enum {
+ VG_BLEND_SRC = 0x2000,
+ VG_BLEND_SRC_OVER = 0x2001,
+ VG_BLEND_DST_OVER = 0x2002,
+ VG_BLEND_SRC_IN = 0x2003,
+ VG_BLEND_DST_IN = 0x2004,
+ VG_BLEND_MULTIPLY = 0x2005,
+ VG_BLEND_SCREEN = 0x2006,
+ VG_BLEND_DARKEN = 0x2007,
+ VG_BLEND_LIGHTEN = 0x2008,
+ VG_BLEND_ADDITIVE = 0x2009,
+
+ VG_BLEND_MODE_FORCE_SIZE = VG_MAX_ENUM
+} VGBlendMode;
+
+typedef enum {
+ VG_FONT_NUM_GLYPHS = 0x2F00,
+
+ VG_FONT_PARAM_TYPE_FORCE_SIZE = VG_MAX_ENUM
+} VGFontParamType;
+
+typedef enum {
+ VG_IMAGE_FORMAT_QUERY = 0x2100,
+ VG_PATH_DATATYPE_QUERY = 0x2101,
+
+ VG_HARDWARE_QUERY_TYPE_FORCE_SIZE = VG_MAX_ENUM
+} VGHardwareQueryType;
+
+typedef enum {
+ VG_HARDWARE_ACCELERATED = 0x2200,
+ VG_HARDWARE_UNACCELERATED = 0x2201,
+
+ VG_HARDWARE_QUERY_RESULT_FORCE_SIZE = VG_MAX_ENUM
+} VGHardwareQueryResult;
+
+typedef enum {
+ VG_VENDOR = 0x2300,
+ VG_RENDERER = 0x2301,
+ VG_VERSION = 0x2302,
+ VG_EXTENSIONS = 0x2303,
+
+ VG_STRING_ID_FORCE_SIZE = VG_MAX_ENUM
+} VGStringID;
+
+/* Function Prototypes */
+
+#ifndef VG_API_CALL
+# error VG_API_CALL must be defined
+#endif
+
+#ifndef VG_API_ENTRY
+# error VG_API_ENTRY must be defined
+#endif
+
+#ifndef VG_API_EXIT
+# error VG_API_EXIT must be defined
+#endif
+
+VG_API_CALL VGErrorCode VG_API_ENTRY vgGetError(void) VG_API_EXIT;
+
+VG_API_CALL void VG_API_ENTRY vgFlush(void) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgFinish(void) VG_API_EXIT;
+
+/* Getters and Setters */
+VG_API_CALL void VG_API_ENTRY vgSetf (VGParamType type, VGfloat value) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgSeti (VGParamType type, VGint value) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgSetfv(VGParamType type, VGint count,
+ const VGfloat * values) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgSetiv(VGParamType type, VGint count,
+ const VGint * values) VG_API_EXIT;
+
+VG_API_CALL VGfloat VG_API_ENTRY vgGetf(VGParamType type) VG_API_EXIT;
+VG_API_CALL VGint VG_API_ENTRY vgGeti(VGParamType type) VG_API_EXIT;
+VG_API_CALL VGint VG_API_ENTRY vgGetVectorSize(VGParamType type) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgGetfv(VGParamType type, VGint count, VGfloat * values) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgGetiv(VGParamType type, VGint count, VGint * values) VG_API_EXIT;
+
+VG_API_CALL void VG_API_ENTRY vgSetParameterf(VGHandle object,
+ VGint paramType,
+ VGfloat value) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgSetParameteri(VGHandle object,
+ VGint paramType,
+ VGint value) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgSetParameterfv(VGHandle object,
+ VGint paramType,
+ VGint count, const VGfloat * values) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgSetParameteriv(VGHandle object,
+ VGint paramType,
+ VGint count, const VGint * values) VG_API_EXIT;
+
+VG_API_CALL VGfloat VG_API_ENTRY vgGetParameterf(VGHandle object,
+ VGint paramType) VG_API_EXIT;
+VG_API_CALL VGint VG_API_ENTRY vgGetParameteri(VGHandle object,
+ VGint paramType);
+VG_API_CALL VGint VG_API_ENTRY vgGetParameterVectorSize(VGHandle object,
+ VGint paramType) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgGetParameterfv(VGHandle object,
+ VGint paramType,
+ VGint count, VGfloat * values) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgGetParameteriv(VGHandle object,
+ VGint paramType,
+ VGint count, VGint * values) VG_API_EXIT;
+
+/* Matrix Manipulation */
+VG_API_CALL void VG_API_ENTRY vgLoadIdentity(void) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgLoadMatrix(const VGfloat * m) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgGetMatrix(VGfloat * m) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgMultMatrix(const VGfloat * m) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgTranslate(VGfloat tx, VGfloat ty) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgScale(VGfloat sx, VGfloat sy) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgShear(VGfloat shx, VGfloat shy) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgRotate(VGfloat angle) VG_API_EXIT;
+
+/* Masking and Clearing */
+VG_API_CALL void VG_API_ENTRY vgMask(VGHandle mask, VGMaskOperation operation,
+ VGint x, VGint y,
+ VGint width, VGint height) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgRenderToMask(VGPath path,
+ VGbitfield paintModes,
+ VGMaskOperation operation) VG_API_EXIT;
+VG_API_CALL VGMaskLayer VG_API_ENTRY vgCreateMaskLayer(VGint width, VGint height) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgDestroyMaskLayer(VGMaskLayer maskLayer) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgFillMaskLayer(VGMaskLayer maskLayer,
+ VGint x, VGint y,
+ VGint width, VGint height,
+ VGfloat value) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgCopyMask(VGMaskLayer maskLayer,
+ VGint dx, VGint dy,
+ VGint sx, VGint sy,
+ VGint width, VGint height) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgClear(VGint x, VGint y, VGint width, VGint height) VG_API_EXIT;
+
+/* Paths */
+VG_API_CALL VGPath VG_API_ENTRY vgCreatePath(VGint pathFormat,
+ VGPathDatatype datatype,
+ VGfloat scale, VGfloat bias,
+ VGint segmentCapacityHint,
+ VGint coordCapacityHint,
+ VGbitfield capabilities) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgClearPath(VGPath path, VGbitfield capabilities) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgDestroyPath(VGPath path) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgRemovePathCapabilities(VGPath path,
+ VGbitfield capabilities) VG_API_EXIT;
+VG_API_CALL VGbitfield VG_API_ENTRY vgGetPathCapabilities(VGPath path) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgAppendPath(VGPath dstPath, VGPath srcPath) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgAppendPathData(VGPath dstPath,
+ VGint numSegments,
+ const VGubyte * pathSegments,
+ const void * pathData) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgModifyPathCoords(VGPath dstPath, VGint startIndex,
+ VGint numSegments,
+ const void * pathData) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgTransformPath(VGPath dstPath, VGPath srcPath) VG_API_EXIT;
+VG_API_CALL VGboolean VG_API_ENTRY vgInterpolatePath(VGPath dstPath,
+ VGPath startPath,
+ VGPath endPath,
+ VGfloat amount) VG_API_EXIT;
+VG_API_CALL VGfloat VG_API_ENTRY vgPathLength(VGPath path,
+ VGint startSegment, VGint numSegments) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgPointAlongPath(VGPath path,
+ VGint startSegment, VGint numSegments,
+ VGfloat distance,
+ VGfloat * x, VGfloat * y,
+ VGfloat * tangentX, VGfloat * tangentY) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgPathBounds(VGPath path,
+ VGfloat * minX, VGfloat * minY,
+ VGfloat * width, VGfloat * height) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgPathTransformedBounds(VGPath path,
+ VGfloat * minX, VGfloat * minY,
+ VGfloat * width, VGfloat * height) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgDrawPath(VGPath path, VGbitfield paintModes) VG_API_EXIT;
+
+/* Paint */
+VG_API_CALL VGPaint VG_API_ENTRY vgCreatePaint(void) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgDestroyPaint(VGPaint paint) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgSetPaint(VGPaint paint, VGbitfield paintModes) VG_API_EXIT;
+VG_API_CALL VGPaint VG_API_ENTRY vgGetPaint(VGPaintMode paintMode) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgSetColor(VGPaint paint, VGuint rgba) VG_API_EXIT;
+VG_API_CALL VGuint VG_API_ENTRY vgGetColor(VGPaint paint) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgPaintPattern(VGPaint paint, VGImage pattern) VG_API_EXIT;
+
+/* Images */
+VG_API_CALL VGImage VG_API_ENTRY vgCreateImage(VGImageFormat format,
+ VGint width, VGint height,
+ VGbitfield allowedQuality) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgDestroyImage(VGImage image) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgClearImage(VGImage image,
+ VGint x, VGint y, VGint width, VGint height) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgImageSubData(VGImage image,
+ const void * data, VGint dataStride,
+ VGImageFormat dataFormat,
+ VGint x, VGint y, VGint width, VGint height) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgGetImageSubData(VGImage image,
+ void * data, VGint dataStride,
+ VGImageFormat dataFormat,
+ VGint x, VGint y,
+ VGint width, VGint height) VG_API_EXIT;
+VG_API_CALL VGImage VG_API_ENTRY vgChildImage(VGImage parent,
+ VGint x, VGint y, VGint width, VGint height) VG_API_EXIT;
+VG_API_CALL VGImage VG_API_ENTRY vgGetParent(VGImage image) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgCopyImage(VGImage dst, VGint dx, VGint dy,
+ VGImage src, VGint sx, VGint sy,
+ VGint width, VGint height,
+ VGboolean dither) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgDrawImage(VGImage image) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgSetPixels(VGint dx, VGint dy,
+ VGImage src, VGint sx, VGint sy,
+ VGint width, VGint height) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgWritePixels(const void * data, VGint dataStride,
+ VGImageFormat dataFormat,
+ VGint dx, VGint dy,
+ VGint width, VGint height) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgGetPixels(VGImage dst, VGint dx, VGint dy,
+ VGint sx, VGint sy,
+ VGint width, VGint height) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgReadPixels(void * data, VGint dataStride,
+ VGImageFormat dataFormat,
+ VGint sx, VGint sy,
+ VGint width, VGint height) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgCopyPixels(VGint dx, VGint dy,
+ VGint sx, VGint sy,
+ VGint width, VGint height) VG_API_EXIT;
+
+/* Text */
+VG_API_CALL VGFont VG_API_ENTRY vgCreateFont(VGint glyphCapacityHint) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgDestroyFont(VGFont font) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgSetGlyphToPath(VGFont font,
+ VGuint glyphIndex,
+ VGPath path,
+ VGboolean isHinted,
+ const VGfloat glyphOrigin [2],
+ const VGfloat escapement[2]) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgSetGlyphToImage(VGFont font,
+ VGuint glyphIndex,
+ VGImage image,
+ const VGfloat glyphOrigin [2],
+ const VGfloat escapement[2]) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgClearGlyph(VGFont font,VGuint glyphIndex) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgDrawGlyph(VGFont font,
+ VGuint glyphIndex,
+ VGbitfield paintModes,
+ VGboolean allowAutoHinting) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgDrawGlyphs(VGFont font,
+ VGint glyphCount,
+ const VGuint *glyphIndices,
+ const VGfloat *adjustments_x,
+ const VGfloat *adjustments_y,
+ VGbitfield paintModes,
+ VGboolean allowAutoHinting) VG_API_EXIT;
+
+/* Image Filters */
+VG_API_CALL void VG_API_ENTRY vgColorMatrix(VGImage dst, VGImage src,
+ const VGfloat * matrix) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgConvolve(VGImage dst, VGImage src,
+ VGint kernelWidth, VGint kernelHeight,
+ VGint shiftX, VGint shiftY,
+ const VGshort * kernel,
+ VGfloat scale,
+ VGfloat bias,
+ VGTilingMode tilingMode) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgSeparableConvolve(VGImage dst, VGImage src,
+ VGint kernelWidth,
+ VGint kernelHeight,
+ VGint shiftX, VGint shiftY,
+ const VGshort * kernelX,
+ const VGshort * kernelY,
+ VGfloat scale,
+ VGfloat bias,
+ VGTilingMode tilingMode) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgGaussianBlur(VGImage dst, VGImage src,
+ VGfloat stdDeviationX,
+ VGfloat stdDeviationY,
+ VGTilingMode tilingMode) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgLookup(VGImage dst, VGImage src,
+ const VGubyte * redLUT,
+ const VGubyte * greenLUT,
+ const VGubyte * blueLUT,
+ const VGubyte * alphaLUT,
+ VGboolean outputLinear,
+ VGboolean outputPremultiplied) VG_API_EXIT;
+VG_API_CALL void VG_API_ENTRY vgLookupSingle(VGImage dst, VGImage src,
+ const VGuint * lookupTable,
+ VGImageChannel sourceChannel,
+ VGboolean outputLinear,
+ VGboolean outputPremultiplied) VG_API_EXIT;
+
+/* Hardware Queries */
+VG_API_CALL VGHardwareQueryResult VG_API_ENTRY vgHardwareQuery(VGHardwareQueryType key,
+ VGint setting) VG_API_EXIT;
+
+/* Renderer and Extension Information */
+VG_API_CALL const VGubyte * VG_API_ENTRY vgGetString(VGStringID name) VG_API_EXIT;
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* _OPENVG_H */
--- /dev/null
+/* $Revision: 6810 $ on $Date:: 2008-10-29 07:31:37 -0700 #$ */
+
+/*------------------------------------------------------------------------
+ *
+ * VG extensions Reference Implementation
+ * -------------------------------------
+ *
+ * Copyright (c) 2008 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and /or associated documentation files
+ * (the "Materials "), to deal in the Materials without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Materials,
+ * and to permit persons to whom the Materials are furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
+ * THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//**
+ * \file
+ * \brief VG extensions
+ *//*-------------------------------------------------------------------*/
+
+
+
+#ifndef _VGEXT_H
+#define _VGEXT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <VG/openvg.h>
+#include <VG/vgu.h>
+
+#ifndef VG_API_ENTRYP
+# define VG_API_ENTRYP VG_API_ENTRY*
+#endif
+
+#ifndef VGU_API_ENTRYP
+# define VGU_API_ENTRYP VGU_API_ENTRY*
+#endif
+
+/*-------------------------------------------------------------------------------
+ * KHR extensions
+ *------------------------------------------------------------------------------*/
+
+typedef enum {
+
+#ifndef VG_KHR_iterative_average_blur
+ VG_MAX_AVERAGE_BLUR_DIMENSION_KHR = 0x116B,
+ VG_AVERAGE_BLUR_DIMENSION_RESOLUTION_KHR = 0x116C,
+ VG_MAX_AVERAGE_BLUR_ITERATIONS_KHR = 0x116D,
+#endif
+
+ VG_PARAM_TYPE_KHR_FORCE_SIZE = VG_MAX_ENUM
+} VGParamTypeKHR;
+
+#ifndef VG_KHR_EGL_image
+#define VG_KHR_EGL_image 1
+/* VGEGLImageKHR is an opaque handle to an EGLImage */
+typedef void* VGeglImageKHR;
+
+#ifdef VG_VGEXT_PROTOTYPES
+VG_API_CALL VGImage VG_API_ENTRY vgCreateEGLImageTargetKHR(VGeglImageKHR image);
+#endif
+typedef VGImage (VG_API_ENTRYP PFNVGCREATEEGLIMAGETARGETKHRPROC) (VGeglImageKHR image);
+
+#endif
+
+
+#ifndef VG_KHR_iterative_average_blur
+#define VG_KHR_iterative_average_blur 1
+
+#ifdef VG_VGEXT_PROTOTYPES
+VG_API_CALL void vgIterativeAverageBlurKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGTilingMode tilingMode);
+#endif
+typedef void (VG_API_ENTRYP PFNVGITERATIVEAVERAGEBLURKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGTilingMode tilingMode);
+
+#endif
+
+
+#ifndef VG_KHR_advanced_blending
+#define VG_KHR_advanced_blending 1
+
+typedef enum {
+ VG_BLEND_OVERLAY_KHR = 0x2010,
+ VG_BLEND_HARDLIGHT_KHR = 0x2011,
+ VG_BLEND_SOFTLIGHT_SVG_KHR = 0x2012,
+ VG_BLEND_SOFTLIGHT_KHR = 0x2013,
+ VG_BLEND_COLORDODGE_KHR = 0x2014,
+ VG_BLEND_COLORBURN_KHR = 0x2015,
+ VG_BLEND_DIFFERENCE_KHR = 0x2016,
+ VG_BLEND_SUBTRACT_KHR = 0x2017,
+ VG_BLEND_INVERT_KHR = 0x2018,
+ VG_BLEND_EXCLUSION_KHR = 0x2019,
+ VG_BLEND_LINEARDODGE_KHR = 0x201a,
+ VG_BLEND_LINEARBURN_KHR = 0x201b,
+ VG_BLEND_VIVIDLIGHT_KHR = 0x201c,
+ VG_BLEND_LINEARLIGHT_KHR = 0x201d,
+ VG_BLEND_PINLIGHT_KHR = 0x201e,
+ VG_BLEND_HARDMIX_KHR = 0x201f,
+ VG_BLEND_CLEAR_KHR = 0x2020,
+ VG_BLEND_DST_KHR = 0x2021,
+ VG_BLEND_SRC_OUT_KHR = 0x2022,
+ VG_BLEND_DST_OUT_KHR = 0x2023,
+ VG_BLEND_SRC_ATOP_KHR = 0x2024,
+ VG_BLEND_DST_ATOP_KHR = 0x2025,
+ VG_BLEND_XOR_KHR = 0x2026,
+
+ VG_BLEND_MODE_KHR_FORCE_SIZE= VG_MAX_ENUM
+} VGBlendModeKHR;
+#endif
+
+#ifndef VG_KHR_parametric_filter
+#define VG_KHR_parametric_filter 1
+
+typedef enum {
+ VG_PF_OBJECT_VISIBLE_FLAG_KHR = (1 << 0),
+ VG_PF_KNOCKOUT_FLAG_KHR = (1 << 1),
+ VG_PF_OUTER_FLAG_KHR = (1 << 2),
+ VG_PF_INNER_FLAG_KHR = (1 << 3),
+
+ VG_PF_TYPE_KHR_FORCE_SIZE = VG_MAX_ENUM
+} VGPfTypeKHR;
+
+typedef enum {
+ VGU_IMAGE_IN_USE_ERROR = 0xF010,
+
+ VGU_ERROR_CODE_KHR_FORCE_SIZE = VG_MAX_ENUM
+} VGUErrorCodeKHR;
+
+#ifdef VG_VGEXT_PROTOTYPES
+VG_API_CALL void VG_API_ENTRY vgParametricFilterKHR(VGImage dst,VGImage src,VGImage blur,VGfloat strength,VGfloat offsetX,VGfloat offsetY,VGbitfield filterFlags,VGPaint highlightPaint,VGPaint shadowPaint);
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguDropShadowKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint shadowColorRGBA);
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguGlowKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint glowColorRGBA) ;
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguBevelKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint highlightColorRGBA,VGuint shadowColorRGBA);
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguGradientGlowKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* glowColorRampStops);
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguGradientBevelKHR(VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* bevelColorRampStops);
+#endif
+typedef void (VG_API_ENTRYP PFNVGPARAMETRICFILTERKHRPROC) (VGImage dst,VGImage src,VGImage blur,VGfloat strength,VGfloat offsetX,VGfloat offsetY,VGbitfield filterFlags,VGPaint highlightPaint,VGPaint shadowPaint);
+typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUDROPSHADOWKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint shadowColorRGBA);
+typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUGLOWKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint glowColorRGBA);
+typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUBEVELKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint highlightColorRGBA,VGuint shadowColorRGBA);
+typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUGRADIENTGLOWKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* glowColorRampStops);
+typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUGRADIENTBEVELKHRPROC) (VGImage dst,VGImage src,VGfloat dimX,VGfloat dimY,VGuint iterative,VGfloat strength,VGfloat distance,VGfloat angle,VGbitfield filterFlags,VGbitfield allowedQuality,VGuint stopsCount,const VGfloat* bevelColorRampStops);
+
+#endif
+
+
+/*-------------------------------------------------------------------------------
+ * NDS extensions
+ *------------------------------------------------------------------------------*/
+
+#ifndef VG_NDS_paint_generation
+#define VG_NDS_paint_generation 1
+
+typedef enum {
+ VG_PAINT_COLOR_RAMP_LINEAR_NDS = 0x1A10,
+ VG_COLOR_MATRIX_NDS = 0x1A11,
+ VG_PAINT_COLOR_TRANSFORM_LINEAR_NDS = 0x1A12,
+
+ VG_PAINT_PARAM_TYPE_NDS_FORCE_SIZE = VG_MAX_ENUM
+} VGPaintParamTypeNds;
+
+typedef enum {
+ VG_DRAW_IMAGE_COLOR_MATRIX_NDS = 0x1F10,
+
+ VG_IMAGE_MODE_NDS_FORCE_SIZE = VG_MAX_ENUM
+} VGImageModeNds;
+#endif
+
+
+#ifndef VG_NDS_projective_geometry
+#define VG_NDS_projective_geometry 1
+
+typedef enum {
+ VG_CLIP_MODE_NDS = 0x1180,
+ VG_CLIP_LINES_NDS = 0x1181,
+ VG_MAX_CLIP_LINES_NDS = 0x1182,
+
+ VG_PARAM_TYPE_NDS_FORCE_SIZE = VG_MAX_ENUM
+} VGParamTypeNds;
+
+typedef enum {
+ VG_CLIPMODE_NONE_NDS = 0x3000,
+ VG_CLIPMODE_CLIP_CLOSED_NDS = 0x3001,
+ VG_CLIPMODE_CLIP_OPEN_NDS = 0x3002,
+ VG_CLIPMODE_CULL_NDS = 0x3003,
+
+ VG_CLIPMODE_NDS_FORCE_SIZE = VG_MAX_ENUM
+} VGClipModeNds;
+
+typedef enum {
+ VG_RQUAD_TO_NDS = ( 13 << 1 ),
+ VG_RCUBIC_TO_NDS = ( 14 << 1 ),
+
+ VG_PATH_SEGMENT_NDS_FORCE_SIZE = VG_MAX_ENUM
+} VGPathSegmentNds;
+
+typedef enum {
+ VG_RQUAD_TO_ABS_NDS = (VG_RQUAD_TO_NDS | VG_ABSOLUTE),
+ VG_RQUAD_TO_REL_NDS = (VG_RQUAD_TO_NDS | VG_RELATIVE),
+ VG_RCUBIC_TO_ABS_NDS = (VG_RCUBIC_TO_NDS | VG_ABSOLUTE),
+ VG_RCUBIC_TO_REL_NDS = (VG_RCUBIC_TO_NDS | VG_RELATIVE),
+
+ VG_PATH_COMMAND_NDS_FORCE_SIZE = VG_MAX_ENUM
+} VGPathCommandNds;
+
+#ifdef VG_VGEXT_PROTOTYPES
+VG_API_CALL void VG_API_ENTRY vgProjectiveMatrixNDS(VGboolean enable) ;
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguTransformClipLineNDS(const VGfloat Ain,const VGfloat Bin,const VGfloat Cin,const VGfloat* matrix,const VGboolean inverse,VGfloat* Aout,VGfloat* Bout,VGfloat* Cout);
+#endif
+typedef void (VG_API_ENTRYP PFNVGPROJECTIVEMATRIXNDSPROC) (VGboolean enable) ;
+typedef VGUErrorCode (VGU_API_ENTRYP PFNVGUTRANSFORMCLIPLINENDSPROC) (const VGfloat Ain,const VGfloat Bin,const VGfloat Cin,const VGfloat* matrix,const VGboolean inverse,VGfloat* Aout,VGfloat* Bout,VGfloat* Cout);
+
+#endif
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* _VGEXT_H */
--- /dev/null
+/* $Revision: 6810 $ on $Date:: 2008-10-29 07:31:37 -0700 #$ */
+
+/*------------------------------------------------------------------------
+ *
+ * VG platform specific header Reference Implementation
+ * ----------------------------------------------------
+ *
+ * Copyright (c) 2008 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and /or associated documentation files
+ * (the "Materials "), to deal in the Materials without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Materials,
+ * and to permit persons to whom the Materials are furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
+ * THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//**
+ * \file
+ * \brief VG platform specific header
+ *//*-------------------------------------------------------------------*/
+
+#ifndef _VGPLATFORM_H
+#define _VGPLATFORM_H
+
+#include <KHR/khrplatform.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef VG_API_CALL
+#if defined(OPENVG_STATIC_LIBRARY)
+# define VG_API_CALL
+#else
+# define VG_API_CALL KHRONOS_APICALL
+#endif /* defined OPENVG_STATIC_LIBRARY */
+#endif /* ifndef VG_API_CALL */
+
+#ifndef VGU_API_CALL
+#if defined(OPENVG_STATIC_LIBRARY)
+# define VGU_API_CALL
+#else
+# define VGU_API_CALL KHRONOS_APICALL
+#endif /* defined OPENVG_STATIC_LIBRARY */
+#endif /* ifndef VGU_API_CALL */
+
+
+#ifndef VG_API_ENTRY
+#define VG_API_ENTRY
+#endif
+
+#ifndef VG_API_EXIT
+#define VG_API_EXIT
+#endif
+
+#ifndef VGU_API_ENTRY
+#define VGU_API_ENTRY
+#endif
+
+#ifndef VGU_API_EXIT
+#define VGU_API_EXIT
+#endif
+
+typedef float VGfloat;
+typedef signed char VGbyte;
+typedef unsigned char VGubyte;
+typedef signed short VGshort;
+typedef signed int VGint;
+typedef unsigned int VGuint;
+typedef unsigned int VGbitfield;
+
+#ifndef VG_VGEXT_PROTOTYPES
+#define VG_VGEXT_PROTOTYPES
+#endif
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* _VGPLATFORM_H */
--- /dev/null
+/* $Revision: 6810 $ on $Date:: 2008-10-29 07:31:37 -0700 #$ */
+
+/*------------------------------------------------------------------------
+ *
+ * VGU 1.1 Reference Implementation
+ * -------------------------------------
+ *
+ * Copyright (c) 2008 The Khronos Group Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and /or associated documentation files
+ * (the "Materials "), to deal in the Materials without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Materials,
+ * and to permit persons to whom the Materials are furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Materials.
+ *
+ * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR
+ * THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ *
+ *//**
+ * \file
+ * \brief VGU 1.1 API.
+ *//*-------------------------------------------------------------------*/
+
+#ifndef _VGU_H
+#define _VGU_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <VG/openvg.h>
+
+#define VGU_VERSION_1_0 1
+#define VGU_VERSION_1_1 2
+
+#ifndef VGU_API_CALL
+# error VGU_API_CALL must be defined
+#endif
+
+#ifndef VGU_API_ENTRY
+# error VGU_API_ENTRY must be defined
+#endif
+
+#ifndef VGU_API_EXIT
+# error VGU_API_EXIT must be defined
+#endif
+
+
+typedef enum {
+ VGU_NO_ERROR = 0,
+ VGU_BAD_HANDLE_ERROR = 0xF000,
+ VGU_ILLEGAL_ARGUMENT_ERROR = 0xF001,
+ VGU_OUT_OF_MEMORY_ERROR = 0xF002,
+ VGU_PATH_CAPABILITY_ERROR = 0xF003,
+ VGU_BAD_WARP_ERROR = 0xF004,
+
+ VGU_ERROR_CODE_FORCE_SIZE = VG_MAX_ENUM
+} VGUErrorCode;
+
+typedef enum {
+ VGU_ARC_OPEN = 0xF100,
+ VGU_ARC_CHORD = 0xF101,
+ VGU_ARC_PIE = 0xF102,
+
+ VGU_ARC_TYPE_FORCE_SIZE = VG_MAX_ENUM
+} VGUArcType;
+
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguLine(VGPath path,
+ VGfloat x0, VGfloat y0,
+ VGfloat x1, VGfloat y1) VGU_API_EXIT;
+
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguPolygon(VGPath path,
+ const VGfloat * points, VGint count,
+ VGboolean closed) VGU_API_EXIT;
+
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguRect(VGPath path,
+ VGfloat x, VGfloat y,
+ VGfloat width, VGfloat height) VGU_API_EXIT;
+
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguRoundRect(VGPath path,
+ VGfloat x, VGfloat y,
+ VGfloat width, VGfloat height,
+ VGfloat arcWidth, VGfloat arcHeight) VGU_API_EXIT;
+
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguEllipse(VGPath path,
+ VGfloat cx, VGfloat cy,
+ VGfloat width, VGfloat height) VGU_API_EXIT;
+
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguArc(VGPath path,
+ VGfloat x, VGfloat y,
+ VGfloat width, VGfloat height,
+ VGfloat startAngle, VGfloat angleExtent,
+ VGUArcType arcType) VGU_API_EXIT;
+
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguComputeWarpQuadToSquare(VGfloat sx0, VGfloat sy0,
+ VGfloat sx1, VGfloat sy1,
+ VGfloat sx2, VGfloat sy2,
+ VGfloat sx3, VGfloat sy3,
+ VGfloat * matrix) VGU_API_EXIT;
+
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguComputeWarpSquareToQuad(VGfloat dx0, VGfloat dy0,
+ VGfloat dx1, VGfloat dy1,
+ VGfloat dx2, VGfloat dy2,
+ VGfloat dx3, VGfloat dy3,
+ VGfloat * matrix) VGU_API_EXIT;
+
+VGU_API_CALL VGUErrorCode VGU_API_ENTRY vguComputeWarpQuadToQuad(VGfloat dx0, VGfloat dy0,
+ VGfloat dx1, VGfloat dy1,
+ VGfloat dx2, VGfloat dy2,
+ VGfloat dx3, VGfloat dy3,
+ VGfloat sx0, VGfloat sy0,
+ VGfloat sx1, VGfloat sy1,
+ VGfloat sx2, VGfloat sy2,
+ VGfloat sx3, VGfloat sy3,
+ VGfloat * matrix) VGU_API_EXIT;
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* #ifndef _VGU_H */
--- /dev/null
+/*
+ * Copyright (C) 2013 Canonical Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authored by: Thomas Voss <thomas.voss@canonical.com>
+ */
+
+#ifndef CAMERA_COMPATIBILITY_LAYER_H_
+#define CAMERA_COMPATIBILITY_LAYER_H_
+
+#include <stdint.h>
+#include <unistd.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ // Forward declarations
+ struct SfSurface;
+
+ typedef enum
+ {
+ // This camera has higher quality and features like high resolution and flash
+ BACK_FACING_CAMERA_TYPE,
+ // The camera that is on the same side as the touch display. Usually used for video calls
+ FRONT_FACING_CAMERA_TYPE
+ } CameraType;
+
+ struct CameraControl;
+
+ typedef void (*on_msg_error)(void* context);
+ typedef void (*on_msg_shutter)(void* context);
+ typedef void (*on_msg_focus)(void* context);
+ typedef void (*on_msg_zoom)(void* context, int32_t new_zoom_level);
+
+ typedef void (*on_data_raw_image)(void* data, uint32_t data_size, void* context);
+ typedef void (*on_data_compressed_image)(void* data, uint32_t data_size, void* context);
+ typedef void (*on_preview_texture_needs_update)(void* context);
+
+ struct CameraControlListener
+ {
+ // Called whenever an error occurs while the camera HAL executes a command
+ on_msg_error on_msg_error_cb;
+ // Called while taking a picture when the shutter has been triggered
+ on_msg_shutter on_msg_shutter_cb;
+ // Called while focusing
+ on_msg_focus on_msg_focus_cb;
+ // Called while zooming
+ on_msg_zoom on_msg_zoom_cb;
+
+ // Raw image data (Bayer pattern) is reported over this callback
+ on_data_raw_image on_data_raw_image_cb;
+ // JPEG-compressed image is reported over this callback
+ on_data_compressed_image on_data_compressed_image_cb;
+
+ // If a texture has been set as a destination for preview frames,
+ // this callback is invoked whenever a new buffer from the camera is available
+ // and needs to be uploaded to the texture by means of calling
+ // android_camera_update_preview_texture. Please note that this callback can
+ // be invoked on any thread, and android_camera_update_preview_texture must only
+ // be called on the thread that setup the EGL/GL context.
+ on_preview_texture_needs_update on_preview_texture_needs_update_cb;
+
+ void* context;
+ };
+
+ // Initializes a connection to the camera, returns NULL on error.
+ struct CameraControl* android_camera_connect_to(CameraType camera_type, struct CameraControlListener* listener);
+
+ // Disconnects the camera and deletes the pointer
+ void android_camera_disconnect(struct CameraControl* control);
+
+ int android_camera_lock(struct CameraControl* control);
+ int android_camera_unlock(struct CameraControl* control);
+
+ // Deletes the CameraControl
+ void android_camera_delete(struct CameraControl* control);
+
+ // Passes the rotation r of the display in [°] relative to the camera to the camera HAL. r \in [0, 359].
+ void android_camera_set_display_orientation(struct CameraControl* control, int32_t clockwise_rotation_degree);
+
+ // Prepares the camera HAL to display preview images to the
+ // supplied surface/texture in a H/W-acclerated way. New frames
+ // are reported via the
+ // 'on_preview_texture_needs_update'-callback, and clients of this
+ // API should invoke android_camera_update_preview_texture
+ // subsequently. Please note that the texture is bound automatically by the underlying
+ // implementation.
+ void android_camera_set_preview_texture(struct CameraControl* control, int texture_id);
+
+ // Reads out the transformation matrix that needs to be applied when displaying the texture
+ void android_camera_get_preview_texture_transformation(struct CameraControl* control, float m[16]);
+
+ // Updates the texture to the last received frame and binds the texture
+ void android_camera_update_preview_texture(struct CameraControl* control);
+
+ // Prepares the camera HAL to display preview images to the supplied surface/texture in a H/W-acclerated way.
+ void android_camera_set_preview_surface(struct CameraControl* control, struct SfSurface* surface);
+
+ // Starts the camera preview
+ void android_camera_start_preview(struct CameraControl* control);
+
+ // Stops the camera preview
+ void android_camera_stop_preview(struct CameraControl* control);
+
+ // Starts an autofocus operation of the camera, results are reported via callback.
+ void android_camera_start_autofocus(struct CameraControl* control);
+
+ // Stops an ongoing autofocus operation.
+ void android_camera_stop_autofocus(struct CameraControl* control);
+
+ // Starts a zooming operation, zoom values are absolute, valid values [1, \infty].
+ void android_camera_start_zoom(struct CameraControl* control, int32_t zoom);
+
+ // Stops an ongoing zoom operation.
+ void android_camera_stop_zoom(struct CameraControl* control);
+
+ // Adjust the zoom level immediately as opposed to smoothly zoomin gin.
+ void android_camera_set_zoom(struct CameraControl* control, int32_t zoom);
+
+ // Takes a picture and reports back image data via
+ // callback. Please note that this stops the preview and thus, the
+ // preview needs to be restarted after the picture operation has
+ // completed. Ideally, this is done from the raw data callback.
+ void android_camera_take_snapshot(struct CameraControl* control);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // CAMERA_COMPATIBILITY_LAYER_H_
--- /dev/null
+/*
+ * Copyright (C) 2013 Canonical Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authored by: Thomas Voss <thomas.voss@canonical.com>
+ */
+
+#ifndef CAMERA_COMPATIBILITY_LAYER_CONFIGURATION_H_
+#define CAMERA_COMPATIBILITY_LAYER_CONFIGURATION_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ struct CameraControl;
+
+ typedef enum
+ {
+ FLASH_MODE_OFF,
+ FLASH_MODE_AUTO,
+ FLASH_MODE_ON,
+ FLASH_MODE_TORCH
+ } FlashMode;
+
+ typedef enum
+ {
+ WHITE_BALANCE_MODE_AUTO,
+ WHITE_BALANCE_MODE_DAYLIGHT,
+ WHITE_BALANCE_MODE_CLOUDY_DAYLIGHT,
+ WHITE_BALANCE_MODE_FLUORESCENT,
+ WHITE_BALANCE_MODE_INCANDESCENT
+ } WhiteBalanceMode;
+
+ typedef enum
+ {
+ SCENE_MODE_AUTO,
+ SCENE_MODE_ACTION,
+ SCENE_MODE_NIGHT,
+ SCENE_MODE_PARTY,
+ SCENE_MODE_SUNSET
+ } SceneMode;
+
+ typedef enum
+ {
+ AUTO_FOCUS_MODE_OFF,
+ AUTO_FOCUS_MODE_CONTINUOUS_VIDEO,
+ AUTO_FOCUS_MODE_AUTO,
+ AUTO_FOCUS_MODE_MACRO,
+ AUTO_FOCUS_MODE_CONTINUOUS_PICTURE,
+ AUTO_FOCUS_MODE_INFINITY
+ } AutoFocusMode;
+
+ typedef enum
+ {
+ EFFECT_MODE_NONE,
+ EFFECT_MODE_MONO,
+ EFFECT_MODE_NEGATIVE,
+ EFFECT_MODE_SOLARIZE,
+ EFFECT_MODE_SEPIA,
+ EFFECT_MODE_POSTERIZE,
+ EFFECT_MODE_WHITEBOARD,
+ EFFECT_MODE_BLACKBOARD,
+ EFFECT_MODE_AQUA
+ } EffectMode;
+
+ typedef enum
+ {
+ CAMERA_PIXEL_FORMAT_YUV422SP,
+ CAMERA_PIXEL_FORMAT_YUV420SP,
+ CAMERA_PIXEL_FORMAT_YUV422I,
+ CAMERA_PIXEL_FORMAT_YUV420P,
+ CAMERA_PIXEL_FORMAT_RGB565,
+ CAMERA_PIXEL_FORMAT_RGBA8888,
+ CAMERA_PIXEL_FORMAT_BAYER_RGGB
+ } CameraPixelFormat;
+
+ typedef struct
+ {
+ int top;
+ int left;
+ int bottom;
+ int right;
+ int weight;
+ } FocusRegion;
+
+ typedef void (*size_callback)(void* ctx, int width, int height);
+
+ // Dumps the camera parameters to stdout.
+ void android_camera_dump_parameters(struct CameraControl* control);
+
+ // Query camera parameters
+ int android_camera_get_number_of_devices();
+ void android_camera_enumerate_supported_preview_sizes(struct CameraControl* control, size_callback cb, void* ctx);
+ void android_camera_get_preview_fps_range(struct CameraControl* control, int* min, int* max);
+ void android_camera_get_preview_fps(struct CameraControl* control, int* fps);
+ void android_camera_enumerate_supported_picture_sizes(struct CameraControl* control, size_callback cb, void* ctx);
+ void android_camera_get_preview_size(struct CameraControl* control, int* width, int* height);
+ void android_camera_get_picture_size(struct CameraControl* control, int* width, int* height);
+
+ void android_camera_get_current_zoom(struct CameraControl* control, int* zoom);
+ void android_camera_get_max_zoom(struct CameraControl* control, int* max_zoom);
+
+ void android_camera_get_effect_mode(struct CameraControl* control, EffectMode* mode);
+ void android_camera_get_flash_mode(struct CameraControl* control, FlashMode* mode);
+ void android_camera_get_white_balance_mode(struct CameraControl* control, WhiteBalanceMode* mode);
+ void android_camera_get_scene_mode(struct CameraControl* control, SceneMode* mode);
+ void android_camera_get_auto_focus_mode(struct CameraControl* control, AutoFocusMode* mode);
+ void android_camera_get_preview_format(struct CameraControl* control, CameraPixelFormat* format);
+
+ // Adjusts camera parameters
+ void android_camera_set_preview_size(struct CameraControl* control, int width, int height);
+ void android_camera_set_preview_fps(struct CameraControl* control, int fps);
+ void android_camera_set_picture_size(struct CameraControl* control, int width, int height);
+ void android_camera_set_effect_mode(struct CameraControl* control, EffectMode mode);
+ void android_camera_set_flash_mode(struct CameraControl* control, FlashMode mode);
+ void android_camera_set_white_balance_mode(struct CameraControl* control, WhiteBalanceMode mode);
+ void android_camera_set_scene_mode(struct CameraControl* control, SceneMode mode);
+ void android_camera_set_auto_focus_mode(struct CameraControl* control, AutoFocusMode mode);
+ void android_camera_set_preview_format(struct CameraControl* control, CameraPixelFormat format);
+
+ void android_camera_set_focus_region(struct CameraControl* control, FocusRegion* region);
+ void android_camera_reset_focus_region(struct CameraControl* control);
+
+ // Set photo metadata
+ void android_camera_set_rotation(struct CameraControl* control, int rotation);
+
+ // Video support
+ void android_camera_enumerate_supported_video_sizes(struct CameraControl* control, size_callback cb, void* ctx);
+ void android_camera_get_video_size(struct CameraControl* control, int* width, int* height);
+ void android_camera_set_video_size(struct CameraControl* control, int width, int height);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // CAMERA_COMPATIBILITY_LAYER_CONFIGURATION_H_
--- /dev/null
+/*
+ * Copyright (C) 2013 Canonical Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authored by: Thomas Voss <thomas.voss@canonical.com>
+ */
+
+#ifndef CAMERA_COMPATIBILITY_LAYER_CONFIGURATION_TRANSLATOR_H_
+#define CAMERA_COMPATIBILITY_LAYER_CONFIGURATION_TRANSLATOR_H_
+
+#include <hybris/camera/camera_compatibility_layer_capabilities.h>
+
+#include <camera/CameraParameters.h>
+#include <utils/KeyedVector.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ static const char* effect_modes[] =
+ {
+ android::CameraParameters::EFFECT_NONE,
+ android::CameraParameters::EFFECT_MONO,
+ android::CameraParameters::EFFECT_NEGATIVE,
+ android::CameraParameters::EFFECT_SOLARIZE,
+ android::CameraParameters::EFFECT_SEPIA,
+ android::CameraParameters::EFFECT_POSTERIZE,
+ android::CameraParameters::EFFECT_WHITEBOARD,
+ android::CameraParameters::EFFECT_BLACKBOARD,
+ android::CameraParameters::EFFECT_AQUA
+ };
+
+ android::KeyedVector<android::String8, EffectMode> init_effect_modes_lut()
+ {
+ android::KeyedVector<android::String8, EffectMode> m;
+ m.add(android::String8(android::CameraParameters::EFFECT_NONE), EFFECT_MODE_NONE);
+ m.add(android::String8(android::CameraParameters::EFFECT_MONO), EFFECT_MODE_MONO);
+ m.add(android::String8(android::CameraParameters::EFFECT_NEGATIVE), EFFECT_MODE_NEGATIVE);
+ m.add(android::String8(android::CameraParameters::EFFECT_SOLARIZE), EFFECT_MODE_SOLARIZE);
+ m.add(android::String8(android::CameraParameters::EFFECT_SEPIA), EFFECT_MODE_SEPIA);
+ m.add(android::String8(android::CameraParameters::EFFECT_POSTERIZE), EFFECT_MODE_POSTERIZE);
+ m.add(android::String8(android::CameraParameters::EFFECT_WHITEBOARD), EFFECT_MODE_WHITEBOARD);
+ m.add(android::String8(android::CameraParameters::EFFECT_BLACKBOARD), EFFECT_MODE_BLACKBOARD);
+ m.add(android::String8(android::CameraParameters::EFFECT_AQUA), EFFECT_MODE_AQUA);
+
+ return m;
+ }
+
+ static android::KeyedVector<android::String8, EffectMode> effect_modes_lut = init_effect_modes_lut();
+
+ static const char* white_balance_modes[] =
+ {
+ android::CameraParameters::WHITE_BALANCE_AUTO,
+ android::CameraParameters::WHITE_BALANCE_DAYLIGHT,
+ android::CameraParameters::WHITE_BALANCE_CLOUDY_DAYLIGHT,
+ android::CameraParameters::WHITE_BALANCE_FLUORESCENT,
+ android::CameraParameters::WHITE_BALANCE_INCANDESCENT
+ };
+
+ android::KeyedVector<android::String8, WhiteBalanceMode> init_white_balance_modes_lut()
+ {
+ android::KeyedVector<android::String8, WhiteBalanceMode> m;
+ m.add(android::String8(android::CameraParameters::WHITE_BALANCE_AUTO), WHITE_BALANCE_MODE_AUTO);
+ m.add(android::String8(android::CameraParameters::WHITE_BALANCE_DAYLIGHT), WHITE_BALANCE_MODE_DAYLIGHT);
+ m.add(android::String8(android::CameraParameters::WHITE_BALANCE_CLOUDY_DAYLIGHT), WHITE_BALANCE_MODE_CLOUDY_DAYLIGHT);
+ m.add(android::String8(android::CameraParameters::WHITE_BALANCE_FLUORESCENT), WHITE_BALANCE_MODE_FLUORESCENT);
+ m.add(android::String8(android::CameraParameters::WHITE_BALANCE_INCANDESCENT), WHITE_BALANCE_MODE_INCANDESCENT);
+ return m;
+ }
+
+ static android::KeyedVector<android::String8, WhiteBalanceMode> white_balance_modes_lut = init_white_balance_modes_lut();
+
+ static const char* flash_modes[] =
+ {
+ android::CameraParameters::FLASH_MODE_OFF,
+ android::CameraParameters::FLASH_MODE_AUTO,
+ android::CameraParameters::FLASH_MODE_ON,
+ android::CameraParameters::FLASH_MODE_TORCH
+ };
+
+ static android::KeyedVector<android::String8, FlashMode> init_flash_modes_lut()
+ {
+ android::KeyedVector<android::String8, FlashMode> m;
+ m.add(android::String8(android::CameraParameters::FLASH_MODE_OFF), FLASH_MODE_OFF);
+ m.add(android::String8(android::CameraParameters::FLASH_MODE_AUTO), FLASH_MODE_AUTO);
+ m.add(android::String8(android::CameraParameters::FLASH_MODE_ON), FLASH_MODE_ON);
+ m.add(android::String8(android::CameraParameters::FLASH_MODE_TORCH), FLASH_MODE_TORCH);
+
+ return m;
+ }
+
+ static android::KeyedVector<android::String8, FlashMode> flash_modes_lut = init_flash_modes_lut();
+
+ static const char* scene_modes[] =
+ {
+ android::CameraParameters::SCENE_MODE_AUTO,
+ android::CameraParameters::SCENE_MODE_ACTION,
+ android::CameraParameters::SCENE_MODE_NIGHT,
+ android::CameraParameters::SCENE_MODE_PARTY,
+ android::CameraParameters::SCENE_MODE_SUNSET
+ };
+
+ static android::KeyedVector<android::String8, SceneMode> init_scene_modes_lut()
+ {
+ android::KeyedVector<android::String8, SceneMode> m;
+ m.add(android::String8(android::CameraParameters::SCENE_MODE_AUTO), SCENE_MODE_AUTO);
+ m.add(android::String8(android::CameraParameters::SCENE_MODE_ACTION), SCENE_MODE_ACTION);
+ m.add(android::String8(android::CameraParameters::SCENE_MODE_NIGHT), SCENE_MODE_NIGHT);
+ m.add(android::String8(android::CameraParameters::SCENE_MODE_PARTY), SCENE_MODE_PARTY);
+ m.add(android::String8(android::CameraParameters::SCENE_MODE_SUNSET), SCENE_MODE_SUNSET);
+
+ return m;
+ }
+
+ static android::KeyedVector<android::String8, SceneMode> scene_modes_lut = init_scene_modes_lut();
+
+ static const char* auto_focus_modes[] =
+ {
+ android::CameraParameters::FOCUS_MODE_FIXED,
+ android::CameraParameters::FOCUS_MODE_CONTINUOUS_VIDEO,
+ android::CameraParameters::FOCUS_MODE_AUTO,
+ android::CameraParameters::FOCUS_MODE_MACRO,
+ android::CameraParameters::FOCUS_MODE_CONTINUOUS_PICTURE,
+ android::CameraParameters::FOCUS_MODE_INFINITY
+ };
+
+ static android::KeyedVector<android::String8, AutoFocusMode> init_auto_focus_modes_lut()
+ {
+ android::KeyedVector<android::String8, AutoFocusMode> m;
+ m.add(android::String8(android::CameraParameters::FOCUS_MODE_FIXED), AUTO_FOCUS_MODE_OFF);
+ m.add(android::String8(android::CameraParameters::FOCUS_MODE_CONTINUOUS_VIDEO), AUTO_FOCUS_MODE_CONTINUOUS_VIDEO);
+ m.add(android::String8(android::CameraParameters::FOCUS_MODE_AUTO), AUTO_FOCUS_MODE_AUTO);
+ m.add(android::String8(android::CameraParameters::FOCUS_MODE_MACRO), AUTO_FOCUS_MODE_MACRO);
+ m.add(android::String8(android::CameraParameters::FOCUS_MODE_CONTINUOUS_PICTURE), AUTO_FOCUS_MODE_CONTINUOUS_PICTURE);
+ m.add(android::String8(android::CameraParameters::FOCUS_MODE_INFINITY), AUTO_FOCUS_MODE_INFINITY);
+
+ return m;
+ }
+
+ static android::KeyedVector<android::String8, AutoFocusMode> auto_focus_modes_lut = init_auto_focus_modes_lut();
+
+ static const char* camera_pixel_formats[] =
+ {
+ android::CameraParameters::PIXEL_FORMAT_YUV422SP,
+ android::CameraParameters::PIXEL_FORMAT_YUV420SP,
+ android::CameraParameters::PIXEL_FORMAT_YUV422I,
+ android::CameraParameters::PIXEL_FORMAT_YUV420P,
+ android::CameraParameters::PIXEL_FORMAT_RGB565,
+ android::CameraParameters::PIXEL_FORMAT_RGBA8888,
+ android::CameraParameters::PIXEL_FORMAT_BAYER_RGGB
+ };
+
+ static android::KeyedVector<android::String8, CameraPixelFormat> init_pixel_formats_lut()
+ {
+ android::KeyedVector<android::String8, CameraPixelFormat> m;
+ m.add(android::String8(android::CameraParameters::PIXEL_FORMAT_YUV422SP), CAMERA_PIXEL_FORMAT_YUV422SP);
+ m.add(android::String8(android::CameraParameters::PIXEL_FORMAT_YUV420SP), CAMERA_PIXEL_FORMAT_YUV420SP);
+ m.add(android::String8(android::CameraParameters::PIXEL_FORMAT_YUV422I), CAMERA_PIXEL_FORMAT_YUV422I);
+ m.add(android::String8(android::CameraParameters::PIXEL_FORMAT_YUV420P), CAMERA_PIXEL_FORMAT_YUV420P);
+ m.add(android::String8(android::CameraParameters::PIXEL_FORMAT_RGB565), CAMERA_PIXEL_FORMAT_RGB565);
+ m.add(android::String8(android::CameraParameters::PIXEL_FORMAT_RGBA8888), CAMERA_PIXEL_FORMAT_RGBA8888);
+ m.add(android::String8(android::CameraParameters::PIXEL_FORMAT_BAYER_RGGB), CAMERA_PIXEL_FORMAT_BAYER_RGGB);
+ return m;
+ }
+
+ static android::KeyedVector<android::String8, CameraPixelFormat> pixel_formats_lut = init_pixel_formats_lut();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null
+/*
+ * Copyright (c) 2013 Intel Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef _HYBRIS_DLFCN_H_
+#define _HYBRIS_DLFCN_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void *hybris_dlopen(const char *filename, int flag);
+void *hybris_dlsym(void *handle, const char *symbol);
+int hybris_dlclose(void *handle);
+char *hybris_dlerror(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _HYBRIS_DLFCN_H_
+
+// vim: noai:ts=4:sw=4:ss=4:expandtab
--- /dev/null
+/*
+ * Copyright (C) 2013 Canonical Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authored by: Thomas Voss <thomas.voss@canonical.com>
+ */
+
+#ifndef INPUT_STACK_COMPATIBILITY_LAYER_H_
+#define INPUT_STACK_COMPATIBILITY_LAYER_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#define MAX_POINTER_COUNT 16
+
+ typedef int64_t nsecs_t;
+
+ typedef enum
+ {
+ KEY_EVENT_TYPE,
+ MOTION_EVENT_TYPE,
+ HW_SWITCH_EVENT_TYPE
+ } EventType;
+
+ struct Event
+ {
+ // Generic event properties
+ EventType type;
+ int32_t device_id;
+ int32_t source_id;
+ int32_t action;
+ int32_t flags;
+ int32_t meta_state;
+ // Information specific to key/motion event types
+ union
+ {
+ struct HardwareSwitchEvent
+ {
+ nsecs_t event_time;
+ uint32_t policy_flags;
+ int32_t switch_values;
+ int32_t switch_mask;
+ } hw_switch;
+ struct KeyEvent
+ {
+ int32_t key_code;
+ int32_t scan_code;
+ int32_t repeat_count;
+ nsecs_t down_time;
+ nsecs_t event_time;
+ bool is_system_key;
+ } key;
+ struct MotionEvent
+ {
+ int32_t edge_flags;
+ int32_t button_state;
+ float x_offset;
+ float y_offset;
+ float x_precision;
+ float y_precision;
+ nsecs_t down_time;
+ nsecs_t event_time;
+
+ size_t pointer_count;
+ struct PointerCoordinates
+ {
+ int id;
+ float x, raw_x;
+ float y, raw_y;
+ float touch_major;
+ float touch_minor;
+ float size;
+ float pressure;
+ float orientation;
+ } pointer;
+ struct PointerCoordinates pointer_coordinates[MAX_POINTER_COUNT];
+ } motion;
+ } details;
+ };
+
+ typedef void (*on_new_event_callback)(struct Event* event, void* context);
+
+ struct AndroidEventListener
+ {
+ on_new_event_callback on_new_event;
+ void* context;
+ };
+
+ struct InputStackConfiguration
+ {
+ bool enable_touch_point_visualization;
+ int default_layer_for_touch_point_visualization;
+ int input_area_width;
+ int input_area_height;
+ };
+
+ void android_input_stack_initialize(
+ struct AndroidEventListener* listener,
+ struct InputStackConfiguration* input_stack_configuration);
+
+ void android_input_stack_loop_once();
+ void android_input_stack_start();
+ void android_input_stack_start_waiting_for_flag(bool* flag);
+ void android_input_stack_stop();
+ void android_input_stack_shutdown();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INPUT_STACK_COMPATIBILITY_LAYER_H_
--- /dev/null
+/*
+ * Copyright (C) 2013 Canonical Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authored by: Thomas Voss <thomas.voss@canonical.com>
+ */
+
+#ifndef INPUT_STACK_COMPATIBILITY_LAYER_CODES_KEY_H_
+#define INPUT_STACK_COMPATIBILITY_LAYER_CODES_KEY_H_
+
+/******************************************************************
+ *
+ * IMPORTANT NOTICE:
+ *
+ * This file is part of Android's set of stable system headers
+ * exposed by the Android NDK (Native Development Kit).
+ *
+ * Third-party source AND binary code relies on the definitions
+ * here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES.
+ *
+ * - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES)
+ * - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS
+ * - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY
+ * - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES
+ */
+
+#include <sys/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /*
+ * Key codes.
+ */
+ enum {
+ ISCL_KEYCODE_UNKNOWN = 0,
+ ISCL_KEYCODE_SOFT_LEFT = 1,
+ ISCL_KEYCODE_SOFT_RIGHT = 2,
+ ISCL_KEYCODE_HOME = 3,
+ ISCL_KEYCODE_BACK = 4,
+ ISCL_KEYCODE_CALL = 5,
+ ISCL_KEYCODE_ENDCALL = 6,
+ ISCL_KEYCODE_0 = 7,
+ ISCL_KEYCODE_1 = 8,
+ ISCL_KEYCODE_2 = 9,
+ ISCL_KEYCODE_3 = 10,
+ ISCL_KEYCODE_4 = 11,
+ ISCL_KEYCODE_5 = 12,
+ ISCL_KEYCODE_6 = 13,
+ ISCL_KEYCODE_7 = 14,
+ ISCL_KEYCODE_8 = 15,
+ ISCL_KEYCODE_9 = 16,
+ ISCL_KEYCODE_STAR = 17,
+ ISCL_KEYCODE_POUND = 18,
+ ISCL_KEYCODE_DPAD_UP = 19,
+ ISCL_KEYCODE_DPAD_DOWN = 20,
+ ISCL_KEYCODE_DPAD_LEFT = 21,
+ ISCL_KEYCODE_DPAD_RIGHT = 22,
+ ISCL_KEYCODE_DPAD_CENTER = 23,
+ ISCL_KEYCODE_VOLUME_UP = 24,
+ ISCL_KEYCODE_VOLUME_DOWN = 25,
+ ISCL_KEYCODE_POWER = 26,
+ ISCL_KEYCODE_CAMERA = 27,
+ ISCL_KEYCODE_CLEAR = 28,
+ ISCL_KEYCODE_A = 29,
+ ISCL_KEYCODE_B = 30,
+ ISCL_KEYCODE_C = 31,
+ ISCL_KEYCODE_D = 32,
+ ISCL_KEYCODE_E = 33,
+ ISCL_KEYCODE_F = 34,
+ ISCL_KEYCODE_G = 35,
+ ISCL_KEYCODE_H = 36,
+ ISCL_KEYCODE_I = 37,
+ ISCL_KEYCODE_J = 38,
+ ISCL_KEYCODE_K = 39,
+ ISCL_KEYCODE_L = 40,
+ ISCL_KEYCODE_M = 41,
+ ISCL_KEYCODE_N = 42,
+ ISCL_KEYCODE_O = 43,
+ ISCL_KEYCODE_P = 44,
+ ISCL_KEYCODE_Q = 45,
+ ISCL_KEYCODE_R = 46,
+ ISCL_KEYCODE_S = 47,
+ ISCL_KEYCODE_T = 48,
+ ISCL_KEYCODE_U = 49,
+ ISCL_KEYCODE_V = 50,
+ ISCL_KEYCODE_W = 51,
+ ISCL_KEYCODE_X = 52,
+ ISCL_KEYCODE_Y = 53,
+ ISCL_KEYCODE_Z = 54,
+ ISCL_KEYCODE_COMMA = 55,
+ ISCL_KEYCODE_PERIOD = 56,
+ ISCL_KEYCODE_ALT_LEFT = 57,
+ ISCL_KEYCODE_ALT_RIGHT = 58,
+ ISCL_KEYCODE_SHIFT_LEFT = 59,
+ ISCL_KEYCODE_SHIFT_RIGHT = 60,
+ ISCL_KEYCODE_TAB = 61,
+ ISCL_KEYCODE_SPACE = 62,
+ ISCL_KEYCODE_SYM = 63,
+ ISCL_KEYCODE_EXPLORER = 64,
+ ISCL_KEYCODE_ENVELOPE = 65,
+ ISCL_KEYCODE_ENTER = 66,
+ ISCL_KEYCODE_DEL = 67,
+ ISCL_KEYCODE_GRAVE = 68,
+ ISCL_KEYCODE_MINUS = 69,
+ ISCL_KEYCODE_EQUALS = 70,
+ ISCL_KEYCODE_LEFT_BRACKET = 71,
+ ISCL_KEYCODE_RIGHT_BRACKET = 72,
+ ISCL_KEYCODE_BACKSLASH = 73,
+ ISCL_KEYCODE_SEMICOLON = 74,
+ ISCL_KEYCODE_APOSTROPHE = 75,
+ ISCL_KEYCODE_SLASH = 76,
+ ISCL_KEYCODE_AT = 77,
+ ISCL_KEYCODE_NUM = 78,
+ ISCL_KEYCODE_HEADSETHOOK = 79,
+ ISCL_KEYCODE_FOCUS = 80, // *Camera* focus
+ ISCL_KEYCODE_PLUS = 81,
+ ISCL_KEYCODE_MENU = 82,
+ ISCL_KEYCODE_NOTIFICATION = 83,
+ ISCL_KEYCODE_SEARCH = 84,
+ ISCL_KEYCODE_MEDIA_PLAY_PAUSE= 85,
+ ISCL_KEYCODE_MEDIA_STOP = 86,
+ ISCL_KEYCODE_MEDIA_NEXT = 87,
+ ISCL_KEYCODE_MEDIA_PREVIOUS = 88,
+ ISCL_KEYCODE_MEDIA_REWIND = 89,
+ ISCL_KEYCODE_MEDIA_FAST_FORWARD = 90,
+ ISCL_KEYCODE_MUTE = 91,
+ ISCL_KEYCODE_PAGE_UP = 92,
+ ISCL_KEYCODE_PAGE_DOWN = 93,
+ ISCL_KEYCODE_PICTSYMBOLS = 94,
+ ISCL_KEYCODE_SWITCH_CHARSET = 95,
+ ISCL_KEYCODE_BUTTON_A = 96,
+ ISCL_KEYCODE_BUTTON_B = 97,
+ ISCL_KEYCODE_BUTTON_C = 98,
+ ISCL_KEYCODE_BUTTON_X = 99,
+ ISCL_KEYCODE_BUTTON_Y = 100,
+ ISCL_KEYCODE_BUTTON_Z = 101,
+ ISCL_KEYCODE_BUTTON_L1 = 102,
+ ISCL_KEYCODE_BUTTON_R1 = 103,
+ ISCL_KEYCODE_BUTTON_L2 = 104,
+ ISCL_KEYCODE_BUTTON_R2 = 105,
+ ISCL_KEYCODE_BUTTON_THUMBL = 106,
+ ISCL_KEYCODE_BUTTON_THUMBR = 107,
+ ISCL_KEYCODE_BUTTON_START = 108,
+ ISCL_KEYCODE_BUTTON_SELECT = 109,
+ ISCL_KEYCODE_BUTTON_MODE = 110,
+ ISCL_KEYCODE_ESCAPE = 111,
+ ISCL_KEYCODE_FORWARD_DEL = 112,
+ ISCL_KEYCODE_CTRL_LEFT = 113,
+ ISCL_KEYCODE_CTRL_RIGHT = 114,
+ ISCL_KEYCODE_CAPS_LOCK = 115,
+ ISCL_KEYCODE_SCROLL_LOCK = 116,
+ ISCL_KEYCODE_META_LEFT = 117,
+ ISCL_KEYCODE_META_RIGHT = 118,
+ ISCL_KEYCODE_FUNCTION = 119,
+ ISCL_KEYCODE_SYSRQ = 120,
+ ISCL_KEYCODE_BREAK = 121,
+ ISCL_KEYCODE_MOVE_HOME = 122,
+ ISCL_KEYCODE_MOVE_END = 123,
+ ISCL_KEYCODE_INSERT = 124,
+ ISCL_KEYCODE_FORWARD = 125,
+ ISCL_KEYCODE_MEDIA_PLAY = 126,
+ ISCL_KEYCODE_MEDIA_PAUSE = 127,
+ ISCL_KEYCODE_MEDIA_CLOSE = 128,
+ ISCL_KEYCODE_MEDIA_EJECT = 129,
+ ISCL_KEYCODE_MEDIA_RECORD = 130,
+ ISCL_KEYCODE_F1 = 131,
+ ISCL_KEYCODE_F2 = 132,
+ ISCL_KEYCODE_F3 = 133,
+ ISCL_KEYCODE_F4 = 134,
+ ISCL_KEYCODE_F5 = 135,
+ ISCL_KEYCODE_F6 = 136,
+ ISCL_KEYCODE_F7 = 137,
+ ISCL_KEYCODE_F8 = 138,
+ ISCL_KEYCODE_F9 = 139,
+ ISCL_KEYCODE_F10 = 140,
+ ISCL_KEYCODE_F11 = 141,
+ ISCL_KEYCODE_F12 = 142,
+ ISCL_KEYCODE_NUM_LOCK = 143,
+ ISCL_KEYCODE_NUMPAD_0 = 144,
+ ISCL_KEYCODE_NUMPAD_1 = 145,
+ ISCL_KEYCODE_NUMPAD_2 = 146,
+ ISCL_KEYCODE_NUMPAD_3 = 147,
+ ISCL_KEYCODE_NUMPAD_4 = 148,
+ ISCL_KEYCODE_NUMPAD_5 = 149,
+ ISCL_KEYCODE_NUMPAD_6 = 150,
+ ISCL_KEYCODE_NUMPAD_7 = 151,
+ ISCL_KEYCODE_NUMPAD_8 = 152,
+ ISCL_KEYCODE_NUMPAD_9 = 153,
+ ISCL_KEYCODE_NUMPAD_DIVIDE = 154,
+ ISCL_KEYCODE_NUMPAD_MULTIPLY = 155,
+ ISCL_KEYCODE_NUMPAD_SUBTRACT = 156,
+ ISCL_KEYCODE_NUMPAD_ADD = 157,
+ ISCL_KEYCODE_NUMPAD_DOT = 158,
+ ISCL_KEYCODE_NUMPAD_COMMA = 159,
+ ISCL_KEYCODE_NUMPAD_ENTER = 160,
+ ISCL_KEYCODE_NUMPAD_EQUALS = 161,
+ ISCL_KEYCODE_NUMPAD_LEFT_PAREN = 162,
+ ISCL_KEYCODE_NUMPAD_RIGHT_PAREN = 163,
+ ISCL_KEYCODE_VOLUME_MUTE = 164,
+ ISCL_KEYCODE_INFO = 165,
+ ISCL_KEYCODE_CHANNEL_UP = 166,
+ ISCL_KEYCODE_CHANNEL_DOWN = 167,
+ ISCL_KEYCODE_ZOOM_IN = 168,
+ ISCL_KEYCODE_ZOOM_OUT = 169,
+ ISCL_KEYCODE_TV = 170,
+ ISCL_KEYCODE_WINDOW = 171,
+ ISCL_KEYCODE_GUIDE = 172,
+ ISCL_KEYCODE_DVR = 173,
+ ISCL_KEYCODE_BOOKMARK = 174,
+ ISCL_KEYCODE_CAPTIONS = 175,
+ ISCL_KEYCODE_SETTINGS = 176,
+ ISCL_KEYCODE_TV_POWER = 177,
+ ISCL_KEYCODE_TV_INPUT = 178,
+ ISCL_KEYCODE_STB_POWER = 179,
+ ISCL_KEYCODE_STB_INPUT = 180,
+ ISCL_KEYCODE_AVR_POWER = 181,
+ ISCL_KEYCODE_AVR_INPUT = 182,
+ ISCL_KEYCODE_PROG_RED = 183,
+ ISCL_KEYCODE_PROG_GREEN = 184,
+ ISCL_KEYCODE_PROG_YELLOW = 185,
+ ISCL_KEYCODE_PROG_BLUE = 186,
+ ISCL_KEYCODE_APP_SWITCH = 187,
+ ISCL_KEYCODE_BUTTON_1 = 188,
+ ISCL_KEYCODE_BUTTON_2 = 189,
+ ISCL_KEYCODE_BUTTON_3 = 190,
+ ISCL_KEYCODE_BUTTON_4 = 191,
+ ISCL_KEYCODE_BUTTON_5 = 192,
+ ISCL_KEYCODE_BUTTON_6 = 193,
+ ISCL_KEYCODE_BUTTON_7 = 194,
+ ISCL_KEYCODE_BUTTON_8 = 195,
+ ISCL_KEYCODE_BUTTON_9 = 196,
+ ISCL_KEYCODE_BUTTON_10 = 197,
+ ISCL_KEYCODE_BUTTON_11 = 198,
+ ISCL_KEYCODE_BUTTON_12 = 199,
+ ISCL_KEYCODE_BUTTON_13 = 200,
+ ISCL_KEYCODE_BUTTON_14 = 201,
+ ISCL_KEYCODE_BUTTON_15 = 202,
+ ISCL_KEYCODE_BUTTON_16 = 203,
+ ISCL_KEYCODE_LANGUAGE_SWITCH = 204,
+ ISCL_KEYCODE_MANNER_MODE = 205,
+ ISCL_KEYCODE_3D_MODE = 206,
+ ISCL_KEYCODE_CONTACTS = 207,
+ ISCL_KEYCODE_CALENDAR = 208,
+ ISCL_KEYCODE_MUSIC = 209,
+ ISCL_KEYCODE_CALCULATOR = 210,
+
+ };
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INPUT_STACK_COMPATIBILITY_LAYER_CODES_KEY_H_
--- /dev/null
+/*
+ * Copyright (C) 2013 Canonical Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authored by: Thomas Voss <thomas.voss@canonical.com>
+ */
+
+#ifndef INPUT_STACK_COMPATIBILITY_LAYER_FLAGS_H_
+#define INPUT_STACK_COMPATIBILITY_LAYER_FLAGS_H_
+
+#include <hybris/input/input_stack_compatibility_layer_flags_key.h>
+#include <hybris/input/input_stack_compatibility_layer_flags_motion.h>
+
+/*
+ * Constants that identify tool types.
+ * Refer to the documentation on the MotionEvent class for descriptions of each tool type.
+ */
+enum
+{
+ ISCL_MOTION_EVENT_TOOL_TYPE_UNKNOWN = 0,
+ ISCL_MOTION_EVENT_TOOL_TYPE_FINGER = 1,
+ ISCL_MOTION_EVENT_TOOL_TYPE_STYLUS = 2,
+ ISCL_MOTION_EVENT_TOOL_TYPE_MOUSE = 3,
+ ISCL_MOTION_EVENT_TOOL_TYPE_ERASER = 4,
+};
+
+/*
+ * Input sources.
+ *
+ * Refer to the documentation on android.view.InputDevice for more details about input sources
+ * and their correct interpretation.
+ */
+enum
+{
+ ISCL_INPUT_SOURCE_CLASS_MASK = 0x000000ff,
+
+ ISCL_INPUT_SOURCE_CLASS_BUTTON = 0x00000001,
+ ISCL_INPUT_SOURCE_CLASS_POINTER = 0x00000002,
+ ISCL_INPUT_SOURCE_CLASS_NAVIGATION = 0x00000004,
+ ISCL_INPUT_SOURCE_CLASS_POSITION = 0x00000008,
+ ISCL_INPUT_SOURCE_CLASS_JOYSTICK = 0x00000010,
+};
+
+enum
+{
+ ISCL_INPUT_SOURCE_UNKNOWN = 0x00000000,
+
+ ISCL_INPUT_SOURCE_KEYBOARD = 0x00000100 | ISCL_INPUT_SOURCE_CLASS_BUTTON,
+ ISCL_INPUT_SOURCE_DPAD = 0x00000200 | ISCL_INPUT_SOURCE_CLASS_BUTTON,
+ ISCL_INPUT_SOURCE_GAMEPAD = 0x00000400 | ISCL_INPUT_SOURCE_CLASS_BUTTON,
+ ISCL_INPUT_SOURCE_TOUCHSCREEN = 0x00001000 | ISCL_INPUT_SOURCE_CLASS_POINTER,
+ ISCL_INPUT_SOURCE_MOUSE = 0x00002000 | ISCL_INPUT_SOURCE_CLASS_POINTER,
+ ISCL_INPUT_SOURCE_STYLUS = 0x00004000 | ISCL_INPUT_SOURCE_CLASS_POINTER,
+ ISCL_INPUT_SOURCE_TRACKBALL = 0x00010000 | ISCL_INPUT_SOURCE_CLASS_NAVIGATION,
+ ISCL_INPUT_SOURCE_TOUCHPAD = 0x00100000 | ISCL_INPUT_SOURCE_CLASS_POSITION,
+ ISCL_INPUT_SOURCE_JOYSTICK = 0x01000000 | ISCL_INPUT_SOURCE_CLASS_JOYSTICK,
+
+ ISCL_INPUT_SOURCE_ANY = 0xffffff00,
+};
+
+#endif // INPUT_STACK_COMPATIBILITY_LAYER_FLAGS_H_
--- /dev/null
+/*
+ * Copyright (C) 2013 Canonical Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authored by: Thomas Voss <thomas.voss@canonical.com>
+ */
+
+#ifndef INPUT_STACK_COMPATIBILITY_LAYER_FLAGS_KEY_H_
+#define INPUT_STACK_COMPATIBILITY_LAYER_FLAGS_KEY_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /*
+ * Key states (may be returned by queries about the current state of a
+ * particular key code, scan code or switch).
+ */
+ enum {
+ /* The key state is unknown or the requested key itself is not supported. */
+ ICSL_KEY_STATE_UNKNOWN = -1,
+
+ /* The key is up. */
+ ICSL_KEY_STATE_UP = 0,
+
+ /* The key is down. */
+ ICSL_KEY_STATE_DOWN = 1,
+
+ /* The key is down but is a virtual key press that is being emulated by the system. */
+ ICSL_KEY_STATE_VIRTUAL = 2
+ };
+
+ /*
+ * Meta key / modifer state.
+ */
+ enum
+ {
+ /* No meta keys are pressed. */
+ ISCL_META_NONE = 0,
+
+ /* This mask is used to check whether one of the ALT meta keys is pressed. */
+ ISCL_META_ALT_ON = 0x02,
+
+ /* This mask is used to check whether the left ALT meta key is pressed. */
+ ISCL_META_ALT_LEFT_ON = 0x10,
+
+ /* This mask is used to check whether the right ALT meta key is pressed. */
+ ISCL_META_ALT_RIGHT_ON = 0x20,
+
+ /* This mask is used to check whether one of the SHIFT meta keys is pressed. */
+ ISCL_META_SHIFT_ON = 0x01,
+
+ /* This mask is used to check whether the left SHIFT meta key is pressed. */
+ ISCL_META_SHIFT_LEFT_ON = 0x40,
+
+ /* This mask is used to check whether the right SHIFT meta key is pressed. */
+ ISCL_META_SHIFT_RIGHT_ON = 0x80,
+
+ /* This mask is used to check whether the SYM meta key is pressed. */
+ ISCL_META_SYM_ON = 0x04,
+
+ /* This mask is used to check whether the FUNCTION meta key is pressed. */
+ ISCL_META_FUNCTION_ON = 0x08,
+
+ /* This mask is used to check whether one of the CTRL meta keys is pressed. */
+ ISCL_META_CTRL_ON = 0x1000,
+
+ /* This mask is used to check whether the left CTRL meta key is pressed. */
+ ISCL_META_CTRL_LEFT_ON = 0x2000,
+
+ /* This mask is used to check whether the right CTRL meta key is pressed. */
+ ISCL_META_CTRL_RIGHT_ON = 0x4000,
+
+ /* This mask is used to check whether one of the META meta keys is pressed. */
+ ISCL_META_META_ON = 0x10000,
+
+ /* This mask is used to check whether the left META meta key is pressed. */
+ ISCL_META_META_LEFT_ON = 0x20000,
+
+ /* This mask is used to check whether the right META meta key is pressed. */
+ ISCL_META_META_RIGHT_ON = 0x40000,
+
+ /* This mask is used to check whether the CAPS LOCK meta key is on. */
+ ISCL_META_CAPS_LOCK_ON = 0x100000,
+
+ /* This mask is used to check whether the NUM LOCK meta key is on. */
+ ISCL_META_NUM_LOCK_ON = 0x200000,
+
+ /* This mask is used to check whether the SCROLL LOCK meta key is on. */
+ ISCL_META_SCROLL_LOCK_ON = 0x400000,
+ };
+
+ /*
+ * Key event actions.
+ */
+ enum
+ {
+ /* The key has been pressed down. */
+ ISCL_KEY_EVENT_ACTION_DOWN = 0,
+
+ /* The key has been released. */
+ ISCL_KEY_EVENT_ACTION_UP = 1,
+
+ /* Multiple duplicate key events have occurred in a row, or a complex string is
+ * being delivered. The repeat_count property of the key event contains the number
+ * of times the given key code should be executed.
+ */
+ ISCL_KEY_EVENT_ACTION_MULTIPLE = 2
+ };
+
+ /*
+ * Key event flags.
+ */
+ enum
+ {
+ /* This mask is set if the device woke because of this key event. */
+ ISCL_KEY_EVENT_FLAG_WOKE_HERE = 0x1,
+
+ /* This mask is set if the key event was generated by a software keyboard. */
+ ISCL_KEY_EVENT_FLAG_SOFT_KEYBOARD = 0x2,
+
+ /* This mask is set if we don't want the key event to cause us to leave touch mode. */
+ ISCL_KEY_EVENT_FLAG_KEEP_TOUCH_MODE = 0x4,
+
+ /* This mask is set if an event was known to come from a trusted part
+ * of the system. That is, the event is known to come from the user,
+ * and could not have been spoofed by a third party component. */
+ ISCL_KEY_EVENT_FLAG_FROM_SYSTEM = 0x8,
+
+ /* This mask is used for compatibility, to identify enter keys that are
+ * coming from an IME whose enter key has been auto-labelled "next" or
+ * "done". This allows TextView to dispatch these as normal enter keys
+ * for old applications, but still do the appropriate action when
+ * receiving them. */
+ ISCL_KEY_EVENT_FLAG_EDITOR_ACTION = 0x10,
+
+ /* When associated with up key events, this indicates that the key press
+ * has been canceled. Typically this is used with virtual touch screen
+ * keys, where the user can slide from the virtual key area on to the
+ * display: in that case, the application will receive a canceled up
+ * event and should not perform the action normally associated with the
+ * key. Note that for this to work, the application can not perform an
+ * action for a key until it receives an up or the long press timeout has
+ * expired. */
+ ISCL_KEY_EVENT_FLAG_CANCELED = 0x20,
+
+ /* This key event was generated by a virtual (on-screen) hard key area.
+ * Typically this is an area of the touchscreen, outside of the regular
+ * display, dedicated to "hardware" buttons. */
+ ISCL_KEY_EVENT_FLAG_VIRTUAL_HARD_KEY = 0x40,
+
+ /* This flag is set for the first key repeat that occurs after the
+ * long press timeout. */
+ ISCL_KEY_EVENT_FLAG_LONG_PRESS = 0x80,
+
+ /* Set when a key event has ISCL_KEY_EVENT_FLAG_CANCELED set because a long
+ * press action was executed while it was down. */
+ ISCL_KEY_EVENT_FLAG_CANCELED_LONG_PRESS = 0x100,
+
+ /* Set for ISCL_KEY_EVENT_ACTION_UP when this event's key code is still being
+ * tracked from its initial down. That is, somebody requested that tracking
+ * started on the key down and a long press has not caused
+ * the tracking to be canceled. */
+ ISCL_KEY_EVENT_FLAG_TRACKING = 0x200,
+
+ /* Set when a key event has been synthesized to implement default behavior
+ * for an event that the application did not handle.
+ * Fallback key events are generated by unhandled trackball motions
+ * (to emulate a directional keypad) and by certain unhandled key presses
+ * that are declared in the key map (such as special function numeric keypad
+ * keys when numlock is off). */
+ ISCL_KEY_EVENT_FLAG_FALLBACK = 0x400,
+ };
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INPUT_STACK_COMPATIBILITY_LAYER_FLAGS_KEY_H_
--- /dev/null
+/*
+ * Copyright (C) 2013 Canonical Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authored by: Thomas Voss <thomas.voss@canonical.com>
+ */
+
+#ifndef INPUT_STACK_COMPATIBILITY_LAYER_FLAGS_MOTION_H_
+#define INPUT_STACK_COMPATIBILITY_LAYER_FLAGS_MOTION_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /*
+ * Motion event actions.
+ */
+
+ /* Bit shift for the action bits holding the pointer index as
+ * defined by ISCL_MOTION_EVENT_ACTION_POINTER_INDEX_MASK.
+ */
+#define ISCL_MOTION_EVENT_ACTION_POINTER_INDEX_SHIFT 8
+
+ enum {
+ /* Bit mask of the parts of the action code that are the action itself.
+ */
+ ISCL_MOTION_EVENT_ACTION_MASK = 0xff,
+
+ /* Bits in the action code that represent a pointer index, used with
+ * ISCL_MOTION_EVENT_ACTION_POINTER_DOWN and ISCL_MOTION_EVENT_ACTION_POINTER_UP. Shifting
+ * down by ISCL_MOTION_EVENT_ACTION_POINTER_INDEX_SHIFT provides the actual pointer
+ * index where the data for the pointer going up or down can be found.
+ */
+ ISCL_MOTION_EVENT_ACTION_POINTER_INDEX_MASK = 0xff00,
+
+ /* A pressed gesture has started, the motion contains the initial starting location.
+ */
+ ISCL_MOTION_EVENT_ACTION_DOWN = 0,
+
+ /* A pressed gesture has finished, the motion contains the final release location
+ * as well as any intermediate points since the last down or move event.
+ */
+ ISCL_MOTION_EVENT_ACTION_UP = 1,
+
+ /* A change has happened during a press gesture (between ISCL_MOTION_EVENT_ACTION_DOWN and
+ * ISCL_MOTION_EVENT_ACTION_UP). The motion contains the most recent point, as well as
+ * any intermediate points since the last down or move event.
+ */
+ ISCL_MOTION_EVENT_ACTION_MOVE = 2,
+
+ /* The current gesture has been aborted.
+ * You will not receive any more points in it. You should treat this as
+ * an up event, but not perform any action that you normally would.
+ */
+ ISCL_MOTION_EVENT_ACTION_CANCEL = 3,
+
+ /* A movement has happened outside of the normal bounds of the UI element.
+ * This does not provide a full gesture, but only the initial location of the movement/touch.
+ */
+ ISCL_MOTION_EVENT_ACTION_OUTSIDE = 4,
+
+ /* A non-primary pointer has gone down.
+ * The bits in ISCL_MOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed.
+ */
+ ISCL_MOTION_EVENT_ACTION_POINTER_DOWN = 5,
+
+ /* A non-primary pointer has gone up.
+ * The bits in ISCL_MOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed.
+ */
+ ISCL_MOTION_EVENT_ACTION_POINTER_UP = 6,
+
+ /* A change happened but the pointer is not down (unlike ISCL_MOTION_EVENT_ACTION_MOVE).
+ * The motion contains the most recent point, as well as any intermediate points since
+ * the last hover move event.
+ */
+ ISCL_MOTION_EVENT_ACTION_HOVER_MOVE = 7,
+
+ /* The motion event contains relative vertical and/or horizontal scroll offsets.
+ * Use getAxisValue to retrieve the information from ISCL_MOTION_EVENT_AXIS_VSCROLL
+ * and ISCL_MOTION_EVENT_AXIS_HSCROLL.
+ * The pointer may or may not be down when this event is dispatched.
+ * This action is always delivered to the winder under the pointer, which
+ * may not be the window currently touched.
+ */
+ ISCL_MOTION_EVENT_ACTION_SCROLL = 8,
+
+ /* The pointer is not down but has entered the boundaries of a window or view.
+ */
+ ISCL_MOTION_EVENT_ACTION_HOVER_ENTER = 9,
+
+ /* The pointer is not down but has exited the boundaries of a window or view.
+ */
+ ISCL_MOTION_EVENT_ACTION_HOVER_EXIT = 10,
+ };
+
+ /*
+ * Motion event flags.
+ */
+ enum
+ {
+ /* This flag indicates that the window that received this motion event is partly
+ * or wholly obscured by another visible window above it. This flag is set to true
+ * even if the event did not directly pass through the obscured area.
+ * A security sensitive application can check this flag to identify situations in which
+ * a malicious application may have covered up part of its content for the purpose
+ * of misleading the user or hijacking touches. An appropriate response might be
+ * to drop the suspect touches or to take additional precautions to confirm the user's
+ * actual intent.
+ */
+ ISCL_MOTION_EVENT_FLAG_WINDOW_IS_OBSCURED = 0x1,
+ };
+
+ /*
+ * Motion event edge touch flags.
+ */
+ enum
+ {
+ /* No edges intersected */
+ ISCL_MOTION_EVENT_EDGE_FLAG_NONE = 0,
+
+ /* Flag indicating the motion event intersected the top edge of the screen. */
+ ISCL_MOTION_EVENT_EDGE_FLAG_TOP = 0x01,
+
+ /* Flag indicating the motion event intersected the bottom edge of the screen. */
+ ISCL_MOTION_EVENT_EDGE_FLAG_BOTTOM = 0x02,
+
+ /* Flag indicating the motion event intersected the left edge of the screen. */
+ ISCL_MOTION_EVENT_EDGE_FLAG_LEFT = 0x04,
+
+ /* Flag indicating the motion event intersected the right edge of the screen. */
+ ISCL_MOTION_EVENT_EDGE_FLAG_RIGHT = 0x08
+ };
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // INPUT_STACK_COMPATIBILITY_LAYER_FLAGS_MOTION_H_
--- /dev/null
+
+/**
+ * Copyright (C) 2013 Simon Busch <morphis@gravedo.de>
+ * 2012 Canonical Ltd
+ * 2013 Jolla Ltd.
+ *
+ * Auto-generated via "generate_wrapper_macros.py"
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ **/
+
+#ifndef HYBRIS_BINDING_H_
+#define HYBRIS_BINDING_H_
+
+/* floating_point_abi.h defines FP_ATTRIB */
+#include <hybris/internal/floating_point_abi.h>
+
+void *android_dlopen(const char *filename, int flag);
+void *android_dlsym(void *name, const char *symbol);
+int android_dlclose(void *handle);
+const char *android_dlerror(void);
+int android_dladdr(const void *addr, void *info);
+
+
+
+/**
+ * XXX AUTO-GENERATED FILE XXX
+ *
+ * Do not edit this file directly, but update the templates in
+ * utils/generate_wrapper_macros.py and run it again to build
+ * an updated version of this header file:
+ *
+ * python utils/generate_wrapper_macros.py > \
+ * hybris/include/hybris/internal/binding.h
+ *
+ * If you need macros with more arguments, just customize the
+ * MAX_ARGS variable in generate_wrapper_macros.py.
+ *
+ * XXX AUTO-GENERATED FILE XXX
+ **/
+
+
+#define HYBRIS_DLSYSM(name, fptr, sym) \
+ if (!name##_handle) \
+ hybris_##name##_initialize(); \
+ if (*(fptr) == NULL) \
+ { \
+ *(fptr) = (void *) android_dlsym(name##_handle, sym); \
+ }
+
+#define HYBRIS_LIBRARY_INITIALIZE(name, path) \
+ void *name##_handle; \
+ void hybris_##name##_initialize() \
+ { \
+ name##_handle = android_dlopen(path, RTLD_LAZY); \
+ }
+
+
+
+#define HYBRIS_IMPLEMENT_FUNCTION0(name, return_type, symbol) \
+ return_type symbol() \
+ { \
+ static return_type (*f)() FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ return f(); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_FUNCTION1(name, return_type, symbol, a1) \
+ return_type symbol(a1 n1) \
+ { \
+ static return_type (*f)(a1) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ return f(n1); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_FUNCTION2(name, return_type, symbol, a1, a2) \
+ return_type symbol(a1 n1, a2 n2) \
+ { \
+ static return_type (*f)(a1, a2) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ return f(n1, n2); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_FUNCTION3(name, return_type, symbol, a1, a2, a3) \
+ return_type symbol(a1 n1, a2 n2, a3 n3) \
+ { \
+ static return_type (*f)(a1, a2, a3) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ return f(n1, n2, n3); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_FUNCTION4(name, return_type, symbol, a1, a2, a3, a4) \
+ return_type symbol(a1 n1, a2 n2, a3 n3, a4 n4) \
+ { \
+ static return_type (*f)(a1, a2, a3, a4) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ return f(n1, n2, n3, n4); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_FUNCTION5(name, return_type, symbol, a1, a2, a3, a4, a5) \
+ return_type symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5) \
+ { \
+ static return_type (*f)(a1, a2, a3, a4, a5) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ return f(n1, n2, n3, n4, n5); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_FUNCTION6(name, return_type, symbol, a1, a2, a3, a4, a5, a6) \
+ return_type symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5, a6 n6) \
+ { \
+ static return_type (*f)(a1, a2, a3, a4, a5, a6) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ return f(n1, n2, n3, n4, n5, n6); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_FUNCTION7(name, return_type, symbol, a1, a2, a3, a4, a5, a6, a7) \
+ return_type symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5, a6 n6, a7 n7) \
+ { \
+ static return_type (*f)(a1, a2, a3, a4, a5, a6, a7) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ return f(n1, n2, n3, n4, n5, n6, n7); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_FUNCTION8(name, return_type, symbol, a1, a2, a3, a4, a5, a6, a7, a8) \
+ return_type symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5, a6 n6, a7 n7, a8 n8) \
+ { \
+ static return_type (*f)(a1, a2, a3, a4, a5, a6, a7, a8) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ return f(n1, n2, n3, n4, n5, n6, n7, n8); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_FUNCTION9(name, return_type, symbol, a1, a2, a3, a4, a5, a6, a7, a8, a9) \
+ return_type symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5, a6 n6, a7 n7, a8 n8, a9 n9) \
+ { \
+ static return_type (*f)(a1, a2, a3, a4, a5, a6, a7, a8, a9) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ return f(n1, n2, n3, n4, n5, n6, n7, n8, n9); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_FUNCTION10(name, return_type, symbol, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) \
+ return_type symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5, a6 n6, a7 n7, a8 n8, a9 n9, a10 n10) \
+ { \
+ static return_type (*f)(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ return f(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_FUNCTION11(name, return_type, symbol, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) \
+ return_type symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5, a6 n6, a7 n7, a8 n8, a9 n9, a10 n10, a11 n11) \
+ { \
+ static return_type (*f)(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ return f(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_FUNCTION12(name, return_type, symbol, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) \
+ return_type symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5, a6 n6, a7 n7, a8 n8, a9 n9, a10 n10, a11 n11, a12 n12) \
+ { \
+ static return_type (*f)(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ return f(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_FUNCTION13(name, return_type, symbol, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) \
+ return_type symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5, a6 n6, a7 n7, a8 n8, a9 n9, a10 n10, a11 n11, a12 n12, a13 n13) \
+ { \
+ static return_type (*f)(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ return f(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_FUNCTION14(name, return_type, symbol, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) \
+ return_type symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5, a6 n6, a7 n7, a8 n8, a9 n9, a10 n10, a11 n11, a12 n12, a13 n13, a14 n14) \
+ { \
+ static return_type (*f)(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ return f(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_FUNCTION15(name, return_type, symbol, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) \
+ return_type symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5, a6 n6, a7 n7, a8 n8, a9 n9, a10 n10, a11 n11, a12 n12, a13 n13, a14 n14, a15 n15) \
+ { \
+ static return_type (*f)(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ return f(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14, n15); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_FUNCTION16(name, return_type, symbol, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) \
+ return_type symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5, a6 n6, a7 n7, a8 n8, a9 n9, a10 n10, a11 n11, a12 n12, a13 n13, a14 n14, a15 n15, a16 n16) \
+ { \
+ static return_type (*f)(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ return f(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14, n15, n16); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_FUNCTION17(name, return_type, symbol, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) \
+ return_type symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5, a6 n6, a7 n7, a8 n8, a9 n9, a10 n10, a11 n11, a12 n12, a13 n13, a14 n14, a15 n15, a16 n16, a17 n17) \
+ { \
+ static return_type (*f)(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ return f(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14, n15, n16, n17); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_FUNCTION18(name, return_type, symbol, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18) \
+ return_type symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5, a6 n6, a7 n7, a8 n8, a9 n9, a10 n10, a11 n11, a12 n12, a13 n13, a14 n14, a15 n15, a16 n16, a17 n17, a18 n18) \
+ { \
+ static return_type (*f)(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ return f(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14, n15, n16, n17, n18); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_FUNCTION19(name, return_type, symbol, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19) \
+ return_type symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5, a6 n6, a7 n7, a8 n8, a9 n9, a10 n10, a11 n11, a12 n12, a13 n13, a14 n14, a15 n15, a16 n16, a17 n17, a18 n18, a19 n19) \
+ { \
+ static return_type (*f)(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ return f(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14, n15, n16, n17, n18, n19); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_VOID_FUNCTION0(name, symbol) \
+ void symbol() \
+ { \
+ static void (*f)() FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ f(); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_VOID_FUNCTION1(name, symbol, a1) \
+ void symbol(a1 n1) \
+ { \
+ static void (*f)(a1) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ f(n1); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_VOID_FUNCTION2(name, symbol, a1, a2) \
+ void symbol(a1 n1, a2 n2) \
+ { \
+ static void (*f)(a1, a2) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ f(n1, n2); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_VOID_FUNCTION3(name, symbol, a1, a2, a3) \
+ void symbol(a1 n1, a2 n2, a3 n3) \
+ { \
+ static void (*f)(a1, a2, a3) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ f(n1, n2, n3); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_VOID_FUNCTION4(name, symbol, a1, a2, a3, a4) \
+ void symbol(a1 n1, a2 n2, a3 n3, a4 n4) \
+ { \
+ static void (*f)(a1, a2, a3, a4) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ f(n1, n2, n3, n4); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_VOID_FUNCTION5(name, symbol, a1, a2, a3, a4, a5) \
+ void symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5) \
+ { \
+ static void (*f)(a1, a2, a3, a4, a5) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ f(n1, n2, n3, n4, n5); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_VOID_FUNCTION6(name, symbol, a1, a2, a3, a4, a5, a6) \
+ void symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5, a6 n6) \
+ { \
+ static void (*f)(a1, a2, a3, a4, a5, a6) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ f(n1, n2, n3, n4, n5, n6); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_VOID_FUNCTION7(name, symbol, a1, a2, a3, a4, a5, a6, a7) \
+ void symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5, a6 n6, a7 n7) \
+ { \
+ static void (*f)(a1, a2, a3, a4, a5, a6, a7) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ f(n1, n2, n3, n4, n5, n6, n7); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_VOID_FUNCTION8(name, symbol, a1, a2, a3, a4, a5, a6, a7, a8) \
+ void symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5, a6 n6, a7 n7, a8 n8) \
+ { \
+ static void (*f)(a1, a2, a3, a4, a5, a6, a7, a8) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ f(n1, n2, n3, n4, n5, n6, n7, n8); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_VOID_FUNCTION9(name, symbol, a1, a2, a3, a4, a5, a6, a7, a8, a9) \
+ void symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5, a6 n6, a7 n7, a8 n8, a9 n9) \
+ { \
+ static void (*f)(a1, a2, a3, a4, a5, a6, a7, a8, a9) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ f(n1, n2, n3, n4, n5, n6, n7, n8, n9); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_VOID_FUNCTION10(name, symbol, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) \
+ void symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5, a6 n6, a7 n7, a8 n8, a9 n9, a10 n10) \
+ { \
+ static void (*f)(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ f(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_VOID_FUNCTION11(name, symbol, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) \
+ void symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5, a6 n6, a7 n7, a8 n8, a9 n9, a10 n10, a11 n11) \
+ { \
+ static void (*f)(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ f(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_VOID_FUNCTION12(name, symbol, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) \
+ void symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5, a6 n6, a7 n7, a8 n8, a9 n9, a10 n10, a11 n11, a12 n12) \
+ { \
+ static void (*f)(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ f(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_VOID_FUNCTION13(name, symbol, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) \
+ void symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5, a6 n6, a7 n7, a8 n8, a9 n9, a10 n10, a11 n11, a12 n12, a13 n13) \
+ { \
+ static void (*f)(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ f(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_VOID_FUNCTION14(name, symbol, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) \
+ void symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5, a6 n6, a7 n7, a8 n8, a9 n9, a10 n10, a11 n11, a12 n12, a13 n13, a14 n14) \
+ { \
+ static void (*f)(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ f(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_VOID_FUNCTION15(name, symbol, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) \
+ void symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5, a6 n6, a7 n7, a8 n8, a9 n9, a10 n10, a11 n11, a12 n12, a13 n13, a14 n14, a15 n15) \
+ { \
+ static void (*f)(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ f(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14, n15); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_VOID_FUNCTION16(name, symbol, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) \
+ void symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5, a6 n6, a7 n7, a8 n8, a9 n9, a10 n10, a11 n11, a12 n12, a13 n13, a14 n14, a15 n15, a16 n16) \
+ { \
+ static void (*f)(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ f(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14, n15, n16); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_VOID_FUNCTION17(name, symbol, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) \
+ void symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5, a6 n6, a7 n7, a8 n8, a9 n9, a10 n10, a11 n11, a12 n12, a13 n13, a14 n14, a15 n15, a16 n16, a17 n17) \
+ { \
+ static void (*f)(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ f(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14, n15, n16, n17); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_VOID_FUNCTION18(name, symbol, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18) \
+ void symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5, a6 n6, a7 n7, a8 n8, a9 n9, a10 n10, a11 n11, a12 n12, a13 n13, a14 n14, a15 n15, a16 n16, a17 n17, a18 n18) \
+ { \
+ static void (*f)(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ f(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14, n15, n16, n17, n18); \
+ }
+
+
+#define HYBRIS_IMPLEMENT_VOID_FUNCTION19(name, symbol, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19) \
+ void symbol(a1 n1, a2 n2, a3 n3, a4 n4, a5 n5, a6 n6, a7 n7, a8 n8, a9 n9, a10 n10, a11 n11, a12 n12, a13 n13, a14 n14, a15 n15, a16 n16, a17 n17, a18 n18, a19 n19) \
+ { \
+ static void (*f)(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19) FP_ATTRIB = NULL; \
+ HYBRIS_DLSYSM(name, &f, #symbol); \
+ f(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14, n15, n16, n17, n18, n19); \
+ }
+
+
+/**
+ * XXX AUTO-GENERATED FILE XXX
+ *
+ * Do not edit this file directly, but update the templates in
+ * utils/generate_wrapper_macros.py and run it again to build
+ * an updated version of this header file:
+ *
+ * python utils/generate_wrapper_macros.py > \
+ * hybris/include/hybris/internal/binding.h
+ *
+ * If you need macros with more arguments, just customize the
+ * MAX_ARGS variable in generate_wrapper_macros.py.
+ *
+ * XXX AUTO-GENERATED FILE XXX
+ **/
+
+
+#endif /* HYBRIS_BINDING_H_ */
+
--- /dev/null
+/*
+ * Copyright (C) 2013 Canonical Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef CAMERA_CONTROL_H_
+#define CAMERA_CONTROL_H_
+
+#include <camera/Camera.h>
+#include <camera/CameraParameters.h>
+#include <gui/SurfaceTexture.h>
+
+#include <stdint.h>
+#include <unistd.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct CameraControlListener;
+
+struct CameraControl : public android::CameraListener,
+ public android::SurfaceTexture::FrameAvailableListener
+{
+ android::Mutex guard;
+ CameraControlListener* listener;
+ android::sp<android::Camera> camera;
+ android::CameraParameters camera_parameters;
+ android::sp<android::SurfaceTexture> preview_texture;
+
+ // From android::SurfaceTexture::FrameAvailableListener
+ void onFrameAvailable();
+
+ // From android::CameraListener
+ void notify(int32_t msg_type, int32_t ext1, int32_t ext2);
+
+ void postData(
+ int32_t msg_type,
+ const android::sp<android::IMemory>& data,
+ camera_frame_metadata_t* metadata);
+
+ void postDataTimestamp(
+ nsecs_t timestamp,
+ int32_t msg_type,
+ const android::sp<android::IMemory>& data);
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // CAMERA_CONTROL_H_
--- /dev/null
+/*
+ * Copyright (C) 2013 Jolla Ltd.
+ * Contact: Thomas Perl <thomas.perl@jollamobile.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HYBRIS_FLOATING_POINT_ABI_H_
+#define HYBRIS_FLOATING_POINT_ABI_H_
+
+/**
+ * Make sure to use FP_ATTRIB on all functions that are loaded from
+ * Android (bionic libc) libraries to make sure floating point arguments
+ * are passed the right way.
+ *
+ * See: http://wiki.debian.org/ArmHardFloatPort/VfpComparison
+ * http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
+ *
+ * It doesn't hurt to have it added for non-floating point arguments and
+ * return types, even though it does not really have any effect.
+ *
+ * If you use the convenience macros in hybris/internal/binding.h, your
+ * wrapper functions will automatically make use of this attribute.
+ **/
+
+#ifdef __ARM_PCS_VFP
+# define FP_ATTRIB __attribute__((pcs("aapcs")))
+#else
+# define FP_ATTRIB
+#endif
+
+#endif /* HYBRIS_FLOATING_POINT_ABI_H_ */
--- /dev/null
+/*
+ * Copyright (C) 2013 Canonical Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authored by: Thomas Voss <thomas.voss@canonical.com>
+ */
+
+#ifndef SURFACE_FLINGER_COMPATIBILITY_LAYER_INTERNAL_H_
+#define SURFACE_FLINGER_COMPATIBILITY_LAYER_INTERNAL_H_
+
+#ifndef __ANDROID__
+#error "Using this header is only safe when compiling for Android."
+#endif
+
+#include <utils/misc.h>
+
+#include <gui/SurfaceComposerClient.h>
+#include <ui/PixelFormat.h>
+#include <ui/Region.h>
+#include <ui/Rect.h>
+
+#include <cassert>
+#include <cstdio>
+
+struct SfClient
+{
+ android::sp<android::SurfaceComposerClient> client;
+ EGLDisplay egl_display;
+ EGLConfig egl_config;
+ EGLContext egl_context;
+ bool egl_support;
+};
+
+struct SfSurface
+{
+ SfSurface() : client(NULL)
+ {
+ }
+
+ SfClient* client;
+ android::sp<android::SurfaceControl> surface_control;
+ android::sp<android::Surface> surface;
+ EGLSurface egl_surface;
+};
+
+#endif // SURFACE_FLINGER_COMPATIBILITY_LAYER_INTERNAL_H_
--- /dev/null
+/*
+ * Copyright (c) 2012 Carsten Munk <carsten.munk@gmail.com>
+ * 2013 Simon Busch <morphis@gravedo.de>
+ * 2008 The Android Open Source Project
+ * 2013 Canonical Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef PROPERTIES_H_
+#define PROPERTIES_H_
+
+#include <stdint.h>
+#include <unistd.h>
+#include <stdint.h>
+
+/* Based on Android */
+#define PROP_SERVICE_NAME "property_service"
+
+#define PROP_NAME_MAX 32
+#define PROP_VALUE_MAX 92
+
+/* Only SETPROP is defined by Android, for GETPROP and LISTPROP to work
+ * an extended Android init service needs to be in place */
+#define PROP_MSG_SETPROP 1
+#define PROP_MSG_GETPROP 2
+#define PROP_MSG_LISTPROP 3
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ typedef struct prop_msg_s {
+ unsigned cmd;
+ char name[PROP_NAME_MAX];
+ char value[PROP_VALUE_MAX];
+ } prop_msg_t;
+
+ int property_set(const char *key, const char *value);
+ int property_get(const char *key, char *value, const char *default_value);
+ int property_list(void (*propfn)(const char *key, const char *value, void *cookie), void *cookie);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // PROPERTIES_H_
--- /dev/null
+/*
+ * Copyright (C) 2013 Canonical Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authored by: Thomas Voss <thomas.voss@canonical.com>
+ */
+
+#ifndef SURFACE_FLINGER_COMPATIBILITY_LAYER_H_
+#define SURFACE_FLINGER_COMPATIBILITY_LAYER_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
+ struct SfClient;
+ struct SfSurface;
+
+ enum
+ {
+ SURFACE_FLINGER_DEFAULT_DISPLAY_ID = 0
+ };
+
+ void sf_blank(size_t display_id);
+ void sf_unblank(size_t display_id);
+
+ size_t sf_get_display_width(size_t display_id);
+ size_t sf_get_display_height(size_t display_id);
+
+ // The egl_support parameter disables the use of EGL inside the
+ // library. sf_client_create() enables the use of EGL by default. When
+ // disabled, the functions sf_client_get_egl_display(),
+ // sf_client_get_egl_config(), sf_surface_get_egl_surface(),
+ // sf_surface_make_current() and the create_egl_window_surface feature are
+ // not supported anymore.
+ struct SfClient* sf_client_create_full(int egl_support);
+ struct SfClient* sf_client_create();
+
+ EGLDisplay sf_client_get_egl_display(struct SfClient* display);
+ EGLConfig sf_client_get_egl_config(struct SfClient* client);
+ void sf_client_begin_transaction(struct SfClient*);
+ void sf_client_end_transaction(struct SfClient*);
+
+ typedef struct
+ {
+ int x;
+ int y;
+ int w;
+ int h;
+ int format;
+ int layer;
+ float alpha;
+ int create_egl_window_surface;
+ const char* name;
+ } SfSurfaceCreationParameters;
+
+ struct SfSurface* sf_surface_create(struct SfClient* client,
+ SfSurfaceCreationParameters* params);
+ EGLSurface sf_surface_get_egl_surface(struct SfSurface*);
+ EGLNativeWindowType sf_surface_get_egl_native_window(struct SfSurface*);
+ void sf_surface_make_current(struct SfSurface* surface);
+
+ void sf_surface_move_to(struct SfSurface* surface, int x, int y);
+ void sf_surface_set_size(struct SfSurface* surface, int w, int h);
+ void sf_surface_set_layer(struct SfSurface* surface, int layer);
+ void sf_surface_set_alpha(struct SfSurface* surface, float alpha);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // SURFACE_FLINGER_COMPATIBILITY_LAYER_H_
--- /dev/null
+/*
+ * Copyright (C) 2013 Simon Busch <morphis@gravedo.de>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef UI_COMPATIBILITY_LAYER_H_
+#define UI_COMPATIBILITY_LAYER_H_
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <unistd.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ struct graphic_buffer;
+
+ struct graphic_buffer* graphic_buffer_new(void);
+ struct graphic_buffer* graphic_buffer_new_sized(uint32_t w, uint32_t h,
+ int32_t format, uint32_t usage);
+ struct graphic_buffer* graphic_buffer_new_existing(uint32_t w, uint32_t h,
+ int32_t format, uint32_t usage,
+ uint32_t stride, void *handle,
+ bool keepOwnership);
+
+ void graphic_buffer_free(struct graphic_buffer *buffer);
+
+ uint32_t graphic_buffer_get_width(struct graphic_buffer *buffer);
+ uint32_t graphic_buffer_get_height(struct graphic_buffer *buffer);
+ uint32_t graphic_buffer_get_stride(struct graphic_buffer *buffer);
+ uint32_t graphic_buffer_get_usage(struct graphic_buffer *buffer);
+ int32_t graphic_buffer_get_pixel_format(struct graphic_buffer *buffer);
+
+ uint32_t graphic_buffer_reallocate(struct graphic_buffer *buffer, uint32_t w,
+ uint32_t h, int32_t f, uint32_t usage);
+ uint32_t graphic_buffer_lock(struct graphic_buffer *buffer, uint32_t usage, void **vaddr);
+ uint32_t graphic_buffer_unlock(struct graphic_buffer *buffer);
+
+ void* graphic_buffer_get_native_buffer(struct graphic_buffer *buffer);
+
+ void graphic_buffer_set_index(struct graphic_buffer *buffer, int index);
+ int graphic_buffer_get_index(struct graphic_buffer *buffer);
+
+ int graphic_buffer_init_check(struct graphic_buffer *buffer);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // UI_COMPATIBILITY_LAYER_H_
--- /dev/null
+lib_LTLIBRARIES = \
+ libis.la
+
+libis_la_SOURCES = is.c
+libis_la_CFLAGS = -I$(top_srcdir)/include
+if WANT_TRACE
+libis_la_CFLAGS += -DDEBUG
+endif
+if WANT_DEBUG
+libis_la_CFLAGS += -ggdb -O0
+endif
+libis_la_LDFLAGS = \
+ $(top_builddir)/common/libhybris-common.la \
+ -version-info "1":"0":"0"
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libis.pc
--- /dev/null
+/*
+ * Copyright (C) 2013 Canonical Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authored by: Michael Frey <michael.frey@canonical.com>
+ * Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
+ */
+
+#include <dlfcn.h>
+#include <stddef.h>
+#include <stdbool.h>
+
+#include <hybris/internal/binding.h>
+#include <hybris/input/input_stack_compatibility_layer.h>
+
+#define COMPAT_LIBRARY_PATH "/system/lib/libis_compat_layer.so"
+
+HYBRIS_LIBRARY_INITIALIZE(is, COMPAT_LIBRARY_PATH);
+
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(is, android_input_stack_initialize,
+ struct AndroidEventListener*, struct InputStackConfiguration*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION0(is, android_input_stack_start);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(is, android_input_stack_start_waiting_for_flag, bool*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION0(is, android_input_stack_stop);
+HYBRIS_IMPLEMENT_VOID_FUNCTION0(is, android_input_stack_shutdown);
--- /dev/null
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=@includedir@
+
+Name: hybris-input
+Description: libhybris input library
+Version: @VERSION@
+Libs: -L${libdir} -lhybris-common -lis
+Cflags: -I${includedir}
--- /dev/null
+lib_LTLIBRARIES = \
+ libnfc_ndef_nxp.la
+
+libnfc_ndef_nxp_la_SOURCES = libnfc_ndef_nxp.c
+libnfc_ndef_nxp_la_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/include/android -I$(top_srcdir)/include/android/libnfc-nxp
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libnfc_ndef_nxp.pc
+
+if WANT_TRACE
+libnfc_ndef_nxp_la_CFLAGS += -DDEBUG
+endif
+
+if WANT_DEBUG
+libnfc_ndef_nxp_la_CFLAGS += -ggdb -O0
+endif
+
+libnfc_ndef_nxp_la_LDFLAGS = \
+ $(top_builddir)/common/libhybris-common.la \
+ -version-info "1":"0":"0"
--- /dev/null
+/*
+ * Copyright (C) 2013 Jolla Ltd.
+ * Contact: Thomas Perl <thomas.perl@jollamobile.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/**
+ * Bindings generated using:
+ * https://github.com/thp/libhybris-nfc-wrapper-generator
+ **/
+
+#include <libnfc-nxp/phNfcStatus.h>
+#include <libnfc-nxp/phNfcTypes.h>
+#include <libnfc-nxp/phNfcIoctlCode.h>
+#include <libnfc-nxp/phLibNfc.h>
+#include <libnfc-nxp/phDal4Nfc_messageQueueLib.h>
+#include <libnfc-nxp/phFriNfc_NdefMap.h>
+
+#include <dlfcn.h>
+#include <stddef.h>
+#include <stdlib.h>
+
+#include <hybris/internal/binding.h>
+
+HYBRIS_LIBRARY_INITIALIZE(libnfc_ndef_so, "/system/lib/libnfc_ndef.so");
+
+HYBRIS_IMPLEMENT_FUNCTION5(libnfc_ndef_so, NFCSTATUS, phFriNfc_NdefRecord_GetRecords, uint8_t *, uint32_t, uint8_t **, uint8_t *, uint32_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_ndef_so, uint32_t, phFriNfc_NdefRecord_GetLength, phFriNfc_NdefRecord_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_ndef_so, NFCSTATUS, phFriNfc_NdefRecord_Parse, phFriNfc_NdefRecord_t *, uint8_t *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_ndef_so, NFCSTATUS, phFriNfc_NdefRecord_Generate, phFriNfc_NdefRecord_t *, uint8_t *, uint32_t, uint32_t *);
+/* XXX No prototype for exported symbol: __on_dlclose */
--- /dev/null
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libnfc_ndef_nxp
+Description: libhybris NFC NDEF library (NXP variant)
+Version: @VERSION@
+Libs: -L${libdir} -lnfc_ndef_nxp
+Cflags: -I${includedir}
--- /dev/null
+lib_LTLIBRARIES = \
+ libnfc_nxp.la
+
+libnfc_nxp_la_SOURCES = libnfc_nxp.c
+libnfc_nxp_la_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/include/android -I$(top_srcdir)/include/android/libnfc-nxp
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libnfc_nxp.pc
+
+if WANT_TRACE
+libnfc_nxp_la_CFLAGS += -DDEBUG
+endif
+
+if WANT_DEBUG
+libnfc_nxp_la_CFLAGS += -ggdb -O0
+endif
+
+libnfc_nxp_la_LDFLAGS = \
+ $(top_builddir)/common/libhybris-common.la \
+ -version-info "1":"0":"0"
--- /dev/null
+/*
+ * Copyright (C) 2013 Jolla Ltd.
+ * Contact: Thomas Perl <thomas.perl@jollamobile.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/**
+ * Bindings generated using:
+ * https://github.com/thp/libhybris-nfc-wrapper-generator
+ **/
+
+#include <android/android-version.h>
+
+#include <libnfc-nxp/phNfcTypes.h>
+#include <libnfc-nxp/phNfcIoctlCode.h>
+#include <libnfc-nxp/phLibNfc.h>
+#include <libnfc-nxp/phDal4Nfc.h>
+#include <libnfc-nxp/phFriNfc_NdefMap.h>
+#include <libnfc-nxp/phLibNfc_Internal.h>
+
+/**
+ * Fix a compiler warning, as this macro is defined multiple times
+ * to different values - we don't need the value for the wrappers.
+ **/
+#undef NFCSTATUS_COMMAND_NOT_SUPPORTED
+
+/* taken from Linux_x86/phDal4Nfc.c */
+typedef void (*pphDal4Nfc_DeferFuncPointer_t) (void * );
+
+#include <libnfc-nxp/phHciNfc_Generic.h>
+#include <libnfc-nxp/phHal4Nfc.h>
+#include <libnfc-nxp/phHal4Nfc_Internal.h>
+#include <libnfc-nxp/phFriNfc_SmtCrdFmt.h>
+#include <libnfc-nxp/phFriNfc_LlcpUtils.h>
+#include <libnfc-nxp/phFriNfc_LlcpTransport.h>
+#include <libnfc-nxp/phLlcNfc_DataTypes.h>
+#include <libnfc-nxp/phHciNfc_NfcIPMgmt.h>
+#include <libnfc-nxp/phHciNfc_WI.h>
+#include <libnfc-nxp/phHciNfc_Pipe.h>
+
+#include <dlfcn.h>
+#include <stddef.h>
+#include <stdlib.h>
+
+#include <hybris/internal/binding.h>
+
+HYBRIS_LIBRARY_INITIALIZE(libnfc_so, "/system/lib/libnfc.so");
+
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phLibNfc_Mgt_ConfigureDriver, pphLibNfc_sConfig_t, void **);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phDal4Nfc_Config, pphDal4Nfc_sConfig_t, void **);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phLibNfc_Mgt_UnConfigureDriver, void *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phDal4Nfc_ConfigRelease, void *);
+HYBRIS_IMPLEMENT_FUNCTION0(libnfc_so, NFCSTATUS, phLibNfc_HW_Reset);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phDal4Nfc_Reset, long);
+HYBRIS_IMPLEMENT_FUNCTION0(libnfc_so, NFCSTATUS, phLibNfc_Download_Mode);
+HYBRIS_IMPLEMENT_FUNCTION0(libnfc_so, NFCSTATUS, phDal4Nfc_Download);
+HYBRIS_IMPLEMENT_FUNCTION0(libnfc_so, int, phLibNfc_Load_Firmware_Image);
+/* XXX No prototype for exported symbol: dlopen_firmware */
+HYBRIS_IMPLEMENT_VOID_FUNCTION0(libnfc_so, phLibNfc_Mgt_Recovery);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phLibNfc_SetIsoXchgTimeout, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION0(libnfc_so, int, phLibNfc_GetIsoXchgTimeout);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phLibNfc_SetHciTimeout, uint32_t);
+HYBRIS_IMPLEMENT_FUNCTION0(libnfc_so, int, phLibNfc_GetHciTimeout);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phLibNfc_SetFelicaTimeout, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION0(libnfc_so, int, phLibNfc_GetFelicaTimeout);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phLibNfc_SetMifareRawTimeout, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION0(libnfc_so, int, phLibNfc_GetMifareRawTimeout);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phLibNfc_Mgt_DeInitialize, void *, pphLibNfc_RspCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHal4Nfc_Close, phHal_sHwReference_t *, pphHal4Nfc_GenCallback_t, void *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phHal4Nfc_Hal4Reset, phHal_sHwReference_t *, void *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(libnfc_so, phOsalNfc_FreeMemory, void *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION0(libnfc_so, phLibNfc_Ndef_DeInit);
+HYBRIS_IMPLEMENT_VOID_FUNCTION0(libnfc_so, phLibNfc_Pending_Shutdown);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phLibNfc_Mgt_Reset, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phLibNfc_UpdateNextState, pphLibNfc_LibContext_t, phLibNfc_State_t);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phLibNfc_Mgt_Initialize, void *, pphLibNfc_RspCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, void *, phOsalNfc_GetMemory, uint32_t);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHal4Nfc_Open, phHal_sHwReference_t *, phHal4Nfc_InitType_t, pphHal4Nfc_GenCallback_t, void *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION0(libnfc_so, phLibNfc_Ndef_Init);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phLibNfc_UpdateCurState, NFCSTATUS, pphLibNfc_LibContext_t);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHal4Nfc_RegisterNotification, phHal_sHwReference_t *, phHal4Nfc_RegisterType_t, pphHal4Nfc_Notification_t, void *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phOsalNfc_RaiseException, phOsalNfc_ExceptionType_t, uint16_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phLibNfc_Mgt_GetstackCapabilities, phLibNfc_StackCapabilities_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHal4Nfc_GetDeviceCapabilities, phHal_sHwReference_t *, phHal_sDeviceCapabilities_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phLibNfc_Mgt_ConfigureTestMode, void *, pphLibNfc_RspCb_t, phLibNfc_Cfg_Testmode_t, void *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phLibNfc_config_discovery_cb, void *, NFCSTATUS);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phLibNfc_Mgt_ConfigureDiscovery, phLibNfc_eDiscoveryConfigMode_t, phLibNfc_sADD_Cfg_t, pphLibNfc_RspCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION5(libnfc_so, NFCSTATUS, phHal4Nfc_ConfigureDiscovery, phHal_sHwReference_t *, phHal_eDiscoveryConfigMode_t, phHal_sADD_Cfg_t *, pphHal4Nfc_GenCallback_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phLibNfc_RemoteDev_CheckPresence, phLibNfc_Handle, pphLibNfc_RspCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHal4Nfc_PresenceCheck, phHal_sHwReference_t *, pphHal4Nfc_GenCallback_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION5(libnfc_so, NFCSTATUS, phHal4Nfc_Transceive, phHal_sHwReference_t *, phHal_sTransceiveInfo_t *, phHal_sRemoteDevInformation_t *, pphHal4Nfc_TransceiveCallback_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHal4Nfc_Connect, phHal_sHwReference_t *, phHal_sRemoteDevInformation_t *, pphHal4Nfc_ConnectCallback_t, void *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(libnfc_so, phLibNfc_Reconnect_Mifare_Cb, void *, phHal_sRemoteDevInformation_t *, NFCSTATUS);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phLibNfc_RemoteDev_NtfRegister, phLibNfc_Registry_Info_t *, phLibNfc_NtfRegister_RspCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION0(libnfc_so, NFCSTATUS, phLibNfc_RemoteDev_NtfUnregister);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHal4Nfc_UnregisterNotification, phHal_sHwReference_t *, phHal4Nfc_RegisterType_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phLibNfc_RemoteDev_ReConnect, phLibNfc_Handle, pphLibNfc_ConnectCallback_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phLibNfc_RemoteDev_Connect, phLibNfc_Handle, pphLibNfc_ConnectCallback_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phLibNfc_RemoteDev_Disconnect, phLibNfc_Handle, phLibNfc_eReleaseType_t, pphLibNfc_DisconnectCallback_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION5(libnfc_so, NFCSTATUS, phHal4Nfc_Disconnect, phHal_sHwReference_t *, phHal_sRemoteDevInformation_t *, phHal_eReleaseType_t, pphHal4Nfc_DiscntCallback_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phLibNfc_RemoteDev_Transceive, phLibNfc_Handle, phLibNfc_sTransceiveInfo_t *, pphLibNfc_TransceiveCallback_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phLibNfc_Mgt_SetP2P_ConfigParams, phLibNfc_sNfcIPCfg_t *, pphLibNfc_RspCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION5(libnfc_so, NFCSTATUS, phHal4Nfc_ConfigParameters, phHal_sHwReference_t *, phHal_eConfigType_t, phHal_uConfig_t *, pphHal4Nfc_GenCallback_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_CloseAll, phFriNfc_LlcpTransport_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phLibNfc_Mgt_SetLlcp_ConfigParams, phLibNfc_Llcp_sLinkParameters_t *, pphLibNfc_RspCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phFriNfc_Llcp_EncodeLinkParams, phNfc_sData_t *, phFriNfc_Llcp_sLinkParameters_t *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION9(libnfc_so, NFCSTATUS, phFriNfc_Llcp_Reset, phFriNfc_Llcp_t *, void *, phFriNfc_Llcp_sLinkParameters_t *, void *, uint16_t, void *, uint16_t, phFriNfc_Llcp_LinkStatus_CB_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_Reset, phFriNfc_LlcpTransport_t *, phFriNfc_Llcp_t *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phLibNfc_Llcp_CheckLlcp, phLibNfc_Handle, pphLibNfc_ChkLlcpRspCb_t, pphLibNfc_LlcpLinkStatusCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_Llcp_ChkLlcp, phFriNfc_Llcp_t *, phHal_sRemoteDevInformation_t *, phFriNfc_Llcp_Check_CB_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phLibNfc_Llcp_Activate, phLibNfc_Handle);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_Llcp_Activate, phFriNfc_Llcp_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phLibNfc_Llcp_Deactivate, phLibNfc_Handle);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_Llcp_Deactivate, phFriNfc_Llcp_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phLibNfc_Llcp_GetLocalInfo, phLibNfc_Handle, phLibNfc_Llcp_sLinkParameters_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phFriNfc_Llcp_GetLocalInfo, phFriNfc_Llcp_t *, phFriNfc_Llcp_sLinkParameters_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phLibNfc_Llcp_GetRemoteInfo, phLibNfc_Handle, phLibNfc_Llcp_sLinkParameters_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phFriNfc_Llcp_GetRemoteInfo, phFriNfc_Llcp_t *, phFriNfc_Llcp_sLinkParameters_t *);
+HYBRIS_IMPLEMENT_FUNCTION6(libnfc_so, NFCSTATUS, phLibNfc_Llcp_DiscoverServices, phLibNfc_Handle, phNfc_sData_t *, uint8_t *, uint8_t, pphLibNfc_RspCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION6(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_DiscoverServices, phFriNfc_LlcpTransport_t *, phNfc_sData_t *, uint8_t *, uint8_t, pphFriNfc_Cr_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION6(libnfc_so, NFCSTATUS, phLibNfc_Llcp_Socket, phLibNfc_Llcp_eSocketType_t, phLibNfc_Llcp_sSocketOptions_t *, phNfc_sData_t *, phLibNfc_Handle *, pphLibNfc_LlcpSocketErrCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION7(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_Socket, phFriNfc_LlcpTransport_t *, phFriNfc_LlcpTransport_eSocketType_t, phFriNfc_LlcpTransport_sSocketOptions_t *, phNfc_sData_t *, phFriNfc_LlcpTransport_Socket_t **, pphFriNfc_LlcpTransportSocketErrCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phLibNfc_Llcp_Close, phLibNfc_Handle);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_Close, phFriNfc_LlcpTransport_Socket_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phLibNfc_Llcp_SocketGetLocalOptions, phLibNfc_Handle, phLibNfc_Llcp_sSocketOptions_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_SocketGetLocalOptions, phFriNfc_LlcpTransport_Socket_t *, phLibNfc_Llcp_sSocketOptions_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phLibNfc_Llcp_SocketGetRemoteOptions, phLibNfc_Handle, phLibNfc_Handle, phLibNfc_Llcp_sSocketOptions_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_SocketGetRemoteOptions, phFriNfc_LlcpTransport_Socket_t *, phLibNfc_Llcp_sSocketOptions_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phLibNfc_Llcp_Bind, phLibNfc_Handle, uint8_t, phNfc_sData_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_Bind, phFriNfc_LlcpTransport_Socket_t *, uint8_t, phNfc_sData_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phLibNfc_Llcp_Listen, phLibNfc_Handle, pphLibNfc_LlcpSocketListenCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_Listen, phFriNfc_LlcpTransport_Socket_t *, pphFriNfc_LlcpTransportSocketListenCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION6(libnfc_so, NFCSTATUS, phLibNfc_Llcp_Accept, phLibNfc_Handle, phLibNfc_Llcp_sSocketOptions_t *, phNfc_sData_t *, pphLibNfc_LlcpSocketErrCb_t, pphLibNfc_LlcpSocketAcceptCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION6(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_Accept, phFriNfc_LlcpTransport_Socket_t *, phFriNfc_LlcpTransport_sSocketOptions_t *, phNfc_sData_t *, pphFriNfc_LlcpTransportSocketErrCb_t, pphFriNfc_LlcpTransportSocketAcceptCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phLibNfc_Llcp_Reject, phLibNfc_Handle, phLibNfc_Handle, pphLibNfc_LlcpSocketRejectCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_Reject, phFriNfc_LlcpTransport_Socket_t *, pphFriNfc_LlcpTransportSocketRejectCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION5(libnfc_so, NFCSTATUS, phLibNfc_Llcp_Connect, phLibNfc_Handle, phLibNfc_Handle, uint8_t, pphLibNfc_LlcpSocketConnectCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_Connect, phFriNfc_LlcpTransport_Socket_t *, uint8_t, pphFriNfc_LlcpTransportSocketConnectCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION5(libnfc_so, NFCSTATUS, phLibNfc_Llcp_ConnectByUri, phLibNfc_Handle, phLibNfc_Handle, phNfc_sData_t *, pphLibNfc_LlcpSocketConnectCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_ConnectByUri, phFriNfc_LlcpTransport_Socket_t *, phNfc_sData_t *, pphFriNfc_LlcpTransportSocketConnectCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phLibNfc_Llcp_Disconnect, phLibNfc_Handle, phLibNfc_Handle, pphLibNfc_LlcpSocketDisconnectCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_Disconnect, phFriNfc_LlcpTransport_Socket_t *, pphLibNfc_LlcpSocketDisconnectCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION5(libnfc_so, NFCSTATUS, phLibNfc_Llcp_Recv, phLibNfc_Handle, phLibNfc_Handle, phNfc_sData_t *, pphLibNfc_LlcpSocketRecvCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_Recv, phFriNfc_LlcpTransport_Socket_t *, phNfc_sData_t *, pphFriNfc_LlcpTransportSocketRecvCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION5(libnfc_so, NFCSTATUS, phLibNfc_Llcp_RecvFrom, phLibNfc_Handle, phLibNfc_Handle, phNfc_sData_t *, pphLibNfc_LlcpSocketRecvFromCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_RecvFrom, phFriNfc_LlcpTransport_Socket_t *, phNfc_sData_t *, pphFriNfc_LlcpTransportSocketRecvFromCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION5(libnfc_so, NFCSTATUS, phLibNfc_Llcp_Send, phLibNfc_Handle, phLibNfc_Handle, phNfc_sData_t *, pphLibNfc_LlcpSocketSendCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_Send, phFriNfc_LlcpTransport_Socket_t *, phNfc_sData_t *, pphFriNfc_LlcpTransportSocketSendCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION6(libnfc_so, NFCSTATUS, phLibNfc_Llcp_SendTo, phLibNfc_Handle, phLibNfc_Handle, uint8_t, phNfc_sData_t *, pphLibNfc_LlcpSocketSendCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION5(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_SendTo, phFriNfc_LlcpTransport_Socket_t *, uint8_t, phNfc_sData_t *, pphFriNfc_LlcpTransportSocketSendCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION6(libnfc_so, NFCSTATUS, phLibNfc_Mgt_IoCtl, void *, uint16_t, phNfc_sData_t *, phNfc_sData_t *, pphLibNfc_IoctlCallback_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION6(libnfc_so, NFCSTATUS, phHal4Nfc_Ioctl, phHal_sHwReference_t *, uint32_t, phNfc_sData_t *, phNfc_sData_t *, pphHal4Nfc_IoctlCallback_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHal4Nfc_Switch_Swp_Mode, phHal_sHwReference_t *, phHal_eSWP_Mode_t, pphHal4Nfc_GenCallback_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phFriNfc_NdefReg_DispatchPacket, phFriNfc_NdefReg_t *, uint8_t *, uint16_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, uint8_t, phFriNfc_NdefReg_Process, phFriNfc_NdefReg_t *, NFCSTATUS *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phFriNfc_NdefReg_RmCb, phFriNfc_NdefReg_t *, phFriNfc_NdefReg_Cb_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phFriNfc_NdefMap_GetContainerSize, const phFriNfc_NdefMap_t *, uint32_t *, uint32_t *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(libnfc_so, phOsalNfc_Timer_Stop, uint32_t);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(libnfc_so, phOsalNfc_Timer_Delete, uint32_t);
+HYBRIS_IMPLEMENT_FUNCTION5(libnfc_so, NFCSTATUS, phLibNfc_Ndef_Read, phLibNfc_Handle, phNfc_sData_t *, phLibNfc_Ndef_EOffset_t, pphLibNfc_RspCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_NdefMap_SetCompletionRoutine, phFriNfc_NdefMap_t *, uint8_t, pphFriNfc_Cr_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_NdefMap_RdNdef, phFriNfc_NdefMap_t *, uint8_t *, uint32_t *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phLibNfc_Ndef_Write, phLibNfc_Handle, phNfc_sData_t *, pphLibNfc_RspCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_NdefMap_EraseNdef, phFriNfc_NdefMap_t *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_NdefMap_WrNdef, phFriNfc_NdefMap_t *, uint8_t *, uint32_t *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phLibNfc_Ndef_CheckNdef, phLibNfc_Handle, pphLibNfc_ChkNdefRspCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION9(libnfc_so, NFCSTATUS, phFriNfc_NdefMap_Reset, phFriNfc_NdefMap_t *, void *, phHal_sRemoteDevInformation_t *, phHal_sDevInputParam_t *, uint8_t *, uint16_t, uint8_t *, uint16_t *, uint16_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_NdefMap_ChkNdef, phFriNfc_NdefMap_t *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(libnfc_so, phOsalNfc_Timer_Start, uint32_t, uint32_t, ppCallBck_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION0(libnfc_so, uint32_t, phOsalNfc_Timer_Create);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phLibNfc_RemoteDev_FormatNdef, phLibNfc_Handle, phNfc_sData_t *, pphLibNfc_RspCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION6(libnfc_so, NFCSTATUS, phFriNfc_NdefSmtCrd_Reset, phFriNfc_sNdefSmtCrdFmt_t *, void *, phHal_sRemoteDevInformation_t *, phHal_sDevInputParam_t *, uint8_t *, uint16_t *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_NdefSmtCrd_SetCR, phFriNfc_sNdefSmtCrdFmt_t *, uint8_t, pphFriNfc_Cr_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phFriNfc_NdefSmtCrd_Format, phFriNfc_sNdefSmtCrdFmt_t *, const uint8_t *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phLibNfc_ConvertToReadOnlyNdef, phLibNfc_Handle, phNfc_sData_t *, pphLibNfc_RspCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_NdefMap_ConvertToReadOnly, phFriNfc_NdefMap_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_NdefSmtCrd_ConvertToReadOnly, phFriNfc_sNdefSmtCrdFmt_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phFriNfc_MifareStdMap_ConvertToReadOnly, phFriNfc_NdefMap_t *, const uint8_t *);
+HYBRIS_IMPLEMENT_FUNCTION5(libnfc_so, NFCSTATUS, phLibNfc_Ndef_SearchNdefContent, phLibNfc_Handle, phLibNfc_Ndef_SrchType_t *, uint8_t, pphLibNfc_Ndef_Search_RspCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION6(libnfc_so, NFCSTATUS, phFriNfc_NdefReg_Reset, phFriNfc_NdefReg_t *, uint8_t **, phFriNfc_NdefRecord_t *, phFriNfc_NdefReg_CbParam_t *, uint8_t *, uint32_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phFriNfc_NdefReg_AddCb, phFriNfc_NdefReg_t *, phFriNfc_NdefReg_Cb_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phLibNfc_SE_NtfRegister, pphLibNfc_SE_NotificationCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION0(libnfc_so, NFCSTATUS, phLibNfc_SE_NtfUnregister);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phLibNfc_SE_GetSecureElementList, phLibNfc_SE_List_t *, uint8_t *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phLibNfc_SE_SetMode, phLibNfc_Handle, phLibNfc_eSE_ActivationMode, pphLibNfc_SE_SetModeRspCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHal4Nfc_Switch_SMX_Mode, phHal_sHwReference_t *, phHal_eSmartMX_Mode_t, pphHal4Nfc_GenCallback_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phLibNfc_RemoteDev_Receive, phLibNfc_Handle, pphLibNfc_Receive_RspCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHal4Nfc_Receive, phHal_sHwReference_t *, phHal4Nfc_TransactInfo_t *, pphHal4Nfc_ReceiveCallback_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phLibNfc_RemoteDev_Send, phLibNfc_Handle, phNfc_sData_t *, pphLibNfc_RspCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION5(libnfc_so, NFCSTATUS, phHal4Nfc_Send, phHal_sHwReference_t *, phHal4Nfc_TransactInfo_t *, phNfc_sData_t, pphHal4Nfc_SendCallback_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHciNfc_Configure, void *, void *, phHal_eConfigType_t, phHal_uConfig_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_Config_Discovery, void *, void *, phHal_sADD_Cfg_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_Restart_Discovery, void *, void *, uint8_t);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(libnfc_so, phHal4Nfc_ConfigureComplete, phHal4Nfc_Hal4Ctxt_t *, void *, uint8_t);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phHal4Nfc_DisconnectComplete, phHal4Nfc_Hal4Ctxt_t *, void *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phHal4Nfc_TargetDiscoveryComplete, phHal4Nfc_Hal4Ctxt_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_Select_Next_Target, void *, void *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phHal4Nfc_HandleEmulationEvent, phHal4Nfc_Hal4Ctxt_t *, void *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phHal4Nfc_TransceiveComplete, phHal4Nfc_Hal4Ctxt_t *, void *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phHal4Nfc_SendCompleteHandler, phHal4Nfc_Hal4Ctxt_t *, void *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phHal4Nfc_ReactivationComplete, phHal4Nfc_Hal4Ctxt_t *, void *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phHal4Nfc_PresenceChkComplete, phHal4Nfc_Hal4Ctxt_t *, void *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phHal4Nfc_ConnectComplete, phHal4Nfc_Hal4Ctxt_t *, void *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phHal4Nfc_RecvCompleteHandler, phHal4Nfc_Hal4Ctxt_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHciNfc_Release, void *, void *, pphNfcIF_Notification_CB_t, void *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phHal4Nfc_HandleP2PDeActivate, phHal4Nfc_Hal4Ctxt_t *, void *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phHal4Nfc_P2PActivateComplete, phHal4Nfc_Hal4Ctxt_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION7(libnfc_so, NFCSTATUS, phHciNfc_Initialise, void *, void *, phHciNfc_Init_t, phHal_sHwConfig_t *, pphNfcIF_Notification_CB_t, void *, phNfcLayer_sCfg_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phDal4Nfc_Register, phNfcIF_sReference_t *, phNfcIF_sCallBack_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phLlcNfc_Register, phNfcIF_sReference_t *, phNfcIF_sCallBack_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHciNfc_System_Get_Info, void *, void *, uint32_t, uint8_t *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHciNfc_System_Test, void *, void *, uint32_t, phNfc_sData_t *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHciNfc_System_Configure, void *, void *, uint32_t, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHciNfc_PRBS_Test, void *, void *, uint32_t, phNfc_sData_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phDnldNfc_Upgrade, phHal_sHwReference_t *, pphNfcIF_Notification_CB_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phDnldNfc_Run_Check, phHal_sHwReference_t *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHciNfc_Switch_SmxMode, void *, void *, phHal_eSmartMX_Mode_t, phHal_sADD_Cfg_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_Switch_SwpMode, void *, void *, phHal_eSWP_Mode_t);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHciNfc_Send_Data, void *, void *, phHal_sRemoteDevInformation_t *, phHciNfc_XchgInfo_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phHal4Nfc_Disconnect_Execute, phHal_sHwReference_t *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phHal4Nfc_Felica_RePoll, void *, NFCSTATUS);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_Reactivate, void *, void *, phHal_sRemoteDevInformation_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, int, phOsalNfc_MemCompare, void *, void *, unsigned int);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_Connect, void *, void *, phHal_sRemoteDevInformation_t *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHciNfc_Exchange_Data, void *, void *, phHal_sRemoteDevInformation_t *, phHciNfc_XchgInfo_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_Disconnect, void *, void *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_Presence_Check, void *, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phDal4Nfc_Unregister, void *, void *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION5(libnfc_so, phHciNfc_Build_HCPFrame, phHciNfc_HCP_Packet_t *, uint8_t, uint8_t, uint8_t, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_Send_HCP, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHciNfc_Update_PipeInfo, phHciNfc_sContext_t *, phHciNfc_PipeMgmt_Seq_t *, uint8_t, phHciNfc_Pipe_Info_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_Admin_Release, phHciNfc_sContext_t *, void *, phHciNfc_HostID_t);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_Close_Pipe, phHciNfc_sContext_t *, void *, phHciNfc_Pipe_Info_t *);
+HYBRIS_IMPLEMENT_FUNCTION5(libnfc_so, NFCSTATUS, phHciNfc_Send_Admin_Event, phHciNfc_sContext_t *, void *, uint8_t, uint8_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION5(libnfc_so, NFCSTATUS, phHciNfc_Send_Admin_Cmd, phHciNfc_sContext_t *, void *, uint8_t, uint8_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_Admin_Initialise, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_Allocate_Resource, void **, uint16_t);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_Create_All_Pipes, phHciNfc_sContext_t *, void *, phHciNfc_PipeMgmt_Seq_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_Open_Pipe, phHciNfc_sContext_t *, void *, phHciNfc_Pipe_Info_t *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHciNfc_Send_Generic_Cmd, phHciNfc_sContext_t *, void *, uint8_t, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION6(libnfc_so, NFCSTATUS, phHciNfc_Set_Param, phHciNfc_sContext_t *, void *, phHciNfc_Pipe_Info_t *, uint8_t, void *, uint16_t);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_Update_Pipe, phHciNfc_sContext_t *, void *, phHciNfc_PipeMgmt_Seq_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_FSM_Update, phHciNfc_sContext_t *, phHciNfc_eState_t);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(libnfc_so, phHciNfc_FSM_Rollback, phHciNfc_sContext_t *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(libnfc_so, phHciNfc_Send_Complete, void *, void *, phNfc_sTransactionInfo_t *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(libnfc_so, phHciNfc_Receive_Complete, void *, void *, phNfc_sTransactionInfo_t *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(libnfc_so, phHciNfc_Notify_Event, void *, void *, uint8_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_Release_Sequence, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phHciNfc_Release_Lower, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(libnfc_so, phHciNfc_Release_Resources, phHciNfc_sContext_t **);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHciNfc_NfcIP_SetATRInfo, phHciNfc_sContext_t *, void *, phHciNfc_eNfcIPType_t, phHal_sNfcIPCfg_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_SWP_Protection, void *, void *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_SWP_Update_Sequence, phHciNfc_sContext_t *, phHciNfc_eSeqType_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_EmulationCfg_Sequence, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_Emulation_Cfg, phHciNfc_sContext_t *, void *, phHciNfc_eConfigType_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_PollLoop_Sequence, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHciNfc_ReaderMgmt_Deselect, phHciNfc_sContext_t *, void *, phHal_eRemDevType_t, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_SWP_Configure_Mode, void *, void *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_SmartMx_Mode_Sequence, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_ReaderMgmt_Activate_Next, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_ReaderMgmt_Select, phHciNfc_sContext_t *, void *, phHal_eRemDevType_t);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_ReaderMgmt_Reactivate, phHciNfc_sContext_t *, void *, phHal_eRemDevType_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_Disconnect_Sequence, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_ReaderMgmt_Exchange_Data, phHciNfc_sContext_t *, void *, phHciNfc_XchgInfo_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_NfcIP_Send_Data, phHciNfc_sContext_t *, void *, phHciNfc_XchgInfo_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_ReaderMgmt_Presence_Check, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHciNfc_DevMgmt_Test, void *, void *, uint8_t, phNfc_sData_t *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHciNfc_DevMgmt_Get_Info, phHciNfc_sContext_t *, void *, uint16_t, uint8_t *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHciNfc_DevMgmt_Configure, phHciNfc_sContext_t *, void *, uint16_t, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_Get_Link_Status, void *, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_LinkMgmt_Open, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(libnfc_so, phHciNfc_Append_HCPFrame, uint8_t *, uint16_t, uint8_t *, uint16_t);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phHciNfc_DevMgmt_Init_Resources, phHciNfc_sContext_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_DevMgmt_Get_PipeID, phHciNfc_sContext_t *, uint8_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_DevMgmt_Get_Test_Result, phHciNfc_sContext_t *, phNfc_sData_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_DevMgmt_Set_Test_Result, phHciNfc_sContext_t *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_DevMgmt_Update_PipeInfo, phHciNfc_sContext_t *, uint8_t, phHciNfc_Pipe_Info_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_DevMgmt_Initialise, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_DevMgmt_Release, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_DevMgmt_Update_Sequence, phHciNfc_sContext_t *, phHciNfc_eSeqType_t);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phHciNfc_Uicc_Connectivity, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_Uicc_Get_PipeID, phHciNfc_sContext_t *, uint8_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_Uicc_Update_PipeInfo, phHciNfc_sContext_t *, uint8_t, phHciNfc_Pipe_Info_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_EmuMgmt_Update_Seq, phHciNfc_sContext_t *, phHciNfc_eSeqType_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_Uicc_Connect_Status, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_SWP_Get_Status, void *, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_EmuMgmt_Initialise, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_WI_Configure_Mode, void *, void *, phHal_eSmartMX_Mode_t);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHciNfc_NfcIP_SetMode, phHciNfc_sContext_t *, void *, phHciNfc_eNfcIPType_t, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_SWP_Get_Bitrate, void *, void *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_NfcIP_SetMergeSak, phHciNfc_sContext_t *, void *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_SWP_Configure_Default, void *, void *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_WI_Configure_Default, void *, void *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_WI_Configure_Notifications, void *, void *, phHciNfc_WI_Events_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_EmuMgmt_Release, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_SWP_Config_Sequence, phHciNfc_sContext_t *, void *, phHal_sEmulationCfg_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_ReaderMgmt_Update_Sequence, phHciNfc_sContext_t *, phHciNfc_eSeqType_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_Felica_Get_PipeID, phHciNfc_sContext_t *, uint8_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phHciNfc_Felica_Init_Resources, phHciNfc_sContext_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_Felica_Update_PipeInfo, phHciNfc_sContext_t *, uint8_t, phHciNfc_Pipe_Info_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_Felica_Update_Info, phHciNfc_sContext_t *, uint8_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_Felica_Info_Sequence, void *, void *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(libnfc_so, phHciNfc_Tag_Notify, phHciNfc_sContext_t *, void *, uint8_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHciNfc_Send_Felica_Command, phHciNfc_sContext_t *, void *, uint8_t, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_Felica_Request_Mode, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHciNfc_Receive, void *, void *, uint8_t *, uint16_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_Resume_Sequence, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION5(libnfc_so, phHciNfc_Error_Sequence, void *, void *, NFCSTATUS, void *, uint8_t);
+HYBRIS_IMPLEMENT_VOID_FUNCTION5(libnfc_so, phHciNfc_Notify, pphNfcIF_Notification_CB_t, void *, void *, uint8_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phHciNfc_FSM_Complete, phHciNfc_sContext_t *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(libnfc_so, phHciNfc_Target_Select_Notify, phHciNfc_sContext_t *, void *, uint8_t, void *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(libnfc_so, phHciNfc_Release_Notify, phHciNfc_sContext_t *, void *, uint8_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phHciNfc_IDMgmt_Init_Resources, phHciNfc_sContext_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_IDMgmt_Get_PipeID, phHciNfc_sContext_t *, uint8_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_IDMgmt_Update_Sequence, phHciNfc_sContext_t *, phHciNfc_eSeqType_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_IDMgmt_Initialise, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_IDMgmt_Info_Sequence, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_IDMgmt_Release, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_IDMgmt_Update_PipeInfo, phHciNfc_sContext_t *, uint8_t, phHciNfc_Pipe_Info_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phHciNfc_ISO15693_Init_Resources, phHciNfc_sContext_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_ISO15693_Get_PipeID, phHciNfc_sContext_t *, uint8_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_ISO15693_Update_PipeInfo, phHciNfc_sContext_t *, uint8_t, phHciNfc_Pipe_Info_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_ISO15693_Update_Info, phHciNfc_sContext_t *, uint8_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_ISO15693_Info_Sequence, void *, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHciNfc_Send_ISO15693_Command, phHciNfc_sContext_t *, void *, uint8_t, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_ISO15693_Set_AFI, void *, void *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_Jewel_Get_PipeID, phHciNfc_sContext_t *, uint8_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phHciNfc_Jewel_Init_Resources, phHciNfc_sContext_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_Jewel_Update_PipeInfo, phHciNfc_sContext_t *, uint8_t, phHciNfc_Pipe_Info_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_Jewel_Update_Info, phHciNfc_sContext_t *, uint8_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHciNfc_Send_Jewel_Command, phHciNfc_sContext_t *, void *, uint8_t, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_Jewel_Info_Sequence, void *, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_Jewel_GetRID, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_LinkMgmt_Initialise, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_LinkMgmt_Release, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phHciNfc_Initiator_Init_Resources, phHciNfc_sContext_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_Initiator_Get_PipeID, phHciNfc_sContext_t *, uint8_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_Initiator_Update_PipeInfo, phHciNfc_sContext_t *, uint8_t, phHciNfc_Pipe_Info_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_NfcIP_Presence_Check, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phHciNfc_Target_Init_Resources, phHciNfc_sContext_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_Target_Get_PipeID, phHciNfc_sContext_t *, uint8_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_Target_Update_PipeInfo, phHciNfc_sContext_t *, uint8_t, phHciNfc_Pipe_Info_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_NfcIP_Info_Sequence, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHciNfc_NfcIP_SetNAD, phHciNfc_sContext_t *, void *, phHciNfc_eNfcIPType_t, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_NfcIP_SetDID, phHciNfc_sContext_t *, void *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHciNfc_NfcIP_SetOptions, phHciNfc_sContext_t *, void *, phHciNfc_eNfcIPType_t, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_NfcIP_SetPSL1, phHciNfc_sContext_t *, void *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_NfcIP_SetPSL2, phHciNfc_sContext_t *, void *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_NfcIP_GetStatus, phHciNfc_sContext_t *, void *, phHciNfc_eNfcIPType_t);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_NfcIP_GetParam, phHciNfc_sContext_t *, void *, phHciNfc_eNfcIPType_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_Initiator_Cont_Activate, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_NfcIP_GetATRInfo, phHciNfc_sContext_t *, void *, phHciNfc_eNfcIPType_t);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_Delete_Pipe, phHciNfc_sContext_t *, void *, phHciNfc_Pipe_Info_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phHciNfc_SWP_Init_Resources, phHciNfc_sContext_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phHciNfc_PollLoop_Init_Resources, phHciNfc_sContext_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phHciNfc_ReaderA_Init_Resources, phHciNfc_sContext_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phHciNfc_ReaderB_Init_Resources, phHciNfc_sContext_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phHciNfc_WI_Init_Resources, phHciNfc_sContext_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_Delete_All_Pipes, phHciNfc_sContext_t *, void *, phHciNfc_PipeMgmt_Seq_t);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_PollLoop_Update_PipeInfo, phHciNfc_sContext_t *, uint8_t, phHciNfc_Pipe_Info_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_WI_Update_PipeInfo, phHciNfc_sContext_t *, uint8_t, phHciNfc_Pipe_Info_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_SWP_Update_PipeInfo, phHciNfc_sContext_t *, uint8_t, phHciNfc_Pipe_Info_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_ReaderB_Update_PipeInfo, phHciNfc_sContext_t *, uint8_t, phHciNfc_Pipe_Info_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_ReaderA_Update_PipeInfo, phHciNfc_sContext_t *, uint8_t, phHciNfc_Pipe_Info_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_ReaderMgmt_Initialise, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_PollLoop_Get_PipeID, phHciNfc_sContext_t *, uint8_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_PollLoop_Initialise, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_PollLoop_Release, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHciNfc_PollLoop_Cfg, void *, void *, uint8_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_ReaderA_Get_PipeID, phHciNfc_sContext_t *, uint8_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_ReaderA_Info_Sequence, void *, void *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_ReaderA_Auto_Activate, void *, void *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_ReaderA_Set_DataRateMax, void *, void *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHciNfc_Send_ReaderA_Command, phHciNfc_sContext_t *, void *, uint8_t, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_ReaderA_Cont_Activate, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_ReaderA_Update_Info, phHciNfc_sContext_t *, uint8_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_ReaderA_App_Data, void *, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_ReaderA_Fwi_Sfgt, void *, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_ReaderB_Get_PipeID, phHciNfc_sContext_t *, uint8_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_ReaderB_Update_Info, phHciNfc_sContext_t *, uint8_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_ReaderB_Info_Sequence, void *, void *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_ReaderB_Set_AFI, void *, void *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_ReaderB_Set_LayerData, void *, void *, phNfc_sData_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_ReaderMgmt_Info_Sequence, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_ReaderMgmt_Release, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHciNfc_Send_RFReader_Event, phHciNfc_sContext_t *, void *, uint8_t, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_ReaderMgmt_Disable_Discovery, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_ReaderMgmt_Enable_Discovery, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phHciNfc_Send_RFReader_Command, phHciNfc_sContext_t *, void *, uint8_t, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_ReaderMgmt_UICC_Dispatch, phHciNfc_sContext_t *, void *, phHal_eRemDevType_t);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phHciNfc_FSM_Validate, phHciNfc_sContext_t *, phHciNfc_eState_t, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_Initialise_Sequence, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_Connect_Sequence, phHciNfc_sContext_t *, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_SWP_Get_PipeID, phHciNfc_sContext_t *, uint8_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_WI_Get_PipeID, phHciNfc_sContext_t *, uint8_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phHciNfc_WI_Get_Default, void *, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phLlcNfc_Release, void *, void *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(libnfc_so, phLlcNfc_TimerUnInit, phLlcNfc_Context_t *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(libnfc_so, phLlcNfc_H_Frame_DeInit, phLlcNfc_Frame_t *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phLlcNfc_Interface_Read, phLlcNfc_Context_t *, uint8_t, uint8_t *, uint32_t);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phLlcNfc_H_CreateIFramePayload, phLlcNfc_Frame_t *, phLlcNfc_LlcPacket_t *, uint8_t *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phLlcNfc_H_StoreIFrame, phLlcNfc_StoreIFrame_t *, phLlcNfc_LlcPacket_t);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phLlcNfc_Interface_Write, phLlcNfc_Context_t *, uint8_t *, uint32_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phLlcNfc_StartTimers, uint8_t, uint8_t);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(libnfc_so, phLlcNfc_H_Frame_Init, phLlcNfc_Context_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phLlcNfc_Interface_Init, phLlcNfc_Context_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phLlcNfc_TimerInit, phLlcNfc_Context_t *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION0(libnfc_so, phLlcNfc_CreateTimers);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phLlcNfc_H_CreateUFramePayload, phLlcNfc_Context_t *, phLlcNfc_LlcPacket_t *, uint8_t *, phLlcNfc_LlcCmd_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phLlcNfc_Interface_Register, phLlcNfc_Context_t *, phNfcLayer_sCfg_t *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(libnfc_so, phLlcNfc_H_ComputeCrc, uint8_t *, uint8_t, uint8_t *, uint8_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phLlcNfc_H_SendTimedOutIFrame, phLlcNfc_Context_t *, phLlcNfc_StoreIFrame_t *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phLlcNfc_H_SendUserIFrame, phLlcNfc_Context_t *, phLlcNfc_StoreIFrame_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phLlcNfc_H_SendRejectedIFrame, phLlcNfc_Context_t *, phLlcNfc_StoreIFrame_t *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phLlcNfc_H_CreateSFramePayload, phLlcNfc_Frame_t *, phLlcNfc_LlcPacket_t *, phLlcNfc_LlcCmd_t);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phLlcNfc_H_SendRSETFrame, phLlcNfc_Context_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phLlcNfc_H_WriteWaitCall, phLlcNfc_Context_t *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(libnfc_so, phLlcNfc_H_ProcessIFrame, phLlcNfc_Context_t *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phLlcNfc_StopTimers, uint8_t, uint8_t);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(libnfc_so, phLlcNfc_H_SendInfo, phLlcNfc_Context_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phLlcNfc_H_ProRecvFrame, phLlcNfc_Context_t *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION0(libnfc_so, phLlcNfc_StopAllTimers);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phLlcNfc_H_ChangeState, phLlcNfc_Context_t *, phLlcNfc_State_t);
+HYBRIS_IMPLEMENT_VOID_FUNCTION0(libnfc_so, phLlcNfc_DeleteTimer);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, uint32_t, phFriNfc_Llcp_Header2Buffer, phFriNfc_Llcp_sPacketHeader_t *, uint8_t *, uint32_t);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, uint32_t, phFriNfc_Llcp_Sequence2Buffer, phFriNfc_Llcp_sPacketSequence_t *, uint8_t *, uint32_t);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_LlcpMac_Send, phFriNfc_LlcpMac_t *, phNfc_sData_t *, phFriNfc_LlcpMac_Send_CB_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_LlcpMac_Deactivate, phFriNfc_LlcpMac_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, uint32_t, phFriNfc_Llcp_Buffer2Header, uint8_t *, uint32_t, phFriNfc_Llcp_sPacketHeader_t *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_Llcp_DecodeTLV, phNfc_sData_t *, uint32_t *, uint8_t *, phNfc_sData_t *);
+HYBRIS_IMPLEMENT_FUNCTION5(libnfc_so, NFCSTATUS, phFriNfc_Llcp_EncodeTLV, phNfc_sData_t *, uint32_t *, uint8_t, uint8_t, uint8_t *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_LlcpMac_Receive, phFriNfc_LlcpMac_t *, phNfc_sData_t *, phFriNfc_LlcpMac_Reveive_CB_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_LlcpMac_Reset, phFriNfc_LlcpMac_t *, void *, phFriNfc_LlcpMac_LinkStatus_CB_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_LlcpMac_ChkLlcp, phFriNfc_LlcpMac_t *, phHal_sRemoteDevInformation_t *, phFriNfc_LlcpMac_Chk_CB_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_LlcpMac_Activate, phFriNfc_LlcpMac_t *);
+HYBRIS_IMPLEMENT_FUNCTION6(libnfc_so, NFCSTATUS, phFriNfc_Llcp_Send, phFriNfc_Llcp_t *, phFriNfc_Llcp_sPacketHeader_t *, phFriNfc_Llcp_sPacketSequence_t *, phNfc_sData_t *, phFriNfc_Llcp_Send_CB_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phFriNfc_Llcp_Recv, phFriNfc_Llcp_t *, phFriNfc_Llcp_Recv_CB_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION5(libnfc_so, NFCSTATUS, phFriNfc_Llcp_AppendTLV, phNfc_sData_t *, uint32_t, uint32_t *, uint8_t, uint8_t *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phFriNfc_Llcp_EncodeMIUX, uint16_t, uint8_t *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(libnfc_so, phFriNfc_Llcp_EncodeRW, uint8_t *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(libnfc_so, phFriNfc_Llcp_CyclicFifoInit, P_UTIL_FIFO_BUFFER, const uint8_t *, uint32_t);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(libnfc_so, phFriNfc_Llcp_CyclicFifoClear, P_UTIL_FIFO_BUFFER);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, uint32_t, phFriNfc_Llcp_CyclicFifoWrite, P_UTIL_FIFO_BUFFER, uint8_t *, uint32_t);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, uint32_t, phFriNfc_Llcp_CyclicFifoFifoRead, P_UTIL_FIFO_BUFFER, uint8_t *, uint32_t);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, uint32_t, phFriNfc_Llcp_CyclicFifoUsage, P_UTIL_FIFO_BUFFER);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, uint32_t, phFriNfc_Llcp_CyclicFifoAvailable, P_UTIL_FIFO_BUFFER);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, uint32_t, phFriNfc_Llcp_Buffer2Sequence, uint8_t *, uint32_t, phFriNfc_Llcp_sPacketSequence_t *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION5(libnfc_so, Handle_ConnectionOriented_IncommingFrame, phFriNfc_LlcpTransport_t *, phNfc_sData_t *, uint8_t, uint8_t, uint8_t);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(libnfc_so, Handle_Connectionless_IncommingFrame, phFriNfc_LlcpTransport_t *, phNfc_sData_t *, uint8_t, uint8_t);
+#if ANDROID_VERSION_MAJOR>=4 && ANDROID_VERSION_MINOR>=3
+/* see libnfc-nxp commit 7c4b4fad -- since Android 4.3 */
+HYBRIS_IMPLEMENT_FUNCTION7(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_LinkSend, phFriNfc_LlcpTransport_t *, phFriNfc_Llcp_sPacketHeader_t *, phFriNfc_Llcp_sPacketSequence_t *, phNfc_sData_t *, phFriNfc_Llcp_LinkSend_CB_t, uint8_t, void *);
+#else
+HYBRIS_IMPLEMENT_FUNCTION6(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_LinkSend, phFriNfc_LlcpTransport_t *, phFriNfc_Llcp_sPacketHeader_t *, phFriNfc_Llcp_sPacketSequence_t *, phNfc_sData_t *, phFriNfc_Llcp_Send_CB_t, void *);
+#endif
+HYBRIS_IMPLEMENT_FUNCTION13(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_SendFrameReject, phFriNfc_LlcpTransport_t *, uint8_t, uint8_t, uint8_t, phFriNfc_Llcp_sPacketSequence_t *, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_ConnectionOriented_Close, phFriNfc_LlcpTransport_Socket_t *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_SendDisconnectMode, phFriNfc_LlcpTransport_t *, uint8_t, uint8_t, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_ConnectionOriented_HandlePendingOperations, phFriNfc_LlcpTransport_Socket_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_Connectionless_HandlePendingOperations, phFriNfc_LlcpTransport_Socket_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_ConnectionOriented_SocketGetLocalOptions, phFriNfc_LlcpTransport_Socket_t *, phLibNfc_Llcp_sSocketOptions_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_ConnectionOriented_SocketGetRemoteOptions, phFriNfc_LlcpTransport_Socket_t *, phLibNfc_Llcp_sSocketOptions_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_Connectionless_Close, phFriNfc_LlcpTransport_Socket_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_ConnectionOriented_Listen, phFriNfc_LlcpTransport_Socket_t *, pphFriNfc_LlcpTransportSocketListenCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION6(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_ConnectionOriented_Accept, phFriNfc_LlcpTransport_Socket_t *, phFriNfc_LlcpTransport_sSocketOptions_t *, phNfc_sData_t *, pphFriNfc_LlcpTransportSocketErrCb_t, pphFriNfc_LlcpTransportSocketAcceptCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phLibNfc_LlcpTransport_ConnectionOriented_Reject, phFriNfc_LlcpTransport_Socket_t *, pphFriNfc_LlcpTransportSocketRejectCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION5(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_ConnectionOriented_Connect, phFriNfc_LlcpTransport_Socket_t *, uint8_t, phNfc_sData_t *, pphFriNfc_LlcpTransportSocketConnectCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phLibNfc_LlcpTransport_ConnectionOriented_Disconnect, phFriNfc_LlcpTransport_Socket_t *, pphLibNfc_LlcpSocketDisconnectCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_ConnectionOriented_Send, phFriNfc_LlcpTransport_Socket_t *, phNfc_sData_t *, pphFriNfc_LlcpTransportSocketSendCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_ConnectionOriented_Recv, phFriNfc_LlcpTransport_Socket_t *, phNfc_sData_t *, pphFriNfc_LlcpTransportSocketRecvCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION5(libnfc_so, NFCSTATUS, phFriNfc_LlcpTransport_Connectionless_SendTo, phFriNfc_LlcpTransport_Socket_t *, uint8_t, phNfc_sData_t *, pphFriNfc_LlcpTransportSocketSendCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phLibNfc_LlcpTransport_Connectionless_RecvFrom, phFriNfc_LlcpTransport_Socket_t *, phNfc_sData_t *, pphFriNfc_LlcpTransportSocketRecvFromCb_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION6(libnfc_so, NFCSTATUS, phFriNfc_LlcpConnTransport_Send, phFriNfc_Llcp_t *, phFriNfc_Llcp_sPacketHeader_t *, phFriNfc_Llcp_sPacketSequence_t *, phNfc_sData_t *, phFriNfc_Llcp_Send_CB_t, phFriNfc_LlcpTransport_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_LlcpMac_Nfcip_Register, phFriNfc_LlcpMac_t *);
+HYBRIS_IMPLEMENT_FUNCTION9(libnfc_so, NFCSTATUS, phFriNfc_OvrHal_Transceive, phFriNfc_OvrHal_t *, phFriNfc_CplRt_t *, phHal_sRemoteDevInformation_t *, phHal_uCmdList_t, phHal_sDepAdditionalInfo_t *, uint8_t *, uint16_t, uint8_t *, uint16_t *);
+HYBRIS_IMPLEMENT_FUNCTION5(libnfc_so, NFCSTATUS, phFriNfc_OvrHal_Receive, phFriNfc_OvrHal_t *, phFriNfc_CplRt_t *, phHal_sRemoteDevInformation_t *, uint8_t *, uint16_t *);
+HYBRIS_IMPLEMENT_FUNCTION5(libnfc_so, NFCSTATUS, phFriNfc_OvrHal_Send, phFriNfc_OvrHal_t *, phFriNfc_CplRt_t *, phHal_sRemoteDevInformation_t *, uint8_t *, uint16_t);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phFriNfc_NdefMap_Process, void *, NFCSTATUS);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phFriNfc_Felica_Process, void *, NFCSTATUS);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phFriNfc_MapTool_ChkSpcVer, const phFriNfc_NdefMap_t *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phFriNfc_MapTool_SetCardState, phFriNfc_NdefMap_t *, uint32_t);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_Felica_RdNdef, phFriNfc_NdefMap_t *, uint8_t *, uint32_t *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_Felica_WrNdef, phFriNfc_NdefMap_t *, uint8_t *, uint32_t *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_Felica_EraseNdef, phFriNfc_NdefMap_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_Felica_ChkNdef, phFriNfc_NdefMap_t *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phFriNfc_MifareStdMap_Process, void *, NFCSTATUS);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_MifareStdMap_H_Reset, phFriNfc_NdefMap_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_MifareStdMap_ChkNdef, phFriNfc_NdefMap_t *);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, NFCSTATUS, phFriNfc_OvrHal_Reconnect, phFriNfc_OvrHal_t *, phFriNfc_CplRt_t *, phHal_sRemoteDevInformation_t *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_OvrHal_Connect, phFriNfc_OvrHal_t *, phFriNfc_CplRt_t *, phHal_sRemoteDevInformation_t *, phHal_sDevInputParam_t *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_MifareStdMap_RdNdef, phFriNfc_NdefMap_t *, uint8_t *, uint32_t *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_MifareStdMap_WrNdef, phFriNfc_NdefMap_t *, uint8_t *, uint32_t *, uint8_t);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phFriNfc_MifareUL_Process, void *, NFCSTATUS);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_MifareUL_H_Reset, phFriNfc_NdefMap_t *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_MifareUL_RdNdef, phFriNfc_NdefMap_t *, uint8_t *, uint32_t *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_MifareUL_WrNdef, phFriNfc_NdefMap_t *, uint8_t *, uint32_t *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_MifareUL_ChkNdef, phFriNfc_NdefMap_t *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phFriNfc_TopazMap_Process, void *, NFCSTATUS);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(libnfc_so, phFriNfc_TopazMap_H_Reset, phFriNfc_NdefMap_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_TopazMap_ChkNdef, phFriNfc_NdefMap_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_TopazMap_ConvertToReadOnly, phFriNfc_NdefMap_t *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_TopazMap_RdNdef, phFriNfc_NdefMap_t *, uint8_t *, uint32_t *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_TopazMap_WrNdef, phFriNfc_NdefMap_t *, uint8_t *, uint32_t *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phFriNfc_Tpz_H_ChkSpcVer, phFriNfc_NdefMap_t *, uint8_t);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phFriNfc_TopazDynamicMap_Process, void *, NFCSTATUS);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_TopazDynamicMap_ChkNdef, phFriNfc_NdefMap_t *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_TopazDynamicMap_RdNdef, phFriNfc_NdefMap_t *, uint8_t *, uint32_t *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_TopazDynamicMap_ConvertToReadOnly, phFriNfc_NdefMap_t *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_TopazDynamicMap_WrNdef, phFriNfc_NdefMap_t *, uint8_t *, uint32_t *, uint8_t);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phFriNfc_Desfire_Process, void *, NFCSTATUS);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_Desfire_RdNdef, phFriNfc_NdefMap_t *, uint8_t *, uint32_t *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_Desfire_WrNdef, phFriNfc_NdefMap_t *, uint8_t *, uint32_t *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_Desfire_ChkNdef, phFriNfc_NdefMap_t *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phFriNfc_ISO15693_Process, void *, NFCSTATUS);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_ISO15693_ChkNdef, phFriNfc_NdefMap_t *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_ISO15693_RdNdef, phFriNfc_NdefMap_t *, uint8_t *, uint32_t *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phFriNfc_ISO15693_WrNdef, phFriNfc_NdefMap_t *, uint8_t *, uint32_t *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_ISO15693_ConvertToReadOnly, phFriNfc_NdefMap_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phFriNfc_NdefMap_SetCardState, phFriNfc_NdefMap_t *, uint16_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phFriNfc_NdefMap_CheckSpecVersion, phFriNfc_NdefMap_t *, uint8_t);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, int16_t, phFriNfc_NdefReg_Strnicmp, const int8_t *, const int8_t *, uint32_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phFriNfc_NdefReg_DispatchRecord, phFriNfc_NdefReg_t *, phFriNfc_NdefRecord_t *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phFriNfc_NdefSmtCrd_Process, void *, NFCSTATUS);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(libnfc_so, phFriNfc_Desfire_Reset, phFriNfc_sNdefSmtCrdFmt_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_Desfire_Format, phFriNfc_sNdefSmtCrdFmt_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_Desfire_ConvertToReadOnly, phFriNfc_sNdefSmtCrdFmt_t *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phFriNfc_Desf_Process, void *, NFCSTATUS);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phFriNfc_SmtCrdFmt_HCrHandler, phFriNfc_sNdefSmtCrdFmt_t *, NFCSTATUS);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(libnfc_so, phFriNfc_MfUL_Reset, phFriNfc_sNdefSmtCrdFmt_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_MfUL_Format, phFriNfc_sNdefSmtCrdFmt_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_MfUL_ConvertToReadOnly, phFriNfc_sNdefSmtCrdFmt_t *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phFriNfc_MfUL_Process, void *, NFCSTATUS);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(libnfc_so, phFriNfc_MfStd_Reset, phFriNfc_sNdefSmtCrdFmt_t *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phFriNfc_MfStd_Format, phFriNfc_sNdefSmtCrdFmt_t *, const uint8_t *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phFriNfc_MfStd_Process, void *, NFCSTATUS);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(libnfc_so, phFriNfc_ISO15693_FmtReset, phFriNfc_sNdefSmtCrdFmt_t *);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, NFCSTATUS, phFriNfc_ISO15693_Format, phFriNfc_sNdefSmtCrdFmt_t *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phFriNfc_ISO15693_FmtProcess, void *, NFCSTATUS);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(libnfc_so, phOsalNfc_Timer_DeferredCall, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, int, phDal4Nfc_msgsnd, int, void *, size_t, int);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(libnfc_so, phOsalNfc_DbgString, const char *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phOsalNfc_DbgTrace, uint8_t *, uint32_t);
+HYBRIS_IMPLEMENT_VOID_FUNCTION4(libnfc_so, phOsalNfc_PrintData, const char *, uint32_t, uint8_t *, int);
+HYBRIS_IMPLEMENT_VOID_FUNCTION0(libnfc_so, phDal4Nfc_uart_initialize);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(libnfc_so, phDal4Nfc_uart_set_open_from_handle, phHal_sHwReference_t *);
+HYBRIS_IMPLEMENT_FUNCTION0(libnfc_so, int, phDal4Nfc_uart_is_opened);
+HYBRIS_IMPLEMENT_VOID_FUNCTION0(libnfc_so, phDal4Nfc_uart_flush);
+HYBRIS_IMPLEMENT_VOID_FUNCTION0(libnfc_so, phDal4Nfc_uart_close);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phDal4Nfc_uart_open_and_configure, pphDal4Nfc_sConfig_t, void **);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, int, phDal4Nfc_uart_read, uint8_t *, int);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, int, phDal4Nfc_uart_write, uint8_t *, int);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, int, phDal4Nfc_uart_reset, long);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phDal4Nfc_Shutdown, void *, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phDal4Nfc_ReadWait, void *, void *, uint8_t *, uint16_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phDal4Nfc_ReadWaitCancel, void *, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phDal4Nfc_Read, void *, void *, uint8_t *, uint16_t);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phDal4Nfc_Init, void *, void *);
+HYBRIS_IMPLEMENT_FUNCTION4(libnfc_so, NFCSTATUS, phDal4Nfc_Write, void *, void *, uint8_t *, uint16_t);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, int, phDal4Nfc_ReaderThread, void *);
+HYBRIS_IMPLEMENT_VOID_FUNCTION0(libnfc_so, phDal4Nfc_i2c_initialize);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(libnfc_so, phDal4Nfc_i2c_set_open_from_handle, phHal_sHwReference_t *);
+HYBRIS_IMPLEMENT_FUNCTION0(libnfc_so, int, phDal4Nfc_i2c_is_opened);
+HYBRIS_IMPLEMENT_VOID_FUNCTION0(libnfc_so, phDal4Nfc_i2c_flush);
+HYBRIS_IMPLEMENT_VOID_FUNCTION0(libnfc_so, phDal4Nfc_i2c_close);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, NFCSTATUS, phDal4Nfc_i2c_open_and_configure, pphDal4Nfc_sConfig_t, void **);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, int, phDal4Nfc_i2c_read, uint8_t *, int);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, int, phDal4Nfc_i2c_write, uint8_t *, int);
+HYBRIS_IMPLEMENT_FUNCTION1(libnfc_so, int, phDal4Nfc_i2c_reset, long);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(libnfc_so, phDal4Nfc_DeferredCall, pphDal4Nfc_DeferFuncPointer_t, void *);
+HYBRIS_IMPLEMENT_FUNCTION2(libnfc_so, int, phDal4Nfc_msgget, key_t, int);
+HYBRIS_IMPLEMENT_FUNCTION3(libnfc_so, int, phDal4Nfc_msgctl, int, int, void *);
+HYBRIS_IMPLEMENT_FUNCTION5(libnfc_so, int, phDal4Nfc_msgrcv, int, void *, size_t, long, int);
+/* XXX No prototype for exported symbol: __on_dlclose */
--- /dev/null
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libnfc_nxp
+Description: libhybris NFC library (NXP variant)
+Version: @VERSION@
+Libs: -L${libdir} -lnfc_nxp
+Cflags: -I${includedir}
--- /dev/null
+lib_LTLIBRARIES = \
+ libsync.la
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libsync.pc
+
+libsync_la_SOURCES = sync.c
+libsync_la_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/include/android
+if WANT_TRACE
+libsync_la_CFLAGS += -DDEBUG
+endif
+if WANT_DEBUG
+libsync_la_CFLAGS += -ggdb -O0
+endif
+libsync_la_LDFLAGS = \
+ -version-info "2":"0":"0"
--- /dev/null
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=@includedir@
+
+Name: hybris-sync
+Description: libhybris sync library
+Version: @VERSION@
+Libs: -L${libdir} -lsync
+Cflags: -I${includedir}
--- /dev/null
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=@includedir@
+
+Name: hybris-sync
+Description: libhybris sync library
+Version: @VERSION@
+Libs: -L${libdir} -lsync
+Cflags: -I${includedir}
--- /dev/null
+/*
+ * sync.c
+ *
+ * Copyright 2012 Google, Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <fcntl.h>
+#include <stdint.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <linux/sync.h>
+#include <linux/sw_sync.h>
+
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+int sync_wait(int fd, int timeout)
+{
+ __s32 to = timeout;
+
+ return ioctl(fd, SYNC_IOC_WAIT, &to);
+}
+
+int sync_merge(const char *name, int fd1, int fd2)
+{
+ struct sync_merge_data data;
+ int err;
+
+ data.fd2 = fd2;
+ strlcpy(data.name, name, sizeof(data.name));
+
+ err = ioctl(fd1, SYNC_IOC_MERGE, &data);
+ if (err < 0)
+ return err;
+
+ return data.fence;
+}
+
+struct sync_fence_info_data *sync_fence_info(int fd)
+{
+ struct sync_fence_info_data *info;
+ int err;
+
+ info = malloc(4096);
+ if (info == NULL)
+ return NULL;
+
+ info->len = 4096;
+ err = ioctl(fd, SYNC_IOC_FENCE_INFO, info);
+ if (err < 0) {
+ free(info);
+ return NULL;
+ }
+
+ return info;
+}
+
+struct sync_pt_info *sync_pt_info(struct sync_fence_info_data *info,
+ struct sync_pt_info *itr)
+{
+ if (itr == NULL)
+ itr = (struct sync_pt_info *) info->pt_info;
+ else
+ itr = (struct sync_pt_info *) ((__u8 *)itr + itr->len);
+
+ if ((__u8 *)itr - (__u8 *)info >= (int)info->len)
+ return NULL;
+
+ return itr;
+}
+
+void sync_fence_info_free(struct sync_fence_info_data *info)
+{
+ free(info);
+}
+
+
+int sw_sync_timeline_create(void)
+{
+ return open("/dev/sw_sync", O_RDWR);
+}
+
+int sw_sync_timeline_inc(int fd, unsigned count)
+{
+ __u32 arg = count;
+
+ return ioctl(fd, SW_SYNC_IOC_INC, &arg);
+}
+
+int sw_sync_fence_create(int fd, const char *name, unsigned value)
+{
+ struct sw_sync_create_fence_data data;
+ int err;
+
+ data.value = value;
+ strlcpy(data.name, name, sizeof(data.name));
+
+ err = ioctl(fd, SW_SYNC_IOC_CREATE_FENCE, &data);
+ if (err < 0)
+ return err;
+
+ return data.fence;
+}
--- /dev/null
+/*
+ * sync_test.c
+ *
+ * Copyright 2012 Google, Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <sync/sync.h>
+
+pthread_mutex_t printf_mutex = PTHREAD_MUTEX_INITIALIZER;
+
+struct sync_thread_data {
+ int thread_no;
+ int fd[2];
+};
+
+void *sync_thread(void *data)
+{
+ struct sync_thread_data *sync_data = data;
+ struct sync_fence_info_data *info;
+ int err;
+ int i;
+
+ for (i = 0; i < 2; i++) {
+ err = sync_wait(sync_data->fd[i], 10000);
+
+ pthread_mutex_lock(&printf_mutex);
+ if (err < 0) {
+ printf("thread %d wait %d failed: %s\n", sync_data->thread_no,
+ i, strerror(errno));
+ } else {
+ printf("thread %d wait %d done\n", sync_data->thread_no, i);
+ }
+ info = sync_fence_info(sync_data->fd[i]);
+ if (info) {
+ struct sync_pt_info *pt_info = NULL;
+ printf(" fence %s %d\n", info->name, info->status);
+
+ while ((pt_info = sync_pt_info(info, pt_info))) {
+ int ts_sec = pt_info->timestamp_ns / 1000000000LL;
+ int ts_usec = (pt_info->timestamp_ns % 1000000000LL) / 1000LL;
+ printf(" pt %s %s %d %d.%06d", pt_info->obj_name,
+ pt_info->driver_name, pt_info->status,
+ ts_sec, ts_usec);
+ if (!strcmp(pt_info->driver_name, "sw_sync"))
+ printf(" val=%d\n", *(uint32_t *)pt_info->driver_data);
+ else
+ printf("\n");
+ }
+ sync_fence_info_free(info);
+ }
+ pthread_mutex_unlock(&printf_mutex);
+ }
+
+ return NULL;
+}
+
+int main(int argc __attribute__((unused)), char *argv[] __attribute__((unused)))
+{
+ struct sync_thread_data sync_data[4];
+ pthread_t threads[4];
+ int sync_timeline_fd;
+ int i, j;
+ char str[256];
+
+ sync_timeline_fd = sw_sync_timeline_create();
+ if (sync_timeline_fd < 0) {
+ perror("can't create sw_sync_timeline:");
+ return 1;
+ }
+
+ for (i = 0; i < 3; i++) {
+ sync_data[i].thread_no = i;
+
+ for (j = 0; j < 2; j++) {
+ unsigned val = i + j * 3 + 1;
+ sprintf(str, "test_fence%d-%d", i, j);
+ int fd = sw_sync_fence_create(sync_timeline_fd, str, val);
+ if (fd < 0) {
+ printf("can't create sync pt %d: %s", val, strerror(errno));
+ return 1;
+ }
+ sync_data[i].fd[j] = fd;
+ printf("sync_data[%d].fd[%d] = %d;\n", i, j, fd);
+
+ }
+ }
+
+ sync_data[3].thread_no = 3;
+ for (j = 0; j < 2; j++) {
+ sprintf(str, "merged_fence%d", j);
+ sync_data[3].fd[j] = sync_merge(str, sync_data[0].fd[j], sync_data[1].fd[j]);
+ if (sync_data[3].fd[j] < 0) {
+ printf("can't merge sync pts %d and %d: %s\n",
+ sync_data[0].fd[j], sync_data[1].fd[j], strerror(errno));
+ return 1;
+ }
+ }
+
+ for (i = 0; i < 4; i++)
+ pthread_create(&threads[i], NULL, sync_thread, &sync_data[i]);
+
+
+ for (i = 0; i < 3; i++) {
+ int err;
+ printf("press enter to inc to %d\n", i+1);
+ fgets(str, sizeof(str), stdin);
+ err = sw_sync_timeline_inc(sync_timeline_fd, 1);
+ if (err < 0) {
+ perror("can't increment sync obj:");
+ return 1;
+ }
+ }
+
+ printf("press enter to close sync_timeline\n");
+ fgets(str, sizeof(str), stdin);
+
+ close(sync_timeline_fd);
+
+ printf("press enter to end test\n");
+ fgets(str, sizeof(str), stdin);
+
+ for (i = 0; i < 3; i++) {
+ void *val;
+ pthread_join(threads[i], &val);
+ }
+
+ return 0;
+}
--- /dev/null
+lib_LTLIBRARIES = \
+ libandroid-properties.la
+
+libandroid_properties_la_SOURCES = properties.c cache.c
+libandroid_properties_la_CFLAGS = -I$(top_srcdir)/include
+if WANT_DEBUG
+libandroid_properties_la_CFLAGS += -ggdb -O0
+endif
+libandroid_properties_la_LDFLAGS = \
+ -version-info "1":"0":"0"
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libandroid-properties.pc
--- /dev/null
+/*
+ * Copyright (c) 2012 Carsten Munk <carsten.munk@gmail.com>
+ * Copyright (c) 2008 The Android Open Source Project
+ * Copyright (c) 2013 Simon Busch <morphis@gravedo.de>
+ * Copyright (c) 2013 Canonical Ltd
+ * Copyright (c) 2013 Jolla Ltd. <robin.burchell@jollamobile.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+#include <hybris/properties/properties.h>
+#include "properties_p.h"
+
+struct hybris_prop_value
+{
+ char *key;
+ char *value;
+};
+
+/* surely enough for anyone */
+#define MAX_PROPS 1000
+
+/* the sorted prop array */
+static struct hybris_prop_value prop_array[MAX_PROPS];
+
+/* the current highest index in prop_array */
+static int max_prop;
+
+/* helpers */
+static int prop_qcmp(const void *a, const void *b);
+static struct hybris_prop_value *cache_find_internal(const char *key);
+static void cache_add_internal(const char *key, const char *value);
+static void cache_repopulate_internal(FILE *f);
+static void cache_empty_internal();
+static void cache_repopulate_cmdline_internal();
+
+/* the inode/mtime of the prop cache, used for invalidation */
+static ino_t static_prop_inode;
+static time_t static_prop_mtime;
+
+
+/* public:
+ * find a prop value from the file cache.
+ *
+ * the return value is the value of the given property key, or NULL if the
+ * property key is not found. the returned value is owned by the caller,
+ * and must be freed.
+ */
+char *hybris_propcache_find(const char *key)
+{
+ struct stat st;
+ FILE *f = fopen("/system/build.prop", "r");
+ char *ret = NULL;
+
+ if (!f)
+ return NULL;
+
+ /* before searching, we must first determine whether our cache is valid. if
+ * it isn't, we must discard our results and re-create the cache.
+ *
+ * we use fstat here to avoid a race between stat and something else
+ * touching the file.
+ */
+ if (fstat(fileno(f), &st) != 0) {
+ perror("cache_find can't stat build.prop");
+ goto out;
+ }
+
+ /* TODO: is there any better way to detect changes? */
+ if (static_prop_inode != st.st_ino ||
+ static_prop_mtime != st.st_mtime) {
+ static_prop_inode = st.st_ino;
+ static_prop_mtime = st.st_mtime;
+
+ /* cache is stale. fill it back up with fresh data first. */
+ cache_empty_internal();
+ cache_repopulate_internal(f);
+ cache_repopulate_cmdline_internal();
+
+ /* sort by keys */
+ qsort(prop_array, max_prop, sizeof(struct hybris_prop_value), prop_qcmp);
+ }
+
+ /* then look up the key and do a copy if we get a result */
+ struct hybris_prop_value *prop = cache_find_internal(key);
+ if (prop)
+ ret = strdup(prop->value);
+
+out:
+ fclose(f);
+ return ret;
+}
+
+/* private:
+ * empties the prop cache, ready for repopulation
+ */
+static void cache_empty_internal()
+{
+ int i;
+ for (i = 0; i < max_prop; ++i) {
+ free(prop_array[i].key);
+ free(prop_array[i].value);
+ }
+
+ max_prop = 0;
+}
+
+/* private:
+ * compares two hybris_prop_value by key, so as to maintain a qsorted array of
+ * props, and search the array.
+ */
+static int prop_qcmp(const void *a, const void *b)
+{
+ struct hybris_prop_value *aa = (struct hybris_prop_value *)a;
+ struct hybris_prop_value *bb = (struct hybris_prop_value *)b;
+
+ return strcmp(aa->key, bb->key);
+}
+
+/* private:
+ * find a given key in the in-memory prop cache.
+ *
+ * returns the value of the given property key, or NULL if the property is not
+ * found. Note that this does not pass ownership of the hybris_prop_value or the
+ * data inside it.
+ */
+static struct hybris_prop_value *cache_find_internal(const char *key)
+{
+ struct hybris_prop_value prop_key;
+ prop_key.key = (char*)key;
+
+ return bsearch(&prop_key, prop_array, max_prop, sizeof(struct hybris_prop_value), prop_qcmp);
+}
+
+/* private:
+ * add a given property to the in-memory prop cache for later retrieval.
+ *
+ * both `key' and `value' are copied from the caller.
+ */
+static void cache_add_internal(const char *key, const char *value)
+{
+ /* Skip values that can be bigger than value max */
+ if (strlen(value) >= PROP_VALUE_MAX -1)
+ return;
+
+ /* preserve current behavior of first prop key => match */
+ if (cache_find_internal(key))
+ return;
+
+ prop_array[max_prop].key = strdup(key);
+ prop_array[max_prop++].value = strdup(value);
+
+ if (max_prop >= MAX_PROPS) {
+ fprintf(stderr, "libhybris: ran out of props, increase MAX_PROPS");
+ exit(1);
+ }
+}
+
+/* private:
+ * repopulates the prop cache from a given file `f'.
+ */
+static void cache_repopulate_internal(FILE *f)
+{
+ char buf[1024];
+ char *mkey, *value;
+
+ while (fgets(buf, 1024, f) != NULL) {
+ if (strchr(buf, '\r'))
+ *(strchr(buf, '\r')) = '\0';
+ if (strchr(buf, '\n'))
+ *(strchr(buf, '\n')) = '\0';
+
+ mkey = strtok(buf, "=");
+
+ if (!mkey)
+ continue;
+
+ value = strtok(NULL, "=");
+ if (!value)
+ continue;
+
+ cache_add_internal(mkey, value);
+ }
+}
+
+/* private:
+ * repopulate the prop cache from /proc/cmdline
+ */
+static void cache_repopulate_cmdline_internal()
+{
+ /* Find a key value from the kernel command line, which is parsed
+ * by Android at init (on an Android working system) */
+ char cmdline[1024];
+ char *ptr;
+ int fd;
+
+ fd = open("/proc/cmdline", O_RDONLY);
+ if (fd >= 0) {
+ int n = read(fd, cmdline, 1023);
+ if (n < 0) n = 0;
+
+ /* get rid of trailing newline, it happens */
+ if (n > 0 && cmdline[n-1] == '\n') n--;
+
+ cmdline[n] = 0;
+ close(fd);
+ } else {
+ cmdline[0] = 0;
+ }
+
+ ptr = cmdline;
+
+ while (ptr && *ptr) {
+ char *x = strchr(ptr, ' ');
+ if (x != 0) *x++ = 0;
+
+ char *name = ptr;
+ ptr = x;
+
+ char *value = strchr(name, '=');
+ int name_len = strlen(name);
+
+ if (value == 0) continue;
+ *value++ = 0;
+ if (name_len == 0) continue;
+
+ if (!strncmp(name, "androidboot.", 12) && name_len > 12) {
+ const char *boot_prop_name = name + 12;
+ char prop[PROP_NAME_MAX];
+ snprintf(prop, sizeof(prop) -1, "ro.%s", boot_prop_name);
+
+ cache_add_internal(prop, value);
+ }
+ }
+}
--- /dev/null
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=@includedir@
+
+Name: android-properties
+Description: android properties library
+Version: @VERSION@
+Libs: -L${libdir} -landroid-properties
+Cflags: -I${includedir}
--- /dev/null
+/*
+ * Copyright (c) 2012 Carsten Munk <carsten.munk@gmail.com>
+ * 2008 The Android Open Source Project
+ * 2013 Simon Busch <morphis@gravedo.de>
+ * 2013 Canonical Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <stddef.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#define __USE_GNU
+#include <unistd.h>
+#include <errno.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <sys/select.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <poll.h>
+
+#include <hybris/properties/properties.h>
+#include "properties_p.h"
+
+
+static const char property_service_socket[] = "/dev/socket/" PROP_SERVICE_NAME;
+static int send_prop_msg_no_reply = 0;
+
+/* Get/Set a property from the Android Init property socket */
+static int send_prop_msg(prop_msg_t *msg,
+ void (*propfn)(const char *, const char *, void *),
+ void *cookie)
+{
+ struct pollfd pollfds[1];
+ union {
+ struct sockaddr_un addr;
+ struct sockaddr addr_g;
+ } addr;
+ socklen_t alen;
+ size_t namelen;
+ int s;
+ int r;
+ int result = -1;
+ int patched_init = 0;
+
+ /* if we tried to talk to the server in the past and didn't get a reply,
+ * it's fairly safe to say that init is not patched and this is all
+ * hopeless, so we should just quit while we're ahead
+ */
+ if (send_prop_msg_no_reply == 1)
+ return -EIO;
+
+ s = socket(AF_LOCAL, SOCK_STREAM, 0);
+ if (s < 0) {
+ return result;
+ }
+
+ memset(&addr, 0, sizeof(addr));
+ namelen = strlen(property_service_socket);
+ strncpy(addr.addr.sun_path, property_service_socket,
+ sizeof(addr.addr.sun_path));
+ addr.addr.sun_family = AF_LOCAL;
+ alen = namelen + offsetof(struct sockaddr_un, sun_path) + 1;
+
+ if (TEMP_FAILURE_RETRY(connect(s, &addr.addr_g, alen) < 0)) {
+ close(s);
+ return result;
+ }
+
+ r = TEMP_FAILURE_RETRY(send(s, msg, sizeof(prop_msg_t), 0));
+
+ if (r == sizeof(prop_msg_t)) {
+ pollfds[0].fd = s;
+ pollfds[0].events = 0;
+ // We successfully wrote to the property server, so use recv
+ // in case we need to get a property. Once the other side is
+ // finished, the socket is closed.
+ while ((r = recv(s, msg, sizeof(prop_msg_t), 0)) > 0) {
+ if (r != sizeof(prop_msg_t)) {
+ close(s);
+ return result;
+ }
+
+ /* If we got a reply, this is a patched init */
+ if (!patched_init)
+ patched_init = 1;
+
+ if (propfn)
+ propfn(msg->name, msg->value, cookie);
+ }
+
+ /* We also just get a close in case of setprop */
+ if ((r >= 0) && (patched_init ||
+ (msg->cmd == PROP_MSG_SETPROP))) {
+ result = 0;
+ } else {
+ send_prop_msg_no_reply = 1;
+ }
+ }
+
+ close(s);
+ return result;
+}
+
+int property_list(void (*propfn)(const char *key, const char *value, void *cookie),
+ void *cookie)
+{
+ int err;
+ prop_msg_t msg;
+
+ memset(&msg, 0, sizeof(msg));
+ msg.cmd = PROP_MSG_LISTPROP;
+
+ err = send_prop_msg(&msg, propfn, cookie);
+ if (err < 0) {
+ return err;
+ }
+
+ return 0;
+}
+
+static int property_get_socket(const char *key, char *value, const char *default_value)
+{
+ int err;
+ prop_msg_t msg;
+
+ memset(&msg, 0, sizeof(msg));
+ msg.cmd = PROP_MSG_GETPROP;
+
+ if (key) {
+ strncpy(msg.name, key, sizeof(msg.name));
+ err = send_prop_msg(&msg, NULL, NULL);
+ if (err < 0)
+ return err;
+ }
+
+ /* In case it's null, just use the default */
+ if ((strlen(msg.value) == 0) && (default_value)) {
+ if (strlen(default_value) >= PROP_VALUE_MAX -1) return -1;
+ strcpy(msg.value, default_value);
+ }
+
+ strcpy(value, msg.value);
+
+ return 0;
+}
+
+int property_get(const char *key, char *value, const char *default_value)
+{
+ char *ret = NULL;
+
+ if ((key) && (strlen(key) >= PROP_NAME_MAX -1)) return -1;
+ if (value == NULL) return -1;
+
+ if (property_get_socket(key, value, default_value) == 0)
+ return strlen(value);
+
+ /* In case the socket is not available, search the property file cache by hand */
+ ret = hybris_propcache_find(key);
+
+ if (ret) {
+ strcpy(value, ret);
+ free(ret);
+ return strlen(value);
+ } else if (default_value != NULL) {
+ strcpy(value, default_value);
+ return strlen(value);
+ } else {
+ value = '\0';
+ }
+
+ return 0;
+}
+
+int property_set(const char *key, const char *value)
+{
+ int err;
+ prop_msg_t msg;
+
+ if (key == 0) return -1;
+ if (value == 0) value = "";
+ if (strlen(key) >= PROP_NAME_MAX -1) return -1;
+ if (strlen(value) >= PROP_VALUE_MAX -1) return -1;
+
+ memset(&msg, 0, sizeof(msg));
+ msg.cmd = PROP_MSG_SETPROP;
+ strncpy(msg.name, key, sizeof(msg.name));
+ strncpy(msg.value, value, sizeof(msg.value));
+
+ err = send_prop_msg(&msg, NULL, NULL);
+ if (err < 0) {
+ return err;
+ }
+
+ return 0;
+}
+
+// vim:ts=4:sw=4:noexpandtab
--- /dev/null
+/*
+ * Copyright (c) 2013 Jolla Ltd. <robin.burchell@jollamobile.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef HYBRIS_PROPERTIES
+#define HYBRIS_PROPERTIES
+
+char *hybris_propcache_find(const char *key);
+
+#endif
--- /dev/null
+lib_LTLIBRARIES = \
+ libsf.la
+
+libsf_la_SOURCES = sf.c
+libsf_la_CFLAGS = -I$(top_srcdir)/include
+if WANT_TRACE
+libsf_la_CFLAGS += -DDEBUG
+endif
+if WANT_DEBUG
+libsf_la_CFLAGS += -ggdb -O0
+endif
+libsf_la_LDFLAGS = \
+ $(top_builddir)/common/libhybris-common.la \
+ -version-info "1":"0":"0"
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libsf.pc
--- /dev/null
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=@includedir@
+
+Name: hybris-surface-flinger
+Description: libhybris surface flinger library
+Version: @VERSION@
+Libs: -L${libdir} -lhybris-common -lsf
+Cflags: -I${includedir}
--- /dev/null
+/*
+ * Copyright (C) 2013 Canonical Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authored by: Michael Frey <michael.frey@canonical.com>
+ * Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
+ */
+
+#include <EGL/egl.h>
+#include <dlfcn.h>
+#include <stddef.h>
+
+#include <hybris/internal/binding.h>
+#include <hybris/surface_flinger/surface_flinger_compatibility_layer.h>
+
+#define COMPAT_LIBRARY_PATH "/system/lib/libsf_compat_layer.so"
+
+HYBRIS_LIBRARY_INITIALIZE(sf, COMPAT_LIBRARY_PATH);
+
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(sf, sf_blank, size_t);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(sf, sf_unblank, size_t);
+HYBRIS_IMPLEMENT_FUNCTION1(sf, size_t, sf_get_display_width, size_t);
+HYBRIS_IMPLEMENT_FUNCTION1(sf, size_t, sf_get_display_height, size_t);
+HYBRIS_IMPLEMENT_FUNCTION1(sf, struct SfClient*, sf_client_create_full, int);
+HYBRIS_IMPLEMENT_FUNCTION0(sf, struct SfClient*, sf_client_create);
+HYBRIS_IMPLEMENT_FUNCTION1(sf, EGLDisplay, sf_client_get_egl_display,
+ struct SfClient*);
+HYBRIS_IMPLEMENT_FUNCTION1(sf, EGLConfig, sf_client_get_egl_config,
+ struct SfClient*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(sf, sf_client_begin_transaction,
+ struct SfClient*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(sf, sf_client_end_transaction,
+ struct SfClient*);
+HYBRIS_IMPLEMENT_FUNCTION2(sf, struct SfSurface*, sf_surface_create,
+ struct SfClient*, SfSurfaceCreationParameters*);
+HYBRIS_IMPLEMENT_FUNCTION1(sf, EGLSurface, sf_surface_get_egl_surface,
+ struct SfSurface*);
+HYBRIS_IMPLEMENT_FUNCTION1(sf, EGLNativeWindowType,
+ sf_surface_get_egl_native_window, struct SfSurface*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(sf, sf_surface_make_current, struct SfSurface*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(sf, sf_surface_move_to,
+ struct SfSurface*, int, int);
+HYBRIS_IMPLEMENT_VOID_FUNCTION3(sf, sf_surface_set_size,
+ struct SfSurface*, int, int);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(sf, sf_surface_set_layer,
+ struct SfSurface*, int);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(sf, sf_surface_set_alpha,
+ struct SfSurface*, float);
--- /dev/null
+bin_PROGRAMS = \
+ test_egl \
+ test_egl_configs \
+ test_glesv2 \
+ test_ui \
+ test_sf \
+ test_sensors \
+ test_input \
+ test_camera \
+ test_gps
+
+if HAS_ANDROID_4_2_0
+bin_PROGRAMS += test_hwcomposer
+endif
+
+if HAS_LIBNFC_NXP_HEADERS
+bin_PROGRAMS += test_nfc
+endif
+
+# Please re-enable your test programs according to android
+# if HAS_ANDROID_X_Y_Z
+# bin_PROGRAMS += test_audio
+# endif
+
+test_audio_SOURCES = test_audio.c
+test_audio_CFLAGS = \
+ -I$(top_srcdir)/include
+test_audio_LDADD = \
+ $(top_builddir)/common/libhybris-common.la \
+ $(top_builddir)/hardware/libhardware.la
+
+test_egl_SOURCES = test_egl.c
+test_egl_CFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/include/android \
+ -I$(top_srcdir)/egl/platforms/common
+
+if WANT_MESA
+test_egl_CFLAGS += -DLIBHYBRIS_WANTS_MESA_X11_HEADERS
+endif
+test_egl_LDADD = \
+ $(top_builddir)/common/libhybris-common.la \
+ $(top_builddir)/egl/libEGL.la
+
+test_egl_configs_SOURCES = test_egl_configs.c
+test_egl_configs_CFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/include/android
+test_egl_configs_LDADD = \
+ $(top_builddir)/common/libhybris-common.la \
+ $(top_builddir)/egl/libEGL.la
+
+test_glesv2_SOURCES = test_glesv2.c
+test_glesv2_CFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/include/android
+if WANT_MESA
+test_glesv2_CFLAGS += -DLIBHYBRIS_WANTS_MESA_X11_HEADERS
+endif
+test_glesv2_LDADD = \
+ -lm \
+ $(top_builddir)/common/libhybris-common.la \
+ $(top_builddir)/egl/libEGL.la \
+ $(top_builddir)/glesv2/libGLESv2.la
+
+test_hwcomposer_SOURCES = test_hwcomposer.cpp
+test_hwcomposer_CXXFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/include/android \
+ -I$(top_srcdir)/common \
+ -I$(top_srcdir)/egl/platforms/common \
+ -I$(top_srcdir)/egl/platforms/hwcomposer \
+ -I$(top_srcdir)/libsync
+
+if WANT_MESA
+test_hwcomposer_CXXFLAGS += -DLIBHYBRIS_WANTS_MESA_X11_HEADERS
+endif
+test_hwcomposer_LDADD = \
+ -lm \
+ $(top_builddir)/common/libhybris-common.la \
+ $(top_builddir)/egl/platforms/hwcomposer/libhybris-hwcomposerwindow.la \
+ $(top_builddir)/egl/platforms/common/libhybris-eglplatformcommon.la \
+ $(top_builddir)/egl/libEGL.la \
+ $(top_builddir)/glesv2/libGLESv2.la \
+ $(top_builddir)/libsync/libsync.la \
+ $(top_builddir)/hardware/libhardware.la
+
+test_sensors_SOURCES = test_sensors.c
+test_sensors_CFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/include/android
+test_sensors_LDADD = \
+ $(top_builddir)/common/libhybris-common.la \
+ $(top_builddir)/hardware/libhardware.la
+
+test_lights_SOURCES = test_lights.c
+test_lights_CFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/include/android
+
+test_lights_LDADD = \
+ $(top_builddir)/common/libhybris-common.la \
+ $(top_builddir)/hardware/libhardware.la
+
+test_ui_SOURCES = test_ui.c
+test_ui_CFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/include/android
+test_ui_LDADD = \
+ $(top_builddir)/common/libhybris-common.la \
+ $(top_builddir)/ui/libui.la
+
+test_sf_SOURCES = test_sf.c
+test_sf_CFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/include/android
+test_sf_LDADD = \
+ $(top_builddir)/common/libhybris-common.la \
+ $(top_builddir)/egl/libEGL.la \
+ $(top_builddir)/glesv2/libGLESv2.la \
+ $(top_builddir)/sf/libsf.la
+
+test_input_SOURCES = test_input.c
+test_input_CFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/include/android
+test_input_LDADD = \
+ $(top_builddir)/common/libhybris-common.la \
+ $(top_builddir)/input/libis.la
+
+test_camera_SOURCES = test_camera.c
+test_camera_CFLAGS = \
+ -I$(top_srcdir)/include
+ -I$(top_srcdir)/include/android
+
+test_camera_LDADD = \
+ $(top_builddir)/common/libhybris-common.la \
+ $(top_builddir)/egl/libEGL.la \
+ $(top_builddir)/glesv2/libGLESv2.la \
+ $(top_builddir)/camera/libcamera.la \
+ $(top_builddir)/input/libis.la
+
+test_gps_SOURCES = test_gps.c
+test_gps_CFLAGS = -pthread \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/include/android
+
+if HAS_ANDROID_4_2_0
+test_gps_CFLAGS += -DHAS_ANDROID_4_2_0
+endif
+
+test_gps_LDFLAGS = -pthread
+test_gps_LDADD = \
+ $(top_builddir)/common/libhybris-common.la \
+ $(top_builddir)/hardware/libhardware.la
+
+test_nfc_SOURCES = test_nfc.c
+test_nfc_CFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/include/android \
+ -I$(top_srcdir)/include/android/libnfc-nxp
+
+test_nfc_LDFLAGS =
+test_nfc_LDADD = \
+ $(top_builddir)/libnfc_nxp/libnfc_nxp.la \
+ $(top_builddir)/hardware/libhardware.la
--- /dev/null
+/*
+ * Copyright (c) 2013 Canonical Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <memory.h>
+#include <assert.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <android/hardware/audio.h>
+#include <android/hardware/hardware.h>
+
+int main(int argc, char **argv)
+{
+ struct hw_module_t *hwmod = 0;
+ struct audio_hw_device *audiohw;
+
+ hw_get_module_by_class(AUDIO_HARDWARE_MODULE_ID,
+ AUDIO_HARDWARE_MODULE_ID_PRIMARY,
+ (const hw_module_t**) &hwmod);
+ assert(hwmod != NULL);
+
+ assert(audio_hw_device_open(hwmod, &audiohw) == 0);
+ assert(audiohw->init_check(audiohw) == 0);
+ printf("Audio Hardware Interface initialized.\n");
+
+ if (audiohw->get_master_volume) {
+ float volume;
+ audiohw->get_master_volume(audiohw, &volume);
+ printf("Master Volume: %f\n", volume);
+ }
+
+ if (audiohw->get_master_mute) {
+ bool mute;
+ audiohw->get_master_mute(audiohw, &mute);
+ printf("Master Mute: %d\n", mute);
+ }
+
+ audio_hw_device_close(audiohw);
+
+ return 0;
+}
+
+// vim:ts=4:sw=4:noexpandtab
--- /dev/null
+/*
+ * Copyright (C) 2012 Canonical Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <hybris/camera/camera_compatibility_layer.h>
+#include <hybris/camera/camera_compatibility_layer_capabilities.h>
+
+#include <hybris/input/input_stack_compatibility_layer.h>
+#include <hybris/input/input_stack_compatibility_layer_codes_key.h>
+#include <hybris/input/input_stack_compatibility_layer_flags_key.h>
+#include <hybris/input/input_stack_compatibility_layer_flags_motion.h>
+
+#include <EGL/egl.h>
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <limits.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+int shot_counter = 1;
+int32_t current_zoom_level = 1;
+bool new_camera_frame_available = true;
+
+static GLuint gProgram;
+static GLuint gaPositionHandle, gaTexHandle, gsTextureHandle, gmTexMatrix;
+
+EffectMode next_effect()
+{
+ static EffectMode current_effect = EFFECT_MODE_NONE;
+
+ EffectMode next = current_effect;
+
+ switch (current_effect) {
+ case EFFECT_MODE_NONE:
+ next = EFFECT_MODE_MONO;
+ break;
+ case EFFECT_MODE_MONO:
+ next = EFFECT_MODE_NEGATIVE;
+ break;
+ case EFFECT_MODE_NEGATIVE:
+ next = EFFECT_MODE_SOLARIZE;
+ break;
+ case EFFECT_MODE_SOLARIZE:
+ next = EFFECT_MODE_SEPIA;
+ break;
+ case EFFECT_MODE_SEPIA:
+ next = EFFECT_MODE_POSTERIZE;
+ break;
+ case EFFECT_MODE_POSTERIZE:
+ next = EFFECT_MODE_WHITEBOARD;
+ break;
+ case EFFECT_MODE_WHITEBOARD:
+ next = EFFECT_MODE_BLACKBOARD;
+ break;
+ case EFFECT_MODE_BLACKBOARD:
+ next = EFFECT_MODE_AQUA;
+ break;
+ case EFFECT_MODE_AQUA:
+ next = EFFECT_MODE_NONE;
+ break;
+ }
+
+ current_effect = next;
+ return next;
+}
+
+void error_msg_cb(void* context)
+{
+ printf("%s \n", __PRETTY_FUNCTION__);
+}
+
+void shutter_msg_cb(void* context)
+{
+ printf("%s \n", __PRETTY_FUNCTION__);
+}
+
+void zoom_msg_cb(void* context, int32_t new_zoom_level)
+{
+ printf("%s \n", __PRETTY_FUNCTION__);
+
+ struct CameraControl* cc = (struct CameraControl*) context;
+ static int zoom;
+ current_zoom_level = new_zoom_level;
+}
+
+void autofocus_msg_cb(void* context)
+{
+ printf("%s \n", __PRETTY_FUNCTION__);
+}
+
+void raw_data_cb(void* data, uint32_t data_size, void* context)
+{
+ printf("%s: %d \n", __PRETTY_FUNCTION__, data_size);
+}
+
+void jpeg_data_cb(void* data, uint32_t data_size, void* context)
+{
+ printf("%s: %d \n", __PRETTY_FUNCTION__, data_size);
+
+ char fn[256];
+ sprintf(fn, "/tmp/shot_%d.jpeg", shot_counter);
+ int fd = open(fn, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
+ ssize_t ret = write(fd, data, data_size);
+ close(fd);
+ shot_counter++;
+
+ struct CameraControl* cc = (struct CameraControl*) context;
+ android_camera_start_preview(cc);
+}
+
+void size_cb(void* ctx, int width, int height)
+{
+ printf("Supported size: [%d,%d]\n", width, height);
+}
+
+void preview_texture_needs_update_cb(void* ctx)
+{
+ new_camera_frame_available = true;
+}
+
+void on_new_input_event(struct Event* event, void* context)
+{
+ assert(context);
+
+ if (event->type == KEY_EVENT_TYPE && event->action == ISCL_KEY_EVENT_ACTION_UP) {
+ printf("We have got a key event: %d \n", event->details.key.key_code);
+
+ struct CameraControl* cc = (struct CameraControl*) context;
+
+ switch(event->details.key.key_code) {
+ case ISCL_KEYCODE_VOLUME_UP:
+ printf("\tZooming in now.\n");
+ android_camera_start_zoom(cc, current_zoom_level+1);
+ break;
+ case ISCL_KEYCODE_VOLUME_DOWN:
+ printf("\tZooming out now.\n");
+ android_camera_start_zoom(cc, current_zoom_level-1);
+ break;
+ case ISCL_KEYCODE_POWER:
+ printf("\tTaking a photo now.\n");
+ android_camera_take_snapshot(cc);
+ break;
+ case ISCL_KEYCODE_HEADSETHOOK:
+ printf("\tSwitching effect.\n");
+ android_camera_set_effect_mode(cc, next_effect());
+
+ }
+ } else if (event->type == MOTION_EVENT_TYPE &&
+ event->details.motion.pointer_count == 1) {
+ if ((event->action & ISCL_MOTION_EVENT_ACTION_MASK) == ISCL_MOTION_EVENT_ACTION_UP) {
+ printf("\tMotion event(Action up): (%f, %f) \n",
+ event->details.motion.pointer_coordinates[0].x,
+ event->details.motion.pointer_coordinates[0].y);
+ }
+
+ if ((event->action & ISCL_MOTION_EVENT_ACTION_MASK) == ISCL_MOTION_EVENT_ACTION_DOWN) {
+ printf("\tMotion event(Action down): (%f, %f) \n",
+ event->details.motion.pointer_coordinates[0].x,
+ event->details.motion.pointer_coordinates[0].y);
+ }
+ }
+}
+
+static const char* vertex_shader()
+{
+ return
+ "#extension GL_OES_EGL_image_external : require \n"
+ "attribute vec4 a_position; \n"
+ "attribute vec2 a_texCoord; \n"
+ "uniform mat4 m_texMatrix; \n"
+ "varying vec2 v_texCoord; \n"
+ "varying float topDown; \n"
+ "void main() \n"
+ "{ \n"
+ " gl_Position = a_position; \n"
+ " v_texCoord = a_texCoord; \n"
+ // " v_texCoord = (m_texMatrix * vec4(a_texCoord, 0.0, 1.0)).xy;\n"
+ // " topDown = v_texCoord.y; \n"
+ "} \n";
+}
+
+static const char* fragment_shader()
+{
+ return
+ "#extension GL_OES_EGL_image_external : require \n"
+ "precision mediump float; \n"
+ "varying vec2 v_texCoord; \n"
+ "uniform samplerExternalOES s_texture; \n"
+ "void main() \n"
+ "{ \n"
+ " gl_FragColor = texture2D( s_texture, v_texCoord );\n"
+ "} \n";
+}
+
+static GLuint loadShader(GLenum shaderType, const char* pSource) {
+ GLuint shader = glCreateShader(shaderType);
+
+ if (shader) {
+ glShaderSource(shader, 1, &pSource, NULL);
+ glCompileShader(shader);
+ GLint compiled = 0;
+ glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
+
+ if (!compiled) {
+ GLint infoLen = 0;
+ glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
+ if (infoLen) {
+ char* buf = (char*) malloc(infoLen);
+ if (buf) {
+ glGetShaderInfoLog(shader, infoLen, NULL, buf);
+ fprintf(stderr, "Could not compile shader %d:\n%s\n",
+ shaderType, buf);
+ free(buf);
+ }
+ glDeleteShader(shader);
+ shader = 0;
+ }
+ }
+ } else {
+ printf("Error, during shader creation: %i\n", glGetError());
+ }
+
+ return shader;
+}
+
+static GLuint create_program(const char* pVertexSource, const char* pFragmentSource) {
+ GLuint vertexShader = loadShader(GL_VERTEX_SHADER, pVertexSource);
+ if (!vertexShader) {
+ printf("vertex shader not compiled\n");
+ return 0;
+ }
+
+ GLuint pixelShader = loadShader(GL_FRAGMENT_SHADER, pFragmentSource);
+ if (!pixelShader) {
+ printf("frag shader not compiled\n");
+ return 0;
+ }
+
+ GLuint program = glCreateProgram();
+ if (program) {
+ glAttachShader(program, vertexShader);
+ glAttachShader(program, pixelShader);
+ glLinkProgram(program);
+ GLint linkStatus = GL_FALSE;
+ glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
+
+ if (linkStatus != GL_TRUE) {
+ GLint bufLength = 0;
+ glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength);
+ if (bufLength) {
+ char* buf = (char*) malloc(bufLength);
+ if (buf) {
+ glGetProgramInfoLog(program, bufLength, NULL, buf);
+ fprintf(stderr, "Could not link program:\n%s\n", buf);
+ free(buf);
+ }
+ }
+ glDeleteProgram(program);
+ program = 0;
+ }
+
+ }
+ return program;
+}
+
+int main(int argc, char** argv)
+{
+ struct CameraControlListener listener;
+ memset(&listener, 0, sizeof(listener));
+ listener.on_msg_error_cb = error_msg_cb;
+ listener.on_msg_shutter_cb = shutter_msg_cb;
+ listener.on_msg_focus_cb = autofocus_msg_cb;
+ listener.on_msg_zoom_cb = zoom_msg_cb;
+
+ listener.on_data_raw_image_cb = raw_data_cb;
+ listener.on_data_compressed_image_cb = jpeg_data_cb;
+ listener.on_preview_texture_needs_update_cb = preview_texture_needs_update_cb;
+ struct CameraControl* cc = android_camera_connect_to(FRONT_FACING_CAMERA_TYPE,
+ &listener);
+ if (cc == NULL) {
+ printf("Problem connecting to camera");
+ return 1;
+ }
+
+ listener.context = cc;
+
+ struct AndroidEventListener event_listener;
+ event_listener.on_new_event = on_new_input_event;
+ event_listener.context = cc;
+
+ struct InputStackConfiguration input_configuration = { false, 25000, 1024, 1024 };
+
+ android_input_stack_initialize(&event_listener, &input_configuration);
+ android_input_stack_start();
+
+ android_camera_dump_parameters(cc);
+ android_camera_enumerate_supported_picture_sizes(cc, size_cb, NULL);
+ android_camera_enumerate_supported_preview_sizes(cc, size_cb, NULL);
+
+ int min_fps, max_fps, current_fps;
+ android_camera_get_preview_fps_range(cc, &min_fps, &max_fps);
+ printf("Preview fps range: [%d,%d]\n", min_fps, max_fps);
+ android_camera_get_preview_fps(cc, ¤t_fps);
+ printf("Current preview fps range: %d\n", current_fps);
+
+ android_camera_set_preview_size(cc, 960, 720);
+
+ int width, height;
+ android_camera_get_preview_size(cc, &width, &height);
+ printf("Current preview size: [%d,%d]\n", width, height);
+ android_camera_get_picture_size(cc, &width, &height);
+ printf("Current picture size: [%d,%d]\n", width, height);
+ int zoom;
+ android_camera_get_max_zoom(cc, &zoom);
+ printf("Max zoom: %d \n", zoom);
+ android_camera_set_zoom(cc, 10);
+
+ EffectMode effect_mode;
+ FlashMode flash_mode;
+ WhiteBalanceMode wb_mode;
+ SceneMode scene_mode;
+ AutoFocusMode af_mode;
+ android_camera_get_effect_mode(cc, &effect_mode);
+ android_camera_get_flash_mode(cc, &flash_mode);
+ android_camera_get_white_balance_mode(cc, &wb_mode);
+ android_camera_get_scene_mode(cc, &scene_mode);
+ android_camera_get_auto_focus_mode(cc, &af_mode);
+ printf("Current effect mode: %d \n", effect_mode);
+ printf("Current flash mode: %d \n", flash_mode);
+ printf("Current wb mode: %d \n", wb_mode);
+ printf("Current scene mode: %d \n", scene_mode);
+ printf("Current af mode: %d \n", af_mode);
+ FocusRegion fr = { top: -200, left: -200, bottom: 200, right: 200, weight: 300};
+ android_camera_set_focus_region(cc, &fr);
+
+ /* EGL Setup */
+ EGLConfig ecfg;
+ EGLBoolean rv;
+ EGLint num_config;
+ EGLContext context;
+ EGLint attr[] = {
+ EGL_BUFFER_SIZE, 32,
+ EGL_RENDERABLE_TYPE,
+ EGL_OPENGL_ES2_BIT,
+ EGL_NONE
+ };
+ EGLint ctxattr[] = {
+ EGL_CONTEXT_CLIENT_VERSION, 2,
+ EGL_NONE
+ };
+
+ EGLDisplay disp = eglGetDisplay(NULL);
+ assert(eglGetError() == EGL_SUCCESS);
+ assert(disp != EGL_NO_DISPLAY);
+
+ rv = eglInitialize(disp, 0, 0);
+ assert(eglGetError() == EGL_SUCCESS);
+ assert(rv == EGL_TRUE);
+
+ eglChooseConfig((EGLDisplay) disp, attr, &ecfg, 1, &num_config);
+ assert(eglGetError() == EGL_SUCCESS);
+ assert(rv == EGL_TRUE);
+
+ EGLSurface surface = eglCreateWindowSurface((EGLDisplay) disp, ecfg,
+ (EGLNativeWindowType) NULL, NULL);
+ assert(eglGetError() == EGL_SUCCESS);
+ assert(surface != EGL_NO_SURFACE);
+
+ context = eglCreateContext((EGLDisplay) disp, ecfg, EGL_NO_CONTEXT, ctxattr);
+ assert(eglGetError() == EGL_SUCCESS);
+ assert(context != EGL_NO_CONTEXT);
+
+ assert(eglMakeCurrent((EGLDisplay) disp, surface, surface, context) == EGL_TRUE);
+
+ gProgram = create_program(vertex_shader(), fragment_shader());
+ gaPositionHandle = glGetAttribLocation(gProgram, "a_position");
+ gaTexHandle = glGetAttribLocation(gProgram, "a_texCoord");
+ gsTextureHandle = glGetUniformLocation(gProgram, "s_texture");
+ gmTexMatrix = glGetUniformLocation(gProgram, "m_texMatrix");
+
+ GLuint preview_texture_id;
+ glGenTextures(1, &preview_texture_id);
+ glClearColor(1.0, 0., 0.5, 1.);
+ glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameteri(
+ GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(
+ GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ android_camera_set_preview_texture(cc, preview_texture_id);
+ android_camera_set_effect_mode(cc, EFFECT_MODE_SEPIA);
+ android_camera_set_flash_mode(cc, FLASH_MODE_AUTO);
+ android_camera_set_auto_focus_mode(cc, AUTO_FOCUS_MODE_CONTINUOUS_PICTURE);
+ android_camera_start_preview(cc);
+
+ GLfloat transformation_matrix[16];
+ android_camera_get_preview_texture_transformation(cc, transformation_matrix);
+ glUniformMatrix4fv(gmTexMatrix, 1, GL_FALSE, transformation_matrix);
+
+ printf("Started camera preview.\n");
+
+ while(true) {
+ /*if (new_camera_frame_available)
+ {
+ printf("Updating texture");
+ new_camera_frame_available = false;
+ }*/
+ static GLfloat vVertices[] = { 0.0f, 0.0f, 0.0f, // Position 0
+ 0.0f, 0.0f, // TexCoord 0
+ 0.0f, 1.0f, 0.0f, // Position 1
+ 0.0f, 1.0f, // TexCoord 1
+ 1.0f, 1.0f, 0.0f, // Position 2
+ 1.0f, 1.0f, // TexCoord 2
+ 1.0f, 0.0f, 0.0f, // Position 3
+ 1.0f, 0.0f // TexCoord 3
+ };
+
+ GLushort indices[] = { 0, 1, 2, 0, 2, 3 };
+
+ // Set the viewport
+ // Clear the color buffer
+ glClear(GL_COLOR_BUFFER_BIT);
+ // Use the program object
+ glUseProgram(gProgram);
+ // Enable attributes
+ glEnableVertexAttribArray(gaPositionHandle);
+ glEnableVertexAttribArray(gaTexHandle);
+ // Load the vertex position
+ glVertexAttribPointer(gaPositionHandle,
+ 3,
+ GL_FLOAT,
+ GL_FALSE,
+ 5 * sizeof(GLfloat),
+ vVertices);
+ // Load the texture coordinate
+ glVertexAttribPointer(gaTexHandle,
+ 2,
+ GL_FLOAT,
+ GL_FALSE,
+ 5 * sizeof(GLfloat),
+ vVertices+3);
+
+ glActiveTexture(GL_TEXTURE0);
+ // Set the sampler texture unit to 0
+ glUniform1i(gsTextureHandle, 0);
+ glUniform1i(gmTexMatrix, 0);
+ android_camera_update_preview_texture(cc);
+ glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);
+ glDisableVertexAttribArray(gaPositionHandle);
+ glDisableVertexAttribArray(gaTexHandle);
+
+ eglSwapBuffers((EGLDisplay) disp, surface);
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2012 Carsten Munk <carsten.munk@gmail.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <EGL/egl.h>
+#include <assert.h>
+#include <stdio.h>
+#include "hybris_nativebufferext.h"
+#include <string.h>
+#include <EGL/eglext.h>
+int main(int argc, char **argv)
+{
+ EGLDisplay display;
+ EGLConfig ecfg;
+ EGLint num_config;
+ EGLint attr[] = { // some attributes to set up our egl-interface
+ EGL_BUFFER_SIZE, 32,
+ EGL_RENDERABLE_TYPE,
+ EGL_OPENGL_ES2_BIT,
+ EGL_NONE
+ };
+ EGLSurface surface;
+ EGLint ctxattr[] = {
+ EGL_CONTEXT_CLIENT_VERSION, 2,
+ EGL_NONE
+ };
+ EGLContext context;
+
+ EGLBoolean rv;
+ PFNEGLHYBRISCREATENATIVEBUFFERPROC eglHybrisCreateNativeBuffer;
+ PFNEGLHYBRISLOCKNATIVEBUFFERPROC eglHybrisLockNativeBuffer;
+ PFNEGLHYBRISUNLOCKNATIVEBUFFERPROC eglHybrisUnlockNativeBuffer;
+ PFNEGLHYBRISRELEASENATIVEBUFFERPROC eglHybrisReleaseNativeBuffer;
+ PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;
+ PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR;
+
+ display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+ assert(eglGetError() == EGL_SUCCESS);
+ assert(display != EGL_NO_DISPLAY);
+
+ rv = eglInitialize(display, NULL, NULL);
+ assert(eglGetError() == EGL_SUCCESS);
+ assert(rv == EGL_TRUE);
+
+ rv = eglChooseConfig((EGLDisplay) display, attr, &ecfg, 1, &num_config);
+ assert(eglGetError() == EGL_SUCCESS);
+ assert(rv == EGL_TRUE);
+
+ surface = eglCreateWindowSurface((EGLDisplay) display, ecfg, (EGLNativeWindowType)NULL, NULL);
+ assert(eglGetError() == EGL_SUCCESS);
+ assert(surface != EGL_NO_SURFACE);
+
+ context = eglCreateContext((EGLDisplay) display, ecfg, EGL_NO_CONTEXT, ctxattr);
+ assert(eglGetError() == EGL_SUCCESS);
+ assert(context != EGL_NO_CONTEXT);
+
+ assert(eglMakeCurrent((EGLDisplay) display, surface, surface, context) == EGL_TRUE);
+
+ if (strstr(eglQueryString(display, EGL_EXTENSIONS), "EGL_HYBRIS_native_buffer") != NULL)
+ {
+ printf("Found EGL_HYBRIS_native_buffer\n");
+ assert((eglHybrisCreateNativeBuffer = (PFNEGLHYBRISCREATENATIVEBUFFERPROC) eglGetProcAddress("eglHybrisCreateNativeBuffer")) != NULL);
+ printf("Found eglHybrisCreateNativeBuffer\n");
+ EGLClientBuffer buf;
+ EGLint stride;
+ void *loc;
+ assert(eglHybrisCreateNativeBuffer(320, 480, HYBRIS_USAGE_SW_READ_RARELY|HYBRIS_USAGE_SW_WRITE_RARELY|HYBRIS_USAGE_HW_TEXTURE, HYBRIS_PIXEL_FORMAT_RGBA_8888, &stride, &buf) == EGL_TRUE);
+ printf("Stride is %i\n", stride);
+ assert((eglHybrisLockNativeBuffer = (PFNEGLHYBRISLOCKNATIVEBUFFERPROC) eglGetProcAddress("eglHybrisLockNativeBuffer")) != NULL);
+ printf("Found eglHybrisLockBuffer\n");
+ assert(eglHybrisLockNativeBuffer(buf, HYBRIS_USAGE_SW_WRITE_RARELY, 0, 0, 320, 480, &loc) == EGL_TRUE);
+ printf("locked at %p\n", loc);
+ printf("Memsetting..\n");
+ memset(loc, 0xEF, (stride*480));
+ assert((eglHybrisUnlockNativeBuffer = (PFNEGLHYBRISUNLOCKNATIVEBUFFERPROC) eglGetProcAddress("eglHybrisUnlockNativeBuffer")) != NULL);
+ printf("Found eglHybrisUnlockBuffer\n");
+ eglHybrisUnlockNativeBuffer(buf);
+ assert((eglCreateImageKHR = (PFNEGLCREATEIMAGEKHRPROC) eglGetProcAddress("eglCreateImageKHR")) != NULL);
+ printf("Found eglCreateImageKHR\n");
+ EGLImageKHR image = eglCreateImageKHR(
+ display, EGL_NO_CONTEXT, EGL_NATIVE_BUFFER_HYBRIS,
+ (EGLClientBuffer)buf, NULL);
+ assert(image != EGL_NO_IMAGE_KHR);
+ assert((eglDestroyImageKHR = (PFNEGLDESTROYIMAGEKHRPROC) eglGetProcAddress("eglDestroyImageKHR")) != NULL);
+ printf("Found eglDestroyImageKHR\n");
+ assert(eglDestroyImageKHR(display, image));
+
+ assert((eglHybrisReleaseNativeBuffer = (PFNEGLHYBRISRELEASENATIVEBUFFERPROC) eglGetProcAddress("eglHybrisReleaseNativeBuffer")) != NULL);
+ printf("Found eglHybrisReleaseNativeBuffer\n");
+ eglHybrisReleaseNativeBuffer(buf);
+ }
+
+ printf("stop\n");
+
+ eglDestroyContext((EGLDisplay) display, context);
+ printf("destroyed context\n");
+
+ eglDestroySurface((EGLDisplay) display, surface);
+ printf("destroyed surface\n");
+ eglTerminate((EGLDisplay) display);
+ return 0;
+}
+
+// vim:ts=4:sw=4:noexpandtab
--- /dev/null
+/**
+ * test_egl_configs: List available EGL configurations
+ * Copyright (c) 2013 Thomas Perl <m@thp.io>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ **/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <assert.h>
+
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
+
+#define FAIL_WITH(...) do { fprintf(stderr, __VA_ARGS__); exit(1); } while (0)
+#define TEST_LOG(...) fprintf(stderr, __VA_ARGS__)
+
+#define TEST_ASSERT(x) do { \
+ int error = eglGetError(); \
+ if (error != EGL_SUCCESS) { \
+ FAIL_WITH("EGL Error %x at %s:%d\n", error, __FILE__, __LINE__); \
+ } \
+ if (!(x)) { \
+ FAIL_WITH("Assertion failed: %s at %s:%d\n", (#x), __FILE__, __LINE__); \
+ } \
+} while (0)
+
+
+static EGLDisplay display;
+static EGLConfig config;
+
+int
+ATTRIB(EGLint attribute)
+{
+ EGLint value;
+ EGLBoolean result;
+
+ result = eglGetConfigAttrib(display, config, attribute, &value);
+ if (result != EGL_TRUE) {
+ TEST_LOG("For attribute: %d\n", attribute);
+ TEST_ASSERT(result == EGL_TRUE); // this makes sure we exit()
+ }
+
+ return value;
+}
+
+#define TEST_LOG_FEATURE(x) TEST_LOG(" %s: %s\n", (#x), ATTRIB(x) ? "yes" : "no")
+#define TEST_LOG_VALUE(x) TEST_LOG(" %s: %d\n", (#x), ATTRIB(x))
+#define TEST_LOG_VALUE_HEX(x) TEST_LOG(" %s: %x\n", (#x), ATTRIB(x))
+
+#define SINCE_EGL_VERSION(maj, min) (major >= (maj) && minor >= (min))
+
+/* Syntactic sugar for decoding one-of-many option fields */
+#define ATTRIB_SWITCH(x) TEST_LOG(" %s: ", (#x)); switch (ATTRIB(x))
+#define ATTRIB_CASE(x) case x: TEST_LOG("%s\n", (#x)); break
+#define ATTRIB_SWITCH_DEFAULT(x) default: TEST_LOG("%x\n", ATTRIB(x)); break
+
+/* Syntactic sugar for decoding bitfields */
+#define START_DECODE_BITFIELD(x) value = ATTRIB(x); TEST_LOG(" %s: %x (", (#x), value);
+#define TEST_BITFIELD_VALUE(x) if (value & (x)) TEST_LOG(" %s ", (#x))
+#define END_DECODE_BITFIELD(x) TEST_LOG(")\n")
+
+
+/**
+ * For reference, the values tested below have been obtained from:
+ * http://www.khronos.org/registry/egl/sdk/docs/man/xhtml/eglGetConfigAttrib.html
+ * http://www.khronos.org/registry/egl/sdk/docs/man/xhtml/eglChooseConfig.html
+ **/
+
+int
+main(int argc, char *argv[])
+{
+ EGLBoolean result;
+ EGLint major, minor;
+ EGLint num_config;
+ EGLint num_config_result;
+ EGLConfig *configs;
+ EGLint value;
+ int i;
+
+ TEST_LOG("Starting test (EGL_PLATFORM=%s)\n", getenv("EGL_PLATFORM"));
+
+ display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+ TEST_ASSERT(display != EGL_NO_DISPLAY);
+
+ result = eglInitialize(display, &major, &minor);
+ TEST_ASSERT(result == EGL_TRUE);
+
+ TEST_LOG("EGL Version %d.%d\n", major, minor);
+ TEST_LOG("Extensions: %s\n", eglQueryString(display, EGL_EXTENSIONS));
+
+ result = eglGetConfigs(display, NULL, 0, &num_config);
+ TEST_ASSERT(result == EGL_TRUE);
+
+ TEST_LOG("Available configurations: %d\n", num_config);
+ configs = (EGLConfig *)calloc(num_config, sizeof(EGLConfig));
+
+ result = eglGetConfigs(display, configs, num_config, &num_config_result);
+ TEST_ASSERT(result == EGL_TRUE);
+
+ for (i=0; i<num_config_result; i++) {
+ config = configs[i];
+
+ TEST_LOG("===== Configuration #%d =====\n", i);
+
+ TEST_LOG_VALUE(EGL_RED_SIZE);
+ TEST_LOG_VALUE(EGL_GREEN_SIZE);
+ TEST_LOG_VALUE(EGL_BLUE_SIZE);
+ TEST_LOG_VALUE(EGL_ALPHA_SIZE);
+ TEST_LOG_VALUE(EGL_BUFFER_SIZE);
+ TEST_LOG_VALUE(EGL_DEPTH_SIZE);
+ TEST_LOG_VALUE(EGL_STENCIL_SIZE);
+
+ TEST_LOG_VALUE(EGL_CONFIG_ID);
+ TEST_LOG_VALUE(EGL_LEVEL);
+ TEST_LOG_VALUE(EGL_SAMPLE_BUFFERS);
+ TEST_LOG_VALUE(EGL_SAMPLES);
+
+ TEST_LOG_VALUE(EGL_MAX_PBUFFER_WIDTH);
+ TEST_LOG_VALUE(EGL_MAX_PBUFFER_HEIGHT);
+ TEST_LOG_VALUE(EGL_MAX_PBUFFER_PIXELS);
+
+ TEST_LOG_VALUE(EGL_MIN_SWAP_INTERVAL);
+ TEST_LOG_VALUE(EGL_MAX_SWAP_INTERVAL);
+
+ TEST_LOG_VALUE(EGL_NATIVE_VISUAL_ID);
+ TEST_LOG_VALUE(EGL_NATIVE_VISUAL_TYPE);
+
+ ATTRIB_SWITCH(EGL_CONFIG_CAVEAT) {
+ ATTRIB_CASE(EGL_NONE);
+ ATTRIB_CASE(EGL_SLOW_CONFIG);
+ ATTRIB_CASE(EGL_NON_CONFORMANT_CONFIG);
+ ATTRIB_SWITCH_DEFAULT(EGL_CONFIG_CAVEAT);
+ }
+
+ TEST_LOG_FEATURE(EGL_BIND_TO_TEXTURE_RGB);
+ TEST_LOG_FEATURE(EGL_BIND_TO_TEXTURE_RGBA);
+ TEST_LOG_FEATURE(EGL_NATIVE_RENDERABLE);
+
+ START_DECODE_BITFIELD(EGL_SURFACE_TYPE) {
+ TEST_BITFIELD_VALUE(EGL_MULTISAMPLE_RESOLVE_BOX_BIT);
+ TEST_BITFIELD_VALUE(EGL_PBUFFER_BIT);
+ TEST_BITFIELD_VALUE(EGL_PIXMAP_BIT);
+ TEST_BITFIELD_VALUE(EGL_SWAP_BEHAVIOR_PRESERVED_BIT);
+ TEST_BITFIELD_VALUE(EGL_VG_ALPHA_FORMAT_PRE_BIT);
+ TEST_BITFIELD_VALUE(EGL_VG_COLORSPACE_LINEAR_BIT);
+ TEST_BITFIELD_VALUE(EGL_WINDOW_BIT);
+ } END_DECODE_BITFIELD(EGL_SURFACE_TYPE);
+
+ TEST_LOG_VALUE_HEX(EGL_TRANSPARENT_RED_VALUE);
+ TEST_LOG_VALUE_HEX(EGL_TRANSPARENT_GREEN_VALUE);
+ TEST_LOG_VALUE_HEX(EGL_TRANSPARENT_BLUE_VALUE);
+
+ ATTRIB_SWITCH(EGL_TRANSPARENT_TYPE) {
+ ATTRIB_CASE(EGL_NONE);
+ ATTRIB_CASE(EGL_TRANSPARENT_RGB);
+ ATTRIB_SWITCH_DEFAULT(EGL_TRANSPARENT_TYPE);
+ }
+
+ // New features introduced in EGL 1.2
+ if (SINCE_EGL_VERSION(1, 2)) {
+#ifdef EGL_LUMINANCE_SIZE
+ TEST_LOG_VALUE(EGL_LUMINANCE_SIZE);
+#endif /* EGL_LUMINANCE_SIZE */
+
+#ifdef EGL_COLOR_BUFFER_TYPE
+ ATTRIB_SWITCH(EGL_COLOR_BUFFER_TYPE) {
+ ATTRIB_CASE(EGL_RGB_BUFFER);
+ ATTRIB_CASE(EGL_LUMINANCE_BUFFER);
+ ATTRIB_SWITCH_DEFAULT(EGL_COLOR_BUFFER_TYPE);
+ }
+#endif /* EGL_COLOR_BUFFER_TYPE */
+
+#ifdef EGL_RENDERABLE_TYPE
+ START_DECODE_BITFIELD(EGL_RENDERABLE_TYPE) {
+ TEST_BITFIELD_VALUE(EGL_OPENGL_BIT);
+ TEST_BITFIELD_VALUE(EGL_OPENGL_ES_BIT);
+ TEST_BITFIELD_VALUE(EGL_OPENGL_ES2_BIT);
+ TEST_BITFIELD_VALUE(EGL_OPENVG_BIT);
+ } END_DECODE_BITFIELD(EGL_RENDERABLE_TYPE);
+#endif /* EGL_RENDERABLE_TYPE */
+ }
+
+ // New features introduced in EGL 1.3
+ if (SINCE_EGL_VERSION(1, 3)) {
+#ifdef EGL_CONFORMANT
+ START_DECODE_BITFIELD(EGL_CONFORMANT) {
+ TEST_BITFIELD_VALUE(EGL_OPENGL_BIT);
+ TEST_BITFIELD_VALUE(EGL_OPENGL_ES_BIT);
+ TEST_BITFIELD_VALUE(EGL_OPENGL_ES2_BIT);
+ TEST_BITFIELD_VALUE(EGL_OPENVG_BIT);
+ } END_DECODE_BITFIELD(EGL_CONFORMANT);
+#endif /* EGL_CONFORMANT */
+ }
+
+ TEST_LOG("\n\n");
+ }
+
+ free(configs);
+
+ result = eglTerminate(display);
+ TEST_ASSERT(result == EGL_TRUE);
+
+ return 0;
+}
--- /dev/null
+/*
+ * Copyright (c) 2012 Carsten Munk <carsten.munk@gmail.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <EGL/egl.h>
+#include <GLES2/gl2.h>
+#include <assert.h>
+#include <stdio.h>
+#include <math.h>
+#include <stddef.h>
+
+const char vertex_src [] =
+" \
+ attribute vec4 position; \
+ varying mediump vec2 pos; \
+ uniform vec4 offset; \
+ \
+ void main() \
+ { \
+ gl_Position = position + offset; \
+ pos = position.xy; \
+ } \
+";
+
+
+const char fragment_src [] =
+" \
+ varying mediump vec2 pos; \
+ uniform mediump float phase; \
+ \
+ void main() \
+ { \
+ gl_FragColor = vec4( 1., 0.9, 0.7, 1.0 ) * \
+ cos( 30.*sqrt(pos.x*pos.x + 1.5*pos.y*pos.y) \
+ + atan(pos.y,pos.x) - phase ); \
+ } \
+";
+
+GLuint load_shader(const char *shader_source, GLenum type)
+{
+ GLuint shader = glCreateShader(type);
+
+ glShaderSource(shader, 1, &shader_source, NULL);
+ glCompileShader(shader);
+
+ return shader;
+}
+
+
+GLfloat norm_x = 0.0;
+GLfloat norm_y = 0.0;
+GLfloat offset_x = 0.0;
+GLfloat offset_y = 0.0;
+GLfloat p1_pos_x = 0.0;
+GLfloat p1_pos_y = 0.0;
+
+GLint phase_loc;
+GLint offset_loc;
+GLint position_loc;
+
+const float vertexArray[] = {
+ 0.0, 1.0, 0.0,
+ -1., 0.0, 0.0,
+ 0.0, -1.0, 0.0,
+ 1., 0.0, 0.0,
+ 0.0, 1., 0.0
+};
+
+
+int main(int argc, char **argv)
+{
+ EGLDisplay display;
+ EGLConfig ecfg;
+ EGLint num_config;
+ EGLint attr[] = { // some attributes to set up our egl-interface
+ EGL_BUFFER_SIZE, 32,
+ EGL_RENDERABLE_TYPE,
+ EGL_OPENGL_ES2_BIT,
+ EGL_NONE
+ };
+ EGLSurface surface;
+ EGLint ctxattr[] = {
+ EGL_CONTEXT_CLIENT_VERSION, 2,
+ EGL_NONE
+ };
+ EGLContext context;
+
+ EGLBoolean rv;
+
+ display = eglGetDisplay(NULL);
+ assert(eglGetError() == EGL_SUCCESS);
+ assert(display != EGL_NO_DISPLAY);
+
+ rv = eglInitialize(display, 0, 0);
+ assert(eglGetError() == EGL_SUCCESS);
+ assert(rv == EGL_TRUE);
+
+ eglChooseConfig((EGLDisplay) display, attr, &ecfg, 1, &num_config);
+ assert(eglGetError() == EGL_SUCCESS);
+ assert(rv == EGL_TRUE);
+
+ surface = eglCreateWindowSurface((EGLDisplay) display, ecfg, (EGLNativeWindowType)NULL, NULL);
+ assert(eglGetError() == EGL_SUCCESS);
+ assert(surface != EGL_NO_SURFACE);
+
+ context = eglCreateContext((EGLDisplay) display, ecfg, EGL_NO_CONTEXT, ctxattr);
+ assert(eglGetError() == EGL_SUCCESS);
+ assert(context != EGL_NO_CONTEXT);
+
+ assert(eglMakeCurrent((EGLDisplay) display, surface, surface, context) == EGL_TRUE);
+
+ const char *version = (const char *)glGetString(GL_VERSION);
+ assert(version);
+ printf("%s\n",version);
+
+
+ GLuint vertexShader = load_shader ( vertex_src , GL_VERTEX_SHADER ); // load vertex shader
+ GLuint fragmentShader = load_shader ( fragment_src , GL_FRAGMENT_SHADER ); // load fragment shader
+
+ GLuint shaderProgram = glCreateProgram (); // create program object
+ glAttachShader ( shaderProgram, vertexShader ); // and attach both...
+ glAttachShader ( shaderProgram, fragmentShader ); // ... shaders to it
+
+ glLinkProgram ( shaderProgram ); // link the program
+ glUseProgram ( shaderProgram ); // and select it for usage
+
+ //// now get the locations (kind of handle) of the shaders variables
+ position_loc = glGetAttribLocation ( shaderProgram , "position" );
+ phase_loc = glGetUniformLocation ( shaderProgram , "phase" );
+ offset_loc = glGetUniformLocation ( shaderProgram , "offset" );
+ if ( position_loc < 0 || phase_loc < 0 || offset_loc < 0 ) {
+ return 1;
+ }
+
+ //glViewport ( 0 , 0 , 800, 600); // commented out so it uses the initial window dimensions
+ glClearColor ( 1. , 1. , 1. , 1.); // background color
+ float phase = 0;
+ int i;
+ for (i=0; i<3*60; ++i) {
+ glClear(GL_COLOR_BUFFER_BIT);
+ glUniform1f ( phase_loc , phase ); // write the value of phase to the shaders phase
+ phase = fmodf ( phase + 0.5f , 2.f * 3.141f ); // and update the local variable
+
+ glUniform4f ( offset_loc , offset_x , offset_y , 0.0 , 0.0 );
+
+ glVertexAttribPointer ( position_loc, 3, GL_FLOAT, GL_FALSE, 0, vertexArray );
+ glEnableVertexAttribArray ( position_loc );
+ glDrawArrays ( GL_TRIANGLE_STRIP, 0, 5 );
+
+ eglSwapBuffers ( (EGLDisplay) display, surface ); // get the rendered buffer to the screen
+ }
+
+ printf("stop\n");
+
+#if 0
+(*egldestroycontext)((EGLDisplay) display, context);
+ printf("destroyed context\n");
+
+ (*egldestroysurface)((EGLDisplay) display, surface);
+ printf("destroyed surface\n");
+ (*eglterminate)((EGLDisplay) display);
+ printf("terminated\n");
+ android_dlclose(baz);
+#endif
+}
+
+// vim:ts=4:sw=4:noexpandtab
--- /dev/null
+/*
+ * Copyright (C) 2012 Jolla Ltd.
+ * Author: Philippe De Swert <philippe.deswert@jollamobile.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+#include <pthread.h>
+#include <signal.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <getopt.h>
+#include <string.h>
+
+#include <android/hardware/gps.h>
+
+const GpsInterface* Gps = NULL;
+const AGpsInterface* AGps = NULL;
+const AGpsRilInterface* AGpsRil = NULL;
+const GpsNiInterface *GpsNi = NULL;
+const GpsXtraInterface *GpsExtra = NULL;
+#ifdef HAVE_ULP
+const UlpNetworkInterface *UlpNetwork = NULL;
+const UlpPhoneContextInterface *UlpPhoneContext = NULL;
+#endif /* HAVE_ULP */
+char *apn = 0;
+
+static const GpsInterface* get_gps_interface()
+{
+ int error;
+ hw_module_t* module;
+ const GpsInterface* interface = NULL;
+ struct gps_device_t *device;
+
+ error = hw_get_module(GPS_HARDWARE_MODULE_ID, (hw_module_t const**)&module);
+
+ if (!error)
+ {
+ error = module->methods->open(module, GPS_HARDWARE_MODULE_ID, (struct hw_device_t **) &device);
+ fprintf(stdout, "*** device info\n id = %s\n name = %s\n author = %s\n",
+ module->id, module->name, module->author);
+
+ if (!error)
+ {
+ interface = device->get_gps_interface(device);
+ }
+ }
+ else
+ {
+ fprintf(stdout, "*** GPS interface not found :\(\n Bye! \n");
+ exit(1);
+ }
+
+ return interface;
+}
+
+static const AGpsInterface* get_agps_interface(const GpsInterface *gps)
+{
+ const AGpsInterface* interface = NULL;
+
+ if (gps)
+ {
+ interface = (const AGpsInterface*)gps->get_extension(AGPS_INTERFACE);
+ }
+ return interface;
+}
+
+static const AGpsRilInterface* get_agps_ril_interface(const GpsInterface *gps)
+{
+ const AGpsRilInterface* interface = NULL;
+
+ if (gps)
+ {
+ interface = (const AGpsRilInterface*)gps->get_extension(AGPS_RIL_INTERFACE);
+ }
+ return interface;
+}
+
+static const GpsNiInterface* get_gps_ni_interface(const GpsInterface *gps)
+{
+ const GpsNiInterface* interface = NULL;
+
+ if(gps)
+ {
+ interface = (const GpsNiInterface*)gps->get_extension(GPS_NI_INTERFACE);
+ }
+ return interface;
+}
+
+static const GpsDebugInterface* get_gps_debug_interface(const GpsInterface *gps)
+{
+ const GpsDebugInterface* interface = NULL;
+
+ if(gps)
+ {
+ interface = (const GpsDebugInterface*)gps->get_extension(GPS_DEBUG_INTERFACE);
+ }
+ return interface;
+}
+
+static const GpsXtraInterface* get_gps_extra_interface(const GpsInterface *gps)
+{
+ const GpsXtraInterface* interface = NULL;
+
+ if(gps)
+ {
+ interface = (const GpsXtraInterface*)gps->get_extension(GPS_XTRA_INTERFACE);
+ }
+ return interface;
+}
+
+#ifdef HAVE_ULP
+static const UlpNetworkInterface* get_ulp_network_interface(const GpsInterface *gps)
+{
+ const UlpNetworkInterface* interface = NULL;
+
+ if (gps)
+ {
+ interface = (const UlpNetworkInterface*)gps->get_extension(ULP_NETWORK_INTERFACE);
+ }
+ return interface;
+}
+
+static const UlpPhoneContextInterface* get_ulp_phone_context_interface(const GpsInterface *gps)
+{
+ const UlpPhoneContextInterface* interface = NULL;
+
+ if (gps)
+ {
+ interface = (const UlpPhoneContextInterface*)gps->get_extension(ULP_PHONE_CONTEXT_INTERFACE);
+ }
+ return interface;
+}
+#endif /* HAVE_ULP */
+
+static void location_callback(GpsLocation* location)
+{
+ fprintf(stdout, "*** location callback\n");
+ fprintf(stdout, "flags:\t%d\n", location->flags);
+ fprintf(stdout, "latitude: \t%lf\n", location->latitude);
+ fprintf(stdout, "longtide: \t%lf\n", location->longitude);
+ fprintf(stdout, "accuracy:\t%f\n", location->accuracy);
+ fprintf(stdout, "utc: \t%ld\n", (long)location->timestamp);
+}
+
+static void status_callback(GpsStatus* status)
+{
+ fprintf(stdout, "*** status callback\n");
+
+ switch (status->status)
+ {
+ case GPS_STATUS_NONE:
+ fprintf(stdout, "*** no gps\n");
+ break;
+ case GPS_STATUS_SESSION_BEGIN:
+ fprintf(stdout, "*** session begin\n");
+ break;
+ case GPS_STATUS_SESSION_END:
+ fprintf(stdout, "*** session end\n");
+ break;
+ case GPS_STATUS_ENGINE_ON:
+ fprintf(stdout, "*** engine on\n");
+ break;
+ case GPS_STATUS_ENGINE_OFF:
+ fprintf(stdout, "*** engine off\n");
+ break;
+ default:
+ fprintf(stdout, "*** unknown status\n");
+ }
+}
+
+static void sv_status_callback(GpsSvStatus* sv_info)
+{
+ int i = 0;
+
+ fprintf(stdout, "*** sv status\n");
+ fprintf(stdout, "sv_size:\t%zu\n", sv_info->size);
+ fprintf(stdout, "num_svs:\t%d\n", sv_info->num_svs);
+ for(i=0; i < sv_info->num_svs; i++)
+ {
+ fprintf(stdout, "\t azimuth:\t%f\n", sv_info->sv_list[i].azimuth);
+ fprintf(stdout, "\t elevation:\t%f\n", sv_info->sv_list[i].elevation);
+ /* if prn > 65 and <= 88 this is a glonass sattelite */
+ fprintf(stdout, "\t prn:\t%d\n", sv_info->sv_list[i].prn);
+ fprintf(stdout, "\t size:\t%zu\n", sv_info->sv_list[i].size);
+ fprintf(stdout, "\t snr:\t%f\n", sv_info->sv_list[i].snr);
+ }
+
+}
+
+static void nmea_callback(GpsUtcTime timestamp, const char* nmea, int length)
+{
+ char buf[83];
+ fprintf(stdout, "*** nmea info\n");
+ fprintf(stdout, "timestamp:\t%ld\n", (long)timestamp);
+ /* NMEA sentences can only be between 11 ($TTFFF*CC\r\n) and 82 characters long */
+ if (length > 10 && length < 83) {
+ strncpy(buf, nmea, length);
+ buf[length] = '\0';
+ fprintf(stdout, "nmea (%d): \t%s\n", length, buf);
+ } else {
+ fprintf(stdout, "Invalid nmea data\n");
+ }
+}
+
+static void set_capabilities_callback(uint32_t capabilities)
+{
+ fprintf(stdout, "*** set capabilities\n");
+ fprintf(stdout, "capability is %.8x\n", capabilities);
+ /* do nothing */
+}
+
+static void acquire_wakelock_callback()
+{
+ fprintf(stdout, "*** acquire wakelock\n");
+ /* do nothing */
+}
+
+static void release_wakelock_callback()
+{
+ fprintf(stdout, "*** release wakelock\n");
+ /* do nothing */
+}
+
+struct ThreadWrapperContext {
+ void (*func)(void *);
+ void *user_data;
+};
+
+static void *thread_wrapper_context_main_func(void *user_data)
+{
+ struct ThreadWrapperContext *ctx = (struct ThreadWrapperContext *)user_data;
+
+ fprintf(stderr, " **** Thread wrapper start (start=%p, arg=%p) ****\n",
+ ctx->func, ctx->user_data);
+ ctx->func(ctx->user_data);
+ fprintf(stderr, " **** Thread wrapper end (start=%p, arg=%p) ****\n",
+ ctx->func, ctx->user_data);
+
+ free(ctx);
+
+ return NULL;
+}
+
+static pthread_t create_thread_callback(const char* name, void (*start)(void *), void* arg)
+{
+ pthread_t thread_id;
+ int error = 0;
+
+ /* Wrap thread function, so we can return void * to pthread and log start/end of thread */
+ struct ThreadWrapperContext *ctx = calloc(1, sizeof(struct ThreadWrapperContext));
+ ctx->func = start;
+ ctx->user_data = arg;
+
+ fprintf(stderr, " ** Creating thread: '%s' (start=%p, arg=%p)\n", name, start, arg);
+ /* Do not use a pthread_attr_t (we'd have to take care of bionic/glibc differences) */
+ error = pthread_create(&thread_id, NULL, thread_wrapper_context_main_func, ctx);
+ fprintf(stderr, " ** After thread_create: '%s', error=%d (start=%p, arg=%p)\n", name, error, start, arg);
+
+ if(error != 0)
+ return 0;
+
+ return thread_id;
+}
+
+static void agps_handle_status_callback(AGpsStatus *status)
+{
+ if(status->type)
+ {
+ fprintf(stdout, "*** gps type %d\n", status->type);
+ }
+ switch (status->status)
+ {
+ case GPS_REQUEST_AGPS_DATA_CONN:
+ fprintf(stdout, "*** data_conn_open\n");
+#ifndef HAS_ANDROID_4_2_0
+ AGps->data_conn_open(AGPS_TYPE_SUPL, apn, AGPS_APN_BEARER_IPV4);
+#else
+ AGps->data_conn_open(apn);
+#endif
+ break;
+ case GPS_RELEASE_AGPS_DATA_CONN:
+ fprintf(stdout, "*** data_conn_closed\n");
+#ifndef HAS_ANDROID_4_2_0
+ AGps->data_conn_closed(AGPS_TYPE_SUPL);
+#else
+ AGps->data_conn_closed();
+#endif
+ break;
+ case GPS_AGPS_DATA_CONNECTED:
+ fprintf(stdout, "*** data_conn_established\n");
+ break;
+ case GPS_AGPS_DATA_CONN_DONE:
+ fprintf(stdout, "*** data_conn_done\n");
+ break;
+ case GPS_AGPS_DATA_CONN_FAILED:
+ fprintf(stdout, "*** data_conn_FAILED\n");
+ break;
+ }
+}
+
+static void agps_ril_set_id_callback(uint32_t flags)
+{
+ fprintf(stdout, "*** set_id_cb\n");
+ AGpsRil->set_set_id(AGPS_SETID_TYPE_IMSI, "000000000000000");
+}
+
+static void agps_ril_refloc_callback(uint32_t flags)
+{
+ fprintf(stdout, "*** refloc_cb\n");
+ /* TODO : find out how to fill in location
+ AGpsRefLocation location;
+ AGpsRil->set_ref_location(&location, sizeof(location));
+ */
+}
+
+static void ni_notify_callback (GpsNiNotification *notification)
+{
+ fprintf(stdout, "*** ni notification callback\n");
+}
+
+static void download_xtra_request_callback (void)
+{
+ fprintf(stdout, "*** xtra download request to client\n");
+}
+
+#ifdef HAVE_ULP
+static void ulp_network_location_request_callback(UlpNetworkRequestPos *req)
+{
+ fprintf(stdout, "*** ulp network location request (request_type=%#x, interval_ms=%d, desired_position_source=%#x)\n",
+ req->request_type, req->interval_ms, req->desired_position_source);
+}
+
+static void ulp_request_phone_context_callback(UlpPhoneContextRequest *req)
+{
+ fprintf(stdout, "*** ulp phone context request (context_type=%#x, request_type=%#x, interval_ms=%d)\n",
+ req->context_type, req->request_type, req->interval_ms);
+
+ if (UlpPhoneContext) {
+ fprintf(stdout, "*** sending ulp phone context reply\n");
+ UlpPhoneContextSettings settings;
+ settings.context_type = req->context_type;
+ settings.is_gps_enabled = 1;
+ settings.is_agps_enabled = 1;
+ settings.is_network_position_available = 1;
+ settings.is_wifi_setting_enabled = 1;
+ settings.is_battery_charging = 0;
+ settings.is_enh_location_services_enabled = 1;
+ UlpPhoneContext->ulp_phone_context_settings_update(&settings);
+ }
+}
+#endif /* HAVE_ULP */
+
+GpsCallbacks callbacks = {
+ sizeof(GpsCallbacks),
+ location_callback,
+ status_callback,
+ sv_status_callback,
+ nmea_callback,
+ set_capabilities_callback,
+ acquire_wakelock_callback,
+ release_wakelock_callback,
+ create_thread_callback,
+};
+
+AGpsCallbacks callbacks2 = {
+ agps_handle_status_callback,
+ create_thread_callback,
+};
+
+AGpsRilCallbacks callbacks3 = {
+ agps_ril_set_id_callback,
+ agps_ril_refloc_callback,
+ create_thread_callback,
+};
+
+GpsNiCallbacks callbacks4 = {
+ ni_notify_callback,
+ create_thread_callback,
+};
+
+GpsXtraCallbacks callbacks5 = {
+ download_xtra_request_callback,
+ create_thread_callback,
+};
+
+#ifdef HAVE_ULP
+UlpNetworkLocationCallbacks callbacks6 = {
+ ulp_network_location_request_callback,
+};
+
+UlpPhoneContextCallbacks callbacks7 = {
+ ulp_request_phone_context_callback,
+};
+#endif /* HAVE_ULP */
+
+void sigint_handler(int signum)
+{
+ fprintf(stdout, "*** cleanup\n");
+ if(AGps)
+ {
+#ifndef HAS_ANDROID_4_2_0
+ AGps->data_conn_closed(AGPS_TYPE_SUPL);
+#else
+ AGps->data_conn_closed();
+#endif
+ }
+ if (Gps)
+ {
+ Gps->stop();
+ Gps->cleanup();
+ }
+ exit (0);
+}
+
+int main(int argc, char *argv[])
+{
+ int sleeptime = 6000, opt, initok = 0;
+ int coldstart = 0, extra = 0, ulp = 0;
+ struct timeval tv;
+ int agps = 0, agpsril = 0, injecttime = 0, injectlocation = 0;
+ char *location = 0, *longitude, *latitude;
+ float accuracy = 100; /* Use 100m as location accuracy by default */
+
+ while ((opt = getopt(argc, argv, "acl:p:rtux")) != -1)
+ {
+ switch (opt) {
+ case 'a':
+ agps = 1;
+ fprintf(stdout, "*** Using agps\n");
+ break;
+ case 'c':
+ coldstart = 1;
+ fprintf(stdout, "*** Using cold start\n");
+ break;
+ case 'l':
+ injectlocation = 1;
+ location = optarg;
+ fprintf(stdout, "*** Location info %s will be injected\n", location);
+ break;
+ case 'r':
+ agpsril = 1;
+ fprintf(stdout, "*** Using agpsril\n");
+ break;
+ case 't':
+ injecttime = 1;
+ fprintf(stdout, "*** Timing info will be injected\n");
+ break;
+ case 'p':
+ apn = optarg;
+ break;
+ case 'u':
+ ulp = 1;
+ break;
+ case 'x':
+ extra = 1;
+ fprintf(stdout, "*** Allowing for Xtra downloads\n");
+ break;
+ default:
+ fprintf(stderr, "\n Usage: %s \n \
+ \t-a for agps,\n \
+ \t-c for coldstarting the gps,\n \
+ \t-p <apn name> to specify an apn name,\n \
+ \t-r for agpsril,\n \
+ \t-t to inject time,\n \
+ \t-u to use ULP (if available,\n \
+ \t-x deal with Xtra gps data.\n \
+ \tnone for standalone gps\n",
+ argv[0]);
+ exit(1);
+ }
+ }
+
+ if(!apn)
+ {
+ apn = strdup("Internet");
+ }
+
+ fprintf(stdout, "*** setup signal handler\n");
+ signal(SIGINT, sigint_handler);
+
+ fprintf(stdout, "*** get gps interface\n");
+ Gps = get_gps_interface();
+
+ fprintf(stdout, "*** init gps interface\n");
+ initok = Gps->init(&callbacks);
+ fprintf(stdout, "*** setting positioning mode\n");
+ /* need to be done before starting gps or no info will come out */
+ if((agps||agpsril) && !initok)
+ Gps->set_position_mode(GPS_POSITION_MODE_MS_BASED, GPS_POSITION_RECURRENCE_PERIODIC, 1000, 0, 0);
+ else
+ Gps->set_position_mode(GPS_POSITION_MODE_STANDALONE, GPS_POSITION_RECURRENCE_PERIODIC, 1000, 0, 0);
+
+ if (Gps && !initok && (agps||agpsril))
+ {
+ fprintf(stdout, "*** get agps interface\n");
+ AGps = get_agps_interface(Gps);
+ if (AGps)
+ {
+ fprintf(stdout, "*** set up agps interface\n");
+ AGps->init(&callbacks2);
+ fprintf(stdout, "*** set up agps server\n");
+ AGps->set_server(AGPS_TYPE_SUPL, "supl.google.com", 7276);
+ }
+
+ if(agpsril)
+ {
+ fprintf(stdout, "*** get agps ril interface\n");
+
+ AGpsRil = get_agps_ril_interface(Gps);
+ if (AGpsRil)
+ {
+ AGpsRil->init(&callbacks3);
+ }
+ }
+ /* if coldstart is requested, delete all location info */
+ if(coldstart)
+ {
+ fprintf(stdout, "*** delete aiding data\n");
+ Gps->delete_aiding_data(GPS_DELETE_ALL);
+ }
+
+ if(extra)
+ {
+ fprintf(stdout, "*** xtra aiding data init\n");
+ GpsExtra = get_gps_extra_interface(Gps);
+ if(GpsExtra)
+ GpsExtra->init(&callbacks5);
+ }
+
+ fprintf(stdout, "*** setting up network notification handling\n");
+ GpsNi = get_gps_ni_interface(Gps);
+ if(GpsNi)
+ {
+ GpsNi->init(&callbacks4);
+ }
+
+#ifdef HAVE_ULP
+ if(ulp)
+ {
+ UlpNetwork = get_ulp_network_interface(Gps);
+ if (UlpNetwork) {
+ fprintf(stdout, "*** got ulp network interface\n");
+ if (UlpNetwork->init(&callbacks6) != 0) {
+ fprintf(stdout, "*** FAILED to init ulp network interface\n");
+ UlpNetwork = NULL;
+ }
+ }
+ else
+ fprintf(stdout, "*** ULP failed!\n");
+
+ UlpPhoneContext = get_ulp_phone_context_interface(Gps);
+ if (UlpPhoneContext) {
+ fprintf(stdout, "*** got ulp phone context interface\n");
+ UlpPhoneContext->init(&callbacks7);
+ }
+ }
+#endif /* HAVE_ULP */
+ }
+ if(injecttime)
+ {
+ fprintf(stdout, "*** aiding gps by injecting time information\n");
+ gettimeofday(&tv, NULL);
+ Gps->inject_time(tv.tv_sec, tv.tv_sec, 0);
+ }
+
+ if(injectlocation)
+ {
+ fprintf(stdout, "*** aiding gps by injecting location information\n");
+ //Gps->inject_location(double latitude, double longitude, float accuracy);
+ latitude = strtok(location, ",");
+ longitude = strtok(NULL, ",");
+ Gps->inject_location(strtod(latitude, NULL), strtod(longitude, NULL), accuracy);
+ }
+
+ fprintf(stdout, "*** start gps track\n");
+ Gps->start();
+
+ fprintf(stdout, "*** gps tracking started\n");
+
+ while(sleeptime > 0)
+ {
+ fprintf(stdout, "*** tracking.... \n");
+ sleep(100);
+ sleeptime = sleeptime - 100;
+ }
+
+ if (AGps)
+ AGps->data_conn_closed(AGPS_TYPE_SUPL);
+ fprintf(stdout, "*** stop tracking\n");
+ Gps->stop();
+ fprintf(stdout, "*** cleaning up\n");
+ Gps->cleanup();
+
+ return 0;
+}
--- /dev/null
+/*
+ * Copyright (c) 2012 Carsten Munk <carsten.munk@gmail.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <EGL/egl.h>
+#include <GLES2/gl2.h>
+#include <assert.h>
+#include <stdio.h>
+#include <math.h>
+#include <stddef.h>
+#include <hwcomposer_window.h>
+#include <hardware/hardware.h>
+#include <hardware/hwcomposer.h>
+#include <malloc.h>
+#include <sync/sync.h>
+
+const char vertex_src [] =
+" \
+ attribute vec4 position; \
+ varying mediump vec2 pos; \
+ uniform vec4 offset; \
+ \
+ void main() \
+ { \
+ gl_Position = position + offset; \
+ pos = position.xy; \
+ } \
+";
+
+
+const char fragment_src [] =
+" \
+ varying mediump vec2 pos; \
+ uniform mediump float phase; \
+ \
+ void main() \
+ { \
+ gl_FragColor = vec4( 1., 0.9, 0.7, 1.0 ) * \
+ cos( 30.*sqrt(pos.x*pos.x + 1.5*pos.y*pos.y) \
+ + atan(pos.y,pos.x) - phase ); \
+ } \
+";
+
+GLuint load_shader(const char *shader_source, GLenum type)
+{
+ GLuint shader = glCreateShader(type);
+
+ glShaderSource(shader, 1, &shader_source, NULL);
+ glCompileShader(shader);
+
+ return shader;
+}
+
+
+GLfloat norm_x = 0.0;
+GLfloat norm_y = 0.0;
+GLfloat offset_x = 0.0;
+GLfloat offset_y = 0.0;
+GLfloat p1_pos_x = 0.0;
+GLfloat p1_pos_y = 0.0;
+
+GLint phase_loc;
+GLint offset_loc;
+GLint position_loc;
+
+const float vertexArray[] = {
+ 0.0, 1.0, 0.0,
+ -1., 0.0, 0.0,
+ 0.0, -1.0, 0.0,
+ 1., 0.0, 0.0,
+ 0.0, 1., 0.0
+};
+
+
+int main(int argc, char **argv)
+{
+ EGLDisplay display;
+ EGLConfig ecfg;
+ EGLint num_config;
+ EGLint attr[] = { // some attributes to set up our egl-interface
+ EGL_BUFFER_SIZE, 32,
+ EGL_RENDERABLE_TYPE,
+ EGL_OPENGL_ES2_BIT,
+ EGL_NONE
+ };
+ EGLSurface surface;
+ EGLint ctxattr[] = {
+ EGL_CONTEXT_CLIENT_VERSION, 2,
+ EGL_NONE
+ };
+ EGLContext context;
+
+ EGLBoolean rv;
+
+ int err;
+ hw_module_t *hwcModule = 0;
+ hwc_composer_device_1_t *hwcDevicePtr = 0;
+
+ err = hw_get_module(HWC_HARDWARE_MODULE_ID, (const hw_module_t **) &hwcModule);
+ assert(err == 0);
+
+ err = hwc_open_1(hwcModule, &hwcDevicePtr);
+ assert(err == 0);
+
+ hwcDevicePtr->blank(hwcDevicePtr, 0, 0);
+
+ uint32_t configs[5];
+ size_t numConfigs = 5;
+
+ err = hwcDevicePtr->getDisplayConfigs(hwcDevicePtr, 0, configs, &numConfigs);
+ assert (err == 0);
+
+ int32_t attr_values[2];
+ uint32_t attributes[] = { HWC_DISPLAY_WIDTH, HWC_DISPLAY_HEIGHT, HWC_DISPLAY_NO_ATTRIBUTE };
+
+ hwcDevicePtr->getDisplayAttributes(hwcDevicePtr, 0,
+ configs[0], attributes, attr_values);
+
+ printf("width: %i height: %i\n", attr_values[0], attr_values[1]);
+
+ HWComposerNativeWindow *win = new HWComposerNativeWindow(attr_values[0], attr_values[1], HAL_PIXEL_FORMAT_RGBA_8888);
+
+
+ display = eglGetDisplay(NULL);
+ assert(eglGetError() == EGL_SUCCESS);
+ assert(display != EGL_NO_DISPLAY);
+
+ rv = eglInitialize(display, 0, 0);
+ assert(eglGetError() == EGL_SUCCESS);
+ assert(rv == EGL_TRUE);
+
+ eglChooseConfig((EGLDisplay) display, attr, &ecfg, 1, &num_config);
+ assert(eglGetError() == EGL_SUCCESS);
+ assert(rv == EGL_TRUE);
+
+ surface = eglCreateWindowSurface((EGLDisplay) display, ecfg, (EGLNativeWindowType) static_cast<ANativeWindow *> (win), NULL);
+ assert(eglGetError() == EGL_SUCCESS);
+ assert(surface != EGL_NO_SURFACE);
+
+ context = eglCreateContext((EGLDisplay) display, ecfg, EGL_NO_CONTEXT, ctxattr);
+ assert(eglGetError() == EGL_SUCCESS);
+ assert(context != EGL_NO_CONTEXT);
+
+ assert(eglMakeCurrent((EGLDisplay) display, surface, surface, context) == EGL_TRUE);
+
+ const char *version = (const char *)glGetString(GL_VERSION);
+ assert(version);
+ printf("%s\n",version);
+
+ size_t size = sizeof(hwc_display_contents_1_t) + 2 * sizeof(hwc_layer_1_t);
+ hwc_display_contents_1_t *list = (hwc_display_contents_1_t *) malloc(size);
+ hwc_display_contents_1_t **mList = (hwc_display_contents_1_t **) malloc(HWC_NUM_DISPLAY_TYPES * sizeof(hwc_display_contents_1_t *));
+ const hwc_rect_t r = { 0, 0, attr_values[0], attr_values[1] };
+
+ int counter = 0;
+ for (; counter < HWC_NUM_DISPLAY_TYPES; counter++)
+ mList[counter] = list;
+
+ hwc_layer_1_t *layer = &list->hwLayers[0];
+ memset(layer, 0, sizeof(hwc_layer_1_t));
+ layer->compositionType = HWC_FRAMEBUFFER;
+ layer->hints = 0;
+ layer->flags = 0;
+ layer->handle = 0;
+ layer->transform = 0;
+ layer->blending = HWC_BLENDING_NONE;
+ layer->sourceCrop = r;
+ layer->displayFrame = r;
+ layer->visibleRegionScreen.numRects = 1;
+ layer->visibleRegionScreen.rects = &layer->displayFrame;
+ layer->acquireFenceFd = -1;
+ layer->releaseFenceFd = -1;
+ layer = &list->hwLayers[1];
+ memset(layer, 0, sizeof(hwc_layer_1_t));
+ layer->compositionType = HWC_FRAMEBUFFER_TARGET;
+ layer->hints = 0;
+ layer->flags = 0;
+ layer->handle = 0;
+ layer->transform = 0;
+ layer->blending = HWC_BLENDING_NONE;
+ layer->sourceCrop = r;
+ layer->displayFrame = r;
+ layer->visibleRegionScreen.numRects = 1;
+ layer->visibleRegionScreen.rects = &layer->displayFrame;
+ layer->acquireFenceFd = -1;
+ layer->releaseFenceFd = -1;
+
+ list->retireFenceFd = -1;
+ list->flags = HWC_GEOMETRY_CHANGED;
+ list->numHwLayers = 2;
+
+ GLuint vertexShader = load_shader ( vertex_src , GL_VERTEX_SHADER ); // load vertex shader
+ GLuint fragmentShader = load_shader ( fragment_src , GL_FRAGMENT_SHADER ); // load fragment shader
+
+ GLuint shaderProgram = glCreateProgram (); // create program object
+ glAttachShader ( shaderProgram, vertexShader ); // and attach both...
+ glAttachShader ( shaderProgram, fragmentShader ); // ... shaders to it
+
+ glLinkProgram ( shaderProgram ); // link the program
+ glUseProgram ( shaderProgram ); // and select it for usage
+
+ //// now get the locations (kind of handle) of the shaders variables
+ position_loc = glGetAttribLocation ( shaderProgram , "position" );
+ phase_loc = glGetUniformLocation ( shaderProgram , "phase" );
+ offset_loc = glGetUniformLocation ( shaderProgram , "offset" );
+ if ( position_loc < 0 || phase_loc < 0 || offset_loc < 0 ) {
+ return 1;
+ }
+
+ //glViewport ( 0 , 0 , 800, 600); // commented out so it uses the initial window dimensions
+ glClearColor ( 1. , 1. , 1. , 1.); // background color
+ float phase = 0;
+ int i, oldretire = -1, oldrelease = -1, oldrelease2 = -1;
+ for (i=0; i<1020*60; ++i) {
+ glClear(GL_COLOR_BUFFER_BIT);
+ glUniform1f ( phase_loc , phase ); // write the value of phase to the shaders phase
+ phase = fmodf ( phase + 0.5f , 2.f * 3.141f ); // and update the local variable
+
+ glUniform4f ( offset_loc , offset_x , offset_y , 0.0 , 0.0 );
+
+ glVertexAttribPointer ( position_loc, 3, GL_FLOAT, GL_FALSE, 0, vertexArray );
+ glEnableVertexAttribArray ( position_loc );
+ glDrawArrays ( GL_TRIANGLE_STRIP, 0, 5 );
+
+ eglSwapBuffers ( (EGLDisplay) display, surface ); // get the rendered buffer to the screen
+
+ HWComposerNativeWindowBuffer *front;
+ win->lockFrontBuffer(&front);
+
+ mList[0]->hwLayers[1].handle = front->handle;
+ mList[0]->hwLayers[0].handle = NULL;
+ mList[0]->hwLayers[0].flags = HWC_SKIP_LAYER;
+
+ oldretire = mList[0]->retireFenceFd;
+ oldrelease = mList[0]->hwLayers[1].releaseFenceFd;
+ oldrelease2 = mList[0]->hwLayers[0].releaseFenceFd;
+
+ int err = hwcDevicePtr->prepare(hwcDevicePtr, HWC_NUM_DISPLAY_TYPES, mList);
+ assert(err == 0);
+
+ err = hwcDevicePtr->set(hwcDevicePtr, HWC_NUM_DISPLAY_TYPES, mList);
+ assert(err == 0);
+
+ assert(mList[0]->hwLayers[0].releaseFenceFd == -1);
+
+ win->unlockFrontBuffer(front);
+
+ if (oldrelease != -1)
+ {
+ sync_wait(oldrelease, -1);
+ close(oldrelease);
+ }
+ if (oldrelease2 != -1)
+ {
+ sync_wait(oldrelease2, -1);
+ close(oldrelease2);
+ }
+ if (oldretire != -1)
+ {
+ sync_wait(oldretire, -1);
+ close(oldretire);
+ }
+ }
+
+ printf("stop\n");
+
+#if 0
+ (*egldestroycontext)((EGLDisplay) display, context);
+ printf("destroyed context\n");
+
+ (*egldestroysurface)((EGLDisplay) display, surface);
+ printf("destroyed surface\n");
+ (*eglterminate)((EGLDisplay) display);
+ printf("terminated\n");
+ android_dlclose(baz);
+#endif
+}
+
+// vim:ts=4:sw=4:noexpandtab
--- /dev/null
+/*
+ * Copyright (C) 2013 Canonical Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authored by: Thomas Voß <thomas.voss@canonical.com>
+ * Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
+ */
+
+#include <stddef.h>
+#include <stdio.h>
+#include <stdbool.h>
+#include <signal.h>
+
+#include <hybris/input/input_stack_compatibility_layer.h>
+
+bool g_stop = false;
+
+void signal_handler(int sig)
+{
+ g_stop = true;
+}
+
+void on_new_event(struct Event* event, void* context)
+{
+ printf("%s", __PRETTY_FUNCTION__);
+
+ printf("\tEventType: %d \n", event->type);
+ printf("\tdevice_id: %d \n", event->device_id);
+ printf("\tsource_id: %d \n", event->source_id);
+ printf("\taction: %d \n", event->action);
+ printf("\tflags: %d \n", event->flags);
+ printf("\tmeta_state: %d \n", event->meta_state);
+
+ switch (event->type) {
+ case MOTION_EVENT_TYPE:
+ printf("\tdetails.motion.event_time: %lld\n",
+ event->details.motion.event_time);
+ printf("\tdetails.motion.pointer_coords.x: %f\n",
+ event->details.motion.pointer_coordinates[0].x);
+ printf("\tdetails.motion.pointer_coords.y: %f\n",
+ event->details.motion.pointer_coordinates[0].y);
+ break;
+ default:
+ break;
+ }
+}
+
+int main(int argc, char** argv)
+{
+ g_stop = false;
+ signal(SIGINT, signal_handler);
+
+ struct AndroidEventListener listener;
+ listener.on_new_event = on_new_event;
+ listener.context = NULL;
+
+ struct InputStackConfiguration config = {
+ enable_touch_point_visualization : true,
+ default_layer_for_touch_point_visualization : 10000,
+ input_area_width : 1024,
+ input_area_height : 1024
+ };
+
+ android_input_stack_initialize(&listener, &config);
+ android_input_stack_start_waiting_for_flag(&g_stop);
+
+ android_input_stack_stop();
+ android_input_stack_shutdown();
+}
--- /dev/null
+/*
+ * Copyright (c) 2013 Simon Busch <morphis@gravedo.de>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <memory.h>
+#include <assert.h>
+#include <stdio.h>
+#include <android/hardware/lights.h>
+
+int main(int argc, char **argv)
+{
+ struct hw_module_t *hwmod = 0;
+ struct light_device_t *notifications = 0;
+ struct light_state_t notification_state;
+
+ hw_get_module(LIGHTS_HARDWARE_MODULE_ID, (const hw_module_t**) &hwmod);
+ assert(hwmod != NULL);
+
+ assert(light_device_open(hwmod, LIGHT_ID_NOTIFICATIONS, ¬ifications) == 0);
+ assert(notifications != 0);
+
+ memset(¬ification_state, 0, sizeof(struct light_state_t));
+ notification_state.color = 0xffffffff;
+ notification_state.flashMode = LIGHT_FLASH_TIMED;
+ notification_state.flashOnMS = 1000;
+ notification_state.flashOffMS = 1000;
+
+ assert(notifications->set_light(notifications, ¬ification_state) == 0);
+
+ light_device_close(notifications);
+
+ return 0;
+}
+
+// vim:ts=4:sw=4:noexpandtab
--- /dev/null
+/*
+ * Copyright (C) 2012 Jolla Ltd.
+ * Contact: Aaron McCarthy <aaron.mccarthy@jollamobile.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+#include <assert.h>
+#include <stdio.h>
+#include <pthread.h>
+#include <stdlib.h>
+#include <getopt.h>
+
+#include <hardware/hardware.h>
+#include <hardware/nfc.h>
+#include <libnfc-nxp/phLibNfc.h>
+#include <libnfc-nxp/phDal4Nfc_messageQueueLib.h>
+
+static int messageThreadRunning = 0;
+static int numberOfDiscoveredTargets = 0;
+static phLibNfc_RemoteDevList_t *discoveredTargets = 0;
+static NFCSTATUS targetStatus = 0xFFFF;
+static phLibNfc_sRemoteDevInformation_t *connectedRemoteDevInfo = 0;
+static phLibNfc_ChkNdef_Info_t ndefInfo;
+static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
+static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+
+static void *messageThreadFunc(void *arg)
+{
+ int *clientId = (int *)arg;
+ messageThreadRunning = 1;
+ while (messageThreadRunning) {
+ phDal4Nfc_Message_Wrapper_t message;
+ int ret = phDal4Nfc_msgrcv(*clientId, &message,
+ sizeof(phLibNfc_Message_t), 0, 0);
+ if (ret == -1) {
+ fprintf(stderr, "Failed to receive message from NFC stack.\n");
+ continue;
+ }
+
+ switch (message.msg.eMsgType) {
+ case PH_LIBNFC_DEFERREDCALL_MSG: {
+ phLibNfc_DeferredCall_t *msg = (phLibNfc_DeferredCall_t *)message.msg.pMsgData;
+ if (msg->pCallback)
+ msg->pCallback(msg->pParameter);
+ break;
+ }
+ default:
+ fprintf(stderr, "Unknown message type %d.", message.msg.eMsgType);
+ }
+
+ pthread_cond_signal(&cond);
+ }
+
+ return 0;
+}
+
+static pthread_t createMessageThread(void *arg)
+{
+ pthread_t thread_id;
+ int error = pthread_create(&thread_id, NULL, messageThreadFunc, arg);
+ if (error != 0)
+ return 0;
+
+ return thread_id;
+}
+
+static void terminateMessageThread(int clientId)
+{
+ messageThreadRunning = 0;
+
+ phDal4Nfc_Message_Wrapper_t message;
+ phLibNfc_DeferredCall_t *msg;
+
+ msg = (phLibNfc_DeferredCall_t *)malloc(sizeof(phLibNfc_DeferredCall_t));
+ msg->pCallback = 0;
+ msg->pParameter = 0;
+ message.msg.eMsgType = PH_LIBNFC_DEFERREDCALL_MSG;
+ message.msg.pMsgData = msg;
+ message.msg.Size = sizeof(phLibNfc_DeferredCall_t);
+
+ phDal4Nfc_msgsnd(clientId, &message, sizeof(phLibNfc_Message_t), 0);
+}
+
+void initializeCallback(void *pContext, NFCSTATUS status)
+{
+ NFCSTATUS *callbackStatus = (NFCSTATUS *)pContext;
+ *callbackStatus = status;
+}
+
+void discoveryNotificationCallback(void *pContext, phLibNfc_RemoteDevList_t *psRemoteDevList,
+ uint8_t uNofRemoteDev, NFCSTATUS status)
+{
+ if (status == NFCSTATUS_DESELECTED) {
+ fprintf(stderr, "Target deselected\n");
+ } else {
+ fprintf(stderr, "Discovered %d targets\n", uNofRemoteDev);
+
+ uint8_t i;
+ for (i = 0; i < uNofRemoteDev; ++i) {
+ fprintf(stderr, "Target[%d]\n\tType: %d\n\tSession: %d\n", i,
+ psRemoteDevList[i].psRemoteDevInfo->RemDevType,
+ psRemoteDevList[i].psRemoteDevInfo->SessionOpened);
+ }
+ numberOfDiscoveredTargets = uNofRemoteDev;
+ discoveredTargets = psRemoteDevList;
+ targetStatus = status;
+ }
+}
+
+void discoveryCallback(void *pContext, NFCSTATUS status)
+{
+ fprintf(stderr, "discoveryCallback %d\n", status);
+}
+
+void remoteDevConnectCallback(void *pContext, phLibNfc_Handle hRemoteDev,
+ phLibNfc_sRemoteDevInformation_t *psRemoteDevInfo, NFCSTATUS status)
+{
+ targetStatus = status;
+ connectedRemoteDevInfo = psRemoteDevInfo;
+}
+
+void remoteDevNdefReadCheckCallback(void *pContext, phLibNfc_ChkNdef_Info_t Ndef_Info,
+ NFCSTATUS status)
+{
+ ndefInfo = Ndef_Info;
+ targetStatus = status;
+}
+
+void remoteDevNdefReadCallback(void *pContext, NFCSTATUS status)
+{
+ targetStatus = status;
+}
+
+void testNfc(int readNdefMessages)
+{
+ printf("Starting test_nfc.\n");
+
+ const hw_module_t *hwModule = 0;
+ nfc_pn544_device_t *nfcDevice = 0;
+
+ printf("Finding NFC hardware module.\n");
+ hw_get_module(NFC_HARDWARE_MODULE_ID, &hwModule);
+ assert(hwModule != NULL);
+
+ printf("Opening NFC device.\n");
+ assert(nfc_pn544_open(hwModule, &nfcDevice) == 0);
+ assert(nfcDevice != 0);
+
+ assert(nfcDevice->num_eeprom_settings != 0);
+ assert(nfcDevice->eeprom_settings);
+
+ printf("Configuring NFC driver.\n");
+ phLibNfc_sConfig_t driverConfig;
+ driverConfig.nClientId = phDal4Nfc_msgget(0, 0600);
+ assert(driverConfig.nClientId);
+
+ void *hwRef;
+ NFCSTATUS status = phLibNfc_Mgt_ConfigureDriver(&driverConfig, &hwRef);
+ assert(hwRef);
+ assert(status == NFCSTATUS_SUCCESS);
+
+ pthread_t messageThread = createMessageThread(&driverConfig.nClientId);
+
+ printf("Initializing NFC stack.\n");
+ NFCSTATUS callbackStatus = 0xFFFF;
+ status = phLibNfc_Mgt_Initialize(hwRef, initializeCallback, &callbackStatus);
+ assert(status == NFCSTATUS_PENDING);
+
+ pthread_mutex_lock(&mut);
+ while (callbackStatus == 0xFFFF)
+ pthread_cond_wait(&cond, &mut);
+ pthread_mutex_unlock(&mut);
+
+ assert(callbackStatus == NFCSTATUS_SUCCESS);
+
+ printf("Getting NFC stack capabilities.\n");
+ phLibNfc_StackCapabilities_t capabilities;
+ status = phLibNfc_Mgt_GetstackCapabilities(&capabilities, &callbackStatus);
+ assert(status == NFCSTATUS_SUCCESS);
+
+ printf("NFC capabilities:\n"
+ "\tHAL version: %u\n"
+ "\tFW version: %u\n"
+ "\tHW version: %u\n"
+ "\tModel: %u\n"
+ "\tHCI version: %u\n"
+ "\tVendor: %s\n"
+ "\tFull version: %u %u\n"
+ "\tFW Update: %u\n",
+ capabilities.psDevCapabilities.hal_version, capabilities.psDevCapabilities.fw_version,
+ capabilities.psDevCapabilities.hw_version, capabilities.psDevCapabilities.model_id,
+ capabilities.psDevCapabilities.hci_version,
+ capabilities.psDevCapabilities.vendor_name,
+ capabilities.psDevCapabilities.full_version[NXP_FULL_VERSION_LEN-1],
+ capabilities.psDevCapabilities.full_version[NXP_FULL_VERSION_LEN-2],
+ capabilities.psDevCapabilities.firmware_update_info);
+
+ if (readNdefMessages) {
+ /* Start tag discovery */
+ phLibNfc_Registry_Info_t registryInfo;
+
+ registryInfo.MifareUL = 1;
+ registryInfo.MifareStd = 1;
+ registryInfo.ISO14443_4A = 1;
+ registryInfo.ISO14443_4B = 1;
+ registryInfo.Jewel = 1;
+ registryInfo.Felica = 1;
+ registryInfo.NFC = 1;
+ registryInfo.ISO15693 = 1;
+
+ int context;
+ status = phLibNfc_RemoteDev_NtfRegister(®istryInfo, discoveryNotificationCallback, &context);
+ assert(status == NFCSTATUS_SUCCESS);
+
+ phLibNfc_sADD_Cfg_t discoveryConfig;
+ discoveryConfig.NfcIP_Mode = phNfc_eP2P_ALL;
+ discoveryConfig.NfcIP_Target_Mode = 0x0E;
+ discoveryConfig.Duration = 300000;
+ discoveryConfig.NfcIP_Tgt_Disable = 0;
+ discoveryConfig.PollDevInfo.PollCfgInfo.EnableIso14443A = 1;
+ discoveryConfig.PollDevInfo.PollCfgInfo.EnableIso14443B = 1;
+ discoveryConfig.PollDevInfo.PollCfgInfo.EnableFelica212 = 1;
+ discoveryConfig.PollDevInfo.PollCfgInfo.EnableFelica424 = 1;
+ discoveryConfig.PollDevInfo.PollCfgInfo.EnableIso15693 = 1;
+ discoveryConfig.PollDevInfo.PollCfgInfo.EnableNfcActive = 1;
+ discoveryConfig.PollDevInfo.PollCfgInfo.DisableCardEmulation = 1;
+
+ targetStatus = 0xFFFF;
+ status = phLibNfc_Mgt_ConfigureDiscovery(NFC_DISCOVERY_CONFIG, discoveryConfig,
+ discoveryCallback, &context);
+
+ for (;;) {
+ pthread_mutex_lock(&mut);
+ while (targetStatus == 0xFFFF)
+ pthread_cond_wait(&cond, &mut);
+ pthread_mutex_unlock(&mut);
+
+ fprintf(stderr, "Discovered %d targets\n", numberOfDiscoveredTargets);
+ if (numberOfDiscoveredTargets > 0) {
+ targetStatus = 0xFFFF;
+ status = phLibNfc_RemoteDev_Connect(discoveredTargets[0].hTargetDev,
+ remoteDevConnectCallback, &context);
+ if (status == NFCSTATUS_PENDING) {
+ pthread_mutex_lock(&mut);
+ while (targetStatus == 0xFFFF)
+ pthread_cond_wait(&cond, &mut);
+ pthread_mutex_unlock(&mut);
+
+ if (targetStatus == NFCSTATUS_SUCCESS) {
+ targetStatus = 0xFFFF;
+ status = phLibNfc_Ndef_CheckNdef(discoveredTargets[0].hTargetDev,
+ remoteDevNdefReadCheckCallback, &context);
+
+ pthread_mutex_lock(&mut);
+ while (targetStatus == 0xFFFF)
+ pthread_cond_wait(&cond, &mut);
+ pthread_mutex_unlock(&mut);
+
+ if (targetStatus == NFCSTATUS_SUCCESS &&
+ (ndefInfo.NdefCardState == PHLIBNFC_NDEF_CARD_READ_WRITE ||
+ ndefInfo.NdefCardState == PHLIBNFC_NDEF_CARD_READ_ONLY)) {
+ phLibNfc_Data_t ndefBuffer;
+ ndefBuffer.length = ndefInfo.MaxNdefMsgLength;
+ ndefBuffer.buffer = malloc(ndefBuffer.length);
+
+ targetStatus = 0xFFFF;
+ status = phLibNfc_Ndef_Read(discoveredTargets[0].hTargetDev, &ndefBuffer,
+ phLibNfc_Ndef_EBegin, remoteDevNdefReadCallback, &context);
+
+ pthread_mutex_lock(&mut);
+ while (targetStatus == 0xFFFF)
+ pthread_cond_wait(&cond, &mut);
+ pthread_mutex_unlock(&mut);
+
+ if (targetStatus == NFCSTATUS_SUCCESS) {
+ int i;
+ fprintf(stderr, "NDEF: ");
+ for (i = 0; i < ndefBuffer.length; ++i)
+ fprintf(stderr, "%02x", ndefBuffer.buffer[i]);
+ fprintf(stderr, "\n");
+ }
+
+ free(ndefBuffer.buffer);
+ }
+ }
+ }
+ }
+
+ if (status == NFCSTATUS_FAILED) {
+ fprintf(stderr, "Failed to connect to remote device\n");
+ break;
+ }
+
+ targetStatus = 0xFFFF;
+ status = phLibNfc_Mgt_ConfigureDiscovery(NFC_DISCOVERY_RESUME, discoveryConfig,
+ discoveryCallback, &context);
+ assert(status == NFCSTATUS_SUCCESS || status == NFCSTATUS_PENDING);
+ }
+ }
+
+ printf("Deinitializing NFC stack.\n");
+ callbackStatus = 0xFFFF;
+ status = phLibNfc_Mgt_DeInitialize(hwRef, initializeCallback, &callbackStatus);
+ assert(status == NFCSTATUS_PENDING);
+
+ pthread_mutex_lock(&mut);
+ while (callbackStatus == 0xFFFF)
+ pthread_cond_wait(&cond, &mut);
+ pthread_mutex_unlock(&mut);
+
+ assert(callbackStatus == NFCSTATUS_SUCCESS);
+
+ terminateMessageThread(driverConfig.nClientId);
+ pthread_join(messageThread, NULL);
+
+ printf("Unconfiguring NFC driver.\n");
+ status = phLibNfc_Mgt_UnConfigureDriver(hwRef);
+ assert(status == NFCSTATUS_SUCCESS);
+
+ int result = phDal4Nfc_msgctl(driverConfig.nClientId, 0, 0);
+ assert(result == 0);
+
+ printf("Closing NFC device.\n");
+ nfc_pn544_close(nfcDevice);
+}
+
+int main(int argc, char **argv)
+{
+ int opt;
+ int readNdefMessages = 0;
+ int restartOnFailure = 0;
+
+ while ((opt = getopt(argc, argv, "nrh")) != -1) {
+ switch (opt) {
+ case 'n':
+ readNdefMessages = 1;
+ fprintf(stdout, "Reading NDEF messages from targets\n");
+ break;
+ case 'r':
+ restartOnFailure = 1;
+ readNdefMessages = 1;
+ fprintf(stdout, "Restarting on NDEF read failure, implies -n\n");
+ break;
+ case 'h':
+ default:
+ fprintf(stderr, "\n Usage: %s \n"
+ "\t-n Read NDEF message from targets,\n"
+ "\t-r Restart on NDEF read failure.\n", argv[0]);
+ return 1;
+ }
+ }
+
+ do {
+ testNfc(readNdefMessages);
+ } while (restartOnFailure && readNdefMessages);
+
+ return 0;
+}
--- /dev/null
+/*
+ * Copyright (c) 2012 Simon Busch <morphis@gravedo.de>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <android/hardware/sensors.h>
+
+int main(int argc, char **argv)
+{
+ struct hw_module_t *hwmod;
+ struct sensors_poll_device_t *dev;
+
+ hw_get_module(SENSORS_HARDWARE_MODULE_ID, (const hw_module_t**) &hwmod);
+ assert(hwmod != NULL);
+
+ if (sensors_open(hwmod, &dev) < 0) {
+ printf("ERROR: failed to open sensors device\n");
+ exit(1);
+ }
+
+ if (sensors_close(dev) < 0) {
+ printf("ERROR: failed to close sensors device\n");
+ exit(1);
+ }
+
+ return 0;
+}
+
+// vim:ts=4:sw=4:noexpandtab
--- /dev/null
+/*
+ * Copyright (C) 2013 Canonical Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Authored by: Thomas Voss <thomas.voss@canonical.com>
+ * Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
+ */
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <limits.h>
+
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+
+#include <hybris/surface_flinger/surface_flinger_compatibility_layer.h>
+
+struct SfSurface* sf_surface_create(struct SfClient* client, SfSurfaceCreationParameters* params);
+EGLSurface sf_surface_get_egl_surface(struct SfSurface*);
+void sf_surface_make_current(struct SfSurface* surface);
+
+void sf_surface_move_to(struct SfSurface* surface, int x, int y);
+void sf_surface_set_layer(struct SfSurface* surface, int layer);
+void sf_surface_set_alpha(struct SfSurface* surface, float alpha);
+
+double rotation_increment = 0.01;
+
+/* animation state variables */
+GLfloat rotation_angle = 0.0f;
+
+static GLuint gProgram;
+static GLuint gvPositionHandle, gvColorHandle;
+static GLuint rotation_uniform;
+static GLint num_vertex = 3;
+static const GLfloat triangle[] = {
+ -0.125f, -0.125f, 0.0f, 0.5f,
+ 0.0f, 0.125f, 0.0f, 0.5f,
+ 0.125f, -0.125f, 0.0f, 0.5f };
+static const GLfloat color_triangle[] = {
+ 0.0f, 0.0f, 1.0f, 1.0f,
+ 0.0f, 1.0f, 0.0f, 1.0f,
+ 1.0f, 0.0f, 0.0f, 0.0f };
+const GLfloat * vertex_data;
+const GLfloat * color_data;
+static const char gVertexShader[] =
+ "attribute vec4 vPosition;\n"
+ "attribute vec4 vColor;\n"
+ "uniform float angle;\n"
+ "varying vec4 colorinfo;\n"
+ "void main() {\n"
+ " mat3 rot_z = mat3( vec3( cos(angle), sin(angle), 0.0),\n"
+ " vec3(-sin(angle), cos(angle), 0.0),\n"
+ " vec3( 0.0, 0.0, 1.0));\n"
+ " gl_Position = vec4(rot_z * vPosition.xyz, 1.0);\n"
+ " colorinfo = vColor;\n"
+ "}\n";
+
+static const char gFragmentShader[] = "precision mediump float;\n"
+ "varying vec4 colorinfo;\n"
+ "void main() {\n"
+ " gl_FragColor = colorinfo;\n"
+ "}\n";
+
+/* util functions */
+GLuint loadShader(GLenum shaderType, const char* pSource)
+{
+ GLuint shader = glCreateShader(shaderType);
+ if (shader) {
+ glShaderSource(shader, 1, &pSource, NULL);
+ glCompileShader(shader);
+ GLint compiled = 0;
+ glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
+
+ if (!compiled) {
+ GLint infoLen = 0;
+ glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
+ if (infoLen) {
+ char* buf = (char*) malloc(infoLen);
+ if (buf) {
+ glGetShaderInfoLog(shader, infoLen, NULL, buf);
+ fprintf(stderr, "Could not compile shader %d:\n%s\n",
+ shaderType, buf);
+ free(buf);
+ }
+ glDeleteShader(shader);
+ shader = 0;
+ }
+ }
+ } else {
+ printf("Error, during shader creation: %i\n", glGetError());
+ }
+
+ return shader;
+}
+
+GLuint createProgram(const char* pVertexSource, const char* pFragmentSource)
+{
+ GLuint vertexShader = loadShader(GL_VERTEX_SHADER, pVertexSource);
+ if (!vertexShader) {
+ printf("vertex shader not compiled\n");
+ return 0;
+ }
+
+ GLuint pixelShader = loadShader(GL_FRAGMENT_SHADER, pFragmentSource);
+ if (!pixelShader) {
+ printf("frag shader not compiled\n");
+ return 0;
+ }
+
+ GLuint program = glCreateProgram();
+ if (program) {
+ glAttachShader(program, vertexShader);
+ glAttachShader(program, pixelShader);
+ glLinkProgram(program);
+ GLint linkStatus = GL_FALSE;
+ glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);
+
+ if (linkStatus != GL_TRUE) {
+ GLint bufLength = 0;
+ glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength);
+ if (bufLength) {
+ char* buf = (char*) malloc(bufLength);
+ if (buf) {
+ glGetProgramInfoLog(program, bufLength, NULL, buf);
+ fprintf(stderr, "Could not link program:\n%s\n", buf);
+ free(buf);
+ }
+ }
+ glDeleteProgram(program);
+ program = 0;
+ }
+ }
+
+ return program;
+}
+
+int setupGraphics()
+{
+ vertex_data = triangle;
+ color_data = color_triangle;
+
+ gProgram = createProgram(gVertexShader, gFragmentShader);
+ if (!gProgram) {
+ printf("error making program\n");
+ return 0;
+ }
+
+ gvPositionHandle = glGetAttribLocation(gProgram, "vPosition");
+ gvColorHandle = glGetAttribLocation(gProgram, "vColor");
+
+ rotation_uniform = glGetUniformLocation(gProgram, "angle");
+
+ return 1;
+}
+
+void hw_render(EGLDisplay displ, EGLSurface surface)
+{
+ glUseProgram(gProgram);
+
+ glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
+
+ glUniform1fv(rotation_uniform,1, &rotation_angle);
+
+ glVertexAttribPointer(gvColorHandle, num_vertex, GL_FLOAT, GL_FALSE, sizeof(GLfloat)*4, color_data);
+ glVertexAttribPointer(gvPositionHandle, num_vertex, GL_FLOAT, GL_FALSE, 0, vertex_data);
+ glEnableVertexAttribArray(gvPositionHandle);
+ glEnableVertexAttribArray(gvColorHandle);
+
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, num_vertex);
+ glDisableVertexAttribArray(gvPositionHandle);
+ glDisableVertexAttribArray(gvColorHandle);
+
+ eglSwapBuffers(displ, surface);
+}
+
+void hw_step()
+{
+ rotation_angle += rotation_increment;
+ return;
+}
+
+int main(int argc, char** argv)
+{
+ struct SfClient* sf_client = sf_client_create();
+
+ if (!sf_client) {
+ printf("Problem creating client ... aborting now.");
+ return 1;
+ }
+
+ int x = getenv("X") ? atoi(getenv("X")) : 200;
+ int y = getenv("Y") ? atoi(getenv("Y")) : 200;
+
+ int w = getenv("W") ? atoi(getenv("W")) : 500;
+ int h = getenv("H") ? atoi(getenv("H")) : 500;
+
+ float opacity = getenv("O") ? atof(getenv("O")) : 0.5;
+ rotation_increment = getenv("RI") ? atof(getenv("RI")) : 0.01;
+
+ SfSurfaceCreationParameters params = {
+ x,
+ y,
+ w,
+ h,
+ -1, // PIXEL_FORMAT_RGBA_8888,
+ INT_MAX,
+ opacity,
+ 1,
+ "A test surface"
+ };
+
+ struct SfSurface* sf_surface = sf_surface_create(sf_client, ¶ms);
+
+ if (!sf_surface) {
+ printf("Problem creating surface ... aborting now.");
+ return 1;
+ }
+
+ sf_surface_make_current(sf_surface);
+
+ EGLDisplay disp = sf_client_get_egl_display(sf_client);
+ EGLSurface surface = sf_surface_get_egl_surface(sf_surface);
+
+ setupGraphics();
+
+ printf("Turning off screen\n");
+ sf_blank(0);
+
+ sleep(1);
+
+ printf("Turning on screen\n");
+ sf_unblank(0);
+
+ for (;;) {
+ hw_render(disp, surface);
+ hw_step();
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2013 Simon Busch <morphis@gravedo.de>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <assert.h>
+
+#include <hybris/ui/ui_compatibility_layer.h>
+#include <android/hardware/gralloc.h>
+#include <android/system/graphics.h>
+
+int main(int argc, char **argv)
+{
+ struct graphic_buffer *buffer = 0;
+
+ buffer = graphic_buffer_new();
+
+ assert(buffer != NULL);
+
+ graphic_buffer_free(buffer);
+
+ buffer = graphic_buffer_new_sized(720, 1280, HAL_PIXEL_FORMAT_BGRA_8888, GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE);
+
+ assert(buffer != NULL);
+ assert(graphic_buffer_get_width(buffer) == 720);
+ assert(graphic_buffer_get_height(buffer) == 1280);
+ assert(graphic_buffer_get_usage(buffer) == (GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_RENDER));
+ assert(graphic_buffer_get_pixel_format(buffer) == HAL_PIXEL_FORMAT_BGRA_8888);
+ assert(graphic_buffer_get_native_buffer(buffer) != NULL);
+
+ graphic_buffer_reallocate(buffer, 480, 640, HAL_PIXEL_FORMAT_BGRA_8888, GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_RENDER);
+
+ assert(buffer != NULL);
+ assert(graphic_buffer_get_width(buffer) == 480);
+ assert(graphic_buffer_get_height(buffer) == 640);
+ assert(graphic_buffer_get_usage(buffer) == (GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_RENDER));
+ assert(graphic_buffer_get_pixel_format(buffer) == HAL_PIXEL_FORMAT_BGRA_8888);
+ assert(graphic_buffer_get_native_buffer(buffer) != NULL);
+
+ void *vaddr = NULL;
+ graphic_buffer_lock(buffer, GRALLOC_USAGE_HW_RENDER, &vaddr);
+ graphic_buffer_unlock(buffer);
+
+ graphic_buffer_set_index(buffer, 11);
+ assert(graphic_buffer_get_index(buffer) == 11);
+
+ graphic_buffer_free(buffer);
+
+ return 0;
+}
--- /dev/null
+lib_LTLIBRARIES = \
+ libui.la
+
+libui_la_SOURCES = ui.c
+libui_la_CFLAGS = -I$(top_srcdir)/include
+if WANT_TRACE
+libui_la_CFLAGS += -DDEBUG
+endif
+if WANT_DEBUG
+libui_la_CFLAGS += -ggdb -O0
+endif
+libui_la_LDFLAGS = \
+ $(top_builddir)/common/libhybris-common.la \
+ -version-info "1":"0":"0"
--- /dev/null
+/*
+ * Copyright (C) 2013 Simon Busch <morphis@gravedo.de>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <dlfcn.h>
+#include <stddef.h>
+
+#include <hybris/internal/binding.h>
+#include <hybris/ui/ui_compatibility_layer.h>
+
+#define COMPAT_LIBRARY_PATH "/system/lib/libui_compat_layer.so"
+
+HYBRIS_LIBRARY_INITIALIZE(ui, COMPAT_LIBRARY_PATH);
+
+HYBRIS_IMPLEMENT_FUNCTION0(ui, struct graphic_buffer*, graphic_buffer_new);
+HYBRIS_IMPLEMENT_FUNCTION4(ui, struct graphic_buffer*,
+ graphic_buffer_new_sized, uint32_t, uint32_t, int32_t, uint32_t);
+HYBRIS_IMPLEMENT_FUNCTION7(ui, struct graphic_buffer*, graphic_buffer_new_existing,
+ uint32_t, uint32_t, int32_t, uint32_t, uint32_t, void*, bool);
+HYBRIS_IMPLEMENT_VOID_FUNCTION1(ui, graphic_buffer_free, struct graphic_buffer*);
+HYBRIS_IMPLEMENT_FUNCTION1(ui, uint32_t, graphic_buffer_get_width,
+ struct graphic_buffer*);
+HYBRIS_IMPLEMENT_FUNCTION1(ui, uint32_t, graphic_buffer_get_height,
+ struct graphic_buffer*);
+HYBRIS_IMPLEMENT_FUNCTION1(ui, uint32_t, graphic_buffer_get_stride,
+ struct graphic_buffer*);
+HYBRIS_IMPLEMENT_FUNCTION1(ui, uint32_t, graphic_buffer_get_usage,
+ struct graphic_buffer*);
+HYBRIS_IMPLEMENT_FUNCTION1(ui, int32_t, graphic_buffer_get_pixel_format,
+ struct graphic_buffer*);
+HYBRIS_IMPLEMENT_FUNCTION5(ui, uint32_t, graphic_buffer_reallocate,
+ struct graphic_buffer*, uint32_t, uint32_t, int32_t, uint32_t);
+HYBRIS_IMPLEMENT_FUNCTION3(ui, uint32_t, graphic_buffer_lock,
+ struct graphic_buffer*, uint32_t, void**);
+HYBRIS_IMPLEMENT_FUNCTION1(ui, uint32_t, graphic_buffer_unlock,
+ struct graphic_buffer*);
+HYBRIS_IMPLEMENT_FUNCTION1(ui, void*, graphic_buffer_get_native_buffer,
+ struct graphic_buffer*);
+HYBRIS_IMPLEMENT_VOID_FUNCTION2(ui, graphic_buffer_set_index,
+ struct graphic_buffer*, int);
+HYBRIS_IMPLEMENT_FUNCTION1(ui, int, graphic_buffer_get_index,
+ struct graphic_buffer*);
+HYBRIS_IMPLEMENT_FUNCTION1(ui, int, graphic_buffer_init_check,
+ struct graphic_buffer*);
--- /dev/null
+bin_PROGRAMS = \
+ getprop \
+ setprop
+
+getprop_SOURCES = getprop.c
+getprop_CFLAGS = \
+ -I$(top_srcdir)/include
+getprop_LDADD = \
+ $(top_builddir)/properties/libandroid-properties.la
+
+setprop_SOURCES = setprop.c
+setprop_CFLAGS = \
+ -I$(top_srcdir)/include
+setprop_LDADD = \
+ $(top_builddir)/properties/libandroid-properties.la
--- /dev/null
+/*
+ * Copyright (c) 2008 The Android Open Source Project
+ * 2013 Canonical Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <hybris/properties/properties.h>
+
+typedef struct {
+ int count;
+ char** items;
+} list_t;
+
+static void record_prop(const char* key, const char* name, void* opaque)
+{
+ list_t *list = (list_t *) opaque;
+
+ char temp[PROP_VALUE_MAX + PROP_NAME_MAX + 16];
+ snprintf(temp, sizeof(temp), "[%s]: [%s]", key, name);
+ list->items = realloc(list->items, (list->count + 1) * sizeof(char **));
+ list->items[list->count++] = strdup(temp);
+}
+
+static void list_properties(void)
+{
+ int n;
+
+ list_t list;
+ memset(&list, 0, sizeof(list_t));
+
+ /* Record properties in the string list */
+ if (property_list(record_prop, &list) < 0)
+ return;
+
+ for (n = 0; n < list.count; n++) {
+ printf("%s\n", (char *) list.items[n]);
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ int n = 0;
+
+ if (argc == 1) {
+ list_properties();
+ } else {
+ char value[PROP_VALUE_MAX];
+ char *default_value;
+ if (argc > 2) {
+ default_value = argv[2];
+ } else {
+ default_value = "";
+ }
+
+ property_get(argv[1], value, default_value);
+ printf("%s\n", value);
+ }
+ return 0;
+}
--- /dev/null
+/*
+ * Copyright (c) 2008 The Android Open Source Project
+ * 2013 Canonical Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <stdio.h>
+#include <hybris/properties/properties.h>
+
+int main(int argc, char *argv[])
+{
+ if (argc != 3) {
+ fprintf(stderr, "usage: setprop <key> <value>\n");
+ return 1;
+ }
+
+ if (property_set(argv[1], argv[2])){
+ fprintf(stderr, "could not set property\n");
+ return 1;
+ }
+
+ return 0;
+}
--- /dev/null
+#! /bin/sh
+
+ANDROID_ROOT=$1
+HEADERPATH=$2
+MAJOR=$3
+MINOR=$4
+
+PATCH=$5
+PATCH2=$6
+PATCH3=$7
+
+if [ x$ANDROID_ROOT = x -o "x$HEADERPATH" = x ]; then
+ echo "Syntax: extract-headers.sh ANDROID_ROOT HEADERPATH [MAJOR] [MINOR] [PATCH] [PATCH2] [PATCH3]"
+ exit 1
+fi
+
+
+if [ x$MAJOR = x -o x$MINOR = x -o x$PATCH = x ]; then
+ VERSION_DEFAULTS=$ANDROID_ROOT/build/core/version_defaults.mk
+
+ parse_defaults_failed() {
+ echo "Error: Cannot read PLATFORM_VERSION from ${VERSION_DEFAULTS}."
+ echo "Please specify MAJOR, MINOR and PATCH manually to continue."
+ exit 1
+ }
+
+ if [ ! -f $VERSION_DEFAULTS ]; then
+ parse_defaults_failed
+ fi
+
+ PLATFORM_VERSION=$(egrep -o "PLATFORM_VERSION := [0-9.]+" $VERSION_DEFAULTS | awk '{ print $3 }')
+ if [ x$PLATFORM_VERSION = x ]; then
+ parse_defaults_failed
+ fi
+
+ MAJOR=$(echo $PLATFORM_VERSION | cut -d. -f1)
+ MINOR=$(echo $PLATFORM_VERSION | cut -d. -f2)
+ PATCH=$(echo $PLATFORM_VERSION | cut -d. -f3)
+ PATCH2=$(echo $PLATFORM_VERSION | cut -d. -f4)
+ PATCH3=$(echo $PLATFORM_VERSION | cut -d. -f5)
+
+ if [ x$MAJOR = x -o x$MINOR = x -o x$PATCH = x ]; then
+ parse_defaults_failed
+ fi
+
+ echo -n "Auto-detected version: ${MAJOR}.${MINOR}.${PATCH}"
+ if [ x$PATCH3 != x ]; then
+ echo ".${PATCH2}.${PATCH3}"
+ elif [ x$PATCH2 != x ]; then
+ echo ".${PATCH2}"
+ else
+ echo ""
+ fi
+fi
+
+require_sources() {
+ # require_sources [FILE|DIR] ...
+ # Check if the given paths exist in the Android source
+ while [ $# -gt 0 ]; do
+ SOURCE_PATH=$ANDROID_ROOT/$1
+ shift
+
+ if [ ! -e "$SOURCE_PATH" ]; then
+ echo "Cannot extract headers: '$SOURCE_PATH' does not exist."
+ exit 1
+ fi
+ done
+}
+
+extract_headers_to() {
+ # extract_headers_to <TARGET> [FILE|DIR] ...
+ # For each FILE argument, copy it to TARGET
+ # For each DIR argument, copy all its contents to TARGET
+ TARGET_DIRECTORY=$HEADERPATH/$1
+ if [ ! -d "$TARGET_DIRECTORY" ]; then
+ mkdir -p "$TARGET_DIRECTORY"
+ fi
+ echo " $1"
+ shift
+
+ while [ $# -gt 0 ]; do
+ SOURCE_PATH=$ANDROID_ROOT/$1
+ if [ -d $SOURCE_PATH ]; then
+ for file in $SOURCE_PATH/*; do
+ echo " $1/$(basename $file)"
+ cp $file $TARGET_DIRECTORY/
+ done
+ else
+ echo " $1"
+ cp $SOURCE_PATH $TARGET_DIRECTORY/
+ fi
+ shift
+ done
+}
+
+check_header_exists() {
+ # check_header_exists <FILENAME>
+ HEADER_FILE=$ANDROID_ROOT/$1
+ if [ ! -e "$HEADER_FILE" ]; then
+ return 1
+ fi
+
+ return 0
+}
+
+
+# Make sure that the dir given contains at least some of the assumed structures.
+require_sources \
+ hardware/libhardware/include/hardware
+
+mkdir -p $HEADERPATH
+
+if [ x$PATCH2 = x ]; then
+ PATCH2=0
+fi
+
+if [ x$PATCH3 = x ]; then
+ PATCH3=0
+fi
+
+cat > $HEADERPATH/android-version.h << EOF
+#ifndef ANDROID_VERSION_H_
+#define ANDROID_VERSION_H_
+
+#define ANDROID_VERSION_MAJOR $MAJOR
+#define ANDROID_VERSION_MINOR $MINOR
+#define ANDROID_VERSION_PATCH $PATCH
+#define ANDROID_VERSION_PATCH2 $PATCH2
+#define ANDROID_VERSION_PATCH3 $PATCH3
+
+#endif
+EOF
+
+extract_headers_to hardware \
+ hardware/libhardware/include/hardware
+
+extract_headers_to hardware_legacy \
+ hardware/libhardware_legacy/include/hardware_legacy/audio_policy_conf.h
+
+extract_headers_to cutils \
+ system/core/include/cutils
+
+extract_headers_to system \
+ system/core/include/system
+
+extract_headers_to android \
+ system/core/include/android
+
+check_header_exists external/kernel-headers/original/linux/sync.h && \
+ extract_headers_to linux \
+ external/kernel-headers/original/linux/sync.h \
+ external/kernel-headers/original/linux/sw_sync.h
+
+check_header_exists system/core/include/sync/sync.h && \
+ extract_headers_to sync \
+ system/core/include/sync
+
+check_header_exists external/libnfc-nxp/inc/phNfcConfig.h && \
+ extract_headers_to libnfc-nxp \
+ external/libnfc-nxp/inc \
+ external/libnfc-nxp/src
+
+extract_headers_to private \
+ system/core/include/private/android_filesystem_config.h
+
+
+# In order to make it easier to trace back the origins of headers, fetch
+# some repository information from the Git source tree (if available).
+# Tested with AOSP and CM.
+NOW=$(LC_ALL=C date)
+
+# Add here all sub-projects of AOSP/CM from which headers are extracted
+GIT_PROJECTS="
+ hardware/libhardware
+ hardware/libhardware_legacy
+ system/core
+ external/kernel-headers
+ external/libnfc-nxp
+"
+
+echo "Extracting Git revision information"
+rm -f $HEADERPATH/SOURCE_GIT_REVISION_INFO
+(for GIT_PROJECT in $GIT_PROJECTS; do
+ TARGET_DIR=$ANDROID_ROOT/$GIT_PROJECT
+ echo "================================================"
+ echo "$GIT_PROJECT @ $NOW"
+ echo "================================================"
+ if [ -e $TARGET_DIR/.git ]; then
+ (
+ set -x
+ cd $ANDROID_ROOT
+ repo status $GIT_PROJECT
+ cd $TARGET_DIR
+ git show-ref --head
+ git remote -v
+ )
+ echo ""
+ echo ""
+ else
+ echo "WARNING: $GIT_PROJECT does not contain a Git repository"
+ fi
+done) > $HEADERPATH/git-revisions.txt 2>&1
+
+# Repo manifest that can be used to fetch the sources for re-extracting headers
+if [ -e $ANDROID_ROOT/.repo/manifest.xml ]; then
+ cp $ANDROID_ROOT/.repo/manifest.xml $HEADERPATH/
+fi
+
+exit 0
--- /dev/null
+
+Scripts used to generate bindings in hybris/glesv1/glesv1_cm.c
+
+DEPENDENCIES:
+ cproto
+
+HOWTO:
+ sh glesv1_cproto_prepare.sh
+ sh glesv1_build_wrapper.sh
+
+RESULT:
+ glesv1_wrapper.h
+
+Additional utility to check available symbols in library:
+ glesv1_cm_list_symbols.sh (needs libGLESv1_CM.so from device)
+
--- /dev/null
+#!/usr/bin/python
+# gnerate_wrappers.py: Parse header and output libhybris binding code
+# Adapted for libhybris from apkenv-wrapper-generator
+#
+# apkenv-wrapper-generator version:
+# Copyright (C) 2012 Thomas Perl <m@thp.io>; 2012-10-19
+#
+# libhybris version:
+# Copyright (C) 2013 Jolla Ltd.
+# Contact: Thomas Perl <thomas.perl@jollamobile.com>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+import re
+import os
+import sys
+
+funcs = []
+
+# Some special cases to to avoid having to parse the full C grammar
+FIXED_MAPPINGS = {
+ 'GLint *': 'GLint *',
+ 'GLuint *': 'GLuint *',
+ 'GLsizei *': 'GLsizei *',
+ 'GLfloat eqn[4]': 'GLfloat[4]',
+ 'GLfixed eqn[4]': 'GLfixed[4]',
+ 'GLfixed mantissa[16]': 'GLfixed[16]',
+ 'GLint exponent[16]': 'GLint[16]',
+ 'GLfloat eqn[4]': 'GLfloat[4]',
+ 'GLvoid **': 'GLvoid **',
+ 'GLfloat *': 'GLfloat *',
+ 'GLfixed *': 'GLfixed *',
+}
+
+# Never generate wrappers for these functions
+BLACKLISTED_FUNCS = [
+]
+
+def clean_arg(arg):
+ arg = arg.replace('__restrict', '')
+ arg = arg.replace('__const', '')
+ arg = arg.replace('const', '')
+ return arg.strip()
+
+def mangle(name):
+ return 'my_' + name
+
+class Argument:
+ def __init__(self, type_, name):
+ self.type_ = type_
+ self.name = name
+
+class Function:
+ def __init__(self, retval, name, args):
+ self.retval = retval
+ self.name = name
+ self.raw_args = args
+ self.parsing_error = None
+ self.args = list(self._parse_args(args))
+
+ def _parse_args(self, args):
+ for arg in map(clean_arg, args.split(',')):
+ arg = clean_arg(arg)
+ xarg = re.match(r'^(.*?)([A-Za-z0-9_]+)$', arg)
+ if not xarg:
+ # Unknown argument
+ if arg in FIXED_MAPPINGS:
+ yield Argument(FIXED_MAPPINGS[arg], '__undefined__')
+ continue
+ self.parsing_error = 'Could not parse: ' + repr(arg)
+ print self.parsing_error
+ continue
+ type_, name = xarg.groups()
+ if type_ == '':
+ type_ = name
+ name = '__undefined__'
+ yield Argument(type_, name)
+
+if len(sys.argv) != 2:
+ print >>sys.stderr, """
+ Usage: %s glesv1_functions.h
+ """ % (sys.argv[0],)
+ sys.exit(1)
+
+filename = sys.argv[1]
+
+for line in open(filename):
+ if line.startswith('/*'):
+ continue
+ retval, funcname, args = re.match(r'^(.+ [*]?)([A-Za-z0-9_]+)\((.*)\);\s*$', line).groups()
+ retval, funcname, args = [x.strip() for x in (retval, funcname, args)]
+ if funcname not in BLACKLISTED_FUNCS:
+ funcs.append(Function(retval, funcname, args))
+
+LIBRARY_NAME = 'glesv1_cm'
+
+for function in funcs:
+ args = [a.type_.strip() for a in function.args if a.type_.strip() not in ('', 'void')]
+ if function.retval == 'void':
+ print 'HYBRIS_IMPLEMENT_VOID_FUNCTION%d(%s, %s);' % (len(args), LIBRARY_NAME, ', '.join([function.name] + args))
+ else:
+ print 'HYBRIS_IMPLEMENT_FUNCTION%d(%s, %s, %s);' % (len(args), LIBRARY_NAME, function.retval, ', '.join([function.name] + args))
+
--- /dev/null
+#!/bin/sh
+python generate_wrappers.py glesv1_functions.h > glesv1_wrapper.h
--- /dev/null
+#!/bin/sh
+# List symbols in shared object
+
+LIBGLESV1_CM=/system/lib/libGLESv1_CM.so
+
+objdump -T $LIBGLESV1_CM | grep 'DF .text' | awk '{ print $6 }'
+
--- /dev/null
+#!/bin/sh
+#
+# Extract / preprocess and format function prototypes
+# Dependencies: cproto
+#
+
+cproto -I ../../hybris/include/ -x glesv1_cproto_template.h >glesv1_functions.h
+
--- /dev/null
+
+#define GL_GLEXT_PROTOTYPES
+#include <GLES/gl.h>
+#include <GLES/glext.h>
+
--- /dev/null
+#!/usr/bin/python
+#
+# Generate wrapper macros: hybris/include/hybris/internal/binding.h
+#
+# Usage:
+# python utils/generate_wrapper_macros.py >hybris/include/hybris/internal/binding.h
+#
+# Copyright (C) 2013 Jolla Ltd.
+# Contact: Thomas Perl <thomas.perl@jollamobile.com>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+# Maximum number of arguments to generate wrapper macros for
+MAX_ARGS = 20
+
+BEGIN, END = '{', '}'
+
+AUTO_GENERATED_WARNING = """
+/**
+ * XXX AUTO-GENERATED FILE XXX
+ *
+ * Do not edit this file directly, but update the templates in
+ * utils/generate_wrapper_macros.py and run it again to build
+ * an updated version of this header file:
+ *
+ * python utils/generate_wrapper_macros.py > \\
+ * hybris/include/hybris/internal/binding.h
+ *
+ * If you need macros with more arguments, just customize the
+ * MAX_ARGS variable in generate_wrapper_macros.py.
+ *
+ * XXX AUTO-GENERATED FILE XXX
+ **/
+"""
+
+print """
+/**
+ * Copyright (C) 2013 Simon Busch <morphis@gravedo.de>
+ * 2012 Canonical Ltd
+ * 2013 Jolla Ltd.
+ *
+ * Auto-generated via "generate_wrapper_macros.py"
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ **/
+
+#ifndef HYBRIS_BINDING_H_
+#define HYBRIS_BINDING_H_
+
+/* floating_point_abi.h defines FP_ATTRIB */
+#include <hybris/internal/floating_point_abi.h>
+
+void *android_dlopen(const char *filename, int flag);
+void *android_dlsym(void *name, const char *symbol);
+int android_dlclose(void *handle);
+const char *android_dlerror(void);
+int android_dladdr(const void *addr, void *info);
+"""
+
+print AUTO_GENERATED_WARNING
+
+print """
+#define HYBRIS_DLSYSM(name, fptr, sym) \\
+ if (!name##_handle) \\
+ hybris_##name##_initialize(); \\
+ if (*(fptr) == NULL) \\
+ { \\
+ *(fptr) = (void *) android_dlsym(name##_handle, sym); \\
+ }
+
+#define HYBRIS_LIBRARY_INITIALIZE(name, path) \\
+ void *name##_handle; \\
+ void hybris_##name##_initialize() \\
+ { \\
+ name##_handle = android_dlopen(path, RTLD_LAZY); \\
+ }
+
+"""
+
+for count in range(MAX_ARGS):
+ args = ['a%d' % (x+1) for x in range(count)]
+ names = ['n%d' % (x+1) for x in range(count)]
+ wrapper_signature = ', '.join(['name', 'return_type', 'symbol'] + args)
+ signature = ', '.join(args)
+ signature_with_names = ', '.join(' '.join(x) for x in zip(args, names))
+ call_names = ', '.join(names)
+
+ print """
+#define HYBRIS_IMPLEMENT_FUNCTION{count}({wrapper_signature}) \\
+ return_type symbol({signature_with_names}) \\
+ {BEGIN} \\
+ static return_type (*f)({signature}) FP_ATTRIB = NULL; \\
+ HYBRIS_DLSYSM(name, &f, #symbol); \\
+ return f({call_names}); \\
+ {END}
+""".format(**locals())
+
+for count in range(MAX_ARGS):
+ args = ['a%d' % (x+1) for x in range(count)]
+ names = ['n%d' % (x+1) for x in range(count)]
+ wrapper_signature = ', '.join(['name', 'symbol'] + args)
+ signature = ', '.join(args)
+ signature_with_names = ', '.join(' '.join(x) for x in zip(args, names))
+ call_names = ', '.join(names)
+ print """
+#define HYBRIS_IMPLEMENT_VOID_FUNCTION{count}({wrapper_signature}) \\
+ void symbol({signature_with_names}) \\
+ {BEGIN} \\
+ static void (*f)({signature}) FP_ATTRIB = NULL; \\
+ HYBRIS_DLSYSM(name, &f, #symbol); \\
+ f({call_names}); \\
+ {END}
+""".format(**locals())
+
+# Print it again, so people wanting to append new macros will see it
+print AUTO_GENERATED_WARNING
+
+print """
+#endif /* HYBRIS_BINDING_H_ */
+"""
+
--- /dev/null
+# Copyright (c) 2013 Adrian Negreanu <groleo@gmail.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 3 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, see <http://www.gnu.org/licenses/>
+
+import os
+import re
+import subprocess
+
+class LoadSymFiles(gdb.Command):
+ """Add symbol files for files in /proc/pid/maps: load-sym-file [symbols-directory] [lib-directory]"""
+ """Usage example:
+ start # breakpoint 1
+ set confirm off
+ b dlfcn.c:56 # breakpoint 2, android_dlopen
+ commands 2 # commands to run when breakpoint 2 is hit
+ source ../utils/load_sym_files.py
+ load-sym-files
+ continue
+ end # end of commands for bkpt 2
+ """
+ def __init__(self):
+ gdb.Command.__init__(self, "load-sym-files", gdb.COMMAND_FILES, gdb.COMPLETE_FILENAME, True)
+
+ def invoke(self, arg, from_tty):
+ arg_list = gdb.string_to_argv(arg)
+ symdir = "/system/symbols"
+ libdir = "/system/lib"
+
+ if len(arg_list) == 1:
+ symdir = arg_list[0]
+ if not os.path.isdir(symdir):
+ print "error: invalid symbol directory(%s)"%symdir
+ print "usage: load-sym-files [symbols-dir] [lib-dir]"
+ return
+
+ if len(arg_list) == 2:
+ libdir = arg_list[1]
+ if not os.path.isdir(libdir):
+ print "error: invalid library directory(%s)"%libdir
+ print "usage: load-sym-files [symbols-dir] [lib-dir]"
+ return
+ try:
+ pid = gdb.selected_inferior().pid
+ except AttributeError:
+ # in case gdb-version < 7.4
+ # the array can have more than one element,
+ # but it's good enough when debugging test_egl
+ if len(gdb.inferiors()) == 1:
+ pid = gdb.inferiors()[0].pid
+ else:
+ print "error: no gdb support for more than 1 inferior"
+ return
+
+ if pid == 0:
+ print "error: debugee not started yet"
+ return
+
+ maps = open("/proc/%d/maps"%pid,"rb")
+ for line in maps:
+ # b7fc9000-b7fcf000 r-xp 00000000 08:01 1311443 /system/lib/liblog.so
+ m = re.match("([0-9A-Fa-f]+)-[0-9A-Fa-f]+\s+r-xp.*(%s.*)"%libdir,line)
+ if not m:
+ continue
+
+ start_addr = int(m.group(1),16)
+ lib = m.group(2)
+ text_addr = 0
+
+ p = subprocess.Popen("objdump -h "+lib , shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
+ for header in p.stdout.read().split("\n"):
+ #6 .text 00044ef7 00017f80 00017f80 00017f80 2**4
+ t = re.match("\s*[0-9]+\s+\.text\s+([0-9A-Fa-f]+\s+){3}([0-9A-Fa-f]+)",header)
+ if t:
+ text_addr = int(t.group(2),16)
+ break
+ symfile = symdir + lib
+ if os.path.isfile(symfile):
+ gdb.execute("add-symbol-file %s 0x%X" % (symfile, start_addr+text_addr))
+
+
+LoadSymFiles()