mono/MonoGame — pull request #1254 by Aranda (2013-01-29 04:57:33+00:00)
Title: Ignore mip maps for non power of two textures when device doesn't support them

...t them

Added a GraphicsCapabilities class to test for non-power of two texture support. In the future this can be extended to test for other things.

This feature is important because when you supply non PoT mip maps and the device doesn't support them, you will GL errors. Also, on Android some devices support them and others don't, meaning you may test your game and have it work fine but once released it will crash on other devices.

The support for mip maps with non-PoT textures is patchy, but more and more devices have support so it'd be a shame to disable it outright.

So far I've tested on an iPad 1, Windows 7, Android 4.0 Samsung GalaxyS2, and a MacBook (not pro).

The only part I'm not confident about is the handling of OPENGL non-GLES platforms (ie desktop PC, Mac and Linux). I took the advice given here: http://aras-p.info/blog/2012/10/17/non-power-of-two-textures/ (OpenGL section), which suggests a more reliable way of deciding on PoT support is whether the card supports 8192 sized textures. This is pretty safe. The only risk is that certain older devices that don't support 8192 textures but do fully support non-PoT textures will have their non-PoT mip maps discarded. Not likely to be a problem IMO as non PoT textures are mostly for UI elements and not likely to have mip maps anyway.