Mesa (master): glsl/ast: Fix assertion failure when GS input declared as non-array.

Paul Berry stereotype441 at kemper.freedesktop.org
Wed Aug 14 03:12:45 UTC 2013


Module: Mesa
Branch: master
Commit: 91c8fea924c05801a1e05edcee00e53ea73e48b8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=91c8fea924c05801a1e05edcee00e53ea73e48b8

Author: Paul Berry <stereotype441 at gmail.com>
Date:   Mon Aug 12 06:39:23 2013 -0700

glsl/ast: Fix assertion failure when GS input declared as non-array.

Previously, if a geometry shader input was declared as a non-array, we
would flag the proper compiler error, but then before we got a chance
to report it to the client, handle_geometry_shader_input_decl() would
assertion fail.

With this patch, handle_geometry_shader_input_decl() ignores
non-arrays.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/glsl/ast_to_hir.cpp |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 3610014..8e1e6e5 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2546,9 +2546,8 @@ process_initializer(ir_variable *var, ast_declaration *decl,
 
 
 /**
- * Do additional processing necessary for geometry shader input array
- * declarations (this covers both interface blocks arrays and input variable
- * arrays).
+ * Do additional processing necessary for geometry shader input declarations
+ * (this covers both interface blocks arrays and bare input variables).
  */
 static void
 handle_geometry_shader_input_decl(struct _mesa_glsl_parse_state *state,
@@ -2559,7 +2558,16 @@ handle_geometry_shader_input_decl(struct _mesa_glsl_parse_state *state,
       num_vertices = vertices_per_prim(state->gs_input_prim_type);
    }
 
-   assert(var->type->is_array());
+   /* Geometry shader input variables must be arrays.  Caller should have
+    * reported an error for this.
+    */
+   if (!var->type->is_array()) {
+      assert(state->error);
+
+      /* To avoid cascading failures, short circuit the checks below. */
+      return;
+   }
+
    if (var->type->length == 0) {
       /* Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says:
        *




More information about the mesa-commit mailing list