ac/surface: do not allocate FMASK or CMASK for stencil-only surfaces on GFX9+

FMASK/CMASK make no sense with depth/stencil or stencil-only surfaces.
gfx9_compute_miptree() was called twice for stencil-only surfaces,
and the first call was allocating FMASK/CMASK.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9612>
This commit is contained in:
Samuel Pitoiset 2021-03-15 22:24:41 +01:00 committed by Marge Bot
parent da45f3f35c
commit fa712d9e17

View file

@ -2329,10 +2329,15 @@ static int gfx9_compute_surface(struct ac_addrlib *addrlib, const struct radeon_
surf->u.gfx9.dcc_retile_num_elements = 0;
surf->u.gfx9.dcc_retile_map = NULL;
const bool only_stencil =
(surf->flags & RADEON_SURF_SBUFFER) && !(surf->flags & RADEON_SURF_ZBUFFER);
/* Calculate texture layout information. */
r = gfx9_compute_miptree(addrlib, info, config, surf, compressed, &AddrSurfInfoIn);
if (r)
return r;
if (!only_stencil) {
r = gfx9_compute_miptree(addrlib, info, config, surf, compressed, &AddrSurfInfoIn);
if (r)
return r;
}
/* Calculate texture layout information for stencil. */
if (surf->flags & RADEON_SURF_SBUFFER) {