i965/fs: Move total_scratch calculation into fs_visitor::run().
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 14 May 2014 03:51:32 +0000 (20:51 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 19 May 2014 06:35:18 +0000 (23:35 -0700)
With this one use gone, c->last_scratch is now only used inside
fs_visitor.  The rest of the driver uses prog_data->total_scratch.

We already compute similar prog_data fields in fs_visitor, so this
seems reasonable.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_wm.c

index ed5bb0755f7a44092e65212d009e146eb3ee1e20..ea3c8dead53e5f0febebde3dfbac58c744dcfa59 100644 (file)
@@ -3093,6 +3093,10 @@ fs_visitor::run()
    if (!allocated_without_spills)
       schedule_instructions(SCHEDULE_POST);
 
+   if (c->last_scratch > 0) {
+      c->prog_data.total_scratch = brw_get_scratch_size(c->last_scratch);
+   }
+
    if (dispatch_width == 8)
       c->prog_data.reg_blocks = brw_register_blocks(grf_used);
    else
index cda86895bb59dda6aab6447fda0cdc62709a6faa..5242715603a6781d07364a04deed91995619839e 100644 (file)
@@ -184,10 +184,7 @@ bool do_wm_prog(struct brw_context *brw,
    if (program == NULL)
       return false;
 
-   /* Scratch space is used for register spilling */
-   if (c->last_scratch) {
-      c->prog_data.total_scratch = brw_get_scratch_size(c->last_scratch);
-
+   if (c->prog_data.total_scratch) {
       brw_get_scratch_bo(brw, &brw->wm.base.scratch_bo,
                         c->prog_data.total_scratch * brw->max_wm_threads);
    }