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

mesa: Changes to 'upstream-unstable'



Rebased ref, commits from common ancestor:
commit 1659d87afe72bf6a6536c6154e684b72a0fb72e1
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Fri May 18 15:46:48 2012 -0700

    docs: Add 8.0.3 release notes
    
    Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>

diff --git a/docs/relnotes-8.0.3.html b/docs/relnotes-8.0.3.html
new file mode 100644
index 0000000..4e81da4
--- /dev/null
+++ b/docs/relnotes-8.0.3.html
@@ -0,0 +1,317 @@
+<HTML>
+
+<head>
+<TITLE>Mesa Release Notes</TITLE>
+<link rel="stylesheet" type="text/css" href="mesa.css">
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+</head>
+
+<BODY>
+
+<body bgcolor="#eeeeee">
+
+<H1>Mesa 8.0.3 Release Notes / May 18, 2012</H1>
+
+<p>
+Mesa 8.0.3 is a bug fix release which fixes bugs found since the 8.0.2 release.
+</p>
+<p>
+Mesa 8.0.3 implements the OpenGL 3.0 API, but the version reported by
+glGetString(GL_VERSION) depends on the particular driver being used.
+Some drivers don't support all the features required in OpenGL 3.0.
+</p>
+<p>
+See the <a href="install.html">Compiling/Installing page</a> for prerequisites
+for DRI hardware acceleration.
+</p>
+
+
+<h2>MD5 checksums</h2>
+<pre>
+TBD.
+</pre>
+
+<h2>New features</h2>
+<p>None.</p>
+
+<h2>Bug fixes</h2>
+
+<p>This list is likely incomplete.</p>
+
+<ul>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=28138";>Bug 28138</a> - [G45] Regnum Online, sparkling in in-game rendering</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=30102";>Bug 30102</a> - glean depthStencil test fails BadLength with indirect non-swrast rendering</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=40361";>Bug 40361</a> - Glitches on X3100 after upgrade to 7.11</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=41152";>Bug 41152</a> - [glsl] Shader backend in Regnum Online does not work</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=41216";>Bug 41216</a> - [bisected pineview]oglc filtercubemin(basic.sizedRGBA) fails</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=41372";>Bug 41372</a> - i830_state.c PBO crash</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=41495";>Bug 41495</a> - i830: intel_get_vb_max / intel_batchbuffer_space mismatch.</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=44701";>Bug 44701</a> - Regnum online textures flickering</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=44961";>Bug 44961</a> - [bisected i965] oglc sRGB(Mipmap.1D_textures) regressed</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=44970";>Bug 44970</a> - [i965]oglc max_values(negative.textureSize.textureCube) segfaults</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=45214";>Bug 45214</a> - Textures disappearing or missing in RegnumOnline OpenGL game</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=45558";>Bug 45558</a> - cannot render on a drawable of size equal the max framebuffer size</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=45921";>Bug 45921</a> - [r300g, bisected] Multiple piglit regressions after glsl_to_tgsi changes</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=46303";>Bug 46303</a> - [SNB] segfault in intel_miptree_release()</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=46739";>Bug 46739</a> - [snb-m-gt2+] compiz crashed with SIGSEGV in intel_miptree_release()</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=46834";>Bug 46834</a> - small performance when playing flightgear (swrast fallback through GTT mapping)</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=47126";>Bug 47126</a> - tests/fbo/fbo-array.c:109: create_array_fbo: Assertion `glGetError() == 0' failed.</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=48218";>Bug 48218</a> - brw_fs_schedule_instructions.cpp segfault due to accessing not allocated last_mrf_write[16]</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=48545";>Bug 48545</a> - LLVMpipe glReadPixels Firefox hits the slow path (WebGL rendering)</li>
+
+<li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=49124";>Bug 49124</a> - swrast/s_texfetch.c:1156: set_fetch_functions: Assertion `texImage-&gt;FetchTexel' failed.</li>
+
+<!-- <li><a href="https://bugs.freedesktop.org/show_bug.cgi?id=";>Bug </a> - </li> -->
+
+</ul>
+
+
+<h2>Changes</h2>
+<p>The full set of changes can be viewed by using the following GIT command:</p>
+
+<pre>
+  git log mesa-8.0.2..mesa-8.0.3
+</pre>
+
+<p>Alban Browaeys (1):
+<ul>
+  <li>dri/i915: Fix off-by-one in i830 clip region size.</li>
+</ul></p>
+
+<p>Alex Deucher (2):
+<ul>
+  <li>r200: fix fog coordinate emit</li>
+  <li>radeon: fix fog coordinate emit</li>
+</ul></p>
+
+<p>Alexander von Gluck (4):
+<ul>
+  <li>llvmpipe: fix symbol conflict on Haiku</li>
+  <li>svga: fix typedef conflicts on Haiku</li>
+  <li>mesa: Don't use newlocale on Haiku</li>
+  <li>glsl: Don't use newlocale on Haiku</li>
+</ul></p>
+
+<p>Anuj Phogat (4):
+<ul>
+  <li>mesa: fix issues with texture border and array textures</li>
+  <li>mesa: Fix valid texture target test in _mesa_GetTexLevelParameteriv()</li>
+  <li>mesa: Fix the cause of piglit test fbo-array failure</li>
+  <li>intel: Fix a case when mapping large texture fails</li>
+</ul></p>
+
+<p>Brian Paul (17):
+<ul>
+  <li>mesa: add a couple fast-paths to fast_read_rgba_pixels_memcpy()</li>
+  <li>mesa/gdi: remove wmesa_set_renderbuffer_funcs() function</li>
+  <li>mesa/gdi: remove clear_color() function</li>
+  <li>mesa: bump version to 8.0.2 in configs/default</li>
+  <li>swrast: include s_fragprog.h to silence warnings</li>
+  <li>mesa: remove LSB-first pixel packing check in glReadPixels</li>
+  <li>mesa: fix error in _mesa_format_matches_format_and_type() for RGB888</li>
+  <li>mesa: add BGR888 code in _mesa_format_matches_format_and_type()</li>
+  <li>vbo: fix node_attrsz[] usage in vbo_bind_vertex_list()</li>
+  <li>mesa: add missing texture integer test in glTexSubImage()</li>
+  <li>mesa: add missing return after _mesa_error() in update_array()</li>
+  <li>glsl: propagate MaxUnrollIterations to the optimizer's loop unroller</li>
+  <li>st/mesa: set MaxUnrollIterations = 255</li>
+  <li>st/mesa: no-op glCopyPixels if source region is out of bounds</li>
+  <li>mesa: do more teximage error checking for generic compressed formats</li>
+  <li>mesa: fix/add error check in _mesa_ColorMaterial()</li>
+  <li>mesa: fix glMaterial / dlist bug</li>
+</ul></p>
+
+<p>Chad Versace (3):
+<ul>
+  <li>glsl: Fix Android build</li>
+  <li>main: Fix memory leak in _mesa_make_extension_string()</li>
+  <li>intel: Disable ARB_framebuffer_object in ES contexts</li>
+</ul></p>
+
+<p>Chris Wilson (1):
+<ul>
+  <li>i830: Compute initial number of vertices from remaining batch space</li>
+</ul></p>
+
+<p>Dave Airlie (4):
+<ul>
+  <li>mesa/format_unpack: add LUMINANCE 8/16 UINT/INT</li>
+  <li>glx/drisw: avoid segfaults when we fail to get visual</li>
+  <li>drisw: fix image stride calculation for 16-bit.</li>
+  <li>intel: fix TFP at 16-bpp</li>
+</ul></p>
+
+<p>Dylan Noblesmith (7):
+<ul>
+  <li>intel: fix null dereference processing HiZ buffer</li>
+  <li>util: fix undefined behavior</li>
+  <li>util: fix uninitialized table</li>
+  <li>egl: fix uninitialized values</li>
+  <li>st/vega: fix uninitialized values</li>
+  <li>egl-static: fix printf warning</li>
+  <li>i965: fix typo</li>
+</ul></p>
+
+<p>Eric Anholt (19):
+<ul>
+  <li>i965/fs: Jump from discard statements to the end of the program when done.</li>
+  <li>intel: Fix rendering from textures after RenderTexture().</li>
+  <li>mesa: Fix handling of glCopyBufferSubData() for src == dst.</li>
+  <li>i965/fs: Move GL_CLAMP handling to coordinate setup.</li>
+  <li>i965/fs: Implement GL_CLAMP behavior on texture rectangles on gen6+.</li>
+  <li>mesa: Fix push/pop of multisample coverage invert.</li>
+  <li>mesa: Include the multisample enables under GL_MULTISAMPLE_BIT attrib as well.</li>
+  <li>mesa: Fix display list handling for GL_ARB_draw_instanced.</li>
+  <li>mesa: Fix display lists for draw_elements_base_vertex with draw_instanced.</li>
+  <li>mesa: Add missing error check for first &lt 0 in glDrawArraysInstanced().</li>
+  <li>i915: Fix piglit fbo-nodepth-test on i830.</li>
+  <li>intel: Return success when asked to allocate a 0-width/height renderbuffer.</li>
+  <li>mesa: Throw error on glGetActiveUniform inside Begin/End.</li>
+  <li>i965/vs: Fix up swizzle for dereference_array of matrices.</li>
+  <li>glsl: Fix indentation of switch code.</li>
+  <li>glsl: Let the constructor figure out the types of switch-related expressions.</li>
+  <li>glsl: Reject non-scalar switch expressions.</li>
+  <li>glsl: Fix assertion failure on handling switch on uint expressions.</li>
+  <li>mesa: Check for framebuffer completeness before looking at the rb.</li>
+</ul></p>
+
+<p>Eugeni Dodonov (1):
+<ul>
+  <li>intel: add PCI IDs for Ivy Bridge GT2 server variant</li>
+</ul></p>
+
+<p>Han Shen(沈涵) (1):
+<ul>
+  <li>bin/mklib: remove '-m32' for arm linux</li>
+</ul></p>
+
+<p>Ian Romanick (1):
+<ul>
+  <li>mesa: Bump version number to 8.0.3</li>
+</ul></p>
+
+<p>Jakob Bornecrantz (1):
+<ul>
+  <li>docs: Add 8.0.2 md5sums</li>
+</ul></p>
+
+<p>Jeremy Huddleston (7):
+<ul>
+  <li>darwin: Eliminate a pthread mutex leak</li>
+  <li>darwin: Fix an error message</li>
+  <li>darwin: Make reported errors more user-friendly</li>
+  <li>darwin: Use ASL for logging</li>
+  <li>darwin: Unlock our mutex before destroying it</li>
+  <li>darwin: Eliminate a possible race condition while destroying a surface</li>
+  <li>darwin: Address a build failure on Leopard and earlier OS versions</li>
+</ul></p>
+
+<p>Jon TURNEY (1):
+<ul>
+  <li>Have __glImageSize handle format GL_DEPTH_STENCIL_NV the same way as the server does</li>
+</ul></p>
+
+<p>Jonas Maebe (2):
+<ul>
+  <li>glapi: Correct size of allocated _glapi_table struct</li>
+  <li>apple: Fix a use after free</li>
+</ul></p>
+
+<p>Jordan Justen (1):
+<ul>
+  <li>mesa: Add primitive restart support to glArrayElement</li>
+</ul></p>
+
+<p>Kenneth Graunke (12):
+<ul>
+  <li>i965: Actually upload sampler state pointers for the VS unit on Gen6.</li>
+  <li>i965/fs: Fix FB writes that tried to use the non-existent m16 register.</li>
+  <li>vbo: Remove pedantic warning about 'end' beind out of bounds.</li>
+  <li>vbo: Ignore invalid element ranges which are outside VBO bounds.</li>
+  <li>vbo: Rework checking of 'end' against _MaxElement.</li>
+  <li>vbo: Eliminate short-circuiting in invalid-start case.</li>
+  <li>i965: Fix GPU hangs in the dummy fragment shader.</li>
+  <li>i965: Make the dummy fragment shader work in SIMD16 mode.</li>
+  <li>drirc: Add force_glsl_extensions_warn workaround for Unigine Heaven.</li>
+  <li>i965: Avoid explicit accumulator operands in SIMD16 mode on Gen7.</li>
+  <li>intel: Remove pointless software fallback for glBitmap on Gen6.</li>
+  <li>glsl: Fix broken constant expression handling for &lt, &lt=, &gt;, and &gt;=.</li>
+</ul></p>
+
+<p>Kurt Roeckx (2):
+<ul>
+  <li>i915: Compute maximum number of verts using the actual batchbuffer size.</li>
+  <li>i915: Fix i830 polygon stipple from PBOs.</li>
+</ul></p>
+
+<p>Marek Olšák (5):
+<ul>
+  <li>r300g/swtcl: don't print an error when getting ClipVertex</li>
+  <li>r300g/swtcl: don't enter u_vbuf_mgr</li>
+  <li>r300g/swtcl: don't expose shader subroutine support</li>
+  <li>r300g/swtcl: fix polygon offset</li>
+  <li>r300g/swtcl: fix crash when back color is present in vertex shader</li>
+</ul></p>
+
+<p>Mathias Fröhlich (1):
+<ul>
+  <li>glsl: Avoid excessive loop unrolling.</li>
+</ul></p>
+
+<p>Matt Turner (1):
+<ul>
+  <li>Remove -ffast-math from default CFLAGS</li>
+</ul></p>
+
+<p>Paul Berry (1):
+<ul>
+  <li>i915: Initialize swrast_texture_image structure fields.</li>
+</ul></p>
+
+<p>Roland Scheidegger (1):
+<ul>
+  <li>mesa: check_index_bounds off-by-one fix</li>
+</ul></p>
+
+<p>Tom Stellard (2):
+<ul>
+  <li>r300/compiler: Clear loop registers in vertex shaders w/o loops</li>
+  <li>r300/compiler: Copy all instruction attributes during local transfoms</li>
+</ul></p>
+
+<p>Vinson Lee (5):
+<ul>
+  <li>mesa: Fix memory leak in _mesa_get_uniform_location.</li>
+  <li>linker: Fix memory leak in count_uniform_size::visit_field.</li>
+  <li>swrast: Fix memory leaks in blit_linear.</li>
+  <li>ir_to_mesa: Fix uninitialized member in add_uniform_to_shader.</li>
+  <li>mesa: Fix memory leak in generate_mipmap_compressed.</li>
+</ul></p>
+
+<p>Yuanhan Liu (2):
+<ul>
+  <li>i915: set SPRITE_POINT_ENABLE bit correctly</li>
+  <li>i965: fix wrong cube/3D texture layout</li>
+</ul></p>
+
+</body>
+</html>

commit 60dffb92de8bed96f7335bf07639fe80831d6c5a
Author: Ian Romanick <ian.d.romanick@intel.com>
Date:   Fri May 18 15:27:58 2012 -0700

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

diff --git a/Makefile b/Makefile
index 6084e73..be73f10 100644
--- a/Makefile
+++ b/Makefile
@@ -184,7 +184,7 @@ ultrix-gcc:
 
 # Rules for making release tarballs
 
-PACKAGE_VERSION=8.0.2
+PACKAGE_VERSION=8.0.3
 PACKAGE_DIR = Mesa-$(PACKAGE_VERSION)
 PACKAGE_NAME = MesaLib-$(PACKAGE_VERSION)
 
diff --git a/configs/default b/configs/default
index a4069cb..5e703e2 100644
--- a/configs/default
+++ b/configs/default
@@ -10,7 +10,7 @@ CONFIG_NAME = default
 # Version info
 MESA_MAJOR=8
 MESA_MINOR=0
-MESA_TINY=2
+MESA_TINY=3
 MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY)
 
 # external projects.  This should be useless now that we use libdrm.
diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h
index bc0494c..d9ef3d0 100644
--- a/src/mesa/main/version.h
+++ b/src/mesa/main/version.h
@@ -34,8 +34,8 @@ struct gl_context;
 /* Mesa version */
 #define MESA_MAJOR 8
 #define MESA_MINOR 0
-#define MESA_PATCH 2
-#define MESA_VERSION_STRING "8.0.2"
+#define MESA_PATCH 3
+#define MESA_VERSION_STRING "8.0.3"
 
 /* To make version comparison easy */
 #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

commit b5b65af5fa0f9de5fc4af8fbfe7ca9ebe8c871a3
Author: Eric Anholt <eric@anholt.net>
Date:   Mon May 14 10:18:23 2012 -0700

    mesa: Check for framebuffer completeness before looking at the rb.
    
    Otherwise, an incomplete framebuffer could have a NULL
    _ColorReadBuffer and we'd deref that.
    
    Reviewed-by: Brian Paul <brianp@vmware.com>
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
    (cherry picked from commit 5a827d9a2b5d698fed98a5d62ff0292b48bdd6c7)

diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index b9c9351..6c041fa 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -819,6 +819,12 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
       return;
    }
 
+   if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
+      _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
+                  "glReadPixels(incomplete framebuffer)" );
+      return;
+   }
+
    /* Check that the destination format and source buffer are both
     * integer-valued or both non-integer-valued.
     */
@@ -833,12 +839,6 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
       }
    }
 
-   if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
-      _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
-                  "glReadPixels(incomplete framebuffer)" );
-      return;
-   }
-
    if (ctx->ReadBuffer->Name != 0 && ctx->ReadBuffer->Visual.samples > 0) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(multisample FBO)");
       return;

commit e0e8f1efada825cff290895e5fc3b4ca957b68f7
Author: Eric Anholt <eric@anholt.net>
Date:   Mon May 14 08:51:03 2012 -0700

    glsl: Fix assertion failure on handling switch on uint expressions.
    
    Fixes piglit glsl-1.30/execution/switch/fs-uint.
    
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
    (cherry picked from commit 9c4e9ce051bb43861adb4f8cd8e88a733c2f3ed1)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index ca51ead..d3fdcf0 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -3594,7 +3594,7 @@ ast_switch_statement::test_to_hir(exec_list *instructions,
       test_expression->hir(instructions,
 			   state);
 
-   state->switch_state.test_var = new(ctx) ir_variable(glsl_type::int_type,
+   state->switch_state.test_var = new(ctx) ir_variable(test_val->type,
 						       "switch_test_tmp",
 						       ir_var_temporary);
    ir_dereference_variable *deref_test_var =

commit 91874c3252d179a4f54b19f4178d7f5bdd706bcb
Author: Eric Anholt <eric@anholt.net>
Date:   Mon May 14 08:45:59 2012 -0700

    glsl: Reject non-scalar switch expressions.
    
    The comment quotes spec saying that only scalar integers are allowed,
    but we only checked for integer.
    
    Fixes piglit switch-expression-const-ivec2.vert
    
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
    (cherry picked from commit bbbc7c7d566905920967f56648fc26abcb37f4a1)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index de18d29..ca51ead 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -3516,11 +3516,9 @@ ast_switch_statement::hir(exec_list *instructions,
     *
     *    "The type of init-expression in a switch statement must be a 
     *     scalar integer." 
-    *
-    * The checks are separated so that higher quality diagnostics can be
-    * generated for cases where the rule is violated.
     */
-   if (!test_expression->type->is_integer()) {
+   if (!test_expression->type->is_scalar() ||
+       !test_expression->type->is_integer()) {
       YYLTYPE loc = this->test_expression->get_location();
 
       _mesa_glsl_error(& loc,

commit 2d105870c9873e37957f97cd60eda16d39ac361e
Author: Eric Anholt <eric@anholt.net>
Date:   Mon May 14 08:39:54 2012 -0700

    glsl: Let the constructor figure out the types of switch-related expressions.
    
    I noticed this while unindenting the code.
    
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
    (cherry picked from commit 5d6ea16dfe99e1aba61c25a897b66951faab1a39)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 81609e7..de18d29 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -3726,7 +3726,6 @@ ast_case_label::hir(exec_list *instructions,
 	 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,
 							  label_const,
 							  deref_test_var);
 
@@ -3783,9 +3782,7 @@ ast_iteration_statement::condition_to_hir(ir_loop *stmt,
 	  * 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);
+	    new(ctx) ir_expression(ir_unop_logic_not, cond);
 
 	 ir_if *const if_stmt = new(ctx) ir_if(not_cond);
 

commit 912acd045c520165b13537a24873ef21ff7a155d
Author: Eric Anholt <eric@anholt.net>
Date:   Mon May 14 08:37:50 2012 -0700

    glsl: Fix indentation of switch code.
    
    I managed to completely trash it in 22d81f15.
    
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
    (cherry picked from commit 5462f3679ab7217d3a3be48365750801c7771237)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index c580359..81609e7 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -3571,7 +3571,7 @@ ast_switch_statement::hir(exec_list *instructions,
    /* Cache test expression.
     */
    test_to_hir(instructions, state);
-   
+
    /* Emit code for body of switch stmt.
     */
    body->hir(instructions, state);
@@ -3580,290 +3580,271 @@ ast_switch_statement::hir(exec_list *instructions,
 
    state->switch_state = saved;
 
-     /* 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->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);
-
-     instructions->push_tail(state->switch_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->switch_state.is_fallthru_var);
-     ir_dereference_variable *const deref_is_break_var =
-	new(state) ir_dereference_variable(state->switch_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->switch_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;
-  }
-
-
-  ir_rvalue *
-  ast_case_label::hir(exec_list *instructions,
-		      struct _mesa_glsl_parse_state *state)
-  {
-     void *ctx = state;
-
-     ir_dereference_variable *deref_fallthru_var =
-	new(ctx) ir_dereference_variable(state->switch_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 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);
-	} else {
-	   ast_expression *previous_label = (ast_expression *)
-	      hash_table_find(state->switch_state.labels_ht,
+   /* 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->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);
+
+   instructions->push_tail(state->switch_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->switch_state.is_fallthru_var);
+   ir_dereference_variable *const deref_is_break_var =
+      new(state) ir_dereference_variable(state->switch_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->switch_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;
+}
+
+ir_rvalue *
+ast_case_label::hir(exec_list *instructions,
+		    struct _mesa_glsl_parse_state *state)
+{
+   void *ctx = state;
+
+   ir_dereference_variable *deref_fallthru_var =
+      new(ctx) ir_dereference_variable(state->switch_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 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);
+      } 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 =
+	 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,
+							  label_const,
+							  deref_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 */
+      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 =
+	 new(ctx) ir_assignment(deref_fallthru_var, true_val, NULL);
+
+      instructions->push_tail(set_fallthru);
+   }
 
-	   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 =
-	   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,
-							    label_const,
-							    deref_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 */
-	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 =
-	   new(ctx) ir_assignment(deref_fallthru_var,
-				  true_val,
-				  NULL);
-
-	instructions->push_tail(set_fallthru);
-     }
-
-     /* Case statements do not have r-values.
-      */
-     return NULL;
-  }
-
-
-  void
-  ast_iteration_statement::condition_to_hir(ir_loop *stmt,
-					    struct _mesa_glsl_parse_state *state)
-  {
-     void *ctx = state;
-
-     if (condition != NULL) {
-	ir_rvalue *const cond =
-	   condition->hir(& stmt->body_instructions, state);
-
-	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_if *const if_stmt = new(ctx) ir_if(not_cond);
-
-	   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.
-      */
-     if (mode != ast_do_while)
-	state->symbols->push_scope();
-
-     if (init_statement != NULL)
-	init_statement->hir(instructions, state);
-
-     ir_loop *const stmt = new(ctx) ir_loop();
-     instructions->push_tail(stmt);
-
-     /* Track the current loop nesting.
-      */
-     ast_iteration_statement *nesting_ast = state->loop_nesting_ast;
-
-     state->loop_nesting_ast = this;
-
-     /* Likewise, indicate that following code is closest to a loop,
-      * NOT closest to a switch.
-      */
-     bool saved_is_switch_innermost = state->switch_state.is_switch_innermost;
-     state->switch_state.is_switch_innermost = false;
-
-     if (mode != ast_do_while)
-	condition_to_hir(stmt, state);
-
-     if (body != NULL)
-	body->hir(& stmt->body_instructions, state);
-


Reply to: