[Mesa-dev] [PATCH 20/23] i965: Drop sizeof(struct brw_sampler_state) from estimated prim size.

Kenneth Graunke kenneth at whitecape.org
Wed Jul 30 12:07:26 PDT 2014


On Wednesday, July 30, 2014 11:28:00 AM Pohjolainen, Topi wrote:
> On Tue, Jul 29, 2014 at 04:29:25PM -0700, Kenneth Graunke wrote:
> > This is the last user of the structure.  Hardcoding 16 is poor style,
> > but this code is already a senseless mess, so it's not that much worse.
> > 
> > Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> > ---
> >  src/mesa/drivers/dri/i965/brw_draw.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> > 
> > diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
> > index ac21656..16f6f6a 100644
> > --- a/src/mesa/drivers/dri/i965/brw_draw.c
> > +++ b/src/mesa/drivers/dri/i965/brw_draw.c
> > @@ -444,9 +444,8 @@ static bool brw_try_draw_prims( struct gl_context *ctx,
> >        int estimated_max_prim_size;
> >  
> >        estimated_max_prim_size = 512; /* batchbuffer commands */
> > -      estimated_max_prim_size += (BRW_MAX_TEX_UNIT *
> > -				  (sizeof(struct brw_sampler_state) +
> > -				   sizeof(struct gen5_sampler_default_color)));
> > +      estimated_max_prim_size +=
> > +         (BRW_MAX_TEX_UNIT * (16 + sizeof(struct gen5_sampler_default_color)));
> 
> Maybe using a helper constant (sampler_size) here as well? I know it doesn't
> make much difference but would help a newbie reader.
> 
> >        estimated_max_prim_size += 1024; /* gen6 VS push constants */
> >        estimated_max_prim_size += 1024; /* gen6 WM push constants */
> >        estimated_max_prim_size += 512; /* misc. pad */
> 

Good idea.  Done.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140730/fc485079/attachment.sig>


More information about the mesa-dev mailing list