[Mesa-dev] [PATCH] anv: descriptors: don't update immutables samplers with anything but their immutable value

Jason Ekstrand jason at jlekstrand.net
Sat Jan 21 19:06:38 UTC 2017


Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

On Sat, Jan 21, 2017 at 4:28 AM, Lionel Landwerlin <
lionel.g.landwerlin at intel.com> wrote:

> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
> ---
>  src/intel/vulkan/anv_descriptor_set.c | 31 +++++++++++++++++++-----------
> -
>  1 file changed, 19 insertions(+), 12 deletions(-)
>
> diff --git a/src/intel/vulkan/anv_descriptor_set.c b/src/intel/vulkan/anv_
> descriptor_set.c
> index 4367c0ebe0..a5e65afc48 100644
> --- a/src/intel/vulkan/anv_descriptor_set.c
> +++ b/src/intel/vulkan/anv_descriptor_set.c
> @@ -587,8 +587,13 @@ void anv_UpdateDescriptorSets(
>        switch (write->descriptorType) {
>        case VK_DESCRIPTOR_TYPE_SAMPLER:
>           for (uint32_t j = 0; j < write->descriptorCount; j++) {
> -            ANV_FROM_HANDLE(anv_sampler, sampler,
> -                            write->pImageInfo[j].sampler);
> +            /* If this descriptor has an immutable sampler, we don't want
> to
> +             * stomp on it.
> +             */
> +            struct anv_sampler *sampler =
> +               bind_layout->immutable_samplers ?
> +               bind_layout->immutable_samplers[j] :
> +               anv_sampler_from_handle(write->pImageInfo[j].sampler);
>
>              desc[j] = (struct anv_descriptor) {
>                 .type = VK_DESCRIPTOR_TYPE_SAMPLER,
> @@ -601,17 +606,19 @@ void anv_UpdateDescriptorSets(
>           for (uint32_t j = 0; j < write->descriptorCount; j++) {
>              ANV_FROM_HANDLE(anv_image_view, iview,
>                              write->pImageInfo[j].imageView);
> -            ANV_FROM_HANDLE(anv_sampler, sampler,
> -                            write->pImageInfo[j].sampler);
> -
> -            desc[j].type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
> -            desc[j].image_view = iview;
> -
> -            /* If this descriptor has an immutable sampler, we don't want
> -             * to stomp on it.
> +            /* If this descriptor has an immutable sampler, we don't want
> to
> +             * stomp on it.
>               */
> -            if (sampler)
> -               desc[j].sampler = sampler;
> +            struct anv_sampler *sampler =
> +               bind_layout->immutable_samplers ?
> +               bind_layout->immutable_samplers[j] :
> +               anv_sampler_from_handle(write->pImageInfo[j].sampler);
> +
> +            desc[j] = (struct anv_descriptor) {
> +               .type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
> +               .image_view = iview,
> +               .sampler = sampler,
> +            };
>           }
>           break;
>
> --
> 2.11.0
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170121/731e9ad9/attachment.html>


More information about the mesa-dev mailing list