Browse Source

turnip: add cache invalidate to fix input attachment cases

Fixes artifacts in the subpasses demo.

Workaround texture cache with input attachments from GMEM by adding a cache
invalidate between subpasses.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3143>
master
Jonathan Marek 7 years ago
parent
commit
4a59bc6df2
1 changed files with 15 additions and 1 deletions
  1. 15
    1
      src/freedreno/vulkan/tu_cmd_buffer.c

+ 15
- 1
src/freedreno/vulkan/tu_cmd_buffer.c View File

@@ -1461,7 +1461,7 @@ tu_cmd_prepare_tile_load_ib(struct tu_cmd_buffer *cmd,
const VkRenderPassBeginInfo *info)
{
const uint32_t tile_load_space =
6 + (23+19) * cmd->state.pass->attachment_count +
8 + (23+19) * cmd->state.pass->attachment_count +
21 + (13 * cmd->state.subpass->color_count + 8) + 11;

struct tu_cs sub_cs;
@@ -1483,6 +1483,13 @@ tu_cmd_prepare_tile_load_ib(struct tu_cmd_buffer *cmd,
for (uint32_t i = 0; i < cmd->state.pass->attachment_count; ++i)
tu6_emit_clear_attachment(cmd, &sub_cs, i, info);

/* invalidate because reading input attachments will cache GMEM and
* the cache isn''t updated when GMEM is written
* TODO: is there a no-cache bit for textures?
*/
if (cmd->state.subpass->input_count)
tu6_emit_event_write(cmd, &sub_cs, CACHE_INVALIDATE, false);

tu6_emit_zs(cmd, cmd->state.subpass, &sub_cs);
tu6_emit_mrt(cmd, cmd->state.subpass, &sub_cs);
tu6_emit_msaa(cmd, cmd->state.subpass, &sub_cs);
@@ -2386,6 +2393,13 @@ tu_CmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents)
}
}

/* invalidate because reading input attachments will cache GMEM and
* the cache isn''t updated when GMEM is written
* TODO: is there a no-cache bit for textures?
*/
if (cmd->state.subpass->input_count)
tu6_emit_event_write(cmd, cs, CACHE_INVALIDATE, false);

/* emit mrt/zs/msaa state for the subpass that is starting */
tu6_emit_zs(cmd, cmd->state.subpass, cs);
tu6_emit_mrt(cmd, cmd->state.subpass, cs);

Loading…
Cancel
Save