summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i965/brw_wm_pass0.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2009-11-10 15:51:29 -0800
committerEric Anholt <eric@anholt.net>2009-11-10 16:00:30 -0800
commitc5413839b3e99c7b162f1260142f3c175502b0ce (patch)
tree0f849b3db0283418d5b511de98ae8758ceecb108 /src/mesa/drivers/dri/i965/brw_wm_pass0.c
parenteb6a1f8a00596156cd7164838ef9e9a5b39e7254 (diff)
i965: avoid memsetting all the BRW_WM_MAX_INSN arrays for every compile.
For an app that's blowing out the state cache, like sauerbraten, the memset of the giant arrays ended up taking 11% of the CPU even when only a "few" of the entries got used. With this, the WM program compile drops back down to 1% of CPU time. Bug #24981 (bisected to BRW_WM_MAX_INSN increase).
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_wm_pass0.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_pass0.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_wm_pass0.c b/src/mesa/drivers/dri/i965/brw_wm_pass0.c
index 602b1351ef..ff4c082d5e 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_pass0.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_pass0.c
@@ -42,12 +42,14 @@
static struct brw_wm_ref *get_ref( struct brw_wm_compile *c )
{
assert(c->nr_refs < BRW_WM_MAX_REF);
+ memset(&c->refs[c->nr_refs], 0, sizeof(*c->refs));
return &c->refs[c->nr_refs++];
}
static struct brw_wm_value *get_value( struct brw_wm_compile *c)
{
assert(c->nr_refs < BRW_WM_MAX_VREG);
+ memset(&c->vreg[c->nr_vreg], 0, sizeof(*c->vreg));
return &c->vreg[c->nr_vreg++];
}
@@ -55,6 +57,7 @@ static struct brw_wm_value *get_value( struct brw_wm_compile *c)
static struct brw_wm_instruction *get_instruction( struct brw_wm_compile *c )
{
assert(c->nr_insns < BRW_WM_MAX_INSN);
+ memset(&c->instruction[c->nr_insns], 0, sizeof(*c->instruction));
return &c->instruction[c->nr_insns++];
}