[Mesa-dev] [PATCH] mesa: fix maximum allowed proxy texture size condition

Jose Fonseca jfonseca at vmware.com
Sat Jan 28 03:04:07 PST 2012



----- Original Message -----
> width, height parameter of glTexImage2D() includes: texture image
> width + 2 * border (if any). So when doing the texture size check
> in _mesa_test_proxy_teximage() width and height should not exceed
> maximum supported size for target texture type.
> i.e. 1 << (ctx->Const.MaxTextureLevels - 1)
> 
> This patch fixes Intel oglconform test case: max_values
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44970
> 
> Note: This is a candidate for mesa 8.0 branch.
> 
> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> ---
>  src/mesa/main/teximage.c |   22 +++++++++++-----------
>  1 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> index d11425d..018aca0 100644
> --- a/src/mesa/main/teximage.c
> +++ b/src/mesa/main/teximage.c
> @@ -1179,7 +1179,7 @@ _mesa_test_proxy_teximage(struct gl_context
> *ctx, GLenum target, GLint level,
>     switch (target) {
>     case GL_PROXY_TEXTURE_1D:
>        maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
> -      if (width < 2 * border || width > 2 + maxSize)
> +      if (width < 2 * border || width > maxSize)

Anuj,

I may be missing something, but I'm still unsure about this, because this will create problems for drivers that do support borders.

Intel driver sets:

   ctx->Const.StripTextureBorder = GL_TRUE

So I'd expect the right expression to be

        if (width < 2 * border || width > 2 * border + maxSize)

and that we do one two things:

- we return FALSE here if border > 0 and ctx->Const.StripTextureBorder == GL_TRUE

- or we make sure that the border is striped _everywhere_, including whatever upload path that caused the segfault in bug 44970.


Jose


More information about the mesa-dev mailing list