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

Anuj Phogat anuj.phogat at gmail.com
Thu Feb 2 11:54:37 PST 2012


On Wed, Feb 1, 2012 at 12:52 PM, Jose Fonseca <jfonseca at vmware.com> wrote:

>
>
> ----- Original Message -----
> > On 01/28/2012 04:04 AM, Jose Fonseca wrote:
> > >
> > >
> > > ----- 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.
> >
> > AFAIK, the only desktop graphics hardware that ever supported borders
> > is
> > NVIDIA.  Their driver follows the convention (width + 2 * border) <
> > maxSize, and their driver advertises a maximum size of 2^n.  I tried
> > creating a proxy texture that was the full 2^n plus a border on their
> > closed-source Linux driver, and it was rejected.  A proxy texture
> > 2^n-2
> > plus a border was accepted.
> >
> > Based on that, I believe this patch is correct.
>
> Fair enough. Sounds good to me then!


This patch made the intel oglconform test to pass. But the errors reported in
oglconform failure stays unfixed. This is confirmed by a piglit test
case I developed to reproduce the errors. Test case
(validate-texture-size) is posted on piglit mailing list for review.

Driver throws assertion failure or segfaults with large textures even
much below the maximum supported size.

https://bugs.freedesktop.org/show_bug.cgi?id=44970
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120202/ffb24273/attachment.htm>


More information about the mesa-dev mailing list