aboutsummaryrefslogtreecommitdiff
path: root/mesalib
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-07-01 08:46:12 +0200
committermarha <marha@users.sourceforge.net>2014-07-01 08:46:12 +0200
commitcfc5bafcb2db8c6e05d7be6bb7315960be08c0d8 (patch)
tree1103248fcbdd2cd7a9b6cf1d336da7b3f58d4e2b /mesalib
parentfba3b6d1979c1d1ad0d56d46fc2d787f111c07fb (diff)
downloadvcxsrv-cfc5bafcb2db8c6e05d7be6bb7315960be08c0d8.tar.gz
vcxsrv-cfc5bafcb2db8c6e05d7be6bb7315960be08c0d8.tar.bz2
vcxsrv-cfc5bafcb2db8c6e05d7be6bb7315960be08c0d8.zip
fontconfig mesa pixman git update 1 July 2014
pixman commit 5a2edb3f2c2cfde6b25ac614e2004a9f78583d74 fontconfig commit dab60e4476ada4ad4639599ea24dd012d4a79584 mesa commit 1bfc0a11027449ae7ab7c28eb695f26de530eccf
Diffstat (limited to 'mesalib')
-rw-r--r--mesalib/configure.ac24
-rw-r--r--mesalib/docs/GL3.txt16
-rw-r--r--mesalib/docs/relnotes/10.3.html2
-rw-r--r--mesalib/include/GL/glx.h2
-rw-r--r--mesalib/include/GL/internal/dri_interface.h31
-rw-r--r--mesalib/src/Makefile.am4
-rw-r--r--mesalib/src/gallium/Automake.inc23
-rw-r--r--mesalib/src/glsl/ast.h5
-rw-r--r--mesalib/src/glsl/ast_to_hir.cpp19
-rw-r--r--mesalib/src/glsl/ast_type.cpp39
-rw-r--r--mesalib/src/glsl/builtin_functions.cpp64
-rw-r--r--mesalib/src/glsl/builtin_variables.cpp12
-rw-r--r--mesalib/src/glsl/glsl_parser.yy53
-rw-r--r--mesalib/src/glsl/glsl_parser_extras.h18
-rw-r--r--mesalib/src/glsl/glsl_types.h6
-rw-r--r--mesalib/src/glsl/ir.h39
-rw-r--r--mesalib/src/glsl/ir_hierarchical_visitor.cpp50
-rw-r--r--mesalib/src/glsl/ir_hierarchical_visitor.h6
-rw-r--r--mesalib/src/glsl/ir_hv_accept.cpp20
-rw-r--r--mesalib/src/glsl/ir_print_visitor.cpp20
-rw-r--r--mesalib/src/glsl/ir_reader.cpp28
-rw-r--r--mesalib/src/glsl/ir_rvalue_visitor.cpp37
-rw-r--r--mesalib/src/glsl/ir_rvalue_visitor.h6
-rw-r--r--mesalib/src/glsl/link_atomics.cpp13
-rw-r--r--mesalib/src/glsl/link_uniform_blocks.cpp6
-rw-r--r--mesalib/src/glsl/link_varyings.cpp41
-rw-r--r--mesalib/src/glsl/link_varyings.h17
-rw-r--r--mesalib/src/glsl/linker.cpp150
-rw-r--r--mesalib/src/glsl/lower_output_reads.cpp4
-rw-r--r--mesalib/src/glsl/lower_packed_varyings.cpp4
-rw-r--r--mesalib/src/glsl/opt_dead_code_local.cpp2
-rw-r--r--mesalib/src/loader/Makefile.am23
-rw-r--r--mesalib/src/loader/loader.c212
-rw-r--r--mesalib/src/loader/loader.h7
-rw-r--r--mesalib/src/mapi/glapi/gen/gl_API.xml8
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c53
-rw-r--r--mesalib/src/mesa/drivers/dri/common/dri_util.c6
-rw-r--r--mesalib/src/mesa/drivers/dri/common/xmlconfig.c207
-rw-r--r--mesalib/src/mesa/drivers/dri/common/xmlconfig.h29
-rw-r--r--mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h14
-rw-r--r--mesalib/src/mesa/main/context.c3
-rw-r--r--mesalib/src/mesa/main/dlist.c46
-rw-r--r--mesalib/src/mesa/main/extensions.c3
-rw-r--r--mesalib/src/mesa/main/ff_fragment_shader.cpp80
-rw-r--r--mesalib/src/mesa/main/format_pack.c25
-rw-r--r--mesalib/src/mesa/main/format_unpack.c14
-rw-r--r--mesalib/src/mesa/main/formats.c20
-rw-r--r--mesalib/src/mesa/main/formats.h2
-rw-r--r--mesalib/src/mesa/main/glformats.c35
-rw-r--r--mesalib/src/mesa/main/glformats.h3
-rw-r--r--mesalib/src/mesa/main/mtypes.h14
-rw-r--r--mesalib/src/mesa/main/pack.c137
-rw-r--r--mesalib/src/mesa/main/pack.h8
-rw-r--r--mesalib/src/mesa/main/queryobj.c18
-rw-r--r--mesalib/src/mesa/main/shaderapi.c1
-rw-r--r--mesalib/src/mesa/main/shaderobj.c1
-rw-r--r--mesalib/src/mesa/main/texenv.c198
-rw-r--r--mesalib/src/mesa/main/texenv.h12
-rw-r--r--mesalib/src/mesa/main/texformat.c5
-rw-r--r--mesalib/src/mesa/main/texgetimage.c5
-rw-r--r--mesalib/src/mesa/main/teximage.c13
-rw-r--r--mesalib/src/mesa/main/texstate.c15
-rw-r--r--mesalib/src/mesa/main/texstore.c78
-rw-r--r--mesalib/src/mesa/main/vdpau.c11
-rw-r--r--mesalib/src/mesa/program/prog_statevars.c30
-rw-r--r--mesalib/src/mesa/program/prog_statevars.h2
-rw-r--r--mesalib/src/mesa/program/program.c1
-rw-r--r--mesalib/src/mesa/swrast/s_texcombine.c77
-rw-r--r--mesalib/src/mesa/swrast/s_texfetch.c1
-rw-r--r--mesalib/src/mesa/swrast/s_texfetch_tmp.h16
70 files changed, 1080 insertions, 1114 deletions
diff --git a/mesalib/configure.ac b/mesalib/configure.ac
index e4cfb07ee..0d4fb0518 100644
--- a/mesalib/configure.ac
+++ b/mesalib/configure.ac
@@ -1317,6 +1317,7 @@ if test "x$enable_gallium_egl" = xyes; then
GALLIUM_STATE_TRACKERS_DIRS="egl $GALLIUM_STATE_TRACKERS_DIRS"
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl-static"
+# enable_gallium_loader=yes
fi
AM_CONDITIONAL(HAVE_GALLIUM_EGL, test "x$enable_gallium_egl" = xyes)
@@ -1425,6 +1426,7 @@ AM_CONDITIONAL(HAVE_ST_VDPAU, test "x$enable_vdpau" = xyes)
if test "x$enable_omx" = xyes; then
PKG_CHECK_MODULES([OMX], [libomxil-bellagio >= $LIBOMXIL_BELLAGIO_REQUIRED x11-xcb xcb-dri2 >= $XCBDRI2_REQUIRED])
GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS omx"
+ enable_gallium_loader=yes
fi
AM_CONDITIONAL(HAVE_ST_OMX, test "x$enable_omx" = xyes)
@@ -1602,7 +1604,7 @@ fi
AC_ARG_WITH([egl-driver-dir],
[AS_HELP_STRING([--with-egl-driver-dir=DIR],
- [directory for EGL drivers [[default=${libdir}/egl]]])],
+ [directory for EGL drivers @<:@default=${libdir}/egl@:>@])],
[EGL_DRIVER_INSTALL_DIR="$withval"],
[EGL_DRIVER_INSTALL_DIR='${libdir}/egl'])
AC_SUBST([EGL_DRIVER_INSTALL_DIR])
@@ -1909,14 +1911,14 @@ if test -n "$with_gallium_drivers"; then
HAVE_GALLIUM_SVGA=yes
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga softpipe"
gallium_require_drm_loader
- gallium_check_st "svga/drm" "dri-vmwgfx" ""
+ gallium_check_st "svga/drm" "dri-vmwgfx" "xa/vmwgfx"
;;
xi915)
HAVE_GALLIUM_I915=yes
PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
gallium_require_drm_loader
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915"
- gallium_check_st "i915/drm" "dri-i915"
+ gallium_check_st "i915/drm" "dri-i915" "xa/i915"
DRICOMMON_NEED_LIBDRM=yes
;;
xilo)
@@ -1924,7 +1926,7 @@ if test -n "$with_gallium_drivers"; then
PKG_CHECK_MODULES([INTEL], [libdrm_intel >= $LIBDRM_INTEL_REQUIRED])
gallium_require_drm_loader
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS ilo"
- gallium_check_st "intel/drm" "dri-ilo"
+ gallium_check_st "intel/drm" "dri-ilo" "xa/ilo"
DRICOMMON_NEED_LIBDRM=yes
;;
xr300)
@@ -1933,7 +1935,7 @@ if test -n "$with_gallium_drivers"; then
gallium_require_drm_loader
gallium_require_llvm "Gallium R300"
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
- gallium_check_st "radeon/drm" "r300/dri" "" "" ""
+ gallium_check_st "radeon/drm" "r300/dri" "xa/r300" "" ""
DRICOMMON_NEED_LIBDRM=yes
;;
xr600)
@@ -1951,7 +1953,7 @@ if test -n "$with_gallium_drivers"; then
if test "x$enable_opencl" = xyes; then
LLVM_COMPONENTS="${LLVM_COMPONENTS} bitreader asmparser"
fi
- gallium_check_st "radeon/drm" "r600/dri" "" "xvmc/r600" "vdpau/r600" "r600/omx"
+ gallium_check_st "radeon/drm" "r600/dri" "xa/r600" "xvmc/r600" "vdpau/r600" "omx/r600"
DRICOMMON_NEED_LIBDRM=yes
;;
xradeonsi)
@@ -1961,7 +1963,7 @@ if test -n "$with_gallium_drivers"; then
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS radeonsi"
radeon_llvm_check "radeonsi"
require_egl_drm "radeonsi"
- gallium_check_st "radeon/drm" "radeonsi/dri" "" "" "vdpau/radeonsi" "radeonsi/omx"
+ gallium_check_st "radeon/drm" "radeonsi/dri" "xa/radeonsi" "" "vdpau/radeonsi" "omx/radeonsi"
DRICOMMON_NEED_LIBDRM=yes
;;
xnouveau)
@@ -1969,7 +1971,7 @@ if test -n "$with_gallium_drivers"; then
PKG_CHECK_MODULES([NOUVEAU], [libdrm_nouveau >= $LIBDRM_NOUVEAU_REQUIRED])
gallium_require_drm_loader
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau"
- gallium_check_st "nouveau/drm" "dri-nouveau" "" "xvmc/nouveau" "vdpau/nouveau" "omx-nouveau"
+ gallium_check_st "nouveau/drm" "dri-nouveau" "xa/nouveau" "xvmc/nouveau" "vdpau/nouveau" "omx/nouveau"
DRICOMMON_NEED_LIBDRM=yes
;;
xfreedreno)
@@ -1977,7 +1979,7 @@ if test -n "$with_gallium_drivers"; then
PKG_CHECK_MODULES([FREEDRENO], [libdrm_freedreno >= $LIBDRM_FREEDRENO_REQUIRED])
gallium_require_drm_loader
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS freedreno"
- gallium_check_st "freedreno/drm" "dri-freedreno" "" "" ""
+ gallium_check_st "freedreno/drm" "dri-freedreno" "xa/freedreno" "" ""
DRICOMMON_NEED_LIBDRM=yes
;;
xswrast)
@@ -2214,16 +2216,14 @@ AC_CONFIG_FILES([Makefile
src/gallium/targets/egl-static/Makefile
src/gallium/targets/gbm/Makefile
src/gallium/targets/libgl-xlib/Makefile
- src/gallium/targets/omx-nouveau/Makefile
+ src/gallium/targets/omx/Makefile
src/gallium/targets/opencl/Makefile
src/gallium/targets/osmesa/Makefile
src/gallium/targets/osmesa/osmesa.pc
src/gallium/targets/pipe-loader/Makefile
src/gallium/targets/r300/dri/Makefile
src/gallium/targets/r600/dri/Makefile
- src/gallium/targets/r600/omx/Makefile
src/gallium/targets/radeonsi/dri/Makefile
- src/gallium/targets/radeonsi/omx/Makefile
src/gallium/targets/vdpau/Makefile
src/gallium/targets/xa/Makefile
src/gallium/targets/xa/xatracker.pc
diff --git a/mesalib/docs/GL3.txt b/mesalib/docs/GL3.txt
index 47165fe1e..bc418a908 100644
--- a/mesalib/docs/GL3.txt
+++ b/mesalib/docs/GL3.txt
@@ -101,21 +101,21 @@ GL 4.0:
GL_ARB_draw_indirect DONE (i965)
GL_ARB_gpu_shader5 started
- 'precise' qualifier DONE
- - Dynamically uniform sampler array indices not started
- - Dynamically uniform UBO array indices not started
+ - Dynamically uniform sampler array indices started (Chris)
+ - Dynamically uniform UBO array indices started (Chris)
- Implicit signed -> unsigned conversions DONE
- Fused multiply-add DONE
- Packing/bitfield/conversion functions DONE
- Enhanced textureGather DONE
- Geometry shader instancing DONE
- - Geometry shader multiple streams not started
+ - Geometry shader multiple streams DONE (i965)
- Enhanced per-sample shading DONE
- - Interpolation functions started
+ - Interpolation functions started (Chris)
- New overload resolution rules DONE
- GL_ARB_gpu_shader_fp64 not started
+ GL_ARB_gpu_shader_fp64 started (Dave)
GL_ARB_sample_shading DONE (i965, nv50, nvc0, radeonsi)
GL_ARB_shader_subroutine not started
- GL_ARB_tessellation_shader not started
+ GL_ARB_tessellation_shader started (Fabian)
GL_ARB_texture_buffer_object_rgb32 DONE (i965, nvc0, r600, radeonsi, softpipe)
GL_ARB_texture_cube_map_array DONE (i965, nv50, nvc0, r600, radeonsi, softpipe)
GL_ARB_texture_gather DONE (i965, nv50, nvc0, radeonsi)
@@ -130,7 +130,7 @@ GL 4.1:
GL_ARB_ES2_compatibility DONE (i965, nv50, nvc0, r300, r600, radeonsi)
GL_ARB_get_program_binary DONE (0 binary formats)
GL_ARB_separate_shader_objects DONE (all drivers)
- GL_ARB_shader_precision not started
+ GL_ARB_shader_precision started (Micah)
GL_ARB_vertex_attrib_64bit not started
GL_ARB_viewport_array DONE (i965, nv50, nvc0, r600)
@@ -154,7 +154,7 @@ GL 4.2:
GL 4.3:
GLSL 4.3 not started
- GL_ARB_arrays_of_arrays started
+ GL_ARB_arrays_of_arrays started (Timothy)
GL_ARB_ES3_compatibility DONE (i965)
GL_ARB_clear_buffer_object DONE (all drivers)
GL_ARB_compute_shader started (Paul Berry)
diff --git a/mesalib/docs/relnotes/10.3.html b/mesalib/docs/relnotes/10.3.html
index ecc8580f4..47d2c5fff 100644
--- a/mesalib/docs/relnotes/10.3.html
+++ b/mesalib/docs/relnotes/10.3.html
@@ -53,6 +53,7 @@ Note: some of the new features are only available with certain drivers.
<li>GL_ARB_texture_query_levels on nv50, nvc0, llvmpipe, r600, radeonsi, softpipe</li>
<li>GL_ARB_texture_query_lod on radeonsi</li>
<li>GL_ARB_viewport_array on nvc0</li>
+<li>GL_ARB_seamless_cubemap_per_texture on i965, llvmpipe, nvc0, r600, radeonsi, softpipe</li>
</ul>
@@ -63,6 +64,7 @@ TBD.
<h2>Changes</h2>
<ul>
+<li>Removed support for the GL_ATI_envmap_bumpmap extension</li>
</ul>
</div>
diff --git a/mesalib/include/GL/glx.h b/mesalib/include/GL/glx.h
index 234abc050..78f5052b2 100644
--- a/mesalib/include/GL/glx.h
+++ b/mesalib/include/GL/glx.h
@@ -518,7 +518,7 @@ typedef struct {
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
- GLXDrawable drawable; /* drawable on which event was requested in event mask */
+ Drawable drawable; /* drawable on which event was requested in event mask */
int event_type;
int64_t ust;
int64_t msc;
diff --git a/mesalib/include/GL/internal/dri_interface.h b/mesalib/include/GL/internal/dri_interface.h
index 4d57d0b82..725d622a1 100644
--- a/mesalib/include/GL/internal/dri_interface.h
+++ b/mesalib/include/GL/internal/dri_interface.h
@@ -40,6 +40,7 @@
#ifndef DRI_INTERFACE_H
#define DRI_INTERFACE_H
+#include <stdbool.h>
/* For archs with no drm.h */
#if defined(__APPLE__) || defined(__CYGWIN__) || defined(__GNU__)
#ifndef __NOT_HAVE_DRM_H
@@ -1005,7 +1006,7 @@ struct __DRIdri2ExtensionRec {
* extensions.
*/
#define __DRI_IMAGE "DRI_IMAGE"
-#define __DRI_IMAGE_VERSION 8
+#define __DRI_IMAGE_VERSION 9
/**
* These formats correspond to the similarly named MESA_FORMAT_*
@@ -1133,6 +1134,13 @@ enum __DRIChromaSiting {
#define __DRI_IMAGE_ERROR_BAD_PARAMETER 3
/*@}*/
+/**
+ * blitImage flags
+ */
+
+#define __BLIT_FLAG_FLUSH 0x0001
+#define __BLIT_FLAG_FINISH 0x0002
+
typedef struct __DRIimageRec __DRIimage;
typedef struct __DRIimageExtensionRec __DRIimageExtension;
struct __DRIimageExtensionRec {
@@ -1239,6 +1247,21 @@ struct __DRIimageExtensionRec {
enum __DRIChromaSiting vert_siting,
unsigned *error,
void *loaderPrivate);
+
+ /**
+ * Blit a part of a __DRIimage to another and flushes
+ *
+ * flush_flag:
+ * 0: no flush
+ * __BLIT_FLAG_FLUSH: flush after the blit operation
+ * __BLIT_FLAG_FINISH: flush and wait the blit finished
+ *
+ * \since 9
+ */
+ void (*blitImage)(__DRIcontext *context, __DRIimage *dst, __DRIimage *src,
+ int dstx0, int dsty0, int dstwidth, int dstheight,
+ int srcx0, int srcy0, int srcwidth, int srcheight,
+ int flush_flag);
};
@@ -1272,9 +1295,9 @@ typedef struct __DRI2configQueryExtensionRec __DRI2configQueryExtension;
struct __DRI2configQueryExtensionRec {
__DRIextension base;
- int (*configQueryb)(__DRIscreen *screen, const char *var, GLboolean *val);
- int (*configQueryi)(__DRIscreen *screen, const char *var, GLint *val);
- int (*configQueryf)(__DRIscreen *screen, const char *var, GLfloat *val);
+ int (*configQueryb)(__DRIscreen *screen, const char *var, bool *val);
+ int (*configQueryi)(__DRIscreen *screen, const char *var, int *val);
+ int (*configQueryf)(__DRIscreen *screen, const char *var, float *val);
};
/**
diff --git a/mesalib/src/Makefile.am b/mesalib/src/Makefile.am
index 9d1580f90..d4a7090dc 100644
--- a/mesalib/src/Makefile.am
+++ b/mesalib/src/Makefile.am
@@ -19,12 +19,14 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
-SUBDIRS = gtest loader mapi
+SUBDIRS = gtest mapi
if NEED_OPENGL_COMMON
SUBDIRS += glsl mesa
endif
+SUBDIRS += loader
+
if HAVE_DRI_GLX
SUBDIRS += glx
endif
diff --git a/mesalib/src/gallium/Automake.inc b/mesalib/src/gallium/Automake.inc
index 8bf2a12e8..4600b9c5b 100644
--- a/mesalib/src/gallium/Automake.inc
+++ b/mesalib/src/gallium/Automake.inc
@@ -39,7 +39,7 @@ GALLIUM_DRI_CFLAGS = \
$(LIBDRM_CFLAGS) \
$(VISIBILITY_CFLAGS)
-GALLIUM_VIDEO_CFLAGS = \
+GALLIUM_TARGET_CFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/loader \
-I$(top_srcdir)/src/gallium/include \
@@ -59,20 +59,10 @@ GALLIUM_DRI_LINKER_FLAGS = \
-avoid-version \
$(GC_SECTIONS)
-GALLIUM_OMX_LINKER_FLAGS = \
- -shared \
- -module \
- -no-undefined \
- -avoid-version \
- $(GC_SECTIONS) \
- $(LD_NO_UNDEFINED)
-
if HAVE_LD_VERSION_SCRIPT
GALLIUM_DRI_LINKER_FLAGS += \
-Wl,--version-script=$(top_srcdir)/src/gallium/targets/dri.sym
-GALLIUM_OMX_LINKER_FLAGS += \
- -Wl,--version-script=$(top_srcdir)/src/gallium/targets/omx.sym
endif
@@ -90,12 +80,6 @@ GALLIUM_DRI_LIB_DEPS = \
$(EXPAT_LIBS) \
$(GALLIUM_COMMON_LIB_DEPS)
-GALLIUM_OMX_LIB_DEPS = \
- $(top_builddir)/src/gallium/auxiliary/libgallium.la \
- $(top_builddir)/src/gallium/state_trackers/omx/libomxtracker.la \
- $(OMX_LIBS) \
- $(GALLIUM_COMMON_LIB_DEPS)
-
GALLIUM_WINSYS_CFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/gallium/include \
@@ -104,13 +88,8 @@ GALLIUM_WINSYS_CFLAGS = \
$(VISIBILITY_CFLAGS)
if HAVE_MESA_LLVM
-
GALLIUM_DRI_LINKER_FLAGS += $(LLVM_LDFLAGS)
-GALLIUM_OMX_LINKER_FLAGS += $(LLVM_LDFLAGS)
-
GALLIUM_DRI_LIB_DEPS += $(LLVM_LIBS)
-GALLIUM_OMX_LIB_DEPS += $(LLVM_LIBS)
-
endif
diff --git a/mesalib/src/glsl/ast.h b/mesalib/src/glsl/ast.h
index 56e7bd86f..15bf086a1 100644
--- a/mesalib/src/glsl/ast.h
+++ b/mesalib/src/glsl/ast.h
@@ -509,6 +509,8 @@ struct ast_type_qualifier {
/** \name Layout qualifiers for GL_ARB_gpu_shader5 */
/** \{ */
unsigned invocations:1;
+ unsigned stream:1; /**< Has stream value assigned */
+ unsigned explicit_stream:1; /**< stream value assigned explicitly by shader code */
/** \} */
}
/** \brief Set of flags, accessed by name. */
@@ -542,6 +544,9 @@ struct ast_type_qualifier {
/** Maximum output vertices in GLSL 1.50 geometry shaders. */
int max_vertices;
+ /** Stream in GLSL 1.50 geometry shaders. */
+ unsigned stream;
+
/** Input or output primitive type in GLSL 1.50 geometry shaders */
GLenum prim_type;
diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp
index 7ba04a808..042ef243b 100644
--- a/mesalib/src/glsl/ast_to_hir.cpp
+++ b/mesalib/src/glsl/ast_to_hir.cpp
@@ -2461,6 +2461,11 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
if (qual->flags.q.sample)
var->data.sample = 1;
+ if (state->stage == MESA_SHADER_GEOMETRY &&
+ qual->flags.q.out && qual->flags.q.stream) {
+ var->data.stream = qual->stream;
+ }
+
if (qual->flags.q.attribute && state->stage != MESA_SHADER_VERTEX) {
var->type = glsl_type::error_type;
_mesa_glsl_error(loc, state,
@@ -5100,6 +5105,9 @@ ast_process_structure_or_interface_block(exec_list *instructions,
fields[i].centroid = qual->flags.q.centroid ? 1 : 0;
fields[i].sample = qual->flags.q.sample ? 1 : 0;
+ /* Only save explicitly defined streams in block's field */
+ fields[i].stream = qual->flags.q.explicit_stream ? qual->stream : -1;
+
if (qual->flags.q.row_major || qual->flags.q.column_major) {
if (!qual->flags.q.uniform) {
_mesa_glsl_error(&loc, state,
@@ -5548,6 +5556,17 @@ ast_interface_block::hir(exec_list *instructions,
var->data.sample = fields[i].sample;
var->init_interface_type(block_type);
+ if (fields[i].stream != -1 &&
+ ((unsigned)fields[i].stream) != this->layout.stream) {
+ _mesa_glsl_error(&loc, state,
+ "stream layout qualifier on "
+ "interface block member `%s' does not match "
+ "the interface block (%d vs %d)",
+ var->name, fields[i].stream, this->layout.stream);
+ }
+
+ var->data.stream = this->layout.stream;
+
if (redeclaring_per_vertex) {
ir_variable *earlier =
get_variable_being_redeclared(var, loc, state,
diff --git a/mesalib/src/glsl/ast_type.cpp b/mesalib/src/glsl/ast_type.cpp
index 77053d5b1..017f23d0e 100644
--- a/mesalib/src/glsl/ast_type.cpp
+++ b/mesalib/src/glsl/ast_type.cpp
@@ -125,9 +125,13 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
/* Uniform block layout qualifiers get to overwrite each
* other (rightmost having priority), while all other
* qualifiers currently don't allow duplicates.
+ *
+ * Geometry shaders can have several layout qualifiers
+ * assigning different stream values.
*/
- if ((this->flags.i & q.flags.i & ~(ubo_mat_mask.flags.i |
+ if ((state->stage != MESA_SHADER_GEOMETRY) &&
+ (this->flags.i & q.flags.i & ~(ubo_mat_mask.flags.i |
ubo_layout_mask.flags.i |
ubo_binding_mask.flags.i)) != 0) {
_mesa_glsl_error(loc, state,
@@ -154,6 +158,39 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
this->max_vertices = q.max_vertices;
}
+ if (state->stage == MESA_SHADER_GEOMETRY &&
+ state->has_explicit_attrib_stream()) {
+ if (q.flags.q.stream && q.stream >= state->ctx->Const.MaxVertexStreams) {
+ _mesa_glsl_error(loc, state,
+ "`stream' value is larger than MAX_VERTEX_STREAMS - 1 "
+ "(%d > %d)",
+ q.stream, state->ctx->Const.MaxVertexStreams - 1);
+ }
+ if (this->flags.q.explicit_stream &&
+ this->stream >= state->ctx->Const.MaxVertexStreams) {
+ _mesa_glsl_error(loc, state,
+ "`stream' value is larger than MAX_VERTEX_STREAMS - 1 "
+ "(%d > %d)",
+ this->stream, state->ctx->Const.MaxVertexStreams - 1);
+ }
+
+ if (!this->flags.q.explicit_stream) {
+ if (q.flags.q.stream) {
+ this->flags.q.stream = 1;
+ this->stream = q.stream;
+ } else if (!this->flags.q.stream && this->flags.q.out) {
+ /* Assign default global stream value */
+ this->flags.q.stream = 1;
+ this->stream = state->out_qualifier->stream;
+ }
+ } else {
+ if (q.flags.q.explicit_stream) {
+ _mesa_glsl_error(loc, state,
+ "duplicate layout `stream' qualifier");
+ }
+ }
+ }
+
if ((q.flags.i & ubo_mat_mask.flags.i) != 0)
this->flags.i &= ~ubo_mat_mask.flags.i;
if ((q.flags.i & ubo_layout_mask.flags.i) != 0)
diff --git a/mesalib/src/glsl/builtin_functions.cpp b/mesalib/src/glsl/builtin_functions.cpp
index f9f06862e..94b578107 100644
--- a/mesalib/src/glsl/builtin_functions.cpp
+++ b/mesalib/src/glsl/builtin_functions.cpp
@@ -359,6 +359,12 @@ shader_image_load_store(const _mesa_glsl_parse_state *state)
state->ARB_shader_image_load_store_enable);
}
+static bool
+gs_streams(const _mesa_glsl_parse_state *state)
+{
+ return gpu_shader5(state) && gs_only(state);
+}
+
/** @} */
/******************************************************************************/
@@ -594,6 +600,10 @@ private:
B0(EmitVertex)
B0(EndPrimitive)
+ ir_function_signature *_EmitStreamVertex(builtin_available_predicate avail,
+ const glsl_type *stream_type);
+ ir_function_signature *_EndStreamPrimitive(builtin_available_predicate avail,
+ const glsl_type *stream_type);
B2(textureQueryLod);
B1(textureQueryLevels);
@@ -1708,6 +1718,14 @@ builtin_builder::create_builtins()
add_function("EmitVertex", _EmitVertex(), NULL);
add_function("EndPrimitive", _EndPrimitive(), NULL);
+ add_function("EmitStreamVertex",
+ _EmitStreamVertex(gs_streams, glsl_type::uint_type),
+ _EmitStreamVertex(gs_streams, glsl_type::int_type),
+ NULL);
+ add_function("EndStreamPrimitive",
+ _EndStreamPrimitive(gs_streams, glsl_type::uint_type),
+ _EndStreamPrimitive(gs_streams, glsl_type::int_type),
+ NULL);
add_function("textureQueryLOD",
_textureQueryLod(glsl_type::sampler1D_type, glsl_type::float_type),
@@ -3872,7 +3890,28 @@ builtin_builder::_EmitVertex()
{
MAKE_SIG(glsl_type::void_type, gs_only, 0);
- body.emit(new(mem_ctx) ir_emit_vertex());
+ ir_rvalue *stream = new(mem_ctx) ir_constant(0, 1);
+ body.emit(new(mem_ctx) ir_emit_vertex(stream));
+
+ return sig;
+}
+
+ir_function_signature *
+builtin_builder::_EmitStreamVertex(builtin_available_predicate avail,
+ const glsl_type *stream_type)
+{
+ /* Section 8.12 (Geometry Shader Functions) of the GLSL 4.0 spec says:
+ *
+ * "Emit the current values of output variables to the current output
+ * primitive on stream stream. The argument to stream must be a constant
+ * integral expression."
+ */
+ ir_variable *stream =
+ new(mem_ctx) ir_variable(stream_type, "stream", ir_var_const_in);
+
+ MAKE_SIG(glsl_type::void_type, avail, 1, stream);
+
+ body.emit(new(mem_ctx) ir_emit_vertex(var_ref(stream)));
return sig;
}
@@ -3882,7 +3921,28 @@ builtin_builder::_EndPrimitive()
{
MAKE_SIG(glsl_type::void_type, gs_only, 0);
- body.emit(new(mem_ctx) ir_end_primitive());
+ ir_rvalue *stream = new(mem_ctx) ir_constant(0, 1);
+ body.emit(new(mem_ctx) ir_end_primitive(stream));
+
+ return sig;
+}
+
+ir_function_signature *
+builtin_builder::_EndStreamPrimitive(builtin_available_predicate avail,
+ const glsl_type *stream_type)
+{
+ /* Section 8.12 (Geometry Shader Functions) of the GLSL 4.0 spec says:
+ *
+ * "Completes the current output primitive on stream stream and starts
+ * a new one. The argument to stream must be a constant integral
+ * expression."
+ */
+ ir_variable *stream =
+ new(mem_ctx) ir_variable(stream_type, "stream", ir_var_const_in);
+
+ MAKE_SIG(glsl_type::void_type, avail, 1, stream);
+
+ body.emit(new(mem_ctx) ir_end_primitive(var_ref(stream)));
return sig;
}
diff --git a/mesalib/src/glsl/builtin_variables.cpp b/mesalib/src/glsl/builtin_variables.cpp
index b9c69d23c..9f9571619 100644
--- a/mesalib/src/glsl/builtin_variables.cpp
+++ b/mesalib/src/glsl/builtin_variables.cpp
@@ -160,14 +160,6 @@ static const struct gl_builtin_uniform_element gl_NormalScale_elements[] = {
{NULL, {STATE_NORMAL_SCALE}, SWIZZLE_XXXX},
};
-static const struct gl_builtin_uniform_element gl_BumpRotMatrix0MESA_elements[] = {
- {NULL, {STATE_INTERNAL, STATE_ROT_MATRIX_0}, SWIZZLE_XYZW},
-};
-
-static const struct gl_builtin_uniform_element gl_BumpRotMatrix1MESA_elements[] = {
- {NULL, {STATE_INTERNAL, STATE_ROT_MATRIX_1}, SWIZZLE_XYZW},
-};
-
static const struct gl_builtin_uniform_element gl_FogParamsOptimizedMESA_elements[] = {
{NULL, {STATE_INTERNAL, STATE_FOG_PARAMS_OPTIMIZED}, SWIZZLE_XYZW},
};
@@ -284,8 +276,6 @@ static const struct gl_builtin_uniform_desc _mesa_builtin_uniform_desc[] = {
STATEVAR(gl_NormalMatrix),
STATEVAR(gl_NormalScale),
- STATEVAR(gl_BumpRotMatrix0MESA),
- STATEVAR(gl_BumpRotMatrix1MESA),
STATEVAR(gl_FogParamsOptimizedMESA),
STATEVAR(gl_CurrentAttribVertMESA),
STATEVAR(gl_CurrentAttribFragMESA),
@@ -761,8 +751,6 @@ builtin_variable_generator::generate_uniforms()
add_uniform(mat4_t, "gl_ModelViewProjectionMatrixInverseTranspose");
add_uniform(float_t, "gl_NormalScale");
add_uniform(type("gl_LightModelParameters"), "gl_LightModel");
- add_uniform(vec2_t, "gl_BumpRotMatrix0MESA");
- add_uniform(vec2_t, "gl_BumpRotMatrix1MESA");
add_uniform(vec4_t, "gl_FogParamsOptimizedMESA");
const glsl_type *const mat4_array_type =
diff --git a/mesalib/src/glsl/glsl_parser.yy b/mesalib/src/glsl/glsl_parser.yy
index 240995901..b9897498f 100644
--- a/mesalib/src/glsl/glsl_parser.yy
+++ b/mesalib/src/glsl/glsl_parser.yy
@@ -1395,6 +1395,22 @@ layout_qualifier_id:
}
}
+ if (state->stage == MESA_SHADER_GEOMETRY) {
+ if (match_layout_qualifier("stream", $1, state) == 0 &&
+ state->check_explicit_attrib_stream_allowed(& @3)) {
+ $$.flags.q.stream = 1;
+
+ if ($3 < 0) {
+ _mesa_glsl_error(& @3, state,
+ "invalid stream %d specified", $3);
+ YYERROR;
+ } else {
+ $$.flags.q.explicit_stream = 1;
+ $$.stream = $3;
+ }
+ }
+ }
+
static const char * const local_size_qualifiers[3] = {
"local_size_x",
"local_size_y",
@@ -1693,6 +1709,20 @@ storage_qualifier:
{
memset(& $$, 0, sizeof($$));
$$.flags.q.out = 1;
+
+ if (state->stage == MESA_SHADER_GEOMETRY &&
+ state->has_explicit_attrib_stream()) {
+ /* Section 4.3.8.2 (Output Layout Qualifiers) of the GLSL 4.00
+ * spec says:
+ *
+ * "If the block or variable is declared with the stream
+ * identifier, it is associated with the specified stream;
+ * otherwise, it is associated with the current default stream."
+ */
+ $$.flags.q.stream = 1;
+ $$.flags.q.explicit_stream = 0;
+ $$.stream = state->out_qualifier->stream;
+ }
}
| UNIFORM
{
@@ -2361,6 +2391,18 @@ interface_block:
if (!block->layout.merge_qualifier(& @1, state, $1)) {
YYERROR;
}
+
+ foreach_list_typed (ast_declarator_list, member, link, &block->declarations) {
+ ast_type_qualifier& qualifier = member->type->qualifier;
+ if (qualifier.flags.q.stream && qualifier.stream != block->layout.stream) {
+ _mesa_glsl_error(& @1, state,
+ "stream layout qualifier on "
+ "interface block member does not match "
+ "the interface block (%d vs %d)",
+ qualifier.stream, block->layout.stream);
+ YYERROR;
+ }
+ }
$$ = block;
}
;
@@ -2434,6 +2476,14 @@ basic_interface_block:
block->layout.flags.i |= block_interface_qualifier;
+ if (state->stage == MESA_SHADER_GEOMETRY &&
+ state->has_explicit_attrib_stream()) {
+ /* Assign global layout's stream value. */
+ block->layout.flags.q.stream = 1;
+ block->layout.flags.q.explicit_stream = 0;
+ block->layout.stream = state->out_qualifier->stream;
+ }
+
foreach_list_typed (ast_declarator_list, member, link, &block->declarations) {
ast_type_qualifier& qualifier = member->type->qualifier;
if ((qualifier.flags.i & interface_type_mask) == 0) {
@@ -2576,6 +2626,9 @@ layout_defaults:
}
if (!state->out_qualifier->merge_qualifier(& @1, state, $1))
YYERROR;
+
+ /* Allow future assigments of global out's stream id value */
+ state->out_qualifier->flags.q.explicit_stream = 0;
}
$$ = NULL;
}
diff --git a/mesalib/src/glsl/glsl_parser_extras.h b/mesalib/src/glsl/glsl_parser_extras.h
index aa4a114e4..a0af965fd 100644
--- a/mesalib/src/glsl/glsl_parser_extras.h
+++ b/mesalib/src/glsl/glsl_parser_extras.h
@@ -119,6 +119,19 @@ struct _mesa_glsl_parse_state {
return check_version(130, 300, locp, "bit-wise operations are forbidden");
}
+ bool check_explicit_attrib_stream_allowed(YYLTYPE *locp)
+ {
+ if (!this->has_explicit_attrib_stream()) {
+ const char *const requirement = "GL_ARB_gpu_shader5 extension or GLSL 400";
+
+ _mesa_glsl_error(locp, this, "explicit stream requires %s",
+ requirement);
+ return false;
+ }
+
+ return true;
+ }
+
bool check_explicit_attrib_location_allowed(YYLTYPE *locp,
const ir_variable *var)
{
@@ -166,6 +179,11 @@ struct _mesa_glsl_parse_state {
return true;
}
+ bool has_explicit_attrib_stream() const
+ {
+ return ARB_gpu_shader5_enable || is_version(400, 0);
+ }
+
bool has_explicit_attrib_location() const
{
return ARB_explicit_attrib_location_enable || is_version(330, 300);
diff --git a/mesalib/src/glsl/glsl_types.h b/mesalib/src/glsl/glsl_types.h
index f6d4a02ab..0b63d4850 100644
--- a/mesalib/src/glsl/glsl_types.h
+++ b/mesalib/src/glsl/glsl_types.h
@@ -671,6 +671,12 @@ struct glsl_struct_field {
* in ir_variable::sample). 0 otherwise.
*/
unsigned sample:1;
+
+ /**
+ * For interface blocks, it has a value if this variable uses multiple vertex
+ * streams (as in ir_variable::stream). -1 otherwise.
+ */
+ int stream;
};
static inline unsigned int
diff --git a/mesalib/src/glsl/ir.h b/mesalib/src/glsl/ir.h
index b4e52d3d0..d5239d4de 100644
--- a/mesalib/src/glsl/ir.h
+++ b/mesalib/src/glsl/ir.h
@@ -706,6 +706,11 @@ public:
int location;
/**
+ * Vertex stream output identifier.
+ */
+ unsigned stream;
+
+ /**
* output index for dual source blending.
*/
int index;
@@ -2154,9 +2159,11 @@ private:
*/
class ir_emit_vertex : public ir_instruction {
public:
- ir_emit_vertex()
- : ir_instruction(ir_type_emit_vertex)
+ ir_emit_vertex(ir_rvalue *stream)
+ : ir_instruction(ir_type_emit_vertex),
+ stream(stream)
{
+ assert(stream);
}
virtual void accept(ir_visitor *v)
@@ -2164,12 +2171,19 @@ public:
v->visit(this);
}
- virtual ir_emit_vertex *clone(void *mem_ctx, struct hash_table *) const
+ virtual ir_emit_vertex *clone(void *mem_ctx, struct hash_table *ht) const
{
- return new(mem_ctx) ir_emit_vertex();
+ return new(mem_ctx) ir_emit_vertex(this->stream->clone(mem_ctx, ht));
}
virtual ir_visitor_status accept(ir_hierarchical_visitor *);
+
+ int stream_id() const
+ {
+ return stream->as_constant()->value.i[0];
+ }
+
+ ir_rvalue *stream;
};
/**
@@ -2178,9 +2192,11 @@ public:
*/
class ir_end_primitive : public ir_instruction {
public:
- ir_end_primitive()
- : ir_instruction(ir_type_end_primitive)
+ ir_end_primitive(ir_rvalue *stream)
+ : ir_instruction(ir_type_end_primitive),
+ stream(stream)
{
+ assert(stream);
}
virtual void accept(ir_visitor *v)
@@ -2188,12 +2204,19 @@ public:
v->visit(this);
}
- virtual ir_end_primitive *clone(void *mem_ctx, struct hash_table *) const
+ virtual ir_end_primitive *clone(void *mem_ctx, struct hash_table *ht) const
{
- return new(mem_ctx) ir_end_primitive();
+ return new(mem_ctx) ir_end_primitive(this->stream->clone(mem_ctx, ht));
}
virtual ir_visitor_status accept(ir_hierarchical_visitor *);
+
+ int stream_id() const
+ {
+ return stream->as_constant()->value.i[0];
+ }
+
+ ir_rvalue *stream;
};
/*@}*/
diff --git a/mesalib/src/glsl/ir_hierarchical_visitor.cpp b/mesalib/src/glsl/ir_hierarchical_visitor.cpp
index 2e606dda4..d3c00ecdb 100644
--- a/mesalib/src/glsl/ir_hierarchical_visitor.cpp
+++ b/mesalib/src/glsl/ir_hierarchical_visitor.cpp
@@ -69,24 +69,6 @@ ir_hierarchical_visitor::visit(ir_loop_jump *ir)
}
ir_visitor_status
-ir_hierarchical_visitor::visit(ir_emit_vertex *ir)
-{
- if (this->callback != NULL)
- this->callback(ir, this->data);
-
- return visit_continue;
-}
-
-ir_visitor_status
-ir_hierarchical_visitor::visit(ir_end_primitive *ir)
-{
- if (this->callback != NULL)
- this->callback(ir, this->data);
-
- return visit_continue;
-}
-
-ir_visitor_status
ir_hierarchical_visitor::visit(ir_dereference_variable *ir)
{
if (this->callback != NULL)
@@ -303,6 +285,38 @@ ir_hierarchical_visitor::visit_leave(ir_if *ir)
return visit_continue;
}
+ir_visitor_status
+ir_hierarchical_visitor::visit_enter(ir_emit_vertex *ir)
+{
+ if (this->callback != NULL)
+ this->callback(ir, this->data);
+
+ return visit_continue;
+}
+
+ir_visitor_status
+ir_hierarchical_visitor::visit_leave(ir_emit_vertex *ir)
+{
+ (void) ir;
+ return visit_continue;
+}
+
+ir_visitor_status
+ir_hierarchical_visitor::visit_enter(ir_end_primitive *ir)
+{
+ if (this->callback != NULL)
+ this->callback(ir, this->data);
+
+ return visit_continue;
+}
+
+ir_visitor_status
+ir_hierarchical_visitor::visit_leave(ir_end_primitive *ir)
+{
+ (void) ir;
+ return visit_continue;
+}
+
void
ir_hierarchical_visitor::run(exec_list *instructions)
{
diff --git a/mesalib/src/glsl/ir_hierarchical_visitor.h b/mesalib/src/glsl/ir_hierarchical_visitor.h
index 647d2e002..bc89a04d8 100644
--- a/mesalib/src/glsl/ir_hierarchical_visitor.h
+++ b/mesalib/src/glsl/ir_hierarchical_visitor.h
@@ -87,8 +87,6 @@ public:
virtual ir_visitor_status visit(class ir_variable *);
virtual ir_visitor_status visit(class ir_constant *);
virtual ir_visitor_status visit(class ir_loop_jump *);
- virtual ir_visitor_status visit(class ir_emit_vertex *);
- virtual ir_visitor_status visit(class ir_end_primitive *);
/**
* ir_dereference_variable isn't technically a leaf, but it is treated as a
@@ -137,6 +135,10 @@ public:
virtual ir_visitor_status visit_leave(class ir_discard *);
virtual ir_visitor_status visit_enter(class ir_if *);
virtual ir_visitor_status visit_leave(class ir_if *);
+ virtual ir_visitor_status visit_enter(class ir_emit_vertex *);
+ virtual ir_visitor_status visit_leave(class ir_emit_vertex *);
+ virtual ir_visitor_status visit_enter(class ir_end_primitive *);
+ virtual ir_visitor_status visit_leave(class ir_end_primitive *);
/*@}*/
diff --git a/mesalib/src/glsl/ir_hv_accept.cpp b/mesalib/src/glsl/ir_hv_accept.cpp
index 2a1f70e5b..3ca7a5887 100644
--- a/mesalib/src/glsl/ir_hv_accept.cpp
+++ b/mesalib/src/glsl/ir_hv_accept.cpp
@@ -405,12 +405,28 @@ ir_if::accept(ir_hierarchical_visitor *v)
ir_visitor_status
ir_emit_vertex::accept(ir_hierarchical_visitor *v)
{
- return v->visit(this);
+ ir_visitor_status s = v->visit_enter(this);
+ if (s != visit_continue)
+ return (s == visit_continue_with_parent) ? visit_continue : s;
+
+ s = this->stream->accept(v);
+ if (s != visit_continue)
+ return (s == visit_continue_with_parent) ? visit_continue : s;
+
+ return (s == visit_stop) ? s : v->visit_leave(this);
}
ir_visitor_status
ir_end_primitive::accept(ir_hierarchical_visitor *v)
{
- return v->visit(this);
+ ir_visitor_status s = v->visit_enter(this);
+ if (s != visit_continue)
+ return (s == visit_continue_with_parent) ? visit_continue : s;
+
+ s = this->stream->accept(v);
+ if (s != visit_continue)
+ return (s == visit_continue_with_parent) ? visit_continue : s;
+
+ return (s == visit_stop) ? s : v->visit_leave(this);
}
diff --git a/mesalib/src/glsl/ir_print_visitor.cpp b/mesalib/src/glsl/ir_print_visitor.cpp
index c4a6f9c9f..72ad4223f 100644
--- a/mesalib/src/glsl/ir_print_visitor.cpp
+++ b/mesalib/src/glsl/ir_print_visitor.cpp
@@ -169,11 +169,14 @@ void ir_print_visitor::visit(ir_variable *ir)
"in ", "out ", "inout ",
"const_in ", "sys ", "temporary " };
STATIC_ASSERT(ARRAY_SIZE(mode) == ir_var_mode_count);
+ const char *const stream [] = {"", "stream1 ", "stream2 ", "stream3 "};
const char *const interp[] = { "", "smooth", "flat", "noperspective" };
STATIC_ASSERT(ARRAY_SIZE(interp) == INTERP_QUALIFIER_COUNT);
- fprintf(f, "(%s%s%s%s%s) ",
- cent, samp, inv, mode[ir->data.mode], interp[ir->data.interpolation]);
+ fprintf(f, "(%s%s%s%s%s%s) ",
+ cent, samp, inv, mode[ir->data.mode],
+ stream[ir->data.stream],
+ interp[ir->data.interpolation]);
print_type(f, ir->type);
fprintf(f, " %s)", unique_name(ir));
@@ -560,13 +563,18 @@ ir_print_visitor::visit(ir_loop_jump *ir)
}
void
-ir_print_visitor::visit(ir_emit_vertex *)
+ir_print_visitor::visit(ir_emit_vertex *ir)
{
- fprintf(f, "(emit-vertex)");
+ fprintf(f, "(emit-vertex ");
+ ir->stream->accept(this);
+ fprintf(f, ")\n");
}
void
-ir_print_visitor::visit(ir_end_primitive *)
+ir_print_visitor::visit(ir_end_primitive *ir)
{
- fprintf(f, "(end-primitive)");
+ fprintf(f, "(end-primitive ");
+ ir->stream->accept(this);
+ fprintf(f, ")\n");
+
}
diff --git a/mesalib/src/glsl/ir_reader.cpp b/mesalib/src/glsl/ir_reader.cpp
index 28923f3b8..a178c82b5 100644
--- a/mesalib/src/glsl/ir_reader.cpp
+++ b/mesalib/src/glsl/ir_reader.cpp
@@ -437,6 +437,12 @@ ir_reader::read_declaration(s_expression *expr)
var->data.mode = ir_var_function_inout;
} else if (strcmp(qualifier->value(), "temporary") == 0) {
var->data.mode = ir_var_temporary;
+ } else if (strcmp(qualifier->value(), "stream1") == 0) {
+ var->data.stream = 1;
+ } else if (strcmp(qualifier->value(), "stream2") == 0) {
+ var->data.stream = 2;
+ } else if (strcmp(qualifier->value(), "stream3") == 0) {
+ var->data.stream = 3;
} else if (strcmp(qualifier->value(), "smooth") == 0) {
var->data.interpolation = INTERP_QUALIFIER_SMOOTH;
} else if (strcmp(qualifier->value(), "flat") == 0) {
@@ -1109,10 +1115,17 @@ ir_reader::read_texture(s_expression *expr)
ir_emit_vertex *
ir_reader::read_emit_vertex(s_expression *expr)
{
- s_pattern pat[] = { "emit-vertex" };
+ s_expression *s_stream = NULL;
+
+ s_pattern pat[] = { "emit-vertex", s_stream };
if (MATCH(expr, pat)) {
- return new(mem_ctx) ir_emit_vertex();
+ ir_rvalue *stream = read_dereference(s_stream);
+ if (stream == NULL) {
+ ir_read_error(NULL, "when reading stream info in emit-vertex");
+ return NULL;
+ }
+ return new(mem_ctx) ir_emit_vertex(stream);
}
ir_read_error(NULL, "when reading emit-vertex");
return NULL;
@@ -1121,10 +1134,17 @@ ir_reader::read_emit_vertex(s_expression *expr)
ir_end_primitive *
ir_reader::read_end_primitive(s_expression *expr)
{
- s_pattern pat[] = { "end-primitive" };
+ s_expression *s_stream = NULL;
+
+ s_pattern pat[] = { "end-primitive", s_stream };
if (MATCH(expr, pat)) {
- return new(mem_ctx) ir_end_primitive();
+ ir_rvalue *stream = read_dereference(s_stream);
+ if (stream == NULL) {
+ ir_read_error(NULL, "when reading stream info in end-primitive");
+ return NULL;
+ }
+ return new(mem_ctx) ir_end_primitive(stream);
}
ir_read_error(NULL, "when reading end-primitive");
return NULL;
diff --git a/mesalib/src/glsl/ir_rvalue_visitor.cpp b/mesalib/src/glsl/ir_rvalue_visitor.cpp
index fcbe9448d..0370170b3 100644
--- a/mesalib/src/glsl/ir_rvalue_visitor.cpp
+++ b/mesalib/src/glsl/ir_rvalue_visitor.cpp
@@ -149,6 +149,19 @@ ir_rvalue_base_visitor::rvalue_visit(ir_if *ir)
return visit_continue;
}
+ir_visitor_status
+ir_rvalue_base_visitor::rvalue_visit(ir_emit_vertex *ir)
+{
+ handle_rvalue(&ir->stream);
+ return visit_continue;
+}
+
+ir_visitor_status
+ir_rvalue_base_visitor::rvalue_visit(ir_end_primitive *ir)
+{
+ handle_rvalue(&ir->stream);
+ return visit_continue;
+}
ir_visitor_status
ir_rvalue_visitor::visit_leave(ir_expression *ir)
@@ -205,6 +218,18 @@ ir_rvalue_visitor::visit_leave(ir_if *ir)
}
ir_visitor_status
+ir_rvalue_visitor::visit_leave(ir_emit_vertex *ir)
+{
+ return rvalue_visit(ir);
+}
+
+ir_visitor_status
+ir_rvalue_visitor::visit_leave(ir_end_primitive *ir)
+{
+ return rvalue_visit(ir);
+}
+
+ir_visitor_status
ir_rvalue_enter_visitor::visit_enter(ir_expression *ir)
{
return rvalue_visit(ir);
@@ -257,3 +282,15 @@ ir_rvalue_enter_visitor::visit_enter(ir_if *ir)
{
return rvalue_visit(ir);
}
+
+ir_visitor_status
+ir_rvalue_enter_visitor::visit_enter(ir_emit_vertex *ir)
+{
+ return rvalue_visit(ir);
+}
+
+ir_visitor_status
+ir_rvalue_enter_visitor::visit_enter(ir_end_primitive *ir)
+{
+ return rvalue_visit(ir);
+}
diff --git a/mesalib/src/glsl/ir_rvalue_visitor.h b/mesalib/src/glsl/ir_rvalue_visitor.h
index 2179fa5a8..04ec0fa39 100644
--- a/mesalib/src/glsl/ir_rvalue_visitor.h
+++ b/mesalib/src/glsl/ir_rvalue_visitor.h
@@ -41,6 +41,8 @@ public:
ir_visitor_status rvalue_visit(ir_return *);
ir_visitor_status rvalue_visit(ir_swizzle *);
ir_visitor_status rvalue_visit(ir_texture *);
+ ir_visitor_status rvalue_visit(ir_emit_vertex *);
+ ir_visitor_status rvalue_visit(ir_end_primitive *);
virtual void handle_rvalue(ir_rvalue **rvalue) = 0;
};
@@ -57,6 +59,8 @@ public:
virtual ir_visitor_status visit_leave(ir_return *);
virtual ir_visitor_status visit_leave(ir_swizzle *);
virtual ir_visitor_status visit_leave(ir_texture *);
+ virtual ir_visitor_status visit_leave(ir_emit_vertex *);
+ virtual ir_visitor_status visit_leave(ir_end_primitive *);
};
class ir_rvalue_enter_visitor : public ir_rvalue_base_visitor {
@@ -71,4 +75,6 @@ public:
virtual ir_visitor_status visit_enter(ir_return *);
virtual ir_visitor_status visit_enter(ir_swizzle *);
virtual ir_visitor_status visit_enter(ir_texture *);
+ virtual ir_visitor_status visit_enter(ir_emit_vertex *);
+ virtual ir_visitor_status visit_enter(ir_end_primitive *);
};
diff --git a/mesalib/src/glsl/link_atomics.cpp b/mesalib/src/glsl/link_atomics.cpp
index d92cdb117..fbe4e7364 100644
--- a/mesalib/src/glsl/link_atomics.cpp
+++ b/mesalib/src/glsl/link_atomics.cpp
@@ -54,9 +54,18 @@ namespace {
void push_back(unsigned id, ir_variable *var)
{
- counters = (active_atomic_counter *)
- realloc(counters, sizeof(active_atomic_counter) * (num_counters + 1));
+ active_atomic_counter *new_counters;
+ new_counters = (active_atomic_counter *)
+ realloc(counters, sizeof(active_atomic_counter) *
+ (num_counters + 1));
+
+ if (new_counters == NULL) {
+ _mesa_error_no_memory(__func__);
+ return;
+ }
+
+ counters = new_counters;
counters[num_counters].id = id;
counters[num_counters].var = var;
num_counters++;
diff --git a/mesalib/src/glsl/link_uniform_blocks.cpp b/mesalib/src/glsl/link_uniform_blocks.cpp
index 1a0e64318..53a18c934 100644
--- a/mesalib/src/glsl/link_uniform_blocks.cpp
+++ b/mesalib/src/glsl/link_uniform_blocks.cpp
@@ -170,6 +170,12 @@ link_uniform_blocks(void *mem_ctx,
struct hash_table *block_hash =
_mesa_hash_table_create(mem_ctx, _mesa_key_string_equal);
+ if (block_hash == NULL) {
+ _mesa_error_no_memory(__func__);
+ linker_error(prog, "out of memory\n");
+ return 0;
+ }
+
/* Determine which uniform blocks are active.
*/
link_uniform_block_active_visitor v(mem_ctx, block_hash, prog);
diff --git a/mesalib/src/glsl/link_varyings.cpp b/mesalib/src/glsl/link_varyings.cpp
index 686329857..520a51a27 100644
--- a/mesalib/src/glsl/link_varyings.cpp
+++ b/mesalib/src/glsl/link_varyings.cpp
@@ -291,6 +291,7 @@ tfeedback_decl::init(struct gl_context *ctx, const void *mem_ctx,
this->skip_components = 0;
this->next_buffer_separator = false;
this->matched_candidate = NULL;
+ this->stream_id = 0;
if (ctx->Extensions.ARB_transform_feedback3) {
/* Parse gl_NextBuffer. */
@@ -355,8 +356,8 @@ tfeedback_decl::is_same(const tfeedback_decl &x, const tfeedback_decl &y)
/**
- * Assign a location for this tfeedback_decl object based on the transform
- * feedback candidate found by find_candidate.
+ * Assign a location and stream ID for this tfeedback_decl object based on the
+ * transform feedback candidate found by find_candidate.
*
* If an error occurs, the error is reported through linker_error() and false
* is returned.
@@ -437,6 +438,11 @@ tfeedback_decl::assign_location(struct gl_context *ctx,
return false;
}
+ /* Only transform feedback varyings can be assigned to non-zero streams,
+ * so assign the stream id here.
+ */
+ this->stream_id = this->matched_candidate->toplevel_var->data.stream;
+
return true;
}
@@ -495,6 +501,7 @@ tfeedback_decl::store(struct gl_context *ctx, struct gl_shader_program *prog,
info->Outputs[info->NumOutputs].ComponentOffset = location_frac;
info->Outputs[info->NumOutputs].OutputRegister = location;
info->Outputs[info->NumOutputs].NumComponents = output_size;
+ info->Outputs[info->NumOutputs].StreamId = stream_id;
info->Outputs[info->NumOutputs].OutputBuffer = buffer;
info->Outputs[info->NumOutputs].DstOffset = info->BufferStride[buffer];
++info->NumOutputs;
@@ -628,10 +635,27 @@ store_tfeedback_info(struct gl_context *ctx, struct gl_shader_program *prog,
}
else {
/* GL_INVERLEAVED_ATTRIBS */
+ int buffer_stream_id = -1;
for (unsigned i = 0; i < num_tfeedback_decls; ++i) {
if (tfeedback_decls[i].is_next_buffer_separator()) {
num_buffers++;
+ buffer_stream_id = -1;
continue;
+ } else if (buffer_stream_id == -1) {
+ /* First varying writing to this buffer: remember its stream */
+ buffer_stream_id = (int) tfeedback_decls[i].get_stream_id();
+ } else if (buffer_stream_id !=
+ (int) tfeedback_decls[i].get_stream_id()) {
+ /* Varying writes to the same buffer from a different stream */
+ linker_error(prog,
+ "Transform feedback can't capture varyings belonging "
+ "to different vertex streams in a single buffer. "
+ "Varying %s writes to buffer from stream %u, other "
+ "varyings in the same buffer write from stream %u.",
+ tfeedback_decls[i].name(),
+ tfeedback_decls[i].get_stream_id(),
+ buffer_stream_id);
+ return false;
}
if (!tfeedback_decls[i].store(ctx, prog,
@@ -1323,6 +1347,11 @@ assign_varying_locations(struct gl_context *ctx,
(output_var->data.mode != ir_var_shader_out))
continue;
+ /* Only geometry shaders can use non-zero streams */
+ assert(output_var->data.stream == 0 ||
+ (output_var->data.stream < MAX_VERTEX_STREAMS &&
+ producer->Stage == MESA_SHADER_GEOMETRY));
+
tfeedback_candidate_generator g(mem_ctx, tfeedback_candidates);
g.process(output_var);
@@ -1338,6 +1367,14 @@ assign_varying_locations(struct gl_context *ctx,
if (input_var || (prog->SeparateShader && consumer == NULL)) {
matches.record(output_var, input_var);
}
+
+ /* Only stream 0 outputs can be consumed in the next stage */
+ if (input_var && output_var->data.stream != 0) {
+ linker_error(prog, "output %s is assigned to stream=%d but "
+ "is linked to an input, which requires stream=0",
+ output_var->name, output_var->data.stream);
+ return false;
+ }
}
} else {
/* If there's no producer stage, then this must be a separable program.
diff --git a/mesalib/src/glsl/link_varyings.h b/mesalib/src/glsl/link_varyings.h
index 6fa268176..afc16a8ba 100644
--- a/mesalib/src/glsl/link_varyings.h
+++ b/mesalib/src/glsl/link_varyings.h
@@ -112,6 +112,16 @@ public:
return !this->next_buffer_separator && !this->skip_components;
}
+ const char *name() const
+ {
+ return this->orig_name;
+ }
+
+ unsigned get_stream_id() const
+ {
+ return this->stream_id;
+ }
+
/**
* The total number of varying components taken up by this variable. Only
* valid if assign_location() has been called.
@@ -210,6 +220,13 @@ private:
* data structure that was found. Otherwise NULL.
*/
const tfeedback_candidate *matched_candidate;
+
+ /**
+ * StreamId assigned to this varying (defaults to 0). Can only be set to
+ * values other than 0 in geometry shaders that use the stream layout
+ * modifier. Accepted values must be in the range [0, MAX_VERTEX_STREAMS-1].
+ */
+ unsigned stream_id;
};
diff --git a/mesalib/src/glsl/linker.cpp b/mesalib/src/glsl/linker.cpp
index 0b6a71679..3036ebcb3 100644
--- a/mesalib/src/glsl/linker.cpp
+++ b/mesalib/src/glsl/linker.cpp
@@ -250,31 +250,100 @@ public:
}
};
-
/**
- * Visitor that determines whether or not a shader uses ir_end_primitive.
+ * Visitor that determines the highest stream id to which a (geometry) shader
+ * emits vertices. It also checks whether End{Stream}Primitive is ever called.
*/
-class find_end_primitive_visitor : public ir_hierarchical_visitor {
+class find_emit_vertex_visitor : public ir_hierarchical_visitor {
public:
- find_end_primitive_visitor()
- : found(false)
+ find_emit_vertex_visitor(int max_allowed)
+ : max_stream_allowed(max_allowed),
+ invalid_stream_id(0),
+ invalid_stream_id_from_emit_vertex(false),
+ end_primitive_found(false),
+ uses_non_zero_stream(false)
{
/* empty */
}
- virtual ir_visitor_status visit(ir_end_primitive *)
+ virtual ir_visitor_status visit_leave(ir_emit_vertex *ir)
{
- found = true;
- return visit_stop;
+ int stream_id = ir->stream_id();
+
+ if (stream_id < 0) {
+ invalid_stream_id = stream_id;
+ invalid_stream_id_from_emit_vertex = true;
+ return visit_stop;
+ }
+
+ if (stream_id > max_stream_allowed) {
+ invalid_stream_id = stream_id;
+ invalid_stream_id_from_emit_vertex = true;
+ return visit_stop;
+ }
+
+ if (stream_id != 0)
+ uses_non_zero_stream = true;
+
+ return visit_continue;
}
- bool end_primitive_found()
+ virtual ir_visitor_status visit_leave(ir_end_primitive *ir)
{
- return found;
+ end_primitive_found = true;
+
+ int stream_id = ir->stream_id();
+
+ if (stream_id < 0) {
+ invalid_stream_id = stream_id;
+ invalid_stream_id_from_emit_vertex = false;
+ return visit_stop;
+ }
+
+ if (stream_id > max_stream_allowed) {
+ invalid_stream_id = stream_id;
+ invalid_stream_id_from_emit_vertex = false;
+ return visit_stop;
+ }
+
+ if (stream_id != 0)
+ uses_non_zero_stream = true;
+
+ return visit_continue;
+ }
+
+ bool error()
+ {
+ return invalid_stream_id != 0;
+ }
+
+ const char *error_func()
+ {
+ return invalid_stream_id_from_emit_vertex ?
+ "EmitStreamVertex" : "EndStreamPrimitive";
+ }
+
+ int error_stream()
+ {
+ return invalid_stream_id;
+ }
+
+ bool uses_streams()
+ {
+ return uses_non_zero_stream;
+ }
+
+ bool uses_end_primitive()
+ {
+ return end_primitive_found;
}
private:
- bool found;
+ int max_stream_allowed;
+ int invalid_stream_id;
+ bool invalid_stream_id_from_emit_vertex;
+ bool end_primitive_found;
+ bool uses_non_zero_stream;
};
} /* anonymous namespace */
@@ -551,10 +620,58 @@ validate_geometry_shader_executable(struct gl_shader_program *prog,
analyze_clip_usage(prog, shader, &prog->Geom.UsesClipDistance,
&prog->Geom.ClipDistanceArraySize);
+}
+
+/**
+ * Check if geometry shaders emit to non-zero streams and do corresponding
+ * validations.
+ */
+static void
+validate_geometry_shader_emissions(struct gl_context *ctx,
+ struct gl_shader_program *prog)
+{
+ if (prog->_LinkedShaders[MESA_SHADER_GEOMETRY] != NULL) {
+ find_emit_vertex_visitor emit_vertex(ctx->Const.MaxVertexStreams - 1);
+ emit_vertex.run(prog->_LinkedShaders[MESA_SHADER_GEOMETRY]->ir);
+ if (emit_vertex.error()) {
+ linker_error(prog, "Invalid call %s(%d). Accepted values for the "
+ "stream parameter are in the range [0, %d].",
+ emit_vertex.error_func(),
+ emit_vertex.error_stream(),
+ ctx->Const.MaxVertexStreams - 1);
+ }
+ prog->Geom.UsesStreams = emit_vertex.uses_streams();
+ prog->Geom.UsesEndPrimitive = emit_vertex.uses_end_primitive();
- find_end_primitive_visitor end_primitive;
- end_primitive.run(shader->ir);
- prog->Geom.UsesEndPrimitive = end_primitive.end_primitive_found();
+ /* From the ARB_gpu_shader5 spec:
+ *
+ * "Multiple vertex streams are supported only if the output primitive
+ * type is declared to be "points". A program will fail to link if it
+ * contains a geometry shader calling EmitStreamVertex() or
+ * EndStreamPrimitive() if its output primitive type is not "points".
+ *
+ * However, in the same spec:
+ *
+ * "The function EmitVertex() is equivalent to calling EmitStreamVertex()
+ * with <stream> set to zero."
+ *
+ * And:
+ *
+ * "The function EndPrimitive() is equivalent to calling
+ * EndStreamPrimitive() with <stream> set to zero."
+ *
+ * Since we can call EmitVertex() and EndPrimitive() when we output
+ * primitives other than points, calling EmitStreamVertex(0) or
+ * EmitEndPrimitive(0) should not produce errors. This it also what Nvidia
+ * does. Currently we only set prog->Geom.UsesStreams to TRUE when
+ * EmitStreamVertex() or EmitEndPrimitive() are called with a non-zero
+ * stream.
+ */
+ if (prog->Geom.UsesStreams && prog->Geom.OutputType != GL_POINTS) {
+ linker_error(prog, "EmitStreamVertex(n) and EndStreamPrimitive(n) "
+ "with n>0 requires point output");
+ }
+ }
}
@@ -1479,6 +1596,8 @@ link_intrastage_shaders(void *mem_ctx,
const unsigned num_uniform_blocks =
link_uniform_blocks(mem_ctx, prog, shader_list, num_shaders,
&uniform_blocks);
+ if (!prog->LinkStatus)
+ return NULL;
/* Check that there is only a single definition of each function signature
* across all shaders.
@@ -2556,6 +2675,9 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
;
}
+ /* Check and validate stream emissions in geometry shaders */
+ validate_geometry_shader_emissions(ctx, prog);
+
/* Mark all generic shader inputs and outputs as unpaired. */
for (unsigned i = MESA_SHADER_VERTEX; i <= MESA_SHADER_FRAGMENT; i++) {
if (prog->_LinkedShaders[i] != NULL) {
diff --git a/mesalib/src/glsl/lower_output_reads.cpp b/mesalib/src/glsl/lower_output_reads.cpp
index afe17766b..1ee815d5e 100644
--- a/mesalib/src/glsl/lower_output_reads.cpp
+++ b/mesalib/src/glsl/lower_output_reads.cpp
@@ -52,7 +52,7 @@ public:
output_read_remover();
~output_read_remover();
virtual ir_visitor_status visit(class ir_dereference_variable *);
- virtual ir_visitor_status visit(class ir_emit_vertex *);
+ virtual ir_visitor_status visit_leave(class ir_emit_vertex *);
virtual ir_visitor_status visit_leave(class ir_return *);
virtual ir_visitor_status visit_leave(class ir_function_signature *);
};
@@ -148,7 +148,7 @@ output_read_remover::visit_leave(ir_return *ir)
}
ir_visitor_status
-output_read_remover::visit(ir_emit_vertex *ir)
+output_read_remover::visit_leave(ir_emit_vertex *ir)
{
hash_table_call_foreach(replacements, emit_return_copy, ir);
hash_table_clear(replacements);
diff --git a/mesalib/src/glsl/lower_packed_varyings.cpp b/mesalib/src/glsl/lower_packed_varyings.cpp
index e8654748f..eda56a97b 100644
--- a/mesalib/src/glsl/lower_packed_varyings.cpp
+++ b/mesalib/src/glsl/lower_packed_varyings.cpp
@@ -613,7 +613,7 @@ public:
explicit lower_packed_varyings_gs_splicer(void *mem_ctx,
const exec_list *instructions);
- virtual ir_visitor_status visit(ir_emit_vertex *ev);
+ virtual ir_visitor_status visit_leave(ir_emit_vertex *ev);
private:
/**
@@ -637,7 +637,7 @@ lower_packed_varyings_gs_splicer::lower_packed_varyings_gs_splicer(
ir_visitor_status
-lower_packed_varyings_gs_splicer::visit(ir_emit_vertex *ev)
+lower_packed_varyings_gs_splicer::visit_leave(ir_emit_vertex *ev)
{
foreach_list(node, this->instructions) {
ir_instruction *ir = (ir_instruction *) node;
diff --git a/mesalib/src/glsl/opt_dead_code_local.cpp b/mesalib/src/glsl/opt_dead_code_local.cpp
index c27c526f9..88895fb0e 100644
--- a/mesalib/src/glsl/opt_dead_code_local.cpp
+++ b/mesalib/src/glsl/opt_dead_code_local.cpp
@@ -114,7 +114,7 @@ public:
return visit_continue_with_parent;
}
- virtual ir_visitor_status visit(ir_emit_vertex *)
+ virtual ir_visitor_status visit_leave(ir_emit_vertex *)
{
/* For the purpose of dead code elimination, emitting a vertex counts as
* "reading" all of the currently assigned output variables.
diff --git a/mesalib/src/loader/Makefile.am b/mesalib/src/loader/Makefile.am
index bddf7ac35..ae8a84492 100644
--- a/mesalib/src/loader/Makefile.am
+++ b/mesalib/src/loader/Makefile.am
@@ -29,6 +29,25 @@ libloader_la_CPPFLAGS = \
$(VISIBILITY_CFLAGS) \
$(LIBUDEV_CFLAGS)
+libloader_la_SOURCES = $(LOADER_C_FILES)
+libloader_la_LIBADD =
+
+if NEED_OPENGL_COMMON
+libloader_la_CPPFLAGS += \
+ -I$(top_srcdir)/src/mesa/drivers/dri/common/ \
+ -I$(top_builddir)/src/mesa/drivers/dri/common/ \
+ -I$(top_srcdir)/src/mesa/ \
+ -I$(top_srcdir)/src/mapi/ \
+ -DUSE_DRICONF
+
+libloader_la_SOURCES += \
+ $(top_srcdir)/src/mesa/drivers/dri/common/xmlconfig.c
+
+libloader_la_LIBADD += \
+ -lm \
+ $(EXPAT_LIBS)
+endif
+
if !HAVE_LIBDRM
libloader_la_CPPFLAGS += \
-D__NOT_HAVE_DRM_H
@@ -36,8 +55,6 @@ else
libloader_la_CPPFLAGS += \
$(LIBDRM_CFLAGS)
-libloader_la_LIBADD = \
+libloader_la_LIBADD += \
$(LIBDRM_LIBS)
endif
-
-libloader_la_SOURCES = $(LOADER_C_FILES)
diff --git a/mesalib/src/loader/loader.c b/mesalib/src/loader/loader.c
index 0f262653b..47e1f5874 100644
--- a/mesalib/src/loader/loader.c
+++ b/mesalib/src/loader/loader.c
@@ -70,6 +70,14 @@
#ifdef HAVE_LIBUDEV
#include <assert.h>
#include <dlfcn.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+#ifdef USE_DRICONF
+#include "xmlconfig.h"
+#include "xmlpool.h"
+#endif
#endif
#ifdef HAVE_SYSFS
#include <sys/stat.h>
@@ -214,6 +222,210 @@ out:
return (*chip_id >= 0);
}
+
+static char *
+get_render_node_from_id_path_tag(struct udev *udev,
+ char *id_path_tag,
+ char another_tag)
+{
+ struct udev_device *device;
+ struct udev_enumerate *e;
+ struct udev_list_entry *entry;
+ const char *path, *id_path_tag_tmp;
+ char *path_res;
+ char found = 0;
+ UDEV_SYMBOL(struct udev_enumerate *, udev_enumerate_new,
+ (struct udev *));
+ UDEV_SYMBOL(int, udev_enumerate_add_match_subsystem,
+ (struct udev_enumerate *, const char *));
+ UDEV_SYMBOL(int, udev_enumerate_add_match_sysname,
+ (struct udev_enumerate *, const char *));
+ UDEV_SYMBOL(int, udev_enumerate_scan_devices,
+ (struct udev_enumerate *));
+ UDEV_SYMBOL(struct udev_list_entry *, udev_enumerate_get_list_entry,
+ (struct udev_enumerate *));
+ UDEV_SYMBOL(struct udev_list_entry *, udev_list_entry_get_next,
+ (struct udev_list_entry *));
+ UDEV_SYMBOL(const char *, udev_list_entry_get_name,
+ (struct udev_list_entry *));
+ UDEV_SYMBOL(struct udev_device *, udev_device_new_from_syspath,
+ (struct udev *, const char *));
+ UDEV_SYMBOL(const char *, udev_device_get_property_value,
+ (struct udev_device *, const char *));
+ UDEV_SYMBOL(const char *, udev_device_get_devnode,
+ (struct udev_device *));
+ UDEV_SYMBOL(struct udev_device *, udev_device_unref,
+ (struct udev_device *));
+
+ e = udev_enumerate_new(udev);
+ udev_enumerate_add_match_subsystem(e, "drm");
+ udev_enumerate_add_match_sysname(e, "render*");
+
+ udev_enumerate_scan_devices(e);
+ udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) {
+ path = udev_list_entry_get_name(entry);
+ device = udev_device_new_from_syspath(udev, path);
+ if (!device)
+ continue;
+ id_path_tag_tmp = udev_device_get_property_value(device, "ID_PATH_TAG");
+ if (id_path_tag_tmp) {
+ if ((!another_tag && !strcmp(id_path_tag, id_path_tag_tmp)) ||
+ (another_tag && strcmp(id_path_tag, id_path_tag_tmp))) {
+ found = 1;
+ break;
+ }
+ }
+ udev_device_unref(device);
+ }
+
+ if (found) {
+ path_res = strdup(udev_device_get_devnode(device));
+ udev_device_unref(device);
+ return path_res;
+ }
+ return NULL;
+}
+
+static char *
+get_id_path_tag_from_fd(struct udev *udev, int fd)
+{
+ struct udev_device *device;
+ const char *id_path_tag_tmp;
+ char *id_path_tag;
+ UDEV_SYMBOL(const char *, udev_device_get_property_value,
+ (struct udev_device *, const char *));
+ UDEV_SYMBOL(struct udev_device *, udev_device_unref,
+ (struct udev_device *));
+
+ device = udev_device_new_from_fd(udev, fd);
+ if (!device)
+ return NULL;
+
+ id_path_tag_tmp = udev_device_get_property_value(device, "ID_PATH_TAG");
+ if (!id_path_tag_tmp)
+ return NULL;
+
+ id_path_tag = strdup(id_path_tag_tmp);
+
+ udev_device_unref(device);
+ return id_path_tag;
+}
+
+static int
+drm_open_device(const char *device_name)
+{
+ int fd;
+#ifdef O_CLOEXEC
+ fd = open(device_name, O_RDWR | O_CLOEXEC);
+ if (fd == -1 && errno == EINVAL)
+#endif
+ {
+ fd = open(device_name, O_RDWR);
+ if (fd != -1)
+ fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
+ }
+ return fd;
+}
+
+#ifdef USE_DRICONF
+const char __driConfigOptionsLoader[] =
+DRI_CONF_BEGIN
+ DRI_CONF_SECTION_INITIALIZATION
+ DRI_CONF_DEVICE_ID_PATH_TAG()
+ DRI_CONF_SECTION_END
+DRI_CONF_END;
+#endif
+
+int loader_get_user_preferred_fd(int default_fd, int *different_device)
+{
+ struct udev *udev;
+#ifdef USE_DRICONF
+ driOptionCache defaultInitOptions;
+ driOptionCache userInitOptions;
+#endif
+ const char *dri_prime = getenv("DRI_PRIME");
+ char *prime = NULL;
+ int is_different_device = 0, fd = default_fd;
+ char *default_device_id_path_tag;
+ char *device_name = NULL;
+ char another_tag = 0;
+ UDEV_SYMBOL(struct udev *, udev_new, (void));
+ UDEV_SYMBOL(struct udev *, udev_unref, (struct udev *));
+
+ if (dri_prime)
+ prime = strdup(dri_prime);
+#ifdef USE_DRICONF
+ else {
+ driParseOptionInfo(&defaultInitOptions, __driConfigOptionsLoader);
+ driParseConfigFiles(&userInitOptions, &defaultInitOptions, 0, "loader");
+ if (driCheckOption(&userInitOptions, "device_id", DRI_STRING))
+ prime = strdup(driQueryOptionstr(&userInitOptions, "device_id"));
+ driDestroyOptionCache(&userInitOptions);
+ driDestroyOptionInfo(&defaultInitOptions);
+ }
+#endif
+
+ if (prime == NULL) {
+ *different_device = 0;
+ return default_fd;
+ }
+
+ udev = udev_new();
+ if (!udev)
+ goto prime_clean;
+
+ default_device_id_path_tag = get_id_path_tag_from_fd(udev, default_fd);
+ if (!default_device_id_path_tag)
+ goto udev_clean;
+
+ is_different_device = 1;
+ /* two format are supported:
+ * "1": choose any other card than the card used by default.
+ * id_path_tag: (for example "pci-0000_02_00_0") choose the card
+ * with this id_path_tag.
+ */
+ if (!strcmp(prime,"1")) {
+ free(prime);
+ prime = strdup(default_device_id_path_tag);
+ /* request a card with a different card than the default card */
+ another_tag = 1;
+ } else if (!strcmp(default_device_id_path_tag, prime))
+ /* we are to get a new fd (render-node) of the same device */
+ is_different_device = 0;
+
+ device_name = get_render_node_from_id_path_tag(udev,
+ prime,
+ another_tag);
+ if (device_name == NULL) {
+ is_different_device = 0;
+ goto default_device_clean;
+ }
+
+ fd = drm_open_device(device_name);
+ if (fd > 0) {
+ close(default_fd);
+ } else {
+ fd = default_fd;
+ is_different_device = 0;
+ }
+ free(device_name);
+
+ default_device_clean:
+ free(default_device_id_path_tag);
+ udev_clean:
+ udev_unref(udev);
+ prime_clean:
+ free(prime);
+
+ *different_device = is_different_device;
+ return fd;
+}
+#else
+int loader_get_user_preferred_fd(int default_fd, int *different_device)
+{
+ *different_device = 0;
+ return default_fd;
+}
#endif
#if defined(HAVE_SYSFS)
diff --git a/mesalib/src/loader/loader.h b/mesalib/src/loader/loader.h
index dfd77baad..fa57950de 100644
--- a/mesalib/src/loader/loader.h
+++ b/mesalib/src/loader/loader.h
@@ -41,6 +41,13 @@ loader_get_driver_for_fd(int fd, unsigned driver_types);
char *
loader_get_device_name_for_fd(int fd);
+/* Function to get a different device than the one we are to use by default,
+ * if the user requests so and it is possible. The initial fd will be closed
+ * if neccessary. The returned fd is potentially a render-node.
+ */
+
+int
+loader_get_user_preferred_fd(int default_fd, int *different_device);
/* for logging.. keep this aligned with egllog.h so we can just use
* _eglLog directly.
diff --git a/mesalib/src/mapi/glapi/gen/gl_API.xml b/mesalib/src/mapi/glapi/gen/gl_API.xml
index 0a486f070..882e66e0b 100644
--- a/mesalib/src/mapi/glapi/gen/gl_API.xml
+++ b/mesalib/src/mapi/glapi/gen/gl_API.xml
@@ -12157,22 +12157,22 @@
<size name="GetTexEnviv" mode="get"/>
<size name="GetTexEnvfv" mode="get"/>
</enum>
- <function name="TexBumpParameterfvATI" offset="assign" deprecated="3.1">
+ <function name="TexBumpParameterfvATI" offset="assign" deprecated="3.1" exec="skip">
<param name="pname" type="GLenum"/>
<param name="param" type="const GLfloat *" variable_param="pname"/>
<glx ignore="true"/>
</function>
- <function name="TexBumpParameterivATI" offset="assign" deprecated="3.1">
+ <function name="TexBumpParameterivATI" offset="assign" deprecated="3.1" exec="skip">
<param name="pname" type="GLenum"/>
<param name="param" type="const GLint *" variable_param="pname"/>
<glx ignore="true"/>
</function>
- <function name="GetTexBumpParameterfvATI" offset="assign" deprecated="3.1">
+ <function name="GetTexBumpParameterfvATI" offset="assign" deprecated="3.1" exec="skip">
<param name="pname" type="GLenum"/>
<param name="param" type="GLfloat *" variable_param="pname"/>
<glx ignore="true"/>
</function>
- <function name="GetTexBumpParameterivATI" offset="assign" deprecated="3.1">
+ <function name="GetTexBumpParameterivATI" offset="assign" deprecated="3.1" exec="skip">
<param name="pname" type="GLenum"/>
<param name="param" type="GLint *" variable_param="pname"/>
<glx ignore="true"/>
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index 1a2e45320..f313f5645 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -1515,23 +1515,15 @@ static void
meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
{
const char *vs_source =
+ "#extension GL_AMD_vertex_shader_layer : enable\n"
"attribute vec4 position;\n"
- "void main()\n"
- "{\n"
- " gl_Position = position;\n"
- "}\n";
- const char *gs_source =
- "#version 150\n"
- "layout(triangles) in;\n"
- "layout(triangle_strip, max_vertices = 4) out;\n"
"uniform int layer;\n"
"void main()\n"
"{\n"
- " for (int i = 0; i < 3; i++) {\n"
- " gl_Layer = layer;\n"
- " gl_Position = gl_in[i].gl_Position;\n"
- " EmitVertex();\n"
- " }\n"
+ "#ifdef GL_AMD_vertex_shader_layer\n"
+ " gl_Layer = layer;\n"
+ "#endif\n"
+ " gl_Position = position;\n"
"}\n";
const char *fs_source =
"uniform vec4 color;\n"
@@ -1539,7 +1531,7 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
"{\n"
" gl_FragColor = color;\n"
"}\n";
- GLuint vs, gs = 0, fs;
+ GLuint vs, fs;
bool has_integer_textures;
_mesa_meta_setup_vertex_objects(&clear->VAO, &clear->VBO, true, 3, 0, 0);
@@ -1551,12 +1543,6 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
_mesa_ShaderSource(vs, 1, &vs_source, NULL);
_mesa_CompileShader(vs);
- if (_mesa_has_geometry_shaders(ctx)) {
- gs = _mesa_CreateShader(GL_GEOMETRY_SHADER);
- _mesa_ShaderSource(gs, 1, &gs_source, NULL);
- _mesa_CompileShader(gs);
- }
-
fs = _mesa_CreateShader(GL_FRAGMENT_SHADER);
_mesa_ShaderSource(fs, 1, &fs_source, NULL);
_mesa_CompileShader(fs);
@@ -1564,20 +1550,14 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
clear->ShaderProg = _mesa_CreateProgram();
_mesa_AttachShader(clear->ShaderProg, fs);
_mesa_DeleteShader(fs);
- if (gs != 0)
- _mesa_AttachShader(clear->ShaderProg, gs);
_mesa_AttachShader(clear->ShaderProg, vs);
_mesa_DeleteShader(vs);
_mesa_BindAttribLocation(clear->ShaderProg, 0, "position");
_mesa_ObjectLabel(GL_PROGRAM, clear->ShaderProg, -1, "meta clear");
_mesa_LinkProgram(clear->ShaderProg);
- clear->ColorLocation = _mesa_GetUniformLocation(clear->ShaderProg,
- "color");
- if (gs != 0) {
- clear->LayerLocation = _mesa_GetUniformLocation(clear->ShaderProg,
- "layer");
- }
+ clear->ColorLocation = _mesa_GetUniformLocation(clear->ShaderProg, "color");
+ clear->LayerLocation = _mesa_GetUniformLocation(clear->ShaderProg, "layer");
has_integer_textures = _mesa_is_gles3(ctx) ||
(_mesa_is_desktop_gl(ctx) && ctx->Const.GLSLVersion >= 130);
@@ -1587,9 +1567,14 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
const char *vs_int_source =
ralloc_asprintf(shader_source_mem_ctx,
"#version 130\n"
+ "#extension GL_AMD_vertex_shader_layer : enable\n"
"in vec4 position;\n"
+ "uniform int layer;\n"
"void main()\n"
"{\n"
+ "#ifdef GL_AMD_vertex_shader_layer\n"
+ " gl_Layer = layer;\n"
+ "#endif\n"
" gl_Position = position;\n"
"}\n");
const char *fs_int_source =
@@ -1612,8 +1597,6 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
clear->IntegerShaderProg = _mesa_CreateProgram();
_mesa_AttachShader(clear->IntegerShaderProg, fs);
_mesa_DeleteShader(fs);
- if (gs != 0)
- _mesa_AttachShader(clear->IntegerShaderProg, gs);
_mesa_AttachShader(clear->IntegerShaderProg, vs);
_mesa_DeleteShader(vs);
_mesa_BindAttribLocation(clear->IntegerShaderProg, 0, "position");
@@ -1629,13 +1612,9 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear)
clear->IntegerColorLocation =
_mesa_GetUniformLocation(clear->IntegerShaderProg, "color");
- if (gs != 0) {
- clear->IntegerLayerLocation =
- _mesa_GetUniformLocation(clear->IntegerShaderProg, "layer");
- }
+ clear->IntegerLayerLocation =
+ _mesa_GetUniformLocation(clear->IntegerShaderProg, "layer");
}
- if (gs != 0)
- _mesa_DeleteShader(gs);
}
static void
@@ -1843,7 +1822,7 @@ meta_clear(struct gl_context *ctx, GLbitfield buffers, bool glsl)
/* draw quad(s) */
if (fb->MaxNumLayers > 0) {
unsigned layer;
- assert(glsl);
+ assert(glsl && clear->LayerLocation != -1);
for (layer = 0; layer < fb->MaxNumLayers; layer++) {
if (fb->_IntegerColor)
_mesa_Uniform1i(clear->IntegerLayerLocation, layer);
diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.c b/mesalib/src/mesa/drivers/dri/common/dri_util.c
index 471287909..8506f5356 100644
--- a/mesalib/src/mesa/drivers/dri/common/dri_util.c
+++ b/mesalib/src/mesa/drivers/dri/common/dri_util.c
@@ -677,7 +677,7 @@ dri2ReleaseBuffer(__DRIscreen *screen, __DRIbuffer *buffer)
static int
-dri2ConfigQueryb(__DRIscreen *screen, const char *var, GLboolean *val)
+dri2ConfigQueryb(__DRIscreen *screen, const char *var, bool *val)
{
if (!driCheckOption(&screen->optionCache, var, DRI_BOOL))
return -1;
@@ -688,7 +688,7 @@ dri2ConfigQueryb(__DRIscreen *screen, const char *var, GLboolean *val)
}
static int
-dri2ConfigQueryi(__DRIscreen *screen, const char *var, GLint *val)
+dri2ConfigQueryi(__DRIscreen *screen, const char *var, int *val)
{
if (!driCheckOption(&screen->optionCache, var, DRI_INT) &&
!driCheckOption(&screen->optionCache, var, DRI_ENUM))
@@ -700,7 +700,7 @@ dri2ConfigQueryi(__DRIscreen *screen, const char *var, GLint *val)
}
static int
-dri2ConfigQueryf(__DRIscreen *screen, const char *var, GLfloat *val)
+dri2ConfigQueryf(__DRIscreen *screen, const char *var, float *val)
{
if (!driCheckOption(&screen->optionCache, var, DRI_FLOAT))
return -1;
diff --git a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c
index b95e452f1..5091c115b 100644
--- a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c
+++ b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c
@@ -27,8 +27,6 @@
* \author Felix Kuehling
*/
-#include "main/glheader.h"
-
#include <string.h>
#include <assert.h>
#include <expat.h>
@@ -106,15 +104,15 @@ static const char *__getProgramName () {
#endif
/** \brief Find an option in an option cache with the name as key */
-static GLuint findOption (const driOptionCache *cache, const char *name) {
- GLuint len = strlen (name);
- GLuint size = 1 << cache->tableSize, mask = size - 1;
- GLuint hash = 0;
- GLuint i, shift;
+static uint32_t findOption (const driOptionCache *cache, const char *name) {
+ uint32_t len = strlen (name);
+ uint32_t size = 1 << cache->tableSize, mask = size - 1;
+ uint32_t hash = 0;
+ uint32_t i, shift;
/* compute a hash from the variable length name */
for (i = 0, shift = 0; i < len; ++i, shift = (shift+8) & 31)
- hash += (GLuint)name[i] << shift;
+ hash += (uint32_t)name[i] << shift;
hash *= hash;
hash = (hash >> (16-cache->tableSize/2)) & mask;
@@ -134,7 +132,7 @@ static GLuint findOption (const driOptionCache *cache, const char *name) {
/** \brief Like strdup but using malloc and with error checking. */
#define XSTRDUP(dest,source) do { \
- GLuint len = strlen (source); \
+ uint32_t len = strlen (source); \
if (!(dest = malloc(len+1))) { \
fprintf (stderr, "%s: %d: out of memory.\n", __FILE__, __LINE__); \
abort(); \
@@ -146,8 +144,8 @@ static int compare (const void *a, const void *b) {
return strcmp (*(char *const*)a, *(char *const*)b);
}
/** \brief Binary search in a string array. */
-static GLuint bsearchStr (const XML_Char *name,
- const XML_Char *elems[], GLuint count) {
+static uint32_t bsearchStr (const XML_Char *name,
+ const XML_Char *elems[], uint32_t count) {
const XML_Char **found;
found = bsearch (&name, elems, count, sizeof (XML_Char *), compare);
if (found)
@@ -165,11 +163,11 @@ static GLuint bsearchStr (const XML_Char *name,
* returning tail points to the first character that is not part of
* the integer number. If no number was found then tail points to the
* start of the input string. */
-static GLint strToI (const XML_Char *string, const XML_Char **tail, int base) {
- GLint radix = base == 0 ? 10 : base;
- GLint result = 0;
- GLint sign = 1;
- GLboolean numberFound = GL_FALSE;
+static int strToI (const XML_Char *string, const XML_Char **tail, int base) {
+ int radix = base == 0 ? 10 : base;
+ int result = 0;
+ int sign = 1;
+ bool numberFound = false;
const XML_Char *start = string;
assert (radix >= 2 && radix <= 36);
@@ -180,7 +178,7 @@ static GLint strToI (const XML_Char *string, const XML_Char **tail, int base) {
} else if (*string == '+')
string++;
if (base == 0 && *string == '0') {
- numberFound = GL_TRUE;
+ numberFound = true;
if (*(string+1) == 'x' || *(string+1) == 'X') {
radix = 16;
string += 2;
@@ -190,7 +188,7 @@ static GLint strToI (const XML_Char *string, const XML_Char **tail, int base) {
}
}
do {
- GLint digit = -1;
+ int digit = -1;
if (radix <= 10) {
if (*string >= '0' && *string < '0' + radix)
digit = *string - '0';
@@ -203,12 +201,12 @@ static GLint strToI (const XML_Char *string, const XML_Char **tail, int base) {
digit = *string - 'A' + 10;
}
if (digit != -1) {
- numberFound = GL_TRUE;
+ numberFound = true;
result = radix*result + digit;
string++;
} else
break;
- } while (GL_TRUE);
+ } while (true);
*tail = numberFound ? string : start;
return sign * result;
}
@@ -225,9 +223,9 @@ static GLint strToI (const XML_Char *string, const XML_Char **tail, int base) {
* to the start of the input string.
*
* Uses two passes for maximum accuracy. */
-static GLfloat strToF (const XML_Char *string, const XML_Char **tail) {
- GLint nDigits = 0, pointPos, exponent;
- GLfloat sign = 1.0f, result = 0.0f, scale;
+static float strToF (const XML_Char *string, const XML_Char **tail) {
+ int nDigits = 0, pointPos, exponent;
+ float sign = 1.0f, result = 0.0f, scale;
const XML_Char *start = string, *numStart;
/* sign */
@@ -270,13 +268,13 @@ static GLfloat strToF (const XML_Char *string, const XML_Char **tail) {
string = numStart;
/* scale of the first digit */
- scale = sign * (GLfloat)pow (10.0, (GLdouble)(pointPos-1 + exponent));
+ scale = sign * (float)pow (10.0, (double)(pointPos-1 + exponent));
/* second pass: parse digits */
do {
if (*string != '.') {
assert (*string >= '0' && *string <= '9');
- result += scale * (GLfloat)(*string - '0');
+ result += scale * (float)(*string - '0');
scale *= 0.1f;
nDigits--;
}
@@ -287,7 +285,7 @@ static GLfloat strToF (const XML_Char *string, const XML_Char **tail) {
}
/** \brief Parse a value of a given type. */
-static GLboolean parseValue (driOptionValue *v, driOptionType type,
+static bool parseValue (driOptionValue *v, driOptionType type,
const XML_Char *string) {
const XML_Char *tail = NULL;
/* skip leading white-space */
@@ -295,14 +293,14 @@ static GLboolean parseValue (driOptionValue *v, driOptionType type,
switch (type) {
case DRI_BOOL:
if (!strcmp (string, "false")) {
- v->_bool = GL_FALSE;
+ v->_bool = false;
tail = string + 5;
} else if (!strcmp (string, "true")) {
- v->_bool = GL_TRUE;
+ v->_bool = true;
tail = string + 4;
}
else
- return GL_FALSE;
+ return false;
break;
case DRI_ENUM: /* enum is just a special integer */
case DRI_INT:
@@ -311,23 +309,28 @@ static GLboolean parseValue (driOptionValue *v, driOptionType type,
case DRI_FLOAT:
v->_float = strToF (string, &tail);
break;
+ case DRI_STRING:
+ if (v->_string)
+ free (v->_string);
+ v->_string = strndup(string, STRING_CONF_MAXLEN);
+ return GL_TRUE;
}
if (tail == string)
- return GL_FALSE; /* empty string (or containing only white-space) */
+ return false; /* empty string (or containing only white-space) */
/* skip trailing white space */
if (*tail)
tail += strspn (tail, " \f\n\r\t\v");
if (*tail)
- return GL_FALSE; /* something left over that is not part of value */
+ return false; /* something left over that is not part of value */
- return GL_TRUE;
+ return true;
}
/** \brief Parse a list of ranges of type info->type. */
-static GLboolean parseRanges (driOptionInfo *info, const XML_Char *string) {
+static bool parseRanges (driOptionInfo *info, const XML_Char *string) {
XML_Char *cp, *range;
- GLuint nRanges, i;
+ uint32_t nRanges, i;
driOptionRange *ranges;
XSTRDUP (cp, string);
@@ -375,39 +378,41 @@ static GLboolean parseRanges (driOptionInfo *info, const XML_Char *string) {
free(cp);
if (i < nRanges) {
free(ranges);
- return GL_FALSE;
+ return false;
} else
assert (range == NULL);
info->nRanges = nRanges;
info->ranges = ranges;
- return GL_TRUE;
+ return true;
}
/** \brief Check if a value is in one of info->ranges. */
-static GLboolean checkValue (const driOptionValue *v, const driOptionInfo *info) {
- GLuint i;
+static bool checkValue (const driOptionValue *v, const driOptionInfo *info) {
+ uint32_t i;
assert (info->type != DRI_BOOL); /* should be caught by the parser */
if (info->nRanges == 0)
- return GL_TRUE;
+ return true;
switch (info->type) {
case DRI_ENUM: /* enum is just a special integer */
case DRI_INT:
for (i = 0; i < info->nRanges; ++i)
if (v->_int >= info->ranges[i].start._int &&
v->_int <= info->ranges[i].end._int)
- return GL_TRUE;
+ return true;
break;
case DRI_FLOAT:
for (i = 0; i < info->nRanges; ++i)
if (v->_float >= info->ranges[i].start._float &&
v->_float <= info->ranges[i].end._float)
- return GL_TRUE;
+ return true;
+ break;
+ case DRI_STRING:
break;
default:
assert (0); /* should never happen */
}
- return GL_FALSE;
+ return false;
}
/**
@@ -478,11 +483,11 @@ struct OptInfoData {
const char *name;
XML_Parser parser;
driOptionCache *cache;
- GLboolean inDriInfo;
- GLboolean inSection;
- GLboolean inDesc;
- GLboolean inOption;
- GLboolean inEnum;
+ bool inDriInfo;
+ bool inSection;
+ bool inDesc;
+ bool inOption;
+ bool inEnum;
int curOption;
};
@@ -500,10 +505,10 @@ static const XML_Char *OptInfoElems[] = {
* for external configuration tools.
*/
static void parseEnumAttr (struct OptInfoData *data, const XML_Char **attr) {
- GLuint i;
+ uint32_t i;
const XML_Char *value = NULL, *text = NULL;
driOptionValue v;
- GLuint opt = data->curOption;
+ uint32_t opt = data->curOption;
for (i = 0; attr[i]; i += 2) {
if (!strcmp (attr[i], "value")) value = attr[i+1];
else if (!strcmp (attr[i], "text")) text = attr[i+1];
@@ -523,7 +528,7 @@ static void parseEnumAttr (struct OptInfoData *data, const XML_Char **attr) {
* for external configuration tools.
*/
static void parseDescAttr (struct OptInfoData *data, const XML_Char **attr) {
- GLuint i;
+ uint32_t i;
const XML_Char *lang = NULL, *text = NULL;
for (i = 0; attr[i]; i += 2) {
if (!strcmp (attr[i], "lang")) lang = attr[i+1];
@@ -541,9 +546,9 @@ static void parseOptInfoAttr (struct OptInfoData *data, const XML_Char **attr) {
const XML_Char *attrVal[OA_COUNT] = {NULL, NULL, NULL, NULL};
const char *defaultVal;
driOptionCache *cache = data->cache;
- GLuint opt, i;
+ uint32_t opt, i;
for (i = 0; attr[i]; i += 2) {
- GLuint attrName = bsearchStr (attr[i], optAttr, OA_COUNT);
+ uint32_t attrName = bsearchStr (attr[i], optAttr, OA_COUNT);
if (attrName >= OA_COUNT)
XML_FATAL ("illegal option attribute: %s", attr[i]);
attrVal[attrName] = attr[i+1];
@@ -567,6 +572,8 @@ static void parseOptInfoAttr (struct OptInfoData *data, const XML_Char **attr) {
cache->info[opt].type = DRI_INT;
else if (!strcmp (attrVal[OA_TYPE], "float"))
cache->info[opt].type = DRI_FLOAT;
+ else if (!strcmp (attrVal[OA_TYPE], "string"))
+ cache->info[opt].type = DRI_STRING;
else
XML_FATAL ("illegal type in option: %s.", attrVal[OA_TYPE]);
@@ -608,7 +615,7 @@ static void optInfoStartElem (void *userData, const XML_Char *name,
XML_FATAL1 ("nested <driinfo> elements.");
if (attr[0])
XML_FATAL1 ("attributes specified on <driinfo> element.");
- data->inDriInfo = GL_TRUE;
+ data->inDriInfo = true;
break;
case OI_SECTION:
if (!data->inDriInfo)
@@ -617,14 +624,14 @@ static void optInfoStartElem (void *userData, const XML_Char *name,
XML_FATAL1 ("nested <section> elements.");
if (attr[0])
XML_FATAL1 ("attributes specified on <section> element.");
- data->inSection = GL_TRUE;
+ data->inSection = true;
break;
case OI_DESCRIPTION:
if (!data->inSection && !data->inOption)
XML_FATAL1 ("<description> must be inside <description> or <option.");
if (data->inDesc)
XML_FATAL1 ("nested <description> elements.");
- data->inDesc = GL_TRUE;
+ data->inDesc = true;
parseDescAttr (data, attr);
break;
case OI_OPTION:
@@ -634,7 +641,7 @@ static void optInfoStartElem (void *userData, const XML_Char *name,
XML_FATAL1 ("<option> nested in <description> element.");
if (data->inOption)
XML_FATAL1 ("nested <option> elements.");
- data->inOption = GL_TRUE;
+ data->inOption = true;
parseOptInfoAttr (data, attr);
break;
case OI_ENUM:
@@ -642,7 +649,7 @@ static void optInfoStartElem (void *userData, const XML_Char *name,
XML_FATAL1 ("<enum> must be inside <option> and <description>.");
if (data->inEnum)
XML_FATAL1 ("nested <enum> elements.");
- data->inEnum = GL_TRUE;
+ data->inEnum = true;
parseEnumAttr (data, attr);
break;
default:
@@ -656,19 +663,19 @@ static void optInfoEndElem (void *userData, const XML_Char *name) {
enum OptInfoElem elem = bsearchStr (name, OptInfoElems, OI_COUNT);
switch (elem) {
case OI_DRIINFO:
- data->inDriInfo = GL_FALSE;
+ data->inDriInfo = false;
break;
case OI_SECTION:
- data->inSection = GL_FALSE;
+ data->inSection = false;
break;
case OI_DESCRIPTION:
- data->inDesc = GL_FALSE;
+ data->inDesc = false;
break;
case OI_OPTION:
- data->inOption = GL_FALSE;
+ data->inOption = false;
break;
case OI_ENUM:
- data->inEnum = GL_FALSE;
+ data->inEnum = false;
break;
default:
assert (0); /* should have been caught by StartElem */
@@ -699,11 +706,11 @@ void driParseOptionInfo (driOptionCache *info, const char *configOptions) {
userData.name = "__driConfigOptions";
userData.parser = p;
userData.cache = info;
- userData.inDriInfo = GL_FALSE;
- userData.inSection = GL_FALSE;
- userData.inDesc = GL_FALSE;
- userData.inOption = GL_FALSE;
- userData.inEnum = GL_FALSE;
+ userData.inDriInfo = false;
+ userData.inSection = false;
+ userData.inDesc = false;
+ userData.inOption = false;
+ userData.inEnum = false;
userData.curOption = -1;
status = XML_Parse (p, configOptions, strlen (configOptions), 1);
@@ -718,14 +725,14 @@ struct OptConfData {
const char *name;
XML_Parser parser;
driOptionCache *cache;
- GLint screenNum;
+ int screenNum;
const char *driverName, *execName;
- GLuint ignoringDevice;
- GLuint ignoringApp;
- GLuint inDriConf;
- GLuint inDevice;
- GLuint inApp;
- GLuint inOption;
+ uint32_t ignoringDevice;
+ uint32_t ignoringApp;
+ uint32_t inDriConf;
+ uint32_t inDevice;
+ uint32_t inApp;
+ uint32_t inOption;
};
/** \brief Elements in configuration files. */
@@ -738,7 +745,7 @@ static const XML_Char *OptConfElems[] = {
/** \brief Parse attributes of a device element. */
static void parseDeviceAttr (struct OptConfData *data, const XML_Char **attr) {
- GLuint i;
+ uint32_t i;
const XML_Char *driver = NULL, *screen = NULL;
for (i = 0; attr[i]; i += 2) {
if (!strcmp (attr[i], "driver")) driver = attr[i+1];
@@ -758,7 +765,7 @@ static void parseDeviceAttr (struct OptConfData *data, const XML_Char **attr) {
/** \brief Parse attributes of an application element. */
static void parseAppAttr (struct OptConfData *data, const XML_Char **attr) {
- GLuint i;
+ uint32_t i;
const XML_Char *exec = NULL;
for (i = 0; attr[i]; i += 2) {
if (!strcmp (attr[i], "name")) /* not needed here */;
@@ -771,7 +778,7 @@ static void parseAppAttr (struct OptConfData *data, const XML_Char **attr) {
/** \brief Parse attributes of an option element. */
static void parseOptConfAttr (struct OptConfData *data, const XML_Char **attr) {
- GLuint i;
+ uint32_t i;
const XML_Char *name = NULL, *value = NULL;
for (i = 0; attr[i]; i += 2) {
if (!strcmp (attr[i], "name")) name = attr[i+1];
@@ -782,7 +789,7 @@ static void parseOptConfAttr (struct OptConfData *data, const XML_Char **attr) {
if (!value) XML_WARNING1 ("value attribute missing in option.");
if (name && value) {
driOptionCache *cache = data->cache;
- GLuint opt = findOption (cache, name);
+ uint32_t opt = findOption (cache, name);
if (cache->info[opt].name == NULL)
/* don't use XML_WARNING, drirc defines options for all drivers,
* but not all drivers support them */
@@ -867,6 +874,7 @@ static void optConfEndElem (void *userData, const XML_Char *name) {
/** \brief Initialize an option cache based on info */
static void initOptionCache (driOptionCache *cache, const driOptionCache *info) {
+ GLuint i, size = 1 << info->tableSize;
cache->info = info->info;
cache->tableSize = info->tableSize;
cache->values = malloc((1<<info->tableSize) * sizeof (driOptionValue));
@@ -876,6 +884,10 @@ static void initOptionCache (driOptionCache *cache, const driOptionCache *info)
}
memcpy (cache->values, info->values,
(1<<info->tableSize) * sizeof (driOptionValue));
+ for (i = 0; i < size; ++i) {
+ if (cache->info[i].type == DRI_STRING)
+ XSTRDUP(cache->values[i]._string, info->values[i]._string);
+ }
}
/** \brief Parse the named configuration file */
@@ -918,10 +930,10 @@ static void parseOneConfigFile (XML_Parser p) {
}
void driParseConfigFiles (driOptionCache *cache, const driOptionCache *info,
- GLint screenNum, const char *driverName) {
+ int screenNum, const char *driverName) {
char *filenames[2] = {"/etc/drirc", NULL};
char *home;
- GLuint i;
+ uint32_t i;
struct OptConfData userData;
initOptionCache (cache, info);
@@ -932,7 +944,7 @@ void driParseConfigFiles (driOptionCache *cache, const driOptionCache *info,
userData.execName = GET_PROGRAM_NAME();
if ((home = getenv ("HOME"))) {
- GLuint len = strlen (home);
+ uint32_t len = strlen (home);
filenames[1] = malloc(len + 7+1);
if (filenames[1] == NULL)
__driUtilMessage ("Can't allocate memory for %s/.drirc.", home);
@@ -969,7 +981,7 @@ void driParseConfigFiles (driOptionCache *cache, const driOptionCache *info,
void driDestroyOptionInfo (driOptionCache *info) {
driDestroyOptionCache (info);
if (info->info) {
- GLuint i, size = 1 << info->tableSize;
+ uint32_t i, size = 1 << info->tableSize;
for (i = 0; i < size; ++i) {
if (info->info[i].name) {
free(info->info[i].name);
@@ -981,35 +993,50 @@ void driDestroyOptionInfo (driOptionCache *info) {
}
void driDestroyOptionCache (driOptionCache *cache) {
+ if (cache->info) {
+ GLuint i, size = 1 << cache->tableSize;
+ for (i = 0; i < size; ++i) {
+ if (cache->info[i].type == DRI_STRING)
+ free(cache->values[i]._string);
+ }
+ }
free(cache->values);
}
-GLboolean driCheckOption (const driOptionCache *cache, const char *name,
+bool driCheckOption (const driOptionCache *cache, const char *name,
driOptionType type) {
- GLuint i = findOption (cache, name);
+ uint32_t i = findOption (cache, name);
return cache->info[i].name != NULL && cache->info[i].type == type;
}
-GLboolean driQueryOptionb (const driOptionCache *cache, const char *name) {
- GLuint i = findOption (cache, name);
+bool driQueryOptionb (const driOptionCache *cache, const char *name) {
+ uint32_t i = findOption (cache, name);
/* make sure the option is defined and has the correct type */
assert (cache->info[i].name != NULL);
assert (cache->info[i].type == DRI_BOOL);
return cache->values[i]._bool;
}
-GLint driQueryOptioni (const driOptionCache *cache, const char *name) {
- GLuint i = findOption (cache, name);
+int driQueryOptioni (const driOptionCache *cache, const char *name) {
+ uint32_t i = findOption (cache, name);
/* make sure the option is defined and has the correct type */
assert (cache->info[i].name != NULL);
assert (cache->info[i].type == DRI_INT || cache->info[i].type == DRI_ENUM);
return cache->values[i]._int;
}
-GLfloat driQueryOptionf (const driOptionCache *cache, const char *name) {
- GLuint i = findOption (cache, name);
+float driQueryOptionf (const driOptionCache *cache, const char *name) {
+ uint32_t i = findOption (cache, name);
/* make sure the option is defined and has the correct type */
assert (cache->info[i].name != NULL);
assert (cache->info[i].type == DRI_FLOAT);
return cache->values[i]._float;
}
+
+char *driQueryOptionstr (const driOptionCache *cache, const char *name) {
+ GLuint i = findOption (cache, name);
+ /* make sure the option is defined and has the correct type */
+ assert (cache->info[i].name != NULL);
+ assert (cache->info[i].type == DRI_STRING);
+ return cache->values[i]._string;
+}
diff --git a/mesalib/src/mesa/drivers/dri/common/xmlconfig.h b/mesalib/src/mesa/drivers/dri/common/xmlconfig.h
index d0ad42c19..386ddf19d 100644
--- a/mesalib/src/mesa/drivers/dri/common/xmlconfig.h
+++ b/mesalib/src/mesa/drivers/dri/common/xmlconfig.h
@@ -30,16 +30,21 @@
#ifndef __XMLCONFIG_H
#define __XMLCONFIG_H
+#include <stdbool.h>
+
+#define STRING_CONF_MAXLEN 25
+
/** \brief Option data types */
typedef enum driOptionType {
- DRI_BOOL, DRI_ENUM, DRI_INT, DRI_FLOAT
+ DRI_BOOL, DRI_ENUM, DRI_INT, DRI_FLOAT, DRI_STRING
} driOptionType;
/** \brief Option value */
typedef union driOptionValue {
- GLboolean _bool; /**< \brief Boolean */
- GLint _int; /**< \brief Integer or Enum */
- GLfloat _float; /**< \brief Floating-point */
+ bool _bool; /**< \brief Boolean */
+ int _int; /**< \brief Integer or Enum */
+ float _float; /**< \brief Floating-point */
+ char *_string; /**< \brief String */
} driOptionValue;
/** \brief Single range of valid values
@@ -55,7 +60,7 @@ typedef struct driOptionInfo {
char *name; /**< \brief Name */
driOptionType type; /**< \brief Type */
driOptionRange *ranges; /**< \brief Array of ranges */
- GLuint nRanges; /**< \brief Number of ranges */
+ uint nRanges; /**< \brief Number of ranges */
} driOptionInfo;
/** \brief Option cache
@@ -73,7 +78,7 @@ typedef struct driOptionCache {
* \li Default values in screen
* \li Actual values in contexts
*/
- GLuint tableSize;
+ uint tableSize;
/**< \brief Size of the arrays
*
* In the current implementation it's not actually a size but log2(size).
@@ -98,7 +103,7 @@ void driParseOptionInfo (driOptionCache *info,
* To be called in <driver>CreateContext. screenNum and driverName select
* device sections. */
void driParseConfigFiles (driOptionCache *cache, const driOptionCache *info,
- GLint screenNum, const char *driverName);
+ int screenNum, const char *driverName);
/** \brief Destroy option info
*
* To be called in <driver>DestroyScreen */
@@ -109,14 +114,16 @@ void driDestroyOptionInfo (driOptionCache *info);
void driDestroyOptionCache (driOptionCache *cache);
/** \brief Check if there exists a certain option */
-GLboolean driCheckOption (const driOptionCache *cache, const char *name,
+bool driCheckOption (const driOptionCache *cache, const char *name,
driOptionType type);
/** \brief Query a boolean option value */
-GLboolean driQueryOptionb (const driOptionCache *cache, const char *name);
+bool driQueryOptionb (const driOptionCache *cache, const char *name);
/** \brief Query an integer option value */
-GLint driQueryOptioni (const driOptionCache *cache, const char *name);
+int driQueryOptioni (const driOptionCache *cache, const char *name);
/** \brief Query a floating-point option value */
-GLfloat driQueryOptionf (const driOptionCache *cache, const char *name);
+float driQueryOptionf (const driOptionCache *cache, const char *name);
+/** \brief Query a string option value */
+char *driQueryOptionstr (const driOptionCache *cache, const char *name);
#endif
diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h b/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h
index 3bf804a17..fc9e10461 100644
--- a/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h
+++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h
@@ -321,3 +321,17 @@ DRI_CONF_SECTION_BEGIN \
DRI_CONF_OPT_BEGIN_B(always_have_depth_buffer, def) \
DRI_CONF_DESC(en,gettext("Create all visuals with a depth buffer")) \
DRI_CONF_OPT_END
+
+
+
+/**
+ * \brief Initialization configuration options
+ */
+#define DRI_CONF_SECTION_INITIALIZATION \
+DRI_CONF_SECTION_BEGIN \
+ DRI_CONF_DESC(en,gettext("Initialization"))
+
+#define DRI_CONF_DEVICE_ID_PATH_TAG(def) \
+DRI_CONF_OPT_BEGIN(device_id, string, def) \
+ DRI_CONF_DESC(en,gettext("Define the graphic device to use if possible")) \
+DRI_CONF_OPT_END
diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c
index 244e63ede..b08215950 100644
--- a/mesalib/src/mesa/main/context.c
+++ b/mesalib/src/mesa/main/context.c
@@ -656,9 +656,6 @@ _mesa_init_constants(struct gl_context *ctx)
/* GL_ARB_sync */
ctx->Const.MaxServerWaitTimeout = 0x1fff7fffffffULL;
- /* GL_ATI_envmap_bumpmap */
- ctx->Const.SupportedBumpUnits = SUPPORTED_ATI_BUMP_UNITS;
-
/* GL_EXT_provoking_vertex */
ctx->Const.QuadsFollowProvokingVertexConvention = GL_TRUE;
diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c
index 5874b99f0..5c7160d05 100644
--- a/mesalib/src/mesa/main/dlist.c
+++ b/mesalib/src/mesa/main/dlist.c
@@ -317,8 +317,6 @@ typedef enum
/* GL_ARB_draw_buffers */
OPCODE_DRAW_BUFFERS_ARB,
/* GL_ATI_fragment_shader */
- OPCODE_TEX_BUMP_PARAMETER_ATI,
- /* GL_ATI_fragment_shader */
OPCODE_BIND_FRAGMENT_SHADER_ATI,
OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI,
/* OpenGL 2.0 */
@@ -4977,36 +4975,6 @@ save_DrawBuffersARB(GLsizei count, const GLenum * buffers)
}
static void GLAPIENTRY
-save_TexBumpParameterfvATI(GLenum pname, const GLfloat *param)
-{
- GET_CURRENT_CONTEXT(ctx);
- Node *n;
-
- n = alloc_instruction(ctx, OPCODE_TEX_BUMP_PARAMETER_ATI, 5);
- if (n) {
- n[1].ui = pname;
- n[2].f = param[0];
- n[3].f = param[1];
- n[4].f = param[2];
- n[5].f = param[3];
- }
- if (ctx->ExecuteFlag) {
- CALL_TexBumpParameterfvATI(ctx->Exec, (pname, param));
- }
-}
-
-static void GLAPIENTRY
-save_TexBumpParameterivATI(GLenum pname, const GLint *param)
-{
- GLfloat p[4];
- p[0] = INT_TO_FLOAT(param[0]);
- p[1] = INT_TO_FLOAT(param[1]);
- p[2] = INT_TO_FLOAT(param[2]);
- p[3] = INT_TO_FLOAT(param[3]);
- save_TexBumpParameterfvATI(pname, p);
-}
-
-static void GLAPIENTRY
save_BindFragmentShaderATI(GLuint id)
{
GET_CURRENT_CONTEXT(ctx);
@@ -8653,16 +8621,6 @@ execute_list(struct gl_context *ctx, GLuint list)
CALL_ClampColor(ctx->Exec, (n[1].e, n[2].e));
break;
- case OPCODE_TEX_BUMP_PARAMETER_ATI:
- {
- GLfloat values[4];
- GLuint i, pname = n[1].ui;
-
- for (i = 0; i < 4; i++)
- values[i] = n[1 + i].f;
- CALL_TexBumpParameterfvATI(ctx->Exec, (pname, values));
- }
- break;
case OPCODE_BIND_FRAGMENT_SHADER_ATI:
CALL_BindFragmentShaderATI(ctx->Exec, (n[1].i));
break;
@@ -9488,10 +9446,6 @@ _mesa_initialize_save_table(const struct gl_context *ctx)
*/
SET_BindProgramARB(table, save_BindProgramNV);
- /* 244. GL_ATI_envmap_bumpmap */
- SET_TexBumpParameterivATI(table, save_TexBumpParameterivATI);
- SET_TexBumpParameterfvATI(table, save_TexBumpParameterfvATI);
-
/* 245. GL_ATI_fragment_shader */
SET_BindFragmentShaderATI(table, save_BindFragmentShaderATI);
SET_SetFragmentShaderConstantATI(table, save_SetFragmentShaderConstantATI);
diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c
index 25e3dab4f..6f2536170 100644
--- a/mesalib/src/mesa/main/extensions.c
+++ b/mesalib/src/mesa/main/extensions.c
@@ -136,6 +136,7 @@ static const struct extension extension_table[] = {
{ "GL_ARB_sample_shading", o(ARB_sample_shading), GL, 2009 },
{ "GL_ARB_sampler_objects", o(dummy_true), GL, 2009 },
{ "GL_ARB_seamless_cube_map", o(ARB_seamless_cube_map), GL, 2009 },
+ { "GL_ARB_seamless_cubemap_per_texture", o(AMD_seamless_cubemap_per_texture), GL, 2013 },
{ "GL_ARB_separate_shader_objects", o(dummy_true), GL, 2010 },
{ "GL_ARB_shader_atomic_counters", o(ARB_shader_atomic_counters), GL, 2011 },
{ "GL_ARB_shader_bit_encoding", o(ARB_shader_bit_encoding), GL, 2010 },
@@ -328,7 +329,6 @@ static const struct extension extension_table[] = {
{ "GL_APPLE_vertex_array_object", o(dummy_true), GLL, 2002 },
{ "GL_ATI_blend_equation_separate", o(EXT_blend_equation_separate), GL, 2003 },
{ "GL_ATI_draw_buffers", o(dummy_true), GLL, 2002 },
- { "GL_ATI_envmap_bumpmap", o(ATI_envmap_bumpmap), GLL, 2001 },
{ "GL_ATI_fragment_shader", o(ATI_fragment_shader), GLL, 2001 },
{ "GL_ATI_separate_stencil", o(ATI_separate_stencil), GLL, 2006 },
{ "GL_ATI_texture_compression_3dc", o(ATI_texture_compression_3dc), GL, 2004 },
@@ -461,7 +461,6 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
ctx->Extensions.ARB_vertex_shader = GL_TRUE;
ctx->Extensions.ARB_sync = GL_TRUE;
ctx->Extensions.APPLE_object_purgeable = GL_TRUE;
- ctx->Extensions.ATI_envmap_bumpmap = GL_TRUE;
ctx->Extensions.ATI_fragment_shader = GL_TRUE;
ctx->Extensions.ATI_texture_compression_3dc = GL_TRUE;
ctx->Extensions.ATI_texture_env_combine3 = GL_TRUE;
diff --git a/mesalib/src/mesa/main/ff_fragment_shader.cpp b/mesalib/src/mesa/main/ff_fragment_shader.cpp
index 211583738..2c4f3d7df 100644
--- a/mesalib/src/mesa/main/ff_fragment_shader.cpp
+++ b/mesalib/src/mesa/main/ff_fragment_shader.cpp
@@ -220,7 +220,6 @@ static GLuint translate_source( GLenum src )
#define MODE_MODULATE_SUBTRACT_ATI 12 /* r = a0 * a2 - a1 */
#define MODE_ADD_PRODUCTS 13 /* r = a0 * a1 + a2 * a3 */
#define MODE_ADD_PRODUCTS_SIGNED 14 /* r = a0 * a1 + a2 * a3 - 0.5 */
-#define MODE_BUMP_ENVMAP_ATI 15 /* special */
#define MODE_UNKNOWN 16
/**
@@ -250,7 +249,6 @@ static GLuint translate_mode( GLenum envMode, GLenum mode )
case GL_MODULATE_ADD_ATI: return MODE_MODULATE_ADD_ATI;
case GL_MODULATE_SIGNED_ADD_ATI: return MODE_MODULATE_SIGNED_ADD_ATI;
case GL_MODULATE_SUBTRACT_ATI: return MODE_MODULATE_SUBTRACT_ATI;
- case GL_BUMP_ENVMAP_ATI: return MODE_BUMP_ENVMAP_ATI;
default:
assert(0);
return MODE_UNKNOWN;
@@ -283,7 +281,6 @@ need_saturate( GLuint mode )
case MODE_MODULATE_SUBTRACT_ATI:
case MODE_ADD_PRODUCTS:
case MODE_ADD_PRODUCTS_SIGNED:
- case MODE_BUMP_ENVMAP_ATI:
return GL_TRUE;
default:
assert(0);
@@ -455,16 +452,6 @@ static GLuint make_state_key( struct gl_context *ctx, struct state_key *key )
key->unit[i].OptRGB[j].Source = translate_source(comb->SourceRGB[j]);
key->unit[i].OptA[j].Source = translate_source(comb->SourceA[j]);
}
-
- if (key->unit[i].ModeRGB == MODE_BUMP_ENVMAP_ATI) {
- /* requires some special translation */
- key->unit[i].NumArgsRGB = 2;
- key->unit[i].ScaleShiftRGB = 0;
- key->unit[i].OptRGB[0].Operand = OPR_SRC_COLOR;
- key->unit[i].OptRGB[0].Source = SRC_TEXTURE;
- key->unit[i].OptRGB[1].Operand = OPR_SRC_COLOR;
- key->unit[i].OptRGB[1].Source = texUnit->BumpTarget - GL_TEXTURE0 + SRC_TEXTURE0;
- }
}
/* _NEW_LIGHT | _NEW_FOG */
@@ -753,11 +740,6 @@ emit_combine(texenv_fragment_program *p,
case MODE_ADD_PRODUCTS_SIGNED:
return add(add(mul(src[0], src[1]), mul(src[2], src[3])),
new(p->mem_ctx) ir_constant(-0.5f));
-
- case MODE_BUMP_ENVMAP_ATI:
- /* special - not handled here */
- assert(0);
- return src[0];
default:
assert(0);
return src[0];
@@ -777,10 +759,6 @@ emit_texenv(texenv_fragment_program *p, GLuint unit)
if (!key->unit[unit].enabled) {
return get_source(p, SRC_PREVIOUS, 0);
}
- if (key->unit[unit].ModeRGB == MODE_BUMP_ENVMAP_ATI) {
- /* this isn't really a env stage delivering a color and handled elsewhere */
- return get_source(p, SRC_PREVIOUS, 0);
- }
switch (key->unit[unit].ModeRGB) {
case MODE_DOT3_RGB_EXT:
@@ -1075,56 +1053,6 @@ load_texunit_sources( texenv_fragment_program *p, GLuint unit )
}
/**
- * Generate instructions for loading bump map textures.
- */
-static void
-load_texunit_bumpmap( texenv_fragment_program *p, GLuint unit )
-{
- const struct state_key *key = p->state;
- GLuint bumpedUnitNr = key->unit[unit].OptRGB[1].Source - SRC_TEXTURE0;
- ir_rvalue *bump;
- ir_rvalue *texcoord;
- ir_variable *rot_mat_0, *rot_mat_1;
-
- rot_mat_0 = p->shader->symbols->get_variable("gl_BumpRotMatrix0MESA");
- assert(rot_mat_0);
- rot_mat_1 = p->shader->symbols->get_variable("gl_BumpRotMatrix1MESA");
- assert(rot_mat_1);
-
- ir_variable *tc_array = p->shader->symbols->get_variable("gl_TexCoord");
- assert(tc_array);
- texcoord = new(p->mem_ctx) ir_dereference_variable(tc_array);
- ir_rvalue *index = new(p->mem_ctx) ir_constant(bumpedUnitNr);
- texcoord = new(p->mem_ctx) ir_dereference_array(texcoord, index);
- tc_array->data.max_array_access = MAX2(tc_array->data.max_array_access, unit);
-
- load_texenv_source( p, unit + SRC_TEXTURE0, unit );
-
- /* Apply rot matrix and add coords to be available in next phase.
- * dest = Arg1 + (Arg0.xx * rotMat0) + (Arg0.yy * rotMat1)
- * note only 2 coords are affected the rest are left unchanged (mul by 0)
- */
- ir_rvalue *bump_x, *bump_y;
-
- texcoord = smear(p, texcoord);
-
- /* bump_texcoord = texcoord */
- ir_variable *bumped = p->make_temp(texcoord->type, "bump_texcoord");
- p->emit(bumped);
- p->emit(assign(bumped, texcoord));
-
- /* bump_texcoord.xy += arg0.x * rotmat0 + arg0.y * rotmat1 */
- bump = get_source(p, key->unit[unit].OptRGB[0].Source, unit);
- bump_x = mul(swizzle_x(bump), rot_mat_0);
- bump_y = mul(swizzle_y(bump->clone(p->mem_ctx, NULL)), rot_mat_1);
-
- p->emit(assign(bumped, add(swizzle_xy(bumped), add(bump_x, bump_y)),
- WRITEMASK_XY));
-
- p->texcoord_tex[bumpedUnitNr] = bumped;
-}
-
-/**
* Applies the fog calculations.
*
* This is basically like the ARB_fragment_prorgam fog options. Note
@@ -1214,14 +1142,6 @@ emit_instructions(texenv_fragment_program *p)
GLuint unit;
if (key->enabled_units) {
- /* Zeroth pass - bump map textures first */
- for (unit = 0; unit < key->nr_enabled_units; unit++) {
- if (key->unit[unit].enabled &&
- key->unit[unit].ModeRGB == MODE_BUMP_ENVMAP_ATI) {
- load_texunit_bumpmap(p, unit);
- }
- }
-
/* First pass - to support texture_env_crossbar, first identify
* all referenced texture sources and emit texld instructions
* for each:
diff --git a/mesalib/src/mesa/main/format_pack.c b/mesalib/src/mesa/main/format_pack.c
index e3cbfff7e..6b28592a6 100644
--- a/mesalib/src/mesa/main/format_pack.c
+++ b/mesalib/src/mesa/main/format_pack.c
@@ -1403,27 +1403,6 @@ pack_float_RG_FLOAT16(const GLfloat src[4], void *dst)
}
-/* MESA_FORMAT_DUDV8 */
-
-static void
-pack_ubyte_DUDV8(const GLubyte src[4], void *dst)
-{
- /* XXX is this ever used? */
- GLushort *d = ((GLushort *) dst);
- *d = PACK_COLOR_88(src[0], src[1]);
-}
-
-static void
-pack_float_DUDV8(const GLfloat src[4], void *dst)
-{
- GLushort *d = ((GLushort *) dst);
- GLbyte du, dv;
- du = FLOAT_TO_BYTE(CLAMP(src[0], 0.0F, 1.0F));
- dv = FLOAT_TO_BYTE(CLAMP(src[1], 0.0F, 1.0F));
- *d = PACK_COLOR_88(du, dv);
-}
-
-
/* MESA_FORMAT_RGBA_UNORM16 */
static void
@@ -2027,8 +2006,6 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format)
table[MESA_FORMAT_RGBA_UINT16] = NULL; /* pack_ubyte_RGBA_UINT16 */
table[MESA_FORMAT_RGBA_UINT32] = NULL; /* pack_ubyte_RGBA_UINT32 */
- table[MESA_FORMAT_DUDV8] = pack_ubyte_DUDV8;
-
table[MESA_FORMAT_RGBA_UNORM16] = pack_ubyte_RGBA_16;
/* n/a */
@@ -2194,8 +2171,6 @@ _mesa_get_pack_float_rgba_function(mesa_format format)
table[MESA_FORMAT_RGBA_UINT16] = NULL;
table[MESA_FORMAT_RGBA_UINT32] = NULL;
- table[MESA_FORMAT_DUDV8] = pack_float_DUDV8;
-
table[MESA_FORMAT_RGBA_UNORM16] = pack_float_RGBA_16;
table[MESA_FORMAT_R_SNORM8] = pack_float_R_SNORM8;
diff --git a/mesalib/src/mesa/main/format_unpack.c b/mesalib/src/mesa/main/format_unpack.c
index 9cc8f4dba..ad5ea4cd1 100644
--- a/mesalib/src/mesa/main/format_unpack.c
+++ b/mesalib/src/mesa/main/format_unpack.c
@@ -1708,19 +1708,6 @@ unpack_RGBA_UINT32(const void *src, GLfloat dst[][4], GLuint n)
}
static void
-unpack_DUDV8(const void *src, GLfloat dst[][4], GLuint n)
-{
- const GLbyte *s = (const GLbyte *) src;
- GLuint i;
- for (i = 0; i < n; i++) {
- dst[i][RCOMP] = BYTE_TO_FLOAT(s[i*2+0]);
- dst[i][GCOMP] = BYTE_TO_FLOAT(s[i*2+1]);
- dst[i][BCOMP] = 0;
- dst[i][ACOMP] = 0;
- }
-}
-
-static void
unpack_R_SNORM8(const void *src, GLfloat dst[][4], GLuint n)
{
const GLbyte *s = ((const GLbyte *) src);
@@ -2486,7 +2473,6 @@ get_unpack_rgba_function(mesa_format format)
table[MESA_FORMAT_RGB_UINT32] = unpack_RGB_UINT32;
table[MESA_FORMAT_RGBA_UINT32] = unpack_RGBA_UINT32;
- table[MESA_FORMAT_DUDV8] = unpack_DUDV8;
table[MESA_FORMAT_R_SNORM8] = unpack_R_SNORM8;
table[MESA_FORMAT_R8G8_SNORM] = unpack_R8G8_SNORM;
table[MESA_FORMAT_X8B8G8R8_SNORM] = unpack_X8B8G8R8_SNORM;
diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c
index 5c670115e..1f20a9a6a 100644
--- a/mesalib/src/mesa/main/formats.c
+++ b/mesalib/src/mesa/main/formats.c
@@ -43,7 +43,7 @@ struct gl_format_info
/**
* Base format is one of GL_RED, GL_RG, GL_RGB, GL_RGBA, GL_ALPHA,
* GL_LUMINANCE, GL_LUMINANCE_ALPHA, GL_INTENSITY, GL_YCBCR_MESA,
- * GL_DEPTH_COMPONENT, GL_STENCIL_INDEX, GL_DEPTH_STENCIL, GL_DUDV_ATI.
+ * GL_DEPTH_COMPONENT, GL_STENCIL_INDEX, GL_DEPTH_STENCIL.
*/
GLenum BaseFormat;
@@ -415,15 +415,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
/* Array unorm formats */
{
- MESA_FORMAT_DUDV8,
- "MESA_FORMAT_DUDV8",
- GL_DUDV_ATI,
- GL_SIGNED_NORMALIZED,
- 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 1, 1, 2
- },
- {
MESA_FORMAT_A_UNORM8, /* Name */
"MESA_FORMAT_A_UNORM8", /* StrName */
GL_ALPHA, /* BaseFormat */
@@ -2576,11 +2567,6 @@ _mesa_format_to_type_and_comps(mesa_format format,
*comps = 1;
return;
- case MESA_FORMAT_DUDV8:
- *datatype = GL_BYTE;
- *comps = 2;
- return;
-
case MESA_FORMAT_R_SNORM8:
case MESA_FORMAT_A_SNORM8:
case MESA_FORMAT_L_SNORM8:
@@ -3387,10 +3373,6 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format,
case MESA_FORMAT_RGBA_UINT32:
return format == GL_RGBA_INTEGER && type == GL_UNSIGNED_INT && !swapBytes;
- case MESA_FORMAT_DUDV8:
- return (format == GL_DU8DV8_ATI || format == GL_DUDV_ATI) &&
- type == GL_BYTE && littleEndian && !swapBytes;
-
case MESA_FORMAT_R_SNORM8:
return format == GL_RED && type == GL_BYTE;
case MESA_FORMAT_R8G8_SNORM:
diff --git a/mesalib/src/mesa/main/formats.h b/mesalib/src/mesa/main/formats.h
index 185010e02..dc50bc830 100644
--- a/mesalib/src/mesa/main/formats.h
+++ b/mesalib/src/mesa/main/formats.h
@@ -211,8 +211,6 @@ typedef enum
MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */
MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */
- MESA_FORMAT_DUDV8, /* DUDU DUDU DVDV DVDV */
-
/* Array unorm formats */
MESA_FORMAT_A_UNORM8, /* ubyte[i] = A */
MESA_FORMAT_A_UNORM16, /* ushort[i] = A */
diff --git a/mesalib/src/mesa/main/glformats.c b/mesalib/src/mesa/main/glformats.c
index aee336e12..304d45298 100644
--- a/mesalib/src/mesa/main/glformats.c
+++ b/mesalib/src/mesa/main/glformats.c
@@ -189,8 +189,6 @@ _mesa_components_in_format(GLenum format)
case GL_RG:
case GL_YCBCR_MESA:
case GL_DEPTH_STENCIL_EXT:
- case GL_DUDV_ATI:
- case GL_DU8DV8_ATI:
case GL_RG_INTEGER:
return 2;
@@ -817,22 +815,6 @@ _mesa_is_depth_or_stencil_format(GLenum format)
/**
- * Test if the given image format is a dudv format.
- */
-GLboolean
-_mesa_is_dudv_format(GLenum format)
-{
- switch (format) {
- case GL_DUDV_ATI:
- case GL_DU8DV8_ATI:
- return GL_TRUE;
- default:
- return GL_FALSE;
- }
-}
-
-
-/**
* Test if an image format is a supported compressed format.
* \param format the internal format token provided by the user.
* \return GL_TRUE if compressed, GL_FALSE if uncompressed
@@ -1446,23 +1428,6 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
else
return GL_INVALID_ENUM;
- case GL_DUDV_ATI:
- case GL_DU8DV8_ATI:
- if (!ctx->Extensions.ATI_envmap_bumpmap)
- return GL_INVALID_ENUM;
- switch (type) {
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- case GL_INT:
- case GL_UNSIGNED_INT:
- case GL_FLOAT:
- return GL_NO_ERROR;
- default:
- return GL_INVALID_ENUM;
- }
-
/* integer-valued formats */
case GL_RED_INTEGER_EXT:
case GL_GREEN_INTEGER_EXT:
diff --git a/mesalib/src/mesa/main/glformats.h b/mesalib/src/mesa/main/glformats.h
index ccbce2dab..d64114ec9 100644
--- a/mesalib/src/mesa/main/glformats.h
+++ b/mesalib/src/mesa/main/glformats.h
@@ -84,9 +84,6 @@ extern GLboolean
_mesa_is_depth_or_stencil_format(GLenum format);
extern GLboolean
-_mesa_is_dudv_format(GLenum format);
-
-extern GLboolean
_mesa_is_compressed_format(struct gl_context *ctx, GLenum format);
extern GLenum
diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h
index 4762d9616..eaf377610 100644
--- a/mesalib/src/mesa/main/mtypes.h
+++ b/mesalib/src/mesa/main/mtypes.h
@@ -1342,8 +1342,6 @@ struct gl_texture_unit
GLbitfield _GenFlags; /**< Bitwise-OR of Gen[STRQ]._ModeBit */
GLfloat LodBias; /**< for biasing mipmap levels */
- GLenum BumpTarget;
- GLfloat RotMatrix[4]; /* 2x2 matrix */
/** Current sampler object (GL_ARB_sampler_objects) */
struct gl_sampler_object *Sampler;
@@ -1791,6 +1789,7 @@ struct gl_transform_feedback_output
unsigned OutputRegister;
unsigned OutputBuffer;
unsigned NumComponents;
+ unsigned StreamId;
/** offset (in DWORDs) of this output within the interleaved structure */
unsigned DstOffset;
@@ -2177,6 +2176,7 @@ struct gl_geometry_program
GL_TRIANGLES, or GL_TRIANGLES_ADJACENCY_ARB */
GLenum OutputType; /**< GL_POINTS, GL_LINE_STRIP or GL_TRIANGLE_STRIP */
bool UsesEndPrimitive;
+ bool UsesStreams;
};
@@ -2680,6 +2680,7 @@ struct gl_shader_program
GLuint ClipDistanceArraySize; /**< Size of the gl_ClipDistance array, or
0 if not present. */
bool UsesEndPrimitive;
+ bool UsesStreams;
} Geom;
/** Vertex shader state */
@@ -2892,6 +2893,7 @@ struct gl_query_object
GLboolean Active; /**< inside Begin/EndQuery */
GLboolean Ready; /**< result is ready? */
GLboolean EverBound;/**< has query object ever been bound */
+ GLuint Stream; /**< The stream */
};
@@ -2908,8 +2910,8 @@ struct gl_query_state
struct gl_query_object *CondRenderQuery;
/** GL_EXT_transform_feedback */
- struct gl_query_object *PrimitivesGenerated;
- struct gl_query_object *PrimitivesWritten;
+ struct gl_query_object *PrimitivesGenerated[MAX_VERTEX_STREAMS];
+ struct gl_query_object *PrimitivesWritten[MAX_VERTEX_STREAMS];
/** GL_ARB_timer_query */
struct gl_query_object *TimeElapsed;
@@ -3358,9 +3360,6 @@ struct gl_constants
*/
GLuint UniformBooleanTrue;
- /** Which texture units support GL_ATI_envmap_bumpmap as targets */
- GLbitfield SupportedBumpUnits;
-
/**
* Maximum amount of time, measured in nanseconds, that the server can wait.
*/
@@ -3618,7 +3617,6 @@ struct gl_extensions
GLboolean AMD_seamless_cubemap_per_texture;
GLboolean AMD_vertex_shader_layer;
GLboolean APPLE_object_purgeable;
- GLboolean ATI_envmap_bumpmap;
GLboolean ATI_texture_compression_3dc;
GLboolean ATI_texture_mirror_once;
GLboolean ATI_texture_env_combine3;
diff --git a/mesalib/src/mesa/main/pack.c b/mesalib/src/mesa/main/pack.c
index 1df656832..5ebaaf6e5 100644
--- a/mesalib/src/mesa/main/pack.c
+++ b/mesalib/src/mesa/main/pack.c
@@ -420,11 +420,6 @@ get_component_indexes(GLenum format,
*blueIndex = 1;
*alphaIndex = 0;
break;
- case GL_DU8DV8_ATI:
- case GL_DUDV_ATI:
- *redIndex = 0;
- *greenIndex = 1;
- break;
default:
assert(0 && "bad format in get_component_indexes()");
}
@@ -1471,13 +1466,6 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
rgba[i][BCOMP]);
}
break;
- case GL_DUDV_ATI:
- case GL_DU8DV8_ATI:
- for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_UBYTE(rgba[i][RCOMP]);
- dst[i*2+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]);
- }
- break;
default:
_mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
}
@@ -1628,13 +1616,6 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
rgba[i][BCOMP]);
}
break;
- case GL_DUDV_ATI:
- case GL_DU8DV8_ATI:
- for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_BYTE_TEX(rgba[i][RCOMP]);
- dst[i*2+1] = FLOAT_TO_BYTE_TEX(rgba[i][GCOMP]);
- }
- break;
default:
_mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
}
@@ -1785,13 +1766,6 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
rgba[i][BCOMP]);
}
break;
- case GL_DUDV_ATI:
- case GL_DU8DV8_ATI:
- for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_USHORT(rgba[i][RCOMP]);
- dst[i*2+1] = FLOAT_TO_USHORT(rgba[i][GCOMP]);
- }
- break;
default:
_mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
}
@@ -1942,13 +1916,6 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
rgba[i][BCOMP]);
}
break;
- case GL_DUDV_ATI:
- case GL_DU8DV8_ATI:
- for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_SHORT_TEX(rgba[i][RCOMP]);
- dst[i*2+1] = FLOAT_TO_SHORT_TEX(rgba[i][GCOMP]);
- }
- break;
default:
_mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
}
@@ -2099,13 +2066,6 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
rgba[i][BCOMP]);
}
break;
- case GL_DUDV_ATI:
- case GL_DU8DV8_ATI:
- for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_UINT(rgba[i][RCOMP]);
- dst[i*2+1] = FLOAT_TO_UINT(rgba[i][GCOMP]);
- }
- break;
default:
_mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
}
@@ -2185,13 +2145,6 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
dst[i*4+3] = FLOAT_TO_INT(rgba[i][RCOMP]);
}
break;
- case GL_DUDV_ATI:
- case GL_DU8DV8_ATI:
- for (i=0;i<n;i++) {
- dst[i*2+0] = FLOAT_TO_INT(rgba[i][RCOMP]);
- dst[i*2+1] = FLOAT_TO_INT(rgba[i][GCOMP]);
- }
- break;
case GL_RED_INTEGER_EXT:
for (i=0;i<n;i++) {
dst[i] = (GLint) rgba[i][RCOMP];
@@ -2342,13 +2295,6 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
dst[i*4+3] = rgba[i][RCOMP];
}
break;
- case GL_DUDV_ATI:
- case GL_DU8DV8_ATI:
- for (i=0;i<n;i++) {
- dst[i*2+0] = rgba[i][RCOMP];
- dst[i*2+1] = rgba[i][GCOMP];
- }
- break;
default:
_mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
}
@@ -2428,13 +2374,6 @@ _mesa_pack_rgba_span_float(struct gl_context *ctx, GLuint n, GLfloat rgba[][4],
dst[i*4+3] = _mesa_float_to_half(rgba[i][RCOMP]);
}
break;
- case GL_DUDV_ATI:
- case GL_DU8DV8_ATI:
- for (i=0;i<n;i++) {
- dst[i*2+0] = _mesa_float_to_half(rgba[i][RCOMP]);
- dst[i*2+1] = _mesa_float_to_half(rgba[i][GCOMP]);
- }
- break;
default:
_mesa_problem(ctx, "bad format in _mesa_pack_rgba_span\n");
}
@@ -3095,13 +3034,6 @@ get_component_mapping(GLenum format,
*bDst = 1;
*aDst = 0;
break;
- case GL_DU8DV8_ATI:
- case GL_DUDV_ATI:
- *rSrc = 0;
- *gSrc = 1;
- *bSrc = -1;
- *aSrc = -1;
- break;
default:
_mesa_problem(NULL, "bad srcFormat %s in get_component_mapping",
_mesa_lookup_enum_by_nr(format));
@@ -3151,8 +3083,6 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4],
srcFormat == GL_RGBA ||
srcFormat == GL_BGRA ||
srcFormat == GL_ABGR_EXT ||
- srcFormat == GL_DU8DV8_ATI ||
- srcFormat == GL_DUDV_ATI ||
srcFormat == GL_RED_INTEGER_EXT ||
srcFormat == GL_GREEN_INTEGER_EXT ||
srcFormat == GL_BLUE_INTEGER_EXT ||
@@ -3768,8 +3698,6 @@ extract_uint_rgba(GLuint n, GLuint rgba[][4],
srcFormat == GL_RGBA ||
srcFormat == GL_BGRA ||
srcFormat == GL_ABGR_EXT ||
- srcFormat == GL_DU8DV8_ATI ||
- srcFormat == GL_DUDV_ATI ||
srcFormat == GL_RED_INTEGER_EXT ||
srcFormat == GL_RG_INTEGER ||
srcFormat == GL_GREEN_INTEGER_EXT ||
@@ -4846,71 +4774,6 @@ _mesa_unpack_color_span_uint(struct gl_context *ctx,
}
-
-/**
- * Similar to _mesa_unpack_color_span_float(), but for dudv data instead of rgba,
- * directly return GLbyte data, no transfer ops apply.
- */
-void
-_mesa_unpack_dudv_span_byte( struct gl_context *ctx,
- GLuint n, GLenum dstFormat, GLbyte dest[],
- GLenum srcFormat, GLenum srcType,
- const GLvoid *source,
- const struct gl_pixelstore_attrib *srcPacking,
- GLbitfield transferOps )
-{
- ASSERT(dstFormat == GL_DUDV_ATI);
- ASSERT(srcFormat == GL_DUDV_ATI ||
- srcFormat == GL_DU8DV8_ATI);
-
- ASSERT(srcType == GL_UNSIGNED_BYTE ||
- srcType == GL_BYTE ||
- srcType == GL_UNSIGNED_SHORT ||
- srcType == GL_SHORT ||
- srcType == GL_UNSIGNED_INT ||
- srcType == GL_INT ||
- srcType == GL_HALF_FLOAT_ARB ||
- srcType == GL_FLOAT);
-
- /* general solution */
- {
- GLint dstComponents;
- GLbyte *dst = dest;
- GLuint i;
- GLfloat (*rgba)[4] = malloc(4 * n * sizeof(GLfloat));
-
- if (!rgba) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "pixel unpacking");
- return;
- }
-
- dstComponents = _mesa_components_in_format( dstFormat );
- /* source & dest image formats should have been error checked by now */
- assert(dstComponents > 0);
-
- /*
- * Extract image data and convert to RGBA floats
- */
- extract_float_rgba(n, rgba, srcFormat, srcType, source,
- srcPacking->SwapBytes);
-
-
- /* Now determine which color channels we need to produce.
- * And determine the dest index (offset) within each color tuple.
- */
-
- /* Now pack results in the requested dstFormat */
- for (i = 0; i < n; i++) {
- /* not sure - need clamp[-1,1] here? */
- dst[0] = FLOAT_TO_BYTE(rgba[i][RCOMP]);
- dst[1] = FLOAT_TO_BYTE(rgba[i][GCOMP]);
- dst += dstComponents;
- }
-
- free(rgba);
- }
-}
-
/*
* Unpack a row of color index data from a client buffer according to
* the pixel unpacking parameters.
diff --git a/mesalib/src/mesa/main/pack.h b/mesalib/src/mesa/main/pack.h
index ad357bae1..2173b652e 100644
--- a/mesalib/src/mesa/main/pack.h
+++ b/mesalib/src/mesa/main/pack.h
@@ -83,14 +83,6 @@ _mesa_unpack_color_span_uint(struct gl_context *ctx,
const struct gl_pixelstore_attrib *srcPacking);
extern void
-_mesa_unpack_dudv_span_byte(struct gl_context *ctx,
- GLuint n, GLenum dstFormat, GLbyte dest[],
- GLenum srcFormat, GLenum srcType,
- const GLvoid *source,
- const struct gl_pixelstore_attrib *srcPacking,
- GLbitfield transferOps);
-
-extern void
_mesa_unpack_index_span(struct gl_context *ctx, GLuint n,
GLenum dstType, GLvoid *dest,
GLenum srcType, const GLvoid *source,
diff --git a/mesalib/src/mesa/main/queryobj.c b/mesalib/src/mesa/main/queryobj.c
index 86e7c3ad0..932359c4e 100644
--- a/mesalib/src/mesa/main/queryobj.c
+++ b/mesalib/src/mesa/main/queryobj.c
@@ -144,11 +144,12 @@ _mesa_init_query_object_functions(struct dd_function_table *driver)
/**
- * Return pointer to the query object binding point for the given target.
+ * Return pointer to the query object binding point for the given target and
+ * index.
* \return NULL if invalid target, else the address of binding point
*/
static struct gl_query_object **
-get_query_binding_point(struct gl_context *ctx, GLenum target)
+get_query_binding_point(struct gl_context *ctx, GLenum target, GLuint index)
{
switch (target) {
case GL_SAMPLES_PASSED_ARB:
@@ -174,12 +175,12 @@ get_query_binding_point(struct gl_context *ctx, GLenum target)
return NULL;
case GL_PRIMITIVES_GENERATED:
if (ctx->Extensions.EXT_transform_feedback)
- return &ctx->Query.PrimitivesGenerated;
+ return &ctx->Query.PrimitivesGenerated[index];
else
return NULL;
case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
if (ctx->Extensions.EXT_transform_feedback)
- return &ctx->Query.PrimitivesWritten;
+ return &ctx->Query.PrimitivesWritten[index];
else
return NULL;
default:
@@ -240,7 +241,7 @@ _mesa_DeleteQueries(GLsizei n, const GLuint *ids)
if (q) {
if (q->Active) {
struct gl_query_object **bindpt;
- bindpt = get_query_binding_point(ctx, q->Target);
+ bindpt = get_query_binding_point(ctx, q->Target, q->Stream);
assert(bindpt); /* Should be non-null for active q. */
if (bindpt) {
*bindpt = NULL;
@@ -313,7 +314,7 @@ _mesa_BeginQueryIndexed(GLenum target, GLuint index, GLuint id)
FLUSH_VERTICES(ctx, 0);
- bindpt = get_query_binding_point(ctx, target);
+ bindpt = get_query_binding_point(ctx, target, index);
if (!bindpt) {
_mesa_error(ctx, GL_INVALID_ENUM, "glBeginQuery{Indexed}(target)");
return;
@@ -367,6 +368,7 @@ _mesa_BeginQueryIndexed(GLenum target, GLuint index, GLuint id)
q->Result = 0;
q->Ready = GL_FALSE;
q->EverBound = GL_TRUE;
+ q->Stream = index;
/* XXX should probably refcount query objects */
*bindpt = q;
@@ -390,7 +392,7 @@ _mesa_EndQueryIndexed(GLenum target, GLuint index)
FLUSH_VERTICES(ctx, 0);
- bindpt = get_query_binding_point(ctx, target);
+ bindpt = get_query_binding_point(ctx, target, index);
if (!bindpt) {
_mesa_error(ctx, GL_INVALID_ENUM, "glEndQuery{Indexed}(target)");
return;
@@ -517,7 +519,7 @@ _mesa_GetQueryIndexediv(GLenum target, GLuint index, GLenum pname,
}
}
else {
- bindpt = get_query_binding_point(ctx, target);
+ bindpt = get_query_binding_point(ctx, target, index);
if (!bindpt) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetQuery{Indexed}iv(target)");
return;
diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c
index 2ec2444da..2bbef35d3 100644
--- a/mesalib/src/mesa/main/shaderapi.c
+++ b/mesalib/src/mesa/main/shaderapi.c
@@ -1888,6 +1888,7 @@ _mesa_copy_linked_program_data(gl_shader_stage type,
dst_gp->OutputType = src->Geom.OutputType;
dst->UsesClipDistanceOut = src->Geom.UsesClipDistance;
dst_gp->UsesEndPrimitive = src->Geom.UsesEndPrimitive;
+ dst_gp->UsesStreams = src->Geom.UsesStreams;
}
break;
case MESA_SHADER_FRAGMENT: {
diff --git a/mesalib/src/mesa/main/shaderobj.c b/mesalib/src/mesa/main/shaderobj.c
index c6e852c87..b9feff4a4 100644
--- a/mesalib/src/mesa/main/shaderobj.c
+++ b/mesalib/src/mesa/main/shaderobj.c
@@ -249,6 +249,7 @@ _mesa_init_shader_program(struct gl_context *ctx, struct gl_shader_program *prog
prog->Geom.InputType = GL_TRIANGLES;
prog->Geom.OutputType = GL_TRIANGLE_STRIP;
prog->Geom.UsesEndPrimitive = false;
+ prog->Geom.UsesStreams = false;
prog->TransformFeedback.BufferMode = GL_INTERLEAVED_ATTRIBS;
diff --git a/mesalib/src/mesa/main/texenv.c b/mesalib/src/mesa/main/texenv.c
index 4848208f5..ec521e6c6 100644
--- a/mesalib/src/mesa/main/texenv.c
+++ b/mesalib/src/mesa/main/texenv.c
@@ -138,11 +138,6 @@ set_combiner_mode(struct gl_context *ctx,
legal = (ctx->API == API_OPENGL_COMPAT &&
ctx->Extensions.ATI_texture_env_combine3);
break;
- case GL_BUMP_ENVMAP_ATI:
- legal = (ctx->API == API_OPENGL_COMPAT &&
- ctx->Extensions.ATI_envmap_bumpmap &&
- pname == GL_COMBINE_RGB);
- break;
default:
legal = GL_FALSE;
}
@@ -440,26 +435,6 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
case GL_ALPHA_SCALE:
set_combiner_scale(ctx, texUnit, pname, param[0]);
break;
- case GL_BUMP_TARGET_ATI:
- if (ctx->API != API_OPENGL_COMPAT || !ctx->Extensions.ATI_envmap_bumpmap) {
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname=0x%x)", pname );
- return;
- }
- if ((iparam0 < GL_TEXTURE0) ||
- (iparam0 > GL_TEXTURE31)) {
- /* spec doesn't say this but it seems logical */
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(param=0x%x)", iparam0);
- return;
- }
- if (!((1 << (iparam0 - GL_TEXTURE0)) & ctx->Const.SupportedBumpUnits)) {
- _mesa_error( ctx, GL_INVALID_VALUE, "glTexEnv(param=0x%x)", iparam0);
- return;
- }
- else {
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- texUnit->BumpTarget = iparam0;
- }
- break;
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" );
return;
@@ -641,16 +616,6 @@ get_texenvi(struct gl_context *ctx, const struct gl_texture_unit *texUnit,
return 1 << texUnit->Combine.ScaleShiftRGB;
case GL_ALPHA_SCALE:
return 1 << texUnit->Combine.ScaleShiftA;
- case GL_BUMP_TARGET_ATI:
- /* spec doesn't say so, but I think this should be queryable */
- if (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.ATI_envmap_bumpmap) {
- return texUnit->BumpTarget;
- }
- else {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
- }
- break;
-
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetTexEnvfv(pname)");
break;
@@ -784,166 +749,3 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
}
}
-
-/**
- * Why does ATI_envmap_bumpmap require new entrypoints? Should just
- * reuse TexEnv ones...
- */
-void GLAPIENTRY
-_mesa_TexBumpParameterivATI( GLenum pname, const GLint *param )
-{
- GLfloat p[4];
- GET_CURRENT_CONTEXT(ctx);
-
- if (!ctx->Extensions.ATI_envmap_bumpmap) {
- /* This isn't an "official" error case, but let's tell the user
- * that something's wrong.
- */
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTexBumpParameterivATI");
- return;
- }
-
- if (pname == GL_BUMP_ROT_MATRIX_ATI) {
- /* hope that conversion is correct here */
- p[0] = INT_TO_FLOAT( param[0] );
- p[1] = INT_TO_FLOAT( param[1] );
- p[2] = INT_TO_FLOAT( param[2] );
- p[3] = INT_TO_FLOAT( param[3] );
- }
- else {
- p[0] = (GLfloat) param[0];
- p[1] = p[2] = p[3] = 0.0F; /* init to zero, just to be safe */
- }
- _mesa_TexBumpParameterfvATI( pname, p );
-}
-
-
-void GLAPIENTRY
-_mesa_TexBumpParameterfvATI( GLenum pname, const GLfloat *param )
-{
- struct gl_texture_unit *texUnit;
- GET_CURRENT_CONTEXT(ctx);
-
- if (!ctx->Extensions.ATI_envmap_bumpmap) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTexBumpParameterfvATI");
- return;
- }
-
- texUnit = _mesa_get_current_tex_unit(ctx);
-
- if (pname == GL_BUMP_ROT_MATRIX_ATI) {
- if (TEST_EQ_4V(param, texUnit->RotMatrix))
- return;
- FLUSH_VERTICES(ctx, _NEW_TEXTURE);
- COPY_4FV(texUnit->RotMatrix, param);
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glTexBumpParameter(pname)" );
- return;
- }
- /* Drivers might want to know about this, instead of dedicated function
- just shove it into TexEnv where it really belongs anyway */
- if (ctx->Driver.TexEnv) {
- (*ctx->Driver.TexEnv)( ctx, 0, pname, param );
- }
-}
-
-
-void GLAPIENTRY
-_mesa_GetTexBumpParameterivATI( GLenum pname, GLint *param )
-{
- const struct gl_texture_unit *texUnit;
- GLuint i;
- GET_CURRENT_CONTEXT(ctx);
-
- if (!ctx->Extensions.ATI_envmap_bumpmap) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexBumpParameterivATI");
- return;
- }
-
- texUnit = _mesa_get_current_tex_unit(ctx);
-
- if (pname == GL_BUMP_ROT_MATRIX_SIZE_ATI) {
- /* spec leaves open to support larger matrices.
- Don't think anyone would ever want to use it
- (and apps almost certainly would not understand it and
- thus fail to submit matrices correctly) so hardcode this. */
- *param = 4;
- }
- else if (pname == GL_BUMP_ROT_MATRIX_ATI) {
- /* hope that conversion is correct here */
- param[0] = FLOAT_TO_INT(texUnit->RotMatrix[0]);
- param[1] = FLOAT_TO_INT(texUnit->RotMatrix[1]);
- param[2] = FLOAT_TO_INT(texUnit->RotMatrix[2]);
- param[3] = FLOAT_TO_INT(texUnit->RotMatrix[3]);
- }
- else if (pname == GL_BUMP_NUM_TEX_UNITS_ATI) {
- GLint count = 0;
- for (i = 0; i < ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits; i++) {
- if (ctx->Const.SupportedBumpUnits & (1 << i)) {
- count++;
- }
- }
- *param = count;
- }
- else if (pname == GL_BUMP_TEX_UNITS_ATI) {
- for (i = 0; i < ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits; i++) {
- if (ctx->Const.SupportedBumpUnits & (1 << i)) {
- *param++ = i + GL_TEXTURE0;
- }
- }
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexBumpParameter(pname)" );
- return;
- }
-}
-
-
-void GLAPIENTRY
-_mesa_GetTexBumpParameterfvATI( GLenum pname, GLfloat *param )
-{
- const struct gl_texture_unit *texUnit;
- GLuint i;
- GET_CURRENT_CONTEXT(ctx);
-
- if (!ctx->Extensions.ATI_envmap_bumpmap) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexBumpParameterfvATI");
- return;
- }
-
- texUnit = _mesa_get_current_tex_unit(ctx);
-
- if (pname == GL_BUMP_ROT_MATRIX_SIZE_ATI) {
- /* spec leaves open to support larger matrices.
- Don't think anyone would ever want to use it
- (and apps might not understand it) so hardcode this. */
- *param = 4.0F;
- }
- else if (pname == GL_BUMP_ROT_MATRIX_ATI) {
- param[0] = texUnit->RotMatrix[0];
- param[1] = texUnit->RotMatrix[1];
- param[2] = texUnit->RotMatrix[2];
- param[3] = texUnit->RotMatrix[3];
- }
- else if (pname == GL_BUMP_NUM_TEX_UNITS_ATI) {
- GLint count = 0;
- for (i = 0; i < ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits; i++) {
- if (ctx->Const.SupportedBumpUnits & (1 << i)) {
- count++;
- }
- }
- *param = (GLfloat) count;
- }
- else if (pname == GL_BUMP_TEX_UNITS_ATI) {
- for (i = 0; i < ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits; i++) {
- if (ctx->Const.SupportedBumpUnits & (1 << i)) {
- *param++ = (GLfloat) (i + GL_TEXTURE0);
- }
- }
- }
- else {
- _mesa_error( ctx, GL_INVALID_ENUM, "glGetTexBumpParameter(pname)" );
- return;
- }
-}
diff --git a/mesalib/src/mesa/main/texenv.h b/mesalib/src/mesa/main/texenv.h
index 46a7ec4e2..4aa3cb179 100644
--- a/mesalib/src/mesa/main/texenv.h
+++ b/mesalib/src/mesa/main/texenv.h
@@ -48,16 +48,4 @@ _mesa_TexEnvi( GLenum target, GLenum pname, GLint param );
extern void GLAPIENTRY
_mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param );
-extern void GLAPIENTRY
-_mesa_TexBumpParameterivATI( GLenum pname, const GLint *param );
-
-extern void GLAPIENTRY
-_mesa_TexBumpParameterfvATI( GLenum pname, const GLfloat *param );
-
-extern void GLAPIENTRY
-_mesa_GetTexBumpParameterivATI( GLenum pname, GLint *param );
-
-extern void GLAPIENTRY
-_mesa_GetTexBumpParameterfvATI( GLenum pname, GLfloat *param );
-
#endif /* TEXENV_H */
diff --git a/mesalib/src/mesa/main/texformat.c b/mesalib/src/mesa/main/texformat.c
index d43480482..c61a74859 100644
--- a/mesalib/src/mesa/main/texformat.c
+++ b/mesalib/src/mesa/main/texformat.c
@@ -440,11 +440,6 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_Z32_FLOAT_S8X24_UINT]);
return MESA_FORMAT_Z32_FLOAT_S8X24_UINT;
- case GL_DUDV_ATI:
- case GL_DU8DV8_ATI:
- RETURN_IF_SUPPORTED(MESA_FORMAT_DUDV8);
- break;
-
case GL_RED_SNORM:
case GL_R8_SNORM:
RETURN_IF_SUPPORTED(MESA_FORMAT_R_SNORM8);
diff --git a/mesalib/src/mesa/main/texgetimage.c b/mesalib/src/mesa/main/texgetimage.c
index 8c0d3a18e..f1e09c986 100644
--- a/mesalib/src/mesa/main/texgetimage.c
+++ b/mesalib/src/mesa/main/texgetimage.c
@@ -859,11 +859,6 @@ getteximage_error_check(struct gl_context *ctx, GLenum target, GLint level,
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
return GL_TRUE;
}
- else if (_mesa_is_dudv_format(format)
- && !_mesa_is_dudv_format(baseFormat)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
- return GL_TRUE;
- }
else if (_mesa_is_enum_format_integer(format) !=
_mesa_is_format_integer(texImage->TexFormat)) {
_mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)");
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index cab29c35d..a06959463 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -255,16 +255,6 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat )
}
}
- if (ctx->Extensions.ATI_envmap_bumpmap) {
- switch (internalFormat) {
- case GL_DUDV_ATI:
- case GL_DU8DV8_ATI:
- return GL_DUDV_ATI;
- default:
- ; /* fallthrough */
- }
- }
-
if (ctx->Extensions.EXT_texture_snorm) {
switch (internalFormat) {
case GL_RED_SNORM:
@@ -2157,8 +2147,7 @@ texture_error_check( struct gl_context *ctx,
colorFormat = _mesa_is_color_format(format);
if ((_mesa_is_color_format(internalFormat) && !colorFormat && !indexFormat) ||
(is_internalFormat_depth_or_depthstencil != is_format_depth_or_depthstencil) ||
- (_mesa_is_ycbcr_format(internalFormat) != _mesa_is_ycbcr_format(format)) ||
- (_mesa_is_dudv_format(internalFormat) != _mesa_is_dudv_format(format))) {
+ (_mesa_is_ycbcr_format(internalFormat) != _mesa_is_ycbcr_format(format))) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glTexImage%dD(incompatible internalFormat = %s, format = %s)",
dimensions, _mesa_lookup_enum_by_nr(internalFormat),
diff --git a/mesalib/src/mesa/main/texstate.c b/mesalib/src/mesa/main/texstate.c
index 19508cf39..e0f085218 100644
--- a/mesalib/src/mesa/main/texstate.c
+++ b/mesalib/src/mesa/main/texstate.c
@@ -91,10 +91,6 @@ _mesa_copy_texture_state( const struct gl_context *src, struct gl_context *dst )
/* GL_EXT_texture_env_combine */
dst->Texture.Unit[u].Combine = src->Texture.Unit[u].Combine;
- /* GL_ATI_envmap_bumpmap - need this? */
- dst->Texture.Unit[u].BumpTarget = src->Texture.Unit[u].BumpTarget;
- COPY_4V(dst->Texture.Unit[u].RotMatrix, src->Texture.Unit[u].RotMatrix);
-
/*
* XXX strictly speaking, we should compare texture names/ids and
* bind textures in the dest context according to id. For now, only
@@ -188,7 +184,6 @@ calculate_derived_texenv( struct gl_tex_env_combine_state *state,
case GL_RG:
case GL_RGB:
case GL_YCBCR_MESA:
- case GL_DUDV_ATI:
state->SourceA[0] = GL_PREVIOUS;
break;
@@ -230,7 +225,6 @@ calculate_derived_texenv( struct gl_tex_env_combine_state *state,
case GL_RG:
case GL_RGB:
case GL_YCBCR_MESA:
- case GL_DUDV_ATI:
mode_rgb = GL_REPLACE;
break;
case GL_RGBA:
@@ -259,7 +253,6 @@ calculate_derived_texenv( struct gl_tex_env_combine_state *state,
case GL_LUMINANCE_ALPHA:
case GL_RGBA:
case GL_YCBCR_MESA:
- case GL_DUDV_ATI:
state->SourceRGB[2] = GL_TEXTURE;
state->SourceA[2] = GL_TEXTURE;
state->SourceRGB[0] = GL_CONSTANT;
@@ -443,10 +436,6 @@ update_tex_combine(struct gl_context *ctx, struct gl_texture_unit *texUnit)
case GL_MODULATE_SUBTRACT_ATI:
combine->_NumArgsRGB = 3;
break;
- case GL_BUMP_ENVMAP_ATI:
- /* no real arguments for this case */
- combine->_NumArgsRGB = 0;
- break;
default:
combine->_NumArgsRGB = 0;
_mesa_problem(ctx, "invalid RGB combine mode in update_texture_state");
@@ -848,7 +837,6 @@ init_texture_unit( struct gl_context *ctx, GLuint unit )
texUnit->Combine = default_combine_state;
texUnit->_EnvMode = default_combine_state;
texUnit->_CurrentCombine = & texUnit->_EnvMode;
- texUnit->BumpTarget = GL_TEXTURE0;
texUnit->TexGenEnabled = 0x0;
texUnit->GenS.Mode = GL_EYE_LINEAR;
@@ -870,9 +858,6 @@ init_texture_unit( struct gl_context *ctx, GLuint unit )
ASSIGN_4V( texUnit->GenR.EyePlane, 0.0, 0.0, 0.0, 0.0 );
ASSIGN_4V( texUnit->GenQ.EyePlane, 0.0, 0.0, 0.0, 0.0 );
- /* no mention of this in spec, but maybe id matrix expected? */
- ASSIGN_4V( texUnit->RotMatrix, 1.0, 0.0, 0.0, 1.0 );
-
/* initialize current texture object ptrs to the shared default objects */
for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) {
_mesa_reference_texobj(&texUnit->CurrentTex[tex],
diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c
index cb81f3fde..d363f9faa 100644
--- a/mesalib/src/mesa/main/texstore.c
+++ b/mesalib/src/mesa/main/texstore.c
@@ -2061,83 +2061,6 @@ _mesa_texstore_ycbcr(TEXSTORE_PARAMS)
return GL_TRUE;
}
-static GLboolean
-_mesa_texstore_dudv8(TEXSTORE_PARAMS)
-{
- const GLboolean littleEndian = _mesa_little_endian();
- const GLuint texelBytes = _mesa_get_format_bytes(dstFormat);
-
- ASSERT(dstFormat == MESA_FORMAT_DUDV8);
- ASSERT(texelBytes == 2);
- ASSERT(ctx->Extensions.ATI_envmap_bumpmap);
- ASSERT((srcFormat == GL_DU8DV8_ATI) ||
- (srcFormat == GL_DUDV_ATI));
- ASSERT(baseInternalFormat == GL_DUDV_ATI);
-
- if (srcType == GL_BYTE) {
- GLubyte dstmap[4];
-
- /* dstmap - how to swizzle from RGBA to dst format:
- */
- if (littleEndian) {
- dstmap[0] = 0;
- dstmap[1] = 3;
- }
- else {
- dstmap[0] = 3;
- dstmap[1] = 0;
- }
- dstmap[2] = ZERO; /* ? */
- dstmap[3] = ONE; /* ? */
-
- _mesa_swizzle_ubyte_image(ctx, dims,
- GL_LUMINANCE_ALPHA, /* hack */
- GL_UNSIGNED_BYTE, /* hack */
- GL_LUMINANCE_ALPHA, /* hack */
- dstmap, 2,
- dstRowStride, dstSlices,
- srcWidth, srcHeight, srcDepth, srcAddr,
- srcPacking);
- }
- else {
- /* general path - note this is defined for 2d textures only */
- const GLint components = _mesa_components_in_format(baseInternalFormat);
- const GLint srcStride = _mesa_image_row_stride(srcPacking, srcWidth,
- srcFormat, srcType);
- GLbyte *tempImage, *dst, *src;
- GLint row;
-
- tempImage = malloc(srcWidth * srcHeight * srcDepth
- * components * sizeof(GLbyte));
- if (!tempImage)
- return GL_FALSE;
-
- src = (GLbyte *) _mesa_image_address(dims, srcPacking, srcAddr,
- srcWidth, srcHeight,
- srcFormat, srcType,
- 0, 0, 0);
-
- dst = tempImage;
- for (row = 0; row < srcHeight; row++) {
- _mesa_unpack_dudv_span_byte(ctx, srcWidth, baseInternalFormat,
- dst, srcFormat, srcType, src,
- srcPacking, 0);
- dst += srcWidth * components;
- src += srcStride;
- }
-
- src = tempImage;
- dst = (GLbyte *) dstSlices[0];
- for (row = 0; row < srcHeight; row++) {
- memcpy(dst, src, srcWidth * texelBytes);
- dst += dstRowStride;
- src += srcWidth * texelBytes;
- }
- free((void *) tempImage);
- }
- return GL_TRUE;
-}
-
/**
* Store a texture in a signed normalized 8-bit format.
@@ -3723,7 +3646,6 @@ _mesa_get_texstore_func(mesa_format format)
table[MESA_FORMAT_R_FLOAT16] = _mesa_texstore_rgba_float16;
table[MESA_FORMAT_RG_FLOAT32] = _mesa_texstore_rgba_float32;
table[MESA_FORMAT_RG_FLOAT16] = _mesa_texstore_rgba_float16;
- table[MESA_FORMAT_DUDV8] = _mesa_texstore_dudv8;
table[MESA_FORMAT_R_SNORM8] = _mesa_texstore_snorm8;
table[MESA_FORMAT_R8G8_SNORM] = _mesa_texstore_snorm88;
table[MESA_FORMAT_X8B8G8R8_SNORM] = _mesa_texstore_signed_rgbx8888;
diff --git a/mesalib/src/mesa/main/vdpau.c b/mesalib/src/mesa/main/vdpau.c
index d97459393..975b812cd 100644
--- a/mesalib/src/mesa/main/vdpau.c
+++ b/mesalib/src/mesa/main/vdpau.c
@@ -132,6 +132,11 @@ register_surface(struct gl_context *ctx, GLboolean isOutput,
}
surf = CALLOC_STRUCT( vdp_surface );
+ if (surf == NULL) {
+ _mesa_error_no_memory("VDPAURegisterSurfaceNV");
+ return (GLintptr)NULL;
+ }
+
surf->vdpSurface = vdpSurface;
surf->target = target;
surf->access = GL_READ_WRITE;
@@ -140,6 +145,12 @@ register_surface(struct gl_context *ctx, GLboolean isOutput,
for (i = 0; i < numTextureNames; ++i) {
struct gl_texture_object *tex;
tex = _mesa_lookup_texture(ctx, textureNames[i]);
+ if (tex == NULL) {
+ free(surf);
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "VDPAURegisterSurfaceNV(texture ID not found)");
+ return (GLintptr)NULL;
+ }
_mesa_lock_texture(ctx, tex);
diff --git a/mesalib/src/mesa/program/prog_statevars.c b/mesalib/src/mesa/program/prog_statevars.c
index 5dda8e28d..be5ddb106 100644
--- a/mesalib/src/mesa/program/prog_statevars.c
+++ b/mesalib/src/mesa/program/prog_statevars.c
@@ -593,28 +593,6 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
}
return;
- case STATE_ROT_MATRIX_0:
- {
- const int unit = (int) state[2];
- GLfloat *rotMat22 = ctx->Texture.Unit[unit].RotMatrix;
- value[0] = rotMat22[0];
- value[1] = rotMat22[2];
- value[2] = 0.0;
- value[3] = 0.0;
- }
- return;
-
- case STATE_ROT_MATRIX_1:
- {
- const int unit = (int) state[2];
- GLfloat *rotMat22 = ctx->Texture.Unit[unit].RotMatrix;
- value[0] = rotMat22[1];
- value[1] = rotMat22[3];
- value[2] = 0.0;
- value[3] = 0.0;
- }
- return;
-
/* XXX: make sure new tokens added here are also handled in the
* _mesa_program_state_flags() switch, below.
*/
@@ -706,8 +684,6 @@ _mesa_program_state_flags(const gl_state_index state[STATE_LENGTH])
return _NEW_MODELVIEW;
case STATE_TEXRECT_SCALE:
- case STATE_ROT_MATRIX_0:
- case STATE_ROT_MATRIX_1:
return _NEW_TEXTURE;
case STATE_FOG_PARAMS_OPTIMIZED:
return _NEW_FOG;
@@ -933,12 +909,6 @@ append_token(char *dst, gl_state_index k)
case STATE_FB_WPOS_Y_TRANSFORM:
append(dst, "FbWposYTransform");
break;
- case STATE_ROT_MATRIX_0:
- append(dst, "rotMatrixRow0");
- break;
- case STATE_ROT_MATRIX_1:
- append(dst, "rotMatrixRow1");
- break;
default:
/* probably STATE_INTERNAL_DRIVER+i (driver private state) */
append(dst, "driverState");
diff --git a/mesalib/src/mesa/program/prog_statevars.h b/mesalib/src/mesa/program/prog_statevars.h
index 23a9f48c3..6333e6328 100644
--- a/mesalib/src/mesa/program/prog_statevars.h
+++ b/mesalib/src/mesa/program/prog_statevars.h
@@ -128,8 +128,6 @@ typedef enum gl_state_index_ {
STATE_PT_BIAS, /**< Pixel transfer RGBA bias */
STATE_FB_SIZE, /**< (width-1, height-1, 0, 0) */
STATE_FB_WPOS_Y_TRANSFORM, /**< (1, 0, -1, height) if a FBO is bound, (-1, height, 1, 0) otherwise */
- STATE_ROT_MATRIX_0, /**< ATI_envmap_bumpmap, rot matrix row 0 */
- STATE_ROT_MATRIX_1, /**< ATI_envmap_bumpmap, rot matrix row 1 */
STATE_INTERNAL_DRIVER /* first available state index for drivers (must be last) */
} gl_state_index;
diff --git a/mesalib/src/mesa/program/program.c b/mesalib/src/mesa/program/program.c
index 988def1a3..aedce3e3c 100644
--- a/mesalib/src/mesa/program/program.c
+++ b/mesalib/src/mesa/program/program.c
@@ -553,6 +553,7 @@ _mesa_clone_program(struct gl_context *ctx, const struct gl_program *prog)
gpc->Invocations = gp->Invocations;
gpc->OutputType = gp->OutputType;
gpc->UsesEndPrimitive = gp->UsesEndPrimitive;
+ gpc->UsesStreams = gp->UsesStreams;
}
break;
default:
diff --git a/mesalib/src/mesa/swrast/s_texcombine.c b/mesalib/src/mesa/swrast/s_texcombine.c
index c1a152aa8..def5eb19e 100644
--- a/mesalib/src/mesa/swrast/s_texcombine.c
+++ b/mesalib/src/mesa/swrast/s_texcombine.c
@@ -429,16 +429,6 @@ texture_combine( struct gl_context *ctx, GLuint unit,
arg1[i][BCOMP]) * scaleRGB;
}
break;
- case GL_BUMP_ENVMAP_ATI:
- /* this produces a fixed rgba color, and the coord calc is done elsewhere */
- for (i = 0; i < n; i++) {
- /* rgba result is 0,0,0,1 */
- rgba[i][RCOMP] = 0.0;
- rgba[i][GCOMP] = 0.0;
- rgba[i][BCOMP] = 0.0;
- rgba[i][ACOMP] = 1.0;
- }
- goto end; /* no alpha processing */
default:
_mesa_problem(ctx, "invalid combine mode");
}
@@ -653,78 +643,13 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span )
}
}
- /* First must sample all bump maps */
- for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
- const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
-
- if (texUnit->_Current &&
- texUnit->_CurrentCombine->ModeRGB == GL_BUMP_ENVMAP_ATI) {
- const GLfloat (*texcoords)[4] = (const GLfloat (*)[4])
- span->array->attribs[VARYING_SLOT_TEX0 + unit];
- float4_array targetcoords =
- span->array->attribs[VARYING_SLOT_TEX0 +
- ctx->Texture.Unit[unit].BumpTarget - GL_TEXTURE0];
-
- const struct gl_sampler_object *samp = _mesa_get_samplerobj(ctx, unit);
- GLfloat *lambda = span->array->lambda[unit];
- float4_array texels = get_texel_array(swrast, unit);
- GLuint i;
- GLfloat rotMatrix00 = ctx->Texture.Unit[unit].RotMatrix[0];
- GLfloat rotMatrix01 = ctx->Texture.Unit[unit].RotMatrix[1];
- GLfloat rotMatrix10 = ctx->Texture.Unit[unit].RotMatrix[2];
- GLfloat rotMatrix11 = ctx->Texture.Unit[unit].RotMatrix[3];
-
- /* adjust texture lod (lambda) */
- if (span->arrayMask & SPAN_LAMBDA) {
- if (texUnit->LodBias + samp->LodBias != 0.0F) {
- /* apply LOD bias, but don't clamp yet */
- const GLfloat bias = CLAMP(texUnit->LodBias + samp->LodBias,
- -ctx->Const.MaxTextureLodBias,
- ctx->Const.MaxTextureLodBias);
- GLuint i;
- for (i = 0; i < span->end; i++) {
- lambda[i] += bias;
- }
- }
-
- if (samp->MinLod != -1000.0 ||
- samp->MaxLod != 1000.0) {
- /* apply LOD clamping to lambda */
- const GLfloat min = samp->MinLod;
- const GLfloat max = samp->MaxLod;
- GLuint i;
- for (i = 0; i < span->end; i++) {
- GLfloat l = lambda[i];
- lambda[i] = CLAMP(l, min, max);
- }
- }
- }
-
- /* Sample the texture (span->end = number of fragments) */
- swrast->TextureSample[unit]( ctx, samp,
- ctx->Texture.Unit[unit]._Current,
- span->end, texcoords, lambda, texels );
-
- /* manipulate the span values of the bump target
- not sure this can work correctly even ignoring
- the problem that channel is unsigned */
- for (i = 0; i < span->end; i++) {
- targetcoords[i][0] += (texels[i][0] * rotMatrix00 + texels[i][1] *
- rotMatrix01) / targetcoords[i][3];
- targetcoords[i][1] += (texels[i][0] * rotMatrix10 + texels[i][1] *
- rotMatrix11) / targetcoords[i][3];
- }
- }
- }
-
/*
* Must do all texture sampling before combining in order to
* accomodate GL_ARB_texture_env_crossbar.
*/
for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
- if (texUnit->_Current &&
- texUnit->_CurrentCombine->ModeRGB != GL_BUMP_ENVMAP_ATI) {
+ if (texUnit->_Current) {
const GLfloat (*texcoords)[4] = (const GLfloat (*)[4])
span->array->attribs[VARYING_SLOT_TEX0 + unit];
const struct gl_texture_object *curObj = texUnit->_Current;
diff --git a/mesalib/src/mesa/swrast/s_texfetch.c b/mesalib/src/mesa/swrast/s_texfetch.c
index 90a514c16..e508368c8 100644
--- a/mesalib/src/mesa/swrast/s_texfetch.c
+++ b/mesalib/src/mesa/swrast/s_texfetch.c
@@ -210,7 +210,6 @@ texfetch_funcs[] =
},
FETCH_FUNCS(YCBCR),
FETCH_FUNCS(YCBCR_REV),
- FETCH_FUNCS(DUDV8),
/* Array unorm formats */
FETCH_FUNCS(A_UNORM8),
diff --git a/mesalib/src/mesa/swrast/s_texfetch_tmp.h b/mesalib/src/mesa/swrast/s_texfetch_tmp.h
index d48e39bfd..deda59246 100644
--- a/mesalib/src/mesa/swrast/s_texfetch_tmp.h
+++ b/mesalib/src/mesa/swrast/s_texfetch_tmp.h
@@ -888,22 +888,6 @@ FETCH(RGBA_UINT32)(const struct swrast_texture_image *texImage,
}
-/**
- * This format by definition produces 0,0,0,1 as rgba values,
- * however we'll return the dudv values as rg and fix up elsewhere.
- */
-static void
-FETCH(DUDV8)(const struct swrast_texture_image *texImage,
- GLint i, GLint j, GLint k, GLfloat *texel)
-{
- const GLbyte *src = TEXEL_ADDR(GLbyte, texImage, i, j, k, 2);
- texel[RCOMP] = BYTE_TO_FLOAT(src[0]);
- texel[GCOMP] = BYTE_TO_FLOAT(src[1]);
- texel[BCOMP] = 0;
- texel[ACOMP] = 0;
-}
-
-
static void
FETCH(R_SNORM8)(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)