summaryrefslogtreecommitdiff
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorMichel Dänzer <daenzer@vmware.com>2009-03-25 11:13:28 +0100
committerMichel Dänzer <daenzer@vmware.com>2009-03-25 11:19:05 +0100
commite101959b6a262ba34a12b407ea6f480e6b4d7d72 (patch)
tree932858d6f0e439123c543ed9838a80f665b770f5 /src/mesa/drivers
parente919bfa1f1766e71780d0a4db5a8b6a04d19868f (diff)
r300: Texture size limit cleanups.
Since core Mesa MAX_TEXTURE_LEVELS was bumped, we were incorrectly advertising a maximum texture size of 4096 on older chips, causing corrupted menu text in Extreme Tux Racer or Armagetron. Also make sure our texture image array can actually hold all the mipmap levels we support...
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.c19
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.h6
-rw-r--r--src/mesa/drivers/dri/r300/r300_texmem.c2
-rw-r--r--src/mesa/drivers/dri/r300/r300_texstate.c2
4 files changed, 23 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c
index fddd87b85f..12bee1a8fb 100644
--- a/src/mesa/drivers/dri/r300/r300_context.c
+++ b/src/mesa/drivers/dri/r300/r300_context.c
@@ -288,10 +288,23 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
ctx->Const.MaxTextureMaxAnisotropy = 16.0;
ctx->Const.MaxTextureLodBias = 16.0;
- if (screen->chip_family >= CHIP_FAMILY_RV515) {
+ if (screen->chip_family >= CHIP_FAMILY_RV515)
ctx->Const.MaxTextureLevels = 13;
- ctx->Const.MaxTextureRectSize = 4096;
- }
+ else
+ ctx->Const.MaxTextureLevels = 12;
+
+ driCalculateMaxTextureLevels( r300->texture_heaps,
+ r300->nr_heaps,
+ & ctx->Const,
+ 4,
+ ctx->Const.MaxTextureLevels - 1,
+ MIN2(ctx->Const.MaxTextureLevels,
+ MAX_3D_TEXTURE_LEVELS) - 1,
+ ctx->Const.MaxTextureLevels - 1,
+ ctx->Const.MaxTextureLevels - 1,
+ ctx->Const.MaxTextureLevels - 1,
+ GL_FALSE,
+ 2 );
ctx->Const.MinPointSize = 1.0;
ctx->Const.MinPointSizeAA = 1.0;
diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h
index c15e9fa300..9c49586998 100644
--- a/src/mesa/drivers/dri/r300/r300_context.h
+++ b/src/mesa/drivers/dri/r300/r300_context.h
@@ -170,6 +170,10 @@ struct r300_dma {
typedef struct r300_tex_obj r300TexObj, *r300TexObjPtr;
+/* Maximum number of mipmap levels supported by any supported GPU
+ */
+#define R300_MAX_TEXTURE_LEVELS 13
+
/* Texture object in locally shared texture space.
*/
struct r300_tex_obj {
@@ -178,7 +182,7 @@ struct r300_tex_obj {
GLuint bufAddr; /* Offset to start of locally
shared texture block */
- drm_radeon_tex_image_t image[6][RADEON_MAX_TEXTURE_LEVELS];
+ drm_radeon_tex_image_t image[6][R300_MAX_TEXTURE_LEVELS];
/* Six, for the cube faces */
GLboolean image_override; /* Image overridden by GLX_EXT_tfp */
diff --git a/src/mesa/drivers/dri/r300/r300_texmem.c b/src/mesa/drivers/dri/r300/r300_texmem.c
index b03eefaa7c..0fe51b0c68 100644
--- a/src/mesa/drivers/dri/r300/r300_texmem.c
+++ b/src/mesa/drivers/dri/r300/r300_texmem.c
@@ -306,7 +306,7 @@ static void r300UploadSubImage(r300ContextPtr rmesa, r300TexObjPtr t,
ASSERT(face < 6);
/* Ensure we have a valid texture to upload */
- if ((hwlevel < 0) || (hwlevel >= RADEON_MAX_TEXTURE_LEVELS)) {
+ if ((hwlevel < 0) || (hwlevel >= R300_MAX_TEXTURE_LEVELS)) {
_mesa_problem(NULL, "bad texture level in %s", __FUNCTION__);
return;
}
diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c
index e2329f04ec..cadec7f3ec 100644
--- a/src/mesa/drivers/dri/r300/r300_texstate.c
+++ b/src/mesa/drivers/dri/r300/r300_texstate.c
@@ -345,7 +345,7 @@ static void r300SetTexImages(r300ContextPtr rmesa,
numLevels = t->base.lastLevel - t->base.firstLevel + 1;
- assert(numLevels <= RADEON_MAX_TEXTURE_LEVELS);
+ assert(numLevels <= R300_MAX_TEXTURE_LEVELS);
/* Calculate mipmap offsets and dimensions for blitting (uploading)
* The idea is that we lay out the mipmap levels within a block of