i965/vec4: Move total_scratch calculation into the visitor.
authorKenneth Graunke <kenneth@whitecape.org>
Mon, 29 Jun 2015 03:55:25 +0000 (20:55 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 10 Jul 2015 00:06:27 +0000 (17:06 -0700)
This is more consistent with how we do it in the FS backend, and reduces
a tiny bit of duplication.  It'll also allow for a bit more tidying.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/mesa/drivers/dri/i965/brw_gs.c
src/mesa/drivers/dri/i965/brw_vec4.cpp
src/mesa/drivers/dri/i965/brw_vs.c

index 7f947e0eb251dd770059ad55e051b8977a0cc2b5..9c59c8a0dfc04210a8fa7b90528eb14ce5961068 100644 (file)
@@ -267,10 +267,7 @@ brw_codegen_gs_prog(struct brw_context *brw,
    }
 
    /* Scratch space is used for register spilling */
-   if (c.base.last_scratch) {
-      c.prog_data.base.base.total_scratch
-         = brw_get_scratch_size(c.base.last_scratch*REG_SIZE);
-
+   if (c.prog_data.base.base.total_scratch) {
       brw_get_scratch_bo(brw, &stage_state->scratch_bo,
                         c.prog_data.base.base.total_scratch *
                          brw->max_gs_threads);
index 60f73e2c82c1b0e7539604bedaf050aff294987c..7b367ec036c49ff43f4cebdd4bf7fa298e5818b4 100644 (file)
@@ -1846,6 +1846,11 @@ vec4_visitor::run(gl_clip_plane *clip_planes)
 
    opt_set_dependency_control();
 
+   if (c->last_scratch > 0) {
+      prog_data->base.total_scratch =
+         brw_get_scratch_size(c->last_scratch * REG_SIZE);
+   }
+
    /* If any state parameters were appended, then ParameterValues could have
     * been realloced, in which case the driver uniform storage set up by
     * _mesa_associate_uniform_storage() would point to freed memory.  Make
@@ -1943,8 +1948,6 @@ brw_vs_emit(struct brw_context *brw,
       }
       g.generate_code(v.cfg, 8);
       assembly = g.get_assembly(final_assembly_size);
-
-      c->base.last_scratch = v.last_scratch;
    }
 
    if (!assembly) {
index edbcbcff818b31fb72d348d984d935f16f97494d..ee3f664093890d759c45c690959ffed87cf25210 100644 (file)
@@ -195,10 +195,7 @@ brw_codegen_vs_prog(struct brw_context *brw,
    }
 
    /* Scratch space is used for register spilling */
-   if (c.base.last_scratch) {
-      prog_data.base.base.total_scratch
-         = brw_get_scratch_size(c.base.last_scratch*REG_SIZE);
-
+   if (prog_data.base.base.total_scratch) {
       brw_get_scratch_bo(brw, &brw->vs.base.scratch_bo,
                         prog_data.base.base.total_scratch *
                          brw->max_vs_threads);