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

Pohjolainen, Topi topi.pohjolainen at intel.com
Wed Jul 30 01:28:00 PDT 2014


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 */
> -- 
> 2.0.2
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list