summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2018-01-17 17:10:34 -0800
committerEmil Velikov <emil.l.velikov@gmail.com>2018-02-09 03:50:10 +0000
commitae5e793fd7bb408fa6924924df06662010273a18 (patch)
tree24aa3952bcee8a59d3d6bea539c027fddd19f085
parent0bc9182f89f166f141e0f847d42c9fc557cc3aea (diff)
anv/pipeline: Don't look at blend state unless we have an attachment
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@lists.freedesktop.org Reviewed-by: Alex Smith <asmith@feralinteractive.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> (cherry picked from commit c8949e24984266cca3593291c30ea199baef5358)
-rw-r--r--src/intel/vulkan/genX_pipeline.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c
index 0f0c1a44371..f342225550d 100644
--- a/src/intel/vulkan/genX_pipeline.c
+++ b/src/intel/vulkan/genX_pipeline.c
@@ -1371,10 +1371,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;
}