On 08/24/2016 04:54 PM, Jordan Justen wrote:
> Signed-off-by: Jordan Justen <[email protected]>
> ---
>  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 =
> +         _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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to