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...
This commit is contained in:
Michel Dänzer
2009-03-25 11:13:28 +01:00
parent e919bfa1f1
commit e101959b6a
4 changed files with 23 additions and 6 deletions
+16 -3
View File
@@ -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;
+5 -1
View File
@@ -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 */
+1 -1
View File
@@ -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;
}
+1 -1
View File
@@ -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