Reputation: 2593
What happens if I create mipmap levels but don't use mipmap filter? Does it always sample from base mipmap level? Do I still get performance gain of mipmap? So, when we create mipmaps, does driver only loads required mipmap level into texture memory and sample from that or it loads all the levels and samples from the required one? Details in the implementation would be helpful.
Upvotes: 0
Views: 389
Reputation: 54642
If you don't use one of the filter values that include mipmaps (like GL_LINEAR_MIPMAP_LINEAR
), your mipmaps will not be used in any way. The behavior is like you never created them. Only the base level will be used, and you get no performance gain.
There are ways of using mipmaps without a mipmap filter. By setting GL_TEXTURE_BASE_LEVEL
and GL_TEXTURE_MAX_LEVEL
, you can force a given mipmap level to be used.
Now, what exactly happens if you generate mipmaps and never use them, that's entirely implementation dependent. Since most applications that generate mipmaps will use them, there could well be a performance cost.
If a vendor found that this was happening in an important application/benchmark, it could easily be optimized to not load the unused mipmaps, or even to defer the mipmap generation until first use (which could be never). In reality, a lot of optimizations are implemented to make poorly written applications/benchmarks run as efficiently as possible, as long as they are considered important.
Upvotes: 1