Index: common/texmem.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/common/texmem.c,v retrieving revision 1.15 diff -u -r1.15 texmem.c --- common/texmem.c 28 Nov 2005 13:17:15 -0000 1.15 +++ common/texmem.c 2 Feb 2006 12:03:22 -0000 @@ -929,7 +929,7 @@ * level) is available. */ - return log2_size + 1; + return log2_size; } } } @@ -942,10 +942,10 @@ } #define SET_MAX(f,v) \ - do { if ( max_sizes[v] != 0 ) { limits-> f = max_sizes[v]; } } while( 0 ) + do { if ( max_sizes[v] != 0 ) { limits-> f = (max_sizes[v] + 1); } } while( 0 ) #define SET_MAX_RECT(f,v) \ - do { if ( max_sizes[v] != 0 ) { limits-> f = 1 << (max_sizes[v] - 1); } } while( 0 ) + do { if ( max_sizes[v] != 0 ) { limits-> f = 1 << max_sizes[v]; } } while( 0 ) /** @@ -971,6 +971,8 @@ * For hardware that does not support mipmapping, this will be 1. * \param all_textures_one_heap True if the hardware requires that all * textures be in a single texture heap for multitexturing. + * \param allow_larger_textures 0 conservative, 1 calculate limits + * so at least one worst-case texture can fit, 2 just use hw limits. */ void @@ -983,7 +985,8 @@ unsigned max_cube_size, unsigned max_rect_size, unsigned mipmaps_at_once, - int all_textures_one_heap ) + int all_textures_one_heap, + int allow_larger_textures ) { struct maps_per_heap max_textures[8]; unsigned i; @@ -1012,14 +1015,15 @@ */ for ( i = 0 ; i < 4 ; i++ ) { - if ( max_sizes[ i ] != 0 ) { - fill_in_maximums( heaps, nr_heaps, max_bytes_per_texel, + if ( (allow_larger_textures != 2) && (max_sizes[ i ] != 0) ) { + fill_in_maximums( heaps, nr_heaps, max_bytes_per_texel, max_sizes[ i ], mipmaps[ i ], dimensions[ i ], faces[ i ], max_textures ); - max_sizes[ i ] = get_max_size( nr_heaps, - limits->MaxTextureUnits, + max_sizes[ i ] = get_max_size( nr_heaps, + allow_larger_textures == 1 ? + 1 : limits->MaxTextureUnits, max_sizes[ i ], all_textures_one_heap, max_textures ); Index: common/texmem.h =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/common/texmem.h,v retrieving revision 1.9 diff -u -r1.9 texmem.h --- common/texmem.h 28 Nov 2005 13:17:16 -0000 1.9 +++ common/texmem.h 2 Feb 2006 12:03:22 -0000 @@ -291,13 +291,14 @@ driCalculateMaxTextureLevels( driTexHeap * const * heaps, unsigned nr_heaps, struct gl_constants * limits, - unsigned max_bytes_per_texel, + unsigned max_bytes_per_texel, unsigned max_2D_size, unsigned max_3D_size, unsigned max_cube_size, unsigned max_rect_size, unsigned mipmaps_at_once, - int all_textures_one_heap ); + int all_textures_one_heap, + int allow_larger_textures ); void driSetTextureSwapCounterLocation( driTexHeap * heap, unsigned * counter ); Index: common/xmlpool/t_options.h =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/common/xmlpool/t_options.h,v retrieving revision 1.1 diff -u -r1.1 t_options.h --- common/xmlpool/t_options.h 11 Apr 2005 21:41:40 -0000 1.1 +++ common/xmlpool/t_options.h 2 Feb 2006 12:03:23 -0000 @@ -191,9 +191,13 @@ DRI_CONF_DESC(en,gettext("Number of texture units used")) \ DRI_CONF_OPT_END -#define DRI_CONF_TEXTURE_LEVEL_HACK(def) \ -DRI_CONF_OPT_BEGIN(texture_level_hack,bool,def) \ - DRI_CONF_DESC(en,gettext("Enable hack to allow larger textures with texture compression on radeon/r200")) \ +#define DRI_CONF_ANNOUNCE_LARGE_TEXTURES(def) \ +DRI_CONF_OPT_BEGIN_V(announce_large_textures,enum,def,"0:2") \ + DRI_CONF_DESC_BEGIN(en,gettext("Support larger textures not guaranteed to fit into graphics memory")) \ + DRI_CONF_ENUM(0,gettext("No")) \ + DRI_CONF_ENUM(1,gettext("At least 1 texture must fit under worst-case assumptions")) \ + DRI_CONF_ENUM(2,gettext("Announce hardware limits")) \ + DRI_CONF_DESC_END \ DRI_CONF_OPT_END #define DRI_CONF_TEXTURE_BLEND_QUALITY(def,range) \ Index: r200/r200_context.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/r200/r200_context.c,v retrieving revision 1.54 diff -u -r1.54 r200_context.c --- r200/r200_context.c 7 Jan 2006 20:42:16 -0000 1.54 +++ r200/r200_context.c 2 Feb 2006 12:03:24 -0000 @@ -376,6 +383,8 @@ ctx->Const.MaxTextureImageUnits = ctx->Const.MaxTextureUnits; ctx->Const.MaxTextureCoordUnits = ctx->Const.MaxTextureUnits; + i = driQueryOptioni( &rmesa->optionCache, "announce_large_textures"); + driCalculateMaxTextureLevels( rmesa->texture_heaps, rmesa->nr_heaps, & ctx->Const, @@ -389,14 +398,8 @@ 11, /* max cube texture size is 2048x2048 */ 11, /* max texture rectangle size is 2048x2048 */ 12, - GL_FALSE ); - - /* adjust max texture size a bit. Hack, but I really want to use larger textures - which will work just fine in 99.999999% of all cases, especially with texture compression... */ - if (driQueryOptionb( &rmesa->optionCache, "texture_level_hack" )) - { - if (ctx->Const.MaxTextureLevels < 12) ctx->Const.MaxTextureLevels += 1; - } + GL_FALSE, + i ); ctx->Const.MaxTextureMaxAnisotropy = 16.0; Index: radeon/radeon_context.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/radeon/radeon_context.c,v retrieving revision 1.47 diff -u -r1.47 radeon_context.c --- radeon/radeon_context.c 7 Jan 2006 20:42:17 -0000 1.47 +++ radeon/radeon_context.c 2 Feb 2006 12:03:33 -0000 @@ -337,23 +337,20 @@ ctx->Const.MaxTextureImageUnits = ctx->Const.MaxTextureUnits; ctx->Const.MaxTextureCoordUnits = ctx->Const.MaxTextureUnits; + i = driQueryOptioni( &rmesa->optionCache, "announce_large_textures"); + driCalculateMaxTextureLevels( rmesa->texture_heaps, rmesa->nr_heaps, & ctx->Const, 4, 11, /* max 2D texture size is 2048x2048 */ - 0, /* 3D textures unsupported. */ + 8, /* 256^3 */ 9, /* \todo: max cube texture size seems to be 512x512(x6) */ 11, /* max rect texture size is 2048x2048. */ 12, - GL_FALSE ); + GL_FALSE, + i ); - /* adjust max texture size a bit. Hack, but I really want to use larger textures - which will work just fine in 99.999999% of all cases, especially with texture compression... */ - if (driQueryOptionb( &rmesa->optionCache, "texture_level_hack" )) - { - if (ctx->Const.MaxTextureLevels < 12) ctx->Const.MaxTextureLevels += 1; - } ctx->Const.MaxTextureMaxAnisotropy = 16.0; Index: radeon/radeon_screen.c =================================================================== RCS file: /cvs/mesa/Mesa/src/mesa/drivers/dri/radeon/radeon_screen.c,v retrieving revision 1.51 diff -u -r1.51 radeon_screen.c --- radeon/radeon_screen.c 20 Jan 2006 21:56:52 -0000 1.51 +++ radeon/radeon_screen.c 2 Feb 2006 12:03:34 -0000 @@ -87,7 +87,7 @@ DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER) DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC) DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF) - DRI_CONF_TEXTURE_LEVEL_HACK(false) + DRI_CONF_ANNOUNCE_LARGE_TEXTURES(0) DRI_CONF_SECTION_END DRI_CONF_SECTION_DEBUG DRI_CONF_NO_RAST(false) @@ -114,7 +114,7 @@ DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER) DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC) DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF) - DRI_CONF_TEXTURE_LEVEL_HACK(false) + DRI_CONF_ANNOUNCE_LARGE_TEXTURES(0) DRI_CONF_TEXTURE_BLEND_QUALITY(1.0,"0.0:1.0") DRI_CONF_SECTION_END DRI_CONF_SECTION_DEBUG