diff options
author | Anuj Phogat <[email protected]> | 2012-01-25 19:05:45 -0800 |
---|---|---|
committer | Anuj Phogat <[email protected]> | 2012-02-09 11:59:38 -0800 |
commit | ea228d97f811092b9ffcb90565184a7a8f089477 (patch) | |
tree | 0920d93a22bc70befe8f993f16c04671eb524c8e | |
parent | 23c52caafba52c77092b9721bd4601f8ea592625 (diff) |
mesa: fix maximum allowed proxy texture size condition
width, height parameter in 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 + 2 * border.
i.e. 1 << (ctx->Const.MaxTextureLevels - 1) + 2 * border
Texture border is anyway stripped out before it is given to intel
or gallium drivers.
This patch fixes Intel oglconform test case:
max_values negative.textureSize.textureCube
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 <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
-rw-r--r-- | 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 25da753697d..e4eb7f67d1f 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 > maxSize) + if (width < 2 * border || width > 2 * border + maxSize) return GL_FALSE; if (level >= ctx->Const.MaxTextureLevels) return GL_FALSE; @@ -1191,9 +1191,9 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level, case GL_PROXY_TEXTURE_2D: maxSize = 1 << (ctx->Const.MaxTextureLevels - 1); - if (width < 2 * border || width > maxSize) + if (width < 2 * border || width > 2 * border + maxSize) return GL_FALSE; - if (height < 2 * border || height > maxSize) + if (height < 2 * border || height > 2 * border + maxSize) return GL_FALSE; if (level >= ctx->Const.MaxTextureLevels) return GL_FALSE; @@ -1207,11 +1207,11 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level, case GL_PROXY_TEXTURE_3D: maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1); - if (width < 2 * border || width > maxSize) + if (width < 2 * border || width > 2 * border + maxSize) return GL_FALSE; - if (height < 2 * border || height > maxSize) + if (height < 2 * border || height > 2 * border + maxSize) return GL_FALSE; - if (depth < 2 * border || depth > maxSize) + if (depth < 2 * border || depth > 2 * border + maxSize) return GL_FALSE; if (level >= ctx->Const.Max3DTextureLevels) return GL_FALSE; @@ -1237,9 +1237,9 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level, case GL_PROXY_TEXTURE_CUBE_MAP_ARB: maxSize = 1 << (ctx->Const.MaxCubeTextureLevels - 1); - if (width < 2 * border || width > maxSize) + if (width < 2 * border || width > 2 * border + maxSize) return GL_FALSE; - if (height < 2 * border || height > maxSize) + if (height < 2 * border || height > 2 * border + maxSize) return GL_FALSE; if (level >= ctx->Const.MaxCubeTextureLevels) return GL_FALSE; @@ -1253,7 +1253,7 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level, case GL_PROXY_TEXTURE_1D_ARRAY_EXT: maxSize = 1 << (ctx->Const.MaxTextureLevels - 1); - if (width < 2 * border || width > maxSize) + if (width < 2 * border || width > 2 * border + maxSize) return GL_FALSE; if (height < 1 || height > ctx->Const.MaxArrayTextureLayers) return GL_FALSE; @@ -1267,9 +1267,9 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level, case GL_PROXY_TEXTURE_2D_ARRAY_EXT: maxSize = 1 << (ctx->Const.MaxTextureLevels - 1); - if (width < 2 * border || width > maxSize) + if (width < 2 * border || width > 2 * border + maxSize) return GL_FALSE; - if (height < 2 * border || height > maxSize) + if (height < 2 * border || height > 2 * border + maxSize) return GL_FALSE; if (depth < 1 || depth > ctx->Const.MaxArrayTextureLayers) return GL_FALSE; |