[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

mesa: Changes to 'debian-experimental'



 Makefile                                             |    2 
 configure.ac                                         |    2 
 debian/changelog                                     |    6 
 docs/relnotes-8.0.html                               |    2 
 src/gallium/auxiliary/postprocess/postprocess.h      |    3 
 src/gallium/auxiliary/postprocess/pp_init.c          |    6 
 src/gallium/auxiliary/postprocess/pp_run.c           |   13 
 src/gallium/drivers/softpipe/sp_screen.c             |    2 
 src/gallium/drivers/softpipe/sp_state_derived.c      |    3 
 src/gallium/state_trackers/dri/common/dri_context.c  |    3 
 src/gallium/state_trackers/dri/common/dri_drawable.c |   30 -
 src/gallium/state_trackers/dri/drm/dri2.c            |    3 
 src/gallium/state_trackers/vega/path.c               |    2 
 src/gallium/state_trackers/xorg/xvmc/subpicture.c    |    3 
 src/glsl/ast_to_hir.cpp                              |  545 ++++++++++---------
 src/glsl/glcpp/glcpp-lex.l                           |   10 
 src/glsl/glcpp/glcpp-parse.y                         |    3 
 src/glsl/glsl_parser.yy                              |    6 
 src/glsl/glsl_parser_extras.cpp                      |    5 
 src/glsl/glsl_parser_extras.h                        |   21 
 src/mapi/glapi/glapi_nop.c                           |    8 
 src/mesa/drivers/common/meta.c                       |    7 
 src/mesa/drivers/dri/common/drirc                    |   10 
 src/mesa/drivers/dri/common/xmlpool/options.h        |   10 
 src/mesa/drivers/dri/i915/i830_vtbl.c                |    5 
 src/mesa/drivers/dri/i915/i915_vtbl.c                |    5 
 src/mesa/drivers/dri/i965/brw_context.c              |    2 
 src/mesa/drivers/dri/i965/brw_defines.h              |    1 
 src/mesa/drivers/dri/i965/brw_eu_emit.c              |    2 
 src/mesa/drivers/dri/i965/brw_fs.h                   |    2 
 src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp    |    6 
 src/mesa/drivers/dri/i965/brw_structs.h              |   11 
 src/mesa/drivers/dri/i965/brw_vec4.h                 |    1 
 src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp  |    6 
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp       |   14 
 src/mesa/drivers/dri/i965/brw_wm.h                   |    3 
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c     |   22 
 src/mesa/drivers/dri/i965/gen6_sf_state.c            |   13 
 src/mesa/drivers/dri/i965/gen7_sf_state.c            |   18 
 src/mesa/drivers/dri/i965/gen7_wm_surface_state.c    |    2 
 src/mesa/drivers/dri/intel/intel_batchbuffer.c       |    7 
 src/mesa/drivers/dri/intel/intel_blit.c              |    2 
 src/mesa/drivers/dri/intel/intel_context.h           |    2 
 src/mesa/drivers/dri/intel/intel_fbo.c               |  112 +--
 src/mesa/drivers/dri/intel/intel_screen.c            |    3 
 src/mesa/drivers/osmesa/osmesa.c                     |    3 
 src/mesa/main/arrayobj.c                             |    6 
 src/mesa/main/attrib.c                               |   13 
 src/mesa/main/bufferobj.c                            |  138 +---
 src/mesa/main/context.c                              |   28 
 src/mesa/main/dlist.c                                |   21 
 src/mesa/main/format_unpack.c                        |  353 ++++++++++++
 src/mesa/main/mipmap.c                               |    6 
 src/mesa/main/mtypes.h                               |   11 
 src/mesa/main/pack.c                                 |   58 --
 src/mesa/main/shared.c                               |   48 +
 src/mesa/main/shared.h                               |   11 
 src/mesa/main/texgetimage.c                          |    9 
 src/mesa/main/teximage.c                             |   22 
 src/mesa/main/texstore.c                             |   45 -
 src/mesa/main/version.h                              |    2 
 src/mesa/swrast/s_aaline.c                           |    2 
 src/mesa/swrast/s_aalinetemp.h                       |    2 
 src/mesa/swrast/s_aatriangle.c                       |    2 
 src/mesa/swrast/s_context.c                          |   25 
 src/mesa/swrast/s_fragprog.c                         |   12 
 src/mesa/swrast/s_fragprog.h                         |    2 
 src/mesa/swrast/s_lines.c                            |    2 
 src/mesa/swrast/s_span.c                             |   57 -
 src/mesa/swrast/s_triangle.c                         |    4 
 src/mesa/vbo/vbo_exec_array.c                        |    2 
 71 files changed, 1159 insertions(+), 669 deletions(-)

New commits:
commit c02820ba7e77428ea3800eaedefb9326ae6a0728
Author: Cyril Brulebois <kibi@debian.org>
Date:   Fri Feb 10 14:20:17 2012 +0100

    Upload to experimental.

diff --git a/debian/changelog b/debian/changelog
index 298c1be..42c3ec0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-mesa (8.0-1) UNRELEASED; urgency=low
+mesa (8.0-1) experimental; urgency=low
 
   [ Cyril Brulebois ]
   * New upstream release.
@@ -37,7 +37,7 @@ mesa (8.0-1) UNRELEASED; urgency=low
   [ Christopher James Halse Rogers ]
   * debian/control: Add libx11-xcb-dev to libegl1-mesa-dev depends.
 
- -- Robert Hooker <sarvatt@ubuntu.com>  Fri, 03 Feb 2012 10:19:43 -0500
+ -- Cyril Brulebois <kibi@debian.org>  Fri, 10 Feb 2012 14:02:04 +0100
 
 mesa (7.11.2-1) unstable; urgency=low
 

commit 95994fe93e730b5e77c9d99360f2c0399cb8a99c
Author: Cyril Brulebois <kibi@debian.org>
Date:   Fri Feb 10 12:15:15 2012 +0100

    Bump changelog.

diff --git a/debian/changelog b/debian/changelog
index e2ea063..298c1be 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,7 +1,7 @@
-mesa (8.0~rc2-1) UNRELEASED; urgency=low
+mesa (8.0-1) UNRELEASED; urgency=low
 
   [ Cyril Brulebois ]
-  * New upstream snapshot.
+  * New upstream release.
   * Disable patch temporarily (needs a refresh):
     - 11-hurd-ftbfs-again.diff
   * Drop patch, no longer needed since swrastg was renamed to swrast:

commit f9c9933f9c7f72f12be27ccda98c965c75f08a12
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Thu Feb 9 14:26:15 2012 -0800

    mesa: Bump version number to 8.0 (final)
    
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>

diff --git a/Makefile b/Makefile
index c1f7158..e0dd6ef 100644
--- a/Makefile
+++ b/Makefile
@@ -184,7 +184,7 @@ ultrix-gcc:
 
 # Rules for making release tarballs
 
-PACKAGE_VERSION=8.0-rc2
+PACKAGE_VERSION=8.0
 PACKAGE_DIR = Mesa-$(PACKAGE_VERSION)
 PACKAGE_NAME = MesaLib-$(PACKAGE_VERSION)
 
diff --git a/docs/relnotes-8.0.html b/docs/relnotes-8.0.html
index 4aa1753..6df8fc8 100644
--- a/docs/relnotes-8.0.html
+++ b/docs/relnotes-8.0.html
@@ -10,7 +10,7 @@
 
 <body bgcolor="#eeeeee">
 
-<H1>Mesa 8.0 Release Notes / (release date TBD)</H1>
+<H1>Mesa 8.0 Release Notes / February 9, 2012</H1>
 
 <p>
 Mesa 8.0 is a new development release.
diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h
index 12844b1..11fe922 100644
--- a/src/mesa/main/version.h
+++ b/src/mesa/main/version.h
@@ -35,7 +35,7 @@ struct gl_context;
 #define MESA_MAJOR 8
 #define MESA_MINOR 0
 #define MESA_PATCH 0
-#define MESA_VERSION_STRING "8.0-rc2"
+#define MESA_VERSION_STRING "8.0"
 
 /* To make version comparison easy */
 #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

commit b2b5d6b8fb839cb93173f2d59475ff1d4ba60494
Author: Anuj Phogat <anuj.phogat@gmail.com>
Date:   Wed Jan 25 19:05:45 2012 -0800

    mesa: fix maximum allowed proxy texture size condition
    
    width, height parameter in glTexImage2D() includes: texture image
    width + 2 * border (if any). So when doing the texture size check
    in _mesa_test_proxy_teximage() width and height should not exceed
    maximum supported size for target texture type + 2 * border.
    i.e. 1 << (ctx->Const.MaxTextureLevels - 1) + 2 * border
    
    Texture border is anyway stripped out before it is given to intel
    or gallium drivers.
    
    This patch fixes Intel oglconform test case:
    max_values negative.textureSize.textureCube
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44970
    
    Note: This is a candidate for mesa 8.0 branch.
    
    Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
    Reviewed-by: Ian Romanick <idr@freedesktop.org>
    Reviewed-by: Brian Paul <brianp@vmware.com>
    (cherry picked from commit ea228d97f811092b9ffcb90565184a7a8f089477)

diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 111e4bf..e4f678d 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1173,7 +1173,7 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
    switch (target) {
    case GL_PROXY_TEXTURE_1D:
       maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
-      if (width < 2 * border || width > maxSize)
+      if (width < 2 * border || width > 2 * border + maxSize)
          return GL_FALSE;
       if (level >= ctx->Const.MaxTextureLevels)
          return GL_FALSE;
@@ -1185,9 +1185,9 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
 
    case GL_PROXY_TEXTURE_2D:
       maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
-      if (width < 2 * border || width > maxSize)
+      if (width < 2 * border || width > 2 * border + maxSize)
          return GL_FALSE;
-      if (height < 2 * border || height > maxSize)
+      if (height < 2 * border || height > 2 * border + maxSize)
          return GL_FALSE;
       if (level >= ctx->Const.MaxTextureLevels)
          return GL_FALSE;
@@ -1201,11 +1201,11 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
 
    case GL_PROXY_TEXTURE_3D:
       maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1);
-      if (width < 2 * border || width > maxSize)
+      if (width < 2 * border || width > 2 * border + maxSize)
          return GL_FALSE;
-      if (height < 2 * border || height > maxSize)
+      if (height < 2 * border || height > 2 * border + maxSize)
          return GL_FALSE;
-      if (depth < 2 * border || depth > maxSize)
+      if (depth < 2 * border || depth > 2 * border + maxSize)
          return GL_FALSE;
       if (level >= ctx->Const.Max3DTextureLevels)
          return GL_FALSE;
@@ -1231,9 +1231,9 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
 
    case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
       maxSize = 1 << (ctx->Const.MaxCubeTextureLevels - 1);
-      if (width < 2 * border || width > maxSize)
+      if (width < 2 * border || width > 2 * border + maxSize)
          return GL_FALSE;
-      if (height < 2 * border || height > maxSize)
+      if (height < 2 * border || height > 2 * border + maxSize)
          return GL_FALSE;
       if (level >= ctx->Const.MaxCubeTextureLevels)
          return GL_FALSE;
@@ -1247,7 +1247,7 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
 
    case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
       maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
-      if (width < 2 * border || width > maxSize)
+      if (width < 2 * border || width > 2 * border + maxSize)
          return GL_FALSE;
       if (height < 1 || height > ctx->Const.MaxArrayTextureLayers)
          return GL_FALSE;
@@ -1261,9 +1261,9 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
 
    case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
       maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
-      if (width < 2 * border || width > maxSize)
+      if (width < 2 * border || width > 2 * border + maxSize)
          return GL_FALSE;
-      if (height < 2 * border || height > maxSize)
+      if (height < 2 * border || height > 2 * border + maxSize)
          return GL_FALSE;
       if (depth < 1 || depth > ctx->Const.MaxArrayTextureLayers)
          return GL_FALSE;

commit e86d90eb208292916c8a04c5d75499492003dd16
Author: Eric Anholt <eric@anholt.net>
Date:   Mon Jan 30 13:30:53 2012 -0800

    dri: Add Unigine Tropics as an app that requires the GLSL warn workaround.
    
    I wasn't seeing it be needed because of the previous bug.
    
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
    (cherry picked from commit b8c9252570d126e06607cd28b14f0fe3a2ffe4cf)

diff --git a/src/mesa/drivers/dri/common/drirc b/src/mesa/drivers/dri/common/drirc
index ac83a2d..59c00d7 100644
--- a/src/mesa/drivers/dri/common/drirc
+++ b/src/mesa/drivers/dri/common/drirc
@@ -3,5 +3,8 @@
         <application executable="Sanctuary">
             <option name="force_glsl_extensions_warn" value="true" />
 	</application>
+        <application executable="Tropics">
+            <option name="force_glsl_extensions_warn" value="true" />
+	</application>
     </device>
 </driconf>

commit 1531b94471fa283690fabb19e9a157247ba5fb8b
Author: Eric Anholt <eric@anholt.net>
Date:   Mon Jan 30 13:29:07 2012 -0800

    dri: Fix typo in xml file that made all applications use the workaround.
    
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
    (cherry picked from commit 4dd2743d4542bedd935134d351e528ad574f7ee5)

diff --git a/src/mesa/drivers/dri/common/drirc b/src/mesa/drivers/dri/common/drirc
index 7abc646..ac83a2d 100644
--- a/src/mesa/drivers/dri/common/drirc
+++ b/src/mesa/drivers/dri/common/drirc
@@ -1,6 +1,6 @@
 <driconf>
     <device screen="0" driver="i965">
-        <application name="Sanctuary">
+        <application executable="Sanctuary">
             <option name="force_glsl_extensions_warn" value="true" />
 	</application>
     </device>

commit b5efe0881ed385de36fa2f4889e1dd962990420a
Author: Eric Anholt <eric@anholt.net>
Date:   Wed Jan 25 14:22:03 2012 -0800

    dri: Add a default drirc to be installed to provide application workarounds.
    
    Specifially, this being present works around a bug in Unigine
    Sanctuary on i965 which previously resulted in bad rendering.
    
    NOTE: This is a candidate for the 8.0 branch.
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    (cherry picked from commit ff2497dca39d688bbceba9f524a61e99d93a9607)
    
    NOTE: Compared to ff2497d this does not install the default drirc.
    The pre-automake build system is sufficiently braindamaged to make
    this exceptionally difficult.

diff --git a/src/mesa/drivers/dri/common/drirc b/src/mesa/drivers/dri/common/drirc
new file mode 100644
index 0000000..7abc646
--- /dev/null
+++ b/src/mesa/drivers/dri/common/drirc
@@ -0,0 +1,7 @@
+<driconf>
+    <device screen="0" driver="i965">
+        <application name="Sanctuary">
+            <option name="force_glsl_extensions_warn" value="true" />
+	</application>
+    </device>
+</driconf>

commit 73e15679cede19a780481bb60fa2ca582c6abf0e
Author: Chih-Wei Huang <cwhuang@linux.org.tw>
Date:   Thu Feb 2 20:23:57 2012 +0800

    vbo: fix a building error
    
    Signed-off-by: Marek Olšák <maraeo@gmail.com>
    
    NOTE: This is a candidate for the 8.0 branch.
    (cherry picked from commit f8be4f33d31d004bfcf090fa7d4aa37b750e43af)

diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index fec49d3..e31e93f 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -1302,7 +1302,9 @@ vbo_exec_array_init( struct vbo_exec_context *exec )
    exec->vtxfmt.DrawArraysInstanced = vbo_exec_DrawArraysInstanced;
    exec->vtxfmt.DrawElementsInstanced = vbo_exec_DrawElementsInstanced;
    exec->vtxfmt.DrawElementsInstancedBaseVertex = vbo_exec_DrawElementsInstancedBaseVertex;
+#if FEATURE_EXT_transform_feedback
    exec->vtxfmt.DrawTransformFeedback = vbo_exec_DrawTransformFeedback;
+#endif
 }
 
 

commit 974a67b41e879b91765e3ef647ae22fe99a47079
Author: Eric Anholt <eric@anholt.net>
Date:   Mon Jan 30 09:50:35 2012 -0800

    glsl: Add error case for switch() with two default cases.
    
    Fixes piglit switch-case-duplicated.vert.
    
    NOTE: This is a candidate for the 8.0 branch.
    
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
    (cherry picked from commit 57e44371a5b6aa8122b6a482ed6bd33e797ea1d2)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 4f328ad..c580359 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -3537,6 +3537,7 @@ ast_switch_statement::hir(exec_list *instructions,
    state->switch_state.switch_nesting_ast = this;
    state->switch_state.labels_ht = hash_table_ctor(0, hash_table_pointer_hash,
 						   hash_table_pointer_compare);
+   state->switch_state.previous_default = NULL;
 
    /* Initalize is_fallthru state to false.
     */
@@ -3749,6 +3750,20 @@ ast_switch_statement::hir(exec_list *instructions,
 
 	instructions->push_tail(set_fallthru_on_test);
      } else { /* default case */
+	if (state->switch_state.previous_default) {
+	   printf("a\n");
+	   YYLTYPE loc = this->get_location();
+	   _mesa_glsl_error(& loc, state,
+			       "multiple default labels in one switch");
+
+	   printf("b\n");
+
+	   loc = state->switch_state.previous_default->get_location();
+	   _mesa_glsl_error(& loc, state,
+			    "this is the first default label");
+	}
+	state->switch_state.previous_default = this;
+
 	/* Set falltrhu state.
 	 */
 	ir_assignment *set_fallthru =
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index d5d5101..ee8f71b 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -51,6 +51,7 @@ struct glsl_switch_state {
 
    /** Table of constant values already used in case labels */
    struct hash_table *labels_ht;
+   class ast_case_label *previous_default;
 
    bool is_switch_innermost; // if switch stmt is closest to break, ...
 };

commit 83075bd0fe1fa4519f40edde1f9bc70967ee03a9
Author: Eric Anholt <eric@anholt.net>
Date:   Mon Jan 30 08:50:14 2012 -0800

    glsl: Throw an error when faced with a duplicated switch() case label.
    
    The error message I chose matches gcc's error.  Fixes piglit
    switch-case-duplicated.vert.
    
    NOTE: This is a candidate for the 8.0 branch.
    
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
    (cherry picked from commit 140632190cf41e6a035ca199b181091d4ed46986)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 28aff39..4f328ad 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -54,6 +54,7 @@
 #include "glsl_parser_extras.h"
 #include "ast.h"
 #include "glsl_types.h"
+#include "program/hash_table.h"
 #include "ir.h"
 
 void
@@ -3534,6 +3535,8 @@ ast_switch_statement::hir(exec_list *instructions,
 
    state->switch_state.is_switch_innermost = true;
    state->switch_state.switch_nesting_ast = this;
+   state->switch_state.labels_ht = hash_table_ctor(0, hash_table_pointer_hash,
+						   hash_table_pointer_compare);
 
    /* Initalize is_fallthru state to false.
     */
@@ -3572,6 +3575,8 @@ ast_switch_statement::hir(exec_list *instructions,
     */
    body->hir(instructions, state);
 
+   hash_table_dtor(state->switch_state.labels_ht);
+
    state->switch_state = saved;
 
      /* Switch statements do not have r-values.
@@ -3709,6 +3714,24 @@ ast_switch_statement::hir(exec_list *instructions,
 
 	   /* Stuff a dummy value in to allow processing to continue. */
 	   label_const = new(ctx) ir_constant(0);
+	} else {
+	   ast_expression *previous_label = (ast_expression *)
+	      hash_table_find(state->switch_state.labels_ht,
+			      (void *)(uintptr_t)label_const->value.u[0]);
+
+	   if (previous_label) {
+	      YYLTYPE loc = this->test_value->get_location();
+	      _mesa_glsl_error(& loc, state,
+			       "duplicate case value");
+
+	      loc = previous_label->get_location();
+	      _mesa_glsl_error(& loc, state,
+			       "this is the previous case label");
+	   } else {
+	      hash_table_insert(state->switch_state.labels_ht,
+				this->test_value,
+				(void *)(uintptr_t)label_const->value.u[0]);
+	   }
 	}
 
 	ir_dereference_variable *deref_test_var =
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index 35d1e3a..d5d5101 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -48,6 +48,10 @@ struct glsl_switch_state {
    ir_variable *is_fallthru_var;
    ir_variable *is_break_var;
    class ast_switch_statement *switch_nesting_ast;
+
+   /** Table of constant values already used in case labels */
+   struct hash_table *labels_ht;
+
    bool is_switch_innermost; // if switch stmt is closest to break, ...
 };
 

commit d799a7b585225441b5a424fbd3de8b719d0ada6e
Author: Eric Anholt <eric@anholt.net>
Date:   Mon Jan 30 09:46:09 2012 -0800

    glsl: Add other missing error location information for switch statements.
    
    NOTE: This is a candidate for the 8.0 branch.
    
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
    (cherry picked from commit 01a5a2c9d761d4c9d72c236084efee700dcb28b8)

diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index 8368d06..d5e85ab 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -1671,6 +1671,7 @@ switch_statement:
 	SWITCH '(' expression ')' switch_body
 	{
 	   $$ = new(state) ast_switch_statement($3, $5);
+	   $$->set_location(yylloc);
 	}
 	;
 
@@ -1707,6 +1708,7 @@ case_label_list:
 
 	   labels->labels.push_tail(& $1->link);
 	   $$ = labels;
+	   $$->set_location(yylloc);
 	}
 	| case_label_list case_label
 	{
@@ -1719,6 +1721,7 @@ case_statement:
 	case_label_list statement
 	{
 	   ast_case_statement *stmts = new(state) ast_case_statement($1);
+	   stmts->set_location(yylloc);
 
 	   stmts->stmts.push_tail(& $2->link);
 	   $$ = stmts;
@@ -1734,6 +1737,7 @@ case_statement_list:
 	case_statement
 	{
 	   ast_case_statement_list *cases= new(state) ast_case_statement_list();
+	   cases->set_location(yylloc);
 
 	   cases->cases.push_tail(& $1->link);
 	   $$ = cases;

commit 2b4df494b1f5f020444b14fcaeea6e02adb7d7ac
Author: Eric Anholt <eric@anholt.net>
Date:   Mon Jan 30 09:41:55 2012 -0800

    glsl: Add missing location info to case labels.
    
    Otherwise, the upcoming error messages said the location was 0:0(0).
    
    NOTE: This is a candidate for the 8.0 branch.
    
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
    (cherry picked from commit 663dcbbffeaedf0643e7e9d930ccfbcd698d1d9c)

diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index e774b46..8368d06 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -1691,10 +1691,12 @@ case_label:
 	CASE expression ':'
 	{
 	   $$ = new(state) ast_case_label($2);
+	   $$->set_location(yylloc);
 	}
 	| DEFAULT ':'
 	{
 	   $$ = new(state) ast_case_label(NULL);
+	   $$->set_location(yylloc);
 	}
 	;
 

commit 728bda08d85813eeda12ae52e0893a37533ba02c
Author: Eric Anholt <eric@anholt.net>
Date:   Sat Jan 28 11:43:22 2012 -0800

    glsl: Throw the required error when a case label is a non-constant.
    
    It's not quite spelled out in the spec text, but the grammar indicates
    that only constant values are allowed as switch() case labels (and
    only constant values make sense, anyway).
    
    Fixes piglit glsl-1.30/compiler/switch-statement/switch-case-uniform-int.vert.
    
    NOTE: This is a candidate for the 8.0 branch.
    
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
    (cherry picked from commit 2c3e10e71935506798c413363df27afc4348fb53)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 25ccdab..28aff39 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -3697,14 +3697,26 @@ ast_switch_statement::hir(exec_list *instructions,
 	/* Conditionally set fallthru state based on
 	 * comparison of cached test expression value to case label.
 	 */
-	ir_rvalue *const test_val = this->test_value->hir(instructions, state);
+	ir_rvalue *const label_rval = this->test_value->hir(instructions, state);
+	ir_constant *label_const = label_rval->constant_expression_value();
+
+	if (!label_const) {
+	   YYLTYPE loc = this->test_value->get_location();
+
+	   _mesa_glsl_error(& loc, state,
+			    "switch statement case label must be a "
+			    "constant expression");
+
+	   /* Stuff a dummy value in to allow processing to continue. */
+	   label_const = new(ctx) ir_constant(0);
+	}
 
 	ir_dereference_variable *deref_test_var =
 	   new(ctx) ir_dereference_variable(state->switch_state.test_var);
 
 	ir_rvalue *const test_cond = new(ctx) ir_expression(ir_binop_all_equal,
 							    glsl_type::bool_type,
-							    test_val,
+							    label_const,
 							    deref_test_var);
 
 	ir_assignment *set_fallthru_on_test =

commit f775d9aa848c61dcf7eb2ca6d599b40366034848
Author: Eric Anholt <eric@anholt.net>
Date:   Sat Jan 28 11:26:02 2012 -0800

    glsl: Save and restore the whole switch state for nesting.
    
    This stuffs them all in a struct for sanity.  Fixes piglit
    glsl-1.30/execution/switch/fs-uniform-nested.
    
    NOTE: This is a candidate for the 8.0 branch.
    
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
    (cherry picked from commit 22d81f154fed9e004cca91807808ae3b81b01ced)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index cde7052..25ccdab 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -3405,7 +3405,7 @@ ast_jump_statement::hir(exec_list *instructions,
 			  "continue may only appear in a loop");
       } else if (mode == ast_break &&
 		 state->loop_nesting_ast == NULL &&
-		 state->switch_nesting_ast == NULL) {
+		 state->switch_state.switch_nesting_ast == NULL) {
 	 YYLTYPE loc = this->get_location();
 
 	 _mesa_glsl_error(& loc, state,
@@ -3423,11 +3423,11 @@ ast_jump_statement::hir(exec_list *instructions,
 							  state);
 	 }
 
-	 if (state->is_switch_innermost &&
+	 if (state->switch_state.is_switch_innermost &&
 	     mode == ast_break) {
 	    /* Force break out of switch by setting is_break switch state.
 	     */
-	    ir_variable *const is_break_var = state->is_break_var;
+	    ir_variable *const is_break_var = state->switch_state.is_break_var;
 	    ir_dereference_variable *const deref_is_break_var =
 	       new(ctx) ir_dereference_variable(is_break_var);
 	    ir_constant *const true_val = new(ctx) ir_constant(true);
@@ -3530,25 +3530,22 @@ ast_switch_statement::hir(exec_list *instructions,
 
    /* Track the switch-statement nesting in a stack-like manner.
     */
-   ir_variable *saved_test_var = state->test_var;
-   ir_variable *saved_is_fallthru_var = state->is_fallthru_var;
-   
-   bool save_is_switch_innermost = state->is_switch_innermost;
-   ast_switch_statement *saved_nesting_ast = state->switch_nesting_ast;
+   struct glsl_switch_state saved = state->switch_state;
 
-   state->is_switch_innermost = true;
-   state->switch_nesting_ast = this;
+   state->switch_state.is_switch_innermost = true;
+   state->switch_state.switch_nesting_ast = this;
 
    /* Initalize is_fallthru state to false.
     */
    ir_rvalue *const is_fallthru_val = new (ctx) ir_constant(false);
-   state->is_fallthru_var = new(ctx) ir_variable(glsl_type::bool_type,
-					        "switch_is_fallthru_tmp",
-					        ir_var_temporary);
-   instructions->push_tail(state->is_fallthru_var);
+   state->switch_state.is_fallthru_var =
+      new(ctx) ir_variable(glsl_type::bool_type,
+			   "switch_is_fallthru_tmp",
+			   ir_var_temporary);
+   instructions->push_tail(state->switch_state.is_fallthru_var);
 
    ir_dereference_variable *deref_is_fallthru_var =
-      new(ctx) ir_dereference_variable(state->is_fallthru_var);
+      new(ctx) ir_dereference_variable(state->switch_state.is_fallthru_var);
    instructions->push_tail(new(ctx) ir_assignment(deref_is_fallthru_var,
 						  is_fallthru_val,
 						  NULL));
@@ -3556,13 +3553,13 @@ ast_switch_statement::hir(exec_list *instructions,
    /* Initalize is_break state to false.
     */
    ir_rvalue *const is_break_val = new (ctx) ir_constant(false);
-   state->is_break_var = new(ctx) ir_variable(glsl_type::bool_type,
-					      "switch_is_break_tmp",
-					      ir_var_temporary);
-   instructions->push_tail(state->is_break_var);
+   state->switch_state.is_break_var = new(ctx) ir_variable(glsl_type::bool_type,
+							   "switch_is_break_tmp",
+							   ir_var_temporary);
+   instructions->push_tail(state->switch_state.is_break_var);
 
    ir_dereference_variable *deref_is_break_var =
-      new(ctx) ir_dereference_variable(state->is_break_var);
+      new(ctx) ir_dereference_variable(state->switch_state.is_break_var);
    instructions->push_tail(new(ctx) ir_assignment(deref_is_break_var,
 						  is_break_val,
 						  NULL));
@@ -3575,254 +3572,248 @@ ast_switch_statement::hir(exec_list *instructions,
     */
    body->hir(instructions, state);
 
-   /* Restore previous nesting before returning.
-    */
-   state->switch_nesting_ast = saved_nesting_ast;
-   state->is_switch_innermost = save_is_switch_innermost;
-
-   state->test_var = saved_test_var;
-   state->is_fallthru_var = saved_is_fallthru_var;
-
-   /* Switch statements do not have r-values.
-    */
-   return NULL;
-}
-
-
-void
-ast_switch_statement::test_to_hir(exec_list *instructions,
-				  struct _mesa_glsl_parse_state *state)
-{
-   void *ctx = state;
-
-   /* Cache value of test expression.
-    */
-   ir_rvalue *const test_val =
-      test_expression->hir(instructions,
-			   state);
-
-   state->test_var = new(ctx) ir_variable(glsl_type::int_type,
-					  "switch_test_tmp",
-					  ir_var_temporary);
-   ir_dereference_variable *deref_test_var =
-      new(ctx) ir_dereference_variable(state->test_var);
-
-   instructions->push_tail(state->test_var);
-   instructions->push_tail(new(ctx) ir_assignment(deref_test_var,
-						  test_val,
-						  NULL));
-}
-
-
-ir_rvalue *
-ast_switch_body::hir(exec_list *instructions,
-		     struct _mesa_glsl_parse_state *state)
-{
-   if (stmts != NULL)
-      stmts->hir(instructions, state);
-      
-   /* Switch bodies do not have r-values.
-    */
-   return NULL;
-}
-
-
-ir_rvalue *
-ast_case_statement_list::hir(exec_list *instructions,
-			     struct _mesa_glsl_parse_state *state)
-{
-   foreach_list_typed (ast_case_statement, case_stmt, link, & this->cases)
-      case_stmt->hir(instructions, state);
-         
-   /* Case statements do not have r-values.
-    */
-   return NULL;
-}
-
-
-ir_rvalue *
-ast_case_statement::hir(exec_list *instructions,
-			struct _mesa_glsl_parse_state *state)
-{
-   labels->hir(instructions, state);
-   
-   /* Conditionally set fallthru state based on break state.
-    */
-   ir_constant *const false_val = new(state) ir_constant(false);
-   ir_dereference_variable *const deref_is_fallthru_var =
-      new(state) ir_dereference_variable(state->is_fallthru_var);
-   ir_dereference_variable *const deref_is_break_var =
-      new(state) ir_dereference_variable(state->is_break_var);
-   ir_assignment *const reset_fallthru_on_break =
-      new(state) ir_assignment(deref_is_fallthru_var,
-			       false_val,
-			       deref_is_break_var);
-   instructions->push_tail(reset_fallthru_on_break);
-
-   /* Guard case statements depending on fallthru state.
-    */
-   ir_dereference_variable *const deref_fallthru_guard =
-      new(state) ir_dereference_variable(state->is_fallthru_var);
-   ir_if *const test_fallthru = new(state) ir_if(deref_fallthru_guard);
-   
-   foreach_list_typed (ast_node, stmt, link, & this->stmts)
-      stmt->hir(& test_fallthru->then_instructions, state);
-
-   instructions->push_tail(test_fallthru);
-         
-   /* Case statements do not have r-values.
-    */
-   return NULL;
-}
-
-
-ir_rvalue *
-ast_case_label_list::hir(exec_list *instructions,
-			 struct _mesa_glsl_parse_state *state)
-{
-   foreach_list_typed (ast_case_label, label, link, & this->labels)
-      label->hir(instructions, state);
-         
-   /* Case labels do not have r-values.
-    */
-   return NULL;
-}
-
+   state->switch_state = saved;
 
-ir_rvalue *
-ast_case_label::hir(exec_list *instructions,
-		    struct _mesa_glsl_parse_state *state)
-{
-   void *ctx = state;
+     /* Switch statements do not have r-values.
+      */
+     return NULL;
+  }
 
-   ir_dereference_variable *deref_fallthru_var =
-      new(ctx) ir_dereference_variable(state->is_fallthru_var);
-   
-   ir_rvalue *const true_val = new(ctx) ir_constant(true);
 
-   /* If not default case, ...
-    */
-   if (this->test_value != NULL) {
-      /* Conditionally set fallthru state based on
-       * comparison of cached test expression value to case label.
-       */
-      ir_rvalue *const test_val = this->test_value->hir(instructions, state);
+  void
+  ast_switch_statement::test_to_hir(exec_list *instructions,
+				    struct _mesa_glsl_parse_state *state)
+  {
+     void *ctx = state;
 
-      ir_dereference_variable *deref_test_var =
-	 new(ctx) ir_dereference_variable(state->test_var);
+     /* Cache value of test expression.
+      */
+     ir_rvalue *const test_val =
+	test_expression->hir(instructions,
+			     state);
 
-      ir_rvalue *const test_cond = new(ctx) ir_expression(ir_binop_all_equal,
-							  glsl_type::bool_type,
-							  test_val,
-							  deref_test_var);
+     state->switch_state.test_var = new(ctx) ir_variable(glsl_type::int_type,
+							 "switch_test_tmp",
+							 ir_var_temporary);
+     ir_dereference_variable *deref_test_var =
+	new(ctx) ir_dereference_variable(state->switch_state.test_var);
 
-      ir_assignment *set_fallthru_on_test =
-	 new(ctx) ir_assignment(deref_fallthru_var,
-				true_val,
-				test_cond);
-   
-      instructions->push_tail(set_fallthru_on_test);
-   } else { /* default case */
-      /* Set falltrhu state.
-       */
-      ir_assignment *set_fallthru =
-	 new(ctx) ir_assignment(deref_fallthru_var,
-				true_val,
-				NULL);
-   
-      instructions->push_tail(set_fallthru);
-   }
-   
-   /* Case statements do not have r-values.
-    */
-   return NULL;
-}
+     instructions->push_tail(state->switch_state.test_var);
+     instructions->push_tail(new(ctx) ir_assignment(deref_test_var,
+						    test_val,
+						    NULL));
+  }
 
 
-void
-ast_iteration_statement::condition_to_hir(ir_loop *stmt,
-					  struct _mesa_glsl_parse_state *state)
-{
-   void *ctx = state;
+  ir_rvalue *
+  ast_switch_body::hir(exec_list *instructions,
+		       struct _mesa_glsl_parse_state *state)
+  {
+     if (stmts != NULL)
+	stmts->hir(instructions, state);
 
-   if (condition != NULL) {
-      ir_rvalue *const cond =
-	 condition->hir(& stmt->body_instructions, state);
+     /* Switch bodies do not have r-values.
+      */
+     return NULL;
+  }
 
-      if ((cond == NULL)
-	  || !cond->type->is_boolean() || !cond->type->is_scalar()) {
-	 YYLTYPE loc = condition->get_location();
 
-	 _mesa_glsl_error(& loc, state,
-			  "loop condition must be scalar boolean");
-      } else {
-	 /* As the first code in the loop body, generate a block that looks
-	  * like 'if (!condition) break;' as the loop termination condition.
-	  */
-	 ir_rvalue *const not_cond =
-	    new(ctx) ir_expression(ir_unop_logic_not, glsl_type::bool_type, cond,
-				   NULL);
+  ir_rvalue *
+  ast_case_statement_list::hir(exec_list *instructions,
+			       struct _mesa_glsl_parse_state *state)
+  {
+     foreach_list_typed (ast_case_statement, case_stmt, link, & this->cases)
+	case_stmt->hir(instructions, state);
 
-	 ir_if *const if_stmt = new(ctx) ir_if(not_cond);
+     /* Case statements do not have r-values.
+      */
+     return NULL;
+  }
 
-	 ir_jump *const break_stmt =
-	    new(ctx) ir_loop_jump(ir_loop_jump::jump_break);
 
-	 if_stmt->then_instructions.push_tail(break_stmt);
-	 stmt->body_instructions.push_tail(if_stmt);
-      }
-   }
-}
-
-
-ir_rvalue *
-ast_iteration_statement::hir(exec_list *instructions,
-			     struct _mesa_glsl_parse_state *state)
-{
-   void *ctx = state;
-
-   /* For-loops and while-loops start a new scope, but do-while loops do not.


Reply to: