[Mesa-dev] [PATCH] u_gen_mipmap: Use untampered cubemap texture coords when generating mipmaps.

Brian Paul brianp at vmware.com
Tue Nov 19 11:44:46 PST 2013


On 11/19/2013 11:54 AM, jfonseca at vmware.com wrote:
> From: José Fonseca <jfonseca at vmware.com>
>
> It's not necessary to scale down cubemap texture coords when generating
> mipmaps: we are doing a 2x minification therefore it's guaranteed that
> the texture coords will always be at least 1 texel away of the edges.
>
> Scaling down can actually be harmful, as it may cause artefacts when
> generating mipmaps with nearest filtering. Sample points will lie
> exactly in the middle each 2x2 texels, so the scaling factor was causing
> different texels to be take on each quadrant of the cube face.  This is
> apparent with a 1x1 checkerboard pattern in the base mipmap level:
> instead of next mipmap level receiving a constant color throughout the
> face, it will have different colors for each quadrant of the face.
>
> The behaviour for blits is left untouched for now, but the cubemap
> texture coord scaling hack should be reconsidered eventually.
> ---
>   src/gallium/auxiliary/util/u_blit.c       |  3 ++-
>   src/gallium/auxiliary/util/u_blitter.c    |  3 ++-
>   src/gallium/auxiliary/util/u_gen_mipmap.c |  3 ++-
>   src/gallium/auxiliary/util/u_texture.c    | 11 +++++++++--
>   src/gallium/auxiliary/util/u_texture.h    |  5 ++++-
>   5 files changed, 19 insertions(+), 6 deletions(-)
>


Reviewed-by: Brian Paul <brianp at vmware.com>



More information about the mesa-dev mailing list