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

Brian Paul brian.e.paul at gmail.com
Wed Feb 29 19:48:51 PST 2012


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
}

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?

-Brian


More information about the mesa-dev mailing list