From: Samuel Pitoiset Date: Mon, 30 Dec 2019 12:47:30 +0000 (+0100) Subject: radv: return the correct pitch for linear mipmaps on GFX10 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=824bd0830e811a7b6347bbd5c30e0a76bc7daf60;p=mesa.git radv: return the correct pitch for linear mipmaps on GFX10 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: Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen --- diff --git a/src/amd/common/ac_surface.c b/src/amd/common/ac_surface.c index 9cc2b932830..92aab57920a 100644 --- a/src/amd/common/ac_surface.c +++ b/src/amd/common/ac_surface.c @@ -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) { diff --git a/src/amd/common/ac_surface.h b/src/amd/common/ac_surface.h index c838bd47da5..1e90c08b2e5 100644 --- a/src/amd/common/ac_surface.h +++ b/src/amd/common/ac_surface.h @@ -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 */ diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c index deb34af3733..544a51f5f39 100644 --- a/src/amd/vulkan/radv_image.c +++ b/src/amd/vulkan/radv_image.c @@ -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;