[PATCH] glamor: GL_TEXTURE_MAX_LEVEL is not available on GLES2

Ian Romanick idr at freedesktop.org
Fri Jan 23 09:09:19 PST 2015


On 01/19/2015 03:37 AM, Maarten Lankhorst wrote:
> Remove the calls to GL_TEXTURE_MAX_LEVEL. Setting the filtering is
> a sufficient hint to the driver about texture mipmap allocation.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst at ubuntu.com>

I agree with Eric that this is better than using MAX_LEVEL
conditionally.  Assuming that textures created in glamor don't change
size (or other things that affect allocation), at some point it will be
worth implementing support for glTexStorage2D.  All Mesa drivers support
GL_ARB_texture_storage, and it's part of OpenGL ES 3.0.  It looks like
Mesa doesn't enable GL_EXT_texture_storage on OpenGL ES 2.0, but that
should be trivial to add.

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

> ---
>  glamor/glamor_fbo.c    | 1 -
>  glamor/glamor_font.c   | 1 -
>  glamor/glamor_pixmap.c | 1 -
>  3 files changed, 3 deletions(-)
> 
> diff --git a/glamor/glamor_fbo.c b/glamor/glamor_fbo.c
> index d2aabb2..26f7972 100644
> --- a/glamor/glamor_fbo.c
> +++ b/glamor/glamor_fbo.c
> @@ -348,7 +348,6 @@ _glamor_create_tex(glamor_screen_private *glamor_priv,
>          glamor_make_current(glamor_priv);
>          glGenTextures(1, &tex);
>          glBindTexture(GL_TEXTURE_2D, tex);
> -        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
>          glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
>          glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
>          glTexImage2D(GL_TEXTURE_2D, 0, format, w, h, 0,
> diff --git a/glamor/glamor_font.c b/glamor/glamor_font.c
> index 0ca91fa..cc0fecf 100644
> --- a/glamor/glamor_font.c
> +++ b/glamor/glamor_font.c
> @@ -97,7 +97,6 @@ glamor_font_get(ScreenPtr screen, FontPtr font)
>      glActiveTexture(GL_TEXTURE0);
>      glBindTexture(GL_TEXTURE_2D, glamor_font->texture_id);
>  
> -    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
>      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
>      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
>  
> diff --git a/glamor/glamor_pixmap.c b/glamor/glamor_pixmap.c
> index 947113e..0d92710 100644
> --- a/glamor/glamor_pixmap.c
> +++ b/glamor/glamor_pixmap.c
> @@ -717,7 +717,6 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, unsigned int *tex,
>      }
>  
>      glBindTexture(GL_TEXTURE_2D, *tex);
> -    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
>      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
>      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
>      glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
> 



More information about the xorg-devel mailing list