[Mesa-dev] [PATCH 1/2] mesa: Implement GL_ARB_texture_filter_anisotropic

Roland Scheidegger sroland at vmware.com
Fri Aug 25 16:48:25 UTC 2017


Am 24.08.2017 um 20:40 schrieb Adam Jackson:
> The only difference from the EXT version is bumping the minmax to 16, so
> just hit all the drivers at once.
> 
> v2: Fix driver names, add to 17.3 release notes (Ilia Mirkin)
> 
> Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
>  docs/features.txt                            | 4 +++-
>  docs/relnotes/17.3.0.html                    | 1 +
>  src/glx/glxextensions.c                      | 1 +
>  src/glx/glxextensions.h                      | 1 +
>  src/mesa/drivers/dri/i965/intel_extensions.c | 1 +
>  src/mesa/drivers/dri/r200/r200_context.c     | 1 +
>  src/mesa/drivers/dri/radeon/radeon_context.c | 1 +
>  src/mesa/main/extensions.c                   | 1 +
>  src/mesa/main/extensions_table.h             | 1 +
>  src/mesa/main/mtypes.h                       | 1 +
>  src/mesa/main/version.c                      | 2 +-
>  src/mesa/state_tracker/st_extensions.c       | 4 ++++
>  12 files changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/docs/features.txt b/docs/features.txt
> index 6f57ec26fd..3f91c2daae 100644
> --- a/docs/features.txt
> +++ b/docs/features.txt
> @@ -231,10 +231,12 @@ GL 4.6, GLSL 4.60
>    GL_ARB_shader_draw_parameters                         DONE (i965, nvc0, radeonsi)
>    GL_ARB_shader_group_vote                              DONE (i965, nvc0, radeonsi)
>    GL_ARB_spirv_extensions                               in progress (Nicolai Hähnle, Ian Romanick)
> -  GL_ARB_texture_filter_anisotropic                     not started
> +  GL_ARB_texture_filter_anisotropic                     DONE (i965, nv50, nvc0, r600, radeonsi, softpipe (*), llvmpipe (*))
>    GL_ARB_transform_feedback_overflow_query              DONE (i965/gen6+, radeonsi, llvmpipe, softpipe)
>    GL_KHR_no_error                                       started (Timothy Arceri)
>  
> +(*) softpipe and llvmpipe advertise 16x anisotropy but simply ignore the setting
That's actually not quite true for neither (though I thought it was for
llvmpipe but I just checked). llvmpipe says the aniso limit is 16x, but
it does not set the cap bit for anisotropic filtering
(PIPE_CAP_ANISOTROPIC_FILTER) itself, so we don't actually lie (but if
you give it an anisotropic sampler despite this, it will indeed ignore it).
softpipe, otoh, does have a AF implementation, working up to 16x (albeit
I quickly checked with texfilt, and it looks like it may not filter
between mips (might be a bug or by design, I don't know), but it does
respect high degree AF).

Roland



> +
>  These are the extensions cherry-picked to make GLES 3.1
>  GLES3.1, GLSL ES 3.1 -- all DONE: i965/hsw+, nvc0, radeonsi
>  
> diff --git a/docs/relnotes/17.3.0.html b/docs/relnotes/17.3.0.html
> index 25d02cdca7..8da43f22f0 100644
> --- a/docs/relnotes/17.3.0.html
> +++ b/docs/relnotes/17.3.0.html
> @@ -45,6 +45,7 @@ Note: some of the new features are only available with certain drivers.
>  
>  <ul>
>  <li>GL_ARB_transform_feedback_overflow_query on radeonsi</li>
> +<li>GL_ARB_texture_filter_anisotropic on i965, nv50, nvc0, r600, radeonsi</li>
>  <li>GL_EXT_memory_object on radeonsi</li>
>  <li>GL_EXT_memory_object_fd on radeonsi</li>
>  </ul>
> diff --git a/src/glx/glxextensions.c b/src/glx/glxextensions.c
> index 22b078ce48..88bf0de3e6 100644
> --- a/src/glx/glxextensions.c
> +++ b/src/glx/glxextensions.c
> @@ -190,6 +190,7 @@ static const struct extension_info known_gl_extensions[] = {
>     { GL(ARB_texture_env_combine),        VER(1,3), Y, N, N, N },
>     { GL(ARB_texture_env_crossbar),       VER(1,4), Y, N, N, N },
>     { GL(ARB_texture_env_dot3),           VER(1,3), Y, N, N, N },
> +   { GL(ARB_texture_filter_anisotropic), VER(0,0), Y, N, N, N },
>     { GL(ARB_texture_mirrored_repeat),    VER(1,4), Y, N, N, N },
>     { GL(ARB_texture_non_power_of_two),   VER(1,5), Y, N, N, N },
>     { GL(ARB_texture_rectangle),          VER(0,0), Y, N, N, N },
> diff --git a/src/glx/glxextensions.h b/src/glx/glxextensions.h
> index 21ad02a44b..2a595516ee 100644
> --- a/src/glx/glxextensions.h
> +++ b/src/glx/glxextensions.h
> @@ -101,6 +101,7 @@ enum
>     GL_ARB_texture_env_combine_bit,
>     GL_ARB_texture_env_crossbar_bit,
>     GL_ARB_texture_env_dot3_bit,
> +   GL_ARB_texture_filter_anisotropic_bit,
>     GL_ARB_texture_mirrored_repeat_bit,
>     GL_ARB_texture_non_power_of_two_bit,
>     GL_ARB_texture_rectangle_bit,
> diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c
> index b91bbdc8d9..c3cd8004a1 100644
> --- a/src/mesa/drivers/dri/i965/intel_extensions.c
> +++ b/src/mesa/drivers/dri/i965/intel_extensions.c
> @@ -80,6 +80,7 @@ intelInitExtensions(struct gl_context *ctx)
>     ctx->Extensions.ARB_texture_env_combine = true;
>     ctx->Extensions.ARB_texture_env_crossbar = true;
>     ctx->Extensions.ARB_texture_env_dot3 = true;
> +   ctx->Extensions.ARB_texture_filter_anisotropic = true;
>     ctx->Extensions.ARB_texture_float = true;
>     ctx->Extensions.ARB_texture_mirror_clamp_to_edge = true;
>     ctx->Extensions.ARB_texture_non_power_of_two = true;
> diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c
> index ca1023c5c3..0a27985de7 100644
> --- a/src/mesa/drivers/dri/r200/r200_context.c
> +++ b/src/mesa/drivers/dri/r200/r200_context.c
> @@ -339,6 +339,7 @@ GLboolean r200CreateContext( gl_api api,
>     ctx->Extensions.ARB_texture_env_combine = true;
>     ctx->Extensions.ARB_texture_env_dot3 = true;
>     ctx->Extensions.ARB_texture_env_crossbar = true;
> +   ctx->Extensions.ARB_texture_filter_anisotropic = true;
>     ctx->Extensions.ARB_texture_mirror_clamp_to_edge = true;
>     ctx->Extensions.ARB_vertex_program = true;
>     ctx->Extensions.ATI_fragment_shader = (ctx->Const.MaxTextureUnits == 6);
> diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c
> index 0c016b4da4..28a79860d7 100644
> --- a/src/mesa/drivers/dri/radeon/radeon_context.c
> +++ b/src/mesa/drivers/dri/radeon/radeon_context.c
> @@ -300,6 +300,7 @@ r100CreateContext( gl_api api,
>     ctx->Extensions.ARB_texture_env_combine = true;
>     ctx->Extensions.ARB_texture_env_crossbar = true;
>     ctx->Extensions.ARB_texture_env_dot3 = true;
> +   ctx->Extensions.ARB_texture_filter_anisotropic = true;
>     ctx->Extensions.ARB_texture_mirror_clamp_to_edge = true;
>     ctx->Extensions.ATI_texture_env_combine3 = true;
>     ctx->Extensions.ATI_texture_mirror_once = true;
> diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
> index 62a731675d..5a5fdd247f 100644
> --- a/src/mesa/main/extensions.c
> +++ b/src/mesa/main/extensions.c
> @@ -130,6 +130,7 @@ _mesa_enable_sw_extensions(struct gl_context *ctx)
>     ctx->Extensions.ARB_texture_env_combine = GL_TRUE;
>     ctx->Extensions.ARB_texture_env_crossbar = GL_TRUE;
>     ctx->Extensions.ARB_texture_env_dot3 = GL_TRUE;
> +   ctx->Extensions.ARB_texture_filter_anisotropic = GL_TRUE;
>  #ifdef TEXTURE_FLOAT_ENABLED
>     ctx->Extensions.ARB_texture_float = GL_TRUE;
>  #endif
> diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
> index 347a6197ed..d096260891 100644
> --- a/src/mesa/main/extensions_table.h
> +++ b/src/mesa/main/extensions_table.h
> @@ -144,6 +144,7 @@ EXT(ARB_texture_env_add                     , dummy_true
>  EXT(ARB_texture_env_combine                 , ARB_texture_env_combine                , GLL,  x ,  x ,  x , 2001)
>  EXT(ARB_texture_env_crossbar                , ARB_texture_env_crossbar               , GLL,  x ,  x ,  x , 2001)
>  EXT(ARB_texture_env_dot3                    , ARB_texture_env_dot3                   , GLL,  x ,  x ,  x , 2001)
> +EXT(ARB_texture_filter_anisotropic          , ARB_texture_filter_anisotropic         , GLL, GLC,  x ,  x , 2017)
>  EXT(ARB_texture_float                       , ARB_texture_float                      , GLL, GLC,  x ,  x , 2004)
>  EXT(ARB_texture_gather                      , ARB_texture_gather                     , GLL, GLC,  x ,  x , 2009)
>  EXT(ARB_texture_mirror_clamp_to_edge        , ARB_texture_mirror_clamp_to_edge       , GLL, GLC,  x ,  x , 2013)
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index 592cb48ca3..99b6dfa611 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -4093,6 +4093,7 @@ struct gl_extensions
>     GLboolean ARB_texture_env_combine;
>     GLboolean ARB_texture_env_crossbar;
>     GLboolean ARB_texture_env_dot3;
> +   GLboolean ARB_texture_filter_anisotropic;
>     GLboolean ARB_texture_float;
>     GLboolean ARB_texture_gather;
>     GLboolean ARB_texture_mirror_clamp_to_edge;
> diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
> index 7cb4ee7f9c..59e7b89ff6 100644
> --- a/src/mesa/main/version.c
> +++ b/src/mesa/main/version.c
> @@ -395,7 +395,7 @@ compute_version(const struct gl_extensions *extensions,
>                           extensions->ARB_shader_atomic_counter_ops &&
>                           extensions->ARB_shader_draw_parameters &&
>                           extensions->ARB_shader_group_vote &&
> -                         /* extensions->ARB_texture_filter_anisotropic */ 0 &&
> +                         extensions->ARB_texture_filter_anisotropic &&
>                           extensions->ARB_transform_feedback_overflow_query);
>  
>     if (ver_4_6) {
> diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
> index 904d9cd834..9a22e54675 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -1251,6 +1251,10 @@ void st_init_extensions(struct pipe_screen *screen,
>        }
>     }
>  
> +   if (extensions->EXT_texture_filter_anisotropic &&
> +       screen->get_paramf(screen, PIPE_CAPF_MAX_TEXTURE_ANISOTROPY) >= 16.0)
> +      extensions->ARB_texture_filter_anisotropic = GL_TRUE;
> +
>     extensions->KHR_robustness = extensions->ARB_robust_buffer_access_behavior;
>  
>     /* If we support ES 3.1, we support the ES3_1_compatibility ext. However
> 



More information about the mesa-dev mailing list