aboutsummaryrefslogtreecommitdiff
path: root/mesalib
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-03-26 14:23:28 +0200
committermarha <marha@users.sourceforge.net>2012-03-26 14:23:28 +0200
commit76bcc36ed305418a3ddc5752d287ede894243e1b (patch)
treebacb320c825768471ce56f058f17ce863d592376 /mesalib
parent7d894e32566b710952c44cbc71939ad1d9e2fa8d (diff)
parent0f834b91a4768673833ab4917e87d86c237bb1a6 (diff)
downloadvcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.gz
vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.bz2
vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.zip
Merge remote-tracking branch 'origin/released'
Conflicts: pixman/pixman/pixman-mmx.c xorg-server/Xext/shm.c xorg-server/Xext/syncsrv.h xorg-server/Xext/xvmain.c xorg-server/Xi/exevents.c xorg-server/Xi/opendev.c xorg-server/composite/compalloc.c xorg-server/composite/compoverlay.c xorg-server/dix/colormap.c xorg-server/dix/devices.c xorg-server/dix/dispatch.c xorg-server/dix/dixfonts.c xorg-server/dix/eventconvert.c xorg-server/dix/events.c xorg-server/dix/gc.c xorg-server/dix/getevents.c xorg-server/dix/main.c xorg-server/dix/privates.c xorg-server/dix/registry.c xorg-server/dix/resource.c xorg-server/exa/exa_accel.c xorg-server/exa/exa_migration_classic.c xorg-server/exa/exa_unaccel.c xorg-server/fb/fb.h xorg-server/fb/fbcopy.c xorg-server/fb/fbpixmap.c xorg-server/glx/dispatch.h xorg-server/glx/glapi.h xorg-server/glx/glapi_gentable.c xorg-server/glx/glapitable.h xorg-server/glx/glprocs.h xorg-server/glx/glxcmds.c xorg-server/glx/glxcmdsswap.c xorg-server/glx/glxdricommon.c xorg-server/glx/glxdriswrast.c xorg-server/glx/glxext.c xorg-server/glx/indirect_dispatch.c xorg-server/glx/indirect_dispatch.h xorg-server/glx/indirect_dispatch_swap.c xorg-server/glx/indirect_size.h xorg-server/glx/indirect_size_get.h xorg-server/glx/indirect_table.c xorg-server/glx/indirect_util.c xorg-server/glx/rensize.c xorg-server/glx/single2swap.c xorg-server/glx/singlepix.c xorg-server/glx/singlepixswap.c xorg-server/glx/singlesize.c xorg-server/hw/dmx/dmxinit.c xorg-server/hw/kdrive/ephyr/ephyr.c xorg-server/hw/kdrive/ephyr/hostx.c xorg-server/hw/kdrive/ephyr/hostx.h xorg-server/hw/kdrive/src/kinput.c xorg-server/hw/xfree86/common/compiler.h xorg-server/hw/xwin/InitInput.c xorg-server/hw/xwin/InitOutput.c xorg-server/hw/xwin/ddraw.h xorg-server/hw/xwin/glx/glwrap.c xorg-server/hw/xwin/glx/indirect.c xorg-server/hw/xwin/glx/wgl_ext_api.h xorg-server/hw/xwin/glx/winpriv.c xorg-server/hw/xwin/win.h xorg-server/hw/xwin/winallpriv.c xorg-server/hw/xwin/winauth.c xorg-server/hw/xwin/winclipboard.h xorg-server/hw/xwin/winclipboardinit.c xorg-server/hw/xwin/winclipboardthread.c xorg-server/hw/xwin/winclipboardunicode.c xorg-server/hw/xwin/winclipboardwndproc.c xorg-server/hw/xwin/winclipboardwrappers.c xorg-server/hw/xwin/winclipboardxevents.c xorg-server/hw/xwin/wincmap.c xorg-server/hw/xwin/winconfig.c xorg-server/hw/xwin/wincreatewnd.c xorg-server/hw/xwin/wincursor.c xorg-server/hw/xwin/windialogs.c xorg-server/hw/xwin/winengine.c xorg-server/hw/xwin/winerror.c xorg-server/hw/xwin/wingc.c xorg-server/hw/xwin/wingetsp.c xorg-server/hw/xwin/winkeybd.c xorg-server/hw/xwin/winkeybd.h xorg-server/hw/xwin/winlayouts.h xorg-server/hw/xwin/winmisc.c xorg-server/hw/xwin/winmonitors.c xorg-server/hw/xwin/winmouse.c xorg-server/hw/xwin/winmsg.c xorg-server/hw/xwin/winmsg.h xorg-server/hw/xwin/winmultiwindowclass.c xorg-server/hw/xwin/winmultiwindowicons.c xorg-server/hw/xwin/winmultiwindowshape.c xorg-server/hw/xwin/winmultiwindowwindow.c xorg-server/hw/xwin/winmultiwindowwm.c xorg-server/hw/xwin/winmultiwindowwndproc.c xorg-server/hw/xwin/winnativegdi.c xorg-server/hw/xwin/winpfbdd.c xorg-server/hw/xwin/winpixmap.c xorg-server/hw/xwin/winpolyline.c xorg-server/hw/xwin/winprefs.c xorg-server/hw/xwin/winprocarg.c xorg-server/hw/xwin/winregistry.c xorg-server/hw/xwin/winscrinit.c xorg-server/hw/xwin/winsetsp.c xorg-server/hw/xwin/winshaddd.c xorg-server/hw/xwin/winshadddnl.c xorg-server/hw/xwin/winshadgdi.c xorg-server/hw/xwin/wintrayicon.c xorg-server/hw/xwin/winwin32rootless.c xorg-server/hw/xwin/winwin32rootlesswindow.c xorg-server/hw/xwin/winwin32rootlesswndproc.c xorg-server/hw/xwin/winwindow.c xorg-server/hw/xwin/winwindow.h xorg-server/hw/xwin/winwindowswm.c xorg-server/hw/xwin/winwndproc.c xorg-server/include/callback.h xorg-server/include/dixstruct.h xorg-server/include/misc.h xorg-server/include/os.h xorg-server/include/scrnintstr.h xorg-server/mi/micmap.c xorg-server/mi/miinitext.c xorg-server/mi/mioverlay.c xorg-server/mi/misprite.c xorg-server/mi/mivaltree.c xorg-server/mi/miwindow.c xorg-server/miext/damage/damage.c xorg-server/miext/rootless/rootlessGC.c xorg-server/miext/rootless/rootlessWindow.c xorg-server/os/WaitFor.c xorg-server/os/access.c xorg-server/os/connection.c xorg-server/os/io.c xorg-server/os/log.c xorg-server/os/osinit.c xorg-server/os/utils.c xorg-server/os/xdmcp.c xorg-server/os/xprintf.c xorg-server/os/xstrans.c xorg-server/render/mipict.c xorg-server/xkb/xkbActions.c xorg-server/xkb/xkbInit.c xorg-server/xkeyboard-config/compat/default.in
Diffstat (limited to 'mesalib')
-rw-r--r--mesalib/Makefile6
-rw-r--r--mesalib/configs/darwin23
-rw-r--r--mesalib/configs/darwin-fat-intel7
-rw-r--r--mesalib/configure.ac29
-rw-r--r--mesalib/docs/banner.html46
-rw-r--r--mesalib/docs/bugs.html3
-rw-r--r--mesalib/docs/install.html8
-rw-r--r--mesalib/docs/news.html8
-rw-r--r--mesalib/docs/relnotes.html1
-rw-r--r--mesalib/src/glsl/ast_to_hir.cpp23
-rw-r--r--mesalib/src/glsl/builtin_types.h12
-rw-r--r--mesalib/src/glsl/builtin_variables.cpp261
-rw-r--r--mesalib/src/glsl/glsl_parser.yy3
-rw-r--r--mesalib/src/glsl/glsl_parser_extras.cpp2
-rw-r--r--mesalib/src/glsl/glsl_parser_extras.h1
-rw-r--r--mesalib/src/glsl/glsl_types.cpp40
-rw-r--r--mesalib/src/glsl/glsl_types.h8
-rw-r--r--mesalib/src/glsl/linker.cpp41
-rw-r--r--mesalib/src/glsl/main.cpp6
-rw-r--r--mesalib/src/mapi/Android.mk4
-rw-r--r--mesalib/src/mapi/glapi/Makefile8
-rw-r--r--mesalib/src/mapi/mapi/sources.mak42
-rw-r--r--mesalib/src/mesa/drivers/dri/common/dri_util.c24
-rw-r--r--mesalib/src/mesa/drivers/dri/common/drirc8
-rw-r--r--mesalib/src/mesa/main/api_validate.c73
-rw-r--r--mesalib/src/mesa/main/api_validate.h2
-rw-r--r--mesalib/src/mesa/main/dlist.c10
-rw-r--r--mesalib/src/mesa/main/getstring.c2
-rw-r--r--mesalib/src/mesa/main/mtypes.h4
-rw-r--r--mesalib/src/mesa/main/samplerobj.c9
-rw-r--r--mesalib/src/mesa/main/samplerobj.h21
-rw-r--r--mesalib/src/mesa/main/teximage.c17
-rw-r--r--mesalib/src/mesa/main/texobj.c334
-rw-r--r--mesalib/src/mesa/main/texobj.h21
-rw-r--r--mesalib/src/mesa/main/texparam.c10
-rw-r--r--mesalib/src/mesa/main/texstate.c7
-rw-r--r--mesalib/src/mesa/main/transformfeedback.c27
-rw-r--r--mesalib/src/mesa/main/transformfeedback.h3
-rw-r--r--mesalib/src/mesa/main/uniform_query.cpp16
-rw-r--r--mesalib/src/mesa/main/uniforms.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_extensions.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_texture.c3
-rw-r--r--mesalib/src/mesa/swrast/s_context.c5
-rw-r--r--mesalib/src/mesa/swrast/s_texfilter.c6
-rw-r--r--mesalib/src/mesa/swrast/s_texfilter.h83
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_api.c3
47 files changed, 735 insertions, 541 deletions
diff --git a/mesalib/Makefile b/mesalib/Makefile
index 6120fbe9f..77c9154ff 100644
--- a/mesalib/Makefile
+++ b/mesalib/Makefile
@@ -199,6 +199,12 @@ EXTRA_FILES = \
src/glsl/glcpp/glcpp-lex.c \
src/glsl/glcpp/glcpp-parse.c \
src/glsl/glcpp/glcpp-parse.h \
+ src/mesa/main/api_exec_es1.c \
+ src/mesa/main/api_exec_es1_dispatch.h \
+ src/mesa/main/api_exec_es1_remap_helper.h \
+ src/mesa/main/api_exec_es2.c \
+ src/mesa/main/api_exec_es2_dispatch.h \
+ src/mesa/main/api_exec_es2_remap_helper.h \
src/mesa/program/lex.yy.c \
src/mesa/program/program_parse.tab.c \
src/mesa/program/program_parse.tab.h
diff --git a/mesalib/configs/darwin b/mesalib/configs/darwin
index e2ca70af9..721fbc780 100644
--- a/mesalib/configs/darwin
+++ b/mesalib/configs/darwin
@@ -9,8 +9,8 @@ INSTALL_DIR = /usr/X11
X11_DIR = $(INSTALL_DIR)
# Compiler and flags
-CC = gcc
-CXX = g++
+CC = $(shell xcrun -find cc)
+CXX = $(shell xcrun -find c++)
PIC_FLAGS = -fPIC
DEFINES = -D_DARWIN_C_SOURCE -DPTHREADS -D_GNU_SOURCE \
-DGLX_ALIAS_UNSUPPORTED \
@@ -24,11 +24,14 @@ DEFINES = -D_DARWIN_C_SOURCE -DPTHREADS -D_GNU_SOURCE \
# -DIN_DRI_DRIVER
ARCH_FLAGS += $(RC_CFLAGS)
+INCLUDE_FLAGS = -I$(INSTALL_DIR)/include -I$(X11_DIR)/include
+OPT_FLAGS = -g3 -gdwarf-2 -Os -ffast-math -fno-strict-aliasing
+WARN_FLAGS = -Wall -Wmissing-prototypes
-CFLAGS = -ggdb3 -Os -Wall -Wmissing-prototypes -std=c99 -ffast-math -fno-strict-aliasing -fvisibility=hidden \
- -I$(INSTALL_DIR)/include -I$(X11_DIR)/include $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
-CXXFLAGS = -ggdb3 -Os -Wall -fno-strict-aliasing -fvisibility=hidden \
- -I$(INSTALL_DIR)/include -I$(X11_DIR)/include $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
+CFLAGS = -std=c99 -fvisibility=hidden \
+ $(OPT_FLAGS) $(WARN_FLAGS) $(INCLUDE_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES) $(EXTRA_CFLAGS)
+CXXFLAGS = -fvisibility=hidden \
+ $(OPT_FLAGS) $(WARN_FLAGS) $(INCLUDE_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES) $(EXTRA_CFLAGS)
# Library names (actual file names)
GL_LIB_NAME = lib$(GL_LIB).dylib
@@ -44,10 +47,10 @@ GLW_LIB_GLOB = lib$(GLW_LIB).*dylib
OSMESA_LIB_GLOB = lib$(OSMESA_LIB).*dylib
VG_LIB_GLOB = lib$(VG_LIB).*dylib
-GL_LIB_DEPS = -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXext -lm -lpthread
-OSMESA_LIB_DEPS =
-GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
-GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXt
+GL_LIB_DEPS = -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11-xcb -lxcb -lX11 -lXext $(EXTRA_LDFLAGS)
+OSMESA_LIB_DEPS = $(EXTRA_LDFLAGS)
+GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) $(EXTRA_LDFLAGS)
+GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXt $(EXTRA_LDFLAGS)
SRC_DIRS = glsl mapi/glapi mapi/vgapi glx/apple mesa gallium glu
GLU_DIRS = sgi
diff --git a/mesalib/configs/darwin-fat-intel b/mesalib/configs/darwin-fat-intel
new file mode 100644
index 000000000..273ae3d6a
--- /dev/null
+++ b/mesalib/configs/darwin-fat-intel
@@ -0,0 +1,7 @@
+# Configuration for Darwin / MacOS X, making 32bit and 64bit fat dynamic libs for intel
+
+RC_CFLAGS=-arch i386 -arch x86_64
+
+include $(TOP)/configs/darwin
+
+CONFIG_NAME = darwin-fat-intel
diff --git a/mesalib/configure.ac b/mesalib/configure.ac
index a2d906abb..ac7d49f1f 100644
--- a/mesalib/configure.ac
+++ b/mesalib/configure.ac
@@ -37,7 +37,7 @@ USER_CXXFLAGS="$CXXFLAGS"
dnl Versions for external dependencies
LIBDRM_REQUIRED=2.4.24
LIBDRM_RADEON_REQUIRED=2.4.31
-LIBDRM_INTEL_REQUIRED=2.4.30
+LIBDRM_INTEL_REQUIRED=2.4.32
LIBDRM_NOUVEAU_REQUIRED=0.6
DRI2PROTO_REQUIRED=2.6
GLPROTO_REQUIRED=1.4.14
@@ -702,6 +702,7 @@ if test "x$enable_shared_glapi" = xyes; then
# 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"
fi
AC_SUBST([SHARED_GLAPI])
AM_CONDITIONAL(HAVE_SHARED_GLAPI, test $SHARED_GLAPI = 1)
@@ -1935,6 +1936,29 @@ if test "x$NEED_G3DVL_DRI" = xyes; then
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS g3dvl/dri"
fi
+dnl Tell Automake which drivers to build
+for driver in $GALLIUM_DRIVERS_DIRS; do
+ case "x$driver" in
+ xgalahad)
+ HAVE_GALAHAD_GALLIUM=yes;
+ ;;
+ xidentity)
+ HAVE_IDENTITY_GALLIUM=yes;
+ ;;
+ xnoop)
+ HAVE_NOOP_GALLIUM=yes;
+ ;;
+ *)
+ GALLIUM_MAKE_DIRS="$GALLIUM_MAKE_DIRS $driver"
+ ;;
+ esac
+done
+
+AM_CONDITIONAL(HAVE_GALAHAD_GALLIUM, test x$HAVE_GALAHAD_GALLIUM = xyes)
+AM_CONDITIONAL(HAVE_IDENTITY_GALLIUM, test x$HAVE_IDENTITY_GALLIUM = xyes)
+AM_CONDITIONAL(HAVE_NOOP_GALLIUM, test x$HAVE_NOOP_GALLIUM = xyes)
+AC_SUBST([GALLIUM_MAKE_DIRS])
+
dnl prepend CORE_DIRS to SRC_DIRS
SRC_DIRS="$CORE_DIRS $SRC_DIRS"
@@ -1948,6 +1972,7 @@ CXXFLAGS="$CXXFLAGS $USER_CXXFLAGS"
dnl Substitute the config
AC_CONFIG_FILES([configs/autoconf
+ src/gallium/drivers/Makefile
src/gallium/drivers/r300/Makefile
src/gbm/Makefile
src/gbm/main/gbm.pc
@@ -1961,6 +1986,7 @@ AC_CONFIG_FILES([configs/autoconf
src/egl/wayland/wayland-egl/wayland-egl.pc
src/egl/wayland/wayland-drm/Makefile
src/glx/Makefile
+ src/mapi/shared-glapi/Makefile
src/mesa/drivers/dri/dri.pc
src/mesa/drivers/dri/Makefile
src/mesa/drivers/dri/common/Makefile
@@ -1985,6 +2011,7 @@ dnl Sort the dirs alphabetically
GALLIUM_TARGET_DIRS=`echo $GALLIUM_TARGET_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
GALLIUM_WINSYS_DIRS=`echo $GALLIUM_WINSYS_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
GALLIUM_DRIVERS_DIRS=`echo $GALLIUM_DRIVERS_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
+GALLIUM_MAKE_DIRS=`echo $GALLIUM_MAKE_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
GALLIUM_STATE_TRACKERS_DIRS=`echo $GALLIUM_STATE_TRACKERS_DIRS|tr " " "\n"|sort -u|tr "\n" " "`
AC_OUTPUT
diff --git a/mesalib/docs/banner.html b/mesalib/docs/banner.html
index 9cb27bb6d..4f12c7ac6 100644
--- a/mesalib/docs/banner.html
+++ b/mesalib/docs/banner.html
@@ -1,27 +1,27 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html LANG=en>
<head>
- <title>Banner</title>
+ <title>Banner</title
+><STYLE TYPE="TEXT/CSS" ><!--
+BODY { BACKGROUND: BLACK; COLOR: WHITE } TABLE { width: 94%; text-align: left; }
+TD { vertical-align: top }
+H1 {
+FONT: X-LARGE sans-serif; TEXT-ALIGN: CENTER;
+HEIGHT: 75PX; MARGIN-LEFT: 100PX; MARGIN-RIGHT: 100PX }
+.gears { WIDTH: 100PX; HEIGHT: 73PX; FLOAT: LEFT; BACKGROUND: URL('gears.png') RIGHT NO-REPEAT }
+DIV + .gears { FLOAT: RIGHT; BACKGROUND-POSITION: LEFT }
+/*
+This should happen in the future instead:
+H1 {
+BORDER-LEFT: 71PX SOLID #C11800; BORDER-RIGHT: 71PX SOLID #00C130;
+BORDER-TOP: 0PX; BORDER-BOTTOM: 0PX;
+border-image: url(gears.png) 100%; -WEBKIT-border-image: url(gears.png) 100%;
+}
+*/
+}
+--></STYLE >
</head>
-<body bgcolor="#000000" text="#ffffff">
-<center>
-<table style="width: 95%; text-align: left;" border="0" cellpadding="2"
- cellspacing="2">
- <tbody>
- <tr>
- <td style="vertical-align: top;">
- <p><img src="gears.png"> </p>
- </td>
- <td style="text-align: center;"><font face="sans-serif" size="5">The
-Mesa 3D Graphics Library</font></td>
- <td style="vertical-align: top; text-align: right;">
- <p><img src="gears.png"> </p>
- </td>
- </tr>
- </tbody>
-</table>
-<p><font face="sans-serif" size="5"><br>
-</font></p>
-</center>
+<body ><DIV CLASS="gears" ></DIV ><DIV CLASS="gears" ></DIV ><H1 >The
+Mesa 3D Graphics Library</H1 >
</body>
</html>
diff --git a/mesalib/docs/bugs.html b/mesalib/docs/bugs.html
index 4397339e9..fa7c484cd 100644
--- a/mesalib/docs/bugs.html
+++ b/mesalib/docs/bugs.html
@@ -1,4 +1,5 @@
-<HTML>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" >
+<HTML LANG=en >
<TITLE>Mesa Bug Reporting</TITLE>
diff --git a/mesalib/docs/install.html b/mesalib/docs/install.html
index 0d5bab249..46d0b4c7b 100644
--- a/mesalib/docs/install.html
+++ b/mesalib/docs/install.html
@@ -68,6 +68,14 @@ version 2.4.15 or later
<li>Xorg server version 1.5 or later
</ul>
</p>
+<p>
+If you're using a fedora distro the following command should install all
+the needed dependencies:
+<pre>
+ sudo yum install flex bison imake libtool xorg-x11-proto-devel libdrm-devel \
+ gcc-c++ xorg-x11-server-devel libXi-devel libXmu-devel libXdamage-devel git \
+ expat-devel llvm-devel
+</pre>
<a name="autoconf">
diff --git a/mesalib/docs/news.html b/mesalib/docs/news.html
index 271fbdd1f..fed8881af 100644
--- a/mesalib/docs/news.html
+++ b/mesalib/docs/news.html
@@ -11,6 +11,14 @@
<H1>News</H1>
+<h2>March 21, 2012</h2>
+
+<p>
+<a href="relnotes-8.0.2.html">Mesa 8.0.2</a> is released.
+This is a bug fix release.
+</p>
+
+
<h2>February 16, 2012</h2>
<p>
diff --git a/mesalib/docs/relnotes.html b/mesalib/docs/relnotes.html
index d5c944add..23337cfd3 100644
--- a/mesalib/docs/relnotes.html
+++ b/mesalib/docs/relnotes.html
@@ -13,6 +13,7 @@ The release notes summarize what's new or changed in each Mesa release.
</p>
<UL>
+<LI><A HREF="relnotes-8.0.2.html">8.0.2 release notes</A>
<LI><A HREF="relnotes-8.0.1.html">8.0.1 release notes</A>
<LI><A HREF="relnotes-8.0.html">8.0 release notes</A>
<LI><A HREF="relnotes-7.11.html">7.11 release notes</A>
diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp
index c580359fd..75d7e9d57 100644
--- a/mesalib/src/glsl/ast_to_hir.cpp
+++ b/mesalib/src/glsl/ast_to_hir.cpp
@@ -1199,15 +1199,9 @@ ast_expression::hir(exec_list *instructions,
op[1] = get_scalar_boolean_operand(&rhs_instructions, state, this, 1,
"RHS", &error_emitted);
- ir_constant *op0_const = op[0]->constant_expression_value();
- if (op0_const) {
- if (op0_const->value.b[0]) {
- instructions->append_list(&rhs_instructions);
- result = op[1];
- } else {
- result = op0_const;
- }
- type = glsl_type::bool_type;
+ if (rhs_instructions.is_empty()) {
+ result = new(ctx) ir_expression(ir_binop_logic_and, op[0], op[1]);
+ type = result->type;
} else {
ir_variable *const tmp = new(ctx) ir_variable(glsl_type::bool_type,
"and_tmp",
@@ -1241,14 +1235,9 @@ ast_expression::hir(exec_list *instructions,
op[1] = get_scalar_boolean_operand(&rhs_instructions, state, this, 1,
"RHS", &error_emitted);
- ir_constant *op0_const = op[0]->constant_expression_value();
- if (op0_const) {
- if (op0_const->value.b[0]) {
- result = op0_const;
- } else {
- result = op[1];
- }
- type = glsl_type::bool_type;
+ if (rhs_instructions.is_empty()) {
+ result = new(ctx) ir_expression(ir_binop_logic_or, op[0], op[1]);
+ type = result->type;
} else {
ir_variable *const tmp = new(ctx) ir_variable(glsl_type::bool_type,
"or_tmp",
diff --git a/mesalib/src/glsl/builtin_types.h b/mesalib/src/glsl/builtin_types.h
index cc99b1bde..890c1213f 100644
--- a/mesalib/src/glsl/builtin_types.h
+++ b/mesalib/src/glsl/builtin_types.h
@@ -259,6 +259,18 @@ const glsl_type *const glsl_type::uvec3_type = & builtin_130_types[2];
const glsl_type *const glsl_type::uvec4_type = & builtin_130_types[3];
/*@}*/
+
+/** \name Types added in GLSL 1.30
+ */
+/*@{*/
+const glsl_type glsl_type::builtin_140_types[] = {
+ glsl_type(GL_INT_SAMPLER_2D_RECT,
+ GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_INT, "isampler2DRect"),
+ glsl_type(GL_UNSIGNED_INT_SAMPLER_2D_RECT,
+ GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_UINT, "usampler2DRect"),
+};
+/*@}*/
+
/** \name Sampler types added by GL_ARB_texture_rectangle
*/
/*@{*/
diff --git a/mesalib/src/glsl/builtin_variables.cpp b/mesalib/src/glsl/builtin_variables.cpp
index 66b3abdd8..516a69caf 100644
--- a/mesalib/src/glsl/builtin_variables.cpp
+++ b/mesalib/src/glsl/builtin_variables.cpp
@@ -528,25 +528,30 @@ generate_100ES_uniforms(exec_list *instructions,
static void
generate_110_uniforms(exec_list *instructions,
- struct _mesa_glsl_parse_state *state)
+ struct _mesa_glsl_parse_state *state,
+ bool add_deprecated)
{
glsl_symbol_table *const symtab = state->symbols;
- for (unsigned i = 0
- ; i < Elements(builtin_110_deprecated_uniforms)
- ; i++) {
- add_builtin_variable(instructions, symtab,
- & builtin_110_deprecated_uniforms[i]);
+ if (add_deprecated) {
+ for (unsigned i = 0
+ ; i < Elements(builtin_110_deprecated_uniforms)
+ ; i++) {
+ add_builtin_variable(instructions, symtab,
+ & builtin_110_deprecated_uniforms[i]);
+ }
}
- add_builtin_constant(instructions, symtab, "gl_MaxLights",
- state->Const.MaxLights);
- add_builtin_constant(instructions, symtab, "gl_MaxClipPlanes",
- state->Const.MaxClipPlanes);
- add_builtin_constant(instructions, symtab, "gl_MaxTextureUnits",
- state->Const.MaxTextureUnits);
- add_builtin_constant(instructions, symtab, "gl_MaxTextureCoords",
- state->Const.MaxTextureCoords);
+ if (add_deprecated) {
+ add_builtin_constant(instructions, symtab, "gl_MaxLights",
+ state->Const.MaxLights);
+ add_builtin_constant(instructions, symtab, "gl_MaxClipPlanes",
+ state->Const.MaxClipPlanes);
+ add_builtin_constant(instructions, symtab, "gl_MaxTextureUnits",
+ state->Const.MaxTextureUnits);
+ add_builtin_constant(instructions, symtab, "gl_MaxTextureCoords",
+ state->Const.MaxTextureCoords);
+ }
add_builtin_constant(instructions, symtab, "gl_MaxVertexAttribs",
state->Const.MaxVertexAttribs);
add_builtin_constant(instructions, symtab, "gl_MaxVertexUniformComponents",
@@ -562,65 +567,69 @@ generate_110_uniforms(exec_list *instructions,
add_builtin_constant(instructions, symtab, "gl_MaxFragmentUniformComponents",
state->Const.MaxFragmentUniformComponents);
- const glsl_type *const mat4_array_type =
- glsl_type::get_array_instance(glsl_type::mat4_type,
- state->Const.MaxTextureCoords);
+ if (add_deprecated) {
+ const glsl_type *const mat4_array_type =
+ glsl_type::get_array_instance(glsl_type::mat4_type,
+ state->Const.MaxTextureCoords);
- add_uniform(instructions, symtab, "gl_TextureMatrix", mat4_array_type);
- add_uniform(instructions, symtab, "gl_TextureMatrixInverse", mat4_array_type);
- add_uniform(instructions, symtab, "gl_TextureMatrixTranspose", mat4_array_type);
- add_uniform(instructions, symtab, "gl_TextureMatrixInverseTranspose", mat4_array_type);
+ add_uniform(instructions, symtab, "gl_TextureMatrix", mat4_array_type);
+ add_uniform(instructions, symtab, "gl_TextureMatrixInverse", mat4_array_type);
+ add_uniform(instructions, symtab, "gl_TextureMatrixTranspose", mat4_array_type);
+ add_uniform(instructions, symtab, "gl_TextureMatrixInverseTranspose", mat4_array_type);
+ }
add_uniform(instructions, symtab, "gl_DepthRange",
symtab->get_type("gl_DepthRangeParameters"));
- add_uniform(instructions, symtab, "gl_ClipPlane",
- glsl_type::get_array_instance(glsl_type::vec4_type,
- state->Const.MaxClipPlanes));
- add_uniform(instructions, symtab, "gl_Point",
- symtab->get_type("gl_PointParameters"));
-
- const glsl_type *const material_parameters_type =
- symtab->get_type("gl_MaterialParameters");
- add_uniform(instructions, symtab, "gl_FrontMaterial", material_parameters_type);
- add_uniform(instructions, symtab, "gl_BackMaterial", material_parameters_type);
-
- const glsl_type *const light_source_array_type =
- glsl_type::get_array_instance(symtab->get_type("gl_LightSourceParameters"), state->Const.MaxLights);
-
- add_uniform(instructions, symtab, "gl_LightSource", light_source_array_type);
-
- const glsl_type *const light_model_products_type =
- symtab->get_type("gl_LightModelProducts");
- add_uniform(instructions, symtab, "gl_FrontLightModelProduct",
- light_model_products_type);
- add_uniform(instructions, symtab, "gl_BackLightModelProduct",
- light_model_products_type);
-
- const glsl_type *const light_products_type =
- glsl_type::get_array_instance(symtab->get_type("gl_LightProducts"),
- state->Const.MaxLights);
- add_uniform(instructions, symtab, "gl_FrontLightProduct", light_products_type);
- add_uniform(instructions, symtab, "gl_BackLightProduct", light_products_type);
-
- add_uniform(instructions, symtab, "gl_TextureEnvColor",
- glsl_type::get_array_instance(glsl_type::vec4_type,
- state->Const.MaxTextureUnits));
-
- const glsl_type *const texcoords_vec4 =
- glsl_type::get_array_instance(glsl_type::vec4_type,
- state->Const.MaxTextureCoords);
- add_uniform(instructions, symtab, "gl_EyePlaneS", texcoords_vec4);
- add_uniform(instructions, symtab, "gl_EyePlaneT", texcoords_vec4);
- add_uniform(instructions, symtab, "gl_EyePlaneR", texcoords_vec4);
- add_uniform(instructions, symtab, "gl_EyePlaneQ", texcoords_vec4);
- add_uniform(instructions, symtab, "gl_ObjectPlaneS", texcoords_vec4);
- add_uniform(instructions, symtab, "gl_ObjectPlaneT", texcoords_vec4);
- add_uniform(instructions, symtab, "gl_ObjectPlaneR", texcoords_vec4);
- add_uniform(instructions, symtab, "gl_ObjectPlaneQ", texcoords_vec4);
-
- add_uniform(instructions, symtab, "gl_Fog",
- symtab->get_type("gl_FogParameters"));
+ if (add_deprecated) {
+ add_uniform(instructions, symtab, "gl_ClipPlane",
+ glsl_type::get_array_instance(glsl_type::vec4_type,
+ state->Const.MaxClipPlanes));
+ add_uniform(instructions, symtab, "gl_Point",
+ symtab->get_type("gl_PointParameters"));
+
+ const glsl_type *const material_parameters_type =
+ symtab->get_type("gl_MaterialParameters");
+ add_uniform(instructions, symtab, "gl_FrontMaterial", material_parameters_type);
+ add_uniform(instructions, symtab, "gl_BackMaterial", material_parameters_type);
+
+ const glsl_type *const light_source_array_type =
+ glsl_type::get_array_instance(symtab->get_type("gl_LightSourceParameters"), state->Const.MaxLights);
+
+ add_uniform(instructions, symtab, "gl_LightSource", light_source_array_type);
+
+ const glsl_type *const light_model_products_type =
+ symtab->get_type("gl_LightModelProducts");
+ add_uniform(instructions, symtab, "gl_FrontLightModelProduct",
+ light_model_products_type);
+ add_uniform(instructions, symtab, "gl_BackLightModelProduct",
+ light_model_products_type);
+
+ const glsl_type *const light_products_type =
+ glsl_type::get_array_instance(symtab->get_type("gl_LightProducts"),
+ state->Const.MaxLights);
+ add_uniform(instructions, symtab, "gl_FrontLightProduct", light_products_type);
+ add_uniform(instructions, symtab, "gl_BackLightProduct", light_products_type);
+
+ add_uniform(instructions, symtab, "gl_TextureEnvColor",
+ glsl_type::get_array_instance(glsl_type::vec4_type,
+ state->Const.MaxTextureUnits));
+
+ const glsl_type *const texcoords_vec4 =
+ glsl_type::get_array_instance(glsl_type::vec4_type,
+ state->Const.MaxTextureCoords);
+ add_uniform(instructions, symtab, "gl_EyePlaneS", texcoords_vec4);
+ add_uniform(instructions, symtab, "gl_EyePlaneT", texcoords_vec4);
+ add_uniform(instructions, symtab, "gl_EyePlaneR", texcoords_vec4);
+ add_uniform(instructions, symtab, "gl_EyePlaneQ", texcoords_vec4);
+ add_uniform(instructions, symtab, "gl_ObjectPlaneS", texcoords_vec4);
+ add_uniform(instructions, symtab, "gl_ObjectPlaneT", texcoords_vec4);
+ add_uniform(instructions, symtab, "gl_ObjectPlaneR", texcoords_vec4);
+ add_uniform(instructions, symtab, "gl_ObjectPlaneQ", texcoords_vec4);
+
+ add_uniform(instructions, symtab, "gl_Fog",
+ symtab->get_type("gl_FogParameters"));
+ }
/* Mesa-internal current attrib state */
const glsl_type *const vert_attribs =
@@ -650,20 +659,23 @@ generate_100ES_vs_variables(exec_list *instructions,
static void
generate_110_vs_variables(exec_list *instructions,
- struct _mesa_glsl_parse_state *state)
+ struct _mesa_glsl_parse_state *state,
+ bool add_deprecated)
{
for (unsigned i = 0; i < Elements(builtin_core_vs_variables); i++) {
add_builtin_variable(instructions, state->symbols,
& builtin_core_vs_variables[i]);
}
- for (unsigned i = 0
- ; i < Elements(builtin_110_deprecated_vs_variables)
- ; i++) {
- add_builtin_variable(instructions, state->symbols,
- & builtin_110_deprecated_vs_variables[i]);
+ if (add_deprecated) {
+ for (unsigned i = 0
+ ; i < Elements(builtin_110_deprecated_vs_variables)
+ ; i++) {
+ add_builtin_variable(instructions, state->symbols,
+ & builtin_110_deprecated_vs_variables[i]);
+ }
}
- generate_110_uniforms(instructions, state);
+ generate_110_uniforms(instructions, state, add_deprecated);
/* From page 54 (page 60 of the PDF) of the GLSL 1.20 spec:
*
@@ -686,12 +698,13 @@ generate_110_vs_variables(exec_list *instructions,
static void
generate_120_vs_variables(exec_list *instructions,
- struct _mesa_glsl_parse_state *state)
+ struct _mesa_glsl_parse_state *state,
+ bool add_deprecated)
{
/* GLSL version 1.20 did not add any built-in variables in the vertex
* shader.
*/
- generate_110_vs_variables(instructions, state);
+ generate_110_vs_variables(instructions, state, add_deprecated);
}
@@ -710,9 +723,10 @@ generate_130_uniforms(exec_list *instructions,
static void
generate_130_vs_variables(exec_list *instructions,
- struct _mesa_glsl_parse_state *state)
+ struct _mesa_glsl_parse_state *state,
+ bool add_deprecated)
{
- generate_120_vs_variables(instructions, state);
+ generate_120_vs_variables(instructions, state, add_deprecated);
for (unsigned i = 0; i < Elements(builtin_130_vs_variables); i++) {
add_builtin_variable(instructions, state->symbols,
@@ -751,19 +765,21 @@ initialize_vs_variables(exec_list *instructions,
generate_100ES_vs_variables(instructions, state);
break;
case 110:
- generate_110_vs_variables(instructions, state);
+ generate_110_vs_variables(instructions, state, true);
break;
case 120:
- generate_120_vs_variables(instructions, state);
+ generate_120_vs_variables(instructions, state, true);
break;
case 130:
- generate_130_vs_variables(instructions, state);
+ generate_130_vs_variables(instructions, state, true);
+ break;
+ case 140:
+ generate_130_vs_variables(instructions, state, false);
break;
}
- if (state->ARB_draw_instanced_enable)
- generate_ARB_draw_instanced_variables(instructions, state, false,
- vertex_shader);
+ generate_ARB_draw_instanced_variables(instructions, state, false,
+ vertex_shader);
}
@@ -790,7 +806,8 @@ generate_100ES_fs_variables(exec_list *instructions,
static void
generate_110_fs_variables(exec_list *instructions,
- struct _mesa_glsl_parse_state *state)
+ struct _mesa_glsl_parse_state *state,
+ bool add_deprecated)
{
for (unsigned i = 0; i < Elements(builtin_core_fs_variables); i++) {
add_builtin_variable(instructions, state->symbols,
@@ -802,13 +819,16 @@ generate_110_fs_variables(exec_list *instructions,
& builtin_110_fs_variables[i]);
}
- for (unsigned i = 0
- ; i < Elements(builtin_110_deprecated_fs_variables)
- ; i++) {
- add_builtin_variable(instructions, state->symbols,
- & builtin_110_deprecated_fs_variables[i]);
+ if (add_deprecated) {
+ for (unsigned i = 0
+ ; i < Elements(builtin_110_deprecated_fs_variables)
+ ; i++) {
+ add_builtin_variable(instructions, state->symbols,
+ & builtin_110_deprecated_fs_variables[i]);
+ }
}
- generate_110_uniforms(instructions, state);
+
+ generate_110_uniforms(instructions, state, add_deprecated);
/* From page 54 (page 60 of the PDF) of the GLSL 1.20 spec:
*
@@ -869,7 +889,10 @@ generate_ARB_draw_instanced_variables(exec_list *instructions,
{
/* gl_InstanceIDARB is only available in the vertex shader.
*/
- if (target == vertex_shader) {
+ if (target != vertex_shader)
+ return;
+
+ if (state->ARB_draw_instanced_enable) {
ir_variable *inst =
add_variable(instructions, state->symbols,
"gl_InstanceIDARB", glsl_type::int_type,
@@ -877,17 +900,20 @@ generate_ARB_draw_instanced_variables(exec_list *instructions,
if (warn)
inst->warn_extension = "GL_ARB_draw_instanced";
+ }
+ if (state->ARB_draw_instanced_enable || state->language_version >= 140) {
/* Originally ARB_draw_instanced only specified that ARB decorated name.
* Since no vendor actually implemented that behavior and some apps use
* the undecorated name, the extension now specifies that both names are
* available.
*/
- inst = add_variable(instructions, state->symbols,
- "gl_InstanceID", glsl_type::int_type,
- ir_var_system_value, SYSTEM_VALUE_INSTANCE_ID);
+ ir_variable *inst =
+ add_variable(instructions, state->symbols,
+ "gl_InstanceID", glsl_type::int_type,
+ ir_var_system_value, SYSTEM_VALUE_INSTANCE_ID);
- if (warn)
+ if (state->language_version < 140 && warn)
inst->warn_extension = "GL_ARB_draw_instanced";
}
}
@@ -927,9 +953,10 @@ generate_AMD_shader_stencil_export_variables(exec_list *instructions,
static void
generate_120_fs_variables(exec_list *instructions,
- struct _mesa_glsl_parse_state *state)
+ struct _mesa_glsl_parse_state *state,
+ bool add_deprecated)
{
- generate_110_fs_variables(instructions, state);
+ generate_110_fs_variables(instructions, state, add_deprecated);
for (unsigned i = 0
; i < Elements(builtin_120_fs_variables)
@@ -940,13 +967,9 @@ generate_120_fs_variables(exec_list *instructions,
}
static void
-generate_130_fs_variables(exec_list *instructions,
- struct _mesa_glsl_parse_state *state)
+generate_fs_clipdistance(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
{
- generate_120_fs_variables(instructions, state);
-
- generate_130_uniforms(instructions, state);
-
/* From the GLSL 1.30 spec, section 7.2 (Fragment Shader Special
* Variables):
*
@@ -968,6 +991,27 @@ generate_130_fs_variables(exec_list *instructions,
}
static void
+generate_130_fs_variables(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
+{
+ generate_120_fs_variables(instructions, state, true);
+
+ generate_130_uniforms(instructions, state);
+ generate_fs_clipdistance(instructions, state);
+}
+
+
+static void
+generate_140_fs_variables(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
+{
+ generate_120_fs_variables(instructions, state, false);
+
+ generate_130_uniforms(instructions, state);
+ generate_fs_clipdistance(instructions, state);
+}
+
+static void
initialize_fs_variables(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
{
@@ -977,14 +1021,17 @@ initialize_fs_variables(exec_list *instructions,
generate_100ES_fs_variables(instructions, state);
break;
case 110:
- generate_110_fs_variables(instructions, state);
+ generate_110_fs_variables(instructions, state, true);
break;
case 120:
- generate_120_fs_variables(instructions, state);
+ generate_120_fs_variables(instructions, state, true);
break;
case 130:
generate_130_fs_variables(instructions, state);
break;
+ case 140:
+ generate_140_fs_variables(instructions, state);
+ break;
}
if (state->ARB_shader_stencil_export_enable)
diff --git a/mesalib/src/glsl/glsl_parser.yy b/mesalib/src/glsl/glsl_parser.yy
index d5e85abc0..64506b635 100644
--- a/mesalib/src/glsl/glsl_parser.yy
+++ b/mesalib/src/glsl/glsl_parser.yy
@@ -264,6 +264,9 @@ version_statement:
case 130:
supported = state->Const.GLSL_130;
break;
+ case 140:
+ supported = state->Const.GLSL_140;
+ break;
default:
supported = false;
break;
diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp
index 2a72ba1f6..21c3c6ec2 100644
--- a/mesalib/src/glsl/glsl_parser_extras.cpp
+++ b/mesalib/src/glsl/glsl_parser_extras.cpp
@@ -94,6 +94,8 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *ctx,
&& (ctx->Const.GLSLVersion >= 120);
this->Const.GLSL_130 = (ctx->API == API_OPENGL)
&& (ctx->Const.GLSLVersion >= 130);
+ this->Const.GLSL_140 = (ctx->API == API_OPENGL)
+ && (ctx->Const.GLSLVersion >= 140);
const unsigned lowest_version =
(ctx->API == API_OPENGLES2) || ctx->Extensions.ARB_ES2_compatibility
diff --git a/mesalib/src/glsl/glsl_parser_extras.h b/mesalib/src/glsl/glsl_parser_extras.h
index ce207ecda..1d9409056 100644
--- a/mesalib/src/glsl/glsl_parser_extras.h
+++ b/mesalib/src/glsl/glsl_parser_extras.h
@@ -136,6 +136,7 @@ struct _mesa_glsl_parse_state {
unsigned GLSL_110:1;
unsigned GLSL_120:1;
unsigned GLSL_130:1;
+ unsigned GLSL_140:1;
/*@}*/
} Const;
diff --git a/mesalib/src/glsl/glsl_types.cpp b/mesalib/src/glsl/glsl_types.cpp
index 1489aae6d..069ebd10d 100644
--- a/mesalib/src/glsl/glsl_types.cpp
+++ b/mesalib/src/glsl/glsl_types.cpp
@@ -169,7 +169,7 @@ glsl_type::generate_100ES_types(glsl_symbol_table *symtab)
}
void
-glsl_type::generate_110_types(glsl_symbol_table *symtab)
+glsl_type::generate_110_types(glsl_symbol_table *symtab, bool add_deprecated)
{
generate_100ES_types(symtab);
@@ -177,16 +177,18 @@ glsl_type::generate_110_types(glsl_symbol_table *symtab)
Elements(builtin_110_types),
false);
add_types_to_symbol_table(symtab, &_sampler3D_type, 1, false);
- add_types_to_symbol_table(symtab, builtin_110_deprecated_structure_types,
- Elements(builtin_110_deprecated_structure_types),
- false);
+ if (add_deprecated) {
+ add_types_to_symbol_table(symtab, builtin_110_deprecated_structure_types,
+ Elements(builtin_110_deprecated_structure_types),
+ false);
+ }
}
void
-glsl_type::generate_120_types(glsl_symbol_table *symtab)
+glsl_type::generate_120_types(glsl_symbol_table *symtab, bool add_deprecated)
{
- generate_110_types(symtab);
+ generate_110_types(symtab, add_deprecated);
add_types_to_symbol_table(symtab, builtin_120_types,
Elements(builtin_120_types), false);
@@ -194,9 +196,9 @@ glsl_type::generate_120_types(glsl_symbol_table *symtab)
void
-glsl_type::generate_130_types(glsl_symbol_table *symtab)
+glsl_type::generate_130_types(glsl_symbol_table *symtab, bool add_deprecated)
{
- generate_120_types(symtab);
+ generate_120_types(symtab, add_deprecated);
add_types_to_symbol_table(symtab, builtin_130_types,
Elements(builtin_130_types), false);
@@ -205,6 +207,16 @@ glsl_type::generate_130_types(glsl_symbol_table *symtab)
void
+glsl_type::generate_140_types(glsl_symbol_table *symtab)
+{
+ generate_130_types(symtab, false);
+
+ add_types_to_symbol_table(symtab, builtin_140_types,
+ Elements(builtin_140_types), false);
+}
+
+
+void
glsl_type::generate_ARB_texture_rectangle_types(glsl_symbol_table *symtab,
bool warn)
{
@@ -249,20 +261,24 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
glsl_type::generate_100ES_types(state->symbols);
break;
case 110:
- glsl_type::generate_110_types(state->symbols);
+ glsl_type::generate_110_types(state->symbols, true);
break;
case 120:
- glsl_type::generate_120_types(state->symbols);
+ glsl_type::generate_120_types(state->symbols, true);
break;
case 130:
- glsl_type::generate_130_types(state->symbols);
+ glsl_type::generate_130_types(state->symbols, true);
+ break;
+ case 140:
+ glsl_type::generate_140_types(state->symbols);
break;
default:
/* error */
break;
}
- if (state->ARB_texture_rectangle_enable) {
+ if (state->ARB_texture_rectangle_enable ||
+ state->language_version >= 140) {
glsl_type::generate_ARB_texture_rectangle_types(state->symbols,
state->ARB_texture_rectangle_warn);
}
diff --git a/mesalib/src/glsl/glsl_types.h b/mesalib/src/glsl/glsl_types.h
index 2997c9311..48d41d7f8 100644
--- a/mesalib/src/glsl/glsl_types.h
+++ b/mesalib/src/glsl/glsl_types.h
@@ -498,6 +498,7 @@ private:
static const glsl_type builtin_110_types[];
static const glsl_type builtin_120_types[];
static const glsl_type builtin_130_types[];
+ static const glsl_type builtin_140_types[];
static const glsl_type builtin_ARB_texture_rectangle_types[];
static const glsl_type builtin_EXT_texture_array_types[];
static const glsl_type builtin_EXT_texture_buffer_object_types[];
@@ -514,9 +515,10 @@ private:
*/
/*@{*/
static void generate_100ES_types(glsl_symbol_table *);
- static void generate_110_types(glsl_symbol_table *);
- static void generate_120_types(glsl_symbol_table *);
- static void generate_130_types(glsl_symbol_table *);
+ static void generate_110_types(glsl_symbol_table *, bool add_deprecated);
+ static void generate_120_types(glsl_symbol_table *, bool add_deprecated);
+ static void generate_130_types(glsl_symbol_table *, bool add_deprecated);
+ static void generate_140_types(glsl_symbol_table *);
static void generate_ARB_texture_rectangle_types(glsl_symbol_table *, bool);
static void generate_EXT_texture_array_types(glsl_symbol_table *, bool);
static void generate_OES_texture_3D_types(glsl_symbol_table *, bool);
diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp
index 82bddb003..8278e43ad 100644
--- a/mesalib/src/glsl/linker.cpp
+++ b/mesalib/src/glsl/linker.cpp
@@ -258,11 +258,36 @@ validate_vertex_shader_executable(struct gl_shader_program *prog,
if (shader == NULL)
return true;
- find_assignment_visitor find("gl_Position");
- find.run(shader->ir);
- if (!find.variable_found()) {
- linker_error(prog, "vertex shader does not write to `gl_Position'\n");
- return false;
+ /* From the GLSL 1.10 spec, page 48:
+ *
+ * "The variable gl_Position is available only in the vertex
+ * language and is intended for writing the homogeneous vertex
+ * position. All executions of a well-formed vertex shader
+ * executable must write a value into this variable. [...] The
+ * variable gl_Position is available only in the vertex
+ * language and is intended for writing the homogeneous vertex
+ * position. All executions of a well-formed vertex shader
+ * executable must write a value into this variable."
+ *
+ * while in GLSL 1.40 this text is changed to:
+ *
+ * "The variable gl_Position is available only in the vertex
+ * language and is intended for writing the homogeneous vertex
+ * position. It can be written at any time during shader
+ * execution. It may also be read back by a vertex shader
+ * after being written. This value will be used by primitive
+ * assembly, clipping, culling, and other fixed functionality
+ * operations, if present, that operate on primitives after
+ * vertex processing has occurred. Its value is undefined if
+ * the vertex shader executable does not write gl_Position."
+ */
+ if (prog->Version < 140) {
+ find_assignment_visitor find("gl_Position");
+ find.run(shader->ir);
+ if (!find.variable_found()) {
+ linker_error(prog, "vertex shader does not write to `gl_Position'\n");
+ return false;
+ }
}
prog->Vert.ClipDistanceArraySize = 0;
@@ -2175,7 +2200,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
* of all shaders must match.
*/
assert(min_version >= 100);
- assert(max_version <= 130);
+ assert(max_version <= 140);
if ((max_version >= 130 || min_version == 100)
&& min_version != max_version) {
linker_error(prog, "all shaders must use same shading "
@@ -2269,7 +2294,9 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
if (ctx->ShaderCompilerOptions[i].LowerClipDistance)
lower_clip_distance(prog->_LinkedShaders[i]->ir);
- while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, false, 32))
+ unsigned max_unroll = ctx->ShaderCompilerOptions[i].MaxUnrollIterations;
+
+ while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, false, max_unroll))
;
}
diff --git a/mesalib/src/glsl/main.cpp b/mesalib/src/glsl/main.cpp
index 519abb5b5..f04a146e8 100644
--- a/mesalib/src/glsl/main.cpp
+++ b/mesalib/src/glsl/main.cpp
@@ -46,10 +46,10 @@ initialize_context(struct gl_context *ctx, gl_api api)
{
initialize_context_to_defaults(ctx, api);
- /* GLSL 1.30 isn't fully supported, but we need to advertise 1.30 so that
- * the built-in functions for 1.30 can be built.
+ /* The standalone compiler needs to claim support for almost
+ * everything in order to compile the built-in functions.
*/
- ctx->Const.GLSLVersion = 130;
+ ctx->Const.GLSLVersion = 140;
ctx->Const.MaxClipPlanes = 8;
ctx->Const.MaxDrawBuffers = 2;
diff --git a/mesalib/src/mapi/Android.mk b/mesalib/src/mapi/Android.mk
index fe9e40e26..b75361f46 100644
--- a/mesalib/src/mapi/Android.mk
+++ b/mesalib/src/mapi/Android.mk
@@ -25,7 +25,7 @@
LOCAL_PATH := $(call my-dir)
-# get MAPI_GLAPI_SOURCES
+# get MAPI_GLAPI_FILES
include $(LOCAL_PATH)/mapi/sources.mak
mapi_abi_headers :=
@@ -38,7 +38,7 @@ include $(CLEAR_VARS)
abi_header := shared-glapi/glapi_mapi_tmp.h
-LOCAL_SRC_FILES := $(addprefix mapi/, $(MAPI_GLAPI_SOURCES))
+LOCAL_SRC_FILES := $(MAPI_GLAPI_FILES)
LOCAL_CFLAGS := \
-DMAPI_MODE_GLAPI \
diff --git a/mesalib/src/mapi/glapi/Makefile b/mesalib/src/mapi/glapi/Makefile
index bb4ed6585..211f384a7 100644
--- a/mesalib/src/mapi/glapi/Makefile
+++ b/mesalib/src/mapi/glapi/Makefile
@@ -19,18 +19,18 @@ ifeq ($(SHARED_GLAPI),1)
glapi_CPPFLAGS += \
-DMAPI_MODE_BRIDGE \
-DMAPI_ABI_HEADER=\"glapi/glapi_mapi_tmp.h\"
-glapi_SOURCES := $(addprefix $(MAPI)/, $(MAPI_BRIDGE_SOURCES))
+glapi_SOURCES := $(MAPI_BRIDGE_FILES)
glapi_GLAPI_OBJECTS :=
glapi_ASM_OBJECTS :=
-glapi_MAPI_OBJECTS := $(MAPI_BRIDGE_SOURCES:.c=.o)
+glapi_MAPI_OBJECTS := $(notdir $(MAPI_BRIDGE_FILES:.c=.o))
else
glapi_CPPFLAGS += -DMAPI_MODE_UTIL
-glapi_SOURCES := $(GLAPI_SOURCES) $(addprefix $(MAPI)/, $(MAPI_UTIL_SOURCES))
+glapi_SOURCES := $(GLAPI_SOURCES) $(MAPI_UTIL_FILES)
glapi_GLAPI_OBJECTS := $(GLAPI_SOURCES:.c=.o)
glapi_ASM_OBJECTS := $(GLAPI_ASM_SOURCES:.S=.o)
-glapi_MAPI_OBJECTS := $(MAPI_UTIL_SOURCES:.c=.o)
+glapi_MAPI_OBJECTS := $(notdir $(MAPI_UTIL_FILES:.c=.o))
endif # SHARED_GLAPI
glapi_OBJECTS := \
diff --git a/mesalib/src/mapi/mapi/sources.mak b/mesalib/src/mapi/mapi/sources.mak
index 28141860f..56f4afd3e 100644
--- a/mesalib/src/mapi/mapi/sources.mak
+++ b/mesalib/src/mapi/mapi/sources.mak
@@ -3,34 +3,34 @@
# mapi may be used in several ways
#
# - In default mode, mapi implements the interface defined by mapi.h. To use
-# this mode, compile MAPI_SOURCES.
+# this mode, compile MAPI_FILES.
#
# - In util mode, mapi provides utility functions for use with glapi. To use
-# this mode, compile MAPI_UTIL_SOURCES with MAPI_MODE_UTIL defined.
+# this mode, compile MAPI_UTIL_FILES with MAPI_MODE_UTIL defined.
#
# - In glapi mode, mapi implements the interface defined by glapi.h. To use
-# this mode, compile MAPI_GLAPI_SOURCES with MAPI_MODE_GLAPI defined.
+# this mode, compile MAPI_GLAPI_FILES with MAPI_MODE_GLAPI defined.
#
# - In bridge mode, mapi provides entry points calling into glapi. To use
-# this mode, compile MAPI_BRIDGE_SOURCES with MAPI_MODE_BRIDGE defined.
+# this mode, compile MAPI_BRIDGE_FILES with MAPI_MODE_BRIDGE defined.
-MAPI_UTIL_SOURCES = \
- u_current.c \
- u_execmem.c
+MAPI_UTIL_FILES = \
+ $(TOP)/src/mapi/mapi/u_current.c \
+ $(TOP)/src/mapi/mapi/u_execmem.c
-MAPI_SOURCES = \
- entry.c \
- mapi.c \
- stub.c \
- table.c \
- $(MAPI_UTIL_SOURCES)
+MAPI_FILES = \
+ $(TOP)/src/mapi/mapi/entry.c \
+ $(TOP)/src/mapi/mapi/mapi.c \
+ $(TOP)/src/mapi/mapi/stub.c \
+ $(TOP)/src/mapi/mapi/table.c \
+ $(MAPI_UTIL_FILES)
-MAPI_GLAPI_SOURCES = \
- entry.c \
- mapi_glapi.c \
- stub.c \
- table.c \
- $(MAPI_UTIL_SOURCES)
+MAPI_GLAPI_FILES = \
+ $(TOP)/src/mapi/mapi/entry.c \
+ $(TOP)/src/mapi/mapi/mapi_glapi.c \
+ $(TOP)/src/mapi/mapi/stub.c \
+ $(TOP)/src/mapi/mapi/table.c \
+ $(MAPI_UTIL_FILES)
-MAPI_BRIDGE_SOURCES = \
- entry.c
+MAPI_BRIDGE_FILES = \
+ $(TOP)/src/mapi/mapi/entry.c
diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.c b/mesalib/src/mesa/drivers/dri/common/dri_util.c
index db7322ec4..53707a80d 100644
--- a/mesalib/src/mesa/drivers/dri/common/dri_util.c
+++ b/mesalib/src/mesa/drivers/dri/common/dri_util.c
@@ -1,3 +1,27 @@
+/*
+ * (C) Copyright IBM Corporation 2002, 2004
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
/**
* \file dri_util.c
* DRI utility functions.
diff --git a/mesalib/src/mesa/drivers/dri/common/drirc b/mesalib/src/mesa/drivers/dri/common/drirc
index 755174afd..2d9287852 100644
--- a/mesalib/src/mesa/drivers/dri/common/drirc
+++ b/mesalib/src/mesa/drivers/dri/common/drirc
@@ -1,15 +1,15 @@
<driconf>
<device screen="0" driver="i965">
- <application executable="Sanctuary">
+ <application name="Unigine Sanctuary" executable="Sanctuary">
<option name="force_glsl_extensions_warn" value="true" />
</application>
- <application executable="Tropics">
+ <application name="Unigine Tropics" executable="Tropics">
<option name="force_glsl_extensions_warn" value="true" />
</application>
- <application executable="heaven_x86">
+ <application name="Unigine Heaven (32-bit)" executable="heaven_x86">
<option name="force_glsl_extensions_warn" value="true" />
</application>
- <application executable="heaven_x64">
+ <application name="Unigine Heaven (64-bit)" executable="heaven_x64">
<option name="force_glsl_extensions_warn" value="true" />
</application>
</device>
diff --git a/mesalib/src/mesa/main/api_validate.c b/mesalib/src/mesa/main/api_validate.c
index 4e94f47e3..02495a15a 100644
--- a/mesalib/src/mesa/main/api_validate.c
+++ b/mesalib/src/mesa/main/api_validate.c
@@ -29,6 +29,7 @@
#include "imports.h"
#include "mfeatures.h"
#include "mtypes.h"
+#include "enums.h"
#include "vbo/vbo.h"
@@ -204,18 +205,60 @@ check_index_bounds(struct gl_context *ctx, GLsizei count, GLenum type,
* are supported.
*/
GLboolean
-_mesa_valid_prim_mode(const struct gl_context *ctx, GLenum mode)
+_mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name)
{
if (ctx->Extensions.ARB_geometry_shader4 &&
mode > GL_TRIANGLE_STRIP_ADJACENCY_ARB) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s(mode=%x)", name, mode);
return GL_FALSE;
}
else if (mode > GL_POLYGON) {
- return GL_FALSE;
- }
- else {
- return GL_TRUE;
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s(mode=%x)", name, mode);
+ return GL_FALSE;
+ }
+
+ /* From the GL_EXT_transform_feedback spec:
+ *
+ * "The error INVALID_OPERATION is generated if Begin, or any command
+ * that performs an explicit Begin, is called when:
+ *
+ * * a geometry shader is not active and <mode> does not match the
+ * allowed begin modes for the current transform feedback state as
+ * given by table X.1.
+ *
+ * * a geometry shader is active and the output primitive type of the
+ * geometry shader does not match the allowed begin modes for the
+ * current transform feedback state as given by table X.1.
+ *
+ */
+ if (ctx->TransformFeedback.CurrentObject->Active &&
+ !ctx->TransformFeedback.CurrentObject->Paused) {
+ GLboolean pass = GL_TRUE;
+
+ switch (mode) {
+ case GL_POINTS:
+ pass = ctx->TransformFeedback.Mode == GL_POINTS;
+ break;
+ case GL_LINES:
+ case GL_LINE_STRIP:
+ case GL_LINE_LOOP:
+ pass = ctx->TransformFeedback.Mode == GL_LINES;
+ break;
+ default:
+ pass = ctx->TransformFeedback.Mode == GL_TRIANGLES;
+ break;
+ }
+ if (!pass) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "%s(mode=%s vs transform feedback %s)",
+ name,
+ _mesa_lookup_prim_by_nr(mode),
+ _mesa_lookup_prim_by_nr(ctx->TransformFeedback.Mode));
+ return GL_FALSE;
+ }
}
+
+ return GL_TRUE;
}
@@ -237,8 +280,7 @@ _mesa_validate_DrawElements(struct gl_context *ctx,
return GL_FALSE;
}
- if (!_mesa_valid_prim_mode(ctx, mode)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glDrawElements(mode)" );
+ if (!_mesa_valid_prim_mode(ctx, mode, "glDrawElements")) {
return GL_FALSE;
}
@@ -294,8 +336,7 @@ _mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode,
return GL_FALSE;
}
- if (!_mesa_valid_prim_mode(ctx, mode)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glDrawRangeElements(mode)" );
+ if (!_mesa_valid_prim_mode(ctx, mode, "glDrawRangeElements")) {
return GL_FALSE;
}
@@ -353,8 +394,7 @@ _mesa_validate_DrawArrays(struct gl_context *ctx,
return GL_FALSE;
}
- if (!_mesa_valid_prim_mode(ctx, mode)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glDrawArrays(mode)" );
+ if (!_mesa_valid_prim_mode(ctx, mode, "glDrawArrays")) {
return GL_FALSE;
}
@@ -389,9 +429,7 @@ _mesa_validate_DrawArraysInstanced(struct gl_context *ctx, GLenum mode, GLint fi
return GL_FALSE;
}
- if (!_mesa_valid_prim_mode(ctx, mode)) {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glDrawArraysInstanced(mode=0x%x)", mode);
+ if (!_mesa_valid_prim_mode(ctx, mode, "glDrawArraysInstanced")) {
return GL_FALSE;
}
@@ -429,9 +467,7 @@ _mesa_validate_DrawElementsInstanced(struct gl_context *ctx,
return GL_FALSE;
}
- if (!_mesa_valid_prim_mode(ctx, mode)) {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glDrawElementsInstanced(mode = 0x%x)", mode);
+ if (!_mesa_valid_prim_mode(ctx, mode, "glDrawElementsInstanced")) {
return GL_FALSE;
}
@@ -485,8 +521,7 @@ _mesa_validate_DrawTransformFeedback(struct gl_context *ctx,
{
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
- if (!_mesa_valid_prim_mode(ctx, mode)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glDrawTransformFeedback(mode)");
+ if (!_mesa_valid_prim_mode(ctx, mode, "glDrawTransformFeedback")) {
return GL_FALSE;
}
diff --git a/mesalib/src/mesa/main/api_validate.h b/mesalib/src/mesa/main/api_validate.h
index f4948424c..d92fd433f 100644
--- a/mesalib/src/mesa/main/api_validate.h
+++ b/mesalib/src/mesa/main/api_validate.h
@@ -43,7 +43,7 @@ _mesa_max_buffer_index(struct gl_context *ctx, GLuint count, GLenum type,
extern GLboolean
-_mesa_valid_prim_mode(const struct gl_context *ctx, GLenum mode);
+_mesa_valid_prim_mode(struct gl_context *ctx, GLenum mode, const char *name);
extern GLboolean
diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c
index 420ddcc0c..f113573d8 100644
--- a/mesalib/src/mesa/main/dlist.c
+++ b/mesalib/src/mesa/main/dlist.c
@@ -5767,10 +5767,16 @@ save_Begin(GLenum mode)
Node *n;
GLboolean error = GL_FALSE;
- if (!_mesa_valid_prim_mode(ctx, mode)) {
- _mesa_compile_error(ctx, GL_INVALID_ENUM, "glBegin(mode)");
+ if (mode > GL_POLYGON) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBegin(mode=%x)", mode);
error = GL_TRUE;
}
+ if (ctx->ExecuteFlag) {
+ if (!_mesa_valid_prim_mode(ctx, mode, "glBegin")) {
+ error = GL_TRUE;
+ }
+ }
+
else if (ctx->Driver.CurrentSavePrimitive == PRIM_UNKNOWN) {
/* Typically the first begin. This may raise an error on
* playback, depending on whether CallList is issued from inside
diff --git a/mesalib/src/mesa/main/getstring.c b/mesalib/src/mesa/main/getstring.c
index 90e028055..2f445aaf9 100644
--- a/mesalib/src/mesa/main/getstring.c
+++ b/mesalib/src/mesa/main/getstring.c
@@ -53,6 +53,8 @@ shading_language_version(struct gl_context *ctx)
return (const GLubyte *) "1.20";
case 130:
return (const GLubyte *) "1.30";
+ case 140:
+ return (const GLubyte *) "1.40";
default:
_mesa_problem(ctx,
"Invalid GLSL version in shading_language_version()");
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index f76096a49..a3827d48d 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -1316,7 +1316,9 @@ struct gl_texture_object
GLenum Swizzle[4]; /**< GL_EXT_texture_swizzle */
GLuint _Swizzle; /**< same as Swizzle, but SWIZZLE_* format */
GLboolean GenerateMipmap; /**< GL_SGIS_generate_mipmap */
- GLboolean _Complete; /**< Is texture object complete? */
+ GLboolean _BaseComplete; /**< Is the base texture level valid? */
+ GLboolean _MipmapComplete; /**< Is the whole mipmap valid? */
+ GLboolean _IsIntegerFormat; /**< Does the texture store integer values? */
GLboolean _RenderToTexture; /**< Any rendering to this texture? */
GLboolean Purgeable; /**< Is the buffer purgeable under memory pressure? */
GLboolean Immutable; /**< GL_ARB_texture_storage */
diff --git a/mesalib/src/mesa/main/samplerobj.c b/mesalib/src/mesa/main/samplerobj.c
index 7cf0654ad..5d1b2adbb 100644
--- a/mesalib/src/mesa/main/samplerobj.c
+++ b/mesalib/src/mesa/main/samplerobj.c
@@ -55,12 +55,11 @@ _mesa_lookup_samplerobj(struct gl_context *ctx, GLuint name)
* Handle reference counting.
*/
void
-_mesa_reference_sampler_object(struct gl_context *ctx,
- struct gl_sampler_object **ptr,
- struct gl_sampler_object *samp)
+_mesa_reference_sampler_object_(struct gl_context *ctx,
+ struct gl_sampler_object **ptr,
+ struct gl_sampler_object *samp)
{
- if (*ptr == samp)
- return;
+ assert(*ptr != samp); /* The inline wrapper should prevent no-op calls */
if (*ptr) {
/* Unreference the old sampler */
diff --git a/mesalib/src/mesa/main/samplerobj.h b/mesalib/src/mesa/main/samplerobj.h
index fe7d5a7d3..0bfda4351 100644
--- a/mesalib/src/mesa/main/samplerobj.h
+++ b/mesalib/src/mesa/main/samplerobj.h
@@ -37,10 +37,29 @@ _mesa_get_samplerobj(struct gl_context *ctx, GLuint unit)
return &ctx->Texture.Unit[unit]._Current->Sampler;
}
+
+/** Does the given filter state do mipmap filtering? */
+static inline GLboolean
+_mesa_is_mipmap_filter(const struct gl_sampler_object *samp)
+{
+ return samp->MinFilter != GL_NEAREST && samp->MinFilter != GL_LINEAR;
+}
+
+
extern void
+_mesa_reference_sampler_object_(struct gl_context *ctx,
+ struct gl_sampler_object **ptr,
+ struct gl_sampler_object *samp);
+
+static inline void
_mesa_reference_sampler_object(struct gl_context *ctx,
struct gl_sampler_object **ptr,
- struct gl_sampler_object *samp);
+ struct gl_sampler_object *samp)
+{
+ if (*ptr != samp)
+ _mesa_reference_sampler_object_(ctx, ptr, samp);
+}
+
extern void
_mesa_init_sampler_object(struct gl_sampler_object *sampObj, GLuint name);
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index cf0a0cb2a..c54118212 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -43,6 +43,7 @@
#include "state.h"
#include "texcompress.h"
#include "teximage.h"
+#include "texobj.h"
#include "texstate.h"
#include "texpal.h"
#include "mtypes.h"
@@ -2602,9 +2603,7 @@ teximage(struct gl_context *ctx, GLuint dims,
_mesa_update_fbo_texture(ctx, texObj, face, level);
- /* state update */
- texObj->_Complete = GL_FALSE;
- ctx->NewState |= _NEW_TEXTURE;
+ _mesa_dirty_texobj(ctx, texObj, GL_TRUE);
}
else {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage%uD", dims);
@@ -2702,9 +2701,7 @@ _mesa_EGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image)
ctx->Driver.EGLImageTargetTexture2D(ctx, target,
texObj, texImage, image);
- /* state update */
- texObj->_Complete = GL_FALSE;
- ctx->NewState |= _NEW_TEXTURE;
+ _mesa_dirty_texobj(ctx, texObj, GL_TRUE);
}
_mesa_unlock_texture(ctx, texObj);
@@ -2965,9 +2962,7 @@ copyteximage(struct gl_context *ctx, GLuint dims,
_mesa_update_fbo_texture(ctx, texObj, face, level);
- /* state update */
- texObj->_Complete = GL_FALSE;
- ctx->NewState |= _NEW_TEXTURE;
+ _mesa_dirty_texobj(ctx, texObj, GL_TRUE);
}
else {
/* probably too large of image */
@@ -3598,9 +3593,7 @@ compressedteximage(struct gl_context *ctx, GLuint dims,
check_gen_mipmap(ctx, target, texObj, level);
- /* state update */
- texObj->_Complete = GL_FALSE;
- ctx->NewState |= _NEW_TEXTURE;
+ _mesa_dirty_texobj(ctx, texObj, GL_TRUE);
}
else {
_mesa_error(ctx, GL_OUT_OF_MEMORY,
diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c
index 590594826..cfaac64bf 100644
--- a/mesalib/src/mesa/main/texobj.c
+++ b/mesalib/src/mesa/main/texobj.c
@@ -262,7 +262,8 @@ _mesa_copy_texture_object( struct gl_texture_object *dest,
dest->_MaxLevel = src->_MaxLevel;
dest->_MaxLambda = src->_MaxLambda;
dest->GenerateMipmap = src->GenerateMipmap;
- dest->_Complete = src->_Complete;
+ dest->_BaseComplete = src->_BaseComplete;
+ dest->_MipmapComplete = src->_MipmapComplete;
COPY_4V(dest->Swizzle, src->Swizzle);
dest->_Swizzle = src->_Swizzle;
@@ -386,14 +387,26 @@ _mesa_reference_texobj_(struct gl_texture_object **ptr,
}
+enum base_mipmap { BASE, MIPMAP };
+
/**
- * Mark a texture object as incomplete.
+ * Mark a texture object as incomplete. There are actually three kinds of
+ * (in)completeness:
+ * 1. "base incomplete": the base level of the texture is invalid so no
+ * texturing is possible.
+ * 2. "mipmap incomplete": a non-base level of the texture is invalid so
+ * mipmap filtering isn't possible, but non-mipmap filtering is.
+ * 3. "texture incompleteness": some combination of texture state and
+ * sampler state renders the texture incomplete.
+ *
* \param t texture object
+ * \param bm either BASE or MIPMAP to indicate what's incomplete
* \param fmt... string describing why it's incomplete (for debugging).
*/
static void
-incomplete(struct gl_texture_object *t, const char *fmt, ...)
+incomplete(struct gl_texture_object *t, enum base_mipmap bm,
+ const char *fmt, ...)
{
#if 0
va_list args;
@@ -405,7 +418,9 @@ incomplete(struct gl_texture_object *t, const char *fmt, ...)
printf("Texture Obj %d incomplete because: %s\n", t->Name, s);
#endif
- t->_Complete = GL_FALSE;
+ if (bm == BASE)
+ t->_BaseComplete = GL_FALSE;
+ t->_MipmapComplete = GL_FALSE;
}
@@ -426,79 +441,94 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
struct gl_texture_object *t )
{
const GLint baseLevel = t->BaseLevel;
+ const struct gl_texture_image *baseImage;
GLint maxLog2 = 0, maxLevels = 0;
- t->_Complete = GL_TRUE; /* be optimistic */
+ /* We'll set these to FALSE if tests fail below */
+ t->_BaseComplete = GL_TRUE;
+ t->_MipmapComplete = GL_TRUE;
/* Detect cases where the application set the base level to an invalid
* value.
*/
if ((baseLevel < 0) || (baseLevel >= MAX_TEXTURE_LEVELS)) {
- incomplete(t, "base level = %d is invalid", baseLevel);
+ incomplete(t, BASE, "base level = %d is invalid", baseLevel);
+ return;
+ }
+
+ if (t->MaxLevel < baseLevel) {
+ incomplete(t, BASE, "MAX_LEVEL (%d) < BASE_LEVEL (%d)",
+ t->MaxLevel, baseLevel);
return;
}
+ baseImage = t->Image[0][baseLevel];
+
/* Always need the base level image */
- if (!t->Image[0][baseLevel]) {
- incomplete(t, "Image[baseLevel=%d] == NULL", baseLevel);
+ if (!baseImage) {
+ incomplete(t, BASE, "Image[baseLevel=%d] == NULL", baseLevel);
return;
}
/* Check width/height/depth for zero */
- if (t->Image[0][baseLevel]->Width == 0 ||
- t->Image[0][baseLevel]->Height == 0 ||
- t->Image[0][baseLevel]->Depth == 0) {
- incomplete(t, "texture width = 0");
+ if (baseImage->Width == 0 ||
+ baseImage->Height == 0 ||
+ baseImage->Depth == 0) {
+ incomplete(t, BASE, "texture width or height or depth = 0");
return;
}
- /* Compute _MaxLevel */
- if ((t->Target == GL_TEXTURE_1D) ||
- (t->Target == GL_TEXTURE_1D_ARRAY_EXT)) {
- maxLog2 = t->Image[0][baseLevel]->WidthLog2;
- maxLevels = ctx->Const.MaxTextureLevels;
+ /* Check if the texture values are integer */
+ {
+ GLenum datatype = _mesa_get_format_datatype(baseImage->TexFormat);
+ t->_IsIntegerFormat = datatype == GL_INT || datatype == GL_UNSIGNED_INT;
}
- else if ((t->Target == GL_TEXTURE_2D) ||
- (t->Target == GL_TEXTURE_2D_ARRAY_EXT)) {
- maxLog2 = MAX2(t->Image[0][baseLevel]->WidthLog2,
- t->Image[0][baseLevel]->HeightLog2);
+
+ /* Compute _MaxLevel (the maximum mipmap level we'll sample from given the
+ * mipmap image sizes and GL_TEXTURE_MAX_LEVEL state).
+ */
+ switch (t->Target) {
+ case GL_TEXTURE_1D:
+ case GL_TEXTURE_1D_ARRAY_EXT:
+ maxLog2 = baseImage->WidthLog2;
maxLevels = ctx->Const.MaxTextureLevels;
- }
- else if (t->Target == GL_TEXTURE_3D) {
- GLint max = MAX2(t->Image[0][baseLevel]->WidthLog2,
- t->Image[0][baseLevel]->HeightLog2);
- maxLog2 = MAX2(max, (GLint)(t->Image[0][baseLevel]->DepthLog2));
+ break;
+ case GL_TEXTURE_2D:
+ case GL_TEXTURE_2D_ARRAY_EXT:
+ maxLog2 = MAX2(baseImage->WidthLog2,
+ baseImage->HeightLog2);
+ maxLevels = ctx->Const.MaxTextureLevels;
+ break;
+ case GL_TEXTURE_3D:
+ maxLog2 = MAX3(baseImage->WidthLog2,
+ baseImage->HeightLog2,
+ baseImage->DepthLog2);
maxLevels = ctx->Const.Max3DTextureLevels;
- }
- else if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) {
- maxLog2 = MAX2(t->Image[0][baseLevel]->WidthLog2,
- t->Image[0][baseLevel]->HeightLog2);
+ break;
+ case GL_TEXTURE_CUBE_MAP_ARB:
+ maxLog2 = MAX2(baseImage->WidthLog2,
+ baseImage->HeightLog2);
maxLevels = ctx->Const.MaxCubeTextureLevels;
- }
- else if (t->Target == GL_TEXTURE_RECTANGLE_NV ||
- t->Target == GL_TEXTURE_EXTERNAL_OES) {
+ break;
+ case GL_TEXTURE_RECTANGLE_NV:
+ case GL_TEXTURE_BUFFER:
+ case GL_TEXTURE_EXTERNAL_OES:
maxLog2 = 0; /* not applicable */
maxLevels = 1; /* no mipmapping */
- }
- else {
+ break;
+ default:
_mesa_problem(ctx, "Bad t->Target in _mesa_test_texobj_completeness");
return;
}
ASSERT(maxLevels > 0);
- if (t->MaxLevel < t->BaseLevel) {
- incomplete(t, "MAX_LEVEL (%d) < BASE_LEVEL (%d)",
- t->MaxLevel, t->BaseLevel);
- return;
- }
-
- t->_MaxLevel = baseLevel + maxLog2;
+ t->_MaxLevel = baseLevel + maxLog2; /* 'p' in the GL spec */
t->_MaxLevel = MIN2(t->_MaxLevel, t->MaxLevel);
- t->_MaxLevel = MIN2(t->_MaxLevel, maxLevels - 1);
+ t->_MaxLevel = MIN2(t->_MaxLevel, maxLevels - 1); /* 'q' in the GL spec */
/* Compute _MaxLambda = q - b (see the 1.2 spec) used during mipmapping */
- t->_MaxLambda = (GLfloat) (t->_MaxLevel - t->BaseLevel);
+ t->_MaxLambda = (GLfloat) (t->_MaxLevel - baseLevel);
if (t->Immutable) {
/* This texture object was created with glTexStorage1/2/3D() so we
@@ -510,193 +540,103 @@ _mesa_test_texobj_completeness( const struct gl_context *ctx,
}
if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) {
- /* make sure that all six cube map level 0 images are the same size */
- const GLuint w = t->Image[0][baseLevel]->Width2;
- const GLuint h = t->Image[0][baseLevel]->Height2;
+ /* Make sure that all six cube map level 0 images are the same size.
+ * Note: we know that the image's width==height (we enforce that
+ * at glTexImage time) so we only need to test the width here.
+ */
GLuint face;
+ assert(baseImage->Width2 == baseImage->Height);
for (face = 1; face < 6; face++) {
+ assert(t->Image[face][baseLevel]->Width2 ==
+ t->Image[face][baseLevel]->Height2);
if (t->Image[face][baseLevel] == NULL ||
- t->Image[face][baseLevel]->Width2 != w ||
- t->Image[face][baseLevel]->Height2 != h) {
- incomplete(t, "Cube face missing or mismatched size");
+ t->Image[face][baseLevel]->Width2 != baseImage->Width2) {
+ incomplete(t, BASE, "Cube face missing or mismatched size");
return;
}
}
}
- /* extra checking for mipmaps */
- if (t->Sampler.MinFilter != GL_NEAREST && t->Sampler.MinFilter != GL_LINEAR) {
- /*
- * Mipmapping: determine if we have a complete set of mipmaps
- */
+ /*
+ * Do mipmap consistency checking.
+ * Note: we don't care about the current texture sampler state here.
+ * To determine texture completeness we'll either look at _BaseComplete
+ * or _MipmapComplete depending on the current minification filter mode.
+ */
+ {
GLint i;
- GLint minLevel = baseLevel;
- GLint maxLevel = t->_MaxLevel;
+ const GLint minLevel = baseLevel;
+ const GLint maxLevel = t->_MaxLevel;
+ GLuint width, height, depth, face, numFaces = 1;
if (minLevel > maxLevel) {
- incomplete(t, "minLevel > maxLevel");
+ incomplete(t, BASE, "minLevel > maxLevel");
return;
}
- /* Test dimension-independent attributes */
- for (i = minLevel; i <= maxLevel; i++) {
- if (t->Image[0][i]) {
- if (t->Image[0][i]->TexFormat != t->Image[0][baseLevel]->TexFormat) {
- incomplete(t, "Format[i] != Format[baseLevel]");
- return;
- }
- if (t->Image[0][i]->Border != t->Image[0][baseLevel]->Border) {
- incomplete(t, "Border[i] != Border[baseLevel]");
- return;
- }
- }
- }
+ /* Get the base image's dimensions */
+ width = baseImage->Width2;
+ height = baseImage->Height2;
+ depth = baseImage->Depth2;
- /* Test things which depend on number of texture image dimensions */
- if ((t->Target == GL_TEXTURE_1D) ||
- (t->Target == GL_TEXTURE_1D_ARRAY_EXT)) {
- /* Test 1-D mipmaps */
- GLuint width = t->Image[0][baseLevel]->Width2;
- for (i = baseLevel + 1; i < maxLevels; i++) {
- if (width > 1) {
- width /= 2;
- }
- if (i >= minLevel && i <= maxLevel) {
- const struct gl_texture_image *img = t->Image[0][i];
- if (!img) {
- incomplete(t, "1D Image[%d] is missing", i);
- return;
- }
- if (img->Width2 != width ) {
- incomplete(t, "1D Image[%d] bad width %u", i, img->Width2);
- return;
- }
- }
- if (width == 1) {
- return; /* found smallest needed mipmap, all done! */
- }
+ /* Note: this loop will be a no-op for RECT, BUFFER, EXTERNAL textures */
+ for (i = baseLevel + 1; i < maxLevels; i++) {
+ /* Compute the expected size of image at level[i] */
+ if (width > 1) {
+ width /= 2;
}
- }
- else if ((t->Target == GL_TEXTURE_2D) ||
- (t->Target == GL_TEXTURE_2D_ARRAY_EXT)) {
- /* Test 2-D mipmaps */
- GLuint width = t->Image[0][baseLevel]->Width2;
- GLuint height = t->Image[0][baseLevel]->Height2;
- for (i = baseLevel + 1; i < maxLevels; i++) {
- if (width > 1) {
- width /= 2;
- }
- if (height > 1) {
- height /= 2;
- }
+ if (height > 1 && t->Target != GL_TEXTURE_1D_ARRAY) {
+ height /= 2;
+ }
+ if (depth > 1 && t->Target != GL_TEXTURE_2D_ARRAY) {
+ depth /= 2;
+ }
+
+ /* loop over cube faces (or single face otherwise) */
+ for (face = 0; face < numFaces; face++) {
if (i >= minLevel && i <= maxLevel) {
- const struct gl_texture_image *img = t->Image[0][i];
+ const struct gl_texture_image *img = t->Image[face][i];
+
if (!img) {
- incomplete(t, "2D Image[%d of %d] is missing", i, maxLevel);
+ incomplete(t, MIPMAP, "TexImage[%d] is missing", i);
return;
}
- if (img->Width2 != width) {
- incomplete(t, "2D Image[%d] bad width %u", i, img->Width2);
- return;
- }
- if (img->Height2 != height) {
- incomplete(t, "2D Image[i] bad height %u", i, img->Height2);
- return;
- }
- if (width==1 && height==1) {
- return; /* found smallest needed mipmap, all done! */
- }
- }
- }
- }
- else if (t->Target == GL_TEXTURE_3D) {
- /* Test 3-D mipmaps */
- GLuint width = t->Image[0][baseLevel]->Width2;
- GLuint height = t->Image[0][baseLevel]->Height2;
- GLuint depth = t->Image[0][baseLevel]->Depth2;
- for (i = baseLevel + 1; i < maxLevels; i++) {
- if (width > 1) {
- width /= 2;
- }
- if (height > 1) {
- height /= 2;
- }
- if (depth > 1) {
- depth /= 2;
- }
- if (i >= minLevel && i <= maxLevel) {
- const struct gl_texture_image *img = t->Image[0][i];
- if (!img) {
- incomplete(t, "3D Image[%d] is missing", i);
+ if (img->TexFormat != baseImage->TexFormat) {
+ incomplete(t, MIPMAP, "Format[i] != Format[baseLevel]");
return;
}
- if (img->_BaseFormat == GL_DEPTH_COMPONENT) {
- incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex");
+ if (img->Border != baseImage->Border) {
+ incomplete(t, MIPMAP, "Border[i] != Border[baseLevel]");
return;
}
if (img->Width2 != width) {
- incomplete(t, "3D Image[%d] bad width %u", i, img->Width2);
+ incomplete(t, MIPMAP, "TexImage[%d] bad width %u", i, img->Width2);
return;
}
if (img->Height2 != height) {
- incomplete(t, "3D Image[%d] bad height %u", i, img->Height2);
+ incomplete(t, MIPMAP, "TexImage[%d] bad height %u", i, img->Height2);
return;
}
if (img->Depth2 != depth) {
- incomplete(t, "3D Image[%d] bad depth %u", i, img->Depth2);
+ incomplete(t, MIPMAP, "TexImage[%d] bad depth %u", i, img->Depth2);
return;
}
- }
- if (width == 1 && height == 1 && depth == 1) {
- return; /* found smallest needed mipmap, all done! */
- }
- }
- }
- else if (t->Target == GL_TEXTURE_CUBE_MAP_ARB) {
- /* make sure 6 cube faces are consistant */
- GLuint width = t->Image[0][baseLevel]->Width2;
- GLuint height = t->Image[0][baseLevel]->Height2;
- for (i = baseLevel + 1; i < maxLevels; i++) {
- if (width > 1) {
- width /= 2;
- }
- if (height > 1) {
- height /= 2;
- }
- if (i >= minLevel && i <= maxLevel) {
- GLuint face;
- for (face = 0; face < 6; face++) {
- /* check that we have images defined */
- if (!t->Image[face][i]) {
- incomplete(t, "CubeMap Image[n][i] == NULL");
- return;
- }
- /* Don't support GL_DEPTH_COMPONENT for cube maps */
- if (ctx->VersionMajor < 3 && !ctx->Extensions.EXT_gpu_shader4) {
- if (t->Image[face][i]->_BaseFormat == GL_DEPTH_COMPONENT) {
- incomplete(t, "GL_DEPTH_COMPONENT only works with 1/2D tex");
- return;
- }
- }
- /* check that all six images have same size */
- if (t->Image[face][i]->Width2 != width ||
- t->Image[face][i]->Height2 != height) {
- incomplete(t, "CubeMap Image[n][i] bad size");
+
+ /* Extra checks for cube textures */
+ if (face > 0) {
+ /* check that cube faces are the same size */
+ if (img->Width2 != t->Image[0][i]->Width2 ||
+ img->Height2 != t->Image[0][i]->Height2) {
+ incomplete(t, MIPMAP, "CubeMap Image[n][i] bad size");
return;
}
- }
- }
- if (width == 1 && height == 1) {
- return; /* found smallest needed mipmap, all done! */
+ }
}
}
- }
- else if (t->Target == GL_TEXTURE_RECTANGLE_NV) {
- /* XXX special checking? */
- }
- else {
- /* Target = ??? */
- _mesa_problem(ctx, "Bug in gl_test_texture_object_completeness\n");
+
+ if (width == 1 && height == 1 && depth == 1) {
+ return; /* found smallest needed mipmap, all done! */
+ }
}
}
}
@@ -752,7 +692,8 @@ void
_mesa_dirty_texobj(struct gl_context *ctx, struct gl_texture_object *texObj,
GLboolean invalidate_state)
{
- texObj->_Complete = GL_FALSE;
+ texObj->_BaseComplete = GL_FALSE;
+ texObj->_MipmapComplete = GL_FALSE;
if (invalidate_state)
ctx->NewState |= _NEW_TEXTURE;
}
@@ -875,7 +816,8 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex)
}
_mesa_test_texobj_completeness(ctx, texObj);
- assert(texObj->_Complete);
+ assert(texObj->_BaseComplete);
+ assert(texObj->_MipmapComplete);
ctx->Shared->FallbackTex[tex] = texObj;
}
diff --git a/mesalib/src/mesa/main/texobj.h b/mesalib/src/mesa/main/texobj.h
index 03dfbe304..c020b9013 100644
--- a/mesalib/src/mesa/main/texobj.h
+++ b/mesalib/src/mesa/main/texobj.h
@@ -35,6 +35,7 @@
#include "compiler.h"
#include "glheader.h"
#include "mtypes.h"
+#include "samplerobj.h"
/**
@@ -77,6 +78,26 @@ _mesa_reference_texobj(struct gl_texture_object **ptr,
}
+/** Is the texture "complete" with respect to the given sampler state? */
+static inline GLboolean
+_mesa_is_texture_complete(const struct gl_texture_object *texObj,
+ const struct gl_sampler_object *sampler)
+{
+ if (texObj->_IsIntegerFormat &&
+ (sampler->MagFilter != GL_NEAREST ||
+ (sampler->MinFilter != GL_NEAREST &&
+ sampler->MinFilter != GL_NEAREST_MIPMAP_NEAREST))) {
+ /* If the format is integer, only nearest filtering is allowed */
+ return GL_FALSE;
+ }
+
+ if (_mesa_is_mipmap_filter(sampler))
+ return texObj->_MipmapComplete;
+ else
+ return texObj->_BaseComplete;
+}
+
+
extern void
_mesa_test_texobj_completeness( const struct gl_context *ctx,
struct gl_texture_object *obj );
diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c
index 9a2ec518f..9abc503e3 100644
--- a/mesalib/src/mesa/main/texparam.c
+++ b/mesalib/src/mesa/main/texparam.c
@@ -41,6 +41,7 @@
#include "main/mtypes.h"
#include "main/state.h"
#include "main/texcompress.h"
+#include "main/texobj.h"
#include "main/texparam.h"
#include "main/teximage.h"
#include "main/texstate.h"
@@ -211,8 +212,7 @@ flush(struct gl_context *ctx)
/**
* This is called just prior to changing any texture object state which
- * can effect texture completeness (texture base level, max level,
- * minification filter).
+ * can effect texture completeness (texture base level, max level).
* Any pending rendering will be flushed out, we'll set the _NEW_TEXTURE
* state flag and then mark the texture object as 'incomplete' so that any
* per-texture derived state gets recomputed.
@@ -221,7 +221,7 @@ static inline void
incomplete(struct gl_context *ctx, struct gl_texture_object *texObj)
{
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texObj->_Complete = GL_FALSE;
+ _mesa_dirty_texobj(ctx, texObj, GL_TRUE);
}
@@ -241,7 +241,7 @@ set_tex_parameteri(struct gl_context *ctx,
switch (params[0]) {
case GL_NEAREST:
case GL_LINEAR:
- incomplete(ctx, texObj);
+ flush(ctx);
texObj->Sampler.MinFilter = params[0];
return GL_TRUE;
case GL_NEAREST_MIPMAP_NEAREST:
@@ -250,7 +250,7 @@ set_tex_parameteri(struct gl_context *ctx,
case GL_LINEAR_MIPMAP_LINEAR:
if (texObj->Target != GL_TEXTURE_RECTANGLE_NV &&
texObj->Target != GL_TEXTURE_EXTERNAL_OES) {
- incomplete(ctx, texObj);
+ flush(ctx);
texObj->Sampler.MinFilter = params[0];
return GL_TRUE;
}
diff --git a/mesalib/src/mesa/main/texstate.c b/mesalib/src/mesa/main/texstate.c
index 187ec9c36..ee778ffd0 100644
--- a/mesalib/src/mesa/main/texstate.c
+++ b/mesalib/src/mesa/main/texstate.c
@@ -569,10 +569,13 @@ update_texture_state( struct gl_context *ctx )
for (texIndex = 0; texIndex < NUM_TEXTURE_TARGETS; texIndex++) {
if (enabledTargets & (1 << texIndex)) {
struct gl_texture_object *texObj = texUnit->CurrentTex[texIndex];
- if (!texObj->_Complete) {
+ struct gl_sampler_object *sampler = texUnit->Sampler ?
+ texUnit->Sampler : &texObj->Sampler;
+
+ if (!_mesa_is_texture_complete(texObj, sampler)) {
_mesa_test_texobj_completeness(ctx, texObj);
}
- if (texObj->_Complete) {
+ if (_mesa_is_texture_complete(texObj, sampler)) {
texUnit->_ReallyEnabled = 1 << texIndex;
_mesa_reference_texobj(&texUnit->_Current, texObj);
break;
diff --git a/mesalib/src/mesa/main/transformfeedback.c b/mesalib/src/mesa/main/transformfeedback.c
index c2114c227..f2c1435d9 100644
--- a/mesalib/src/mesa/main/transformfeedback.c
+++ b/mesalib/src/mesa/main/transformfeedback.c
@@ -89,33 +89,6 @@ reference_transform_feedback_object(struct gl_transform_feedback_object **ptr,
/**
- * Check if the given primitive mode (as in glBegin(mode)) is compatible
- * with the current transform feedback mode (if it's enabled).
- * This is to be called from glBegin(), glDrawArrays(), glDrawElements(), etc.
- *
- * \return GL_TRUE if the mode is OK, GL_FALSE otherwise.
- */
-GLboolean
-_mesa_validate_primitive_mode(struct gl_context *ctx, GLenum mode)
-{
- if (ctx->TransformFeedback.CurrentObject->Active &&
- !ctx->TransformFeedback.CurrentObject->Paused) {
- switch (mode) {
- case GL_POINTS:
- return ctx->TransformFeedback.Mode == GL_POINTS;
- case GL_LINES:
- case GL_LINE_STRIP:
- case GL_LINE_LOOP:
- return ctx->TransformFeedback.Mode == GL_LINES;
- default:
- return ctx->TransformFeedback.Mode == GL_TRIANGLES;
- }
- }
- return GL_TRUE;
-}
-
-
-/**
* Check that all the buffer objects currently bound for transform
* feedback actually exist. Raise a GL_INVALID_OPERATION error if
* any buffers are missing.
diff --git a/mesalib/src/mesa/main/transformfeedback.h b/mesalib/src/mesa/main/transformfeedback.h
index 8a6672d58..7d63de017 100644
--- a/mesalib/src/mesa/main/transformfeedback.h
+++ b/mesalib/src/mesa/main/transformfeedback.h
@@ -42,9 +42,6 @@ _mesa_free_transform_feedback(struct gl_context *ctx);
#if FEATURE_EXT_transform_feedback
extern GLboolean
-_mesa_validate_primitive_mode(struct gl_context *ctx, GLenum mode);
-
-extern GLboolean
_mesa_validate_transform_feedback_buffers(struct gl_context *ctx);
diff --git a/mesalib/src/mesa/main/uniform_query.cpp b/mesalib/src/mesa/main/uniform_query.cpp
index 869f7d373..991df7896 100644
--- a/mesalib/src/mesa/main/uniform_query.cpp
+++ b/mesalib/src/mesa/main/uniform_query.cpp
@@ -203,10 +203,18 @@ _mesa_get_uniform(struct gl_context *ctx, GLuint program, GLint location,
const union gl_constant_value *const src =
&uni->storage[offset * elements];
- unsigned bytes = sizeof(uni->storage[0]) * elements;
- if (bytes > (unsigned) bufSize) {
- elements = bufSize / sizeof(uni->storage[0]);
- bytes = bufSize;
+ assert(returnType == GLSL_TYPE_FLOAT || returnType == GLSL_TYPE_INT ||
+ returnType == GLSL_TYPE_UINT);
+ /* The three (currently) supported types all have the same size,
+ * which is of course the same as their union. That'll change
+ * with glGetUniformdv()...
+ */
+ unsigned bytes = sizeof(src[0]) * elements;
+ if (bufSize < 0 || bytes > (unsigned) bufSize) {
+ _mesa_error( ctx, GL_INVALID_OPERATION,
+ "glGetnUniform*vARB(out of bounds: bufSize is %d,"
+ " but %u bytes are required)", bufSize, bytes );
+ return;
}
/* If the return type and the uniform's native type are "compatible,"
diff --git a/mesalib/src/mesa/main/uniforms.c b/mesalib/src/mesa/main/uniforms.c
index e0214a88a..be1e1728d 100644
--- a/mesalib/src/mesa/main/uniforms.c
+++ b/mesalib/src/mesa/main/uniforms.c
@@ -479,7 +479,7 @@ _mesa_GetnUniformdvARB(GLhandleARB program, GLint location,
(void) params;
/*
- _mesa_get_uniform(ctx, program, location, bufSize, GL_DOUBLE, params);
+ _mesa_get_uniform(ctx, program, location, bufSize, GLSL_TYPE_DOUBLE, params);
*/
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetUniformdvARB"
"(GL_ARB_gpu_shader_fp64 not implemented)");
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index ea59ccf25..f9c190a68 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -1243,7 +1243,7 @@ st_finalize_texture(struct gl_context *ctx,
enum pipe_format firstImageFormat;
GLuint ptWidth, ptHeight, ptDepth, ptLayers;
- if (stObj->base._Complete) {
+ if (_mesa_is_texture_complete(tObj, &tObj->Sampler)) {
/* The texture is complete and we know exactly how many mipmap levels
* are present/needed. This is conditional because we may be called
* from the st_generate_mipmap() function when the texture object is
diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c
index 33bc6ed72..afea0ea4f 100644
--- a/mesalib/src/mesa/state_tracker/st_extensions.c
+++ b/mesalib/src/mesa/state_tracker/st_extensions.c
@@ -216,6 +216,8 @@ void st_init_limits(struct st_context *st)
if (options->EmitNoLoops)
options->MaxUnrollIterations = MIN2(screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_INSTRUCTIONS), 65536);
+ else
+ options->MaxUnrollIterations = 255; /* SM3 limit */
}
/* PIPE_SHADER_CAP_MAX_INPUTS for the FS specifies the maximum number
diff --git a/mesalib/src/mesa/state_tracker/st_texture.c b/mesalib/src/mesa/state_tracker/st_texture.c
index 132d7a81c..9627a6117 100644
--- a/mesalib/src/mesa/state_tracker/st_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_texture.c
@@ -222,6 +222,9 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
DBG("%s \n", __FUNCTION__);
+ if (!stImage->pt)
+ return NULL;
+
if (stObj->pt != stImage->pt)
level = 0;
else
diff --git a/mesalib/src/mesa/swrast/s_context.c b/mesalib/src/mesa/swrast/s_context.c
index beb915879..432db71c8 100644
--- a/mesalib/src/mesa/swrast/s_context.c
+++ b/mesalib/src/mesa/swrast/s_context.c
@@ -30,6 +30,7 @@
#include "main/bufferobj.h"
#include "main/colormac.h"
#include "main/mtypes.h"
+#include "main/samplerobj.h"
#include "main/teximage.h"
#include "program/prog_parameter.h"
#include "program/prog_statevars.h"
@@ -482,7 +483,9 @@ _swrast_update_texture_samplers(struct gl_context *ctx)
if (tObj) {
_mesa_update_fetch_functions(tObj);
}
- swrast->TextureSample[u] = _swrast_choose_texture_sample_func(ctx, tObj);
+ swrast->TextureSample[u] =
+ _swrast_choose_texture_sample_func(ctx, tObj,
+ _mesa_get_samplerobj(ctx, u));
}
}
diff --git a/mesalib/src/mesa/swrast/s_texfilter.c b/mesalib/src/mesa/swrast/s_texfilter.c
index d142d3d07..412316f36 100644
--- a/mesalib/src/mesa/swrast/s_texfilter.c
+++ b/mesalib/src/mesa/swrast/s_texfilter.c
@@ -27,6 +27,7 @@
#include "main/context.h"
#include "main/colormac.h"
#include "main/imports.h"
+#include "main/texobj.h"
#include "s_context.h"
#include "s_texfilter.h"
@@ -3612,9 +3613,10 @@ null_sample_func( struct gl_context *ctx,
*/
texture_sample_func
_swrast_choose_texture_sample_func( struct gl_context *ctx,
- const struct gl_texture_object *t )
+ const struct gl_texture_object *t,
+ const struct gl_sampler_object *sampler)
{
- if (!t || !t->_Complete) {
+ if (!t || !_mesa_is_texture_complete(t, sampler)) {
return &null_sample_func;
}
else {
diff --git a/mesalib/src/mesa/swrast/s_texfilter.h b/mesalib/src/mesa/swrast/s_texfilter.h
index fd7e5776f..58b57365c 100644
--- a/mesalib/src/mesa/swrast/s_texfilter.h
+++ b/mesalib/src/mesa/swrast/s_texfilter.h
@@ -1,41 +1,42 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5
- *
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#ifndef S_TEXFILTER_H
-#define S_TEXFILTER_H
-
-
-#include "s_context.h"
-
-struct gl_context;
-struct gl_texture_object;
-
-
-extern texture_sample_func
-_swrast_choose_texture_sample_func( struct gl_context *ctx,
- const struct gl_texture_object *tObj );
-
-
-#endif
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.5
+ *
+ * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef S_TEXFILTER_H
+#define S_TEXFILTER_H
+
+
+#include "s_context.h"
+
+struct gl_context;
+struct gl_texture_object;
+
+
+extern texture_sample_func
+_swrast_choose_texture_sample_func( struct gl_context *ctx,
+ const struct gl_texture_object *tObj,
+ const struct gl_sampler_object *sampler);
+
+
+#endif
diff --git a/mesalib/src/mesa/vbo/vbo_exec_api.c b/mesalib/src/mesa/vbo/vbo_exec_api.c
index cb5f9ae52..306199067 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_api.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_api.c
@@ -696,8 +696,7 @@ static void GLAPIENTRY vbo_exec_Begin( GLenum mode )
struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
int i;
- if (!_mesa_valid_prim_mode(ctx, mode)) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glBegin");
+ if (!_mesa_valid_prim_mode(ctx, mode, "glBegin")) {
return;
}