PDA

View Full Version : Clarification on mipmaps



debonair
11-13-2015, 01:28 PM
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.

GClements
11-13-2015, 01:49 PM
What happens if I create mipmap levels but don't use mipmap filter? Does it always sample from base mipmap level?
Yes.


Do I still get performance gain of mipmap?
No. The performance gain comes from improved locality and reduced texture bandwidth when sampling lower-resolution levels.


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?
The latter.

Note that if you use mipmaps, the implementation often samples multiple levels for a single primitive. If you're using either of the *_MIPMAP_LINEAR filters, it will typically be sampling from two levels for each fragment. And regardless of whether you're using *_MIPMAP_LINEAR or *_MIPMAP_NEAREST, the choice of level(s) is made per fragment, not for the primitive as a whole (otherwise you'd get visible seams between primitives).

debonair
11-13-2015, 02:22 PM
Yes.


No. The performance gain comes from improved locality and reduced texture bandwidth when sampling lower-resolution levels.


The latter.

Note that if you use mipmaps, the implementation often samples multiple levels for a single primitive. If you're using either of the *_MIPMAP_LINEAR filters, it will typically be sampling from two levels for each fragment. And regardless of whether you're using *_MIPMAP_LINEAR or *_MIPMAP_NEAREST, the choice of level(s) is made per fragment, not for the primitive as a whole (otherwise you'd get visible seams between primitives).

Thanks for clarification!