diff options
author | Eric Anholt <[email protected]> | 2010-10-21 15:07:45 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2010-10-21 15:21:28 -0700 |
commit | 4e7252510976d8d3ff12437ea8842129f24d88f5 (patch) | |
tree | c2e50a075fd7ede483e7265f46567cdbc5370d2b /src/mesa/drivers/dri/i965/brw_wm.c | |
parent | 0b77d57394a3712851ec271aa7ad353d56f302a1 (diff) |
i965: Correct scratch space allocation.
One, it was allocating increments of 1kb, but per thread scratch space
is a power of two. Two, the new FS wasn't getting total_scratch set
at all, so everyone thought they had 1kb and writes beyond 1kb would
go stomping on a neighbor thread.
With this plus the previous register spilling for the new FS,
glsl-fs-convolution-1 passes.
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_wm.c')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index f2ce7565643..7f3ba5f0581 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -114,14 +114,6 @@ brw_wm_non_glsl_emit(struct brw_context *brw, struct brw_wm_compile *c) /* how many general-purpose registers are used */ c->prog_data.total_grf = c->max_wm_grf; - /* Scratch space is used for register spilling */ - if (c->last_scratch) { - c->prog_data.total_scratch = c->last_scratch + 0x40; - } - else { - c->prog_data.total_scratch = 0; - } - /* Emit GEN4 code. */ brw_wm_emit(c); @@ -193,6 +185,19 @@ static void do_wm_prog( struct brw_context *brw, } } + /* Scratch space is used for register spilling */ + if (c->last_scratch) { + /* Per-thread scratch space is power-of-two sized. */ + for (c->prog_data.total_scratch = 1024; + c->prog_data.total_scratch <= c->last_scratch; + c->prog_data.total_scratch *= 2) { + /* empty */ + } + } + else { + c->prog_data.total_scratch = 0; + } + if (INTEL_DEBUG & DEBUG_WM) fprintf(stderr, "\n"); |