aboutsummaryrefslogtreecommitdiff
path: root/mesalib
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-08-27 08:17:50 +0200
committermarha <marha@users.sourceforge.net>2012-09-04 14:23:00 +0200
commit02b914d3b9b658a16e17cf2d95deede75dbbacc9 (patch)
tree3757711ab3e1db8e1b59877354096503d9635112 /mesalib
parentf479a5fc7f844d96b169c399cb1e8ac085de6c2b (diff)
downloadvcxsrv-02b914d3b9b658a16e17cf2d95deede75dbbacc9.tar.gz
vcxsrv-02b914d3b9b658a16e17cf2d95deede75dbbacc9.tar.bz2
vcxsrv-02b914d3b9b658a16e17cf2d95deede75dbbacc9.zip
xwininfo fontconfig libX11 libXau libXext libxcb mesa pixman
xkeyboard-config git update 27 Aug 2012
Diffstat (limited to 'mesalib')
-rw-r--r--mesalib/Android.common.mk4
-rw-r--r--mesalib/configs/current.in1
-rw-r--r--mesalib/configs/default1
-rw-r--r--mesalib/configure.ac229
-rw-r--r--mesalib/docs/GL3.txt4
-rw-r--r--mesalib/include/GL/internal/dri_interface.h12
-rw-r--r--mesalib/src/glsl/Android.mk2
-rw-r--r--mesalib/src/glsl/link_uniforms.cpp2
-rw-r--r--mesalib/src/glu/Makefile2
-rw-r--r--mesalib/src/mapi/glapi/gen/Makefile.am16
-rw-r--r--mesalib/src/mapi/glapi/gen/glapi_gen.mk4
-rw-r--r--mesalib/src/mesa/Makefile.am19
-rw-r--r--mesalib/src/mesa/SConscript3
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c8
-rw-r--r--mesalib/src/mesa/drivers/dri/swrast/swrast.c3
-rw-r--r--mesalib/src/mesa/main/APIspec.xml717
-rw-r--r--mesalib/src/mesa/main/api_validate.c48
-rw-r--r--mesalib/src/mesa/main/bufferobj.c50
-rw-r--r--mesalib/src/mesa/main/dd.h18
-rw-r--r--mesalib/src/mesa/main/dlopen.c112
-rw-r--r--mesalib/src/mesa/main/dlopen.h83
-rw-r--r--mesalib/src/mesa/main/es1_conversion.c64
-rw-r--r--mesalib/src/mesa/main/extensions.c1
-rw-r--r--mesalib/src/mesa/main/ff_fragment_shader.cpp3
-rw-r--r--mesalib/src/mesa/main/glformats.c63
-rw-r--r--mesalib/src/mesa/main/glformats.h3
-rw-r--r--mesalib/src/mesa/main/mipmap.c3
-rw-r--r--mesalib/src/mesa/main/mtypes.h8
-rw-r--r--mesalib/src/mesa/main/queryobj.c37
-rw-r--r--mesalib/src/mesa/main/shaderapi.c92
-rw-r--r--mesalib/src/mesa/main/texcompress.c26
-rw-r--r--mesalib/src/mesa/main/texcompress.h2
-rw-r--r--mesalib/src/mesa/main/texcompress_cpal.c (renamed from mesalib/src/mesa/main/texpal.c)25
-rw-r--r--mesalib/src/mesa/main/texcompress_cpal.h (renamed from mesalib/src/mesa/main/texpal.h)6
-rw-r--r--mesalib/src/mesa/main/texcompress_rgtc.c100
-rw-r--r--mesalib/src/mesa/main/texcompress_rgtc.h32
-rw-r--r--mesalib/src/mesa/main/texcompress_s3tc.c60
-rw-r--r--mesalib/src/mesa/main/texcompress_s3tc.h32
-rw-r--r--mesalib/src/mesa/main/texformat.c42
-rw-r--r--mesalib/src/mesa/main/texformat.h4
-rw-r--r--mesalib/src/mesa/main/teximage.c1023
-rw-r--r--mesalib/src/mesa/main/teximage.h8
-rw-r--r--mesalib/src/mesa/main/texobj.c37
-rw-r--r--mesalib/src/mesa/main/texobj.h11
-rw-r--r--mesalib/src/mesa/main/texparam.c265
-rw-r--r--mesalib/src/mesa/main/texstorage.c5
-rw-r--r--mesalib/src/mesa/main/uniform_query.cpp3
-rw-r--r--mesalib/src/mesa/main/varray.c98
-rw-r--r--mesalib/src/mesa/sources.mak3
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.c10
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.h5
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_format.c12
-rw-r--r--mesalib/src/mesa/state_tracker/st_format.h3
-rw-r--r--mesalib/src/mesa/state_tracker/st_manager.c10
-rw-r--r--mesalib/src/mesa/swrast/s_texfetch.c96
-rw-r--r--mesalib/src/mesa/swrast/s_texfilter.c115
-rw-r--r--mesalib/src/mesa/swrast/s_texture.c5
59 files changed, 1682 insertions, 1972 deletions
diff --git a/mesalib/Android.common.mk b/mesalib/Android.common.mk
index e8b900697..1e9f040ac 100644
--- a/mesalib/Android.common.mk
+++ b/mesalib/Android.common.mk
@@ -47,7 +47,9 @@ LOCAL_CFLAGS += \
ifeq ($(strip $(MESA_ENABLE_ASM)),true)
ifeq ($(TARGET_ARCH),x86)
LOCAL_CFLAGS += \
- -DUSE_X86_ASM
+ -DUSE_X86_ASM \
+ -DHAVE_DLOPEN \
+
endif
endif
diff --git a/mesalib/configs/current.in b/mesalib/configs/current.in
index c49084210..1802271f9 100644
--- a/mesalib/configs/current.in
+++ b/mesalib/configs/current.in
@@ -105,7 +105,6 @@ GLAPI_LIB_GLOB = @GLAPI_LIB_GLOB@
# Directories to build
LIB_DIR = @LIB_DIR@
SRC_DIRS = @SRC_DIRS@
-GLU_DIRS = @GLU_DIRS@
DRIVER_DIRS = @DRIVER_DIRS@
GALLIUM_DIRS = @GALLIUM_DIRS@
GALLIUM_DRIVERS_DIRS = @GALLIUM_DRIVERS_DIRS@
diff --git a/mesalib/configs/default b/mesalib/configs/default
index ea026e632..1f167b58e 100644
--- a/mesalib/configs/default
+++ b/mesalib/configs/default
@@ -95,7 +95,6 @@ MOTIF_CFLAGS = -I/usr/include/Motif1.2
LIB_DIR = lib
SRC_DIRS = glsl mapi/glapi mapi/vgapi mesa \
gallium egl gallium/winsys gallium/targets glu
-GLU_DIRS = sgi
DRIVER_DIRS = x11 osmesa
# Gallium directories and
diff --git a/mesalib/configure.ac b/mesalib/configure.ac
index 7dac091b0..c30bcf05c 100644
--- a/mesalib/configure.ac
+++ b/mesalib/configure.ac
@@ -29,7 +29,7 @@ LT_INIT([disable-static])
dnl Versions for external dependencies
LIBDRM_REQUIRED=2.4.24
LIBDRM_RADEON_REQUIRED=2.4.38
-LIBDRM_INTEL_REQUIRED=2.4.37
+LIBDRM_INTEL_REQUIRED=2.4.38
LIBDRM_NVVIEUX_REQUIRED=2.4.33
LIBDRM_NOUVEAU_REQUIRED=2.4.33
DRI2PROTO_REQUIRED=2.6
@@ -55,7 +55,7 @@ fi
AC_PROG_YACC
AC_PATH_PROG([YACC_INST], $YACC)
-if test ! -f "$srcdir/src/glsl/glcpp/glcpp-parse.y"; then
+if test ! -f "$srcdir/src/glsl/glcpp/glcpp-parse.c"; then
if test -z "$YACC_INST"; then
AC_MSG_ERROR([yacc not found - unable to compile glcpp-parse.y])
fi
@@ -283,6 +283,8 @@ xnono )
;;
esac
+AM_CONDITIONAL(BUILD_SHARED, test "x$enable_shared" = xyes)
+
dnl
dnl mklib options
dnl
@@ -497,8 +499,9 @@ MESA_PIC_FLAGS
dnl Check to see if dlopen is in default libraries (like Solaris, which
dnl has it in libc), or if libdl is needed to get it.
-AC_CHECK_FUNC([dlopen], [],
- [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
+AC_CHECK_FUNC([dlopen], [DEFINES="$DEFINES -DHAVE_DLOPEN"],
+ [AC_CHECK_LIB([dl], [dlopen],
+ [DEFINES="$DEFINES -DHAVE_DLOPEN"; DLOPEN_LIBS="-ldl"])])
AC_SUBST([DLOPEN_LIBS])
dnl See if posix_memalign is available
@@ -543,19 +546,19 @@ AC_ARG_ENABLE([openvg],
AC_ARG_ENABLE([dri],
[AS_HELP_STRING([--enable-dri],
- [enable DRI modules @<:@default=auto@:>@])],
+ [enable DRI modules @<:@default=enabled@:>@])],
[enable_dri="$enableval"],
- [enable_dri=auto])
+ [enable_dri=yes])
AC_ARG_ENABLE([glx],
[AS_HELP_STRING([--enable-glx],
- [enable GLX library @<:@default=auto@:>@])],
+ [enable GLX library @<:@default=enabled@:>@])],
[enable_glx="$enableval"],
- [enable_glx=auto])
+ [enable_glx=yes])
AC_ARG_ENABLE([osmesa],
[AS_HELP_STRING([--enable-osmesa],
- [enable OSMesa library @<:@default=auto@:>@])],
+ [enable OSMesa library @<:@default=disabled@:>@])],
[enable_osmesa="$enableval"],
- [enable_osmesa=auto])
+ [enable_osmesa=no])
AC_ARG_ENABLE([egl],
[AS_HELP_STRING([--disable-egl],
[disable EGL library @<:@default=enabled@:>@])],
@@ -605,9 +608,9 @@ AC_ARG_ENABLE([opencl],
[enable_opencl=no])
AC_ARG_ENABLE([xlib_glx],
[AS_HELP_STRING([--enable-xlib-glx],
- [make GLX library Xlib-based instead of DRI-based @<:@default=disable@:>@])],
+ [make GLX library Xlib-based instead of DRI-based @<:@default=disabled@:>@])],
[enable_xlib_glx="$enableval"],
- [enable_xlib_glx=auto])
+ [enable_xlib_glx=no])
AC_ARG_ENABLE([gallium_egl],
[AS_HELP_STRING([--enable-gallium-egl],
[enable optional EGL state tracker (not required
@@ -681,123 +684,61 @@ if test "x$enable_gles2" = xyes; then
fi
AC_SUBST([API_DEFINES])
+if test "x$enable_glx" = xno; then
+ AC_MSG_WARN([GLX disabled, disabling Xlib-GLX])
+ enable_xlib_glx=no
+fi
+
+if test "x$enable_dri$enable_xlib_glx" = xyesyes; then
+ AC_MSG_ERROR([DRI and Xlib-GLX cannot be built together])
+fi
+
+# Disable GLX if DRI and Xlib-GLX are not enabled
+if test "x$enable_glx" = xyes -a \
+ "x$enable_dri" = xno -a \
+ "x$enable_xlib_glx" = xno; then
+ AC_MSG_WARN([Neither DRI nor Xlib-GLX enabled, disabling GLX])
+ enable_glx=no
+fi
+
+AM_CONDITIONAL(HAVE_DRI, test "x$enable_dri" = xyes)
+AM_CONDITIONAL(NEED_LIBMESA, test "x$enable_xlib_glx" = xyes -o \
+ "x$enable_osmesa" = xyes)
+
AC_ARG_ENABLE([shared-glapi],
[AS_HELP_STRING([--enable-shared-glapi],
[Enable shared glapi for OpenGL @<:@default=yes@:>@])],
[enable_shared_glapi="$enableval"],
- [enable_shared_glapi=yes])
+ [enable_shared_glapi="$enable_dri"])
+
+# Shared GLAPI is only useful for DRI
+if test "x$enable_dri" = xno; then
+ AC_MSG_NOTICE([Shared GLAPI is only useful for DRI, disabling])
+ enable_shared_glapi=no
+fi
+# TODO: Get rid of SHARED_GLAPI variable
SHARED_GLAPI="0"
if test "x$enable_shared_glapi" = xyes; then
SHARED_GLAPI="1"
# libGL will use libglapi for function lookups (IN_DRI_DRIVER means to use
# the remap table)
DEFINES="$DEFINES -DIN_DRI_DRIVER"
- SRC_DIRS="$SRC_DIRS mapi/shared-glapi"
+ CORE_DIRS="mapi/shared-glapi"
fi
AC_SUBST([SHARED_GLAPI])
-AM_CONDITIONAL(HAVE_SHARED_GLAPI, test $SHARED_GLAPI = 1)
-
-dnl
-dnl Driver configuration. Options are xlib, dri and osmesa right now.
-dnl More later: fbdev, ...
-dnl
-default_driver="xlib"
-
-case "$host_os" in
-linux*)
- default_driver="dri"
- ;;
-*freebsd* | dragonfly* | *netbsd*)
- case "$host_cpu" in
- i*86|x86_64|powerpc*|sparc*) default_driver="dri";;
- esac
- ;;
-esac
-
-if test "x$enable_opengl" = xno; then
- default_driver="no"
-fi
-
-AC_ARG_WITH([driver],
- [AS_HELP_STRING([--with-driver=DRIVER], [DEPRECATED])],
- [mesa_driver="$withval"],
- [mesa_driver=auto])
-dnl Check for valid option
-case "x$mesa_driver" in
-xxlib|xdri|xosmesa|xno)
- if test "x$enable_dri" != xauto -o \
- "x$enable_glx" != xauto -o \
- "x$enable_osmesa" != xauto -o \
- "x$enable_xlib_glx" != xauto; then
- AC_MSG_ERROR([--with-driver=$mesa_driver is deprecated])
- fi
- ;;
-xauto)
- mesa_driver="$default_driver"
- ;;
-*)
- AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
- ;;
-esac
-
-# map $mesa_driver to APIs
-if test "x$enable_dri" = xauto; then
- case "x$mesa_driver" in
- xdri) enable_dri=yes ;;
- *) enable_dri=no ;;
- esac
-fi
-
-if test "x$enable_glx" = xauto; then
- case "x$mesa_driver" in
- xdri|xxlib) enable_glx=yes ;;
- *) enable_glx=no ;;
- esac
-fi
-
-if test "x$enable_osmesa" = xauto; then
- case "x$mesa_driver" in
- xxlib|xosmesa) enable_osmesa=yes ;;
- *) enable_osmesa=no ;;
- esac
-fi
-
-if test "x$enable_xlib_glx" = xauto; then
- case "x$mesa_driver" in
- xxlib) enable_xlib_glx=yes ;;
- *) enable_xlib_glx=no ;;
- esac
-fi
-
-if test "x$enable_glx" = xno; then
- enable_xlib_glx=no
-fi
-
-AM_CONDITIONAL(HAVE_DRI, test x"$enable_dri" = xyes)
+AM_CONDITIONAL(HAVE_SHARED_GLAPI, test "x$enable_shared_glapi" = xyes)
dnl
dnl Driver specific build directories
dnl
-
-dnl this variable will be prepended to SRC_DIRS and is not exported
-CORE_DIRS=""
-
SRC_DIRS="gtest"
-GLU_DIRS="sgi"
GALLIUM_DIRS="auxiliary drivers state_trackers"
GALLIUM_TARGET_DIRS=""
GALLIUM_WINSYS_DIRS="sw"
GALLIUM_DRIVERS_DIRS="galahad trace rbug noop identity"
GALLIUM_STATE_TRACKERS_DIRS=""
-# build shared-glapi if enabled for OpenGL or if OpenGL ES is enabled
-case "x$enable_shared_glapi$enable_gles1$enable_gles2" in
-x*yes*)
- CORE_DIRS="$CORE_DIRS mapi/shared-glapi"
- ;;
-esac
-
# build glapi if OpenGL is enabled
if test "x$enable_opengl" = xyes; then
CORE_DIRS="$CORE_DIRS mapi/glapi"
@@ -847,7 +788,6 @@ if test "x$enable_osmesa" = xyes; then
fi
AC_SUBST([SRC_DIRS])
-AC_SUBST([GLU_DIRS])
AC_SUBST([DRIVER_DIRS])
AC_SUBST([GALLIUM_DIRS])
AC_SUBST([GALLIUM_TARGET_DIRS])
@@ -979,17 +919,8 @@ GLAPI_LIB_DEPS="-lpthread $SELINUX_LIBS"
AC_SUBST([GLAPI_LIB_DEPS])
-dnl dri libraries are linking with mesa
-DRI_LIB_DEPS='$(TOP)/src/mesa/libmesa.la'
-GALLIUM_DRI_LIB_DEPS='$(TOP)/src/mesa/libmesa.a'
-
-dnl ... or dricore?
-if test "x$enable_dri" = xyes && test "x$driglx_direct" = xyes ; then
- DRI_LIB_DEPS="\$(TOP)/src/mesa/libdricore/libdricore${VERSION}.la"
- GALLIUM_DRI_LIB_DEPS="\$(TOP)/\$(LIB_DIR)/libdricore${VERSION}.so"
- HAVE_DRICORE=yes
-fi
-AM_CONDITIONAL(HAVE_DRICORE, test x$HAVE_DRICORE = xyes)
+DRI_LIB_DEPS="\$(top_builddir)/src/mesa/libdricore/libdricore${VERSION}.la"
+GALLIUM_DRI_LIB_DEPS="\$(TOP)/\$(LIB_DIR)/libdricore${VERSION}.so"
AC_SUBST([HAVE_XF86VIDMODE])
@@ -1268,13 +1199,10 @@ if test "x$enable_osmesa" = xyes; then
OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
fi
-OSMESA_VERSION=`echo "$VERSION" | $SED 's/\./:/g'`
-
AC_SUBST([OSMESA_LIB_DEPS])
AC_SUBST([OSMESA_MESA_DEPS])
AC_SUBST([OSMESA_PC_REQ])
AC_SUBST([OSMESA_PC_LIB_PRIV])
-AC_SUBST([OSMESA_VERSION])
dnl
dnl gbm configuration
@@ -1295,9 +1223,11 @@ if test "x$enable_gbm" = xyes; then
if test "x$enable_dri" = xyes; then
GBM_BACKEND_DIRS="$GBM_BACKEND_DIRS dri"
- if test "$SHARED_GLAPI" -eq 0; then
+ if test "x$enable_shared_glapi" = xno; then
AC_MSG_ERROR([gbm_dri requires --enable-shared-glapi])
fi
+ PKG_CHECK_MODULES([LIBKMS], [libkms], [],
+ AC_MSG_ERROR([gbm needs libkms]))
fi
fi
GBM_PC_REQ_PRIV="libudev"
@@ -1439,6 +1369,8 @@ if test "x$enable_openvg" = xyes; then
CORE_DIRS="$CORE_DIRS mapi/vgapi"
GALLIUM_STATE_TRACKERS_DIRS="vega $GALLIUM_STATE_TRACKERS_DIRS"
HAVE_ST_VEGA=yes
+ VG_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
+ AC_SUBST([VG_PC_LIB_PRIV])
fi
dnl
@@ -1593,6 +1525,7 @@ dnl
if test "x$with_gallium_drivers" != x; then
SRC_DIRS="$SRC_DIRS gallium gallium/winsys gallium/targets"
fi
+AM_CONDITIONAL(HAVE_GALLIUM, test "x$with_gallium_drivers" != x)
AC_SUBST([LLVM_BINDIR])
AC_SUBST([LLVM_CFLAGS])
@@ -2048,12 +1981,15 @@ AM_CONDITIONAL(HAVE_GALLIUM_COMPUTE, test x$enable_opencl = xyes)
AC_SUBST([GALLIUM_MAKE_DIRS])
AM_CONDITIONAL(HAVE_X11_DRIVER, echo "$DRIVER_DIRS" | grep 'x11' >/dev/null 2>&1)
-AM_CONDITIONAL(HAVE_DRI_DRIVER, echo "$DRIVER_DIRS" | grep 'dri' >/dev/null 2>&1)
AM_CONDITIONAL(HAVE_X86_ASM, echo "$DEFINES" | grep 'X86_ASM' >/dev/null 2>&1)
AM_CONDITIONAL(HAVE_X86_64_ASM, echo "$DEFINES" | grep 'X86_64_ASM' >/dev/null 2>&1)
AM_CONDITIONAL(HAVE_SPARC_ASM, echo "$DEFINES" | grep 'SPARC_ASM' >/dev/null 2>&1)
+# To pass as an argument to libtool's -version-number flag
+VERSION_NUMBER=`echo "$VERSION" | $SED 's/\./:/g'`
+AC_SUBST([VERSION_NUMBER])
+
dnl prepend CORE_DIRS to SRC_DIRS
SRC_DIRS="$CORE_DIRS $SRC_DIRS"
@@ -2068,56 +2004,62 @@ CXXFLAGS="$CXXFLAGS $USER_CXXFLAGS"
dnl Substitute the config
AC_CONFIG_FILES([configs/current
Makefile
- src/Makefile
- src/gallium/Makefile
- src/gallium/auxiliary/pipe-loader/Makefile
- src/gallium/state_trackers/clover/Makefile
- src/gallium/drivers/Makefile
- src/gallium/drivers/r300/Makefile
- src/gallium/drivers/r600/Makefile
- src/gallium/targets/opencl/Makefile
- src/gbm/Makefile
- src/gbm/main/gbm.pc
+ src/egl/Makefile
src/egl/drivers/Makefile
src/egl/drivers/dri2/Makefile
src/egl/drivers/glx/Makefile
- src/egl/Makefile
src/egl/main/Makefile
src/egl/main/egl.pc
src/egl/wayland/Makefile
+ src/egl/wayland/wayland-drm/Makefile
src/egl/wayland/wayland-egl/Makefile
src/egl/wayland/wayland-egl/wayland-egl.pc
- src/egl/wayland/wayland-drm/Makefile
+ src/gallium/Makefile
+ src/gallium/auxiliary/pipe-loader/Makefile
+ src/gallium/drivers/Makefile
+ src/gallium/drivers/r300/Makefile
+ src/gallium/drivers/r600/Makefile
+ src/gallium/state_trackers/clover/Makefile
+ src/gallium/targets/opencl/Makefile
+ src/gbm/Makefile
+ src/gbm/main/gbm.pc
src/glsl/Makefile
src/glsl/glcpp/Makefile
src/glsl/tests/Makefile
src/glx/Makefile
src/glx/tests/Makefile
+ src/gtest/Makefile
+ src/Makefile
+ src/mapi/es1api/Makefile
+ src/mapi/es1api/glesv1_cm.pc
+ src/mapi/es2api/Makefile
+ src/mapi/es2api/glesv2.pc
src/mapi/glapi/Makefile
src/mapi/glapi/gen/Makefile
- src/mapi/shared-glapi/Makefile
src/mapi/glapi/tests/Makefile
+ src/mapi/shared-glapi/Makefile
src/mapi/shared-glapi/tests/Makefile
- src/gtest/Makefile
+ src/mapi/vgapi/Makefile
+ src/mapi/vgapi/vg.pc
src/mesa/Makefile
- src/mesa/libdricore/Makefile
- src/mesa/main/tests/Makefile
- src/mesa/x86/Makefile
- src/mesa/x86-64/Makefile
+ src/mesa/gl.pc
src/mesa/drivers/Makefile
src/mesa/drivers/dri/dri.pc
- src/mesa/drivers/dri/Makefile
src/mesa/drivers/dri/common/Makefile
src/mesa/drivers/dri/i915/Makefile
src/mesa/drivers/dri/i965/Makefile
+ src/mesa/drivers/dri/Makefile
src/mesa/drivers/dri/nouveau/Makefile
src/mesa/drivers/dri/r200/Makefile
src/mesa/drivers/dri/radeon/Makefile
src/mesa/drivers/dri/swrast/Makefile
src/mesa/drivers/osmesa/Makefile
+ src/mesa/drivers/osmesa/osmesa.pc
src/mesa/drivers/x11/Makefile
- src/mesa/gl.pc
- src/mesa/drivers/osmesa/osmesa.pc])
+ src/mesa/libdricore/Makefile
+ src/mesa/main/tests/Makefile
+ src/mesa/x86-64/Makefile
+ src/mesa/x86/Makefile])
dnl Sort the dirs alphabetically
GALLIUM_TARGET_DIRS=`echo $GALLIUM_TARGET_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
@@ -2224,6 +2166,7 @@ dnl Libraries
echo ""
echo " Shared libs: $enable_shared"
echo " Static libs: $enable_static"
+echo " Shared-glapi: $enable_shared_glapi"
dnl Compiler options
# cleanup the CFLAGS/CXXFLAGS/DEFINES vars
diff --git a/mesalib/docs/GL3.txt b/mesalib/docs/GL3.txt
index 246eb30a9..1d5528236 100644
--- a/mesalib/docs/GL3.txt
+++ b/mesalib/docs/GL3.txt
@@ -75,12 +75,12 @@ GL 3.3:
GLSL 3.30 new features in this version pretty much done
GL_ARB_blend_func_extended DONE (i965, r600, softpipe)
GL_ARB_explicit_attrib_location DONE (i915, i965, r300, r600, swrast)
-GL_ARB_occlusion_query2 DONE (r300, r600, swrast)
+GL_ARB_occlusion_query2 DONE (i965, r300, r600, swrast)
GL_ARB_sampler_objects DONE (i965, r300, r600)
GL_ARB_shader_bit_encoding DONE
GL_ARB_texture_rgb10_a2ui DONE (i965, r600)
GL_ARB_texture_swizzle DONE (same as EXT version) (i965, r300, r600, swrast)
-GL_ARB_timer_query DONE
+GL_ARB_timer_query DONE (i965)
GL_ARB_instanced_arrays DONE (i965, r300, r600)
GL_ARB_vertex_type_2_10_10_10_rev DONE (r600)
diff --git a/mesalib/include/GL/internal/dri_interface.h b/mesalib/include/GL/internal/dri_interface.h
index 865164306..a23d93ceb 100644
--- a/mesalib/include/GL/internal/dri_interface.h
+++ b/mesalib/include/GL/internal/dri_interface.h
@@ -939,8 +939,7 @@ struct __DRIdri2ExtensionRec {
#define __DRI_IMAGE_USE_SHARE 0x0001
#define __DRI_IMAGE_USE_SCANOUT 0x0002
-#define __DRI_IMAGE_USE_CURSOR 0x0004
-#define __DRI_IMAGE_USE_WRITE 0x0008
+#define __DRI_IMAGE_USE_CURSOR 0x0004 /* Depricated */
/**
* queryImage attributes
@@ -950,7 +949,7 @@ struct __DRIdri2ExtensionRec {
#define __DRI_IMAGE_ATTRIB_HANDLE 0x2001
#define __DRI_IMAGE_ATTRIB_NAME 0x2002
#define __DRI_IMAGE_ATTRIB_FORMAT 0x2003 /* available in versions 3+ */
-#define __DRI_IMAGE_ATTRIB_WIDTH 0x2004 /* available in versions 5+ */
+#define __DRI_IMAGE_ATTRIB_WIDTH 0x2004 /* available in versions 4+ */
#define __DRI_IMAGE_ATTRIB_HEIGHT 0x2005
typedef struct __DRIimageRec __DRIimage;
@@ -989,13 +988,6 @@ struct __DRIimageExtensionRec {
GLboolean (*validateUsage)(__DRIimage *image, unsigned int use);
/**
- * Write data into image.
- *
- * \since 4
- */
- int (*write)(__DRIimage *image, const void *buf, size_t count);
-
- /**
* Create an image out of a sub-region of a parent image. This
* entry point lets us create individual __DRIimages for different
* planes in a planar buffer (typically yuv), for example. While a
diff --git a/mesalib/src/glsl/Android.mk b/mesalib/src/glsl/Android.mk
index 66c8bec32..87a02f51b 100644
--- a/mesalib/src/glsl/Android.mk
+++ b/mesalib/src/glsl/Android.mk
@@ -25,9 +25,9 @@
LOCAL_PATH := $(call my-dir)
-GLSL_SRCDIR = .
include $(LOCAL_PATH)/Makefile.sources
+GLSL_SRCDIR = .
# ---------------------------------------
# Build libmesa_glsl
# ---------------------------------------
diff --git a/mesalib/src/glsl/link_uniforms.cpp b/mesalib/src/glsl/link_uniforms.cpp
index 27694b3f3..5d701e75e 100644
--- a/mesalib/src/glsl/link_uniforms.cpp
+++ b/mesalib/src/glsl/link_uniforms.cpp
@@ -313,7 +313,7 @@ private:
const gl_texture_index target = base_type->sampler_index();
const unsigned shadow = base_type->sampler_shadow;
for (unsigned i = this->uniforms[id].sampler
- ; i < this->next_sampler
+ ; i < MIN2(this->next_sampler, MAX_SAMPLERS)
; i++) {
this->targets[i] = target;
this->shader_samplers_used |= 1U << i;
diff --git a/mesalib/src/glu/Makefile b/mesalib/src/glu/Makefile
index b26826597..472645ffb 100644
--- a/mesalib/src/glu/Makefile
+++ b/mesalib/src/glu/Makefile
@@ -5,7 +5,7 @@ TOP = ../..
include $(TOP)/configs/current
-SUBDIRS = $(GLU_DIRS)
+SUBDIRS = sgi
default: $(TOP)/configs/current
diff --git a/mesalib/src/mapi/glapi/gen/Makefile.am b/mesalib/src/mapi/glapi/gen/Makefile.am
index 499ec09a8..40aaf51cd 100644
--- a/mesalib/src/mapi/glapi/gen/Makefile.am
+++ b/mesalib/src/mapi/glapi/gen/Makefile.am
@@ -38,10 +38,18 @@ MESA_GLAPI_OUTPUTS = \
$(MESA_GLAPI_DIR)/glapitable.h \
$(MESA_GLAPI_DIR)/glapi_gentable.c
-MESA_GLAPI_ASM_OUTPUTS = \
- $(MESA_GLAPI_DIR)/glapi_x86.S \
- $(MESA_GLAPI_DIR)/glapi_x86-64.S \
- $(MESA_GLAPI_DIR)/glapi_sparc.S
+MESA_GLAPI_ASM_OUTPUTS =
+if HAVE_X86_ASM
+MESA_GLAPI_ASM_OUTPUTS += $(MESA_GLAPI_DIR)/glapi_x86.S
+endif
+
+if HAVE_X86_64_ASM
+MESA_GLAPI_ASM_OUTPUTS += $(MESA_GLAPI_DIR)/glapi_x86-64.S
+endif
+
+if HAVE_SPARC_ASM
+MESA_GLAPI_ASM_OUTPUTS += $(MESA_GLAPI_DIR)/glapi_sparc.S
+endif
MESA_OUTPUTS = \
$(MESA_GLAPI_OUTPUTS) \
diff --git a/mesalib/src/mapi/glapi/gen/glapi_gen.mk b/mesalib/src/mapi/glapi/gen/glapi_gen.mk
index eab8eb40c..f65286fbd 100644
--- a/mesalib/src/mapi/glapi/gen/glapi_gen.mk
+++ b/mesalib/src/mapi/glapi/gen/glapi_gen.mk
@@ -1,9 +1,5 @@
# Helpers for glapi header generation
-ifndef top_srcdir
-$(error top_srcdir must be defined.)
-endif
-
glapi_gen_common_deps := \
$(wildcard $(top_srcdir)/src/mapi/glapi/gen/*.xml) \
$(wildcard $(top_srcdir)/src/mapi/glapi/gen/*.py)
diff --git a/mesalib/src/mesa/Makefile.am b/mesalib/src/mesa/Makefile.am
index f1cd6d67c..6964c8a68 100644
--- a/mesalib/src/mesa/Makefile.am
+++ b/mesalib/src/mesa/Makefile.am
@@ -39,6 +39,8 @@ main/git_sha1.h: main/git_sha1.h.tmp
@echo "updating main/git_sha1.h"
@if ! cmp -s main/git_sha1.h.tmp main/git_sha1.h; then \
mv main/git_sha1.h.tmp main/git_sha1.h ;\
+ else \
+ rm main/git_sha1.h.tmp ;\
fi
# include glapi_gen.mk for generating glapi headers for GLES
@@ -92,7 +94,15 @@ program/lex.yy.c: program/program_lexer.l
$(MKDIR_P) program
$(AM_V_GEN) $(LEX) --never-interactive --outfile=$@ $<
-noinst_LTLIBRARIES = libmesa.la libmesagallium.la
+noinst_LTLIBRARIES =
+if NEED_LIBMESA
+noinst_LTLIBRARIES += libmesa.la
+else
+check_LTLIBRARIES = libmesa.la
+endif
+if HAVE_GALLIUM
+noinst_LTLIBRARIES += libmesagallium.la
+endif
SRCDIR = $(top_srcdir)/src/mesa/
BUILDDIR = $(top_builddir)/src/mesa/
@@ -140,13 +150,14 @@ libmesagallium_la_SOURCES = \
libmesagallium_la_LIBADD = $(top_builddir)/src/glsl/libglsl.la
libmesagallium_la_LDFLAGS =
+if HAVE_GALLIUM
# Provide compatibility with scripts for the old Mesa build system for
# a while by putting a link to the library in the current directory.
-all-local: libmesa.la libmesagallium.la
- ln -f .libs/libmesa.a .
+all-local: $(noinst_LTLIBRARIES)
ln -f .libs/libmesagallium.a .
+endif
-CLEANFILES += libmesa.a libmesagallium.a
+CLEANFILES += libmesagallium.a
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = gl.pc
diff --git a/mesalib/src/mesa/SConscript b/mesalib/src/mesa/SConscript
index 1b98b04c1..e2064ce73 100644
--- a/mesalib/src/mesa/SConscript
+++ b/mesalib/src/mesa/SConscript
@@ -60,7 +60,6 @@ main_sources = [
'main/debug.c',
'main/depth.c',
'main/dlist.c',
- 'main/dlopen.c',
'main/drawpix.c',
'main/drawtex.c',
'main/enable.c',
@@ -116,6 +115,7 @@ main_sources = [
'main/stencil.c',
'main/syncobj.c',
'main/texcompress.c',
+ 'main/texcompress_cpal.c',
'main/texcompress_rgtc.c',
'main/texcompress_s3tc.c',
'main/texcompress_fxt1.c',
@@ -126,7 +126,6 @@ main_sources = [
'main/texgetimage.c',
'main/teximage.c',
'main/texobj.c',
- 'main/texpal.c',
'main/texparam.c',
'main/texstate.c',
'main/texstorage.c',
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index db49d90ea..7d7113c56 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -3010,7 +3010,10 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
_mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, mipmap->FBO);
- _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, GL_FALSE);
+ if (ctx->API == API_OPENGL || ctx->API == API_OPENGLES)
+ _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, GL_FALSE);
+ else
+ assert(!genMipmapSave);
if (ctx->Extensions.EXT_framebuffer_sRGB) {
_mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB_EXT, GL_FALSE);
@@ -3149,7 +3152,8 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
_mesa_meta_end(ctx);
_mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, maxLevelSave);
- _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, genMipmapSave);
+ if (genMipmapSave)
+ _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, genMipmapSave);
_mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboSave);
}
diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast.c b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
index 28177cbe0..d528804b4 100644
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c
+++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
@@ -637,13 +637,14 @@ viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
}
static gl_format swrastChooseTextureFormat(struct gl_context * ctx,
+ GLenum target,
GLint internalFormat,
GLenum format,
GLenum type)
{
if (internalFormat == GL_RGB)
return MESA_FORMAT_XRGB8888;
- return _mesa_choose_tex_format(ctx, internalFormat, format, type);
+ return _mesa_choose_tex_format(ctx, target, internalFormat, format, type);
}
static void
diff --git a/mesalib/src/mesa/main/APIspec.xml b/mesalib/src/mesa/main/APIspec.xml
index c26caf6ad..3121226ca 100644
--- a/mesalib/src/mesa/main/APIspec.xml
+++ b/mesalib/src/mesa/main/APIspec.xml
@@ -226,47 +226,6 @@
<param name="param" type="GLtype"/>
</vector>
</proto>
-
- <desc name="target">
- <value name="GL_TEXTURE_2D"/>
- <value name="GL_TEXTURE_CUBE_MAP" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_3D_OES" category="OES_texture_3D"/>
- <value name="GL_TEXTURE_EXTERNAL_OES" category="OES_EGL_image_external"/>
- </desc>
-
- <desc name="pname">
- <value name="GL_TEXTURE_WRAP_S"/>
- <value name="GL_TEXTURE_WRAP_T"/>
- <value name="GL_TEXTURE_WRAP_R_OES" category="OES_texture_3D"/>
-
- <desc name="param">
- <value name="GL_CLAMP_TO_EDGE"/>
- <value name="GL_REPEAT"/>
- <value name="GL_MIRRORED_REPEAT" category="GLES2.0"/>
- <value name="GL_MIRRORED_REPEAT_OES" category="OES_texture_mirrored_repeat"/>
- </desc>
- </desc>
-
- <desc name="pname">
- <value name="GL_TEXTURE_MIN_FILTER"/>
- <value name="GL_TEXTURE_MAG_FILTER"/>
- <value name="GL_TEXTURE_MAX_ANISOTROPY_EXT" category="EXT_texture_filter_anisotropic"/>
- </desc>
-
- <desc name="pname" category="GLES1.1">
- <value name="GL_GENERATE_MIPMAP"/>
-
- <desc name="param">
- <value name="GL_TRUE"/>
- <value name="GL_FALSE"/>
- </desc>
- </desc>
-
- <desc name="pname" category="OES_draw_texture">
- <value name="GL_TEXTURE_CROP_RECT_OES"/>
- <desc name="params" vector_size="4"/>
- </desc>
</template>
<template name="TexImage2D">
@@ -282,168 +241,6 @@
<param name="type" type="GLenum"/>
<param name="pixels" type="const GLvoid *"/>
</proto>
-
- <desc name="target">
- <value name="GL_TEXTURE_2D"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" category="OES_texture_cube_map"/>
- </desc>
-
- <desc name="internalFormat">
- <value name="GL_ALPHA"/>
-
- <desc name="format" error="GL_INVALID_VALUE">
- <value name="GL_ALPHA"/>
- </desc>
- </desc>
-
- <desc name="internalFormat">
- <value name="GL_RGB"/>
-
- <desc name="format" error="GL_INVALID_VALUE">
- <value name="GL_RGB"/>
- </desc>
- </desc>
-
- <desc name="internalFormat">
- <value name="GL_RGBA"/>
-
- <desc name="format" error="GL_INVALID_VALUE">
- <value name="GL_RGBA"/>
- </desc>
- </desc>
-
- <desc name="internalFormat">
- <value name="GL_LUMINANCE"/>
-
- <desc name="format" error="GL_INVALID_VALUE">
- <value name="GL_LUMINANCE"/>
- </desc>
- </desc>
-
- <desc name="internalFormat">
- <value name="GL_LUMINANCE_ALPHA"/>
-
- <desc name="format" error="GL_INVALID_VALUE">
- <value name="GL_LUMINANCE_ALPHA"/>
- </desc>
- </desc>
-
- <desc name="internalFormat" category="OES_depth_texture">
- <value name="GL_DEPTH_COMPONENT"/>
-
- <desc name="format" error="GL_INVALID_VALUE">
- <value name="GL_DEPTH_COMPONENT"/>
- </desc>
- </desc>
-
- <desc name="internalFormat" category="OES_packed_depth_stencil">
- <value name="GL_DEPTH_STENCIL_OES"/>
-
- <desc name="format" error="GL_INVALID_VALUE">
- <value name="GL_DEPTH_STENCIL_OES"/>
- </desc>
- </desc>
-
- <desc name="internalFormat" category="EXT_texture_format_BGRA8888">
- <value name="GL_BGRA_EXT"/>
-
- <desc name="format" error="GL_INVALID_VALUE">
- <value name="GL_BGRA_EXT"/>
- </desc>
- </desc>
-
- <desc name="border" error="GL_INVALID_VALUE">
- <value name="0"/>
- </desc>
-
- <desc name="format">
- <value name="GL_ALPHA"/>
-
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- <value name="GL_FLOAT" category="OES_texture_float"/>
- <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
- </desc>
- </desc>
-
- <desc name="format">
- <value name="GL_RGB"/>
-
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- <value name="GL_UNSIGNED_SHORT_5_6_5"/>
- <value name="GL_FLOAT" category="OES_texture_float"/>
- <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
- </desc>
- </desc>
-
- <desc name="format">
- <value name="GL_RGBA"/>
-
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- <value name="GL_UNSIGNED_SHORT_4_4_4_4"/>
- <value name="GL_UNSIGNED_SHORT_5_5_5_1"/>
- <value name="GL_FLOAT" category="OES_texture_float"/>
- <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
- <value name="GL_UNSIGNED_INT_2_10_10_10_REV_EXT" category="EXT_texture_type_2_10_10_10_REV"/>
- </desc>
- </desc>
-
- <desc name="format">
- <value name="GL_LUMINANCE"/>
-
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- <value name="GL_FLOAT" category="OES_texture_float"/>
- <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
- </desc>
- </desc>
-
- <desc name="format">
- <value name="GL_LUMINANCE_ALPHA"/>
-
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- <value name="GL_FLOAT" category="OES_texture_float"/>
- <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
- </desc>
- </desc>
-
- <desc name="format" category="OES_depth_texture">
- <value name="GL_DEPTH_COMPONENT"/>
-
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_SHORT"/>
- <value name="GL_UNSIGNED_INT"/>
- </desc>
- </desc>
-
- <desc name="format" category="OES_packed_depth_stencil">
- <value name="GL_DEPTH_STENCIL_OES"/>
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_INT_24_8_OES"/>
- </desc>
- </desc>
-
- <desc name="format" category="EXT_texture_format_BGRA8888">
- <value name="GL_BGRA_EXT"/>
-
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- </desc>
- </desc>
</template>
<template name="TexEnv">
@@ -1231,30 +1028,6 @@
<param name="pname" type="GLenum"/>
<vector name="params" type="GLtype *" size="dynamic"/>
</proto>
-
- <desc name="target">
- <value name="GL_TEXTURE_2D"/>
- <value name="GL_TEXTURE_CUBE_MAP" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_3D_OES" category="OES_texture_3D"/>
- <value name="GL_TEXTURE_EXTERNAL_OES" category="OES_EGL_image_external"/>
- </desc>
-
- <desc name="pname">
- <value name="GL_TEXTURE_WRAP_S"/>
- <value name="GL_TEXTURE_WRAP_T"/>
- <value name="GL_TEXTURE_WRAP_R_OES" category="OES_texture_3D"/>
- <value name="GL_TEXTURE_MIN_FILTER"/>
- <value name="GL_TEXTURE_MAG_FILTER"/>
- <value name="GL_GENERATE_MIPMAP" category="GLES1.1"/>
-
- <desc name="params" vector_size="1" convert="false"/>
- </desc>
-
- <desc name="pname" category="OES_draw_texture">
- <value name="GL_TEXTURE_CROP_RECT_OES"/>
- <desc name="params" vector_size="4"/>
- </desc>
</template>
<template name="IsEnabled" direction="get">
@@ -1445,17 +1218,6 @@
<param name="stride" type="GLsizei"/>
<param name="pointer" type="const GLvoid *"/>
</proto>
-
- <desc name="size" error="GL_INVALID_VALUE">
- <value name="4"/>
- </desc>
-
- <desc name="type">
- <value name="GL_UNSIGNED_BYTE"/>
- <value name="GL_FLOAT"/>
- <value name="GL_FIXED"/>
- <value name="GL_HALF_FLOAT_OES" category="OES_vertex_half_float"/>
- </desc>
</template>
<template name="DisableClientState">
@@ -1567,14 +1329,6 @@
<param name="stride" type="GLsizei"/>
<param name="pointer" type="const GLvoid *"/>
</proto>
-
- <desc name="type">
- <value name="GL_BYTE"/>
- <value name="GL_SHORT"/>
- <value name="GL_FLOAT"/>
- <value name="GL_FIXED"/>
- <value name="GL_HALF_FLOAT_OES" category="OES_vertex_half_float"/>
- </desc>
</template>
<template name="TexCoordPointer">
@@ -1585,20 +1339,6 @@
<param name="stride" type="GLsizei"/>
<param name="pointer" type="const GLvoid *"/>
</proto>
-
- <desc name="size" error="GL_INVALID_VALUE">
- <value name="2"/>
- <value name="3"/>
- <value name="4"/>
- </desc>
-
- <desc name="type">
- <value name="GL_BYTE"/>
- <value name="GL_SHORT"/>
- <value name="GL_FLOAT"/>
- <value name="GL_FIXED"/>
- <value name="GL_HALF_FLOAT_OES" category="OES_vertex_half_float"/>
- </desc>
</template>
<template name="VertexPointer">
@@ -1609,20 +1349,6 @@
<param name="stride" type="GLsizei"/>
<param name="pointer" type="const GLvoid *"/>
</proto>
-
- <desc name="size" error="GL_INVALID_VALUE">
- <value name="2"/>
- <value name="3"/>
- <value name="4"/>
- </desc>
-
- <desc name="type">
- <value name="GL_BYTE"/>
- <value name="GL_SHORT"/>
- <value name="GL_FLOAT"/>
- <value name="GL_FIXED"/>
- <value name="GL_HALF_FLOAT_OES" category="OES_vertex_half_float"/>
- </desc>
</template>
<template name="PolygonOffset">
@@ -1645,34 +1371,6 @@
<param name="height" type="GLsizei"/>
<param name="border" type="GLint"/>
</proto>
-
- <desc name="target">
- <value name="GL_TEXTURE_2D"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" category="OES_texture_cube_map"/>
- </desc>
-
- <desc name="internalFormat" error="GL_INVALID_VALUE">
- <value name="GL_ALPHA"/>
- <value name="GL_RGB"/>
- <value name="GL_RGBA"/>
- <value name="GL_LUMINANCE"/>
- <value name="GL_LUMINANCE_ALPHA"/>
- </desc>
-
- <desc name="border" error="GL_INVALID_VALUE">
- <value name="0"/>
- </desc>
</template>
<template name="CopyTexSubImage2D">
@@ -1687,22 +1385,6 @@
<param name="width" type="GLsizei"/>
<param name="height" type="GLsizei"/>
</proto>
-
- <desc name="target">
- <value name="GL_TEXTURE_2D"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" category="OES_texture_cube_map"/>
- </desc>
</template>
<template name="TexSubImage2D">
@@ -1718,101 +1400,6 @@
<param name="type" type="GLenum"/>
<param name="pixels" type="const GLvoid *"/>
</proto>
-
- <desc name="target">
- <value name="GL_TEXTURE_2D"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" category="OES_texture_cube_map"/>
- </desc>
-
- <desc name="format">
- <value name="GL_ALPHA"/>
-
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- <value name="GL_FLOAT" category="OES_texture_float"/>
- <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
- </desc>
- </desc>
-
- <desc name="format">
- <value name="GL_RGB"/>
-
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- <value name="GL_UNSIGNED_SHORT_5_6_5"/>
- <value name="GL_FLOAT" category="OES_texture_float"/>
- <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
- </desc>
- </desc>
-
- <desc name="format">
- <value name="GL_RGBA"/>
-
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- <value name="GL_UNSIGNED_SHORT_4_4_4_4"/>
- <value name="GL_UNSIGNED_SHORT_5_5_5_1"/>
- <value name="GL_FLOAT" category="OES_texture_float"/>
- <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
- <value name="GL_UNSIGNED_INT_2_10_10_10_REV_EXT" category="EXT_texture_type_2_10_10_10_REV"/>
- </desc>
- </desc>
-
- <desc name="format">
- <value name="GL_LUMINANCE"/>
-
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- <value name="GL_FLOAT" category="OES_texture_float"/>
- <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
- </desc>
- </desc>
-
- <desc name="format">
- <value name="GL_LUMINANCE_ALPHA"/>
-
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- <value name="GL_FLOAT" category="OES_texture_float"/>
- <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
- </desc>
- </desc>
-
- <desc name="format" category="OES_depth_texture">
- <value name="GL_DEPTH_COMPONENT"/>
-
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_SHORT"/>
- <value name="GL_UNSIGNED_INT"/>
- </desc>
- </desc>
-
- <desc name="format" category="OES_packed_depth_stencil">
- <value name="GL_DEPTH_STENCIL_OES"/>
-
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_INT_24_8_OES"/>
- </desc>
- </desc>
-
- <desc name="format" category="EXT_texture_format_BGRA8888">
- <value name="GL_BGRA_EXT"/>
-
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- </desc>
- </desc>
</template>
<template name="BindTexture">
@@ -1821,14 +1408,6 @@
<param name="target" type="GLenum"/>
<param name="texture" type="GLuint"/>
</proto>
-
- <desc name="target">
- <value name="GL_TEXTURE_2D"/>
- <value name="GL_TEXTURE_CUBE_MAP" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_3D_OES" category="OES_texture_3D"/>
- <value name="GL_TEXTURE_EXTERNAL_OES" category="OES_EGL_image_external"/>
- </desc>
</template>
<template name="DeleteTextures">
@@ -1894,71 +1473,6 @@
<param name="pixels" type="const GLvoid *"/>
</proto>
- <desc name="target">
- <value name="GL_TEXTURE_3D_OES"/>
- </desc>
-
- <desc name="internalFormat">
- <value name="GL_ALPHA"/>
- <value name="GL_RGB"/>
- <value name="GL_RGBA"/>
- <value name="GL_LUMINANCE"/>
- <value name="GL_LUMINANCE_ALPHA"/>
- </desc>
-
- <desc name="format">
- <value name="GL_ALPHA"/>
-
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- <value name="GL_FLOAT" category="OES_texture_float"/>
- <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
- </desc>
- </desc>
-
- <desc name="format">
- <value name="GL_RGB"/>
-
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- <value name="GL_UNSIGNED_SHORT_5_6_5"/>
- <value name="GL_FLOAT" category="OES_texture_float"/>
- <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
- </desc>
- </desc>
-
- <desc name="format">
- <value name="GL_RGBA"/>
-
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- <value name="GL_UNSIGNED_SHORT_4_4_4_4"/>
- <value name="GL_UNSIGNED_SHORT_5_5_5_1"/>
- <value name="GL_FLOAT" category="OES_texture_float"/>
- <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
- <value name="GL_UNSIGNED_INT_2_10_10_10_REV_EXT" category="EXT_texture_type_2_10_10_10_REV"/>
- </desc>
- </desc>
-
- <desc name="format">
- <value name="GL_LUMINANCE"/>
-
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- <value name="GL_FLOAT" category="OES_texture_float"/>
- <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
- </desc>
- </desc>
-
- <desc name="format">
- <value name="GL_LUMINANCE_ALPHA"/>
-
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- <value name="GL_FLOAT" category="OES_texture_float"/>
- <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
- </desc>
- </desc>
</template>
<template name="TexSubImage3D">
@@ -1976,64 +1490,6 @@
<param name="type" type="GLenum"/>
<param name="pixels" type="const GLvoid *"/>
</proto>
-
- <desc name="target">
- <value name="GL_TEXTURE_3D_OES"/>
- </desc>
-
- <desc name="format">
- <value name="GL_ALPHA"/>
-
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- <value name="GL_FLOAT" category="OES_texture_float"/>
- <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
- </desc>
- </desc>
-
- <desc name="format">
- <value name="GL_RGB"/>
-
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- <value name="GL_UNSIGNED_SHORT_5_6_5"/>
- <value name="GL_FLOAT" category="OES_texture_float"/>
- <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
- </desc>
- </desc>
-
- <desc name="format">
- <value name="GL_RGBA"/>
-
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- <value name="GL_UNSIGNED_SHORT_4_4_4_4"/>
- <value name="GL_UNSIGNED_SHORT_5_5_5_1"/>
- <value name="GL_FLOAT" category="OES_texture_float"/>
- <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
- <value name="GL_UNSIGNED_INT_2_10_10_10_REV_EXT" category="EXT_texture_type_2_10_10_10_REV"/>
- </desc>
- </desc>
-
- <desc name="format">
- <value name="GL_LUMINANCE"/>
-
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- <value name="GL_FLOAT" category="OES_texture_float"/>
- <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
- </desc>
- </desc>
-
- <desc name="format">
- <value name="GL_LUMINANCE_ALPHA"/>
-
- <desc name="type" error="GL_INVALID_OPERATION">
- <value name="GL_UNSIGNED_BYTE"/>
- <value name="GL_FLOAT" category="OES_texture_float"/>
- <value name="GL_HALF_FLOAT_OES" category="OES_texture_half_float"/>
- </desc>
- </desc>
</template>
<template name="CopyTexSubImage3D">
@@ -2049,10 +1505,6 @@
<param name="width" type="GLsizei"/>
<param name="height" type="GLsizei"/>
</proto>
-
- <desc name="target">
- <value name="GL_TEXTURE_3D_OES"/>
- </desc>
</template>
<template name="MultiTexCoord">
@@ -2081,10 +1533,6 @@
<param name="imagesize" type="GLsizei"/>
<param name="data" type="const GLvoid *"/>
</proto>
-
- <desc name="target">
- <value name="GL_TEXTURE_3D_OES"/>
- </desc>
</template>
<template name="CompressedTexSubImage3D">
@@ -2102,10 +1550,6 @@
<param name="imagesize" type="GLsizei"/>
<param name="data" type="const GLvoid *"/>
</proto>
-
- <desc name="target">
- <value name="GL_TEXTURE_3D_OES"/>
- </desc>
</template>
<template name="ActiveTexture">
@@ -2142,40 +1586,6 @@
<param name="imageSize" type="GLsizei"/>
<param name="data" type="const GLvoid *"/>
</proto>
-
- <desc name="target">
- <value name="GL_TEXTURE_2D"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" category="OES_texture_cube_map"/>
- </desc>
-
- <desc name="internalFormat">
- <value name="GL_ETC1_RGB8_OES" category="OES_compressed_ETC1_RGB8_texture"/>
-
- <value name="GL_PALETTE4_RGB8_OES" category="OES_compressed_paletted_texture"/>
- <value name="GL_PALETTE4_RGBA8_OES" category="OES_compressed_paletted_texture"/>
- <value name="GL_PALETTE4_R5_G6_B5_OES" category="OES_compressed_paletted_texture"/>
- <value name="GL_PALETTE4_RGBA4_OES" category="OES_compressed_paletted_texture"/>
- <value name="GL_PALETTE4_RGB5_A1_OES" category="OES_compressed_paletted_texture"/>
- <value name="GL_PALETTE8_RGB8_OES" category="OES_compressed_paletted_texture"/>
- <value name="GL_PALETTE8_RGBA8_OES" category="OES_compressed_paletted_texture"/>
- <value name="GL_PALETTE8_R5_G6_B5_OES" category="OES_compressed_paletted_texture"/>
- <value name="GL_PALETTE8_RGBA4_OES" category="OES_compressed_paletted_texture"/>
- <value name="GL_PALETTE8_RGB5_A1_OES" category="OES_compressed_paletted_texture"/>
-
- <value name="GL_COMPRESSED_RGB_S3TC_DXT1_EXT" category="EXT_texture_compression_dxt1"/>
- <value name="GL_COMPRESSED_RGBA_S3TC_DXT1_EXT" category="EXT_texture_compression_dxt1"/>
- </desc>
</template>
<template name="CompressedTexSubImage2D">
@@ -2191,27 +1601,6 @@
<param name="imageSize" type="GLsizei"/>
<param name="data" type="const GLvoid *"/>
</proto>
-
- <desc name="target">
- <value name="GL_TEXTURE_2D"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z" category="GLES2.0"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES" category="OES_texture_cube_map"/>
- <value name="GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES" category="OES_texture_cube_map"/>
- </desc>
-
- <desc name="format">
- <value name="GL_COMPRESSED_RGB_S3TC_DXT1_EXT" category="EXT_texture_compression_dxt1"/>
- <value name="GL_COMPRESSED_RGBA_S3TC_DXT1_EXT" category="EXT_texture_compression_dxt1"/>
- </desc>
</template>
<template name="BlendFuncSeparate">
@@ -2344,35 +1733,6 @@
<param name="stride" type="GLsizei"/>
<param name="pointer" type="const GLvoid *"/>
</proto>
-
- <desc name="size" error="GL_INVALID_VALUE">
- <value name="1"/>
- <value name="2"/>
- <value name="3"/>
- <value name="4"/>
- </desc>
-
- <desc name="type" error="GL_INVALID_VALUE">
- <value name="GL_BYTE"/>
- <value name="GL_UNSIGNED_BYTE"/>
- <value name="GL_SHORT"/>
- <value name="GL_UNSIGNED_SHORT"/>
- <value name="GL_FLOAT"/>
- <value name="GL_FIXED"/>
- <value name="GL_HALF_FLOAT_OES" category="OES_vertex_half_float"/>
- <value name="GL_UNSIGNED_INT_10_10_10_2_OES" category="OES_vertex_type_10_10_10_2"/>
- <value name="GL_INT_10_10_10_2_OES" category="OES_vertex_type_10_10_10_2"/>
- </desc>
-
- <desc name="type" category="OES_vertex_type_10_10_10_2">
- <value name="GL_UNSIGNED_INT_10_10_10_2_OES"/>
- <value name="GL_INT_10_10_10_2_OES"/>
-
- <desc name="size">
- <value name="3"/>
- <value name="4"/>
- </desc>
- </desc>
</template>
<template name="EnableVertexAttribArray">
@@ -2403,21 +1763,6 @@
<param name="pname" type="GLenum"/>
<vector name="params" type="GLtype *" size="dynamic"/>
</proto>
-
- <desc name="pname">
- <value name="GL_DELETE_STATUS"/>
- <value name="GL_LINK_STATUS"/>
- <value name="GL_VALIDATE_STATUS"/>
- <value name="GL_INFO_LOG_LENGTH"/>
- <value name="GL_ATTACHED_SHADERS"/>
- <value name="GL_ACTIVE_ATTRIBUTES"/>
- <value name="GL_ACTIVE_ATTRIBUTE_MAX_LENGTH"/>
- <value name="GL_ACTIVE_UNIFORMS"/>
- <value name="GL_ACTIVE_UNIFORM_MAX_LENGTH"/>
- <value name="GL_PROGRAM_BINARY_LENGTH_OES" category="OES_get_program_binary"/>
-
- <desc name="params" convert="false"/>
- </desc>
</template>
<template name="GetVertexAttrib" direction="get">
@@ -2461,11 +1806,6 @@
<param name="pname" type="GLenum"/>
<vector name="params" type="GLvoid **" size="dynamic"/>
</proto>
-
- <desc name="target">
- <value name="GL_ARRAY_BUFFER"/>
- <value name="GL_ELEMENT_ARRAY_BUFFER"/>
- </desc>
</template>
<template name="MapBuffer" direction="get">
@@ -2474,15 +1814,6 @@
<param name="target" type="GLenum"/>
<param name="access" type="GLenum"/>
</proto>
-
- <desc name="target">
- <value name="GL_ARRAY_BUFFER"/>
- <value name="GL_ELEMENT_ARRAY_BUFFER"/>
- </desc>
-
- <desc name="access">
- <value name="GL_WRITE_ONLY_OES"/>
- </desc>
</template>
<template name="UnmapBuffer" direction="get">
@@ -2490,11 +1821,6 @@
<return type="GLboolean"/>
<param name="target" type="GLenum"/>
</proto>
-
- <desc name="target">
- <value name="GL_ARRAY_BUFFER"/>
- <value name="GL_ELEMENT_ARRAY_BUFFER"/>
- </desc>
</template>
<template name="BindBuffer">
@@ -2503,11 +1829,6 @@
<param name="target" type="GLenum"/>
<param name="buffer" type="GLuint"/>
</proto>
-
- <desc name="target">
- <value name="GL_ARRAY_BUFFER"/>
- <value name="GL_ELEMENT_ARRAY_BUFFER"/>
- </desc>
</template>
<template name="BufferData">
@@ -2518,17 +1839,6 @@
<param name="data" type="const GLvoid *"/>
<param name="usage" type="GLenum"/>
</proto>
-
- <desc name="target">
- <value name="GL_ARRAY_BUFFER"/>
- <value name="GL_ELEMENT_ARRAY_BUFFER"/>
- </desc>
-
- <desc name="usage">
- <value name="GL_STATIC_DRAW"/>
- <value name="GL_DYNAMIC_DRAW"/>
- <value name="GL_STREAM_DRAW" category="GLES2.0"/>
- </desc>
</template>
<template name="BufferSubData">
@@ -2539,11 +1849,6 @@
<param name="size" type="GLsizeiptr"/>
<param name="data" type="const GLvoid *"/>
</proto>
-
- <desc name="target">
- <value name="GL_ARRAY_BUFFER"/>
- <value name="GL_ELEMENT_ARRAY_BUFFER"/>
- </desc>
</template>
<template name="DeleteBuffers">
@@ -2569,18 +1874,6 @@
<param name="pname" type="GLenum"/>
<vector name="params" type="GLtype *" size="dynamic"/>
</proto>
-
- <desc name="target">
- <value name="GL_ARRAY_BUFFER"/>
- <value name="GL_ELEMENT_ARRAY_BUFFER"/>
- </desc>
-
- <desc name="pname">
- <value name="GL_BUFFER_SIZE"/>
- <value name="GL_BUFFER_USAGE"/>
- <value name="GL_BUFFER_ACCESS_OES" category="OES_mapbuffer"/>
- <value name="GL_BUFFER_MAPPED_OES" category="OES_mapbuffer"/>
- </desc>
</template>
<template name="IsBuffer" direction="get">
@@ -2595,11 +1888,6 @@
<return type="GLuint"/>
<param name="type" type="GLenum"/>
</proto>
-
- <desc name="type">
- <value name="GL_VERTEX_SHADER"/>
- <value name="GL_FRAGMENT_SHADER"/>
- </desc>
</template>
<template name="ShaderSource">
@@ -3140,11 +2428,6 @@
<param name="target" type="GLenum"/>
<param name="image" type="GLeglImageOES"/>
</proto>
-
- <desc name="target">
- <value name="GL_TEXTURE_2D"/>
- <value name="GL_TEXTURE_EXTERNAL_OES" category="OES_EGL_image_external"/>
- </desc>
</template>
<template name="EGLImageTargetRenderbufferStorage">
diff --git a/mesalib/src/mesa/main/api_validate.c b/mesalib/src/mesa/main/api_validate.c
index eaf614bdc..b15dfba73 100644
--- a/mesalib/src/mesa/main/api_validate.c
+++ b/mesalib/src/mesa/main/api_validate.c
@@ -31,6 +31,7 @@
#include "mtypes.h"
#include "enums.h"
#include "vbo/vbo.h"
+#include <stdbool.h>
/**
@@ -262,6 +263,26 @@ _mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name)
return GL_TRUE;
}
+/**
+ * Verify that the element type is valid.
+ *
+ * Generates \c GL_INVALID_ENUM and returns \c false if it is not.
+ */
+static bool
+valid_elements_type(struct gl_context *ctx, GLenum type, const char *name)
+{
+ switch (type) {
+ case GL_UNSIGNED_BYTE:
+ case GL_UNSIGNED_SHORT:
+ case GL_UNSIGNED_INT:
+ return true;
+
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s(type = %s)", name,
+ _mesa_lookup_enum_by_nr(type));
+ return false;
+ }
+}
/**
* Error checking for glDrawElements(). Includes parameter checking
@@ -286,13 +307,8 @@ _mesa_validate_DrawElements(struct gl_context *ctx,
return GL_FALSE;
}
- if (type != GL_UNSIGNED_INT &&
- type != GL_UNSIGNED_BYTE &&
- type != GL_UNSIGNED_SHORT)
- {
- _mesa_error(ctx, GL_INVALID_ENUM, "glDrawElements(type)" );
+ if (!valid_elements_type(ctx, type, "glDrawElements"))
return GL_FALSE;
- }
if (!check_valid_to_render(ctx, "glDrawElements"))
return GL_FALSE;
@@ -348,13 +364,8 @@ _mesa_validate_MultiDrawElements(struct gl_context *ctx,
return GL_FALSE;
}
- if (type != GL_UNSIGNED_INT &&
- type != GL_UNSIGNED_BYTE &&
- type != GL_UNSIGNED_SHORT)
- {
- _mesa_error(ctx, GL_INVALID_ENUM, "glMultiDrawElements(type)" );
+ if (!valid_elements_type(ctx, type, "glMultiDrawElements"))
return GL_FALSE;
- }
if (!check_valid_to_render(ctx, "glMultiDrawElements"))
return GL_FALSE;
@@ -419,12 +430,8 @@ _mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode,
return GL_FALSE;
}
- if (type != GL_UNSIGNED_INT &&
- type != GL_UNSIGNED_BYTE &&
- type != GL_UNSIGNED_SHORT) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glDrawRangeElements(type)" );
+ if (!valid_elements_type(ctx, type, "glDrawRangeElements"))
return GL_FALSE;
- }
if (!check_valid_to_render(ctx, "glDrawRangeElements"))
return GL_FALSE;
@@ -548,13 +555,8 @@ _mesa_validate_DrawElementsInstanced(struct gl_context *ctx,
return GL_FALSE;
}
- if (type != GL_UNSIGNED_INT &&
- type != GL_UNSIGNED_BYTE &&
- type != GL_UNSIGNED_SHORT) {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glDrawElementsInstanced(type=0x%x)", type);
+ if (!valid_elements_type(ctx, type, "glDrawElementsInstanced"))
return GL_FALSE;
- }
if (numInstances <= 0) {
if (numInstances < 0)
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index 90f8b8bf2..2d406f9bb 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -30,7 +30,7 @@
* \author Brian Paul, Ian Romanick
*/
-
+#include <stdbool.h>
#include "glheader.h"
#include "enums.h"
#include "hash.h"
@@ -68,6 +68,12 @@ static struct gl_buffer_object DummyBufferObject;
static inline struct gl_buffer_object **
get_buffer_target(struct gl_context *ctx, GLenum target)
{
+ /* Other targets are only supported in desktop OpenGL and OpenGL ES 3.0.
+ */
+ if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx)
+ && target != GL_ARRAY_BUFFER && target != GL_ELEMENT_ARRAY_BUFFER)
+ return NULL;
+
switch (target) {
case GL_ARRAY_BUFFER_ARB:
return &ctx->Array.ArrayBufferObj;
@@ -89,7 +95,8 @@ get_buffer_target(struct gl_context *ctx, GLenum target)
break;
#endif
case GL_TEXTURE_BUFFER:
- if (ctx->Extensions.ARB_texture_buffer_object) {
+ if (_mesa_is_desktop_gl(ctx)
+ && ctx->Extensions.ARB_texture_buffer_object) {
return &ctx->Texture.BufferObject;
}
break;
@@ -1002,6 +1009,7 @@ _mesa_BufferDataARB(GLenum target, GLsizeiptrARB size,
{
GET_CURRENT_CONTEXT(ctx);
struct gl_buffer_object *bufObj;
+ bool valid_usage;
ASSERT_OUTSIDE_BEGIN_END(ctx);
if (MESA_VERBOSE & VERBOSE_API)
@@ -1017,18 +1025,30 @@ _mesa_BufferDataARB(GLenum target, GLsizeiptrARB size,
switch (usage) {
case GL_STREAM_DRAW_ARB:
+ valid_usage = (ctx->API != API_OPENGLES);
+ break;
+
+ case GL_STATIC_DRAW_ARB:
+ case GL_DYNAMIC_DRAW_ARB:
+ valid_usage = true;
+ break;
+
case GL_STREAM_READ_ARB:
case GL_STREAM_COPY_ARB:
- case GL_STATIC_DRAW_ARB:
case GL_STATIC_READ_ARB:
case GL_STATIC_COPY_ARB:
- case GL_DYNAMIC_DRAW_ARB:
case GL_DYNAMIC_READ_ARB:
case GL_DYNAMIC_COPY_ARB:
- /* OK */
+ valid_usage = _mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx);
break;
+
default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glBufferDataARB(usage)");
+ valid_usage = false;
+ break;
+ }
+
+ if (!valid_usage) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBufferData(usage)");
return;
}
@@ -1115,20 +1135,29 @@ _mesa_MapBufferARB(GLenum target, GLenum access)
struct gl_buffer_object * bufObj;
GLbitfield accessFlags;
void *map;
+ bool valid_access;
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, NULL);
switch (access) {
case GL_READ_ONLY_ARB:
accessFlags = GL_MAP_READ_BIT;
+ valid_access = _mesa_is_desktop_gl(ctx);
break;
case GL_WRITE_ONLY_ARB:
accessFlags = GL_MAP_WRITE_BIT;
+ valid_access = true;
break;
case GL_READ_WRITE_ARB:
accessFlags = GL_MAP_READ_BIT | GL_MAP_WRITE_BIT;
+ valid_access = _mesa_is_desktop_gl(ctx);
break;
default:
+ valid_access = false;
+ break;
+ }
+
+ if (!valid_access) {
_mesa_error(ctx, GL_INVALID_ENUM, "glMapBufferARB(access)");
return NULL;
}
@@ -1282,17 +1311,20 @@ _mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params)
*params = _mesa_bufferobj_mapped(bufObj);
return;
case GL_BUFFER_ACCESS_FLAGS:
- if (!ctx->Extensions.ARB_map_buffer_range)
+ if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_map_buffer_range)
+ && !_mesa_is_gles3(ctx))
goto invalid_pname;
*params = bufObj->AccessFlags;
return;
case GL_BUFFER_MAP_OFFSET:
- if (!ctx->Extensions.ARB_map_buffer_range)
+ if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_map_buffer_range)
+ && !_mesa_is_gles3(ctx))
goto invalid_pname;
*params = (GLint) bufObj->Offset;
return;
case GL_BUFFER_MAP_LENGTH:
- if (!ctx->Extensions.ARB_map_buffer_range)
+ if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_map_buffer_range)
+ && !_mesa_is_gles3(ctx))
goto invalid_pname;
*params = (GLint) bufObj->Length;
return;
diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h
index 226897b19..e6a1e68cb 100644
--- a/mesalib/src/mesa/main/dd.h
+++ b/mesalib/src/mesa/main/dd.h
@@ -189,12 +189,15 @@ struct dd_function_table {
/*@{*/
/**
- * Choose actual hardware texture format given the user-provided source
- * image format and type and the desired internal format. In some
- * cases, srcFormat and srcType can be GL_NONE.
+ * Choose actual hardware texture format given the texture target, the
+ * user-provided source image format and type and the desired internal
+ * format. In some cases, srcFormat and srcType can be GL_NONE.
+ * Note: target may be GL_TEXTURE_CUBE_MAP, but never
+ * GL_TEXTURE_CUBE_MAP_[POSITIVE/NEGATIVE]_[XYZ].
* Called by glTexImage(), etc.
*/
- gl_format (*ChooseTextureFormat)( struct gl_context *ctx, GLint internalFormat,
+ gl_format (*ChooseTextureFormat)( struct gl_context *ctx,
+ GLenum target, GLint internalFormat,
GLenum srcFormat, GLenum srcType );
/**
@@ -396,6 +399,13 @@ struct dd_function_table {
GLboolean (*ProgramStringNotify)(struct gl_context *ctx, GLenum target,
struct gl_program *prog);
+ /**
+ * Notify driver that the sampler uniforms for the current program have
+ * changed. On some drivers, this may require shader recompiles.
+ */
+ void (*SamplerUniformChange)(struct gl_context *ctx, GLenum target,
+ struct gl_program *prog);
+
/** Query if program can be loaded onto hardware */
GLboolean (*IsProgramNative)(struct gl_context *ctx, GLenum target,
struct gl_program *prog);
diff --git a/mesalib/src/mesa/main/dlopen.c b/mesalib/src/mesa/main/dlopen.c
deleted file mode 100644
index 62d9023a9..000000000
--- a/mesalib/src/mesa/main/dlopen.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Mesa 3-D graphics library
- *
- * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-/**
- * Wrapper functions for dlopen(), dlsym(), dlclose().
- * Note that the #ifdef tests for various environments should be expanded.
- */
-
-
-#include "compiler.h"
-#include "dlopen.h"
-
-#if defined(_GNU_SOURCE) && !defined(__MINGW32__) && !defined(__blrts)
-#include <dlfcn.h>
-#endif
-#if defined(_WIN32)
-#include <windows.h>
-#endif
-
-
-/**
- * Wrapper for dlopen().
- * Note that 'flags' isn't used at this time.
- */
-void *
-_mesa_dlopen(const char *libname, int flags)
-{
-#if defined(__blrts)
- return NULL;
-#elif defined(_GNU_SOURCE)
- flags = RTLD_LAZY | RTLD_GLOBAL; /* Overriding flags at this time */
- return dlopen(libname, flags);
-#elif defined(__MINGW32__) | defined(_MSC_VER)
- return LoadLibraryA(libname);
-#else
- return NULL;
-#endif
-}
-
-
-/**
- * Wrapper for dlsym() that does a cast to a generic function type,
- * rather than a void *. This reduces the number of warnings that are
- * generated.
- */
-GenericFunc
-_mesa_dlsym(void *handle, const char *fname)
-{
- union {
- void *v;
- GenericFunc f;
- } u;
-#if defined(__blrts)
- u.v = NULL;
-#elif defined(__DJGPP__)
- /* need '_' prefix on symbol names */
- char fname2[1000];
- fname2[0] = '_';
- strncpy(fname2 + 1, fname, 998);
- fname2[999] = 0;
- u.v = dlsym(handle, fname2);
-#elif defined(_GNU_SOURCE)
- u.v = dlsym(handle, fname);
-#elif defined(__MINGW32__) | defined(_MSC_VER)
- u.v = (void *) GetProcAddress(handle, fname);
-#else
- u.v = NULL;
-#endif
- return u.f;
-}
-
-
-/**
- * Wrapper for dlclose().
- */
-void
-_mesa_dlclose(void *handle)
-{
-#if defined(__blrts)
- (void) handle;
-#elif defined(_GNU_SOURCE)
- dlclose(handle);
-#elif defined(__MINGW32__) | defined(_MSC_VER)
- FreeLibrary(handle);
-#else
- (void) handle;
-#endif
-}
-
-
-
diff --git a/mesalib/src/mesa/main/dlopen.h b/mesalib/src/mesa/main/dlopen.h
index 9895a2254..a5366a14e 100644
--- a/mesalib/src/mesa/main/dlopen.h
+++ b/mesalib/src/mesa/main/dlopen.h
@@ -25,18 +25,85 @@
#ifndef DLOPEN_H
#define DLOPEN_H
+/**
+ * Wrapper functions for dlopen(), dlsym(), dlclose().
+ * Note that the #ifdef tests for various environments should be expanded.
+ */
-typedef void (*GenericFunc)(void);
-
+#if defined(HAVE_DLOPEN)
+#include <dlfcn.h>
+#endif
+#if defined(_WIN32)
+#include <windows.h>
+#endif
-extern void *
-_mesa_dlopen(const char *libname, int flags);
+typedef void (*GenericFunc)(void);
-extern GenericFunc
-_mesa_dlsym(void *handle, const char *fname);
+/**
+ * Wrapper for dlopen().
+ * Note that 'flags' isn't used at this time.
+ */
+static inline void *
+_mesa_dlopen(const char *libname, int flags)
+{
+#if defined(__blrts)
+ return NULL;
+#elif defined(HAVE_DLOPEN)
+ flags = RTLD_LAZY | RTLD_GLOBAL; /* Overriding flags at this time */
+ return dlopen(libname, flags);
+#elif defined(__MINGW32__)
+ return LoadLibraryA(libname);
+#else
+ return NULL;
+#endif
+}
-extern void
-_mesa_dlclose(void *handle);
+/**
+ * Wrapper for dlsym() that does a cast to a generic function type,
+ * rather than a void *. This reduces the number of warnings that are
+ * generated.
+ */
+static inline GenericFunc
+_mesa_dlsym(void *handle, const char *fname)
+{
+ union {
+ void *v;
+ GenericFunc f;
+ } u;
+#if defined(__blrts)
+ u.v = NULL;
+#elif defined(__DJGPP__)
+ /* need '_' prefix on symbol names */
+ char fname2[1000];
+ fname2[0] = '_';
+ strncpy(fname2 + 1, fname, 998);
+ fname2[999] = 0;
+ u.v = dlsym(handle, fname2);
+#elif defined(HAVE_DLOPEN)
+ u.v = dlsym(handle, fname);
+#elif defined(__MINGW32__)
+ u.v = (void *) GetProcAddress(handle, fname);
+#else
+ u.v = NULL;
+#endif
+ return u.f;
+}
+/**
+ * Wrapper for dlclose().
+ */
+static inline void
+_mesa_dlclose(void *handle)
+{
+#if defined(__blrts)
+ (void) handle;
+#elif defined(HAVE_DLOPEN)
+ dlclose(handle);
+#elif defined(__MINGW32__)
+ FreeLibrary(handle);
+#else
+ (void) handle;
+#endif
+}
#endif
diff --git a/mesalib/src/mesa/main/es1_conversion.c b/mesalib/src/mesa/main/es1_conversion.c
index ebd1e889f..75cdfc887 100644
--- a/mesalib/src/mesa/main/es1_conversion.c
+++ b/mesalib/src/mesa/main/es1_conversion.c
@@ -1237,56 +1237,11 @@ _check_TexGenxvOES(GLenum coord, GLenum pname, const GLfixed *params)
void GL_APIENTRY
_es_TexParameterx(GLenum target, GLenum pname, GLfixed param)
{
- GLfloat converted_param;
- bool convert_param_value = true;
-
- switch(target) {
- case GL_TEXTURE_2D:
- case GL_TEXTURE_CUBE_MAP:
- case GL_TEXTURE_EXTERNAL_OES:
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexParameterx(target=0x%x)", target);
- return;
- }
- switch(pname) {
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- if (param != GL_CLAMP_TO_EDGE && param != GL_REPEAT && param != GL_MIRRORED_REPEAT) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexParameterx(pname=0x%x)", pname);
- return;
- }
- convert_param_value = false;
- break;
- case GL_TEXTURE_MIN_FILTER:
- case GL_TEXTURE_MAG_FILTER:
- convert_param_value = false;
- break;
- case GL_GENERATE_MIPMAP:
- if (param != GL_TRUE && param != GL_FALSE) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexParameterx(pname=0x%x)", pname);
- return;
- }
- convert_param_value = false;
- break;
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- break;
- default:
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexParameterx(pname=0x%x)", pname);
- return;
- }
-
- if (convert_param_value) {
- converted_param = (GLfloat) (param / 65536.0f);
+ if (pname == GL_TEXTURE_MAX_ANISOTROPY_EXT) {
+ _mesa_TexParameterf(target, pname, (GLfloat) (param / 65536.0f));
} else {
- converted_param = (GLfloat) param;
+ _mesa_TexParameterf(target, pname, (GLfloat) param);
}
-
- _mesa_TexParameterf(target, pname, converted_param);
}
void GL_APIENTRY
@@ -1310,25 +1265,12 @@ _es_TexParameterxv(GLenum target, GLenum pname, const GLfixed *params)
switch(pname) {
case GL_TEXTURE_WRAP_S:
case GL_TEXTURE_WRAP_T:
- if (params[0] != GL_CLAMP_TO_EDGE && params[0] != GL_REPEAT && params[0] != GL_MIRRORED_REPEAT) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexParameterxv(pname=0x%x)", pname);
- return;
- }
convert_params_value = false;
n_params = 1;
break;
case GL_TEXTURE_MIN_FILTER:
case GL_TEXTURE_MAG_FILTER:
- convert_params_value = false;
- n_params = 1;
- break;
case GL_GENERATE_MIPMAP:
- if (params[0] != GL_TRUE && params[0] != GL_FALSE) {
- _mesa_error(_mesa_get_current_context(), GL_INVALID_ENUM,
- "glTexParameterxv(pname=0x%x)", pname);
- return;
- }
convert_params_value = false;
n_params = 1;
break;
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index 9e357cd09..ab33ac565 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -275,6 +275,7 @@ static const struct extension extension_table[] = {
{ "GL_AMD_shader_stencil_export", o(ARB_shader_stencil_export), GL, 2009 },
{ "GL_APPLE_object_purgeable", o(APPLE_object_purgeable), GL, 2006 },
{ "GL_APPLE_packed_pixels", o(APPLE_packed_pixels), GLL, 2002 },
+ { "GL_APPLE_texture_max_level", o(dummy_true), ES1 | ES2, 2009 },
{ "GL_APPLE_vertex_array_object", o(APPLE_vertex_array_object), GLL, 2002 },
{ "GL_ATI_blend_equation_separate", o(EXT_blend_equation_separate), GL, 2003 },
{ "GL_ATI_draw_buffers", o(dummy_true), GLL, 2002 },
diff --git a/mesalib/src/mesa/main/ff_fragment_shader.cpp b/mesalib/src/mesa/main/ff_fragment_shader.cpp
index f743ce109..e850d47dd 100644
--- a/mesalib/src/mesa/main/ff_fragment_shader.cpp
+++ b/mesalib/src/mesa/main/ff_fragment_shader.cpp
@@ -1363,7 +1363,8 @@ create_new_program(struct gl_context *ctx, struct state_key *key)
_mesa_associate_uniform_storage(ctx, p.shader_program, fp->Parameters);
_mesa_update_shader_textures_used(p.shader_program, fp);
- (void) ctx->Driver.ProgramStringNotify(ctx, fp->Target, fp);
+ if (ctx->Driver.SamplerUniformChange)
+ ctx->Driver.SamplerUniformChange(ctx, fp->Target, fp);
if (!p.shader_program->LinkStatus)
_mesa_problem(ctx, "Failed to link fixed function fragment shader: %s\n",
diff --git a/mesalib/src/mesa/main/glformats.c b/mesalib/src/mesa/main/glformats.c
index daf1b7667..2d06cb715 100644
--- a/mesalib/src/mesa/main/glformats.c
+++ b/mesalib/src/mesa/main/glformats.c
@@ -790,37 +790,45 @@ _mesa_is_compressed_format(struct gl_context *ctx, GLenum format)
switch (format) {
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ return ctx->Extensions.EXT_texture_compression_s3tc;
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- return ctx->Extensions.EXT_texture_compression_s3tc;
+ return _mesa_is_desktop_gl(ctx)
+ && ctx->Extensions.EXT_texture_compression_s3tc;
case GL_RGB_S3TC:
case GL_RGB4_S3TC:
case GL_RGBA_S3TC:
case GL_RGBA4_S3TC:
- return ctx->Extensions.S3_s3tc;
+ return _mesa_is_desktop_gl(ctx) && ctx->Extensions.S3_s3tc;
case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
- return ctx->Extensions.EXT_texture_sRGB
+ return _mesa_is_desktop_gl(ctx)
+ && ctx->Extensions.EXT_texture_sRGB
&& ctx->Extensions.EXT_texture_compression_s3tc;
case GL_COMPRESSED_RGB_FXT1_3DFX:
case GL_COMPRESSED_RGBA_FXT1_3DFX:
- return ctx->Extensions.TDFX_texture_compression_FXT1;
+ return _mesa_is_desktop_gl(ctx)
+ && ctx->Extensions.TDFX_texture_compression_FXT1;
case GL_COMPRESSED_RED_RGTC1:
case GL_COMPRESSED_SIGNED_RED_RGTC1:
case GL_COMPRESSED_RG_RGTC2:
case GL_COMPRESSED_SIGNED_RG_RGTC2:
- return ctx->Extensions.ARB_texture_compression_rgtc;
+ return _mesa_is_desktop_gl(ctx)
+ && ctx->Extensions.ARB_texture_compression_rgtc;
case GL_COMPRESSED_LUMINANCE_LATC1_EXT:
case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT:
case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT:
- return ctx->Extensions.EXT_texture_compression_latc;
+ return ctx->API == API_OPENGL
+ && ctx->Extensions.EXT_texture_compression_latc;
case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI:
- return ctx->Extensions.ATI_texture_compression_3dc;
+ return ctx->API == API_OPENGL
+ && ctx->Extensions.ATI_texture_compression_3dc;
case GL_ETC1_RGB8_OES:
- return ctx->Extensions.OES_compressed_ETC1_RGB8_texture;
+ return _mesa_is_gles(ctx)
+ && ctx->Extensions.OES_compressed_ETC1_RGB8_texture;
#if FEATURE_ES
case GL_PALETTE4_RGB8_OES:
case GL_PALETTE4_RGBA8_OES:
@@ -963,6 +971,45 @@ _mesa_base_format_has_channel(GLenum base_format, GLenum pname)
/**
+ * If format is a generic compressed format, return the corresponding
+ * non-compressed format. For other formats, return the format as-is.
+ */
+GLenum
+_mesa_generic_compressed_format_to_uncompressed_format(GLenum format)
+{
+ switch (format) {
+ case GL_COMPRESSED_RED:
+ return GL_RED;
+ case GL_COMPRESSED_RG:
+ return GL_RG;
+ case GL_COMPRESSED_RGB:
+ return GL_RGB;
+ case GL_COMPRESSED_RGBA:
+ return GL_RGBA;
+ case GL_COMPRESSED_ALPHA:
+ return GL_ALPHA;
+ case GL_COMPRESSED_LUMINANCE:
+ return GL_LUMINANCE;
+ case GL_COMPRESSED_LUMINANCE_ALPHA:
+ return GL_LUMINANCE_ALPHA;
+ case GL_COMPRESSED_INTENSITY:
+ return GL_INTENSITY;
+ /* sRGB formats */
+ case GL_COMPRESSED_SRGB:
+ return GL_SRGB;
+ case GL_COMPRESSED_SRGB_ALPHA:
+ return GL_SRGB_ALPHA;
+ case GL_COMPRESSED_SLUMINANCE:
+ return GL_SLUMINANCE;
+ case GL_COMPRESSED_SLUMINANCE_ALPHA:
+ return GL_SLUMINANCE_ALPHA;
+ default:
+ return format;
+ }
+}
+
+
+/**
* Do error checking of format/type combinations for glReadPixels,
* glDrawPixels and glTex[Sub]Image. Note that depending on the format
* and type values, we may either generate GL_INVALID_OPERATION or
diff --git a/mesalib/src/mesa/main/glformats.h b/mesalib/src/mesa/main/glformats.h
index d553eae0a..24fbda991 100644
--- a/mesalib/src/mesa/main/glformats.h
+++ b/mesalib/src/mesa/main/glformats.h
@@ -92,6 +92,9 @@ extern GLboolean
_mesa_base_format_has_channel(GLenum base_format, GLenum pname);
extern GLenum
+_mesa_generic_compressed_format_to_uncompressed_format(GLenum format);
+
+extern GLenum
_mesa_error_check_format_and_type(const struct gl_context *ctx,
GLenum format, GLenum type);
diff --git a/mesalib/src/mesa/main/mipmap.c b/mesalib/src/mesa/main/mipmap.c
index 00d3e8f9e..15373ba69 100644
--- a/mesalib/src/mesa/main/mipmap.c
+++ b/mesalib/src/mesa/main/mipmap.c
@@ -33,6 +33,7 @@
#include "mipmap.h"
#include "mtypes.h"
#include "teximage.h"
+#include "texobj.h"
#include "texstore.h"
#include "image.h"
#include "macros.h"
@@ -1817,7 +1818,7 @@ _mesa_prepare_mipmap_level(struct gl_context *ctx,
GLsizei width, GLsizei height, GLsizei depth,
GLsizei border, GLenum intFormat, gl_format format)
{
- const GLuint numFaces = texObj->Target == GL_TEXTURE_CUBE_MAP ? 6 : 1;
+ const GLuint numFaces = _mesa_num_tex_faces(texObj->Target);
GLuint face;
if (texObj->Immutable) {
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 552c1cf69..58111a737 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -2820,6 +2820,14 @@ struct gl_constants
GLuint MaxProgramMatrices;
GLuint MaxProgramMatrixStackDepth;
+ struct {
+ GLuint SamplesPassed;
+ GLuint TimeElapsed;
+ GLuint Timestamp;
+ GLuint PrimitivesGenerated;
+ GLuint PrimitivesWritten;
+ } QueryCounterBits;
+
/** vertex array / buffer object bounds checking */
GLboolean CheckArrayBounds;
diff --git a/mesalib/src/mesa/main/queryobj.c b/mesalib/src/mesa/main/queryobj.c
index a578aa594..d5e2453e6 100644
--- a/mesalib/src/mesa/main/queryobj.c
+++ b/mesalib/src/mesa/main/queryobj.c
@@ -482,7 +482,36 @@ _mesa_GetQueryIndexediv(GLenum target, GLuint index, GLenum pname,
switch (pname) {
case GL_QUERY_COUNTER_BITS_ARB:
- *params = 8 * sizeof(q->Result);
+ switch (target) {
+ case GL_SAMPLES_PASSED:
+ *params = ctx->Const.QueryCounterBits.SamplesPassed;
+ break;
+ case GL_ANY_SAMPLES_PASSED:
+ /* The minimum value of this is 1 if it's nonzero, and the value
+ * is only ever GL_TRUE or GL_FALSE, so no sense in reporting more
+ * bits.
+ */
+ *params = 1;
+ break;
+ case GL_TIME_ELAPSED:
+ *params = ctx->Const.QueryCounterBits.TimeElapsed;
+ break;
+ case GL_TIMESTAMP:
+ *params = ctx->Const.QueryCounterBits.Timestamp;
+ break;
+ case GL_PRIMITIVES_GENERATED:
+ *params = ctx->Const.QueryCounterBits.PrimitivesGenerated;
+ break;
+ case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
+ *params = ctx->Const.QueryCounterBits.PrimitivesWritten;
+ break;
+ default:
+ _mesa_problem(ctx,
+ "Unknown target in glGetQueryIndexediv(target = %s)",
+ _mesa_lookup_enum_by_nr(target));
+ *params = 0;
+ break;
+ }
break;
case GL_CURRENT_QUERY_ARB:
*params = q ? q->Id : 0;
@@ -716,6 +745,12 @@ _mesa_init_queryobj(struct gl_context *ctx)
{
ctx->Query.QueryObjects = _mesa_NewHashTable();
ctx->Query.CurrentOcclusionObject = NULL;
+
+ ctx->Const.QueryCounterBits.SamplesPassed = 64;
+ ctx->Const.QueryCounterBits.TimeElapsed = 64;
+ ctx->Const.QueryCounterBits.Timestamp = 64;
+ ctx->Const.QueryCounterBits.PrimitivesGenerated = 64;
+ ctx->Const.QueryCounterBits.PrimitivesWritten = 64;
}
diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c
index caeb9657e..d6acade3d 100644
--- a/mesalib/src/mesa/main/shaderapi.c
+++ b/mesalib/src/mesa/main/shaderapi.c
@@ -177,7 +177,7 @@ validate_shader_target(const struct gl_context *ctx, GLenum type)
#endif
#if FEATURE_ARB_geometry_shader4
case GL_GEOMETRY_SHADER_ARB:
- return ctx->Extensions.ARB_geometry_shader4;
+ return _mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_geometry_shader4;
#endif
default:
return false;
@@ -473,6 +473,29 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param
struct gl_shader_program *shProg
= _mesa_lookup_shader_program(ctx, program);
+#if FEATURE_EXT_transform_feedback
+ /* Is transform feedback available in this context?
+ */
+ const bool has_xfb =
+ (ctx->API == API_OPENGL && ctx->Extensions.EXT_transform_feedback)
+ || ctx->API == API_OPENGL_CORE
+ || _mesa_is_gles3(ctx);
+#endif
+
+#if FEATURE_ARB_geometry_shader4
+ /* Are geometry shaders available in this context?
+ */
+ const bool has_gs =
+ _mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_geometry_shader4;
+#endif
+
+ /* Are uniform buffer objects available in this context?
+ */
+ const bool has_ubo =
+ (ctx->API == API_OPENGL && ctx->Extensions.ARB_uniform_buffer_object)
+ || ctx->API == API_OPENGL_CORE
+ || _mesa_is_gles3(ctx);
+
if (!shProg) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramiv(program)");
return;
@@ -481,28 +504,28 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param
switch (pname) {
case GL_DELETE_STATUS:
*params = shProg->DeletePending;
- break;
+ return;
case GL_LINK_STATUS:
*params = shProg->LinkStatus;
- break;
+ return;
case GL_VALIDATE_STATUS:
*params = shProg->Validated;
- break;
+ return;
case GL_INFO_LOG_LENGTH:
*params = shProg->InfoLog ? strlen(shProg->InfoLog) + 1 : 0;
- break;
+ return;
case GL_ATTACHED_SHADERS:
*params = shProg->NumShaders;
- break;
+ return;
case GL_ACTIVE_ATTRIBUTES:
*params = _mesa_count_active_attribs(shProg);
- break;
+ return;
case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH:
*params = _mesa_longest_attribute_name_length(shProg);
- break;
+ return;
case GL_ACTIVE_UNIFORMS:
*params = shProg->NumUserUniformStorage;
- break;
+ return;
case GL_ACTIVE_UNIFORM_MAX_LENGTH: {
unsigned i;
GLint max_len = 0;
@@ -517,41 +540,48 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param
}
*params = max_len;
- break;
+ return;
}
- case GL_PROGRAM_BINARY_LENGTH_OES:
- *params = 0;
- break;
#if FEATURE_EXT_transform_feedback
case GL_TRANSFORM_FEEDBACK_VARYINGS:
+ if (!has_xfb)
+ break;
*params = shProg->TransformFeedback.NumVarying;
- break;
+ return;
case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH:
+ if (!has_xfb)
+ break;
*params = longest_feedback_varying_name(shProg) + 1;
- break;
+ return;
case GL_TRANSFORM_FEEDBACK_BUFFER_MODE:
+ if (!has_xfb)
+ break;
*params = shProg->TransformFeedback.BufferMode;
- break;
+ return;
#endif
#if FEATURE_ARB_geometry_shader4
case GL_GEOMETRY_VERTICES_OUT_ARB:
+ if (!has_gs)
+ break;
*params = shProg->Geom.VerticesOut;
- break;
+ return;
case GL_GEOMETRY_INPUT_TYPE_ARB:
+ if (!has_gs)
+ break;
*params = shProg->Geom.InputType;
- break;
+ return;
case GL_GEOMETRY_OUTPUT_TYPE_ARB:
+ if (!has_gs)
+ break;
*params = shProg->Geom.OutputType;
- break;
+ return;
#endif
case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH: {
unsigned i;
GLint max_len = 0;
- if (!ctx->Extensions.ARB_uniform_buffer_object) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramiv(pname)");
- return;
- }
+ if (!has_ubo)
+ break;
for (i = 0; i < shProg->NumUniformBlocks; i++) {
/* Add one for the terminating NUL character.
@@ -563,20 +593,20 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param
}
*params = max_len;
- break;
+ return;
}
case GL_ACTIVE_UNIFORM_BLOCKS:
- if (!ctx->Extensions.ARB_uniform_buffer_object) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramiv(pname)");
- return;
- }
+ if (!has_ubo)
+ break;
*params = shProg->NumUniformBlocks;
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramiv(pname)");
return;
+ default:
+ break;
}
+
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramiv(pname=%s)",
+ _mesa_lookup_enum_by_nr(pname));
}
diff --git a/mesalib/src/mesa/main/texcompress.c b/mesalib/src/mesa/main/texcompress.c
index c376b970e..846d4bb63 100644
--- a/mesalib/src/mesa/main/texcompress.c
+++ b/mesalib/src/mesa/main/texcompress.c
@@ -372,7 +372,7 @@ _mesa_glenum_to_compressed_format(GLenum format)
* internal format unchanged.
*/
GLenum
-_mesa_compressed_format_to_glenum(struct gl_context *ctx, GLuint mesaFormat)
+_mesa_compressed_format_to_glenum(struct gl_context *ctx, gl_format mesaFormat)
{
switch (mesaFormat) {
#if FEATURE_texture_fxt1
@@ -494,16 +494,16 @@ _mesa_decompress_image(gl_format format, GLuint width, GLuint height,
switch (format) {
/* DXT formats */
case MESA_FORMAT_RGB_DXT1:
- fetch = _mesa_fetch_texel_2d_f_rgb_dxt1;
+ fetch = _mesa_fetch_texel_rgb_dxt1;
break;
case MESA_FORMAT_RGBA_DXT1:
- fetch = _mesa_fetch_texel_2d_f_rgba_dxt1;
+ fetch = _mesa_fetch_texel_rgba_dxt1;
break;
case MESA_FORMAT_RGBA_DXT3:
- fetch = _mesa_fetch_texel_2d_f_rgba_dxt3;
+ fetch = _mesa_fetch_texel_rgba_dxt3;
break;
case MESA_FORMAT_RGBA_DXT5:
- fetch = _mesa_fetch_texel_2d_f_rgba_dxt5;
+ fetch = _mesa_fetch_texel_rgba_dxt5;
break;
/* FXT1 formats */
@@ -516,30 +516,30 @@ _mesa_decompress_image(gl_format format, GLuint width, GLuint height,
/* Red/RG formats */
case MESA_FORMAT_RED_RGTC1:
- fetch = _mesa_fetch_texel_2d_f_red_rgtc1;
+ fetch = _mesa_fetch_texel_red_rgtc1;
break;
case MESA_FORMAT_SIGNED_RED_RGTC1:
- fetch = _mesa_fetch_texel_2d_f_signed_red_rgtc1;
+ fetch = _mesa_fetch_texel_signed_red_rgtc1;
break;
case MESA_FORMAT_RG_RGTC2:
- fetch = _mesa_fetch_texel_2d_f_rg_rgtc2;
+ fetch = _mesa_fetch_texel_rg_rgtc2;
break;
case MESA_FORMAT_SIGNED_RG_RGTC2:
- fetch = _mesa_fetch_texel_2d_f_signed_rg_rgtc2;
+ fetch = _mesa_fetch_texel_signed_rg_rgtc2;
break;
/* L/LA formats */
case MESA_FORMAT_L_LATC1:
- fetch = _mesa_fetch_texel_2d_f_l_latc1;
+ fetch = _mesa_fetch_texel_l_latc1;
break;
case MESA_FORMAT_SIGNED_L_LATC1:
- fetch = _mesa_fetch_texel_2d_f_signed_l_latc1;
+ fetch = _mesa_fetch_texel_signed_l_latc1;
break;
case MESA_FORMAT_LA_LATC2:
- fetch = _mesa_fetch_texel_2d_f_la_latc2;
+ fetch = _mesa_fetch_texel_la_latc2;
break;
case MESA_FORMAT_SIGNED_LA_LATC2:
- fetch = _mesa_fetch_texel_2d_f_signed_la_latc2;
+ fetch = _mesa_fetch_texel_signed_la_latc2;
break;
/* ETC1 formats */
diff --git a/mesalib/src/mesa/main/texcompress.h b/mesalib/src/mesa/main/texcompress.h
index 2c357068c..34f4fae7a 100644
--- a/mesalib/src/mesa/main/texcompress.h
+++ b/mesalib/src/mesa/main/texcompress.h
@@ -43,7 +43,7 @@ extern gl_format
_mesa_glenum_to_compressed_format(GLenum format);
extern GLenum
-_mesa_compressed_format_to_glenum(struct gl_context *ctx, GLuint mesaFormat);
+_mesa_compressed_format_to_glenum(struct gl_context *ctx, gl_format mesaFormat);
extern GLubyte *
_mesa_compressed_image_address(GLint col, GLint row, GLint img,
diff --git a/mesalib/src/mesa/main/texpal.c b/mesalib/src/mesa/main/texcompress_cpal.c
index ed2261b01..2398ded69 100644
--- a/mesalib/src/mesa/main/texpal.c
+++ b/mesalib/src/mesa/main/texcompress_cpal.c
@@ -1,10 +1,25 @@
-/**************************************************************************
+/*
+ * Mesa 3-D graphics library
*
* 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
+ * THE AUTHORS BE LIABLE FOR 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.
+ */
/**
* Code to convert compressed/paletted texture images to ordinary images.
@@ -22,8 +37,8 @@
#include "mtypes.h"
#include "imports.h"
#include "pixelstore.h"
+#include "texcompress_cpal.h"
#include "teximage.h"
-#include "texpal.h"
#if FEATURE_ES
diff --git a/mesalib/src/mesa/main/texpal.h b/mesalib/src/mesa/main/texcompress_cpal.h
index acfaa313e..7507d5c1b 100644
--- a/mesalib/src/mesa/main/texpal.h
+++ b/mesalib/src/mesa/main/texcompress_cpal.h
@@ -23,8 +23,8 @@
*/
-#ifndef TEXPAL_H
-#define TEXPAL_H
+#ifndef TEXCOMPRESS_CPAL_H
+#define TEXCOMPRESS_CPAL_H
#include "main/glheader.h"
@@ -42,4 +42,4 @@ extern void
_mesa_cpal_compressed_format_type(GLenum internalFormat, GLenum *format,
GLenum *type);
-#endif /* TEXPAL_H */
+#endif /* TEXCOMPRESS_CPAL_H */
diff --git a/mesalib/src/mesa/main/texcompress_rgtc.c b/mesalib/src/mesa/main/texcompress_rgtc.c
index f707a0994..84d8fc7fc 100644
--- a/mesalib/src/mesa/main/texcompress_rgtc.c
+++ b/mesalib/src/mesa/main/texcompress_rgtc.c
@@ -292,12 +292,14 @@ _mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS)
}
void
-_mesa_fetch_texel_2d_f_red_rgtc1(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+_mesa_fetch_texel_red_rgtc1(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
GLubyte red;
- unsigned_fetch_texel_rgtc(texImage->RowStride, texImage->Map,
- i, j, &red, 1);
+ GLint sliceOffset = k ? texImage->ImageOffsets[k] / 2 : 0;
+ unsigned_fetch_texel_rgtc(texImage->RowStride,
+ texImage->Map + sliceOffset,
+ i, j, &red, 1);
texel[RCOMP] = UBYTE_TO_FLOAT(red);
texel[GCOMP] = 0.0;
texel[BCOMP] = 0.0;
@@ -305,12 +307,14 @@ _mesa_fetch_texel_2d_f_red_rgtc1(const struct swrast_texture_image *texImage,
}
void
-_mesa_fetch_texel_2d_f_signed_red_rgtc1(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+_mesa_fetch_texel_signed_red_rgtc1(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
GLbyte red;
- signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Map),
- i, j, &red, 1);
+ GLint sliceOffset = k ? texImage->ImageOffsets[k] / 2 : 0;
+ signed_fetch_texel_rgtc(texImage->RowStride,
+ (GLbyte *)(texImage->Map) + sliceOffset,
+ i, j, &red, 1);
texel[RCOMP] = BYTE_TO_FLOAT_TEX(red);
texel[GCOMP] = 0.0;
texel[BCOMP] = 0.0;
@@ -318,14 +322,17 @@ _mesa_fetch_texel_2d_f_signed_red_rgtc1(const struct swrast_texture_image *texIm
}
void
-_mesa_fetch_texel_2d_f_rg_rgtc2(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+_mesa_fetch_texel_rg_rgtc2(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
GLubyte red, green;
- unsigned_fetch_texel_rgtc(texImage->RowStride, texImage->Map,
- i, j, &red, 2);
- unsigned_fetch_texel_rgtc(texImage->RowStride, texImage->Map + 8,
- i, j, &green, 2);
+ GLint sliceOffset = k ? texImage->ImageOffsets[k] : 0;
+ unsigned_fetch_texel_rgtc(texImage->RowStride,
+ texImage->Map + sliceOffset,
+ i, j, &red, 2);
+ unsigned_fetch_texel_rgtc(texImage->RowStride,
+ texImage->Map + sliceOffset + 8,
+ i, j, &green, 2);
texel[RCOMP] = UBYTE_TO_FLOAT(red);
texel[GCOMP] = UBYTE_TO_FLOAT(green);
texel[BCOMP] = 0.0;
@@ -333,14 +340,17 @@ _mesa_fetch_texel_2d_f_rg_rgtc2(const struct swrast_texture_image *texImage,
}
void
-_mesa_fetch_texel_2d_f_signed_rg_rgtc2(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+_mesa_fetch_texel_signed_rg_rgtc2(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
GLbyte red, green;
- signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Map),
- i, j, &red, 2);
- signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Map) + 8,
- i, j, &green, 2);
+ GLint sliceOffset = k ? texImage->ImageOffsets[k] : 0;
+ signed_fetch_texel_rgtc(texImage->RowStride,
+ (GLbyte *)(texImage->Map) + sliceOffset,
+ i, j, &red, 2);
+ signed_fetch_texel_rgtc(texImage->RowStride,
+ (GLbyte *)(texImage->Map) + sliceOffset + 8,
+ i, j, &green, 2);
texel[RCOMP] = BYTE_TO_FLOAT_TEX(red);
texel[GCOMP] = BYTE_TO_FLOAT_TEX(green);
texel[BCOMP] = 0.0;
@@ -348,12 +358,14 @@ _mesa_fetch_texel_2d_f_signed_rg_rgtc2(const struct swrast_texture_image *texIma
}
void
-_mesa_fetch_texel_2d_f_l_latc1(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+_mesa_fetch_texel_l_latc1(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
GLubyte red;
- unsigned_fetch_texel_rgtc(texImage->RowStride, texImage->Map,
- i, j, &red, 1);
+ GLint sliceOffset = k ? texImage->ImageOffsets[k] / 2 : 0;
+ unsigned_fetch_texel_rgtc(texImage->RowStride,
+ texImage->Map + sliceOffset,
+ i, j, &red, 1);
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] = UBYTE_TO_FLOAT(red);
@@ -361,12 +373,14 @@ _mesa_fetch_texel_2d_f_l_latc1(const struct swrast_texture_image *texImage,
}
void
-_mesa_fetch_texel_2d_f_signed_l_latc1(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+_mesa_fetch_texel_signed_l_latc1(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
GLbyte red;
- signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Map),
- i, j, &red, 1);
+ GLint sliceOffset = k ? texImage->ImageOffsets[k] / 2 : 0;
+ signed_fetch_texel_rgtc(texImage->RowStride,
+ (GLbyte *)(texImage->Map) + sliceOffset,
+ i, j, &red, 1);
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] = BYTE_TO_FLOAT_TEX(red);
@@ -374,14 +388,17 @@ _mesa_fetch_texel_2d_f_signed_l_latc1(const struct swrast_texture_image *texImag
}
void
-_mesa_fetch_texel_2d_f_la_latc2(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+_mesa_fetch_texel_la_latc2(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
GLubyte red, green;
- unsigned_fetch_texel_rgtc(texImage->RowStride, texImage->Map,
- i, j, &red, 2);
- unsigned_fetch_texel_rgtc(texImage->RowStride, texImage->Map + 8,
- i, j, &green, 2);
+ GLint sliceOffset = k ? texImage->ImageOffsets[k] : 0;
+ unsigned_fetch_texel_rgtc(texImage->RowStride,
+ texImage->Map + sliceOffset,
+ i, j, &red, 2);
+ unsigned_fetch_texel_rgtc(texImage->RowStride,
+ texImage->Map + sliceOffset + 8,
+ i, j, &green, 2);
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] = UBYTE_TO_FLOAT(red);
@@ -389,14 +406,17 @@ _mesa_fetch_texel_2d_f_la_latc2(const struct swrast_texture_image *texImage,
}
void
-_mesa_fetch_texel_2d_f_signed_la_latc2(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+_mesa_fetch_texel_signed_la_latc2(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
GLbyte red, green;
- signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Map),
- i, j, &red, 2);
- signed_fetch_texel_rgtc(texImage->RowStride, (GLbyte *)(texImage->Map) + 8,
- i, j, &green, 2);
+ GLint sliceOffset = k ? texImage->ImageOffsets[k] : 0;
+ signed_fetch_texel_rgtc(texImage->RowStride,
+ (GLbyte *)(texImage->Map) + sliceOffset,
+ i, j, &red, 2);
+ signed_fetch_texel_rgtc(texImage->RowStride,
+ (GLbyte *)(texImage->Map) + sliceOffset + 8,
+ i, j, &green, 2);
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] = BYTE_TO_FLOAT_TEX(red);
diff --git a/mesalib/src/mesa/main/texcompress_rgtc.h b/mesalib/src/mesa/main/texcompress_rgtc.h
index 6be6ad9be..91fda882d 100644
--- a/mesalib/src/mesa/main/texcompress_rgtc.h
+++ b/mesalib/src/mesa/main/texcompress_rgtc.h
@@ -43,35 +43,35 @@ extern GLboolean
_mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS);
extern void
-_mesa_fetch_texel_2d_f_red_rgtc1(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
+_mesa_fetch_texel_red_rgtc1(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
extern void
-_mesa_fetch_texel_2d_f_signed_red_rgtc1(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
+_mesa_fetch_texel_signed_red_rgtc1(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
extern void
-_mesa_fetch_texel_2d_f_rg_rgtc2(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
+_mesa_fetch_texel_rg_rgtc2(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
extern void
-_mesa_fetch_texel_2d_f_signed_rg_rgtc2(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
+_mesa_fetch_texel_signed_rg_rgtc2(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
extern void
-_mesa_fetch_texel_2d_f_l_latc1(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
+_mesa_fetch_texel_l_latc1(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
extern void
-_mesa_fetch_texel_2d_f_signed_l_latc1(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
+_mesa_fetch_texel_signed_l_latc1(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
extern void
-_mesa_fetch_texel_2d_f_la_latc2(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
+_mesa_fetch_texel_la_latc2(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
extern void
-_mesa_fetch_texel_2d_f_signed_la_latc2(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
+_mesa_fetch_texel_signed_la_latc2(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
#endif
diff --git a/mesalib/src/mesa/main/texcompress_s3tc.c b/mesalib/src/mesa/main/texcompress_s3tc.c
index 632c05873..c1984da66 100644
--- a/mesalib/src/mesa/main/texcompress_s3tc.c
+++ b/mesalib/src/mesa/main/texcompress_s3tc.c
@@ -372,13 +372,14 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS)
static void
-fetch_texel_2d_rgb_dxt1( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLubyte *texel )
+fetch_texel_2d_rgb_dxt1(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLubyte *texel)
{
(void) k;
if (fetch_ext_rgb_dxt1) {
+ GLint sliceOffset = k ? texImage->ImageOffsets[k] / 2 : 0;
fetch_ext_rgb_dxt1(texImage->RowStride,
- texImage->Map, i, j, texel);
+ texImage->Map + sliceOffset, i, j, texel);
}
else
_mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgb_dxt1");
@@ -386,8 +387,8 @@ fetch_texel_2d_rgb_dxt1( const struct swrast_texture_image *texImage,
void
-_mesa_fetch_texel_2d_f_rgb_dxt1(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+_mesa_fetch_texel_rgb_dxt1(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
/* just sample as GLubyte and convert to float here */
GLubyte rgba[4];
@@ -400,13 +401,14 @@ _mesa_fetch_texel_2d_f_rgb_dxt1(const struct swrast_texture_image *texImage,
static void
-fetch_texel_2d_rgba_dxt1( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLubyte *texel )
+fetch_texel_2d_rgba_dxt1(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLubyte *texel)
{
(void) k;
if (fetch_ext_rgba_dxt1) {
+ GLint sliceOffset = k ? texImage->ImageOffsets[k] / 2 : 0;
fetch_ext_rgba_dxt1(texImage->RowStride,
- texImage->Map, i, j, texel);
+ texImage->Map + sliceOffset, i, j, texel);
}
else
_mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgba_dxt1\n");
@@ -414,8 +416,8 @@ fetch_texel_2d_rgba_dxt1( const struct swrast_texture_image *texImage,
void
-_mesa_fetch_texel_2d_f_rgba_dxt1(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+_mesa_fetch_texel_rgba_dxt1(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
/* just sample as GLubyte and convert to float here */
GLubyte rgba[4];
@@ -428,13 +430,14 @@ _mesa_fetch_texel_2d_f_rgba_dxt1(const struct swrast_texture_image *texImage,
static void
-fetch_texel_2d_rgba_dxt3( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLubyte *texel )
+fetch_texel_2d_rgba_dxt3(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLubyte *texel)
{
(void) k;
if (fetch_ext_rgba_dxt3) {
+ GLint sliceOffset = k ? texImage->ImageOffsets[k] : 0;
fetch_ext_rgba_dxt3(texImage->RowStride,
- texImage->Map, i, j, texel);
+ texImage->Map + sliceOffset, i, j, texel);
}
else
_mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgba_dxt3\n");
@@ -442,8 +445,8 @@ fetch_texel_2d_rgba_dxt3( const struct swrast_texture_image *texImage,
void
-_mesa_fetch_texel_2d_f_rgba_dxt3(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+_mesa_fetch_texel_rgba_dxt3(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
/* just sample as GLubyte and convert to float here */
GLubyte rgba[4];
@@ -456,13 +459,14 @@ _mesa_fetch_texel_2d_f_rgba_dxt3(const struct swrast_texture_image *texImage,
static void
-fetch_texel_2d_rgba_dxt5( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLubyte *texel )
+fetch_texel_2d_rgba_dxt5(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLubyte *texel)
{
(void) k;
if (fetch_ext_rgba_dxt5) {
+ GLint sliceOffset = k ? texImage->ImageOffsets[k] : 0;
fetch_ext_rgba_dxt5(texImage->RowStride,
- texImage->Map, i, j, texel);
+ texImage->Map + sliceOffset, i, j, texel);
}
else
_mesa_debug(NULL, "attempted to decode s3tc texture without library available: fetch_texel_2d_rgba_dxt5\n");
@@ -470,8 +474,8 @@ fetch_texel_2d_rgba_dxt5( const struct swrast_texture_image *texImage,
void
-_mesa_fetch_texel_2d_f_rgba_dxt5(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+_mesa_fetch_texel_rgba_dxt5(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
/* just sample as GLubyte and convert to float here */
GLubyte rgba[4];
@@ -484,8 +488,8 @@ _mesa_fetch_texel_2d_f_rgba_dxt5(const struct swrast_texture_image *texImage,
#if FEATURE_EXT_texture_sRGB
void
-_mesa_fetch_texel_2d_f_srgb_dxt1( const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel )
+_mesa_fetch_texel_srgb_dxt1(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
/* just sample as GLubyte and convert to float here */
GLubyte rgba[4];
@@ -497,8 +501,8 @@ _mesa_fetch_texel_2d_f_srgb_dxt1( const struct swrast_texture_image *texImage,
}
void
-_mesa_fetch_texel_2d_f_srgba_dxt1(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+_mesa_fetch_texel_srgba_dxt1(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
/* just sample as GLubyte and convert to float here */
GLubyte rgba[4];
@@ -510,8 +514,8 @@ _mesa_fetch_texel_2d_f_srgba_dxt1(const struct swrast_texture_image *texImage,
}
void
-_mesa_fetch_texel_2d_f_srgba_dxt3(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+_mesa_fetch_texel_srgba_dxt3(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
/* just sample as GLubyte and convert to float here */
GLubyte rgba[4];
@@ -523,8 +527,8 @@ _mesa_fetch_texel_2d_f_srgba_dxt3(const struct swrast_texture_image *texImage,
}
void
-_mesa_fetch_texel_2d_f_srgba_dxt5(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
+_mesa_fetch_texel_srgba_dxt5(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel)
{
/* just sample as GLubyte and convert to float here */
GLubyte rgba[4];
diff --git a/mesalib/src/mesa/main/texcompress_s3tc.h b/mesalib/src/mesa/main/texcompress_s3tc.h
index 23793d167..2c06e50ce 100644
--- a/mesalib/src/mesa/main/texcompress_s3tc.h
+++ b/mesalib/src/mesa/main/texcompress_s3tc.h
@@ -48,36 +48,36 @@ extern GLboolean
_mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS);
extern void
-_mesa_fetch_texel_2d_f_rgb_dxt1(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
+_mesa_fetch_texel_rgb_dxt1(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
extern void
-_mesa_fetch_texel_2d_f_rgba_dxt1(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
+_mesa_fetch_texel_rgba_dxt1(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
extern void
-_mesa_fetch_texel_2d_f_rgba_dxt3(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
+_mesa_fetch_texel_rgba_dxt3(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
extern void
-_mesa_fetch_texel_2d_f_rgba_dxt5(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
+_mesa_fetch_texel_rgba_dxt5(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
extern void
-_mesa_fetch_texel_2d_f_srgb_dxt1(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
+_mesa_fetch_texel_srgb_dxt1(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
extern void
-_mesa_fetch_texel_2d_f_srgba_dxt1(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
+_mesa_fetch_texel_srgba_dxt1(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
extern void
-_mesa_fetch_texel_2d_f_srgba_dxt3(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
+_mesa_fetch_texel_srgba_dxt3(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
extern void
-_mesa_fetch_texel_2d_f_srgba_dxt5(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel);
+_mesa_fetch_texel_srgba_dxt5(const struct swrast_texture_image *texImage,
+ GLint i, GLint j, GLint k, GLfloat *texel);
extern void
_mesa_init_texture_s3tc(struct gl_context *ctx);
diff --git a/mesalib/src/mesa/main/texformat.c b/mesalib/src/mesa/main/texformat.c
index 275e69e31..1a318abe4 100644
--- a/mesalib/src/mesa/main/texformat.c
+++ b/mesalib/src/mesa/main/texformat.c
@@ -61,8 +61,8 @@
* will typically override this function with a specialized version.
*/
gl_format
-_mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
- GLenum format, GLenum type )
+_mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
+ GLint internalFormat, GLenum format, GLenum type)
{
(void) format;
(void) type;
@@ -236,21 +236,33 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
RETURN_IF_SUPPORTED(MESA_FORMAT_I8);
break;
case GL_COMPRESSED_RGB_ARB:
- if (ctx->Extensions.EXT_texture_compression_s3tc ||
- ctx->Extensions.S3_s3tc)
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1);
- if (ctx->Extensions.TDFX_texture_compression_FXT1)
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FXT1);
+ /* We don't use texture compression for 1D and 1D array textures.
+ * For 1D textures, compressions doesn't buy us much.
+ * For 1D ARRAY textures, there's complicated issues with updating
+ * sub-regions on non-block boundaries with glCopyTexSubImage, among
+ * other issues. FWIW, the GL_EXT_texture_array extension prohibits
+ * 1D ARRAY textures in S3TC format.
+ */
+ if (target != GL_TEXTURE_1D && target != GL_TEXTURE_1D_ARRAY) {
+ if (ctx->Extensions.EXT_texture_compression_s3tc ||
+ ctx->Extensions.S3_s3tc)
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1);
+ if (ctx->Extensions.TDFX_texture_compression_FXT1)
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FXT1);
+ }
RETURN_IF_SUPPORTED(MESA_FORMAT_RGB888);
RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888);
RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
break;
case GL_COMPRESSED_RGBA_ARB:
- if (ctx->Extensions.EXT_texture_compression_s3tc ||
- ctx->Extensions.S3_s3tc)
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT3); /* Not rgba_dxt1, see spec */
- if (ctx->Extensions.TDFX_texture_compression_FXT1)
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FXT1);
+ /* We don't use texture compression for 1D and 1D array textures. */
+ if (target != GL_TEXTURE_1D && target != GL_TEXTURE_1D_ARRAY) {
+ if (ctx->Extensions.EXT_texture_compression_s3tc ||
+ ctx->Extensions.S3_s3tc)
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT3); /* Not rgba_dxt1, see spec */
+ if (ctx->Extensions.TDFX_texture_compression_FXT1)
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FXT1);
+ }
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888);
RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
break;
@@ -775,7 +787,8 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
break;
case GL_COMPRESSED_RED:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RED_RGTC1);
+ if (target != GL_TEXTURE_1D && target != GL_TEXTURE_1D_ARRAY)
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RED_RGTC1);
RETURN_IF_SUPPORTED(MESA_FORMAT_R8);
break;
@@ -789,7 +802,8 @@ _mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
break;
case GL_COMPRESSED_RG:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RG_RGTC2);
+ if (target != GL_TEXTURE_1D && target != GL_TEXTURE_1D_ARRAY)
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RG_RGTC2);
RETURN_IF_SUPPORTED(MESA_FORMAT_GR88);
break;
diff --git a/mesalib/src/mesa/main/texformat.h b/mesalib/src/mesa/main/texformat.h
index 3cf09213a..71af9ca22 100644
--- a/mesalib/src/mesa/main/texformat.h
+++ b/mesalib/src/mesa/main/texformat.h
@@ -32,8 +32,8 @@
struct gl_context;
extern gl_format
-_mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
- GLenum format, GLenum type );
+_mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
+ GLint internalFormat, GLenum format, GLenum type);
#endif
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 27294ba80..59b38dee4 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -28,7 +28,7 @@
* Texture image-related functions.
*/
-
+#include <stdbool.h>
#include "glheader.h"
#include "bufferobj.h"
#include "context.h"
@@ -42,14 +42,20 @@
#include "mfeatures.h"
#include "state.h"
#include "texcompress.h"
+#include "texcompress_cpal.h"
#include "teximage.h"
#include "texobj.h"
#include "texstate.h"
-#include "texpal.h"
#include "mtypes.h"
#include "glformats.h"
+/* Inexplicably, GL_HALF_FLOAT_OES has a different value than GL_HALF_FLOAT.
+ */
+#ifndef GL_HALF_FLOAT_OES
+#define GL_HALF_FLOAT_OES 0x8D61
+#endif
+
/**
* State changes which we care about for glCopyTex[Sub]Image() calls.
* In particular, we care about pixel transfer state and buffer state
@@ -833,8 +839,8 @@ _mesa_get_tex_image(struct gl_context *ctx, struct gl_texture_object *texObj,
* \return pointer to texture image or NULL if invalid target, invalid
* level, or out of memory.
*/
-struct gl_texture_image *
-_mesa_get_proxy_tex_image(struct gl_context *ctx, GLenum target, GLint level)
+static struct gl_texture_image *
+get_proxy_tex_image(struct gl_context *ctx, GLenum target, GLint level)
{
struct gl_texture_image *texImage;
GLuint texIndex;
@@ -1375,6 +1381,16 @@ compressedteximage_only_format(const struct gl_context *ctx, GLenum format)
{
switch (format) {
case GL_ETC1_RGB8_OES:
+ 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:
return GL_TRUE;
default:
return GL_FALSE;
@@ -1426,16 +1442,19 @@ legal_teximage_target(struct gl_context *ctx, GLuint dims, GLenum target)
switch (target) {
case GL_TEXTURE_1D:
case GL_PROXY_TEXTURE_1D:
- return GL_TRUE;
+ return _mesa_is_desktop_gl(ctx);
default:
return GL_FALSE;
}
case 2:
switch (target) {
case GL_TEXTURE_2D:
- case GL_PROXY_TEXTURE_2D:
return GL_TRUE;
+ case GL_PROXY_TEXTURE_2D:
+ return _mesa_is_desktop_gl(ctx);
case GL_PROXY_TEXTURE_CUBE_MAP:
+ return _mesa_is_desktop_gl(ctx)
+ && ctx->Extensions.ARB_texture_cube_map;
case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
@@ -1445,23 +1464,31 @@ legal_teximage_target(struct gl_context *ctx, GLuint dims, GLenum target)
return ctx->Extensions.ARB_texture_cube_map;
case GL_TEXTURE_RECTANGLE_NV:
case GL_PROXY_TEXTURE_RECTANGLE_NV:
- return ctx->Extensions.NV_texture_rectangle;
+ return _mesa_is_desktop_gl(ctx)
+ && ctx->Extensions.NV_texture_rectangle;
case GL_TEXTURE_1D_ARRAY_EXT:
case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
- return (ctx->Extensions.MESA_texture_array ||
- ctx->Extensions.EXT_texture_array);
+ return _mesa_is_desktop_gl(ctx)
+ && (ctx->Extensions.MESA_texture_array ||
+ ctx->Extensions.EXT_texture_array);
default:
return GL_FALSE;
}
case 3:
switch (target) {
case GL_TEXTURE_3D:
- case GL_PROXY_TEXTURE_3D:
return GL_TRUE;
+ case GL_PROXY_TEXTURE_3D:
+ return _mesa_is_desktop_gl(ctx);
case GL_TEXTURE_2D_ARRAY_EXT:
+ return (_mesa_is_desktop_gl(ctx)
+ && (ctx->Extensions.MESA_texture_array ||
+ ctx->Extensions.EXT_texture_array))
+ || _mesa_is_gles3(ctx);
case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
- return (ctx->Extensions.MESA_texture_array ||
- ctx->Extensions.EXT_texture_array);
+ return _mesa_is_desktop_gl(ctx)
+ && (ctx->Extensions.MESA_texture_array ||
+ ctx->Extensions.EXT_texture_array);
default:
return GL_FALSE;
}
@@ -1483,7 +1510,7 @@ legal_texsubimage_target(struct gl_context *ctx, GLuint dims, GLenum target)
{
switch (dims) {
case 1:
- return target == GL_TEXTURE_1D;
+ return _mesa_is_desktop_gl(ctx) && target == GL_TEXTURE_1D;
case 2:
switch (target) {
case GL_TEXTURE_2D:
@@ -1496,10 +1523,12 @@ legal_texsubimage_target(struct gl_context *ctx, GLuint dims, GLenum target)
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
return ctx->Extensions.ARB_texture_cube_map;
case GL_TEXTURE_RECTANGLE_NV:
- return ctx->Extensions.NV_texture_rectangle;
+ return _mesa_is_desktop_gl(ctx)
+ && ctx->Extensions.NV_texture_rectangle;
case GL_TEXTURE_1D_ARRAY_EXT:
- return (ctx->Extensions.MESA_texture_array ||
- ctx->Extensions.EXT_texture_array);
+ return _mesa_is_desktop_gl(ctx)
+ && (ctx->Extensions.MESA_texture_array ||
+ ctx->Extensions.EXT_texture_array);
default:
return GL_FALSE;
}
@@ -1508,8 +1537,10 @@ legal_texsubimage_target(struct gl_context *ctx, GLuint dims, GLenum target)
case GL_TEXTURE_3D:
return GL_TRUE;
case GL_TEXTURE_2D_ARRAY_EXT:
- return (ctx->Extensions.MESA_texture_array ||
- ctx->Extensions.EXT_texture_array);
+ return (_mesa_is_desktop_gl(ctx)
+ && (ctx->Extensions.MESA_texture_array ||
+ ctx->Extensions.EXT_texture_array))
+ || _mesa_is_gles3(ctx);
default:
return GL_FALSE;
}
@@ -1537,6 +1568,101 @@ mutable_tex_object(struct gl_context *ctx, GLenum target)
}
+GLenum
+_mesa_es_error_check_format_and_type(GLenum format, GLenum type,
+ unsigned dimensions)
+{
+ bool type_valid = true;
+
+ switch (format) {
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE_ALPHA:
+ type_valid = (type == GL_UNSIGNED_BYTE
+ || type == GL_FLOAT
+ || type == GL_HALF_FLOAT_OES);
+ break;
+
+ case GL_RGB:
+ type_valid = (type == GL_UNSIGNED_BYTE
+ || type == GL_UNSIGNED_SHORT_5_6_5
+ || type == GL_FLOAT
+ || type == GL_HALF_FLOAT_OES);
+ break;
+
+ case GL_RGBA:
+ type_valid = (type == GL_UNSIGNED_BYTE
+ || type == GL_UNSIGNED_SHORT_4_4_4_4
+ || type == GL_UNSIGNED_SHORT_5_5_5_1
+ || type == GL_FLOAT
+ || type == GL_HALF_FLOAT_OES
+ || type == GL_UNSIGNED_INT_2_10_10_10_REV);
+ break;
+
+ case GL_DEPTH_COMPONENT:
+ /* This format is filtered against invalid dimensionalities elsewhere.
+ */
+ type_valid = (type == GL_UNSIGNED_SHORT
+ || type == GL_UNSIGNED_INT);
+ break;
+
+ case GL_DEPTH_STENCIL:
+ /* This format is filtered against invalid dimensionalities elsewhere.
+ */
+ type_valid = (type == GL_UNSIGNED_INT_24_8);
+ break;
+
+ case GL_BGRA_EXT:
+ type_valid = (type == GL_UNSIGNED_BYTE);
+
+ /* This feels like a bug in the EXT_texture_format_BGRA8888 spec, but
+ * the format does not appear to be allowed for 3D textures in OpenGL
+ * ES.
+ */
+ if (dimensions != 2)
+ return GL_INVALID_VALUE;
+
+ break;
+
+ default:
+ return GL_INVALID_VALUE;
+ }
+
+ return type_valid ? GL_NO_ERROR : GL_INVALID_OPERATION;
+}
+
+
+
+/**
+ * Return expected size of a compressed texture.
+ */
+static GLuint
+compressed_tex_size(GLsizei width, GLsizei height, GLsizei depth,
+ GLenum glformat)
+{
+ gl_format mesaFormat = _mesa_glenum_to_compressed_format(glformat);
+ return _mesa_format_image_size(mesaFormat, width, height, depth);
+}
+
+
+/*
+ * Return compressed texture block size, in pixels.
+ */
+static void
+get_compressed_block_size(GLenum glformat, GLuint *bw, GLuint *bh)
+{
+ gl_format mesaFormat = _mesa_glenum_to_compressed_format(glformat);
+ _mesa_get_format_block_size(mesaFormat, bw, bh);
+}
+
+
+/**
+ * Special value returned by error some texture error checking functions when
+ * an error is detected and the proxy texture image's width/height/depth/format
+ * fields should be zeroed-out.
+ */
+#define PROXY_ERROR 2
+
/**
* Test the glTexImage[123]D() parameters for errors.
@@ -1553,13 +1679,14 @@ mutable_tex_object(struct gl_context *ctx, GLenum target)
* \param depth image depth given by the user.
* \param border image border given by the user.
*
- * \return GL_TRUE if an error was detected, or GL_FALSE if no errors.
+ * \return PROXY_ERROR if there's an error that should zero-out the proxy image,
+ * GL_TRUE if a regular GL error is found, or GL_FALSE if no error,
*
* Verifies each of the parameters against the constants specified in
* __struct gl_contextRec::Const and the supported extensions, and according
* to the OpenGL specification.
*/
-static GLboolean
+static GLenum
texture_error_check( struct gl_context *ctx,
GLuint dimensions, GLenum target,
GLint level, GLint internalFormat,
@@ -1579,34 +1706,62 @@ texture_error_check( struct gl_context *ctx,
*/
const GLboolean indexFormat = (format == GL_COLOR_INDEX);
+ /* Note: for proxy textures, some error conditions immediately generate
+ * a GL error in the usual way. But others do not generate a GL error.
+ * Instead, they cause the width, height, depth, format fields of the
+ * texture image to be zeroed-out. The GL spec seems to indicate that the
+ * zero-out behaviour is only used in cases related to memory allocation.
+ */
+
/* Basic level check (more checking in ctx->Driver.TestProxyTexImage) */
if (level < 0 || level >= MAX_TEXTURE_LEVELS) {
- if (!isProxy) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glTexImage%dD(level=%d)", dimensions, level);
- }
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glTexImage%dD(level=%d)", dimensions, level);
return GL_TRUE;
}
/* Check border */
if (border < 0 || border > 1 ||
- ((target == GL_TEXTURE_RECTANGLE_NV ||
+ ((ctx->API != API_OPENGL ||
+ target == GL_TEXTURE_RECTANGLE_NV ||
target == GL_PROXY_TEXTURE_RECTANGLE_NV) && border != 0)) {
- if (!isProxy) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glTexImage%dD(border=%d)", dimensions, border);
- }
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glTexImage%dD(border=%d)", dimensions, border);
return GL_TRUE;
}
if (width < 0 || height < 0 || depth < 0) {
- if (!isProxy) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glTexImage%dD(width, height or depth < 0)", dimensions);
- }
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glTexImage%dD(width, height or depth < 0)", dimensions);
return GL_TRUE;
}
+ /* OpenGL ES 1.x and OpenGL ES 2.0 impose additional restrictions on the
+ * combinations of format, internalFormat, and type that can be used.
+ * Formats and types that require additional extensions (e.g., GL_FLOAT
+ * requires GL_OES_texture_float) are filtered elsewhere.
+ */
+ if (_mesa_is_gles(ctx) && !_mesa_is_gles3(ctx)) {
+ if (format != internalFormat) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glTexImage%dD(format = %s, internalFormat = %s)",
+ dimensions,
+ _mesa_lookup_enum_by_nr(format),
+ _mesa_lookup_enum_by_nr(internalFormat));
+ return GL_TRUE;
+ }
+
+ err = _mesa_es_error_check_format_and_type(format, type, dimensions);
+ if (err != GL_NO_ERROR) {
+ _mesa_error(ctx, err,
+ "glTexImage%dD(format = %s, type = %s)",
+ dimensions,
+ _mesa_lookup_enum_by_nr(format),
+ _mesa_lookup_enum_by_nr(type));
+ return GL_TRUE;
+ }
+ }
+
/* Do this simple check before calling the TestProxyTexImage() function */
if (proxyTarget == GL_PROXY_TEXTURE_CUBE_MAP_ARB) {
sizeOK = (width == height);
@@ -1621,32 +1776,32 @@ texture_error_check( struct gl_context *ctx,
type, width, height,
depth, border);
if (!sizeOK) {
- if (!isProxy) {
+ if (isProxy) {
+ /* No GL error is recorded, but we need to zero-out the image dims */
+ return PROXY_ERROR;
+ }
+ else {
_mesa_error(ctx, GL_INVALID_VALUE,
"glTexImage%dD(level=%d, width=%d, height=%d, depth=%d)",
dimensions, level, width, height, depth);
+ return GL_TRUE;
}
- return GL_TRUE;
}
/* Check internalFormat */
if (_mesa_base_tex_format(ctx, internalFormat) < 0) {
- if (!isProxy) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glTexImage%dD(internalFormat=%s)",
- dimensions, _mesa_lookup_enum_by_nr(internalFormat));
- }
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glTexImage%dD(internalFormat=%s)",
+ dimensions, _mesa_lookup_enum_by_nr(internalFormat));
return GL_TRUE;
}
/* Check incoming image format and type */
err = _mesa_error_check_format_and_type(ctx, format, type);
if (err != GL_NO_ERROR) {
- if (!isProxy) {
- _mesa_error(ctx, err,
- "glTexImage%dD(incompatible format 0x%x, type 0x%x)",
- dimensions, format, type);
- }
+ _mesa_error(ctx, err,
+ "glTexImage%dD(incompatible format 0x%x, type 0x%x)",
+ dimensions, format, type);
return GL_TRUE;
}
@@ -1657,10 +1812,9 @@ texture_error_check( struct gl_context *ctx,
(_mesa_is_ycbcr_format(internalFormat) != _mesa_is_ycbcr_format(format)) ||
(_mesa_is_depthstencil_format(internalFormat) != _mesa_is_depthstencil_format(format)) ||
(_mesa_is_dudv_format(internalFormat) != _mesa_is_dudv_format(format))) {
- if (!isProxy)
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glTexImage%dD(incompatible internalFormat 0x%x, format 0x%x)",
- dimensions, internalFormat, format);
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glTexImage%dD(incompatible internalFormat 0x%x, format 0x%x)",
+ dimensions, internalFormat, format);
return GL_TRUE;
}
@@ -1671,7 +1825,8 @@ texture_error_check( struct gl_context *ctx,
type != GL_UNSIGNED_SHORT_8_8_REV_MESA) {
char message[100];
_mesa_snprintf(message, sizeof(message),
- "glTexImage%dD(format/type YCBCR mismatch", dimensions);
+ "glTexImage%dD(format/type YCBCR mismatch)",
+ dimensions);
_mesa_error(ctx, GL_INVALID_ENUM, "%s", message);
return GL_TRUE; /* error */
}
@@ -1679,18 +1834,17 @@ texture_error_check( struct gl_context *ctx,
target != GL_PROXY_TEXTURE_2D &&
target != GL_TEXTURE_RECTANGLE_NV &&
target != GL_PROXY_TEXTURE_RECTANGLE_NV) {
- if (!isProxy)
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage(target)");
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexImage%dD(bad target for YCbCr texture)",
+ dimensions);
return GL_TRUE;
}
if (border != 0) {
- if (!isProxy) {
- char message[100];
- _mesa_snprintf(message, sizeof(message),
- "glTexImage%dD(format=GL_YCBCR_MESA and border=%d)",
- dimensions, border);
- _mesa_error(ctx, GL_INVALID_VALUE, "%s", message);
- }
+ char message[100];
+ _mesa_snprintf(message, sizeof(message),
+ "glTexImage%dD(format=GL_YCBCR_MESA and border=%d)",
+ dimensions, border);
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s", message);
return GL_TRUE;
}
}
@@ -1711,9 +1865,9 @@ texture_error_check( struct gl_context *ctx,
target != GL_PROXY_TEXTURE_RECTANGLE_ARB &&
!((_mesa_is_cube_face(target) || target == GL_PROXY_TEXTURE_CUBE_MAP) &&
(ctx->Version >= 30 || ctx->Extensions.EXT_gpu_shader4))) {
- if (!isProxy)
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glTexImage(target/internalFormat)");
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexImage%dD(bad target for depth texture)",
+ dimensions);
return GL_TRUE;
}
}
@@ -1721,21 +1875,18 @@ texture_error_check( struct gl_context *ctx,
/* additional checks for compressed textures */
if (_mesa_is_compressed_format(ctx, internalFormat)) {
if (!target_can_be_compressed(ctx, target, internalFormat)) {
- if (!isProxy)
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glTexImage%dD(target)", dimensions);
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glTexImage%dD(target can't be compressed)", dimensions);
return GL_TRUE;
}
if (compressedteximage_only_format(ctx, internalFormat)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
- "glTexImage%dD(no compression for format)", dimensions);
+ "glTexImage%dD(no compression for format)", dimensions);
return GL_TRUE;
}
if (border != 0) {
- if (!isProxy) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glTexImage%dD(border!=0)", dimensions);
- }
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glTexImage%dD(border!=0)", dimensions);
return GL_TRUE;
}
}
@@ -1744,11 +1895,9 @@ texture_error_check( struct gl_context *ctx,
if ((ctx->Version >= 30 || ctx->Extensions.EXT_texture_integer) &&
(_mesa_is_enum_format_integer(format) !=
_mesa_is_enum_format_integer(internalFormat))) {
- if (!isProxy) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glTexImage%dD(integer/non-integer format mismatch)",
- dimensions);
- }
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glTexImage%dD(integer/non-integer format mismatch)",
+ dimensions);
return GL_TRUE;
}
@@ -1764,6 +1913,187 @@ texture_error_check( struct gl_context *ctx,
/**
+ * Error checking for glCompressedTexImage[123]D().
+ * \param reason returns reason for error, if any
+ * \return error code or GL_NO_ERROR or PROXY_ERROR.
+ */
+static GLenum
+compressed_texture_error_check(struct gl_context *ctx, GLint dimensions,
+ GLenum target, GLint level,
+ GLenum internalFormat, GLsizei width,
+ GLsizei height, GLsizei depth, GLint border,
+ GLsizei imageSize)
+{
+ const GLenum proxyTarget = get_proxy_target(target);
+ const GLint maxLevels = _mesa_max_texture_levels(ctx, target);
+ GLint expectedSize;
+ GLenum choose_format;
+ GLenum choose_type;
+ GLenum proxy_format;
+ GLenum error = GL_NO_ERROR;
+ char *reason = ""; /* no error */
+
+ if (!target_can_be_compressed(ctx, target, internalFormat)) {
+ reason = "target";
+ error = GL_INVALID_ENUM;
+ goto error;
+ }
+
+ /* This will detect any invalid internalFormat value */
+ if (!_mesa_is_compressed_format(ctx, internalFormat)) {
+ reason = "internalFormat";
+ error = GL_INVALID_ENUM;
+ goto error;
+ }
+
+ switch (internalFormat) {
+#if FEATURE_ES
+ 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_format_type(internalFormat, &choose_format,
+ &choose_type);
+ proxy_format = choose_format;
+
+ /* check level (note that level should be zero or less!) */
+ if (level > 0 || level < -maxLevels) {
+ reason = "level";
+ error = GL_INVALID_VALUE;
+ goto error;
+ }
+
+ if (dimensions != 2) {
+ reason = "compressed paletted textures must be 2D";
+ error = GL_INVALID_OPERATION;
+ goto error;
+ }
+
+ /* Figure out the expected texture size (in bytes). This will be
+ * checked against the actual size later.
+ */
+ expectedSize = _mesa_cpal_compressed_size(level, internalFormat,
+ width, height);
+
+ /* This is for the benefit of the TestProxyTexImage below. It expects
+ * level to be non-negative. OES_compressed_paletted_texture uses a
+ * weird mechanism where the level specified to glCompressedTexImage2D
+ * is -(n-1) number of levels in the texture, and the data specifies the
+ * complete mipmap stack. This is done to ensure the palette is the
+ * same for all levels.
+ */
+ level = -level;
+ break;
+#endif
+
+ default:
+ choose_format = GL_NONE;
+ choose_type = GL_NONE;
+ proxy_format = internalFormat;
+
+ /* check level */
+ if (level < 0 || level >= maxLevels) {
+ reason = "level";
+ error = GL_INVALID_VALUE;
+ goto error;
+ }
+
+ /* Figure out the expected texture size (in bytes). This will be
+ * checked against the actual size later.
+ */
+ expectedSize = compressed_tex_size(width, height, depth, internalFormat);
+ break;
+ }
+
+ /* This should really never fail */
+ if (_mesa_base_tex_format(ctx, internalFormat) < 0) {
+ reason = "internalFormat";
+ error = GL_INVALID_ENUM;
+ goto error;
+ }
+
+ /* No compressed formats support borders at this time */
+ if (border != 0) {
+ reason = "border != 0";
+ error = GL_INVALID_VALUE;
+ goto error;
+ }
+
+ /* For cube map, width must equal height */
+ if (_mesa_is_cube_face(target) && width != height) {
+ reason = "width != height";
+ error = GL_INVALID_VALUE;
+ goto error;
+ }
+
+ /* check image size against compression block size */
+ {
+ gl_format texFormat =
+ ctx->Driver.ChooseTextureFormat(ctx, target, proxy_format,
+ choose_format, choose_type);
+ GLuint bw, bh;
+
+ _mesa_get_format_block_size(texFormat, &bw, &bh);
+ if ((width > bw && width % bw > 0) ||
+ (height > bh && height % bh > 0)) {
+ /*
+ * Per GL_ARB_texture_compression: GL_INVALID_OPERATION is
+ * generated [...] if any parameter combinations are not
+ * supported by the specific compressed internal format.
+ */
+ reason = "invalid width or height for compression format";
+ error = GL_INVALID_OPERATION;
+ goto error;
+ }
+ }
+
+ /* check image sizes */
+ if (!ctx->Driver.TestProxyTexImage(ctx, proxyTarget, level,
+ proxy_format, choose_format,
+ choose_type,
+ width, height, depth, border)) {
+ /* See error comment above */
+ if (target == proxyTarget) {
+ return PROXY_ERROR;
+ }
+ reason = "invalid width, height or format";
+ error = GL_INVALID_OPERATION;
+ goto error;
+ }
+
+ /* check image size in bytes */
+ if (expectedSize != imageSize) {
+ /* Per GL_ARB_texture_compression: GL_INVALID_VALUE is generated [...]
+ * if <imageSize> is not consistent with the format, dimensions, and
+ * contents of the specified image.
+ */
+ reason = "imageSize inconsistant with width/height/format";
+ error = GL_INVALID_VALUE;
+ goto error;
+ }
+
+ if (!mutable_tex_object(ctx, target)) {
+ reason = "immutable texture";
+ error = GL_INVALID_OPERATION;
+ goto error;
+ }
+
+ return GL_NO_ERROR;
+
+error:
+ _mesa_error(ctx, error, "glCompressedTexImage%dD(%s)", dimensions, reason);
+ return error;
+}
+
+
+
+/**
* Test glTexSubImage[123]D() parameters for errors.
*
* \param ctx GL context.
@@ -1817,6 +2147,23 @@ subtexture_error_check( struct gl_context *ctx, GLuint dimensions,
return GL_TRUE;
}
+ /* OpenGL ES 1.x and OpenGL ES 2.0 impose additional restrictions on the
+ * combinations of format and type that can be used. Formats and types
+ * that require additional extensions (e.g., GL_FLOAT requires
+ * GL_OES_texture_float) are filtered elsewhere.
+ */
+ if (_mesa_is_gles(ctx) && !_mesa_is_gles3(ctx)) {
+ err = _mesa_es_error_check_format_and_type(format, type, dimensions);
+ if (err != GL_NO_ERROR) {
+ _mesa_error(ctx, err,
+ "glTexSubImage%dD(format = %s, type = %s)",
+ dimensions,
+ _mesa_lookup_enum_by_nr(format),
+ _mesa_lookup_enum_by_nr(type));
+ return GL_TRUE;
+ }
+ }
+
err = _mesa_error_check_format_and_type(ctx, format, type);
if (err != GL_NO_ERROR) {
_mesa_error(ctx, err,
@@ -1992,11 +2339,32 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
/* Check border */
if (border < 0 || border > 1 ||
- ((target == GL_TEXTURE_RECTANGLE_NV ||
+ ((ctx->API != API_OPENGL ||
+ target == GL_TEXTURE_RECTANGLE_NV ||
target == GL_PROXY_TEXTURE_RECTANGLE_NV) && border != 0)) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glCopyTexImage%dD(border=%d)", dimensions, border);
return GL_TRUE;
}
+ /* OpenGL ES 1.x and OpenGL ES 2.0 impose additional restrictions on the
+ * internalFormat.
+ */
+ if (_mesa_is_gles(ctx) && !_mesa_is_gles3(ctx)) {
+ switch (internalFormat) {
+ case GL_ALPHA:
+ case GL_RGB:
+ case GL_RGBA:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE_ALPHA:
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glCopyTexImage%dD(internalFormat)", dimensions);
+ return GL_TRUE;
+ }
+ }
+
baseFormat = _mesa_base_tex_format(ctx, internalFormat);
if (baseFormat < 0) {
_mesa_error(ctx, GL_INVALID_VALUE,
@@ -2429,7 +2797,8 @@ _mesa_choose_texture_format(struct gl_context *ctx,
}
/* choose format from scratch */
- f = ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type);
+ f = ctx->Driver.ChooseTextureFormat(ctx, texObj->Target, internalFormat,
+ format, type);
ASSERT(f != MESA_FORMAT_NONE);
return f;
}
@@ -2477,71 +2846,125 @@ strip_texture_border(GLenum target,
}
}
+
/**
- * Common code to implement all the glTexImage1D/2D/3D functions.
+ * Common code to implement all the glTexImage1D/2D/3D functions
+ * as well as glCompressedTexImage1D/2D/3D.
+ * \param compressed only GL_TRUE for glCompressedTexImage1D/2D/3D calls.
+ * \param format the user's image format (only used if !compressed)
+ * \param type the user's image type (only used if !compressed)
+ * \param imageSize only used for glCompressedTexImage1D/2D/3D calls.
*/
static void
-teximage(struct gl_context *ctx, GLuint dims,
+teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims,
GLenum target, GLint level, GLint internalFormat,
GLsizei width, GLsizei height, GLsizei depth,
GLint border, GLenum format, GLenum type,
- const GLvoid *pixels)
+ GLsizei imageSize, const GLvoid *pixels)
{
- GLboolean error;
+ const char *func = compressed ? "glCompressedTexImage" : "glTexImage";
+ GLenum error;
struct gl_pixelstore_attrib unpack_no_border;
const struct gl_pixelstore_attrib *unpack = &ctx->Unpack;
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
- _mesa_debug(ctx, "glTexImage%uD %s %d %s %d %d %d %d %s %s %p\n",
- dims,
- _mesa_lookup_enum_by_nr(target), level,
- _mesa_lookup_enum_by_nr(internalFormat),
- width, height, depth, border,
- _mesa_lookup_enum_by_nr(format),
- _mesa_lookup_enum_by_nr(type), pixels);
+ if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) {
+ if (compressed)
+ _mesa_debug(ctx,
+ "glCompressedTexImage%uD %s %d %s %d %d %d %d %p\n",
+ dims,
+ _mesa_lookup_enum_by_nr(target), level,
+ _mesa_lookup_enum_by_nr(internalFormat),
+ width, height, depth, border, pixels);
+ else
+ _mesa_debug(ctx,
+ "glTexImage%uD %s %d %s %d %d %d %d %s %s %p\n",
+ dims,
+ _mesa_lookup_enum_by_nr(target), level,
+ _mesa_lookup_enum_by_nr(internalFormat),
+ width, height, depth, border,
+ _mesa_lookup_enum_by_nr(format),
+ _mesa_lookup_enum_by_nr(type), pixels);
+ }
internalFormat = override_internal_format(internalFormat, width, height);
/* target error checking */
if (!legal_teximage_target(ctx, dims, target)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage%uD(target=%s)",
- dims, _mesa_lookup_enum_by_nr(target));
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s%uD(target=%s)",
+ func, dims, _mesa_lookup_enum_by_nr(target));
return;
}
/* general error checking */
- error = texture_error_check(ctx, dims, target, level, internalFormat,
- format, type, width, height, depth, border);
+ if (compressed) {
+ error = compressed_texture_error_check(ctx, dims, target, level,
+ internalFormat,
+ width, height, depth,
+ border, imageSize);
+ }
+ else {
+ error = texture_error_check(ctx, dims, target, level, internalFormat,
+ format, type, width, height, depth, border);
+ }
+
+#if FEATURE_ES
+ /* Here we convert a cpal compressed image into a regular glTexImage2D
+ * call by decompressing the texture. If we really want to support cpal
+ * textures in any driver this would have to be changed.
+ */
+ if (compressed && !error && dims == 2) {
+ 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, pixels);
+ return;
+ }
+ }
+#endif
if (_mesa_is_proxy_texture(target)) {
/* Proxy texture: just clear or set state depending on error checking */
struct gl_texture_image *texImage =
- _mesa_get_proxy_tex_image(ctx, target, level);
+ get_proxy_tex_image(ctx, target, level);
+ gl_format texFormat = MESA_FORMAT_NONE;
- if (error) {
- /* when error, clear all proxy texture image parameters */
- if (texImage)
- clear_teximage_fields(texImage);
- }
- else {
- /* no error, set the tex image parameters */
+ if (!error) {
+ /* No parameter errors. Choose a texture format and see if we
+ * can really allocate the texture.
+ */
struct gl_texture_object *texObj =
_mesa_get_current_tex_object(ctx, target);
- gl_format texFormat = _mesa_choose_texture_format(ctx, texObj,
- target, level,
- internalFormat,
- format, type);
-
- if (legal_texture_size(ctx, texFormat, width, height, depth)) {
- _mesa_init_teximage_fields(ctx, texImage, width, height,
- depth, border, internalFormat,
- texFormat);
+ texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
+ internalFormat, format, type);
+ if (!legal_texture_size(ctx, texFormat, width, height, depth)) {
+ error = PROXY_ERROR;
}
- else if (texImage) {
+ }
+
+ if (error == PROXY_ERROR) {
+ /* image too large, etc. Clear all proxy texture image parameters. */
+ if (texImage)
clear_teximage_fields(texImage);
- }
+ }
+ else if (error == GL_FALSE) {
+ /* no error: store the teximage parameters */
+ if (texImage)
+ _mesa_init_teximage_fields(ctx, texImage, width, height, depth,
+ border, internalFormat, texFormat);
+ }
+ else {
+ /* other, regular error (was already recorded) */
}
}
else {
@@ -2575,7 +2998,7 @@ teximage(struct gl_context *ctx, GLuint dims,
texImage = _mesa_get_tex_image(ctx, texObj, target, level);
if (!texImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage%uD", dims);
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s%uD", func, dims);
}
else {
gl_format texFormat;
@@ -2592,8 +3015,14 @@ teximage(struct gl_context *ctx, GLuint dims,
border, internalFormat, texFormat);
/* Give the texture to the driver. <pixels> may be null. */
- ctx->Driver.TexImage(ctx, dims, texImage, format,
- type, pixels, unpack);
+ if (compressed) {
+ ctx->Driver.CompressedTexImage(ctx, dims, texImage,
+ imageSize, pixels);
+ }
+ else {
+ ctx->Driver.TexImage(ctx, dims, texImage, format,
+ type, pixels, unpack);
+ }
check_gen_mipmap(ctx, target, texObj, level);
@@ -2602,7 +3031,7 @@ teximage(struct gl_context *ctx, GLuint dims,
_mesa_dirty_texobj(ctx, texObj, GL_TRUE);
}
else {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage%uD", dims);
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s%uD", func, dims);
}
}
}
@@ -2620,8 +3049,8 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat,
GLenum type, const GLvoid *pixels )
{
GET_CURRENT_CONTEXT(ctx);
- teximage(ctx, 1, target, level, internalFormat, width, 1, 1,
- border, format, type, pixels);
+ teximage(ctx, GL_FALSE, 1, target, level, internalFormat, width, 1, 1,
+ border, format, type, 0, pixels);
}
@@ -2632,8 +3061,8 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat,
const GLvoid *pixels )
{
GET_CURRENT_CONTEXT(ctx);
- teximage(ctx, 2, target, level, internalFormat, width, height, 1,
- border, format, type, pixels);
+ teximage(ctx, GL_FALSE, 2, target, level, internalFormat, width, height, 1,
+ border, format, type, 0, pixels);
}
@@ -2648,8 +3077,9 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat,
const GLvoid *pixels )
{
GET_CURRENT_CONTEXT(ctx);
- teximage(ctx, 3, target, level, internalFormat, width, height, depth,
- border, format, type, pixels);
+ teximage(ctx, GL_FALSE, 3, target, level, internalFormat,
+ width, height, depth,
+ border, format, type, 0, pixels);
}
@@ -2670,13 +3100,23 @@ _mesa_EGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image)
{
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
+ bool valid_target;
GET_CURRENT_CONTEXT(ctx);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- if ((target == GL_TEXTURE_2D &&
- !ctx->Extensions.OES_EGL_image) ||
- (target == GL_TEXTURE_EXTERNAL_OES &&
- !ctx->Extensions.OES_EGL_image_external)) {
+ switch (target) {
+ case GL_TEXTURE_2D:
+ valid_target = ctx->Extensions.OES_EGL_image;
+ break;
+ case GL_TEXTURE_EXTERNAL_OES:
+ valid_target = ctx->Extensions.OES_EGL_image_external;
+ break;
+ default:
+ valid_target = false;
+ break;
+ }
+
+ if (!valid_target) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glEGLImageTargetTexture2D(target=%d)", target);
return;
@@ -3084,190 +3524,6 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level,
/**
- * Return expected size of a compressed texture.
- */
-static GLuint
-compressed_tex_size(GLsizei width, GLsizei height, GLsizei depth,
- GLenum glformat)
-{
- gl_format mesaFormat = _mesa_glenum_to_compressed_format(glformat);
- return _mesa_format_image_size(mesaFormat, width, height, depth);
-}
-
-
-/*
- * Return compressed texture block size, in pixels.
- */
-static void
-get_compressed_block_size(GLenum glformat, GLuint *bw, GLuint *bh)
-{
- gl_format mesaFormat = _mesa_glenum_to_compressed_format(glformat);
- _mesa_get_format_block_size(mesaFormat, bw, bh);
-}
-
-
-/**
- * Error checking for glCompressedTexImage[123]D().
- * \param reason returns reason for error, if any
- * \return error code or GL_NO_ERROR.
- */
-static GLenum
-compressed_texture_error_check(struct gl_context *ctx, GLint dimensions,
- GLenum target, GLint level,
- GLenum internalFormat, GLsizei width,
- GLsizei height, GLsizei depth, GLint border,
- GLsizei imageSize, char **reason)
-{
- const GLenum proxyTarget = get_proxy_target(target);
- const GLint maxLevels = _mesa_max_texture_levels(ctx, target);
- GLint expectedSize;
- GLenum choose_format;
- GLenum choose_type;
- GLenum proxy_format;
-
- *reason = ""; /* no error */
-
- if (!target_can_be_compressed(ctx, target, internalFormat)) {
- *reason = "target";
- return GL_INVALID_ENUM;
- }
-
- /* This will detect any invalid internalFormat value */
- if (!_mesa_is_compressed_format(ctx, internalFormat)) {
- *reason = "internalFormat";
- return GL_INVALID_ENUM;
- }
-
- switch (internalFormat) {
-#if FEATURE_ES
- 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_format_type(internalFormat, &choose_format,
- &choose_type);
- proxy_format = choose_format;
-
- /* check level */
- if (level > 0 || level < -maxLevels) {
- *reason = "level";
- return GL_INVALID_VALUE;
- }
-
- if (dimensions != 2) {
- *reason = "compressed paletted textures must be 2D";
- return GL_INVALID_OPERATION;
- }
-
- /* Figure out the expected texture size (in bytes). This will be
- * checked against the actual size later.
- */
- expectedSize = _mesa_cpal_compressed_size(level, internalFormat,
- width, height);
-
- /* This is for the benefit of the TestProxyTexImage below. It expects
- * level to be non-negative. OES_compressed_paletted_texture uses a
- * weird mechanism where the level specified to glCompressedTexImage2D
- * is -(n-1) number of levels in the texture, and the data specifies the
- * complete mipmap stack. This is done to ensure the palette is the
- * same for all levels.
- */
- level = -level;
- break;
-#endif
-
- default:
- choose_format = GL_NONE;
- choose_type = GL_NONE;
- proxy_format = internalFormat;
-
- /* check level */
- if (level < 0 || level >= maxLevels) {
- *reason = "level";
- return GL_INVALID_VALUE;
- }
-
- /* Figure out the expected texture size (in bytes). This will be
- * checked against the actual size later.
- */
- expectedSize = compressed_tex_size(width, height, depth, internalFormat);
- break;
- }
-
- /* This should really never fail */
- if (_mesa_base_tex_format(ctx, internalFormat) < 0) {
- *reason = "internalFormat";
- return GL_INVALID_ENUM;
- }
-
- /* No compressed formats support borders at this time */
- if (border != 0) {
- *reason = "border != 0";
- return GL_INVALID_VALUE;
- }
-
- /* For cube map, width must equal height */
- if (_mesa_is_cube_face(target) && width != height) {
- *reason = "width != height";
- return GL_INVALID_VALUE;
- }
-
- /* check image size against compression block size */
- {
- gl_format texFormat =
- ctx->Driver.ChooseTextureFormat(ctx, proxy_format,
- choose_format, choose_type);
- GLuint bw, bh;
-
- _mesa_get_format_block_size(texFormat, &bw, &bh);
- if ((width > bw && width % bw > 0) ||
- (height > bh && height % bh > 0)) {
- /*
- * Per GL_ARB_texture_compression: GL_INVALID_OPERATION is
- * generated [...] if any parameter combinations are not
- * supported by the specific compressed internal format.
- */
- *reason = "invalid width or height for compression format";
- return GL_INVALID_OPERATION;
- }
- }
-
- /* check image sizes */
- if (!ctx->Driver.TestProxyTexImage(ctx, proxyTarget, level,
- proxy_format, choose_format,
- choose_type,
- width, height, depth, border)) {
- /* See error comment above */
- *reason = "invalid width, height or format";
- return GL_INVALID_OPERATION;
- }
-
- /* check image size in bytes */
- if (expectedSize != imageSize) {
- /* Per GL_ARB_texture_compression: GL_INVALID_VALUE is generated [...]
- * if <imageSize> is not consistent with the format, dimensions, and
- * contents of the specified image.
- */
- *reason = "imageSize inconsistant with width/height/format";
- return GL_INVALID_VALUE;
- }
-
- if (!mutable_tex_object(ctx, target)) {
- *reason = "immutable texture";
- return GL_INVALID_OPERATION;
- }
-
- return GL_NO_ERROR;
-}
-
-
-/**
* Error checking for glCompressedTexSubImage[123]D().
* \warning There are some bad assumptions here about the size of compressed
* texture tiles (multiple of 4) used to test the validity of the
@@ -3409,141 +3665,6 @@ compressed_subtexture_error_check2(struct gl_context *ctx, GLuint dims,
}
-/**
- * Implementation of the glCompressedTexImage1/2/3D() functions.
- */
-static void
-compressedteximage(struct gl_context *ctx, GLuint dims,
- GLenum target, GLint level,
- GLenum internalFormat, GLsizei width,
- GLsizei height, GLsizei depth, GLint border,
- GLsizei imageSize, const GLvoid *data)
-{
- GLenum error;
- char *reason = "";
-
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE))
- _mesa_debug(ctx,
- "glCompressedTexImage%uDARB %s %d %s %d %d %d %d %d %p\n",
- dims,
- _mesa_lookup_enum_by_nr(target), level,
- _mesa_lookup_enum_by_nr(internalFormat),
- width, height, depth, border, imageSize, data);
-
- /* check target */
- if (!legal_teximage_target(ctx, dims, target)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glCompressedTexImage%uD(target=%s)",
- dims, _mesa_lookup_enum_by_nr(target));
- return;
- }
-
- error = compressed_texture_error_check(ctx, dims, target, level,
- internalFormat, width, height, depth,
- border, imageSize, &reason);
-
-#if FEATURE_ES
- /* XXX this is kind of a hack */
- if (!error && dims == 2) {
- 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 (_mesa_is_proxy_texture(target)) {
- /* Proxy texture: just check for errors and update proxy state */
- struct gl_texture_image *texImage;
-
- if (!error) {
- struct gl_texture_object *texObj =
- _mesa_get_current_tex_object(ctx, target);
- gl_format texFormat =
- _mesa_choose_texture_format(ctx, texObj, target, level,
- internalFormat, GL_NONE, GL_NONE);
- if (!legal_texture_size(ctx, texFormat, width, height, depth)) {
- error = GL_OUT_OF_MEMORY;
- }
- }
-
- texImage = _mesa_get_proxy_tex_image(ctx, target, level);
- if (texImage) {
- if (error) {
- /* if error, clear all proxy texture image parameters */
- clear_teximage_fields(texImage);
- }
- else {
- /* no error: store the teximage parameters */
- _mesa_init_teximage_fields(ctx, texImage, width, height,
- depth, border, internalFormat,
- MESA_FORMAT_NONE);
- }
- }
- }
- else {
- /* non-proxy target */
- struct gl_texture_object *texObj;
- struct gl_texture_image *texImage;
-
- if (error) {
- _mesa_error(ctx, error, "glCompressedTexImage%uD(%s)", dims, reason);
- return;
- }
-
- texObj = _mesa_get_current_tex_object(ctx, target);
-
- _mesa_lock_texture(ctx, texObj);
- {
- texImage = _mesa_get_tex_image(ctx, texObj, target, level);
- if (!texImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY,
- "glCompressedTexImage%uD", dims);
- }
- else {
- gl_format texFormat;
-
- ctx->Driver.FreeTextureImageBuffer(ctx, texImage);
-
- texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,
- internalFormat, GL_NONE,
- GL_NONE);
-
- if (legal_texture_size(ctx, texFormat, width, height, depth)) {
- _mesa_init_teximage_fields(ctx, texImage,
- width, height, depth,
- border, internalFormat, texFormat);
-
- ctx->Driver.CompressedTexImage(ctx, dims, texImage, imageSize,
- data);
-
- check_gen_mipmap(ctx, target, texObj, level);
-
- _mesa_dirty_texobj(ctx, texObj, GL_TRUE);
- }
- else {
- _mesa_error(ctx, GL_OUT_OF_MEMORY,
- "glCompressedTexImage%uD", dims);
- }
- }
- }
- _mesa_unlock_texture(ctx, texObj);
- }
-}
-
-
void GLAPIENTRY
_mesa_CompressedTexImage1DARB(GLenum target, GLint level,
GLenum internalFormat, GLsizei width,
@@ -3551,8 +3672,8 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level,
const GLvoid *data)
{
GET_CURRENT_CONTEXT(ctx);
- compressedteximage(ctx, 1, target, level, internalFormat,
- width, 1, 1, border, imageSize, data);
+ teximage(ctx, GL_TRUE, 1, target, level, internalFormat,
+ width, 1, 1, border, GL_NONE, GL_NONE, imageSize, data);
}
@@ -3563,8 +3684,8 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
const GLvoid *data)
{
GET_CURRENT_CONTEXT(ctx);
- compressedteximage(ctx, 2, target, level, internalFormat,
- width, height, 1, border, imageSize, data);
+ teximage(ctx, GL_TRUE, 2, target, level, internalFormat,
+ width, height, 1, border, GL_NONE, GL_NONE, imageSize, data);
}
@@ -3575,8 +3696,8 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level,
GLsizei imageSize, const GLvoid *data)
{
GET_CURRENT_CONTEXT(ctx);
- compressedteximage(ctx, 3, target, level, internalFormat,
- width, height, depth, border, imageSize, data);
+ teximage(ctx, GL_TRUE, 3, target, level, internalFormat,
+ width, height, depth, border, GL_NONE, GL_NONE, imageSize, data);
}
diff --git a/mesalib/src/mesa/main/teximage.h b/mesalib/src/mesa/main/teximage.h
index 66a0c8895..feaaf0cba 100644
--- a/mesalib/src/mesa/main/teximage.h
+++ b/mesalib/src/mesa/main/teximage.h
@@ -120,10 +120,6 @@ _mesa_get_tex_image(struct gl_context *ctx, struct gl_texture_object *texObj,
GLenum target, GLint level);
-extern struct gl_texture_image *
-_mesa_get_proxy_tex_image(struct gl_context *ctx, GLenum target, GLint level);
-
-
extern GLint
_mesa_max_texture_levels(struct gl_context *ctx, GLenum target);
@@ -140,6 +136,10 @@ _mesa_tex_target_to_face(GLenum target);
extern GLint
_mesa_get_texture_dimensions(GLenum target);
+extern GLenum
+_mesa_es_error_check_format_and_type(GLenum format, GLenum type,
+ unsigned dimensions);
+
/**
* Lock a texture for updating. See also _mesa_lock_context_textures().
*/
diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c
index 1d905b608..638e418da 100644
--- a/mesalib/src/mesa/main/texobj.c
+++ b/mesalib/src/mesa/main/texobj.c
@@ -577,7 +577,7 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
GLint i;
const GLint minLevel = baseLevel;
const GLint maxLevel = t->_MaxLevel;
- const GLuint numFaces = t->Target == GL_TEXTURE_CUBE_MAP ? 6 : 1;
+ const GLuint numFaces = _mesa_num_tex_faces(t->Target);
GLuint width, height, depth, face;
if (minLevel > maxLevel) {
@@ -783,7 +783,8 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex)
texObj->Sampler.MinFilter = GL_NEAREST;
texObj->Sampler.MagFilter = GL_NEAREST;
- texFormat = ctx->Driver.ChooseTextureFormat(ctx, GL_RGBA, GL_RGBA,
+ texFormat = ctx->Driver.ChooseTextureFormat(ctx, target,
+ GL_RGBA, GL_RGBA,
GL_UNSIGNED_BYTE);
/* need a loop here just for cube maps */
@@ -826,7 +827,7 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex)
static GLuint
texture_size(const struct gl_texture_object *texObj)
{
- const GLuint numFaces = texObj->Target == GL_TEXTURE_CUBE_MAP ? 6 : 1;
+ const GLuint numFaces = _mesa_num_tex_faces(texObj->Target);
GLuint face, level, size = 0;
for (face = 0; face < numFaces; face++) {
@@ -1118,27 +1119,39 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures)
* \return TEXTURE_x_INDEX or -1 if target is invalid
*/
static GLint
-target_enum_to_index(GLenum target)
+target_enum_to_index(struct gl_context *ctx, GLenum target)
{
switch (target) {
case GL_TEXTURE_1D:
- return TEXTURE_1D_INDEX;
+ return _mesa_is_desktop_gl(ctx) ? TEXTURE_1D_INDEX : -1;
case GL_TEXTURE_2D:
return TEXTURE_2D_INDEX;
case GL_TEXTURE_3D:
return TEXTURE_3D_INDEX;
case GL_TEXTURE_CUBE_MAP_ARB:
- return TEXTURE_CUBE_INDEX;
+ return ctx->Extensions.ARB_texture_cube_map
+ ? TEXTURE_CUBE_INDEX : -1;
case GL_TEXTURE_RECTANGLE_NV:
- return TEXTURE_RECT_INDEX;
+ return _mesa_is_desktop_gl(ctx) && ctx->Extensions.NV_texture_rectangle
+ ? TEXTURE_RECT_INDEX : -1;
case GL_TEXTURE_1D_ARRAY_EXT:
- return TEXTURE_1D_ARRAY_INDEX;
+ return _mesa_is_desktop_gl(ctx)
+ && (ctx->Extensions.EXT_texture_array
+ || ctx->Extensions.MESA_texture_array)
+ ? TEXTURE_1D_ARRAY_INDEX : -1;
case GL_TEXTURE_2D_ARRAY_EXT:
- return TEXTURE_2D_ARRAY_INDEX;
+ return (_mesa_is_desktop_gl(ctx)
+ && (ctx->Extensions.EXT_texture_array
+ || ctx->Extensions.MESA_texture_array))
+ || _mesa_is_gles3(ctx)
+ ? TEXTURE_2D_ARRAY_INDEX : -1;
case GL_TEXTURE_BUFFER_ARB:
- return TEXTURE_BUFFER_INDEX;
+ return _mesa_is_desktop_gl(ctx)
+ && ctx->Extensions.ARB_texture_buffer_object
+ ? TEXTURE_BUFFER_INDEX : -1;
case GL_TEXTURE_EXTERNAL_OES:
- return TEXTURE_EXTERNAL_INDEX;
+ return _mesa_is_gles(ctx) && ctx->Extensions.OES_EGL_image_external
+ ? TEXTURE_EXTERNAL_INDEX : -1;
default:
return -1;
}
@@ -1173,7 +1186,7 @@ _mesa_BindTexture( GLenum target, GLuint texName )
_mesa_debug(ctx, "glBindTexture %s %d\n",
_mesa_lookup_enum_by_nr(target), (GLint) texName);
- targetIndex = target_enum_to_index(target);
+ targetIndex = target_enum_to_index(ctx, target);
if (targetIndex < 0) {
_mesa_error(ctx, GL_INVALID_ENUM, "glBindTexture(target)");
return;
diff --git a/mesalib/src/mesa/main/texobj.h b/mesalib/src/mesa/main/texobj.h
index 93e0d7738..a6f1d3a14 100644
--- a/mesalib/src/mesa/main/texobj.h
+++ b/mesalib/src/mesa/main/texobj.h
@@ -78,6 +78,17 @@ _mesa_reference_texobj(struct gl_texture_object **ptr,
}
+/**
+ * Return number of faces for a texture target. This will be 6 for
+ * cube maps (and cube map arrays) and 1 otherwise.
+ */
+static inline GLuint
+_mesa_num_tex_faces(GLenum target)
+{
+ return target == GL_TEXTURE_CUBE_MAP ? 6 : 1;
+}
+
+
/** Is the texture "complete" with respect to the given sampler state? */
static inline GLboolean
_mesa_is_texture_complete(const struct gl_texture_object *texObj,
diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c
index 41b9f97bf..e6140eb65 100644
--- a/mesalib/src/mesa/main/texparam.c
+++ b/mesalib/src/mesa/main/texparam.c
@@ -29,7 +29,7 @@
* glTexParameter-related functions
*/
-
+#include <stdbool.h>
#include "main/glheader.h"
#include "main/colormac.h"
#include "main/context.h"
@@ -56,43 +56,56 @@ static GLboolean
validate_texture_wrap_mode(struct gl_context * ctx, GLenum target, GLenum wrap)
{
const struct gl_extensions * const e = & ctx->Extensions;
+ const bool is_desktop_gl = _mesa_is_desktop_gl(ctx);
+ bool supported;
- if (target == GL_TEXTURE_RECTANGLE_NV) {
- if (wrap == GL_CLAMP || wrap == GL_CLAMP_TO_EDGE ||
- (wrap == GL_CLAMP_TO_BORDER && e->ARB_texture_border_clamp))
- return GL_TRUE;
- }
- else if (target == GL_TEXTURE_EXTERNAL_OES) {
- if (wrap == GL_CLAMP_TO_EDGE)
- return GL_TRUE;
- }
- else {
- switch (wrap) {
- case GL_CLAMP:
- case GL_REPEAT:
- case GL_CLAMP_TO_EDGE:
- case GL_MIRRORED_REPEAT:
- return GL_TRUE;
- case GL_CLAMP_TO_BORDER:
- if (e->ARB_texture_border_clamp)
- return GL_TRUE;
- break;
- case GL_MIRROR_CLAMP_EXT:
- case GL_MIRROR_CLAMP_TO_EDGE_EXT:
- if (e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp)
- return GL_TRUE;
- break;
- case GL_MIRROR_CLAMP_TO_BORDER_EXT:
- if (e->EXT_texture_mirror_clamp)
- return GL_TRUE;
- break;
- default:
- break;
- }
+ switch (wrap) {
+ case GL_CLAMP:
+ /* GL_CLAMP was removed in the core profile, and it has never existed in
+ * OpenGL ES.
+ */
+ supported = (ctx->API == API_OPENGL)
+ && (target != GL_TEXTURE_EXTERNAL_OES);
+ break;
+
+ case GL_CLAMP_TO_EDGE:
+ supported = true;
+ break;
+
+ case GL_CLAMP_TO_BORDER:
+ supported = is_desktop_gl && e->ARB_texture_border_clamp
+ && (target != GL_TEXTURE_EXTERNAL_OES);
+ break;
+
+ case GL_REPEAT:
+ case GL_MIRRORED_REPEAT:
+ supported = (target != GL_TEXTURE_RECTANGLE_NV)
+ && (target != GL_TEXTURE_EXTERNAL_OES);
+ break;
+
+ case GL_MIRROR_CLAMP_EXT:
+ case GL_MIRROR_CLAMP_TO_EDGE_EXT:
+ supported = is_desktop_gl
+ && (e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp)
+ && (target != GL_TEXTURE_RECTANGLE_NV)
+ && (target != GL_TEXTURE_EXTERNAL_OES);
+ break;
+
+ case GL_MIRROR_CLAMP_TO_BORDER_EXT:
+ supported = is_desktop_gl && e->EXT_texture_mirror_clamp
+ && (target != GL_TEXTURE_RECTANGLE_NV)
+ && (target != GL_TEXTURE_EXTERNAL_OES);
+ break;
+
+ default:
+ supported = false;
+ break;
}
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(param=0x%x)", wrap );
- return GL_FALSE;
+ if (!supported)
+ _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(param=0x%x)", wrap );
+
+ return supported;
}
@@ -118,35 +131,42 @@ get_texobj(struct gl_context *ctx, GLenum target, GLboolean get)
switch (target) {
case GL_TEXTURE_1D:
- return texUnit->CurrentTex[TEXTURE_1D_INDEX];
+ if (_mesa_is_desktop_gl(ctx))
+ return texUnit->CurrentTex[TEXTURE_1D_INDEX];
+ break;
case GL_TEXTURE_2D:
return texUnit->CurrentTex[TEXTURE_2D_INDEX];
case GL_TEXTURE_3D:
- return texUnit->CurrentTex[TEXTURE_3D_INDEX];
+ if (ctx->API != API_OPENGLES)
+ return texUnit->CurrentTex[TEXTURE_3D_INDEX];
+ break;
case GL_TEXTURE_CUBE_MAP:
if (ctx->Extensions.ARB_texture_cube_map) {
return texUnit->CurrentTex[TEXTURE_CUBE_INDEX];
}
break;
case GL_TEXTURE_RECTANGLE_NV:
- if (ctx->Extensions.NV_texture_rectangle) {
+ if (_mesa_is_desktop_gl(ctx)
+ && ctx->Extensions.NV_texture_rectangle) {
return texUnit->CurrentTex[TEXTURE_RECT_INDEX];
}
break;
case GL_TEXTURE_1D_ARRAY_EXT:
- if (ctx->Extensions.MESA_texture_array ||
- ctx->Extensions.EXT_texture_array) {
+ if (_mesa_is_desktop_gl(ctx)
+ && (ctx->Extensions.MESA_texture_array ||
+ ctx->Extensions.EXT_texture_array)) {
return texUnit->CurrentTex[TEXTURE_1D_ARRAY_INDEX];
}
break;
case GL_TEXTURE_2D_ARRAY_EXT:
- if (ctx->Extensions.MESA_texture_array ||
- ctx->Extensions.EXT_texture_array) {
+ if ((_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx))
+ && (ctx->Extensions.MESA_texture_array ||
+ ctx->Extensions.EXT_texture_array)) {
return texUnit->CurrentTex[TEXTURE_2D_ARRAY_INDEX];
}
break;
case GL_TEXTURE_EXTERNAL_OES:
- if (ctx->Extensions.OES_EGL_image_external) {
+ if (_mesa_is_gles(ctx) && ctx->Extensions.OES_EGL_image_external) {
return texUnit->CurrentTex[TEXTURE_EXTERNAL_INDEX];
}
break;
@@ -305,6 +325,9 @@ set_tex_parameteri(struct gl_context *ctx,
return GL_FALSE;
case GL_TEXTURE_BASE_LEVEL:
+ if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+ goto invalid_pname;
+
if (texObj->BaseLevel == params[0])
return GL_FALSE;
if (params[0] < 0 ||
@@ -330,6 +353,9 @@ set_tex_parameteri(struct gl_context *ctx,
return GL_TRUE;
case GL_GENERATE_MIPMAP_SGIS:
+ if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ goto invalid_pname;
+
if (params[0] && texObj->Target == GL_TEXTURE_EXTERNAL_OES)
goto invalid_param;
if (texObj->GenerateMipmap != params[0]) {
@@ -340,7 +366,8 @@ set_tex_parameteri(struct gl_context *ctx,
return GL_FALSE;
case GL_TEXTURE_COMPARE_MODE_ARB:
- if (ctx->Extensions.ARB_shadow) {
+ if ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_shadow)
+ || _mesa_is_gles3(ctx)) {
if (texObj->Sampler.CompareMode == params[0])
return GL_FALSE;
if (params[0] == GL_NONE ||
@@ -354,7 +381,8 @@ set_tex_parameteri(struct gl_context *ctx,
goto invalid_pname;
case GL_TEXTURE_COMPARE_FUNC_ARB:
- if (ctx->Extensions.ARB_shadow) {
+ if ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_shadow)
+ || _mesa_is_gles3(ctx)) {
if (texObj->Sampler.CompareFunc == params[0])
return GL_FALSE;
switch (params[0]) {
@@ -382,7 +410,10 @@ set_tex_parameteri(struct gl_context *ctx,
goto invalid_pname;
case GL_DEPTH_TEXTURE_MODE_ARB:
- if (ctx->Extensions.ARB_depth_texture) {
+ /* GL_DEPTH_TEXTURE_MODE_ARB is removed in core-profile and it has never
+ * existed in OpenGL ES.
+ */
+ if (ctx->API == API_OPENGL && ctx->Extensions.ARB_depth_texture) {
if (texObj->DepthMode == params[0])
return GL_FALSE;
if (params[0] == GL_LUMINANCE ||
@@ -399,6 +430,9 @@ set_tex_parameteri(struct gl_context *ctx,
#if FEATURE_OES_draw_texture
case GL_TEXTURE_CROP_RECT_OES:
+ if (ctx->API != API_OPENGLES || !ctx->Extensions.OES_draw_texture)
+ goto invalid_pname;
+
texObj->CropRect[0] = params[0];
texObj->CropRect[1] = params[1];
texObj->CropRect[2] = params[2];
@@ -410,7 +444,8 @@ set_tex_parameteri(struct gl_context *ctx,
case GL_TEXTURE_SWIZZLE_G_EXT:
case GL_TEXTURE_SWIZZLE_B_EXT:
case GL_TEXTURE_SWIZZLE_A_EXT:
- if (ctx->Extensions.EXT_texture_swizzle) {
+ if ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_swizzle)
+ || _mesa_is_gles3(ctx)) {
const GLuint comp = pname - GL_TEXTURE_SWIZZLE_R_EXT;
const GLint swz = comp_to_swizzle(params[0]);
if (swz < 0) {
@@ -428,7 +463,8 @@ set_tex_parameteri(struct gl_context *ctx,
goto invalid_pname;
case GL_TEXTURE_SWIZZLE_RGBA_EXT:
- if (ctx->Extensions.EXT_texture_swizzle) {
+ if ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_swizzle)
+ || _mesa_is_gles3(ctx)) {
GLuint comp;
flush(ctx);
for (comp = 0; comp < 4; comp++) {
@@ -448,7 +484,8 @@ set_tex_parameteri(struct gl_context *ctx,
goto invalid_pname;
case GL_TEXTURE_SRGB_DECODE_EXT:
- if (ctx->Extensions.EXT_texture_sRGB_decode) {
+ if (_mesa_is_desktop_gl(ctx)
+ && ctx->Extensions.EXT_texture_sRGB_decode) {
GLenum decode = params[0];
if (decode == GL_DECODE_EXT || decode == GL_SKIP_DECODE_EXT) {
if (texObj->Sampler.sRGBDecode != decode) {
@@ -461,7 +498,8 @@ set_tex_parameteri(struct gl_context *ctx,
goto invalid_pname;
case GL_TEXTURE_CUBE_MAP_SEAMLESS:
- if (ctx->Extensions.AMD_seamless_cubemap_per_texture) {
+ if (_mesa_is_desktop_gl(ctx)
+ && ctx->Extensions.AMD_seamless_cubemap_per_texture) {
GLenum param = params[0];
if (param != GL_TRUE && param != GL_FALSE) {
goto invalid_param;
@@ -501,6 +539,9 @@ set_tex_parameterf(struct gl_context *ctx,
{
switch (pname) {
case GL_TEXTURE_MIN_LOD:
+ if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+ goto invalid_pname;
+
if (texObj->Sampler.MinLod == params[0])
return GL_FALSE;
flush(ctx);
@@ -508,6 +549,9 @@ set_tex_parameterf(struct gl_context *ctx,
return GL_TRUE;
case GL_TEXTURE_MAX_LOD:
+ if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+ goto invalid_pname;
+
if (texObj->Sampler.MaxLod == params[0])
return GL_FALSE;
flush(ctx);
@@ -515,6 +559,9 @@ set_tex_parameterf(struct gl_context *ctx,
return GL_TRUE;
case GL_TEXTURE_PRIORITY:
+ if (ctx->API != API_OPENGL)
+ goto invalid_pname;
+
flush(ctx);
texObj->Priority = CLAMP(params[0], 0.0F, 1.0F);
return GL_TRUE;
@@ -536,13 +583,18 @@ set_tex_parameterf(struct gl_context *ctx,
else {
static GLuint count = 0;
if (count++ < 10)
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glTexParameter(pname=GL_TEXTURE_MAX_ANISOTROPY_EXT)");
+ goto invalid_pname;
}
return GL_FALSE;
case GL_TEXTURE_LOD_BIAS:
- /* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias */
+ /* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias.
+ * It was removed in core-profile, and it has never existed in OpenGL
+ * ES.
+ */
+ if (ctx->API != API_OPENGL)
+ goto invalid_pname;
+
if (texObj->Sampler.LodBias != params[0]) {
flush(ctx);
texObj->Sampler.LodBias = params[0];
@@ -551,6 +603,9 @@ set_tex_parameterf(struct gl_context *ctx,
break;
case GL_TEXTURE_BORDER_COLOR:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_pname;
+
flush(ctx);
/* ARB_texture_float disables clamping */
if (ctx->Extensions.ARB_texture_float) {
@@ -567,9 +622,14 @@ set_tex_parameterf(struct gl_context *ctx,
return GL_TRUE;
default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=0x%x)", pname);
+ goto invalid_pname;
}
return GL_FALSE;
+
+invalid_pname:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=%s)",
+ _mesa_lookup_enum_by_nr(pname));
+ return GL_FALSE;
}
@@ -1250,6 +1310,9 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
*params = ENUM_TO_FLOAT(obj->Sampler.WrapR);
break;
case GL_TEXTURE_BORDER_COLOR:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_pname;
+
if (ctx->NewState & (_NEW_BUFFERS | _NEW_FRAG_CLAMP))
_mesa_update_state_locked(ctx);
if (ctx->Color._ClampFragmentColor) {
@@ -1266,18 +1329,33 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
}
break;
case GL_TEXTURE_RESIDENT:
+ if (ctx->API != API_OPENGL)
+ goto invalid_pname;
+
*params = 1.0F;
break;
case GL_TEXTURE_PRIORITY:
+ if (ctx->API != API_OPENGL)
+ goto invalid_pname;
+
*params = obj->Priority;
break;
case GL_TEXTURE_MIN_LOD:
+ if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+ goto invalid_pname;
+
*params = obj->Sampler.MinLod;
break;
case GL_TEXTURE_MAX_LOD:
+ if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+ goto invalid_pname;
+
*params = obj->Sampler.MaxLod;
break;
case GL_TEXTURE_BASE_LEVEL:
+ if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+ goto invalid_pname;
+
*params = (GLfloat) obj->BaseLevel;
break;
case GL_TEXTURE_MAX_LEVEL:
@@ -1289,28 +1367,42 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
*params = obj->Sampler.MaxAnisotropy;
break;
case GL_GENERATE_MIPMAP_SGIS:
+ if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ goto invalid_pname;
+
*params = (GLfloat) obj->GenerateMipmap;
break;
case GL_TEXTURE_COMPARE_MODE_ARB:
- if (!ctx->Extensions.ARB_shadow)
+ if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_shadow)
+ && !_mesa_is_gles3(ctx))
goto invalid_pname;
*params = (GLfloat) obj->Sampler.CompareMode;
break;
case GL_TEXTURE_COMPARE_FUNC_ARB:
- if (!ctx->Extensions.ARB_shadow)
+ if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_shadow)
+ && !_mesa_is_gles3(ctx))
goto invalid_pname;
*params = (GLfloat) obj->Sampler.CompareFunc;
break;
case GL_DEPTH_TEXTURE_MODE_ARB:
- if (!ctx->Extensions.ARB_depth_texture)
+ /* GL_DEPTH_TEXTURE_MODE_ARB is removed in core-profile and it has
+ * never existed in OpenGL ES.
+ */
+ if (ctx->API != API_OPENGL || !ctx->Extensions.ARB_depth_texture)
goto invalid_pname;
*params = (GLfloat) obj->DepthMode;
break;
case GL_TEXTURE_LOD_BIAS:
+ if (ctx->API != API_OPENGL)
+ goto invalid_pname;
+
*params = obj->Sampler.LodBias;
break;
#if FEATURE_OES_draw_texture
case GL_TEXTURE_CROP_RECT_OES:
+ if (ctx->API != API_OPENGLES || !ctx->Extensions.OES_draw_texture)
+ goto invalid_pname;
+
params[0] = obj->CropRect[0];
params[1] = obj->CropRect[1];
params[2] = obj->CropRect[2];
@@ -1322,13 +1414,17 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
case GL_TEXTURE_SWIZZLE_G_EXT:
case GL_TEXTURE_SWIZZLE_B_EXT:
case GL_TEXTURE_SWIZZLE_A_EXT:
- if (!ctx->Extensions.EXT_texture_swizzle)
+ if ((!_mesa_is_desktop_gl(ctx)
+ || !ctx->Extensions.EXT_texture_swizzle)
+ && !_mesa_is_gles3(ctx))
goto invalid_pname;
*params = (GLfloat) obj->Swizzle[pname - GL_TEXTURE_SWIZZLE_R_EXT];
break;
case GL_TEXTURE_SWIZZLE_RGBA_EXT:
- if (!ctx->Extensions.EXT_texture_swizzle) {
+ if ((!_mesa_is_desktop_gl(ctx)
+ || !ctx->Extensions.EXT_texture_swizzle)
+ && !_mesa_is_gles3(ctx)) {
goto invalid_pname;
}
else {
@@ -1340,7 +1436,8 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
break;
case GL_TEXTURE_CUBE_MAP_SEAMLESS:
- if (!ctx->Extensions.AMD_seamless_cubemap_per_texture)
+ if (!_mesa_is_desktop_gl(ctx)
+ || !ctx->Extensions.AMD_seamless_cubemap_per_texture)
goto invalid_pname;
*params = (GLfloat) obj->Sampler.CubeMapSeamless;
break;
@@ -1394,6 +1491,9 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
*params = (GLint) obj->Sampler.WrapR;
break;
case GL_TEXTURE_BORDER_COLOR:
+ if (!_mesa_is_desktop_gl(ctx))
+ goto invalid_pname;
+
{
GLfloat b[4];
b[0] = CLAMP(obj->Sampler.BorderColor.f[0], 0.0F, 1.0F);
@@ -1407,18 +1507,33 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
}
break;
case GL_TEXTURE_RESIDENT:
+ if (ctx->API != API_OPENGL)
+ goto invalid_pname;
+
*params = 1;
break;
case GL_TEXTURE_PRIORITY:
+ if (ctx->API != API_OPENGL)
+ goto invalid_pname;
+
*params = FLOAT_TO_INT(obj->Priority);
break;
case GL_TEXTURE_MIN_LOD:
+ if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+ goto invalid_pname;
+
*params = (GLint) obj->Sampler.MinLod;
break;
case GL_TEXTURE_MAX_LOD:
+ if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+ goto invalid_pname;
+
*params = (GLint) obj->Sampler.MaxLod;
break;
case GL_TEXTURE_BASE_LEVEL:
+ if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+ goto invalid_pname;
+
*params = obj->BaseLevel;
break;
case GL_TEXTURE_MAX_LEVEL:
@@ -1430,28 +1545,39 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
*params = (GLint) obj->Sampler.MaxAnisotropy;
break;
case GL_GENERATE_MIPMAP_SGIS:
+ if (ctx->API != API_OPENGL && ctx->API != API_OPENGLES)
+ goto invalid_pname;
+
*params = (GLint) obj->GenerateMipmap;
break;
case GL_TEXTURE_COMPARE_MODE_ARB:
- if (!ctx->Extensions.ARB_shadow)
+ if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_shadow)
+ && !_mesa_is_gles3(ctx))
goto invalid_pname;
*params = (GLint) obj->Sampler.CompareMode;
break;
case GL_TEXTURE_COMPARE_FUNC_ARB:
- if (!ctx->Extensions.ARB_shadow)
+ if ((!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_shadow)
+ && !_mesa_is_gles3(ctx))
goto invalid_pname;
*params = (GLint) obj->Sampler.CompareFunc;
break;
case GL_DEPTH_TEXTURE_MODE_ARB:
- if (!ctx->Extensions.ARB_depth_texture)
+ if (ctx->API != API_OPENGL || !ctx->Extensions.ARB_depth_texture)
goto invalid_pname;
*params = (GLint) obj->DepthMode;
break;
case GL_TEXTURE_LOD_BIAS:
+ if (ctx->API != API_OPENGL)
+ goto invalid_pname;
+
*params = (GLint) obj->Sampler.LodBias;
break;
#if FEATURE_OES_draw_texture
case GL_TEXTURE_CROP_RECT_OES:
+ if (ctx->API != API_OPENGLES || !ctx->Extensions.OES_draw_texture)
+ goto invalid_pname;
+
params[0] = obj->CropRect[0];
params[1] = obj->CropRect[1];
params[2] = obj->CropRect[2];
@@ -1462,19 +1588,24 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
case GL_TEXTURE_SWIZZLE_G_EXT:
case GL_TEXTURE_SWIZZLE_B_EXT:
case GL_TEXTURE_SWIZZLE_A_EXT:
- if (!ctx->Extensions.EXT_texture_swizzle)
+ if ((!_mesa_is_desktop_gl(ctx)
+ || !ctx->Extensions.EXT_texture_swizzle)
+ && !_mesa_is_gles3(ctx))
goto invalid_pname;
*params = obj->Swizzle[pname - GL_TEXTURE_SWIZZLE_R_EXT];
break;
case GL_TEXTURE_SWIZZLE_RGBA_EXT:
- if (!ctx->Extensions.EXT_texture_swizzle)
+ if ((!_mesa_is_desktop_gl(ctx)
+ || !ctx->Extensions.EXT_texture_swizzle)
+ && !_mesa_is_gles3(ctx))
goto invalid_pname;
COPY_4V(params, obj->Swizzle);
break;
case GL_TEXTURE_CUBE_MAP_SEAMLESS:
- if (!ctx->Extensions.AMD_seamless_cubemap_per_texture)
+ if (!_mesa_is_desktop_gl(ctx)
+ || !ctx->Extensions.AMD_seamless_cubemap_per_texture)
goto invalid_pname;
*params = (GLint) obj->Sampler.CubeMapSeamless;
break;
@@ -1486,7 +1617,7 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
break;
case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES:
- if (!ctx->Extensions.OES_EGL_image_external)
+ if (!_mesa_is_gles(ctx) || !ctx->Extensions.OES_EGL_image_external)
goto invalid_pname;
*params = obj->RequiredTextureImageUnits;
break;
diff --git a/mesalib/src/mesa/main/texstorage.c b/mesalib/src/mesa/main/texstorage.c
index 5e1f31a93..f8af8bf01 100644
--- a/mesalib/src/mesa/main/texstorage.c
+++ b/mesalib/src/mesa/main/texstorage.c
@@ -36,6 +36,7 @@
#include "macros.h"
#include "mfeatures.h"
#include "teximage.h"
+#include "texobj.h"
#include "texstorage.h"
#include "mtypes.h"
@@ -128,7 +129,7 @@ setup_texstorage(struct gl_context *ctx,
GLsizei width, GLsizei height, GLsizei depth)
{
const GLenum target = texObj->Target;
- const GLuint numFaces = (target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
+ const GLuint numFaces = _mesa_num_tex_faces(target);
gl_format texFormat;
GLint level, levelWidth = width, levelHeight = height, levelDepth = depth;
GLuint face;
@@ -206,7 +207,7 @@ clear_image_fields(struct gl_context *ctx,
struct gl_texture_object *texObj)
{
const GLenum target = texObj->Target;
- const GLuint numFaces = (target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
+ const GLuint numFaces = _mesa_num_tex_faces(target);
GLint level;
GLuint face;
diff --git a/mesalib/src/mesa/main/uniform_query.cpp b/mesalib/src/mesa/main/uniform_query.cpp
index 816c2779c..bddb8f95e 100644
--- a/mesalib/src/mesa/main/uniform_query.cpp
+++ b/mesalib/src/mesa/main/uniform_query.cpp
@@ -809,7 +809,8 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg,
sizeof(shProg->SamplerUnits));
_mesa_update_shader_textures_used(shProg, prog);
- (void) ctx->Driver.ProgramStringNotify(ctx, prog->Target, prog);
+ if (ctx->Driver.SamplerUniformChange)
+ ctx->Driver.SamplerUniformChange(ctx, prog->Target, prog);
}
}
}
diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c
index 327fabbc1..8c3ddc524 100644
--- a/mesalib/src/mesa/main/varray.c
+++ b/mesalib/src/mesa/main/varray.c
@@ -133,16 +133,37 @@ update_array(struct gl_context *ctx,
GLsizei elementSize;
GLenum format = GL_RGBA;
- if (ctx->API != API_OPENGLES && ctx->API != API_OPENGLES2) {
- /* fixed point arrays / data is only allowed with OpenGL ES 1.x/2.0 */
+ if (_mesa_is_gles(ctx)) {
+ /* Once Mesa gets support for GL_OES_vertex_half_float this mask will
+ * change. Adding support for this extension isn't quite as trivial as
+ * we'd like because ES uses a different enum value for GL_HALF_FLOAT.
+ */
+ legalTypesMask &= ~(FIXED_GL_BIT | HALF_BIT | DOUBLE_BIT);
+
+ /* GL_INT and GL_UNSIGNED_INT data is not allowed in OpenGL ES until
+ * 3.0. The 2_10_10_10 types are added in OpenGL ES 3.0 or
+ * GL_OES_vertex_type_10_10_10_2.
+ */
+ if (ctx->Version < 30) {
+ legalTypesMask &= ~(UNSIGNED_INT_BIT
+ | INT_BIT
+ | UNSIGNED_INT_2_10_10_10_REV_BIT
+ | INT_2_10_10_10_REV_BIT);
+ }
+
+ /* BGRA ordering is not supported in ES contexts.
+ */
+ if (sizeMax == BGRA_OR_4)
+ sizeMax = 4;
+ } else {
legalTypesMask &= ~FIXED_ES_BIT;
- }
- if (!ctx->Extensions.ARB_ES2_compatibility) {
- legalTypesMask &= ~FIXED_GL_BIT;
- }
- if (!ctx->Extensions.ARB_vertex_type_2_10_10_10_rev) {
- legalTypesMask &= ~(UNSIGNED_INT_2_10_10_10_REV_BIT |
- INT_2_10_10_10_REV_BIT);
+
+ if (!ctx->Extensions.ARB_ES2_compatibility)
+ legalTypesMask &= ~FIXED_GL_BIT;
+
+ if (!ctx->Extensions.ARB_vertex_type_2_10_10_10_rev)
+ legalTypesMask &= ~(UNSIGNED_INT_2_10_10_10_REV_BIT |
+ INT_2_10_10_10_REV_BIT);
}
typeBit = type_to_bit(ctx, type);
@@ -228,16 +249,15 @@ update_array(struct gl_context *ctx,
void GLAPIENTRY
_mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
{
- GLbitfield legalTypes = (SHORT_BIT | INT_BIT | FLOAT_BIT |
- DOUBLE_BIT | HALF_BIT | FIXED_ES_BIT |
- UNSIGNED_INT_2_10_10_10_REV_BIT |
- INT_2_10_10_10_REV_BIT);
GET_CURRENT_CONTEXT(ctx);
+ GLbitfield legalTypes = (ctx->API == API_OPENGLES)
+ ? (BYTE_BIT | SHORT_BIT | FLOAT_BIT | FIXED_ES_BIT)
+ : (SHORT_BIT | INT_BIT | FLOAT_BIT |
+ DOUBLE_BIT | HALF_BIT |
+ UNSIGNED_INT_2_10_10_10_REV_BIT |
+ INT_2_10_10_10_REV_BIT);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- if (ctx->API == API_OPENGLES)
- legalTypes |= BYTE_BIT;
-
update_array(ctx, "glVertexPointer", VERT_ATTRIB_POS,
legalTypes, 2, 4,
size, type, stride, GL_FALSE, GL_FALSE, ptr);
@@ -247,12 +267,13 @@ _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
void GLAPIENTRY
_mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr )
{
- const GLbitfield legalTypes = (BYTE_BIT | SHORT_BIT | INT_BIT |
- HALF_BIT | FLOAT_BIT | DOUBLE_BIT |
- FIXED_ES_BIT |
- UNSIGNED_INT_2_10_10_10_REV_BIT |
- INT_2_10_10_10_REV_BIT);
GET_CURRENT_CONTEXT(ctx);
+ const GLbitfield legalTypes = (ctx->API == API_OPENGLES)
+ ? (BYTE_BIT | SHORT_BIT | FLOAT_BIT | FIXED_ES_BIT)
+ : (BYTE_BIT | SHORT_BIT | INT_BIT |
+ HALF_BIT | FLOAT_BIT | DOUBLE_BIT |
+ UNSIGNED_INT_2_10_10_10_REV_BIT |
+ INT_2_10_10_10_REV_BIT);
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
update_array(ctx, "glNormalPointer", VERT_ATTRIB_NORMAL,
@@ -264,18 +285,20 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr )
void GLAPIENTRY
_mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
{
- const GLbitfield legalTypes = (BYTE_BIT | UNSIGNED_BYTE_BIT |
- SHORT_BIT | UNSIGNED_SHORT_BIT |
- INT_BIT | UNSIGNED_INT_BIT |
- HALF_BIT | FLOAT_BIT | DOUBLE_BIT |
- FIXED_ES_BIT |
- UNSIGNED_INT_2_10_10_10_REV_BIT |
- INT_2_10_10_10_REV_BIT);
GET_CURRENT_CONTEXT(ctx);
+ const GLbitfield legalTypes = (ctx->API == API_OPENGLES)
+ ? (UNSIGNED_BYTE_BIT | HALF_BIT | FLOAT_BIT | FIXED_ES_BIT)
+ : (BYTE_BIT | UNSIGNED_BYTE_BIT |
+ SHORT_BIT | UNSIGNED_SHORT_BIT |
+ INT_BIT | UNSIGNED_INT_BIT |
+ HALF_BIT | FLOAT_BIT | DOUBLE_BIT |
+ UNSIGNED_INT_2_10_10_10_REV_BIT |
+ INT_2_10_10_10_REV_BIT);
+ const GLint sizeMin = (ctx->API == API_OPENGLES) ? 4 : 3;
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
update_array(ctx, "glColorPointer", VERT_ATTRIB_COLOR0,
- legalTypes, 3, BGRA_OR_4,
+ legalTypes, sizeMin, BGRA_OR_4,
size, type, stride, GL_TRUE, GL_FALSE, ptr);
}
@@ -330,20 +353,19 @@ void GLAPIENTRY
_mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
const GLvoid *ptr)
{
- GLbitfield legalTypes = (SHORT_BIT | INT_BIT |
- HALF_BIT | FLOAT_BIT | DOUBLE_BIT |
- FIXED_ES_BIT |
- UNSIGNED_INT_2_10_10_10_REV_BIT |
- INT_2_10_10_10_REV_BIT);
GET_CURRENT_CONTEXT(ctx);
+ GLbitfield legalTypes = (ctx->API == API_OPENGLES)
+ ? (BYTE_BIT | SHORT_BIT | FLOAT_BIT | FIXED_ES_BIT)
+ : (SHORT_BIT | INT_BIT |
+ HALF_BIT | FLOAT_BIT | DOUBLE_BIT |
+ UNSIGNED_INT_2_10_10_10_REV_BIT |
+ INT_2_10_10_10_REV_BIT);
+ const GLint sizeMin = (ctx->API == API_OPENGLES) ? 2 : 1;
const GLuint unit = ctx->Array.ActiveTexture;
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
- if (ctx->API == API_OPENGLES)
- legalTypes |= BYTE_BIT;
-
update_array(ctx, "glTexCoordPointer", VERT_ATTRIB_TEX(unit),
- legalTypes, 1, 4,
+ legalTypes, sizeMin, 4,
size, type, stride, GL_FALSE, GL_FALSE,
ptr);
}
diff --git a/mesalib/src/mesa/sources.mak b/mesalib/src/mesa/sources.mak
index ee260cbfd..7f7ea2885 100644
--- a/mesalib/src/mesa/sources.mak
+++ b/mesalib/src/mesa/sources.mak
@@ -32,7 +32,6 @@ MAIN_FILES = \
$(SRCDIR)main/debug.c \
$(SRCDIR)main/depth.c \
$(SRCDIR)main/dlist.c \
- $(SRCDIR)main/dlopen.c \
$(SRCDIR)main/drawpix.c \
$(SRCDIR)main/drawtex.c \
$(SRCDIR)main/enable.c \
@@ -85,6 +84,7 @@ MAIN_FILES = \
$(SRCDIR)main/stencil.c \
$(SRCDIR)main/syncobj.c \
$(SRCDIR)main/texcompress.c \
+ $(SRCDIR)main/texcompress_cpal.c \
$(SRCDIR)main/texcompress_rgtc.c \
$(SRCDIR)main/texcompress_s3tc.c \
$(SRCDIR)main/texcompress_fxt1.c \
@@ -95,7 +95,6 @@ MAIN_FILES = \
$(SRCDIR)main/texgetimage.c \
$(SRCDIR)main/teximage.c \
$(SRCDIR)main/texobj.c \
- $(SRCDIR)main/texpal.c \
$(SRCDIR)main/texparam.c \
$(SRCDIR)main/texstate.c \
$(SRCDIR)main/texstorage.c \
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index a7c732bd7..3de96adf3 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -1299,7 +1299,7 @@ st_AllocTextureStorage(struct gl_context *ctx,
GLsizei levels, GLsizei width,
GLsizei height, GLsizei depth)
{
- const GLuint numFaces = (texObj->Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
+ const GLuint numFaces = _mesa_num_tex_faces(texObj->Target);
struct st_context *st = st_context(ctx);
struct st_texture_object *stObj = st_texture_object(texObj);
GLuint ptWidth, ptHeight, ptDepth, ptLayers, bindings;
diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c
index 2e14da211..aa3534125 100644
--- a/mesalib/src/mesa/state_tracker/st_context.c
+++ b/mesalib/src/mesa/state_tracker/st_context.c
@@ -114,12 +114,15 @@ st_get_msaa(void)
static struct st_context *
-st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe )
+st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe,
+ const struct st_config_options *options)
{
struct pipe_screen *screen = pipe->screen;
uint i;
struct st_context *st = ST_CALLOC_STRUCT( st_context );
+ st->options = *options;
+
ctx->st = st;
st->ctx = ctx;
@@ -207,7 +210,8 @@ static void st_init_driver_flags(struct gl_driver_flags *f)
struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,
const struct gl_config *visual,
- struct st_context *share)
+ struct st_context *share,
+ const struct st_config_options *options)
{
struct gl_context *ctx;
struct gl_context *shareCtx = share ? share->ctx : NULL;
@@ -234,7 +238,7 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe,
if (debug_get_option_mesa_mvp_dp4())
_mesa_set_mvp_with_dp4( ctx, GL_TRUE );
- return st_create_context_priv(ctx, pipe);
+ return st_create_context_priv(ctx, pipe, options);
}
diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h
index 47d3af520..c85d09cb5 100644
--- a/mesalib/src/mesa/state_tracker/st_context.h
+++ b/mesalib/src/mesa/state_tracker/st_context.h
@@ -194,6 +194,8 @@ struct st_context
int32_t draw_stamp;
int32_t read_stamp;
+
+ struct st_config_options options;
};
@@ -266,7 +268,8 @@ st_get_msaa(void);
extern struct st_context *
st_create_context(gl_api api, struct pipe_context *pipe,
const struct gl_config *visual,
- struct st_context *share);
+ struct st_context *share,
+ const struct st_config_options *options);
extern void
st_destroy_context(struct st_context *st);
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 2f034cb28..5e482d9f7 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -646,4 +646,6 @@ void st_init_extensions(struct st_context *st)
ctx->Extensions.ARB_draw_instanced) {
ctx->Extensions.ARB_transform_feedback_instanced = GL_TRUE;
}
+ if (st->options.force_glsl_extensions_warn)
+ ctx->Const.ForceGLSLExtensionsWarn = 1;
}
diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c
index 962b09250..302b58c7b 100644
--- a/mesalib/src/mesa/state_tracker/st_format.c
+++ b/mesalib/src/mesa/state_tracker/st_format.c
@@ -1631,7 +1631,8 @@ st_ChooseTextureFormat_renderable(struct gl_context *ctx, GLint internalFormat,
* Called via ctx->Driver.ChooseTextureFormat().
*/
gl_format
-st_ChooseTextureFormat(struct gl_context *ctx, GLint internalFormat,
+st_ChooseTextureFormat(struct gl_context *ctx, GLenum target,
+ GLint internalFormat,
GLenum format, GLenum type)
{
boolean want_renderable =
@@ -1640,6 +1641,15 @@ st_ChooseTextureFormat(struct gl_context *ctx, GLint internalFormat,
internalFormat == GL_RGB8 || internalFormat == GL_RGBA8 ||
internalFormat == GL_BGRA;
+ if (target == GL_TEXTURE_1D || target == GL_TEXTURE_1D_ARRAY) {
+ /* We don't do compression for these texture targets because of
+ * difficulty with sub-texture updates on non-block boundaries, etc.
+ * So change the internal format request to an uncompressed format.
+ */
+ internalFormat =
+ _mesa_generic_compressed_format_to_uncompressed_format(internalFormat);
+ }
+
return st_ChooseTextureFormat_renderable(ctx, internalFormat,
format, type, want_renderable);
}
diff --git a/mesalib/src/mesa/state_tracker/st_format.h b/mesalib/src/mesa/state_tracker/st_format.h
index 7cf92eb41..2eef2c0d4 100644
--- a/mesalib/src/mesa/state_tracker/st_format.h
+++ b/mesalib/src/mesa/state_tracker/st_format.h
@@ -63,7 +63,8 @@ st_ChooseTextureFormat_renderable(struct gl_context *ctx, GLint internalFormat,
GLenum format, GLenum type, GLboolean renderable);
extern gl_format
-st_ChooseTextureFormat(struct gl_context * ctx, GLint internalFormat,
+st_ChooseTextureFormat(struct gl_context * ctx, GLenum target,
+ GLint internalFormat,
GLenum format, GLenum type);
diff --git a/mesalib/src/mesa/state_tracker/st_manager.c b/mesalib/src/mesa/state_tracker/st_manager.c
index 5142eb2dd..df73d0e1b 100644
--- a/mesalib/src/mesa/state_tracker/st_manager.c
+++ b/mesalib/src/mesa/state_tracker/st_manager.c
@@ -468,7 +468,7 @@ st_context_flush(struct st_context_iface *stctxi, unsigned flags,
static boolean
st_context_teximage(struct st_context_iface *stctxi,
- enum st_texture_type target,
+ enum st_texture_type tex_type,
int level, enum pipe_format internal_format,
struct pipe_resource *tex, boolean mipmap)
{
@@ -481,8 +481,9 @@ st_context_teximage(struct st_context_iface *stctxi,
struct st_texture_image *stImage;
GLenum internalFormat;
GLuint width, height, depth;
+ GLenum target;
- switch (target) {
+ switch (tex_type) {
case ST_TEXTURE_1D:
target = GL_TEXTURE_1D;
break;
@@ -497,7 +498,6 @@ st_context_teximage(struct st_context_iface *stctxi,
break;
default:
return FALSE;
- break;
}
texObj = _mesa_select_tex_object(ctx, texUnit, target);
@@ -533,7 +533,7 @@ st_context_teximage(struct st_context_iface *stctxi,
else
internalFormat = GL_RGB;
- texFormat = st_ChooseTextureFormat(ctx, internalFormat,
+ texFormat = st_ChooseTextureFormat(ctx, target, internalFormat,
GL_BGRA, GL_UNSIGNED_BYTE);
_mesa_init_teximage_fields(ctx, texImage,
@@ -637,7 +637,7 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
}
st_visual_to_context_mode(&attribs->visual, &mode);
- st = st_create_context(api, pipe, &mode, shared_ctx);
+ st = st_create_context(api, pipe, &mode, shared_ctx, &attribs->options);
if (!st) {
*error = ST_CONTEXT_ERROR_NO_MEMORY;
pipe->destroy(pipe);
diff --git a/mesalib/src/mesa/swrast/s_texfetch.c b/mesalib/src/mesa/swrast/s_texfetch.c
index db7c887b6..741dd876c 100644
--- a/mesalib/src/mesa/swrast/s_texfetch.c
+++ b/mesalib/src/mesa/swrast/s_texfetch.c
@@ -426,27 +426,27 @@ texfetch_funcs[MESA_FORMAT_COUNT] =
},
{
MESA_FORMAT_SRGB_DXT1,
- NULL,
- _mesa_fetch_texel_2d_f_srgb_dxt1,
- NULL
+ _mesa_fetch_texel_srgb_dxt1,
+ _mesa_fetch_texel_srgb_dxt1,
+ _mesa_fetch_texel_srgb_dxt1
},
{
MESA_FORMAT_SRGBA_DXT1,
- NULL,
- _mesa_fetch_texel_2d_f_srgba_dxt1,
- NULL
+ _mesa_fetch_texel_srgba_dxt1,
+ _mesa_fetch_texel_srgba_dxt1,
+ _mesa_fetch_texel_srgba_dxt1
},
{
MESA_FORMAT_SRGBA_DXT3,
- NULL,
- _mesa_fetch_texel_2d_f_srgba_dxt3,
- NULL
+ _mesa_fetch_texel_srgba_dxt3,
+ _mesa_fetch_texel_srgba_dxt3,
+ _mesa_fetch_texel_srgba_dxt3
},
{
MESA_FORMAT_SRGBA_DXT5,
- NULL,
- _mesa_fetch_texel_2d_f_srgba_dxt5,
- NULL
+ _mesa_fetch_texel_srgba_dxt5,
+ _mesa_fetch_texel_srgba_dxt5,
+ _mesa_fetch_texel_srgba_dxt5
},
{
@@ -463,27 +463,27 @@ texfetch_funcs[MESA_FORMAT_COUNT] =
},
{
MESA_FORMAT_RGB_DXT1,
- NULL,
- _mesa_fetch_texel_2d_f_rgb_dxt1,
- NULL
+ _mesa_fetch_texel_rgb_dxt1,
+ _mesa_fetch_texel_rgb_dxt1,
+ _mesa_fetch_texel_rgb_dxt1
},
{
MESA_FORMAT_RGBA_DXT1,
- NULL,
- _mesa_fetch_texel_2d_f_rgba_dxt1,
- NULL
+ _mesa_fetch_texel_rgba_dxt1,
+ _mesa_fetch_texel_rgba_dxt1,
+ _mesa_fetch_texel_rgba_dxt1
},
{
MESA_FORMAT_RGBA_DXT3,
- NULL,
- _mesa_fetch_texel_2d_f_rgba_dxt3,
- NULL
+ _mesa_fetch_texel_rgba_dxt3,
+ _mesa_fetch_texel_rgba_dxt3,
+ _mesa_fetch_texel_rgba_dxt3
},
{
MESA_FORMAT_RGBA_DXT5,
- NULL,
- _mesa_fetch_texel_2d_f_rgba_dxt5,
- NULL
+ _mesa_fetch_texel_rgba_dxt5,
+ _mesa_fetch_texel_rgba_dxt5,
+ _mesa_fetch_texel_rgba_dxt5
},
{
MESA_FORMAT_RGBA_FLOAT32,
@@ -976,51 +976,51 @@ texfetch_funcs[MESA_FORMAT_COUNT] =
},
{
MESA_FORMAT_RED_RGTC1,
- NULL,
- _mesa_fetch_texel_2d_f_red_rgtc1,
- NULL
+ _mesa_fetch_texel_red_rgtc1,
+ _mesa_fetch_texel_red_rgtc1,
+ _mesa_fetch_texel_red_rgtc1
},
{
MESA_FORMAT_SIGNED_RED_RGTC1,
- NULL,
- _mesa_fetch_texel_2d_f_signed_red_rgtc1,
- NULL
+ _mesa_fetch_texel_signed_red_rgtc1,
+ _mesa_fetch_texel_signed_red_rgtc1,
+ _mesa_fetch_texel_signed_red_rgtc1
},
{
MESA_FORMAT_RG_RGTC2,
- NULL,
- _mesa_fetch_texel_2d_f_rg_rgtc2,
- NULL
+ _mesa_fetch_texel_rg_rgtc2,
+ _mesa_fetch_texel_rg_rgtc2,
+ _mesa_fetch_texel_rg_rgtc2
},
{
MESA_FORMAT_SIGNED_RG_RGTC2,
- NULL,
- _mesa_fetch_texel_2d_f_signed_rg_rgtc2,
- NULL
+ _mesa_fetch_texel_signed_rg_rgtc2,
+ _mesa_fetch_texel_signed_rg_rgtc2,
+ _mesa_fetch_texel_signed_rg_rgtc2
},
{
MESA_FORMAT_L_LATC1,
- NULL,
- _mesa_fetch_texel_2d_f_l_latc1,
- NULL
+ _mesa_fetch_texel_l_latc1,
+ _mesa_fetch_texel_l_latc1,
+ _mesa_fetch_texel_l_latc1
},
{
MESA_FORMAT_SIGNED_L_LATC1,
- NULL,
- _mesa_fetch_texel_2d_f_signed_l_latc1,
- NULL
+ _mesa_fetch_texel_signed_l_latc1,
+ _mesa_fetch_texel_signed_l_latc1,
+ _mesa_fetch_texel_signed_l_latc1
},
{
MESA_FORMAT_LA_LATC2,
- NULL,
- _mesa_fetch_texel_2d_f_la_latc2,
- NULL
+ _mesa_fetch_texel_la_latc2,
+ _mesa_fetch_texel_la_latc2,
+ _mesa_fetch_texel_la_latc2
},
{
MESA_FORMAT_SIGNED_LA_LATC2,
- NULL,
- _mesa_fetch_texel_2d_f_signed_la_latc2,
- NULL
+ _mesa_fetch_texel_signed_la_latc2,
+ _mesa_fetch_texel_signed_la_latc2,
+ _mesa_fetch_texel_signed_la_latc2
},
{
MESA_FORMAT_ETC1_RGB8,
diff --git a/mesalib/src/mesa/swrast/s_texfilter.c b/mesalib/src/mesa/swrast/s_texfilter.c
index 3c2aae913..d116a059d 100644
--- a/mesalib/src/mesa/swrast/s_texfilter.c
+++ b/mesalib/src/mesa/swrast/s_texfilter.c
@@ -800,6 +800,42 @@ get_border_color(const struct gl_sampler_object *samp,
}
+/**
+ * Put z into texel according to GL_DEPTH_MODE.
+ */
+static INLINE void
+apply_depth_mode(GLenum depthMode, GLfloat z, GLfloat texel[4])
+{
+ switch (depthMode) {
+ case GL_LUMINANCE:
+ ASSIGN_4V(texel, z, z, z, 1.0F);
+ break;
+ case GL_INTENSITY:
+ ASSIGN_4V(texel, z, z, z, z);
+ break;
+ case GL_ALPHA:
+ ASSIGN_4V(texel, 0.0F, 0.0F, 0.0F, z);
+ break;
+ case GL_RED:
+ ASSIGN_4V(texel, z, 0.0F, 0.0F, 1.0F);
+ break;
+ default:
+ _mesa_problem(NULL, "Bad depth texture mode");
+ }
+}
+
+
+/**
+ * Is the given texture a depth (or depth/stencil) texture?
+ */
+static GLboolean
+is_depth_texture(const struct gl_texture_object *tObj)
+{
+ GLenum format = tObj->Image[0][tObj->BaseLevel]->_BaseFormat;
+ return format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL_EXT;
+}
+
+
/**********************************************************************/
/* 1-D Texture Sampling Functions */
/**********************************************************************/
@@ -2391,6 +2427,11 @@ sample_nearest_cube(struct gl_context *ctx,
sample_2d_nearest(ctx, samp, images[tObj->BaseLevel],
newCoord, rgba[i]);
}
+ if (is_depth_texture(tObj)) {
+ for (i = 0; i < n; i++) {
+ apply_depth_mode(tObj->DepthMode, rgba[i][0], rgba[i]);
+ }
+ }
}
@@ -2410,6 +2451,11 @@ sample_linear_cube(struct gl_context *ctx,
sample_2d_linear(ctx, samp, images[tObj->BaseLevel],
newCoord, rgba[i]);
}
+ if (is_depth_texture(tObj)) {
+ for (i = 0; i < n; i++) {
+ apply_depth_mode(tObj->DepthMode, rgba[i][0], rgba[i]);
+ }
+ }
}
@@ -2440,6 +2486,11 @@ sample_cube_nearest_mipmap_nearest(struct gl_context *ctx,
sample_2d_nearest(ctx, samp, images[level], newCoord, rgba[i]);
}
+ if (is_depth_texture(tObj)) {
+ for (i = 0; i < n; i++) {
+ apply_depth_mode(tObj->DepthMode, rgba[i][0], rgba[i]);
+ }
+ }
}
@@ -2460,6 +2511,11 @@ sample_cube_linear_mipmap_nearest(struct gl_context *ctx,
images = choose_cube_face(tObj, texcoord[i], newCoord);
sample_2d_linear(ctx, samp, images[level], newCoord, rgba[i]);
}
+ if (is_depth_texture(tObj)) {
+ for (i = 0; i < n; i++) {
+ apply_depth_mode(tObj->DepthMode, rgba[i][0], rgba[i]);
+ }
+ }
}
@@ -2490,6 +2546,11 @@ sample_cube_nearest_mipmap_linear(struct gl_context *ctx,
lerp_rgba(rgba[i], f, t0, t1);
}
}
+ if (is_depth_texture(tObj)) {
+ for (i = 0; i < n; i++) {
+ apply_depth_mode(tObj->DepthMode, rgba[i][0], rgba[i]);
+ }
+ }
}
@@ -2520,6 +2581,11 @@ sample_cube_linear_mipmap_linear(struct gl_context *ctx,
lerp_rgba(rgba[i], f, t0, t1);
}
}
+ if (is_depth_texture(tObj)) {
+ for (i = 0; i < n; i++) {
+ apply_depth_mode(tObj->DepthMode, rgba[i][0], rgba[i]);
+ }
+ }
}
@@ -3520,23 +3586,7 @@ sample_depth_texture( struct gl_context *ctx,
result = shadow_compare(function, depthRef, depthSample);
- switch (tObj->DepthMode) {
- case GL_LUMINANCE:
- ASSIGN_4V(texel[i], result, result, result, 1.0F);
- break;
- case GL_INTENSITY:
- ASSIGN_4V(texel[i], result, result, result, result);
- break;
- case GL_ALPHA:
- ASSIGN_4V(texel[i], 0.0F, 0.0F, 0.0F, result);
- break;
- case GL_RED:
- ASSIGN_4V(texel[i], result, 0.0F, 0.0F, 1.0F);
- break;
- default:
- _mesa_problem(ctx, "Bad depth texture mode");
- break;
- }
+ apply_depth_mode(tObj->DepthMode, result, texel[i]);
}
}
else {
@@ -3615,20 +3665,7 @@ sample_depth_texture( struct gl_context *ctx,
depth00, depth01, depth10, depth11,
wi, wj);
- switch (tObj->DepthMode) {
- case GL_LUMINANCE:
- ASSIGN_4V(texel[i], result, result, result, 1.0F);
- break;
- case GL_INTENSITY:
- ASSIGN_4V(texel[i], result, result, result, result);
- break;
- case GL_ALPHA:
- ASSIGN_4V(texel[i], 0.0F, 0.0F, 0.0F, result);
- break;
- default:
- _mesa_problem(ctx, "Bad depth texture mode");
- }
-
+ apply_depth_mode(tObj->DepthMode, result, texel[i]);
} /* for */
} /* if filter */
}
@@ -3676,11 +3713,10 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx,
else {
const GLboolean needLambda =
(GLboolean) (sampler->MinFilter != sampler->MagFilter);
- const GLenum format = t->Image[0][t->BaseLevel]->_BaseFormat;
switch (t->Target) {
case GL_TEXTURE_1D:
- if (format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL_EXT) {
+ if (is_depth_texture(t)) {
return &sample_depth_texture;
}
else if (needLambda) {
@@ -3694,7 +3730,7 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx,
return &sample_nearest_1d;
}
case GL_TEXTURE_2D:
- if (format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL_EXT) {
+ if (is_depth_texture(t)) {
return &sample_depth_texture;
}
else if (needLambda) {
@@ -3741,10 +3777,7 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx,
return &sample_nearest_3d;
}
case GL_TEXTURE_CUBE_MAP:
- if (format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL_EXT) {
- return &sample_depth_texture;
- }
- else if (needLambda) {
+ if (needLambda) {
return &sample_lambda_cube;
}
else if (sampler->MinFilter == GL_LINEAR) {
@@ -3755,7 +3788,7 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx,
return &sample_nearest_cube;
}
case GL_TEXTURE_RECTANGLE_NV:
- if (format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL_EXT) {
+ if (is_depth_texture(t)) {
return &sample_depth_texture;
}
else if (needLambda) {
@@ -3769,7 +3802,7 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx,
return &sample_nearest_rect;
}
case GL_TEXTURE_1D_ARRAY_EXT:
- if (format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL_EXT) {
+ if (is_depth_texture(t)) {
return &sample_depth_texture;
}
else if (needLambda) {
@@ -3783,7 +3816,7 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx,
return &sample_nearest_1d_array;
}
case GL_TEXTURE_2D_ARRAY_EXT:
- if (format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL_EXT) {
+ if (is_depth_texture(t)) {
return &sample_depth_texture;
}
else if (needLambda) {
diff --git a/mesalib/src/mesa/swrast/s_texture.c b/mesalib/src/mesa/swrast/s_texture.c
index 8df4b8439..1b73d46e4 100644
--- a/mesalib/src/mesa/swrast/s_texture.c
+++ b/mesalib/src/mesa/swrast/s_texture.c
@@ -29,6 +29,7 @@
#include "main/context.h"
#include "main/fbobject.h"
#include "main/teximage.h"
+#include "main/texobj.h"
#include "swrast/swrast.h"
#include "swrast/s_context.h"
@@ -246,7 +247,7 @@ _swrast_unmap_teximage(struct gl_context *ctx,
void
_swrast_map_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
{
- const GLuint faces = texObj->Target == GL_TEXTURE_CUBE_MAP ? 6 : 1;
+ const GLuint faces = _mesa_num_tex_faces(texObj->Target);
GLuint face, level;
for (face = 0; face < faces; face++) {
@@ -267,7 +268,7 @@ _swrast_map_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
void
_swrast_unmap_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
{
- const GLuint faces = texObj->Target == GL_TEXTURE_CUBE_MAP ? 6 : 1;
+ const GLuint faces = _mesa_num_tex_faces(texObj->Target);
GLuint face, level;
for (face = 0; face < faces; face++) {