summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2019-05-27 17:42:35 +0200
committerSamuel Pitoiset <[email protected]>2019-05-28 08:17:23 +0200
commit469258c3b1fe61ebdb9c815e1fc741adeb6e01fe (patch)
tree1f37f93f0190fdc9615d0d548df25abfa74d494b /src
parentd2b0246741e299c35a654bd1d262807e6bcdc22e (diff)
radv: cleanup the compute resolve path for subpass
This makes use of radv_meta_resolve_compute_image() by filling a VkImageResolve region instead of duplicating code. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/amd/vulkan/radv_meta_resolve_cs.c85
1 files changed, 29 insertions, 56 deletions
diff --git a/src/amd/vulkan/radv_meta_resolve_cs.c b/src/amd/vulkan/radv_meta_resolve_cs.c
index 1b786526cf2..76612672b1c 100644
--- a/src/amd/vulkan/radv_meta_resolve_cs.c
+++ b/src/amd/vulkan/radv_meta_resolve_cs.c
@@ -489,7 +489,6 @@ 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;
/* Resolves happen before the end-of-subpass barriers get executed, so
@@ -500,67 +499,41 @@ radv_cmd_buffer_resolve_subpass_cs(struct radv_cmd_buffer *cmd_buffer)
barrier.dst_access_mask = VK_ACCESS_INPUT_ATTACHMENT_READ_BIT;
radv_subpass_barrier(cmd_buffer, &barrier);
- radv_decompress_resolve_subpass_src(cmd_buffer);
-
- radv_meta_save(&saved_state, cmd_buffer,
- RADV_META_SAVE_COMPUTE_PIPELINE |
- RADV_META_SAVE_CONSTANTS |
- RADV_META_SAVE_DESCRIPTORS);
-
for (uint32_t i = 0; i < subpass->color_count; ++i) {
struct radv_subpass_attachment src_att = subpass->color_attachments[i];
- struct radv_subpass_attachment dest_att = subpass->resolve_attachments[i];
- struct radv_image_view *src_iview = cmd_buffer->state.framebuffer->attachments[src_att.attachment].attachment;
- struct radv_image_view *dst_iview = cmd_buffer->state.framebuffer->attachments[dest_att.attachment].attachment;
- if (dest_att.attachment == VK_ATTACHMENT_UNUSED)
- continue;
-
- struct radv_image *src_image = src_iview->image;
- struct radv_image *dst_image = dst_iview->image;
- for (uint32_t layer = 0; layer < src_image->info.array_size; layer++) {
+ struct radv_subpass_attachment dst_att = subpass->resolve_attachments[i];
+ struct radv_image_view *src_iview = fb->attachments[src_att.attachment].attachment;
+ struct radv_image_view *dst_iview = fb->attachments[dst_att.attachment].attachment;
- struct radv_image_view tsrc_iview;
- radv_image_view_init(&tsrc_iview, cmd_buffer->device,
- &(VkImageViewCreateInfo) {
- .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
- .image = radv_image_to_handle(src_image),
- .viewType = radv_meta_get_view_type(src_image),
- .format = src_image->vk_format,
- .subresourceRange = {
- .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
- .baseMipLevel = src_iview->base_mip,
- .levelCount = 1,
- .baseArrayLayer = layer,
- .layerCount = 1,
- },
- });
+ if (dst_att.attachment == VK_ATTACHMENT_UNUSED)
+ continue;
- struct radv_image_view tdst_iview;
- radv_image_view_init(&tdst_iview, cmd_buffer->device,
- &(VkImageViewCreateInfo) {
- .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
- .image = radv_image_to_handle(dst_image),
- .viewType = radv_meta_get_view_type(dst_image),
- .format = vk_to_non_srgb_format(dst_image->vk_format),
- .subresourceRange = {
- .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
- .baseMipLevel = dst_iview->base_mip,
- .levelCount = 1,
- .baseArrayLayer = layer,
- .layerCount = 1,
- },
- });
- emit_resolve(cmd_buffer,
- &tsrc_iview,
- &tdst_iview,
- &(VkOffset2D) { 0, 0 },
- &(VkOffset2D) { 0, 0 },
- &(VkExtent2D) { fb->width, fb->height });
- }
+ VkImageResolve region = {
+ .extent = (VkExtent3D){ fb->width, fb->height, 0 },
+ .srcSubresource = (VkImageSubresourceLayers) {
+ .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
+ .mipLevel = src_iview->base_mip,
+ .baseArrayLayer = 0,
+ .layerCount = src_iview->image->info.array_size
+ },
+ .dstSubresource = (VkImageSubresourceLayers) {
+ .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
+ .mipLevel = dst_iview->base_mip,
+ .baseArrayLayer = 0,
+ .layerCount = dst_iview->image->info.array_size
+ },
+ .srcOffset = (VkOffset3D){ 0, 0, 0 },
+ .dstOffset = (VkOffset3D){ 0, 0, 0 },
+ };
+
+ radv_meta_resolve_compute_image(cmd_buffer,
+ src_iview->image,
+ src_att.layout,
+ dst_iview->image,
+ dst_att.layout,
+ 1, &region);
}
cmd_buffer->state.flush_bits |= RADV_CMD_FLAG_CS_PARTIAL_FLUSH |
RADV_CMD_FLAG_INV_VMEM_L1;
-
- radv_meta_restore(&saved_state, cmd_buffer);
}