diff options
author | Chad Versace <[email protected]> | 2015-10-29 10:59:55 -0700 |
---|---|---|
committer | Chad Versace <[email protected]> | 2015-10-29 10:59:55 -0700 |
commit | c284c39b135821a9417b95319fa6726e5892bef9 (patch) | |
tree | 666f7531cf71dfbcbb497e1ffc11a52063e56269 /src/vulkan/anv_meta.c | |
parent | 8bcba083db25da7074270aaaeb7ea1ab04bafc33 (diff) |
anv: Fix parsing of load ops in VkAttachmentDescription
My original understanding of VkAttachmentDescription::loadOp,
stencilLoadOp was incorrect. Below are all possible combinations:
VkFormat | loadOp=clear stencilLoadOp=clear
---------------+---------------------------
color | clear-color ignored
depth-only | clear-depth ignored
stencil-only | ignored clear-stencil
depth-stencil | clear-depth clear-stencil
Diffstat (limited to 'src/vulkan/anv_meta.c')
-rw-r--r-- | src/vulkan/anv_meta.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/vulkan/anv_meta.c b/src/vulkan/anv_meta.c index 8bfab1f8323..cc605197f9b 100644 --- a/src/vulkan/anv_meta.c +++ b/src/vulkan/anv_meta.c @@ -446,8 +446,8 @@ anv_cmd_buffer_clear_attachments(struct anv_cmd_buffer *cmd_buffer, for (uint32_t i = 0; i < pass->attachment_count; i++) { const struct anv_render_pass_attachment *att = &pass->attachments[i]; - if (att->load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) { - if (anv_format_is_color(att->format)) { + if (anv_format_is_color(att->format)) { + if (att->load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) { instance_data[layer] = (struct clear_instance_data) { .vue_header = { .RTAIndex = i, @@ -458,14 +458,19 @@ anv_cmd_buffer_clear_attachments(struct anv_cmd_buffer *cmd_buffer, }; color_attachments[layer] = i; layer++; - } else if (att->format->depth_format) { + } + } else { + if (att->format->depth_format && + att->load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) { assert(ds_attachment == VK_ATTACHMENT_UNUSED); ds_attachment = i; ds_clear_value = clear_values[ds_attachment].depthStencil; } - } else if (att->stencil_load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) { - assert(att->format->has_stencil); - anv_finishme("stencil clear"); + + if (att->format->has_stencil && + att->stencil_load_op == VK_ATTACHMENT_LOAD_OP_CLEAR) { + anv_finishme("stencil clear"); + } } } |