radv: allocate metadata space for mipmapped depth/stencil images
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 23 Aug 2019 08:48:20 +0000 (10:48 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 26 Aug 2019 13:56:51 +0000 (15:56 +0200)
For each mipmaps, the driver will store the clear values (8-bytes)
and the TC-compat zrange value (4-bytes).

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_image.c

index 34eb672..f0c9fd7 100644 (file)
@@ -1157,7 +1157,7 @@ radv_image_alloc_htile(struct radv_device *device, struct radv_image *image)
 
        /* + 8 for storing the clear values */
        image->clear_value_offset = image->htile_offset + image->planes[0].surface.htile_size;
-       image->size = image->clear_value_offset + 8;
+       image->size = image->clear_value_offset + image->info.levels * 8;
        if (radv_image_is_tc_compat_htile(image) &&
            device->physical_device->has_tc_compat_zrange_bug) {
                /* Metadata for the TC-compatible HTILE hardware bug which
@@ -1165,7 +1165,7 @@ radv_image_alloc_htile(struct radv_device *device, struct radv_image *image)
                 * fast depth clears to 0.0f.
                 */
                image->tc_compat_zrange_offset = image->size;
-               image->size = image->tc_compat_zrange_offset + 4;
+               image->size = image->tc_compat_zrange_offset + image->info.levels * 4;
        }
        image->alignment = align64(image->alignment, image->planes[0].surface.htile_alignment);
 }