i965/vs: Fix GPU hangs in shaders with large virtual GRFs pre-gen6.
authorEric Anholt <eric@anholt.net>
Tue, 30 Aug 2011 22:50:17 +0000 (15:50 -0700)
committerEric Anholt <eric@anholt.net>
Wed, 7 Sep 2011 01:00:57 +0000 (18:00 -0700)
If you get your total GRF count wrong, you write over some other
shader's g0, and the GPU fails shortly thereafter.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp

index 72e0c0755f78a2b293113ea9334f282b9b872e15..9fd4922bb3fd76df0b47b2874aa96e783e790994 100644 (file)
@@ -216,7 +216,8 @@ vec4_visitor::reg_allocate()
       int reg = ra_get_node_reg(g, i);
 
       hw_reg_mapping[i] = first_assigned_grf + brw->vs.ra_reg_to_grf[reg];
-      prog_data->total_grf = MAX2(prog_data->total_grf, hw_reg_mapping[i] + 1);
+      prog_data->total_grf = MAX2(prog_data->total_grf,
+                                 hw_reg_mapping[i] + virtual_grf_sizes[i]);
    }
 
    foreach_list(node, &this->instructions) {