radv: implement clearing DCC layers on GFX8
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 1 Jul 2019 14:30:59 +0000 (16:30 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 2 Jul 2019 07:37:56 +0000 (09:37 +0200)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_cmd_buffer.c
src/amd/vulkan/radv_meta_clear.c

index 1f3fdd1abd0aeb6735f49890186f827d8f372c54..fc8184200fc40c7bee0e0dbd90e267dfb77af0fd 100644 (file)
@@ -4968,11 +4968,13 @@ void radv_initialize_dcc(struct radv_cmd_buffer *cmd_buffer,
                for (unsigned i = 0; i < image->planes[0].surface.num_dcc_levels; i++) {
                        struct legacy_surf_level *surf_level =
                                &image->planes[0].surface.u.legacy.level[i];
+                       unsigned dcc_fast_clear_size =
+                               surf_level->dcc_slice_fast_clear_size * image->info.array_size;
 
-                       if (!surf_level->dcc_fast_clear_size)
+                       if (!dcc_fast_clear_size)
                                break;
 
-                       size = surf_level->dcc_offset + surf_level->dcc_fast_clear_size;
+                       size = surf_level->dcc_offset + dcc_fast_clear_size;
                }
 
                /* Initialize the mipmap levels without DCC. */
index e5181daf0f2be8f08408a62b7c4b83f01573c8a1..08d9ea3e1db24b61eb15801f43c8a488e90b8664 100644 (file)
@@ -1397,8 +1397,9 @@ radv_clear_dcc(struct radv_cmd_buffer *cmd_buffer,
                         * fast clear path fallbacks to slow clears if one
                         * level can't be fast cleared.
                         */
-                       offset += surf_level->dcc_offset;
-                       size = surf_level->dcc_fast_clear_size;
+                       offset += surf_level->dcc_offset +
+                                 surf_level->dcc_slice_fast_clear_size * range->baseArrayLayer;
+                       size = surf_level->dcc_slice_fast_clear_size * radv_get_layerCount(image, range);
                }
 
                flush_bits |= radv_fill_buffer(cmd_buffer, image->bo, offset,