diff options
author | Samuel Pitoiset <[email protected]> | 2018-07-18 16:19:04 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2018-07-20 10:17:11 +0200 |
commit | 0a8127bbfbe8a8af45dacf6c0998a8f0f1152f4b (patch) | |
tree | d23c308e96ea26a67a5c0a0f0385c0ffd1cb0718 /src/amd | |
parent | 409a60df3ba2cd0e05623dcb895034edcbe1342d (diff) |
radv: make use of radv_subpass_barrier() when resolving subpasses
The goal is to use radv_barrier()/radv_subpass_barrier() as
much as possible for further optimizations.
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd')
-rw-r--r-- | src/amd/vulkan/radv_cmd_buffer.c | 3 | ||||
-rw-r--r-- | src/amd/vulkan/radv_meta_resolve_cs.c | 16 | ||||
-rw-r--r-- | src/amd/vulkan/radv_meta_resolve_fs.c | 13 | ||||
-rw-r--r-- | src/amd/vulkan/radv_private.h | 3 |
4 files changed, 20 insertions, 15 deletions
diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c index f6ab5e6c753..032b701561f 100644 --- a/src/amd/vulkan/radv_cmd_buffer.c +++ b/src/amd/vulkan/radv_cmd_buffer.c @@ -2053,7 +2053,8 @@ radv_dst_access_flush(struct radv_cmd_buffer *cmd_buffer, return flush_bits; } -static void radv_subpass_barrier(struct radv_cmd_buffer *cmd_buffer, const struct radv_subpass_barrier *barrier) +void radv_subpass_barrier(struct radv_cmd_buffer *cmd_buffer, + const struct radv_subpass_barrier *barrier) { cmd_buffer->state.flush_bits |= radv_src_access_flush(cmd_buffer, barrier->src_access_mask, NULL); diff --git a/src/amd/vulkan/radv_meta_resolve_cs.c b/src/amd/vulkan/radv_meta_resolve_cs.c index daf11e05768..ad02594614c 100644 --- a/src/amd/vulkan/radv_meta_resolve_cs.c +++ b/src/amd/vulkan/radv_meta_resolve_cs.c @@ -473,6 +473,8 @@ radv_cmd_buffer_resolve_subpass_cs(struct radv_cmd_buffer *cmd_buffer) struct radv_framebuffer *fb = cmd_buffer->state.framebuffer; const struct radv_subpass *subpass = cmd_buffer->state.subpass; struct radv_meta_saved_state saved_state; + struct radv_subpass_barrier barrier; + /* FINISHME(perf): Skip clears for resolve attachments. * * From the Vulkan 1.0 spec: @@ -485,13 +487,13 @@ radv_cmd_buffer_resolve_subpass_cs(struct radv_cmd_buffer *cmd_buffer) if (!subpass->has_resolve) return; - /* Resolves happen before the end-of-subpass barriers get executed, - * so we have to make the attachment shader-readable */ - cmd_buffer->state.flush_bits |= RADV_CMD_FLAG_PS_PARTIAL_FLUSH | - RADV_CMD_FLAG_FLUSH_AND_INV_CB | - RADV_CMD_FLAG_FLUSH_AND_INV_CB_META | - RADV_CMD_FLAG_INV_GLOBAL_L2 | - RADV_CMD_FLAG_INV_VMEM_L1; + /* Resolves happen before the end-of-subpass barriers get executed, so + * we have to make the attachment shader-readable. + */ + barrier.src_stage_mask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; + barrier.src_access_mask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT; + barrier.dst_access_mask = VK_ACCESS_INPUT_ATTACHMENT_READ_BIT; + radv_subpass_barrier(cmd_buffer, &barrier); radv_decompress_resolve_subpass_src(cmd_buffer); diff --git a/src/amd/vulkan/radv_meta_resolve_fs.c b/src/amd/vulkan/radv_meta_resolve_fs.c index 5f4f2418932..0e4957b163c 100644 --- a/src/amd/vulkan/radv_meta_resolve_fs.c +++ b/src/amd/vulkan/radv_meta_resolve_fs.c @@ -580,6 +580,7 @@ radv_cmd_buffer_resolve_subpass_fs(struct radv_cmd_buffer *cmd_buffer) struct radv_framebuffer *fb = cmd_buffer->state.framebuffer; const struct radv_subpass *subpass = cmd_buffer->state.subpass; struct radv_meta_saved_state saved_state; + struct radv_subpass_barrier barrier; /* FINISHME(perf): Skip clears for resolve attachments. * @@ -600,13 +601,11 @@ radv_cmd_buffer_resolve_subpass_fs(struct radv_cmd_buffer *cmd_buffer) /* Resolves happen before the end-of-subpass barriers get executed, * so we have to make the attachment shader-readable */ - cmd_buffer->state.flush_bits |= RADV_CMD_FLAG_PS_PARTIAL_FLUSH | - RADV_CMD_FLAG_FLUSH_AND_INV_CB | - RADV_CMD_FLAG_FLUSH_AND_INV_CB_META | - RADV_CMD_FLAG_FLUSH_AND_INV_DB | - RADV_CMD_FLAG_FLUSH_AND_INV_DB_META | - RADV_CMD_FLAG_INV_GLOBAL_L2 | - RADV_CMD_FLAG_INV_VMEM_L1; + barrier.src_stage_mask = VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; + barrier.src_access_mask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | + VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT; + barrier.dst_access_mask = VK_ACCESS_INPUT_ATTACHMENT_READ_BIT; + radv_subpass_barrier(cmd_buffer, &barrier); radv_decompress_resolve_subpass_src(cmd_buffer); diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index d8443cb7bb0..a187f76be49 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -1718,6 +1718,9 @@ struct radv_subpass_barrier { VkAccessFlags dst_access_mask; }; +void radv_subpass_barrier(struct radv_cmd_buffer *cmd_buffer, + const struct radv_subpass_barrier *barrier); + struct radv_subpass_attachment { uint32_t attachment; VkImageLayout layout; |