[Mesa-dev] [PATCH 2/4] r600g: update compressed_colortex_masks when a cmask is created or disabled

Marek Olšák maraeo at gmail.com
Thu Mar 10 16:36:28 UTC 2016


On Thu, Mar 10, 2016 at 12:07 AM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
> ---
>  src/gallium/drivers/r600/r600_state_common.c | 30 ++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
>
> diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
> index e3314bb..40ceb8d 100644
> --- a/src/gallium/drivers/r600/r600_state_common.c
> +++ b/src/gallium/drivers/r600/r600_state_common.c
> @@ -693,6 +693,26 @@ static void r600_set_sampler_views(struct pipe_context *pipe, unsigned shader,
>         }
>  }
>
> +static void r600_update_compressed_colortex_mask(struct r600_samplerview_state *views)
> +{
> +       uint32_t mask = views->enabled_mask;
> +
> +       while (mask) {
> +               unsigned i = u_bit_scan(&mask);
> +               struct pipe_resource *res = views->views[i]->base.texture;
> +
> +               if (res && res->target != PIPE_BUFFER) {
> +                       struct r600_texture *rtex = (struct r600_texture *)res;
> +
> +                       if (rtex->cmask.size) {
> +                               views->compressed_colortex_mask |= 1 << i;
> +                       } else {
> +                               views->compressed_colortex_mask &= ~(1 << i);
> +                       }

r600_set_sampler_views contains the same code. This conditional should
be moved to a separate function, so that both functions can use it.

Marek


More information about the mesa-dev mailing list