[Mesa-dev] [PATCH 1/5] radv: do not resolve all image layers with compute inside a subpass

Samuel Pitoiset samuel.pitoiset at gmail.com
Mon Jun 10 15:45:29 UTC 2019


When resolving inside a subpass, we should rely on the framebuffer
layer count instead of resolving all images layers. This should
improve performance of layered resolves a bit.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/amd/vulkan/radv_meta_resolve_cs.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/amd/vulkan/radv_meta_resolve_cs.c b/src/amd/vulkan/radv_meta_resolve_cs.c
index b6c9e1c2b1f..fc4bcf27bb9 100644
--- a/src/amd/vulkan/radv_meta_resolve_cs.c
+++ b/src/amd/vulkan/radv_meta_resolve_cs.c
@@ -508,6 +508,10 @@ 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_subpass_barrier barrier;
+	uint32_t layer_count = fb->layers;
+
+	if (subpass->view_mask)
+		layer_count = util_last_bit(subpass->view_mask);
 
 	/* Resolves happen before the end-of-subpass barriers get executed, so
 	 * we have to make the attachment shader-readable.
@@ -531,14 +535,14 @@ radv_cmd_buffer_resolve_subpass_cs(struct radv_cmd_buffer *cmd_buffer)
 			.srcSubresource = (VkImageSubresourceLayers) {
 				.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
 				.mipLevel = src_iview->base_mip,
-				.baseArrayLayer = 0,
-				.layerCount = src_iview->image->info.array_size
+				.baseArrayLayer = src_iview->base_layer,
+				.layerCount = layer_count,
 			},
 			.dstSubresource = (VkImageSubresourceLayers) {
 				.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
 				.mipLevel = dst_iview->base_mip,
-				.baseArrayLayer = 0,
-				.layerCount = dst_iview->image->info.array_size
+				.baseArrayLayer = dst_iview->base_layer,
+				.layerCount = layer_count,
 			},
 			.srcOffset = (VkOffset3D){ 0, 0, 0 },
 			.dstOffset = (VkOffset3D){ 0, 0, 0 },
-- 
2.22.0



More information about the mesa-dev mailing list