From 8524deb8c8fc37abc2cb2717be64a533746a92f9 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sun, 28 Jun 2015 20:55:25 -0700 Subject: [PATCH] i965/vec4: Move total_scratch calculation into the visitor. 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 Reviewed-by: Topi Pohjolainen --- src/mesa/drivers/dri/i965/brw_gs.c | 5 +---- src/mesa/drivers/dri/i965/brw_vec4.cpp | 7 +++++-- src/mesa/drivers/dri/i965/brw_vs.c | 5 +---- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c index 7f947e0eb25..9c59c8a0dfc 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.c +++ b/src/mesa/drivers/dri/i965/brw_gs.c @@ -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); diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp index 60f73e2c82c..7b367ec036c 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp @@ -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) { diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index edbcbcff818..ee3f6640938 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -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); -- 2.30.2