radv: return the correct pitch for linear mipmaps on GFX10
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 30 Dec 2019 12:47:30 +0000 (13:47 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 30 Dec 2019 13:17:45 +0000 (14:17 +0100)
On GFX9, the pitch of a level is always the pitch of the entire image
but not on GFX10.

This fixes graphics glithes with Halo - The Master Chief Collection.

Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2188
CC: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/common/ac_surface.c
src/amd/common/ac_surface.h
src/amd/vulkan/radv_image.c

index 9cc2b9328304901ba6c40456f0304b6b66a69593..92aab57920a35feda4c678389f177c3f63a74aeb 100644 (file)
@@ -1062,8 +1062,10 @@ static int gfx9_compute_miptree(ADDR_HANDLE addrlib,
        surf->surf_alignment = out.baseAlign;
 
        if (in->swizzleMode == ADDR_SW_LINEAR) {
-               for (unsigned i = 0; i < in->numMipLevels; i++)
+               for (unsigned i = 0; i < in->numMipLevels; i++) {
                        surf->u.gfx9.offset[i] = mip_info[i].offset;
+                       surf->u.gfx9.pitch[i] = mip_info[i].pitch;
+               }
        }
 
        if (in->flags.depth) {
index c838bd47da5ded1e720ea1ff3c6fee972dbb8e34..1e90c08b2e53337c62d873dc08dcd869f02ba781 100644 (file)
@@ -154,6 +154,8 @@ struct gfx9_surf_layout {
     uint64_t                    surf_slice_size;
     /* Mipmap level offset within the slice in bytes. Only valid for LINEAR. */
     uint32_t                    offset[RADEON_SURF_MAX_LEVELS];
+    /* Mipmap level pitch in elements. Only valid for LINEAR. */
+    uint32_t                    pitch[RADEON_SURF_MAX_LEVELS];
 
     uint64_t                    stencil_offset; /* separate stencil */
 
index deb34af3733b746c163a344b1994f0cdd5d2a3c1..544a51f5f39ad930c7f6291ff15cbc2bbb08f63e 100644 (file)
@@ -1889,7 +1889,7 @@ void radv_GetImageSubresourceLayout(
                        pLayout->rowPitch = surface->u.gfx9.surf_pitch * surface->bpe / 3;
                } else {
                        assert(util_is_power_of_two_nonzero(surface->bpe));
-                       pLayout->rowPitch = surface->u.gfx9.surf_pitch * surface->bpe;
+                       pLayout->rowPitch = surface->u.gfx9.pitch[level] * surface->bpe;
                }
 
                pLayout->arrayPitch = surface->u.gfx9.surf_slice_size;