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 <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
This commit is contained in:
Kenneth Graunke 2015-06-28 20:55:25 -07:00
parent dc776ffb90
commit 8524deb8c8
3 changed files with 7 additions and 10 deletions

View 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);

View 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) {

View 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);