linker: Fix regressions caused by previous commit
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 8 Dec 2010 03:00:44 +0000 (19:00 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 8 Dec 2010 03:00:44 +0000 (19:00 -0800)
That's what I get for not running piglit before pushing.

Don't try to patch types of unsized arrays when linking fails.

Don't try to patch types of unsized arrays that are shared between
shader stages.

src/glsl/linker.cpp

index d7638facce66ce8fc8a13b53dd3df01435549199..e62fe6d7e9fd4002a3ac070298da0d7da7fef9c2 100644 (file)
@@ -871,23 +871,27 @@ link_intrastage_shaders(void *mem_ctx,
     * unspecified sizes have a size specified.  The size is inferred from the
     * max_array_access field.
     */
-   foreach_list(node, linked->ir) {
-      ir_variable *const var = ((ir_instruction *) node)->as_variable();
+   if (linked != NULL) {
+      foreach_list(node, linked->ir) {
+        ir_variable *const var = ((ir_instruction *) node)->as_variable();
 
-      if (var == NULL)
-        continue;
+        if (var == NULL)
+           continue;
 
-      if (!var->type->is_array() || (var->type->length != 0))
-        continue;
+        if ((var->mode != ir_var_auto) && (var->mode != ir_var_temporary))
+           continue;
 
-      const glsl_type *type =
-        glsl_type::get_array_instance(var->type->fields.array,
-                                      var->max_array_access);
+        if (!var->type->is_array() || (var->type->length != 0))
+           continue;
 
-      assert(type != NULL);
-      var->type = type;
-   }
+        const glsl_type *type =
+           glsl_type::get_array_instance(var->type->fields.array,
+                                         var->max_array_access);
 
+        assert(type != NULL);
+        var->type = type;
+      }
+   }
 
    return linked;
 }