[Mesa-dev] [PATCH 04/16] i965/hsw: Adjust uploading default color for stencil surfaces

Pohjolainen, Topi topi.pohjolainen at gmail.com
Thu Aug 25 05:25:33 UTC 2016


On Wed, Aug 24, 2016 at 05:34:49PM -0700, Ian Romanick wrote:
> On 08/24/2016 04:54 PM, Jordan Justen wrote:
> > Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> > ---
> >  src/mesa/drivers/dri/i965/brw_sampler_state.c | 8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/src/mesa/drivers/dri/i965/brw_sampler_state.c b/src/mesa/drivers/dri/i965/brw_sampler_state.c
> > index 9f56c81..8ad34b8 100644
> > --- a/src/mesa/drivers/dri/i965/brw_sampler_state.c
> > +++ b/src/mesa/drivers/dri/i965/brw_sampler_state.c
> > @@ -281,7 +281,10 @@ upload_default_color(struct brw_context *brw,
> >        memset(sdc, 0, 20 * 4);
> >        sdc = &sdc[16];
> >  
> > -      int bits_per_channel = _mesa_get_format_bits(format, GL_RED_BITS);
> > +      int bits_per_channel =

And while we are here we could declare this constant as well. It doesn't
get altered either.

> > +         _mesa_get_format_bits(format,
> > +                               format == MESA_FORMAT_S_UINT8 ?
> > +                               GL_STENCIL_BITS : GL_RED_BITS);
> >  
> >        /* From the Haswell PRM, "Command Reference: Structures", Page 36:
> >         * "If any color channel is missing from the surface format,
> > @@ -290,8 +293,9 @@ upload_default_color(struct brw_context *brw,
> >         *  be programmed as 1."
> >         */
> >        unsigned c[4] = { 0, 0, 0, 1 };
> > +      bool is_color = _mesa_is_format_color_format(format);
> 
> constify
> 
> >        for (int i = 0; i < 4; i++) {
> > -         if (_mesa_format_has_color_component(format, i))
> > +         if (is_color ? _mesa_format_has_color_component(format, i) : i == 0)
> >              c[i] = color.ui[i];
> >        }
> >  
> > 
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list