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>master
| surf->surf_alignment = out.baseAlign; | surf->surf_alignment = out.baseAlign; | ||||
| if (in->swizzleMode == ADDR_SW_LINEAR) { | 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.offset[i] = mip_info[i].offset; | ||||
| surf->u.gfx9.pitch[i] = mip_info[i].pitch; | |||||
| } | |||||
| } | } | ||||
| if (in->flags.depth) { | if (in->flags.depth) { |
| uint64_t surf_slice_size; | uint64_t surf_slice_size; | ||||
| /* Mipmap level offset within the slice in bytes. Only valid for LINEAR. */ | /* Mipmap level offset within the slice in bytes. Only valid for LINEAR. */ | ||||
| uint32_t offset[RADEON_SURF_MAX_LEVELS]; | 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 */ | uint64_t stencil_offset; /* separate stencil */ | ||||
| pLayout->rowPitch = surface->u.gfx9.surf_pitch * surface->bpe / 3; | pLayout->rowPitch = surface->u.gfx9.surf_pitch * surface->bpe / 3; | ||||
| } else { | } else { | ||||
| assert(util_is_power_of_two_nonzero(surface->bpe)); | 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; | pLayout->arrayPitch = surface->u.gfx9.surf_slice_size; |