Keith Whitwell [2011-03-21 18:43]:
> On Mon, 2011-03-21 at 19:28 +0100, Tilman Sauerbeck wrote:
> > Signed-off-by: Tilman Sauerbeck <til...@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));
> > +
> 
> At a glance, could the memset be moved up another couple of lines and
> changed to:
> 
>  memset(st->state.samplers, 0, st->state.num_samplers * sizeof(struct 
> pipe_sampler_state));

I wondered about this, too. Consider the case where the sampler state is
undefined when update_samplers() is called though -- then we might end
up with partially uninitialized samplers, no?

Regards,
Tilman

-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

Attachment: pgpd6mh5uL0Yr.pgp
Description: PGP signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to