radv: add support for decompressing DCC layers with compute
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 1 Jul 2019 14:30:57 +0000 (16:30 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 2 Jul 2019 07:37:49 +0000 (09:37 +0200)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_meta_fast_clear.c

index a642d6243d4680a63c44d7327a5dc27bf70256d4..d601686f8f6a21360a1bbc2f6f044a2c70885162 100644 (file)
@@ -818,58 +818,60 @@ radv_decompress_dcc_compute(struct radv_cmd_buffer *cmd_buffer,
                height = radv_minify(image->info.height,
                                    subresourceRange->baseMipLevel + l);
 
-               radv_image_view_init(&iview, cmd_buffer->device,
-                                    &(VkImageViewCreateInfo) {
-                                            .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
-                                                    .image = radv_image_to_handle(image),
-                                                    .viewType = VK_IMAGE_VIEW_TYPE_2D,
-                                                    .format = image->vk_format,
-                                                    .subresourceRange = {
-                                                       .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
-                                                       .baseMipLevel = subresourceRange->baseMipLevel + l,
-                                                       .levelCount = 1,
-                                                       .baseArrayLayer = 0,
-                                                       .layerCount = 1
-                                                    },
-                                    });
-
-               radv_meta_push_descriptor_set(cmd_buffer,
-                                             VK_PIPELINE_BIND_POINT_COMPUTE,
-                                             device->meta_state.fast_clear_flush.dcc_decompress_compute_p_layout,
-                                             0, /* set */
-                                             2, /* descriptorWriteCount */
-                                             (VkWriteDescriptorSet[]) {
-                                             {
-                                                              .sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
-                                                              .dstBinding = 0,
-                                                              .dstArrayElement = 0,
-                                                              .descriptorCount = 1,
-                                                              .descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE,
-                                                              .pImageInfo = (VkDescriptorImageInfo[]) {
-                                                                      {
-                                                                              .sampler = VK_NULL_HANDLE,
-                                                                              .imageView = radv_image_view_to_handle(&iview),
-                                                                              .imageLayout = VK_IMAGE_LAYOUT_GENERAL,
-                                                                      },
-                                                              }
-                                                     },
+               for (uint32_t s = 0; s < radv_get_layerCount(image, subresourceRange); s++) {
+                       radv_image_view_init(&iview, cmd_buffer->device,
+                                            &(VkImageViewCreateInfo) {
+                                                    .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
+                                                            .image = radv_image_to_handle(image),
+                                                            .viewType = VK_IMAGE_VIEW_TYPE_2D,
+                                                            .format = image->vk_format,
+                                                            .subresourceRange = {
+                                                               .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
+                                                               .baseMipLevel = subresourceRange->baseMipLevel + l,
+                                                               .levelCount = 1,
+                                                               .baseArrayLayer = subresourceRange->baseArrayLayer + s,
+                                                               .layerCount = 1
+                                                            },
+                                            });
+
+                       radv_meta_push_descriptor_set(cmd_buffer,
+                                                     VK_PIPELINE_BIND_POINT_COMPUTE,
+                                                     device->meta_state.fast_clear_flush.dcc_decompress_compute_p_layout,
+                                                     0, /* set */
+                                                     2, /* descriptorWriteCount */
+                                                     (VkWriteDescriptorSet[]) {
                                                      {
-                                                              .sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
-                                                              .dstBinding = 1,
-                                                              .dstArrayElement = 0,
-                                                              .descriptorCount = 1,
-                                                              .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
-                                                              .pImageInfo = (VkDescriptorImageInfo[]) {
-                                                                      {
-                                                                              .sampler = VK_NULL_HANDLE,
-                                                                              .imageView = radv_image_view_to_handle(&iview),
-                                                                              .imageLayout = VK_IMAGE_LAYOUT_GENERAL,
-                                                                      },
-                                                              }
-                                                     }
-                                             });
-
-               radv_unaligned_dispatch(cmd_buffer, width, height, 1);
+                                                                      .sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
+                                                                      .dstBinding = 0,
+                                                                      .dstArrayElement = 0,
+                                                                      .descriptorCount = 1,
+                                                                      .descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE,
+                                                                      .pImageInfo = (VkDescriptorImageInfo[]) {
+                                                                              {
+                                                                                      .sampler = VK_NULL_HANDLE,
+                                                                                      .imageView = radv_image_view_to_handle(&iview),
+                                                                                      .imageLayout = VK_IMAGE_LAYOUT_GENERAL,
+                                                                              },
+                                                                      }
+                                                             },
+                                                             {
+                                                                      .sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
+                                                                      .dstBinding = 1,
+                                                                      .dstArrayElement = 0,
+                                                                      .descriptorCount = 1,
+                                                                      .descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
+                                                                      .pImageInfo = (VkDescriptorImageInfo[]) {
+                                                                              {
+                                                                                      .sampler = VK_NULL_HANDLE,
+                                                                                      .imageView = radv_image_view_to_handle(&iview),
+                                                                                      .imageLayout = VK_IMAGE_LAYOUT_GENERAL,
+                                                                              },
+                                                                      }
+                                                             }
+                                                     });
+
+                       radv_unaligned_dispatch(cmd_buffer, width, height, 1);
+               }
        }
 
        /* Mark this image as actually being decompressed. */