diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c index 72a468a744..c4f89068a8 100644 --- a/src/intel/vulkan/anv_blorp.c +++ b/src/intel/vulkan/anv_blorp.c @@ -1148,6 +1148,9 @@ anv_cmd_buffer_flush_attachments(struct anv_cmd_buffer *cmd_buffer, for (uint32_t i = 0; i < subpass->color_count; ++i) { uint32_t att = subpass->color_attachments[i].attachment; + if (att == VK_ATTACHMENT_UNUSED) + continue; + assert(att < pass->attachment_count); if (attachment_needs_flush(cmd_buffer, &pass->attachments[att], stage)) { cmd_buffer->state.pending_pipe_bits |= @@ -1158,11 +1161,14 @@ anv_cmd_buffer_flush_attachments(struct anv_cmd_buffer *cmd_buffer, if (subpass->depth_stencil_attachment.attachment != VK_ATTACHMENT_UNUSED) { uint32_t att = subpass->depth_stencil_attachment.attachment; - assert(att < pass->attachment_count); - if (attachment_needs_flush(cmd_buffer, &pass->attachments[att], stage)) { - cmd_buffer->state.pending_pipe_bits |= - ANV_PIPE_TEXTURE_CACHE_INVALIDATE_BIT | - ANV_PIPE_DEPTH_CACHE_FLUSH_BIT; + if (att != VK_ATTACHMENT_UNUSED) + { + assert(att < pass->attachment_count); + if (attachment_needs_flush(cmd_buffer, &pass->attachments[att], stage)) { + cmd_buffer->state.pending_pipe_bits |= + ANV_PIPE_TEXTURE_CACHE_INVALIDATE_BIT | + ANV_PIPE_DEPTH_CACHE_FLUSH_BIT; + } } } } @@ -1175,7 +1181,7 @@ subpass_needs_clear(const struct anv_cmd_buffer *cmd_buffer) for (uint32_t i = 0; i < cmd_state->subpass->color_count; ++i) { uint32_t a = cmd_state->subpass->color_attachments[i].attachment; - if (cmd_state->attachments[a].pending_clear_aspects) { + if (a != VK_ATTACHMENT_UNUSED && cmd_state->attachments[a].pending_clear_aspects) { return true; } } @@ -1214,6 +1220,9 @@ anv_cmd_buffer_clear_subpass(struct anv_cmd_buffer *cmd_buffer) struct anv_framebuffer *fb = cmd_buffer->state.framebuffer; for (uint32_t i = 0; i < cmd_state->subpass->color_count; ++i) { const uint32_t a = cmd_state->subpass->color_attachments[i].attachment; + if (a == VK_ATTACHMENT_UNUSED) + continue; + struct anv_attachment_state *att_state = &cmd_state->attachments[a]; if (!att_state->pending_clear_aspects) @@ -1437,6 +1446,9 @@ ccs_resolve_attachment(struct anv_cmd_buffer *cmd_buffer, struct blorp_batch *batch, uint32_t att) { + if (att == VK_ATTACHMENT_UNUSED) + return; + struct anv_framebuffer *fb = cmd_buffer->state.framebuffer; struct anv_attachment_state *att_state = &cmd_buffer->state.attachments[att]; diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 1ce549a202..f67c55b055 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -1165,7 +1165,10 @@ emit_binding_table(struct anv_cmd_buffer *cmd_buffer, assert(binding->binding == 0); if (binding->index < subpass->color_count) { const unsigned att = subpass->color_attachments[binding->index].attachment; - surface_state = cmd_buffer->state.attachments[att].color_rt_state; + if (att != VK_ATTACHMENT_UNUSED) + surface_state = cmd_buffer->state.attachments[att].color_rt_state; + else + surface_state = cmd_buffer->state.null_surface_state; } else { surface_state = cmd_buffer->state.null_surface_state; } -- 2.12.2