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.pho...@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.

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
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to