[Mesa-dev] [PATCH] mesa: fix maximum supported texture size returned by glGetIntegrv

Anuj Phogat anuj.phogat at gmail.com
Thu Jan 26 16:54:25 PST 2012


As per OpenGL 3.0 specification section 3.9, page 187 in pdf the maximum
allowable width, height, or depth of a texel array must be at least
2^(k−lod) + 2*bt for image arrays of level-of-detail (lod) 0 through k,
where k is the log base 2 of MAX_3D_TEXTURE_SIZE, and bt is the maximum
border width

Currently different values for maximum allowable texture size are returned
by glGetIntegrv() and proxy textures. glGetIntegrv returns 2048 and proxy
texture returns (2048 + 2)

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/get.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 5ad6012..4a70109 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1507,7 +1507,8 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
    case GL_MAX_3D_TEXTURE_SIZE:
    case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB:
       p = (GLuint *) ((char *) ctx + d->offset);
-      v->value_int = 1 << (*p - 1);
+      /* GL 3.0: Add 2 pixels to accmodate border */
+      v->value_int = 1 << (*p - 1) + 2;
       break;
 
    case GL_SCISSOR_BOX:
-- 
1.7.7.4



More information about the mesa-dev mailing list