From e8980c61b2932cd4c8791fcc5afdb54fa033c224 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 11 Aug 2011 09:17:18 -0700 Subject: [PATCH] i965/vs: Fix the trivial register allocator's failure path. --- src/mesa/drivers/dri/i965/brw_vec4_emit.cpp | 3 +++ src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp index 350d544aba3..27160fb40d4 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp @@ -561,6 +561,9 @@ vec4_visitor::run() setup_payload(); reg_allocate(); + if (failed) + return false; + brw_set_access_mode(p, BRW_ALIGN_16); generate_code(); diff --git a/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp b/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp index 1bfd84d76e8..d5fd21d99a4 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_reg_allocate.cpp @@ -39,7 +39,6 @@ assign(int *reg_hw_locations, reg *reg) void vec4_visitor::reg_allocate_trivial() { - int last_grf = 0; int hw_reg_mapping[this->virtual_grf_count]; bool virtual_grf_used[this->virtual_grf_count]; int i; @@ -84,9 +83,9 @@ vec4_visitor::reg_allocate_trivial() assign(hw_reg_mapping, &inst->src[2]); } - if (last_grf >= BRW_MAX_GRF) { + if (prog_data->total_grf > BRW_MAX_GRF) { fail("Ran out of regs on trivial allocator (%d/%d)\n", - last_grf, BRW_MAX_GRF); + prog_data->total_grf, BRW_MAX_GRF); } } -- 2.30.2