[Mesa-dev] [PATCH] i965: Only set key->flat_shade if COL0/COL1 are written.

Timothy Arceri tarceri at itsqueeze.com
Wed Aug 23 06:38:56 UTC 2017


Seems reasonable:

Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>

On 23/08/17 12:19, Kenneth Graunke wrote:
> This may reduce some recompiles.
> ---
>   src/mesa/drivers/dri/i965/brw_wm.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
> index c9c45045902..e1555d60c56 100644
> --- a/src/mesa/drivers/dri/i965/brw_wm.c
> +++ b/src/mesa/drivers/dri/i965/brw_wm.c
> @@ -531,7 +531,9 @@ brw_wm_populate_key(struct brw_context *brw, struct brw_wm_prog_key *key)
>         key->stats_wm = brw->stats_wm;
>   
>      /* _NEW_LIGHT */
> -   key->flat_shade = (ctx->Light.ShadeModel == GL_FLAT);
> +   key->flat_shade =
> +      (prog->info.inputs_read & (VARYING_BIT_COL0 | VARYING_BIT_COL1)) &&
> +      (ctx->Light.ShadeModel == GL_FLAT);
>   
>      /* _NEW_FRAG_CLAMP | _NEW_BUFFERS */
>      key->clamp_fragment_color = ctx->Color._ClampFragmentColor;
> 


More information about the mesa-dev mailing list