[Mesa-dev] [PATCH] anv/pipeline: Don't look at blend state unless we have an attachment

Alex Smith asmith at feralinteractive.com
Thu Jan 18 10:37:27 UTC 2018


Oops, sorry about that.

Reviewed-by: Alex Smith <asmith at feralinteractive.com>

On 18 January 2018 at 01:16, Jason Ekstrand <jason at jlekstrand.net> wrote:

> Without this, we may end up dereferencing blend before we check for
> binding->index != UINT32_MAX.  However, Vulkan allows the blend state to
> be NULL so long as you don't have any color attachments.  This fixes a
> segfault when running The Talos Principal.
>
> Fixes: 12f4e00b69e724a23504b7bd3958fb75dc462950
> Cc: mesa-stable at lists.freedesktop.org
> ---
>  src/intel/vulkan/genX_pipeline.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_
> pipeline.c
> index cfc3bea..e8ac7c6 100644
> --- a/src/intel/vulkan/genX_pipeline.c
> +++ b/src/intel/vulkan/genX_pipeline.c
> @@ -1345,10 +1345,10 @@ has_color_buffer_write_enabled(const struct
> anv_pipeline *pipeline,
>        if (binding->set != ANV_DESCRIPTOR_SET_COLOR_ATTACHMENTS)
>           continue;
>
> -      const VkPipelineColorBlendAttachmentState *a =
> -         &blend->pAttachments[binding->index];
> +      if (binding->index == UINT32_MAX)
> +         continue;
>
> -      if (binding->index != UINT32_MAX && a->colorWriteMask != 0)
> +      if (blend->pAttachments[binding->index].colorWriteMask != 0)
>           return true;
>     }
>
> --
> 2.5.0.400.gff86faf
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180118/ca2fabb1/attachment.html>


More information about the mesa-dev mailing list