Compare commits

...

98 Commits

Author SHA1 Message Date
Chia-I Wu
74237c1a10 mesa: Remember client active texture in _mesa_meta_draw_tex. 2009-10-31 18:03:34 +08:00
Chia-I Wu
ce5af556aa egl_android: Update native buffer only when it is really changed. 2009-10-30 17:27:14 +08:00
Chia-I Wu
f457f7a31c egl_android: Decide image config by matching the native pixmap. 2009-10-27 17:45:13 +08:00
Chia-I Wu
11ff6a0e6f egl_android: Set surface type and native visual type. 2009-10-27 17:30:24 +08:00
Chia-I Wu
b4bf8be547 intel: Correct support for GL_BGRA. 2009-10-23 17:54:49 +08:00
Chia-I Wu
6ec4bba0ea egl: Unlink image before destroying it. 2009-10-22 17:00:59 +08:00
Chia-I Wu
893bc24da3 egl_android: Wrong attribute is passed. 2009-10-22 15:48:05 +08:00
Chia-I Wu
c83d23d30d egl_android: Install customized logger. 2009-09-29 18:33:53 +08:00
Chia-I Wu
e786472b8d egl: Improve logging facility.
Add _eglSetLogger and _eglSetLogLevel to allow drivers to change the
message logger or report level.
2009-09-29 18:33:53 +08:00
Chia-I Wu
27c1ec2334 egl: Allow binding to any client API.
As a result, EGL_NONE is no longer a valid client API.  And it is
possible that no config supports the current bound API.
2009-09-29 18:33:53 +08:00
Chia-I Wu
607a4393e7 egl: Preload a driver if eglGetProcAddress is called early. 2009-09-29 18:33:53 +08:00
Chia-I Wu
74174dd5d6 egl: Better report of driver loading error. 2009-09-29 18:19:50 +08:00
Chia-I Wu
35f9a9c5c9 egl: Allow driver to be built-in.
This undoes a temporary hack.
2009-09-28 18:10:37 +08:00
Chia-I Wu
d5e732764b egl_android: Minor fixes to image surface. 2009-09-24 12:53:50 +08:00
Chia-I Wu
ef1a6243ef egl_android: Refactor tiling support. 2009-09-24 12:53:32 +08:00
Chia-I Wu
8911b7d7a1 egl_android: Merge tiling support from eagle. 2009-09-24 10:09:32 +08:00
Chia-I Wu
1ba61c244f Merge branch 'mesa-es' into android 2009-09-23 14:45:37 +08:00
Chia-I Wu
dce62509e5 mesa: Pixel zoom should be ignored in _mesa_meta_draw_tex. 2009-09-23 14:44:09 +08:00
Chia-I Wu
25e6736400 es: Add support for GL_ARB_texture_non_power_of_two. 2009-09-23 14:40:41 +08:00
Chia-I Wu
6059e6a8f2 egl_android: Add untested support for EGLImage. 2009-09-18 18:36:14 +08:00
Chia-I Wu
3c718c0e95 egl_android: Initialize __DRIbuffer properly. 2009-09-18 17:13:13 +08:00
Chia-I Wu
3806be3ddb egl_android: Remove unused variables. 2009-09-18 15:42:48 +08:00
Chia-I Wu
94f9330609 egl_android: New EGL driver for Android. 2009-09-18 15:32:26 +08:00
Chia-I Wu
08b9155eee es: Turn of FEATURE_es2_glsl. 2009-09-18 11:23:39 +08:00
Chia-I Wu
87b5e03290 Build libes1api.a. 2009-09-16 11:19:23 +08:00
Chia-I Wu
94fe206c56 mesa: Rename libmesa.a to libes1.a. 2009-09-16 11:19:23 +08:00
Chia-I Wu
62e7cd2aca mesa: Save META_SHADER in _mesa_meta_draw_tex. 2009-09-15 23:51:18 +08:00
Chia-I Wu
16678f5dbf Merge commit 'eee/mesa-es' into android 2009-09-15 18:50:51 +08:00
Chia-I Wu
705fed33ea mesa: Fix a division in _mesa_meta_draw_tex.
Both crop rectangle and texture dimensions are integers.  Cast to get
float division.
2009-09-15 18:44:38 +08:00
Chia-I Wu
4e547d5155 intel: Add support for GL_OES_draw_texture. 2009-09-15 17:51:25 +08:00
Chia-I Wu
d535d82b32 mesa: Add _mesa_meta_draw_tex. 2009-09-15 17:48:36 +08:00
Chia-I Wu
dea3bc04c1 mesa/tnl: Add support for GL_FIXED in _tnl_import_array. 2009-09-15 15:23:31 +08:00
Chia-I Wu
a49adc545b Update Android.mk for recent merge. 2009-09-15 14:20:30 +08:00
Chia-I Wu
b4d0fdf8d2 intel: Fix DRI CopyBuffer extension. 2009-09-15 14:18:27 +08:00
Chia-I Wu
a5a8bdfd9b es: Pre-generate ES1 source files. 2009-09-15 14:17:03 +08:00
Chia-I Wu
e2ba90a9cc Merge commit 'eee/mesa-es' into android 2009-09-15 14:16:22 +08:00
Chia-I Wu
b4b8800315 egl_xdri: Check that FlushCurrentContext is available. 2009-09-15 12:41:16 +08:00
Chia-I Wu
4e5934fed1 intel: Add support for GL_OES_EGL_image.
This is primitive and some pathes are not tested.
2009-09-14 16:17:21 +08:00
Chia-I Wu
c4a8ce7ffd es: Add support for GL_OES_EGL_image. 2009-09-14 16:05:46 +08:00
Chia-I Wu
9199889374 es/glapi: Add support for GL_OES_EGL_image. 2009-09-14 16:05:46 +08:00
Chia-I Wu
80c0f18f2d glapi: Generate typedef for GLeglImageOES. 2009-09-14 16:05:46 +08:00
Chia-I Wu
4db23069f9 es: Check OES_draw_texture is enabled. 2009-09-14 15:58:42 +08:00
Chia-I Wu
77e2b23ea6 egl_xdri: Flush commands on context switch and buffer swap.
The corresponding DRI functions does not flush for us.
2009-09-14 13:39:19 +08:00
Chia-I Wu
5f32756254 egl_xdri: Implement eglCreateImageKHR. 2009-09-14 13:39:19 +08:00
Chia-I Wu
9e9a4cf471 egl: Add support for EGL_KHR_image_base.
Individual drivers still need to implement the API hooks.
2009-09-14 13:39:18 +08:00
Chia-I Wu
985cefb769 egl: Update eglext.h to version 3. 2009-09-14 13:39:18 +08:00
Chia-I Wu
554361e2b2 i915: Build i915_dri with libes1.a. 2009-09-14 13:05:47 +08:00
Chia-I Wu
a1842a4f11 es: Build libesX.a. 2009-09-14 13:05:15 +08:00
Chia-I Wu
73f3765270 i915: Respect mfeatures.h. 2009-09-14 13:04:58 +08:00
Chia-I Wu
33640499b9 dri/common: Protect driDispatchRemapTable with IN_DRIVER_DRIVER. 2009-09-14 13:04:58 +08:00
Chia-I Wu
0878cce17d mesa/swrast: Define _swrast_UpdateTexturePalette to NULL.
This allows swrast to be passed to _MESA_INIT_COLORTABLE_FUNCTIONS.
2009-09-14 13:04:58 +08:00
Chia-I Wu
cbd17236c8 glapi: Respect IN_DRI_DRIVER in extension_helper.h.
This allows extension_helper.h to be used with IN_DRI_DRIVER undefined.
In such case, generate macros for source level compatibility.
2009-09-14 13:04:57 +08:00
Chia-I Wu
8077986205 es/main: Report GL_OES_draw_texture only when enabled. 2009-09-14 11:51:47 +08:00
Chia-I Wu
542c26fa4f es/st: Move state tracker code to mesa/st.
State tracker is one of the mesa drivers.  It should not belong to the
es overlay.
2009-09-14 11:51:47 +08:00
Chia-I Wu
a98c282c7d es: Proper support for FEATURE_OES_draw_texture.
Update default extensions and add DrawTex driver function.
2009-09-14 11:51:47 +08:00
Chia-I Wu
dc2ddb27d3 mesa/swrast: Respect mfeatures.h.
FEATURE_accum, FEATURE_convolve, FEATURE_colortable, and FEATURE_drawpix
cover part of the functionalities of swrast module.  Disable them when
the features are disabled.
2009-09-13 17:38:05 +08:00
Chia-I Wu
0fc1cd5e91 mesa/tnl: Respect mfeatures.h.
_tnl_RasterPos should be disabled with FEATURE_rastpos.
2009-09-13 17:38:05 +08:00
Chia-I Wu
5f471a37aa es/main: Better glGetString support. 2009-09-13 17:06:21 +08:00
Chia-I Wu
9562ca3628 es/glapi: Remove unnecessary extensions from es_COMPAT.
After disabling FEATURE_beginend, many of the extensions defined for
compatibility are not needed anymore.
2009-09-13 17:06:19 +08:00
Chia-I Wu
e6f4bc9d82 mesa: New feature FEATURE_beginend.
This feature corresponds to the Begin/End paradigm.  Disabling this
feature also eliminates the use of GLvertexformat completely.
2009-09-13 17:06:16 +08:00
Chia-I Wu
2ae5bf72c2 progs/es: Link to libX11. 2009-09-12 20:56:04 +08:00
Brian Paul
cc0d078977 es: fix comment 2009-09-12 20:56:04 +08:00
Brian Paul
4938cb77f8 es: OpenGL ES 2.x demo programs 2009-09-12 20:56:04 +08:00
Brian Paul
a00d4ab589 es: updated Makefile comment 2009-09-12 20:56:03 +08:00
Brian Paul
b5abf7b08b es: update window title 2009-09-12 20:56:03 +08:00
Brian Paul
70b6b622bf es: OpenGL ES 1.x demo programs 2009-09-12 20:56:03 +08:00
Chia-I Wu
440882f547 st/es: Add OpenGL ES state trackers. 2009-09-12 20:56:03 +08:00
Chia-I Wu
e5501bd823 Makefile: Pack ES files. 2009-09-12 20:56:03 +08:00
Chia-I Wu
919fbc5524 mesa/es: Add OpenGL ES overlay.
This is primitive support for OpenGL ES.  It uses a subset of mesa
sources to build libesXgallium.a and libesXapi.a, where X is 1 for
OpenGL ES 1.x, 2 for OpenGL ES 2.x.  The static libraries serve the same
purpose as libmesagallium.a and libglapi.a do for OpenGL.

This is based on the work of opengl-es branch.
2009-09-12 20:56:03 +08:00
Chia-I Wu
55c73512c9 mesa/es: Add OpenGL ES XMLs. 2009-09-12 20:56:02 +08:00
Chia-I Wu
4cf0415cc0 glapi: Add OpenGL ES compatibility mode to scripts.
When the mode is on, the scripts would generate headers that are
suitable for OpenGL ES overlay, that will be later introduced.
2009-09-12 20:56:02 +08:00
Chia-I Wu
3de1a6584f glapi: Prefix includes with glapi.
This allows different sets of generated headers to be used.
2009-09-12 20:56:02 +08:00
Chia-I Wu
3c417b27a2 mesa/main: Add point size array. 2009-09-12 20:56:01 +08:00
Brian Paul
9ac1d3e36f mesa: silence warning 2009-09-12 20:56:01 +08:00
Brian Paul
610e200429 st: added preprocessor test for FEATURE_texture_s3tc 2009-09-12 20:56:01 +08:00
Brian Paul
de8b4f3bbd mesa: fix set_tex_parameteri() call 2009-09-12 20:56:01 +08:00
Chia-I Wu
4132e67e31 mesa/main: Provide dummy texformats when FEATURE_texture_s3tc is disabled.
Instead of removing the related enums and texture formats, provide dummy
ones when the feature is disabled.
2009-09-12 20:55:59 +08:00
Chia-I Wu
5c8873a311 mesa/main: Provide dummy texformats when FEATURE_texture_fxt1 is disabled.
Instead of removing the related enums and texture formats, provide dummy
ones when the feature is disabled.
2009-09-12 20:55:59 +08:00
Chia-I Wu
b7c133b5c2 mesa/main: Export null texformat operations. 2009-09-12 20:55:58 +08:00
Chia-I Wu
1c497bd4c6 mesa/main: Make FEATURE_dlist follow feature conventions.
As shown in mfeatures.h, this allows users of dlist.h to work without
knowing if the feature is available.
2009-09-12 20:55:58 +08:00
Chia-I Wu
17f2649e26 mesa/main: Make FEATURE_evaluators follow feature conventions.
As shown in mfeatures.h, this allows users of eval.h to work without
knowing if the feature is available.  It is renamed to FEATURE_eval
along the way.
2009-09-12 20:55:58 +08:00
Chia-I Wu
57ce3ab323 mesa/main: New feature FEATURE_queryobj.
It merges FEATURE_ARB_occlusion_query and FEATURE_EXT_timer_query, and
follows the feature conventions.
2009-09-12 20:55:57 +08:00
Chia-I Wu
7f8045ab4e mesa/main: New feature FEATURE_arrayelt.
This allows the removal of AEcontext.
2009-09-12 20:55:57 +08:00
Chia-I Wu
6fcf6a5a7f mesa/main: Make FEATURE_texgen follow feature conventions.
As shown in mfeatures.h, this allows users of texgen.h to work without
knowing if the feature is available.
2009-09-12 20:55:57 +08:00
Chia-I Wu
b04d58c0b1 mesa/main: Make FEATURE_feedback follow feature conventions.
As shown in mfeatures.h, this allows users of feedback.h to work without
knowing if the feature is available.
2009-09-12 20:55:57 +08:00
Chia-I Wu
8df670164f mesa/main: Make FEATURE_drawpix follow feature conventions.
As shown in mfeatures.h, this allows users of drawpix.h to work
without knowing if the feature is available.
2009-09-12 20:55:56 +08:00
Chia-I Wu
940b525a5a mesa/main: New feature FEATURE_rastpos.
It is separated from FEATURE_drawpix and made to follow the feature
convensions.
2009-09-12 20:55:56 +08:00
Chia-I Wu
93c3911ca8 mesa/main: Make FEATURE_histogram follow feature conventions.
As shown in mfeatures.h, this allows users of histogram.h to work without
knowing if the feature is available.
2009-09-12 20:55:56 +08:00
Chia-I Wu
c9ae896376 mesa/main: Make FEATURE_attrib_stack follow feature conventions.
As shown in mfeatures.h, this allows users of attrib.h to work without
knowing if the feature is available.
2009-09-12 20:55:55 +08:00
Chia-I Wu
bae850f9af mesa/main: Make FEATURE_accum follow feature conventions.
As shown in mfeatures.h, this allows users of accum.h to work without
knowing if the feature is available.
2009-09-12 20:55:55 +08:00
Chia-I Wu
ec86469c55 mesa/main: Make FEATURE_convolve follow feature conventions.
As shown in mfeatures.h, this allows users of convolve.h to work
without knowing if the feature is available.
2009-09-12 20:55:55 +08:00
Chia-I Wu
5bcfe4b5c8 mesa/main: Make FEATURE_colortable follow feature conventions.
As shown in mfeatures.h, this allows users of colortab.h to work
without knowing if the feature is available.
2009-09-12 20:55:55 +08:00
Chia-I Wu
57377d5d69 mesa/main: Make FEATURE_pixel_transfer follow feature conventions.
As shown in mfeatures.h, this allows users of pixel.h to work without
knowing if the feature is available.
2009-09-12 20:55:55 +08:00
Chia-I Wu
b565e7b88c mesa/main: Add comments to mfeatures.h.
The comments document the conventions that a feature may follow.
2009-09-12 20:55:54 +08:00
Chia-I Wu
c7ebd40185 Add mine configs. 2009-09-12 20:55:54 +08:00
John Lee
11a4292d4e Add external/expat/lib since we need expat.h to compile. 2009-06-12 12:18:44 +08:00
Chia-I Wu
07cc2311a8 Create Android.mk.
utils.h is soft linked to avoid conflict with libutils's header.
2009-06-08 11:51:38 +08:00
Kristian Høgsberg
8567d003d5 Add a DRI CopyBuffer extension to expose 2d blits. 2009-03-05 07:46:44 -05:00
194 changed files with 45487 additions and 904 deletions

1
Android.mk Normal file
View File

@@ -0,0 +1 @@
include $(call all-subdir-makefiles)

View File

@@ -105,6 +105,8 @@ irix6-n32-static \
irix6-o32 \
irix6-o32-static \
linux \
mine \
mine-dri \
linux-alpha \
linux-alpha-static \
linux-cell \
@@ -303,10 +305,25 @@ MAIN_FILES = \
$(DIRECTORY)/progs/util/sampleMakefile \
$(DIRECTORY)/windows/VC8/
EGL_FILES = \
$(DIRECTORY)/include/EGL/*.h \
ES_FILES = \
$(DIRECTORY)/include/GLES/*.h \
$(DIRECTORY)/include/GLES2/*.h \
$(DIRECTORY)/src/mesa/glapi/*.xml \
$(DIRECTORY)/src/mesa/glapi/*.py \
$(DIRECTORY)/src/mesa/glapi/*.dtd \
$(DIRECTORY)/src/mesa/es/glapi/Makefile \
$(DIRECTORY)/src/mesa/es/glapi/*.xml \
$(DIRECTORY)/src/mesa/es/glapi/*.py \
$(DIRECTORY)/src/mesa/es/state_tracker/*.[ch] \
$(DIRECTORY)/src/mesa/es/main/*.[ch] \
$(DIRECTORY)/src/mesa/es/main/*.py \
$(DIRECTORY)/src/mesa/es/main/*.txt \
$(DIRECTORY)/src/mesa/es/main/es*_special \
$(DIRECTORY)/src/mesa/es/Makefile \
$(DIRECTORY)/src/mesa/es/sources.mak \
EGL_FILES = \
$(DIRECTORY)/include/EGL/*.h \
$(DIRECTORY)/src/egl/Makefile \
$(DIRECTORY)/src/egl/*/Makefile \
$(DIRECTORY)/src/egl/*/*.[ch] \
@@ -471,6 +488,7 @@ DEPEND_FILES = \
LIB_FILES = \
$(MAIN_FILES) \
$(ES_FILES) \
$(EGL_FILES) \
$(GALLIUM_FILES) \
$(DRI_FILES) \

82
configs/mine Normal file
View File

@@ -0,0 +1,82 @@
# -*-makefile-*-
# Configuration for linux-dri: Linux DRI hardware drivers for XFree86 & others
include $(TOP)/configs/default
CONFIG_NAME = mine
# Compiler and flags
CC = ccache gcc
CXX = ccache g++
#MKDEP = /usr/X11R6/bin/makedepend
#MKDEP = gcc -M
#MKDEP_OPTIONS = -MF depend
OPT_FLAGS = -O0 -g
PIC_FLAGS = -fPIC
# Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support.
ARCH_FLAGS ?=
DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
-D_BSD_SOURCE -D_GNU_SOURCE \
-DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 \
-DGLX_DIRECT_RENDERING \
-DHAVE_ALIAS -DHAVE_POSIX_MEMALIGN
X11_INCLUDES = -I/usr/X11R6/include
CFLAGS = -Wall -Wmissing-prototypes -std=c99 -ffast-math \
$(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) $(ASM_FLAGS)
CXXFLAGS = -Wall $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
GLUT_CFLAGS = -fexceptions
# Work around aliasing bugs - developers should comment this out
CFLAGS += -fno-strict-aliasing
CXXFLAGS += -fno-strict-aliasing
MESA_ASM_SOURCES =
# Library/program dependencies
EXTRA_LIB_PATH=-L/usr/X11R6/lib
DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB)
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
-lm -lpthread -ldl $(LIBDRM_LIB)
# Directories
SRC_DIRS = egl mesa gallium gallium/winsys
PROGRAM_DIRS := egl openvg/demos demos xdemos
# EGL directories
EGL_DRIVERS_DIRS = glx xdri
ifeq ($(USE_DRI),yes)
DEFINES += -DIN_DRI_DRIVER -DGLX_INDIRECT_RENDERING
LIBDRM_CFLAGS = $(shell pkg-config --cflags libdrm)
LIBDRM_LIB = $(shell pkg-config --libs libdrm)
SRC_DIRS := glx/x11 $(SRC_DIRS)
DRIVER_DIRS = dri
WINDOW_SYSTEM = dri
DRI_DIRS = i915
GALLIUM_WINSYS_DIRS = drm egl_xlib
GALLIUM_WINSYS_DRM_DIRS = intel
GALLIUM_STATE_TRACKERS_DIRS = egl glx vega
else
DRIVER_DIRS =
WINDOW_SYSTEM =
DRI_DIRS =
GALLIUM_WINSYS_DIRS = egl_xlib xlib
GALLIUM_STATE_TRACKERS_DIRS = glx vega
endif

5
configs/mine-dri Normal file
View File

@@ -0,0 +1,5 @@
# -*-makefile-*-
# Configuration for linux-dri: Linux DRI hardware drivers for XFree86 & others
USE_DRI = yes
include $(TOP)/configs/mine

View File

@@ -6,7 +6,7 @@ extern "C" {
#endif
/*
** Copyright (c) 2007 The Khronos Group Inc.
** 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
@@ -33,9 +33,9 @@ extern "C" {
/*************************************************************/
/* Header file version number */
/* eglext.h last updated 2007/11/20 */
/* Current version at http://www.khronos.org/registry/egl/ */
#define EGL_EGLEXT_VERSION 1
/* $Revision: 7244 $ on $Date: 2009-01-20 17:06:59 -0800 (Tue, 20 Jan 2009) $ */
#define EGL_EGLEXT_VERSION 3
#ifndef EGL_KHR_config_attribs
#define EGL_KHR_config_attribs 1
@@ -79,12 +79,12 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display
#define EGL_KHR_image 1
#define EGL_NATIVE_PIXMAP_KHR 0x30B0 /* eglCreateImageKHR target */
typedef void *EGLImageKHR;
extern const EGLImageKHR EGL_NO_IMAGE_KHR;
#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, EGLint *attr_list);
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, EGLint *attr_list);
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
@@ -179,6 +179,17 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOPYCONTEXTMESA) (EGLDisplay dpy, EGLCont
#endif /* EGL_MESA_copy_context */
#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
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,27 @@
#ifndef EGLIMAGE_DRI_INCLUDED
#define EGLIMAGE_DRI_INCLUDED
#include "GL/internal/dri_interface.h"
#define __DRI_EGL_IMAGE_MAGIC \
(('D' << 24) | \
('R' << 16) | \
('I' << 8) | \
('0'))
typedef void *__DRIEGLImageHandle;
typedef struct __DRIEGLImageRec __DRIEGLImage;
struct __DRIEGLImageRec {
GLint magic;
__DRIdrawable *drawable;
GLboolean texture_format_rgba;
GLint level;
GLint __pad[4];
};
extern __DRIEGLImage *_eglClientGetImageData(__DRIEGLImageHandle handle);
#endif /* EGLIMAGE_DRI_INCLUDED */

View File

@@ -708,6 +708,19 @@ struct __DRIdri2LoaderExtensionRec {
int *out_count, void *loaderPrivate);
};
#define __DRI_COPY_BUFFER "DRI_CopyBuffer"
#define __DRI_COPY_BUFFER_VERSION 1
typedef struct __DRIcopyBufferExtensionRec __DRIcopyBufferExtension;
struct __DRIcopyBufferExtensionRec {
__DRIextension base;
int (*copyBuffer)(__DRIcontext *context,
__DRIbuffer *dst, int dst_x, int dst_y,
__DRIdrawable *src, unsigned int src_attachment,
int x, int y, int width, int height);
};
/**
* This extension provides alternative screen, drawable and context
* constructors for DRI2.

77
progs/es1/xegl/Makefile Normal file
View File

@@ -0,0 +1,77 @@
# progs/es1/xegl/Makefile
TOP = ../../..
include $(TOP)/configs/current
INCLUDE_DIRS = \
-I$(TOP)/include \
HEADERS = $(TOP)/include/GLES/egl.h
ES1_LIB_DEPS = \
$(TOP)/$(LIB_DIR)/libEGL.so \
$(TOP)/$(LIB_DIR)/libGLESv1_CM.so
ES1_LIBS = \
-L$(TOP)/$(LIB_DIR) -lEGL \
-L$(TOP)/$(LIB_DIR) -lGLESv1_CM $(LIBDRM_LIB) -lX11
PROGRAMS = \
drawtex \
es1_info \
msaa \
pbuffer \
render_tex \
torus \
tri \
two_win
.c.o:
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
default: $(PROGRAMS)
drawtex: drawtex.o $(ES1_LIB_DEPS)
$(CC) $(CFLAGS) drawtex.o $(ES1_LIBS) -o $@
es1_info: es1_info.o $(ES1_LIB_DEPS)
$(CC) $(CFLAGS) es1_info.o $(ES1_LIBS) -o $@
msaa: msaa.o $(ES1_LIB_DEPS)
$(CC) $(CFLAGS) msaa.o $(ES1_LIBS) -o $@
pbuffer: pbuffer.o $(ES1_LIB_DEPS)
$(CC) $(CFLAGS) pbuffer.o $(ES1_LIBS) -o $@
render_tex: render_tex.o $(ES1_LIB_DEPS)
$(CC) $(CFLAGS) render_tex.o $(ES1_LIBS) -o $@
torus: torus.o $(ES1_LIB_DEPS)
$(CC) $(CFLAGS) torus.o $(ES1_LIBS) -o $@
two_win: two_win.o $(ES1_LIB_DEPS)
$(CC) $(CFLAGS) two_win.o $(ES1_LIBS) -o $@
tri: tri.o $(ES1_LIB_DEPS)
$(CC) $(CFLAGS) tri.o $(ES1_LIBS) -o $@
clean:
rm -f *.o *~
rm -f $(PROGRAMS)

427
progs/es1/xegl/drawtex.c Normal file
View File

@@ -0,0 +1,427 @@
/*
* Copyright (C) 2008 Tunsgten Graphics,Inc. All Rights Reserved.
*/
/*
* Test GL_OES_draw_texture
* Brian Paul
* August 2008
*/
#define GL_GLEXT_PROTOTYPES
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <EGL/egl.h>
static GLfloat view_posx = 10.0, view_posy = 20.0;
static GLfloat width = 200, height = 200;
static void
draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glDrawTexfOES(view_posx, view_posy, 0.0, width, height);
}
/* new window size or exposure */
static void
reshape(int width, int height)
{
GLfloat ar = (GLfloat) width / (GLfloat) height;
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
#ifdef GL_VERSION_ES_CM_1_0
glFrustumf(-ar, ar, -1, 1, 5.0, 60.0);
#else
glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
#endif
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -15.0);
}
static float
dist(GLuint i, GLuint j, float x, float y)
{
return sqrt((i-x) * (i-x) + (j-y) * (j-y));
}
static void
make_smile_texture(void)
{
#define SZ 128
GLenum Filter = GL_LINEAR;
GLubyte image[SZ][SZ][4];
GLuint i, j;
GLint cropRect[4];
for (i = 0; i < SZ; i++) {
for (j = 0; j < SZ; j++) {
GLfloat d_mouth = dist(i, j, SZ/2, SZ/2);
GLfloat d_rt_eye = dist(i, j, SZ*3/4, SZ*3/4);
GLfloat d_lt_eye = dist(i, j, SZ*3/4, SZ*1/4);
if (d_rt_eye < SZ / 8 || d_lt_eye < SZ / 8) {
image[i][j][0] = 20;
image[i][j][1] = 50;
image[i][j][2] = 255;
image[i][j][3] = 255;
}
else if (i < SZ/2 && d_mouth < SZ/3) {
image[i][j][0] = 255;
image[i][j][1] = 20;
image[i][j][2] = 20;
image[i][j][3] = 255;
}
else {
image[i][j][0] = 200;
image[i][j][1] = 200;
image[i][j][2] = 200;
image[i][j][3] = 255;
}
}
}
glActiveTexture(GL_TEXTURE0); /* unit 0 */
glBindTexture(GL_TEXTURE_2D, 42);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SZ, SZ, 0,
GL_RGBA, GL_UNSIGNED_BYTE, image);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, Filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, Filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
cropRect[0] = 0;
cropRect[1] = 0;
cropRect[2] = SZ;
cropRect[3] = SZ;
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, cropRect);
#undef SZ
}
static void
init(void)
{
const char *ext = (char *) glGetString(GL_EXTENSIONS);
if (!strstr(ext, "GL_OES_draw_texture")) {
fprintf(stderr, "Sorry, this program requires GL_OES_draw_texture");
exit(1);
}
glClearColor(0.4, 0.4, 0.4, 0.0);
make_smile_texture();
glEnable(GL_TEXTURE_2D);
}
/*
* Create an RGB, double-buffered X window.
* Return the window and context handles.
*/
static void
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
const char *name,
int x, int y, int width, int height,
Window *winRet,
EGLContext *ctxRet,
EGLSurface *surfRet)
{
static const EGLint attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_NONE
};
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
XVisualInfo *visInfo, visTemplate;
int num_visuals;
EGLContext ctx;
EGLConfig config;
EGLint num_configs;
EGLint vid;
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
assert(config);
assert(num_configs > 0);
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");
exit(1);
}
/* The X window visual must match the EGL config */
visTemplate.visualid = vid;
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
if (!visInfo) {
printf("Error: couldn't get X visual\n");
exit(1);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
0, visInfo->depth, InputOutput,
visInfo->visual, mask, &attr );
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(x_dpy, win, &sizehints);
XSetStandardProperties(x_dpy, win, name, name,
None, (char **)NULL, 0, &sizehints);
}
eglBindAPI(EGL_OPENGL_ES_API);
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
if (!ctx) {
printf("Error: eglCreateContext failed\n");
exit(1);
}
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
if (!*surfRet) {
printf("Error: eglCreateWindowSurface failed\n");
exit(1);
}
XFree(visInfo);
*winRet = win;
*ctxRet = ctx;
}
static void
event_loop(Display *dpy, Window win,
EGLDisplay egl_dpy, EGLSurface egl_surf)
{
int anim = 0;
while (1) {
int redraw = 0;
if (!anim || XPending(dpy)) {
XEvent event;
XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
redraw = 1;
break;
case ConfigureNotify:
reshape(event.xconfigure.width, event.xconfigure.height);
break;
case KeyPress:
{
char buffer[10];
int r, code;
code = XLookupKeysym(&event.xkey, 0);
if (code == XK_Left) {
view_posx -= 1.0;
}
else if (code == XK_Right) {
view_posx += 1.0;
}
else if (code == XK_Up) {
view_posy += 1.0;
}
else if (code == XK_Down) {
view_posy -= 1.0;
}
else {
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == ' ') {
anim = !anim;
}
else if (buffer[0] == 'w') {
width -= 1.0f;
}
else if (buffer[0] == 'W') {
width += 1.0f;
}
else if (buffer[0] == 'h') {
height -= 1.0f;
}
else if (buffer[0] == 'H') {
height += 1.0f;
}
else if (buffer[0] == 27) {
/* escape */
return;
}
}
}
redraw = 1;
break;
default:
; /*no-op*/
}
}
if (anim) {
view_posx += 1.0;
view_posy += 2.0;
redraw = 1;
}
if (redraw) {
draw();
eglSwapBuffers(egl_dpy, egl_surf);
}
}
}
static void
usage(void)
{
printf("Usage:\n");
printf(" -display <displayname> set the display to run on\n");
printf(" -info display OpenGL renderer info\n");
}
int
main(int argc, char *argv[])
{
const int winWidth = 400, winHeight = 300;
Display *x_dpy;
Window win;
EGLSurface egl_surf;
EGLContext egl_ctx;
EGLDisplay egl_dpy;
char *dpyName = NULL;
GLboolean printInfo = GL_FALSE;
EGLint egl_major, egl_minor;
int i;
const char *s;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
dpyName = argv[i+1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {
printInfo = GL_TRUE;
}
else {
usage();
return -1;
}
}
x_dpy = XOpenDisplay(dpyName);
if (!x_dpy) {
printf("Error: couldn't open display %s\n",
dpyName ? dpyName : getenv("DISPLAY"));
return -1;
}
egl_dpy = eglGetDisplay(x_dpy);
if (!egl_dpy) {
printf("Error: eglGetDisplay() failed\n");
return -1;
}
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n");
return -1;
}
s = eglQueryString(egl_dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s);
s = eglQueryString(egl_dpy, EGL_VENDOR);
printf("EGL_VENDOR = %s\n", s);
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
printf("EGL_EXTENSIONS = %s\n", s);
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
printf("EGL_CLIENT_APIS = %s\n", s);
make_x_window(x_dpy, egl_dpy,
"drawtex", 0, 0, winWidth, winHeight,
&win, &egl_ctx, &egl_surf);
XMapWindow(x_dpy, win);
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
printf("Error: eglMakeCurrent() failed\n");
return -1;
}
if (printInfo) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
}
init();
/* Set initial projection/viewing transformation.
* We can't be sure we'll get a ConfigureNotify event when the window
* first appears.
*/
reshape(winWidth, winHeight);
event_loop(x_dpy, win, egl_dpy, egl_surf);
eglDestroyContext(egl_dpy, egl_ctx);
eglDestroySurface(egl_dpy, egl_surf);
eglTerminate(egl_dpy);
XDestroyWindow(x_dpy, win);
XCloseDisplay(x_dpy);
return 0;
}

274
progs/es1/xegl/es1_info.c Normal file
View File

@@ -0,0 +1,274 @@
/*
* Copyright (C) 2008 Tunsgten Graphics,Inc. All Rights Reserved.
*/
/*
* List OpenGL ES extensions.
* Print ES 1 or ES 2 extensions depending on which library we're
* linked with: libGLESv1_CM.so vs libGLESv2.so
*/
#define GL_GLEXT_PROTOTYPES
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <EGL/egl.h>
/*
* Print a list of extensions, with word-wrapping.
*/
static void
print_extension_list(const char *ext)
{
const char *indentString = " ";
const int indent = 4;
const int max = 79;
int width, i, j;
if (!ext || !ext[0])
return;
width = indent;
printf(indentString);
i = j = 0;
while (1) {
if (ext[j] == ' ' || ext[j] == 0) {
/* found end of an extension name */
const int len = j - i;
if (width + len > max) {
/* start a new line */
printf("\n");
width = indent;
printf(indentString);
}
/* print the extension name between ext[i] and ext[j] */
while (i < j) {
printf("%c", ext[i]);
i++;
}
/* either we're all done, or we'll continue with next extension */
width += len + 1;
if (ext[j] == 0) {
break;
}
else {
i++;
j++;
if (ext[j] == 0)
break;
printf(", ");
width += 2;
}
}
j++;
}
printf("\n");
}
static void
info(EGLDisplay egl_dpy)
{
const char *s;
s = eglQueryString(egl_dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s);
s = eglQueryString(egl_dpy, EGL_VENDOR);
printf("EGL_VENDOR = %s\n", s);
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
printf("EGL_EXTENSIONS = %s\n", s);
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
printf("EGL_CLIENT_APIS = %s\n", s);
printf("GL_VERSION: %s\n", (char *) glGetString(GL_VERSION));
printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_EXTENSIONS:\n");
print_extension_list((char *) glGetString(GL_EXTENSIONS));
}
/*
* Create an RGB, double-buffered X window.
* Return the window and context handles.
*/
static void
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
const char *name,
int x, int y, int width, int height,
Window *winRet,
EGLContext *ctxRet,
EGLSurface *surfRet)
{
static const EGLint attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_NONE
};
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
XVisualInfo *visInfo, visTemplate;
int num_visuals;
EGLContext ctx;
EGLConfig config;
EGLint num_configs;
EGLint vid;
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
assert(config);
assert(num_configs > 0);
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");
exit(1);
}
/* The X window visual must match the EGL config */
visTemplate.visualid = vid;
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
if (!visInfo) {
printf("Error: couldn't get X visual\n");
exit(1);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
0, visInfo->depth, InputOutput,
visInfo->visual, mask, &attr );
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(x_dpy, win, &sizehints);
XSetStandardProperties(x_dpy, win, name, name,
None, (char **)NULL, 0, &sizehints);
}
eglBindAPI(EGL_OPENGL_ES_API);
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
if (!ctx) {
printf("Error: eglCreateContext failed\n");
exit(1);
}
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
if (!*surfRet) {
printf("Error: eglCreateWindowSurface failed\n");
exit(1);
}
XFree(visInfo);
*winRet = win;
*ctxRet = ctx;
}
static void
usage(void)
{
printf("Usage:\n");
printf(" -display <displayname> set the display to run on\n");
}
int
main(int argc, char *argv[])
{
const int winWidth = 400, winHeight = 300;
Display *x_dpy;
Window win;
EGLSurface egl_surf;
EGLContext egl_ctx;
EGLDisplay egl_dpy;
char *dpyName = NULL;
EGLint egl_major, egl_minor;
int i;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
dpyName = argv[i+1];
i++;
}
else {
usage();
return -1;
}
}
x_dpy = XOpenDisplay(dpyName);
if (!x_dpy) {
printf("Error: couldn't open display %s\n",
dpyName ? dpyName : getenv("DISPLAY"));
return -1;
}
egl_dpy = eglGetDisplay(x_dpy);
if (!egl_dpy) {
printf("Error: eglGetDisplay() failed\n");
return -1;
}
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n");
return -1;
}
make_x_window(x_dpy, egl_dpy,
"ES info", 0, 0, winWidth, winHeight,
&win, &egl_ctx, &egl_surf);
/*XMapWindow(x_dpy, win);*/
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
printf("Error: eglMakeCurrent() failed\n");
return -1;
}
info(egl_dpy);
eglDestroyContext(egl_dpy, egl_ctx);
eglDestroySurface(egl_dpy, egl_surf);
eglTerminate(egl_dpy);
XDestroyWindow(x_dpy, win);
XCloseDisplay(x_dpy);
return 0;
}

442
progs/es1/xegl/msaa.c Normal file
View File

@@ -0,0 +1,442 @@
/*
* Copyright (C) 2008 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.
*/
/*
* Test MSAA with X/EGL and OpenGL ES 1.x
* Brian Paul
* 15 September 2008
*/
#define USE_FULL_GL 0
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#if USE_FULL_GL
#include <GL/gl.h> /* use full OpenGL */
#else
#include <GLES/gl.h> /* use OpenGL ES 1.x */
#include <GLES/glext.h>
#endif
#include <EGL/egl.h>
static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
static GLboolean AA = 0*GL_TRUE;
static void
draw(void)
{
float a;
static const GLfloat verts[4][2] = {
{ -1, -.1 },
{ 1, -.1 },
{ -1, .1 },
{ 1, .1 }
};
static const GLfloat colors[4][4] = {
{ 1, 0, 0, 1 },
{ 0, 1, 0, 1 },
{ 0, 0, 1, 1 },
{ 1, 0, 1, 1 }
};
if (AA) {
printf("MSAA enabled\n");
glEnable(GL_MULTISAMPLE);
}
else {
printf("MSAA disabled\n");
glDisable(GL_MULTISAMPLE);
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(view_rotx, 1, 0, 0);
glRotatef(view_roty, 0, 1, 0);
glRotatef(view_rotz, 0, 0, 1);
{
glVertexPointer(2, GL_FLOAT, 0, verts);
glColorPointer(4, GL_FLOAT, 0, colors);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
for (a = 0; a < 360; a += 20.0) {
glPushMatrix();
glRotatef(a, 0, 0, 1);
glTranslatef(1.5, 0, 0);
/* draw triangle */
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glPopMatrix();
}
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
}
glPopMatrix();
}
/* new window size or exposure */
static void
reshape(int width, int height)
{
GLfloat ary = 3.0;
GLfloat arx = ary * (GLfloat) width / (GLfloat) height;
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
#ifdef GL_VERSION_ES_CM_1_0
glOrthof(-arx, arx, -ary, ary, -1.0, 1.0);
#else
glOrtho(-arx, arx, -ary, ary, -1.0, 1.0);
#endif
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
static void
init(void)
{
printf("Press 'a' to toggle multisample antialiasing\n");
printf("Press 'Esc' to exit\n");
}
/*
* Create an RGB, double-buffered X window.
* Return the window and context handles.
*/
static void
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
const char *name,
int x, int y, int width, int height,
Window *winRet,
EGLContext *ctxRet,
EGLSurface *surfRet)
{
static const EGLint attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_DEPTH_SIZE, 1,
EGL_SAMPLES, 1,
EGL_SAMPLE_BUFFERS, 1,
EGL_NONE
};
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
XVisualInfo *visInfo, visTemplate;
int num_visuals;
EGLContext ctx;
EGLConfig config;
EGLint num_configs;
EGLint vid;
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
if (num_configs < 1) {
printf("Error: Unable to find multisample pixel format.\n");
printf("Try running glxinfo to see if your server supports MSAA.\n");
exit(1);
}
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");
exit(1);
}
/* The X window visual must match the EGL config */
visTemplate.visualid = vid;
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
if (!visInfo) {
printf("Error: couldn't get X visual\n");
exit(1);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
0, visInfo->depth, InputOutput,
visInfo->visual, mask, &attr );
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(x_dpy, win, &sizehints);
XSetStandardProperties(x_dpy, win, name, name,
None, (char **)NULL, 0, &sizehints);
}
#if USE_FULL_GL
eglBindAPI(EGL_OPENGL_API);
#else
eglBindAPI(EGL_OPENGL_ES_API);
#endif
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
if (!ctx) {
printf("Error: eglCreateContext failed\n");
exit(1);
}
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
if (!*surfRet) {
printf("Error: eglCreateWindowSurface failed\n");
exit(1);
}
XFree(visInfo);
*winRet = win;
*ctxRet = ctx;
}
static void
event_loop(Display *dpy, Window win,
EGLDisplay egl_dpy, EGLSurface egl_surf)
{
while (1) {
int redraw = 0;
XEvent event;
XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
redraw = 1;
break;
case ConfigureNotify:
reshape(event.xconfigure.width, event.xconfigure.height);
break;
case KeyPress:
{
char buffer[10];
int r, code;
code = XLookupKeysym(&event.xkey, 0);
if (code == XK_Left) {
view_roty += 5.0;
}
else if (code == XK_Right) {
view_roty -= 5.0;
}
else if (code == XK_Up) {
view_rotx += 5.0;
}
else if (code == XK_Down) {
view_rotx -= 5.0;
}
else {
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == 'a') {
AA = !AA;
redraw = 1;
}
else if (buffer[0] == 27) {
/* escape */
return;
}
}
}
redraw = 1;
break;
default:
; /*no-op*/
}
if (redraw) {
draw();
eglSwapBuffers(egl_dpy, egl_surf);
}
}
}
static void
usage(void)
{
printf("Usage:\n");
printf(" -display <displayname> set the display to run on\n");
printf(" -info display OpenGL renderer info\n");
}
int
main(int argc, char *argv[])
{
const int winWidth = 600, winHeight = 600;
Display *x_dpy;
Window win;
EGLSurface egl_surf;
EGLContext egl_ctx;
EGLDisplay egl_dpy;
char *dpyName = NULL;
GLboolean printInfo = GL_FALSE;
EGLint egl_major, egl_minor;
int i;
const char *s;
static struct {
char *name;
GLenum value;
enum {GetString, GetInteger} type;
} info_items[] = {
{"GL_RENDERER", GL_RENDERER, GetString},
{"GL_VERSION", GL_VERSION, GetString},
{"GL_VENDOR", GL_VENDOR, GetString},
{"GL_EXTENSIONS", GL_EXTENSIONS, GetString},
{"GL_MAX_PALETTE_MATRICES_OES", GL_MAX_PALETTE_MATRICES_OES, GetInteger},
{"GL_MAX_VERTEX_UNITS_OES", GL_MAX_VERTEX_UNITS_OES, GetInteger},
};
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
dpyName = argv[i+1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {
printInfo = GL_TRUE;
}
else {
usage();
return -1;
}
}
x_dpy = XOpenDisplay(dpyName);
if (!x_dpy) {
printf("Error: couldn't open display %s\n",
dpyName ? dpyName : getenv("DISPLAY"));
return -1;
}
egl_dpy = eglGetDisplay(x_dpy);
if (!egl_dpy) {
printf("Error: eglGetDisplay() failed\n");
return -1;
}
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n");
return -1;
}
s = eglQueryString(egl_dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s);
s = eglQueryString(egl_dpy, EGL_VENDOR);
printf("EGL_VENDOR = %s\n", s);
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
printf("EGL_EXTENSIONS = %s\n", s);
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
printf("EGL_CLIENT_APIS = %s\n", s);
make_x_window(x_dpy, egl_dpy,
"msaa", 0, 0, winWidth, winHeight,
&win, &egl_ctx, &egl_surf);
XMapWindow(x_dpy, win);
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
printf("Error: eglMakeCurrent() failed\n");
return -1;
}
if (printInfo) {
for (i = 0; i < sizeof(info_items)/sizeof(info_items[0]); i++) {
switch (info_items[i].type) {
case GetString:
printf("%s = %s\n", info_items[i].name, (char *)glGetString(info_items[i].value));
break;
case GetInteger: {
GLint rv = -1;
glGetIntegerv(info_items[i].value, &rv);
printf("%s = %d\n", info_items[i].name, rv);
break;
}
}
}
};
init();
/* Set initial projection/viewing transformation.
* We can't be sure we'll get a ConfigureNotify event when the window
* first appears.
*/
reshape(winWidth, winHeight);
event_loop(x_dpy, win, egl_dpy, egl_surf);
eglDestroyContext(egl_dpy, egl_ctx);
eglDestroySurface(egl_dpy, egl_surf);
eglTerminate(egl_dpy);
XDestroyWindow(x_dpy, win);
XCloseDisplay(x_dpy);
return 0;
}

607
progs/es1/xegl/pbuffer.c Normal file
View File

@@ -0,0 +1,607 @@
/*
* Copyright (C) 2008 Tunsgten Graphics,Inc. All Rights Reserved.
*/
/*
* Test EGL Pbuffers
* Brian Paul
* August 2008
*/
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <EGL/egl.h>
static int WinWidth = 300, WinHeight = 300;
static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
static void
Normal(GLfloat *n, GLfloat nx, GLfloat ny, GLfloat nz)
{
n[0] = nx;
n[1] = ny;
n[2] = nz;
}
static void
Vertex(GLfloat *v, GLfloat vx, GLfloat vy, GLfloat vz)
{
v[0] = vx;
v[1] = vy;
v[2] = vz;
}
static void
Texcoord(GLfloat *v, GLfloat s, GLfloat t)
{
v[0] = s;
v[1] = t;
}
/* Borrowed from glut, adapted */
static void
draw_torus(GLfloat r, GLfloat R, GLint nsides, GLint rings)
{
int i, j;
GLfloat theta, phi, theta1;
GLfloat cosTheta, sinTheta;
GLfloat cosTheta1, sinTheta1;
GLfloat ringDelta, sideDelta;
GLfloat varray[100][3], narray[100][3], tarray[100][2];
int vcount;
glVertexPointer(3, GL_FLOAT, 0, varray);
glNormalPointer(GL_FLOAT, 0, narray);
glTexCoordPointer(2, GL_FLOAT, 0, tarray);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
ringDelta = 2.0 * M_PI / rings;
sideDelta = 2.0 * M_PI / nsides;
theta = 0.0;
cosTheta = 1.0;
sinTheta = 0.0;
for (i = rings - 1; i >= 0; i--) {
theta1 = theta + ringDelta;
cosTheta1 = cos(theta1);
sinTheta1 = sin(theta1);
vcount = 0; /* glBegin(GL_QUAD_STRIP); */
phi = 0.0;
for (j = nsides; j >= 0; j--) {
GLfloat s0, s1, t;
GLfloat cosPhi, sinPhi, dist;
phi += sideDelta;
cosPhi = cos(phi);
sinPhi = sin(phi);
dist = R + r * cosPhi;
s0 = 20.0 * theta / (2.0 * M_PI);
s1 = 20.0 * theta1 / (2.0 * M_PI);
t = 8.0 * phi / (2.0 * M_PI);
Normal(narray[vcount], cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi);
Texcoord(tarray[vcount], s1, t);
Vertex(varray[vcount], cosTheta1 * dist, -sinTheta1 * dist, r * sinPhi);
vcount++;
Normal(narray[vcount], cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi);
Texcoord(tarray[vcount], s0, t);
Vertex(varray[vcount], cosTheta * dist, -sinTheta * dist, r * sinPhi);
vcount++;
}
/*glEnd();*/
assert(vcount <= 100);
glDrawArrays(GL_TRIANGLE_STRIP, 0, vcount);
theta = theta1;
cosTheta = cosTheta1;
sinTheta = sinTheta1;
}
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
static void
draw(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(view_rotx, 1, 0, 0);
glRotatef(view_roty, 0, 1, 0);
glRotatef(view_rotz, 0, 0, 1);
glScalef(0.5, 0.5, 0.5);
draw_torus(1.0, 3.0, 30, 60);
glPopMatrix();
glFinish();
}
/**
* Draw to both the window and pbuffer and compare results.
*/
static void
draw_both(EGLDisplay egl_dpy, EGLSurface egl_surf, EGLSurface egl_pbuf,
EGLContext egl_ctx)
{
unsigned *wbuf, *pbuf;
int x = 100, y = 110;
int i, dif;
wbuf = (unsigned *) malloc(WinWidth * WinHeight * 4);
pbuf = (unsigned *) malloc(WinWidth * WinHeight * 4);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
/* first draw to window */
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
printf("Error: eglMakeCurrent(window) failed\n");
return;
}
draw();
glReadPixels(0, 0, WinWidth, WinHeight, GL_RGBA, GL_UNSIGNED_BYTE, wbuf);
printf("Window[%d,%d] = 0x%08x\n", x, y, wbuf[y*WinWidth+x]);
/* then draw to pbuffer */
if (!eglMakeCurrent(egl_dpy, egl_pbuf, egl_pbuf, egl_ctx)) {
printf("Error: eglMakeCurrent(pbuffer) failed\n");
return;
}
draw();
glReadPixels(0, 0, WinWidth, WinHeight, GL_RGBA, GL_UNSIGNED_BYTE, pbuf);
printf("Pbuffer[%d,%d] = 0x%08x\n", x, y, pbuf[y*WinWidth+x]);
eglSwapBuffers(egl_dpy, egl_surf);
/* compare renderings */
for (dif = i = 0; i < WinWidth * WinHeight; i++) {
if (wbuf[i] != pbuf[i]) {
dif = 1;
break;
}
}
if (dif)
printf("Difference at %d: 0x%08x vs. 0x%08x\n", i, wbuf[i], pbuf[i]);
else
printf("Window rendering matches Pbuffer rendering!\n");
free(wbuf);
free(pbuf);
}
/* new window size or exposure */
static void
reshape(int width, int height)
{
GLfloat ar = (GLfloat) width / (GLfloat) height;
WinWidth = width;
WinHeight = height;
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
#ifdef GL_VERSION_ES_CM_1_0
glFrustumf(-ar, ar, -1, 1, 5.0, 60.0);
#else
glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
#endif
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -15.0);
}
static void
make_texture(void)
{
#define SZ 64
GLenum Filter = GL_LINEAR;
GLubyte image[SZ][SZ][4];
GLuint i, j;
for (i = 0; i < SZ; i++) {
for (j = 0; j < SZ; j++) {
GLfloat d = (i - SZ/2) * (i - SZ/2) + (j - SZ/2) * (j - SZ/2);
d = sqrt(d);
if (d < SZ/3) {
image[i][j][0] = 255;
image[i][j][1] = 255;
image[i][j][2] = 255;
image[i][j][3] = 255;
}
else {
image[i][j][0] = 127;
image[i][j][1] = 127;
image[i][j][2] = 127;
image[i][j][3] = 255;
}
}
}
glActiveTexture(GL_TEXTURE0); /* unit 0 */
glBindTexture(GL_TEXTURE_2D, 42);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SZ, SZ, 0,
GL_RGBA, GL_UNSIGNED_BYTE, image);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, Filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, Filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
#undef SZ
}
static void
init(void)
{
static const GLfloat red[4] = {1, 0, 0, 0};
static const GLfloat white[4] = {1.0, 1.0, 1.0, 1.0};
static const GLfloat diffuse[4] = {0.7, 0.7, 0.7, 1.0};
static const GLfloat specular[4] = {0.001, 0.001, 0.001, 1.0};
static const GLfloat pos[4] = {20, 20, 50, 1};
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, red);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, white);
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 9.0);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glLightfv(GL_LIGHT0, GL_POSITION, pos);
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
glLightfv(GL_LIGHT0, GL_SPECULAR, specular);
glClearColor(0.4, 0.4, 0.4, 0.0);
glEnable(GL_DEPTH_TEST);
make_texture();
glEnable(GL_TEXTURE_2D);
}
/*
* Create an RGB, double-buffered X window.
* Return the window and context handles.
*/
static void
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
const char *name,
int x, int y, int width, int height,
Window *winRet,
EGLContext *ctxRet,
EGLSurface *surfRet)
{
static const EGLint attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_DEPTH_SIZE, 1,
EGL_NONE
};
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
XVisualInfo *visInfo, visTemplate;
int num_visuals;
EGLContext ctx;
EGLConfig config;
EGLint num_configs;
EGLint vid;
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
assert(config);
assert(num_configs > 0);
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");
exit(1);
}
/* The X window visual must match the EGL config */
visTemplate.visualid = vid;
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
if (!visInfo) {
printf("Error: couldn't get X visual\n");
exit(1);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
0, visInfo->depth, InputOutput,
visInfo->visual, mask, &attr );
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(x_dpy, win, &sizehints);
XSetStandardProperties(x_dpy, win, name, name,
None, (char **)NULL, 0, &sizehints);
}
eglBindAPI(EGL_OPENGL_ES_API);
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
if (!ctx) {
printf("Error: eglCreateContext failed\n");
exit(1);
}
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
if (!*surfRet) {
printf("Error: eglCreateWindowSurface failed\n");
exit(1);
}
XFree(visInfo);
*winRet = win;
*ctxRet = ctx;
}
static EGLSurface
make_pbuffer(Display *x_dpy, EGLDisplay egl_dpy, int width, int height)
{
static const EGLint config_attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_DEPTH_SIZE, 1,
EGL_NONE
};
EGLConfig config;
EGLSurface pbuf;
EGLint num_configs;
EGLint pbuf_attribs[5];
pbuf_attribs[0] = EGL_WIDTH;
pbuf_attribs[1] = width;
pbuf_attribs[2] = EGL_HEIGHT;
pbuf_attribs[3] = height;
pbuf_attribs[4] = EGL_NONE;
if (!eglChooseConfig( egl_dpy, config_attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL config for pbuffer\n");
exit(1);
}
pbuf = eglCreatePbufferSurface(egl_dpy, config, pbuf_attribs);
return pbuf;
}
static void
event_loop(Display *dpy, Window win,
EGLDisplay egl_dpy, EGLSurface egl_surf, EGLSurface egl_pbuf,
EGLContext egl_ctx)
{
int anim = 0;
while (1) {
int redraw = 0;
if (!anim || XPending(dpy)) {
XEvent event;
XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
redraw = 1;
break;
case ConfigureNotify:
if (event.xconfigure.window == win)
reshape(event.xconfigure.width, event.xconfigure.height);
break;
case KeyPress:
{
char buffer[10];
int r, code;
code = XLookupKeysym(&event.xkey, 0);
if (code == XK_Left) {
view_roty += 5.0;
}
else if (code == XK_Right) {
view_roty -= 5.0;
}
else if (code == XK_Up) {
view_rotx += 5.0;
}
else if (code == XK_Down) {
view_rotx -= 5.0;
}
else {
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == ' ') {
anim = !anim;
}
else if (buffer[0] == 27) {
/* escape */
return;
}
}
}
redraw = 1;
break;
default:
; /*no-op*/
}
}
if (anim) {
view_rotx += 1.0;
view_roty += 2.0;
redraw = 1;
}
if (redraw) {
draw_both(egl_dpy, egl_surf, egl_pbuf, egl_ctx);
}
}
}
static void
usage(void)
{
printf("Usage:\n");
printf(" -display <displayname> set the display to run on\n");
printf(" -info display OpenGL renderer info\n");
}
int
main(int argc, char *argv[])
{
Display *x_dpy;
Window win;
EGLSurface egl_surf, egl_pbuf;
EGLContext egl_ctx;
EGLDisplay egl_dpy;
char *dpyName = NULL;
GLboolean printInfo = GL_FALSE;
EGLint egl_major, egl_minor;
int i;
const char *s;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
dpyName = argv[i+1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {
printInfo = GL_TRUE;
}
else {
usage();
return -1;
}
}
x_dpy = XOpenDisplay(dpyName);
if (!x_dpy) {
printf("Error: couldn't open display %s\n",
dpyName ? dpyName : getenv("DISPLAY"));
return -1;
}
egl_dpy = eglGetDisplay(x_dpy);
if (!egl_dpy) {
printf("Error: eglGetDisplay() failed\n");
return -1;
}
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n");
return -1;
}
s = eglQueryString(egl_dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s);
s = eglQueryString(egl_dpy, EGL_VENDOR);
printf("EGL_VENDOR = %s\n", s);
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
printf("EGL_EXTENSIONS = %s\n", s);
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
printf("EGL_CLIENT_APIS = %s\n", s);
make_x_window(x_dpy, egl_dpy,
"pbuffer", 0, 0, WinWidth, WinHeight,
&win, &egl_ctx, &egl_surf);
egl_pbuf = make_pbuffer(x_dpy, egl_dpy, WinWidth, WinHeight);
if (!egl_pbuf) {
printf("Error: eglCreatePBufferSurface() failed\n");
return -1;
}
XMapWindow(x_dpy, win);
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
printf("Error: eglMakeCurrent() failed\n");
return -1;
}
if (printInfo) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
}
init();
/* Set initial projection/viewing transformation.
* We can't be sure we'll get a ConfigureNotify event when the window
* first appears.
*/
reshape(WinWidth, WinHeight);
event_loop(x_dpy, win, egl_dpy, egl_surf, egl_pbuf, egl_ctx);
eglDestroyContext(egl_dpy, egl_ctx);
eglDestroySurface(egl_dpy, egl_surf);
eglTerminate(egl_dpy);
XDestroyWindow(x_dpy, win);
XCloseDisplay(x_dpy);
return 0;
}

657
progs/es1/xegl/render_tex.c Normal file
View File

@@ -0,0 +1,657 @@
/*
* Copyright (C) 2008 Tunsgten Graphics,Inc. All Rights Reserved.
*/
/*
* Test EGL render to texture.
* Brian Paul
* August 2008
*/
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <EGL/egl.h>
static int TexWidth = 256, TexHeight = 256;
static int WinWidth = 300, WinHeight = 300;
static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
static GLuint DotTexture, RenderTexture;
static void
Normal(GLfloat *n, GLfloat nx, GLfloat ny, GLfloat nz)
{
n[0] = nx;
n[1] = ny;
n[2] = nz;
}
static void
Vertex(GLfloat *v, GLfloat vx, GLfloat vy, GLfloat vz)
{
v[0] = vx;
v[1] = vy;
v[2] = vz;
}
static void
Texcoord(GLfloat *v, GLfloat s, GLfloat t)
{
v[0] = s;
v[1] = t;
}
/* Borrowed from glut, adapted */
static void
draw_torus(GLfloat r, GLfloat R, GLint nsides, GLint rings)
{
int i, j;
GLfloat theta, phi, theta1;
GLfloat cosTheta, sinTheta;
GLfloat cosTheta1, sinTheta1;
GLfloat ringDelta, sideDelta;
GLfloat varray[100][3], narray[100][3], tarray[100][2];
int vcount;
glVertexPointer(3, GL_FLOAT, 0, varray);
glNormalPointer(GL_FLOAT, 0, narray);
glTexCoordPointer(2, GL_FLOAT, 0, tarray);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
ringDelta = 2.0 * M_PI / rings;
sideDelta = 2.0 * M_PI / nsides;
theta = 0.0;
cosTheta = 1.0;
sinTheta = 0.0;
for (i = rings - 1; i >= 0; i--) {
theta1 = theta + ringDelta;
cosTheta1 = cos(theta1);
sinTheta1 = sin(theta1);
vcount = 0; /* glBegin(GL_QUAD_STRIP); */
phi = 0.0;
for (j = nsides; j >= 0; j--) {
GLfloat s0, s1, t;
GLfloat cosPhi, sinPhi, dist;
phi += sideDelta;
cosPhi = cos(phi);
sinPhi = sin(phi);
dist = R + r * cosPhi;
s0 = 20.0 * theta / (2.0 * M_PI);
s1 = 20.0 * theta1 / (2.0 * M_PI);
t = 8.0 * phi / (2.0 * M_PI);
Normal(narray[vcount], cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi);
Texcoord(tarray[vcount], s1, t);
Vertex(varray[vcount], cosTheta1 * dist, -sinTheta1 * dist, r * sinPhi);
vcount++;
Normal(narray[vcount], cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi);
Texcoord(tarray[vcount], s0, t);
Vertex(varray[vcount], cosTheta * dist, -sinTheta * dist, r * sinPhi);
vcount++;
}
/*glEnd();*/
assert(vcount <= 100);
glDrawArrays(GL_TRIANGLE_STRIP, 0, vcount);
theta = theta1;
cosTheta = cosTheta1;
sinTheta = sinTheta1;
}
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
static void
draw_torus_to_texture(void)
{
glViewport(0, 0, TexWidth, TexHeight);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustumf(-1, 1, -1, 1, 5.0, 60.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -15.0);
glClearColor(0.4, 0.4, 0.4, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBindTexture(GL_TEXTURE_2D, DotTexture);
glEnable(GL_LIGHTING);
glPushMatrix();
glRotatef(view_roty, 0, 1, 0);
glScalef(0.5, 0.5, 0.5);
draw_torus(1.0, 3.0, 30, 60);
glPopMatrix();
glDisable(GL_LIGHTING);
#if 0
glBindTexture(GL_TEXTURE_2D, RenderTexture);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, TexWidth, TexHeight);
#endif
glFinish();
}
static void
draw_textured_quad(void)
{
GLfloat ar = (GLfloat) WinWidth / (GLfloat) WinHeight;
glViewport(0, 0, WinWidth, WinHeight);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustumf(-ar, ar, -1, 1, 5.0, 60.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -8.0);
glClearColor(0.4, 0.4, 1.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBindTexture(GL_TEXTURE_2D, RenderTexture);
glPushMatrix();
glRotatef(view_rotx, 1, 0, 0);
glRotatef(view_rotz, 0, 0, 1);
{
static const GLfloat texcoord[4][2] = {
{ 0, 0 }, { 1, 0 }, { 0, 1 }, { 1, 1 }
};
static const GLfloat vertex[4][2] = {
{ -1, -1 }, { 1, -1 }, { -1, 1 }, { 1, 1 }
};
glVertexPointer(2, GL_FLOAT, 0, vertex);
glTexCoordPointer(2, GL_FLOAT, 0, texcoord);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
glPopMatrix();
}
static void
draw(EGLDisplay egl_dpy, EGLSurface egl_surf, EGLSurface egl_pbuf,
EGLContext egl_ctx)
{
/*printf("Begin draw\n");*/
/* first draw torus to pbuffer /texture */
#if 01
if (!eglMakeCurrent(egl_dpy, egl_pbuf, egl_pbuf, egl_ctx)) {
#else
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
#endif
printf("Error: eglMakeCurrent(pbuf) failed\n");
return;
}
glBindTexture(GL_TEXTURE_2D, RenderTexture);
eglBindTexImage(egl_dpy, egl_pbuf, EGL_BACK_BUFFER);
draw_torus_to_texture();
eglReleaseTexImage(egl_dpy, egl_pbuf, EGL_BACK_BUFFER);
/* draw textured quad to window */
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
printf("Error: eglMakeCurrent(pbuffer) failed\n");
return;
}
draw_textured_quad();
eglSwapBuffers(egl_dpy, egl_surf);
/*printf("End draw\n");*/
}
static void
make_dot_texture(void)
{
#define SZ 64
GLenum Filter = GL_LINEAR;
GLubyte image[SZ][SZ][4];
GLuint i, j;
for (i = 0; i < SZ; i++) {
for (j = 0; j < SZ; j++) {
GLfloat d = (i - SZ/2) * (i - SZ/2) + (j - SZ/2) * (j - SZ/2);
d = sqrt(d);
if (d < SZ/3) {
image[i][j][0] = 255;
image[i][j][1] = 255;
image[i][j][2] = 255;
image[i][j][3] = 255;
}
else {
image[i][j][0] = 127;
image[i][j][1] = 127;
image[i][j][2] = 127;
image[i][j][3] = 255;
}
}
}
glGenTextures(1, &DotTexture);
glBindTexture(GL_TEXTURE_2D, DotTexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SZ, SZ, 0,
GL_RGBA, GL_UNSIGNED_BYTE, image);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, Filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, Filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
#undef SZ
}
static void
make_render_texture(void)
{
GLenum Filter = GL_LINEAR;
glGenTextures(1, &RenderTexture);
glBindTexture(GL_TEXTURE_2D, RenderTexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, TexWidth, TexHeight, 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, Filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, Filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
}
static void
init(void)
{
static const GLfloat red[4] = {1, 0, 0, 0};
static const GLfloat white[4] = {1.0, 1.0, 1.0, 1.0};
static const GLfloat diffuse[4] = {0.7, 0.7, 0.7, 1.0};
static const GLfloat specular[4] = {0.001, 0.001, 0.001, 1.0};
static const GLfloat pos[4] = {20, 20, 50, 1};
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, red);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, white);
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 9.0);
glEnable(GL_LIGHT0);
glLightfv(GL_LIGHT0, GL_POSITION, pos);
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
glLightfv(GL_LIGHT0, GL_SPECULAR, specular);
glEnable(GL_DEPTH_TEST);
make_dot_texture();
make_render_texture();
printf("DotTexture=%u RenderTexture=%u\n", DotTexture, RenderTexture);
glEnable(GL_TEXTURE_2D);
}
/*
* Create an RGB, double-buffered X window.
* Return the window and context handles.
*/
static void
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
const char *name,
int x, int y, int width, int height,
Window *winRet,
EGLContext *ctxRet,
EGLSurface *surfRet)
{
static const EGLint attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_DEPTH_SIZE, 1,
EGL_NONE
};
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
XVisualInfo *visInfo, visTemplate;
int num_visuals;
EGLContext ctx;
EGLConfig config;
EGLint num_configs;
EGLint vid;
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
assert(config);
assert(num_configs > 0);
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");
exit(1);
}
/* The X window visual must match the EGL config */
visTemplate.visualid = vid;
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
if (!visInfo) {
printf("Error: couldn't get X visual\n");
exit(1);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
0, visInfo->depth, InputOutput,
visInfo->visual, mask, &attr );
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(x_dpy, win, &sizehints);
XSetStandardProperties(x_dpy, win, name, name,
None, (char **)NULL, 0, &sizehints);
}
eglBindAPI(EGL_OPENGL_ES_API);
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
if (!ctx) {
printf("Error: eglCreateContext failed\n");
exit(1);
}
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
if (!*surfRet) {
printf("Error: eglCreateWindowSurface failed\n");
exit(1);
}
XFree(visInfo);
*winRet = win;
*ctxRet = ctx;
}
static EGLSurface
make_pbuffer(Display *x_dpy, EGLDisplay egl_dpy, int width, int height)
{
static const EGLint config_attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_DEPTH_SIZE, 1,
EGL_NONE
};
EGLConfig config;
EGLSurface pbuf;
EGLint num_configs;
EGLint pbuf_attribs[15];
int i = 0;
pbuf_attribs[i++] = EGL_WIDTH;
pbuf_attribs[i++] = width;
pbuf_attribs[i++] = EGL_HEIGHT;
pbuf_attribs[i++] = height;
pbuf_attribs[i++] = EGL_TEXTURE_FORMAT;
pbuf_attribs[i++] = EGL_TEXTURE_RGBA;
pbuf_attribs[i++] = EGL_TEXTURE_TARGET;
pbuf_attribs[i++] = EGL_TEXTURE_2D;
pbuf_attribs[i++] = EGL_MIPMAP_TEXTURE;
pbuf_attribs[i++] = EGL_FALSE;
pbuf_attribs[i++] = EGL_NONE;
assert(i <= 15);
if (!eglChooseConfig( egl_dpy, config_attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL config for pbuffer\n");
exit(1);
}
pbuf = eglCreatePbufferSurface(egl_dpy, config, pbuf_attribs);
return pbuf;
}
static void
event_loop(Display *dpy, Window win,
EGLDisplay egl_dpy, EGLSurface egl_surf, EGLSurface egl_pbuf,
EGLContext egl_ctx)
{
int anim = 0;
while (1) {
int redraw = 0;
if (!anim || XPending(dpy)) {
XEvent event;
XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
redraw = 1;
break;
case ConfigureNotify:
if (event.xconfigure.window == win) {
WinWidth = event.xconfigure.width;
WinHeight = event.xconfigure.height;
}
break;
case KeyPress:
{
char buffer[10];
int r, code;
code = XLookupKeysym(&event.xkey, 0);
if (code == XK_Left) {
view_roty += 5.0;
}
else if (code == XK_Right) {
view_roty -= 5.0;
}
else if (code == XK_Up) {
view_rotx += 5.0;
}
else if (code == XK_Down) {
view_rotx -= 5.0;
}
else {
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == ' ') {
anim = !anim;
}
else if (buffer[0] == 'z') {
view_rotz += 5.0;
}
else if (buffer[0] == 'Z') {
view_rotz -= 5.0;
}
else if (buffer[0] == 27) {
/* escape */
return;
}
}
}
redraw = 1;
break;
default:
; /*no-op*/
}
}
if (anim) {
view_rotx += 1.0;
view_roty += 2.0;
redraw = 1;
}
if (redraw) {
draw(egl_dpy, egl_surf, egl_pbuf, egl_ctx);
}
}
}
static void
usage(void)
{
printf("Usage:\n");
printf(" -display <displayname> set the display to run on\n");
printf(" -info display OpenGL renderer info\n");
}
int
main(int argc, char *argv[])
{
Display *x_dpy;
Window win;
EGLSurface egl_surf, egl_pbuf;
EGLContext egl_ctx;
EGLDisplay egl_dpy;
char *dpyName = NULL;
GLboolean printInfo = GL_FALSE;
EGLint egl_major, egl_minor;
int i;
const char *s;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
dpyName = argv[i+1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {
printInfo = GL_TRUE;
}
else {
usage();
return -1;
}
}
x_dpy = XOpenDisplay(dpyName);
if (!x_dpy) {
printf("Error: couldn't open display %s\n",
dpyName ? dpyName : getenv("DISPLAY"));
return -1;
}
egl_dpy = eglGetDisplay(x_dpy);
if (!egl_dpy) {
printf("Error: eglGetDisplay() failed\n");
return -1;
}
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n");
return -1;
}
s = eglQueryString(egl_dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s);
s = eglQueryString(egl_dpy, EGL_VENDOR);
printf("EGL_VENDOR = %s\n", s);
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
printf("EGL_EXTENSIONS = %s\n", s);
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
printf("EGL_CLIENT_APIS = %s\n", s);
make_x_window(x_dpy, egl_dpy,
"render_tex", 0, 0, WinWidth, WinHeight,
&win, &egl_ctx, &egl_surf);
egl_pbuf = make_pbuffer(x_dpy, egl_dpy, TexWidth, TexHeight);
if (!egl_pbuf) {
printf("Error: eglCreatePBufferSurface() failed\n");
return -1;
}
XMapWindow(x_dpy, win);
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
printf("Error: eglMakeCurrent() failed\n");
return -1;
}
if (printInfo) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
}
init();
event_loop(x_dpy, win, egl_dpy, egl_surf, egl_pbuf, egl_ctx);
eglDestroyContext(egl_dpy, egl_ctx);
eglDestroySurface(egl_dpy, egl_surf);
eglTerminate(egl_dpy);
XDestroyWindow(x_dpy, win);
XCloseDisplay(x_dpy);
return 0;
}

509
progs/es1/xegl/torus.c Normal file
View File

@@ -0,0 +1,509 @@
/*
* Copyright (C) 2008 Tunsgten Graphics,Inc. All Rights Reserved.
*/
/*
* Draw a lit, textured torus with X/EGL and OpenGL ES 1.x
* Brian Paul
* July 2008
*/
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <EGL/egl.h>
static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
static void
Normal(GLfloat *n, GLfloat nx, GLfloat ny, GLfloat nz)
{
n[0] = nx;
n[1] = ny;
n[2] = nz;
}
static void
Vertex(GLfloat *v, GLfloat vx, GLfloat vy, GLfloat vz)
{
v[0] = vx;
v[1] = vy;
v[2] = vz;
}
static void
Texcoord(GLfloat *v, GLfloat s, GLfloat t)
{
v[0] = s;
v[1] = t;
}
/* Borrowed from glut, adapted */
static void
draw_torus(GLfloat r, GLfloat R, GLint nsides, GLint rings)
{
int i, j;
GLfloat theta, phi, theta1;
GLfloat cosTheta, sinTheta;
GLfloat cosTheta1, sinTheta1;
GLfloat ringDelta, sideDelta;
GLfloat varray[100][3], narray[100][3], tarray[100][2];
int vcount;
glVertexPointer(3, GL_FLOAT, 0, varray);
glNormalPointer(GL_FLOAT, 0, narray);
glTexCoordPointer(2, GL_FLOAT, 0, tarray);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
ringDelta = 2.0 * M_PI / rings;
sideDelta = 2.0 * M_PI / nsides;
theta = 0.0;
cosTheta = 1.0;
sinTheta = 0.0;
for (i = rings - 1; i >= 0; i--) {
theta1 = theta + ringDelta;
cosTheta1 = cos(theta1);
sinTheta1 = sin(theta1);
vcount = 0; /* glBegin(GL_QUAD_STRIP); */
phi = 0.0;
for (j = nsides; j >= 0; j--) {
GLfloat s0, s1, t;
GLfloat cosPhi, sinPhi, dist;
phi += sideDelta;
cosPhi = cos(phi);
sinPhi = sin(phi);
dist = R + r * cosPhi;
s0 = 20.0 * theta / (2.0 * M_PI);
s1 = 20.0 * theta1 / (2.0 * M_PI);
t = 8.0 * phi / (2.0 * M_PI);
Normal(narray[vcount], cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi);
Texcoord(tarray[vcount], s1, t);
Vertex(varray[vcount], cosTheta1 * dist, -sinTheta1 * dist, r * sinPhi);
vcount++;
Normal(narray[vcount], cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi);
Texcoord(tarray[vcount], s0, t);
Vertex(varray[vcount], cosTheta * dist, -sinTheta * dist, r * sinPhi);
vcount++;
}
/*glEnd();*/
assert(vcount <= 100);
glDrawArrays(GL_TRIANGLE_STRIP, 0, vcount);
theta = theta1;
cosTheta = cosTheta1;
sinTheta = sinTheta1;
}
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
static void
draw(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(view_rotx, 1, 0, 0);
glRotatef(view_roty, 0, 1, 0);
glRotatef(view_rotz, 0, 0, 1);
glScalef(0.5, 0.5, 0.5);
draw_torus(1.0, 3.0, 30, 60);
glPopMatrix();
}
/* new window size or exposure */
static void
reshape(int width, int height)
{
GLfloat ar = (GLfloat) width / (GLfloat) height;
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
#ifdef GL_VERSION_ES_CM_1_0
glFrustumf(-ar, ar, -1, 1, 5.0, 60.0);
#else
glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
#endif
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -15.0);
}
static void
make_texture(void)
{
#define SZ 64
GLenum Filter = GL_LINEAR;
GLubyte image[SZ][SZ][4];
GLuint i, j;
for (i = 0; i < SZ; i++) {
for (j = 0; j < SZ; j++) {
GLfloat d = (i - SZ/2) * (i - SZ/2) + (j - SZ/2) * (j - SZ/2);
d = sqrt(d);
if (d < SZ/3) {
image[i][j][0] = 255;
image[i][j][1] = 255;
image[i][j][2] = 255;
image[i][j][3] = 255;
}
else {
image[i][j][0] = 127;
image[i][j][1] = 127;
image[i][j][2] = 127;
image[i][j][3] = 255;
}
}
}
glActiveTexture(GL_TEXTURE0); /* unit 0 */
glBindTexture(GL_TEXTURE_2D, 42);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SZ, SZ, 0,
GL_RGBA, GL_UNSIGNED_BYTE, image);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, Filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, Filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
#undef SZ
}
static void
init(void)
{
static const GLfloat red[4] = {1, 0, 0, 0};
static const GLfloat white[4] = {1.0, 1.0, 1.0, 1.0};
static const GLfloat diffuse[4] = {0.7, 0.7, 0.7, 1.0};
static const GLfloat specular[4] = {0.001, 0.001, 0.001, 1.0};
static const GLfloat pos[4] = {20, 20, 50, 1};
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, red);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, white);
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 9.0);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glLightfv(GL_LIGHT0, GL_POSITION, pos);
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
glLightfv(GL_LIGHT0, GL_SPECULAR, specular);
glClearColor(0.4, 0.4, 0.4, 0.0);
glEnable(GL_DEPTH_TEST);
make_texture();
glEnable(GL_TEXTURE_2D);
}
/*
* Create an RGB, double-buffered X window.
* Return the window and context handles.
*/
static void
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
const char *name,
int x, int y, int width, int height,
Window *winRet,
EGLContext *ctxRet,
EGLSurface *surfRet)
{
static const EGLint attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_DEPTH_SIZE, 1,
EGL_NONE
};
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
XVisualInfo *visInfo, visTemplate;
int num_visuals;
EGLContext ctx;
EGLConfig config;
EGLint num_configs;
EGLint vid;
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
assert(config);
assert(num_configs > 0);
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");
exit(1);
}
/* The X window visual must match the EGL config */
visTemplate.visualid = vid;
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
if (!visInfo) {
printf("Error: couldn't get X visual\n");
exit(1);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
0, visInfo->depth, InputOutput,
visInfo->visual, mask, &attr );
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(x_dpy, win, &sizehints);
XSetStandardProperties(x_dpy, win, name, name,
None, (char **)NULL, 0, &sizehints);
}
eglBindAPI(EGL_OPENGL_ES_API);
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
if (!ctx) {
printf("Error: eglCreateContext failed\n");
exit(1);
}
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
if (!*surfRet) {
printf("Error: eglCreateWindowSurface failed\n");
exit(1);
}
XFree(visInfo);
*winRet = win;
*ctxRet = ctx;
}
static void
event_loop(Display *dpy, Window win,
EGLDisplay egl_dpy, EGLSurface egl_surf)
{
int anim = 1;
while (1) {
int redraw = 0;
if (!anim || XPending(dpy)) {
XEvent event;
XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
redraw = 1;
break;
case ConfigureNotify:
reshape(event.xconfigure.width, event.xconfigure.height);
break;
case KeyPress:
{
char buffer[10];
int r, code;
code = XLookupKeysym(&event.xkey, 0);
if (code == XK_Left) {
view_roty += 5.0;
}
else if (code == XK_Right) {
view_roty -= 5.0;
}
else if (code == XK_Up) {
view_rotx += 5.0;
}
else if (code == XK_Down) {
view_rotx -= 5.0;
}
else {
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == ' ') {
anim = !anim;
}
else if (buffer[0] == 27) {
/* escape */
return;
}
}
}
redraw = 1;
break;
default:
; /*no-op*/
}
}
if (anim) {
view_rotx += 1.0;
view_roty += 2.0;
redraw = 1;
}
if (redraw) {
draw();
eglSwapBuffers(egl_dpy, egl_surf);
}
}
}
static void
usage(void)
{
printf("Usage:\n");
printf(" -display <displayname> set the display to run on\n");
printf(" -info display OpenGL renderer info\n");
}
int
main(int argc, char *argv[])
{
const int winWidth = 300, winHeight = 300;
Display *x_dpy;
Window win;
EGLSurface egl_surf;
EGLContext egl_ctx;
EGLDisplay egl_dpy;
char *dpyName = NULL;
GLboolean printInfo = GL_FALSE;
EGLint egl_major, egl_minor;
int i;
const char *s;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
dpyName = argv[i+1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {
printInfo = GL_TRUE;
}
else {
usage();
return -1;
}
}
x_dpy = XOpenDisplay(dpyName);
if (!x_dpy) {
printf("Error: couldn't open display %s\n",
dpyName ? dpyName : getenv("DISPLAY"));
return -1;
}
egl_dpy = eglGetDisplay(x_dpy);
if (!egl_dpy) {
printf("Error: eglGetDisplay() failed\n");
return -1;
}
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n");
return -1;
}
s = eglQueryString(egl_dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s);
s = eglQueryString(egl_dpy, EGL_VENDOR);
printf("EGL_VENDOR = %s\n", s);
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
printf("EGL_EXTENSIONS = %s\n", s);
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
printf("EGL_CLIENT_APIS = %s\n", s);
make_x_window(x_dpy, egl_dpy,
"torus", 0, 0, winWidth, winHeight,
&win, &egl_ctx, &egl_surf);
XMapWindow(x_dpy, win);
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
printf("Error: eglMakeCurrent() failed\n");
return -1;
}
if (printInfo) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
}
init();
/* Set initial projection/viewing transformation.
* We can't be sure we'll get a ConfigureNotify event when the window
* first appears.
*/
reshape(winWidth, winHeight);
event_loop(x_dpy, win, egl_dpy, egl_surf);
eglDestroyContext(egl_dpy, egl_ctx);
eglDestroySurface(egl_dpy, egl_surf);
eglTerminate(egl_dpy);
XDestroyWindow(x_dpy, win);
XCloseDisplay(x_dpy);
return 0;
}

473
progs/es1/xegl/tri.c Normal file
View File

@@ -0,0 +1,473 @@
/*
* Copyright (C) 2008 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.
*/
/*
* Draw a triangle with X/EGL and OpenGL ES 1.x
* Brian Paul
* 5 June 2008
*/
#define USE_FULL_GL 0
#define USE_FIXED_POINT 0
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#if USE_FULL_GL
#include <GL/gl.h> /* use full OpenGL */
#else
#include <GLES/gl.h> /* use OpenGL ES 1.x */
#include <GLES/glext.h>
#endif
#include <EGL/egl.h>
#define FLOAT_TO_FIXED(X) ((X) * 65535.0)
static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
static void
draw(void)
{
#if USE_FIXED_POINT
static const GLfixed verts[3][2] = {
{ -65536, -65536 },
{ 65536, -65536 },
{ 0, 65536 }
};
static const GLfixed colors[3][4] = {
{ 65536, 0, 0, 65536 },
{ 0, 65536, 0 , 65536},
{ 0, 0, 65536 , 65536}
};
#else
static const GLfloat verts[3][2] = {
{ -1, -1 },
{ 1, -1 },
{ 0, 1 }
};
static const GLfloat colors[3][4] = {
{ 1, 0, 0, 1 },
{ 0, 1, 0, 1 },
{ 0, 0, 1, 1 }
};
#endif
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(view_rotx, 1, 0, 0);
glRotatef(view_roty, 0, 1, 0);
glRotatef(view_rotz, 0, 0, 1);
{
#if USE_FIXED_POINT
glVertexPointer(2, GL_FIXED, 0, verts);
glColorPointer(4, GL_FIXED, 0, colors);
#else
glVertexPointer(2, GL_FLOAT, 0, verts);
glColorPointer(4, GL_FLOAT, 0, colors);
#endif
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
/* draw triangle */
glDrawArrays(GL_TRIANGLES, 0, 3);
/* draw some points */
glPointSizex(FLOAT_TO_FIXED(15.5));
glDrawArrays(GL_POINTS, 0, 3);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
}
if (0) {
/* test code */
GLfixed size;
glGetFixedv(GL_POINT_SIZE, &size);
printf("GL_POINT_SIZE = 0x%x %f\n", size, size / 65536.0);
}
glPopMatrix();
}
/* new window size or exposure */
static void
reshape(int width, int height)
{
GLfloat ar = (GLfloat) width / (GLfloat) height;
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
#ifdef GL_VERSION_ES_CM_1_0
glFrustumf(-ar, ar, -1, 1, 5.0, 60.0);
#else
glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
#endif
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -10.0);
}
static void
test_query_matrix(void)
{
PFNGLQUERYMATRIXXOESPROC procQueryMatrixx;
typedef void (*voidproc)();
GLfixed mantissa[16];
GLint exponent[16];
GLbitfield rv;
int i;
voidproc p = eglGetProcAddress("eglCreateContext");
assert(p);
procQueryMatrixx = (PFNGLQUERYMATRIXXOESPROC) eglGetProcAddress("glQueryMatrixxOES");
assert(procQueryMatrixx);
/* Actually try out this one */
rv = (*procQueryMatrixx)(mantissa, exponent);
for (i = 0; i < 16; i++) {
if (rv & (1<<i)) {
printf("matrix[%d] invalid\n", i);
}
else {
printf("matrix[%d] = %f * 2^(%d)\n", i, mantissa[i]/65536.0, exponent[i]);
}
}
p = eglGetProcAddress("glFoo");
assert(!p);
}
static void
init(void)
{
glClearColor(0.4, 0.4, 0.4, 0.0);
if (0)
test_query_matrix();
}
/*
* Create an RGB, double-buffered X window.
* Return the window and context handles.
*/
static void
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
const char *name,
int x, int y, int width, int height,
Window *winRet,
EGLContext *ctxRet,
EGLSurface *surfRet)
{
static const EGLint attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_DEPTH_SIZE, 1,
EGL_NONE
};
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
XVisualInfo *visInfo, visTemplate;
int num_visuals;
EGLContext ctx;
EGLConfig config;
EGLint num_configs;
EGLint vid;
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
assert(config);
assert(num_configs > 0);
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");
exit(1);
}
/* The X window visual must match the EGL config */
visTemplate.visualid = vid;
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
if (!visInfo) {
printf("Error: couldn't get X visual\n");
exit(1);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
0, visInfo->depth, InputOutput,
visInfo->visual, mask, &attr );
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(x_dpy, win, &sizehints);
XSetStandardProperties(x_dpy, win, name, name,
None, (char **)NULL, 0, &sizehints);
}
#if USE_FULL_GL
eglBindAPI(EGL_OPENGL_API);
#else
eglBindAPI(EGL_OPENGL_ES_API);
#endif
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
if (!ctx) {
printf("Error: eglCreateContext failed\n");
exit(1);
}
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
if (!*surfRet) {
printf("Error: eglCreateWindowSurface failed\n");
exit(1);
}
XFree(visInfo);
*winRet = win;
*ctxRet = ctx;
}
static void
event_loop(Display *dpy, Window win,
EGLDisplay egl_dpy, EGLSurface egl_surf)
{
while (1) {
int redraw = 0;
XEvent event;
XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
redraw = 1;
break;
case ConfigureNotify:
reshape(event.xconfigure.width, event.xconfigure.height);
break;
case KeyPress:
{
char buffer[10];
int r, code;
code = XLookupKeysym(&event.xkey, 0);
if (code == XK_Left) {
view_roty += 5.0;
}
else if (code == XK_Right) {
view_roty -= 5.0;
}
else if (code == XK_Up) {
view_rotx += 5.0;
}
else if (code == XK_Down) {
view_rotx -= 5.0;
}
else {
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == 27) {
/* escape */
return;
}
}
}
redraw = 1;
break;
default:
; /*no-op*/
}
if (redraw) {
draw();
eglSwapBuffers(egl_dpy, egl_surf);
}
}
}
static void
usage(void)
{
printf("Usage:\n");
printf(" -display <displayname> set the display to run on\n");
printf(" -info display OpenGL renderer info\n");
}
int
main(int argc, char *argv[])
{
const int winWidth = 300, winHeight = 300;
Display *x_dpy;
Window win;
EGLSurface egl_surf;
EGLContext egl_ctx;
EGLDisplay egl_dpy;
char *dpyName = NULL;
GLboolean printInfo = GL_FALSE;
EGLint egl_major, egl_minor;
int i;
const char *s;
static struct {
char *name;
GLenum value;
enum {GetString, GetInteger} type;
} info_items[] = {
{"GL_RENDERER", GL_RENDERER, GetString},
{"GL_VERSION", GL_VERSION, GetString},
{"GL_VENDOR", GL_VENDOR, GetString},
{"GL_EXTENSIONS", GL_EXTENSIONS, GetString},
{"GL_MAX_PALETTE_MATRICES_OES", GL_MAX_PALETTE_MATRICES_OES, GetInteger},
{"GL_MAX_VERTEX_UNITS_OES", GL_MAX_VERTEX_UNITS_OES, GetInteger},
};
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
dpyName = argv[i+1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {
printInfo = GL_TRUE;
}
else {
usage();
return -1;
}
}
x_dpy = XOpenDisplay(dpyName);
if (!x_dpy) {
printf("Error: couldn't open display %s\n",
dpyName ? dpyName : getenv("DISPLAY"));
return -1;
}
egl_dpy = eglGetDisplay(x_dpy);
if (!egl_dpy) {
printf("Error: eglGetDisplay() failed\n");
return -1;
}
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n");
return -1;
}
s = eglQueryString(egl_dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s);
s = eglQueryString(egl_dpy, EGL_VENDOR);
printf("EGL_VENDOR = %s\n", s);
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
printf("EGL_EXTENSIONS = %s\n", s);
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
printf("EGL_CLIENT_APIS = %s\n", s);
make_x_window(x_dpy, egl_dpy,
"OpenGL ES 1.x tri", 0, 0, winWidth, winHeight,
&win, &egl_ctx, &egl_surf);
XMapWindow(x_dpy, win);
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
printf("Error: eglMakeCurrent() failed\n");
return -1;
}
if (printInfo) {
for (i = 0; i < sizeof(info_items)/sizeof(info_items[0]); i++) {
switch (info_items[i].type) {
case GetString:
printf("%s = %s\n", info_items[i].name, (char *)glGetString(info_items[i].value));
break;
case GetInteger: {
GLint rv = -1;
glGetIntegerv(info_items[i].value, &rv);
printf("%s = %d\n", info_items[i].name, rv);
break;
}
}
}
};
init();
/* Set initial projection/viewing transformation.
* We can't be sure we'll get a ConfigureNotify event when the window
* first appears.
*/
reshape(winWidth, winHeight);
event_loop(x_dpy, win, egl_dpy, egl_surf);
eglDestroyContext(egl_dpy, egl_ctx);
eglDestroySurface(egl_dpy, egl_surf);
eglTerminate(egl_dpy);
XDestroyWindow(x_dpy, win);
XCloseDisplay(x_dpy);
return 0;
}

433
progs/es1/xegl/two_win.c Normal file
View File

@@ -0,0 +1,433 @@
/*
* Copyright (C) 2008 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.
*/
/*
* Test drawing to two windows.
* Brian Paul
* August 2008
*/
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <EGL/egl.h>
static int WinWidth[2] = {150, 300}, WinHeight[2] = {150, 300};
static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
/* new window size or exposure */
static void
reshape(int width, int height)
{
GLfloat ar = (GLfloat) width / (GLfloat) height;
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
#ifdef GL_VERSION_ES_CM_1_0
glFrustumf(-ar, ar, -1, 1, 5.0, 60.0);
#else
glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
#endif
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -10.0);
}
static void
draw(int win)
{
static const GLfloat verts[3][2] = {
{ -1, -1 },
{ 1, -1 },
{ 0, 1 }
};
static const GLfloat colors[3][4] = {
{ 1, 0, 0, 1 },
{ 0, 1, 0, 1 },
{ 0, 0, 1, 1 }
};
assert(win == 0 || win == 1);
reshape(WinWidth[win], WinHeight[win]);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(view_rotx, 1, 0, 0);
glRotatef(view_roty, 0, 1, 0);
glRotatef(view_rotz, 0, 0, 1);
/* draw triangle */
{
glVertexPointer(2, GL_FLOAT, 0, verts);
glColorPointer(4, GL_FLOAT, 0, colors);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glDrawArrays(GL_TRIANGLES, 0, 3);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
}
glPopMatrix();
}
static void
init(void)
{
glClearColor(0.4, 0.4, 0.4, 0.0);
}
/*
* Create an RGB, double-buffered X window.
* Return the window and context handles.
*/
static void
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
const char *name,
int x, int y, int width, int height,
Window *winRet,
EGLContext *ctxRet,
EGLSurface *surfRet)
{
static const EGLint attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_DEPTH_SIZE, 1,
EGL_NONE
};
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
XVisualInfo *visInfo, visTemplate;
int num_visuals;
EGLContext ctx;
EGLConfig config;
EGLint num_configs;
EGLint vid;
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
assert(config);
assert(num_configs > 0);
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");
exit(1);
}
/* The X window visual must match the EGL config */
visTemplate.visualid = vid;
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
if (!visInfo) {
printf("Error: couldn't get X visual\n");
exit(1);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( x_dpy, root, x, y, width, height,
0, visInfo->depth, InputOutput,
visInfo->visual, mask, &attr );
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(x_dpy, win, &sizehints);
XSetStandardProperties(x_dpy, win, name, name,
None, (char **)NULL, 0, &sizehints);
}
#if USE_FULL_GL
eglBindAPI(EGL_OPENGL_API);
#else
eglBindAPI(EGL_OPENGL_ES_API);
#endif
if (ctxRet) {
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
if (!ctx) {
printf("Error: eglCreateContext failed\n");
exit(1);
}
*ctxRet = ctx;
}
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
if (!*surfRet) {
printf("Error: eglCreateWindowSurface failed\n");
exit(1);
}
XFree(visInfo);
*winRet = win;
}
static void
event_loop(Display *dpy, Window win1, Window win2,
EGLDisplay egl_dpy, EGLSurface egl_surf1, EGLSurface egl_surf2,
EGLContext egl_ctx)
{
while (1) {
int redraw = 0;
int win;
XEvent event;
XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
redraw = 1;
break;
case ConfigureNotify:
if (event.xconfigure.window == win1)
win = 0;
else
win = 1;
WinWidth[win] = event.xconfigure.width;
WinHeight[win] = event.xconfigure.height;
break;
case KeyPress:
{
char buffer[10];
int r, code;
code = XLookupKeysym(&event.xkey, 0);
if (code == XK_Left) {
view_roty += 5.0;
}
else if (code == XK_Right) {
view_roty -= 5.0;
}
else if (code == XK_Up) {
view_rotx += 5.0;
}
else if (code == XK_Down) {
view_rotx -= 5.0;
}
else {
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == 27) {
/* escape */
return;
}
}
}
redraw = 1;
break;
default:
; /*no-op*/
}
if (redraw) {
/* win 1 */
if (!eglMakeCurrent(egl_dpy, egl_surf1, egl_surf1, egl_ctx)) {
printf("Error: eglMakeCurrent(1) failed\n");
return;
}
draw(0);
eglSwapBuffers(egl_dpy, egl_surf1);
/* win 2 */
if (!eglMakeCurrent(egl_dpy, egl_surf2, egl_surf2, egl_ctx)) {
printf("Error: eglMakeCurrent(2) failed\n");
return;
}
draw(1);
eglSwapBuffers(egl_dpy, egl_surf2);
}
}
}
static void
usage(void)
{
printf("Usage:\n");
printf(" -display <displayname> set the display to run on\n");
printf(" -info display OpenGL renderer info\n");
}
int
main(int argc, char *argv[])
{
Display *x_dpy;
Window win1, win2;
EGLSurface egl_surf1, egl_surf2;
EGLContext egl_ctx;
EGLDisplay egl_dpy;
char *dpyName = NULL;
GLboolean printInfo = GL_FALSE;
EGLint egl_major, egl_minor;
int i;
const char *s;
static struct {
char *name;
GLenum value;
enum {GetString, GetInteger} type;
} info_items[] = {
{"GL_RENDERER", GL_RENDERER, GetString},
{"GL_VERSION", GL_VERSION, GetString},
{"GL_VENDOR", GL_VENDOR, GetString},
{"GL_EXTENSIONS", GL_EXTENSIONS, GetString},
{"GL_MAX_PALETTE_MATRICES_OES", GL_MAX_PALETTE_MATRICES_OES, GetInteger},
{"GL_MAX_VERTEX_UNITS_OES", GL_MAX_VERTEX_UNITS_OES, GetInteger},
};
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
dpyName = argv[i+1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {
printInfo = GL_TRUE;
}
else {
usage();
return -1;
}
}
x_dpy = XOpenDisplay(dpyName);
if (!x_dpy) {
printf("Error: couldn't open display %s\n",
dpyName ? dpyName : getenv("DISPLAY"));
return -1;
}
egl_dpy = eglGetDisplay(x_dpy);
if (!egl_dpy) {
printf("Error: eglGetDisplay() failed\n");
return -1;
}
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n");
return -1;
}
s = eglQueryString(egl_dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s);
s = eglQueryString(egl_dpy, EGL_VENDOR);
printf("EGL_VENDOR = %s\n", s);
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
printf("EGL_EXTENSIONS = %s\n", s);
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
printf("EGL_CLIENT_APIS = %s\n", s);
make_x_window(x_dpy, egl_dpy,
"xegl_two_win #1", 0, 0, WinWidth[0], WinHeight[0],
&win1, &egl_ctx, &egl_surf1);
make_x_window(x_dpy, egl_dpy,
"xegl_two_win #2", WinWidth[0] + 50, 0,
WinWidth[1], WinHeight[1],
&win2, NULL, &egl_surf2);
XMapWindow(x_dpy, win1);
XMapWindow(x_dpy, win2);
if (!eglMakeCurrent(egl_dpy, egl_surf1, egl_surf1, egl_ctx)) {
printf("Error: eglMakeCurrent() failed\n");
return -1;
}
if (printInfo) {
for (i = 0; i < sizeof(info_items)/sizeof(info_items[0]); i++) {
switch (info_items[i].type) {
case GetString:
printf("%s = %s\n", info_items[i].name, (char *)glGetString(info_items[i].value));
break;
case GetInteger: {
GLint rv = -1;
glGetIntegerv(info_items[i].value, &rv);
printf("%s = %d\n", info_items[i].name, rv);
break;
}
}
}
};
init();
event_loop(x_dpy, win1, win2, egl_dpy, egl_surf1, egl_surf2, egl_ctx);
eglDestroyContext(egl_dpy, egl_ctx);
eglDestroySurface(egl_dpy, egl_surf1);
eglDestroySurface(egl_dpy, egl_surf2);
eglTerminate(egl_dpy);
XDestroyWindow(x_dpy, win1);
XDestroyWindow(x_dpy, win2);
XCloseDisplay(x_dpy);
return 0;
}

51
progs/es2/xegl/Makefile Normal file
View File

@@ -0,0 +1,51 @@
# progs/es2/xegl/Makefile
TOP = ../../..
include $(TOP)/configs/current
INCLUDE_DIRS = \
-I$(TOP)/include \
HEADERS = $(TOP)/include/GLES/egl.h
ES2_LIB_DEPS = \
$(TOP)/$(LIB_DIR)/libEGL.so \
$(TOP)/$(LIB_DIR)/libGLESv2.so
ES2_LIBS = \
-L$(TOP)/$(LIB_DIR) -lEGL \
-L$(TOP)/$(LIB_DIR) -lGLESv2 $(LIBDRM_LIB) -lX11
PROGRAMS = \
es2_info \
tri
.c.o:
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
default: $(PROGRAMS)
es2_info.c:
cp ../../es1/xegl/es1_info.c es2_info.c
es2_info: es2_info.o $(ES2_LIB_DEPS)
$(CC) $(CFLAGS) es2_info.o $(ES2_LIBS) -o $@
tri: tri.o $(ES2_LIB_DEPS)
$(CC) $(CFLAGS) tri.o $(ES2_LIBS) -o $@
clean:
rm -f *.o *~
rm -f $(PROGRAMS)
rm -f es2_info.c

516
progs/es2/xegl/tri.c Normal file
View File

@@ -0,0 +1,516 @@
/**************************************************************************
*
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
**************************************************************************/
/*
* Draw a triangle with X/EGL and OpenGL ES 2.x
*/
#define USE_FULL_GL 0
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#if USE_FULL_GL
#include <GL/gl.h> /* use full OpenGL */
#else
#include <GLES2/gl2.h> /* use OpenGL ES 2.x */
#endif
#include <EGL/egl.h>
#define FLOAT_TO_FIXED(X) ((X) * 65535.0)
static GLfloat view_rotx = 0.0, view_roty = 0.0;
static GLint u_matrix = -1;
static GLint attr_pos = 0, attr_color = 1;
static void
make_z_rot_matrix(GLfloat angle, GLfloat *m)
{
float c = cos(angle * M_PI / 180.0);
float s = sin(angle * M_PI / 180.0);
int i;
for (i = 0; i < 16; i++)
m[i] = 0.0;
m[0] = m[5] = m[10] = m[15] = 1.0;
m[0] = c;
m[1] = s;
m[4] = -s;
m[5] = c;
}
static void
make_scale_matrix(GLfloat xs, GLfloat ys, GLfloat zs, GLfloat *m)
{
int i;
for (i = 0; i < 16; i++)
m[i] = 0.0;
m[0] = xs;
m[5] = ys;
m[10] = zs;
m[15] = 1.0;
}
static void
mul_matrix(GLfloat *prod, const GLfloat *a, const GLfloat *b)
{
#define A(row,col) a[(col<<2)+row]
#define B(row,col) b[(col<<2)+row]
#define P(row,col) p[(col<<2)+row]
GLfloat p[16];
GLint i;
for (i = 0; i < 4; i++) {
const GLfloat ai0=A(i,0), ai1=A(i,1), ai2=A(i,2), ai3=A(i,3);
P(i,0) = ai0 * B(0,0) + ai1 * B(1,0) + ai2 * B(2,0) + ai3 * B(3,0);
P(i,1) = ai0 * B(0,1) + ai1 * B(1,1) + ai2 * B(2,1) + ai3 * B(3,1);
P(i,2) = ai0 * B(0,2) + ai1 * B(1,2) + ai2 * B(2,2) + ai3 * B(3,2);
P(i,3) = ai0 * B(0,3) + ai1 * B(1,3) + ai2 * B(2,3) + ai3 * B(3,3);
}
memcpy(prod, p, sizeof(p));
#undef A
#undef B
#undef PROD
}
static void
draw(void)
{
static const GLfloat verts[3][2] = {
{ -1, -1 },
{ 1, -1 },
{ 0, 1 }
};
static const GLfloat colors[3][3] = {
{ 1, 0, 0 },
{ 0, 1, 0 },
{ 0, 0, 1 }
};
GLfloat mat[16], rot[16], scale[16];
/* Set modelview/projection matrix */
make_z_rot_matrix(view_rotx, rot);
make_scale_matrix(0.5, 0.5, 0.5, scale);
mul_matrix(mat, rot, scale);
glUniformMatrix4fv(u_matrix, 1, GL_FALSE, mat);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
{
glVertexAttribPointer(attr_pos, 2, GL_FLOAT, GL_FALSE, 0, verts);
glVertexAttribPointer(attr_color, 3, GL_FLOAT, GL_FALSE, 0, colors);
glEnableVertexAttribArray(attr_pos);
glEnableVertexAttribArray(attr_color);
glDrawArrays(GL_TRIANGLES, 0, 3);
glDisableVertexAttribArray(attr_pos);
glDisableVertexAttribArray(attr_color);
}
}
/* new window size or exposure */
static void
reshape(int width, int height)
{
glViewport(0, 0, (GLint) width, (GLint) height);
}
static void
create_shaders(void)
{
static const char *fragShaderText =
"varying vec4 v_color;\n"
"void main() {\n"
" gl_FragColor = v_color;\n"
"}\n";
static const char *vertShaderText =
"uniform mat4 modelviewProjection;\n"
"attribute vec4 pos;\n"
"attribute vec4 color;\n"
"varying vec4 v_color;\n"
"void main() {\n"
" gl_Position = modelviewProjection * pos;\n"
" v_color = color;\n"
"}\n";
GLuint fragShader, vertShader, program;
GLint stat;
fragShader = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(fragShader, 1, (const char **) &fragShaderText, NULL);
glCompileShader(fragShader);
glGetShaderiv(fragShader, GL_COMPILE_STATUS, &stat);
if (!stat) {
printf("Error: fragment shader did not compile!\n");
exit(1);
}
vertShader = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(vertShader, 1, (const char **) &vertShaderText, NULL);
glCompileShader(vertShader);
glGetShaderiv(vertShader, GL_COMPILE_STATUS, &stat);
if (!stat) {
printf("Error: vertex shader did not compile!\n");
exit(1);
}
program = glCreateProgram();
glAttachShader(program, fragShader);
glAttachShader(program, vertShader);
glLinkProgram(program);
glGetProgramiv(program, GL_LINK_STATUS, &stat);
if (!stat) {
char log[1000];
GLsizei len;
glGetProgramInfoLog(program, 1000, &len, log);
printf("Error: linking:\n%s\n", log);
exit(1);
}
glUseProgram(program);
if (1) {
/* test setting attrib locations */
glBindAttribLocation(program, attr_pos, "pos");
glBindAttribLocation(program, attr_color, "color");
glLinkProgram(program); /* needed to put attribs into effect */
}
else {
/* test automatic attrib locations */
attr_pos = glGetAttribLocation(program, "pos");
attr_color = glGetAttribLocation(program, "color");
}
u_matrix = glGetUniformLocation(program, "modelviewProjection");
printf("Uniform modelviewProjection at %d\n", u_matrix);
printf("Attrib pos at %d\n", attr_pos);
printf("Attrib color at %d\n", attr_color);
}
static void
init(void)
{
typedef void (*proc)();
#if 1 /* test code */
proc p = eglGetProcAddress("eglCreateContext");
assert(p);
p = eglGetProcAddress("glMapBufferOES");
assert(p);
#endif
glClearColor(0.4, 0.4, 0.4, 0.0);
create_shaders();
}
/*
* Create an RGB, double-buffered X window.
* Return the window and context handles.
*/
static void
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
const char *name,
int x, int y, int width, int height,
Window *winRet,
EGLContext *ctxRet,
EGLSurface *surfRet)
{
static const EGLint attribs[] = {
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_DEPTH_SIZE, 1,
EGL_NONE
};
static const EGLint ctx_attribs[] = {
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
Window win;
XVisualInfo *visInfo, visTemplate;
int num_visuals;
EGLContext ctx;
EGLConfig config;
EGLint num_configs;
EGLint vid;
scrnum = DefaultScreen( x_dpy );
root = RootWindow( x_dpy, scrnum );
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n");
exit(1);
}
assert(config);
assert(num_configs > 0);
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
printf("Error: eglGetConfigAttrib() failed\n");
exit(1);
}
/* The X window visual must match the EGL config */
visTemplate.visualid = vid;
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
if (!visInfo) {
printf("Error: couldn't get X visual\n");
exit(1);
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
0, visInfo->depth, InputOutput,
visInfo->visual, mask, &attr );
/* set hints and properties */
{
XSizeHints sizehints;
sizehints.x = x;
sizehints.y = y;
sizehints.width = width;
sizehints.height = height;
sizehints.flags = USSize | USPosition;
XSetNormalHints(x_dpy, win, &sizehints);
XSetStandardProperties(x_dpy, win, name, name,
None, (char **)NULL, 0, &sizehints);
}
#if USE_FULL_GL /* XXX fix this when eglBindAPI() works */
eglBindAPI(EGL_OPENGL_API);
#else
eglBindAPI(EGL_OPENGL_ES_API);
#endif
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, ctx_attribs );
if (!ctx) {
printf("Error: eglCreateContext failed\n");
exit(1);
}
/* test eglQueryContext() */
{
EGLint val;
eglQueryContext(egl_dpy, ctx, EGL_CONTEXT_CLIENT_VERSION, &val);
assert(val == 2);
}
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
if (!*surfRet) {
printf("Error: eglCreateWindowSurface failed\n");
exit(1);
}
{
EGLint val;
eglQuerySurface(egl_dpy, *surfRet, EGL_WIDTH, &val);
assert(val == width);
eglQuerySurface(egl_dpy, *surfRet, EGL_HEIGHT, &val);
assert(val == height);
eglQuerySurface(egl_dpy, *surfRet, EGL_SURFACE_TYPE, &val);
assert(val == EGL_WINDOW_BIT);
}
XFree(visInfo);
*winRet = win;
*ctxRet = ctx;
}
static void
event_loop(Display *dpy, Window win,
EGLDisplay egl_dpy, EGLSurface egl_surf)
{
while (1) {
int redraw = 0;
XEvent event;
XNextEvent(dpy, &event);
switch (event.type) {
case Expose:
redraw = 1;
break;
case ConfigureNotify:
reshape(event.xconfigure.width, event.xconfigure.height);
break;
case KeyPress:
{
char buffer[10];
int r, code;
code = XLookupKeysym(&event.xkey, 0);
if (code == XK_Left) {
view_roty += 5.0;
}
else if (code == XK_Right) {
view_roty -= 5.0;
}
else if (code == XK_Up) {
view_rotx += 5.0;
}
else if (code == XK_Down) {
view_rotx -= 5.0;
}
else {
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
NULL, NULL);
if (buffer[0] == 27) {
/* escape */
return;
}
}
}
redraw = 1;
break;
default:
; /*no-op*/
}
if (redraw) {
draw();
eglSwapBuffers(egl_dpy, egl_surf);
}
}
}
static void
usage(void)
{
printf("Usage:\n");
printf(" -display <displayname> set the display to run on\n");
printf(" -info display OpenGL renderer info\n");
}
int
main(int argc, char *argv[])
{
const int winWidth = 300, winHeight = 300;
Display *x_dpy;
Window win;
EGLSurface egl_surf;
EGLContext egl_ctx;
EGLDisplay egl_dpy;
char *dpyName = NULL;
GLboolean printInfo = GL_FALSE;
EGLint egl_major, egl_minor;
int i;
const char *s;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-display") == 0) {
dpyName = argv[i+1];
i++;
}
else if (strcmp(argv[i], "-info") == 0) {
printInfo = GL_TRUE;
}
else {
usage();
return -1;
}
}
x_dpy = XOpenDisplay(dpyName);
if (!x_dpy) {
printf("Error: couldn't open display %s\n",
dpyName ? dpyName : getenv("DISPLAY"));
return -1;
}
egl_dpy = eglGetDisplay(x_dpy);
if (!egl_dpy) {
printf("Error: eglGetDisplay() failed\n");
return -1;
}
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n");
return -1;
}
s = eglQueryString(egl_dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s);
s = eglQueryString(egl_dpy, EGL_VENDOR);
printf("EGL_VENDOR = %s\n", s);
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
printf("EGL_EXTENSIONS = %s\n", s);
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
printf("EGL_CLIENT_APIS = %s\n", s);
make_x_window(x_dpy, egl_dpy,
"OpenGL ES 2.x tri", 0, 0, winWidth, winHeight,
&win, &egl_ctx, &egl_surf);
XMapWindow(x_dpy, win);
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
printf("Error: eglMakeCurrent() failed\n");
return -1;
}
if (printInfo) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
}
init();
/* Set initial projection/viewing transformation.
* We can't be sure we'll get a ConfigureNotify event when the window
* first appears.
*/
reshape(winWidth, winHeight);
event_loop(x_dpy, win, egl_dpy, egl_surf);
eglDestroyContext(egl_dpy, egl_ctx);
eglDestroySurface(egl_dpy, egl_surf);
eglTerminate(egl_dpy);
XDestroyWindow(x_dpy, win);
XCloseDisplay(x_dpy);
return 0;
}

1
src/Android.mk Normal file
View File

@@ -0,0 +1 @@
include $(call all-subdir-makefiles)

41
src/egl/Android.mk Normal file
View File

@@ -0,0 +1,41 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
main/eglapi.c \
main/eglclient.c \
main/eglconfig.c \
main/eglconfigutil.c \
main/eglcontext.c \
main/eglcurrent.c \
main/egldisplay.c \
main/egldriver.c \
main/eglglobals.c \
main/eglimage.c \
main/egllog.c \
main/eglmisc.c \
main/eglmode.c \
main/eglscreen.c \
main/eglstring.c \
main/eglsurface.c
LOCAL_SRC_FILES += \
drivers/android/egl_android.c \
drivers/android/droid_loader.c \
drivers/android/droid_ui.cpp \
drivers/android/droid_intel.c
LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/main \
external/mesa/include \
external/mesa/src/mesa \
external/drm/shared-core
LOCAL_CFLAGS += -DPTHREADS
LOCAL_SHARED_LIBRARIES := libdl libui libutils
LOCAL_STATIC_LIBRARIES := libes1api
LOCAL_MODULE := libhgl
include $(BUILD_SHARED_LIBRARY)

View File

@@ -0,0 +1,136 @@
/*
* Copyright (C) 2009 Chia-I Wu <olvaffe@gmail.com>
*
* This is based on the work of eagle, by
* Copyright © 2008, 2009 Kristian Høgsberg
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to 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 _DROID_H_
#define _DROID_H_
#include "GL/gl.h"
#include "GL/internal/dri_interface.h"
#include "eglcurrent.h"
#include "egldisplay.h"
#include "eglcontext.h"
#include "eglsurface.h"
#include "eglconfig.h"
/* opaque types */
struct droid_loader;
struct droid_context;
struct droid_drawable;
struct droid_image;
struct droid_surface;
struct droid_backend {
/* these are usually used by a loader */
const char *driver_name;
int (*initialize)(struct droid_backend *backend, int *fd, int *screen_number);
int (*process_config)(struct droid_backend *backend, _EGLConfig *conf);
void (*destroy)(struct droid_backend *backend);
__DRIbuffer *(*get_native_buffer)(struct droid_backend *backend,
struct droid_surface *surf,
int *width, int *height);
__DRIbuffer *(*get_surface_buffers)(struct droid_backend *backend,
struct droid_surface *surf,
int *width, int *height,
unsigned int *attachments, int count,
int *out_count, int has_format);
/* public methods */
struct droid_surface *(*create_window_surface)(struct droid_backend *backend,
_EGLSurface *surf,
NativeWindowType win);
struct droid_surface *(*create_image_surface)(struct droid_backend *backend,
NativePixmapType pix);
void (*destroy_surface)(struct droid_backend *backend, struct droid_surface *surf);
void (*swap_native_buffers)(struct droid_backend *backend,
struct droid_surface *surf);
int (*match_pixmap)(struct droid_backend *backend, _EGLConfig *conf,
NativePixmapType pix);
};
struct droid_screen {
struct droid_loader *loader;
__DRIscreen *dri_screen;
__DRItexBufferExtension *tex_buffer;
__DRIcopyBufferExtension *copy_buffer;
const __DRIconfig **dri_configs;
int num_dri_configs;
};
struct droid_backend *
droid_backend_create_intel(const char *dev);
void
droid_backend_destroy(struct droid_backend *backend);
struct droid_screen *
droid_screen_create(struct droid_backend *backend);
void
droid_screen_destroy(struct droid_screen *screen);
int
droid_screen_convert_config(struct droid_screen *screen,
const __DRIconfig *conf, _EGLConfig *egl_conf);
struct droid_context *
droid_screen_create_context(struct droid_screen *screen,
const __DRIconfig *conf,
struct droid_context *shared);
void
droid_screen_destroy_context(struct droid_screen *screen,
struct droid_context *ctx);
struct droid_drawable *
droid_screen_create_drawable(struct droid_screen *screen,
const __DRIconfig *conf,
struct droid_surface *surf);
void *
droid_screen_get_drawable_data(struct droid_screen *screen,
struct droid_drawable *drawable);
void
droid_screen_destroy_drawable(struct droid_screen *screen,
struct droid_drawable *drawable);
int
droid_screen_bind_context(struct droid_screen *screen,
struct droid_drawable *draw,
struct droid_drawable *read,
struct droid_context *ctx);
int
droid_screen_swap_buffers(struct droid_screen *screen,
struct droid_context *ctx,
struct droid_drawable *drawable);
#endif /* _DROID_H_ */

View File

@@ -0,0 +1,648 @@
/*
* Copyright (C) 2009 Chia-I Wu <olvaffe@gmail.com>
*
* This is based on the work of eagle, by
* Copyright © 2008, 2009 Kristian Høgsberg
*
* 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.
*/
#define LOG_TAG "DROID-INTEL"
#include <utils/Log.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <i915_drm.h>
#include <GL/gl.h> /* dri_interface.h uses some GL integer types... */
#include <GL/internal/dri_interface.h>
#include <EGL/egl.h>
#include "droid.h"
#include "droid_ui.h"
#define INTEL_IS_I965(x) ((x) & INTEL_GEN_4)
#define INTEL_IS_I915(x) ((x) & INTEL_GEN_3)
#define INTEL_IS_I9xx(x) ((x) & (INTEL_GEN_3 | INTEL_GEN_4))
#define INTEL_IS_I8xx(x) ((x) & (INTEL_GEN_1 | INTEL_GEN_2))
#define INTEL_HAS_128_BYTE_Y_TILING(x) \
(((x) & (INTEL_GEN_3 | INTEL_GEN_4 | INTEL_GEN_MINOR_MASK)) > INTEL_GEN_3)
enum {
INTEL_SURFACE_TYPE_WINDOW,
INTEL_SURFACE_TYPE_IMAGE,
};
/* Look at xf86-video-intel/src/common.h for the full horror of device
* identification.
*/
enum {
INTEL_GEN_1 = 0x10,
INTEL_GEN_2 = 0x20,
INTEL_GEN_3 = 0x40,
INTEL_GEN_31 = 0x41,
INTEL_GEN_4 = 0x80,
INTEL_GEN_MAJOR_MASK = 0xf0,
INTEL_GEN_MINOR_MASK = 0x0f,
};
struct droid_backend_intel {
struct droid_backend base;
int fd;
int screen_number;
uint32_t generation;
int pitch_align;
int enable_tiling;
};
struct droid_surface_intel {
int type;
union {
NativeWindowType win;
NativePixmapType pix;
} native;
__DRIbuffer native_buffer;
unsigned int native_width, native_height;
int native_changed;
unsigned int attachments[20];
__DRIbuffer buffers[10];
uint32_t handles[10];
int num_buffers;
int depth_idx;
_EGLSurface *surf;
};
static INLINE struct droid_backend_intel *
lookup_backend(struct droid_backend *backend)
{
return (struct droid_backend_intel *) backend;
}
static INLINE struct droid_surface_intel *
lookup_surface(struct droid_surface *surface)
{
return (struct droid_surface_intel *) surface;
}
static __DRIbuffer *
intel_get_native_buffer(struct droid_backend *backend,
struct droid_surface *surf,
int *width, int *height)
{
struct droid_surface_intel *isurf = lookup_surface(surf);
/* non-window surface is single-buffered */
if (isurf->type != INTEL_SURFACE_TYPE_WINDOW)
return NULL;
if (!isurf->native_buffer.name)
return NULL;
if (width)
*width = isurf->native_width;
if (height)
*height = isurf->native_height;
return &isurf->native_buffer;
}
static INLINE uint32_t
align_to(uint32_t value, uint32_t align)
{
return (value + align - 1) & ~(align - 1);
}
static INLINE int
fence_pitch(struct droid_backend *backend, int pitch, int tiling)
{
struct droid_backend_intel *intel = lookup_backend(backend);
int pitch_align, tile_width;
switch (tiling) {
case I915_TILING_NONE:
default:
pitch_align = intel->pitch_align;
tile_width = 1; /* not used */
break;
case I915_TILING_X:
pitch_align = 512;
tile_width = 512;
break;
case I915_TILING_Y:
pitch_align = 512;
tile_width =
(INTEL_HAS_128_BYTE_Y_TILING(intel->generation)) ? 128 : 512;
break;
}
pitch = align_to(pitch, pitch_align);
if (tiling == I915_TILING_NONE)
return pitch;
/* 965+ just needs multiples of tile width */
if (INTEL_IS_I965(intel->generation)) {
pitch = align_to(pitch, tile_width);
}
else {
/* Pre-965 needs power of two tile widths */
while (tile_width < pitch)
tile_width <<= 1;
pitch = tile_width;
}
return pitch;
}
static INLINE uint32_t
fence_size(struct droid_backend *backend, int height, int pitch, int tiling)
{
struct droid_backend_intel *intel = lookup_backend(backend);
int height_align;
uint32_t size;
switch (tiling) {
case I915_TILING_NONE:
default:
/* Round the height up so that the GPU's access to a 2x2 aligned
* subspan doesn't address an invalid page offset beyond the
* end of the GTT.
*/
height_align = 2;
break;
case I915_TILING_X:
height_align = 8;
break;
case I915_TILING_Y:
height_align = 32;
break;
}
height = align_to(height, height_align);
size = pitch * height;
if (tiling == I915_TILING_NONE)
return size;
/* The 965 can have fences at any page boundary. */
if (INTEL_IS_I965(intel->generation)) {
size = align_to(size, 4096);
}
else {
uint32_t fence;
/* Align the size to a power of two greater than the smallest fence. */
if (INTEL_IS_I9xx(intel->generation))
fence = 1 << 20; /* 1 MiB */
else
fence = 1 << 19; /* 512 KiB */
while (fence < size)
fence <<= 1;
size = fence;
}
return size;
}
static int
create_buffer(struct droid_backend *backend, __DRIbuffer *buffer,
int width, int height, int cpp, int tiling)
{
struct droid_backend_intel *intel = lookup_backend(backend);
struct drm_i915_gem_create create;
struct drm_gem_flink flink;
buffer->pitch = fence_pitch(backend, width * cpp, tiling);
create.size = fence_size(backend, height, buffer->pitch, tiling);
if (ioctl(intel->fd, DRM_IOCTL_I915_GEM_CREATE, &create)) {
LOGE("failed to create buffer");
return 0;
}
if (tiling != I915_TILING_NONE) {
struct drm_i915_gem_set_tiling set_tiling;
memset(&set_tiling, 0, sizeof(set_tiling));
set_tiling.handle = create.handle;
set_tiling.tiling_mode = tiling;
set_tiling.stride = buffer->pitch;
if (ioctl(intel->fd, DRM_IOCTL_I915_GEM_SET_TILING, &set_tiling))
LOGW("failed to enable tiling");
}
flink.handle = create.handle;
if (ioctl(intel->fd, DRM_IOCTL_GEM_FLINK, &flink) < 0) {
LOGE("failed to flink buffer");
return 0;
}
buffer->name = flink.name;
buffer->cpp = cpp;
buffer->flags = 0;
return create.handle;
}
static void
delete_buffers(struct droid_backend *backend, struct droid_surface *surf)
{
struct droid_backend_intel *intel = lookup_backend(backend);
struct droid_surface_intel *isurf = lookup_surface(surf);
int i;
for (i = 0; i < isurf->num_buffers; i++) {
if (isurf->handles[i]) {
struct drm_gem_close close;
close.handle = isurf->handles[i];
if (ioctl(intel->fd, DRM_IOCTL_GEM_CLOSE, &close) < 0)
LOGE("failed to close bo %d", close.handle);
isurf->handles[i] = 0;
}
}
isurf->num_buffers = 0;
}
static __DRIbuffer *
intel_get_surface_buffers(struct droid_backend *backend,
struct droid_surface *surf,
int *width, int *height,
unsigned int *attachments, int count,
int *out_count, int has_format)
{
struct droid_backend_intel *intel = lookup_backend(backend);
struct droid_surface_intel *isurf = lookup_surface(surf);
unsigned int att_size;
__DRIbuffer buffers[10];
uint32_t handles[10];
int num = 0;
if (count > 10) {
LOGW("too many buffers requested");
count = 10;
}
att_size = sizeof(attachments[0]) * count * ((has_format) ? 2 : 1);
if (isurf->native_changed) {
delete_buffers(backend, surf);
isurf->native_changed = 0;
}
/* same buffers requested */
if (isurf->num_buffers == count &&
memcmp(isurf->attachments, attachments, att_size) == 0) {
num = isurf->num_buffers;
goto end;
}
memcpy(isurf->attachments, attachments, att_size);
while (count-- > 0) {
unsigned int att = *attachments++;
unsigned int format = (has_format) ? *attachments++ : 0;
unsigned int cpp = (format) ? format / 8 : isurf->native_buffer.cpp;
__DRIbuffer *buf = NULL;
int reuse;
/* re-use buffer */
for (reuse = 0; reuse < isurf->num_buffers; reuse++) {
if (isurf->buffers[reuse].attachment == att) {
if (isurf->buffers[reuse].cpp == cpp &&
isurf->handles[reuse])
buf = &isurf->buffers[reuse];
break;
}
}
if (0)
LOGD("%s buffer %d: att %d cpp %d",
(buf) ? "reuse" : "create", num, att, cpp);
if (buf) {
buffers[num] = isurf->buffers[reuse];
handles[num] = isurf->handles[reuse];
isurf->handles[reuse] = 0;
}
else {
int tiling =
(intel->enable_tiling) ? I915_TILING_X : I915_TILING_NONE;
buffers[num].attachment = att;
if (isurf->type == INTEL_SURFACE_TYPE_IMAGE &&
att == __DRI_BUFFER_FRONT_LEFT) {
/* return native buffer */
buffers[num] = isurf->native_buffer;
buffers[num].attachment = att;
handles[num] = 0;
} else {
buffers[num].attachment = att;
handles[num] = create_buffer(backend, &buffers[num],
isurf->native_width,
isurf->native_height,
cpp,
tiling);
}
}
num++;
}
/* delete old buffers that are not re-used */
delete_buffers(backend, surf);
memcpy(isurf->buffers, buffers, sizeof(buffers[0]) * num);
memcpy(isurf->handles, handles, sizeof(handles[0]) * num);
isurf->num_buffers = num;
end:
*out_count = num;
*width = isurf->native_width;
*height = isurf->native_height;
return isurf->buffers;
}
static void
update_native_buffer(struct droid_surface *surf)
{
struct droid_surface_intel *isurf = lookup_surface(surf);
__DRIbuffer *buf = &isurf->native_buffer;
unsigned int name, cpp, pitch, width, height;
switch (isurf->type) {
case INTEL_SURFACE_TYPE_WINDOW:
/* oem[0] always point to the buffer that a client is drawing to */
name = isurf->native.win->oem[0];
cpp = ui_bytes_per_pixel(isurf->native.win->format);
pitch = isurf->native.win->stride * cpp;
width = isurf->native.win->width;
height = isurf->native.win->height;
break;
case INTEL_SURFACE_TYPE_IMAGE:
name = isurf->native.pix->reserved;
cpp = ui_bytes_per_pixel(isurf->native.pix->format);
pitch = isurf->native.pix->stride * cpp;
width = isurf->native.pix->width;
height = isurf->native.pix->height;
break;
default:
name = cpp = pitch = width = height = 0;
break;
}
if (buf->name != name || buf->cpp != cpp || buf->pitch != pitch ||
isurf->native_width != width || isurf->native_height != height) {
buf->attachment = __DRI_BUFFER_FRONT_LEFT;
buf->name = name;
buf->cpp = cpp;
buf->pitch = pitch;
buf->flags = 0;
isurf->native_width = width;
isurf->native_height = height;
isurf->native_changed = 1;
}
}
static struct droid_surface *
intel_create_window_surface(struct droid_backend *backend,
_EGLSurface *surf,
NativeWindowType win)
{
struct droid_surface_intel *isurf;
if (!win) {
LOGE("invalid native window");
_eglError(EGL_BAD_NATIVE_WINDOW, "eglCreateWindowSurface");
return NULL;
}
/* TODO lift this limitation */
if (!win->oem[0]) {
LOGE("TODO support for non-gem based window");
_eglError(EGL_BAD_NATIVE_WINDOW, "eglCreateWindowSurface");
return NULL;
}
isurf = calloc(1, sizeof(*isurf));
if (!isurf) {
_eglError(EGL_BAD_ALLOC, "eglCreateWindowSurface");
return NULL;
}
isurf->type = INTEL_SURFACE_TYPE_WINDOW;
isurf->native.win = win;
surf->Width = win->width;
surf->Height = win->height;
/* always back buffer */
surf->RenderBuffer = EGL_BACK_BUFFER;
isurf->surf = surf;
update_native_buffer((struct droid_surface *) isurf);
return (struct droid_surface *) isurf;
}
static struct droid_surface *
intel_create_image_surface(struct droid_backend *backend,
NativePixmapType pix)
{
struct droid_surface_intel *isurf;
int cpp;
if (!pix) {
LOGE("invalid native pixmap");
_eglError(EGL_BAD_NATIVE_PIXMAP, "eglCreateImage");
return NULL;
}
/* TODO lift this limitation */
if (!pix->reserved) {
LOGE("TODO support for non-gem based pixmap");
_eglError(EGL_BAD_NATIVE_PIXMAP, "eglCreateImage");
return NULL;
}
isurf = calloc(1, sizeof(*isurf));
if (!isurf) {
_eglError(EGL_BAD_ALLOC, "eglCreateWindowSurface");
return NULL;
}
isurf->type = INTEL_SURFACE_TYPE_IMAGE;
isurf->native.pix = pix;
update_native_buffer((struct droid_surface *) isurf);
return (struct droid_surface *) isurf;
}
static void
intel_destroy_surface(struct droid_backend *backend, struct droid_surface *surf)
{
struct droid_surface_intel *isurf = lookup_surface(surf);
delete_buffers(backend, surf);
free(isurf);
}
static void
intel_swap_native_buffers(struct droid_backend *backend,
struct droid_surface *surf)
{
struct droid_surface_intel *isurf = lookup_surface(surf);
if (isurf->type == INTEL_SURFACE_TYPE_WINDOW) {
uint32_t flags;
flags = isurf->native.win->swapBuffers(isurf->native.win);
if (flags & EGL_NATIVES_FLAG_SIZE_CHANGED) {
update_native_buffer(surf);
} else {
/* oem[0] is changed after buffer swap */
isurf->native_buffer.name = isurf->native.win->oem[0];
}
}
}
static int
intel_match_pixmap(struct droid_backend *backend, _EGLConfig *conf,
NativePixmapType pix)
{
int val;
val = GET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_TYPE);
/* match the visual type */
return (pix->format == val);
}
static int
intel_initialize(struct droid_backend *backend, int *fd, int *screen_number)
{
struct droid_backend_intel *intel = lookup_backend(backend);
drm_auth_t auth;
int err;
err = ioctl(intel->fd, DRM_IOCTL_GET_MAGIC, &auth);
if (!err)
err = ui_auth_gpu(auth.magic);
if (err) {
LOGE("failed to authenticate");
return 0;
}
if (fd)
*fd = intel->fd;
if (screen_number)
*screen_number = intel->screen_number;
return 1;
}
#include <assert.h>
static int
intel_process_config(struct droid_backend *backend, _EGLConfig *conf)
{
int r, g, b, a;
int surface_type;
int format;
r = GET_CONFIG_ATTRIB(conf, EGL_RED_SIZE);
g = GET_CONFIG_ATTRIB(conf, EGL_GREEN_SIZE);
b = GET_CONFIG_ATTRIB(conf, EGL_BLUE_SIZE);
a = GET_CONFIG_ATTRIB(conf, EGL_ALPHA_SIZE);
format = ui_get_rgb_format(r, g, b, a);
if (format) {
SET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_TYPE, format);
SET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE,
EGL_WINDOW_BIT |
EGL_PIXMAP_BIT |
EGL_PBUFFER_BIT);
}
else {
SET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE, EGL_PBUFFER_BIT);
}
return 1;
}
static void
intel_destroy(struct droid_backend *backend)
{
struct droid_backend_intel *intel = lookup_backend(backend);
close(intel->fd);
free(intel);
}
struct droid_backend *
droid_backend_create_intel(const char *dev)
{
struct droid_backend_intel *intel;
intel = calloc(1, sizeof(*intel));
if (!intel)
return NULL;
intel->fd = open(dev, O_RDWR);
if (intel->fd < 0) {
LOGE("failed to open %s", dev);
free(intel);
return NULL;
}
intel->screen_number = 0;
/* XXX query using I915_GETPARAM + PARAM_CHIPSET_ID */
intel->generation = INTEL_GEN_3;
intel->pitch_align = 64;
intel->enable_tiling = 1;
intel->base.driver_name = "i915";
intel->base.initialize = intel_initialize;
intel->base.process_config = intel_process_config;
intel->base.destroy = intel_destroy;
intel->base.get_native_buffer = intel_get_native_buffer;
intel->base.get_surface_buffers = intel_get_surface_buffers;
intel->base.create_window_surface = intel_create_window_surface;
intel->base.create_image_surface = intel_create_image_surface;
intel->base.destroy_surface = intel_destroy_surface;
intel->base.swap_native_buffers = intel_swap_native_buffers;
intel->base.match_pixmap = intel_match_pixmap;
return &intel->base;
}

View File

@@ -0,0 +1,509 @@
/*
* Copyright (C) 2009 Chia-I Wu <olvaffe@gmail.com>
*
* This is based on the work of eagle, by
* Copyright © 2008, 2009 Kristian Høgsberg
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to 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.
*/
#define LOG_TAG "DROID-LOADER"
#include <utils/Log.h>
#include <string.h>
#include <errno.h>
#include <dlfcn.h>
#include <assert.h>
#include "droid.h"
#include "EGL/internal/eglimage_dri.h"
#ifndef DROID_DRIVER_PATH
#define DROID_DRIVER_PATH "/system/lib"
#endif
struct droid_loader {
struct droid_backend *backend;
char *filename;
void *handle;
__DRIcoreExtension *core;
__DRIdri2Extension *dri2;
};
struct droid_context {
__DRIcontext *dri_context;
};
struct droid_drawable {
struct droid_loader *loader;
struct droid_surface *surface;
__DRIdrawable *dri_drawable;
const __DRIconfig *dri_config;
__DRIEGLImage *dri_image;
};
static __DRIbuffer *
loader_ext_get_buffers_with_format(__DRIdrawable *driDrawable,
int *width, int *height,
unsigned int *attachments, int count,
int *out_count, void *loaderPrivate)
{
struct droid_drawable *drawable = (struct droid_drawable *) loaderPrivate;
struct droid_loader *loader = drawable->loader;
__DRIbuffer *buffers;
buffers = loader->backend->get_surface_buffers(loader->backend,
drawable->surface,
width, height,
attachments, count,
out_count, 1);
return buffers;
}
static const __DRIdri2LoaderExtension loader_ext_dri2_loader = {
{ __DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION },
NULL,
NULL,
loader_ext_get_buffers_with_format,
};
static int
loader_ext_get_ust(int64_t *ust)
{
struct timeval tv;
if (ust == NULL)
return -EFAULT;
if (gettimeofday(&tv, NULL) == 0) {
ust[0] = (tv.tv_sec * 1000000) + tv.tv_usec;
return 0;
} else {
return -errno;
}
}
static const __DRIsystemTimeExtension loader_ext_system_time = {
{ __DRI_SYSTEM_TIME, __DRI_SYSTEM_TIME_VERSION },
loader_ext_get_ust,
NULL,
};
static const __DRIextension *loader_extensions[] = {
&loader_ext_dri2_loader.base,
&loader_ext_system_time.base,
NULL
};
static struct droid_loader *
loader_create(struct droid_backend *backend)
{
struct droid_loader *loader;
loader = calloc(1, sizeof(*loader));
if (!loader)
return NULL;
loader->backend = backend;
return loader;
}
static void
loader_destroy(struct droid_loader *loader)
{
if (loader->filename)
free(loader->filename);
if (loader->handle)
dlclose(loader->handle);
free(loader);
}
static int
loader_load(struct droid_loader *loader, const char *filename)
{
const __DRIextension **extensions;
const char *path = NULL;
int i;
LOGD("Loading DRI driver %s", filename);
loader->handle = dlopen(filename, RTLD_NOW | RTLD_LOCAL);
if (loader->handle == NULL) {
LOGE("dlopen: %s", dlerror());
return 0;
}
extensions = dlsym(loader->handle, __DRI_DRIVER_EXTENSIONS);
if (extensions == NULL) {
LOGE("dlsym: %s", dlerror());
dlclose(loader->handle);
loader->handle = NULL;
return 0;
}
for (i = 0; extensions[i]; i++) {
if (strcmp(extensions[i]->name, __DRI_CORE) == 0 &&
extensions[i]->version >= __DRI_CORE_VERSION) {
loader->core = (__DRIcoreExtension *) extensions[i];
}
if (strcmp(extensions[i]->name, __DRI_DRI2) == 0 &&
extensions[i]->version >= __DRI_DRI2_VERSION) {
loader->dri2 = (__DRIdri2Extension *) extensions[i];
}
}
if (loader->core == NULL || loader->dri2 == NULL) {
LOGE("missing required DRI extensions");
dlclose(loader->handle);
loader->handle = NULL;
return 0;
}
return 1;
}
static int
loader_init(struct droid_loader *loader)
{
char filename[1024];
const char *path;
path = DROID_DRIVER_PATH;
snprintf(filename, sizeof(filename), "%s/%s_dri.so",
path, loader->backend->driver_name);
if (!loader_load(loader, filename))
return 0;
loader->filename = strdup(filename);
return 1;
}
void
droid_backend_destroy(struct droid_backend *backend)
{
backend->destroy(backend);
}
struct droid_screen *
droid_screen_create(struct droid_backend *backend)
{
struct droid_screen *screen = NULL;
struct droid_loader *loader;
const __DRIextension **extensions;
int fd, screen_number;
int i;
loader = loader_create(backend);
if (!loader || !loader_init(loader)) {
LOGE("failed to initialize loader");
goto fail;
}
screen = calloc(1, sizeof(*screen));
if (!screen) {
LOGE("failed to allocate new screen");
goto fail;
}
if (!loader->backend->initialize(loader->backend, &fd, &screen_number)) {
LOGE("failed to initialize backend");
goto fail;
}
screen->loader = loader;
screen->dri_screen =
loader->dri2->createNewScreen(screen_number, fd,
loader_extensions,
&screen->dri_configs, NULL);
if (!screen->dri_screen) {
LOGE("failed to create DRI screen");
goto fail;
}
extensions = loader->core->getExtensions(screen->dri_screen);
for (i = 0; extensions && extensions[i]; i++) {
if (strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0 &&
extensions[i]->version >= __DRI_TEX_BUFFER_VERSION)
screen->tex_buffer = (__DRItexBufferExtension *) extensions[i];
if (strcmp(extensions[i]->name, __DRI_COPY_BUFFER) == 0 &&
extensions[i]->version >= __DRI_COPY_BUFFER_VERSION)
screen->copy_buffer = (__DRIcopyBufferExtension *) extensions[i];
}
if (!screen->tex_buffer) {
LOGE("DRI driver has no TexBuffer extension");
goto fail;
}
if (!screen->tex_buffer) {
LOGE("DRI driver has no CopyBuffer extension");
goto fail;
}
for (i = 0; screen->dri_configs[i]; i++)
;
screen->num_dri_configs = i;
return screen;
fail:
if (screen)
droid_screen_destroy(screen);
if (loader)
loader_destroy(loader);
return NULL;
}
void
droid_screen_destroy(struct droid_screen *screen)
{
struct droid_loader *loader = screen->loader;
if (screen->dri_screen)
loader->core->destroyScreen(screen->dri_screen);
free(screen);
}
static const struct {
EGLenum egl_attrib;
unsigned int dri_attrib;
} droid_attrib_map[] = {
{ EGL_BUFFER_SIZE, __DRI_ATTRIB_BUFFER_SIZE },
{ EGL_RED_SIZE, __DRI_ATTRIB_RED_SIZE },
{ EGL_GREEN_SIZE, __DRI_ATTRIB_GREEN_SIZE },
{ EGL_BLUE_SIZE, __DRI_ATTRIB_BLUE_SIZE },
{ EGL_ALPHA_SIZE, __DRI_ATTRIB_ALPHA_SIZE },
{ EGL_BIND_TO_TEXTURE_RGB, __DRI_ATTRIB_BIND_TO_TEXTURE_RGB },
{ EGL_BIND_TO_TEXTURE_RGBA, __DRI_ATTRIB_BIND_TO_TEXTURE_RGBA },
{ EGL_CONFIG_CAVEAT, __DRI_ATTRIB_CONFIG_CAVEAT },
{ EGL_DEPTH_SIZE, __DRI_ATTRIB_DEPTH_SIZE },
{ EGL_LEVEL, __DRI_ATTRIB_LEVEL },
{ EGL_MAX_PBUFFER_WIDTH, __DRI_ATTRIB_MAX_PBUFFER_WIDTH },
{ EGL_MAX_PBUFFER_HEIGHT, __DRI_ATTRIB_MAX_PBUFFER_HEIGHT },
{ EGL_MAX_PBUFFER_PIXELS, __DRI_ATTRIB_MAX_PBUFFER_PIXELS },
{ EGL_SAMPLE_BUFFERS, __DRI_ATTRIB_SAMPLE_BUFFERS },
{ EGL_SAMPLES, __DRI_ATTRIB_SAMPLES },
{ EGL_STENCIL_SIZE, __DRI_ATTRIB_STENCIL_SIZE },
};
int
droid_screen_convert_config(struct droid_screen *screen,
const __DRIconfig *conf, _EGLConfig *egl_conf)
{
struct droid_loader *loader = screen->loader;
const int num_attrs =
sizeof(droid_attrib_map) / sizeof(droid_attrib_map[0]);
int i;
for (i = 0; i < num_attrs; i++) {
unsigned int dri_attrib = droid_attrib_map[i].dri_attrib;
unsigned int dri_value;
EGLenum egl_attrib = droid_attrib_map[i].egl_attrib;
EGLint egl_value;
if (!loader->core->getConfigAttrib(conf, dri_attrib, &dri_value)) {
LOGE("failed to get attribute %02d for %p", dri_attrib, conf);
return 0;
}
switch (egl_attrib) {
case EGL_CONFIG_CAVEAT:
if (dri_value & __DRI_ATTRIB_SLOW_BIT)
egl_value = EGL_SLOW_CONFIG;
else if (dri_value & __DRI_ATTRIB_NON_CONFORMANT_CONFIG)
egl_value = EGL_NON_CONFORMANT_CONFIG;
else
egl_value = EGL_NONE;
break;
default:
egl_value = (EGLint) dri_value;
break;
}
SET_CONFIG_ATTRIB(egl_conf, egl_attrib, egl_value);
}
return loader->backend->process_config(loader->backend, egl_conf);
}
struct droid_context *
droid_screen_create_context(struct droid_screen *screen,
const __DRIconfig *conf,
struct droid_context *shared)
{
struct droid_loader *loader = screen->loader;
struct droid_context *ctx;
ctx = calloc(1, sizeof(*ctx));
if (!ctx) {
LOGE("failed to allocate context");
return NULL;
}
ctx->dri_context =
loader->dri2->createNewContext(screen->dri_screen, conf,
(shared) ? shared->dri_context : NULL,
NULL);
if (!ctx->dri_context) {
LOGE("failed to create DRI context");
free(ctx);
return NULL;
}
return ctx;
}
void
droid_screen_destroy_context(struct droid_screen *screen,
struct droid_context *ctx)
{
struct droid_loader *loader = screen->loader;
loader->core->destroyContext(ctx->dri_context);
free(ctx);
}
struct droid_drawable *
droid_screen_create_drawable(struct droid_screen *screen,
const __DRIconfig *conf,
struct droid_surface *surf)
{
struct droid_loader *loader = screen->loader;
struct droid_drawable *drawable;
drawable = calloc(1, sizeof(*drawable));
if (!drawable) {
LOGE("failed to allocate drawable");
return NULL;
}
/* needed in GetBuffers */
drawable->loader = loader;
drawable->surface = surf;
drawable->dri_config = conf;
drawable->dri_drawable =
loader->dri2->createNewDrawable(screen->dri_screen,
conf, (void *) drawable);
if (!drawable->dri_drawable) {
LOGE("failed to create DRI drawable");
free(drawable);
return NULL;
}
return drawable;
}
void *
droid_screen_get_drawable_data(struct droid_screen *screen,
struct droid_drawable *drawable)
{
struct droid_loader *loader = screen->loader;
__DRIEGLImage *img = drawable->dri_image;
if (!img) {
unsigned int val;
img = calloc(1, sizeof(__DRIEGLImage));
if (!img)
return NULL;
img->magic = __DRI_EGL_IMAGE_MAGIC;
img->drawable = drawable->dri_drawable;
img->level = 0;
if (loader->core->getConfigAttrib(drawable->dri_config,
__DRI_ATTRIB_ALPHA_SIZE, &val))
img->texture_format_rgba = (val > 0);
drawable->dri_image = img;
}
return (void *) img;
}
void
droid_screen_destroy_drawable(struct droid_screen *screen,
struct droid_drawable *drawable)
{
struct droid_loader *loader = screen->loader;
if (drawable->dri_image)
free(drawable->dri_image);
loader->core->destroyDrawable(drawable->dri_drawable);
free(drawable);
}
int
droid_screen_bind_context(struct droid_screen *screen,
struct droid_drawable *draw,
struct droid_drawable *read,
struct droid_context *ctx)
{
struct droid_loader *loader = screen->loader;
int ret = 0;
if (ctx) {
if (draw && read)
ret = loader->core->bindContext(ctx->dri_context,
draw->dri_drawable,
read->dri_drawable);
else if (!draw && !read)
ret = loader->core->unbindContext(ctx->dri_context);
}
if (!ret)
LOGE("failed to bind context %p", ctx);
return ret;
}
int
droid_screen_swap_buffers(struct droid_screen *screen,
struct droid_context *ctx,
struct droid_drawable *drawable)
{
struct droid_loader *loader = screen->loader;
__DRIbuffer *native;
int width, height;
int err = 0;
native = loader->backend->get_native_buffer(loader->backend,
drawable->surface,
&width, &height);
/* copy from front buffer to native buffer */
if (native)
err = screen->copy_buffer->copyBuffer(ctx->dri_context, native, 0, 0,
drawable->dri_drawable,
__DRI_BUFFER_FRONT_LEFT, 0, 0,
width, height);
if (!err)
loader->backend->swap_native_buffers(loader->backend, drawable->surface);
return (!err);
}

View File

@@ -0,0 +1,81 @@
/*
* Copyright (C) 2009 Chia-I Wu <olvaffe@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include <ui/PixelFormat.h>
#include <ui/ISurfaceComposer.h>
#include "droid_ui.h"
using namespace android;
namespace android {
const sp<ISurfaceComposer>& _get_surface_manager();
};
int
ui_auth_gpu(drm_magic_t magic)
{
/*
* surface flinger itself or root; we might want something like
* getSurfaceFlinger() from libEGL
*/
if (getuid() == 1000 || getuid() == 0)
return 0;
sp<ISurfaceComposer> sm(_get_surface_manager());
if (sm == NULL)
return -ENODEV;
return sm->authGPU(magic);
}
int ui_bytes_per_pixel(int format)
{
return bytesPerPixel(format);
}
int ui_get_rgb_format(int red, int green, int blue, int alpha)
{
PixelFormatInfo info;
PixelFormat fmt;
/* look in the RGB range */
for (fmt = 1; fmt < PIXEL_FORMAT_YCbCr_422_SP; fmt++) {
status_t err = getPixelFormatInfo(fmt, &info);
if (err)
return -1;
/* bpp must be equal to depth */
if (info.bytesPerPixel * 8 != info.bitsPerPixel)
continue;
if ((info.h_red - info.l_red != red) ||
(info.h_green - info.l_green != green) ||
(info.h_blue - info.l_blue != blue) ||
(info.h_alpha - info.l_alpha != alpha))
continue;
/* mask? */
return fmt;
}
return -1;
}

View File

@@ -0,0 +1,41 @@
/*
* Copyright (C) 2009 Chia-I Wu <olvaffe@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (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 _DROID_UI_H
#define _DROID_UI_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus */
#include <drm.h>
int ui_auth_gpu(drm_magic_t magic);
int ui_bytes_per_pixel(int format);
int ui_get_rgb_format(int red, int green, int blue, int alpha);
#ifdef __cplusplus
}
#endif /*__cplusplus */
#endif /* _DROID_UI_H */

View File

@@ -0,0 +1,596 @@
/*
* Copyright (C) 2009 Chia-I Wu <olvaffe@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (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.
*/
#define LOG_TAG "DROID-EGL"
#include <utils/Log.h>
#include "glapi/glapi.h"
#include "eglconfig.h"
#include "eglcontext.h"
#include "egldisplay.h"
#include "egldriver.h"
#include "eglglobals.h"
#include "egllog.h"
#include "eglsurface.h"
#include "eglimage.h"
#include "droid.h"
#ifndef DROID_DEVICE_PATH
#define DROID_DEVICE_PATH "/dev/dri/card0"
#endif
struct droid_egl_driver
{
_EGLDriver base;
/* EGL_DEFAULT_DISPLAY */
struct droid_egl_display *default_display;
void (*flush_current)(void);
void (*finish_current)(void);
};
struct droid_egl_display
{
EGLint refcnt;
EGLint apis;
EGLint major;
EGLint minor;
struct droid_backend *backend;
struct droid_screen *screen;
};
struct droid_egl_context {
_EGLContext base;
struct droid_context *context;
};
struct droid_egl_surface {
_EGLSurface base;
struct droid_drawable *drawable;
struct droid_surface *surface;
};
struct droid_egl_image {
_EGLImage base;
struct droid_drawable *drawable;
struct droid_surface *surface;
};
struct droid_egl_config {
_EGLConfig base;
const __DRIconfig *config;
};
static INLINE struct droid_egl_driver *
lookup_driver(_EGLDriver *drv)
{
return (struct droid_egl_driver *) drv;
}
static INLINE struct droid_egl_display *
lookup_display(_EGLDisplay *dpy)
{
return (struct droid_egl_display *) dpy->DriverData;
}
static INLINE struct droid_egl_context *
lookup_context(_EGLContext *context)
{
return (struct droid_egl_context *) context;
}
static INLINE struct droid_egl_surface *
lookup_surface(_EGLSurface *surface)
{
return (struct droid_egl_surface *) surface;
}
static INLINE struct droid_egl_image *
lookup_image(_EGLImage *image)
{
return (struct droid_egl_image *) image;
}
static INLINE struct droid_egl_config *
lookup_config(_EGLConfig *conf)
{
return (struct droid_egl_config *) conf;
}
static void
droid_create_configs(_EGLDisplay *dpy, struct droid_egl_display *droid_dpy,
const __DRIconfig **configs, EGLint num_configs)
{
EGLint i;
EGLint id = 1;
for (i = 0; i < num_configs; i++) {
struct droid_egl_config *droid_conf = calloc(1, sizeof(*droid_conf));
EGLint val;
if (!droid_conf)
break;
_eglInitConfig(&droid_conf->base, id);
droid_conf->config = configs[i];
if (!droid_screen_convert_config(droid_dpy->screen, droid_conf->config,
&droid_conf->base)) {
free(droid_conf);
continue;
}
val = GET_CONFIG_ATTRIB(&droid_conf->base, EGL_CONFIG_CAVEAT);
/* we do not want slow configs */
if (val == EGL_SLOW_CONFIG) {
free(droid_conf);
} else {
_eglAddConfig(dpy, &droid_conf->base);
id++;
}
}
}
static EGLBoolean
droid_initialize_display(struct droid_egl_display *droid_dpy)
{
const char *path = DROID_DEVICE_PATH;
droid_dpy->backend = droid_backend_create_intel(path);
if (!droid_dpy->backend)
return EGL_FALSE;
droid_dpy->screen = droid_screen_create(droid_dpy->backend);
if (!droid_dpy->screen) {
free(droid_dpy->backend);
droid_dpy->backend = NULL;
return EGL_FALSE;
}
droid_dpy->apis = EGL_OPENGL_ES_BIT;
droid_dpy->major = 1;
droid_dpy->major = 4;
return EGL_TRUE;
}
static EGLBoolean
droid_eglInitialize(_EGLDriver *drv, _EGLDisplay *dpy,
EGLint *major, EGLint *minor)
{
struct droid_egl_driver *droid_drv = lookup_driver(drv);
struct droid_egl_display *droid_dpy;
if (dpy->NativeDisplay != EGL_DEFAULT_DISPLAY)
return _eglError(EGL_NOT_INITIALIZED, "eglInitialize");
/* the default display */
droid_dpy = droid_drv->default_display;
if (!droid_dpy) {
droid_dpy = calloc(1, sizeof(*droid_dpy));
if (!droid_dpy)
return _eglError(EGL_BAD_ALLOC, "eglInitialize");
if (!droid_initialize_display(droid_dpy))
return _eglError(EGL_NOT_INITIALIZED, "eglInitialize");
droid_create_configs(dpy, droid_dpy, droid_dpy->screen->dri_configs,
droid_dpy->screen->num_dri_configs);
#if EGL_KHR_image_base
if (droid_dpy->backend->create_image_surface) {
dpy->Extensions.KHR_image = EGL_TRUE;
dpy->Extensions.KHR_image_base = EGL_TRUE;
dpy->Extensions.KHR_image_pixmap = EGL_TRUE;
}
#endif
droid_drv->default_display = droid_dpy;
}
dpy->DriverData = (void *) droid_dpy;
droid_dpy->refcnt++;
*major = droid_dpy->major;
*minor = droid_dpy->minor;
return EGL_TRUE;
}
static EGLBoolean
droid_eglTerminate(_EGLDriver *drv, _EGLDisplay *dpy)
{
struct droid_egl_driver *droid_drv = lookup_driver(drv);
struct droid_egl_display *droid_dpy = lookup_display(dpy);
dpy->DriverData = NULL;
droid_dpy->refcnt--;
if (!droid_dpy->refcnt) {
_eglReleaseDisplayResources(drv, dpy);
_eglCleanupDisplay(dpy);
free(droid_dpy);
droid_drv->default_display = NULL;
}
return EGL_TRUE;
}
static _EGLProc
droid_eglGetProcAddress(const char *procname)
{
return (_EGLProc) _glapi_get_proc_address(procname);
}
static _EGLContext *
droid_eglCreateContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
_EGLContext *share_list, const EGLint *attrib_list)
{
struct droid_egl_display *droid_dpy = lookup_display(dpy);
struct droid_egl_config *droid_conf = lookup_config(conf);
struct droid_egl_context *shared = lookup_context(share_list);
struct droid_egl_context *ctx;
ctx = calloc(1, sizeof(*ctx));
if (!ctx) {
_eglError(EGL_BAD_ALLOC, "eglCreateContext");
return NULL;
}
if (!_eglInitContext(drv, &ctx->base, &droid_conf->base, attrib_list)) {
free(ctx);
return NULL;
}
ctx->context =
droid_screen_create_context(droid_dpy->screen, droid_conf->config,
(shared) ? shared->context : NULL);
if (!ctx->context) {
free(ctx);
return NULL;
}
return &ctx->base;
}
static EGLBoolean
droid_eglDestroyContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
{
struct droid_egl_display *droid_dpy = lookup_display(dpy);
struct droid_egl_context *droid_ctx = lookup_context(ctx);
if (!_eglIsContextBound(ctx))
droid_screen_destroy_context(droid_dpy->screen, droid_ctx->context);
return EGL_TRUE;
}
static EGLBoolean
droid_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *d,
_EGLSurface *r, _EGLContext *ctx)
{
struct droid_egl_driver *droid_drv = lookup_driver(drv);
struct droid_egl_display *droid_dpy = lookup_display(dpy);
struct droid_egl_surface *draw = lookup_surface(d);
struct droid_egl_surface *read = lookup_surface(r);
struct droid_egl_context *droid_ctx = lookup_context(ctx);
_EGLContext *old;
struct droid_egl_context *droid_old;
old = _eglGetCurrentContext();
/* an unlinked context will be invalid after context switch */
if (!_eglIsContextLinked(old))
old = NULL;
droid_old = lookup_context(old);
if (!_eglMakeCurrent(drv, dpy, d, r, ctx))
return EGL_FALSE;
if (droid_old && droid_old != droid_ctx && droid_drv->flush_current)
droid_drv->flush_current();
_glapi_check_multithread();
/* bind new context or unbind old one */
if (droid_ctx)
droid_screen_bind_context(droid_dpy->screen,
draw->drawable, read->drawable,
droid_ctx->context);
else if (droid_old)
droid_screen_bind_context(droid_dpy->screen,
NULL, NULL,
droid_old->context);
return EGL_TRUE;
}
static _EGLSurface *
droid_eglCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
NativeWindowType window, const EGLint *attrib_list)
{
struct droid_egl_display *droid_dpy = lookup_display(dpy);
struct droid_egl_config *droid_conf = lookup_config(conf);
struct droid_egl_surface *surf;
surf = calloc(1, sizeof(*surf));
if (!surf) {
_eglError(EGL_BAD_ALLOC, "eglCreateWindowSurface");
return NULL;
}
if (!_eglInitSurface(drv, &surf->base, EGL_WINDOW_BIT, &droid_conf->base, attrib_list)) {
free(surf);
return NULL;
}
surf->surface =
droid_dpy->backend->create_window_surface(droid_dpy->backend,
&surf->base, window);
if (!surf->surface) {
free(surf);
return NULL;
}
surf->drawable = droid_screen_create_drawable(droid_dpy->screen,
droid_conf->config,
surf->surface);
if (!surf->drawable) {
droid_dpy->backend->destroy_surface(droid_dpy->backend, surf->surface);
free(surf);
return NULL;
}
return &surf->base;
}
static EGLBoolean
droid_eglDestroySurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf)
{
struct droid_egl_display *droid_dpy = lookup_display(dpy);
struct droid_egl_surface *droid_surf = lookup_surface(surf);
if (_eglIsSurfaceBound(&droid_surf->base))
return EGL_TRUE;
droid_screen_destroy_drawable(droid_dpy->screen, droid_surf->drawable);
droid_dpy->backend->destroy_surface(droid_dpy->backend, droid_surf->surface);
free(droid_surf);
return EGL_TRUE;
}
static EGLBoolean
droid_eglSwapBuffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf)
{
struct droid_egl_driver *droid_drv = lookup_driver(drv);
struct droid_egl_display *droid_dpy = lookup_display(dpy);
struct droid_egl_surface *droid_surf = lookup_surface(surf);
_EGLContext *ctx = _eglGetCurrentContext();
struct droid_egl_context *droid_ctx = lookup_context(ctx);
if (droid_ctx) {
if (droid_drv->flush_current)
droid_drv->flush_current();
droid_screen_swap_buffers(droid_dpy->screen,
droid_ctx->context,
droid_surf->drawable);
}
return EGL_TRUE;
}
#if EGL_KHR_image_base
static _EGLImage *
droid_eglCreateImageKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx,
EGLenum target, EGLClientBuffer buffer, const EGLint *attr_list)
{
struct droid_egl_display *droid_dpy = lookup_display(dpy);
struct droid_egl_image *droid_img;
struct droid_egl_config *droid_conf;
_EGLConfig *conf;
EGLint val, i;
/* only EGL_KHR_image_pixmap is supported */
if (target != EGL_NATIVE_PIXMAP_KHR || ctx) {
_eglError(EGL_BAD_PARAMETER, "eglCreateImageKHR");
return NULL;
}
for (i = 0; i < dpy->NumConfigs; i++) {
conf = dpy->Configs[i];
if (droid_dpy->backend->match_pixmap(droid_dpy->backend, conf,
(NativePixmapType) buffer)) {
EGLint val;
val = GET_CONFIG_ATTRIB(conf, EGL_BIND_TO_TEXTURE_RGB);
val |= GET_CONFIG_ATTRIB(conf, EGL_BIND_TO_TEXTURE_RGBA);
if (val)
break;
}
}
if (i >= dpy->NumConfigs)
return NULL;
droid_img = calloc(1, sizeof(*droid_img));
if (!droid_img) {
_eglError(EGL_BAD_ALLOC, "eglCreateImageKHR");
return NULL;
}
if (!_eglInitImage(drv, &droid_img->base, attr_list)) {
free(droid_img);
return NULL;
}
droid_img->surface =
droid_dpy->backend->create_image_surface(droid_dpy->backend,
(NativePixmapType) buffer);
if (!droid_img->surface) {
free(droid_img);
return NULL;
}
droid_conf = lookup_config(conf);
droid_img->drawable =
droid_screen_create_drawable(droid_dpy->screen, droid_conf->config,
droid_img->surface);
if (!droid_img->drawable) {
droid_dpy->backend->destroy_surface(droid_dpy->backend,
droid_img->surface);
free(droid_img);
return NULL;
}
droid_img->base.ClientData =
droid_screen_get_drawable_data(droid_dpy->screen, droid_img->drawable);
return &droid_img->base;
}
static EGLBoolean
droid_eglDestroyImageKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLImage *img)
{
struct droid_egl_display *droid_dpy = lookup_display(dpy);
struct droid_egl_image *droid_img = lookup_image(img);
droid_screen_destroy_drawable(droid_dpy->screen, droid_img->drawable);
droid_dpy->backend->destroy_surface(droid_dpy->backend, droid_img->surface);
free(droid_img);
return EGL_TRUE;
}
#endif /* EGL_KHR_image_base */
static EGLBoolean
droid_eglWaitClient(_EGLDriver *drv, _EGLDisplay *dpy)
{
struct droid_egl_driver *droid_drv = lookup_driver(drv);
_EGLContext *ctx = _eglGetCurrentContext();
if (!ctx || !droid_drv->finish_current)
return EGL_TRUE;
if (!_eglIsSurfaceLinked(ctx->DrawSurface))
return _eglError(EGL_BAD_CURRENT_SURFACE, "eglWaitClient");
droid_drv->finish_current();
return EGL_TRUE;
}
static EGLBoolean
droid_eglWaitNative(_EGLDriver *drv, _EGLDisplay *dpy, EGLint engine)
{
struct droid_egl_display *droid_dpy = lookup_display(dpy);
_EGLContext *ctx = _eglGetCurrentContext();
struct droid_egl_surface *droid_surf;
if (engine != EGL_CORE_NATIVE_ENGINE)
return _eglError(EGL_BAD_PARAMETER, "eglWaitNative");
if (!ctx)
return EGL_TRUE;
if (!_eglIsSurfaceLinked(ctx->DrawSurface))
return _eglError(EGL_BAD_CURRENT_SURFACE, "eglWaitNative");
droid_surf = lookup_surface(ctx->DrawSurface);
droid_dpy->backend->swap_native_buffers(droid_dpy->backend,
droid_surf->surface);
return EGL_TRUE;
}
static void
droid_Unload(_EGLDriver *drv)
{
struct droid_egl_driver *droid_drv = lookup_driver(drv);
free(droid_drv);
}
static void
droid_Log(EGLint level, const char *msg)
{
switch (level) {
case _EGL_DEBUG:
LOGD(msg);
break;
case _EGL_INFO:
LOGI(msg);
break;
case _EGL_WARNING:
LOGW(msg);
break;
case _EGL_FATAL:
LOGE(msg);
break;
}
}
_EGLDriver *
_eglMain(const char *args)
{
struct droid_egl_driver *droid_drv = calloc(1, sizeof(*droid_drv));
if (!droid_drv)
return NULL;
_eglInitDriverFallbacks(&droid_drv->base);
droid_drv->base.API.Initialize = droid_eglInitialize;
droid_drv->base.API.Terminate = droid_eglTerminate;
droid_drv->base.API.GetProcAddress = droid_eglGetProcAddress;
droid_drv->base.API.CreateContext = droid_eglCreateContext;
droid_drv->base.API.DestroyContext = droid_eglDestroyContext;
droid_drv->base.API.MakeCurrent = droid_eglMakeCurrent;
droid_drv->base.API.CreateWindowSurface = droid_eglCreateWindowSurface;
droid_drv->base.API.DestroySurface = droid_eglDestroySurface;
droid_drv->base.API.SwapBuffers = droid_eglSwapBuffers;
#if EGL_KHR_image_base
droid_drv->base.API.CreateImageKHR = droid_eglCreateImageKHR;
droid_drv->base.API.DestroyImageKHR = droid_eglDestroyImageKHR;
#endif /* EGL_KHR_image_base */
droid_drv->base.API.WaitClient = droid_eglWaitClient;
droid_drv->base.API.WaitNative = droid_eglWaitNative;
droid_drv->base.Name = "Android/i915";
droid_drv->base.Unload = droid_Unload;
/* we need a way to flush commands */
droid_drv->flush_current =
(void (*)(void)) droid_eglGetProcAddress("glFlush");
droid_drv->finish_current =
(void (*)(void)) droid_eglGetProcAddress("glFinish");
_eglSetLogProc(droid_Log);
return &droid_drv->base;
}

View File

@@ -54,13 +54,18 @@
#include "eglglobals.h"
#include "egllog.h"
#include "eglsurface.h"
#include "eglimage.h"
#include "EGL/internal/eglimage_dri.h"
#define MAX_DEPTH 32
#define CALLOC_STRUCT(T) (struct T *) calloc(1, sizeof(struct T))
/** subclass of _EGLDriver */
struct xdri_egl_driver
{
_EGLDriver Base; /**< base class */
void (*FlushCurrentContext)(void);
};
@@ -73,6 +78,8 @@ struct xdri_egl_display
__GLXscreenConfigs *psc;
EGLint scr;
const __GLcontextModes *imageConfigs[MAX_DEPTH + 1];
};
@@ -98,6 +105,16 @@ struct xdri_egl_surface
};
/** subclass of _EGLImage */
struct xdri_egl_image
{
_EGLImage Base; /**< base class */
Drawable pixmap;
__GLXDRIdrawable *driDrawable;
};
/** subclass of _EGLConfig */
struct xdri_egl_config
{
@@ -147,6 +164,14 @@ lookup_config(_EGLConfig *conf)
}
/** Map EGLImage handle to xdri_egl_image object */
static INLINE struct xdri_egl_image *
lookup_image(_EGLImage *img)
{
return (struct xdri_egl_image *) img;
}
/** Get size of given window */
static Status
get_drawable_size(Display *dpy, Drawable d, uint *width, uint *height)
@@ -162,6 +187,62 @@ get_drawable_size(Display *dpy, Drawable d, uint *width, uint *height)
}
#if EGL_KHR_image_base
/** Get depth of given window */
static Status
get_drawable_depth(Display *dpy, Drawable d, uint *depth_ret)
{
Window root;
Status stat;
int xpos, ypos;
unsigned int w, h, bw, depth;
stat = XGetGeometry(dpy, d, &root, &xpos, &ypos, &w, &h, &bw, &depth);
*depth_ret = depth;
return stat;
}
/**
* The config of a pixmap must be guessed from its depth. Do the guess once
* for all depths.
*/
static void
find_image_configs(_EGLDisplay *dpy, const __GLcontextModes *modes)
{
struct xdri_egl_display *xdri_dpy = lookup_display(dpy);
EGLint depth;
for (depth = 0; depth < MAX_DEPTH + 1; depth++) {
const __GLcontextModes *m;
for (m = modes; m; m = m->next) {
/* the depth of a pixmap might not include alpha */
if (m->rgbBits != depth && (m->rgbBits - m->alphaBits) != depth)
continue;
if (!m->visualID)
continue;
if (depth == 32) {
if (m->bindToTextureRgba) {
xdri_dpy->imageConfigs[depth] = m;
break;
}
}
if (m->bindToTextureRgb) {
xdri_dpy->imageConfigs[depth] = m;
break;
}
}
if (m)
_eglLog(_EGL_DEBUG, "Use mode 0x%02x for depth %d",
m->visualID, depth);
}
}
#endif /* EGL_KHR_image_base */
/**
* Produce a set of EGL configs.
*/
@@ -275,6 +356,15 @@ xdri_eglInitialize(_EGLDriver *drv, _EGLDisplay *dpy,
EGL_OPENGL_ES2_BIT |
EGL_OPENVG_BIT);
#if EGL_KHR_image_base
/* must be called after DriverData is set */
find_image_configs(dpy, psc->configs);
dpy->Extensions.KHR_image = EGL_TRUE;
dpy->Extensions.KHR_image_base = EGL_TRUE;
dpy->Extensions.KHR_image_pixmap = EGL_TRUE;
#endif
/* we're supporting EGL 1.4 */
*minor = 1;
*major = 4;
@@ -406,13 +496,23 @@ static EGLBoolean
xdri_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *d,
_EGLSurface *r, _EGLContext *context)
{
struct xdri_egl_driver *xdri_driver = xdri_egl_driver(drv);
struct xdri_egl_context *xdri_ctx = lookup_context(context);
struct xdri_egl_surface *draw = lookup_surface(d);
struct xdri_egl_surface *read = lookup_surface(r);
_EGLContext *old = _eglGetCurrentContext();
/* an unlinked context will be invalid after context switch */
if (!_eglIsContextLinked(old))
old = NULL;
if (!_eglMakeCurrent(drv, dpy, d, r, context))
return EGL_FALSE;
/* flush before context switch */
if (old && old != context && xdri_driver->FlushCurrentContext)
xdri_driver->FlushCurrentContext();
/* the symbol is defined in libGL.so */
_glapi_check_multithread();
@@ -423,12 +523,9 @@ xdri_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *d,
return EGL_FALSE;
}
}
else {
_EGLContext *old = _eglGetCurrentContext();
if (old) {
xdri_ctx = lookup_context(old);
xdri_ctx->driContext->unbindContext(xdri_ctx->driContext);
}
else if (old) {
xdri_ctx = lookup_context(old);
xdri_ctx->driContext->unbindContext(xdri_ctx->driContext);
}
return EGL_TRUE;
@@ -524,15 +621,119 @@ xdri_eglReleaseTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
static EGLBoolean
xdri_eglSwapBuffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw)
{
struct xdri_egl_driver *xdri_driver = xdri_egl_driver(drv);
struct xdri_egl_display *xdri_dpy = lookup_display(dpy);
struct xdri_egl_surface *xdri_surf = lookup_surface(draw);
/* swapBuffers does not flush commands */
if (draw == _eglGetCurrentSurface(EGL_DRAW) &&
xdri_driver->FlushCurrentContext)
xdri_driver->FlushCurrentContext();
xdri_dpy->psc->driScreen->swapBuffers(xdri_surf->driDrawable);
return EGL_TRUE;
}
#if EGL_KHR_image_base
static _EGLImage *
xdri_eglCreateImageKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx,
EGLenum target, EGLClientBuffer buffer, const EGLint *attr_list)
{
struct xdri_egl_display *xdri_dpy = lookup_display(dpy);
struct xdri_egl_image *xdri_img;
__DRIEGLImage *driImage;
EGLint err = EGL_SUCCESS;
const __GLcontextModes *mode;
uint depth;
xdri_img = CALLOC_STRUCT(xdri_egl_image);
if (!xdri_img) {
_eglError(EGL_BAD_ALLOC, "eglCreateImageKHR");
return NULL;
}
switch (target) {
case EGL_NATIVE_PIXMAP_KHR:
if (ctx) {
err = EGL_BAD_PARAMETER;
break;
}
xdri_img->pixmap = (Pixmap) buffer;
break;
default:
err = EGL_BAD_PARAMETER;
break;
}
if (err != EGL_SUCCESS) {
_eglError(EGL_BAD_PARAMETER, "eglCreateImageKHR");
free(xdri_img);
return NULL;
}
if (!_eglInitImage(drv, &xdri_img->Base, attr_list)) {
free(xdri_img);
return NULL;
}
if (!get_drawable_depth(xdri_dpy->dpy, xdri_img->pixmap, &depth) ||
depth > MAX_DEPTH) {
free(xdri_img);
return NULL;
}
mode = xdri_dpy->imageConfigs[depth];
if (!mode) {
free(xdri_img);
return NULL;
}
driImage = CALLOC_STRUCT(__DRIEGLImageRec);
if (!driImage) {
_eglError(EGL_BAD_ALLOC, "eglCreateImageKHR");
free(xdri_img);
return NULL;
}
xdri_img->driDrawable =
xdri_dpy->psc->driScreen->createDrawable(xdri_dpy->psc,
(XID) xdri_img->pixmap,
(GLXDrawable) xdri_img->pixmap,
mode);
if (!xdri_img->driDrawable) {
free(driImage);
free(xdri_img);
return NULL;
}
driImage->magic = __DRI_EGL_IMAGE_MAGIC;
driImage->drawable = xdri_img->driDrawable->driDrawable;
driImage->texture_format_rgba = (depth == 32 && mode->bindToTextureRgba);
driImage->level = 0;
xdri_img->Base.ClientData = (void *) driImage;
return &xdri_img->Base;
}
static EGLBoolean
xdri_eglDestroyImageKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLImage *img)
{
struct xdri_egl_image *xdri_img = lookup_image(img);
free(xdri_img->Base.ClientData);
xdri_img->driDrawable->destroyDrawable(xdri_img->driDrawable);
free(xdri_img);
return EGL_TRUE;
}
#endif /* EGL_KHR_image_base */
static void
xdri_Unload(_EGLDriver *drv)
{
@@ -567,9 +768,17 @@ _eglMain(const char *args)
xdri_drv->Base.API.BindTexImage = xdri_eglBindTexImage;
xdri_drv->Base.API.ReleaseTexImage = xdri_eglReleaseTexImage;
xdri_drv->Base.API.SwapBuffers = xdri_eglSwapBuffers;
#if EGL_KHR_image_base
xdri_drv->Base.API.CreateImageKHR = xdri_eglCreateImageKHR;
xdri_drv->Base.API.DestroyImageKHR = xdri_eglDestroyImageKHR;
#endif /* EGL_KHR_image_base */
xdri_drv->Base.Name = "X/DRI";
xdri_drv->Base.Unload = xdri_Unload;
/* we need a way to flush commands */
xdri_drv->FlushCurrentContext =
(void (*)(void)) xdri_eglGetProcAddress("glFlush");
return &xdri_drv->Base;
}

View File

@@ -7,6 +7,7 @@ include $(TOP)/configs/current
INCLUDE_DIRS = -I$(TOP)/include -I$(TOP)/src/mesa/glapi $(X11_INCLUDES)
HEADERS = \
eglclient.h \
eglcompiler.h \
eglconfig.h \
eglconfigutil.h \
@@ -16,6 +17,7 @@ HEADERS = \
egldisplay.h \
egldriver.h \
eglglobals.h \
eglimage.h \
egllog.h \
eglmisc.h \
eglmode.h \
@@ -26,6 +28,7 @@ HEADERS = \
SOURCES = \
eglapi.c \
eglclient.c \
eglconfig.c \
eglconfigutil.c \
eglcontext.c \
@@ -33,6 +36,7 @@ SOURCES = \
egldisplay.c \
egldriver.c \
eglglobals.c \
eglimage.c \
egllog.c \
eglmisc.c \
eglmode.c \

View File

@@ -41,6 +41,7 @@
#include "eglconfig.h"
#include "eglscreen.h"
#include "eglmode.h"
#include "eglimage.h"
/**
@@ -92,8 +93,8 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
snprintf(disp->Version, sizeof(disp->Version),
"%d.%d (%s)", major_int, minor_int, drv->Name);
/* update the global notion of supported APIs */
_eglGlobal.ClientAPIsMask |= disp->ClientAPIsMask;
/* limit to APIs supported by core */
disp->ClientAPIsMask &= _EGL_API_ALL_BITS;
disp->Driver = drv;
} else {
@@ -644,6 +645,10 @@ void (* EGLAPIENTRY eglGetProcAddress(const char *procname))()
{ "eglReleaseThread", (_EGLProc) eglReleaseThread },
{ "eglWaitClient", (_EGLProc) eglWaitClient },
#endif /* EGL_VERSION_1_2 */
#ifdef EGL_KHR_image_base
{ "eglCreateImageKHR", (_EGLProc) eglCreateImageKHR },
{ "eglDestroyImageKHR", (_EGLProc) eglDestroyImageKHR },
#endif /* EGL_KHR_image_base */
{ NULL, NULL }
};
EGLint i;
@@ -653,6 +658,10 @@ void (* EGLAPIENTRY eglGetProcAddress(const char *procname))()
}
}
/* preload a driver if there isn't one */
if (!_eglGlobal.NumDrivers)
_eglPreloadDriver(NULL);
/* now loop over drivers to query their procs */
for (i = 0; i < _eglGlobal.NumDrivers; i++) {
_EGLProc p = _eglGlobal.Drivers[i]->API.GetProcAddress(procname);
@@ -867,33 +876,7 @@ eglBindAPI(EGLenum api)
if (!_eglIsApiValid(api))
return _eglError(EGL_BAD_PARAMETER, "eglBindAPI");
switch (api) {
#ifdef EGL_VERSION_1_4
case EGL_OPENGL_API:
if (_eglGlobal.ClientAPIsMask & EGL_OPENGL_BIT) {
t->CurrentAPIIndex = _eglConvertApiToIndex(api);
return EGL_TRUE;
}
_eglError(EGL_BAD_PARAMETER, "eglBindAPI");
return EGL_FALSE;
#endif
case EGL_OPENGL_ES_API:
if (_eglGlobal.ClientAPIsMask & (EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT)) {
t->CurrentAPIIndex = _eglConvertApiToIndex(api);
return EGL_TRUE;
}
_eglError(EGL_BAD_PARAMETER, "eglBindAPI");
return EGL_FALSE;
case EGL_OPENVG_API:
if (_eglGlobal.ClientAPIsMask & EGL_OPENVG_BIT) {
t->CurrentAPIIndex = _eglConvertApiToIndex(api);
return EGL_TRUE;
}
_eglError(EGL_BAD_PARAMETER, "eglBindAPI");
return EGL_FALSE;
default:
return EGL_FALSE;
}
t->CurrentAPIIndex = _eglConvertApiToIndex(api);
return EGL_TRUE;
}
@@ -968,3 +951,50 @@ eglWaitClient(void)
#endif /* EGL_VERSION_1_2 */
#ifdef EGL_KHR_image_base
EGLImageKHR
eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attr_list)
{
_EGLDisplay *disp = _eglLookupDisplay(dpy);
_EGLContext *context = _eglLookupContext(ctx, disp);
_EGLDriver *drv;
_EGLImage *img;
drv = _eglCheckDisplay(disp, __FUNCTION__);
if (!drv)
return EGL_NO_IMAGE_KHR;
if (!context && ctx != EGL_NO_CONTEXT) {
_eglError(EGL_BAD_CONTEXT, __FUNCTION__);
return EGL_NO_IMAGE_KHR;
}
img = drv->API.CreateImageKHR(drv, disp, context, target, buffer, attr_list);
if (img)
return _eglLinkImage(img, disp);
else
return EGL_NO_IMAGE_KHR;
}
EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)
{
_EGLDisplay *disp = _eglLookupDisplay(dpy);
_EGLImage *img = _eglLookupImage(image, disp);
_EGLDriver *drv;
drv = _eglCheckDisplay(disp, __FUNCTION__);
if (!drv)
return EGL_FALSE;
if (!img)
return _eglError(EGL_BAD_PARAMETER, __FUNCTION__);
_eglUnlinkImage(img);
return drv->API.DestroyImageKHR(drv, disp, img);
}
#endif /* EGL_KHR_image_base */

View File

@@ -70,6 +70,11 @@ typedef _EGLSurface *(*CreatePbufferFromClientBuffer_t)(_EGLDriver *drv, _EGLDis
#endif /* EGL_VERSION_1_2 */
#ifdef EGL_KHR_image_base
typedef _EGLImage *(*CreateImageKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attr_list);
typedef EGLBoolean (*DestroyImageKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLImage *image);
#endif /* EGL_KHR_image_base */
/**
* The API dispatcher jumps through these functions
@@ -105,7 +110,7 @@ struct _egl_api
WaitNative_t WaitNative;
GetProcAddress_t GetProcAddress;
/* EGL_MESA_screen extension */
#ifdef EGL_MESA_screen_surface
ChooseModeMESA_t ChooseModeMESA;
GetModesMESA_t GetModesMESA;
GetModeAttribMESA_t GetModeAttribMESA;
@@ -118,11 +123,17 @@ struct _egl_api
QueryScreenSurfaceMESA_t QueryScreenSurfaceMESA;
QueryScreenModeMESA_t QueryScreenModeMESA;
QueryModeStringMESA_t QueryModeStringMESA;
#endif /* EGL_MESA_screen_surface */
#ifdef EGL_VERSION_1_2
WaitClient_t WaitClient;
CreatePbufferFromClientBuffer_t CreatePbufferFromClientBuffer;
#endif
#ifdef EGL_KHR_image_base
CreateImageKHR_t CreateImageKHR;
DestroyImageKHR_t DestroyImageKHR;
#endif /* EGL_KHR_image_base */
};
#endif /* EGLAPI_INCLUDED */

21
src/egl/main/eglclient.c Normal file
View File

@@ -0,0 +1,21 @@
/**
* Functions that client APIs can call.
*/
#include "eglcurrent.h"
#include "egldisplay.h"
#include "eglimage.h"
#include "eglclient.h"
/**
* Return the opaque client data of an image.
*/
void *
_eglClientGetImageData(EGLImageKHR image)
{
_EGLDisplay *dpy = _eglGetCurrentDisplay();
_EGLImage *img = _eglLookupImage(image, dpy);
return (img) ? img->ClientData : NULL;
}

12
src/egl/main/eglclient.h Normal file
View File

@@ -0,0 +1,12 @@
#ifndef EGLCLIENT_INCLUDED
#define EGLCLIENT_INCLUDED
#include "egltypedefs.h"
extern void *
_eglClientGetImageData(EGLImageKHR image);
#endif /* EGLCLIENT_INCLUDED */

View File

@@ -9,7 +9,7 @@
/* This should be kept in sync with _eglInitThreadInfo() */
#define _EGL_THREAD_INFO_INITIALIZER \
{ EGL_SUCCESS, { NULL }, 1 }
{ EGL_SUCCESS, { NULL }, 0 }
/* a fallback thread info to guarantee that every thread always has one */
static _EGLThreadInfo dummy_thread = _EGL_THREAD_INFO_INITIALIZER;

View File

@@ -4,8 +4,16 @@
#include "egltypedefs.h"
#define _EGL_API_NUM_INDICES \
(EGL_OPENGL_API - EGL_OPENGL_ES_API + 2) /* idx 0 is for EGL_NONE */
#define _EGL_API_ALL_BITS \
(EGL_OPENGL_ES_BIT | \
EGL_OPENVG_BIT | \
EGL_OPENGL_ES2_BIT | \
EGL_OPENGL_BIT)
#define _EGL_API_FIRST_API EGL_OPENGL_ES_API
#define _EGL_API_LAST_API EGL_OPENGL_API
#define _EGL_API_NUM_APIS (_EGL_API_LAST_API - _EGL_API_FIRST_API + 1)
/**
@@ -14,20 +22,19 @@
struct _egl_thread_info
{
EGLint LastError;
_EGLContext *CurrentContexts[_EGL_API_NUM_INDICES];
_EGLContext *CurrentContexts[_EGL_API_NUM_APIS];
/* use index for fast access to current context */
EGLint CurrentAPIIndex;
};
/**
* Return true if a client API enum can be converted to an index.
* Return true if a client API enum is recognized.
*/
static INLINE EGLBoolean
_eglIsApiValid(EGLenum api)
{
return ((api >= EGL_OPENGL_ES_API && api <= EGL_OPENGL_API) ||
api == EGL_NONE);
return (api >= _EGL_API_FIRST_API && api <= _EGL_API_LAST_API);
}
@@ -38,7 +45,7 @@ _eglIsApiValid(EGLenum api)
static INLINE EGLint
_eglConvertApiToIndex(EGLenum api)
{
return (api != EGL_NONE) ? api - EGL_OPENGL_ES_API + 1 : 0;
return api - _EGL_API_FIRST_API;
}
@@ -49,7 +56,7 @@ _eglConvertApiToIndex(EGLenum api)
static INLINE EGLenum
_eglConvertApiFromIndex(EGLint idx)
{
return (idx) ? EGL_OPENGL_ES_API + idx - 1 : EGL_NONE;
return _EGL_API_FIRST_API + idx;
}

View File

@@ -14,6 +14,9 @@ struct _egl_extensions
{
EGLBoolean MESA_screen_surface;
EGLBoolean MESA_copy_context;
EGLBoolean KHR_image;
EGLBoolean KHR_image_base;
EGLBoolean KHR_image_pixmap;
char String[_EGL_MAX_EXTENSIONS_LEN];
};
@@ -50,6 +53,8 @@ struct _egl_display
/* lists of linked contexts and surface */
_EGLContext *ContextList;
_EGLSurface *SurfaceList;
_EGLImage *ImageList;
};

View File

@@ -19,62 +19,74 @@
#include "eglscreen.h"
#include "eglstring.h"
#include "eglsurface.h"
#include "eglimage.h"
#if defined(_EGL_PLATFORM_X)
#include <dlfcn.h>
#elif defined(_EGL_PLATFORM_WINDOWS)
/* Use static linking on Windows for now */
#define WINDOWS_STATIC_LINK
#endif
/**
* Wrappers for dlopen/dlclose()
*/
#if defined(_EGL_PLATFORM_WINDOWS)
#ifdef WINDOWS_STATIC_LINK
static const char *DefaultDriverName = "Windows EGL Static Library";
#else
/* XXX Need to decide how to do dynamic name lookup on Windows */
static const char *DefaultDriverName = "TBD";
#endif
typedef HMODULE lib_handle;
static HMODULE
open_library(const char *filename)
{
#ifdef WINDOWS_STATIC_LINK
return 0;
#else
return LoadLibrary(filename);
#endif
}
static void
close_library(HMODULE lib)
{
#ifdef WINDOWS_STATIC_LINK
#else
FreeLibrary(lib);
#endif
}
/* XXX Need to decide how to do dynamic name lookup on Windows */
static const char DefaultDriverName[] = "TBD";
typedef HMODULE lib_handle;
static HMODULE
open_library(const char *filename)
{
return LoadLibrary(filename);
}
static void
close_library(HMODULE lib)
{
FreeLibrary(lib);
}
#elif defined(_EGL_PLATFORM_X)
static const char *DefaultDriverName = "egl_softpipe";
typedef void * lib_handle;
static void *
open_library(const char *filename)
{
return dlopen(filename, RTLD_LAZY);
}
static const char DefaultDriverName[] = "egl_softpipe";
typedef void * lib_handle;
static void *
open_library(const char *filename)
{
return dlopen(filename, RTLD_LAZY);
}
static void
close_library(void *lib)
{
dlclose(lib);
}
#else /* _EGL_PLATFORM_NO_OS */
static const char DefaultDriverName[] = "builtin";
typedef void *lib_handle;
static INLINE void *
open_library(const char *filename)
{
return (void *) filename;
}
static INLINE void
close_library(void *lib)
{
}
static void
close_library(void *lib)
{
dlclose(lib);
}
#endif
@@ -95,14 +107,22 @@ _eglChooseDriver(_EGLDisplay *dpy, char **argsRet)
path = _eglstrdup(path);
#if defined(_EGL_PLATFORM_X)
if (!path && dpy->NativeDisplay) {
if (!path && dpy && dpy->NativeDisplay) {
/* assume (wrongly!) that the native display is a display string */
path = _eglSplitDisplayString((const char *) dpy->NativeDisplay, &args);
}
suffix = "so";
#elif defined(_EGL_PLATFORM_WINDOWS)
suffix = "dll";
#endif /* _EGL_PLATFORM_X */
#else /* _EGL_PLATFORM_NO_OS */
if (path) {
/* force the use of the default driver */
_eglLog(_EGL_DEBUG, "ignore EGL_DRIVER");
free(path);
path = NULL;
}
suffix = NULL;
#endif
if (!path)
path = _eglstrdup(DefaultDriverName);
@@ -136,43 +156,48 @@ _eglChooseDriver(_EGLDisplay *dpy, char **argsRet)
static _EGLMain_t
_eglOpenLibrary(const char *driverPath, lib_handle *handle)
{
_EGLMain_t mainFunc;
lib_handle lib;
_EGLMain_t mainFunc = NULL;
const char *error = "unknown error";
assert(driverPath);
_eglLog(_EGL_DEBUG, "dlopen(%s)", driverPath);
lib = open_library(driverPath);
#if defined(_EGL_PLATFORM_WINDOWS)
/* Use static linking on Windows for now */
#ifdef WINDOWS_STATIC_LINK
lib = 0;
mainFunc = (_EGLMain_t)_eglMain;
#else
/* XXX untested */
_eglLog(_EGL_DEBUG, "dlopen(%s)", driverPath);
lib = open_library(driverPath);
if (!lib) {
_eglLog(_EGL_WARNING, "Could not open %s",
driverPath);
return NULL;
}
mainFunc = (_EGLMain_t) GetProcAddress(lib, "_eglMain");
#endif
if (lib)
mainFunc = (_EGLMain_t) GetProcAddress(lib, "_eglMain");
#elif defined(_EGL_PLATFORM_X)
_eglLog(_EGL_DEBUG, "dlopen(%s)", driverPath);
lib = open_library(driverPath);
if (lib) {
mainFunc = (_EGLMain_t) dlsym(lib, "_eglMain");
if (!mainFunc)
error = dlerror();
}
else {
error = dlerror();
}
#else /* _EGL_PLATFORM_NO_OS */
/* must be the default driver name */
if (strcmp(driverPath, DefaultDriverName) == 0)
mainFunc = (_EGLMain_t) _eglMain;
else
error = "not builtin driver";
#endif
if (!lib) {
_eglLog(_EGL_WARNING, "Could not open %s (%s)",
driverPath, dlerror());
_eglLog(_EGL_WARNING, "Could not open driver %s (%s)",
driverPath, error);
if (!getenv("EGL_DRIVER"))
_eglLog(_EGL_WARNING,
"The driver can be overridden by setting EGL_DRIVER");
return NULL;
}
mainFunc = (_EGLMain_t) dlsym(lib, "_eglMain");
#endif
if (!mainFunc) {
_eglLog(_EGL_WARNING, "_eglMain not found in %s", driverPath);
_eglLog(_EGL_WARNING, "_eglMain not found in %s (%s)",
driverPath, error);
if (lib)
close_library(lib);
return NULL;
@@ -404,6 +429,11 @@ _eglInitDriverFallbacks(_EGLDriver *drv)
#ifdef EGL_VERSION_1_2
drv->API.CreatePbufferFromClientBuffer = _eglCreatePbufferFromClientBuffer;
#endif /* EGL_VERSION_1_2 */
#ifdef EGL_KHR_image_base
drv->API.CreateImageKHR = _eglCreateImageKHR;
drv->API.DestroyImageKHR = _eglDestroyImageKHR;
#endif /* EGL_KHR_image_base */
}
@@ -428,6 +458,11 @@ _eglFindAPIs(void)
const char *es2_libname = "libGLESv2.so";
const char *gl_libname = "libGL.so";
const char *vg_libname = "libOpenVG.so";
#else /* _EGL_PLATFORM_NO_OS */
const char *es1_libname = NULL;
const char *es2_libname = NULL;
const char *gl_libname = NULL;
const char *vg_libname = NULL;
#endif
if ((lib = open_library(es1_libname))) {

View File

@@ -15,13 +15,13 @@ struct _egl_global _eglGlobal =
&_eglGlobalMutex, /* Mutex */
NULL, /* DisplayList */
1, /* FreeScreenHandle */
0x0, /* ClientAPIsMask */
0, /* NumDrivers */
{ NULL }, /* Drivers */
2, /* NumAtExitCalls */
{ /* AtExitCalls */
_eglFiniDisplay,
_eglUnloadDrivers
{
/* default AtExitCalls, called in reverse order */
_eglUnloadDrivers, /* always called last */
_eglFiniDisplay
},
};

View File

@@ -19,9 +19,6 @@ struct _egl_global
EGLScreenMESA FreeScreenHandle;
/* bitmaks of supported APIs (supported by _some_ driver) */
EGLint ClientAPIsMask;
EGLint NumDrivers;
_EGLDriver *Drivers[10];

104
src/egl/main/eglimage.c Normal file
View File

@@ -0,0 +1,104 @@
#include <assert.h>
#include "eglimage.h"
#include "egldisplay.h"
EGLBoolean
_eglInitImage(_EGLDriver *drv, _EGLImage *img, const EGLint *attrib_list)
{
EGLint i;
img->Preserved = EGL_FALSE;
for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
switch (attrib_list[i]) {
case EGL_IMAGE_PRESERVED_KHR:
i++;
img->Preserved = attrib_list[i];
break;
default:
/* not an error */
break;
}
}
return EGL_TRUE;
}
_EGLImage *
_eglCreateImageKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx,
EGLenum target, EGLClientBuffer buffer, const EGLint *attr_list)
{
/* driver should override this function */
return NULL;
}
EGLBoolean
_eglDestroyImageKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLImage *image)
{
/* driver should override this function */
return EGL_FALSE;
}
EGLImageKHR
_eglLinkImage(_EGLImage *img, _EGLDisplay *dpy)
{
img->Display = dpy;
img->Next = dpy->ImageList;
dpy->ImageList = img;
return (EGLImageKHR) img;
}
void
_eglUnlinkImage(_EGLImage *img)
{
_EGLImage *prev;
prev = img->Display->ImageList;
if (prev != img) {
while (prev) {
if (prev->Next == img)
break;
prev = prev->Next;
}
assert(prev);
prev->Next = img->Next;
}
else {
img->Display->ImageList = img->Next;
}
img->Next = NULL;
img->Display = NULL;
}
#ifndef _EGL_SKIP_HANDLE_CHECK
/**
* Return EGL_TRUE if the given handle is a valid handle to an image.
*/
EGLBoolean
_eglCheckImageHandle(EGLImageKHR img, _EGLDisplay *dpy)
{
_EGLImage *cur = NULL;
if (dpy)
cur = dpy->ImageList;
while (cur) {
if (cur == (_EGLImage *) img) {
assert(cur->Display == dpy);
break;
}
cur = cur->Next;
}
return (cur != NULL);
}
#endif /* _EGL_SKIP_HANDLE_CHECK */

93
src/egl/main/eglimage.h Normal file
View File

@@ -0,0 +1,93 @@
#ifndef EGLIMAGE_INCLUDED
#define EGLIMAGE_INCLUDED
#include "egltypedefs.h"
/**
* "Base" class for device driver images.
*/
struct _egl_image
{
/* Client data that client APIs and the driver agree on */
void *ClientData;
/* Managed by EGLDisplay for linking */
_EGLDisplay *Display;
_EGLImage *Next;
EGLBoolean Preserved;
};
extern EGLBoolean
_eglInitImage(_EGLDriver *drv, _EGLImage *img, const EGLint *attrib_list);
extern _EGLImage *
_eglCreateImageKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx,
EGLenum target, EGLClientBuffer buffer, const EGLint *attr_list);
extern EGLBoolean
_eglDestroyImageKHR(_EGLDriver *drv, _EGLDisplay *dpy, _EGLImage *image);
extern EGLImageKHR
_eglLinkImage(_EGLImage *img, _EGLDisplay *dpy);
extern void
_eglUnlinkImage(_EGLImage *img);
#ifndef _EGL_SKIP_HANDLE_CHECK
extern EGLBoolean
_eglCheckImageHandle(EGLImageKHR img, _EGLDisplay *dpy);
#else
/**
* Perform a quick check on the handle.
*/
static INLINE EGLBoolean
_eglCheckImageHandle(EGLImageKHR img, _EGLDisplay *dpy)
{
_EGLImage *i = (_EGLImage *) img;
return (dpy && i && i->Display == dpy);
}
#endif
/**
* Lookup a handle to find the linked image.
* Return NULL if the handle has no corresponding linked image.
*/
static INLINE _EGLImage *
_eglLookupImage(EGLImageKHR image, _EGLDisplay *dpy)
{
_EGLImage *img = (_EGLImage *) image;
if (!_eglCheckImageHandle(img, dpy))
img = NULL;
return img;
}
/**
* Return the handle of a linked image.
*/
static INLINE EGLImageKHR
_eglGetImageHandle(_EGLImage *img)
{
return (EGLImageKHR) ((img && img->Display) ? img : EGL_NO_IMAGE_KHR);
}
#endif /* EGLIMAGE_INCLUDED */

View File

@@ -9,51 +9,140 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "egllog.h"
#include "eglmutex.h"
#define MAXSTRING 1000
#define FALLBACK_LOG_LEVEL _EGL_WARNING
#define FALLBACK_LOG_LEVEL_STR "warning"
static EGLint ReportingLevel = -1;
#define FALLBACK_LOG_LEVEL _EGL_WARNING
static void
log_level_initialize(void)
static struct {
_EGLMutex mutex;
EGLBoolean initialized;
EGLint level;
_EGLLogProc logger;
EGLint num_messages;
} logging = {
_EGL_MUTEX_INITIALIZER,
EGL_FALSE,
FALLBACK_LOG_LEVEL,
NULL,
0
};
static const char *level_strings[] = {
/* the order is important */
"fatal",
"warning",
"info",
"debug",
NULL
};
/**
* Set the function to be called when there is a message to log.
* Note that the function will be called with an internal lock held.
* Recursive logging is not allowed.
*/
void
_eglSetLogProc(_EGLLogProc logger)
{
#if defined(_EGL_PLATFORM_X)
char *log_env = getenv("EGL_LOG_LEVEL");
#else
char *log_env = NULL;
#endif
EGLint num_messages = 0;
if (log_env == NULL) {
ReportingLevel = FALLBACK_LOG_LEVEL;
_eglLockMutex(&logging.mutex);
if (logging.logger != logger) {
logging.logger = logger;
num_messages = logging.num_messages;
logging.num_messages = 0;
}
else if (strcasecmp(log_env, "fatal") == 0) {
ReportingLevel = _EGL_FATAL;
}
else if (strcasecmp(log_env, "warning") == 0) {
ReportingLevel = _EGL_WARNING;
}
else if (strcasecmp(log_env, "info") == 0) {
ReportingLevel = _EGL_INFO;
}
else if (strcasecmp(log_env, "debug") == 0) {
ReportingLevel = _EGL_DEBUG;
}
else {
fprintf(stderr, "Unrecognized EGL_LOG_LEVEL environment variable value. "
"Expected one of \"fatal\", \"warning\", \"info\", \"debug\". "
"Got \"%s\". Falling back to \"%s\".\n",
log_env, FALLBACK_LOG_LEVEL_STR);
ReportingLevel = FALLBACK_LOG_LEVEL;
_eglUnlockMutex(&logging.mutex);
if (num_messages)
_eglLog(_EGL_DEBUG,
"New logger installed. "
"Messages before the new logger might not be available.");
}
/**
* Set the log reporting level.
*/
void
_eglSetLogLevel(EGLint level)
{
switch (level) {
case _EGL_FATAL:
case _EGL_WARNING:
case _EGL_INFO:
case _EGL_DEBUG:
_eglLockMutex(&logging.mutex);
logging.level = level;
_eglUnlockMutex(&logging.mutex);
break;
default:
break;
}
}
/**
* Log a message to stderr.
* The default logger. It prints the message to stderr.
*/
static void
_eglDefaultLogger(EGLint level, const char *msg)
{
fprintf(stderr, "libEGL %s: %s\n", level_strings[level], msg);
}
/**
* Initialize the logging facility.
*/
static void
_eglInitLogger(void)
{
const char *log_env;
EGLint i, level = -1;
if (logging.initialized)
return;
log_env = getenv("EGL_LOG_LEVEL");
if (log_env) {
for (i = 0; level_strings[i]; i++) {
if (strcasecmp(log_env, level_strings[i]) == 0) {
level = i;
break;
}
}
}
else {
level = FALLBACK_LOG_LEVEL;
}
logging.logger = _eglDefaultLogger;
logging.level = (level >= 0) ? level : FALLBACK_LOG_LEVEL;
logging.initialized = EGL_TRUE;
/* it is fine to call _eglLog now */
if (log_env && level < 0) {
_eglLog(_EGL_WARNING,
"Unrecognized EGL_LOG_LEVEL environment variable value. "
"Expected one of \"fatal\", \"warning\", \"info\", \"debug\". "
"Got \"%s\". Falling back to \"%s\".",
log_env, level_strings[FALLBACK_LOG_LEVEL]);
}
}
/**
* Log a message with message logger.
* \param level one of _EGL_FATAL, _EGL_WARNING, _EGL_INFO, _EGL_DEBUG.
*/
void
@@ -61,40 +150,26 @@ _eglLog(EGLint level, const char *fmtStr, ...)
{
va_list args;
char msg[MAXSTRING];
const char *levelStr;
static int log_level_initialized = 0;
if (!log_level_initialized) {
log_level_initialize();
log_level_initialized = 1;
}
/* one-time initialization; a little race here is fine */
if (!logging.initialized)
_eglInitLogger();
if (level > logging.level || level < 0)
return;
if (level <= ReportingLevel) {
switch (level) {
case _EGL_FATAL:
levelStr = "Fatal";
break;
case _EGL_WARNING:
levelStr = "Warning";
break;
case _EGL_INFO:
levelStr = "Info";
break;
case _EGL_DEBUG:
levelStr = "Debug";
break;
default:
levelStr = "";
}
_eglLockMutex(&logging.mutex);
if (logging.logger) {
va_start(args, fmtStr);
vsnprintf(msg, MAXSTRING, fmtStr, args);
va_end(args);
fprintf(stderr, "libEGL %s: %s\n", levelStr, msg);
if (level == _EGL_FATAL) {
exit(1); /* or abort()? */
}
logging.logger(level, msg);
logging.num_messages++;
}
_eglUnlockMutex(&logging.mutex);
if (level == _EGL_FATAL)
exit(1); /* or abort()? */
}

View File

@@ -9,6 +9,17 @@
#define _EGL_DEBUG 3 /* useful info for debugging */
typedef void (*_EGLLogProc)(EGLint level, const char *msg);
extern void
_eglSetLogProc(_EGLLogProc logger);
extern void
_eglSetLogLevel(EGLint level);
extern void
_eglLog(EGLint level, const char *fmtStr, ...);

View File

@@ -54,6 +54,12 @@ _eglUpdateExtensionsString(_EGLDisplay *dpy)
strcat(exts, "EGL_MESA_screen_surface ");
if (dpy->Extensions.MESA_copy_context)
strcat(exts, "EGL_MESA_copy_context ");
if (dpy->Extensions.KHR_image)
strcat(exts, "EGL_KHR_image ");
if (dpy->Extensions.KHR_image_base)
strcat(exts, "EGL_KHR_image_base ");
if (dpy->Extensions.KHR_image_pixmap)
strcat(exts, "EGL_KHR_image_pixmap ");
assert(strlen(exts) < _EGL_MAX_EXTENSIONS_LEN);
}

View File

@@ -6,6 +6,62 @@
#include <EGL/egl.h>
#include <EGL/eglext.h>
#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 uint32_t EGLScreenMESA;
typedef 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 */
#include "eglcompiler.h"
typedef struct _egl_api _EGLAPI;
@@ -28,6 +84,8 @@ typedef struct _egl_surface _EGLSurface;
typedef struct _egl_thread_info _EGLThreadInfo;
typedef struct _egl_image _EGLImage;
typedef _EGLDriver *(*_EGLMain_t)(const char *args);

View File

@@ -0,0 +1,100 @@
# src/gallium/state_trackers/es/Makefile
# Build the ES 1/2 state tracker libraries
# This consists of core Mesa ES, plus GL/gallium state tracker.
TOP = ../../../..
include $(TOP)/configs/current
GLES_1_VERSION_MAJOR = 1
GLES_1_VERSION_MINOR = 1
GLES_1_VERSION_PATCH = 0
GLES_2_VERSION_MAJOR = 2
GLES_2_VERSION_MINOR = 0
GLES_2_VERSION_PATCH = 0
# Maybe move these into configs/default:
GLES_1_LIB = GLESv1_CM
GLES_1_LIB_NAME = lib$(GLES_1_LIB).so
GLES_2_LIB = GLESv2
GLES_2_LIB_NAME = lib$(GLES_2_LIB).so
INCLUDE_DIRS = \
-I$(TOP)/src/mesa \
-I$(TOP)/include
ES1_SOURCES = \
st_es1.c \
ES1_OBJECTS = $(ES1_SOURCES:.c=.o)
ES2_SOURCES = \
st_es2.c \
ES2_OBJECTS = $(ES2_SOURCES:.c=.o)
# we only need the gallium libs that the state trackers directly use:
GALLIUM_LIBS = \
$(TOP)/src/gallium/auxiliary/cso_cache/libcso_cache.a \
$(TOP)/src/gallium/auxiliary/rtasm/librtasm.a \
$(TOP)/src/gallium/auxiliary/tgsi/libtgsi.a \
$(TOP)/src/gallium/auxiliary/util/libutil.a
ES1_LIBS = \
$(TOP)/src/mesa/es/libes1gallium.a \
$(TOP)/src/mesa/es/libes1api.a
ES2_LIBS = \
$(TOP)/src/mesa/es/libes2gallium.a \
$(TOP)/src/mesa/es/libes2api.a
SYS_LIBS = -lm -pthread
.c.o:
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
# Default: make both GL ES 1.1 and GL ES 2.0 libraries
default: $(TOP)/$(LIB_DIR)/$(GLES_1_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLES_2_LIB_NAME)
# Make the shared libs
$(TOP)/$(LIB_DIR)/$(GLES_1_LIB_NAME): $(ES1_OBJECTS) $(ES1_LIBS)
$(TOP)/bin/mklib -o $(GLES_1_LIB) \
-major $(GLES_1_VERSION_MAJOR) \
-minor $(GLES_1_VERSION_MINOR) \
-patch $(GLES_1_VERSION_PATCH) \
-install $(TOP)/$(LIB_DIR) \
$(ES1_OBJECTS) \
-Wl,--whole-archive $(ES1_LIBS) -Wl,--no-whole-archive \
-Wl,--start-group $(GALLIUM_LIBS) -Wl,--end-group \
$(SYS_LIBS)
$(TOP)/$(LIB_DIR)/$(GLES_2_LIB_NAME): $(ES2_OBJECTS) $(ES1_LIBS)
$(TOP)/bin/mklib -o $(GLES_2_LIB) \
-major $(GLES_2_VERSION_MAJOR) \
-minor $(GLES_2_VERSION_MINOR) \
-patch $(GLES_2_VERSION_PATCH) \
-install $(TOP)/$(LIB_DIR) \
$(ES2_OBJECTS) \
-Wl,--whole-archive $(ES2_LIBS) -Wl,--no-whole-archive \
-Wl,--start-group $(GALLIUM_LIBS) -Wl,--end-group \
$(SYS_LIBS)
install: default
$(INSTALL) -d $(INSTALL_DIR)/include/GLES
$(INSTALL) -m 644 $(TOP)/include/GLES/*.h $(INSTALL_DIR)/include/GLES
$(INSTALL) -d $(INSTALL_DIR)/include/GLES2
$(INSTALL) -m 644 $(TOP)/include/GLES2/*.h $(INSTALL_DIR)/include/GLES2
$(INSTALL) -d $(INSTALL_DIR)/$(LIB_DIR)
$(INSTALL) $(TOP)/$(LIB_DIR)/libGLESv1* $(INSTALL_DIR)/$(LIB_DIR)
$(INSTALL) $(TOP)/$(LIB_DIR)/libGLESv2* $(INSTALL_DIR)/$(LIB_DIR)
clean:
-rm -f *.o *~
-rm -f $(TOP)/$(LIB_DIR)/$(GLES_1_LIB_NAME)* $(TOP)/$(LIB_DIR)/$(GLES_2_LIB_NAME)*
-rm -f *.pyc

View File

@@ -0,0 +1 @@
const int st_api_OpenGL_ES1 = 1;

View File

@@ -0,0 +1 @@
const int st_api_OpenGL_ES2 = 1;

181
src/mesa/Android.mk Normal file
View File

@@ -0,0 +1,181 @@
LOCAL_PATH := $(call my-dir)
MESA := $(LOCAL_PATH)
include $(LOCAL_PATH)/es/sources.mak
common_CFLAGS := \
-DUSE_EXTERNAL_DXTN_LIB=1 -DHAVE_ALIAS \
-DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING
common_CFLAGS += -DPTHREADS
# FIXME should we?
#common_CFLAGS += -DGLX_USE_TLS
ifeq ($(TARGET_ARCH),x86)
MESA_ASM_SOURCES := $(X86_SOURCES)
# GLAPI_ASM_SOURCES := $(X86_API)
common_CFLAGS += -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM \
-DUSE_SSE_ASM
endif
common_C_INCLUDES := \
$(LOCAL_PATH)/../../include \
$(LOCAL_PATH)/es/glapi/headers-es1 \
$(LOCAL_PATH)/es \
$(LOCAL_PATH)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := x86/gen_matypes.c
LOCAL_C_INCLUDES += $(common_C_INCLUDES)
LOCAL_CFLAGS += $(common_CFLAGS)
LOCAL_MODULE := gen_matypes
# build gen_matypes
ifeq ($(TARGET_ARCH),x86)
include $(BUILD_HOST_EXECUTABLE)
endif
include $(CLEAR_VARS)
mesa_SOURCES := $(ES1_MESA_SOURCES)
es1_SOURCES := $(addprefix es/, $(ES1_LOCAL_SOURCES))
LOCAL_SRC_FILES := \
$(mesa_SOURCES) \
$(es1_SOURCES) \
$(MESA_ASM_SOURCES)
LOCAL_C_INCLUDES += $(common_C_INCLUDES)
LOCAL_CFLAGS += \
-include es/main/mfeatures.h \
$(common_CFLAGS) \
-Wno-sign-compare
LOCAL_MODULE := libes1
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
# generate matypes.h
ifeq ($(TARGET_ARCH),x86)
intermediates := $(local-intermediates-dir)
GEN := $(intermediates)/matypes.h
$(GEN): PRIVATE_CUSTOM_TOOL = $(HOST_OUT_EXECUTABLES)/gen_matypes > $@
$(GEN): $(HOST_OUT_EXECUTABLES)/gen_matypes
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
LOCAL_C_INCLUDES += $(intermediates)
endif
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
$(ES1_API_SOURCES) \
$(GLAPI_ASM_SOURCES)
LOCAL_C_INCLUDES += $(common_C_INCLUDES)
LOCAL_CFLAGS += \
$(common_CFLAGS) \
-UUSE_X86_ASM \
-Wno-sign-compare
LOCAL_MODULE := libes1api
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
i915_SOURCES = \
i830_context.c \
i830_metaops.c \
i830_state.c \
i830_texblend.c \
i830_texstate.c \
i830_vtbl.c \
intel_render.c \
intel_regions.c \
intel_buffer_objects.c \
intel_batchbuffer.c \
intel_clear.c \
intel_eglimage.c \
intel_extensions.c \
intel_generatemipmap.c \
intel_mipmap_tree.c \
intel_tex_layout.c \
intel_tex_image.c \
intel_tex_subimage.c \
intel_tex_copy.c \
intel_tex_validate.c \
intel_tex_format.c \
intel_tex.c \
intel_pixel.c \
intel_pixel_read.c \
intel_buffers.c \
intel_blit.c \
intel_swapbuffers.c \
i915_tex_layout.c \
i915_texstate.c \
i915_context.c \
i915_debug.c \
i915_debug_fp.c \
i915_fragprog.c \
i915_metaops.c \
i915_program.c \
i915_state.c \
i915_vtbl.c \
intel_context.c \
intel_decode.c \
intel_screen.c \
intel_span.c \
intel_state.c \
intel_syncobj.c \
intel_tris.c \
intel_fbo.c
i915_SOURCES := $(addprefix drivers/dri/i915/, $(i915_SOURCES))
common_SOURCES = \
utils.c \
vblank.c \
dri_util.c \
xmlconfig.c \
texmem.c \
drirenderbuffer.c \
dri_metaops.c
common_SOURCES := $(addprefix drivers/dri/common/, $(common_SOURCES))
LOCAL_SRC_FILES := \
$(i915_SOURCES) \
$(common_SOURCES)
LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/drivers/dri/i915 \
$(LOCAL_PATH)/drivers/dri/common \
$(LOCAL_PATH)/drivers/dri/intel \
$(LOCAL_PATH)/drivers/dri/intel/server \
$(common_C_INCLUDES) \
external/drm/libdrm \
external/drm/libdrm/intel \
external/drm/shared-core \
external/expat/lib
LOCAL_CFLAGS += \
$(common_CFLAGS) \
-DI915 \
-DDRM_VBLANK_FLIP=DRM_VBLANK_FLIP \
-Wno-sign-compare
LOCAL_SHARED_LIBRARIES := libexpat libdrm libdrm_intel
LOCAL_STATIC_LIBRARIES := libes1
LOCAL_MODULE := i915_dri
LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
include $(BUILD_SHARED_LIBRARY)

View File

@@ -24,13 +24,18 @@
#include "main/glheader.h"
#include "main/accum.h"
#include "main/imports.h"
#include "main/arrayobj.h"
#include "main/buffers.h"
#include "main/colortab.h"
#include "main/context.h"
#include "main/convolve.h"
#include "main/drawpix.h"
#include "main/framebuffer.h"
#include "main/mipmap.h"
#include "main/queryobj.h"
#include "main/rastpos.h"
#include "main/renderbuffer.h"
#include "main/texcompress.h"
#include "main/texformat.h"
@@ -84,12 +89,13 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
/* framebuffer/image functions */
driver->Clear = _swrast_Clear;
driver->Accum = _swrast_Accum;
driver->RasterPos = _tnl_RasterPos;
driver->DrawPixels = _swrast_DrawPixels;
_MESA_INIT_ACCUM_FUNCTIONS(driver, _swrast_);
_MESA_INIT_DRAWPIX_FUNCTIONS(driver, _swrast_);
_MESA_INIT_RASTPOS_FUNCTIONS(driver, _tnl_);
driver->ReadPixels = _swrast_ReadPixels;
driver->CopyPixels = _swrast_CopyPixels;
driver->Bitmap = _swrast_Bitmap;
/* Texture functions */
driver->ChooseTextureFormat = _mesa_choose_tex_format;
@@ -129,10 +135,10 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
driver->UpdateTexturePalette = NULL;
/* imaging */
driver->CopyColorTable = _swrast_CopyColorTable;
driver->CopyColorSubTable = _swrast_CopyColorSubTable;
driver->CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
driver->CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
/* swrast does not need UpdateTexturePalette */
#define _swrast_UpdateTexturePalette NULL
_MESA_INIT_COLORTABLE_FUNCTIONS(driver, _swrast_);
_MESA_INIT_CONVOLVE_FUNCTIONS(driver, _swrast_);
/* Vertex/fragment programs */
driver->BindProgram = NULL;

View File

@@ -228,6 +228,16 @@ struct gen_mipmap_state
};
/**
* State for glDrawTex()
*/
struct drawtex_state
{
GLuint ArrayObj;
GLuint VBO;
};
/**
* All per-context meta state.
*/
@@ -243,6 +253,8 @@ struct gl_meta_state
struct drawpix_state DrawPix; /**< For _mesa_meta_draw_pixels() */
struct bitmap_state Bitmap; /**< For _mesa_meta_bitmap() */
struct gen_mipmap_state Mipmap; /**< For _mesa_meta_generate_mipmap() */
struct drawtex_state DrawTex; /**< For _mesa_meta_draw_tex() */
};
@@ -299,6 +311,11 @@ _mesa_meta_free(GLcontext *ctx)
_mesa_DeleteBuffersARB(1, & meta->Bitmap.VBO);
_mesa_DeleteVertexArraysAPPLE(1, &meta->Bitmap.ArrayObj);
_mesa_DeleteTextures(1, &meta->Bitmap.Tex.TexObj);
/* glDrawTex */
_mesa_DeleteBuffersARB(1, & meta->DrawTex.VBO);
_mesa_DeleteVertexArraysAPPLE(1, &meta->DrawTex.ArrayObj);
}
_mesa_free(ctx->Meta);
@@ -2037,3 +2054,132 @@ _mesa_meta_generate_mipmap(GLcontext *ctx, GLenum target,
/* restore (XXX add to meta_begin/end()? */
_mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboSave);
}
#if FEATURE_OES_draw_texture
/**
* Meta implementation of ctx->Driver.DrawTex() in terms
* of polygon rendering.
*/
void
_mesa_meta_draw_tex(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z,
GLfloat width, GLfloat height)
{
struct drawtex_state *drawtex = &ctx->Meta->DrawTex;
struct vertex {
GLfloat x, y, z, st[MAX_TEXTURE_UNITS][2];
};
struct vertex verts[4];
GLuint i;
_mesa_meta_begin(ctx, (META_RASTERIZATION |
META_SHADER |
META_TRANSFORM |
META_VERTEX |
META_VIEWPORT));
if (drawtex->ArrayObj == 0) {
/* one-time setup */
GLint active_texture;
/* create vertex array object */
_mesa_GenVertexArrays(1, &drawtex->ArrayObj);
_mesa_BindVertexArray(drawtex->ArrayObj);
/* create vertex array buffer */
_mesa_GenBuffersARB(1, &drawtex->VBO);
_mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, drawtex->VBO);
_mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts),
NULL, GL_DYNAMIC_DRAW_ARB);
/* client active texture is not part of the array object */
active_texture = ctx->Array.ActiveTexture;
/* setup vertex arrays */
_mesa_VertexPointer(3, GL_FLOAT, sizeof(struct vertex), OFFSET(x));
_mesa_EnableClientState(GL_VERTEX_ARRAY);
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
_mesa_ClientActiveTextureARB(GL_TEXTURE0 + i);
_mesa_TexCoordPointer(2, GL_FLOAT, sizeof(struct vertex), OFFSET(st[i]));
_mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY);
}
/* restore client active texture */
_mesa_ClientActiveTextureARB(GL_TEXTURE0 + active_texture);
}
else {
_mesa_BindVertexArray(drawtex->ArrayObj);
_mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, drawtex->VBO);
}
/* vertex positions, texcoords */
{
const GLfloat x1 = x + width;
const GLfloat y1 = y + height;
verts[0].x = x;
verts[0].y = y;
verts[0].z = z;
verts[1].x = x1;
verts[1].y = y;
verts[1].z = z;
verts[2].x = x1;
verts[2].y = y1;
verts[2].z = z;
verts[3].x = x;
verts[3].y = y1;
verts[3].z = z;
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
const struct gl_texture_object *texObj;
const struct gl_texture_image *texImage;
GLfloat s, t, s1, t1;
GLuint tw, th;
if (!ctx->Texture.Unit[i]._ReallyEnabled) {
GLuint j;
for (j = 0; j < 4; j++) {
verts[j].st[i][0] = 0.0f;
verts[j].st[i][1] = 0.0f;
}
continue;
}
texObj = ctx->Texture.Unit[i]._Current;
texImage = texObj->Image[0][texObj->BaseLevel];
tw = texImage->Width2;
th = texImage->Height2;
s = (GLfloat) texObj->CropRect[0] / tw;
t = (GLfloat) texObj->CropRect[1] / th;
s1 = (GLfloat) (texObj->CropRect[0] + texObj->CropRect[2]) / tw;
t1 = (GLfloat) (texObj->CropRect[1] + texObj->CropRect[3]) / th;
verts[0].st[i][0] = s;
verts[0].st[i][1] = t;
verts[1].st[i][0] = s1;
verts[1].st[i][1] = t;
verts[2].st[i][0] = s1;
verts[2].st[i][1] = t1;
verts[3].st[i][0] = s;
verts[3].st[i][1] = t1;
}
_mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
}
_mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
_mesa_meta_end(ctx);
}
#endif /* FEATURE_OES_draw_texture */

View File

@@ -87,5 +87,8 @@ extern void
_mesa_meta_generate_mipmap(GLcontext *ctx, GLenum target,
struct gl_texture_object *texObj);
extern void
_mesa_meta_draw_tex(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z,
GLfloat width, GLfloat height);
#endif /* META_H */

View File

@@ -0,0 +1,104 @@
# -*-makefile-*-
ES_VERSION ?= 1
DRIVER_DEFINES += -UIN_DRI_DRIVER
MESA_MODULES = $(TOP)/src/mesa/es/libes$(ES_VERSION).a
COMMON_GALLIUM_SOURCES = \
../common/utils.c \
../common/vblank.c \
../common/dri_util.c \
../common/xmlconfig.c
COMMON_SOURCES = $(COMMON_GALLIUM_SOURCES) \
../../common/driverfuncs.c \
../common/texmem.c \
../common/drirenderbuffer.c \
../common/dri_metaops.c
ifeq ($(WINDOW_SYSTEM),dri)
WINOBJ=
WINLIB=
INCLUDES = $(SHARED_INCLUDES) $(EXPAT_INCLUDES)
OBJECTS = $(C_SOURCES:.c=.o) \
$(ASM_SOURCES:.S=.o)
else
# miniglx
WINOBJ=
WINLIB=-L$(MESA)/src/glx/mini
MINIGLX_INCLUDES = -I$(TOP)/src/glx/mini
INCLUDES = $(MINIGLX_INCLUDES) \
$(SHARED_INCLUDES) \
$(PCIACCESS_CFLAGS)
OBJECTS = $(C_SOURCES:.c=.o) \
$(MINIGLX_SOURCES:.c=.o) \
$(ASM_SOURCES:.S=.o)
endif
### Include directories
SHARED_INCLUDES = \
-I. \
-I$(TOP)/src/mesa/drivers/dri/common \
-Iserver \
-I$(TOP)/src/mesa/es/glapi/headers-es$(ES_VERSION) \
-I$(TOP)/src/mesa/es \
-I$(TOP)/include \
-I$(TOP)/src/mesa \
-I$(TOP)/src/egl/main \
-I$(TOP)/src/egl/drivers/dri \
$(LIBDRM_CFLAGS)
##### RULES #####
.c.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@
.S.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@
##### TARGETS #####
default: symlinks depend $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME)
$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(PIPE_DRIVERS) $(WINOBJ) Makefile $(TOP)/src/mesa/drivers/dri/Makefile.template
$(MKLIB) -o $@ -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
$(OBJECTS) $(PIPE_DRIVERS) $(MESA_MODULES) $(WINOBJ) $(DRI_LIB_DEPS)
$(TOP)/$(LIB_DIR)/$(LIBNAME): $(LIBNAME)
$(INSTALL) $(LIBNAME) $(TOP)/$(LIB_DIR)
depend: $(C_SOURCES) $(ASM_SOURCES) $(SYMLINKS)
@ echo "running $(MKDEP)"
@ rm -f depend
@ touch depend
@ $(MKDEP) $(MKDEP_OPTIONS) $(DRIVER_DEFINES) $(INCLUDES) $(C_SOURCES) \
$(ASM_SOURCES) > /dev/null 2>/dev/null
# Emacs tags
tags:
etags `find . -name \*.[ch]` `find ../include`
# Remove .o and backup files
clean:
-rm -f *.o */*.o *~ *.so *~ server/*.o $(SYMLINKS)
-rm -f depend depend.bak
install: $(LIBNAME)
$(INSTALL) -d $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR)
$(MINSTALL) -m 755 $(LIBNAME) $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR)
-include depend

View File

@@ -32,6 +32,8 @@
# define NULL 0
#endif
#if defined(IN_DRI_DRIVER)
#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects)
static const char UniformMatrix3fvARB_names[] =
"iiip\0" /* Parameter signature */
@@ -1820,13 +1822,6 @@ static const char DeleteFencesNV_names[] =
"";
#endif
#if defined(need_GL_SGIX_polynomial_ffd)
static const char DeformationMap3dSGIX_names[] =
"iddiiddiiddiip\0" /* Parameter signature */
"glDeformationMap3dSGIX\0"
"";
#endif
#if defined(need_GL_VERSION_2_0)
static const char IsShader_names[] =
"i\0" /* Parameter signature */
@@ -2053,6 +2048,13 @@ static const char GetCombinerOutputParameterivNV_names[] =
"";
#endif
#if defined(need_GL_IBM_multimode_draw_arrays)
static const char MultiModeDrawArraysIBM_names[] =
"pppii\0" /* Parameter signature */
"glMultiModeDrawArraysIBM\0"
"";
#endif
#if defined(need_GL_SGIS_pixel_texture)
static const char PixelTexGenParameterivSGIS_names[] =
"ip\0" /* Parameter signature */
@@ -4004,13 +4006,6 @@ static const char VertexAttribs4dvNV_names[] =
"";
#endif
#if defined(need_GL_IBM_multimode_draw_arrays)
static const char MultiModeDrawArraysIBM_names[] =
"pppii\0" /* Parameter signature */
"glMultiModeDrawArraysIBM\0"
"";
#endif
#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
static const char VertexAttrib4dARB_names[] =
"idddd\0" /* Parameter signature */
@@ -4709,6 +4704,13 @@ static const char Minmax_names[] =
"";
#endif
#if defined(need_GL_SGIX_polynomial_ffd)
static const char DeformationMap3dSGIX_names[] =
"iddiiddiiddiip\0" /* Parameter signature */
"glDeformationMap3dSGIX\0"
"";
#endif
#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord)
static const char FogCoorddvEXT_names[] =
"p\0" /* Parameter signature */
@@ -6267,9 +6269,9 @@ static const struct dri_extension_function GL_SGIX_pixel_texture_functions[] = {
#if defined(need_GL_SGIX_polynomial_ffd)
static const struct dri_extension_function GL_SGIX_polynomial_ffd_functions[] = {
{ LoadIdentityDeformationMapSGIX_names, LoadIdentityDeformationMapSGIX_remap_index, -1 },
{ DeformationMap3dSGIX_names, DeformationMap3dSGIX_remap_index, -1 },
{ DeformSGIX_names, DeformSGIX_remap_index, -1 },
{ DeformationMap3fSGIX_names, DeformationMap3fSGIX_remap_index, -1 },
{ DeformationMap3dSGIX_names, DeformationMap3dSGIX_remap_index, -1 },
{ NULL, 0, 0 }
};
#endif
@@ -6637,3 +6639,463 @@ static const struct dri_extension_function GL_VERSION_2_1_functions[] = {
};
#endif
#else /* IN_DRI_DRIVER */
#if defined(need_GL_3DFX_tbuffer)
#define GL_3DFX_tbuffer_functions NULL
#endif
#if defined(need_GL_APPLE_flush_buffer_range)
#define GL_APPLE_flush_buffer_range_functions NULL
#endif
#if defined(need_GL_APPLE_texture_range)
#define GL_APPLE_texture_range_functions NULL
#endif
#if defined(need_GL_APPLE_vertex_array_object)
#define GL_APPLE_vertex_array_object_functions NULL
#endif
#if defined(need_GL_ARB_copy_buffer)
#define GL_ARB_copy_buffer_functions NULL
#endif
#if defined(need_GL_ARB_draw_buffers)
#define GL_ARB_draw_buffers_functions NULL
#endif
#if defined(need_GL_ARB_draw_elements_base_vertex)
#define GL_ARB_draw_elements_base_vertex_functions NULL
#endif
#if defined(need_GL_ARB_framebuffer_object)
#define GL_ARB_framebuffer_object_functions NULL
#endif
#if defined(need_GL_ARB_map_buffer_range)
#define GL_ARB_map_buffer_range_functions NULL
#endif
#if defined(need_GL_ARB_matrix_palette)
#define GL_ARB_matrix_palette_functions NULL
#endif
#if defined(need_GL_ARB_multisample)
#define GL_ARB_multisample_functions NULL
#endif
#if defined(need_GL_ARB_occlusion_query)
#define GL_ARB_occlusion_query_functions NULL
#endif
#if defined(need_GL_ARB_point_parameters)
#define GL_ARB_point_parameters_functions NULL
#endif
#if defined(need_GL_ARB_shader_objects)
#define GL_ARB_shader_objects_functions NULL
#endif
#if defined(need_GL_ARB_sync)
#define GL_ARB_sync_functions NULL
#endif
#if defined(need_GL_ARB_texture_compression)
#define GL_ARB_texture_compression_functions NULL
#endif
#if defined(need_GL_ARB_transpose_matrix)
#define GL_ARB_transpose_matrix_functions NULL
#endif
#if defined(need_GL_ARB_vertex_array_object)
#define GL_ARB_vertex_array_object_functions NULL
#endif
#if defined(need_GL_ARB_vertex_blend)
#define GL_ARB_vertex_blend_functions NULL
#endif
#if defined(need_GL_ARB_vertex_buffer_object)
#define GL_ARB_vertex_buffer_object_functions NULL
#endif
#if defined(need_GL_ARB_vertex_program)
#define GL_ARB_vertex_program_functions NULL
#endif
#if defined(need_GL_ARB_vertex_shader)
#define GL_ARB_vertex_shader_functions NULL
#endif
#if defined(need_GL_ARB_window_pos)
#define GL_ARB_window_pos_functions NULL
#endif
#if defined(need_GL_ATI_blend_equation_separate)
#define GL_ATI_blend_equation_separate_functions NULL
#endif
#if defined(need_GL_ATI_draw_buffers)
#define GL_ATI_draw_buffers_functions NULL
#endif
#if defined(need_GL_ATI_envmap_bumpmap)
#define GL_ATI_envmap_bumpmap_functions NULL
#endif
#if defined(need_GL_ATI_fragment_shader)
#define GL_ATI_fragment_shader_functions NULL
#endif
#if defined(need_GL_ATI_separate_stencil)
#define GL_ATI_separate_stencil_functions NULL
#endif
#if defined(need_GL_EXT_blend_color)
#define GL_EXT_blend_color_functions NULL
#endif
#if defined(need_GL_EXT_blend_equation_separate)
#define GL_EXT_blend_equation_separate_functions NULL
#endif
#if defined(need_GL_EXT_blend_func_separate)
#define GL_EXT_blend_func_separate_functions NULL
#endif
#if defined(need_GL_EXT_blend_minmax)
#define GL_EXT_blend_minmax_functions NULL
#endif
#if defined(need_GL_EXT_color_subtable)
#define GL_EXT_color_subtable_functions NULL
#endif
#if defined(need_GL_EXT_compiled_vertex_array)
#define GL_EXT_compiled_vertex_array_functions NULL
#endif
#if defined(need_GL_EXT_convolution)
#define GL_EXT_convolution_functions NULL
#endif
#if defined(need_GL_EXT_coordinate_frame)
#define GL_EXT_coordinate_frame_functions NULL
#endif
#if defined(need_GL_EXT_copy_texture)
#define GL_EXT_copy_texture_functions NULL
#endif
#if defined(need_GL_EXT_cull_vertex)
#define GL_EXT_cull_vertex_functions NULL
#endif
#if defined(need_GL_EXT_depth_bounds_test)
#define GL_EXT_depth_bounds_test_functions NULL
#endif
#if defined(need_GL_EXT_draw_range_elements)
#define GL_EXT_draw_range_elements_functions NULL
#endif
#if defined(need_GL_EXT_fog_coord)
#define GL_EXT_fog_coord_functions NULL
#endif
#if defined(need_GL_EXT_framebuffer_blit)
#define GL_EXT_framebuffer_blit_functions NULL
#endif
#if defined(need_GL_EXT_framebuffer_object)
#define GL_EXT_framebuffer_object_functions NULL
#endif
#if defined(need_GL_EXT_gpu_program_parameters)
#define GL_EXT_gpu_program_parameters_functions NULL
#endif
#if defined(need_GL_EXT_histogram)
#define GL_EXT_histogram_functions NULL
#endif
#if defined(need_GL_EXT_index_func)
#define GL_EXT_index_func_functions NULL
#endif
#if defined(need_GL_EXT_index_material)
#define GL_EXT_index_material_functions NULL
#endif
#if defined(need_GL_EXT_light_texture)
#define GL_EXT_light_texture_functions NULL
#endif
#if defined(need_GL_EXT_multi_draw_arrays)
#define GL_EXT_multi_draw_arrays_functions NULL
#endif
#if defined(need_GL_EXT_multisample)
#define GL_EXT_multisample_functions NULL
#endif
#if defined(need_GL_EXT_paletted_texture)
#define GL_EXT_paletted_texture_functions NULL
#endif
#if defined(need_GL_EXT_pixel_transform)
#define GL_EXT_pixel_transform_functions NULL
#endif
#if defined(need_GL_EXT_point_parameters)
#define GL_EXT_point_parameters_functions NULL
#endif
#if defined(need_GL_EXT_polygon_offset)
#define GL_EXT_polygon_offset_functions NULL
#endif
#if defined(need_GL_EXT_provoking_vertex)
#define GL_EXT_provoking_vertex_functions NULL
#endif
#if defined(need_GL_EXT_secondary_color)
#define GL_EXT_secondary_color_functions NULL
#endif
#if defined(need_GL_EXT_stencil_two_side)
#define GL_EXT_stencil_two_side_functions NULL
#endif
#if defined(need_GL_EXT_subtexture)
#define GL_EXT_subtexture_functions NULL
#endif
#if defined(need_GL_EXT_texture3D)
#define GL_EXT_texture3D_functions NULL
#endif
#if defined(need_GL_EXT_texture_array)
#define GL_EXT_texture_array_functions NULL
#endif
#if defined(need_GL_EXT_texture_object)
#define GL_EXT_texture_object_functions NULL
#endif
#if defined(need_GL_EXT_texture_perturb_normal)
#define GL_EXT_texture_perturb_normal_functions NULL
#endif
#if defined(need_GL_EXT_timer_query)
#define GL_EXT_timer_query_functions NULL
#endif
#if defined(need_GL_EXT_vertex_array)
#define GL_EXT_vertex_array_functions NULL
#endif
#if defined(need_GL_EXT_vertex_weighting)
#define GL_EXT_vertex_weighting_functions NULL
#endif
#if defined(need_GL_HP_image_transform)
#define GL_HP_image_transform_functions NULL
#endif
#if defined(need_GL_IBM_multimode_draw_arrays)
#define GL_IBM_multimode_draw_arrays_functions NULL
#endif
#if defined(need_GL_IBM_vertex_array_lists)
#define GL_IBM_vertex_array_lists_functions NULL
#endif
#if defined(need_GL_INGR_blend_func_separate)
#define GL_INGR_blend_func_separate_functions NULL
#endif
#if defined(need_GL_INTEL_parallel_arrays)
#define GL_INTEL_parallel_arrays_functions NULL
#endif
#if defined(need_GL_MESA_resize_buffers)
#define GL_MESA_resize_buffers_functions NULL
#endif
#if defined(need_GL_MESA_shader_debug)
#define GL_MESA_shader_debug_functions NULL
#endif
#if defined(need_GL_MESA_window_pos)
#define GL_MESA_window_pos_functions NULL
#endif
#if defined(need_GL_NV_evaluators)
#define GL_NV_evaluators_functions NULL
#endif
#if defined(need_GL_NV_fence)
#define GL_NV_fence_functions NULL
#endif
#if defined(need_GL_NV_fragment_program)
#define GL_NV_fragment_program_functions NULL
#endif
#if defined(need_GL_NV_point_sprite)
#define GL_NV_point_sprite_functions NULL
#endif
#if defined(need_GL_NV_register_combiners)
#define GL_NV_register_combiners_functions NULL
#endif
#if defined(need_GL_NV_register_combiners2)
#define GL_NV_register_combiners2_functions NULL
#endif
#if defined(need_GL_NV_vertex_array_range)
#define GL_NV_vertex_array_range_functions NULL
#endif
#if defined(need_GL_NV_vertex_program)
#define GL_NV_vertex_program_functions NULL
#endif
#if defined(need_GL_PGI_misc_hints)
#define GL_PGI_misc_hints_functions NULL
#endif
#if defined(need_GL_SGIS_detail_texture)
#define GL_SGIS_detail_texture_functions NULL
#endif
#if defined(need_GL_SGIS_fog_function)
#define GL_SGIS_fog_function_functions NULL
#endif
#if defined(need_GL_SGIS_multisample)
#define GL_SGIS_multisample_functions NULL
#endif
#if defined(need_GL_SGIS_pixel_texture)
#define GL_SGIS_pixel_texture_functions NULL
#endif
#if defined(need_GL_SGIS_point_parameters)
#define GL_SGIS_point_parameters_functions NULL
#endif
#if defined(need_GL_SGIS_sharpen_texture)
#define GL_SGIS_sharpen_texture_functions NULL
#endif
#if defined(need_GL_SGIS_texture4D)
#define GL_SGIS_texture4D_functions NULL
#endif
#if defined(need_GL_SGIS_texture_color_mask)
#define GL_SGIS_texture_color_mask_functions NULL
#endif
#if defined(need_GL_SGIS_texture_filter4)
#define GL_SGIS_texture_filter4_functions NULL
#endif
#if defined(need_GL_SGIX_async)
#define GL_SGIX_async_functions NULL
#endif
#if defined(need_GL_SGIX_flush_raster)
#define GL_SGIX_flush_raster_functions NULL
#endif
#if defined(need_GL_SGIX_fragment_lighting)
#define GL_SGIX_fragment_lighting_functions NULL
#endif
#if defined(need_GL_SGIX_framezoom)
#define GL_SGIX_framezoom_functions NULL
#endif
#if defined(need_GL_SGIX_igloo_interface)
#define GL_SGIX_igloo_interface_functions NULL
#endif
#if defined(need_GL_SGIX_instruments)
#define GL_SGIX_instruments_functions NULL
#endif
#if defined(need_GL_SGIX_list_priority)
#define GL_SGIX_list_priority_functions NULL
#endif
#if defined(need_GL_SGIX_pixel_texture)
#define GL_SGIX_pixel_texture_functions NULL
#endif
#if defined(need_GL_SGIX_polynomial_ffd)
#define GL_SGIX_polynomial_ffd_functions NULL
#endif
#if defined(need_GL_SGIX_reference_plane)
#define GL_SGIX_reference_plane_functions NULL
#endif
#if defined(need_GL_SGIX_sprite)
#define GL_SGIX_sprite_functions NULL
#endif
#if defined(need_GL_SGIX_tag_sample_buffer)
#define GL_SGIX_tag_sample_buffer_functions NULL
#endif
#if defined(need_GL_SGI_color_table)
#define GL_SGI_color_table_functions NULL
#endif
#if defined(need_GL_SUNX_constant_data)
#define GL_SUNX_constant_data_functions NULL
#endif
#if defined(need_GL_SUN_global_alpha)
#define GL_SUN_global_alpha_functions NULL
#endif
#if defined(need_GL_SUN_mesh_array)
#define GL_SUN_mesh_array_functions NULL
#endif
#if defined(need_GL_SUN_triangle_list)
#define GL_SUN_triangle_list_functions NULL
#endif
#if defined(need_GL_SUN_vertex)
#define GL_SUN_vertex_functions NULL
#endif
#if defined(need_GL_VERSION_1_3)
#define GL_VERSION_1_3_functions NULL
#endif
#if defined(need_GL_VERSION_1_4)
#define GL_VERSION_1_4_functions NULL
#endif
#if defined(need_GL_VERSION_1_5)
#define GL_VERSION_1_5_functions NULL
#endif
#if defined(need_GL_VERSION_2_0)
#define GL_VERSION_2_0_functions NULL
#endif
#if defined(need_GL_VERSION_2_1)
#define GL_VERSION_2_1_functions NULL
#endif
#endif /* IN_DRI_DRIVER */

View File

@@ -38,8 +38,16 @@
#include "utils.h"
#ifdef IN_DRI_DRIVER
int driDispatchRemapTable[ driDispatchRemapTable_size ];
#else /* IN_DRI_DRIVER */
#define driDispatchRemapTable_size 1
static int driDispatchRemapTable[ driDispatchRemapTable_size ];
#endif /* IN_DRI_DRIVER */
unsigned
driParseDebugString( const char * debug,

View File

@@ -18,6 +18,7 @@ DRIVER_SOURCES = \
intel_buffer_objects.c \
intel_batchbuffer.c \
intel_clear.c \
intel_eglimage.c \
intel_extensions.c \
intel_generatemipmap.c \
intel_mipmap_tree.c \
@@ -29,9 +30,6 @@ DRIVER_SOURCES = \
intel_tex_format.c \
intel_tex.c \
intel_pixel.c \
intel_pixel_bitmap.c \
intel_pixel_copy.c \
intel_pixel_draw.c \
intel_pixel_read.c \
intel_buffers.c \
intel_blit.c \
@@ -67,7 +65,7 @@ DRIVER_DEFINES = -I../intel -I../intel/server -DI915 \
DRI_LIB_DEPS += -ldrm_intel
include ../Makefile.template
include ../Makefile.es
intel_decode.o: ../intel/intel_decode.c

View File

@@ -60,6 +60,8 @@ translate_texture_format(GLuint mesa_format, GLuint internal_format,
return MAPSURF_32BIT | MT_32BIT_XRGB8888;
else
return MAPSURF_32BIT | MT_32BIT_ARGB8888;
case MESA_FORMAT_ARGB8888_REV:
return MAPSURF_32BIT | MT_32BIT_ABGR8888;
case MESA_FORMAT_YCBCR_REV:
return (MAPSURF_422 | MT_422_YCRCB_NORMAL);
case MESA_FORMAT_YCBCR:

View File

@@ -0,0 +1 @@
../intel/intel_eglimage.c

View File

@@ -0,0 +1 @@
../intel/intel_eglimage.h

View File

@@ -0,0 +1 @@
../common/utils.h

View File

@@ -27,7 +27,9 @@
#include "main/glheader.h"
#include "main/colortab.h"
#include "main/context.h"
#include "main/convolve.h"
#include "main/arrayobj.h"
#include "main/extensions.h"
#include "main/framebuffer.h"
@@ -52,6 +54,7 @@
#include "intel_regions.h"
#include "intel_buffer_objects.h"
#include "intel_fbo.h"
#include "intel_eglimage.h"
#include "intel_decode.h"
#include "intel_bufmgr.h"
#include "intel_screen.h"
@@ -587,10 +590,8 @@ intelInitDriverFunctions(struct dd_function_table *functions)
functions->GetString = intelGetString;
functions->UpdateState = intelInvalidateState;
functions->CopyColorTable = _swrast_CopyColorTable;
functions->CopyColorSubTable = _swrast_CopyColorSubTable;
functions->CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D;
functions->CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D;
_MESA_INIT_COLORTABLE_FUNCTIONS(functions, _swrast_);
_MESA_INIT_CONVOLVE_FUNCTIONS(functions, _swrast_);
intelInitTextureFuncs(functions);
intelInitTextureImageFuncs(functions);
@@ -602,6 +603,11 @@ intelInitDriverFunctions(struct dd_function_table *functions)
intelInitPixelFuncs(functions);
intelInitBufferObjectFuncs(functions);
intel_init_syncobj_functions(functions);
#if FEATURE_OES_draw_texture
functions->DrawTex = _mesa_meta_draw_tex;
#endif
intelInitEGLImageFuncs(functions);
}

View File

@@ -0,0 +1,139 @@
/**************************************************************************
*
* Copyright (C) 2009 Chia-I Wu <olvaffe@gmail.com>
* 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 TUNGSTEN GRAPHICS 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.
*
**************************************************************************/
#include "main/mtypes.h"
#include "main/teximage.h"
#include "intel_context.h"
#include "intel_fbo.h"
#include "intel_tex.h"
#include "intel_eglimage.h"
#include "main/eglimage.h"
#include "EGL/internal/eglimage_dri.h"
#if FEATURE_OES_EGL_image
/* move to intel_fbo.c */
static void
copy_renderbuffer(struct intel_renderbuffer *dst,
struct intel_renderbuffer *src)
{
dst->Base.Width = src->Base.Width;
dst->Base.Height = src->Base.Height;
dst->Base.InternalFormat = src->Base.InternalFormat;
dst->Base._ActualFormat = src->Base._ActualFormat;
dst->Base._BaseFormat = src->Base._BaseFormat;
dst->Base.ColorEncoding = src->Base.ColorEncoding;
dst->Base.ComponentType = src->Base.ComponentType;
dst->Base.RedBits = src->Base.RedBits;
dst->Base.GreenBits = src->Base.GreenBits;
dst->Base.BlueBits = src->Base.BlueBits;
dst->Base.AlphaBits = src->Base.AlphaBits;
dst->Base.IndexBits = src->Base.IndexBits;
dst->Base.DepthBits = src->Base.DepthBits;
dst->Base.StencilBits = src->Base.StencilBits;
dst->Base.NumSamples = src->Base.NumSamples;
dst->Base.DataType = src->Base.DataType;
intel_renderbuffer_set_region(dst, src->region);
}
static __DRIEGLImage *
get_image(GLcontext *ctx, GLeglImageOES image)
{
__DRIEGLImage *driImage;
driImage = _eglClientGetImageData((__DRIEGLImageHandle) image);
if (!driImage || driImage->magic != __DRI_EGL_IMAGE_MAGIC) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glEGLImageTargetTexture2DOES(image=0x%x)", image);
return NULL;
}
return driImage;
}
void
intelEGLImageTargetRenderbufferStorage(GLcontext *ctx,
struct gl_renderbuffer *rb,
GLeglImageOES image)
{
struct intel_renderbuffer *irb = intel_renderbuffer(rb);
__DRIEGLImage *driImage;
struct intel_framebuffer *image_fb;
struct intel_renderbuffer *image_rb;
driImage = get_image(ctx, image);
if (!driImage)
return;
image_fb = driImage->drawable->driverPrivate;
image_rb = image_fb->color_rb[0];
copy_renderbuffer(irb, image_rb);
}
void
intelEGLImageTargetTexture2D(GLcontext *ctx,
struct gl_texture_object *texObj,
GLeglImageOES image)
{
struct intel_context *intel = intel_context(ctx);
__DRIEGLImage *driImage;
GLint glx_texture_format;
driImage = get_image(ctx, image);
if (!driImage)
return;
/* only level == 0 is supported */
if (driImage->level) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glEGLImageTargetTexture2DOES(level=%d)", driImage->level);
return;
}
glx_texture_format = (driImage->texture_format_rgba)
? GLX_TEXTURE_FORMAT_RGBA_EXT : GLX_TEXTURE_FORMAT_RGB_EXT;
/* TODO refactor intelSetTexBuffer2 to avoid lock... */
_mesa_unlock_texture(ctx, texObj);
intelSetTexBuffer2(intel->driContext, texObj->Target, glx_texture_format,
driImage->drawable);
_mesa_lock_texture(ctx, texObj);
}
#endif /* FEATURE_OES_EGL_image */

View File

@@ -0,0 +1,61 @@
/**************************************************************************
*
* Copyright (C) 2009 Chia-I Wu <olvaffe@gmail.com>
* 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 TUNGSTEN GRAPHICS 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 INTEL_EGLIMAGE_H
#define INTEL_EGLIMAGE_H
#include "main/mtypes.h"
/* main/eglimage.h might not exist */
#if FEATURE_OES_EGL_image
#ifndef GL_OES_EGL_image
typedef void *GLeglImageOES;
#endif
#include "main/eglimage.h"
extern void
intelEGLImageTargetRenderbufferStorage(GLcontext *ctx,
struct gl_renderbuffer *rb,
GLeglImageOES image);
extern void
intelEGLImageTargetTexture2D(GLcontext *ctx,
struct gl_texture_object *texObj,
GLeglImageOES image);
#else
#define _MESA_INIT_EGLIMAGE_FUNCTIONS(driver, impl) do { } while (0)
#endif /* FEATURE_OES_EGL_image */
static INLINE void
intelInitEGLImageFuncs(struct dd_function_table *functions)
{
_MESA_INIT_EGLIMAGE_FUNCTIONS(functions, intel);
}
#endif /* INTEL_EGLIMAGE_H */

View File

@@ -179,6 +179,12 @@ static const struct dri_extension ttm_extensions[] = {
{ "GL_ARB_pixel_buffer_object", NULL },
{ "GL_EXT_framebuffer_blit", GL_EXT_framebuffer_blit_functions },
{ "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions },
#if FEATURE_OES_EGL_image
{ "GL_OES_EGL_image", NULL },
#endif
#if FEATURE_OES_draw_texture
{ "GL_OES_draw_texture", NULL },
#endif
{ NULL, NULL }
};

View File

@@ -715,5 +715,7 @@ intel_fbo_init(struct intel_context *intel)
intel->ctx.Driver.FinishRenderTexture = intel_finish_render_texture;
intel->ctx.Driver.ResizeBuffers = intel_resize_buffers;
intel->ctx.Driver.ValidateFramebuffer = intel_validate_framebuffer;
#if FEATURE_EXT_framebuffer_blit
intel->ctx.Driver.BlitFramebuffer = _mesa_meta_blit_framebuffer;
#endif
}

View File

@@ -48,7 +48,6 @@
#include "main/hash.h"
#include "main/mipmap.h"
#include "main/blend.h"
#include "glapi/dispatch.h"
#include "swrast/swrast.h"
#include "intel_screen.h"
@@ -58,6 +57,7 @@
#include "intel_tex.h"
#include "intel_mipmap_tree.h"
#if FEATURE_attrib_stack
static const char *intel_fp_tex2d =
"!!ARBfp1.0\n"
"TEX result.color, fragment.texcoord[0], texture[0], 2D;\n"
@@ -215,6 +215,7 @@ fail:
return success;
}
#endif /* FEATURE_attrib_stack */
/**
@@ -238,6 +239,7 @@ intel_generate_mipmap(GLcontext *ctx, GLenum target,
GLuint nr_faces = (intelObj->base.Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
int face, i;
#if FEATURE_attrib_stack
/* HW path */
if (target == GL_TEXTURE_2D &&
ctx->Extensions.EXT_framebuffer_object &&
@@ -255,6 +257,7 @@ intel_generate_mipmap(GLcontext *ctx, GLenum target,
if (success)
return;
}
#endif /* FEATURE_attrib_stack */
/* SW path */
intel_tex_map_level_images(intel, intelObj, texObj->BaseLevel);

View File

@@ -25,6 +25,8 @@
*
**************************************************************************/
#include "main/accum.h"
#include "main/drawpix.h"
#include "main/enums.h"
#include "main/state.h"
#include "main/bufferobj.h"
@@ -179,11 +181,9 @@ intel_check_blit_format(struct intel_region * region,
void
intelInitPixelFuncs(struct dd_function_table *functions)
{
functions->Accum = _swrast_Accum;
_MESA_INIT_ACCUM_FUNCTIONS(functions, _swrast_);
if (!getenv("INTEL_NO_BLIT")) {
functions->Bitmap = intelBitmap;
functions->CopyPixels = intelCopyPixels;
functions->DrawPixels = intelDrawPixels;
_MESA_INIT_DRAWPIX_FUNCTIONS(functions, intel);
}
functions->ReadPixels = intelReadPixels;
}

View File

@@ -25,6 +25,7 @@
*
**************************************************************************/
#include <sys/ioctl.h>
#include "main/glheader.h"
#include "main/context.h"
#include "main/framebuffer.h"
@@ -229,6 +230,50 @@ static const __DRItexBufferExtension intelTexBufferExtension = {
intelSetTexBuffer2,
};
static int
intelCopyBufferExt(__DRIcontext *context,
__DRIbuffer *dst,
int dst_x, int dst_y,
__DRIdrawable *src, unsigned int src_attachment,
int x, int y, int width, int height)
{
struct intel_framebuffer *intel_fb = src->driverPrivate;
struct intel_context *intel = context->driverPrivate;
struct intel_region *dst_region;
struct intel_renderbuffer *rb;
if (src_attachment != __DRI_BUFFER_FRONT_LEFT)
return -1;
dst_region = intel_region_alloc_for_handle(intel,
dst->cpp,
dst_x + width,
dst_y + height,
dst->pitch / dst->cpp,
dst->name,
"copyBuffer dst temp");
intel_update_renderbuffers(context, src);
rb = intel_fb->color_rb[0];
intel_region_copy(intel, dst_region, 0, dst_x, dst_y,
rb->region, 0, x, y, width, height, GL_COPY);
intel_batchbuffer_flush(intel->batch);
intel_region_release(&dst_region);
if (ioctl(intel->driFd, DRM_IOCTL_I915_GEM_THROTTLE, NULL) < 0) {
fprintf(stderr, "throttle failed: %m\n");
return -1;
}
return 0;
}
static const __DRIcopyBufferExtension intelCopyBufferExtension = {
{ __DRI_COPY_BUFFER, __DRI_COPY_BUFFER_VERSION },
intelCopyBufferExt,
};
static const __DRIextension *intelScreenExtensions[] = {
&driReadDrawableExtension,
&driCopySubBufferExtension.base,
@@ -237,6 +282,7 @@ static const __DRIextension *intelScreenExtensions[] = {
&driMediaStreamCounterExtension.base,
&intelTexOffsetExtension.base,
&intelTexBufferExtension.base,
&intelCopyBufferExtension.base,
NULL
};

View File

@@ -45,6 +45,8 @@
#include "intel_batchbuffer.h"
#include "intel_reg.h"
#if FEATURE_ARB_sync
static struct gl_sync_object *
intel_new_sync_object(GLcontext *ctx, GLuint id)
{
@@ -130,3 +132,11 @@ void intel_init_syncobj_functions(struct dd_function_table *functions)
functions->ClientWaitSync = intel_client_wait_sync;
functions->ServerWaitSync = intel_server_wait_sync;
}
#else /* FEATURE_ARB_sync */
void intel_init_syncobj_functions(struct dd_function_table *functions)
{
}
#endif

View File

@@ -34,7 +34,7 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat,
case GL_COMPRESSED_RGBA:
if (format == GL_BGRA) {
if (type == GL_UNSIGNED_BYTE || type == GL_UNSIGNED_INT_8_8_8_8_REV) {
return &_mesa_texformat_argb8888;
return &_mesa_texformat_argb8888_rev;
}
else if (type == GL_UNSIGNED_SHORT_4_4_4_4_REV) {
return &_mesa_texformat_argb4444;

115
src/mesa/es/Makefile Normal file
View File

@@ -0,0 +1,115 @@
# src/mesa/es/Makefile
#
TOP := ../../..
MESA := ..
include $(TOP)/configs/current
include sources.mak
# no libes1.a and libes2.a by default
ES1_LIBS := libes1.a libes1gallium.a libes1api.a
ES2_LIBS := libes2.a libes2gallium.a libes2api.a
# Default rule: create ES1 and ES2 libs
.PHONY: default
default: subdirs $(ES1_LIBS) $(ES2_LIBS)
# force the inclusion of es's mfeatures.h
ES1_CFLAGS := -include main/mfeatures.h -D__GL_EXPORTS -UIN_DRI_DRIVER
ES2_CFLAGS := $(ES1_CFLAGS)
# rebuild when these files are changed
ES1_GLAPI_DEPS := glapi/headers-es1/glapi/dispatch.h
ES2_GLAPI_DEPS := glapi/headers-es2/glapi/dispatch.h
ES1_OBJ_DIR := objs-es1
ES2_OBJ_DIR := objs-es2
# adjust output dir
ES1_OBJECTS := $(addprefix $(ES1_OBJ_DIR)/, $(ES1_OBJECTS))
ES1_GALLIUM_OBJECTS := $(addprefix $(ES1_OBJ_DIR)/, $(ES1_GALLIUM_OBJECTS))
ES1_API_OBJECTS := $(addprefix $(ES1_OBJ_DIR)/, $(ES1_API_OBJECTS))
ES2_OBJECTS := $(addprefix $(ES2_OBJ_DIR)/, $(ES2_OBJECTS))
ES2_GALLIUM_OBJECTS := $(addprefix $(ES2_OBJ_DIR)/, $(ES2_GALLIUM_OBJECTS))
ES2_API_OBJECTS := $(addprefix $(ES2_OBJ_DIR)/, $(ES2_API_OBJECTS))
# specify prerequisites
$(foreach obj,$(ALL_LOCAL_OBJECTS), \
$(eval $(ES1_OBJ_DIR)/$(obj): $(obj:.o=.c) $(ES1_GLAPI_DEPS)) \
$(eval $(ES2_OBJ_DIR)/$(obj): $(obj:.o=.c) $(ES2_GLAPI_DEPS)))
$(foreach obj,$(ALL_MESA_OBJECTS), \
$(eval $(ES1_OBJ_DIR)/$(obj): $(MESA)/$(obj:.o=.c) $(ES1_GLAPI_DEPS)) \
$(eval $(ES2_OBJ_DIR)/$(obj): $(MESA)/$(obj:.o=.c) $(ES2_GLAPI_DEPS)))
# sort to remove duplicates
ES1_ANY_OBJECTS := $(sort $(ES1_OBJECTS) $(ES1_GALLIUM_OBJECTS))
ES2_ANY_OBJECTS := $(sort $(ES2_OBJECTS) $(ES2_GALLIUM_OBJECTS))
$(ES1_ANY_OBJECTS):
@mkdir -p $(dir $@)
$(CC) -c $(CFLAGS) $(ES1_CFLAGS) $(ES1_INCLUDES) $< -o $@
$(ES1_API_OBJECTS):
@mkdir -p $(dir $@)
$(CC) -c $(CFLAGS) $(ES1_CFLAGS) -UIN_DRI_DRIVER $(ES1_INCLUDES) $< -o $@
$(ES2_ANY_OBJECTS):
@mkdir -p $(dir $@)
$(CC) -c $(CFLAGS) $(ES2_CFLAGS) $(ES2_INCLUDES) $< -o $@
$(ES2_API_OBJECTS):
@mkdir -p $(dir $@)
$(CC) -c $(CFLAGS) $(ES2_CFLAGS) -UIN_DRI_DRIVER $(ES2_INCLUDES) $< -o $@
libes1.a: $(ES1_OBJECTS)
@echo "Making $@"
@$(TOP)/bin/mklib -o es1 -static $(ES1_OBJECTS)
libes2.a: $(ES2_OBJECTS)
@echo "Making $@"
@$(TOP)/bin/mklib -o es2 -static $(ES1_OBJECTS)
libes1gallium.a: $(ES1_GALLIUM_OBJECTS)
@echo "Making $@"
@$(TOP)/bin/mklib -o es1gallium -static $(ES1_GALLIUM_OBJECTS)
libes2gallium.a: $(ES2_GALLIUM_OBJECTS)
@echo "Making $@"
@$(TOP)/bin/mklib -o es2gallium -static $(ES2_GALLIUM_OBJECTS)
libes1api.a: $(ES1_API_OBJECTS)
@echo "Making $@"
@$(TOP)/bin/mklib -o es1api -static $(ES1_API_OBJECTS)
libes2api.a: $(ES2_API_OBJECTS)
@echo "Making $@"
@$(TOP)/bin/mklib -o es2api -static $(ES2_API_OBJECTS)
GENERATED_SOURCES := \
main/api_exec_es1.c \
main/api_exec_es2.c \
main/get_es1.c \
main/get_es2.c
main/api_exec_es1.c: main/APIspec.txt main/es_generator.py main/apiutil.py main/es1_special
$(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.txt -V GLES1.1 > $@
main/api_exec_es2.c: main/APIspec.txt main/es_generator.py main/apiutil.py main/es2_special
$(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.txt -V GLES2.0 > $@
main/get_es1.c: main/get_gen.py
$(PYTHON2) $(PYTHON_FLAGS) $< 1 > $@
main/get_es2.c: main/get_gen.py
$(PYTHON2) $(PYTHON_FLAGS) $< 2 > $@
subdirs:
make -C glapi
.PHONY: clean
clean:
-rm -f $(ES1_LIBS) $(ES2_LIBS)
-rm -rf $(ES1_OBJ_DIR) $(ES2_OBJ_DIR)
-rm -f $(GENERATED_SOURCES)
-rm -f *~

View File

@@ -0,0 +1,65 @@
TOP = ../../../..
GLAPI = ../../glapi
include $(TOP)/configs/current
OUTPUTS := glprocs.h glapitemp.h glapioffsets.h glapitable.h dispatch.h
COMMON = gl_XML.py glX_XML.py license.py typeexpr.py
COMMON := $(addprefix $(GLAPI)/, $(COMMON))
ES1_APIXML := es1_API.xml
ES2_APIXML := es2_API.xml
ES1_OUTPUT_DIR := headers-es1
ES2_OUTPUT_DIR := headers-es2
ES1_DEPS = $(ES1_APIXML) base1_API.xml es1_EXT.xml es_EXT.xml \
es1_COMPAT.xml es_COMPAT.xml
ES2_DEPS = $(ES2_APIXML) base2_API.xml es2_EXT.xml es_EXT.xml \
es2_COMPAT.xml es_COMPAT.xml
ES1_OUTPUTS := $(addprefix $(ES1_OUTPUT_DIR)/glapi/, $(OUTPUTS))
ES2_OUTPUTS := $(addprefix $(ES2_OUTPUT_DIR)/glapi/, $(OUTPUTS))
all: $(ES1_OUTPUTS) $(ES2_OUTPUTS)
$(ES1_OUTPUTS): APIXML := $(ES1_APIXML)
$(ES2_OUTPUTS): APIXML := $(ES2_APIXML)
$(ES1_OUTPUTS): $(ES1_DEPS)
$(ES2_OUTPUTS): $(ES2_DEPS)
%/glprocs.h: $(GLAPI)/gl_procs.py $(COMMON)
@mkdir -p $(dir $@)
$(PYTHON2) $(PYTHON_FLAGS) $< -f $(APIXML) -c > $@
%/glapitemp.h: $(GLAPI)/gl_apitemp.py $(COMMON)
@mkdir -p $(dir $@)
$(PYTHON2) $(PYTHON_FLAGS) $< -f $(APIXML) > $@
%/glapioffsets.h: $(GLAPI)/gl_offsets.py $(COMMON)
@mkdir -p $(dir $@)
$(PYTHON2) $(PYTHON_FLAGS) $< -f $(APIXML) -c > $@
%/glapitable.h: $(GLAPI)/gl_table.py $(COMMON)
@mkdir -p $(dir $@)
$(PYTHON2) $(PYTHON_FLAGS) $< -f $(APIXML) -c > $@
%/dispatch.h: $(GLAPI)/gl_table.py $(COMMON)
@mkdir -p $(dir $@)
$(PYTHON2) $(PYTHON_FLAGS) $< -f $(APIXML) -m remap_table -c > $@
verify_xml:
@if [ ! -f gl.h ]; then \
echo "Please copy gl.h and gl2.h to this directory"; \
exit 1; \
fi
@echo "Verifying that es1_API.xml covers OpenGL ES 1.1..."
@$(PYTHON2) $(PYTHON_FLAGS) gl_parse_header.py gl.h > tmp.xml
@$(PYTHON2) $(PYTHON_FLAGS) gl_compare.py difference tmp.xml es1_API.xml
@echo "Verifying that es2_API.xml covers OpenGL ES 2.0..."
@$(PYTHON2) $(PYTHON_FLAGS) gl_parse_header.py gl2.h > tmp.xml
@$(PYTHON2) $(PYTHON_FLAGS) gl_compare.py difference tmp.xml es2_API.xml
@rm -f tmp.xml
clean:
-rm -rf $(ES1_OUTPUT_DIR) $(ES2_OUTPUT_DIR)
-rm -f *~ *.pyc *.pyo

View File

@@ -0,0 +1,760 @@
<?xml version="1.0"?>
<!DOCTYPE OpenGLAPI SYSTEM "../../glapi/gl_API.dtd">
<!-- OpenGL and OpenGL ES 1.x APIs
This file defines the base categories that can be shared by all APIs.
They are defined in an incremental fashion. The "es" variant of a
category, if exists, is not usually used, except for OpenGL ES 1.0.
-->
<OpenGLAPI>
<!-- base subset of OpenGL 1.0, excluding those not in OpenGL ES 1.0 -->
<category name="base1.0es">
<enum name="FALSE" value="0x0"/>
<enum name="TRUE" value="0x1"/>
<enum name="ZERO" value="0x0"/>
<enum name="ONE" value="0x1"/>
<enum name="NO_ERROR" value="0x0"/>
<enum name="POINTS" value="0x0000"/>
<enum name="LINES" value="0x0001"/>
<enum name="LINE_LOOP" value="0x0002"/>
<enum name="LINE_STRIP" value="0x0003"/>
<enum name="TRIANGLES" value="0x0004"/>
<enum name="TRIANGLE_STRIP" value="0x0005"/>
<enum name="TRIANGLE_FAN" value="0x0006"/>
<enum name="NEVER" value="0x0200"/>
<enum name="LESS" value="0x0201"/>
<enum name="EQUAL" value="0x0202"/>
<enum name="LEQUAL" value="0x0203"/>
<enum name="GREATER" value="0x0204"/>
<enum name="NOTEQUAL" value="0x0205"/>
<enum name="GEQUAL" value="0x0206"/>
<enum name="ALWAYS" value="0x0207"/>
<enum name="SRC_COLOR" value="0x0300"/>
<enum name="ONE_MINUS_SRC_COLOR" value="0x0301"/>
<enum name="SRC_ALPHA" value="0x0302"/>
<enum name="ONE_MINUS_SRC_ALPHA" value="0x0303"/>
<enum name="DST_ALPHA" value="0x0304"/>
<enum name="ONE_MINUS_DST_ALPHA" value="0x0305"/>
<enum name="DST_COLOR" value="0x0306"/>
<enum name="ONE_MINUS_DST_COLOR" value="0x0307"/>
<enum name="SRC_ALPHA_SATURATE" value="0x0308"/>
<enum name="FRONT" value="0x0404"/>
<enum name="BACK" value="0x0405"/>
<enum name="FRONT_AND_BACK" value="0x0408"/>
<enum name="INVALID_ENUM" value="0x0500"/>
<enum name="INVALID_VALUE" value="0x0501"/>
<enum name="INVALID_OPERATION" value="0x0502"/>
<enum name="OUT_OF_MEMORY" value="0x0505"/>
<enum name="CW" value="0x0900"/>
<enum name="CCW" value="0x0901"/>
<enum name="CULL_FACE" count="1" value="0x0B44">
<size name="Get" mode="get"/>
</enum>
<enum name="DEPTH_TEST" count="1" value="0x0B71">
<size name="Get" mode="get"/>
</enum>
<enum name="STENCIL_TEST" count="1" value="0x0B90">
<size name="Get" mode="get"/>
</enum>
<enum name="DITHER" count="1" value="0x0BD0">
<size name="Get" mode="get"/>
</enum>
<enum name="BLEND" count="1" value="0x0BE2">
<size name="Get" mode="get"/>
</enum>
<enum name="SCISSOR_TEST" count="1" value="0x0C11">
<size name="Get" mode="get"/>
</enum>
<enum name="UNPACK_ALIGNMENT" count="1" value="0x0CF5">
<size name="Get" mode="get"/>
</enum>
<enum name="PACK_ALIGNMENT" count="1" value="0x0D05">
<size name="Get" mode="get"/>
</enum>
<enum name="MAX_TEXTURE_SIZE" count="1" value="0x0D33">
<size name="Get" mode="get"/>
</enum>
<enum name="MAX_VIEWPORT_DIMS" count="2" value="0x0D3A">
<size name="Get" mode="get"/>
</enum>
<enum name="SUBPIXEL_BITS" count="1" value="0x0D50">
<size name="Get" mode="get"/>
</enum>
<enum name="RED_BITS" count="1" value="0x0D52">
<size name="Get" mode="get"/>
</enum>
<enum name="GREEN_BITS" count="1" value="0x0D53">
<size name="Get" mode="get"/>
</enum>
<enum name="BLUE_BITS" count="1" value="0x0D54">
<size name="Get" mode="get"/>
</enum>
<enum name="ALPHA_BITS" count="1" value="0x0D55">
<size name="Get" mode="get"/>
</enum>
<enum name="DEPTH_BITS" count="1" value="0x0D56">
<size name="Get" mode="get"/>
</enum>
<enum name="STENCIL_BITS" count="1" value="0x0D57">
<size name="Get" mode="get"/>
</enum>
<enum name="TEXTURE_2D" count="1" value="0x0DE1">
<size name="Get" mode="get"/>
</enum>
<enum name="DONT_CARE" value="0x1100"/>
<enum name="FASTEST" value="0x1101"/>
<enum name="NICEST" value="0x1102"/>
<enum name="BYTE" count="1" value="0x1400">
<size name="CallLists"/>
</enum>
<enum name="UNSIGNED_BYTE" count="1" value="0x1401">
<size name="CallLists"/>
</enum>
<enum name="SHORT" count="2" value="0x1402">
<size name="CallLists"/>
</enum>
<enum name="UNSIGNED_SHORT" count="2" value="0x1403">
<size name="CallLists"/>
</enum>
<enum name="FLOAT" count="4" value="0x1406">
<size name="CallLists"/>
</enum>
<enum name="INVERT" value="0x150A"/>
<enum name="TEXTURE" value="0x1702"/>
<enum name="ALPHA" value="0x1906"/>
<enum name="RGB" value="0x1907"/>
<enum name="RGBA" value="0x1908"/>
<enum name="LUMINANCE" value="0x1909"/>
<enum name="LUMINANCE_ALPHA" value="0x190A"/>
<enum name="KEEP" value="0x1E00"/>
<enum name="REPLACE" value="0x1E01"/>
<enum name="INCR" value="0x1E02"/>
<enum name="DECR" value="0x1E03"/>
<enum name="VENDOR" value="0x1F00"/>
<enum name="RENDERER" value="0x1F01"/>
<enum name="VERSION" value="0x1F02"/>
<enum name="EXTENSIONS" value="0x1F03"/>
<enum name="NEAREST" value="0x2600"/>
<enum name="LINEAR" value="0x2601"/>
<enum name="NEAREST_MIPMAP_NEAREST" value="0x2700"/>
<enum name="LINEAR_MIPMAP_NEAREST" value="0x2701"/>
<enum name="NEAREST_MIPMAP_LINEAR" value="0x2702"/>
<enum name="LINEAR_MIPMAP_LINEAR" value="0x2703"/>
<enum name="TEXTURE_MAG_FILTER" count="1" value="0x2800">
<size name="TexParameterfv"/>
<size name="TexParameteriv"/>
<size name="GetTexParameterfv" mode="get"/>
<size name="GetTexParameteriv" mode="get"/>
</enum>
<enum name="TEXTURE_MIN_FILTER" count="1" value="0x2801">
<size name="TexParameterfv"/>
<size name="TexParameteriv"/>
<size name="GetTexParameterfv" mode="get"/>
<size name="GetTexParameteriv" mode="get"/>
</enum>
<enum name="TEXTURE_WRAP_S" count="1" value="0x2802">
<size name="TexParameterfv"/>
<size name="TexParameteriv"/>
<size name="GetTexParameterfv" mode="get"/>
<size name="GetTexParameteriv" mode="get"/>
</enum>
<enum name="TEXTURE_WRAP_T" count="1" value="0x2803">
<size name="TexParameterfv"/>
<size name="TexParameteriv"/>
<size name="GetTexParameterfv" mode="get"/>
<size name="GetTexParameteriv" mode="get"/>
</enum>
<enum name="REPEAT" value="0x2901"/>
<enum name="DEPTH_BUFFER_BIT" value="0x00000100"/>
<enum name="STENCIL_BUFFER_BIT" value="0x00000400"/>
<enum name="COLOR_BUFFER_BIT" value="0x00004000"/>
<type name="float" size="4" float="true" glx_name="FLOAT32"/>
<type name="clampf" size="4" float="true" glx_name="FLOAT32"/>
<type name="int" size="4" glx_name="CARD32"/>
<type name="uint" size="4" unsigned="true" glx_name="CARD32"/>
<type name="sizei" size="4" glx_name="CARD32"/>
<type name="enum" size="4" unsigned="true" glx_name="ENUM"/>
<type name="bitfield" size="4" unsigned="true" glx_name="CARD32"/>
<type name="short" size="2" glx_name="CARD16"/>
<type name="ushort" size="2" unsigned="true" glx_name="CARD16"/>
<type name="byte" size="1" glx_name="CARD8"/>
<type name="ubyte" size="1" unsigned="true" glx_name="CARD8"/>
<type name="boolean" size="1" unsigned="true" glx_name="CARD8"/>
<type name="void" size="1"/>
<function name="BlendFunc" offset="241">
<param name="sfactor" type="GLenum"/>
<param name="dfactor" type="GLenum"/>
<glx rop="160"/>
</function>
<function name="Clear" offset="203">
<param name="mask" type="GLbitfield"/>
<glx rop="127"/>
</function>
<function name="ClearColor" offset="206">
<param name="red" type="GLclampf"/>
<param name="green" type="GLclampf"/>
<param name="blue" type="GLclampf"/>
<param name="alpha" type="GLclampf"/>
<glx rop="130"/>
</function>
<function name="ClearStencil" offset="207">
<param name="s" type="GLint"/>
<glx rop="131"/>
</function>
<function name="ColorMask" offset="210">
<param name="red" type="GLboolean"/>
<param name="green" type="GLboolean"/>
<param name="blue" type="GLboolean"/>
<param name="alpha" type="GLboolean"/>
<glx rop="134"/>
</function>
<function name="CullFace" offset="152">
<param name="mode" type="GLenum"/>
<glx rop="79"/>
</function>
<function name="DepthFunc" offset="245">
<param name="func" type="GLenum"/>
<glx rop="164"/>
</function>
<function name="DepthMask" offset="211">
<param name="flag" type="GLboolean"/>
<glx rop="135"/>
</function>
<function name="Disable" offset="214">
<param name="cap" type="GLenum"/>
<glx rop="138" handcode="client"/>
</function>
<function name="Enable" offset="215">
<param name="cap" type="GLenum"/>
<glx rop="139" handcode="client"/>
</function>
<function name="Finish" offset="216">
<glx sop="108" handcode="true"/>
</function>
<function name="Flush" offset="217">
<glx sop="142" handcode="true"/>
</function>
<function name="FrontFace" offset="157">
<param name="mode" type="GLenum"/>
<glx rop="84"/>
</function>
<function name="GetError" offset="261">
<return type="GLenum"/>
<glx sop="115" handcode="client"/>
</function>
<function name="GetIntegerv" offset="263">
<param name="pname" type="GLenum"/>
<param name="params" type="GLint *" output="true" variable_param="pname"/>
<glx sop="117" handcode="client"/>
</function>
<function name="GetString" offset="275">
<param name="name" type="GLenum"/>
<return type="const GLubyte *"/>
<glx sop="129" handcode="true"/>
</function>
<function name="Hint" offset="158">
<param name="target" type="GLenum"/>
<param name="mode" type="GLenum"/>
<glx rop="85"/>
</function>
<function name="LineWidth" offset="168">
<param name="width" type="GLfloat"/>
<glx rop="95"/>
</function>
<function name="PixelStorei" offset="250">
<param name="pname" type="GLenum"/>
<param name="param" type="GLint"/>
<glx sop="110" handcode="client"/>
</function>
<function name="ReadPixels" offset="256">
<param name="x" type="GLint"/>
<param name="y" type="GLint"/>
<param name="width" type="GLsizei"/>
<param name="height" type="GLsizei"/>
<param name="format" type="GLenum"/>
<param name="type" type="GLenum"/>
<param name="pixels" type="GLvoid *" output="true" img_width="width" img_height="height" img_format="format" img_type="type" img_target="0"/>
<glx sop="111"/>
</function>
<function name="Scissor" offset="176">
<param name="x" type="GLint"/>
<param name="y" type="GLint"/>
<param name="width" type="GLsizei"/>
<param name="height" type="GLsizei"/>
<glx rop="103"/>
</function>
<function name="StencilFunc" offset="243">
<param name="func" type="GLenum"/>
<param name="ref" type="GLint"/>
<param name="mask" type="GLuint"/>
<glx rop="162"/>
</function>
<function name="StencilMask" offset="209">
<param name="mask" type="GLuint"/>
<glx rop="133"/>
</function>
<function name="StencilOp" offset="244">
<param name="fail" type="GLenum"/>
<param name="zfail" type="GLenum"/>
<param name="zpass" type="GLenum"/>
<glx rop="163"/>
</function>
<function name="TexParameterf" offset="178">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="param" type="GLfloat"/>
<glx rop="105"/>
</function>
<function name="Viewport" offset="305">
<param name="x" type="GLint"/>
<param name="y" type="GLint"/>
<param name="width" type="GLsizei"/>
<param name="height" type="GLsizei"/>
<glx rop="191"/>
</function>
</category>
<!-- base subset of OpenGL 1.1, excluding those not in OpenGL ES 1.0 -->
<category name="base1.1es">
<enum name="POLYGON_OFFSET_FILL" value="0x8037"/>
<function name="BindTexture" offset="307">
<param name="target" type="GLenum"/>
<param name="texture" type="GLuint"/>
<glx rop="4117"/>
</function>
<function name="CopyTexImage2D" offset="324">
<param name="target" type="GLenum"/>
<param name="level" type="GLint"/>
<param name="internalformat" type="GLenum"/>
<param name="x" type="GLint"/>
<param name="y" type="GLint"/>
<param name="width" type="GLsizei"/>
<param name="height" type="GLsizei"/>
<param name="border" type="GLint"/>
<glx rop="4120"/>
</function>
<function name="CopyTexSubImage2D" offset="326">
<param name="target" type="GLenum"/>
<param name="level" type="GLint"/>
<param name="xoffset" type="GLint"/>
<param name="yoffset" type="GLint"/>
<param name="x" type="GLint"/>
<param name="y" type="GLint"/>
<param name="width" type="GLsizei"/>
<param name="height" type="GLsizei"/>
<glx rop="4122"/>
</function>
<function name="DeleteTextures" offset="327">
<param name="n" type="GLsizei" counter="true"/>
<param name="textures" type="const GLuint *" count="n"/>
<glx sop="144"/>
</function>
<function name="DrawArrays" offset="310">
<param name="mode" type="GLenum"/>
<param name="first" type="GLint"/>
<param name="count" type="GLsizei"/>
<glx rop="193" handcode="true"/>
</function>
<function name="DrawElements" offset="311">
<param name="mode" type="GLenum"/>
<param name="count" type="GLsizei"/>
<param name="type" type="GLenum"/>
<param name="indices" type="const GLvoid *"/>
<glx handcode="true"/>
</function>
<function name="GenTextures" offset="328">
<param name="n" type="GLsizei" counter="true"/>
<param name="textures" type="GLuint *" output="true" count="n"/>
<glx sop="145" always_array="true"/>
</function>
<function name="PolygonOffset" offset="319">
<param name="factor" type="GLfloat"/>
<param name="units" type="GLfloat"/>
<glx rop="192"/>
</function>
<function name="TexSubImage2D" offset="333">
<param name="target" type="GLenum"/>
<param name="level" type="GLint"/>
<param name="xoffset" type="GLint"/>
<param name="yoffset" type="GLint"/>
<param name="width" type="GLsizei"/>
<param name="height" type="GLsizei"/>
<param name="format" type="GLenum"/>
<param name="type" type="GLenum"/>
<param name="UNUSED" type="GLuint" padding="true"/>
<param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_xoff="xoffset" img_yoff="yoffset" img_format="format" img_type="type" img_target="target" img_pad_dimensions="true"/>
<glx rop="4100" large="true"/>
</function>
</category>
<!-- base subset of OpenGL 1.2, excluding those not in OpenGL ES 1.0 -->
<category name="base1.2es">
<enum name="UNSIGNED_SHORT_4_4_4_4" value="0x8033"/>
<enum name="UNSIGNED_SHORT_5_5_5_1" value="0x8034"/>
<enum name="CLAMP_TO_EDGE" value="0x812F"/>
<enum name="UNSIGNED_SHORT_5_6_5" value="0x8363"/>
<enum name="ALIASED_POINT_SIZE_RANGE" count="2" value="0x846D">
<size name="Get" mode="get"/>
</enum>
<enum name="ALIASED_LINE_WIDTH_RANGE" count="2" value="0x846E">
<size name="Get" mode="get"/>
</enum>
</category>
<!-- base subset of OpenGL 1.3, excluding those not in OpenGL ES 1.0 -->
<category name="base1.3es">
<enum name="SAMPLE_ALPHA_TO_COVERAGE" count="1" value="0x809E">
<size name="Get" mode="get"/>
</enum>
<enum name="SAMPLE_COVERAGE" count="1" value="0x80A0">
<size name="Get" mode="get"/>
</enum>
<enum name="TEXTURE0" value="0x84C0"/>
<enum name="TEXTURE1" value="0x84C1"/>
<enum name="TEXTURE2" value="0x84C2"/>
<enum name="TEXTURE3" value="0x84C3"/>
<enum name="TEXTURE4" value="0x84C4"/>
<enum name="TEXTURE5" value="0x84C5"/>
<enum name="TEXTURE6" value="0x84C6"/>
<enum name="TEXTURE7" value="0x84C7"/>
<enum name="TEXTURE8" value="0x84C8"/>
<enum name="TEXTURE9" value="0x84C9"/>
<enum name="TEXTURE10" value="0x84CA"/>
<enum name="TEXTURE11" value="0x84CB"/>
<enum name="TEXTURE12" value="0x84CC"/>
<enum name="TEXTURE13" value="0x84CD"/>
<enum name="TEXTURE14" value="0x84CE"/>
<enum name="TEXTURE15" value="0x84CF"/>
<enum name="TEXTURE16" value="0x84D0"/>
<enum name="TEXTURE17" value="0x84D1"/>
<enum name="TEXTURE18" value="0x84D2"/>
<enum name="TEXTURE19" value="0x84D3"/>
<enum name="TEXTURE20" value="0x84D4"/>
<enum name="TEXTURE21" value="0x84D5"/>
<enum name="TEXTURE22" value="0x84D6"/>
<enum name="TEXTURE23" value="0x84D7"/>
<enum name="TEXTURE24" value="0x84D8"/>
<enum name="TEXTURE25" value="0x84D9"/>
<enum name="TEXTURE26" value="0x84DA"/>
<enum name="TEXTURE27" value="0x84DB"/>
<enum name="TEXTURE28" value="0x84DC"/>
<enum name="TEXTURE29" value="0x84DD"/>
<enum name="TEXTURE30" value="0x84DE"/>
<enum name="TEXTURE31" value="0x84DF"/>
<enum name="NUM_COMPRESSED_TEXTURE_FORMATS" count="1" value="0x86A2">
<size name="Get" mode="get"/>
</enum>
<enum name="COMPRESSED_TEXTURE_FORMATS" count="-1" value="0x86A3">
<size name="Get" mode="get"/>
</enum>
<function name="ActiveTexture" offset="374">
<param name="texture" type="GLenum"/>
<glx rop="197"/>
</function>
<function name="CompressedTexImage2D" offset="assign">
<param name="target" type="GLenum"/>
<param name="level" type="GLint"/>
<param name="internalformat" type="GLenum"/>
<param name="width" type="GLsizei"/>
<param name="height" type="GLsizei"/>
<param name="border" type="GLint"/>
<param name="imageSize" type="GLsizei" counter="true"/>
<param name="data" type="const GLvoid *" count="imageSize"/>
<glx rop="215" handcode="client"/>
</function>
<function name="CompressedTexSubImage2D" offset="assign">
<param name="target" type="GLenum"/>
<param name="level" type="GLint"/>
<param name="xoffset" type="GLint"/>
<param name="yoffset" type="GLint"/>
<param name="width" type="GLsizei"/>
<param name="height" type="GLsizei"/>
<param name="format" type="GLenum"/>
<param name="imageSize" type="GLsizei" counter="true"/>
<param name="data" type="const GLvoid *" count="imageSize"/>
<glx rop="218" handcode="client"/>
</function>
<function name="SampleCoverage" offset="assign">
<param name="value" type="GLclampf"/>
<param name="invert" type="GLboolean"/>
<glx rop="229"/>
</function>
</category>
<!-- base subset of OpenGL 1.0 -->
<category name="base1.0">
<!-- addition to base1.0es -->
<enum name="LINE_WIDTH" count="1" value="0x0B21">
<size name="Get" mode="get"/>
</enum>
<enum name="CULL_FACE_MODE" count="1" value="0x0B45">
<size name="Get" mode="get"/>
</enum>
<enum name="FRONT_FACE" count="1" value="0x0B46">
<size name="Get" mode="get"/>
</enum>
<enum name="DEPTH_RANGE" count="2" value="0x0B70">
<size name="Get" mode="get"/>
</enum>
<enum name="DEPTH_WRITEMASK" count="1" value="0x0B72">
<size name="Get" mode="get"/>
</enum>
<enum name="DEPTH_CLEAR_VALUE" count="1" value="0x0B73">
<size name="Get" mode="get"/>
</enum>
<enum name="DEPTH_FUNC" count="1" value="0x0B74">
<size name="Get" mode="get"/>
</enum>
<enum name="STENCIL_CLEAR_VALUE" count="1" value="0x0B91">
<size name="Get" mode="get"/>
</enum>
<enum name="STENCIL_FUNC" count="1" value="0x0B92">
<size name="Get" mode="get"/>
</enum>
<enum name="STENCIL_VALUE_MASK" count="1" value="0x0B93">
<size name="Get" mode="get"/>
</enum>
<enum name="STENCIL_FAIL" count="1" value="0x0B94">
<size name="Get" mode="get"/>
</enum>
<enum name="STENCIL_PASS_DEPTH_FAIL" count="1" value="0x0B95">
<size name="Get" mode="get"/>
</enum>
<enum name="STENCIL_PASS_DEPTH_PASS" count="1" value="0x0B96">
<size name="Get" mode="get"/>
</enum>
<enum name="STENCIL_REF" count="1" value="0x0B97">
<size name="Get" mode="get"/>
</enum>
<enum name="STENCIL_WRITEMASK" count="1" value="0x0B98">
<size name="Get" mode="get"/>
</enum>
<enum name="VIEWPORT" count="4" value="0x0BA2">
<size name="Get" mode="get"/>
</enum>
<enum name="SCISSOR_BOX" count="4" value="0x0C10">
<size name="Get" mode="get"/>
</enum>
<enum name="COLOR_CLEAR_VALUE" count="4" value="0x0C22">
<size name="Get" mode="get"/>
</enum>
<enum name="COLOR_WRITEMASK" count="4" value="0x0C23">
<size name="Get" mode="get"/>
</enum>
<function name="TexParameterfv" offset="179">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfloat *" variable_param="pname"/>
<glx rop="106"/>
</function>
<function name="TexParameteri" offset="180">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="param" type="GLint"/>
<glx rop="107"/>
</function>
<function name="TexParameteriv" offset="181">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="const GLint *" variable_param="pname"/>
<glx rop="108"/>
</function>
<function name="GetBooleanv" offset="258">
<param name="pname" type="GLenum"/>
<param name="params" type="GLboolean *" output="true" variable_param="pname"/>
<glx sop="112" handcode="client"/>
</function>
<function name="GetFloatv" offset="262">
<param name="pname" type="GLenum"/>
<param name="params" type="GLfloat *" output="true" variable_param="pname"/>
<glx sop="116" handcode="client"/>
</function>
<function name="GetTexParameterfv" offset="282">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLfloat *" output="true" variable_param="pname"/>
<glx sop="136"/>
</function>
<function name="GetTexParameteriv" offset="283">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLint *" output="true" variable_param="pname"/>
<glx sop="137"/>
</function>
<function name="IsEnabled" offset="286">
<param name="cap" type="GLenum"/>
<return type="GLboolean"/>
<glx sop="140" handcode="client"/>
</function>
</category>
<!-- base subset of OpenGL 1.1 -->
<category name="base1.1">
<!-- addition to base1.1es -->
<enum name="POLYGON_OFFSET_UNITS" count="1" value="0x2A00">
<size name="Get" mode="get"/>
</enum>
<enum name="POLYGON_OFFSET_FACTOR" count="1" value="0x8038">
<size name="Get" mode="get"/>
</enum>
<enum name="TEXTURE_BINDING_2D" count="1" value="0x8069">
<size name="Get" mode="get"/>
</enum>
<function name="IsTexture" offset="330">
<param name="texture" type="GLuint"/>
<return type="GLboolean"/>
<glx sop="146"/>
</function>
</category>
<!-- base subset of OpenGL 1.2 -->
<category name="base1.2">
<!-- addition to base1.2es -->
<!-- No new functions, types, enums. -->
</category>
<!-- base subset of OpenGL 1.3 -->
<category name="base1.3">
<!-- addition to base1.3es -->
<enum name="SAMPLE_BUFFERS" count="1" value="0x80A8">
<size name="Get" mode="get"/>
</enum>
<enum name="SAMPLES" count="1" value="0x80A9">
<size name="Get" mode="get"/>
</enum>
<enum name="SAMPLE_COVERAGE_VALUE" count="1" value="0x80AA">
<size name="Get" mode="get"/>
</enum>
<enum name="SAMPLE_COVERAGE_INVERT" count="1" value="0x80AB">
<size name="Get" mode="get"/>
</enum>
<enum name="ACTIVE_TEXTURE" count="1" value="0x84E0">
<size name="Get" mode="get"/>
</enum>
</category>
<!-- base subset of OpenGL 1.4 -->
<category name="base1.4">
<enum name="GENERATE_MIPMAP_HINT" value="0x8192"/>
</category>
<!-- base subset of OpenGL 1.5 -->
<category name="base1.5">
<enum name="BUFFER_SIZE" value="0x8764"/>
<enum name="BUFFER_USAGE" value="0x8765"/>
<enum name="ARRAY_BUFFER" value="0x8892"/>
<enum name="ELEMENT_ARRAY_BUFFER" value="0x8893"/>
<enum name="ARRAY_BUFFER_BINDING" value="0x8894"/>
<enum name="ELEMENT_ARRAY_BUFFER_BINDING" value="0x8895"/>
<enum name="STATIC_DRAW" value="0x88E4"/>
<enum name="DYNAMIC_DRAW" value="0x88E8"/>
<type name="intptr" size="4" glx_name="CARD32"/>
<type name="sizeiptr" size="4" glx_name="CARD32"/>
<function name="BindBuffer" offset="assign">
<param name="target" type="GLenum"/>
<param name="buffer" type="GLuint"/>
<glx ignore="true"/>
</function>
<function name="BufferData" offset="assign">
<param name="target" type="GLenum"/>
<param name="size" type="GLsizeiptr" counter="true"/>
<param name="data" type="const GLvoid *" count="size" img_null_flag="true"/>
<param name="usage" type="GLenum"/>
<glx ignore="true"/>
</function>
<function name="BufferSubData" offset="assign">
<param name="target" type="GLenum"/>
<param name="offset" type="GLintptr"/>
<param name="size" type="GLsizeiptr" counter="true"/>
<param name="data" type="const GLvoid *" count="size"/>
<glx ignore="true"/>
</function>
<function name="DeleteBuffers" offset="assign">
<param name="n" type="GLsizei" counter="true"/>
<param name="buffer" type="const GLuint *" count="n"/>
<glx ignore="true"/>
</function>
<function name="GenBuffers" offset="assign">
<param name="n" type="GLsizei" counter="true"/>
<param name="buffer" type="GLuint *" output="true" count="n"/>
<glx ignore="true"/>
</function>
<function name="GetBufferParameteriv" offset="assign">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLint *" output="true" variable_param="pname"/>
<glx ignore="true"/>
</function>
<function name="IsBuffer" offset="assign">
<param name="buffer" type="GLuint"/>
<return type="GLboolean"/>
<glx ignore="true"/>
</function>
</category>
</OpenGLAPI>

View File

@@ -0,0 +1,533 @@
<?xml version="1.0"?>
<!DOCTYPE OpenGLAPI SYSTEM "../../glapi/gl_API.dtd">
<!-- OpenGL and OpenGL ES 2.x APIs -->
<OpenGLAPI>
<xi:include href="base1_API.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<!-- base subset of OpenGL 2.0 -->
<category name="base2.0">
<enum name="BLEND_EQUATION_RGB" count="1" value="0x8009"> <!-- same as BLEND_EQUATION -->
<size name="Get" mode="get"/>
</enum>
<enum name="VERTEX_ATTRIB_ARRAY_ENABLED" count="1" value="0x8622">
<size name="GetVertexAttribdv" mode="get"/>
<size name="GetVertexAttribfv" mode="get"/>
<size name="GetVertexAttribiv" mode="get"/>
</enum>
<enum name="VERTEX_ATTRIB_ARRAY_SIZE" count="1" value="0x8623">
<size name="GetVertexAttribdv" mode="get"/>
<size name="GetVertexAttribfv" mode="get"/>
<size name="GetVertexAttribiv" mode="get"/>
</enum>
<enum name="VERTEX_ATTRIB_ARRAY_STRIDE" count="1" value="0x8624">
<size name="GetVertexAttribdv" mode="get"/>
<size name="GetVertexAttribfv" mode="get"/>
<size name="GetVertexAttribiv" mode="get"/>
</enum>
<enum name="VERTEX_ATTRIB_ARRAY_TYPE" count="1" value="0x8625">
<size name="GetVertexAttribdv" mode="get"/>
<size name="GetVertexAttribfv" mode="get"/>
<size name="GetVertexAttribiv" mode="get"/>
</enum>
<enum name="CURRENT_VERTEX_ATTRIB" count="1" value="0x8626">
<size name="GetVertexAttribdv" mode="get"/>
<size name="GetVertexAttribfv" mode="get"/>
<size name="GetVertexAttribiv" mode="get"/>
</enum>
<enum name="VERTEX_ATTRIB_ARRAY_POINTER" value="0x8645"/>
<enum name="STENCIL_BACK_FUNC" count="1" value="0x8800">
<size name="Get" mode="get"/>
</enum>
<enum name="STENCIL_BACK_FAIL" count="1" value="0x8801">
<size name="Get" mode="get"/>
</enum>
<enum name="STENCIL_BACK_PASS_DEPTH_FAIL" count="1" value="0x8802">
<size name="Get" mode="get"/>
</enum>
<enum name="STENCIL_BACK_PASS_DEPTH_PASS" count="1" value="0x8803">
<size name="Get" mode="get"/>
</enum>
<enum name="BLEND_EQUATION_ALPHA" count="1" value="0x883D">
<size name="Get" mode="get"/>
</enum>
<enum name="MAX_VERTEX_ATTRIBS" count="1" value="0x8869">
<size name="Get" mode="get"/>
</enum>
<enum name="VERTEX_ATTRIB_ARRAY_NORMALIZED" value="0x886A"/>
<enum name="MAX_TEXTURE_IMAGE_UNITS" count="1" value="0x8872">
<size name="Get" mode="get"/>
</enum>
<enum name="FRAGMENT_SHADER" value="0x8B30"/>
<enum name="VERTEX_SHADER" value="0x8B31"/>
<enum name="MAX_VERTEX_TEXTURE_IMAGE_UNITS" value="0x8B4C"/>
<enum name="MAX_COMBINED_TEXTURE_IMAGE_UNITS" value="0x8B4D"/>
<enum name="SHADER_TYPE" value="0x8B4F"/>
<enum name="FLOAT_VEC2" value="0x8B50"/>
<enum name="FLOAT_VEC3" value="0x8B51"/>
<enum name="FLOAT_VEC4" value="0x8B52"/>
<enum name="INT_VEC2" value="0x8B53"/>
<enum name="INT_VEC3" value="0x8B54"/>
<enum name="INT_VEC4" value="0x8B55"/>
<enum name="BOOL" value="0x8B56"/>
<enum name="BOOL_VEC2" value="0x8B57"/>
<enum name="BOOL_VEC3" value="0x8B58"/>
<enum name="BOOL_VEC4" value="0x8B59"/>
<enum name="FLOAT_MAT2" value="0x8B5A"/>
<enum name="FLOAT_MAT3" value="0x8B5B"/>
<enum name="FLOAT_MAT4" value="0x8B5C"/>
<enum name="SAMPLER_2D" value="0x8B5E"/>
<enum name="SAMPLER_CUBE" value="0x8B60"/>
<enum name="DELETE_STATUS" value="0x8B80"/>
<enum name="COMPILE_STATUS" value="0x8B81"/>
<enum name="LINK_STATUS" value="0x8B82"/>
<enum name="VALIDATE_STATUS" value="0x8B83"/>
<enum name="INFO_LOG_LENGTH" value="0x8B84"/>
<enum name="ATTACHED_SHADERS" value="0x8B85"/>
<enum name="ACTIVE_UNIFORMS" value="0x8B86"/>
<enum name="ACTIVE_UNIFORM_MAX_LENGTH" value="0x8B87"/>
<enum name="SHADER_SOURCE_LENGTH" value="0x8B88"/>
<enum name="ACTIVE_ATTRIBUTES" value="0x8B89"/>
<enum name="ACTIVE_ATTRIBUTE_MAX_LENGTH" value="0x8B8A"/>
<enum name="SHADING_LANGUAGE_VERSION" value="0x8B8C"/>
<enum name="CURRENT_PROGRAM" value="0x8B8D"/>
<enum name="STENCIL_BACK_REF" value="0x8CA3"/>
<enum name="STENCIL_BACK_VALUE_MASK" value="0x8CA4"/>
<enum name="STENCIL_BACK_WRITEMASK" value="0x8CA5"/>
<type name="char" size="1" glx_name="CARD8"/>
<function name="AttachShader" offset="assign">
<param name="program" type="GLuint"/>
<param name="shader" type="GLuint"/>
<glx ignore="true"/>
</function>
<function name="BindAttribLocation" offset="assign">
<param name="program" type="GLuint"/>
<param name="index" type="GLuint"/>
<param name="name" type="const GLchar *"/>
<glx ignore="true"/>
</function>
<function name="BlendEquationSeparate" offset="assign">
<param name="modeRGB" type="GLenum"/>
<param name="modeA" type="GLenum"/>
<glx rop="4228"/>
</function>
<function name="CompileShader" offset="assign">
<param name="shader" type="GLuint"/>
<glx ignore="true"/>
</function>
<function name="CreateProgram" offset="assign">
<return type="GLuint"/>
<glx ignore="true"/>
</function>
<function name="CreateShader" offset="assign">
<param name="type" type="GLenum"/>
<return type="GLuint"/>
<glx ignore="true"/>
</function>
<function name="DeleteProgram" offset="assign">
<param name="program" type="GLuint"/>
<glx ignore="true"/>
</function>
<function name="DeleteShader" offset="assign">
<param name="program" type="GLuint"/>
<glx ignore="true"/>
</function>
<function name="DetachShader" offset="assign">
<param name="program" type="GLuint"/>
<param name="shader" type="GLuint"/>
<glx ignore="true"/>
</function>
<function name="DisableVertexAttribArray" offset="assign">
<param name="index" type="GLuint"/>
<glx ignore="true"/>
</function>
<function name="EnableVertexAttribArray" offset="assign">
<param name="index" type="GLuint"/>
<glx ignore="true"/>
</function>
<function name="GetActiveAttrib" offset="assign">
<param name="program" type="GLuint"/>
<param name="index" type="GLuint"/>
<param name="bufSize" type="GLsizei "/>
<param name="length" type="GLsizei *" output="true"/>
<param name="size" type="GLint *" output="true"/>
<param name="type" type="GLenum *" output="true"/>
<param name="name" type="GLchar *" output="true"/>
<glx ignore="true"/>
</function>
<function name="GetActiveUniform" offset="assign">
<param name="program" type="GLuint"/>
<param name="index" type="GLuint"/>
<param name="bufSize" type="GLsizei"/>
<param name="length" type="GLsizei *" output="true"/>
<param name="size" type="GLint *" output="true"/>
<param name="type" type="GLenum *" output="true"/>
<param name="name" type="GLchar *" output="true"/>
<glx ignore="true"/>
</function>
<function name="GetAttachedShaders" offset="assign">
<param name="program" type="GLuint"/>
<param name="maxCount" type="GLsizei"/>
<param name="count" type="GLsizei *" output="true"/>
<param name="obj" type="GLuint *" output="true"/>
<glx ignore="true"/>
</function>
<function name="GetAttribLocation" offset="assign">
<param name="program" type="GLuint"/>
<param name="name" type="const GLchar *"/>
<return type="GLint"/>
<glx ignore="true"/>
</function>
<function name="GetProgramiv" offset="assign">
<param name="program" type="GLuint"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLint *"/>
<glx ignore="true"/>
</function>
<function name="GetProgramInfoLog" offset="assign">
<param name="program" type="GLuint"/>
<param name="bufSize" type="GLsizei"/>
<param name="length" type="GLsizei *"/>
<param name="infoLog" type="GLchar *"/>
<glx ignore="true"/>
</function>
<function name="GetShaderiv" offset="assign">
<param name="shader" type="GLuint"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLint *"/>
<glx ignore="true"/>
</function>
<function name="GetShaderInfoLog" offset="assign">
<param name="shader" type="GLuint"/>
<param name="bufSize" type="GLsizei"/>
<param name="length" type="GLsizei *"/>
<param name="infoLog" type="GLchar *"/>
<glx ignore="true"/>
</function>
<function name="GetShaderSource" offset="assign">
<param name="shader" type="GLuint"/>
<param name="bufSize" type="GLsizei"/>
<param name="length" type="GLsizei *" output="true"/>
<param name="source" type="GLchar *" output="true"/>
<glx ignore="true"/>
</function>
<function name="GetUniformfv" offset="assign">
<param name="program" type="GLuint"/>
<param name="location" type="GLint"/>
<param name="params" type="GLfloat *" output="true"/>
<glx ignore="true"/>
</function>
<function name="GetUniformiv" offset="assign">
<param name="program" type="GLuint"/>
<param name="location" type="GLint"/>
<param name="params" type="GLint *"/>
<glx ignore="true"/>
</function>
<function name="GetUniformLocation" offset="assign">
<param name="program" type="GLuint"/>
<param name="name" type="const GLchar *"/>
<return type="GLint"/>
<glx ignore="true"/>
</function>
<function name="GetVertexAttribfv" offset="assign">
<param name="index" type="GLuint"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLfloat *" output="true" variable_param="pname"/>
<glx ignore="true"/>
</function>
<function name="GetVertexAttribiv" offset="assign">
<param name="index" type="GLuint"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLint *" output="true" variable_param="pname"/>
<glx ignore="true"/>
</function>
<function name="GetVertexAttribPointerv" offset="assign">
<param name="index" type="GLuint"/>
<param name="pname" type="GLenum"/>
<param name="pointer" type="GLvoid **" output="true"/>
<glx ignore="true"/>
</function>
<function name="IsProgram" offset="assign">
<param name="program" type="GLuint"/>
<return type="GLboolean"/>
<glx ignore="true"/>
</function>
<function name="IsShader" offset="assign">
<param name="shader" type="GLuint"/>
<return type="GLboolean"/>
<glx ignore="true"/>
</function>
<function name="LinkProgram" offset="assign">
<param name="program" type="GLuint"/>
<glx ignore="true"/>
</function>
<function name="ShaderSource" offset="assign">
<param name="shader" type="GLuint"/>
<param name="count" type="GLsizei"/>
<param name="string" type="const GLchar **"/>
<param name="length" type="const GLint *"/>
<glx ignore="true"/>
</function>
<function name="StencilFuncSeparate" offset="assign">
<param name="face" type="GLenum"/>
<param name="func" type="GLenum"/>
<param name="ref" type="GLint"/>
<param name="mask" type="GLuint"/>
<glx ignore="true"/>
</function>
<function name="StencilOpSeparate" offset="assign">
<param name="face" type="GLenum"/>
<param name="sfail" type="GLenum"/>
<param name="zfail" type="GLenum"/>
<param name="zpass" type="GLenum"/>
<glx ignore="true"/>
</function>
<function name="StencilMaskSeparate" offset="assign">
<param name="face" type="GLenum"/>
<param name="mask" type="GLuint"/>
<glx ignore="true"/>
</function>
<function name="Uniform1f" offset="assign">
<param name="location" type="GLint"/>
<param name="v0" type="GLfloat"/>
<glx ignore="true"/>
</function>
<function name="Uniform1fv" offset="assign">
<param name="location" type="GLint"/>
<param name="count" type="GLsizei"/>
<param name="value" type="const GLfloat *"/>
<glx ignore="true"/>
</function>
<function name="Uniform1i" offset="assign">
<param name="location" type="GLint"/>
<param name="v0" type="GLint"/>
<glx ignore="true"/>
</function>
<function name="Uniform1iv" offset="assign">
<param name="location" type="GLint"/>
<param name="count" type="GLsizei"/>
<param name="value" type="const GLint *"/>
<glx ignore="true"/>
</function>
<function name="Uniform2f" offset="assign">
<param name="location" type="GLint"/>
<param name="v0" type="GLfloat"/>
<param name="v1" type="GLfloat"/>
<glx ignore="true"/>
</function>
<function name="Uniform2fv" offset="assign">
<param name="location" type="GLint"/>
<param name="count" type="GLsizei"/>
<param name="value" type="const GLfloat *"/>
<glx ignore="true"/>
</function>
<function name="Uniform2i" offset="assign">
<param name="location" type="GLint"/>
<param name="v0" type="GLint"/>
<param name="v1" type="GLint"/>
<glx ignore="true"/>
</function>
<function name="Uniform2iv" offset="assign">
<param name="location" type="GLint"/>
<param name="count" type="GLsizei"/>
<param name="value" type="const GLint *"/>
<glx ignore="true"/>
</function>
<function name="Uniform3f" offset="assign">
<param name="location" type="GLint"/>
<param name="v0" type="GLfloat"/>
<param name="v1" type="GLfloat"/>
<param name="v2" type="GLfloat"/>
<glx ignore="true"/>
</function>
<function name="Uniform3fv" offset="assign">
<param name="location" type="GLint"/>
<param name="count" type="GLsizei"/>
<param name="value" type="const GLfloat *"/>
<glx ignore="true"/>
</function>
<function name="Uniform3i" offset="assign">
<param name="location" type="GLint"/>
<param name="v0" type="GLint"/>
<param name="v1" type="GLint"/>
<param name="v2" type="GLint"/>
<glx ignore="true"/>
</function>
<function name="Uniform3iv" offset="assign">
<param name="location" type="GLint"/>
<param name="count" type="GLsizei"/>
<param name="value" type="const GLint *"/>
<glx ignore="true"/>
</function>
<function name="Uniform4f" offset="assign">
<param name="location" type="GLint"/>
<param name="v0" type="GLfloat"/>
<param name="v1" type="GLfloat"/>
<param name="v2" type="GLfloat"/>
<param name="v3" type="GLfloat"/>
<glx ignore="true"/>
</function>
<function name="Uniform4fv" offset="assign">
<param name="location" type="GLint"/>
<param name="count" type="GLsizei"/>
<param name="value" type="const GLfloat *"/>
<glx ignore="true"/>
</function>
<function name="Uniform4i" offset="assign">
<param name="location" type="GLint"/>
<param name="v0" type="GLint"/>
<param name="v1" type="GLint"/>
<param name="v2" type="GLint"/>
<param name="v3" type="GLint"/>
<glx ignore="true"/>
</function>
<function name="Uniform4iv" offset="assign">
<param name="location" type="GLint"/>
<param name="count" type="GLsizei"/>
<param name="value" type="const GLint *"/>
<glx ignore="true"/>
</function>
<function name="UniformMatrix2fv" offset="assign">
<param name="location" type="GLint"/>
<param name="count" type="GLsizei"/>
<param name="transpose" type="GLboolean"/>
<param name="value" type="const GLfloat *"/>
<glx ignore="true"/>
</function>
<function name="UniformMatrix3fv" offset="assign">
<param name="location" type="GLint"/>
<param name="count" type="GLsizei"/>
<param name="transpose" type="GLboolean"/>
<param name="value" type="const GLfloat *"/>
<glx ignore="true"/>
</function>
<function name="UniformMatrix4fv" offset="assign">
<param name="location" type="GLint"/>
<param name="count" type="GLsizei"/>
<param name="transpose" type="GLboolean"/>
<param name="value" type="const GLfloat *"/>
<glx ignore="true"/>
</function>
<function name="UseProgram" offset="assign">
<param name="program" type="GLuint"/>
<glx ignore="true"/>
</function>
<function name="ValidateProgram" offset="assign">
<param name="program" type="GLuint"/>
<glx ignore="true"/>
</function>
<function name="VertexAttrib1f" offset="assign">
<param name="index" type="GLuint"/>
<param name="x" type="GLfloat"/>
</function>
<function name="VertexAttrib1fv" offset="assign">
<param name="index" type="GLuint"/>
<param name="v" type="const GLfloat *"/>
</function>
<function name="VertexAttrib2f" offset="assign">
<param name="index" type="GLuint"/>
<param name="x" type="GLfloat"/>
<param name="y" type="GLfloat"/>
</function>
<function name="VertexAttrib2fv" offset="assign">
<param name="index" type="GLuint"/>
<param name="v" type="const GLfloat *"/>
</function>
<function name="VertexAttrib3f" offset="assign">
<param name="index" type="GLuint"/>
<param name="x" type="GLfloat"/>
<param name="y" type="GLfloat"/>
<param name="z" type="GLfloat"/>
</function>
<function name="VertexAttrib3fv" offset="assign">
<param name="index" type="GLuint"/>
<param name="v" type="const GLfloat *"/>
</function>
<function name="VertexAttrib4f" offset="assign">
<param name="index" type="GLuint"/>
<param name="x" type="GLfloat"/>
<param name="y" type="GLfloat"/>
<param name="z" type="GLfloat"/>
<param name="w" type="GLfloat"/>
</function>
<function name="VertexAttrib4fv" offset="assign">
<param name="index" type="GLuint"/>
<param name="v" type="const GLfloat *"/>
</function>
<function name="VertexAttribPointer" offset="assign">
<param name="index" type="GLuint"/>
<param name="size" type="GLint"/>
<param name="type" type="GLenum"/>
<param name="normalized" type="GLboolean"/>
<param name="stride" type="GLsizei"/>
<param name="pointer" type="const GLvoid *"/>
</function>
</category>
</OpenGLAPI>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,130 @@
<?xml version="1.0"?>
<!DOCTYPE OpenGLAPI SYSTEM "../../glapi/gl_API.dtd">
<OpenGLAPI>
<xi:include href="es_COMPAT.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<!-- these functions are also missing in es1_API.xml or es1_EXT.xml -->
<category name="es1compat">
<!-- OpenGL 1.0 -->
<function name="TexGenf" alias="TexGenfOES" static_dispatch="false">
<param name="coord" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="param" type="GLfloat"/>
<glx rop="117"/>
</function>
<function name="TexGenfv" alias="TexGenfvOES" static_dispatch="false">
<param name="coord" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfloat *" variable_param="pname"/>
<glx rop="118"/>
</function>
<function name="TexGeni" alias="TexGeniOES" static_dispatch="false">
<param name="coord" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="param" type="GLint"/>
<glx rop="119"/>
</function>
<function name="TexGeniv" alias="TexGenivOES" static_dispatch="false">
<param name="coord" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="const GLint *" variable_param="pname"/>
<glx rop="120"/>
</function>
<function name="GetTexGenfv" alias="GetTexGenfvOES" static_dispatch="false">
<param name="coord" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLfloat *" output="true" variable_param="pname"/>
<glx sop="133"/>
</function>
<function name="GetTexGeniv" alias="GetTexGenivOES" static_dispatch="false">
<param name="coord" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLint *" output="true" variable_param="pname"/>
<glx sop="134"/>
</function>
<!-- OpenGL 1.2 -->
<function name="BlendColor" offset="336" static_dispatch="false">
<param name="red" type="GLclampf"/>
<param name="green" type="GLclampf"/>
<param name="blue" type="GLclampf"/>
<param name="alpha" type="GLclampf"/>
<glx rop="4096"/>
</function>
<function name="BlendEquation" alias="BlendEquationOES" static_dispatch="false">
<param name="mode" type="GLenum"/>
<glx rop="4097"/>
</function>
<function name="TexImage3D" offset="371" static_dispatch="false">
<param name="target" type="GLenum"/>
<param name="level" type="GLint"/>
<param name="internalformat" type="GLint"/>
<param name="width" type="GLsizei"/>
<param name="height" type="GLsizei"/>
<param name="depth" type="GLsizei"/>
<param name="border" type="GLint"/>
<param name="format" type="GLenum"/>
<param name="type" type="GLenum"/>
<param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_format="format" img_type="type" img_target="target" img_null_flag="true" img_pad_dimensions="true"/>
<glx rop="4114" large="true"/>
</function>
<function name="TexSubImage3D" offset="372" static_dispatch="false">
<param name="target" type="GLenum"/>
<param name="level" type="GLint"/>
<param name="xoffset" type="GLint"/>
<param name="yoffset" type="GLint"/>
<param name="zoffset" type="GLint"/>
<param name="width" type="GLsizei"/>
<param name="height" type="GLsizei"/>
<param name="depth" type="GLsizei"/>
<param name="format" type="GLenum"/>
<param name="type" type="GLenum"/>
<param name="UNUSED" type="GLuint" padding="true"/>
<param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_xoff="xoffset" img_yoff="yoffset" img_zoff="zoffset" img_format="format" img_type="type" img_target="target" img_pad_dimensions="true"/>
<glx rop="4115" large="true"/>
</function>
<function name="CopyTexSubImage3D" offset="373" static_dispatch="false">
<param name="target" type="GLenum"/>
<param name="level" type="GLint"/>
<param name="xoffset" type="GLint"/>
<param name="yoffset" type="GLint"/>
<param name="zoffset" type="GLint"/>
<param name="x" type="GLint"/>
<param name="y" type="GLint"/>
<param name="width" type="GLsizei"/>
<param name="height" type="GLsizei"/>
<glx rop="4123"/>
</function>
<!-- GL_ARB_multitexture -->
<function name="ActiveTextureARB" alias="ActiveTexture" static_dispatch="false">
<param name="texture" type="GLenum"/>
<glx rop="197"/>
</function>
<function name="ClientActiveTextureARB" alias="ClientActiveTexture" static_dispatch="false">
<param name="texture" type="GLenum"/>
<glx handcode="true"/>
</function>
<function name="MultiTexCoord4fARB" alias="MultiTexCoord4f" vectorequiv="MultiTexCoord4fvARB" static_dispatch="false">
<param name="target" type="GLenum"/>
<param name="s" type="GLfloat"/>
<param name="t" type="GLfloat"/>
<param name="r" type="GLfloat"/>
<param name="q" type="GLfloat"/>
</function>
</category>
</OpenGLAPI>

View File

@@ -0,0 +1,693 @@
<?xml version="1.0"?>
<!DOCTYPE OpenGLAPI SYSTEM "../../glapi/gl_API.dtd">
<!-- OpenGL ES 1.x extensions -->
<OpenGLAPI>
<xi:include href="es_EXT.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<!-- part of es1.1 extension pack -->
<category name="GL_OES_blend_equation_separate" number="1">
<enum name="BLEND_EQUATION_RGB_OES" count="1" value="0x8009">
<size name="Get" mode="get"/>
</enum>
<enum name="BLEND_EQUATION_ALPHA_OES" count="1" value="0x883D">
<size name="Get" mode="get"/>
</enum>
<function name="BlendEquationSeparateOES" offset="assign">
<param name="modeRGB" type="GLenum"/>
<param name="modeA" type="GLenum"/>
<glx rop="4228"/>
</function>
</category>
<!-- part of es1.1 extension pack -->
<category name="GL_OES_blend_func_separate" number="2">
<enum name="BLEND_DST_RGB_OES" count="1" value="0x80C8">
<size name="Get" mode="get"/>
</enum>
<enum name="BLEND_SRC_RGB_OES" count="1" value="0x80C9">
<size name="Get" mode="get"/>
</enum>
<enum name="BLEND_DST_ALPHA_OES" count="1" value="0x80CA">
<size name="Get" mode="get"/>
</enum>
<enum name="BLEND_SRC_ALPHA_OES" count="1" value="0x80CB">
<size name="Get" mode="get"/>
</enum>
<function name="BlendFuncSeparateOES" offset="assign">
<param name="sfactorRGB" type="GLenum"/>
<param name="dfactorRGB" type="GLenum"/>
<param name="sfactorAlpha" type="GLenum"/>
<param name="dfactorAlpha" type="GLenum"/>
<glx rop="4134"/>
</function>
</category>
<!-- part of es1.1 extension pack -->
<category name="GL_OES_blend_subtract" number="3">
<enum name="FUNC_ADD_OES" value="0x8006"/>
<enum name="BLEND_EQUATION_OES" count="1" value="0x8009">
<size name="Get" mode="get"/>
</enum>
<enum name="FUNC_SUBTRACT_OES" value="0x800A"/>
<enum name="FUNC_REVERSE_SUBTRACT_OES" value="0x800B"/>
<function name="BlendEquationOES" offset="337">
<param name="mode" type="GLenum"/>
<glx rop="4097"/>
</function>
</category>
<!-- core addition to es1.0 and later -->
<category name="GL_OES_byte_coordinates" number="4">
<enum name="BYTE" value="0x1400"/>
</category>
<!-- optional for es1.1 -->
<category name="GL_OES_draw_texture" number="7">
<enum name="TEXTURE_CROP_RECT_OES" value="0x8B9D"/>
<function name="DrawTexiOES" offset="assign">
<param name="x" type="GLint"/>
<param name="y" type="GLint"/>
<param name="z" type="GLint"/>
<param name="width" type="GLint"/>
<param name="height" type="GLint"/>
</function>
<function name="DrawTexivOES" offset="assign">
<param name="coords" type="const GLint *" count="5"/>
</function>
<function name="DrawTexfOES" offset="assign">
<param name="x" type="GLfloat"/>
<param name="y" type="GLfloat"/>
<param name="z" type="GLfloat"/>
<param name="width" type="GLfloat"/>
<param name="height" type="GLfloat"/>
</function>
<function name="DrawTexfvOES" offset="assign">
<param name="coords" type="const GLfloat *" count="5"/>
</function>
<function name="DrawTexsOES" offset="assign">
<param name="x" type="GLshort"/>
<param name="y" type="GLshort"/>
<param name="z" type="GLshort"/>
<param name="width" type="GLshort"/>
<param name="height" type="GLshort"/>
</function>
<function name="DrawTexsvOES" offset="assign">
<param name="coords" type="const GLshort *" count="5"/>
</function>
<function name="DrawTexxOES" offset="assign">
<param name="x" type="GLfixed"/>
<param name="y" type="GLfixed"/>
<param name="z" type="GLfixed"/>
<param name="width" type="GLfixed"/>
<param name="height" type="GLfixed"/>
</function>
<function name="DrawTexxvOES" offset="assign">
<param name="coords" type="const GLfixed *" count="5"/>
</function>
<!-- TexParameter{ifx}v is skipped here -->
</category>
<!-- core addition to es1.0 and later -->
<category name="GL_OES_fixed_point" number="9">
<enum name="FIXED_OES" value="0x140C"/>
<!-- additon to es1.0 -->
<function name="AlphaFuncxOES" alias="AlphaFuncx">
<param name="func" type="GLenum"/>
<param name="ref" type="GLclampx"/>
</function>
<function name="ClearColorxOES" alias="ClearColorx">
<param name="red" type="GLclampx"/>
<param name="green" type="GLclampx"/>
<param name="blue" type="GLclampx"/>
<param name="alpha" type="GLclampx"/>
</function>
<function name="ClearDepthxOES" alias="ClearDepthx">
<param name="depth" type="GLclampx"/>
</function>
<function name="Color4xOES" alias="Color4x">
<param name="red" type="GLfixed"/>
<param name="green" type="GLfixed"/>
<param name="blue" type="GLfixed"/>
<param name="alpha" type="GLfixed"/>
</function>
<function name="DepthRangexOES" alias="DepthRangex">
<param name="zNear" type="GLclampx"/>
<param name="zFar" type="GLclampx"/>
</function>
<function name="FogxOES" alias="Fogx">
<param name="pname" type="GLenum"/>
<param name="param" type="GLfixed"/>
</function>
<function name="FogxvOES" alias="Fogxv">
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfixed *" variable_param="pname"/>
</function>
<function name="FrustumxOES" alias="Frustumx">
<param name="left" type="GLfixed"/>
<param name="right" type="GLfixed"/>
<param name="bottom" type="GLfixed"/>
<param name="top" type="GLfixed"/>
<param name="zNear" type="GLfixed"/>
<param name="zFar" type="GLfixed"/>
</function>
<function name="LightModelxOES" alias="LightModelx">
<param name="pname" type="GLenum"/>
<param name="param" type="GLfixed"/>
</function>
<function name="LightModelxvOES" alias="LightModelxv">
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfixed *" variable_param="pname"/>
</function>
<function name="LightxOES" alias="Lightx">
<param name="light" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="param" type="GLfixed"/>
</function>
<function name="LightxvOES" alias="Lightxv">
<param name="light" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfixed *" variable_param="pname"/>
</function>
<function name="LineWidthxOES" alias="LineWidthx">
<param name="width" type="GLfixed"/>
</function>
<function name="LoadMatrixxOES" alias="LoadMatrixx">
<param name="m" type="const GLfixed *" count="16"/>
</function>
<function name="MaterialxOES" alias="Materialx">
<param name="face" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="param" type="GLfixed"/>
</function>
<function name="MaterialxvOES" alias="Materialxv">
<param name="face" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfixed *" variable_param="pname"/>
</function>
<function name="MultiTexCoord4xOES" alias="MultiTexCoord4x">
<param name="target" type="GLenum"/>
<param name="s" type="GLfixed"/>
<param name="t" type="GLfixed"/>
<param name="r" type="GLfixed"/>
<param name="q" type="GLfixed"/>
</function>
<function name="MultMatrixxOES" alias="MultMatrixx">
<param name="m" type="const GLfixed *" count="16"/>
</function>
<function name="Normal3xOES" alias="Normal3x">
<param name="nx" type="GLfixed"/>
<param name="ny" type="GLfixed"/>
<param name="nz" type="GLfixed"/>
</function>
<function name="OrthoxOES" alias="Orthox">
<param name="left" type="GLfixed"/>
<param name="right" type="GLfixed"/>
<param name="bottom" type="GLfixed"/>
<param name="top" type="GLfixed"/>
<param name="zNear" type="GLfixed"/>
<param name="zFar" type="GLfixed"/>
</function>
<function name="PointSizexOES" alias="PointSizex">
<param name="size" type="GLfixed"/>
</function>
<function name="PolygonOffsetxOES" alias="PolygonOffsetx">
<param name="factor" type="GLfixed"/>
<param name="units" type="GLfixed"/>
</function>
<function name="RotatexOES" alias="Rotatex">
<param name="angle" type="GLfixed"/>
<param name="x" type="GLfixed"/>
<param name="y" type="GLfixed"/>
<param name="z" type="GLfixed"/>
</function>
<function name="SampleCoveragexOES" alias="SampleCoveragex">
<param name="value" type="GLclampx"/>
<param name="invert" type="GLboolean"/>
</function>
<function name="ScalexOES" alias="Scalex">
<param name="x" type="GLfixed"/>
<param name="y" type="GLfixed"/>
<param name="z" type="GLfixed"/>
</function>
<function name="TexEnvxOES" alias="TexEnvx">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="param" type="GLfixed"/>
</function>
<function name="TexEnvxvOES" alias="TexEnvxv">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfixed *" variable_param="pname"/>
</function>
<function name="TexParameterxOES" alias="TexParameterx">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="param" type="GLfixed"/>
</function>
<function name="TranslatexOES" alias="Translatex">
<param name="x" type="GLfixed"/>
<param name="y" type="GLfixed"/>
<param name="z" type="GLfixed"/>
</function>
<!-- additon to es1.1 -->
<function name="ClipPlanexOES" alias="ClipPlanex">
<param name="plane" type="GLenum"/>
<param name="equation" type="const GLfixed *" count="4"/>
</function>
<function name="GetClipPlanexOES" alias="GetClipPlanex">
<param name="plane" type="GLenum"/>
<param name="equation" type="GLfixed *" output="true" count="4"/>
</function>
<function name="GetFixedvOES" alias="GetFixedv">
<param name="pname" type="GLenum"/>
<param name="params" type="GLfixed *" output="true" variable_param="pname"/>
</function>
<function name="GetLightxvOES" alias="GetLightxv">
<param name="light" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLfixed *" output="true" variable_param="pname"/>
</function>
<function name="GetMaterialxvOES" alias="GetMaterialxv">
<param name="face" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLfixed *" output="true" variable_param="pname"/>
</function>
<function name="GetTexEnvxvOES" alias="GetTexEnvxv">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLfixed *" output="true" variable_param="pname"/>
</function>
<function name="GetTexParameterxvOES" alias="GetTexParameterxv">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLfixed *" output="true" variable_param="pname"/>
</function>
<function name="PointParameterxOES" alias="PointParameterx">
<param name="pname" type="GLenum"/>
<param name="param" type="GLfixed"/>
</function>
<function name="PointParameterxvOES" alias="PointParameterxv">
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfixed *"/>
</function>
<function name="TexParameterxvOES" alias="TexParameterxv">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfixed *" variable_param="pname"/>
</function>
</category>
<!-- part of es1.1 extension pack -->
<category name="GL_OES_framebuffer_object" number="10">
<enum name="NONE_OES" value="0"/>
<enum name="INVALID_FRAMEBUFFER_OPERATION_OES" value="0x0506"/>
<enum name="RGBA4_OES" value="0x8056"/>
<enum name="RGB5_A1_OES" value="0x8057"/>
<enum name="DEPTH_COMPONENT16_OES" value="0x81A5"/>
<enum name="MAX_RENDERBUFFER_SIZE_OES" value="0x84E8"/>
<enum name="FRAMEBUFFER_BINDING_OES" value="0x8CA6"/>
<enum name="RENDERBUFFER_BINDING_OES" value="0x8CA7"/>
<enum name="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES" value="0x8CD0"/>
<enum name="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES" value="0x8CD1"/>
<enum name="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES" value="0x8CD2"/>
<enum name="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES" value="0x8CD3"/>
<enum name="FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES" value="0x8CD4"/>
<enum name="FRAMEBUFFER_COMPLETE_OES" value="0x8CD5"/>
<enum name="FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES" value="0x8CD6"/>
<enum name="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES" value="0x8CD7"/>
<enum name="FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES" value="0x8CD9"/>
<enum name="FRAMEBUFFER_INCOMPLETE_FORMATS_OES" value="0x8CDA"/>
<enum name="FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES" value="0x8CDB"/>
<enum name="FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES" value="0x8CDC"/>
<enum name="FRAMEBUFFER_UNSUPPORTED_OES" value="0x8CDD"/>
<enum name="COLOR_ATTACHMENT0_OES" value="0x8CE0"/>
<enum name="DEPTH_ATTACHMENT_OES" value="0x8D00"/>
<enum name="STENCIL_ATTACHMENT_OES" value="0x8D20"/>
<enum name="FRAMEBUFFER_OES" value="0x8D40"/>
<enum name="RENDERBUFFER_OES" value="0x8D41"/>
<enum name="RENDERBUFFER_WIDTH_OES" value="0x8D42"/>
<enum name="RENDERBUFFER_HEIGHT_OES" value="0x8D43"/>
<enum name="RENDERBUFFER_INTERNAL_FORMAT_OES" value="0x8D44"/>
<enum name="STENCIL_INDEX1_OES" value="0x8D46"/>
<enum name="STENCIL_INDEX4_OES" value="0x8D47"/>
<enum name="STENCIL_INDEX8_OES" value="0x8D48"/>
<enum name="RENDERBUFFER_RED_SIZE_OES" value="0x8D50"/>
<enum name="RENDERBUFFER_GREEN_SIZE_OES" value="0x8D51"/>
<enum name="RENDERBUFFER_BLUE_SIZE_OES" value="0x8D52"/>
<enum name="RENDERBUFFER_ALPHA_SIZE_OES" value="0x8D53"/>
<enum name="RENDERBUFFER_DEPTH_SIZE_OES" value="0x8D54"/>
<enum name="RENDERBUFFER_STENCIL_SIZE_OES" value="0x8D55"/>
<enum name="RGB565_OES" value="0x8D62"/>
<function name="BindFramebufferOES" offset="assign">
<param name="target" type="GLenum"/>
<param name="framebuffer" type="GLuint"/>
</function>
<function name="BindRenderbufferOES" offset="assign">
<param name="target" type="GLenum"/>
<param name="renderbuffer" type="GLuint"/>
</function>
<function name="CheckFramebufferStatusOES" offset="assign">
<param name="target" type="GLenum"/>
<return type="GLenum"/>
</function>
<function name="DeleteFramebuffersOES" offset="assign">
<param name="n" type="GLsizei" counter="true"/>
<param name="framebuffers" type="const GLuint *" count="n"/>
</function>
<function name="DeleteRenderbuffersOES" offset="assign">
<param name="n" type="GLsizei" counter="true"/>
<param name="renderbuffers" type="const GLuint *" count="n"/>
</function>
<function name="FramebufferRenderbufferOES" offset="assign">
<param name="target" type="GLenum"/>
<param name="attachment" type="GLenum"/>
<param name="renderbuffertarget" type="GLenum"/>
<param name="renderbuffer" type="GLuint"/>
</function>
<function name="FramebufferTexture2DOES" offset="assign">
<param name="target" type="GLenum"/>
<param name="attachment" type="GLenum"/>
<param name="textarget" type="GLenum"/>
<param name="texture" type="GLuint"/>
<param name="level" type="GLint"/>
</function>
<function name="GenerateMipmapOES" offset="assign">
<param name="target" type="GLenum"/>
</function>
<function name="GenFramebuffersOES" offset="assign">
<param name="n" type="GLsizei" counter="true"/>
<param name="framebuffers" type="GLuint *" count="n" output="true"/>
</function>
<function name="GenRenderbuffersOES" offset="assign">
<param name="n" type="GLsizei" counter="true"/>
<param name="renderbuffers" type="GLuint *" count="n" output="true"/>
</function>
<function name="GetFramebufferAttachmentParameterivOES" offset="assign">
<param name="target" type="GLenum"/>
<param name="attachment" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLint *" output="true"/>
</function>
<function name="GetRenderbufferParameterivOES" offset="assign">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLint *" output="true"/>
</function>
<function name="IsFramebufferOES" offset="assign">
<param name="framebuffer" type="GLuint"/>
<return type="GLboolean"/>
</function>
<function name="IsRenderbufferOES" offset="assign">
<param name="renderbuffer" type="GLuint"/>
<return type="GLboolean"/>
</function>
<function name="RenderbufferStorageOES" offset="assign">
<param name="target" type="GLenum"/>
<param name="internalformat" type="GLenum"/>
<param name="width" type="GLsizei"/>
<param name="height" type="GLsizei"/>
</function>
</category>
<!-- core addition to es1.1 -->
<category name="GL_OES_matrix_get" number="11">
<enum name="MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES" value="0x898D"/>
<enum name="PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES" value="0x898E"/>
<enum name="TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES" value="0x898F"/>
</category>
<!-- optional for es1.1 -->
<category name="GL_OES_matrix_palette" number="12">
<enum name="MAX_VERTEX_UNITS_OES" value="0x86A4"/>
<enum name="WEIGHT_ARRAY_TYPE_OES" value="0x86A9"/>
<enum name="WEIGHT_ARRAY_STRIDE_OES" value="0x86AA"/>
<enum name="WEIGHT_ARRAY_SIZE_OES" value="0x86AB"/>
<enum name="WEIGHT_ARRAY_POINTER_OES" value="0x86AC"/>
<enum name="WEIGHT_ARRAY_OES" value="0x86AD"/>
<enum name="MATRIX_PALETTE_OES" value="0x8840"/>
<enum name="MAX_PALETTE_MATRICES_OES" value="0x8842"/>
<enum name="CURRENT_PALETTE_MATRIX_OES" value="0x8843"/>
<enum name="MATRIX_INDEX_ARRAY_OES" value="0x8844"/>
<enum name="MATRIX_INDEX_ARRAY_SIZE_OES" value="0x8846"/>
<enum name="MATRIX_INDEX_ARRAY_TYPE_OES" value="0x8847"/>
<enum name="MATRIX_INDEX_ARRAY_STRIDE_OES" value="0x8848"/>
<enum name="MATRIX_INDEX_ARRAY_POINTER_OES" value="0x8849"/>
<enum name="WEIGHT_ARRAY_BUFFER_BINDING_OES" value="0x889E"/>
<enum name="MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES" value="0x8B9E"/>
<function name="CurrentPaletteMatrixOES">
<param name="matrixpaletteindex" type="GLuint"/>
</function>
<function name="LoadPaletteFromModelViewMatrixOES">
</function>
<function name="MatrixIndexPointerOES">
<param name="size" type="GLint"/>
<param name="type" type="GLenum"/>
<param name="stride" type="GLsizei"/>
<param name="pointer" type="const GLvoid *"/>
</function>
<function name="WeightPointerOES">
<param name="size" type="GLint"/>
<param name="type" type="GLenum"/>
<param name="stride" type="GLsizei"/>
<param name="pointer" type="const GLvoid *"/>
</function>
</category>
<!-- required for es1.1 -->
<category name="GL_OES_point_size_array" number="14">
<enum name="POINT_SIZE_ARRAY_TYPE_OES" value="0x898A"/>
<enum name="POINT_SIZE_ARRAY_STRIDE_OES" value="0x898B"/>
<enum name="POINT_SIZE_ARRAY_POINTER_OES" value="0x898C"/>
<enum name="POINT_SIZE_ARRAY_OES" value="0x8B9C"/>
<enum name="POINT_SIZE_ARRAY_BUFFER_BINDING_OES" value="0x8B9F"/>
<function name="PointSizePointerOES" offset="assign">
<param name="type" type="GLenum"/>
<param name="stride" type="GLsizei"/>
<param name="pointer" type="const GLvoid *"/>
</function>
</category>
<!-- required for es1.1 -->
<category name="GL_OES_point_sprite" number="15">
<enum name="POINT_SPRITE_OES" value="0x8861"/>
<enum name="COORD_REPLACE_OES" value="0x8862"/>
</category>
<!-- optional for es1.0 -->
<category name="GL_OES_query_matrix" number="16">
<function name="QueryMatrixxOES" offset="assign">
<param name="mantissa" type="GLfixed *" count="16" />
<param name="exponent" type="GLint *" count="16" />
<return type="GLbitfield"/>
</function>
</category>
<!-- required for es1.0 and later -->
<category name="GL_OES_read_format" number="17">
<enum name="IMPLEMENTATION_COLOR_READ_TYPE_OES" value="0x8B9A"/>
<enum name="IMPLEMENTATION_COLOR_READ_FORMAT_OES" value="0x8B9B"/>
</category>
<!-- core addition to es1.0 and later -->
<category name="GL_OES_single_precision" number="18">
<!-- additon to es1.0 -->
<function name="ClearDepthfOES" alias="ClearDepthf">
<param name="depth" type="GLclampf"/>
</function>
<function name="DepthRangefOES" alias="DepthRangef">
<param name="zNear" type="GLclampf"/>
<param name="zFar" type="GLclampf"/>
</function>
<function name="FrustumfOES" alias="Frustumf">
<param name="left" type="GLfloat"/>
<param name="right" type="GLfloat"/>
<param name="bottom" type="GLfloat"/>
<param name="top" type="GLfloat"/>
<param name="zNear" type="GLfloat"/>
<param name="zFar" type="GLfloat"/>
</function>
<function name="OrthofOES" alias="Orthof">
<param name="left" type="GLfloat"/>
<param name="right" type="GLfloat"/>
<param name="bottom" type="GLfloat"/>
<param name="top" type="GLfloat"/>
<param name="zNear" type="GLfloat"/>
<param name="zFar" type="GLfloat"/>
</function>
<!-- additon to es1.1 -->
<function name="ClipPlanefOES" alias="ClipPlanef">
<param name="plane" type="GLenum"/>
<param name="equation" type="const GLfloat *" count="4"/>
</function>
<function name="GetClipPlanefOES" alias="GetClipPlanef">
<param name="plane" type="GLenum"/>
<param name="equation" type="GLfloat *" output="true" count="4"/>
</function>
</category>
<!-- part of es1.1 extension pack -->
<category name="GL_OES_texture_cube_map" number="20">
<enum name="GL_TEXTURE_GEN_MODE_OES" value="0x2500"/>
<enum name="GL_NORMAL_MAP_OES" value="0x8511"/>
<enum name="GL_REFLECTION_MAP_OES" value="0x8512"/>
<enum name="GL_TEXTURE_CUBE_MAP_OES" value="0x8513"/>
<enum name="GL_TEXTURE_BINDING_CUBE_MAP_OES" value="0x8514"/>
<enum name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" value="0x8515"/>
<enum name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" value="0x8516"/>
<enum name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" value="0x8517"/>
<enum name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" value="0x8518"/>
<enum name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" value="0x8519"/>
<enum name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" value="0x851A"/>
<enum name="GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES" value="0x851C"/>
<enum name="GL_TEXTURE_GEN_STR_OES" value="0x8D60"/>
<function name="GetTexGenfvOES" offset="279">
<param name="coord" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLfloat *" output="true" variable_param="pname"/>
<glx sop="133"/>
</function>
<function name="GetTexGenivOES" offset="280">
<param name="coord" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLint *" output="true" variable_param="pname"/>
<glx sop="134"/>
</function>
<function name="GetTexGenxvOES" offset="assign">
<param name="coord" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLfixed *" output="true" variable_param="pname"/>
</function>
<function name="TexGenfOES" offset="190">
<param name="coord" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="param" type="GLfloat"/>
<glx rop="117"/>
</function>
<function name="TexGenfvOES" offset="191">
<param name="coord" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfloat *" variable_param="pname"/>
<glx rop="118"/>
</function>
<function name="TexGeniOES" offset="192">
<param name="coord" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="param" type="GLint"/>
<glx rop="119"/>
</function>
<function name="TexGenivOES" offset="193">
<param name="coord" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="const GLint *" variable_param="pname"/>
<glx rop="120"/>
</function>
<function name="TexGenxOES" offset="assign">
<param name="coord" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="param" type="GLint"/>
</function>
<function name="TexGenxvOES" offset="assign">
<param name="coord" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfixed *" variable_param="pname"/>
</function>
</category>
<category name="GL_OES_texture_env_crossbar" number="21">
<!-- No new functions, types, enums. -->
</category>
<category name="GL_OES_texture_mirrored_repeat" number="22">
<!-- No new functions, types, enums. -->
</category>
</OpenGLAPI>

View File

@@ -0,0 +1,294 @@
<?xml version="1.0"?>
<!DOCTYPE OpenGLAPI SYSTEM "../../glapi/gl_API.dtd">
<!-- OpenGL ES 2.x API -->
<OpenGLAPI>
<xi:include href="base2_API.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<!-- subset of OpenGL 2.0 defined by OpenGL ES 2.0 -->
<category name="es2.0core">
<!-- addition to base1.0 -->
<enum name="NONE" value="0x0"/>
<enum name="INT" count="4" value="0x1404">
<size name="CallLists"/>
</enum>
<enum name="UNSIGNED_INT" count="4" value="0x1405">
<size name="CallLists"/>
</enum>
<enum name="STENCIL_INDEX" value="0x1901"/>
<enum name="DEPTH_COMPONENT" value="0x1902"/>
<function name="TexImage2D" offset="183">
<param name="target" type="GLenum"/>
<param name="level" type="GLint"/>
<param name="internalformat" type="GLint"/> <!-- XXX the actual type is GLenum... -->
<param name="width" type="GLsizei"/>
<param name="height" type="GLsizei"/>
<param name="border" type="GLint"/>
<param name="format" type="GLenum"/>
<param name="type" type="GLenum"/>
<param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_format="format" img_type="type" img_target="target" img_send_null="true" img_pad_dimensions="true"/>
<glx rop="110" large="true"/>
</function>
<!-- addition to base1.1 -->
<enum name="RGBA4" value="0x8056"/>
<enum name="RGB5_A1" value="0x8057"/>
<!-- addition to base1.2 -->
<enum name="CONSTANT_COLOR" value="0x8001"/>
<enum name="ONE_MINUS_CONSTANT_COLOR" value="0x8002"/>
<enum name="CONSTANT_ALPHA" value="0x8003"/>
<enum name="ONE_MINUS_CONSTANT_ALPHA" value="0x8004"/>
<enum name="BLEND_COLOR" count="4" value="0x8005">
<size name="Get" mode="get"/>
</enum>
<enum name="FUNC_ADD" value="0x8006"/>
<enum name="BLEND_EQUATION" count="1" value="0x8009">
<size name="Get" mode="get"/>
</enum>
<enum name="FUNC_SUBTRACT" value="0x800A"/>
<enum name="FUNC_REVERSE_SUBTRACT" value="0x800B"/>
<function name="BlendColor" offset="336">
<param name="red" type="GLclampf"/>
<param name="green" type="GLclampf"/>
<param name="blue" type="GLclampf"/>
<param name="alpha" type="GLclampf"/>
<glx rop="4096"/>
</function>
<function name="BlendEquation" offset="337">
<param name="mode" type="GLenum"/>
<glx rop="4097"/>
</function>
<!-- addition to base1.3 -->
<enum name="TEXTURE_CUBE_MAP" count="1" value="0x8513">
<size name="Get" mode="get"/>
</enum>
<enum name="TEXTURE_BINDING_CUBE_MAP" count="1" value="0x8514">
<size name="Get" mode="get"/>
</enum>
<enum name="TEXTURE_CUBE_MAP_POSITIVE_X" value="0x8515"/>
<enum name="TEXTURE_CUBE_MAP_NEGATIVE_X" value="0x8516"/>
<enum name="TEXTURE_CUBE_MAP_POSITIVE_Y" value="0x8517"/>
<enum name="TEXTURE_CUBE_MAP_NEGATIVE_Y" value="0x8518"/>
<enum name="TEXTURE_CUBE_MAP_POSITIVE_Z" value="0x8519"/>
<enum name="TEXTURE_CUBE_MAP_NEGATIVE_Z" value="0x851A"/>
<enum name="MAX_CUBE_MAP_TEXTURE_SIZE" count="1" value="0x851C">
<size name="Get" mode="get"/>
</enum>
<!-- addition to base1.4 -->
<enum name="BLEND_DST_RGB" count="1" value="0x80C8">
<size name="Get" mode="get"/>
</enum>
<enum name="BLEND_SRC_RGB" count="1" value="0x80C9">
<size name="Get" mode="get"/>
</enum>
<enum name="BLEND_DST_ALPHA" count="1" value="0x80CA">
<size name="Get" mode="get"/>
</enum>
<enum name="BLEND_SRC_ALPHA" count="1" value="0x80CB">
<size name="Get" mode="get"/>
</enum>
<enum name="DEPTH_COMPONENT16" value="0x81A5"/>
<enum name="MIRRORED_REPEAT" value="0x8370"/>
<enum name="INCR_WRAP" value="0x8507"/>
<enum name="DECR_WRAP" value="0x8508"/>
<function name="BlendFuncSeparate" offset="assign">
<param name="sfactorRGB" type="GLenum"/>
<param name="dfactorRGB" type="GLenum"/>
<param name="sfactorAlpha" type="GLenum"/>
<param name="dfactorAlpha" type="GLenum"/>
<glx rop="4134"/>
</function>
<!-- addition to base1.5 -->
<enum name="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING" count="1" value="0x889F">
<size name="GetVertexAttribdv" mode="get"/>
<size name="GetVertexAttribfv" mode="get"/>
<size name="GetVertexAttribiv" mode="get"/>
</enum>
<enum name="STREAM_DRAW" value="0x88E0"/>
<!-- addition to base2.0 -->
<!-- base2.0 should have everything defined -->
</category>
<!-- OpenGL ES 2.0 -->
<category name="es2.0">
<!-- addition to es2.0core -->
<enum name="LOW_FLOAT" value="0x8DF0"/>
<enum name="MEDIUM_FLOAT" value="0x8DF1"/>
<enum name="HIGH_FLOAT" value="0x8DF2"/>
<enum name="LOW_INT" value="0x8DF3"/>
<enum name="MEDIUM_INT" value="0x8DF4"/>
<enum name="HIGH_INT" value="0x8DF5"/>
<enum name="SHADER_BINARY_FORMATS" value="0x8DF8"/>
<enum name="NUM_SHADER_BINARY_FORMATS" value="0x8DF9"/>
<enum name="SHADER_COMPILER" value="0x8DFA"/>
<enum name="MAX_VERTEX_UNIFORM_VECTORS" value="0x8DFB"/>
<enum name="MAX_VARYING_VECTORS" value="0x8DFC"/>
<enum name="MAX_FRAGMENT_UNIFORM_VECTORS" value="0x8DFD"/>
<function name="GetShaderPrecisionFormat" offset="assign">
<param name="shadertype" type="GLenum"/>
<param name="precisiontype" type="GLenum"/>
<param name="range" type="GLint *"/>
<param name="precision" type="GLint *"/>
</function>
<function name="ReleaseShaderCompiler" offset="assign">
</function>
<function name="ShaderBinary" offset="assign">
<param name="n" type="GLsizei"/>
<param name="shaders" type="const GLuint *"/>
<param name="binaryformat" type="GLenum"/>
<param name="binary" type="const GLvoid *"/>
<param name="length" type="GLsizei"/>
</function>
<!-- from GL_OES_fixed_point -->
<enum name="FIXED" value="0x140C"/>
<type name="fixed" size="4" />
<!-- from GL_OES_framebuffer_object -->
<enum name="INVALID_FRAMEBUFFER_OPERATION" value="0x0506"/>
<enum name="MAX_RENDERBUFFER_SIZE" value="0x84E8"/>
<enum name="FRAMEBUFFER_BINDING" value="0x8CA6"/>
<enum name="RENDERBUFFER_BINDING" value="0x8CA7"/>
<enum name="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE" value="0x8CD0"/>
<enum name="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME" value="0x8CD1"/>
<enum name="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL" value="0x8CD2"/>
<enum name="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE" value="0x8CD3"/>
<enum name="FRAMEBUFFER_COMPLETE" value="0x8CD5"/>
<enum name="FRAMEBUFFER_INCOMPLETE_ATTACHMENT" value="0x8CD6"/>
<enum name="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT" value="0x8CD7"/>
<enum name="FRAMEBUFFER_INCOMPLETE_DIMENSIONS" value="0x8CD9"/>
<enum name="FRAMEBUFFER_UNSUPPORTED" value="0x8CDD"/>
<enum name="COLOR_ATTACHMENT0" value="0x8CE0"/>
<enum name="DEPTH_ATTACHMENT" value="0x8D00"/>
<enum name="STENCIL_ATTACHMENT" value="0x8D20"/>
<enum name="FRAMEBUFFER" value="0x8D40"/>
<enum name="RENDERBUFFER" value="0x8D41"/>
<enum name="RENDERBUFFER_WIDTH" value="0x8D42"/>
<enum name="RENDERBUFFER_HEIGHT" value="0x8D43"/>
<enum name="RENDERBUFFER_INTERNAL_FORMAT" value="0x8D44"/>
<enum name="STENCIL_INDEX8" value="0x8D48"/>
<enum name="RENDERBUFFER_RED_SIZE" value="0x8D50"/>
<enum name="RENDERBUFFER_GREEN_SIZE" value="0x8D51"/>
<enum name="RENDERBUFFER_BLUE_SIZE" value="0x8D52"/>
<enum name="RENDERBUFFER_ALPHA_SIZE" value="0x8D53"/>
<enum name="RENDERBUFFER_DEPTH_SIZE" value="0x8D54"/>
<enum name="RENDERBUFFER_STENCIL_SIZE" value="0x8D55"/>
<enum name="RGB565" value="0x8D62"/>
<function name="BindFramebuffer" offset="assign">
<param name="target" type="GLenum"/>
<param name="framebuffer" type="GLuint"/>
</function>
<function name="BindRenderbuffer" offset="assign">
<param name="target" type="GLenum"/>
<param name="renderbuffer" type="GLuint"/>
</function>
<function name="CheckFramebufferStatus" offset="assign">
<param name="target" type="GLenum"/>
<return type="GLenum"/>
</function>
<function name="DeleteFramebuffers" offset="assign">
<param name="n" type="GLsizei" counter="true"/>
<param name="framebuffers" type="const GLuint *" count="n"/>
</function>
<function name="DeleteRenderbuffers" offset="assign">
<param name="n" type="GLsizei" counter="true"/>
<param name="renderbuffers" type="const GLuint *" count="n"/>
</function>
<function name="FramebufferRenderbuffer" offset="assign">
<param name="target" type="GLenum"/>
<param name="attachment" type="GLenum"/>
<param name="renderbuffertarget" type="GLenum"/>
<param name="renderbuffer" type="GLuint"/>
</function>
<function name="FramebufferTexture2D" offset="assign">
<param name="target" type="GLenum"/>
<param name="attachment" type="GLenum"/>
<param name="textarget" type="GLenum"/>
<param name="texture" type="GLuint"/>
<param name="level" type="GLint"/>
</function>
<function name="GenerateMipmap" offset="assign">
<param name="target" type="GLenum"/>
</function>
<function name="GenFramebuffers" offset="assign">
<param name="n" type="GLsizei" counter="true"/>
<param name="framebuffers" type="GLuint *" count="n" output="true"/>
</function>
<function name="GenRenderbuffers" offset="assign">
<param name="n" type="GLsizei" counter="true"/>
<param name="renderbuffers" type="GLuint *" count="n" output="true"/>
</function>
<function name="GetFramebufferAttachmentParameteriv" offset="assign">
<param name="target" type="GLenum"/>
<param name="attachment" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLint *" output="true"/>
</function>
<function name="GetRenderbufferParameteriv" offset="assign">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLint *" output="true"/>
</function>
<function name="IsFramebuffer" offset="assign">
<param name="framebuffer" type="GLuint"/>
<return type="GLboolean"/>
</function>
<function name="IsRenderbuffer" offset="assign">
<param name="renderbuffer" type="GLuint"/>
<return type="GLboolean"/>
</function>
<function name="RenderbufferStorage" offset="assign">
<param name="target" type="GLenum"/>
<param name="internalformat" type="GLenum"/>
<param name="width" type="GLsizei"/>
<param name="height" type="GLsizei"/>
</function>
<!-- from GL_OES_read_format -->
<enum name="IMPLEMENTATION_COLOR_READ_TYPE" value="0x8B9A"/>
<enum name="IMPLEMENTATION_COLOR_READ_FORMAT" value="0x8B9B"/>
<!-- from GL_OES_single_precision -->
<function name="ClearDepthf" offset="assign">
<param name="depth" type="GLclampf"/>
</function>
<function name="DepthRangef" offset="assign">
<param name="zNear" type="GLclampf"/>
<param name="zFar" type="GLclampf"/>
</function>
</category>
<xi:include href="es2_EXT.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="es2_COMPAT.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
</OpenGLAPI>

View File

@@ -0,0 +1,363 @@
<?xml version="1.0"?>
<!DOCTYPE OpenGLAPI SYSTEM "../../glapi/gl_API.dtd">
<OpenGLAPI>
<xi:include href="es_COMPAT.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<!-- these functions are also missing in es2_API.xml -->
<category name="es2compat">
<!-- OpenGL 1.0 -->
<function name="Color4f" offset="29" vectorequiv="Color4fv" static_dispatch="false">
<param name="red" type="GLfloat"/>
<param name="green" type="GLfloat"/>
<param name="blue" type="GLfloat"/>
<param name="alpha" type="GLfloat"/>
</function>
<function name="Color4ub" offset="35" vectorequiv="Color4ubv" static_dispatch="false">
<param name="red" type="GLubyte"/>
<param name="green" type="GLubyte"/>
<param name="blue" type="GLubyte"/>
<param name="alpha" type="GLubyte"/>
</function>
<function name="Normal3f" offset="56" vectorequiv="Normal3fv" static_dispatch="false">
<param name="nx" type="GLfloat"/>
<param name="ny" type="GLfloat"/>
<param name="nz" type="GLfloat"/>
</function>
<function name="Fogf" offset="153" static_dispatch="false">
<param name="pname" type="GLenum"/>
<param name="param" type="GLfloat"/>
<glx rop="80"/>
</function>
<function name="Fogfv" offset="154" static_dispatch="false">
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfloat *" variable_param="pname"/>
<glx rop="81"/>
</function>
<function name="Lightf" offset="159" static_dispatch="false">
<param name="light" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="param" type="GLfloat"/>
<glx rop="86"/>
</function>
<function name="Lightfv" offset="160" static_dispatch="false">
<param name="light" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfloat *" variable_param="pname"/>
<glx rop="87"/>
</function>
<function name="LightModelf" offset="163" static_dispatch="false">
<param name="pname" type="GLenum"/>
<param name="param" type="GLfloat"/>
<glx rop="90"/>
</function>
<function name="LightModelfv" offset="164" static_dispatch="false">
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfloat *" variable_param="pname"/>
<glx rop="91"/>
</function>
<function name="Materialf" offset="169" static_dispatch="false">
<param name="face" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="param" type="GLfloat"/>
<glx rop="96"/>
</function>
<function name="Materialfv" offset="170" static_dispatch="false">
<param name="face" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfloat *" variable_param="pname"/>
<glx rop="97"/>
</function>
<function name="PointSize" offset="173" static_dispatch="false">
<param name="size" type="GLfloat"/>
<glx rop="100"/>
</function>
<function name="ShadeModel" offset="177" static_dispatch="false">
<param name="mode" type="GLenum"/>
<glx rop="104"/>
</function>
<function name="TexEnvf" offset="184" static_dispatch="false">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="param" type="GLfloat"/>
<glx rop="111"/>
</function>
<function name="TexEnvfv" offset="185" static_dispatch="false">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfloat *" variable_param="pname"/>
<glx rop="112"/>
</function>
<function name="TexEnvi" offset="186" static_dispatch="false">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="param" type="GLint"/>
<glx rop="113"/>
</function>
<function name="TexEnviv" offset="187" static_dispatch="false">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="const GLint *" variable_param="pname"/>
<glx rop="114"/>
</function>
<function name="TexGenf" offset="190" static_dispatch="false">
<param name="coord" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="param" type="GLfloat"/>
<glx rop="117"/>
</function>
<function name="TexGenfv" offset="191" static_dispatch="false">
<param name="coord" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="const GLfloat *" variable_param="pname"/>
<glx rop="118"/>
</function>
<function name="TexGeni" offset="192" static_dispatch="false">
<param name="coord" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="param" type="GLint"/>
<glx rop="119"/>
</function>
<function name="TexGeniv" offset="193" static_dispatch="false">
<param name="coord" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="const GLint *" variable_param="pname"/>
<glx rop="120"/>
</function>
<function name="AlphaFunc" offset="240" static_dispatch="false">
<param name="func" type="GLenum"/>
<param name="ref" type="GLclampf"/>
<glx rop="159"/>
</function>
<function name="LogicOp" offset="242" static_dispatch="false">
<param name="opcode" type="GLenum"/>
<glx rop="161"/>
</function>
<function name="GetLightfv" offset="264" static_dispatch="false">
<param name="light" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLfloat *" output="true" variable_param="pname"/>
<glx sop="118"/>
</function>
<function name="GetMaterialfv" offset="269" static_dispatch="false">
<param name="face" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLfloat *" output="true" variable_param="pname"/>
<glx sop="123"/>
</function>
<function name="GetTexEnvfv" offset="276" static_dispatch="false">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLfloat *" output="true" variable_param="pname"/>
<glx sop="130"/>
</function>
<function name="GetTexEnviv" offset="277" static_dispatch="false">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLint *" output="true" variable_param="pname"/>
<glx sop="131"/>
</function>
<function name="GetTexGenfv" offset="279" static_dispatch="false">
<param name="coord" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLfloat *" output="true" variable_param="pname"/>
<glx sop="133"/>
</function>
<function name="GetTexGeniv" offset="280" static_dispatch="false">
<param name="coord" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLint *" output="true" variable_param="pname"/>
<glx sop="134"/>
</function>
<function name="LoadIdentity" offset="290" static_dispatch="false">
<glx rop="176"/>
</function>
<function name="LoadMatrixf" offset="291" static_dispatch="false">
<param name="m" type="const GLfloat *" count="16"/>
<glx rop="177"/>
</function>
<function name="MatrixMode" offset="293" static_dispatch="false">
<param name="mode" type="GLenum"/>
<glx rop="179"/>
</function>
<function name="MultMatrixf" offset="294" static_dispatch="false">
<param name="m" type="const GLfloat *" count="16"/>
<glx rop="180"/>
</function>
<function name="PopMatrix" offset="297" static_dispatch="false">
<glx rop="183"/>
</function>
<function name="PushMatrix" offset="298" static_dispatch="false">
<glx rop="184"/>
</function>
<function name="Rotatef" offset="300" static_dispatch="false">
<param name="angle" type="GLfloat"/>
<param name="x" type="GLfloat"/>
<param name="y" type="GLfloat"/>
<param name="z" type="GLfloat"/>
<glx rop="186"/>
</function>
<function name="Scalef" offset="302" static_dispatch="false">
<param name="x" type="GLfloat"/>
<param name="y" type="GLfloat"/>
<param name="z" type="GLfloat"/>
<glx rop="188"/>
</function>
<function name="Translatef" offset="304" static_dispatch="false">
<param name="x" type="GLfloat"/>
<param name="y" type="GLfloat"/>
<param name="z" type="GLfloat"/>
<glx rop="190"/>
</function>
<!-- OpenGL 1.1 -->
<function name="ColorPointer" offset="308" static_dispatch="false">
<param name="size" type="GLint"/>
<param name="type" type="GLenum"/>
<param name="stride" type="GLsizei"/>
<param name="pointer" type="const GLvoid *"/>
<glx handcode="true"/>
</function>
<function name="DisableClientState" offset="309" static_dispatch="false">
<param name="array" type="GLenum"/>
<glx handcode="true"/>
</function>
<function name="EnableClientState" offset="313" static_dispatch="false">
<param name="array" type="GLenum"/>
<glx handcode="true"/>
</function>
<function name="NormalPointer" offset="318" static_dispatch="false">
<param name="type" type="GLenum"/>
<param name="stride" type="GLsizei"/>
<param name="pointer" type="const GLvoid *"/>
<glx handcode="true"/>
</function>
<function name="TexCoordPointer" offset="320" static_dispatch="false">
<param name="size" type="GLint"/>
<param name="type" type="GLenum"/>
<param name="stride" type="GLsizei"/>
<param name="pointer" type="const GLvoid *"/>
<glx handcode="true"/>
</function>
<function name="VertexPointer" offset="321" static_dispatch="false">
<param name="size" type="GLint"/>
<param name="type" type="GLenum"/>
<param name="stride" type="GLsizei"/>
<param name="pointer" type="const GLvoid *"/>
<glx handcode="true"/>
</function>
<function name="GetPointerv" offset="329" static_dispatch="false">
<param name="pname" type="GLenum"/>
<param name="params" type="GLvoid **" output="true"/>
<glx handcode="true"/>
</function>
<!-- OpenGL 1.2 -->
<function name="TexImage3D" alias="TexImage3DOES" static_dispatch="false">
<param name="target" type="GLenum"/>
<param name="level" type="GLint"/>
<param name="internalformat" type="GLint"/>
<param name="width" type="GLsizei"/>
<param name="height" type="GLsizei"/>
<param name="depth" type="GLsizei"/>
<param name="border" type="GLint"/>
<param name="format" type="GLenum"/>
<param name="type" type="GLenum"/>
<param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_format="format" img_type="type" img_target="target" img_null_flag="true" img_pad_dimensions="true"/>
<glx rop="4114" large="true"/>
</function>
<function name="TexSubImage3D" alias="TexSubImage3DOES" static_dispatch="false">
<param name="target" type="GLenum"/>
<param name="level" type="GLint"/>
<param name="xoffset" type="GLint"/>
<param name="yoffset" type="GLint"/>
<param name="zoffset" type="GLint"/>
<param name="width" type="GLsizei"/>
<param name="height" type="GLsizei"/>
<param name="depth" type="GLsizei"/>
<param name="format" type="GLenum"/>
<param name="type" type="GLenum"/>
<param name="UNUSED" type="GLuint" padding="true"/>
<param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_xoff="xoffset" img_yoff="yoffset" img_zoff="zoffset" img_format="format" img_type="type" img_target="target" img_pad_dimensions="true"/>
<glx rop="4115" large="true"/>
</function>
<function name="CopyTexSubImage3D" alias="CopyTexSubImage3DOES" static_dispatch="false">
<param name="target" type="GLenum"/>
<param name="level" type="GLint"/>
<param name="xoffset" type="GLint"/>
<param name="yoffset" type="GLint"/>
<param name="zoffset" type="GLint"/>
<param name="x" type="GLint"/>
<param name="y" type="GLint"/>
<param name="width" type="GLsizei"/>
<param name="height" type="GLsizei"/>
<glx rop="4123"/>
</function>
<!-- GL_ARB_multitexture -->
<function name="ActiveTextureARB" alias="ActiveTexture" static_dispatch="false">
<param name="texture" type="GLenum"/>
<glx rop="197"/>
</function>
<function name="ClientActiveTextureARB" offset="375" static_dispatch="false">
<param name="texture" type="GLenum"/>
<glx handcode="true"/>
</function>
<function name="MultiTexCoord4fARB" offset="402" vectorequiv="MultiTexCoord4fvARB" static_dispatch="false">
<param name="target" type="GLenum"/>
<param name="s" type="GLfloat"/>
<param name="t" type="GLfloat"/>
<param name="r" type="GLfloat"/>
<param name="q" type="GLfloat"/>
</function>
</category>
</OpenGLAPI>

View File

@@ -0,0 +1,122 @@
<?xml version="1.0"?>
<!DOCTYPE OpenGLAPI SYSTEM "../../glapi/gl_API.dtd">
<!-- OpenGL ES 2.x extensions -->
<OpenGLAPI>
<xi:include href="es_EXT.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<category name="GL_OES_texture_3D" number="34">
<enum name="TEXTURE_BINDING_3D_OES" value="0x806A"/>
<enum name="TEXTURE_3D_OES" value="0x806F"/>
<enum name="TEXTURE_WRAP_R_OES" value="0x8072"/>
<enum name="MAX_3D_TEXTURE_SIZE_OES" value="0x8073"/>
<enum name="SAMPLER_3D_OES" value="0x8B5F"/>
<enum name="FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES" value="0x8CD4"/>
<function name="CompressedTexImage3DOES" offset="assign">
<param name="target" type="GLenum"/>
<param name="level" type="GLint"/>
<param name="internalformat" type="GLenum"/>
<param name="width" type="GLsizei"/>
<param name="height" type="GLsizei"/>
<param name="depth" type="GLsizei"/>
<param name="border" type="GLint"/>
<param name="imageSize" type="GLsizei" counter="true"/>
<param name="data" type="const GLvoid *" count="imageSize"/>
<glx rop="216" handcode="client"/>
</function>
<function name="CompressedTexSubImage3DOES" offset="assign">
<param name="target" type="GLenum"/>
<param name="level" type="GLint"/>
<param name="xoffset" type="GLint"/>
<param name="yoffset" type="GLint"/>
<param name="zoffset" type="GLint"/>
<param name="width" type="GLsizei"/>
<param name="height" type="GLsizei"/>
<param name="depth" type="GLsizei"/>
<param name="format" type="GLenum"/>
<param name="imageSize" type="GLsizei" counter="true"/>
<param name="data" type="const GLvoid *" count="imageSize"/>
<glx rop="219" handcode="client"/>
</function>
<function name="CopyTexSubImage3DOES" offset="373">
<param name="target" type="GLenum"/>
<param name="level" type="GLint"/>
<param name="xoffset" type="GLint"/>
<param name="yoffset" type="GLint"/>
<param name="zoffset" type="GLint"/>
<param name="x" type="GLint"/>
<param name="y" type="GLint"/>
<param name="width" type="GLsizei"/>
<param name="height" type="GLsizei"/>
<glx rop="4123"/>
</function>
<function name="FramebufferTexture3DOES" offset="assign">
<param name="target" type="GLenum"/>
<param name="attachment" type="GLenum"/>
<param name="textarget" type="GLenum"/>
<param name="texture" type="GLuint"/>
<param name="level" type="GLint"/>
<param name="zoffset" type="GLint"/>
<glx rop="4323"/>
</function>
<function name="TexImage3DOES" offset="371">
<param name="target" type="GLenum"/>
<param name="level" type="GLint"/>
<param name="internalformat" type="GLenum"/>
<param name="width" type="GLsizei"/>
<param name="height" type="GLsizei"/>
<param name="depth" type="GLsizei"/>
<param name="border" type="GLint"/>
<param name="format" type="GLenum"/>
<param name="type" type="GLenum"/>
<param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_format="format" img_type="type" img_target="target" img_null_flag="true" img_pad_dimensions="true"/>
<glx rop="4114" large="true"/>
</function>
<function name="TexSubImage3DOES" offset="372">
<param name="target" type="GLenum"/>
<param name="level" type="GLint"/>
<param name="xoffset" type="GLint"/>
<param name="yoffset" type="GLint"/>
<param name="zoffset" type="GLint"/>
<param name="width" type="GLsizei"/>
<param name="height" type="GLsizei"/>
<param name="depth" type="GLsizei"/>
<param name="format" type="GLenum"/>
<param name="type" type="GLenum"/>
<param name="UNUSED" type="GLuint" padding="true"/>
<param name="pixels" type="const GLvoid *" img_width="width" img_height="height" img_depth="depth" img_xoff="xoffset" img_yoff="yoffset" img_zoff="zoffset" img_format="format" img_type="type" img_target="target" img_pad_dimensions="true"/>
<glx rop="4115" large="true"/>
</function>
</category>
<category name="GL_OES_texture_npot" number="37">
<!-- No new functions, types, enums. -->
</category>
<category name="GL_EXT_texture_type_2_10_10_10_REV" number="42">
<enum name="UNSIGNED_INT_2_10_10_10_REV_EXT" value="0x8368"/>
</category>
<category name="GL_OES_packed_depth_stencil" number="43">
<enum name="DEPTH_STENCIL_OES" value="0x84F9"/>
<enum name="UNSIGNED_INT_24_8_OES" value="0x84FA"/>
<enum name="DEPTH24_STENCIL8_OES" value="0x88F0"/>
</category>
<category name="GL_OES_depth_texture" number="44">
<!-- No new functions, types, enums. -->
</category>
<category name="GL_OES_standard_derivatives" number="45">
<enum name="FRAGMENT_SHADER_DERIVATIVE_HINT_OES" value="0x8B8B"/>
</category>
</OpenGLAPI>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,97 @@
<?xml version="1.0"?>
<!DOCTYPE OpenGLAPI SYSTEM "../../glapi/gl_API.dtd">
<!-- OpenGL ES extensions -->
<OpenGLAPI>
<category name="GL_OES_compressed_paletted_texture" number="6">
<enum name="PALETTE4_RGB8_OES" value="0x8B90"/>
<enum name="PALETTE4_RGBA8_OES" value="0x8B91"/>
<enum name="PALETTE4_R5_G6_B5_OES" value="0x8B92"/>
<enum name="PALETTE4_RGBA4_OES" value="0x8B93"/>
<enum name="PALETTE4_RGB5_A1_OES" value="0x8B94"/>
<enum name="PALETTE8_RGB8_OES" value="0x8B95"/>
<enum name="PALETTE8_RGBA8_OES" value="0x8B96"/>
<enum name="PALETTE8_R5_G6_B5_OES" value="0x8B97"/>
<enum name="PALETTE8_RGBA4_OES" value="0x8B98"/>
<enum name="PALETTE8_RGB5_A1_OES" value="0x8B99"/>
</category>
<category name="GL_OES_EGL_image" number="23">
<type name="eglImageOES" size="4" />
<function name="EGLImageTargetTexture2DOES" offset="assign">
<param name="target" type="GLenum"/>
<param name="image" type="GLeglImageOES"/>
</function>
<function name="EGLImageTargetRenderbufferStorageOES" offset="assign">
<param name="target" type="GLenum"/>
<param name="image" type="GLeglImageOES"/>
</function>
</category>
<category name="GL_OES_depth24" number="24">
<enum name="DEPTH_COMPONENT24_OES" value="0x81A6"/>
</category>
<category name="GL_OES_depth32" number="25">
<enum name="DEPTH_COMPONENT32_OES" value="0x81A7"/>
</category>
<category name="GL_OES_element_index_uint" number="26">
<!-- No new functions, types, enums. -->
</category>
<category name="GL_OES_fbo_render_mipmap" number="27">
<!-- No new functions, types, enums. -->
</category>
<category name="GL_OES_mapbuffer" number="29">
<enum name="WRITE_ONLY_OES" value="0x88B9"/>
<enum name="BUFFER_ACCESS_OES" value="0x88BB"/>
<enum name="BUFFER_MAPPED_OES" value="0x88BC"/>
<enum name="BUFFER_MAP_POINTER_OES" value="0x88BD"/>
<function name="GetBufferPointervOES" offset="assign">
<param name="target" type="GLenum"/>
<param name="pname" type="GLenum"/>
<param name="params" type="GLvoid **"/>
</function>
<function name="MapBufferOES" offset="assign">
<param name="target" type="GLenum"/>
<param name="access" type="GLenum"/>
<return type="GLvoid *"/>
</function>
<function name="UnmapBufferOES" offset="assign">
<param name="target" type="GLenum"/>
<return type="GLboolean"/>
</function>
</category>
<category name="GL_OES_rgb8_rgba8" number="30">
<enum name="RGB8_OES" value="0x8051"/>
<enum name="RGBA8_OES" value="0x8058"/>
</category>
<category name="GL_OES_stencil1" number="31">
<enum name="STENCIL_INDEX1_OES" value="0x8D46"/>
</category>
<category name="GL_OES_stencil4" number="32">
<enum name="STENCIL_INDEX4_OES" value="0x8D47"/>
</category>
<category name="GL_OES_stencil8" number="33">
<enum name="STENCIL_INDEX8_OES" value="0x8D48"/>
</category>
<category name="GL_EXT_texture_filter_anisotropic" number="41">
<enum name="TEXTURE_MAX_ANISOTROPY_EXT" value="0x84FE"/>
<enum name="MAX_TEXTURE_MAX_ANISOTROPY_EXT" value="0x84FF"/>
</category>
</OpenGLAPI>

View File

@@ -0,0 +1,354 @@
#!/usr/bin/python
#
# Copyright (C) Chia-I Wu <olvaffe@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# 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
# IBM 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.
import sys
import os.path
import getopt
GLAPI = "../../glapi"
sys.path.append(GLAPI)
import gl_XML
import glX_XML
class ApiSet(object):
def __init__(self, api, elts=["enum", "type", "function"]):
self.api = api
self.elts = elts
def _check_enum(self, e1, e2, strict=True):
if e1.name != e2.name:
raise ValueError("%s: name mismatch" % e1.name)
if e1.value != e2.value:
raise ValueError("%s: value 0x%04x != 0x%04x"
% (e1.name, e1.value, e2.value))
def _check_type(self, t1, t2, strict=True):
if t1.name != t2.name:
raise ValueError("%s: name mismatch" % t1.name)
if t1.type_expr.string() != t2.type_expr.string():
raise ValueError("%s: type %s != %s"
% (t1.name, t1.type_expr.string(), t2.type_expr.string()))
def _check_function(self, f1, f2, strict=True):
if f1.name != f2.name:
raise ValueError("%s: name mismatch" % f1.name)
if f1.return_type != f2.return_type:
raise ValueError("%s: return type %s != %s"
% (f1.name, f1.return_type, f2.return_type))
# there might be padded parameters
if strict and len(f1.parameters) != len(f2.parameters):
raise ValueError("%s: parameter length %d != %d"
% (f1.name, len(f1.parameters), len(f2.parameters)))
if f1.assign_offset != f2.assign_offset:
if ((f1.assign_offset and f2.offset < 0) or
(f2.assign_offset and f1.offset < 0)):
raise ValueError("%s: assign offset %d != %d"
% (f1.name, f1.assign_offset, f2.assign_offset))
elif not f1.assign_offset:
if f1.offset != f2.offset:
raise ValueError("%s: offset %d != %d"
% (f1.name, f1.offset, f2.offset))
if strict:
l1 = f1.entry_points
l2 = f2.entry_points
l1.sort()
l2.sort()
if l1 != l2:
raise ValueError("%s: entry points %s != %s"
% (f1.name, l1, l2))
l1 = f1.static_entry_points
l2 = f2.static_entry_points
l1.sort()
l2.sort()
if l1 != l2:
raise ValueError("%s: static entry points %s != %s"
% (f1.name, l1, l2))
pad = 0
for i in xrange(len(f1.parameters)):
p1 = f1.parameters[i]
p2 = f2.parameters[i + pad]
if not strict and p1.is_padding != p2.is_padding:
if p1.is_padding:
pad -= 1
continue
else:
pad += 1
p2 = f2.parameters[i + pad]
if strict and p1.name != p2.name:
raise ValueError("%s: parameter %d name %s != %s"
% (f1.name, i, p1.name, p2.name))
if p1.type_expr.string() != p2.type_expr.string():
if (strict or
# special case
f1.name == "TexImage2D" and p1.name != "internalformat"):
raise ValueError("%s: parameter %s type %s != %s"
% (f1.name, p1.name, p1.type_expr.string(),
p2.type_expr.string()))
def union(self, other):
union = gl_XML.gl_api(None)
if "enum" in self.elts:
union.enums_by_name = other.enums_by_name.copy()
for key, val in self.api.enums_by_name.iteritems():
if key not in union.enums_by_name:
union.enums_by_name[key] = val
else:
self._check_enum(val, other.enums_by_name[key])
if "type" in self.elts:
union.types_by_name = other.types_by_name.copy()
for key, val in self.api.types_by_name.iteritems():
if key not in union.types_by_name:
union.types_by_name[key] = val
else:
self._check_type(val, other.types_by_name[key])
if "function" in self.elts:
union.functions_by_name = other.functions_by_name.copy()
for key, val in self.api.functions_by_name.iteritems():
if key not in union.functions_by_name:
union.functions_by_name[key] = val
else:
self._check_function(val, other.functions_by_name[key])
return union
def intersection(self, other):
intersection = gl_XML.gl_api(None)
if "enum" in self.elts:
for key, val in self.api.enums_by_name.iteritems():
if key in other.enums_by_name:
self._check_enum(val, other.enums_by_name[key])
intersection.enums_by_name[key] = val
if "type" in self.elts:
for key, val in self.api.types_by_name.iteritems():
if key in other.types_by_name:
self._check_type(val, other.types_by_name[key])
intersection.types_by_name[key] = val
if "function" in self.elts:
for key, val in self.api.functions_by_name.iteritems():
if key in other.functions_by_name:
self._check_function(val, other.functions_by_name[key])
intersection.functions_by_name[key] = val
return intersection
def difference(self, other):
difference = gl_XML.gl_api(None)
if "enum" in self.elts:
for key, val in self.api.enums_by_name.iteritems():
if key not in other.enums_by_name:
difference.enums_by_name[key] = val
else:
self._check_enum(val, other.enums_by_name[key])
if "type" in self.elts:
for key, val in self.api.types_by_name.iteritems():
if key not in other.types_by_name:
difference.types_by_name[key] = val
else:
self._check_type(val, other.types_by_name[key])
if "function" in self.elts:
for key, val in self.api.functions_by_name.iteritems():
if key not in other.functions_by_name:
difference.functions_by_name[key] = val
else:
self._check_function(val, other.functions_by_name[key], False)
return difference
def cmp_enum(e1, e2):
if e1.value < e2.value:
return -1
elif e1.value > e2.value:
return 1
else:
return 0
def cmp_type(t1, t2):
return t1.size - t2.size
def cmp_function(f1, f2):
if f1.name > f2.name:
return 1
elif f1.name < f2.name:
return -1
else:
return 0
def spaces(n, str=""):
spaces = n - len(str)
if spaces < 1:
spaces = 1
return " " * spaces
def output_enum(e, indent=0):
attrs = 'name="%s"' % e.name
if e.default_count > 0:
tab = spaces(37, attrs)
attrs += '%scount="%d"' % (tab, e.default_count)
tab = spaces(48, attrs)
val = "%04x" % e.value
val = "0x" + val.upper()
attrs += '%svalue="%s"' % (tab, val)
# no child
if not e.functions:
print '%s<enum %s/>' % (spaces(indent), attrs)
return
print '%s<enum %s>' % (spaces(indent), attrs)
for key, val in e.functions.iteritems():
attrs = 'name="%s"' % key
if val[0] != e.default_count:
attrs += ' count="%d"' % val[0]
if not val[1]:
attrs += ' mode="get"'
print '%s<size %s/>' % (spaces(indent * 2), attrs)
print '%s</enum>' % spaces(indent)
def output_type(t, indent=0):
tab = spaces(16, t.name)
attrs = 'name="%s"%ssize="%d"' % (t.name, tab, t.size)
ctype = t.type_expr.string()
if ctype.find("unsigned") != -1:
attrs += ' unsigned="true"'
elif ctype.find("signed") == -1:
attrs += ' float="true"'
print '%s<type %s/>' % (spaces(indent), attrs)
def output_function(f, indent=0):
attrs = 'name="%s"' % f.name
if f.offset > 0:
if f.assign_offset:
attrs += ' offset="assign"'
else:
attrs += ' offset="%d"' % f.offset
print '%s<function %s>' % (spaces(indent), attrs)
for p in f.parameters:
attrs = 'name="%s" type="%s"' \
% (p.name, p.type_expr.original_string)
print '%s<param %s/>' % (spaces(indent * 2), attrs)
if f.return_type != "void":
attrs = 'type="%s"' % f.return_type
print '%s<return %s/>' % (spaces(indent * 2), attrs)
print '%s</function>' % spaces(indent)
def output_category(api, indent=0):
enums = api.enums_by_name.values()
enums.sort(cmp_enum)
types = api.types_by_name.values()
types.sort(cmp_type)
functions = api.functions_by_name.values()
functions.sort(cmp_function)
for e in enums:
output_enum(e, indent)
if enums and types:
print
for t in types:
output_type(t, indent)
if enums or types:
print
for f in functions:
output_function(f, indent)
if f != functions[-1]:
print
def is_api_empty(api):
return bool(not api.enums_by_name and
not api.types_by_name and
not api.functions_by_name)
def show_usage(ops):
print "Usage: %s [-k elts] <%s> <file1> <file2>" % (sys.argv[0], "|".join(ops))
print " -k elts A comma separated string of types of elements to"
print " skip. Possible types are enum, type, and function."
sys.exit(1)
def main():
ops = ["union", "intersection", "difference"]
elts = ["enum", "type", "function"]
try:
options, args = getopt.getopt(sys.argv[1:], "k:")
except Exception, e:
show_usage(ops)
if len(args) != 3:
show_usage(ops)
op, file1, file2 = args
if op not in ops:
show_usage(ops)
skips = []
for opt, val in options:
if opt == "-k":
skips = val.split(",")
for elt in skips:
try:
elts.remove(elt)
except ValueError:
show_usage(ops)
api1 = gl_XML.parse_GL_API(file1, glX_XML.glx_item_factory())
api2 = gl_XML.parse_GL_API(file2, glX_XML.glx_item_factory())
set = ApiSet(api1, elts)
func = getattr(set, op)
result = func(api2)
if not is_api_empty(result):
cat_name = "%s_of_%s_and_%s" \
% (op, os.path.basename(file1), os.path.basename(file2))
print '<?xml version="1.0"?>'
print '<!DOCTYPE OpenGLAPI SYSTEM "%s/gl_API.dtd">' % GLAPI
print
print '<OpenGLAPI>'
print
print '<category name="%s">' % (cat_name)
output_category(result, 4)
print '</category>'
print
print '</OpenGLAPI>'
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,450 @@
#!/usr/bin/python
#
# Copyright (C) Chia-I Wu <olvaffe@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# 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
# IBM 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.
import sys
import os.path
import getopt
import re
GLAPI = "../../glapi"
sys.path.append(GLAPI)
class HeaderParser(object):
"""Parser for GL header files."""
def __init__(self, verbose=0):
# match #if and #ifdef
self.IFDEF = re.compile('#\s*if(n?def\s+(?P<ifdef>\w+)|\s+(?P<if>.+))')
# match #endif
self.ENDIF = re.compile('#\s*endif')
# match typedef abc def;
self.TYPEDEF = re.compile('typedef\s+(?P<from>[\w ]+)\s+(?P<to>\w+);')
# match #define XYZ VAL
self.DEFINE = re.compile('#\s*define\s+(?P<key>\w+)(?P<value>\s+[\w"]*)?')
# match GLAPI
self.GLAPI = re.compile('^GL_?API(CALL)?\s+(?P<return>[\w\s*]+[\w*])\s+(GL)?_?APIENTRY\s+(?P<name>\w+)\s*\((?P<params>[\w\s(,*\[\])]+)\)\s*;')
self.split_params = re.compile('\s*,\s*')
self.split_ctype = re.compile('(\W)')
# ignore GL_VERSION_X_Y
self.ignore_enum = re.compile('GL(_ES)?_VERSION(_ES_C[ML])?_\d_\d')
self.verbose = verbose
self._reset()
def _reset(self):
"""Reset to initial state."""
self.ifdef_levels = []
self.need_char = False
# use typeexpr?
def _format_ctype(self, ctype, fix=True):
"""Format a ctype string, optionally fix it."""
# split the type string
tmp = self.split_ctype.split(ctype)
tmp = [s for s in tmp if s and s != " "]
pretty = ""
for i in xrange(len(tmp)):
# add missing GL prefix
if (fix and tmp[i] != "const" and tmp[i] != "*" and
not tmp[i].startswith("GL")):
tmp[i] = "GL" + tmp[i]
if i == 0:
pretty = tmp[i]
else:
sep = " "
if tmp[i - 1] == "*":
sep = ""
pretty += sep + tmp[i]
return pretty
# use typeexpr?
def _get_ctype_attrs(self, ctype):
"""Get the attributes of a ctype."""
is_float = (ctype.find("float") != -1 or ctype.find("double") != -1)
is_signed = not (ctype.find("unsigned") != -1)
size = 0
if ctype.find("char") != -1:
size = 1
elif ctype.find("short") != -1:
size = 2
elif ctype.find("int") != -1:
size = 4
elif is_float:
if ctype.find("float") != -1:
size = 4
else:
size = 8
return (size, is_float, is_signed)
def _parse_define(self, line):
"""Parse a #define line for an <enum>."""
m = self.DEFINE.search(line)
if not m:
if self.verbose and line.find("#define") >= 0:
print "ignore %s" % (line)
return None
key = m.group("key").strip()
val = m.group("value").strip()
# enum must begin with GL_ and be all uppercase
if ((not (key.startswith("GL_") and key.isupper())) or
(self.ignore_enum.match(key) and val == "1")):
if self.verbose:
print "ignore enum %s" % (key)
return None
return (key, val)
def _parse_typedef(self, line):
"""Parse a typedef line for a <type>."""
m = self.TYPEDEF.search(line)
if not m:
if self.verbose and line.find("typedef") >= 0:
print "ignore %s" % (line)
return None
f = m.group("from").strip()
t = m.group("to").strip()
if not t.startswith("GL"):
if self.verbose:
print "ignore type %s" % (t)
return None
attrs = self._get_ctype_attrs(f)
return (f, t, attrs)
def _parse_gl_api(self, line):
"""Parse a GLAPI line for a <function>."""
m = self.GLAPI.search(line)
if not m:
if self.verbose and line.find("APIENTRY") >= 0:
print "ignore %s" % (line)
return None
rettype = m.group("return")
rettype = self._format_ctype(rettype)
if rettype == "GLvoid":
rettype = ""
name = m.group("name")
param_str = m.group("params")
chunks = self.split_params.split(param_str)
chunks = [s.strip() for s in chunks]
if len(chunks) == 1 and (chunks[0] == "void" or chunks[0] == "GLvoid"):
chunks = []
params = []
for c in chunks:
# split type and variable name
idx = c.rfind("*")
if idx < 0:
idx = c.rfind(" ")
if idx >= 0:
idx += 1
ctype = c[:idx]
var = c[idx:]
else:
ctype = c
var = "unnamed"
# convert array to pointer
idx = var.find("[")
if idx >= 0:
var = var[:idx]
ctype += "*"
ctype = self._format_ctype(ctype)
var = var.strip()
if not self.need_char and ctype.find("GLchar") >= 0:
self.need_char = True
params.append((ctype, var))
return (rettype, name, params)
def _change_level(self, line):
"""Parse a #ifdef line and change level."""
m = self.IFDEF.search(line)
if m:
ifdef = m.group("ifdef")
if not ifdef:
ifdef = m.group("if")
self.ifdef_levels.append(ifdef)
return True
m = self.ENDIF.search(line)
if m:
self.ifdef_levels.pop()
return True
return False
def _read_header(self, header):
"""Open a header file and read its contents."""
lines = []
try:
fp = open(header, "rb")
lines = fp.readlines()
fp.close()
except IOError, e:
print "failed to read %s: %s" % (header, e)
return lines
def _cmp_enum(self, enum1, enum2):
"""Compare two enums."""
# sort by length of the values as strings
val1 = enum1[1]
val2 = enum2[1]
ret = len(val1) - len(val2)
# sort by the values
if not ret:
val1 = int(val1, 16)
val2 = int(val2, 16)
ret = val1 - val2
# in case int cannot hold the result
if ret > 0:
ret = 1
elif ret < 0:
ret = -1
# sort by the names
if not ret:
if enum1[0] < enum2[0]:
ret = -1
elif enum1[0] > enum2[0]:
ret = 1
return ret
def _cmp_type(self, type1, type2):
"""Compare two types."""
attrs1 = type1[2]
attrs2 = type2[2]
# sort by type size
ret = attrs1[0] - attrs2[0]
# float is larger
if not ret:
ret = attrs1[1] - attrs2[1]
# signed is larger
if not ret:
ret = attrs1[2] - attrs2[2]
# reverse
ret = -ret
return ret
def _cmp_function(self, func1, func2):
"""Compare two functions."""
name1 = func1[1]
name2 = func2[1]
ret = 0
# sort by the names
if name1 < name2:
ret = -1
elif name1 > name2:
ret = 1
return ret
def _postprocess_dict(self, hdict):
"""Post-process a header dict and return an ordered list."""
hlist = []
largest = 0
for key, cat in hdict.iteritems():
size = len(cat["enums"]) + len(cat["types"]) + len(cat["functions"])
# ignore empty category
if not size:
continue
cat["enums"].sort(self._cmp_enum)
# remove duplicates
dup = []
for i in xrange(1, len(cat["enums"])):
if cat["enums"][i] == cat["enums"][i - 1]:
dup.insert(0, i)
for i in dup:
e = cat["enums"].pop(i)
if self.verbose:
print "remove duplicate enum %s" % e[0]
cat["types"].sort(self._cmp_type)
cat["functions"].sort(self._cmp_function)
# largest category comes first
if size > largest:
hlist.insert(0, (key, cat))
largest = size
else:
hlist.append((key, cat))
return hlist
def parse(self, header):
"""Parse a header file."""
self._reset()
if self.verbose:
print "Parsing %s" % (header)
hdict = {}
lines = self._read_header(header)
for line in lines:
if self._change_level(line):
continue
# skip until the first ifdef (i.e. __gl_h_)
if not self.ifdef_levels:
continue
cat_name = os.path.basename(header)
# check if we are in an extension
if (len(self.ifdef_levels) > 1 and
self.ifdef_levels[-1].startswith("GL_")):
cat_name = self.ifdef_levels[-1]
try:
cat = hdict[cat_name]
except KeyError:
cat = {
"enums": [],
"types": [],
"functions": []
}
hdict[cat_name] = cat
key = "enums"
elem = self._parse_define(line)
if not elem:
key = "types"
elem = self._parse_typedef(line)
if not elem:
key = "functions"
elem = self._parse_gl_api(line)
if elem:
cat[key].append(elem)
if self.need_char:
if self.verbose:
print "define GLchar"
elem = self._parse_typedef("typedef char GLchar;")
cat["types"].append(elem)
return self._postprocess_dict(hdict)
def spaces(n, str=""):
spaces = n - len(str)
if spaces < 1:
spaces = 1
return " " * spaces
def output_xml(name, hlist):
"""Output a parsed header in OpenGLAPI XML."""
for i in xrange(len(hlist)):
cat_name, cat = hlist[i]
print '<category name="%s">' % (cat_name)
indent = 4
for enum in cat["enums"]:
name = enum[0][3:]
value = enum[1]
tab = spaces(41, name)
attrs = 'name="%s"%svalue="%s"' % (name, tab, value)
print '%s<enum %s/>' % (spaces(indent), attrs)
if cat["enums"] and cat["types"]:
print
for type in cat["types"]:
ctype = type[0]
size, is_float, is_signed = type[2]
attrs = 'name="%s"' % (type[1][2:])
attrs += spaces(16, attrs) + 'size="%d"' % (size)
if is_float:
attrs += ' float="true"'
elif not is_signed:
attrs += ' unsigned="true"'
print '%s<type %s/>' % (spaces(indent), attrs)
for func in cat["functions"]:
print
ret = func[0]
name = func[1][2:]
params = func[2]
attrs = 'name="%s" offset="assign"' % name
print '%s<function %s>' % (spaces(indent), attrs)
for param in params:
attrs = 'name="%s" type="%s"' % (param[1], param[0])
print '%s<param %s/>' % (spaces(indent * 2), attrs)
if ret:
attrs = 'type="%s"' % ret
print '%s<return %s/>' % (spaces(indent * 2), attrs)
print '%s</function>' % spaces(indent)
print '</category>'
print
def show_usage():
print "Usage: %s [-v] <header> ..." % sys.argv[0]
sys.exit(1)
def main():
try:
args, headers = getopt.getopt(sys.argv[1:], "v")
except Exception, e:
show_usage()
if not headers:
show_usage()
verbose = 0
for arg in args:
if arg[0] == "-v":
verbose += 1
need_xml_header = True
parser = HeaderParser(verbose)
for h in headers:
h = os.path.abspath(h)
hlist = parser.parse(h)
if need_xml_header:
print '<?xml version="1.0"?>'
print '<!DOCTYPE OpenGLAPI SYSTEM "%s/gl_API.dtd">' % GLAPI
need_xml_header = False
print
print '<!-- %s -->' % (h)
print '<OpenGLAPI>'
print
output_xml(h, hlist)
print '</OpenGLAPI>'
if __name__ == '__main__':
main()

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,797 @@
/* DO NOT EDIT - This file generated automatically by gl_offsets.py (from Mesa) script */
/*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
* (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
* 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
* BRIAN PAUL, IBM,
* 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.
*/
#if !defined( _GLAPI_OFFSETS_H_ )
# define _GLAPI_OFFSETS_H_
#define _gloffset_NewList 0
#define _gloffset_EndList 1
#define _gloffset_CallList 2
#define _gloffset_CallLists 3
#define _gloffset_DeleteLists 4
#define _gloffset_GenLists 5
#define _gloffset_ListBase 6
#define _gloffset_Begin 7
#define _gloffset_Bitmap 8
#define _gloffset_Color3b 9
#define _gloffset_Color3bv 10
#define _gloffset_Color3d 11
#define _gloffset_Color3dv 12
#define _gloffset_Color3f 13
#define _gloffset_Color3fv 14
#define _gloffset_Color3i 15
#define _gloffset_Color3iv 16
#define _gloffset_Color3s 17
#define _gloffset_Color3sv 18
#define _gloffset_Color3ub 19
#define _gloffset_Color3ubv 20
#define _gloffset_Color3ui 21
#define _gloffset_Color3uiv 22
#define _gloffset_Color3us 23
#define _gloffset_Color3usv 24
#define _gloffset_Color4b 25
#define _gloffset_Color4bv 26
#define _gloffset_Color4d 27
#define _gloffset_Color4dv 28
#define _gloffset_Color4fv 30
#define _gloffset_Color4i 31
#define _gloffset_Color4iv 32
#define _gloffset_Color4s 33
#define _gloffset_Color4sv 34
#define _gloffset_Color4ubv 36
#define _gloffset_Color4ui 37
#define _gloffset_Color4uiv 38
#define _gloffset_Color4us 39
#define _gloffset_Color4usv 40
#define _gloffset_EdgeFlag 41
#define _gloffset_EdgeFlagv 42
#define _gloffset_End 43
#define _gloffset_Indexd 44
#define _gloffset_Indexdv 45
#define _gloffset_Indexf 46
#define _gloffset_Indexfv 47
#define _gloffset_Indexi 48
#define _gloffset_Indexiv 49
#define _gloffset_Indexs 50
#define _gloffset_Indexsv 51
#define _gloffset_Normal3b 52
#define _gloffset_Normal3bv 53
#define _gloffset_Normal3d 54
#define _gloffset_Normal3dv 55
#define _gloffset_Normal3fv 57
#define _gloffset_Normal3i 58
#define _gloffset_Normal3iv 59
#define _gloffset_Normal3s 60
#define _gloffset_Normal3sv 61
#define _gloffset_RasterPos2d 62
#define _gloffset_RasterPos2dv 63
#define _gloffset_RasterPos2f 64
#define _gloffset_RasterPos2fv 65
#define _gloffset_RasterPos2i 66
#define _gloffset_RasterPos2iv 67
#define _gloffset_RasterPos2s 68
#define _gloffset_RasterPos2sv 69
#define _gloffset_RasterPos3d 70
#define _gloffset_RasterPos3dv 71
#define _gloffset_RasterPos3f 72
#define _gloffset_RasterPos3fv 73
#define _gloffset_RasterPos3i 74
#define _gloffset_RasterPos3iv 75
#define _gloffset_RasterPos3s 76
#define _gloffset_RasterPos3sv 77
#define _gloffset_RasterPos4d 78
#define _gloffset_RasterPos4dv 79
#define _gloffset_RasterPos4f 80
#define _gloffset_RasterPos4fv 81
#define _gloffset_RasterPos4i 82
#define _gloffset_RasterPos4iv 83
#define _gloffset_RasterPos4s 84
#define _gloffset_RasterPos4sv 85
#define _gloffset_Rectd 86
#define _gloffset_Rectdv 87
#define _gloffset_Rectf 88
#define _gloffset_Rectfv 89
#define _gloffset_Recti 90
#define _gloffset_Rectiv 91
#define _gloffset_Rects 92
#define _gloffset_Rectsv 93
#define _gloffset_TexCoord1d 94
#define _gloffset_TexCoord1dv 95
#define _gloffset_TexCoord1f 96
#define _gloffset_TexCoord1fv 97
#define _gloffset_TexCoord1i 98
#define _gloffset_TexCoord1iv 99
#define _gloffset_TexCoord1s 100
#define _gloffset_TexCoord1sv 101
#define _gloffset_TexCoord2d 102
#define _gloffset_TexCoord2dv 103
#define _gloffset_TexCoord2f 104
#define _gloffset_TexCoord2fv 105
#define _gloffset_TexCoord2i 106
#define _gloffset_TexCoord2iv 107
#define _gloffset_TexCoord2s 108
#define _gloffset_TexCoord2sv 109
#define _gloffset_TexCoord3d 110
#define _gloffset_TexCoord3dv 111
#define _gloffset_TexCoord3f 112
#define _gloffset_TexCoord3fv 113
#define _gloffset_TexCoord3i 114
#define _gloffset_TexCoord3iv 115
#define _gloffset_TexCoord3s 116
#define _gloffset_TexCoord3sv 117
#define _gloffset_TexCoord4d 118
#define _gloffset_TexCoord4dv 119
#define _gloffset_TexCoord4f 120
#define _gloffset_TexCoord4fv 121
#define _gloffset_TexCoord4i 122
#define _gloffset_TexCoord4iv 123
#define _gloffset_TexCoord4s 124
#define _gloffset_TexCoord4sv 125
#define _gloffset_Vertex2d 126
#define _gloffset_Vertex2dv 127
#define _gloffset_Vertex2f 128
#define _gloffset_Vertex2fv 129
#define _gloffset_Vertex2i 130
#define _gloffset_Vertex2iv 131
#define _gloffset_Vertex2s 132
#define _gloffset_Vertex2sv 133
#define _gloffset_Vertex3d 134
#define _gloffset_Vertex3dv 135
#define _gloffset_Vertex3f 136
#define _gloffset_Vertex3fv 137
#define _gloffset_Vertex3i 138
#define _gloffset_Vertex3iv 139
#define _gloffset_Vertex3s 140
#define _gloffset_Vertex3sv 141
#define _gloffset_Vertex4d 142
#define _gloffset_Vertex4dv 143
#define _gloffset_Vertex4f 144
#define _gloffset_Vertex4fv 145
#define _gloffset_Vertex4i 146
#define _gloffset_Vertex4iv 147
#define _gloffset_Vertex4s 148
#define _gloffset_Vertex4sv 149
#define _gloffset_ClipPlane 150
#define _gloffset_ColorMaterial 151
#define _gloffset_Fogi 155
#define _gloffset_Fogiv 156
#define _gloffset_Lighti 161
#define _gloffset_Lightiv 162
#define _gloffset_LightModeli 165
#define _gloffset_LightModeliv 166
#define _gloffset_LineStipple 167
#define _gloffset_Materiali 171
#define _gloffset_Materialiv 172
#define _gloffset_PolygonMode 174
#define _gloffset_PolygonStipple 175
#define _gloffset_TexImage1D 182
#define _gloffset_TexGend 188
#define _gloffset_TexGendv 189
#define _gloffset_FeedbackBuffer 194
#define _gloffset_SelectBuffer 195
#define _gloffset_RenderMode 196
#define _gloffset_InitNames 197
#define _gloffset_LoadName 198
#define _gloffset_PassThrough 199
#define _gloffset_PopName 200
#define _gloffset_PushName 201
#define _gloffset_DrawBuffer 202
#define _gloffset_ClearAccum 204
#define _gloffset_ClearIndex 205
#define _gloffset_ClearDepth 208
#define _gloffset_IndexMask 212
#define _gloffset_Accum 213
#define _gloffset_PopAttrib 218
#define _gloffset_PushAttrib 219
#define _gloffset_Map1d 220
#define _gloffset_Map1f 221
#define _gloffset_Map2d 222
#define _gloffset_Map2f 223
#define _gloffset_MapGrid1d 224
#define _gloffset_MapGrid1f 225
#define _gloffset_MapGrid2d 226
#define _gloffset_MapGrid2f 227
#define _gloffset_EvalCoord1d 228
#define _gloffset_EvalCoord1dv 229
#define _gloffset_EvalCoord1f 230
#define _gloffset_EvalCoord1fv 231
#define _gloffset_EvalCoord2d 232
#define _gloffset_EvalCoord2dv 233
#define _gloffset_EvalCoord2f 234
#define _gloffset_EvalCoord2fv 235
#define _gloffset_EvalMesh1 236
#define _gloffset_EvalPoint1 237
#define _gloffset_EvalMesh2 238
#define _gloffset_EvalPoint2 239
#define _gloffset_PixelZoom 246
#define _gloffset_PixelTransferf 247
#define _gloffset_PixelTransferi 248
#define _gloffset_PixelStoref 249
#define _gloffset_PixelMapfv 251
#define _gloffset_PixelMapuiv 252
#define _gloffset_PixelMapusv 253
#define _gloffset_ReadBuffer 254
#define _gloffset_CopyPixels 255
#define _gloffset_DrawPixels 257
#define _gloffset_GetClipPlane 259
#define _gloffset_GetDoublev 260
#define _gloffset_GetLightiv 265
#define _gloffset_GetMapdv 266
#define _gloffset_GetMapfv 267
#define _gloffset_GetMapiv 268
#define _gloffset_GetMaterialiv 270
#define _gloffset_GetPixelMapfv 271
#define _gloffset_GetPixelMapuiv 272
#define _gloffset_GetPixelMapusv 273
#define _gloffset_GetPolygonStipple 274
#define _gloffset_GetTexGendv 278
#define _gloffset_GetTexImage 281
#define _gloffset_GetTexLevelParameterfv 284
#define _gloffset_GetTexLevelParameteriv 285
#define _gloffset_IsList 287
#define _gloffset_DepthRange 288
#define _gloffset_Frustum 289
#define _gloffset_LoadMatrixd 292
#define _gloffset_MultMatrixd 295
#define _gloffset_Ortho 296
#define _gloffset_Rotated 299
#define _gloffset_Scaled 301
#define _gloffset_Translated 303
#define _gloffset_ArrayElement 306
#define _gloffset_EdgeFlagPointer 312
#define _gloffset_IndexPointer 314
#define _gloffset_Indexub 315
#define _gloffset_Indexubv 316
#define _gloffset_InterleavedArrays 317
#define _gloffset_AreTexturesResident 322
#define _gloffset_CopyTexImage1D 323
#define _gloffset_CopyTexSubImage1D 325
#define _gloffset_PrioritizeTextures 331
#define _gloffset_TexSubImage1D 332
#define _gloffset_PopClientAttrib 334
#define _gloffset_PushClientAttrib 335
#define _gloffset_DrawRangeElements 338
#define _gloffset_ColorTable 339
#define _gloffset_ColorTableParameterfv 340
#define _gloffset_ColorTableParameteriv 341
#define _gloffset_CopyColorTable 342
#define _gloffset_GetColorTable 343
#define _gloffset_GetColorTableParameterfv 344
#define _gloffset_GetColorTableParameteriv 345
#define _gloffset_ColorSubTable 346
#define _gloffset_CopyColorSubTable 347
#define _gloffset_ConvolutionFilter1D 348
#define _gloffset_ConvolutionFilter2D 349
#define _gloffset_ConvolutionParameterf 350
#define _gloffset_ConvolutionParameterfv 351
#define _gloffset_ConvolutionParameteri 352
#define _gloffset_ConvolutionParameteriv 353
#define _gloffset_CopyConvolutionFilter1D 354
#define _gloffset_CopyConvolutionFilter2D 355
#define _gloffset_GetConvolutionFilter 356
#define _gloffset_GetConvolutionParameterfv 357
#define _gloffset_GetConvolutionParameteriv 358
#define _gloffset_GetSeparableFilter 359
#define _gloffset_SeparableFilter2D 360
#define _gloffset_GetHistogram 361
#define _gloffset_GetHistogramParameterfv 362
#define _gloffset_GetHistogramParameteriv 363
#define _gloffset_GetMinmax 364
#define _gloffset_GetMinmaxParameterfv 365
#define _gloffset_GetMinmaxParameteriv 366
#define _gloffset_Histogram 367
#define _gloffset_Minmax 368
#define _gloffset_ResetHistogram 369
#define _gloffset_ResetMinmax 370
#define _gloffset_MultiTexCoord1dARB 376
#define _gloffset_MultiTexCoord1dvARB 377
#define _gloffset_MultiTexCoord1fARB 378
#define _gloffset_MultiTexCoord1fvARB 379
#define _gloffset_MultiTexCoord1iARB 380
#define _gloffset_MultiTexCoord1ivARB 381
#define _gloffset_MultiTexCoord1sARB 382
#define _gloffset_MultiTexCoord1svARB 383
#define _gloffset_MultiTexCoord2dARB 384
#define _gloffset_MultiTexCoord2dvARB 385
#define _gloffset_MultiTexCoord2fARB 386
#define _gloffset_MultiTexCoord2fvARB 387
#define _gloffset_MultiTexCoord2iARB 388
#define _gloffset_MultiTexCoord2ivARB 389
#define _gloffset_MultiTexCoord2sARB 390
#define _gloffset_MultiTexCoord2svARB 391
#define _gloffset_MultiTexCoord3dARB 392
#define _gloffset_MultiTexCoord3dvARB 393
#define _gloffset_MultiTexCoord3fARB 394
#define _gloffset_MultiTexCoord3fvARB 395
#define _gloffset_MultiTexCoord3iARB 396
#define _gloffset_MultiTexCoord3ivARB 397
#define _gloffset_MultiTexCoord3sARB 398
#define _gloffset_MultiTexCoord3svARB 399
#define _gloffset_MultiTexCoord4dARB 400
#define _gloffset_MultiTexCoord4dvARB 401
#define _gloffset_MultiTexCoord4fvARB 403
#define _gloffset_MultiTexCoord4iARB 404
#define _gloffset_MultiTexCoord4ivARB 405
#define _gloffset_MultiTexCoord4sARB 406
#define _gloffset_MultiTexCoord4svARB 407
#if !defined(IN_DRI_DRIVER)
#define _gloffset_Color4f 29
#define _gloffset_Color4ub 35
#define _gloffset_Normal3f 56
#define _gloffset_CullFace 152
#define _gloffset_Fogf 153
#define _gloffset_Fogfv 154
#define _gloffset_FrontFace 157
#define _gloffset_Hint 158
#define _gloffset_Lightf 159
#define _gloffset_Lightfv 160
#define _gloffset_LightModelf 163
#define _gloffset_LightModelfv 164
#define _gloffset_LineWidth 168
#define _gloffset_Materialf 169
#define _gloffset_Materialfv 170
#define _gloffset_PointSize 173
#define _gloffset_Scissor 176
#define _gloffset_ShadeModel 177
#define _gloffset_TexParameterf 178
#define _gloffset_TexParameterfv 179
#define _gloffset_TexParameteri 180
#define _gloffset_TexParameteriv 181
#define _gloffset_TexImage2D 183
#define _gloffset_TexEnvf 184
#define _gloffset_TexEnvfv 185
#define _gloffset_TexEnvi 186
#define _gloffset_TexEnviv 187
#define _gloffset_TexGenfOES 190
#define _gloffset_TexGenfvOES 191
#define _gloffset_TexGeniOES 192
#define _gloffset_TexGenivOES 193
#define _gloffset_Clear 203
#define _gloffset_ClearColor 206
#define _gloffset_ClearStencil 207
#define _gloffset_StencilMask 209
#define _gloffset_ColorMask 210
#define _gloffset_DepthMask 211
#define _gloffset_Disable 214
#define _gloffset_Enable 215
#define _gloffset_Finish 216
#define _gloffset_Flush 217
#define _gloffset_AlphaFunc 240
#define _gloffset_BlendFunc 241
#define _gloffset_LogicOp 242
#define _gloffset_StencilFunc 243
#define _gloffset_StencilOp 244
#define _gloffset_DepthFunc 245
#define _gloffset_PixelStorei 250
#define _gloffset_ReadPixels 256
#define _gloffset_GetBooleanv 258
#define _gloffset_GetError 261
#define _gloffset_GetFloatv 262
#define _gloffset_GetIntegerv 263
#define _gloffset_GetLightfv 264
#define _gloffset_GetMaterialfv 269
#define _gloffset_GetString 275
#define _gloffset_GetTexEnvfv 276
#define _gloffset_GetTexEnviv 277
#define _gloffset_GetTexGenfvOES 279
#define _gloffset_GetTexGenivOES 280
#define _gloffset_GetTexParameterfv 282
#define _gloffset_GetTexParameteriv 283
#define _gloffset_IsEnabled 286
#define _gloffset_LoadIdentity 290
#define _gloffset_LoadMatrixf 291
#define _gloffset_MatrixMode 293
#define _gloffset_MultMatrixf 294
#define _gloffset_PopMatrix 297
#define _gloffset_PushMatrix 298
#define _gloffset_Rotatef 300
#define _gloffset_Scalef 302
#define _gloffset_Translatef 304
#define _gloffset_Viewport 305
#define _gloffset_BindTexture 307
#define _gloffset_ColorPointer 308
#define _gloffset_DisableClientState 309
#define _gloffset_DrawArrays 310
#define _gloffset_DrawElements 311
#define _gloffset_EnableClientState 313
#define _gloffset_NormalPointer 318
#define _gloffset_PolygonOffset 319
#define _gloffset_TexCoordPointer 320
#define _gloffset_VertexPointer 321
#define _gloffset_CopyTexImage2D 324
#define _gloffset_CopyTexSubImage2D 326
#define _gloffset_DeleteTextures 327
#define _gloffset_GenTextures 328
#define _gloffset_GetPointerv 329
#define _gloffset_IsTexture 330
#define _gloffset_TexSubImage2D 333
#define _gloffset_BlendColor 336
#define _gloffset_BlendEquationOES 337
#define _gloffset_TexImage3D 371
#define _gloffset_TexSubImage3D 372
#define _gloffset_CopyTexSubImage3D 373
#define _gloffset_ActiveTexture 374
#define _gloffset_ClientActiveTexture 375
#define _gloffset_MultiTexCoord4f 402
#define _gloffset_BlendEquationSeparateOES 408
#define _gloffset_BlendFuncSeparateOES 409
#define _gloffset_DrawTexfOES 410
#define _gloffset_DrawTexfvOES 411
#define _gloffset_DrawTexiOES 412
#define _gloffset_DrawTexivOES 413
#define _gloffset_DrawTexsOES 414
#define _gloffset_DrawTexsvOES 415
#define _gloffset_DrawTexxOES 416
#define _gloffset_DrawTexxvOES 417
#define _gloffset_BindFramebufferOES 418
#define _gloffset_BindRenderbufferOES 419
#define _gloffset_CheckFramebufferStatusOES 420
#define _gloffset_DeleteFramebuffersOES 421
#define _gloffset_DeleteRenderbuffersOES 422
#define _gloffset_FramebufferRenderbufferOES 423
#define _gloffset_FramebufferTexture2DOES 424
#define _gloffset_GenFramebuffersOES 425
#define _gloffset_GenRenderbuffersOES 426
#define _gloffset_GenerateMipmapOES 427
#define _gloffset_GetFramebufferAttachmentParameterivOES 428
#define _gloffset_GetRenderbufferParameterivOES 429
#define _gloffset_IsFramebufferOES 430
#define _gloffset_IsRenderbufferOES 431
#define _gloffset_RenderbufferStorageOES 432
#define _gloffset_PointSizePointerOES 433
#define _gloffset_QueryMatrixxOES 434
#define _gloffset_GetTexGenxvOES 435
#define _gloffset_TexGenxOES 436
#define _gloffset_TexGenxvOES 437
#define _gloffset_EGLImageTargetRenderbufferStorageOES 438
#define _gloffset_EGLImageTargetTexture2DOES 439
#define _gloffset_GetBufferPointervOES 440
#define _gloffset_MapBufferOES 441
#define _gloffset_UnmapBufferOES 442
#define _gloffset_BindVertexArrayAPPLE 443
#define _gloffset_DeleteVertexArraysAPPLE 444
#define _gloffset_GenVertexArraysAPPLE 445
#define _gloffset_IsVertexArrayAPPLE 446
#define _gloffset_CompressedTexImage2D 447
#define _gloffset_CompressedTexSubImage2D 448
#define _gloffset_SampleCoverage 449
#define _gloffset_BindBuffer 450
#define _gloffset_BufferData 451
#define _gloffset_BufferSubData 452
#define _gloffset_DeleteBuffers 453
#define _gloffset_GenBuffers 454
#define _gloffset_GetBufferParameteriv 455
#define _gloffset_IsBuffer 456
#define _gloffset_AlphaFuncx 457
#define _gloffset_ClearColorx 458
#define _gloffset_ClearDepthf 459
#define _gloffset_ClearDepthx 460
#define _gloffset_Color4x 461
#define _gloffset_DepthRangef 462
#define _gloffset_DepthRangex 463
#define _gloffset_Fogx 464
#define _gloffset_Fogxv 465
#define _gloffset_Frustumf 466
#define _gloffset_Frustumx 467
#define _gloffset_LightModelx 468
#define _gloffset_LightModelxv 469
#define _gloffset_Lightx 470
#define _gloffset_Lightxv 471
#define _gloffset_LineWidthx 472
#define _gloffset_LoadMatrixx 473
#define _gloffset_Materialx 474
#define _gloffset_Materialxv 475
#define _gloffset_MultMatrixx 476
#define _gloffset_MultiTexCoord4x 477
#define _gloffset_Normal3x 478
#define _gloffset_Orthof 479
#define _gloffset_Orthox 480
#define _gloffset_PointSizex 481
#define _gloffset_PolygonOffsetx 482
#define _gloffset_Rotatex 483
#define _gloffset_SampleCoveragex 484
#define _gloffset_Scalex 485
#define _gloffset_TexEnvx 486
#define _gloffset_TexEnvxv 487
#define _gloffset_TexParameterx 488
#define _gloffset_Translatex 489
#define _gloffset_ClipPlanef 490
#define _gloffset_ClipPlanex 491
#define _gloffset_GetClipPlanef 492
#define _gloffset_GetClipPlanex 493
#define _gloffset_GetFixedv 494
#define _gloffset_GetLightxv 495
#define _gloffset_GetMaterialxv 496
#define _gloffset_GetTexEnvxv 497
#define _gloffset_GetTexParameterxv 498
#define _gloffset_PointParameterx 499
#define _gloffset_PointParameterxv 500
#define _gloffset_TexParameterxv 501
#define _gloffset_PointParameterf 502
#define _gloffset_PointParameterfv 503
#define _gloffset_FIRST_DYNAMIC 504
#else
#define _gloffset_Color4f driDispatchRemapTable[Color4f_remap_index]
#define _gloffset_Color4ub driDispatchRemapTable[Color4ub_remap_index]
#define _gloffset_Normal3f driDispatchRemapTable[Normal3f_remap_index]
#define _gloffset_CullFace driDispatchRemapTable[CullFace_remap_index]
#define _gloffset_Fogf driDispatchRemapTable[Fogf_remap_index]
#define _gloffset_Fogfv driDispatchRemapTable[Fogfv_remap_index]
#define _gloffset_FrontFace driDispatchRemapTable[FrontFace_remap_index]
#define _gloffset_Hint driDispatchRemapTable[Hint_remap_index]
#define _gloffset_Lightf driDispatchRemapTable[Lightf_remap_index]
#define _gloffset_Lightfv driDispatchRemapTable[Lightfv_remap_index]
#define _gloffset_LightModelf driDispatchRemapTable[LightModelf_remap_index]
#define _gloffset_LightModelfv driDispatchRemapTable[LightModelfv_remap_index]
#define _gloffset_LineWidth driDispatchRemapTable[LineWidth_remap_index]
#define _gloffset_Materialf driDispatchRemapTable[Materialf_remap_index]
#define _gloffset_Materialfv driDispatchRemapTable[Materialfv_remap_index]
#define _gloffset_PointSize driDispatchRemapTable[PointSize_remap_index]
#define _gloffset_Scissor driDispatchRemapTable[Scissor_remap_index]
#define _gloffset_ShadeModel driDispatchRemapTable[ShadeModel_remap_index]
#define _gloffset_TexParameterf driDispatchRemapTable[TexParameterf_remap_index]
#define _gloffset_TexParameterfv driDispatchRemapTable[TexParameterfv_remap_index]
#define _gloffset_TexParameteri driDispatchRemapTable[TexParameteri_remap_index]
#define _gloffset_TexParameteriv driDispatchRemapTable[TexParameteriv_remap_index]
#define _gloffset_TexImage2D driDispatchRemapTable[TexImage2D_remap_index]
#define _gloffset_TexEnvf driDispatchRemapTable[TexEnvf_remap_index]
#define _gloffset_TexEnvfv driDispatchRemapTable[TexEnvfv_remap_index]
#define _gloffset_TexEnvi driDispatchRemapTable[TexEnvi_remap_index]
#define _gloffset_TexEnviv driDispatchRemapTable[TexEnviv_remap_index]
#define _gloffset_TexGenfOES driDispatchRemapTable[TexGenfOES_remap_index]
#define _gloffset_TexGenfvOES driDispatchRemapTable[TexGenfvOES_remap_index]
#define _gloffset_TexGeniOES driDispatchRemapTable[TexGeniOES_remap_index]
#define _gloffset_TexGenivOES driDispatchRemapTable[TexGenivOES_remap_index]
#define _gloffset_Clear driDispatchRemapTable[Clear_remap_index]
#define _gloffset_ClearColor driDispatchRemapTable[ClearColor_remap_index]
#define _gloffset_ClearStencil driDispatchRemapTable[ClearStencil_remap_index]
#define _gloffset_StencilMask driDispatchRemapTable[StencilMask_remap_index]
#define _gloffset_ColorMask driDispatchRemapTable[ColorMask_remap_index]
#define _gloffset_DepthMask driDispatchRemapTable[DepthMask_remap_index]
#define _gloffset_Disable driDispatchRemapTable[Disable_remap_index]
#define _gloffset_Enable driDispatchRemapTable[Enable_remap_index]
#define _gloffset_Finish driDispatchRemapTable[Finish_remap_index]
#define _gloffset_Flush driDispatchRemapTable[Flush_remap_index]
#define _gloffset_AlphaFunc driDispatchRemapTable[AlphaFunc_remap_index]
#define _gloffset_BlendFunc driDispatchRemapTable[BlendFunc_remap_index]
#define _gloffset_LogicOp driDispatchRemapTable[LogicOp_remap_index]
#define _gloffset_StencilFunc driDispatchRemapTable[StencilFunc_remap_index]
#define _gloffset_StencilOp driDispatchRemapTable[StencilOp_remap_index]
#define _gloffset_DepthFunc driDispatchRemapTable[DepthFunc_remap_index]
#define _gloffset_PixelStorei driDispatchRemapTable[PixelStorei_remap_index]
#define _gloffset_ReadPixels driDispatchRemapTable[ReadPixels_remap_index]
#define _gloffset_GetBooleanv driDispatchRemapTable[GetBooleanv_remap_index]
#define _gloffset_GetError driDispatchRemapTable[GetError_remap_index]
#define _gloffset_GetFloatv driDispatchRemapTable[GetFloatv_remap_index]
#define _gloffset_GetIntegerv driDispatchRemapTable[GetIntegerv_remap_index]
#define _gloffset_GetLightfv driDispatchRemapTable[GetLightfv_remap_index]
#define _gloffset_GetMaterialfv driDispatchRemapTable[GetMaterialfv_remap_index]
#define _gloffset_GetString driDispatchRemapTable[GetString_remap_index]
#define _gloffset_GetTexEnvfv driDispatchRemapTable[GetTexEnvfv_remap_index]
#define _gloffset_GetTexEnviv driDispatchRemapTable[GetTexEnviv_remap_index]
#define _gloffset_GetTexGenfvOES driDispatchRemapTable[GetTexGenfvOES_remap_index]
#define _gloffset_GetTexGenivOES driDispatchRemapTable[GetTexGenivOES_remap_index]
#define _gloffset_GetTexParameterfv driDispatchRemapTable[GetTexParameterfv_remap_index]
#define _gloffset_GetTexParameteriv driDispatchRemapTable[GetTexParameteriv_remap_index]
#define _gloffset_IsEnabled driDispatchRemapTable[IsEnabled_remap_index]
#define _gloffset_LoadIdentity driDispatchRemapTable[LoadIdentity_remap_index]
#define _gloffset_LoadMatrixf driDispatchRemapTable[LoadMatrixf_remap_index]
#define _gloffset_MatrixMode driDispatchRemapTable[MatrixMode_remap_index]
#define _gloffset_MultMatrixf driDispatchRemapTable[MultMatrixf_remap_index]
#define _gloffset_PopMatrix driDispatchRemapTable[PopMatrix_remap_index]
#define _gloffset_PushMatrix driDispatchRemapTable[PushMatrix_remap_index]
#define _gloffset_Rotatef driDispatchRemapTable[Rotatef_remap_index]
#define _gloffset_Scalef driDispatchRemapTable[Scalef_remap_index]
#define _gloffset_Translatef driDispatchRemapTable[Translatef_remap_index]
#define _gloffset_Viewport driDispatchRemapTable[Viewport_remap_index]
#define _gloffset_BindTexture driDispatchRemapTable[BindTexture_remap_index]
#define _gloffset_ColorPointer driDispatchRemapTable[ColorPointer_remap_index]
#define _gloffset_DisableClientState driDispatchRemapTable[DisableClientState_remap_index]
#define _gloffset_DrawArrays driDispatchRemapTable[DrawArrays_remap_index]
#define _gloffset_DrawElements driDispatchRemapTable[DrawElements_remap_index]
#define _gloffset_EnableClientState driDispatchRemapTable[EnableClientState_remap_index]
#define _gloffset_NormalPointer driDispatchRemapTable[NormalPointer_remap_index]
#define _gloffset_PolygonOffset driDispatchRemapTable[PolygonOffset_remap_index]
#define _gloffset_TexCoordPointer driDispatchRemapTable[TexCoordPointer_remap_index]
#define _gloffset_VertexPointer driDispatchRemapTable[VertexPointer_remap_index]
#define _gloffset_CopyTexImage2D driDispatchRemapTable[CopyTexImage2D_remap_index]
#define _gloffset_CopyTexSubImage2D driDispatchRemapTable[CopyTexSubImage2D_remap_index]
#define _gloffset_DeleteTextures driDispatchRemapTable[DeleteTextures_remap_index]
#define _gloffset_GenTextures driDispatchRemapTable[GenTextures_remap_index]
#define _gloffset_GetPointerv driDispatchRemapTable[GetPointerv_remap_index]
#define _gloffset_IsTexture driDispatchRemapTable[IsTexture_remap_index]
#define _gloffset_TexSubImage2D driDispatchRemapTable[TexSubImage2D_remap_index]
#define _gloffset_BlendColor driDispatchRemapTable[BlendColor_remap_index]
#define _gloffset_BlendEquationOES driDispatchRemapTable[BlendEquationOES_remap_index]
#define _gloffset_TexImage3D driDispatchRemapTable[TexImage3D_remap_index]
#define _gloffset_TexSubImage3D driDispatchRemapTable[TexSubImage3D_remap_index]
#define _gloffset_CopyTexSubImage3D driDispatchRemapTable[CopyTexSubImage3D_remap_index]
#define _gloffset_ActiveTexture driDispatchRemapTable[ActiveTexture_remap_index]
#define _gloffset_ClientActiveTexture driDispatchRemapTable[ClientActiveTexture_remap_index]
#define _gloffset_MultiTexCoord4f driDispatchRemapTable[MultiTexCoord4f_remap_index]
#define _gloffset_BlendEquationSeparateOES driDispatchRemapTable[BlendEquationSeparateOES_remap_index]
#define _gloffset_BlendFuncSeparateOES driDispatchRemapTable[BlendFuncSeparateOES_remap_index]
#define _gloffset_DrawTexfOES driDispatchRemapTable[DrawTexfOES_remap_index]
#define _gloffset_DrawTexfvOES driDispatchRemapTable[DrawTexfvOES_remap_index]
#define _gloffset_DrawTexiOES driDispatchRemapTable[DrawTexiOES_remap_index]
#define _gloffset_DrawTexivOES driDispatchRemapTable[DrawTexivOES_remap_index]
#define _gloffset_DrawTexsOES driDispatchRemapTable[DrawTexsOES_remap_index]
#define _gloffset_DrawTexsvOES driDispatchRemapTable[DrawTexsvOES_remap_index]
#define _gloffset_DrawTexxOES driDispatchRemapTable[DrawTexxOES_remap_index]
#define _gloffset_DrawTexxvOES driDispatchRemapTable[DrawTexxvOES_remap_index]
#define _gloffset_BindFramebufferOES driDispatchRemapTable[BindFramebufferOES_remap_index]
#define _gloffset_BindRenderbufferOES driDispatchRemapTable[BindRenderbufferOES_remap_index]
#define _gloffset_CheckFramebufferStatusOES driDispatchRemapTable[CheckFramebufferStatusOES_remap_index]
#define _gloffset_DeleteFramebuffersOES driDispatchRemapTable[DeleteFramebuffersOES_remap_index]
#define _gloffset_DeleteRenderbuffersOES driDispatchRemapTable[DeleteRenderbuffersOES_remap_index]
#define _gloffset_FramebufferRenderbufferOES driDispatchRemapTable[FramebufferRenderbufferOES_remap_index]
#define _gloffset_FramebufferTexture2DOES driDispatchRemapTable[FramebufferTexture2DOES_remap_index]
#define _gloffset_GenFramebuffersOES driDispatchRemapTable[GenFramebuffersOES_remap_index]
#define _gloffset_GenRenderbuffersOES driDispatchRemapTable[GenRenderbuffersOES_remap_index]
#define _gloffset_GenerateMipmapOES driDispatchRemapTable[GenerateMipmapOES_remap_index]
#define _gloffset_GetFramebufferAttachmentParameterivOES driDispatchRemapTable[GetFramebufferAttachmentParameterivOES_remap_index]
#define _gloffset_GetRenderbufferParameterivOES driDispatchRemapTable[GetRenderbufferParameterivOES_remap_index]
#define _gloffset_IsFramebufferOES driDispatchRemapTable[IsFramebufferOES_remap_index]
#define _gloffset_IsRenderbufferOES driDispatchRemapTable[IsRenderbufferOES_remap_index]
#define _gloffset_RenderbufferStorageOES driDispatchRemapTable[RenderbufferStorageOES_remap_index]
#define _gloffset_PointSizePointerOES driDispatchRemapTable[PointSizePointerOES_remap_index]
#define _gloffset_QueryMatrixxOES driDispatchRemapTable[QueryMatrixxOES_remap_index]
#define _gloffset_GetTexGenxvOES driDispatchRemapTable[GetTexGenxvOES_remap_index]
#define _gloffset_TexGenxOES driDispatchRemapTable[TexGenxOES_remap_index]
#define _gloffset_TexGenxvOES driDispatchRemapTable[TexGenxvOES_remap_index]
#define _gloffset_EGLImageTargetRenderbufferStorageOES driDispatchRemapTable[EGLImageTargetRenderbufferStorageOES_remap_index]
#define _gloffset_EGLImageTargetTexture2DOES driDispatchRemapTable[EGLImageTargetTexture2DOES_remap_index]
#define _gloffset_GetBufferPointervOES driDispatchRemapTable[GetBufferPointervOES_remap_index]
#define _gloffset_MapBufferOES driDispatchRemapTable[MapBufferOES_remap_index]
#define _gloffset_UnmapBufferOES driDispatchRemapTable[UnmapBufferOES_remap_index]
#define _gloffset_BindVertexArrayAPPLE driDispatchRemapTable[BindVertexArrayAPPLE_remap_index]
#define _gloffset_DeleteVertexArraysAPPLE driDispatchRemapTable[DeleteVertexArraysAPPLE_remap_index]
#define _gloffset_GenVertexArraysAPPLE driDispatchRemapTable[GenVertexArraysAPPLE_remap_index]
#define _gloffset_IsVertexArrayAPPLE driDispatchRemapTable[IsVertexArrayAPPLE_remap_index]
#define _gloffset_CompressedTexImage2D driDispatchRemapTable[CompressedTexImage2D_remap_index]
#define _gloffset_CompressedTexSubImage2D driDispatchRemapTable[CompressedTexSubImage2D_remap_index]
#define _gloffset_SampleCoverage driDispatchRemapTable[SampleCoverage_remap_index]
#define _gloffset_BindBuffer driDispatchRemapTable[BindBuffer_remap_index]
#define _gloffset_BufferData driDispatchRemapTable[BufferData_remap_index]
#define _gloffset_BufferSubData driDispatchRemapTable[BufferSubData_remap_index]
#define _gloffset_DeleteBuffers driDispatchRemapTable[DeleteBuffers_remap_index]
#define _gloffset_GenBuffers driDispatchRemapTable[GenBuffers_remap_index]
#define _gloffset_GetBufferParameteriv driDispatchRemapTable[GetBufferParameteriv_remap_index]
#define _gloffset_IsBuffer driDispatchRemapTable[IsBuffer_remap_index]
#define _gloffset_AlphaFuncx driDispatchRemapTable[AlphaFuncx_remap_index]
#define _gloffset_ClearColorx driDispatchRemapTable[ClearColorx_remap_index]
#define _gloffset_ClearDepthf driDispatchRemapTable[ClearDepthf_remap_index]
#define _gloffset_ClearDepthx driDispatchRemapTable[ClearDepthx_remap_index]
#define _gloffset_Color4x driDispatchRemapTable[Color4x_remap_index]
#define _gloffset_DepthRangef driDispatchRemapTable[DepthRangef_remap_index]
#define _gloffset_DepthRangex driDispatchRemapTable[DepthRangex_remap_index]
#define _gloffset_Fogx driDispatchRemapTable[Fogx_remap_index]
#define _gloffset_Fogxv driDispatchRemapTable[Fogxv_remap_index]
#define _gloffset_Frustumf driDispatchRemapTable[Frustumf_remap_index]
#define _gloffset_Frustumx driDispatchRemapTable[Frustumx_remap_index]
#define _gloffset_LightModelx driDispatchRemapTable[LightModelx_remap_index]
#define _gloffset_LightModelxv driDispatchRemapTable[LightModelxv_remap_index]
#define _gloffset_Lightx driDispatchRemapTable[Lightx_remap_index]
#define _gloffset_Lightxv driDispatchRemapTable[Lightxv_remap_index]
#define _gloffset_LineWidthx driDispatchRemapTable[LineWidthx_remap_index]
#define _gloffset_LoadMatrixx driDispatchRemapTable[LoadMatrixx_remap_index]
#define _gloffset_Materialx driDispatchRemapTable[Materialx_remap_index]
#define _gloffset_Materialxv driDispatchRemapTable[Materialxv_remap_index]
#define _gloffset_MultMatrixx driDispatchRemapTable[MultMatrixx_remap_index]
#define _gloffset_MultiTexCoord4x driDispatchRemapTable[MultiTexCoord4x_remap_index]
#define _gloffset_Normal3x driDispatchRemapTable[Normal3x_remap_index]
#define _gloffset_Orthof driDispatchRemapTable[Orthof_remap_index]
#define _gloffset_Orthox driDispatchRemapTable[Orthox_remap_index]
#define _gloffset_PointSizex driDispatchRemapTable[PointSizex_remap_index]
#define _gloffset_PolygonOffsetx driDispatchRemapTable[PolygonOffsetx_remap_index]
#define _gloffset_Rotatex driDispatchRemapTable[Rotatex_remap_index]
#define _gloffset_SampleCoveragex driDispatchRemapTable[SampleCoveragex_remap_index]
#define _gloffset_Scalex driDispatchRemapTable[Scalex_remap_index]
#define _gloffset_TexEnvx driDispatchRemapTable[TexEnvx_remap_index]
#define _gloffset_TexEnvxv driDispatchRemapTable[TexEnvxv_remap_index]
#define _gloffset_TexParameterx driDispatchRemapTable[TexParameterx_remap_index]
#define _gloffset_Translatex driDispatchRemapTable[Translatex_remap_index]
#define _gloffset_ClipPlanef driDispatchRemapTable[ClipPlanef_remap_index]
#define _gloffset_ClipPlanex driDispatchRemapTable[ClipPlanex_remap_index]
#define _gloffset_GetClipPlanef driDispatchRemapTable[GetClipPlanef_remap_index]
#define _gloffset_GetClipPlanex driDispatchRemapTable[GetClipPlanex_remap_index]
#define _gloffset_GetFixedv driDispatchRemapTable[GetFixedv_remap_index]
#define _gloffset_GetLightxv driDispatchRemapTable[GetLightxv_remap_index]
#define _gloffset_GetMaterialxv driDispatchRemapTable[GetMaterialxv_remap_index]
#define _gloffset_GetTexEnvxv driDispatchRemapTable[GetTexEnvxv_remap_index]
#define _gloffset_GetTexParameterxv driDispatchRemapTable[GetTexParameterxv_remap_index]
#define _gloffset_PointParameterx driDispatchRemapTable[PointParameterx_remap_index]
#define _gloffset_PointParameterxv driDispatchRemapTable[PointParameterxv_remap_index]
#define _gloffset_TexParameterxv driDispatchRemapTable[TexParameterxv_remap_index]
#define _gloffset_PointParameterf driDispatchRemapTable[PointParameterf_remap_index]
#define _gloffset_PointParameterfv driDispatchRemapTable[PointParameterfv_remap_index]
#endif /* !defined(IN_DRI_DRIVER) */
/* define aliases for compatibility */
#define _gloffset_TexGenf _gloffset_TexGenfOES
#define _gloffset_TexGenfv _gloffset_TexGenfvOES
#define _gloffset_TexGeni _gloffset_TexGeniOES
#define _gloffset_TexGeniv _gloffset_TexGenivOES
#define _gloffset_GetTexGenfv _gloffset_GetTexGenfvOES
#define _gloffset_GetTexGeniv _gloffset_GetTexGenivOES
#define _gloffset_BlendEquation _gloffset_BlendEquationOES
#define _gloffset_ActiveTextureARB _gloffset_ActiveTexture
#define _gloffset_ClientActiveTextureARB _gloffset_ClientActiveTexture
#define _gloffset_MultiTexCoord4fARB _gloffset_MultiTexCoord4f
#define _gloffset_AlphaFuncxOES _gloffset_AlphaFuncx
#define _gloffset_ClearColorxOES _gloffset_ClearColorx
#define _gloffset_ClearDepthfOES _gloffset_ClearDepthf
#define _gloffset_ClearDepthxOES _gloffset_ClearDepthx
#define _gloffset_Color4xOES _gloffset_Color4x
#define _gloffset_DepthRangefOES _gloffset_DepthRangef
#define _gloffset_DepthRangexOES _gloffset_DepthRangex
#define _gloffset_FogxOES _gloffset_Fogx
#define _gloffset_FogxvOES _gloffset_Fogxv
#define _gloffset_FrustumfOES _gloffset_Frustumf
#define _gloffset_FrustumxOES _gloffset_Frustumx
#define _gloffset_LightModelxOES _gloffset_LightModelx
#define _gloffset_LightModelxvOES _gloffset_LightModelxv
#define _gloffset_LightxOES _gloffset_Lightx
#define _gloffset_LightxvOES _gloffset_Lightxv
#define _gloffset_LineWidthxOES _gloffset_LineWidthx
#define _gloffset_LoadMatrixxOES _gloffset_LoadMatrixx
#define _gloffset_MaterialxOES _gloffset_Materialx
#define _gloffset_MaterialxvOES _gloffset_Materialxv
#define _gloffset_MultMatrixxOES _gloffset_MultMatrixx
#define _gloffset_MultiTexCoord4xOES _gloffset_MultiTexCoord4x
#define _gloffset_Normal3xOES _gloffset_Normal3x
#define _gloffset_OrthofOES _gloffset_Orthof
#define _gloffset_OrthoxOES _gloffset_Orthox
#define _gloffset_PointSizexOES _gloffset_PointSizex
#define _gloffset_PolygonOffsetxOES _gloffset_PolygonOffsetx
#define _gloffset_RotatexOES _gloffset_Rotatex
#define _gloffset_SampleCoveragexOES _gloffset_SampleCoveragex
#define _gloffset_ScalexOES _gloffset_Scalex
#define _gloffset_TexEnvxOES _gloffset_TexEnvx
#define _gloffset_TexEnvxvOES _gloffset_TexEnvxv
#define _gloffset_TexParameterxOES _gloffset_TexParameterx
#define _gloffset_TranslatexOES _gloffset_Translatex
#define _gloffset_ClipPlanefOES _gloffset_ClipPlanef
#define _gloffset_ClipPlanexOES _gloffset_ClipPlanex
#define _gloffset_GetClipPlanefOES _gloffset_GetClipPlanef
#define _gloffset_GetClipPlanexOES _gloffset_GetClipPlanex
#define _gloffset_GetFixedvOES _gloffset_GetFixedv
#define _gloffset_GetLightxvOES _gloffset_GetLightxv
#define _gloffset_GetMaterialxvOES _gloffset_GetMaterialxv
#define _gloffset_GetTexEnvxvOES _gloffset_GetTexEnvxv
#define _gloffset_GetTexParameterxvOES _gloffset_GetTexParameterxv
#define _gloffset_PointParameterxOES _gloffset_PointParameterx
#define _gloffset_PointParameterxvOES _gloffset_PointParameterxv
#define _gloffset_TexParameterxvOES _gloffset_TexParameterxv
#endif /* !defined( _GLAPI_OFFSETS_H_ ) */

View File

@@ -0,0 +1,554 @@
/* DO NOT EDIT - This file generated automatically by gl_table.py (from Mesa) script */
/*
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
* (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
* 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
* BRIAN PAUL, IBM,
* 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.
*/
#if !defined( _GLAPI_TABLE_H_ )
# define _GLAPI_TABLE_H_
#ifndef GLAPIENTRYP
# ifndef GLAPIENTRY
# define GLAPIENTRY
# endif
# define GLAPIENTRYP GLAPIENTRY *
#endif
#ifndef HAVE_GLES_TYPES
typedef void *GLeglImageOES;
typedef int GLfixed;
typedef int GLclampx;
#endif
struct _glapi_table
{
void (GLAPIENTRYP NewList)(GLuint list, GLenum mode); /* 0 */
void (GLAPIENTRYP EndList)(void); /* 1 */
void (GLAPIENTRYP CallList)(GLuint list); /* 2 */
void (GLAPIENTRYP CallLists)(GLsizei n, GLenum type, const GLvoid * lists); /* 3 */
void (GLAPIENTRYP DeleteLists)(GLuint list, GLsizei range); /* 4 */
GLuint (GLAPIENTRYP GenLists)(GLsizei range); /* 5 */
void (GLAPIENTRYP ListBase)(GLuint base); /* 6 */
void (GLAPIENTRYP Begin)(GLenum mode); /* 7 */
void (GLAPIENTRYP Bitmap)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte * bitmap); /* 8 */
void (GLAPIENTRYP Color3b)(GLbyte red, GLbyte green, GLbyte blue); /* 9 */
void (GLAPIENTRYP Color3bv)(const GLbyte * v); /* 10 */
void (GLAPIENTRYP Color3d)(GLdouble red, GLdouble green, GLdouble blue); /* 11 */
void (GLAPIENTRYP Color3dv)(const GLdouble * v); /* 12 */
void (GLAPIENTRYP Color3f)(GLfloat red, GLfloat green, GLfloat blue); /* 13 */
void (GLAPIENTRYP Color3fv)(const GLfloat * v); /* 14 */
void (GLAPIENTRYP Color3i)(GLint red, GLint green, GLint blue); /* 15 */
void (GLAPIENTRYP Color3iv)(const GLint * v); /* 16 */
void (GLAPIENTRYP Color3s)(GLshort red, GLshort green, GLshort blue); /* 17 */
void (GLAPIENTRYP Color3sv)(const GLshort * v); /* 18 */
void (GLAPIENTRYP Color3ub)(GLubyte red, GLubyte green, GLubyte blue); /* 19 */
void (GLAPIENTRYP Color3ubv)(const GLubyte * v); /* 20 */
void (GLAPIENTRYP Color3ui)(GLuint red, GLuint green, GLuint blue); /* 21 */
void (GLAPIENTRYP Color3uiv)(const GLuint * v); /* 22 */
void (GLAPIENTRYP Color3us)(GLushort red, GLushort green, GLushort blue); /* 23 */
void (GLAPIENTRYP Color3usv)(const GLushort * v); /* 24 */
void (GLAPIENTRYP Color4b)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); /* 25 */
void (GLAPIENTRYP Color4bv)(const GLbyte * v); /* 26 */
void (GLAPIENTRYP Color4d)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); /* 27 */
void (GLAPIENTRYP Color4dv)(const GLdouble * v); /* 28 */
void (GLAPIENTRYP Color4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); /* 29 */
void (GLAPIENTRYP Color4fv)(const GLfloat * v); /* 30 */
void (GLAPIENTRYP Color4i)(GLint red, GLint green, GLint blue, GLint alpha); /* 31 */
void (GLAPIENTRYP Color4iv)(const GLint * v); /* 32 */
void (GLAPIENTRYP Color4s)(GLshort red, GLshort green, GLshort blue, GLshort alpha); /* 33 */
void (GLAPIENTRYP Color4sv)(const GLshort * v); /* 34 */
void (GLAPIENTRYP Color4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); /* 35 */
void (GLAPIENTRYP Color4ubv)(const GLubyte * v); /* 36 */
void (GLAPIENTRYP Color4ui)(GLuint red, GLuint green, GLuint blue, GLuint alpha); /* 37 */
void (GLAPIENTRYP Color4uiv)(const GLuint * v); /* 38 */
void (GLAPIENTRYP Color4us)(GLushort red, GLushort green, GLushort blue, GLushort alpha); /* 39 */
void (GLAPIENTRYP Color4usv)(const GLushort * v); /* 40 */
void (GLAPIENTRYP EdgeFlag)(GLboolean flag); /* 41 */
void (GLAPIENTRYP EdgeFlagv)(const GLboolean * flag); /* 42 */
void (GLAPIENTRYP End)(void); /* 43 */
void (GLAPIENTRYP Indexd)(GLdouble c); /* 44 */
void (GLAPIENTRYP Indexdv)(const GLdouble * c); /* 45 */
void (GLAPIENTRYP Indexf)(GLfloat c); /* 46 */
void (GLAPIENTRYP Indexfv)(const GLfloat * c); /* 47 */
void (GLAPIENTRYP Indexi)(GLint c); /* 48 */
void (GLAPIENTRYP Indexiv)(const GLint * c); /* 49 */
void (GLAPIENTRYP Indexs)(GLshort c); /* 50 */
void (GLAPIENTRYP Indexsv)(const GLshort * c); /* 51 */
void (GLAPIENTRYP Normal3b)(GLbyte nx, GLbyte ny, GLbyte nz); /* 52 */
void (GLAPIENTRYP Normal3bv)(const GLbyte * v); /* 53 */
void (GLAPIENTRYP Normal3d)(GLdouble nx, GLdouble ny, GLdouble nz); /* 54 */
void (GLAPIENTRYP Normal3dv)(const GLdouble * v); /* 55 */
void (GLAPIENTRYP Normal3f)(GLfloat nx, GLfloat ny, GLfloat nz); /* 56 */
void (GLAPIENTRYP Normal3fv)(const GLfloat * v); /* 57 */
void (GLAPIENTRYP Normal3i)(GLint nx, GLint ny, GLint nz); /* 58 */
void (GLAPIENTRYP Normal3iv)(const GLint * v); /* 59 */
void (GLAPIENTRYP Normal3s)(GLshort nx, GLshort ny, GLshort nz); /* 60 */
void (GLAPIENTRYP Normal3sv)(const GLshort * v); /* 61 */
void (GLAPIENTRYP RasterPos2d)(GLdouble x, GLdouble y); /* 62 */
void (GLAPIENTRYP RasterPos2dv)(const GLdouble * v); /* 63 */
void (GLAPIENTRYP RasterPos2f)(GLfloat x, GLfloat y); /* 64 */
void (GLAPIENTRYP RasterPos2fv)(const GLfloat * v); /* 65 */
void (GLAPIENTRYP RasterPos2i)(GLint x, GLint y); /* 66 */
void (GLAPIENTRYP RasterPos2iv)(const GLint * v); /* 67 */
void (GLAPIENTRYP RasterPos2s)(GLshort x, GLshort y); /* 68 */
void (GLAPIENTRYP RasterPos2sv)(const GLshort * v); /* 69 */
void (GLAPIENTRYP RasterPos3d)(GLdouble x, GLdouble y, GLdouble z); /* 70 */
void (GLAPIENTRYP RasterPos3dv)(const GLdouble * v); /* 71 */
void (GLAPIENTRYP RasterPos3f)(GLfloat x, GLfloat y, GLfloat z); /* 72 */
void (GLAPIENTRYP RasterPos3fv)(const GLfloat * v); /* 73 */
void (GLAPIENTRYP RasterPos3i)(GLint x, GLint y, GLint z); /* 74 */
void (GLAPIENTRYP RasterPos3iv)(const GLint * v); /* 75 */
void (GLAPIENTRYP RasterPos3s)(GLshort x, GLshort y, GLshort z); /* 76 */
void (GLAPIENTRYP RasterPos3sv)(const GLshort * v); /* 77 */
void (GLAPIENTRYP RasterPos4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 78 */
void (GLAPIENTRYP RasterPos4dv)(const GLdouble * v); /* 79 */
void (GLAPIENTRYP RasterPos4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 80 */
void (GLAPIENTRYP RasterPos4fv)(const GLfloat * v); /* 81 */
void (GLAPIENTRYP RasterPos4i)(GLint x, GLint y, GLint z, GLint w); /* 82 */
void (GLAPIENTRYP RasterPos4iv)(const GLint * v); /* 83 */
void (GLAPIENTRYP RasterPos4s)(GLshort x, GLshort y, GLshort z, GLshort w); /* 84 */
void (GLAPIENTRYP RasterPos4sv)(const GLshort * v); /* 85 */
void (GLAPIENTRYP Rectd)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); /* 86 */
void (GLAPIENTRYP Rectdv)(const GLdouble * v1, const GLdouble * v2); /* 87 */
void (GLAPIENTRYP Rectf)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); /* 88 */
void (GLAPIENTRYP Rectfv)(const GLfloat * v1, const GLfloat * v2); /* 89 */
void (GLAPIENTRYP Recti)(GLint x1, GLint y1, GLint x2, GLint y2); /* 90 */
void (GLAPIENTRYP Rectiv)(const GLint * v1, const GLint * v2); /* 91 */
void (GLAPIENTRYP Rects)(GLshort x1, GLshort y1, GLshort x2, GLshort y2); /* 92 */
void (GLAPIENTRYP Rectsv)(const GLshort * v1, const GLshort * v2); /* 93 */
void (GLAPIENTRYP TexCoord1d)(GLdouble s); /* 94 */
void (GLAPIENTRYP TexCoord1dv)(const GLdouble * v); /* 95 */
void (GLAPIENTRYP TexCoord1f)(GLfloat s); /* 96 */
void (GLAPIENTRYP TexCoord1fv)(const GLfloat * v); /* 97 */
void (GLAPIENTRYP TexCoord1i)(GLint s); /* 98 */
void (GLAPIENTRYP TexCoord1iv)(const GLint * v); /* 99 */
void (GLAPIENTRYP TexCoord1s)(GLshort s); /* 100 */
void (GLAPIENTRYP TexCoord1sv)(const GLshort * v); /* 101 */
void (GLAPIENTRYP TexCoord2d)(GLdouble s, GLdouble t); /* 102 */
void (GLAPIENTRYP TexCoord2dv)(const GLdouble * v); /* 103 */
void (GLAPIENTRYP TexCoord2f)(GLfloat s, GLfloat t); /* 104 */
void (GLAPIENTRYP TexCoord2fv)(const GLfloat * v); /* 105 */
void (GLAPIENTRYP TexCoord2i)(GLint s, GLint t); /* 106 */
void (GLAPIENTRYP TexCoord2iv)(const GLint * v); /* 107 */
void (GLAPIENTRYP TexCoord2s)(GLshort s, GLshort t); /* 108 */
void (GLAPIENTRYP TexCoord2sv)(const GLshort * v); /* 109 */
void (GLAPIENTRYP TexCoord3d)(GLdouble s, GLdouble t, GLdouble r); /* 110 */
void (GLAPIENTRYP TexCoord3dv)(const GLdouble * v); /* 111 */
void (GLAPIENTRYP TexCoord3f)(GLfloat s, GLfloat t, GLfloat r); /* 112 */
void (GLAPIENTRYP TexCoord3fv)(const GLfloat * v); /* 113 */
void (GLAPIENTRYP TexCoord3i)(GLint s, GLint t, GLint r); /* 114 */
void (GLAPIENTRYP TexCoord3iv)(const GLint * v); /* 115 */
void (GLAPIENTRYP TexCoord3s)(GLshort s, GLshort t, GLshort r); /* 116 */
void (GLAPIENTRYP TexCoord3sv)(const GLshort * v); /* 117 */
void (GLAPIENTRYP TexCoord4d)(GLdouble s, GLdouble t, GLdouble r, GLdouble q); /* 118 */
void (GLAPIENTRYP TexCoord4dv)(const GLdouble * v); /* 119 */
void (GLAPIENTRYP TexCoord4f)(GLfloat s, GLfloat t, GLfloat r, GLfloat q); /* 120 */
void (GLAPIENTRYP TexCoord4fv)(const GLfloat * v); /* 121 */
void (GLAPIENTRYP TexCoord4i)(GLint s, GLint t, GLint r, GLint q); /* 122 */
void (GLAPIENTRYP TexCoord4iv)(const GLint * v); /* 123 */
void (GLAPIENTRYP TexCoord4s)(GLshort s, GLshort t, GLshort r, GLshort q); /* 124 */
void (GLAPIENTRYP TexCoord4sv)(const GLshort * v); /* 125 */
void (GLAPIENTRYP Vertex2d)(GLdouble x, GLdouble y); /* 126 */
void (GLAPIENTRYP Vertex2dv)(const GLdouble * v); /* 127 */
void (GLAPIENTRYP Vertex2f)(GLfloat x, GLfloat y); /* 128 */
void (GLAPIENTRYP Vertex2fv)(const GLfloat * v); /* 129 */
void (GLAPIENTRYP Vertex2i)(GLint x, GLint y); /* 130 */
void (GLAPIENTRYP Vertex2iv)(const GLint * v); /* 131 */
void (GLAPIENTRYP Vertex2s)(GLshort x, GLshort y); /* 132 */
void (GLAPIENTRYP Vertex2sv)(const GLshort * v); /* 133 */
void (GLAPIENTRYP Vertex3d)(GLdouble x, GLdouble y, GLdouble z); /* 134 */
void (GLAPIENTRYP Vertex3dv)(const GLdouble * v); /* 135 */
void (GLAPIENTRYP Vertex3f)(GLfloat x, GLfloat y, GLfloat z); /* 136 */
void (GLAPIENTRYP Vertex3fv)(const GLfloat * v); /* 137 */
void (GLAPIENTRYP Vertex3i)(GLint x, GLint y, GLint z); /* 138 */
void (GLAPIENTRYP Vertex3iv)(const GLint * v); /* 139 */
void (GLAPIENTRYP Vertex3s)(GLshort x, GLshort y, GLshort z); /* 140 */
void (GLAPIENTRYP Vertex3sv)(const GLshort * v); /* 141 */
void (GLAPIENTRYP Vertex4d)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); /* 142 */
void (GLAPIENTRYP Vertex4dv)(const GLdouble * v); /* 143 */
void (GLAPIENTRYP Vertex4f)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); /* 144 */
void (GLAPIENTRYP Vertex4fv)(const GLfloat * v); /* 145 */
void (GLAPIENTRYP Vertex4i)(GLint x, GLint y, GLint z, GLint w); /* 146 */
void (GLAPIENTRYP Vertex4iv)(const GLint * v); /* 147 */
void (GLAPIENTRYP Vertex4s)(GLshort x, GLshort y, GLshort z, GLshort w); /* 148 */
void (GLAPIENTRYP Vertex4sv)(const GLshort * v); /* 149 */
void (GLAPIENTRYP ClipPlane)(GLenum plane, const GLdouble * equation); /* 150 */
void (GLAPIENTRYP ColorMaterial)(GLenum face, GLenum mode); /* 151 */
void (GLAPIENTRYP CullFace)(GLenum mode); /* 152 */
void (GLAPIENTRYP Fogf)(GLenum pname, GLfloat param); /* 153 */
void (GLAPIENTRYP Fogfv)(GLenum pname, const GLfloat * params); /* 154 */
void (GLAPIENTRYP Fogi)(GLenum pname, GLint param); /* 155 */
void (GLAPIENTRYP Fogiv)(GLenum pname, const GLint * params); /* 156 */
void (GLAPIENTRYP FrontFace)(GLenum mode); /* 157 */
void (GLAPIENTRYP Hint)(GLenum target, GLenum mode); /* 158 */
void (GLAPIENTRYP Lightf)(GLenum light, GLenum pname, GLfloat param); /* 159 */
void (GLAPIENTRYP Lightfv)(GLenum light, GLenum pname, const GLfloat * params); /* 160 */
void (GLAPIENTRYP Lighti)(GLenum light, GLenum pname, GLint param); /* 161 */
void (GLAPIENTRYP Lightiv)(GLenum light, GLenum pname, const GLint * params); /* 162 */
void (GLAPIENTRYP LightModelf)(GLenum pname, GLfloat param); /* 163 */
void (GLAPIENTRYP LightModelfv)(GLenum pname, const GLfloat * params); /* 164 */
void (GLAPIENTRYP LightModeli)(GLenum pname, GLint param); /* 165 */
void (GLAPIENTRYP LightModeliv)(GLenum pname, const GLint * params); /* 166 */
void (GLAPIENTRYP LineStipple)(GLint factor, GLushort pattern); /* 167 */
void (GLAPIENTRYP LineWidth)(GLfloat width); /* 168 */
void (GLAPIENTRYP Materialf)(GLenum face, GLenum pname, GLfloat param); /* 169 */
void (GLAPIENTRYP Materialfv)(GLenum face, GLenum pname, const GLfloat * params); /* 170 */
void (GLAPIENTRYP Materiali)(GLenum face, GLenum pname, GLint param); /* 171 */
void (GLAPIENTRYP Materialiv)(GLenum face, GLenum pname, const GLint * params); /* 172 */
void (GLAPIENTRYP PointSize)(GLfloat size); /* 173 */
void (GLAPIENTRYP PolygonMode)(GLenum face, GLenum mode); /* 174 */
void (GLAPIENTRYP PolygonStipple)(const GLubyte * mask); /* 175 */
void (GLAPIENTRYP Scissor)(GLint x, GLint y, GLsizei width, GLsizei height); /* 176 */
void (GLAPIENTRYP ShadeModel)(GLenum mode); /* 177 */
void (GLAPIENTRYP TexParameterf)(GLenum target, GLenum pname, GLfloat param); /* 178 */
void (GLAPIENTRYP TexParameterfv)(GLenum target, GLenum pname, const GLfloat * params); /* 179 */
void (GLAPIENTRYP TexParameteri)(GLenum target, GLenum pname, GLint param); /* 180 */
void (GLAPIENTRYP TexParameteriv)(GLenum target, GLenum pname, const GLint * params); /* 181 */
void (GLAPIENTRYP TexImage1D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 182 */
void (GLAPIENTRYP TexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 183 */
void (GLAPIENTRYP TexEnvf)(GLenum target, GLenum pname, GLfloat param); /* 184 */
void (GLAPIENTRYP TexEnvfv)(GLenum target, GLenum pname, const GLfloat * params); /* 185 */
void (GLAPIENTRYP TexEnvi)(GLenum target, GLenum pname, GLint param); /* 186 */
void (GLAPIENTRYP TexEnviv)(GLenum target, GLenum pname, const GLint * params); /* 187 */
void (GLAPIENTRYP TexGend)(GLenum coord, GLenum pname, GLdouble param); /* 188 */
void (GLAPIENTRYP TexGendv)(GLenum coord, GLenum pname, const GLdouble * params); /* 189 */
void (GLAPIENTRYP TexGenfOES)(GLenum coord, GLenum pname, GLfloat param); /* 190 */
void (GLAPIENTRYP TexGenfvOES)(GLenum coord, GLenum pname, const GLfloat * params); /* 191 */
void (GLAPIENTRYP TexGeniOES)(GLenum coord, GLenum pname, GLint param); /* 192 */
void (GLAPIENTRYP TexGenivOES)(GLenum coord, GLenum pname, const GLint * params); /* 193 */
void (GLAPIENTRYP FeedbackBuffer)(GLsizei size, GLenum type, GLfloat * buffer); /* 194 */
void (GLAPIENTRYP SelectBuffer)(GLsizei size, GLuint * buffer); /* 195 */
GLint (GLAPIENTRYP RenderMode)(GLenum mode); /* 196 */
void (GLAPIENTRYP InitNames)(void); /* 197 */
void (GLAPIENTRYP LoadName)(GLuint name); /* 198 */
void (GLAPIENTRYP PassThrough)(GLfloat token); /* 199 */
void (GLAPIENTRYP PopName)(void); /* 200 */
void (GLAPIENTRYP PushName)(GLuint name); /* 201 */
void (GLAPIENTRYP DrawBuffer)(GLenum mode); /* 202 */
void (GLAPIENTRYP Clear)(GLbitfield mask); /* 203 */
void (GLAPIENTRYP ClearAccum)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); /* 204 */
void (GLAPIENTRYP ClearIndex)(GLfloat c); /* 205 */
void (GLAPIENTRYP ClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); /* 206 */
void (GLAPIENTRYP ClearStencil)(GLint s); /* 207 */
void (GLAPIENTRYP ClearDepth)(GLclampd depth); /* 208 */
void (GLAPIENTRYP StencilMask)(GLuint mask); /* 209 */
void (GLAPIENTRYP ColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); /* 210 */
void (GLAPIENTRYP DepthMask)(GLboolean flag); /* 211 */
void (GLAPIENTRYP IndexMask)(GLuint mask); /* 212 */
void (GLAPIENTRYP Accum)(GLenum op, GLfloat value); /* 213 */
void (GLAPIENTRYP Disable)(GLenum cap); /* 214 */
void (GLAPIENTRYP Enable)(GLenum cap); /* 215 */
void (GLAPIENTRYP Finish)(void); /* 216 */
void (GLAPIENTRYP Flush)(void); /* 217 */
void (GLAPIENTRYP PopAttrib)(void); /* 218 */
void (GLAPIENTRYP PushAttrib)(GLbitfield mask); /* 219 */
void (GLAPIENTRYP Map1d)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble * points); /* 220 */
void (GLAPIENTRYP Map1f)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat * points); /* 221 */
void (GLAPIENTRYP Map2d)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble * points); /* 222 */
void (GLAPIENTRYP Map2f)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat * points); /* 223 */
void (GLAPIENTRYP MapGrid1d)(GLint un, GLdouble u1, GLdouble u2); /* 224 */
void (GLAPIENTRYP MapGrid1f)(GLint un, GLfloat u1, GLfloat u2); /* 225 */
void (GLAPIENTRYP MapGrid2d)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); /* 226 */
void (GLAPIENTRYP MapGrid2f)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); /* 227 */
void (GLAPIENTRYP EvalCoord1d)(GLdouble u); /* 228 */
void (GLAPIENTRYP EvalCoord1dv)(const GLdouble * u); /* 229 */
void (GLAPIENTRYP EvalCoord1f)(GLfloat u); /* 230 */
void (GLAPIENTRYP EvalCoord1fv)(const GLfloat * u); /* 231 */
void (GLAPIENTRYP EvalCoord2d)(GLdouble u, GLdouble v); /* 232 */
void (GLAPIENTRYP EvalCoord2dv)(const GLdouble * u); /* 233 */
void (GLAPIENTRYP EvalCoord2f)(GLfloat u, GLfloat v); /* 234 */
void (GLAPIENTRYP EvalCoord2fv)(const GLfloat * u); /* 235 */
void (GLAPIENTRYP EvalMesh1)(GLenum mode, GLint i1, GLint i2); /* 236 */
void (GLAPIENTRYP EvalPoint1)(GLint i); /* 237 */
void (GLAPIENTRYP EvalMesh2)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); /* 238 */
void (GLAPIENTRYP EvalPoint2)(GLint i, GLint j); /* 239 */
void (GLAPIENTRYP AlphaFunc)(GLenum func, GLclampf ref); /* 240 */
void (GLAPIENTRYP BlendFunc)(GLenum sfactor, GLenum dfactor); /* 241 */
void (GLAPIENTRYP LogicOp)(GLenum opcode); /* 242 */
void (GLAPIENTRYP StencilFunc)(GLenum func, GLint ref, GLuint mask); /* 243 */
void (GLAPIENTRYP StencilOp)(GLenum fail, GLenum zfail, GLenum zpass); /* 244 */
void (GLAPIENTRYP DepthFunc)(GLenum func); /* 245 */
void (GLAPIENTRYP PixelZoom)(GLfloat xfactor, GLfloat yfactor); /* 246 */
void (GLAPIENTRYP PixelTransferf)(GLenum pname, GLfloat param); /* 247 */
void (GLAPIENTRYP PixelTransferi)(GLenum pname, GLint param); /* 248 */
void (GLAPIENTRYP PixelStoref)(GLenum pname, GLfloat param); /* 249 */
void (GLAPIENTRYP PixelStorei)(GLenum pname, GLint param); /* 250 */
void (GLAPIENTRYP PixelMapfv)(GLenum map, GLsizei mapsize, const GLfloat * values); /* 251 */
void (GLAPIENTRYP PixelMapuiv)(GLenum map, GLsizei mapsize, const GLuint * values); /* 252 */
void (GLAPIENTRYP PixelMapusv)(GLenum map, GLsizei mapsize, const GLushort * values); /* 253 */
void (GLAPIENTRYP ReadBuffer)(GLenum mode); /* 254 */
void (GLAPIENTRYP CopyPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); /* 255 */
void (GLAPIENTRYP ReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid * pixels); /* 256 */
void (GLAPIENTRYP DrawPixels)(GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels); /* 257 */
void (GLAPIENTRYP GetBooleanv)(GLenum pname, GLboolean * params); /* 258 */
void (GLAPIENTRYP GetClipPlane)(GLenum plane, GLdouble * equation); /* 259 */
void (GLAPIENTRYP GetDoublev)(GLenum pname, GLdouble * params); /* 260 */
GLenum (GLAPIENTRYP GetError)(void); /* 261 */
void (GLAPIENTRYP GetFloatv)(GLenum pname, GLfloat * params); /* 262 */
void (GLAPIENTRYP GetIntegerv)(GLenum pname, GLint * params); /* 263 */
void (GLAPIENTRYP GetLightfv)(GLenum light, GLenum pname, GLfloat * params); /* 264 */
void (GLAPIENTRYP GetLightiv)(GLenum light, GLenum pname, GLint * params); /* 265 */
void (GLAPIENTRYP GetMapdv)(GLenum target, GLenum query, GLdouble * v); /* 266 */
void (GLAPIENTRYP GetMapfv)(GLenum target, GLenum query, GLfloat * v); /* 267 */
void (GLAPIENTRYP GetMapiv)(GLenum target, GLenum query, GLint * v); /* 268 */
void (GLAPIENTRYP GetMaterialfv)(GLenum face, GLenum pname, GLfloat * params); /* 269 */
void (GLAPIENTRYP GetMaterialiv)(GLenum face, GLenum pname, GLint * params); /* 270 */
void (GLAPIENTRYP GetPixelMapfv)(GLenum map, GLfloat * values); /* 271 */
void (GLAPIENTRYP GetPixelMapuiv)(GLenum map, GLuint * values); /* 272 */
void (GLAPIENTRYP GetPixelMapusv)(GLenum map, GLushort * values); /* 273 */
void (GLAPIENTRYP GetPolygonStipple)(GLubyte * mask); /* 274 */
const GLubyte * (GLAPIENTRYP GetString)(GLenum name); /* 275 */
void (GLAPIENTRYP GetTexEnvfv)(GLenum target, GLenum pname, GLfloat * params); /* 276 */
void (GLAPIENTRYP GetTexEnviv)(GLenum target, GLenum pname, GLint * params); /* 277 */
void (GLAPIENTRYP GetTexGendv)(GLenum coord, GLenum pname, GLdouble * params); /* 278 */
void (GLAPIENTRYP GetTexGenfvOES)(GLenum coord, GLenum pname, GLfloat * params); /* 279 */
void (GLAPIENTRYP GetTexGenivOES)(GLenum coord, GLenum pname, GLint * params); /* 280 */
void (GLAPIENTRYP GetTexImage)(GLenum target, GLint level, GLenum format, GLenum type, GLvoid * pixels); /* 281 */
void (GLAPIENTRYP GetTexParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 282 */
void (GLAPIENTRYP GetTexParameteriv)(GLenum target, GLenum pname, GLint * params); /* 283 */
void (GLAPIENTRYP GetTexLevelParameterfv)(GLenum target, GLint level, GLenum pname, GLfloat * params); /* 284 */
void (GLAPIENTRYP GetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint * params); /* 285 */
GLboolean (GLAPIENTRYP IsEnabled)(GLenum cap); /* 286 */
GLboolean (GLAPIENTRYP IsList)(GLuint list); /* 287 */
void (GLAPIENTRYP DepthRange)(GLclampd zNear, GLclampd zFar); /* 288 */
void (GLAPIENTRYP Frustum)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); /* 289 */
void (GLAPIENTRYP LoadIdentity)(void); /* 290 */
void (GLAPIENTRYP LoadMatrixf)(const GLfloat * m); /* 291 */
void (GLAPIENTRYP LoadMatrixd)(const GLdouble * m); /* 292 */
void (GLAPIENTRYP MatrixMode)(GLenum mode); /* 293 */
void (GLAPIENTRYP MultMatrixf)(const GLfloat * m); /* 294 */
void (GLAPIENTRYP MultMatrixd)(const GLdouble * m); /* 295 */
void (GLAPIENTRYP Ortho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); /* 296 */
void (GLAPIENTRYP PopMatrix)(void); /* 297 */
void (GLAPIENTRYP PushMatrix)(void); /* 298 */
void (GLAPIENTRYP Rotated)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z); /* 299 */
void (GLAPIENTRYP Rotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); /* 300 */
void (GLAPIENTRYP Scaled)(GLdouble x, GLdouble y, GLdouble z); /* 301 */
void (GLAPIENTRYP Scalef)(GLfloat x, GLfloat y, GLfloat z); /* 302 */
void (GLAPIENTRYP Translated)(GLdouble x, GLdouble y, GLdouble z); /* 303 */
void (GLAPIENTRYP Translatef)(GLfloat x, GLfloat y, GLfloat z); /* 304 */
void (GLAPIENTRYP Viewport)(GLint x, GLint y, GLsizei width, GLsizei height); /* 305 */
void (GLAPIENTRYP ArrayElement)(GLint i); /* 306 */
void (GLAPIENTRYP BindTexture)(GLenum target, GLuint texture); /* 307 */
void (GLAPIENTRYP ColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 308 */
void (GLAPIENTRYP DisableClientState)(GLenum array); /* 309 */
void (GLAPIENTRYP DrawArrays)(GLenum mode, GLint first, GLsizei count); /* 310 */
void (GLAPIENTRYP DrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices); /* 311 */
void (GLAPIENTRYP EdgeFlagPointer)(GLsizei stride, const GLvoid * pointer); /* 312 */
void (GLAPIENTRYP EnableClientState)(GLenum array); /* 313 */
void (GLAPIENTRYP IndexPointer)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 314 */
void (GLAPIENTRYP Indexub)(GLubyte c); /* 315 */
void (GLAPIENTRYP Indexubv)(const GLubyte * c); /* 316 */
void (GLAPIENTRYP InterleavedArrays)(GLenum format, GLsizei stride, const GLvoid * pointer); /* 317 */
void (GLAPIENTRYP NormalPointer)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 318 */
void (GLAPIENTRYP PolygonOffset)(GLfloat factor, GLfloat units); /* 319 */
void (GLAPIENTRYP TexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 320 */
void (GLAPIENTRYP VertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 321 */
GLboolean (GLAPIENTRYP AreTexturesResident)(GLsizei n, const GLuint * textures, GLboolean * residences); /* 322 */
void (GLAPIENTRYP CopyTexImage1D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); /* 323 */
void (GLAPIENTRYP CopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); /* 324 */
void (GLAPIENTRYP CopyTexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); /* 325 */
void (GLAPIENTRYP CopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); /* 326 */
void (GLAPIENTRYP DeleteTextures)(GLsizei n, const GLuint * textures); /* 327 */
void (GLAPIENTRYP GenTextures)(GLsizei n, GLuint * textures); /* 328 */
void (GLAPIENTRYP GetPointerv)(GLenum pname, GLvoid ** params); /* 329 */
GLboolean (GLAPIENTRYP IsTexture)(GLuint texture); /* 330 */
void (GLAPIENTRYP PrioritizeTextures)(GLsizei n, const GLuint * textures, const GLclampf * priorities); /* 331 */
void (GLAPIENTRYP TexSubImage1D)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid * pixels); /* 332 */
void (GLAPIENTRYP TexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * pixels); /* 333 */
void (GLAPIENTRYP PopClientAttrib)(void); /* 334 */
void (GLAPIENTRYP PushClientAttrib)(GLbitfield mask); /* 335 */
void (GLAPIENTRYP BlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); /* 336 */
void (GLAPIENTRYP BlendEquationOES)(GLenum mode); /* 337 */
void (GLAPIENTRYP DrawRangeElements)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices); /* 338 */
void (GLAPIENTRYP ColorTable)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * table); /* 339 */
void (GLAPIENTRYP ColorTableParameterfv)(GLenum target, GLenum pname, const GLfloat * params); /* 340 */
void (GLAPIENTRYP ColorTableParameteriv)(GLenum target, GLenum pname, const GLint * params); /* 341 */
void (GLAPIENTRYP CopyColorTable)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); /* 342 */
void (GLAPIENTRYP GetColorTable)(GLenum target, GLenum format, GLenum type, GLvoid * table); /* 343 */
void (GLAPIENTRYP GetColorTableParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 344 */
void (GLAPIENTRYP GetColorTableParameteriv)(GLenum target, GLenum pname, GLint * params); /* 345 */
void (GLAPIENTRYP ColorSubTable)(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid * data); /* 346 */
void (GLAPIENTRYP CopyColorSubTable)(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); /* 347 */
void (GLAPIENTRYP ConvolutionFilter1D)(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid * image); /* 348 */
void (GLAPIENTRYP ConvolutionFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * image); /* 349 */
void (GLAPIENTRYP ConvolutionParameterf)(GLenum target, GLenum pname, GLfloat params); /* 350 */
void (GLAPIENTRYP ConvolutionParameterfv)(GLenum target, GLenum pname, const GLfloat * params); /* 351 */
void (GLAPIENTRYP ConvolutionParameteri)(GLenum target, GLenum pname, GLint params); /* 352 */
void (GLAPIENTRYP ConvolutionParameteriv)(GLenum target, GLenum pname, const GLint * params); /* 353 */
void (GLAPIENTRYP CopyConvolutionFilter1D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); /* 354 */
void (GLAPIENTRYP CopyConvolutionFilter2D)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); /* 355 */
void (GLAPIENTRYP GetConvolutionFilter)(GLenum target, GLenum format, GLenum type, GLvoid * image); /* 356 */
void (GLAPIENTRYP GetConvolutionParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 357 */
void (GLAPIENTRYP GetConvolutionParameteriv)(GLenum target, GLenum pname, GLint * params); /* 358 */
void (GLAPIENTRYP GetSeparableFilter)(GLenum target, GLenum format, GLenum type, GLvoid * row, GLvoid * column, GLvoid * span); /* 359 */
void (GLAPIENTRYP SeparableFilter2D)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid * row, const GLvoid * column); /* 360 */
void (GLAPIENTRYP GetHistogram)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 361 */
void (GLAPIENTRYP GetHistogramParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 362 */
void (GLAPIENTRYP GetHistogramParameteriv)(GLenum target, GLenum pname, GLint * params); /* 363 */
void (GLAPIENTRYP GetMinmax)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid * values); /* 364 */
void (GLAPIENTRYP GetMinmaxParameterfv)(GLenum target, GLenum pname, GLfloat * params); /* 365 */
void (GLAPIENTRYP GetMinmaxParameteriv)(GLenum target, GLenum pname, GLint * params); /* 366 */
void (GLAPIENTRYP Histogram)(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); /* 367 */
void (GLAPIENTRYP Minmax)(GLenum target, GLenum internalformat, GLboolean sink); /* 368 */
void (GLAPIENTRYP ResetHistogram)(GLenum target); /* 369 */
void (GLAPIENTRYP ResetMinmax)(GLenum target); /* 370 */
void (GLAPIENTRYP TexImage3D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 371 */
void (GLAPIENTRYP TexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid * pixels); /* 372 */
void (GLAPIENTRYP CopyTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); /* 373 */
void (GLAPIENTRYP ActiveTexture)(GLenum texture); /* 374 */
void (GLAPIENTRYP ClientActiveTexture)(GLenum texture); /* 375 */
void (GLAPIENTRYP MultiTexCoord1dARB)(GLenum target, GLdouble s); /* 376 */
void (GLAPIENTRYP MultiTexCoord1dvARB)(GLenum target, const GLdouble * v); /* 377 */
void (GLAPIENTRYP MultiTexCoord1fARB)(GLenum target, GLfloat s); /* 378 */
void (GLAPIENTRYP MultiTexCoord1fvARB)(GLenum target, const GLfloat * v); /* 379 */
void (GLAPIENTRYP MultiTexCoord1iARB)(GLenum target, GLint s); /* 380 */
void (GLAPIENTRYP MultiTexCoord1ivARB)(GLenum target, const GLint * v); /* 381 */
void (GLAPIENTRYP MultiTexCoord1sARB)(GLenum target, GLshort s); /* 382 */
void (GLAPIENTRYP MultiTexCoord1svARB)(GLenum target, const GLshort * v); /* 383 */
void (GLAPIENTRYP MultiTexCoord2dARB)(GLenum target, GLdouble s, GLdouble t); /* 384 */
void (GLAPIENTRYP MultiTexCoord2dvARB)(GLenum target, const GLdouble * v); /* 385 */
void (GLAPIENTRYP MultiTexCoord2fARB)(GLenum target, GLfloat s, GLfloat t); /* 386 */
void (GLAPIENTRYP MultiTexCoord2fvARB)(GLenum target, const GLfloat * v); /* 387 */
void (GLAPIENTRYP MultiTexCoord2iARB)(GLenum target, GLint s, GLint t); /* 388 */
void (GLAPIENTRYP MultiTexCoord2ivARB)(GLenum target, const GLint * v); /* 389 */
void (GLAPIENTRYP MultiTexCoord2sARB)(GLenum target, GLshort s, GLshort t); /* 390 */
void (GLAPIENTRYP MultiTexCoord2svARB)(GLenum target, const GLshort * v); /* 391 */
void (GLAPIENTRYP MultiTexCoord3dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r); /* 392 */
void (GLAPIENTRYP MultiTexCoord3dvARB)(GLenum target, const GLdouble * v); /* 393 */
void (GLAPIENTRYP MultiTexCoord3fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r); /* 394 */
void (GLAPIENTRYP MultiTexCoord3fvARB)(GLenum target, const GLfloat * v); /* 395 */
void (GLAPIENTRYP MultiTexCoord3iARB)(GLenum target, GLint s, GLint t, GLint r); /* 396 */
void (GLAPIENTRYP MultiTexCoord3ivARB)(GLenum target, const GLint * v); /* 397 */
void (GLAPIENTRYP MultiTexCoord3sARB)(GLenum target, GLshort s, GLshort t, GLshort r); /* 398 */
void (GLAPIENTRYP MultiTexCoord3svARB)(GLenum target, const GLshort * v); /* 399 */
void (GLAPIENTRYP MultiTexCoord4dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); /* 400 */
void (GLAPIENTRYP MultiTexCoord4dvARB)(GLenum target, const GLdouble * v); /* 401 */
void (GLAPIENTRYP MultiTexCoord4f)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); /* 402 */
void (GLAPIENTRYP MultiTexCoord4fvARB)(GLenum target, const GLfloat * v); /* 403 */
void (GLAPIENTRYP MultiTexCoord4iARB)(GLenum target, GLint s, GLint t, GLint r, GLint q); /* 404 */
void (GLAPIENTRYP MultiTexCoord4ivARB)(GLenum target, const GLint * v); /* 405 */
void (GLAPIENTRYP MultiTexCoord4sARB)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); /* 406 */
void (GLAPIENTRYP MultiTexCoord4svARB)(GLenum target, const GLshort * v); /* 407 */
void (GLAPIENTRYP BlendEquationSeparateOES)(GLenum modeRGB, GLenum modeA); /* 408 */
void (GLAPIENTRYP BlendFuncSeparateOES)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); /* 409 */
void (GLAPIENTRYP DrawTexfOES)(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height); /* 410 */
void (GLAPIENTRYP DrawTexfvOES)(const GLfloat * coords); /* 411 */
void (GLAPIENTRYP DrawTexiOES)(GLint x, GLint y, GLint z, GLint width, GLint height); /* 412 */
void (GLAPIENTRYP DrawTexivOES)(const GLint * coords); /* 413 */
void (GLAPIENTRYP DrawTexsOES)(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height); /* 414 */
void (GLAPIENTRYP DrawTexsvOES)(const GLshort * coords); /* 415 */
void (GLAPIENTRYP DrawTexxOES)(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height); /* 416 */
void (GLAPIENTRYP DrawTexxvOES)(const GLfixed * coords); /* 417 */
void (GLAPIENTRYP BindFramebufferOES)(GLenum target, GLuint framebuffer); /* 418 */
void (GLAPIENTRYP BindRenderbufferOES)(GLenum target, GLuint renderbuffer); /* 419 */
GLenum (GLAPIENTRYP CheckFramebufferStatusOES)(GLenum target); /* 420 */
void (GLAPIENTRYP DeleteFramebuffersOES)(GLsizei n, const GLuint * framebuffers); /* 421 */
void (GLAPIENTRYP DeleteRenderbuffersOES)(GLsizei n, const GLuint * renderbuffers); /* 422 */
void (GLAPIENTRYP FramebufferRenderbufferOES)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); /* 423 */
void (GLAPIENTRYP FramebufferTexture2DOES)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); /* 424 */
void (GLAPIENTRYP GenFramebuffersOES)(GLsizei n, GLuint * framebuffers); /* 425 */
void (GLAPIENTRYP GenRenderbuffersOES)(GLsizei n, GLuint * renderbuffers); /* 426 */
void (GLAPIENTRYP GenerateMipmapOES)(GLenum target); /* 427 */
void (GLAPIENTRYP GetFramebufferAttachmentParameterivOES)(GLenum target, GLenum attachment, GLenum pname, GLint * params); /* 428 */
void (GLAPIENTRYP GetRenderbufferParameterivOES)(GLenum target, GLenum pname, GLint * params); /* 429 */
GLboolean (GLAPIENTRYP IsFramebufferOES)(GLuint framebuffer); /* 430 */
GLboolean (GLAPIENTRYP IsRenderbufferOES)(GLuint renderbuffer); /* 431 */
void (GLAPIENTRYP RenderbufferStorageOES)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); /* 432 */
void (GLAPIENTRYP PointSizePointerOES)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 433 */
GLbitfield (GLAPIENTRYP QueryMatrixxOES)(GLfixed * mantissa, GLint * exponent); /* 434 */
void (GLAPIENTRYP GetTexGenxvOES)(GLenum coord, GLenum pname, GLfixed * params); /* 435 */
void (GLAPIENTRYP TexGenxOES)(GLenum coord, GLenum pname, GLint param); /* 436 */
void (GLAPIENTRYP TexGenxvOES)(GLenum coord, GLenum pname, const GLfixed * params); /* 437 */
void (GLAPIENTRYP EGLImageTargetRenderbufferStorageOES)(GLenum target, GLeglImageOES image); /* 438 */
void (GLAPIENTRYP EGLImageTargetTexture2DOES)(GLenum target, GLeglImageOES image); /* 439 */
void (GLAPIENTRYP GetBufferPointervOES)(GLenum target, GLenum pname, GLvoid ** params); /* 440 */
GLvoid * (GLAPIENTRYP MapBufferOES)(GLenum target, GLenum access); /* 441 */
GLboolean (GLAPIENTRYP UnmapBufferOES)(GLenum target); /* 442 */
void (GLAPIENTRYP BindVertexArrayAPPLE)(GLuint array); /* 443 */
void (GLAPIENTRYP DeleteVertexArraysAPPLE)(GLsizei n, const GLuint * arrays); /* 444 */
void (GLAPIENTRYP GenVertexArraysAPPLE)(GLsizei n, GLuint * arrays); /* 445 */
GLboolean (GLAPIENTRYP IsVertexArrayAPPLE)(GLuint array); /* 446 */
void (GLAPIENTRYP CompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data); /* 447 */
void (GLAPIENTRYP CompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data); /* 448 */
void (GLAPIENTRYP SampleCoverage)(GLclampf value, GLboolean invert); /* 449 */
void (GLAPIENTRYP BindBuffer)(GLenum target, GLuint buffer); /* 450 */
void (GLAPIENTRYP BufferData)(GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage); /* 451 */
void (GLAPIENTRYP BufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid * data); /* 452 */
void (GLAPIENTRYP DeleteBuffers)(GLsizei n, const GLuint * buffer); /* 453 */
void (GLAPIENTRYP GenBuffers)(GLsizei n, GLuint * buffer); /* 454 */
void (GLAPIENTRYP GetBufferParameteriv)(GLenum target, GLenum pname, GLint * params); /* 455 */
GLboolean (GLAPIENTRYP IsBuffer)(GLuint buffer); /* 456 */
void (GLAPIENTRYP AlphaFuncx)(GLenum func, GLclampx ref); /* 457 */
void (GLAPIENTRYP ClearColorx)(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha); /* 458 */
void (GLAPIENTRYP ClearDepthf)(GLclampf depth); /* 459 */
void (GLAPIENTRYP ClearDepthx)(GLclampx depth); /* 460 */
void (GLAPIENTRYP Color4x)(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); /* 461 */
void (GLAPIENTRYP DepthRangef)(GLclampf zNear, GLclampf zFar); /* 462 */
void (GLAPIENTRYP DepthRangex)(GLclampx zNear, GLclampx zFar); /* 463 */
void (GLAPIENTRYP Fogx)(GLenum pname, GLfixed param); /* 464 */
void (GLAPIENTRYP Fogxv)(GLenum pname, const GLfixed * params); /* 465 */
void (GLAPIENTRYP Frustumf)(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); /* 466 */
void (GLAPIENTRYP Frustumx)(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); /* 467 */
void (GLAPIENTRYP LightModelx)(GLenum pname, GLfixed param); /* 468 */
void (GLAPIENTRYP LightModelxv)(GLenum pname, const GLfixed * params); /* 469 */
void (GLAPIENTRYP Lightx)(GLenum light, GLenum pname, GLfixed param); /* 470 */
void (GLAPIENTRYP Lightxv)(GLenum light, GLenum pname, const GLfixed * params); /* 471 */
void (GLAPIENTRYP LineWidthx)(GLfixed width); /* 472 */
void (GLAPIENTRYP LoadMatrixx)(const GLfixed * m); /* 473 */
void (GLAPIENTRYP Materialx)(GLenum face, GLenum pname, GLfixed param); /* 474 */
void (GLAPIENTRYP Materialxv)(GLenum face, GLenum pname, const GLfixed * params); /* 475 */
void (GLAPIENTRYP MultMatrixx)(const GLfixed * m); /* 476 */
void (GLAPIENTRYP MultiTexCoord4x)(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q); /* 477 */
void (GLAPIENTRYP Normal3x)(GLfixed nx, GLfixed ny, GLfixed nz); /* 478 */
void (GLAPIENTRYP Orthof)(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); /* 479 */
void (GLAPIENTRYP Orthox)(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); /* 480 */
void (GLAPIENTRYP PointSizex)(GLfixed size); /* 481 */
void (GLAPIENTRYP PolygonOffsetx)(GLfixed factor, GLfixed units); /* 482 */
void (GLAPIENTRYP Rotatex)(GLfixed angle, GLfixed x, GLfixed y, GLfixed z); /* 483 */
void (GLAPIENTRYP SampleCoveragex)(GLclampx value, GLboolean invert); /* 484 */
void (GLAPIENTRYP Scalex)(GLfixed x, GLfixed y, GLfixed z); /* 485 */
void (GLAPIENTRYP TexEnvx)(GLenum target, GLenum pname, GLfixed param); /* 486 */
void (GLAPIENTRYP TexEnvxv)(GLenum target, GLenum pname, const GLfixed * params); /* 487 */
void (GLAPIENTRYP TexParameterx)(GLenum target, GLenum pname, GLfixed param); /* 488 */
void (GLAPIENTRYP Translatex)(GLfixed x, GLfixed y, GLfixed z); /* 489 */
void (GLAPIENTRYP ClipPlanef)(GLenum plane, const GLfloat * equation); /* 490 */
void (GLAPIENTRYP ClipPlanex)(GLenum plane, const GLfixed * equation); /* 491 */
void (GLAPIENTRYP GetClipPlanef)(GLenum plane, GLfloat * equation); /* 492 */
void (GLAPIENTRYP GetClipPlanex)(GLenum plane, GLfixed * equation); /* 493 */
void (GLAPIENTRYP GetFixedv)(GLenum pname, GLfixed * params); /* 494 */
void (GLAPIENTRYP GetLightxv)(GLenum light, GLenum pname, GLfixed * params); /* 495 */
void (GLAPIENTRYP GetMaterialxv)(GLenum face, GLenum pname, GLfixed * params); /* 496 */
void (GLAPIENTRYP GetTexEnvxv)(GLenum target, GLenum pname, GLfixed * params); /* 497 */
void (GLAPIENTRYP GetTexParameterxv)(GLenum target, GLenum pname, GLfixed * params); /* 498 */
void (GLAPIENTRYP PointParameterx)(GLenum pname, GLfixed param); /* 499 */
void (GLAPIENTRYP PointParameterxv)(GLenum pname, const GLfixed * params); /* 500 */
void (GLAPIENTRYP TexParameterxv)(GLenum target, GLenum pname, const GLfixed * params); /* 501 */
void (GLAPIENTRYP PointParameterf)(GLenum pname, GLfloat param); /* 502 */
void (GLAPIENTRYP PointParameterfv)(GLenum pname, const GLfloat * params); /* 503 */
};
#endif /* !defined( _GLAPI_TABLE_H_ ) */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

2974
src/mesa/es/main/APIspec.txt Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1117
src/mesa/es/main/apiutil.py Normal file

File diff suppressed because it is too large Load Diff

149
src/mesa/es/main/drawtex.c Normal file
View File

@@ -0,0 +1,149 @@
/*
* Copyright (C) 2009 Chia-I Wu <olvaffe@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include "drawtex.h"
#include "main/state.h"
#include "main/imports.h"
#include "glapi/dispatch.h"
#if FEATURE_OES_draw_texture
static INLINE void
draw_texture(GLcontext *ctx, GLfloat x, GLfloat y, GLfloat z,
GLfloat width, GLfloat height)
{
if (!ctx->Extensions.OES_draw_texture) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glDrawTex(unsupported)");
return;
}
if (width <= 0.0f || height <= 0.0f) {
_mesa_error(ctx, GL_INVALID_VALUE, "glDrawTex(width or height <= 0)");
return;
}
if (ctx->NewState)
_mesa_update_state(ctx);
ASSERT(ctx->Driver.DrawTex);
ctx->Driver.DrawTex(ctx, x, y, z, width, height);
}
void GLAPIENTRY
_mesa_DrawTexf(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height)
{
GET_CURRENT_CONTEXT(ctx);
draw_texture(ctx, x, y, z, width, height);
}
void GLAPIENTRY
_mesa_DrawTexfv(const GLfloat *coords)
{
GET_CURRENT_CONTEXT(ctx);
draw_texture(ctx, coords[0], coords[1], coords[2], coords[3], coords[4]);
}
void GLAPIENTRY
_mesa_DrawTexi(GLint x, GLint y, GLint z, GLint width, GLint height)
{
GET_CURRENT_CONTEXT(ctx);
draw_texture(ctx, (GLfloat) x, (GLfloat) y, (GLfloat) z,
(GLfloat) width, (GLfloat) height);
}
void GLAPIENTRY
_mesa_DrawTexiv(const GLint *coords)
{
GET_CURRENT_CONTEXT(ctx);
draw_texture(ctx, (GLfloat) coords[0], (GLfloat) coords[1],
(GLfloat) coords[2], (GLfloat) coords[3], (GLfloat) coords[4]);
}
void GLAPIENTRY
_mesa_DrawTexs(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height)
{
GET_CURRENT_CONTEXT(ctx);
draw_texture(ctx, (GLfloat) x, (GLfloat) y, (GLfloat) z,
(GLfloat) width, (GLfloat) height);
}
void GLAPIENTRY
_mesa_DrawTexsv(const GLshort *coords)
{
GET_CURRENT_CONTEXT(ctx);
draw_texture(ctx, (GLfloat) coords[0], (GLfloat) coords[1],
(GLfloat) coords[2], (GLfloat) coords[3], (GLfloat) coords[4]);
}
/* it is static because GLfixed is not defined publicly */
static void GLAPIENTRY
_mesa_DrawTexx(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height)
{
GET_CURRENT_CONTEXT(ctx);
draw_texture(ctx,
(GLfloat) x / 65536.0f,
(GLfloat) y / 65536.0f,
(GLfloat) z / 65536.0f,
(GLfloat) width / 65536.0f,
(GLfloat) height / 65536.0f);
}
static void GLAPIENTRY
_mesa_DrawTexxv(const GLfixed *coords)
{
GET_CURRENT_CONTEXT(ctx);
draw_texture(ctx,
(GLfloat) coords[0] / 65536.0f,
(GLfloat) coords[1] / 65536.0f,
(GLfloat) coords[2] / 65536.0f,
(GLfloat) coords[3] / 65536.0f,
(GLfloat) coords[4] / 65536.0f);
}
void
_mesa_init_drawtex_dispatch(struct _glapi_table *disp)
{
SET_DrawTexfOES(disp, _mesa_DrawTexf);
SET_DrawTexfvOES(disp, _mesa_DrawTexfv);
SET_DrawTexiOES(disp, _mesa_DrawTexi);
SET_DrawTexivOES(disp, _mesa_DrawTexiv);
SET_DrawTexsOES(disp, _mesa_DrawTexs);
SET_DrawTexsvOES(disp, _mesa_DrawTexsv);
SET_DrawTexxOES(disp, _mesa_DrawTexx);
SET_DrawTexxvOES(disp, _mesa_DrawTexxv);
}
#endif /* FEATURE_OES_draw_texture */

View File

@@ -0,0 +1,79 @@
/*
* Copyright (C) 2009 Chia-I Wu <olvaffe@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (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 DRAWTEX_H
#define DRAWTEX_H
#include "main/mtypes.h"
#if FEATURE_OES_draw_texture
#define _MESA_INIT_DRAWTEX_FUNCTIONS(driver, impl) \
do { \
(driver)->DrawTex = impl ## DrawTex; \
} while (0)
extern void GLAPIENTRY
_mesa_DrawTexf(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
extern void GLAPIENTRY
_mesa_DrawTexfv(const GLfloat *coords);
extern void GLAPIENTRY
_mesa_DrawTexi(GLint x, GLint y, GLint z, GLint width, GLint height);
extern void GLAPIENTRY
_mesa_DrawTexiv(const GLint *coords);
extern void GLAPIENTRY
_mesa_DrawTexs(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
extern void GLAPIENTRY
_mesa_DrawTexsv(const GLshort *coords);
#if 0
extern void GLAPIENTRY
_mesa_DrawTexx(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
extern void GLAPIENTRY
_mesa_DrawTexxv(const GLfixed *coords);
#endif
extern void
_mesa_init_drawtex_dispatch(struct _glapi_table *disp);
#else /* FEATURE_OES_draw_texture */
#define _MESA_INIT_DRAWTEX_FUNCTIONS(driver, impl) do { } while (0)
static INLINE void
_mesa_init_drawtex_dispatch(struct _glapi_table *disp)
{
}
#endif /* FEATURE_OES_draw_texture */
#endif /* DRAWTEX_H */

115
src/mesa/es/main/eglimage.c Normal file
View File

@@ -0,0 +1,115 @@
/*
* Copyright (C) 2009 Chia-I Wu <olvaffe@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include "main/mtypes.h"
#include "main/context.h"
#include "main/teximage.h"
#include "main/texstate.h"
#include "main/imports.h"
#include "glapi/dispatch.h"
#include "eglimage.h"
#if FEATURE_OES_EGL_image
void GLAPIENTRY
_mesa_EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
{
GET_CURRENT_CONTEXT(ctx);
struct gl_renderbuffer *rb;
if (!ctx->Extensions.OES_EGL_image) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glEGLImageTargetRenderbufferStorageOES(unsupported)");
return;
}
if (target != GL_RENDERBUFFER) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glEGLImageTargetRenderbufferStorage(target=0x%x)", target);
return;
}
rb = ctx->CurrentRenderbuffer;
if (!rb) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glEGLImageTargetRenderbufferStorageOES(no bound rb)");
return;
}
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
ASSERT(ctx->Driver.EGLImageTargetRenderbufferStorage);
ctx->Driver.EGLImageTargetRenderbufferStorage(ctx, rb, image);
/* invalidate fbo? */
}
void GLAPIENTRY _mesa_EGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
{
GET_CURRENT_CONTEXT(ctx);
struct gl_texture_unit *texUnit;
struct gl_texture_object *texObj;
if (!ctx->Extensions.OES_EGL_image) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glEGLImageTargetTexture2DOES(unsupported)");
return;
}
if (target != GL_TEXTURE_2D) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glEGLImageTargetTexture2D(target=0x%x)", target);
return;
}
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
texUnit = _mesa_get_current_tex_unit(ctx);
texObj = _mesa_select_tex_object(ctx, texUnit, target);
_mesa_lock_texture(ctx, texObj);
ASSERT(ctx->Driver.EGLImageTargetTexture2D);
ctx->Driver.EGLImageTargetTexture2D(ctx, texObj ,image);
/* invalidate state and fbo?*/
/* fbo? */
texObj->_Complete = GL_FALSE;
ctx->NewState |= _NEW_TEXTURE;
_mesa_unlock_texture(ctx, texObj);
}
void
_mesa_init_eglimage_dispatch(struct _glapi_table *disp)
{
SET_EGLImageTargetRenderbufferStorageOES(disp,
_mesa_EGLImageTargetRenderbufferStorageOES);
SET_EGLImageTargetTexture2DOES(disp, _mesa_EGLImageTargetTexture2DOES);
}
#endif /* FEATURE_OES_EGL_image */

View File

@@ -0,0 +1,61 @@
/*
* Copyright (C) 2009 Chia-I Wu <olvaffe@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (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 EGLIMAGE_H
#define EGLIMAGE_H
#include "main/mtypes.h"
#if FEATURE_OES_EGL_image
#define _MESA_INIT_EGLIMAGE_FUNCTIONS(driver, impl) \
do { \
(driver)->EGLImageTargetRenderbufferStorage = \
impl ## EGLImageTargetRenderbufferStorage; \
(driver)->EGLImageTargetTexture2D = impl ## EGLImageTargetTexture2D; \
} while (0)
extern void GLAPIENTRY
_mesa_EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image);
extern void GLAPIENTRY
_mesa_EGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image);
extern void
_mesa_init_eglimage_dispatch(struct _glapi_table *disp);
#else /* FEATURE_OES_EGL_image */
#define _MESA_INIT_EGLIMAGE_FUNCTIONS(driver, impl) do { } while (0)
static INLINE void
_mesa_init_eglimage_dispatch(struct _glapi_table *disp)
{
}
#endif /* FEATURE_OES_EGL_image */
#endif /* EGLIMAGE_H */

View File

@@ -0,0 +1,8 @@
# GetString is always special.
GetString
# CompressedTexImage2D calls out to two different functions based on
# whether the image is a paletted image or not
CompressedTexImage2D
# QueryMatrixx returns values in an unusual, decomposed, fixed-value
# form; it has its own code for this
QueryMatrixx

View File

@@ -0,0 +1,5 @@
# GetString must always have its own implementation, so we return our
# implementation values instead of Mesa's.
GetString
CompressedTexImage2D
RenderbufferStorage

View File

@@ -0,0 +1,240 @@
/**************************************************************************
*
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
**************************************************************************/
/**
* Code to convert compressed/paletted texture images to ordinary 4-byte RGBA.
* See the GL_OES_compressed_paletted_texture spec at
* http://khronos.org/registry/gles/extensions/OES/OES_compressed_paletted_texture.txt
*/
#include <stdlib.h>
#include <assert.h>
#include "GLES/gl.h"
#include "GLES/glext.h"
void GL_APIENTRY _es_CompressedTexImage2D(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
void GL_APIENTRY _mesa_TexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
void GL_APIENTRY _mesa_CompressedTexImage2DARB(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
static const struct {
GLenum format;
GLuint palette_size;
GLuint size;
} formats[] = {
{ GL_PALETTE4_RGB8_OES, 16, 3 },
{ GL_PALETTE4_RGBA8_OES, 16, 4 },
{ GL_PALETTE4_R5_G6_B5_OES, 16, 2 },
{ GL_PALETTE4_RGBA4_OES, 16, 2 },
{ GL_PALETTE4_RGB5_A1_OES, 16, 2 },
{ GL_PALETTE8_RGB8_OES, 256, 3 },
{ GL_PALETTE8_RGBA8_OES, 256, 4 },
{ GL_PALETTE8_R5_G6_B5_OES, 256, 2 },
{ GL_PALETTE8_RGBA4_OES, 256, 2 },
{ GL_PALETTE8_RGB5_A1_OES, 256, 2 }
};
/**
* Get a color/entry from the palette. Convert to GLubyte/RGBA format.
*/
static void
get_palette_entry(GLenum format, const void *palette, GLuint index,
GLubyte rgba[4])
{
switch (format) {
case GL_PALETTE4_RGB8_OES:
case GL_PALETTE8_RGB8_OES:
{
const GLubyte *pal = (const GLubyte *) palette;
rgba[0] = pal[index * 3 + 0];
rgba[1] = pal[index * 3 + 1];
rgba[2] = pal[index * 3 + 2];
rgba[3] = 255;
}
break;
case GL_PALETTE4_RGBA8_OES:
case GL_PALETTE8_RGBA8_OES:
{
const GLubyte *pal = (const GLubyte *) palette;
rgba[0] = pal[index * 4 + 0];
rgba[1] = pal[index * 4 + 1];
rgba[2] = pal[index * 4 + 2];
rgba[3] = pal[index * 4 + 3];
}
break;
case GL_PALETTE4_R5_G6_B5_OES:
case GL_PALETTE8_R5_G6_B5_OES:
{
const GLushort *pal = (const GLushort *) palette;
const GLushort color = pal[index];
rgba[0] = ((color >> 8) & 0xf8) | ((color >> 11) & 0x3);
rgba[1] = ((color >> 3) & 0xfc) | ((color >> 1 ) & 0x3);
rgba[2] = ((color << 3) & 0xf8) | ((color ) & 0x7);
rgba[3] = 255;
}
break;
case GL_PALETTE4_RGBA4_OES:
case GL_PALETTE8_RGBA4_OES:
{
const GLushort *pal = (const GLushort *) palette;
const GLushort color = pal[index];
rgba[0] = ((color & 0xf000) >> 8) | ((color & 0xf000) >> 12);
rgba[1] = ((color & 0x0f00) >> 4) | ((color & 0x0f00) >> 8);
rgba[2] = ((color & 0x00f0) ) | ((color & 0x00f0) >> 4);
rgba[3] = ((color & 0x000f) << 4) | ((color & 0x000f) );
}
break;
case GL_PALETTE4_RGB5_A1_OES:
case GL_PALETTE8_RGB5_A1_OES:
{
const GLushort *pal = (const GLushort *) palette;
const GLushort color = pal[index];
rgba[0] = ((color >> 8) & 0xf8) | ((color >> 11) & 0x7);
rgba[1] = ((color >> 3) & 0xf8) | ((color >> 6) & 0x7);
rgba[2] = ((color << 2) & 0xf8) | ((color >> 1) & 0x7);
rgba[3] = (color & 0x1) * 255;
}
break;
default:
assert(0);
}
}
/**
* Convert paletted texture to simple GLubyte/RGBA format.
*/
static void
paletted_to_rgba(GLenum src_format,
const void *palette,
const void *indexes,
GLsizei width, GLsizei height,
GLubyte *rgba)
{
GLuint pal_ents, i;
assert(src_format >= GL_PALETTE4_RGB8_OES);
assert(src_format <= GL_PALETTE8_RGB5_A1_OES);
assert(formats[src_format - GL_PALETTE4_RGB8_OES].format == src_format);
pal_ents = formats[src_format - GL_PALETTE4_RGB8_OES].palette_size;
if (pal_ents == 16) {
/* 4 bits per index */
const GLubyte *ind = (const GLubyte *) indexes;
if (width * height == 1) {
/* special case the only odd-sized image */
GLuint index0 = ind[0] >> 4;
get_palette_entry(src_format, palette, index0, rgba);
return;
}
/* two pixels per iteration */
for (i = 0; i < width * height / 2; i++) {
GLuint index0 = ind[i] >> 4;
GLuint index1 = ind[i] & 0xf;
get_palette_entry(src_format, palette, index0, rgba + i * 8);
get_palette_entry(src_format, palette, index1, rgba + i * 8 + 4);
}
}
else {
/* 8 bits per index */
const GLubyte *ind = (const GLubyte *) indexes;
for (i = 0; i < width * height; i++) {
GLuint index = ind[i];
get_palette_entry(src_format, palette, index, rgba + i * 4);
}
}
}
/**
* Convert a call to glCompressedTexImage2D() where internalFormat is a
* compressed palette format into a regular GLubyte/RGBA glTexImage2D() call.
*/
static void
cpal_compressed_teximage2d(GLenum target, GLint level,
GLenum internalFormat,
GLsizei width, GLsizei height,
const void *pixels)
{
GLuint pal_ents, pal_ent_size, pal_bytes;
const GLint num_levels = level + 1;
GLint lvl;
const GLubyte *indexes;
assert(internalFormat >= GL_PALETTE4_RGB8_OES);
assert(internalFormat <= GL_PALETTE8_RGB5_A1_OES);
assert(formats[internalFormat - GL_PALETTE4_RGB8_OES].format == internalFormat);
pal_ents = formats[internalFormat - GL_PALETTE4_RGB8_OES].palette_size;
pal_ent_size = formats[internalFormat - GL_PALETTE4_RGB8_OES].size;
pal_bytes = pal_ents * pal_ent_size;
/* first image follows the palette */
indexes = (const GLubyte *) pixels + pal_bytes;
/* No worries about glPixelStore state since the only supported parameter is
* GL_UNPACK_ALIGNMENT and it doesn't matter when unpacking GLubyte/RGBA.
*/
for (lvl = 0; lvl < num_levels; lvl++) {
/* Allocate GLubyte/RGBA dest image buffer */
GLubyte *rgba = (GLubyte *) malloc(width * height * 4);
if (pixels)
paletted_to_rgba(internalFormat, pixels, indexes, width, height, rgba);
_mesa_TexImage2D(target, lvl, GL_RGBA, width, height, 0,
GL_RGBA, GL_UNSIGNED_BYTE, rgba);
free(rgba);
/* advance index pointer to point to next src mipmap */
if (pal_ents == 4)
indexes += width * height / 2;
else
indexes += width * height;
/* next mipmap level size */
if (width > 1)
width /= 2;
if (height > 1)
height /= 2;
}
}
void GL_APIENTRY
_es_CompressedTexImage2D(GLenum target, GLint level, GLenum internalFormat,
GLsizei width, GLsizei height, GLint border,
GLsizei imageSize, const GLvoid *data)
{
switch (internalFormat) {
case GL_PALETTE4_RGB8_OES:
case GL_PALETTE4_RGBA8_OES:
case GL_PALETTE4_R5_G6_B5_OES:
case GL_PALETTE4_RGBA4_OES:
case GL_PALETTE4_RGB5_A1_OES:
case GL_PALETTE8_RGB8_OES:
case GL_PALETTE8_RGBA8_OES:
case GL_PALETTE8_R5_G6_B5_OES:
case GL_PALETTE8_RGBA4_OES:
case GL_PALETTE8_RGB5_A1_OES:
cpal_compressed_teximage2d(target, level, internalFormat,
width, height, data);
break;
default:
_mesa_CompressedTexImage2DARB(target, level, internalFormat,
width, height, border, imageSize, data);
}
}

37
src/mesa/es/main/es_fbo.c Normal file
View File

@@ -0,0 +1,37 @@
/**************************************************************************
*
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
**************************************************************************/
#include "GLES2/gl2.h"
#include "GLES2/gl2ext.h"
extern void GL_APIENTRY _es_RenderbufferStorage(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height);
extern void GL_APIENTRY _mesa_RenderbufferStorageEXT(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height);
void GL_APIENTRY
_es_RenderbufferStorage(GLenum target, GLenum internalFormat,
GLsizei width, GLsizei height)
{
switch (internalFormat) {
case GL_RGBA4:
case GL_RGB5_A1:
case GL_RGB565:
internalFormat = GL_RGBA;
break;
case GL_STENCIL_INDEX1_OES:
case GL_STENCIL_INDEX4_OES:
case GL_STENCIL_INDEX8:
internalFormat = GL_STENCIL_INDEX;
break;
default:
; /* no op */
}
_mesa_RenderbufferStorageEXT(target, internalFormat, width, height);
}

View File

@@ -0,0 +1,782 @@
#*************************************************************************
# 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, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# TUNGSTEN GRAPHICS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#*************************************************************************
import sys, os
import apiutil
# These dictionary entries are used for automatic conversion.
# The string will be used as a format string with the conversion
# variable.
Converters = {
'GLint': {
'GLfloat': "(GLfloat) (%s)",
},
'GLshort': {
'GLfloat': "(GLfloat) (%s)",
},
'GLfloat': {
'GLdouble': "(GLdouble) (%s)",
'GLint': "(GLint) (%s)",
'GLshort': "(GLshort) (%s)",
'GLfixed' : "(GLint) (%s * 65536)",
},
'GLfixed': {
'GLfloat': "(GLfloat) (%s / 65536.0f)",
'GLdouble': "(GLdouble) (%s / 65536.0)",
},
'GLdouble': {
'GLfloat': "(GLfloat) (%s)",
'GLfixed': "(GLfixed) (%s * 65536)",
},
'GLclampf': {
'GLclampd': "(GLclampd) (%s)",
'GLclampx': "(GLclampx) (%s * 65536)",
},
'GLclampx': {
'GLclampf': "(GLclampf) (%s / 65536.0f)",
'GLclampd': "(GLclampd) (%s / 65536.0)",
},
'GLubyte': {
'GLfloat': "(GLfloat) (%s / 255.0f)",
},
}
def GetBaseType(type):
typeTokens = type.split(' ')
baseType = None
typeModifiers = []
for t in typeTokens:
if t in ['const', '*']:
typeModifiers.append(t)
else:
baseType = t
return (baseType, typeModifiers)
def ConvertValue(value, fromType, toType):
"""Returns a string that represents the given parameter string,
type-converted if necessary."""
if not Converters.has_key(fromType):
sys.stderr.write("No base converter for type '%s' found. Ignoring." % fromType)
return value
if not Converters[fromType].has_key(toType):
sys.stderr.write("No converter found for type '%s' to type '%s'. Ignoring." % (fromType, toType))
return value
# This part is simple. Return the proper conversion.
conversionString = Converters[fromType][toType]
return conversionString % value
def GetLoopSizeExpression(funcName, paramName, paramMaxVecSize):
# The VariantArrays() list will have all the information (for all
# parameters) on how to calculate variant array sizes.
variantArrays = apiutil.VariantArrays(funcName)
defaultSize = paramMaxVecSize
loopSizeExpression = ''
# There can be many different entries in the variantArrays for the
# same parameter. We have to look at all of them and pick out the
# ones of interest.
for (variantName, variantSize, controllingParam, controllingValues) in variantArrays:
if paramName == variantName:
# This variant specification applies to us. It may be of
# the form "param size default", meaning that the value should
# replace the default size, or it may be
# "param size controlParam value...", in which case the size should
# be used if the controlParam has any one of the given values.
if len(controllingValues) == 0:
defaultSize = variantSize
else:
# Create a compound conditional that expresses
# all the possible values in the list
conditional = ''
for value in controllingValues:
if len(conditional) > 0:
conditional = conditional + " || "
conditional = conditional + "%s == %s" % (controllingParam, value)
# Add the possibly compound conditional and
# the associated vector size to the
# loop control expression
loopSizeExpression = loopSizeExpression + "(%s) ? %s : " % (conditional, variantSize)
# end if the name matches
# end for the list of all variant array declarations
# Return the expression that returns the actual size of the
# array. Note that 'loopSizeExpression' will already have a
# trailing ": " if it is nonempty.
if len(loopSizeExpression) > 0:
return "(%s%s)" % (loopSizeExpression, defaultSize)
else:
return "%s" % defaultSize
FormatStrings = {
'GLenum' : '0x%x',
'GLfloat' : '%f',
'GLint' : '%d',
'GLbitfield' : '0x%x',
}
def GetFormatString(type):
if FormatStrings.has_key(type):
return FormatStrings[type]
else:
return None
######################################################################
# Version-specific values to be used in the main script
# header: which header file to include
# api: what text specifies an API-level function
# special: the name of the "specials" file
VersionSpecificValues = {
'GLES1.1' : {
'description' : 'GLES1.1 functions',
'header' : 'GLES/gl.h',
'extheader' : 'GLES/glext.h',
'special' : 'es1_special',
},
'GLES2.0': {
'description' : 'GLES2.0 functions',
'header' : 'GLES2/gl2.h',
'extheader' : 'GLES2/gl2ext.h',
'special' : 'es2_special',
}
}
######################################################################
# Main code for the script begins here.
# Get the name of the program (without the directory part) for use in
# error messages.
program = os.path.basename(sys.argv[0])
# We assume that the directory that the Python script is in also
# houses the "special" files.
programDir = os.path.dirname(sys.argv[0])
# Set default values
verbose = 0
functionList = "APIspec.txt"
version = "GLES1.1"
# Allow for command-line switches
import getopt, time
options = "hvV:S:"
try:
optlist, args = getopt.getopt(sys.argv[1:], options)
except getopt.GetoptError, message:
sys.stderr.write("%s: %s. Use -h for help.\n" % (program, message))
sys.exit(1)
for option, optarg in optlist:
if option == "-h":
sys.stderr.write("Usage: %s [-%s]\n" % (program, options))
sys.stderr.write("Parse an API specification file and generate wrapper functions for a given GLES version\n")
sys.stderr.write("-h gives help\n")
sys.stderr.write("-v is verbose\n")
sys.stderr.write("-V specifies GLES version to generate [%s]:\n" % version)
for key in VersionSpecificValues.keys():
sys.stderr.write(" %s - %s\n" % (key, VersionSpecificValues[key]['description']))
sys.stderr.write("-S specifies API specification file to use [%s]\n" % functionList)
sys.exit(1)
elif option == "-v":
verbose += 1
elif option == "-V":
version = optarg
elif option == "-S":
functionList = optarg
# Beyond switches, we support no further command-line arguments
if len(args) > 0:
sys.stderr.write("%s: only switch arguments are supported - use -h for help\n" % program)
sys.exit(1)
# If we don't have a valid version, abort.
if not VersionSpecificValues.has_key(version):
sys.stderr.write("%s: version '%s' is not valid - use -h for help\n" % (program, version))
sys.exit(1)
# Grab the version-specific items we need to use
versionHeader = VersionSpecificValues[version]['header']
versionExtHeader = VersionSpecificValues[version]['extheader']
versionSpecial = VersionSpecificValues[version]['special']
# We're probably being invoked from a different directory,
# so look for the "special" file in the same directory that
# holds the Python script
specialFile = os.path.join(programDir, versionSpecial)
if not os.path.isfile(specialFile):
sys.stderr.write("%s: can't find special file '%s' for version '%s' - aborting" % (program, specialFile, version))
sys.exit(1)
allSpecials = apiutil.AllSpecials(specialFile.split("_")[0])
# If we get to here, we're good to go. The "version" parameter
# directs GetDispatchedFunctions to only allow functions from
# that "category" (version in our parlance). This allows
# functions with different declarations in different categories
# to exist (glTexImage2D, for example, is different between
# GLES1 and GLES2).
keys = apiutil.GetAllFunctions(functionList, version)
print """/* DO NOT EDIT *************************************************
* THIS FILE AUTOMATICALLY GENERATED BY THE %s SCRIPT
* API specification file: %s
* GLES version: %s
* date: %s
*/
""" % (program, functionList, version, time.strftime("%Y-%m-%d %H:%M:%S"))
# The headers we choose are version-specific.
print """
#include "%s"
#include "%s"
""" % (versionHeader, versionExtHeader)
# Everyone needs these types.
print """
/* These types are needed for the Mesa veneer, but are not defined in
* the standard GLES headers.
*/
typedef double GLdouble;
typedef double GLclampd;
/* This type is normally in glext.h, but needed here */
typedef char GLchar;
/* Mesa error handling requires these */
extern void *_mesa_get_current_context(void);
extern void _mesa_error(void *ctx, GLenum error, const char *fmtString, ... );
#include "main/compiler.h"
#include "main/api_exec.h"
#define HAVE_GLES_TYPES
#include "glapi/dispatch.h"
typedef void (*_glapi_proc)(void); /* generic function pointer */
"""
# All variant-length arrays in the GLES API are controlled by some
# selector parameter. Almost all of those are constant length based
# on the selector parameter (e.g., in glFogfv(), if the "pname"
# parameter is GL_FOG_COLOR, the "params" array is considered to be
# 4 floats long; for any other value of "pname", the "params' array
# is considered to be 1 float long.
#
# There are a very few instances where the selector parameter chooses
# a runtime-determined value:
# glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS)
# glGetIntegerv(GL_SHADER_BINARY_FORMATS)
# plus the glGetBooleanv, glGetFloatv, glGetFixedv counterparts.
#
# The number of formats in both cases is not a constant, but is a
# runtime-determined value (based on the return value of
# glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS) or
# glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS).
#
# Rather than hard-code some value (and risk memory errors when we
# overshoot arrays), in these cases we'll use a constant expresssion
# (e.g. _get_size(GL_NUM_COMPRESSED_TEXTURE_FORMATS)) to get the
# value of the variant array. Note, though, that in these cases the
# "vector" parameter should be set to some size large enough to hold
# all values (and must be set for GLfixed-based conversions, which
# need it to define an auxiliary array size).
#
# Here's the function itself. Although we only need a couple of values,
# we'll make it general.
print """
extern void GLAPIENTRY _mesa_GetIntegerv(GLenum, GLint *);
static INLINE unsigned int _get_size(GLenum pname)
{
/* In case of error, make sure the value returned is 0. */
GLint value = 0;
_mesa_GetIntegerv(pname, &value);
return (unsigned int) value;
}
"""
# Finally we get to the all-important functions
print """/*************************************************************
* Generated functions begin here
*/
"""
for funcName in keys:
if verbose > 0: sys.stderr.write("%s: processing function %s\n" % (program, funcName))
# start figuring out what this function will look like.
returnType = apiutil.ReturnType(funcName)
props = apiutil.Properties(funcName)
params = apiutil.Parameters(funcName)
declarationString = apiutil.MakeDeclarationString(params)
# In case of error, a function may have to return. Make
# sure we have valid return values in this case.
if returnType == "void":
errorReturn = "return"
elif returnType == "GLboolean":
errorReturn = "return GL_FALSE"
else:
errorReturn = "return (%s) 0" % returnType
# These are the output of this large calculation block.
# passthroughDeclarationString: a typed set of parameters that
# will be used to create the "extern" reference for the
# underlying Mesa or support function. Note that as generated
# these have an extra ", " at the beginning, which will be
# removed before use.
#
# passthroughDeclarationString: an untyped list of parameters
# that will be used to call the underlying Mesa or support
# function (including references to converted parameters).
# This will also be generated with an extra ", " at the
# beginning, which will be removed before use.
#
# variables: C code to create any local variables determined to
# be necessary.
# conversionCodeOutgoing: C code to convert application parameters
# to a necessary type before calling the underlying support code.
# May be empty if no conversion is required.
# conversionCodeIncoming: C code to do the converse: convert
# values returned by underlying Mesa code to the types needed
# by the application.
# Note that *either* the conversionCodeIncoming will be used (for
# generated query functions), *or* the conversionCodeOutgoing will
# be used (for generated non-query functions), never both.
passthroughFuncName = ""
passthroughDeclarationString = ""
passthroughCallString = ""
variables = []
conversionCodeOutgoing = []
conversionCodeIncoming = []
switchCode = []
# Calculate the name of the underlying support function to call.
# By default, the passthrough function is named _mesa_<funcName>.
# We're allowed to override the prefix and/or the function name
# for each function record, though. The "ConversionFunction"
# utility is poorly named, BTW...
aliasprefix = apiutil.AliasPrefix(funcName)
alias = apiutil.ConversionFunction(funcName)
if not alias:
# There may still be a Mesa alias for the function
if apiutil.Alias(funcName):
passthroughFuncName = "%s%s" % (aliasprefix, apiutil.Alias(funcName))
else:
passthroughFuncName = "%s%s" % (aliasprefix, funcName)
else: # a specific alias is provided
passthroughFuncName = "%s%s" % (aliasprefix, alias)
# Look at every parameter: each one may have only specific
# allowed values, or dependent parameters to check, or
# variant-sized vector arrays to calculate
for (paramName, paramType, paramMaxVecSize, paramConvertToType, paramValidValues, paramValueConversion) in params:
# We'll need this below if we're doing conversions
(paramBaseType, paramTypeModifiers) = GetBaseType(paramType)
# Conversion management.
# We'll handle three cases, easiest to hardest: a parameter
# that doesn't require conversion, a scalar parameter that
# requires conversion, and a vector parameter that requires
# conversion.
if paramConvertToType == None:
# Unconverted parameters are easy, whether they're vector
# or scalar - just add them to the call list. No conversions
# or anything to worry about.
passthroughDeclarationString += ", %s %s" % (paramType, paramName)
passthroughCallString += ", %s" % paramName
elif paramMaxVecSize == 0: # a scalar parameter that needs conversion
# A scalar to hold a converted parameter
variables.append(" %s converted_%s;" % (paramConvertToType, paramName))
# Outgoing conversion depends on whether we have to conditionally
# perform value conversion.
if paramValueConversion == "none":
conversionCodeOutgoing.append(" converted_%s = (%s) %s;" % (paramName, paramConvertToType, paramName))
elif paramValueConversion == "some":
# We'll need a conditional variable to keep track of
# whether we're converting values or not.
if (" int convert_%s_value = 1;" % paramName) not in variables:
variables.append(" int convert_%s_value = 1;" % paramName)
# Write code based on that conditional.
conversionCodeOutgoing.append(" if (convert_%s_value) {" % paramName)
conversionCodeOutgoing.append(" converted_%s = %s;" % (paramName, ConvertValue(paramName, paramBaseType, paramConvertToType)))
conversionCodeOutgoing.append(" } else {")
conversionCodeOutgoing.append(" converted_%s = (%s) %s;" % (paramName, paramConvertToType, paramName))
conversionCodeOutgoing.append(" }")
else: # paramValueConversion == "all"
conversionCodeOutgoing.append(" converted_%s = %s;" % (paramName, ConvertValue(paramName, paramBaseType, paramConvertToType)))
# Note that there can be no incoming conversion for a
# scalar parameter; changing the scalar will only change
# the local value, and won't ultimately change anything
# that passes back to the application.
# Call strings. The unusual " ".join() call will join the
# array of parameter modifiers with spaces as separators.
passthroughDeclarationString += ", %s %s %s" % (paramConvertToType, " ".join(paramTypeModifiers), paramName)
passthroughCallString += ", converted_%s" % paramName
else: # a vector parameter that needs conversion
# We'll need an index variable for conversions
if " register unsigned int i;" not in variables:
variables.append(" register unsigned int i;")
# This variable will hold the (possibly variant) size of
# this array needing conversion. By default, we'll set
# it to the maximal size (which is correct for functions
# with a constant-sized vector parameter); for true
# variant arrays, we'll modify it with other code.
variables.append(" unsigned int n_%s = %d;" % (paramName, paramMaxVecSize))
# This array will hold the actual converted values.
variables.append(" %s converted_%s[%d];" % (paramConvertToType, paramName, paramMaxVecSize))
# Again, we choose the conversion code based on whether we
# have to always convert values, never convert values, or
# conditionally convert values.
if paramValueConversion == "none":
conversionCodeOutgoing.append(" for (i = 0; i < n_%s; i++) {" % paramName)
conversionCodeOutgoing.append(" converted_%s[i] = (%s) %s[i];" % (paramName, paramConvertToType, paramName))
conversionCodeOutgoing.append(" }")
elif paramValueConversion == "some":
# We'll need a conditional variable to keep track of
# whether we're converting values or not.
if (" int convert_%s_value = 1;" % paramName) not in variables:
variables.append(" int convert_%s_value = 1;" % paramName)
# Write code based on that conditional.
conversionCodeOutgoing.append(" if (convert_%s_value) {" % paramName)
conversionCodeOutgoing.append(" for (i = 0; i < n_%s; i++) {" % paramName)
conversionCodeOutgoing.append(" converted_%s[i] = %s;" % (paramName, ConvertValue("%s[i]" % paramName, paramBaseType, paramConvertToType)))
conversionCodeOutgoing.append(" }")
conversionCodeOutgoing.append(" } else {")
conversionCodeOutgoing.append(" for (i = 0; i < n_%s; i++) {" % paramName)
conversionCodeOutgoing.append(" converted_%s[i] = (%s) %s[i];" % (paramName, paramConvertToType, paramName))
conversionCodeOutgoing.append(" }")
conversionCodeOutgoing.append(" }")
else: # paramValueConversion == "all"
conversionCodeOutgoing.append(" for (i = 0; i < n_%s; i++) {" % paramName)
conversionCodeOutgoing.append(" converted_%s[i] = %s;" % (paramName, ConvertValue("%s[i]" % paramName, paramBaseType, paramConvertToType)))
conversionCodeOutgoing.append(" }")
# If instead we need an incoming conversion (i.e. results
# from Mesa have to be converted before handing back
# to the application), this is it. Fortunately, we don't
# have to worry about conditional value conversion - the
# functions that do (e.g. glGetFixedv()) are handled
# specially, outside this code generation.
#
# Whether we use incoming conversion or outgoing conversion
# is determined later - we only ever use one or the other.
if paramValueConversion == "none":
conversionCodeIncoming.append(" for (i = 0; i < n_%s; i++) {" % paramName)
conversionCodeIncoming.append(" %s[i] = (%s) converted_%s[i];" % (paramName, paramConvertToType, paramName))
conversionCodeIncoming.append(" }")
elif paramValueConversion == "some":
# We'll need a conditional variable to keep track of
# whether we're converting values or not.
if (" int convert_%s_value = 1;" % paramName) not in variables:
variables.append(" int convert_%s_value = 1;" % paramName)
# Write code based on that conditional.
conversionCodeIncoming.append(" if (convert_%s_value) {" % paramName)
conversionCodeIncoming.append(" for (i = 0; i < n_%s; i++) {" % paramName)
conversionCodeIncoming.append(" %s[i] = %s;" % (paramName, ConvertValue("converted_%s[i]" % paramName, paramConvertToType, paramBaseType)))
conversionCodeIncoming.append(" }")
conversionCodeIncoming.append(" } else {")
conversionCodeIncoming.append(" for (i = 0; i < n_%s; i++) {" % paramName)
conversionCodeIncoming.append(" %s[i] = (%s) converted_%s[i];" % (paramName, paramConvertToType, paramName))
conversionCodeIncoming.append(" }")
conversionCodeIncoming.append(" }")
else: # paramValueConversion == "all"
conversionCodeIncoming.append(" for (i = 0; i < n_%s; i++) {" % paramName)
conversionCodeIncoming.append(" %s[i] = %s;" % (paramName, ConvertValue("converted_%s[i]" % paramName, paramConvertToType, paramBaseType)))
conversionCodeIncoming.append(" }")
# Call strings. The unusual " ".join() call will join the
# array of parameter modifiers with spaces as separators.
passthroughDeclarationString += ", %s %s %s" % (paramConvertToType, " ".join(paramTypeModifiers), paramName)
passthroughCallString += ", converted_%s" % paramName
# endif conversion management
# Parameter checking. If the parameter has a specific list of
# valid values, we have to make sure that the passed-in values
# match these, or we make an error.
if len(paramValidValues) > 0:
# We're about to make a big switch statement with an
# error at the end. By default, the error is GL_INVALID_ENUM,
# unless we find a "case" statement in the middle with a
# non-GLenum value.
errorDefaultCase = "GL_INVALID_ENUM"
# This parameter has specific valid values. Make a big
# switch statement to handle it. Note that the original
# parameters are always what is checked, not the
# converted parameters.
switchCode.append(" switch(%s) {" % paramName)
for valueIndex in range(len(paramValidValues)):
(paramValue, dependentVecSize, dependentParamName, dependentValidValues, errorCode, valueConvert) = paramValidValues[valueIndex]
# We're going to need information on the dependent param
# as well.
if dependentParamName:
depParamIndex = apiutil.FindParamIndex(params, dependentParamName)
if depParamIndex == None:
sys.stderr.write("%s: can't find dependent param '%s' for function '%s'\n" % (program, dependentParamName, funcName))
(depParamName, depParamType, depParamMaxVecSize, depParamConvertToType, depParamValidValues, depParamValueConversion) = params[depParamIndex]
else:
(depParamName, depParamType, depParamMaxVecSize, depParamConvertToType, depParamValidValues, depParamValueConversion) = (None, None, None, None, [], None)
# This is a sneaky trick. It's valid syntax for a parameter
# that is *not* going to be converted to be declared
# with a dependent vector size; but in this case, the
# dependent vector size is unused and unnecessary.
# So check for this and ignore the dependent vector size
# if the parameter is not going to be converted.
if depParamConvertToType:
usedDependentVecSize = dependentVecSize
else:
usedDependentVecSize = None
# We'll peek ahead at the next parameter, to see whether
# we can combine cases
if valueIndex + 1 < len(paramValidValues) :
(nextParamValue, nextDependentVecSize, nextDependentParamName, nextDependentValidValues, nextErrorCode, nextValueConvert) = paramValidValues[valueIndex + 1]
if depParamConvertToType:
usedNextDependentVecSize = nextDependentVecSize
else:
usedNextDependentVecSize = None
# Create a case for this value. As a mnemonic,
# if we have a dependent vector size that we're ignoring,
# add it as a comment.
if usedDependentVecSize == None and dependentVecSize != None:
switchCode.append(" case %s: /* size %s */" % (paramValue, dependentVecSize))
else:
switchCode.append(" case %s:" % paramValue)
# If this is not a GLenum case, then switch our error
# if no value is matched to be GL_INVALID_VALUE instead
# of GL_INVALID_ENUM. (Yes, this does get confused
# if there are both values and GLenums in the same
# switch statement, which shouldn't happen.)
if paramValue[0:3] != "GL_":
errorDefaultCase = "GL_INVALID_VALUE"
# If all the remaining parameters are identical to the
# next set, then we're done - we'll just create the
# official code on the next pass through, and the two
# cases will share the code.
if valueIndex + 1 < len(paramValidValues) and usedDependentVecSize == usedNextDependentVecSize and dependentParamName == nextDependentParamName and dependentValidValues == nextDependentValidValues and errorCode == nextErrorCode and valueConvert == nextValueConvert:
continue
# Otherwise, we'll have to generate code for this case.
# Start off with a check: if there is a dependent parameter,
# and a list of valid values for that parameter, we need
# to generate an error if something other than one
# of those values is passed.
if len(dependentValidValues) > 0:
conditional=""
# If the parameter being checked is actually an array,
# check only its first element.
if depParamMaxVecSize == 0:
valueToCheck = dependentParamName
else:
valueToCheck = "%s[0]" % dependentParamName
for v in dependentValidValues:
conditional += " && %s != %s" % (valueToCheck, v)
switchCode.append(" if (%s) {" % conditional[4:])
if errorCode == None:
errorCode = "GL_INVALID_ENUM"
switchCode.append(' _mesa_error(_mesa_get_current_context(), %s, "gl%s(%s=0x%s)", %s);' % (errorCode, funcName, paramName, "%x", paramName))
switchCode.append(" %s;" % errorReturn)
switchCode.append(" }")
# endif there are dependent valid values
# The dependent parameter may require conditional
# value conversion. If it does, and we don't want
# to convert values, we'll have to generate code for that
if depParamValueConversion == "some" and valueConvert == "noconvert":
switchCode.append(" convert_%s_value = 0;" % dependentParamName)
# If there's a dependent vector size for this parameter
# that we're actually going to use (i.e. we need conversion),
# mark it.
if usedDependentVecSize:
switchCode.append(" n_%s = %s;" % (dependentParamName, dependentVecSize))
# In all cases, break out of the switch if any valid
# value is found.
switchCode.append(" break;")
# Need a default case to catch all the other, invalid
# parameter values. These will all generate errors.
switchCode.append(" default:")
if errorCode == None:
errorCode = "GL_INVALID_ENUM"
formatString = GetFormatString(paramType)
if formatString == None:
switchCode.append(' _mesa_error(_mesa_get_current_context(), %s, "gl%s(%s)");' % (errorCode, funcName, paramName))
else:
switchCode.append(' _mesa_error(_mesa_get_current_context(), %s, "gl%s(%s=%s)", %s);' % (errorCode, funcName, paramName, formatString, paramName))
switchCode.append(" %s;" % errorReturn)
# End of our switch code.
switchCode.append(" }")
# endfor every recognized parameter value
# endfor every param
# Here, the passthroughDeclarationString and passthroughCallString
# are complete; remove the extra ", " at the front of each.
passthroughDeclarationString = passthroughDeclarationString[2:]
passthroughCallString = passthroughCallString[2:]
# The Mesa functions are scattered across all the Mesa
# header files. The easiest way to manage declarations
# is to create them ourselves.
if funcName not in allSpecials:
print "extern %s GLAPIENTRY %s(%s);" % (returnType, passthroughFuncName, passthroughDeclarationString)
# A function may be a core function (i.e. it exists in
# the core specification), a core addition (extension
# functions added officially to the core), a required
# extension (usually an extension for an earlier version
# that has been officially adopted), or an optional extension.
#
# Core functions have a simple category (e.g. "GLES1.1");
# we generate only a simple callback for them.
#
# Core additions have two category listings, one simple
# and one compound (e.g. ["GLES1.1", "GLES1.1:OES_fixed_point"]).
# We generate the core function, and also an extension function.
#
# Required extensions and implemented optional extensions
# have a single compound category "GLES1.1:OES_point_size_array".
# For these we generate just the extension function.
for categorySpec in apiutil.Categories(funcName):
compoundCategory = categorySpec.split(":")
# This category isn't for us, if the base category doesn't match
# our version
if compoundCategory[0] != version:
continue
# Otherwise, determine if we're writing code for a core
# function (no suffix) or an extension function.
if len(compoundCategory) == 1:
# This is a core function
extensionName = None
fullFuncName = "_es_" + funcName
else:
# This is an extension function. We'll need to append
# the extension suffix.
extensionName = compoundCategory[1]
extensionSuffix = extensionName.split("_")[0]
fullFuncName = "_es_" + funcName + extensionSuffix
# Now the generated function. The text used to mark an API-level
# function, oddly, is version-specific.
if extensionName:
print "/* Extension %s */" % extensionName
if funcName in allSpecials:
print "/* this function is special and is defined elsewhere */"
print "extern %s %s(%s);" % (returnType, fullFuncName, declarationString)
print
continue
print "static %s %s(%s)" % (returnType, fullFuncName, declarationString)
print "{"
# Start printing our code pieces. Start with any local
# variables we need. This unusual syntax joins the
# lines in the variables[] array with the "\n" separator.
if len(variables) > 0:
print "\n".join(variables), "\n";
# If there's any sort of parameter checking or variable
# array sizing, the switch code will contain it.
if len(switchCode) > 0:
print "\n".join(switchCode), "\n";
# In the case of an outgoing conversion (i.e. parameters must
# be converted before calling the underlying Mesa function),
# use the appropriate code.
if "get" not in props and len(conversionCodeOutgoing) > 0:
print "\n".join(conversionCodeOutgoing), "\n";
# Call the Mesa function. Note that there are very few functions
# that return a value (i.e. returnType is not "void"), and that
# none of them require incoming translation; so we're safe
# to generate code that directly returns in those cases,
# even though it's not completely independent.
if returnType == "void":
print " %s(%s);" % (passthroughFuncName, passthroughCallString)
else:
print " return %s(%s);" % (passthroughFuncName, passthroughCallString)
# If the function is one that returns values (i.e. "get" in props),
# it might return values of a different type than we need, that
# require conversion before passing back to the application.
if "get" in props and len(conversionCodeIncoming) > 0:
print "\n".join(conversionCodeIncoming)
# All done.
print "}"
print
# end for each category provided for a function
# end for each function
print "void"
print "_mesa_init_exec_table(struct _glapi_table *exec)"
print "{"
for func in keys:
for spec in apiutil.Categories(func):
ext = spec.split(":")
# version does not match
if ext.pop(0) != version:
continue
entry = func
if ext:
suffix = ext[0].split("_")[0]
entry += suffix
print " SET_%s(exec, _es_%s);" % (entry, entry)
print "}"

Some files were not shown because too many files have changed in this diff Show More