Skip to content

st/mesa: Allocate full miplevels if MaxLevel is explicitly set

Kenneth Graunke requested to merge kwg/mesa:civ-mipmap into master

Some applications explicitly call glTex[ture]Parameteri[v] to set GL_TEXTURE_MAX_LEVEL and GL_TEXTURE_BASE_LEVEL before uploading any texture data. Core Mesa initializes MaxLevel to 1000, so if it isn't that, we know they've set it. (We check for < TEXTURE_MAX_LEVELS to avoid hardcoding that value, however.)

If MaxLevel - BaseLevel > 0, then the app is trying to tell us that this texture is going to have multiple miplevels. In that case, go ahead and allocate the space for it.

Avoids piles of resource_copy_region at texture finalization time in the Civilization VI benchmark.

TODO: quantify any performance improvement

Merge request reports