[Mesa-dev] [PATCH] st/mesa: In update_samplers(), clear all samplers at once.

Tilman Sauerbeck tilman at code-monkey.de
Mon Mar 21 11:28:41 PDT 2011


Signed-off-by: Tilman Sauerbeck <tilman at code-monkey.de>
---

update_samplers() showed up in a profile of Heroes of Newerth;
this patch pushes it down the profile by ~3%.

Does this seem plausible?

 src/mesa/state_tracker/st_atom_sampler.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index 474cbd5..4374ac1 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -129,12 +129,13 @@ update_samplers(struct st_context *st)
 
    st->state.num_samplers = 0;
 
+   memset(st->state.samplers, 0, st->ctx->Const.MaxTextureImageUnits *
+          sizeof(struct pipe_sampler_state));
+
    /* loop over sampler units (aka tex image units) */
    for (su = 0; su < st->ctx->Const.MaxTextureImageUnits; su++) {
       struct pipe_sampler_state *sampler = st->state.samplers + su;
 
-      memset(sampler, 0, sizeof(*sampler));
-
       if (samplersUsed & (1 << su)) {
          struct gl_texture_object *texobj;
          struct gl_texture_image *teximg;
-- 
1.7.3.5



More information about the mesa-dev mailing list