[Mesa-dev] [PATCH] mesa: Strip texture border for proxy texture as well

Anuj Phogat anuj.phogat at gmail.com
Thu Mar 1 11:32:51 PST 2012


On Wed, Feb 29, 2012 at 7:48 PM, Brian Paul <brian.e.paul at gmail.com> wrote:

> On Wed, Feb 29, 2012 at 6:44 PM, Anuj Phogat <anuj.phogat at gmail.com>
> wrote:
> > Intel and Gallium drivers don't support texture borders. Border is
> stripped
> > before texture is used inside the driver. So, glGetTexLevelParameteriv()
> > returns the stripped values of texture dimensions. But it returns un-
> > stripped values for proxy textures. This patch adds
> strip_texture_border()
> > for proxy textures as well.
> >
> > Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> > ---
> > A piglit test case for this patch will be posted on piglit mailing list
> > for review.
> >
> >  src/mesa/main/teximage.c |    9 +++++++++
> >  1 files changed, 9 insertions(+), 0 deletions(-)
> >
> > diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> > index b8ff67e..5a2ef70 100644
> > --- a/src/mesa/main/teximage.c
> > +++ b/src/mesa/main/teximage.c
> > @@ -2543,6 +2543,15 @@ teximage(struct gl_context *ctx, GLuint dims,
> >       }
> >       else {
> >          /* no error, set the tex image parameters */
> > +
> > +        /* Allow a hardware driver to just strip out the border, to
> provide
> > +         * reliable but slightly incorrect hardware rendering instead of
> > +         * rarely-tested software fallback rendering.
> > +         */
> > +        if (border && ctx->Const.StripTextureBorder)
> > +           strip_texture_border(target, &border, &width, &height,
> &depth, unpack,
> > +                                &unpack_no_border);
> > +
> >          struct gl_texture_object *texObj =
> >             _mesa_get_current_tex_object(ctx, target);
> >          gl_format texFormat = _mesa_choose_texture_format(ctx, texObj,
>
> Actually, I'm not sure we want to do this.
>
> The typical usage of proxy textures is:
>
> glTexImage2D(GL_PROXY_TEXTURE_2D, border=1, width, height, ...);
> glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, GL_TEXTURE_WIDTH, &w);
> if (w != width) {
>   // the proxy texture failed, do something else
> }

I agree. This is the typical usage.

>


> If we stripped the texture border for the proxy texture, the
> conditional above would then fail. Have you found a different case
> where it makes sense to strip the border for proxies?


I  thought of a case where below 2 cases gives you different values without
this patch:
1. glTexImage2D(GL_PROXY_TEXTURE_2D, border=1, width, height, ...);
   glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, GL_TEXTURE_WIDTH, &w);
   /*you get an unstripped width value*/

2. glTexImage2D(GL_TEXTURE_2D, border=1, width, height, ...);
   glGetTexLevelParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WIDTH, &w);
   /*you get a stripped width value*/

But i haven't seen a case where any application compare these two values to
make
a decision. We can leave proxy textures unstripped if this is not an
important use case.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120301/535274ef/attachment.html>


More information about the mesa-dev mailing list