Merge branch 'gles2-2'

Conflicts:
	src/mesa/drivers/dri/common/dri_util.h
This commit is contained in:
Kristian Høgsberg 2010-05-02 10:17:07 -04:00
commit 0870e4a202
99 changed files with 5042 additions and 4257 deletions

View file

@ -14,6 +14,8 @@ ARCH_FLAGS = @ARCH_FLAGS@
ASM_FLAGS = @ASM_FLAGS@
PIC_FLAGS = @PIC_FLAGS@
DEFINES = @DEFINES@
API_DEFINES = @API_DEFINES@
APIS = @APIS@
CFLAGS = @CPPFLAGS@ @CFLAGS@ \
$(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
CXXFLAGS = @CPPFLAGS@ @CXXFLAGS@ \
@ -53,6 +55,8 @@ GLU_LIB = GLU
GLUT_LIB = glut
GLW_LIB = GLw
OSMESA_LIB = @OSMESA_LIB@
GLESv1_CM_LIB = GLESv1_CM
GLESv2_LIB = GLESv2
# Library names (actual file names)
GL_LIB_NAME = @GL_LIB_NAME@
@ -61,6 +65,8 @@ GLUT_LIB_NAME = @GLUT_LIB_NAME@
GLW_LIB_NAME = @GLW_LIB_NAME@
OSMESA_LIB_NAME = @OSMESA_LIB_NAME@
EGL_LIB_NAME = @EGL_LIB_NAME@
GLESv1_CM_LIB_NAME = @GLESv1_CM_LIB_NAME@
GLESv2_LIB_NAME = @GLESv2_LIB_NAME@
# Globs used to install the lib and all symlinks
GL_LIB_GLOB = @GL_LIB_GLOB@
@ -69,6 +75,8 @@ GLUT_LIB_GLOB = @GLUT_LIB_GLOB@
GLW_LIB_GLOB = @GLW_LIB_GLOB@
OSMESA_LIB_GLOB = @OSMESA_LIB_GLOB@
EGL_LIB_GLOB = @EGL_LIB_GLOB@
GLESv1_CM_LIB_GLOB = @GLESv1_CM_LIB_GLOB@
GLESv2_LIB_GLOB = @GLESv2_LIB_GLOB@
# Directories to build
LIB_DIR = @LIB_DIR@
@ -110,6 +118,8 @@ GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLUT_MESA_DEPS@ \
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLW_MESA_DEPS@ \
$(EXTRA_LIB_PATH) @GLW_LIB_DEPS@
APP_LIB_DEPS = $(EXTRA_LIB_PATH) @APP_LIB_DEPS@
GLESv1_CM_LIB_DEPS = $(EXTRA_LIB_PATH) @GLESv1_LIB_DEPS@
GLESv2_LIB_DEPS = $(EXTRA_LIB_PATH) @GLESv2_LIB_DEPS@
# DRI dependencies
DRI_LIB_DEPS = $(EXTRA_LIB_PATH) @DRI_LIB_DEPS@
@ -158,6 +168,8 @@ GLW_PC_LIB_PRIV = @GLW_PC_LIB_PRIV@
GLW_PC_CFLAGS = @GLW_PC_CFLAGS@
OSMESA_PC_REQ = @OSMESA_PC_REQ@
OSMESA_PC_LIB_PRIV = @OSMESA_PC_LIB_PRIV@
GLESv1_CM_PC_LIB_PRIV = @GLESv2_PC_LIB_PRIV@
GLESv2_PC_LIB_PRIV = @GLESv2_PC_LIB_PRIV@
EGL_DRI2_CFLAGS = @EGL_DRI2_CFLAGS@
EGL_DRI2_LIBS = @EGL_DRI2_LIBS@

View file

@ -279,6 +279,8 @@ GLUT_LIB_NAME='lib$(GLUT_LIB).'${LIB_EXTENSION}
GLW_LIB_NAME='lib$(GLW_LIB).'${LIB_EXTENSION}
OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION}
EGL_LIB_NAME='lib$(EGL_LIB).'${LIB_EXTENSION}
GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION}
GLESv2_LIB_NAME='lib$(GLESv2_LIB).'${LIB_EXTENSION}
GL_LIB_GLOB='lib$(GL_LIB).*'${LIB_EXTENSION}'*'
GLU_LIB_GLOB='lib$(GLU_LIB).*'${LIB_EXTENSION}'*'
@ -286,6 +288,8 @@ GLUT_LIB_GLOB='lib$(GLUT_LIB).*'${LIB_EXTENSION}'*'
GLW_LIB_GLOB='lib$(GLW_LIB).*'${LIB_EXTENSION}'*'
OSMESA_LIB_GLOB='lib$(OSMESA_LIB).*'${LIB_EXTENSION}'*'
EGL_LIB_GLOB='lib$(EGL_LIB).*'${LIB_EXTENSION}'*'
GLESv1_CM_LIB_GLOB='lib$(GLESv1_CM_LIB).*'${LIB_EXTENSION}'*'
GLESv2_LIB_GLOB='lib$(GLESv2_LIB).*'${LIB_EXTENSION}'*'
AC_SUBST([GL_LIB_NAME])
AC_SUBST([GLU_LIB_NAME])
@ -293,6 +297,8 @@ AC_SUBST([GLUT_LIB_NAME])
AC_SUBST([GLW_LIB_NAME])
AC_SUBST([OSMESA_LIB_NAME])
AC_SUBST([EGL_LIB_NAME])
AC_SUBST([GLESv1_CM_LIB_NAME])
AC_SUBST([GLESv2_LIB_NAME])
AC_SUBST([GL_LIB_GLOB])
AC_SUBST([GLU_LIB_GLOB])
@ -300,6 +306,8 @@ AC_SUBST([GLUT_LIB_GLOB])
AC_SUBST([GLW_LIB_GLOB])
AC_SUBST([OSMESA_LIB_GLOB])
AC_SUBST([EGL_LIB_GLOB])
AC_SUBST([GLESv1_CM_LIB_GLOB])
AC_SUBST([GLESv2_LIB_GLOB])
dnl
dnl Arch/platform-specific settings
@ -654,6 +662,10 @@ dri)
# need DRM libs, -lpthread, etc.
GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
GLESv1_CM_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
GLESv2_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
;;
osmesa)
# No libGL for osmesa
@ -665,6 +677,8 @@ AC_SUBST([GL_PC_REQ_PRIV])
AC_SUBST([GL_PC_LIB_PRIV])
AC_SUBST([GL_PC_CFLAGS])
AC_SUBST([DRI_PC_REQ_PRIV])
AC_SUBST([GLESv1_LIB_DEPS])
AC_SUBST([GLESv2_LIB_DEPS])
dnl
dnl More X11 setup
@ -712,6 +726,45 @@ if test "x$with_dri_drivers" = x; then
with_dri_drivers=no
fi
dnl Determine which APIs to support
AC_ARG_ENABLE([opengl],
[AS_HELP_STRING([--disable-opengl],
[disable support for standard OpenGL API @<:@default=no@:>@])],
[enable_opengl="$enableval"],
[enable_opengl=yes])
AC_ARG_ENABLE([gles1],
[AS_HELP_STRING([--enable-gles1],
[enable support for OpenGL ES 1.x API @<:@default=no@:>@])],
[enable_gles1="$enableval"],
[enable_gles1=no])
AC_ARG_ENABLE([gles2],
[AS_HELP_STRING([--enable-gles2],
[enable support for OpenGL ES 2.x API @<:@default=no@:>@])],
[enable_gles2="$enableval"],
[enable_gles2=no])
API_DEFINES=""
APIS=""
if test "x$enable_opengl" = xno; then
API_DEFINES="$API_DEFINES -DFEATURE_GL=0"
else
API_DEFINES="$API_DEFINES -DFEATURE_GL=1"
APIS="$APIS gl"
fi
if test "x$enable_gles1" = xyes; then
API_DEFINES="$API_DEFINES -DFEATURE_ES1=1"
APIS="$APIS es1"
fi
if test "x$enable_gles2" = xyes; then
API_DEFINES="$API_DEFINES -DFEATURE_ES2=1"
APIS="$APIS es2"
fi
if test "x$enable_gles1" = xyes -o "x$enable_gles2"; then
SRC_DIRS="$SRC_DIRS gles"
fi
AC_SUBST([API_DEFINES])
AC_SUBST([APIS])
dnl If $with_dri_drivers is yes, directories will be added through
dnl platform checks
DRI_DIRS=""

View file

@ -736,7 +736,11 @@ struct __DRIdri2LoaderExtensionRec {
* constructors for DRI2.
*/
#define __DRI_DRI2 "DRI_DRI2"
#define __DRI_DRI2_VERSION 1
#define __DRI_DRI2_VERSION 2
#define __DRI_API_OPENGL 0
#define __DRI_API_GLES 1
#define __DRI_API_GLES2 2
struct __DRIdri2ExtensionRec {
__DRIextension base;
@ -755,6 +759,14 @@ struct __DRIdri2ExtensionRec {
__DRIcontext *shared,
void *loaderPrivate);
/* Since version 2 */
unsigned int (*getAPIMask)(__DRIscreen *screen);
__DRIcontext *(*createNewContextForAPI)(__DRIscreen *screen,
int api,
const __DRIconfig *config,
__DRIcontext *shared,
void *data);
};

View file

@ -254,9 +254,8 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
_eglSetConfigKey(&base,
EGL_BIND_TO_TEXTURE_RGBA, bind_to_texture_rgba);
/* EGL_OPENGL_ES_BIT, EGL_OPENVG_BIT, EGL_OPENGL_ES2_BIT */
_eglSetConfigKey(&base, EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT);
_eglSetConfigKey(&base, EGL_CONFORMANT, EGL_OPENGL_BIT);
_eglSetConfigKey(&base, EGL_RENDERABLE_TYPE, disp->ClientAPIsMask);
_eglSetConfigKey(&base, EGL_CONFORMANT, disp->ClientAPIsMask);
if (!_eglValidateConfig(&base, EGL_FALSE)) {
_eglLog(_EGL_DEBUG, "DRI2: failed to validate config %d", id);
@ -643,6 +642,7 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp,
const __DRIextension **extensions;
struct dri2_egl_display *dri2_dpy;
char path[PATH_MAX], *search_paths, *p, *next, *end;
unsigned int api_mask;
dri2_dpy = malloc(sizeof *dri2_dpy);
if (!dri2_dpy)
@ -685,6 +685,8 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp,
snprintf(path, sizeof path,
dri_driver_format, (int) (next - p), p, dri2_dpy->driver_name);
dri2_dpy->driver = dlopen(path, RTLD_NOW | RTLD_GLOBAL);
if (dri2_dpy->driver == NULL)
_eglLog(_EGL_DEBUG, "failed to open %s: %s\n", path, dlerror());
}
if (dri2_dpy->driver == NULL) {
@ -754,12 +756,24 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp,
if (!dri2_bind_extensions(dri2_dpy, dri2_core_extensions, extensions))
goto cleanup_dri_screen;
if (dri2_dpy->dri2->base.version >= 2)
api_mask = dri2_dpy->dri2->getAPIMask(dri2_dpy->dri_screen);
else
api_mask = __DRI_API_OPENGL;
disp->ClientAPIsMask = 0;
if (api_mask & (1 <<__DRI_API_OPENGL))
disp->ClientAPIsMask |= EGL_OPENGL_BIT;
if (api_mask & (1 <<__DRI_API_GLES))
disp->ClientAPIsMask |= EGL_OPENGL_ES_BIT;
if (api_mask & (1 << __DRI_API_GLES2))
disp->ClientAPIsMask |= EGL_OPENGL_ES2_BIT;
if (dri2_dpy->conn) {
if (!dri2_add_configs_for_visuals(dri2_dpy, disp))
goto cleanup_configs;
}
disp->ClientAPIsMask = EGL_OPENGL_BIT;
disp->Extensions.KHR_image_base = EGL_TRUE;
disp->Extensions.KHR_image_pixmap = EGL_TRUE;
disp->Extensions.KHR_gl_renderbuffer_image = EGL_TRUE;
@ -822,6 +836,7 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_context *dri2_ctx_shared = dri2_egl_context(share_list);
struct dri2_egl_config *dri2_config = dri2_egl_config(conf);
int api;
dri2_ctx = malloc(sizeof *dri2_ctx);
if (!dri2_ctx) {
@ -832,12 +847,46 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
if (!_eglInitContext(&dri2_ctx->base, disp, conf, attrib_list))
goto cleanup;
dri2_ctx->dri_context =
dri2_dpy->dri2->createNewContext(dri2_dpy->dri_screen,
dri2_config->dri_config,
dri2_ctx_shared ?
dri2_ctx_shared->dri_context : NULL,
dri2_ctx);
switch (dri2_ctx->base.ClientAPI) {
case EGL_OPENGL_ES_API:
switch (dri2_ctx->base.ClientVersion) {
case 1:
api = __DRI_API_GLES;
break;
case 2:
api = __DRI_API_GLES2;
break;
default:
_eglError(EGL_BAD_PARAMETER, "eglCreateContext");
return NULL;
}
break;
case EGL_OPENGL_API:
api = __DRI_API_OPENGL;
break;
default:
_eglError(EGL_BAD_PARAMETER, "eglCreateContext");
return NULL;
}
if (dri2_dpy->dri2->base.version >= 2) {
dri2_ctx->dri_context =
dri2_dpy->dri2->createNewContextForAPI(dri2_dpy->dri_screen,
api,
dri2_config->dri_config,
dri2_ctx_shared ?
dri2_ctx_shared->dri_context : NULL,
dri2_ctx);
} else if (api == __DRI_API_OPENGL) {
dri2_ctx->dri_context =
dri2_dpy->dri2->createNewContext(dri2_dpy->dri_screen,
dri2_config->dri_config,
dri2_ctx_shared ?
dri2_ctx_shared->dri_context : NULL,
dri2_ctx);
} else {
/* fail */
}
if (!dri2_ctx->dri_context)
goto cleanup;

70
src/gles/Makefile Normal file
View file

@ -0,0 +1,70 @@
TOP = ../..
MESA = $(TOP)/src/mesa
include $(TOP)/configs/current
include $(MESA)/sources.mak
GLESv1_CM_ASM := $(addprefix $(MESA)/es/glapi/glapi-es1/,$(GLAPI_ASM_SOURCES))
GLESv2_ASM := $(addprefix $(MESA)/es/glapi/glapi-es2/,$(GLAPI_ASM_SOURCES))
API_SOURCES := $(addprefix $(MESA)/,$(GLAPI_SOURCES))
$(TOP)/$(LIB_DIR)/$(GLESv1_CM_LIB_NAME) : PREFIX = es1
$(TOP)/$(LIB_DIR)/$(GLESv1_CM_LIB_NAME) : NAME = GLESv1_CM
$(TOP)/$(LIB_DIR)/$(GLESv2_LIB_NAME) : PREFIX = es2
$(TOP)/$(LIB_DIR)/$(GLESv2_LIB_NAME) : NAME = GLESv2
INCLUDES = -I$(MESA)/es/glapi/glapi-$(PREFIX) -I$(MESA)
OBJECTS = \
$(notdir $(GLAPI_ASM_SOURCES:%.S=%.o)) \
$(notdir $(GLAPI_SOURCES:%.c=%.o))
GLESv1_CM_OBJECTS = $(addprefix es1-,$(OBJECTS))
GLESv2_OBJECTS = $(addprefix es2-,$(OBJECTS))
es1-%.o: $(dir $(GLESv1_CM_ASM))%.S
$(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $<
es1-%.o: $(MESA)/glapi/%.c
$(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $<
es2-%.o: $(dir $(GLESv2_ASM))%.S
$(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $<
es2-%.o: $(MESA)/glapi/%.c
$(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $<
default: depend \
$(TOP)/$(LIB_DIR)/$(GLESv1_CM_LIB_NAME) \
$(TOP)/$(LIB_DIR)/$(GLESv2_LIB_NAME)
$(TOP)/$(LIB_DIR)/$(GLESv1_CM_LIB_NAME) : $(GLESv1_CM_OBJECTS)
$(TOP)/$(LIB_DIR)/$(GLESv2_LIB_NAME) : $(GLESv2_OBJECTS)
$(TOP)/$(LIB_DIR)/$(GLESv1_CM_LIB_NAME) \
$(TOP)/$(LIB_DIR)/$(GLESv2_LIB_NAME) : Makefile
$(MKLIB) -o $($(NAME)_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-major 1 -minor 2 $(MKLIB_OPTIONS) \
-install $(TOP)/$(LIB_DIR) -id \
$(INSTALL_LIB_DIR)/lib$($(NAME)_LIB).1.dylib \
$($(NAME)_LIB_DEPS) $($(NAME)_OBJECTS)
depend: Makefile
rm -f depend
touch depend
$(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(API_SOURCES) \
$(ES1_API_ASM) $(ES2_API_ASM)
# Emacs tags
tags:
etags `find . -name \*.[ch]` `find $(TOP)/include`
install: $(TOP)/$(LIB_DIR)/$(GLESv1_CM_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLESv2_LIB_NAME)
$(MAKE) -C $(TOP)/src/mesa install-es2 install-es1
# Remove .o and backup files
clean:
-rm -f $(TOP)/$(LIB_DIR)/$(GLESv1_CM_LIB_GLOB)
-rm -f $(TOP)/$(LIB_DIR)/$(GLESv2_LIB_GLOB)
-rm -f *.o *~
-rm -f depend depend.bak
-include depend

View file

@ -16,6 +16,7 @@ include sources.mak
.S.o:
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
CFLAGS += $(API_DEFINES)
# Default: build dependencies, then asm_subdirs, GLSL built-in lib,
@ -24,6 +25,17 @@ default: depend asm_subdirs glsl_builtin libmesa.a libmesagallium.a \
libglapi.a driver_subdirs
main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
$(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES1.1 > $@
main/api_exec_es2.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
$(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES2.0 > $@
main/get_es1.c: main/get_gen_es.py
$(PYTHON2) $(PYTHON_FLAGS) $< 1 > $@
main/get_es2.c: main/get_gen_es.py
$(PYTHON2) $(PYTHON_FLAGS) $< 2 > $@
######################################################################
# Helper libraries used by many drivers:
@ -94,14 +106,23 @@ install: default
dri) $(MAKE) install-libgl install-dri || exit 1 ;; \
*) $(MAKE) install-libgl || exit 1 ;; \
esac ; \
done; \
for api in $(APIS) ; do \
case "$$api" in \
es1) $(MAKE) install-es1 || exit 1;; \
es2) $(MAKE) install-es2 || exit 1;; \
esac; \
done
gl_pcedit = sed \
pcedit = \
-e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
-e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
-e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
-e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \
gl_pcedit = sed \
$(pcedit) \
-e 's,@GL_PC_REQ_PRIV@,$(GL_PC_REQ_PRIV),' \
-e 's,@GL_PC_LIB_PRIV@,$(GL_PC_LIB_PRIV),' \
-e 's,@GL_PC_CFLAGS@,$(GL_PC_CFLAGS),' \
@ -110,11 +131,24 @@ gl_pcedit = sed \
gl.pc: gl.pc.in
$(gl_pcedit) $< > $@
glesv2_pcedit = sed \
$(pcedit) \
-e 's,@GLESv2_PC_LIB_PRIV@,$(GLESv2_PC_LIB_PRIV),' \
-e 's,@GLESv2_LIB@,$(GLESv2_LIB),'
glesv2.pc: glesv2.pc.in
$(glesv2_pcedit) $< > $@
glesv1_cm_pcedit = sed \
$(pcedit) \
-e 's,@GLESv1_CM_PC_LIB_PRIV@,$(GLESv1_CM_PC_LIB_PRIV),' \
-e 's,@GLESv1_CM_LIB@,$(GLESv1_CM_LIB),'
glesv1_cm.pc: glesv1_cm.pc.in
$(glesv1_cm_pcedit) $< > $@
osmesa_pcedit = sed \
-e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
-e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
-e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
-e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \
$(pcedit) \
-e 's,@OSMESA_LIB@,$(OSMESA_LIB),' \
-e 's,@OSMESA_PC_REQ@,$(OSMESA_PC_REQ),' \
-e 's,@OSMESA_PC_LIB_PRIV@,$(OSMESA_PC_LIB_PRIV),'
@ -134,6 +168,30 @@ install-libgl: default gl.pc install-headers
$(DESTDIR)$(INSTALL_LIB_DIR)
$(INSTALL) -m 644 gl.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
install-headers-es1:
$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GLES
$(INSTALL) -m 644 $(TOP)/include/GLES/*.h \
$(DESTDIR)$(INSTALL_INC_DIR)/GLES
install-es1: default glesv1_cm.pc install-headers-es1
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
$(MINSTALL) $(TOP)/$(LIB_DIR)/$(GLESv1_CM_LIB_GLOB) \
$(DESTDIR)$(INSTALL_LIB_DIR)
$(INSTALL) -m 644 glesv1_cm.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
install-headers-es2:
$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GLES2
$(INSTALL) -m 644 $(TOP)/include/GLES2/*.h \
$(DESTDIR)$(INSTALL_INC_DIR)/GLES2
install-es2: default glesv2.pc install-headers-es2
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
$(MINSTALL) $(TOP)/$(LIB_DIR)/$(GLESv2_LIB_GLOB) \
$(DESTDIR)$(INSTALL_LIB_DIR)
$(INSTALL) -m 644 glesv2.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
install-osmesa: default osmesa.pc
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig

View file

@ -31,6 +31,7 @@ SHARED_INCLUDES = \
-I$(TOP)/src/egl/drivers/dri \
$(LIBDRM_CFLAGS)
CFLAGS += $(API_DEFINES)
##### RULES #####

View file

@ -612,7 +612,8 @@ driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config,
pcp->hHWContext = hwContext;
if ( !(*psp->DriverAPI.CreateContext)(&config->modes, pcp, shareCtx) ) {
if ( !(*psp->DriverAPI.CreateContext)(API_OPENGL,
&config->modes, pcp, shareCtx) ) {
free(pcp);
return NULL;
}
@ -620,15 +621,62 @@ driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config,
return pcp;
}
static unsigned int
dri2GetAPIMask(__DRIscreen *screen)
{
return screen->api_mask;
}
static __DRIcontext *
dri2CreateNewContextForAPI(__DRIscreen *screen, int api,
const __DRIconfig *config,
__DRIcontext *shared, void *data)
{
__DRIcontext *context;
void *shareCtx = (shared != NULL) ? shared->driverPrivate : NULL;
gl_api mesa_api;
if (!(screen->api_mask & (1 << api)))
return NULL;
switch (api) {
case __DRI_API_OPENGL:
mesa_api = API_OPENGL;
break;
case __DRI_API_GLES:
mesa_api = API_OPENGLES;
break;
case __DRI_API_GLES2:
mesa_api = API_OPENGLES2;
break;
}
context = malloc(sizeof *context);
if (!context)
return NULL;
context->driScreenPriv = screen;
context->driDrawablePriv = NULL;
context->loaderPrivate = data;
if (!(*screen->DriverAPI.CreateContext)(api, &config->modes,
context, shareCtx) ) {
free(context);
return NULL;
}
return context;
}
static __DRIcontext *
dri2CreateNewContext(__DRIscreen *screen, const __DRIconfig *config,
__DRIcontext *shared, void *data)
{
return driCreateNewContext(screen, config, 0, shared, 0, data);
return dri2CreateNewContextForAPI(screen, __DRI_API_OPENGL,
config, shared, data);
}
static int
driCopyContext(__DRIcontext *dest, __DRIcontext *src, unsigned long mask)
{
@ -766,6 +814,7 @@ driCreateNewScreen(int scrn,
psp->dri2.enabled = GL_FALSE;
psp->DriverAPI = driDriverAPI;
psp->api_mask = (1 << __DRI_API_OPENGL);
*driver_modes = driDriverAPI.InitScreen(psp);
if (*driver_modes == NULL) {
@ -812,6 +861,7 @@ dri2CreateNewScreen(int scrn, int fd,
psp->dri2.enabled = GL_TRUE;
psp->DriverAPI = driDriverAPI;
psp->api_mask = (1 << __DRI_API_OPENGL);
*driver_configs = driDriverAPI.InitScreen2(psp);
if (*driver_configs == NULL) {
free(psp);
@ -863,6 +913,8 @@ const __DRIdri2Extension driDRI2Extension = {
dri2CreateNewScreen,
dri2CreateNewDrawable,
dri2CreateNewContext,
dri2GetAPIMask,
dri2CreateNewContextForAPI
};
const __DRI2configQueryExtension dri2ConfigQueryExtension = {

View file

@ -53,6 +53,7 @@
#include <xf86drm.h>
#include "xmlconfig.h"
#include "main/glheader.h"
#include "main/mtypes.h"
#include "GL/internal/glcore.h"
#include "GL/internal/dri_interface.h"
@ -148,8 +149,9 @@ struct __DriverAPIRec {
/**
* Context creation callback
*/
GLboolean (*CreateContext)(const __GLcontextModes *glVis,
__DRIcontext *driContextPriv,
GLboolean (*CreateContext)(gl_api api,
const __GLcontextModes *glVis,
__DRIcontext *driContextPriv,
void *sharedContextPrivate);
/**
@ -531,6 +533,7 @@ struct __DRIscreenRec {
drmLock *lock;
driOptionCache optionCache;
unsigned int api_mask;
};
extern void

View file

@ -166,7 +166,8 @@ static const struct dri_debug_control debug_control[] =
};
GLboolean
i810CreateContext( const __GLcontextModes *mesaVis,
i810CreateContext( gl_api api,
const __GLcontextModes *mesaVis,
__DRIcontext *driContextPriv,
void *sharedContextPrivate )
{

View file

@ -78,7 +78,8 @@ typedef struct {
extern GLboolean
i810CreateContext( const __GLcontextModes *mesaVis,
i810CreateContext( gl_api api,
const __GLcontextModes *mesaVis,
__DRIcontext *driContextPriv,
void *sharedContextPrivate );

View file

@ -16,6 +16,7 @@ DRIVER_SOURCES = \
intel_batchbuffer.c \
intel_clear.c \
intel_extensions.c \
intel_extensions_es2.c \
intel_mipmap_tree.c \
intel_tex_layout.c \
intel_tex_image.c \

View file

@ -63,7 +63,7 @@ i830CreateContext(const __GLcontextModes * mesaVis,
i830InitVtbl(i830);
i830InitDriverFunctions(&functions);
if (!intelInitContext(intel, mesaVis, driContextPriv,
if (!intelInitContext(intel, __DRI_API_OPENGL, mesaVis, driContextPriv,
sharedContextPrivate, &functions)) {
FREE(i830);
return GL_FALSE;

View file

@ -94,7 +94,8 @@ i915InitDriverFunctions(struct dd_function_table *functions)
extern const struct tnl_pipeline_stage *intel_pipeline[];
GLboolean
i915CreateContext(const __GLcontextModes * mesaVis,
i915CreateContext(int api,
const __GLcontextModes * mesaVis,
__DRIcontext * driContextPriv,
void *sharedContextPrivate)
{
@ -114,7 +115,7 @@ i915CreateContext(const __GLcontextModes * mesaVis,
i915InitDriverFunctions(&functions);
if (!intelInitContext(intel, mesaVis, driContextPriv,
if (!intelInitContext(intel, api, mesaVis, driContextPriv,
sharedContextPrivate, &functions)) {
FREE(i915);
return GL_FALSE;

View file

@ -318,7 +318,8 @@ do { \
/*======================================================================
* i915_context.c
*/
extern GLboolean i915CreateContext(const __GLcontextModes * mesaVis,
extern GLboolean i915CreateContext(int api,
const __GLcontextModes * mesaVis,
__DRIcontext * driContextPriv,
void *sharedContextPrivate);

View file

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

View file

@ -13,6 +13,7 @@ DRIVER_SOURCES = \
intel_context.c \
intel_decode.c \
intel_extensions.c \
intel_extensions_es2.c \
intel_fbo.c \
intel_mipmap_tree.c \
intel_regions.c \

View file

@ -68,7 +68,8 @@ static void brwInitDriverFunctions( struct dd_function_table *functions )
functions->Viewport = intel_viewport;
}
GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
GLboolean brwCreateContext( int api,
const __GLcontextModes *mesaVis,
__DRIcontext *driContextPriv,
void *sharedContextPrivate)
{
@ -85,7 +86,7 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
brwInitVtbl( brw );
brwInitDriverFunctions( &functions );
if (!intelInitContext( intel, mesaVis, driContextPriv,
if (!intelInitContext( intel, api, mesaVis, driContextPriv,
sharedContextPrivate, &functions )) {
printf("%s: failed to init intel context\n", __FUNCTION__);
FREE(brw);

View file

@ -687,7 +687,8 @@ void brwInitVtbl( struct brw_context *brw );
/*======================================================================
* brw_context.c
*/
GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
GLboolean brwCreateContext( int api,
const __GLcontextModes *mesaVis,
__DRIcontext *driContextPriv,
void *sharedContextPrivate);

View file

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

View file

@ -586,6 +586,7 @@ intelInitDriverFunctions(struct dd_function_table *functions)
GLboolean
intelInitContext(struct intel_context *intel,
int api,
const __GLcontextModes * mesaVis,
__DRIcontext * driContextPriv,
void *sharedContextPrivate,
@ -601,8 +602,8 @@ intelInitContext(struct intel_context *intel,
if (intelScreen->bufmgr == NULL)
return GL_FALSE;
if (!_mesa_initialize_context(&intel->ctx, mesaVis, shareCtx,
functions, (void *) intel)) {
if (!_mesa_initialize_context_for_api(&intel->ctx, api, mesaVis, shareCtx,
functions, (void *) intel)) {
printf("%s: failed to init mesa context\n", __FUNCTION__);
return GL_FALSE;
}
@ -736,7 +737,16 @@ intelInitContext(struct intel_context *intel,
intel->RenderIndex = ~0;
intelInitExtensions(ctx);
switch (ctx->API) {
case API_OPENGL:
intelInitExtensions(ctx);
break;
case API_OPENGLES:
break;
case API_OPENGLES2:
intelInitExtensionsES2(ctx);
break;
}
INTEL_DEBUG = driParseDebugString(getenv("INTEL_DEBUG"), debug_control);
if (INTEL_DEBUG & DEBUG_BUFMGR)

View file

@ -364,6 +364,7 @@ extern int INTEL_DEBUG;
*/
extern GLboolean intelInitContext(struct intel_context *intel,
int api,
const __GLcontextModes * mesaVis,
__DRIcontext * driContextPriv,
void *sharedContextPrivate,

View file

@ -33,7 +33,7 @@ extern void
intelInitExtensions(GLcontext *ctx);
extern void
intelFlushDrawable(__DRIdrawable *drawable);
intelInitExtensionsES2(GLcontext *ctx);
#endif

View file

@ -0,0 +1,93 @@
/**************************************************************************
*
* Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 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/extensions.h"
#include "intel_extensions.h"
#include "utils.h"
static const char *es2_extensions[] = {
/* Used by mesa internally (cf all_mesa_extensions in ../common/utils.c) */
"GL_ARB_draw_buffers",
"GL_ARB_multisample",
"GL_ARB_texture_compression",
"GL_ARB_transpose_matrix",
"GL_ARB_vertex_buffer_object",
"GL_ARB_window_pos",
"GL_EXT_blend_func_separate",
"GL_EXT_compiled_vertex_array",
"GL_EXT_multi_draw_arrays",
"GL_EXT_polygon_offset",
"GL_EXT_texture_object",
"GL_EXT_vertex_array",
"GL_IBM_multimode_draw_arrays",
"GL_MESA_window_pos",
"GL_NV_vertex_program",
/* Required by GLES2 */
"GL_ARB_fragment_program",
"GL_ARB_fragment_shader",
"GL_ARB_multitexture",
"GL_ARB_shader_objects",
"GL_ARB_texture_cube_map",
"GL_ARB_texture_mirrored_repeat",
"GL_ARB_texture_non_power_of_two",
"GL_ARB_vertex_shader",
"GL_EXT_blend_color",
"GL_EXT_blend_equation_separate",
"GL_EXT_blend_minmax",
"GL_EXT_blend_subtract",
"GL_EXT_stencil_wrap",
/* Optional GLES2 */
"GL_ARB_framebuffer_object",
"GL_EXT_texture_filter_anisotropic",
"GL_ARB_depth_texture",
"GL_EXT_packed_depth_stencil",
#if FEATURE_OES_EGL_image
"GL_OES_EGL_image",
#endif
NULL,
};
/**
* Initializes potential list of extensions if ctx == NULL, or actually enables
* extensions for a context.
*/
void
intelInitExtensionsES2(GLcontext *ctx)
{
int i;
/* Can't use driInitExtensions() since it uses extensions from
* main/remap_helper.h when called the first time. */
for (i = 0; es2_extensions[i]; i++)
_mesa_enable_extension(ctx, es2_extensions[i]);
}

View file

@ -357,15 +357,18 @@ extern GLboolean i830CreateContext(const __GLcontextModes * mesaVis,
__DRIcontext * driContextPriv,
void *sharedContextPrivate);
extern GLboolean i915CreateContext(const __GLcontextModes * mesaVis,
extern GLboolean i915CreateContext(int api,
const __GLcontextModes * mesaVis,
__DRIcontext * driContextPriv,
void *sharedContextPrivate);
extern GLboolean brwCreateContext(const __GLcontextModes * mesaVis,
extern GLboolean brwCreateContext(int api,
const __GLcontextModes * mesaVis,
__DRIcontext * driContextPriv,
void *sharedContextPrivate);
static GLboolean
intelCreateContext(const __GLcontextModes * mesaVis,
intelCreateContext(gl_api api,
const __GLcontextModes * mesaVis,
__DRIcontext * driContextPriv,
void *sharedContextPrivate)
{
@ -375,7 +378,7 @@ intelCreateContext(const __GLcontextModes * mesaVis,
#ifdef I915
if (IS_9XX(intelScreen->deviceID)) {
if (!IS_965(intelScreen->deviceID)) {
return i915CreateContext(mesaVis, driContextPriv,
return i915CreateContext(api, mesaVis, driContextPriv,
sharedContextPrivate);
}
} else {
@ -384,7 +387,8 @@ intelCreateContext(const __GLcontextModes * mesaVis,
}
#else
if (IS_965(intelScreen->deviceID))
return brwCreateContext(mesaVis, driContextPriv, sharedContextPrivate);
return brwCreateContext(api, mesaVis,
driContextPriv, sharedContextPrivate);
#endif
fprintf(stderr, "Unrecognized deviceID %x\n", intelScreen->deviceID);
return GL_FALSE;
@ -431,6 +435,7 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
struct intel_screen *intelScreen;
GLenum fb_format[3];
GLenum fb_type[3];
unsigned int api_mask;
static const GLenum back_buffer_modes[] = {
GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML
@ -457,6 +462,17 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
&intelScreen->deviceID))
return GL_FALSE;
api_mask = (1 << __DRI_API_OPENGL);
#if FEATURE_ES1
api_mask |= (1 << __DRI_API_GLES);
#endif
#if FEATURE_ES2
api_mask |= (1 << __DRI_API_GLES2);
#endif
if (IS_9XX(intelScreen->deviceID) || IS_965(intelScreen->deviceID))
psp->api_mask = api_mask;
if (!intel_init_bufmgr(intelScreen))
return GL_FALSE;

View file

@ -86,7 +86,8 @@ static const struct dri_extension card_extensions[] =
/* Create the device specific context.
*/
GLboolean mach64CreateContext( const __GLcontextModes *glVisual,
GLboolean mach64CreateContext( gl_api api,
const __GLcontextModes *glVisual,
__DRIcontext *driContextPriv,
void *sharedContextPrivate )
{

View file

@ -273,7 +273,8 @@ struct mach64_context {
#define MACH64_CONTEXT(ctx) ((mach64ContextPtr)(ctx->DriverCtx))
extern GLboolean mach64CreateContext( const __GLcontextModes *glVisual,
extern GLboolean mach64CreateContext( gl_api api,
const __GLcontextModes *glVisual,
__DRIcontext *driContextPriv,
void *sharedContextPrivate );

View file

@ -423,7 +423,8 @@ static const struct dri_debug_control debug_control[] =
static GLboolean
mgaCreateContext( const __GLcontextModes *mesaVis,
mgaCreateContext( gl_api api,
const __GLcontextModes *mesaVis,
__DRIcontext *driContextPriv,
void *sharedContextPrivate )
{

View file

@ -75,7 +75,8 @@ nouveau_channel_flush_notify(struct nouveau_channel *chan)
}
GLboolean
nouveau_context_create(const __GLcontextModes *visual, __DRIcontext *dri_ctx,
nouveau_context_create(gl_api api,
const __GLcontextModes *visual, __DRIcontext *dri_ctx,
void *share_ctx)
{
__DRIscreen *dri_screen = dri_ctx->driScreenPriv;

View file

@ -99,7 +99,8 @@ static const struct dri_debug_control debug_control[] =
/* Create the device specific context.
*/
GLboolean r128CreateContext( const __GLcontextModes *glVisual,
GLboolean r128CreateContext( gl_api api,
const __GLcontextModes *glVisual,
__DRIcontext *driContextPriv,
void *sharedContextPrivate )
{

View file

@ -224,7 +224,8 @@ struct r128_context {
(rmesa->r128Screen->chipset == R128_CARD_TYPE_R128_MOBILITY)
extern GLboolean r128CreateContext( const __GLcontextModes *glVisual,
extern GLboolean r128CreateContext( gl_api api,
const __GLcontextModes *glVisual,
__DRIcontext *driContextPriv,
void *sharedContextPrivate );

View file

@ -271,7 +271,8 @@ static void r200_init_vtbl(radeonContextPtr radeon)
/* Create the device specific rendering context.
*/
GLboolean r200CreateContext( const __GLcontextModes *glVisual,
GLboolean r200CreateContext( gl_api api,
const __GLcontextModes *glVisual,
__DRIcontext *driContextPriv,
void *sharedContextPrivate)
{

View file

@ -637,7 +637,8 @@ struct r200_context {
extern void r200DestroyContext( __DRIcontext *driContextPriv );
extern GLboolean r200CreateContext( const __GLcontextModes *glVisual,
extern GLboolean r200CreateContext( gl_api api,
const __GLcontextModes *glVisual,
__DRIcontext *driContextPriv,
void *sharedContextPrivate);
extern GLboolean r200MakeCurrent( __DRIcontext *driContextPriv,

View file

@ -478,7 +478,8 @@ static void r300InitIoctlFuncs(struct dd_function_table *functions)
/* Create the device specific rendering context.
*/
GLboolean r300CreateContext(const __GLcontextModes * glVisual,
GLboolean r300CreateContext(gl_api api,
const __GLcontextModes * glVisual,
__DRIcontext * driContextPriv,
void *sharedContextPrivate)
{

View file

@ -543,7 +543,8 @@ struct r300_context {
#define R300_CONTEXT(ctx) ((r300ContextPtr)(ctx->DriverCtx))
extern void r300DestroyContext(__DRIcontext * driContextPriv);
extern GLboolean r300CreateContext(const __GLcontextModes * glVisual,
extern GLboolean r300CreateContext(gl_api api,
const __GLcontextModes * glVisual,
__DRIcontext * driContextPriv,
void *sharedContextPrivate);

View file

@ -353,7 +353,8 @@ static void r600InitGLExtensions(GLcontext *ctx)
/* Create the device specific rendering context.
*/
GLboolean r600CreateContext(const __GLcontextModes * glVisual,
GLboolean r600CreateContext(gl_api api,
const __GLcontextModes * glVisual,
__DRIcontext * driContextPriv,
void *sharedContextPrivate)
{

View file

@ -155,7 +155,8 @@ struct r600_context {
#define R700_CONTEXT(ctx) ((context_t *)(ctx->DriverCtx))
#define GL_CONTEXT(context) ((GLcontext *)(context->radeon.glCtx))
extern GLboolean r600CreateContext(const __GLcontextModes * glVisual,
extern GLboolean r600CreateContext(gl_api api,
const __GLcontextModes * glVisual,
__DRIcontext * driContextPriv,
void *sharedContextPrivate);

View file

@ -206,9 +206,10 @@ static void r100_init_vtbl(radeonContextPtr radeon)
/* Create the device specific context.
*/
GLboolean
r100CreateContext( const __GLcontextModes *glVisual,
__DRIcontext *driContextPriv,
void *sharedContextPrivate)
r100CreateContext( gl_api api,
const __GLcontextModes *glVisual,
__DRIcontext *driContextPriv,
void *sharedContextPrivate)
{
__DRIscreen *sPriv = driContextPriv->driScreenPriv;
radeonScreenPtr screen = (radeonScreenPtr)(sPriv->private);

View file

@ -450,7 +450,8 @@ struct r100_context {
#define RADEON_OLD_PACKETS 1
extern GLboolean r100CreateContext( const __GLcontextModes *glVisual,
extern GLboolean r100CreateContext( gl_api api,
const __GLcontextModes *glVisual,
__DRIcontext *driContextPriv,
void *sharedContextPrivate);

View file

@ -288,7 +288,8 @@ savageDestroyScreen(__DRIscreen *sPriv)
}
static GLboolean
savageCreateContext( const __GLcontextModes *mesaVis,
savageCreateContext( gl_api api,
const __GLcontextModes *mesaVis,
__DRIcontext *driContextPriv,
void *sharedContextPrivate )
{

View file

@ -158,7 +158,8 @@ void sisReAllocateBuffers(GLcontext *ctx, GLframebuffer *drawbuffer,
}
GLboolean
sisCreateContext( const __GLcontextModes *glVisual,
sisCreateContext( gl_api api,
const __GLcontextModes *glVisual,
__DRIcontext *driContextPriv,
void *sharedContextPrivate )
{

View file

@ -438,7 +438,8 @@ enum _sis_verbose {
VERBOSE_SIS_MEMORY = 0x2
};
extern GLboolean sisCreateContext( const __GLcontextModes *glVisual,
extern GLboolean sisCreateContext( gl_api api,
const __GLcontextModes *glVisual,
__DRIcontext *driContextPriv,
void *sharedContextPrivate );
extern void sisDestroyContext( __DRIcontext * );

View file

@ -164,7 +164,8 @@ static const struct dri_debug_control debug_control[] =
{ NULL, 0 }
};
GLboolean tdfxCreateContext( const __GLcontextModes *mesaVis,
GLboolean tdfxCreateContext( gl_api api,
const __GLcontextModes *mesaVis,
__DRIcontext *driContextPriv,
void *sharedContextPrivate )
{

View file

@ -937,7 +937,8 @@ struct tdfx_context {
extern GLboolean
tdfxCreateContext( const __GLcontextModes *mesaVis,
tdfxCreateContext( gl_api api,
const __GLcontextModes *mesaVis,
__DRIcontext *driContextPriv,
void *sharedContextPrivate );

View file

@ -456,7 +456,8 @@ FreeBuffer(struct via_context *vmesa)
GLboolean
viaCreateContext(const __GLcontextModes *visual,
viaCreateContext(gl_api api,
const __GLcontextModes *visual,
__DRIcontext *driContextPriv,
void *sharedContextPrivate)
{

View file

@ -76,7 +76,8 @@ typedef struct {
extern GLboolean
viaCreateContext(const __GLcontextModes *mesaVis,
viaCreateContext(gl_api api,
const __GLcontextModes *mesaVis,
__DRIcontext *driContextPriv,
void *sharedContextPrivate);

View file

@ -82,24 +82,6 @@ libes1api.a: $(ES1_API_OBJECTS)
libes2api.a: $(ES2_API_OBJECTS)
@$(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.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
$(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES1.1 > $@
main/api_exec_es2.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
$(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -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 > $@
.PHONY: clean
clean:
-rm -f $(ES1_LIBS) $(ES2_LIBS)

View file

@ -11,7 +11,6 @@ OUTPUTS := \
sparc/glapi_sparc.S \
x86-64/glapi_x86-64.S \
x86/glapi_x86.S \
main/enums.c \
main/remap_helper.h
COMMON = gl_XML.py glX_XML.py license.py typeexpr.py
@ -66,9 +65,6 @@ endef
%/x86/glapi_x86.S: $(GLAPI)/gl_x86_asm.py $(COMMON)
$(call gen-glapi)
%/main/enums.c: $(GLAPI)/gl_enums.py $(COMMON)
$(call gen-glapi)
%/main/remap_helper.h: $(GLAPI)/remap_helper.py $(COMMON)
$(call gen-glapi)

View file

@ -1,91 +0,0 @@
/*
* Copyright (C) 2009 Chia-I Wu <olv@0xlab.org>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to 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 "GLES/gl.h"
#include "GLES/glext.h"
#include "main/compiler.h" /* for ASSERT */
#ifndef GL_TEXTURE_GEN_S
#define GL_TEXTURE_GEN_S 0x0C60
#define GL_TEXTURE_GEN_T 0x0C61
#define GL_TEXTURE_GEN_R 0x0C62
#endif
extern void GL_APIENTRY _es_Disable(GLenum cap);
extern void GL_APIENTRY _es_Enable(GLenum cap);
extern GLboolean GL_APIENTRY _es_IsEnabled(GLenum cap);
extern void GL_APIENTRY _mesa_Disable(GLenum cap);
extern void GL_APIENTRY _mesa_Enable(GLenum cap);
extern GLboolean GL_APIENTRY _mesa_IsEnabled(GLenum cap);
void GL_APIENTRY
_es_Disable(GLenum cap)
{
switch (cap) {
case GL_TEXTURE_GEN_STR_OES:
/* disable S, T, and R at the same time */
_mesa_Disable(GL_TEXTURE_GEN_S);
_mesa_Disable(GL_TEXTURE_GEN_T);
_mesa_Disable(GL_TEXTURE_GEN_R);
break;
default:
_mesa_Disable(cap);
break;
}
}
void GL_APIENTRY
_es_Enable(GLenum cap)
{
switch (cap) {
case GL_TEXTURE_GEN_STR_OES:
/* enable S, T, and R at the same time */
_mesa_Enable(GL_TEXTURE_GEN_S);
_mesa_Enable(GL_TEXTURE_GEN_T);
_mesa_Enable(GL_TEXTURE_GEN_R);
break;
default:
_mesa_Enable(cap);
break;
}
}
GLboolean GL_APIENTRY
_es_IsEnabled(GLenum cap)
{
switch (cap) {
case GL_TEXTURE_GEN_STR_OES:
cap = GL_TEXTURE_GEN_S;
default:
break;
}
return _mesa_IsEnabled(cap);
}

View file

@ -1,37 +0,0 @@
/**************************************************************************
*
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
**************************************************************************/
#include "GLES2/gl2.h"
#include "GLES2/gl2ext.h"
#ifndef GL_RGB5
#define GL_RGB5 0x8050
#endif
extern void GL_APIENTRY _es_RenderbufferStorageEXT(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_RenderbufferStorageEXT(GLenum target, GLenum internalFormat,
GLsizei width, GLsizei height)
{
switch (internalFormat) {
case GL_RGB565:
/* XXX this confuses GL_RENDERBUFFER_INTERNAL_FORMAT_OES */
/* choose a closest format */
internalFormat = GL_RGB5;
break;
default:
break;
}
_mesa_RenderbufferStorageEXT(target, internalFormat, width, height);
}

View file

@ -1,73 +0,0 @@
/*
* Copyright (C) 2009 Chia-I Wu <olv@0xlab.org>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to 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 "GLES/gl.h"
#include "GLES/glext.h"
#include "main/compiler.h" /* for ASSERT */
#ifndef GL_S
#define GL_S 0x2000
#define GL_T 0x2001
#define GL_R 0x2002
#endif
extern void GL_APIENTRY _es_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params);
extern void GL_APIENTRY _es_TexGenf(GLenum coord, GLenum pname, GLfloat param);
extern void GL_APIENTRY _es_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params);
extern void GL_APIENTRY _mesa_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params);
extern void GL_APIENTRY _mesa_TexGenf(GLenum coord, GLenum pname, GLfloat param);
extern void GL_APIENTRY _mesa_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params);
void GL_APIENTRY
_es_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
{
ASSERT(coord == GL_TEXTURE_GEN_STR_OES);
_mesa_GetTexGenfv(GL_S, pname, params);
}
void GL_APIENTRY
_es_TexGenf(GLenum coord, GLenum pname, GLfloat param)
{
ASSERT(coord == GL_TEXTURE_GEN_STR_OES);
/* set S, T, and R at the same time */
_mesa_TexGenf(GL_S, pname, param);
_mesa_TexGenf(GL_T, pname, param);
_mesa_TexGenf(GL_R, pname, param);
}
void GL_APIENTRY
_es_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
{
ASSERT(coord == GL_TEXTURE_GEN_STR_OES);
/* set S, T, and R at the same time */
_mesa_TexGenfv(GL_S, pname, params);
_mesa_TexGenfv(GL_T, pname, params);
_mesa_TexGenfv(GL_R, pname, params);
}

View file

@ -1,218 +0,0 @@
/**************************************************************************
*
* 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.
**************************************************************************/
#include "main/mtypes.h"
#include "main/context.h"
#include "main/imports.h"
#include "main/get.h"
extern const GLubyte * GLAPIENTRY _es_GetString(GLenum name);
static const GLubyte *
compute_es_version(void)
{
GET_CURRENT_CONTEXT(ctx);
static const char es_1_0[] = "OpenGL ES-CM 1.0";
static const char es_1_1[] = "OpenGL ES-CM 1.1";
/* OpenGL ES 1.0 is derived from OpenGL 1.3 */
const GLboolean ver_1_0 = (ctx->Extensions.ARB_multisample &&
ctx->Extensions.ARB_multitexture &&
ctx->Extensions.ARB_texture_compression &&
ctx->Extensions.EXT_texture_env_add &&
ctx->Extensions.ARB_texture_env_combine &&
ctx->Extensions.ARB_texture_env_dot3);
/* OpenGL ES 1.1 is derived from OpenGL 1.5 */
const GLboolean ver_1_1 = (ver_1_0 &&
ctx->Extensions.EXT_point_parameters &&
ctx->Extensions.SGIS_generate_mipmap &&
ctx->Extensions.ARB_vertex_buffer_object);
if (ver_1_1)
return (const GLubyte *) es_1_1;
if (!ver_1_0)
_mesa_problem(ctx, "Incomplete OpenGL ES 1.0 support.");
return (const GLubyte *) es_1_0;
}
static size_t
append_extension(char **str, const char *ext)
{
char *s = *str;
size_t len = strlen(ext);
if (s) {
memcpy(s, ext, len);
s[len++] = ' ';
s[len] = '\0';
*str += len;
}
else {
len++;
}
return len;
}
static size_t
make_extension_string(const GLcontext *ctx, char *str)
{
size_t len = 0;
/* Core additions */
len += append_extension(&str, "GL_OES_byte_coordinates");
len += append_extension(&str, "GL_OES_fixed_point");
len += append_extension(&str, "GL_OES_single_precision");
len += append_extension(&str, "GL_OES_matrix_get");
/* 1.1 required extensions */
len += append_extension(&str, "GL_OES_read_format");
len += append_extension(&str, "GL_OES_compressed_paletted_texture");
len += append_extension(&str, "GL_OES_point_size_array");
len += append_extension(&str, "GL_OES_point_sprite");
/* 1.1 deprecated extensions */
len += append_extension(&str, "GL_OES_query_matrix");
#if FEATURE_OES_draw_texture
if (ctx->Extensions.OES_draw_texture)
len += append_extension(&str, "GL_OES_draw_texture");
#endif
if (ctx->Extensions.EXT_blend_equation_separate)
len += append_extension(&str, "GL_OES_blend_equation_separate");
if (ctx->Extensions.EXT_blend_func_separate)
len += append_extension(&str, "GL_OES_blend_func_separate");
if (ctx->Extensions.EXT_blend_subtract)
len += append_extension(&str, "GL_OES_blend_subtract");
if (ctx->Extensions.EXT_stencil_wrap)
len += append_extension(&str, "GL_OES_stencil_wrap");
if (ctx->Extensions.ARB_texture_cube_map)
len += append_extension(&str, "GL_OES_texture_cube_map");
if (ctx->Extensions.ARB_texture_env_crossbar)
len += append_extension(&str, "GL_OES_texture_env_crossbar");
if (ctx->Extensions.ARB_texture_mirrored_repeat)
len += append_extension(&str, "GL_OES_texture_mirrored_repeat");
if (ctx->Extensions.ARB_framebuffer_object) {
len += append_extension(&str, "GL_OES_framebuffer_object");
len += append_extension(&str, "GL_OES_depth24");
len += append_extension(&str, "GL_OES_depth32");
len += append_extension(&str, "GL_OES_fbo_render_mipmap");
len += append_extension(&str, "GL_OES_rgb8_rgba8");
len += append_extension(&str, "GL_OES_stencil1");
len += append_extension(&str, "GL_OES_stencil4");
len += append_extension(&str, "GL_OES_stencil8");
}
if (ctx->Extensions.EXT_vertex_array)
len += append_extension(&str, "GL_OES_element_index_uint");
if (ctx->Extensions.ARB_vertex_buffer_object)
len += append_extension(&str, "GL_OES_mapbuffer");
if (ctx->Extensions.EXT_texture_filter_anisotropic)
len += append_extension(&str, "GL_EXT_texture_filter_anisotropic");
/* some applications check this for NPOT support */
if (ctx->Extensions.ARB_texture_non_power_of_two)
len += append_extension(&str, "GL_ARB_texture_non_power_of_two");
if (ctx->Extensions.EXT_texture_compression_s3tc)
len += append_extension(&str, "GL_EXT_texture_compression_dxt1");
if (ctx->Extensions.EXT_texture_lod_bias)
len += append_extension(&str, "GL_EXT_texture_lod_bias");
if (ctx->Extensions.EXT_blend_minmax)
len += append_extension(&str, "GL_EXT_blend_minmax");
if (ctx->Extensions.EXT_multi_draw_arrays)
len += append_extension(&str, "GL_EXT_multi_draw_arrays");
#if FEATURE_OES_EGL_image
if (ctx->Extensions.OES_EGL_image)
len += append_extension(&str, "GL_OES_EGL_image");
#endif
return len;
}
static const GLubyte *
compute_es_extensions(void)
{
GET_CURRENT_CONTEXT(ctx);
if (!ctx->Extensions.String) {
char *s;
unsigned int len;
len = make_extension_string(ctx, NULL);
s = (char *) malloc(len + 1);
if (!s)
return NULL;
make_extension_string(ctx, s);
ctx->Extensions.String = (const GLubyte *) s;
}
return ctx->Extensions.String;
}
const GLubyte * GLAPIENTRY
_es_GetString(GLenum name)
{
switch (name) {
case GL_VERSION:
return compute_es_version();
case GL_EXTENSIONS:
return compute_es_extensions();
default:
return _mesa_GetString(name);
}
}
void
_mesa_initialize_context_extra(GLcontext *ctx)
{
GLuint i;
/**
* GL_OES_texture_cube_map says
* "Initially all texture generation modes are set to REFLECTION_MAP_OES"
*/
for (i = 0; i < MAX_TEXTURE_UNITS; i++) {
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
texUnit->GenS.Mode = GL_REFLECTION_MAP_NV;
texUnit->GenT.Mode = GL_REFLECTION_MAP_NV;
texUnit->GenR.Mode = GL_REFLECTION_MAP_NV;
texUnit->GenS._ModeBit = TEXGEN_REFLECTION_MAP_NV;
texUnit->GenT._ModeBit = TEXGEN_REFLECTION_MAP_NV;
texUnit->GenR._ModeBit = TEXGEN_REFLECTION_MAP_NV;
}
}

View file

@ -1,179 +0,0 @@
/**************************************************************************
*
* 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.
**************************************************************************/
#include "main/mtypes.h"
#include "main/context.h"
#include "main/imports.h"
#include "main/get.h"
const GLubyte * GLAPIENTRY _es_GetString(GLenum name);
static const GLubyte *
compute_es_version(void)
{
GET_CURRENT_CONTEXT(ctx);
static const char es_2_0[] = "OpenGL ES 2.0";
/* OpenGL ES 2.0 is derived from OpenGL 2.0 */
const GLboolean ver_2_0 = (ctx->Extensions.ARB_multisample &&
ctx->Extensions.ARB_multitexture &&
ctx->Extensions.ARB_texture_compression &&
ctx->Extensions.ARB_texture_cube_map &&
ctx->Extensions.ARB_texture_mirrored_repeat &&
ctx->Extensions.EXT_blend_color &&
ctx->Extensions.EXT_blend_func_separate &&
ctx->Extensions.EXT_blend_minmax &&
ctx->Extensions.EXT_blend_subtract &&
ctx->Extensions.EXT_stencil_wrap &&
ctx->Extensions.ARB_vertex_buffer_object &&
ctx->Extensions.ARB_shader_objects &&
ctx->Extensions.ARB_vertex_shader &&
ctx->Extensions.ARB_fragment_shader &&
ctx->Extensions.ARB_texture_non_power_of_two &&
ctx->Extensions.EXT_blend_equation_separate);
if (!ver_2_0)
_mesa_problem(ctx, "Incomplete OpenGL ES 2.0 support.");
return (const GLubyte *) es_2_0;
}
static size_t
append_extension(char **str, const char *ext)
{
char *s = *str;
size_t len = strlen(ext);
if (s) {
memcpy(s, ext, len);
s[len++] = ' ';
s[len] = '\0';
*str += len;
}
else {
len++;
}
return len;
}
static size_t
make_extension_string(const GLcontext *ctx, char *str)
{
size_t len = 0;
len += append_extension(&str, "GL_OES_compressed_paletted_texture");
if (ctx->Extensions.ARB_framebuffer_object) {
len += append_extension(&str, "GL_OES_depth24");
len += append_extension(&str, "GL_OES_depth32");
len += append_extension(&str, "GL_OES_fbo_render_mipmap");
len += append_extension(&str, "GL_OES_rgb8_rgba8");
len += append_extension(&str, "GL_OES_stencil1");
len += append_extension(&str, "GL_OES_stencil4");
}
if (ctx->Extensions.EXT_vertex_array)
len += append_extension(&str, "GL_OES_element_index_uint");
if (ctx->Extensions.ARB_vertex_buffer_object)
len += append_extension(&str, "GL_OES_mapbuffer");
if (ctx->Extensions.EXT_texture3D)
len += append_extension(&str, "GL_OES_texture_3D");
if (ctx->Extensions.ARB_texture_non_power_of_two)
len += append_extension(&str, "GL_OES_texture_npot");
if (ctx->Extensions.EXT_texture_filter_anisotropic)
len += append_extension(&str, "GL_EXT_texture_filter_anisotropic");
len += append_extension(&str, "GL_EXT_texture_type_2_10_10_10_REV");
if (ctx->Extensions.ARB_depth_texture)
len += append_extension(&str, "GL_OES_depth_texture");
if (ctx->Extensions.EXT_packed_depth_stencil)
len += append_extension(&str, "GL_OES_packed_depth_stencil");
if (ctx->Extensions.ARB_fragment_shader)
len += append_extension(&str, "GL_OES_standard_derivatives");
if (ctx->Extensions.EXT_texture_compression_s3tc)
len += append_extension(&str, "GL_EXT_texture_compression_dxt1");
if (ctx->Extensions.EXT_blend_minmax)
len += append_extension(&str, "GL_EXT_blend_minmax");
if (ctx->Extensions.EXT_multi_draw_arrays)
len += append_extension(&str, "GL_EXT_multi_draw_arrays");
#if FEATURE_OES_EGL_image
if (ctx->Extensions.OES_EGL_image)
len += append_extension(&str, "GL_OES_EGL_image");
#endif
return len;
}
static const GLubyte *
compute_es_extensions(void)
{
GET_CURRENT_CONTEXT(ctx);
if (!ctx->Extensions.String) {
char *s;
unsigned int len;
len = make_extension_string(ctx, NULL);
s = (char *) malloc(len + 1);
if (!s)
return NULL;
make_extension_string(ctx, s);
ctx->Extensions.String = (const GLubyte *) s;
}
return ctx->Extensions.String;
}
const GLubyte * GLAPIENTRY
_es_GetString(GLenum name)
{
switch (name) {
case GL_VERSION:
return compute_es_version();
case GL_SHADING_LANGUAGE_VERSION:
return (const GLubyte *) "OpenGL ES GLSL ES 1.0.16";
case GL_EXTENSIONS:
return compute_es_extensions();
default:
return _mesa_GetString(name);
}
}
void
_mesa_initialize_context_extra(GLcontext *ctx)
{
ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
ctx->VertexProgram._MaintainTnlProgram = GL_TRUE;
ctx->Point.PointSprite = GL_TRUE; /* always on for ES 2.x */
}

View file

@ -1,131 +0,0 @@
/**************************************************************************
*
* 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.
**************************************************************************/
/**
* Temporary stubs for "missing" mesa functions.
*/
#include "main/mtypes.h"
#include "main/imports.h"
#include "vbo/vbo.h"
#define NEED_IMPLEMENT() do { \
GET_CURRENT_CONTEXT(ctx); \
_mesa_error(ctx, GL_INVALID_OPERATION, __FUNCTION__); \
} while (0)
/* silence compiler warnings */
extern void GLAPIENTRY _vbo_Materialf(GLenum face, GLenum pname, GLfloat param);
extern void GLAPIENTRY _mesa_GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
extern void GLAPIENTRY _mesa_ReleaseShaderCompiler(void);
extern void GLAPIENTRY _mesa_ShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length);
extern void GLAPIENTRY _vbo_VertexAttrib1f(GLuint indx, GLfloat x);
extern void GLAPIENTRY _vbo_VertexAttrib1fv(GLuint indx, const GLfloat* values);
extern void GLAPIENTRY _vbo_VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
extern void GLAPIENTRY _vbo_VertexAttrib2fv(GLuint indx, const GLfloat* values);
extern void GLAPIENTRY _vbo_VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
extern void GLAPIENTRY _vbo_VertexAttrib3fv(GLuint indx, const GLfloat* values);
extern void GLAPIENTRY _vbo_VertexAttrib4fv(GLuint indx, const GLfloat* values);
void GLAPIENTRY
_vbo_Materialf(GLenum face, GLenum pname, GLfloat param)
{
_vbo_Materialfv(face, pname, &param);
}
void GLAPIENTRY
_mesa_GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype,
GLint* range, GLint* precision)
{
NEED_IMPLEMENT();
}
void GLAPIENTRY
_mesa_ReleaseShaderCompiler(void)
{
NEED_IMPLEMENT();
}
void GLAPIENTRY
_mesa_ShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat,
const void* binary, GLint length)
{
NEED_IMPLEMENT();
}
void GLAPIENTRY
_vbo_VertexAttrib1f(GLuint indx, GLfloat x)
{
_vbo_VertexAttrib4f(indx, x, 0.0, 0.0, 1.0f);
}
void GLAPIENTRY
_vbo_VertexAttrib1fv(GLuint indx, const GLfloat* values)
{
_vbo_VertexAttrib4f(indx, values[0], 0.0, 0.0, 1.0f);
}
void GLAPIENTRY
_vbo_VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
{
_vbo_VertexAttrib4f(indx, x, y, 0.0, 1.0f);
}
void GLAPIENTRY
_vbo_VertexAttrib2fv(GLuint indx, const GLfloat* values)
{
_vbo_VertexAttrib4f(indx, values[0], values[1], 0.0, 1.0f);
}
void GLAPIENTRY
_vbo_VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
{
_vbo_VertexAttrib4f(indx, x, y, z, 1.0f);
}
void GLAPIENTRY
_vbo_VertexAttrib3fv(GLuint indx, const GLfloat* values)
{
_vbo_VertexAttrib4f(indx, values[0], values[1], values[2], 1.0f);
}
void GLAPIENTRY
_vbo_VertexAttrib4fv(GLuint indx, const GLfloat* values)
{
_vbo_VertexAttrib4f(indx, values[0], values[1], values[2], values[3]);
}

View file

@ -1,45 +1,13 @@
include $(MESA)/sources.mak
# LOCAL sources
LOCAL_ES1_SOURCES := \
main/api_exec_es1.c \
main/get_es1.c \
main/specials_es1.c \
main/drawtex.c \
main/es_cpaltex.c \
main/es_enable.c \
main/es_fbo.c \
main/es_query_matrix.c \
main/es_texgen.c \
main/stubs.c \
glapi/glapi-es1/main/enums.c
LOCAL_ES1_GALLIUM_SOURCES := \
$(LOCAL_ES1_SOURCES) \
state_tracker/st_cb_drawtex.c
# always use local version of GLAPI_ASM_SOURCES
LOCAL_ES1_API_ASM := $(addprefix glapi/glapi-es1/, $(GLAPI_ASM_SOURCES))
LOCAL_ES1_INCLUDES := \
-I. \
-I./glapi/glapi-es1 \
-I./state_tracker \
-I$(MESA)/state_tracker
LOCAL_ES2_SOURCES := \
main/api_exec_es2.c \
main/get_es2.c \
main/specials_es2.c \
main/es_cpaltex.c \
main/es_fbo.c \
main/stubs.c \
glapi/glapi-es2/main/enums.c
LOCAL_ES2_GALLIUM_SOURCES := \
$(LOCAL_ES2_SOURCES)
LOCAL_ES2_API_ASM := $(subst es1,es2, $(LOCAL_ES1_API_ASM))
LOCAL_ES2_INCLUDES := $(subst es1,es2, $(LOCAL_ES1_INCLUDES))
@ -50,7 +18,6 @@ MAIN_OMITTED := \
main/api_exec.c \
main/condrender.c \
main/dlopen.c \
main/enums.c \
main/get.c
MAIN_SOURCES := $(filter-out $(MAIN_OMITTED), $(MAIN_SOURCES))
@ -101,10 +68,6 @@ MESA_ES1_API_SOURCES := \
MESA_ES1_INCLUDES := $(INCLUDE_DIRS)
# remove LOCAL sources from MESA sources
MESA_ES1_SOURCES := $(filter-out $(LOCAL_ES1_SOURCES), $(MESA_ES1_SOURCES))
MESA_ES1_GALLIUM_SOURCES := $(filter-out $(LOCAL_ES1_GALLIUM_SOURCES), $(MESA_ES1_GALLIUM_SOURCES))
# right now es2 and es1 share MESA sources
MESA_ES2_SOURCES := $(MESA_ES1_SOURCES)
MESA_ES2_GALLIUM_SOURCES := $(MESA_ES1_GALLIUM_SOURCES)
@ -116,12 +79,12 @@ MESA_ES2_INCLUDES := $(MESA_ES1_INCLUDES)
MESA_ES_ASM := $(MESA_ASM_SOURCES)
# collect sources, adjust the pathes
ES1_SOURCES := $(LOCAL_ES1_SOURCES) $(addprefix $(MESA)/,$(MESA_ES1_SOURCES))
ES1_GALLIUM_SOURCES := $(LOCAL_ES1_GALLIUM_SOURCES) $(addprefix $(MESA)/,$(MESA_ES1_GALLIUM_SOURCES))
ES1_SOURCES := $(addprefix $(MESA)/,$(MESA_ES1_SOURCES))
ES1_GALLIUM_SOURCES := $(addprefix $(MESA)/,$(MESA_ES1_GALLIUM_SOURCES))
ES1_API_SOURCES := $(addprefix $(MESA)/,$(MESA_ES1_API_SOURCES))
ES2_SOURCES := $(LOCAL_ES2_SOURCES) $(addprefix $(MESA)/,$(MESA_ES2_SOURCES))
ES2_GALLIUM_SOURCES := $(LOCAL_ES2_GALLIUM_SOURCES) $(addprefix $(MESA)/,$(MESA_ES2_GALLIUM_SOURCES))
ES2_SOURCES := $(addprefix $(MESA)/,$(MESA_ES2_SOURCES))
ES2_GALLIUM_SOURCES := $(addprefix $(MESA)/,$(MESA_ES2_GALLIUM_SOURCES))
ES2_API_SOURCES := $(addprefix $(MESA)/,$(MESA_ES2_API_SOURCES))
# collect includes
@ -130,12 +93,10 @@ ES2_INCLUDES := $(LOCAL_ES2_INCLUDES) $(MESA_ES2_INCLUDES)
# collect objects, including asm
ES1_OBJECTS := \
$(LOCAL_ES1_SOURCES:.c=.o) \
$(MESA_ES1_SOURCES:.c=.o) \
$(MESA_ES_ASM:.S=.o)
ES1_GALLIUM_OBJECTS := \
$(LOCAL_ES1_GALLIUM_SOURCES:.c=.o) \
$(MESA_ES1_GALLIUM_SOURCES:.c=.o) \
$(MESA_ES_ASM:.S=.o)
@ -144,12 +105,10 @@ ES1_API_OBJECTS := \
$(MESA_ES1_API_SOURCES:.c=.o)
ES2_OBJECTS := \
$(LOCAL_ES2_SOURCES:.c=.o) \
$(MESA_ES2_SOURCES:.c=.o) \
$(MESA_ES_ASM:.S=.o)
ES2_GALLIUM_OBJECTS := \
$(LOCAL_ES2_GALLIUM_SOURCES:.c=.o) \
$(MESA_ES2_GALLIUM_SOURCES:.c=.o) \
$(MESA_ES_ASM:.S=.o)

View file

@ -151,8 +151,10 @@ $(MESA_DIR)/sparc/glapi_sparc.S: gl_SPARC_asm.py $(COMMON)
######################################################################
$(MESA_DIR)/main/enums.c: gl_enums.py $(COMMON)
$(PYTHON2) $(PYTHON_FLAGS) $< > $@
$(MESA_DIR)/main/enums.c: gl_enums.py $(COMMON) $(ES_API)
$(PYTHON2) $(PYTHON_FLAGS) $< -f gl_API.xml \
-f $(MESA_DIR)/es/glapi/es1_API.xml \
-f $(MESA_DIR)/es/glapi/es2_API.xml > $@
$(MESA_DIR)/main/remap_helper.h: remap_helper.py $(COMMON)
$(PYTHON2) $(PYTHON_FLAGS) $< > $@

View file

@ -151,8 +151,10 @@ int _mesa_lookup_enum_by_name( const char *symbol )
return
def printBody(self, api):
self.process_enums( api )
def printBody(self, api_list):
self.enum_table = {}
for api in api_list:
self.process_enums( api )
keys = self.enum_table.keys()
keys.sort()
@ -209,16 +211,20 @@ int _mesa_lookup_enum_by_name( const char *symbol )
def process_enums(self, api):
self.enum_table = {}
for obj in api.enumIterateByName():
if obj.value not in self.enum_table:
self.enum_table[ obj.value ] = []
enum = self.enum_table[ obj.value ]
name = "GL_" + obj.name
priority = obj.priority()
self.enum_table[ obj.value ].append( [name, priority] )
already_in = False;
for n, p in enum:
if n == name:
already_in = True
if not already_in:
enum.append( [name, priority] )
def show_usage():
@ -226,18 +232,16 @@ def show_usage():
sys.exit(1)
if __name__ == '__main__':
file_name = "gl_API.xml"
try:
(args, trail) = getopt.getopt(sys.argv[1:], "f:")
except Exception,e:
show_usage()
api_list = []
for (arg,val) in args:
if arg == "-f":
file_name = val
api = gl_XML.parse_GL_API( file_name )
api = gl_XML.parse_GL_API( val )
api_list.append(api);
printer = PrintGlEnums()
printer.Print( api )
printer.Print( api_list )

View file

@ -65,17 +65,12 @@ class PrintGlRemap(gl_XML.gl_print_base):
def printRealHeader(self):
print '#include "main/dispatch.h"'
print '#include "main/remap.h"'
print ''
return
def printBody(self, api):
print 'struct gl_function_remap {'
print ' GLint func_index;'
print ' GLint dispatch_offset; /* for sanity check */'
print '};'
print ''
pool_indices = {}
print '/* this is internal to remap.c */'
@ -108,10 +103,7 @@ class PrintGlRemap(gl_XML.gl_print_base):
print ''
print '/* these functions need to be remapped */'
print 'static const struct {'
print ' GLint pool_index;'
print ' GLint remap_index;'
print '} MESA_remap_table_functions[] = {'
print 'static const struct gl_function_pool_remap MESA_remap_table_functions[] = {'
# output all functions that need to be remapped
# iterate by offsets so that they are sorted by remap indices
for f in api.functionIterateByOffset():

View file

@ -3921,8 +3921,8 @@
<function name="ColorMask" template="ColorMask"/>
<function name="DepthMask" template="DepthMask"/>
<function name="Disable" external="true" template="Disable"/>
<function name="Enable" external="true" template="Enable"/>
<function name="Disable" template="Disable"/>
<function name="Enable" template="Enable"/>
<function name="Finish" template="Finish"/>
<function name="Flush" template="Flush"/>
@ -3939,15 +3939,15 @@
<function name="PixelStorei" template="PixelStore" gltype="GLint"/>
<function name="ReadPixels" template="ReadPixels"/>
<function name="GetBooleanv" template="GetState" gltype="GLboolean"/>
<function name="GetBooleanv" default_prefix="_es1_" template="GetState" gltype="GLboolean"/>
<function name="GetClipPlanef" template="GetClipPlane" gltype="GLfloat"/>
<function name="GetClipPlanex" template="GetClipPlane" gltype="GLfixed"/>
<function name="GetError" template="GetError"/>
<function name="GetFloatv" template="GetState" gltype="GLfloat"/>
<function name="GetFixedv" template="GetState" gltype="GLfixed"/>
<function name="GetIntegerv" template="GetState" gltype="GLint"/>
<function name="GetFloatv" default_prefix="_es1_" template="GetState" gltype="GLfloat"/>
<function name="GetFixedv" default_prefix="_es1_" template="GetState" gltype="GLfixed"/>
<function name="GetIntegerv" default_prefix="_es1_" template="GetState" gltype="GLint"/>
<function name="GetLightfv" template="GetLight" gltype="GLfloat"/>
<function name="GetLightxv" template="GetLight" gltype="GLfixed"/>
@ -3955,7 +3955,7 @@
<function name="GetMaterialfv" template="GetMaterial" gltype="GLfloat"/>
<function name="GetMaterialxv" template="GetMaterial" gltype="GLfixed"/>
<function name="GetString" external="true" template="GetString"/>
<function name="GetString" template="GetString"/>
<function name="GetTexEnvfv" template="GetTexEnv" gltype="GLfloat"/>
<function name="GetTexEnviv" template="GetTexEnv" gltype="GLint"/>
@ -3969,7 +3969,7 @@
<function name="GetTexParameteriv" template="GetTexParameter" gltype="GLint"/>
<function name="GetTexParameterxv" template="GetTexParameter" gltype="GLfixed"/>
<function name="IsEnabled" external="true" template="IsEnabled"/>
<function name="IsEnabled" template="IsEnabled"/>
<function name="DepthRangef" template="DepthRange" gltype="GLclampf"/>
<function name="DepthRangex" template="DepthRange" gltype="GLclampx"/>
@ -4040,7 +4040,7 @@
<!-- CompressedTexImage2D calls out to two different functions based on
whether the image is a paletted image or not -->
<function name="CompressedTexImage2D" external="true" template="CompressedTexImage2D"/>
<function name="CompressedTexImage2D" template="CompressedTexImage2D"/>
<function name="CompressedTexSubImage2D" template="CompressedTexSubImage2D"/>
<function name="BlendFuncSeparateOES" template="BlendFuncSeparate"/>
@ -4173,12 +4173,12 @@
<function name="PixelStorei" template="PixelStore" gltype="GLint"/>
<function name="ReadPixels" template="ReadPixels"/>
<function name="GetBooleanv" template="GetState" gltype="GLboolean"/>
<function name="GetBooleanv" default_prefix="_es2_" template="GetState" gltype="GLboolean"/>
<function name="GetError" template="GetError"/>
<function name="GetFloatv" template="GetState" gltype="GLfloat"/>
<function name="GetIntegerv" template="GetState" gltype="GLint"/>
<function name="GetFloatv" default_prefix="_es2_" template="GetState" gltype="GLfloat"/>
<function name="GetIntegerv" default_prefix="_es2_" template="GetState" gltype="GLint"/>
<function name="GetString" external="true" template="GetString"/>
<function name="GetString" template="GetString"/>
<function name="GetTexParameterfv" template="GetTexParameter" gltype="GLfloat"/>
<function name="GetTexParameteriv" template="GetTexParameter" gltype="GLint"/>
@ -4217,7 +4217,7 @@
<function name="SampleCoverage" template="SampleCoverage" gltype="GLclampf"/>
<function name="CompressedTexImage2D" external="true" template="CompressedTexImage2D"/>
<function name="CompressedTexImage2D" template="CompressedTexImage2D"/>
<function name="CompressedTexSubImage2D" template="CompressedTexSubImage2D"/>
<function name="BlendFuncSeparate" template="BlendFuncSeparate"/>

View file

@ -222,6 +222,13 @@ def Parameters(funcname):
return params
def FunctionPrefix(funcname):
"""Return function specific prefix."""
func = __functions[funcname]
return func.prefix
def FindParamIndex(params, paramname):
"""Find the index of a named parameter."""
for i in xrange(len(params)):

View file

@ -107,6 +107,40 @@
#endif
#include "main/dispatch.h"
#define need_MESA_remap_table
#include "main/remap.h"
#include "main/remap_helper.h"
/* This is shared across all APIs but We define this here since
* desktop GL has the biggest remap table. */
int driDispatchRemapTable[driDispatchRemapTable_size];
/**
* Map the functions which are already static.
*
* When a extension function are incorporated into the ABI, the
* extension suffix is usually stripped. Mapping such functions
* makes sure the alternative names are available.
*
* Note that functions mapped by _mesa_init_remap_table() are
* excluded.
*/
void
_mesa_map_static_functions(void)
{
/* Remap static functions which have alternative names and are in the ABI.
* This is to be on the safe side. glapi should have defined those names.
*/
_mesa_map_function_array(MESA_alt_functions);
}
void
_mesa_init_remap_table(void)
{
_mesa_do_init_remap_table(_mesa_function_pool,
driDispatchRemapTable_size,
MESA_remap_table_functions);
}
/**
@ -119,9 +153,15 @@
* \param ctx GL context to which \c exec belongs.
* \param exec dispatch table.
*/
void
_mesa_init_exec_table(struct _glapi_table *exec)
struct _glapi_table *
_mesa_create_exec_table(void)
{
struct _glapi_table *exec;
exec = _mesa_alloc_dispatch_table(sizeof *exec);
if (exec == NULL)
return NULL;
#if _HAVE_FULL_GL
_mesa_loopback_init_api_table( exec );
#endif
@ -777,4 +817,6 @@ _mesa_init_exec_table(struct _glapi_table *exec)
SET_ObjectUnpurgeableAPPLE(exec, _mesa_ObjectUnpurgeableAPPLE);
SET_GetObjectParameterivAPPLE(exec, _mesa_GetObjectParameterivAPPLE);
#endif
return exec;
}

View file

@ -29,9 +29,17 @@
struct _glapi_table;
extern struct _glapi_table *
_mesa_alloc_dispatch_table(int size);
extern void
_mesa_init_exec_table(struct _glapi_table *exec);
extern struct _glapi_table *
_mesa_create_exec_table(void);
extern struct _glapi_table *
_mesa_create_exec_table_es1(void);
extern struct _glapi_table *
_mesa_create_exec_table_es2(void);
#endif

View file

@ -129,8 +129,6 @@
#include "version.h"
#include "viewport.h"
#include "vtxfmt.h"
#include "glapi/glthread.h"
#include "glapi/glapitable.h"
#include "shader/program.h"
#include "shader/prog_print.h"
#include "shader/shader_api.h"
@ -396,7 +394,25 @@ one_time_init( GLcontext *ctx )
_mesa_get_cpu_features();
_mesa_init_remap_table();
switch (ctx->API) {
#if FEATURE_GL
case API_OPENGL:
_mesa_init_remap_table();
break;
#endif
#if FEATURE_ES1
case API_OPENGLES:
_mesa_init_remap_table_es1();
break;
#endif
#if FEATURE_ES2
case API_OPENGLES2:
_mesa_init_remap_table_es2();
break;
#endif
default:
break;
}
_mesa_init_sqrt_table();
@ -749,8 +765,8 @@ generic_nop(void)
/**
* Allocate and initialize a new dispatch table.
*/
static struct _glapi_table *
alloc_dispatch_table(void)
struct _glapi_table *
_mesa_alloc_dispatch_table(int size)
{
/* Find the larger of Mesa's dispatch table and libGL's dispatch table.
* In practice, this'll be the same for stand-alone Mesa. But for DRI
@ -758,7 +774,7 @@ alloc_dispatch_table(void)
* DRI drivers.
*/
GLint numEntries = MAX2(_glapi_get_dispatch_table_size(),
sizeof(struct _glapi_table) / sizeof(_glapi_proc));
size / sizeof(_glapi_proc));
struct _glapi_table *table =
(struct _glapi_table *) malloc(numEntries * sizeof(_glapi_proc));
if (table) {
@ -791,6 +807,7 @@ alloc_dispatch_table(void)
* for debug flags.
*
* \param ctx the context to initialize
* \param api the GL API type to create the context for
* \param visual describes the visual attributes for this context
* \param share_list points to context to share textures, display lists,
* etc with, or NULL
@ -799,27 +816,30 @@ alloc_dispatch_table(void)
* \param driverContext pointer to driver-specific context data
*/
GLboolean
_mesa_initialize_context(GLcontext *ctx,
const GLvisual *visual,
GLcontext *share_list,
const struct dd_function_table *driverFunctions,
void *driverContext)
_mesa_initialize_context_for_api(GLcontext *ctx,
gl_api api,
const GLvisual *visual,
GLcontext *share_list,
const struct dd_function_table *driverFunctions,
void *driverContext)
{
struct gl_shared_state *shared;
int i;
/*ASSERT(driverContext);*/
assert(driverFunctions->NewTextureObject);
assert(driverFunctions->FreeTexImageData);
/* misc one-time initializations */
one_time_init(ctx);
ctx->API = api;
ctx->Visual = *visual;
ctx->DrawBuffer = NULL;
ctx->ReadBuffer = NULL;
ctx->WinSysDrawBuffer = NULL;
ctx->WinSysReadBuffer = NULL;
/* misc one-time initializations */
one_time_init(ctx);
/* Plug in driver functions and context pointer here.
* This is important because when we call alloc_shared_state() below
* we'll call ctx->Driver.NewTextureObject() to create the default
@ -849,22 +869,44 @@ _mesa_initialize_context(GLcontext *ctx,
return GL_FALSE;
}
#if FEATURE_dispatch
/* setup the API dispatch tables */
ctx->Exec = alloc_dispatch_table();
ctx->Save = alloc_dispatch_table();
if (!ctx->Exec || !ctx->Save) {
switch (ctx->API) {
#if FEATURE_GL
case API_OPENGL:
ctx->Exec = _mesa_create_exec_table();
break;
#endif
#if FEATURE_ES1
case API_OPENGLES:
ctx->Exec = _mesa_create_exec_table_es1();
break;
#endif
#if FEATURE_ES2
case API_OPENGLES2:
ctx->Exec = _mesa_create_exec_table_es2();
break;
#endif
default:
_mesa_problem(ctx, "unknown or unsupported API");
break;
}
if (!ctx->Exec) {
_mesa_release_shared_state(ctx, ctx->Shared);
if (ctx->Exec)
free(ctx->Exec);
return GL_FALSE;
}
#if FEATURE_dispatch
_mesa_init_exec_table(ctx->Exec);
#endif
ctx->CurrentDispatch = ctx->Exec;
#if FEATURE_dlist
_mesa_init_save_table(ctx->Save);
ctx->Save = _mesa_create_save_table();
if (!ctx->Save) {
_mesa_release_shared_state(ctx, ctx->Shared);
free(ctx->Exec);
return GL_FALSE;
}
_mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt );
#endif
@ -883,15 +925,50 @@ _mesa_initialize_context(GLcontext *ctx,
ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
}
#if FEATURE_extra_context_init
_mesa_initialize_context_extra(ctx);
#endif
switch (ctx->API) {
case API_OPENGL:
break;
case API_OPENGLES:
/**
* GL_OES_texture_cube_map says
* "Initially all texture generation modes are set to REFLECTION_MAP_OES"
*/
for (i = 0; i < MAX_TEXTURE_UNITS; i++) {
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
texUnit->GenS.Mode = GL_REFLECTION_MAP_NV;
texUnit->GenT.Mode = GL_REFLECTION_MAP_NV;
texUnit->GenR.Mode = GL_REFLECTION_MAP_NV;
texUnit->GenS._ModeBit = TEXGEN_REFLECTION_MAP_NV;
texUnit->GenT._ModeBit = TEXGEN_REFLECTION_MAP_NV;
texUnit->GenR._ModeBit = TEXGEN_REFLECTION_MAP_NV;
}
break;
case API_OPENGLES2:
ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
ctx->VertexProgram._MaintainTnlProgram = GL_TRUE;
ctx->Point.PointSprite = GL_TRUE; /* always on for ES 2.x */
break;
}
ctx->FirstTimeCurrent = GL_TRUE;
return GL_TRUE;
}
GLboolean
_mesa_initialize_context(GLcontext *ctx,
const GLvisual *visual,
GLcontext *share_list,
const struct dd_function_table *driverFunctions,
void *driverContext)
{
return _mesa_initialize_context_for_api(ctx,
API_OPENGL,
visual,
share_list,
driverFunctions,
driverContext);
}
/**
* Allocate and initialize a GLcontext structure.
@ -899,6 +976,7 @@ _mesa_initialize_context(GLcontext *ctx,
* we need to at least call driverFunctions->NewTextureObject to initialize
* the rendering context.
*
* \param api the GL API type to create the context for
* \param visual a GLvisual pointer (we copy the struct contents)
* \param share_list another context to share display lists with or NULL
* \param driverFunctions points to the dd_function_table into which the
@ -908,10 +986,11 @@ _mesa_initialize_context(GLcontext *ctx,
* \return pointer to a new __GLcontextRec or NULL if error.
*/
GLcontext *
_mesa_create_context(const GLvisual *visual,
GLcontext *share_list,
const struct dd_function_table *driverFunctions,
void *driverContext)
_mesa_create_context_for_api(gl_api api,
const GLvisual *visual,
GLcontext *share_list,
const struct dd_function_table *driverFunctions,
void *driverContext)
{
GLcontext *ctx;
@ -922,8 +1001,8 @@ _mesa_create_context(const GLvisual *visual,
if (!ctx)
return NULL;
if (_mesa_initialize_context(ctx, visual, share_list,
driverFunctions, driverContext)) {
if (_mesa_initialize_context_for_api(ctx, api, visual, share_list,
driverFunctions, driverContext)) {
return ctx;
}
else {
@ -932,6 +1011,17 @@ _mesa_create_context(const GLvisual *visual,
}
}
GLcontext *
_mesa_create_context(const GLvisual *visual,
GLcontext *share_list,
const struct dd_function_table *driverFunctions,
void *driverContext)
{
return _mesa_create_context_for_api(API_OPENGL, visual,
share_list,
driverFunctions,
driverContext);
}
/**
* Free the data associated with the given context.

View file

@ -112,8 +112,20 @@ _mesa_initialize_context( GLcontext *ctx,
const struct dd_function_table *driverFunctions,
void *driverContext );
extern void
_mesa_initialize_context_extra(GLcontext *ctx);
extern GLcontext *
_mesa_create_context_for_api(gl_api api,
const GLvisual *visual,
GLcontext *share_list,
const struct dd_function_table *driverFunctions,
void *driverContext);
extern GLboolean
_mesa_initialize_context_for_api(GLcontext *ctx,
gl_api api,
const GLvisual *visual,
GLcontext *share_list,
const struct dd_function_table *driverFunctions,
void *driverContext);
extern void
_mesa_free_context_data( GLcontext *ctx );

View file

@ -8747,9 +8747,15 @@ exec_MultiModeDrawElementsIBM(const GLenum * mode,
* initialized from _mesa_init_api_defaults and from the active vtxfmt
* struct.
*/
void
_mesa_init_save_table(struct _glapi_table *table)
struct _glapi_table *
_mesa_create_save_table(void)
{
struct _glapi_table *table;
table = _mesa_alloc_dispatch_table(sizeof *table);
if (table == NULL)
return NULL;
_mesa_loopback_init_api_table(table);
/* GL 1.0 */
@ -9349,6 +9355,8 @@ _mesa_init_save_table(struct _glapi_table *table)
(void) save_ClearBufferfv;
(void) save_ClearBufferfi;
#endif
return table;
}

View file

@ -72,7 +72,7 @@ extern void _mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist);
extern void _mesa_save_vtxfmt_init( GLvertexformat *vfmt );
extern void _mesa_init_save_table( struct _glapi_table *table );
extern struct _glapi_table *_mesa_create_save_table(void);
extern void _mesa_install_dlist_vtxfmt(struct _glapi_table *disp,
const GLvertexformat *vfmt);

View file

@ -21,7 +21,7 @@
* DEALINGS IN THE SOFTWARE.
*/
#include "drawtex.h"
#include "main/drawtex.h"
#include "main/state.h"
#include "main/imports.h"
@ -130,19 +130,4 @@ _mesa_DrawTexxv(const GLfixed *coords)
(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

@ -59,18 +59,10 @@ _mesa_DrawTexx(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
extern void GLAPIENTRY
_mesa_DrawTexxv(const GLfixed *coords);
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 */

View file

@ -682,6 +682,25 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state)
}
break;
#if FEATURE_ES1
case GL_TEXTURE_GEN_STR_OES:
/* disable S, T, and R at the same time */
{
struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
if (texUnit) {
GLuint newenabled =
texUnit->TexGenEnabled & ~STR_BITS;
if (state)
newenabled |= STR_BITS;
if (texUnit->TexGenEnabled == newenabled)
return;
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texUnit->TexGenEnabled = newenabled;
}
}
break;
#endif
/*
* CLIENT STATE!!!
*/
@ -1301,6 +1320,15 @@ _mesa_IsEnabled( GLenum cap )
}
}
return GL_FALSE;
#if FEATURE_ES1
case GL_TEXTURE_GEN_STR_OES:
{
const struct gl_texture_unit *texUnit = get_texcoord_unit(ctx);
if (texUnit) {
return (texUnit->TexGenEnabled & STR_BITS) == STR_BITS ? GL_TRUE : GL_FALSE;
}
}
#endif
/*
* CLIENT STATE!!!

File diff suppressed because it is too large Load diff

View file

@ -103,11 +103,13 @@ VersionSpecificValues = {
'description' : 'GLES1.1 functions',
'header' : 'GLES/gl.h',
'extheader' : 'GLES/glext.h',
'shortname' : 'es1'
},
'GLES2.0': {
'description' : 'GLES2.0 functions',
'header' : 'GLES2/gl2.h',
'extheader' : 'GLES2/gl2ext.h',
'shortname' : 'es2'
}
}
@ -164,6 +166,7 @@ if not VersionSpecificValues.has_key(version):
# Grab the version-specific items we need to use
versionHeader = VersionSpecificValues[version]['header']
versionExtHeader = VersionSpecificValues[version]['extheader']
shortname = VersionSpecificValues[version]['shortname']
# If we get to here, we're good to go. The "version" parameter
# directs GetDispatchedFunctions to only allow functions from
@ -206,11 +209,39 @@ extern void _mesa_error(void *ctx, GLenum error, const char *fmtString, ... );
#include "main/compiler.h"
#include "main/api_exec.h"
#include "main/remap.h"
#include "main/dispatch.h"
#ifdef IN_DRI_DRIVER
#define _GLAPI_USE_REMAP_TABLE
#endif
#include "es/glapi/glapi-%s/glapi/glapitable.h"
#include "es/glapi/glapi-%s/glapi/glapioffsets.h"
#include "es/glapi/glapi-%s/glapi/glapidispatch.h"
#if FEATURE_remap_table
#define need_MESA_remap_table
#include "es/glapi/glapi-%s/main/remap_helper.h"
void
_mesa_init_remap_table_%s(void)
{
_mesa_do_init_remap_table(_mesa_function_pool,
driDispatchRemapTable_size,
MESA_remap_table_functions);
}
void
_mesa_map_static_functions_%s(void)
{
}
#endif
typedef void (*_glapi_proc)(void); /* generic function pointer */
"""
""" % (shortname, shortname, shortname, shortname, shortname, shortname);
# Finally we get to the all-important functions
print """/*************************************************************
@ -262,6 +293,7 @@ for funcName in keys:
passthroughFuncName = ""
passthroughDeclarationString = ""
passthroughCallString = ""
prefixOverride = None
variables = []
conversionCodeOutgoing = []
conversionCodeIncoming = []
@ -280,6 +312,9 @@ for funcName in keys:
funcPrefix = "_es_"
aliasprefix = apiutil.AliasPrefix(funcName)
alias = apiutil.ConversionFunction(funcName)
prefixOverride = apiutil.FunctionPrefix(funcName)
if prefixOverride != "_mesa_":
aliasprefix = apiutil.FunctionPrefix(funcName)
if not alias:
# There may still be a Mesa alias for the function
if apiutil.Alias(funcName):
@ -667,9 +702,17 @@ for funcName in keys:
# end for each function
print "void"
print "_mesa_init_exec_table(struct _glapi_table *exec)"
print "{"
print """
struct _glapi_table *
_mesa_create_exec_table_%s(void)
{
struct _glapi_table *exec;
exec = _mesa_alloc_dispatch_table(sizeof *exec);
if (exec == NULL)
return NULL;
""" % shortname
for func in keys:
prefix = "_es_" if func not in allSpecials else "_check_"
for spec in apiutil.Categories(func):
@ -682,4 +725,6 @@ for func in keys:
suffix = ext[0].split("_")[0]
entry += suffix
print " SET_%s(exec, %s%s);" % (entry, prefix, entry)
print ""
print " return exec;"
print "}"

View file

@ -495,7 +495,6 @@ _mesa_enable_2_1_extensions(GLcontext *ctx)
}
/**
* Either enable or disable the named extension.
* \return GL_TRUE for success, GL_FALSE if invalid extension name
@ -681,8 +680,8 @@ _mesa_init_extensions( GLcontext *ctx )
* Construct the GL_EXTENSIONS string. Called the first time that
* glGetString(GL_EXTENSIONS) is called.
*/
GLubyte *
_mesa_make_extension_string( GLcontext *ctx )
static GLubyte *
compute_extensions( GLcontext *ctx )
{
const char *extraExt = get_extension_override(ctx);
GLuint extStrLen = 0;
@ -727,6 +726,206 @@ _mesa_make_extension_string( GLcontext *ctx )
return (GLubyte *) s;
}
static size_t
append_extension(GLubyte **str, const char *ext)
{
GLubyte *s = *str;
size_t len = strlen(ext);
if (s) {
memcpy(s, ext, len);
s[len++] = ' ';
s[len] = '\0';
*str += len;
}
else {
len++;
}
return len;
}
static size_t
make_extension_string_es1(const GLcontext *ctx, GLubyte *str)
{
size_t len = 0;
/* Core additions */
len += append_extension(&str, "GL_OES_byte_coordinates");
len += append_extension(&str, "GL_OES_fixed_point");
len += append_extension(&str, "GL_OES_single_precision");
len += append_extension(&str, "GL_OES_matrix_get");
/* 1.1 required extensions */
len += append_extension(&str, "GL_OES_read_format");
len += append_extension(&str, "GL_OES_compressed_paletted_texture");
len += append_extension(&str, "GL_OES_point_size_array");
len += append_extension(&str, "GL_OES_point_sprite");
/* 1.1 deprecated extensions */
len += append_extension(&str, "GL_OES_query_matrix");
#if FEATURE_OES_draw_texture
if (ctx->Extensions.OES_draw_texture)
len += append_extension(&str, "GL_OES_draw_texture");
#endif
if (ctx->Extensions.EXT_blend_equation_separate)
len += append_extension(&str, "GL_OES_blend_equation_separate");
if (ctx->Extensions.EXT_blend_func_separate)
len += append_extension(&str, "GL_OES_blend_func_separate");
if (ctx->Extensions.EXT_blend_subtract)
len += append_extension(&str, "GL_OES_blend_subtract");
if (ctx->Extensions.EXT_stencil_wrap)
len += append_extension(&str, "GL_OES_stencil_wrap");
if (ctx->Extensions.ARB_texture_cube_map)
len += append_extension(&str, "GL_OES_texture_cube_map");
if (ctx->Extensions.ARB_texture_env_crossbar)
len += append_extension(&str, "GL_OES_texture_env_crossbar");
if (ctx->Extensions.ARB_texture_mirrored_repeat)
len += append_extension(&str, "GL_OES_texture_mirrored_repeat");
if (ctx->Extensions.ARB_framebuffer_object) {
len += append_extension(&str, "GL_OES_framebuffer_object");
len += append_extension(&str, "GL_OES_depth24");
len += append_extension(&str, "GL_OES_depth32");
len += append_extension(&str, "GL_OES_fbo_render_mipmap");
len += append_extension(&str, "GL_OES_rgb8_rgba8");
len += append_extension(&str, "GL_OES_stencil1");
len += append_extension(&str, "GL_OES_stencil4");
len += append_extension(&str, "GL_OES_stencil8");
}
if (ctx->Extensions.EXT_vertex_array)
len += append_extension(&str, "GL_OES_element_index_uint");
if (ctx->Extensions.ARB_vertex_buffer_object)
len += append_extension(&str, "GL_OES_mapbuffer");
if (ctx->Extensions.EXT_texture_filter_anisotropic)
len += append_extension(&str, "GL_EXT_texture_filter_anisotropic");
/* some applications check this for NPOT support */
if (ctx->Extensions.ARB_texture_non_power_of_two)
len += append_extension(&str, "GL_ARB_texture_non_power_of_two");
if (ctx->Extensions.EXT_texture_compression_s3tc)
len += append_extension(&str, "GL_EXT_texture_compression_dxt1");
if (ctx->Extensions.EXT_texture_lod_bias)
len += append_extension(&str, "GL_EXT_texture_lod_bias");
if (ctx->Extensions.EXT_blend_minmax)
len += append_extension(&str, "GL_EXT_blend_minmax");
if (ctx->Extensions.EXT_multi_draw_arrays)
len += append_extension(&str, "GL_EXT_multi_draw_arrays");
#if FEATURE_OES_EGL_image
if (ctx->Extensions.OES_EGL_image)
len += append_extension(&str, "GL_OES_EGL_image");
#endif
return len;
}
static GLubyte *
compute_extensions_es1(const GLcontext *ctx)
{
GLubyte *s;
unsigned int len;
len = make_extension_string_es1(ctx, NULL);
s = malloc(len + 1);
if (!s)
return NULL;
make_extension_string_es1(ctx, s);
return s;
}
static size_t
make_extension_string_es2(const GLcontext *ctx, GLubyte *str)
{
size_t len = 0;
len += append_extension(&str, "GL_OES_compressed_paletted_texture");
if (ctx->Extensions.ARB_framebuffer_object) {
len += append_extension(&str, "GL_OES_depth24");
len += append_extension(&str, "GL_OES_depth32");
len += append_extension(&str, "GL_OES_fbo_render_mipmap");
len += append_extension(&str, "GL_OES_rgb8_rgba8");
len += append_extension(&str, "GL_OES_stencil1");
len += append_extension(&str, "GL_OES_stencil4");
}
if (ctx->Extensions.EXT_vertex_array)
len += append_extension(&str, "GL_OES_element_index_uint");
if (ctx->Extensions.ARB_vertex_buffer_object)
len += append_extension(&str, "GL_OES_mapbuffer");
if (ctx->Extensions.EXT_texture3D)
len += append_extension(&str, "GL_OES_texture_3D");
if (ctx->Extensions.ARB_texture_non_power_of_two)
len += append_extension(&str, "GL_OES_texture_npot");
if (ctx->Extensions.EXT_texture_filter_anisotropic)
len += append_extension(&str, "GL_EXT_texture_filter_anisotropic");
len += append_extension(&str, "GL_EXT_texture_type_2_10_10_10_REV");
if (ctx->Extensions.ARB_depth_texture)
len += append_extension(&str, "GL_OES_depth_texture");
if (ctx->Extensions.EXT_packed_depth_stencil)
len += append_extension(&str, "GL_OES_packed_depth_stencil");
if (ctx->Extensions.ARB_fragment_shader)
len += append_extension(&str, "GL_OES_standard_derivatives");
if (ctx->Extensions.EXT_texture_compression_s3tc)
len += append_extension(&str, "GL_EXT_texture_compression_dxt1");
if (ctx->Extensions.EXT_blend_minmax)
len += append_extension(&str, "GL_EXT_blend_minmax");
if (ctx->Extensions.EXT_multi_draw_arrays)
len += append_extension(&str, "GL_EXT_multi_draw_arrays");
#if FEATURE_OES_EGL_image
if (ctx->Extensions.OES_EGL_image)
len += append_extension(&str, "GL_OES_EGL_image");
#endif
return len;
}
static GLubyte *
compute_extensions_es2(GLcontext *ctx)
{
GLubyte *s;
unsigned int len;
len = make_extension_string_es2(ctx, NULL);
s = malloc(len + 1);
if (!s)
return NULL;
make_extension_string_es2(ctx, s);
return s;
}
GLubyte *
_mesa_make_extension_string(GLcontext *ctx)
{
switch (ctx->API) {
case API_OPENGL:
return compute_extensions(ctx);
case API_OPENGLES2:
return compute_extensions_es2(ctx);
case API_OPENGLES:
return compute_extensions_es1(ctx);
default:
assert(0);
return NULL;
}
}
/**
* Return number of enabled extensions.

View file

@ -1110,7 +1110,22 @@ _mesa_RenderbufferStorageMultisample(GLenum target, GLsizei samples,
renderbuffer_storage(target, internalFormat, width, height, samples);
}
void GLAPIENTRY
_es_RenderbufferStorageEXT(GLenum target, GLenum internalFormat,
GLsizei width, GLsizei height)
{
switch (internalFormat) {
case GL_RGB565:
/* XXX this confuses GL_RENDERBUFFER_INTERNAL_FORMAT_OES */
/* choose a closest format */
internalFormat = GL_RGB5;
break;
default:
break;
}
renderbuffer_storage(target, internalFormat, width, height, 0);
}
void GLAPIENTRY
_mesa_GetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params)

View file

@ -88,6 +88,10 @@ _mesa_RenderbufferStorageMultisample(GLenum target, GLsizei samples,
GLenum internalformat,
GLsizei width, GLsizei height);
extern void GLAPIENTRY
_es_RenderbufferStorageEXT(GLenum target, GLenum internalFormat,
GLsizei width, GLsizei height);
extern void GLAPIENTRY
_mesa_EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image);

View file

@ -71,4 +71,27 @@ _mesa_GetStringi(GLenum name, GLuint index);
extern GLenum GLAPIENTRY
_mesa_GetError( void );
extern void GLAPIENTRY
_es1_GetBooleanv( GLenum pname, GLboolean *params );
extern void GLAPIENTRY
_es1_GetFloatv( GLenum pname, GLfloat *params );
extern void GLAPIENTRY
_es1_GetIntegerv( GLenum pname, GLint *params );
extern void GLAPIENTRY
_es1_GetFixedv( GLenum pname, GLfixed *params );
extern void GLAPIENTRY
_es2_GetBooleanv( GLenum pname, GLboolean *params );
extern void GLAPIENTRY
_es2_GetFloatv( GLenum pname, GLfloat *params );
extern void GLAPIENTRY
_es2_GetIntegerv( GLenum pname, GLint *params );
#endif

View file

@ -565,7 +565,7 @@ def ConversionFunc(fromType, toType):
return fromStr + "_TO_" + toStr
def EmitGetFunction(stateVars, returnType):
def EmitGetFunction(stateVars, returnType, API):
"""Emit the code to implement glGetBooleanv, glGetIntegerv or glGetFloatv."""
assert (returnType == GLboolean or
returnType == GLint or
@ -575,13 +575,13 @@ def EmitGetFunction(stateVars, returnType):
strType = TypeStrings[returnType]
# Capitalize first letter of return type
if returnType == GLint:
function = "_mesa_GetIntegerv"
function = "_es%d_GetIntegerv" % API
elif returnType == GLboolean:
function = "_mesa_GetBooleanv"
function = "_es%d_GetBooleanv" % API
elif returnType == GLfloat:
function = "_mesa_GetFloatv"
function = "_es%d_GetFloatv" % API
elif returnType == GLfixed:
function = "_mesa_GetFixedv"
function = "_es%d_GetFixedv" % API
else:
abort()
@ -773,20 +773,17 @@ static GLenum compressed_formats[] = {
#define ARRAY_SIZE(A) (sizeof(A) / sizeof(A[0]))
void GLAPIENTRY
_mesa_GetFixedv( GLenum pname, GLfixed *params );
"""
return
def EmitAll(stateVars, API):
EmitHeader()
EmitGetFunction(stateVars, GLboolean)
EmitGetFunction(stateVars, GLfloat)
EmitGetFunction(stateVars, GLint)
EmitGetFunction(stateVars, GLboolean, API)
EmitGetFunction(stateVars, GLfloat, API)
EmitGetFunction(stateVars, GLint, API)
if API == 1:
EmitGetFunction(stateVars, GLfixed)
EmitGetFunction(stateVars, GLfixed, API)
def main(args):

View file

@ -30,6 +30,30 @@
#include "enums.h"
#include "extensions.h"
static const GLubyte *
shading_laguage_version(GLcontext *ctx)
{
switch (ctx->API) {
#if FEATURE_ARB_shading_language_100
case API_OPENGL:
if (ctx->Extensions.ARB_shading_language_120)
return (const GLubyte *) "1.20";
else if (ctx->Extensions.ARB_shading_language_100)
return (const GLubyte *) "1.10";
goto error;
#endif
case API_OPENGLES2:
return (const GLubyte *) "OpenGL ES GLSL ES 1.0.16";
case API_OPENGLES:
default:
error:
_mesa_error( ctx, GL_INVALID_ENUM, "glGetString" );
return (const GLubyte *) 0;
}
}
/**
* Query string-valued state. The return value should _not_ be freed by
@ -74,13 +98,9 @@ _mesa_GetString( GLenum name )
if (!ctx->Extensions.String)
ctx->Extensions.String = _mesa_make_extension_string(ctx);
return (const GLubyte *) ctx->Extensions.String;
#if FEATURE_ARB_shading_language_100
case GL_SHADING_LANGUAGE_VERSION_ARB:
if (ctx->Extensions.ARB_shading_language_120)
return (const GLubyte *) "1.20";
else if (ctx->Extensions.ARB_shading_language_100)
return (const GLubyte *) "1.10";
goto error;
#if FEATURE_ARB_shading_language_100 || FEATURE_ES2
case GL_SHADING_LANGUAGE_VERSION:
return shading_laguage_version(ctx);
#endif
#if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program || \
FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program
@ -92,9 +112,6 @@ _mesa_GetString( GLenum name )
return (const GLubyte *) ctx->Program.ErrorString;
}
/* FALL-THROUGH */
#endif
#if FEATURE_ARB_shading_language_100
error:
#endif
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glGetString" );

View file

@ -85,6 +85,27 @@ typedef void *GLeglImageOES;
#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741
#endif
/* GLES 2.0 tokens */
#ifndef GL_RGB565
#define GL_RGB565 0x8D62
#endif
#ifndef GL_TEXTURE_GEN_STR_OES
#define GL_TEXTURE_GEN_STR_OES 0x8D60
#endif
#ifndef GL_OES_compressed_paletted_texture
#define GL_PALETTE4_RGB8_OES 0x8B90
#define GL_PALETTE4_RGBA8_OES 0x8B91
#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
#define GL_PALETTE4_RGBA4_OES 0x8B93
#define GL_PALETTE4_RGB5_A1_OES 0x8B94
#define GL_PALETTE8_RGB8_OES 0x8B95
#define GL_PALETTE8_RGBA8_OES 0x8B96
#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
#define GL_PALETTE8_RGBA4_OES 0x8B98
#define GL_PALETTE8_RGB5_A1_OES 0x8B99
#endif
/**
* Special, internal token

View file

@ -1076,6 +1076,7 @@ typedef enum
#define T_BIT 2
#define R_BIT 4
#define Q_BIT 8
#define STR_BITS (S_BIT | T_BIT | R_BIT)
/*@}*/
@ -2869,6 +2870,14 @@ struct gl_dlist_state
} Current;
};
/**
* Enum for the OpenGL APIs we know about and may support.
*/
typedef enum {
API_OPENGL,
API_OPENGLES,
API_OPENGLES2,
} gl_api;
/**
* Mesa rendering context.
@ -2887,6 +2896,7 @@ struct __GLcontextRec
/** \name API function pointer tables */
/*@{*/
gl_api API;
struct _glapi_table *Save; /**< Display list save functions */
struct _glapi_table *Exec; /**< Execute functions */
struct _glapi_table *CurrentDispatch; /**< == Save or Exec !! */

View file

@ -38,23 +38,15 @@
#include "remap.h"
#include "imports.h"
#include "main/dispatch.h"
#include "glapi/glapi.h"
#if FEATURE_remap_table
#define need_MESA_remap_table
#include "main/remap_helper.h"
#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
#define MAX_ENTRY_POINTS 16
/* this is global for quick access */
int driDispatchRemapTable[driDispatchRemapTable_size];
static const char *_mesa_function_pool;
/**
* Return the spec string associated with the given function index.
@ -67,10 +59,7 @@ int driDispatchRemapTable[driDispatchRemapTable_size];
const char *
_mesa_get_function_spec(GLint func_index)
{
if (func_index < ARRAY_SIZE(_mesa_function_pool))
return _mesa_function_pool + func_index;
else
return NULL;
return _mesa_function_pool + func_index;
}
@ -161,33 +150,15 @@ _mesa_map_function_array(const struct gl_function_remap *func_array)
}
/**
* Map the functions which are already static.
*
* When a extension function are incorporated into the ABI, the
* extension suffix is usually stripped. Mapping such functions
* makes sure the alternative names are available.
*
* Note that functions mapped by _mesa_init_remap_table() are
* excluded.
*/
void
_mesa_map_static_functions(void)
{
/* Remap static functions which have alternative names and are in the ABI.
* This is to be on the safe side. glapi should have defined those names.
*/
_mesa_map_function_array(MESA_alt_functions);
}
/**
* Initialize the remap table. This is called in one_time_init().
* The remap table needs to be initialized before calling the
* CALL/GET/SET macros defined in main/dispatch.h.
*/
void
_mesa_init_remap_table(void)
_mesa_do_init_remap_table(const char *pool,
int size,
const struct gl_function_pool_remap *remap)
{
static GLboolean initialized = GL_FALSE;
GLint i;
@ -195,15 +166,16 @@ _mesa_init_remap_table(void)
if (initialized)
return;
initialized = GL_TRUE;
_mesa_function_pool = pool;
/* initialize the remap table */
for (i = 0; i < ARRAY_SIZE(driDispatchRemapTable); i++) {
for (i = 0; i < size; i++) {
GLint offset;
const char *spec;
/* sanity check */
ASSERT(i == MESA_remap_table_functions[i].remap_index);
spec = _mesa_function_pool + MESA_remap_table_functions[i].pool_index;
ASSERT(i == remap[i].remap_index);
spec = _mesa_function_pool + remap[i].pool_index;
offset = _mesa_map_function_spec(spec);
/* store the dispatch offset in the remap table */

View file

@ -28,9 +28,17 @@
#define REMAP_H
#include "main/mtypes.h"
#include "main/mfeatures.h"
struct gl_function_remap;
struct gl_function_pool_remap {
int pool_index;
int remap_index;
};
struct gl_function_remap {
int func_index;
int dispatch_offset; /* for sanity check */
};
#if FEATURE_remap_table
@ -39,9 +47,9 @@ extern int
driDispatchRemapTable[];
extern const char *
_mesa_get_function_spec(GLint func_index);
_mesa_get_function_spec(int func_index);
extern GLint
extern int
_mesa_map_function_spec(const char *spec);
extern void
@ -50,18 +58,35 @@ _mesa_map_function_array(const struct gl_function_remap *func_array);
extern void
_mesa_map_static_functions(void);
extern void
_mesa_map_static_functions_es1(void);
extern void
_mesa_map_static_functions_es2(void);
extern void
_mesa_do_init_remap_table(const char *pool,
int size,
const struct gl_function_pool_remap *remap);
extern void
_mesa_init_remap_table(void);
extern void
_mesa_init_remap_table_es1(void);
extern void
_mesa_init_remap_table_es2(void);
#else /* FEATURE_remap_table */
static INLINE const char *
_mesa_get_function_spec(GLint func_index)
_mesa_get_function_spec(int func_index)
{
return NULL;
}
static INLINE GLint
static INLINE int
_mesa_map_function_spec(const char *spec)
{
return -1;
@ -77,11 +102,39 @@ _mesa_map_static_functions(void)
{
}
static INLINE void
_mesa_map_static_functions_es1(void)
{
}
static INLINE void
_mesa_map_static_functions_es2(void)
{
}
static INLINE void
_mesa_do_init_remap_table(const char *pool,
int size,
const struct gl_function_pool_remap *remap)
{
}
static INLINE void
_mesa_init_remap_table(void)
{
}
static INLINE void
_mesa_init_remap_table_es1(void)
{
}
static INLINE void
_mesa_init_remap_table_es2(void)
{
}
#endif /* FEATURE_remap_table */

View file

@ -26,11 +26,7 @@
*/
#include "main/dispatch.h"
struct gl_function_remap {
GLint func_index;
GLint dispatch_offset; /* for sanity check */
};
#include "main/remap.h"
/* this is internal to remap.c */
#ifdef need_MESA_remap_table
@ -4427,10 +4423,7 @@ static const char _mesa_function_pool[] =
;
/* these functions need to be remapped */
static const struct {
GLint pool_index;
GLint remap_index;
} MESA_remap_table_functions[] = {
static const struct gl_function_pool_remap MESA_remap_table_functions[] = {
{ 1461, AttachShader_remap_index },
{ 8848, CreateProgram_remap_index },
{ 20883, CreateShader_remap_index },

View file

@ -739,3 +739,31 @@ _mesa_ValidateProgramARB(GLhandleARB program)
ctx->Driver.ValidateProgram(ctx, program);
}
#ifdef FEATURE_ES2
void GLAPIENTRY
_mesa_GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype,
GLint* range, GLint* precision)
{
GET_CURRENT_CONTEXT(ctx);
_mesa_error(ctx, GL_INVALID_OPERATION, __FUNCTION__);
}
void GLAPIENTRY
_mesa_ReleaseShaderCompiler(void)
{
GET_CURRENT_CONTEXT(ctx);
_mesa_error(ctx, GL_INVALID_OPERATION, __FUNCTION__);
}
void GLAPIENTRY
_mesa_ShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat,
const void* binary, GLint length)
{
GET_CURRENT_CONTEXT(ctx);
_mesa_error(ctx, GL_INVALID_OPERATION, __FUNCTION__);
}
#endif

View file

@ -232,5 +232,16 @@ extern void GLAPIENTRY
_mesa_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose,
const GLfloat *value);
/* GLES 2.0 */
extern void GLAPIENTRY
_mesa_GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype,
GLint* range, GLint* precision);
extern void GLAPIENTRY
_mesa_ReleaseShaderCompiler(void);
extern void GLAPIENTRY
_mesa_ShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat,
const void* binary, GLint length);
#endif /* SHADERS_H */

View file

@ -192,6 +192,38 @@ _mesa_TexGend(GLenum coord, GLenum pname, GLdouble param )
_mesa_TexGenfv( coord, pname, p );
}
#if FEATURE_ES1
void GLAPIENTRY
_es_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params)
{
ASSERT(coord == GL_TEXTURE_GEN_STR_OES);
_mesa_GetTexGenfv(GL_S, pname, params);
}
void GLAPIENTRY
_es_TexGenf(GLenum coord, GLenum pname, GLfloat param)
{
ASSERT(coord == GL_TEXTURE_GEN_STR_OES);
/* set S, T, and R at the same time */
_mesa_TexGenf(GL_S, pname, param);
_mesa_TexGenf(GL_T, pname, param);
_mesa_TexGenf(GL_R, pname, param);
}
void GLAPIENTRY
_es_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params)
{
ASSERT(coord == GL_TEXTURE_GEN_STR_OES);
/* set S, T, and R at the same time */
_mesa_TexGenfv(GL_S, pname, params);
_mesa_TexGenfv(GL_T, pname, params);
_mesa_TexGenfv(GL_R, pname, params);
}
#endif
static void GLAPIENTRY
_mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params )

View file

@ -52,6 +52,17 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params );
extern void
_mesa_init_texgen_dispatch(struct _glapi_table *disp);
extern void GLAPIENTRY
_es_GetTexGenfv(GLenum coord, GLenum pname, GLfloat *params);
extern void GLAPIENTRY
_es_TexGenf(GLenum coord, GLenum pname, GLfloat param);
extern void GLAPIENTRY
_es_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params);
#else /* FEATURE_texgen */
#define _MESA_INIT_TEXGEN_FUNCTIONS(driver, impl) do { } while (0)

View file

@ -46,6 +46,7 @@
#include "texfetch.h"
#include "teximage.h"
#include "texstate.h"
#include "texpal.h"
#include "mtypes.h"
@ -3380,7 +3381,6 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level,
}
}
void GLAPIENTRY
_mesa_CompressedTexImage2DARB(GLenum target, GLint level,
GLenum internalFormat, GLsizei width,
@ -3396,6 +3396,24 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
_mesa_lookup_enum_by_nr(internalFormat),
width, height, border, imageSize, data);
#if FEATURE_ES
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:
_mesa_cpal_compressed_teximage2d(target, level, internalFormat,
width, height, imageSize, data);
return;
}
#endif
if (target == GL_TEXTURE_2D ||
(ctx->Extensions.ARB_texture_cube_map &&
target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB &&

View file

@ -15,21 +15,16 @@
*/
#include "GLES/gl.h"
#include "GLES/glext.h"
#include "glheader.h"
#include "compiler.h" /* for ASSERT */
#include "context.h"
#include "mtypes.h"
#include "imports.h"
#include "pixelstore.h"
#include "teximage.h"
#include "texpal.h"
#include "main/compiler.h" /* for ASSERT */
void GL_APIENTRY _es_CompressedTexImage2DARB(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
void GL_APIENTRY _mesa_GetIntegerv(GLenum pname, GLint *params);
void GL_APIENTRY _mesa_PixelStorei(GLenum pname, GLint param);
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);
void *_mesa_get_current_context(void);
void _mesa_error(void *ctx, GLenum error, const char *fmtString, ... );
#if FEATURE_ES
static const struct cpal_format_info {
@ -141,15 +136,17 @@ cpal_get_info(GLint level, GLenum internalFormat,
* 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, GLsizei imageSize,
const void *palette)
void
_mesa_cpal_compressed_teximage2d(GLenum target, GLint level,
GLenum internalFormat,
GLsizei width, GLsizei height,
GLsizei imageSize, const void *palette)
{
const struct cpal_format_info *info;
GLint lvl, num_levels;
const GLubyte *indices;
GLint saved_align, align;
GET_CURRENT_CONTEXT(ctx);
info = cpal_get_info(level, internalFormat, width, height, imageSize);
if (!info)
@ -162,7 +159,7 @@ cpal_compressed_teximage2d(GLenum target, GLint level, GLenum internalFormat,
/* first image follows the palette */
indices = (const GLubyte *) palette + info->palette_size * info->size;
_mesa_GetIntegerv(GL_UNPACK_ALIGNMENT, &saved_align);
saved_align = ctx->Unpack.Alignment;
align = saved_align;
for (lvl = 0; lvl < num_levels; lvl++) {
@ -204,28 +201,4 @@ cpal_compressed_teximage2d(GLenum target, GLint level, GLenum internalFormat,
_mesa_PixelStorei(GL_UNPACK_ALIGNMENT, saved_align);
}
void GL_APIENTRY
_es_CompressedTexImage2DARB(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, imageSize, data);
break;
default:
_mesa_CompressedTexImage2DARB(target, level, internalFormat,
width, height, border, imageSize, data);
}
}
#endif

38
src/mesa/main/texpal.h Normal file
View file

@ -0,0 +1,38 @@
/*
* Mesa 3-D graphics library
* Version: 7.8
*
* Copyright (C) 1999-2010 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef TEXPAL_H
#define TEXPAL_H
#include "main/glheader.h"
extern void
_mesa_cpal_compressed_teximage2d(GLenum target, GLint level,
GLenum internalFormat,
GLsizei width, GLsizei height,
GLsizei imageSize, const void *palette);
#endif /* TEXPAL_H */

View file

@ -32,8 +32,11 @@
* Return major and minor version numbers.
*/
static void
compute_version(const GLcontext *ctx, GLuint *major, GLuint *minor)
compute_version(GLcontext *ctx)
{
GLuint major, minor;
static const int max = 100;
const GLboolean ver_1_3 = (ctx->Extensions.ARB_multisample &&
ctx->Extensions.ARB_multitexture &&
ctx->Extensions.ARB_texture_border_clamp &&
@ -85,31 +88,111 @@ compute_version(const GLcontext *ctx, GLuint *major, GLuint *minor)
ctx->Extensions.EXT_pixel_buffer_object &&
ctx->Extensions.EXT_texture_sRGB);
if (ver_2_1) {
*major = 2;
*minor = 1;
major = 2;
minor = 1;
}
else if (ver_2_0) {
*major = 2;
*minor = 0;
major = 2;
minor = 0;
}
else if (ver_1_5) {
*major = 1;
*minor = 5;
major = 1;
minor = 5;
}
else if (ver_1_4) {
*major = 1;
*minor = 4;
major = 1;
minor = 4;
}
else if (ver_1_3) {
*major = 1;
*minor = 3;
major = 1;
minor = 3;
}
else {
*major = 1;
*minor = 2;
major = 1;
minor = 2;
}
ctx->VersionMajor = major;
ctx->VersionMinor = minor;
ctx->VersionString = (char *) malloc(max);
if (ctx->VersionString) {
_mesa_snprintf(ctx->VersionString, max,
"%u.%u Mesa " MESA_VERSION_STRING,
ctx->VersionMajor, ctx->VersionMinor);
}
}
static void
compute_version_es1(GLcontext *ctx)
{
static const int max = 100;
/* OpenGL ES 1.0 is derived from OpenGL 1.3 */
const GLboolean ver_1_0 = (ctx->Extensions.ARB_multisample &&
ctx->Extensions.ARB_multitexture &&
ctx->Extensions.ARB_texture_compression &&
ctx->Extensions.EXT_texture_env_add &&
ctx->Extensions.ARB_texture_env_combine &&
ctx->Extensions.ARB_texture_env_dot3);
/* OpenGL ES 1.1 is derived from OpenGL 1.5 */
const GLboolean ver_1_1 = (ver_1_0 &&
ctx->Extensions.EXT_point_parameters &&
ctx->Extensions.SGIS_generate_mipmap &&
ctx->Extensions.ARB_vertex_buffer_object);
if (ver_1_1) {
ctx->VersionMajor = 1;
ctx->VersionMinor = 1;
} else if (ver_1_0) {
ctx->VersionMajor = 1;
ctx->VersionMinor = 0;
} else {
_mesa_problem(ctx, "Incomplete OpenGL ES 1.0 support.");
}
ctx->VersionString = (char *) malloc(max);
if (ctx->VersionString) {
_mesa_snprintf(ctx->VersionString, max,
"OpenGL ES-CM 1.%d Mesa " MESA_VERSION_STRING,
ctx->VersionMinor);
}
}
static void
compute_version_es2(GLcontext *ctx)
{
static const int max = 100;
/* OpenGL ES 2.0 is derived from OpenGL 2.0 */
const GLboolean ver_2_0 = (ctx->Extensions.ARB_multisample &&
ctx->Extensions.ARB_multitexture &&
ctx->Extensions.ARB_texture_compression &&
ctx->Extensions.ARB_texture_cube_map &&
ctx->Extensions.ARB_texture_mirrored_repeat &&
ctx->Extensions.EXT_blend_color &&
ctx->Extensions.EXT_blend_func_separate &&
ctx->Extensions.EXT_blend_minmax &&
ctx->Extensions.EXT_blend_subtract &&
ctx->Extensions.EXT_stencil_wrap &&
ctx->Extensions.ARB_vertex_buffer_object &&
ctx->Extensions.ARB_shader_objects &&
ctx->Extensions.ARB_vertex_shader &&
ctx->Extensions.ARB_fragment_shader &&
ctx->Extensions.ARB_texture_non_power_of_two &&
ctx->Extensions.EXT_blend_equation_separate);
if (ver_2_0) {
ctx->VersionMajor = 2;
ctx->VersionMinor = 0;
} else {
_mesa_problem(ctx, "Incomplete OpenGL ES 2.0 support.");
}
ctx->VersionString = (char *) malloc(max);
if (ctx->VersionString) {
_mesa_snprintf(ctx->VersionString, max,
"OpenGL ES 2.0 Mesa " MESA_VERSION_STRING);
}
}
/**
* Set the context's VersionMajor, VersionMinor, VersionString fields.
@ -118,13 +201,16 @@ compute_version(const GLcontext *ctx, GLuint *major, GLuint *minor)
void
_mesa_compute_version(GLcontext *ctx)
{
static const int max = 100;
compute_version(ctx, &ctx->VersionMajor, &ctx->VersionMinor);
ctx->VersionString = (char *) malloc(max);
if (ctx->VersionString) {
_mesa_snprintf(ctx->VersionString, max, "%u.%u Mesa " MESA_VERSION_STRING,
ctx->VersionMajor, ctx->VersionMinor);
switch (ctx->API) {
case API_OPENGL:
compute_version(ctx);
break;
case API_OPENGLES:
compute_version_es1(ctx);
break;
case API_OPENGLES2:
compute_version_es2(ctx);
break;
}
}

View file

@ -3,6 +3,8 @@
MAIN_SOURCES = \
main/api_arrayelt.c \
main/api_exec.c \
main/api_exec_es1.c \
main/api_exec_es2.c \
main/api_loopback.c \
main/api_noop.c \
main/api_validate.c \
@ -25,6 +27,7 @@ MAIN_SOURCES = \
main/dlist.c \
main/dlopen.c \
main/drawpix.c \
main/drawtex.c \
main/enable.c \
main/enums.c \
main/eval.c \
@ -37,6 +40,8 @@ MAIN_SOURCES = \
main/formats.c \
main/framebuffer.c \
main/get.c \
main/get_es1.c \
main/get_es2.c \
main/getstring.c \
main/hash.c \
main/hint.c \
@ -54,6 +59,7 @@ MAIN_SOURCES = \
main/points.c \
main/polygon.c \
main/queryobj.c \
main/querymatrix.c \
main/rastpos.c \
main/rbadaptors.c \
main/readpix.c \
@ -76,6 +82,7 @@ MAIN_SOURCES = \
main/texgetimage.c \
main/teximage.c \
main/texobj.c \
main/texpal.c \
main/texparam.c \
main/texrender.c \
main/texstate.c \
@ -199,6 +206,7 @@ STATETRACKER_SOURCES = \
state_tracker/st_cb_condrender.c \
state_tracker/st_cb_flush.c \
state_tracker/st_cb_drawpixels.c \
state_tracker/st_cb_drawtex.c \
state_tracker/st_cb_eglimage.c \
state_tracker/st_cb_fbo.c \
state_tracker/st_cb_feedback.c \

View file

@ -199,7 +199,16 @@ struct st_context *st_create_context(struct pipe_context *pipe,
memset(&funcs, 0, sizeof(funcs));
st_init_driver_functions(&funcs);
ctx = _mesa_create_context(visual, shareCtx, &funcs, NULL);
#if FEATURE_GL
ctx = _mesa_create_context_for_api(API_OPENGL,
visual, shareCtx, &funcs, NULL);
#elif FEATURE_ES1
ctx = _mesa_create_context_for_api(API_OPENGLES,
visual, shareCtx, &funcs, NULL);
#elif FEATURE_ES2
ctx = _mesa_create_context_for_api(API_OPENGLES2,
visual, shareCtx, &funcs, NULL);
#endif
/* XXX: need a capability bit in gallium to query if the pipe
* driver prefers DP4 or MUL/MAD for vertex transformation.

View file

@ -138,7 +138,31 @@ _vbo_MultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
void GLAPIENTRY
_vbo_Materialfv(GLenum face, GLenum pname, const GLfloat *params);
void GLAPIENTRY
_vbo_Materialf(GLenum face, GLenum pname, GLfloat param);
void GLAPIENTRY
_vbo_VertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
void GLAPIENTRY
_vbo_VertexAttrib1f(GLuint indx, GLfloat x);
void GLAPIENTRY
_vbo_VertexAttrib1fv(GLuint indx, const GLfloat* values);
void GLAPIENTRY
_vbo_VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
void GLAPIENTRY
_vbo_VertexAttrib2fv(GLuint indx, const GLfloat* values);
void GLAPIENTRY
_vbo_VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
void GLAPIENTRY
_vbo_VertexAttrib3fv(GLuint indx, const GLfloat* values);
void GLAPIENTRY
_vbo_VertexAttrib4fv(GLuint indx, const GLfloat* values);
#endif

View file

@ -958,6 +958,7 @@ _vbo_MultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
vbo_MultiTexCoord4f(target, s, t, r, q);
}
void GLAPIENTRY
_vbo_Materialfv(GLenum face, GLenum pname, const GLfloat *params)
{
@ -965,8 +966,64 @@ _vbo_Materialfv(GLenum face, GLenum pname, const GLfloat *params)
}
void GLAPIENTRY
_vbo_Materialf(GLenum face, GLenum pname, GLfloat param)
{
vbo_Materialfv(face, pname, &param);
}
void GLAPIENTRY
_vbo_VertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
vbo_VertexAttrib4fARB(index, x, y, z, w);
}
void GLAPIENTRY
_vbo_VertexAttrib1f(GLuint indx, GLfloat x)
{
vbo_VertexAttrib1fARB(indx, x);
}
void GLAPIENTRY
_vbo_VertexAttrib1fv(GLuint indx, const GLfloat* values)
{
vbo_VertexAttrib1fvARB(indx, values);
}
void GLAPIENTRY
_vbo_VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
{
vbo_VertexAttrib2fARB(indx, x, y);
}
void GLAPIENTRY
_vbo_VertexAttrib2fv(GLuint indx, const GLfloat* values)
{
vbo_VertexAttrib2fvARB(indx, values);
}
void GLAPIENTRY
_vbo_VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
{
vbo_VertexAttrib3fARB(indx, x, y, z);
}
void GLAPIENTRY
_vbo_VertexAttrib3fv(GLuint indx, const GLfloat* values)
{
vbo_VertexAttrib3fvARB(indx, values);
}
void GLAPIENTRY
_vbo_VertexAttrib4fv(GLuint indx, const GLfloat* values)
{
vbo_VertexAttrib4fvARB(indx, values);
}