diff options
author | Jonathan Marek <[email protected]> | 2019-12-12 14:02:49 -0500 |
---|---|---|
committer | Jonathan Marek <[email protected]> | 2019-12-12 20:33:17 -0500 |
commit | 3b4b5f549f68fd73097fc565960f8889c4bdd3c5 (patch) | |
tree | 23af8d8777bf61acc8b0fe920361200bc3707cbb | |
parent | aac7d6c1dcab12a820ec8d9c40911dd8212ebce6 (diff) |
turnip: CmdClearAttachments fixes
Partial depth/stencil clear and skipping unused attachments.
Signed-off-by: Jonathan Marek <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
-rw-r--r-- | src/freedreno/vulkan/tu_meta_clear.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/freedreno/vulkan/tu_meta_clear.c b/src/freedreno/vulkan/tu_meta_clear.c index c539a1b65c2..5f5fe44c676 100644 --- a/src/freedreno/vulkan/tu_meta_clear.c +++ b/src/freedreno/vulkan/tu_meta_clear.c @@ -127,11 +127,20 @@ tu_CmdClearAttachments(VkCommandBuffer commandBuffer, for (unsigned j = 0; j < attachmentCount; j++) { uint32_t a; - if (pAttachments[j].aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) + unsigned clear_mask = 0; + if (pAttachments[j].aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) { + clear_mask = 0xf; a = subpass->color_attachments[pAttachments[j].colorAttachment].attachment; - else + } else { a = subpass->depth_stencil_attachment.attachment; - /* TODO: partial depth/stencil clear? */ + if (pAttachments[j].aspectMask & VK_IMAGE_ASPECT_DEPTH_BIT) + clear_mask |= 1; + if (pAttachments[j].aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT) + clear_mask |= 2; + } + + if (a == VK_ATTACHMENT_UNUSED) + continue; VkFormat fmt = cmd->state.pass->attachments[a].format; const struct tu_native_format *format = tu6_get_native_format(fmt); @@ -141,7 +150,7 @@ tu_CmdClearAttachments(VkCommandBuffer commandBuffer, tu_cs_emit(cs, A6XX_RB_BLIT_DST_INFO_COLOR_FORMAT(format->rb)); tu_cs_emit_pkt4(cs, REG_A6XX_RB_BLIT_INFO, 1); - tu_cs_emit(cs, A6XX_RB_BLIT_INFO_GMEM | A6XX_RB_BLIT_INFO_CLEAR_MASK(0xf)); + tu_cs_emit(cs, A6XX_RB_BLIT_INFO_GMEM | A6XX_RB_BLIT_INFO_CLEAR_MASK(clear_mask)); tu_cs_emit_pkt4(cs, REG_A6XX_RB_BLIT_BASE_GMEM, 1); tu_cs_emit(cs, cmd->state.tiling_config.gmem_offsets[a]); |