[Mesa-dev] [PATCH] i965: Always use BRW_TEXCOORDMODE_CUBE when seamless filtering.

Jason Ekstrand jason at jlekstrand.net
Wed Mar 23 23:37:45 UTC 2016


Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
On Mar 23, 2016 3:40 PM, "Kenneth Graunke" <kenneth at whitecape.org> wrote:

> When using seamless cube map mode and NEAREST filtering, we explicitly
> overrode the wrap modes to CLAMP_TO_EDGE.  This was to implement the
> following spec text:
>
>    "If NEAREST filtering is done within a miplevel, always apply apply
>     wrap mode CLAMP_TO_EDGE."
>
> However, textureGather() ignores the sampler's filtering mode, and
> instead returns the four pixels that would be blended by LINEAR
> filtering.  This implies that we should do proper seamless filtering,
> and include pixels from adjacent cube faces.
>
> It turns out that we can simply delete the NEAREST -> CLAMP_TO_EDGE
> overrides.  Normal cube map sampling works by first selecting the
> face, and then nearest filtering fetches the closest texel.  If the
> nearest texel was on a different face, then that face would have been
> chosen.  So it should always be within the face anyway, which
> effectively performs CLAMP_TO_EDGE.
>
> Fixes 86 dEQP-GLES31.texture.gather.basic.cube.* tests.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/drivers/dri/i965/brw_sampler_state.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_sampler_state.c
> b/src/mesa/drivers/dri/i965/brw_sampler_state.c
> index c20a028..3bd22c7 100644
> --- a/src/mesa/drivers/dri/i965/brw_sampler_state.c
> +++ b/src/mesa/drivers/dri/i965/brw_sampler_state.c
> @@ -460,9 +460,7 @@ brw_update_sampler_state(struct brw_context *brw,
>        /* Cube maps must use the same wrap mode for all three coordinate
>         * dimensions.  Prior to Haswell, only CUBE and CLAMP are valid.
>         */
> -      if ((tex_cube_map_seamless || sampler->CubeMapSeamless) &&
> -         (sampler->MinFilter != GL_NEAREST ||
> -          sampler->MagFilter != GL_NEAREST)) {
> +      if (tex_cube_map_seamless || sampler->CubeMapSeamless) {
>          wrap_s = BRW_TEXCOORDMODE_CUBE;
>          wrap_t = BRW_TEXCOORDMODE_CUBE;
>          wrap_r = BRW_TEXCOORDMODE_CUBE;
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160323/562b6b15/attachment.html>


More information about the mesa-dev mailing list