summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/anv_pass.c
diff options
context:
space:
mode:
authorNanley Chery <[email protected]>2017-02-27 10:23:33 -0800
committerNanley Chery <[email protected]>2017-03-02 13:17:54 -0800
commit178f9e5f29f3fe83eb5af99a69d7c583c30d21d1 (patch)
tree266671228dba6febbd56fd872343cca130fbcb4d /src/intel/vulkan/anv_pass.c
parentcd2b55e536dc806f9358f71db438dd9c246cdb14 (diff)
anv/pass: Avoid accessing attachment array out of bounds
Cc: <[email protected]> Signed-off-by: Nanley Chery <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_pass.c')
-rw-r--r--src/intel/vulkan/anv_pass.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/intel/vulkan/anv_pass.c b/src/intel/vulkan/anv_pass.c
index 2df18260d3a..a8b24703bcf 100644
--- a/src/intel/vulkan/anv_pass.c
+++ b/src/intel/vulkan/anv_pass.c
@@ -116,13 +116,15 @@ VkResult anv_CreateRenderPass(
for (uint32_t j = 0; j < desc->inputAttachmentCount; j++) {
uint32_t a = desc->pInputAttachments[j].attachment;
subpass->input_attachments[j] = a;
- pass->attachments[a].usage |= VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT;
- pass->attachments[a].subpass_usage[i] |= ANV_SUBPASS_USAGE_INPUT;
- pass->attachments[a].last_subpass_idx = i;
+ if (a != VK_ATTACHMENT_UNUSED) {
+ pass->attachments[a].usage |= VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT;
+ pass->attachments[a].subpass_usage[i] |= ANV_SUBPASS_USAGE_INPUT;
+ pass->attachments[a].last_subpass_idx = i;
- if (desc->pDepthStencilAttachment &&
- a == desc->pDepthStencilAttachment->attachment)
- subpass->has_ds_self_dep = true;
+ if (desc->pDepthStencilAttachment &&
+ a == desc->pDepthStencilAttachment->attachment)
+ subpass->has_ds_self_dep = true;
+ }
}
}
@@ -133,9 +135,11 @@ VkResult anv_CreateRenderPass(
for (uint32_t j = 0; j < desc->colorAttachmentCount; j++) {
uint32_t a = desc->pColorAttachments[j].attachment;
subpass->color_attachments[j] = a;
- pass->attachments[a].usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
- pass->attachments[a].subpass_usage[i] |= ANV_SUBPASS_USAGE_DRAW;
- pass->attachments[a].last_subpass_idx = i;
+ if (a != VK_ATTACHMENT_UNUSED) {
+ pass->attachments[a].usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
+ pass->attachments[a].subpass_usage[i] |= ANV_SUBPASS_USAGE_DRAW;
+ pass->attachments[a].last_subpass_idx = i;
+ }
}
}