summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-07-08 10:04:14 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-07-08 10:04:14 -0600
commitc1938a60f7a9bf0773b86fb2f9a2677221f96557 (patch)
tree10eb11562ed6ea3661c11e1c86bf293617aa9b1a
parentd65110f352d804a33737f442bc1f681a1b0c6675 (diff)
Fix zero-size texture checking in _mesa_test_proxy_teximage(), bug 11309
-rw-r--r--docs/relnotes-7.0.1.html1
-rw-r--r--src/mesa/main/teximage.c28
2 files changed, 17 insertions, 12 deletions
diff --git a/docs/relnotes-7.0.1.html b/docs/relnotes-7.0.1.html
index 44493402668..e62497fc7c0 100644
--- a/docs/relnotes-7.0.1.html
+++ b/docs/relnotes-7.0.1.html
@@ -40,6 +40,7 @@ Mesa 7.0.1 is a stable release with bug fixes since version 7.0.
<li>GLSL bug fix: .strq and .rgba writemasks didn't always work
<li>Stencil pixel map didn't always work for glDrawPixels (bug 11475)
<li>Fixed polygon stipple bug in i915 driver
+<li>Binding a zero-sized texture didn't disable texturing (bug 11309)
</ul>
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index c8ce79ea865..d1b2c5c6399 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.5.1
+ * Version: 7.0.1
*
- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -1207,6 +1207,10 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target,
* A hardware driver might override this function if, for example, the
* max 3D texture size is 512x512x64 (i.e. not a cube).
*
+ * Note that width, height, depth == 0 is not an error. However, a
+ * texture with zero width/height/depth will be considered "incomplete"
+ * and texturing will effectively be disabled.
+ *
* \param target one of GL_PROXY_TEXTURE_1D, GL_PROXY_TEXTURE_2D,
* GL_PROXY_TEXTURE_3D, GL_PROXY_TEXTURE_RECTANGLE_NV,
* GL_PROXY_TEXTURE_CUBE_MAP_ARB.
@@ -1236,7 +1240,7 @@ _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level,
maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
if (width < 2 * border || width > 2 + maxSize ||
(!ctx->Extensions.ARB_texture_non_power_of_two &&
- _mesa_bitcount(width - 2 * border) != 1) ||
+ width > 0 && _mesa_bitcount(width - 2 * border) != 1) ||
level >= ctx->Const.MaxTextureLevels) {
/* bad width or level */
return GL_FALSE;
@@ -1246,10 +1250,10 @@ _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level,
maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
if (width < 2 * border || width > 2 + maxSize ||
(!ctx->Extensions.ARB_texture_non_power_of_two &&
- _mesa_bitcount(width - 2 * border) != 1) ||
+ width > 0 && _mesa_bitcount(width - 2 * border) != 1) ||
height < 2 * border || height > 2 + maxSize ||
(!ctx->Extensions.ARB_texture_non_power_of_two &&
- _mesa_bitcount(height - 2 * border) != 1) ||
+ height > 0 && _mesa_bitcount(height - 2 * border) != 1) ||
level >= ctx->Const.MaxTextureLevels) {
/* bad width or height or level */
return GL_FALSE;
@@ -1259,21 +1263,21 @@ _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level,
maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1);
if (width < 2 * border || width > 2 + maxSize ||
(!ctx->Extensions.ARB_texture_non_power_of_two &&
- _mesa_bitcount(width - 2 * border) != 1) ||
+ width > 0 && _mesa_bitcount(width - 2 * border) != 1) ||
height < 2 * border || height > 2 + maxSize ||
(!ctx->Extensions.ARB_texture_non_power_of_two &&
- _mesa_bitcount(height - 2 * border) != 1) ||
+ height > 0 && _mesa_bitcount(height - 2 * border) != 1) ||
depth < 2 * border || depth > 2 + maxSize ||
(!ctx->Extensions.ARB_texture_non_power_of_two &&
- _mesa_bitcount(depth - 2 * border) != 1) ||
+ depth > 0 && _mesa_bitcount(depth - 2 * border) != 1) ||
level >= ctx->Const.Max3DTextureLevels) {
/* bad width or height or depth or level */
return GL_FALSE;
}
return GL_TRUE;
case GL_PROXY_TEXTURE_RECTANGLE_NV:
- if (width < 1 || width > ctx->Const.MaxTextureRectSize ||
- height < 1 || height > ctx->Const.MaxTextureRectSize ||
+ if (width < 0 || width > ctx->Const.MaxTextureRectSize ||
+ height < 0 || height > ctx->Const.MaxTextureRectSize ||
level != 0) {
/* bad width or height or level */
return GL_FALSE;
@@ -1283,10 +1287,10 @@ _mesa_test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level,
maxSize = 1 << (ctx->Const.MaxCubeTextureLevels - 1);
if (width < 2 * border || width > 2 + maxSize ||
(!ctx->Extensions.ARB_texture_non_power_of_two &&
- _mesa_bitcount(width - 2 * border) != 1) ||
+ width > 0 && _mesa_bitcount(width - 2 * border) != 1) ||
height < 2 * border || height > 2 + maxSize ||
(!ctx->Extensions.ARB_texture_non_power_of_two &&
- _mesa_bitcount(height - 2 * border) != 1) ||
+ height > 0 && _mesa_bitcount(height - 2 * border) != 1) ||
level >= ctx->Const.MaxCubeTextureLevels) {
/* bad width or height */
return GL_FALSE;