replace the texture level hack used in radeon/r200 to allow larger textures with different methods to calculate the announced maximum texture sizes. Default is still the same (that is, radeon/r200 default to not announce anything which might not fit, i830/i915 default to 1 texture must fit). Bug #5785.

This commit is contained in:
Roland Scheidegger
2006-02-03 13:29:11 +00:00
parent 16a14510c4
commit e7276b7fa5
15 changed files with 112 additions and 67 deletions
+13 -6
View File
@@ -971,19 +971,22 @@ get_max_size( unsigned nr_heaps,
* 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
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 )
{
struct maps_per_heap max_textures[8];
unsigned i;
@@ -1012,18 +1015,22 @@ driCalculateMaxTextureLevels( driTexHeap * const * heaps,
*/
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 );
}
else if (max_sizes[ i ] != 0) {
max_sizes[ i ] += 1;
}
}
SET_MAX( MaxTextureLevels, 0 );
+3 -2
View File
@@ -291,13 +291,14 @@ void
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 );
+24 -15
View File
@@ -178,8 +178,8 @@ msgid ""
"Always synchronize with vertical refresh, application chooses the minimum "
"swap interval"
msgstr ""
"Immer mit der Bildwiederholung synchronisieren, Anwendung wählt das minmale "
"Bildinterval"
"Immer mit der Bildwiederholung synchronisieren, Anwendung wählt das minimale "
"Bildintervall"
#: t_options.h:186
msgid "Use HyperZ to boost performance"
@@ -190,42 +190,51 @@ msgid "Number of texture units used"
msgstr "Anzahl der benutzten Textureinheiten"
#: t_options.h:196
msgid ""
"Enable hack to allow larger textures with texture compression on radeon/r200"
msgstr ""
"Hack aktivieren, der mit Texturkompression auf radeon/r200 größere Texturen "
"erlaubt"
msgid "Support larger textures not guaranteed to fit into graphics memory"
msgstr "Unterstütze grosse Texturen die evtl. nicht in den Grafikspeicher passen"
#: t_options.h:201
#: t_options.h:197
msgid "No"
msgstr "Nein"
#: t_options.h:198
msgid "At least 1 texture must fit under worst-case assumptions"
msgstr "Mindestens 1 Textur muss auch im schlechtesten Fall Platz haben"
#: t_options.h:199
msgid "Announce hardware limits"
msgstr "Benutze Hardware-Limits"
#: t_options.h:205
msgid "Texture filtering quality vs. speed, AKA “brilinear” texture filtering"
msgstr ""
"Texturfilterqualität versus -geschwindigkeit, auch bekannt als „brilineare“ "
"Texturfilterung"
#: t_options.h:209
#: t_options.h:213
msgid "Used types of texture memory"
msgstr "Benutzte Arten von Texturspeicher"
#: t_options.h:210
#: t_options.h:214
msgid "All available memory"
msgstr "Aller verfügbarer Speicher"
#: t_options.h:211
#: t_options.h:215
msgid "Only card memory (if available)"
msgstr "Nur Grafikspeicher (falls verfügbar)"
#: t_options.h:212
#: t_options.h:216
msgid "Only GART (AGP/PCIE) memory (if available)"
msgstr "Nur GART-Speicher (AGP/PCIE) (falls verfügbar)"
#: t_options.h:220
#: t_options.h:224
msgid "Features that are not hardware-accelerated"
msgstr "Funktionalität, die nicht hardwarebeschleunigt ist"
#: t_options.h:224
#: t_options.h:228
msgid "Enable extension GL_ARB_vertex_program"
msgstr "Erweiterung GL_ARB_vertex_program aktivieren"
#: t_options.h:229
#: t_options.h:233
msgid "Enable extension GL_NV_vertex_program"
msgstr "Erweiterung GL_NV_vertex_program aktivieren"
+28 -8
View File
@@ -341,7 +341,7 @@ DRI_CONF_OPT_BEGIN_V(vblank_mode,enum,def,"0:3") \
DRI_CONF_ENUM(0,"Niemals mit der Bildwiederholung synchronisieren, Anweisungen der Anwendung ignorieren") \
DRI_CONF_ENUM(1,"Initiales Bildinterval 0, Anweisungen der Anwendung gehorchen") \
DRI_CONF_ENUM(2,"Initiales Bildinterval 1, Anweisungen der Anwendung gehorchen") \
DRI_CONF_ENUM(3,"Immer mit der Bildwiederholung synchronisieren, Anwendung wählt das minmale Bildinterval") \
DRI_CONF_ENUM(3,"Immer mit der Bildwiederholung synchronisieren, Anwendung wählt das minimale Bildintervall") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(es,"Sincronización con el refresco vertical (intervalos de intercambio)") \
DRI_CONF_ENUM(0,"No sincronizar nunca con el refresco vertical, ignorar la elección de la aplicación") \
@@ -383,13 +383,33 @@ DRI_CONF_OPT_BEGIN_V(texture_units,int,def, # min ":" # max ) \
DRI_CONF_DESC(fr,"Nombre d'unités de texture") \
DRI_CONF_OPT_END
#define DRI_CONF_TEXTURE_LEVEL_HACK(def) \
DRI_CONF_OPT_BEGIN(texture_level_hack,bool,def) \
DRI_CONF_DESC(en,"Enable hack to allow larger textures with texture compression on radeon/r200") \
DRI_CONF_DESC(de,"Hack aktivieren, der mit Texturkompression auf radeon/r200 größere Texturen erlaubt") \
DRI_CONF_DESC(es,"Activar ”hack“ para permitir texturas más grandes con compresión de textura activada en la Radeon/r200") \
DRI_CONF_DESC(nl,"Schakel hack in om met textuurcompressie grotere texturen toe te staan op een radeon/r200") \
DRI_CONF_DESC(fr,"Activer le hack permettant l'utilisation de textures de grande taille avec la compression de textures sur radeon/r200") \
#define DRI_CONF_ALLOW_LARGE_TEXTURES(def) \
DRI_CONF_OPT_BEGIN_V(allow_large_textures,enum,def,"0:2") \
DRI_CONF_DESC_BEGIN(en,"Support larger textures not guaranteed to fit into graphics memory") \
DRI_CONF_ENUM(0,"No") \
DRI_CONF_ENUM(1,"At least 1 texture must fit under worst-case assumptions") \
DRI_CONF_ENUM(2,"Announce hardware limits") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(de,"Unterstütze grosse Texturen die evtl. nicht in den Grafikspeicher passen") \
DRI_CONF_ENUM(0,"Nein") \
DRI_CONF_ENUM(1,"Mindestens 1 Textur muss auch im schlechtesten Fall Platz haben") \
DRI_CONF_ENUM(2,"Benutze Hardware-Limits") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(es,"Support larger textures not guaranteed to fit into graphics memory") \
DRI_CONF_ENUM(0,"No") \
DRI_CONF_ENUM(1,"At least 1 texture must fit under worst-case assumptions") \
DRI_CONF_ENUM(2,"Announce hardware limits") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(nl,"Support larger textures not guaranteed to fit into graphics memory") \
DRI_CONF_ENUM(0,"No") \
DRI_CONF_ENUM(1,"At least 1 texture must fit under worst-case assumptions") \
DRI_CONF_ENUM(2,"Announce hardware limits") \
DRI_CONF_DESC_END \
DRI_CONF_DESC_BEGIN(fr,"Support larger textures not guaranteed to fit into graphics memory") \
DRI_CONF_ENUM(0,"No") \
DRI_CONF_ENUM(1,"At least 1 texture must fit under worst-case assumptions") \
DRI_CONF_ENUM(2,"Announce hardware limits") \
DRI_CONF_DESC_END \
DRI_CONF_OPT_END
#define DRI_CONF_TEXTURE_BLEND_QUALITY(def,range) \
@@ -191,9 +191,13 @@ DRI_CONF_OPT_BEGIN_V(texture_units,int,def, # min ":" # max ) \
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_ALLOW_LARGE_TEXTURES(def) \
DRI_CONF_OPT_BEGIN_V(allow_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) \
+2 -1
View File
@@ -260,7 +260,8 @@ i810CreateContext( const __GLcontextModes *mesaVis,
0, /* cube textures unsupported. */
0, /* texture rectangles unsupported. */
12,
GL_FALSE );
GL_FALSE,
0 );
ctx->Const.MinLineWidth = 1.0;
ctx->Const.MinLineWidthAA = 1.0;
+5 -3
View File
@@ -61,6 +61,7 @@ GLboolean i830CreateContext( const __GLcontextModes *mesaVis,
i830ContextPtr i830 = (i830ContextPtr) CALLOC_STRUCT(i830_context);
intelContextPtr intel = &i830->intel;
GLcontext *ctx = &intel->ctx;
GLuint i;
if (!i830) return GL_FALSE;
i830InitVtbl( i830 );
@@ -91,7 +92,8 @@ GLboolean i830CreateContext( const __GLcontextModes *mesaVis,
/* FIXME: driCalculateMaxTextureLevels assumes that mipmaps are tightly
* FIXME: packed, but they're not in Intel graphics hardware.
*/
intel->ctx.Const.MaxTextureUnits = 1;
intel->ctx.Const.MaxTextureUnits = I830_TEX_UNITS;
i = driQueryOptioni( &intel->intelScreen->optionCache, "allow_large_textures");
driCalculateMaxTextureLevels( intel->texture_heaps,
intel->nr_heaps,
&intel->ctx.Const,
@@ -101,8 +103,8 @@ GLboolean i830CreateContext( const __GLcontextModes *mesaVis,
10, /* max CUBE texture size is 1024x1024 */
11, /* max RECT. supported */
12,
GL_FALSE );
intel->ctx.Const.MaxTextureUnits = I830_TEX_UNITS;
GL_FALSE,
i );
_tnl_init_vertices( ctx, ctx->Const.MaxArrayLockSize + 12,
18 * sizeof(GLfloat) );
+5 -3
View File
@@ -102,6 +102,7 @@ GLboolean i915CreateContext( const __GLcontextModes *mesaVis,
i915ContextPtr i915 = (i915ContextPtr) CALLOC_STRUCT(i915_context);
intelContextPtr intel = &i915->intel;
GLcontext *ctx = &intel->ctx;
GLuint i;
if (!i915) return GL_FALSE;
@@ -135,7 +136,8 @@ GLboolean i915CreateContext( const __GLcontextModes *mesaVis,
* tightly packed, but they're not in Intel graphics
* hardware.
*/
ctx->Const.MaxTextureUnits = 1;
ctx->Const.MaxTextureUnits = I915_TEX_UNITS;
i = driQueryOptioni( &intel->intelScreen->optionCache, "allow_large_textures");
driCalculateMaxTextureLevels( intel->texture_heaps,
intel->nr_heaps,
&intel->ctx.Const,
@@ -145,8 +147,8 @@ GLboolean i915CreateContext( const __GLcontextModes *mesaVis,
11, /* cube texture. */
11, /* rect texture */
12,
GL_FALSE );
ctx->Const.MaxTextureUnits = I915_TEX_UNITS;
GL_FALSE,
i );
/* GL_ARB_fragment_program limits - don't think Mesa actually
* validates programs against these, and in any case one ARB
+2 -1
View File
@@ -48,9 +48,10 @@ PUBLIC const char __driConfigOptions[] =
DRI_CONF_BEGIN
DRI_CONF_SECTION_PERFORMANCE
DRI_CONF_FORCE_S3TC_ENABLE(false)
DRI_CONF_ALLOW_LARGE_TEXTURES(1)
DRI_CONF_SECTION_END
DRI_CONF_END;
const GLuint __driNConfigOptions = 1;
const GLuint __driNConfigOptions = 2;
#ifdef USE_NEW_INTERFACE
static PFNGLXCREATECONTEXTMODES create_context_modes = NULL;
+2 -1
View File
@@ -540,7 +540,8 @@ mgaCreateContext( const __GLcontextModes *mesaVis,
0, /* cube textures unsupported. */
11, /* max texture rect size is 2048x2048 */
maxlevels,
GL_FALSE );
GL_FALSE,
0 );
ctx->Const.MinLineWidth = 1.0;
ctx->Const.MinLineWidthAA = 1.0;
+2 -1
View File
@@ -210,7 +210,8 @@ GLboolean r128CreateContext( const __GLcontextModes *glVisual,
0, /* cube textures unsupported. */
0, /* texture rectangles unsupported. */
11,
GL_FALSE );
GL_FALSE,
0 );
/* No wide points.
*/
+7 -10
View File
@@ -366,8 +366,9 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
rmesa->hw.all_dirty = 1;
/* Set the maximum texture size small enough that we can guarentee that
* all texture units can bind a maximal texture and have them both in
* texturable memory at once.
* all texture units can bind a maximal texture and have all of them in
* texturable memory at once. Depending on the allow_large_textures driconf
* setting allow larger textures.
*/
ctx = rmesa->glCtx;
@@ -376,6 +377,8 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
ctx->Const.MaxTextureImageUnits = ctx->Const.MaxTextureUnits;
ctx->Const.MaxTextureCoordUnits = ctx->Const.MaxTextureUnits;
i = driQueryOptioni( &rmesa->optionCache, "allow_large_textures");
driCalculateMaxTextureLevels( rmesa->texture_heaps,
rmesa->nr_heaps,
& ctx->Const,
@@ -389,14 +392,8 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
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;
+8 -10
View File
@@ -327,8 +327,9 @@ radeonCreateContext( const __GLcontextModes *glVisual,
rmesa->hw.all_dirty = GL_TRUE;
/* Set the maximum texture size small enough that we can guarentee that
* all texture units can bind a maximal texture and have them both in
* texturable memory at once.
* all texture units can bind a maximal texture and have all of them in
* texturable memory at once. Depending on the allow_large_textures driconf
* setting allow larger textures.
*/
ctx = rmesa->glCtx;
@@ -337,23 +338,20 @@ radeonCreateContext( const __GLcontextModes *glVisual,
ctx->Const.MaxTextureImageUnits = ctx->Const.MaxTextureUnits;
ctx->Const.MaxTextureCoordUnits = ctx->Const.MaxTextureUnits;
i = driQueryOptioni( &rmesa->optionCache, "allow_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;
+2 -2
View File
@@ -87,7 +87,7 @@ DRI_CONF_BEGIN
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_ALLOW_LARGE_TEXTURES(0)
DRI_CONF_SECTION_END
DRI_CONF_SECTION_DEBUG
DRI_CONF_NO_RAST(false)
@@ -114,7 +114,7 @@ DRI_CONF_BEGIN
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_ALLOW_LARGE_TEXTURES(0)
DRI_CONF_TEXTURE_BLEND_QUALITY(1.0,"0.0:1.0")
DRI_CONF_SECTION_END
DRI_CONF_SECTION_DEBUG
+2 -1
View File
@@ -456,7 +456,8 @@ savageCreateContext( const __GLcontextModes *mesaVis,
0, /* cube textures unsupported. */
0, /* texture rectangles unsupported. */
12,
GL_FALSE );
GL_FALSE,
0 );
if (ctx->Const.MaxTextureLevels <= 6) { /*spec requires at least 64x64*/
__driUtilMessage("Not enough texture memory. "
"Falling back to indirect rendering.");