Module: Mesa
Branch: staging/19.1
Commit: fa9ba5e19e21adfe477c28ba14cbac077948af3f
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=fa9ba5e19e21adfe477c28ba14cbac077948af3f

Author: Lionel Landwerlin <[email protected]>
Date:   Mon Jul 15 15:35:11 2019 +0300

anv: fix crash in vkCmdClearAttachments with unused attachment

anv_render_pass_compile() turns an unused attachment into a NULL
depth_stencil_attachment pointer so check that pointer before
accessing it.

Found with updates to existing CTS tests.

Signed-off-by: Lionel Landwerlin <[email protected]>
Fixes: 208be8eafa30be ("anv: Make subpass::depth_stencil_attachment a pointer")
Reviewed-by: Eric Engestrom <[email protected]>
Reviewed-by: Juan A. Suarez <[email protected]>
(cherry picked from commit c9c8c2f7d7d83443928717a00c3be8f1f690e6c3)

---

 src/intel/vulkan/anv_blorp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
index 0d3d3f948e6..96ee66f0655 100644
--- a/src/intel/vulkan/anv_blorp.c
+++ b/src/intel/vulkan/anv_blorp.c
@@ -1075,11 +1075,11 @@ clear_depth_stencil_attachment(struct anv_cmd_buffer 
*cmd_buffer,
 {
    static const union isl_color_value color_value = { .u32 = { 0, } };
    const struct anv_subpass *subpass = cmd_buffer->state.subpass;
-   const uint32_t att_idx = subpass->depth_stencil_attachment->attachment;
-
-   if (att_idx == VK_ATTACHMENT_UNUSED)
+   if (!subpass->depth_stencil_attachment)
       return;
 
+   const uint32_t att_idx = subpass->depth_stencil_attachment->attachment;
+   assert(att_idx != VK_ATTACHMENT_UNUSED);
    struct anv_render_pass_attachment *pass_att =
       &cmd_buffer->state.pass->attachments[att_idx];
 

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to