Android.common.mk | 2 SConstruct | 2 configure.ac | 2 debian/changelog | 15 + debian/patches/04_osmesa_version.diff | 78 ++++++++ debian/patches/12_fix_glapi_gen.diff | 19 ++ debian/patches/series | 1 debian/rules | 5 src/gallium/auxiliary/draw/draw_context.c | 5 src/gallium/drivers/llvmpipe/lp_bld_depth.c | 27 +-- src/gallium/drivers/nv30/nv30_format.c | 6 src/gallium/drivers/nv50/nv84_video.c | 6 src/gallium/drivers/radeonsi/radeonsi_shader.c | 135 ++++++++------- src/gallium/drivers/radeonsi/radeonsi_shader.h | 1 src/gallium/drivers/radeonsi/si_state_draw.c | 6 src/glsl/ast_to_hir.cpp | 74 ++++++-- src/glsl/builtins/profiles/100es.frag | 2 src/glsl/builtins/profiles/300es.frag | 1 src/glsl/builtins/profiles/OES_EGL_image_external.glsl | 1 src/glsl/builtins/profiles/OES_standard_derivatives.frag | 1 src/glsl/builtins/profiles/OES_texture_3D.frag | 1 src/glsl/glsl_parser_extras.cpp | 1 src/glsl/glsl_parser_extras.h | 7 src/glsl/ir_optimization.h | 2 src/glsl/link_uniform_blocks.cpp | 17 + src/glsl/link_uniforms.cpp | 56 +++++- src/glsl/linker.cpp | 6 src/glsl/linker.h | 15 + src/glsl/opt_dead_builtin_varyings.cpp | 27 ++- src/mesa/drivers/common/meta.c | 43 +++- src/mesa/drivers/dri/i915/intel_tex_image.c | 1 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 9 + src/mesa/drivers/dri/i965/intel_tex_image.c | 1 src/mesa/program/program_parse.y | 4 src/mesa/vbo/vbo_exec_array.c | 82 ++++++--- 35 files changed, 489 insertions(+), 172 deletions(-)
New commits: commit 36a094ced0b3883c388b2f7425fc90479101eb06 Author: Maarten Lankhorst <maarten.lankho...@canonical.com> Date: Tue Aug 20 17:27:40 2013 +0200 fixup packaging, release to experimental diff --git a/debian/changelog b/debian/changelog index e9eca9a..706ea50 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,13 +1,16 @@ -mesa (9.2~rc1-1) UNRELEASED; urgency=low +mesa (9.2~rc1-1) experimental; urgency=low - * Initial merge to 9.2 branch. - * Refresh 06_kfreebsd-ftbfs.diff 06_kfreebsd-ftbfs.diff. + * New upstream release. + * Refresh patches for 9.2: + - 02_gbm_no_undefined.diff. + - 04_osmesa_version.diff + - 06_kfreebsd-ftbfs.diff + * Removed writes to srcdir, fixing parallel builds. + - 12_fix_glapi_gen.diff * Require llvm-3.3-dev >= 1:3.3-4 and libelf-dev. - * Refresh 02_gbm_no_undefined.diff. - * libllvmradeon is always built statically now. * Update symbols files. - -- Maarten Lankhorst <maarten.lankho...@ubuntu.com> Wed, 14 Aug 2013 13:03:27 +0200 + -- Maarten Lankhorst <maarten.lankho...@ubuntu.com> Tue, 20 Aug 2013 15:42:31 +0200 mesa (9.1.6-2) unstable; urgency=low diff --git a/debian/patches/12_fix_glapi_gen.diff b/debian/patches/12_fix_glapi_gen.diff new file mode 100644 index 0000000..2b183af --- /dev/null +++ b/debian/patches/12_fix_glapi_gen.diff @@ -0,0 +1,19 @@ +diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am +index 9720059..d4fbd35 100644 +--- a/src/mapi/glapi/gen/Makefile.am ++++ b/src/mapi/glapi/gen/Makefile.am +@@ -18,10 +18,10 @@ XORG_INDENT_FLAGS = -linux -bad -bap -blf -bli0 -cbi0 -cdw -nce -cs -i4 -lc80 -p + -T _XFUNCPROTOBEGIN -T _XFUNCPROTOEND -T _X_EXPORT + + +-MESA_DIR = $(top_srcdir)/src/mesa +-MESA_GLAPI_DIR = $(top_srcdir)/src/mapi/glapi +-MESA_MAPI_DIR = $(top_srcdir)/src/mapi +-MESA_GLX_DIR = $(top_srcdir)/src/glx ++MESA_DIR = $(top_builddir)/src/mesa ++MESA_GLAPI_DIR = $(top_builddir)/src/mapi/glapi ++MESA_MAPI_DIR = $(top_builddir)/src/mapi ++MESA_GLX_DIR = $(top_builddir)/src/glx + + MESA_GLAPI_OUTPUTS = \ + $(MESA_GLAPI_DIR)/glapi_mapi_tmp.h \ diff --git a/debian/patches/series b/debian/patches/series index f20129c..8a4d2c0 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -4,3 +4,4 @@ 06_kfreebsd-ftbfs.diff 08-kfreebsd-gallium.diff #11-hurd-ftbfs-again.diff +12_fix_glapi_gen.diff diff --git a/debian/rules b/debian/rules index c0240b9..11267ba 100755 --- a/debian/rules +++ b/debian/rules @@ -7,6 +7,7 @@ ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) + MAKEFLAGS += -j$(NUMJOBS) endif DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) @@ -172,8 +173,6 @@ $(STAMP)-build-%: configure dh_testdir mkdir -p $(DEB_BUILD_DIR)/$* - find $(CURDIR)/* -maxdepth 0 -not -path '$(DEB_BUILD_DIR)*' | \ - xargs cp -rlf -t $(DEB_BUILD_DIR)/$* cd $(DEB_BUILD_DIR)/$* && \ ../../configure --prefix=/usr --mandir=\$${prefix}/share/man \ @@ -182,7 +181,7 @@ $(STAMP)-build-%: configure --localstatedir=/var --disable-silent-rules \ $(confflags) $(confflags-$*) \ ac_cv_path_LLVM_CONFIG=llvm-config-3.3 - cd $(DEB_BUILD_DIR)/$* && $(MAKE) $(if $(NUMJOBS),-j$(NUMJOBS)) + cd $(DEB_BUILD_DIR)/$* && $(MAKE) >$@ install: build commit 5b4816c5b3a41744aa93a4c226f5f9039670692e Author: Maarten Lankhorst <maarten.lankho...@canonical.com> Date: Tue Aug 20 14:38:27 2013 +0200 bump changelog diff --git a/debian/changelog b/debian/changelog index 3126662..e9eca9a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -mesa (9.2.0-0~git) UNRELEASED; urgency=low +mesa (9.2~rc1-1) UNRELEASED; urgency=low * Initial merge to 9.2 branch. * Refresh 06_kfreebsd-ftbfs.diff 06_kfreebsd-ftbfs.diff. commit 38f576e9aa70334e0017b1f1d91df30515c05d18 Author: Maarten Lankhorst <maarten.lankho...@canonical.com> Date: Tue Aug 20 14:07:03 2013 +0200 kill gallium osmesa off for real.. Sanity restored. diff --git a/debian/patches/04_osmesa_version.diff b/debian/patches/04_osmesa_version.diff index eeacb58..74c1d77 100644 --- a/debian/patches/04_osmesa_version.diff +++ b/debian/patches/04_osmesa_version.diff @@ -1,5 +1,7 @@ ---- a/src/gallium/targets/osmesa/Makefile.am -+++ b/src/gallium/targets/osmesa/Makefile.am +Index: mesa/src/gallium/targets/osmesa/Makefile.am +=================================================================== +--- mesa.orig/src/gallium/targets/osmesa/Makefile.am 2013-08-20 11:44:50.981036890 +0000 ++++ mesa/src/gallium/targets/osmesa/Makefile.am 2013-08-20 11:44:50.978136960 +0000 @@ -38,7 +38,7 @@ lib@OSMESA_LIB@_la_SOURCES = target.c @@ -20,8 +22,10 @@ endif # XXX fix-up? ---- a/src/mesa/drivers/osmesa/Makefile.am -+++ b/src/mesa/drivers/osmesa/Makefile.am +Index: mesa/src/mesa/drivers/osmesa/Makefile.am +=================================================================== +--- mesa.orig/src/mesa/drivers/osmesa/Makefile.am 2013-08-20 11:44:50.981036890 +0000 ++++ mesa/src/mesa/drivers/osmesa/Makefile.am 2013-08-20 11:44:50.978336955 +0000 @@ -37,7 +37,7 @@ nodist_EXTRA_lib@OSMESA_LIB@_la_SOURCES = dummy.cpp lib@OSMESA_LIB@_la_SOURCES = osmesa.c @@ -40,8 +44,10 @@ endif pkgconfigdir = $(libdir)/pkgconfig ---- a/configure.ac -+++ b/configure.ac +Index: mesa/configure.ac +=================================================================== +--- mesa.orig/configure.ac 2013-08-20 11:44:50.981036890 +0000 ++++ mesa/configure.ac 2013-08-20 12:05:59.000000000 +0000 @@ -769,11 +769,6 @@ GALLIUM_STATE_TRACKERS_DIRS="dri $GALLIUM_STATE_TRACKERS_DIRS" fi @@ -54,3 +60,33 @@ AC_SUBST([MESA_LLVM]) # Check for libdrm +Index: mesa/src/gallium/state_trackers/Makefile.am +=================================================================== +--- mesa.orig/src/gallium/state_trackers/Makefile.am 2013-08-20 07:05:41.097175049 +0000 ++++ mesa/src/gallium/state_trackers/Makefile.am 2013-08-20 12:06:21.289668508 +0000 +@@ -25,10 +25,6 @@ + SUBDIRS += glx + endif + +-if HAVE_OSMESA +-SUBDIRS += osmesa +-endif +- + if HAVE_DRI + SUBDIRS += dri + endif +Index: mesa/src/gallium/targets/Makefile.am +=================================================================== +--- mesa.orig/src/gallium/targets/Makefile.am 2013-08-20 07:05:41.110674769 +0000 ++++ mesa/src/gallium/targets/Makefile.am 2013-08-20 12:06:33.791167527 +0000 +@@ -26,10 +26,6 @@ + SUBDIRS += libgl-xlib + endif + +-if HAVE_OSMESA +-SUBDIRS += osmesa +-endif +- + if HAVE_GALLIUM_GBM + SUBDIRS += gbm + endif commit 868db03418accb5232b5d3654fb9d1e774b99173 Author: Maarten Lankhorst <maarten.lankho...@canonical.com> Date: Tue Aug 20 12:39:00 2013 +0200 kill off the gallium based osmesa This seems to be not as well-tested as the other osmesa, and caused a valgrind error after simply testing in wine. Disable this for now and force using the stable osmesa. diff --git a/debian/patches/04_osmesa_version.diff b/debian/patches/04_osmesa_version.diff index 769b24a..eeacb58 100644 --- a/debian/patches/04_osmesa_version.diff +++ b/debian/patches/04_osmesa_version.diff @@ -40,3 +40,17 @@ endif pkgconfigdir = $(libdir)/pkgconfig +--- a/configure.ac ++++ b/configure.ac +@@ -769,11 +769,6 @@ + GALLIUM_STATE_TRACKERS_DIRS="dri $GALLIUM_STATE_TRACKERS_DIRS" + fi + +-if test "x$enable_osmesa" = xyes; then +- GALLIUM_STATE_TRACKERS_DIRS="osmesa $GALLIUM_STATE_TRACKERS_DIRS" +- GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS osmesa" +-fi +- + AC_SUBST([MESA_LLVM]) + + # Check for libdrm commit 62756222af03502875f4cb1eaa1e7138d5f322cc Author: Maarten Lankhorst <maarten.lankho...@canonical.com> Date: Tue Aug 20 10:48:55 2013 +0200 refresh 04_osmesa_version.diff to target the new gallium osmesa too diff --git a/debian/patches/04_osmesa_version.diff b/debian/patches/04_osmesa_version.diff index bad5f7b..769b24a 100644 --- a/debian/patches/04_osmesa_version.diff +++ b/debian/patches/04_osmesa_version.diff @@ -1,3 +1,25 @@ +--- a/src/gallium/targets/osmesa/Makefile.am ++++ b/src/gallium/targets/osmesa/Makefile.am +@@ -38,7 +38,7 @@ + + lib@OSMESA_LIB@_la_SOURCES = target.c + +-lib@OSMESA_LIB@_la_LDFLAGS = -module -version-number @OSMESA_VERSION@ -no-undefined ++lib@OSMESA_LIB@_la_LDFLAGS = -module -version-number 6:5:3 -no-undefined + + if HAVE_SHARED_GLAPI + GLAPI_LIB = $(top_builddir)/src/mapi/shared-glapi/libglapi.la +@@ -82,8 +82,8 @@ + $(MKDIR_P) $(top_builddir)/$(LIB_DIR); + $(MKDIR_P) $(top_builddir)/$(LIB_DIR)/gallium; + ln -f .libs/lib@OSMESA_LIB@.so $(top_builddir)/$(LIB_DIR)/gallium/lib@OSMESA_LIB@.so; +- ln -f .libs/lib@OSMESA_LIB@.so.@OSMESA_VERSION@ $(top_builddir)/$(LIB_DIR)/gallium/lib@OSMESA_LIB@.so.@OSMESA_VERSION@; +- cp .libs/lib@OSMESA_LIB@.so.@OSMESA_VERSION@.0.0 $(top_builddir)/$(LIB_DIR)/gallium/ ++ ln -f .libs/lib@OSMESA_LIB@.so.6 $(top_builddir)/$(LIB_DIR)/gallium/lib@OSMESA_LIB@.so.6; ++ cp .libs/lib@OSMESA_LIB@.so.6.5.3 $(top_builddir)/$(LIB_DIR)/gallium/ + endif + + # XXX fix-up? --- a/src/mesa/drivers/osmesa/Makefile.am +++ b/src/mesa/drivers/osmesa/Makefile.am @@ -37,7 +37,7 @@ @@ -7,8 +29,8 @@ -lib@OSMESA_LIB@_la_LDFLAGS = -module -version-number @OSMESA_VERSION@ -no-undefined +lib@OSMESA_LIB@_la_LDFLAGS = -module -version-number 6:5:3 -no-undefined + GLAPI_LIB = $(top_builddir)/src/mapi/glapi/libglapi.la if HAVE_SHARED_GLAPI - GLAPI_LIB = $(top_builddir)/src/mapi/shared-glapi/libglapi.la @@ -55,7 +55,7 @@ all-local: lib@OSMESA_LIB@.la $(MKDIR_P) $(top_builddir)/$(LIB_DIR); commit 796b4a7b40889747562d8d693f25f67aff35c189 Author: Ian Romanick <ian.d.roman...@intel.com> Date: Mon Aug 19 16:49:02 2013 -0700 mesa: Bump version to 9.2-rc1 diff --git a/Android.common.mk b/Android.common.mk index c6ee4e1..b5ed472 100644 --- a/Android.common.mk +++ b/Android.common.mk @@ -35,7 +35,7 @@ LOCAL_C_INCLUDES += \ # define ANDROID_VERSION (e.g., 4.0.x => 0x0400) LOCAL_CFLAGS += \ - -DPACKAGE_VERSION=\"9.2.0-devel\" \ + -DPACKAGE_VERSION=\"9.2.0-rc1\" \ -DPACKAGE_BUGREPORT=\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\" \ -DANDROID_VERSION=0x0$(MESA_ANDROID_MAJOR_VERSION)0$(MESA_ANDROID_MINOR_VERSION) diff --git a/SConstruct b/SConstruct index 834e9d5..a75bcb9 100644 --- a/SConstruct +++ b/SConstruct @@ -70,7 +70,7 @@ if env['gles']: # Environment setup env.Append(CPPDEFINES = [ - ('PACKAGE_VERSION', '\\"9.2.0-devel\\"'), + ('PACKAGE_VERSION', '\\"9.2.0-rc1\\"'), ('PACKAGE_BUGREPORT', '\\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\\"'), ]) diff --git a/configure.ac b/configure.ac index 35f6797..bd5c71d 100644 --- a/configure.ac +++ b/configure.ac @@ -6,7 +6,7 @@ dnl Tell the user about autoconf.html in the --help output m4_divert_once([HELP_END], [ See docs/autoconf.html for more details on the options for Mesa.]) -AC_INIT([Mesa], [9.2.0-devel], +AC_INIT([Mesa], [9.2.0-rc1], [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa]) AC_CONFIG_AUX_DIR([bin]) AC_CONFIG_MACRO_DIR([m4]) commit d3004acdd15d0fe3a0ac21f9bd7070d22b13a680 Author: Ian Romanick <ian.d.roman...@intel.com> Date: Sat Aug 17 00:27:43 2013 -0700 glsl: Use alignment of container record for its first field The first field of a record in a UBO has the aligment of the record itself. Fixes piglit vs-struct-pad, fs-struct-pad, and (with the patch posted to the piglit list that extends the test) layout-std140. NOTE: The bit of strangeness with the version of visit_field without the record_type poitner is because that method is pure virtual in the base class. The original implementation of the class did this to ensure derived classes remembered to implement that flavor. Now they can implement either flavor but not both. I don't know a C++ way to enforce that. Signed-off-by: Ian Romanick <ian.d.roman...@intel.com> Reviewed-by: Paul Berry <stereotype...@gmail.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68195 Cc: "9.2 9.1" mesa-sta...@lists.freedesktop.org (cherry picked from commit 574e4843e9e26aa6affa31c80ac42f745b68268b) diff --git a/src/glsl/link_uniform_blocks.cpp b/src/glsl/link_uniform_blocks.cpp index c72d1d8..e475147 100644 --- a/src/glsl/link_uniform_blocks.cpp +++ b/src/glsl/link_uniform_blocks.cpp @@ -59,6 +59,15 @@ private: virtual void visit_field(const glsl_type *type, const char *name, bool row_major) { + (void) type; + (void) name; + (void) row_major; + assert(!"Should not get here."); + } + + virtual void visit_field(const glsl_type *type, const char *name, + bool row_major, const glsl_type *record_type) + { assert(this->index < this->num_variables); gl_uniform_buffer_variable *v = &this->variables[this->index++]; @@ -85,7 +94,9 @@ private: v->IndexName = v->Name; } - unsigned alignment = type->std140_base_alignment(v->RowMajor); + const unsigned alignment = record_type + ? record_type->std140_base_alignment(v->RowMajor) + : type->std140_base_alignment(v->RowMajor); unsigned size = type->std140_size(v->RowMajor); this->offset = glsl_align(this->offset, alignment); @@ -107,6 +118,10 @@ private: virtual void visit_field(const glsl_struct_field *field) { + /* FINISHME: When support for doubles (dvec4, etc.) is added to the + * FINISHME: compiler, this may be incorrect for a structure in a UBO + * FINISHME: like struct s { struct { float f } s1; dvec4 v; };. + */ this->offset = glsl_align(this->offset, field->type->std140_base_alignment(false)); } diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp index 095895b..fa77157 100644 --- a/src/glsl/link_uniforms.cpp +++ b/src/glsl/link_uniforms.cpp @@ -402,6 +402,15 @@ private: virtual void visit_field(const glsl_type *type, const char *name, bool row_major) { + (void) type; + (void) name; + (void) row_major; + assert(!"Should not get here."); + } + + virtual void visit_field(const glsl_type *type, const char *name, + bool row_major, const glsl_type *record_type) + { assert(!type->is_record()); assert(!(type->is_array() && type->fields.array->is_record())); assert(!type->is_interface()); @@ -446,7 +455,9 @@ private: if (this->ubo_block_index != -1) { this->uniforms[id].block_index = this->ubo_block_index; - unsigned alignment = type->std140_base_alignment(ubo_row_major); + const unsigned alignment = record_type + ? record_type->std140_base_alignment(ubo_row_major) + : type->std140_base_alignment(ubo_row_major); this->ubo_byte_offset = glsl_align(this->ubo_byte_offset, alignment); this->uniforms[id].offset = this->ubo_byte_offset; this->ubo_byte_offset += type->std140_size(ubo_row_major); commit 684316512c5570483365d36849250a008b6fcd84 Author: Ian Romanick <ian.d.roman...@intel.com> Date: Fri Aug 16 23:30:43 2013 -0700 glsl: Add new overload of program_resource_visitor::visit_field method The outer-most record is passed into the visit_field method for the first field. In other words, in the following structure: struct S1 { vec4 v; float f; }; struct S { S1 s1; S1 s2; }; uniform Ubo { S s; }; s.s1.v would get record_type = S (because s1.v is the first non-record field in S), and s.s2.v would get record_type = S1. s.s1.f and s.s2.f would get record_type = NULL becuase they aren't the first field of anything. This new overload isn't used yet, but the next patch will add several uses. Signed-off-by: Ian Romanick <ian.d.roman...@intel.com> Reviewed-by: Paul Berry <stereotype...@gmail.com> Cc: "9.2 9.1" mesa-sta...@lists.freedesktop.org (cherry picked from commit 5ac884fd9f213baed1de52eb7d17b86455c48a02) diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp index 35ace1e..095895b 100644 --- a/src/glsl/link_uniforms.cpp +++ b/src/glsl/link_uniforms.cpp @@ -60,7 +60,7 @@ program_resource_visitor::process(const glsl_type *type, const char *name) || (type->is_array() && type->fields.array->is_interface())); char *name_copy = ralloc_strdup(NULL, name); - recursion(type, &name_copy, strlen(name), false); + recursion(type, &name_copy, strlen(name), false, NULL); ralloc_free(name_copy); } @@ -77,24 +77,25 @@ program_resource_visitor::process(ir_variable *var) /* Only strdup the name if we actually will need to modify it. */ if (t->is_record() || (t->is_array() && t->fields.array->is_record())) { char *name = ralloc_strdup(NULL, var->name); - recursion(var->type, &name, strlen(name), false); + recursion(var->type, &name, strlen(name), false, NULL); ralloc_free(name); } else if (t->is_interface()) { char *name = ralloc_strdup(NULL, var->type->name); - recursion(var->type, &name, strlen(name), false); + recursion(var->type, &name, strlen(name), false, NULL); ralloc_free(name); } else if (t->is_array() && t->fields.array->is_interface()) { char *name = ralloc_strdup(NULL, var->type->fields.array->name); - recursion(var->type, &name, strlen(name), false); + recursion(var->type, &name, strlen(name), false, NULL); ralloc_free(name); } else { - this->visit_field(t, var->name, false); + this->visit_field(t, var->name, false, NULL); } } void program_resource_visitor::recursion(const glsl_type *t, char **name, - size_t name_length, bool row_major) + size_t name_length, bool row_major, + const glsl_type *record_type) { /* Records need to have each field processed individually. * @@ -103,6 +104,9 @@ program_resource_visitor::recursion(const glsl_type *t, char **name, * individually. */ if (t->is_record() || t->is_interface()) { + if (record_type == NULL && t->is_record()) + record_type = t; + for (unsigned i = 0; i < t->length; i++) { const char *field = t->fields.structure[i].name; size_t new_length = name_length; @@ -118,10 +122,18 @@ program_resource_visitor::recursion(const glsl_type *t, char **name, } recursion(t->fields.structure[i].type, name, new_length, - t->fields.structure[i].row_major); + t->fields.structure[i].row_major, record_type); + + /* Only the first leaf-field of the record gets called with the + * record type pointer. + */ + record_type = NULL; } } else if (t->is_array() && (t->fields.array->is_record() || t->fields.array->is_interface())) { + if (record_type == NULL && t->fields.array->is_record()) + record_type = t->fields.array; + for (unsigned i = 0; i < t->length; i++) { size_t new_length = name_length; @@ -129,14 +141,27 @@ program_resource_visitor::recursion(const glsl_type *t, char **name, ralloc_asprintf_rewrite_tail(name, &new_length, "[%u]", i); recursion(t->fields.array, name, new_length, - t->fields.structure[i].row_major); + t->fields.structure[i].row_major, record_type); + + /* Only the first leaf-field of the record gets called with the + * record type pointer. + */ + record_type = NULL; } } else { - this->visit_field(t, *name, row_major); + this->visit_field(t, *name, row_major, record_type); } } void +program_resource_visitor::visit_field(const glsl_type *type, const char *name, + bool row_major, + const glsl_type *record_type) +{ + visit_field(type, name, row_major); +} + +void program_resource_visitor::visit_field(const glsl_struct_field *field) { (void) field; diff --git a/src/glsl/linker.h b/src/glsl/linker.h index 2fe2410..c55ba22 100644 --- a/src/glsl/linker.h +++ b/src/glsl/linker.h @@ -124,6 +124,19 @@ protected: * \param type Type of the field. * \param name Fully qualified name of the field. * \param row_major For a matrix type, is it stored row-major. + * \param record_type Type of the record containing the field. + * + * The default implementation just calls the other \c visit_field method. + */ + virtual void visit_field(const glsl_type *type, const char *name, + bool row_major, const glsl_type *record_type); + + /** + * Method invoked for each leaf of the variable + * + * \param type Type of the field. + * \param name Fully qualified name of the field. + * \param row_major For a matrix type, is it stored row-major. */ virtual void visit_field(const glsl_type *type, const char *name, bool row_major) = 0; @@ -144,7 +157,7 @@ private: * terminating \c NUL character. */ void recursion(const glsl_type *t, char **name, size_t name_length, - bool row_major); + bool row_major, const glsl_type *record_type); }; void commit 9f7f727345fb555b30cbc8ad03c9324c7644bdcf Author: Ian Romanick <ian.d.roman...@intel.com> Date: Tue Aug 13 09:15:01 2013 -0700 glsl: Disallow embedded structure definitions Continue to allow them in GLSL 1.10 because the spec allows it. Generate an error in all other versions because the specs specifically disallow it. Signed-off-by: Ian Romanick <ian.d.roman...@intel.com> Reviewed-by: Kenneth Graunke <kenn...@whitecape.org> Cc: "9.2" <mesa-sta...@lists.freedesktop.org> (cherry picked from commit d9bb8b7b56ce65bbf6909419aa6d3d69ccd34c08) diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 870ea3d..216acfc 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -4329,6 +4329,34 @@ ast_struct_specifier::hir(exec_list *instructions, struct _mesa_glsl_parse_state *state) { YYLTYPE loc = this->get_location(); + + /* Section 4.1.8 (Structures) of the GLSL 1.10 spec says: + * + * "Anonymous structures are not supported; so embedded structures must + * have a declarator. A name given to an embedded struct is scoped at + * the same level as the struct it is embedded in." + * + * The same section of the GLSL 1.20 spec says: + * + * "Anonymous structures are not supported. Embedded structures are not + * supported. + * + * struct S { float f; }; + * struct T { + * S; // Error: anonymous structures disallowed + * struct { ... }; // Error: embedded structures disallowed + * S s; // Okay: nested structures with name are allowed + * };" + * + * The GLSL ES 1.00 and 3.00 specs have similar langauge and examples. So, + * we allow embedded structures in 1.10 only. + */ + if (state->language_version != 110 && state->struct_specifier_depth != 0) + _mesa_glsl_error(&loc, state, + "embedded structure declartions are not allowed"); + + state->struct_specifier_depth++; + glsl_struct_field *fields; unsigned decl_count = ast_process_structure_or_interface_block(instructions, @@ -4355,6 +4383,8 @@ ast_struct_specifier::hir(exec_list *instructions, } } + state->struct_specifier_depth--; + /* Structure type definitions do not have r-values. */ return NULL; diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 9f44c20..c16f71f 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -71,6 +71,7 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *_ctx, this->loop_nesting_ast = NULL; this->switch_state.switch_nesting_ast = NULL; + this->struct_specifier_depth = 0; this->num_builtins_to_link = 0; /* Set default language version and extensions */ diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h index 1e386dd..dec13ac 100644 --- a/src/glsl/glsl_parser_extras.h +++ b/src/glsl/glsl_parser_extras.h @@ -159,6 +159,13 @@ struct _mesa_glsl_parse_state { enum _mesa_glsl_parser_targets target; /** + * Number of nested struct_specifier levels + * + * Outside a struct_specifer, this is zero. + */ + unsigned struct_specifier_depth; + + /** * Default uniform layout qualifiers tracked during parsing. * Currently affects uniform blocks and uniform buffer variables in * those blocks. commit 1fb22bf1433a0c0d7c059c435da7af8eb40b1ffc Author: Ian Romanick <ian.d.roman...@intel.com> Date: Fri Aug 9 16:25:17 2013 -0700 meta: Add default precision qualifier to all fragement shaders Signed-off-by: Ian Romanick <ian.d.roman...@intel.com> Reviewed-by: Kenneth Graunke <kenn...@whitecape.org> Cc: "9.2" <mesa-sta...@lists.freedesktop.org> (cherry picked from commit 5fb1dd51f3845985b9389987a1c6337e7fafeabc) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index cfcd0e2..a81ffde 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -1537,6 +1537,9 @@ setup_glsl_blit_framebuffer(struct gl_context *ctx, "}\n"; fs_source = ralloc_asprintf(mem_ctx, + "#ifdef GL_ES\n" + "precision highp float;\n" + "#endif\n" "uniform %s texSampler;\n" "varying vec2 texCoords;\n" "void main()\n" @@ -1561,6 +1564,9 @@ setup_glsl_blit_framebuffer(struct gl_context *ctx, _mesa_is_desktop_gl(ctx) ? "130" : "300 es"); fs_source = ralloc_asprintf(mem_ctx, "#version %s\n" + "#ifdef GL_ES\n" + "precision highp float;\n" + "#endif\n" "uniform %s texSampler;\n" "in vec2 texCoords;\n" "out vec4 out_color;\n" @@ -2139,6 +2145,9 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear) " gl_Position = position;\n" "}\n"; const char *fs_source = + "#ifdef GL_ES\n" + "precision highp float;\n" + "#endif\n" "uniform vec4 color;\n" "void main()\n" "{\n" @@ -2198,6 +2207,9 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear) const char *fs_int_source = ralloc_asprintf(shader_source_mem_ctx, "#version %s\n" + "#ifdef GL_ES\n" + "precision highp float;\n" + "#endif\n" "uniform ivec4 color;\n" "out ivec4 out_color;\n" "\n" @@ -3426,6 +3438,9 @@ setup_glsl_generate_mipmap(struct gl_context *ctx, fs_source = ralloc_asprintf(mem_ctx, "#extension GL_EXT_texture_array : enable\n" + "#ifdef GL_ES\n" + "precision highp float;\n" + "#endif\n" "uniform %s texSampler;\n" "varying vec3 texCoords;\n" "void main()\n" @@ -3449,6 +3464,9 @@ setup_glsl_generate_mipmap(struct gl_context *ctx, _mesa_is_desktop_gl(ctx) ? "130" : "300 es"); fs_source = ralloc_asprintf(mem_ctx, "#version %s\n" + "#ifdef GL_ES\n" + "precision highp float;\n" + "#endif\n" "uniform %s texSampler;\n" "in vec3 texCoords;\n" "out vec4 out_color;\n" commit 9fa7313e346085d98785bd7f87bae73af016e307 Author: Ian Romanick <ian.d.roman...@intel.com> Date: Fri Aug 9 15:02:49 2013 -0700 glsl: Add default precision qualifiers for ES builtins Once the compiler proplerly checks for default precision qualifiers, these shaders will cease to compile. Signed-off-by: Ian Romanick <ian.d.roman...@intel.com> Reviewed-by: Kenneth Graunke <kenn...@whitecape.org> Cc: "9.2" <mesa-sta...@lists.freedesktop.org> (cherry picked from commit 5ac247a73e78c6df7a3980c84e6207c3da601987) diff --git a/src/glsl/builtins/profiles/100es.frag b/src/glsl/builtins/profiles/100es.frag index 904aa30..28c4527 100644 --- a/src/glsl/builtins/profiles/100es.frag +++ b/src/glsl/builtins/profiles/100es.frag @@ -1,4 +1,6 @@ #version 100 +precision highp float; + vec4 texture2D (sampler2D sampler, vec2 coord, float bias); vec4 texture2DProj (sampler2D sampler, vec3 coord, float bias); vec4 texture2DProj (sampler2D sampler, vec4 coord, float bias); diff --git a/src/glsl/builtins/profiles/300es.frag b/src/glsl/builtins/profiles/300es.frag index 38589f7..ef412d8 100644 --- a/src/glsl/builtins/profiles/300es.frag +++ b/src/glsl/builtins/profiles/300es.frag @@ -1,4 +1,5 @@ #version 300 es +precision highp float; /* texture - bias variants */ vec4 texture( sampler2D sampler, vec2 P, float bias); diff --git a/src/glsl/builtins/profiles/OES_EGL_image_external.glsl b/src/glsl/builtins/profiles/OES_EGL_image_external.glsl index 71e6af9..90300ec 100644 --- a/src/glsl/builtins/profiles/OES_EGL_image_external.glsl +++ b/src/glsl/builtins/profiles/OES_EGL_image_external.glsl @@ -1,5 +1,6 @@ #version 100 #extension GL_OES_EGL_image_external : enable +precision highp float; vec4 texture2D(samplerExternalOES sampler, vec2 coord); vec4 texture2DProj(samplerExternalOES sampler, vec3 coord); diff --git a/src/glsl/builtins/profiles/OES_standard_derivatives.frag b/src/glsl/builtins/profiles/OES_standard_derivatives.frag index 2c6ea07..44991ef 100644 --- a/src/glsl/builtins/profiles/OES_standard_derivatives.frag +++ b/src/glsl/builtins/profiles/OES_standard_derivatives.frag @@ -1,5 +1,6 @@ #version 100 #extension GL_OES_standard_derivatives : enable +precision highp float; /* * 8.8 - Fragment Processing Functions diff --git a/src/glsl/builtins/profiles/OES_texture_3D.frag b/src/glsl/builtins/profiles/OES_texture_3D.frag index b6ebd6a..c2c3339 100644 --- a/src/glsl/builtins/profiles/OES_texture_3D.frag +++ b/src/glsl/builtins/profiles/OES_texture_3D.frag @@ -1,5 +1,6 @@ #version 100 #extension GL_OES_texture_3D : enable +precision highp float; vec4 texture3D (sampler3D sampler, vec3 coord); vec4 texture3DProj (sampler3D sampler, vec4 coord); commit 6296abed150883edbd5fa6bbcd3057b015e2dee6 Author: Marek Olšák <marek.ol...@amd.com> Date: Fri Aug 9 22:34:45 2013 +0200 glsl: don't eliminate texcoords that can be set by GL_COORD_REPLACE Tested by examining generated TGSI shaders from piglit/glsl-routing. Cc: mesa-sta...@lists.freedesktop.org Reviewed-by: Henri Verbeet <hverb...@gmail.com> Tested-by: Henri Verbeet <hverb...@gmail.com> Reviewed-by: Ian Romanick <ian.d.roman...@intel.com> (cherry picked from commit d13003f544417db6de44c65a0c118bd2b189458a) diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h index 2c1479f..d9d90dd 100644 --- a/src/glsl/ir_optimization.h +++ b/src/glsl/ir_optimization.h @@ -77,7 +77,7 @@ bool do_copy_propagation(exec_list *instructions); bool do_copy_propagation_elements(exec_list *instructions); bool do_constant_propagation(exec_list *instructions); void do_dead_builtin_varyings(struct gl_context *ctx, - exec_list *producer, exec_list *consumer, + gl_shader *producer, gl_shader *consumer, unsigned num_tfeedback_decls, class tfeedback_decl *tfeedback_decls); bool do_dead_code(exec_list *instructions, bool uniform_locations_assigned); diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index ac010cf..b37b150 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -1906,7 +1906,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) goto done; } - do_dead_builtin_varyings(ctx, sh->ir, NULL, + do_dead_builtin_varyings(ctx, sh, NULL, num_tfeedback_decls, tfeedback_decls); demote_shader_inputs_and_outputs(sh, ir_var_shader_out); @@ -1921,7 +1921,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) */ gl_shader *const sh = prog->_LinkedShaders[first]; - do_dead_builtin_varyings(ctx, NULL, sh->ir, + do_dead_builtin_varyings(ctx, NULL, sh, num_tfeedback_decls, tfeedback_decls); demote_shader_inputs_and_outputs(sh, ir_var_shader_in); @@ -1943,7 +1943,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) tfeedback_decls)) goto done; - do_dead_builtin_varyings(ctx, sh_i->ir, sh_next->ir, + do_dead_builtin_varyings(ctx, sh_i, sh_next, next == MESA_SHADER_FRAGMENT ? num_tfeedback_decls : 0, tfeedback_decls); diff --git a/src/glsl/opt_dead_builtin_varyings.cpp b/src/glsl/opt_dead_builtin_varyings.cpp index 2e813d2..6745d5c 100644 --- a/src/glsl/opt_dead_builtin_varyings.cpp +++ b/src/glsl/opt_dead_builtin_varyings.cpp @@ -409,7 +409,7 @@ lower_texcoord_array(exec_list *ir, const varying_info_visitor *info) void do_dead_builtin_varyings(struct gl_context *ctx, - exec_list *producer, exec_list *consumer, + gl_shader *producer, gl_shader *consumer, unsigned num_tfeedback_decls, tfeedback_decl *tfeedback_decls) { @@ -431,44 +431,55 @@ do_dead_builtin_varyings(struct gl_context *ctx, varying_info_visitor consumer_info(ir_var_shader_in); if (producer) { - producer_info.get(producer, num_tfeedback_decls, tfeedback_decls); + producer_info.get(producer->ir, num_tfeedback_decls, tfeedback_decls); if (!consumer) { /* At least eliminate unused gl_TexCoord elements. */ if (producer_info.lower_texcoord_array) { - lower_texcoord_array(producer, &producer_info); + lower_texcoord_array(producer->ir, &producer_info); } return; } } if (consumer) { - consumer_info.get(consumer, 0, NULL); + consumer_info.get(consumer->ir, 0, NULL); if (!producer) { /* At least eliminate unused gl_TexCoord elements. */ if (consumer_info.lower_texcoord_array) { - lower_texcoord_array(consumer, &consumer_info); + lower_texcoord_array(consumer->ir, &consumer_info); } return; } } - /* Eliminate the varyings unused by the other shader. */ + /* Eliminate the outputs unused by the consumer. */ if (producer_info.lower_texcoord_array || producer_info.color_usage || producer_info.has_fog) { - replace_varyings_visitor(producer, + replace_varyings_visitor(producer->ir, &producer_info, consumer_info.texcoord_usage, consumer_info.color_usage, consumer_info.has_fog); } + /* The gl_TexCoord fragment shader inputs can be initialized + * by GL_COORD_REPLACE, so we can't eliminate them. + * + * This doesn't prevent elimination of the gl_TexCoord elements which + * are not read by the fragment shader. We want to eliminate those anyway. + */ + if (consumer->Type == GL_FRAGMENT_SHADER) { + producer_info.texcoord_usage = (1 << MAX_TEXTURE_COORD_UNITS) - 1; + } + + /* Eliminate the inputs uninitialized by the producer. */ -- To UNSUBSCRIBE, email to debian-x-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/e1vboz9-0005v8...@vasks.debian.org