mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 13:48:06 +02:00
Improved MaxTextureLevel computation to take the nr. of tex units and both
texture heaps into account.
This commit is contained in:
parent
57ff474cb0
commit
7e4a56d110
1 changed files with 34 additions and 12 deletions
|
|
@ -234,6 +234,7 @@ savageCreateContext( const __GLcontextModes *mesaVis,
|
|||
savageScreenPrivate *savageScreen = (savageScreenPrivate *)sPriv->private;
|
||||
drm_savage_sarea_t *saPriv=(drm_savage_sarea_t *)(((char*)sPriv->pSAREA)+
|
||||
savageScreen->sarea_priv_offset);
|
||||
GLuint maxTextureSize, minTextureSize, maxTextureLevels;
|
||||
int i;
|
||||
imesa = (savageContextPtr)Xcalloc(sizeof(savageContext), 1);
|
||||
if (!imesa) {
|
||||
|
|
@ -257,18 +258,6 @@ savageCreateContext( const __GLcontextModes *mesaVis,
|
|||
}
|
||||
driContextPriv->driverPrivate = imesa;
|
||||
|
||||
/* BEGIN;*/
|
||||
/* Set the maximum texture size small enough that we can guarentee
|
||||
* that both texture units can bind a maximal texture and have them
|
||||
* in memory at once.
|
||||
*/
|
||||
if (savageScreen->textureSize[SAVAGE_CARD_HEAP] < 2*1024*1024) {
|
||||
ctx->Const.MaxTextureLevels = 9;
|
||||
} else if (savageScreen->textureSize[SAVAGE_CARD_HEAP] < 8*1024*1024) {
|
||||
ctx->Const.MaxTextureLevels = 10;
|
||||
} else {
|
||||
ctx->Const.MaxTextureLevels = 11;
|
||||
}
|
||||
if (savageScreen->chipset >= S3_SAVAGE4)
|
||||
ctx->Const.MaxTextureUnits = 2;
|
||||
else
|
||||
|
|
@ -276,6 +265,39 @@ savageCreateContext( const __GLcontextModes *mesaVis,
|
|||
ctx->Const.MaxTextureImageUnits = ctx->Const.MaxTextureUnits;
|
||||
ctx->Const.MaxTextureCoordUnits = ctx->Const.MaxTextureUnits;
|
||||
|
||||
/* Set the maximum texture size small enough that we can guarentee
|
||||
* that all texture units can bind a maximal texture and have them
|
||||
* in memory at once.
|
||||
*/
|
||||
if (savageScreen->textureSize[SAVAGE_CARD_HEAP] >
|
||||
savageScreen->textureSize[SAVAGE_AGP_HEAP]) {
|
||||
maxTextureSize = savageScreen->textureSize[SAVAGE_CARD_HEAP];
|
||||
minTextureSize = savageScreen->textureSize[SAVAGE_AGP_HEAP];
|
||||
} else {
|
||||
maxTextureSize = savageScreen->textureSize[SAVAGE_AGP_HEAP];
|
||||
minTextureSize = savageScreen->textureSize[SAVAGE_CARD_HEAP];
|
||||
}
|
||||
if (ctx->Const.MaxTextureUnits == 2) {
|
||||
/* How to distribute two maximum sized textures to two texture heaps?
|
||||
* If the smaller heap is less then half the size of the bigger one
|
||||
* then the maximum size is half the size of the bigger heap.
|
||||
* Otherwise it's the size of the smaller heap. */
|
||||
if (minTextureSize < maxTextureSize / 2)
|
||||
maxTextureSize = maxTextureSize / 2;
|
||||
else
|
||||
maxTextureSize = minTextureSize;
|
||||
}
|
||||
for (maxTextureLevels = 1; maxTextureLevels <= 11; ++maxTextureLevels) {
|
||||
GLuint size = 1 << maxTextureLevels;
|
||||
size *= size * 4; /* 4 bytes per texel */
|
||||
size *= 2; /* all mipmap levels together take roughly twice the size of
|
||||
the biggest level */
|
||||
if (size > maxTextureSize)
|
||||
break;
|
||||
}
|
||||
ctx->Const.MaxTextureLevels = maxTextureLevels-1;
|
||||
assert (ctx->Const.MaxTextureLevels >= 6); /*spec requires at least 64x64*/
|
||||
|
||||
#if 0
|
||||
ctx->Const.MinLineWidth = 1.0;
|
||||
ctx->Const.MinLineWidthAA = 1.0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue