Hardware texture support without powering two textures

I heard conflicting opinions about whether it is safe to use without using two textures in OpenGL applications. Some say that all modern hardware supports NPOT textures perfectly, others say that it is not, or there is great success.

The reason I'm asking is because I want to do something in a frame buffer the size of a screen (which might not be powerful of the two) and use it as a texture. I want to understand what will happen to performance and portability in this case.

+7
source share
4 answers

Custom texture sizes have been defined as the bulk of OpenGL since OpenGL-2, which was a long time ago (2004). All GPUs developed each time do support NP2 textures. The only question is how good the performance is.

However, since GPUs got programming, any optimization based on predictable fixed function text access patterns has become outdated, and GPUs now have caches optimized for general data localization, and performance is not a problem either. In fact, with P2 textures, you may need to scale the data to fit the format, which increases the required memory bandwidth. However, memory bandwidth is the # 1 bottleneck of modern GPUs. Thus, using a slightly smaller texture NP2 can actually improve performance.

In short: you can use NP2 textures safely, and performance is also not a big issue.

+9
source

All modern APIs (with the exception of some versions of OpenGL ES, I think) on modern graphics hardware (the last 10 or so generations from ATi / AMD / nVidia and the last pair from Intel) support NP2 texture just fine. They have been used, especially for subsequent processing, for quite some time.

However, not to say that they are as comfortable as power-of-2 textures. One of the main cases is memory packing; drivers can often pack textures into memory much better if they have two powers. If you look at the texture with mipmaps, the base and all mips can be packed in an area of ​​150% of the original width and 100% of the original height. It is also possible that certain sizes of textures will build memory pages in increments (the size of the texture string in bytes), which will provide an optimal situation with access to memory. NP2 makes this optimization more difficult, and therefore memory usage and addressing may be less efficient. Regardless of whether you notice, any effect is very dependent on drivers and applications.

Off-screen effects are perhaps the most common medium for NP2 textures, especially screen-sized textures. Almost every game on the market that performs any post-processing or delayed visualization has 1-15 outpost buffers, many of which are the same size as the screen (for some effects, half or quarter size is useful). They are usually well supported even with mipmaps.

Since NP2 textures are widely supported and an almost sure bet on desktop computers and consoles, their use should work fine. If you are worried about platforms or equipment where they might not be supported, lightweight backups include using the closest power-2 size (which may result in slightly lower quality, but they will work) or completely discarding the effect (with obvious marks).

+3
source

I have a lot of experience creating games (+4 years) and using texture atlases for iOS and Android, although cross-platform development using OpenGL 2.0

Stick to PoT textures with a maximum size of 2048x2048, because some devices (especially cheap with cheap equipment) still do not support dynamic texture sizes, I know this from real testers and see it first hand. There are so many devices now, you never know which GPU you will come across.

You iOS devices will also show black squares and artifacts if you are not using PoT textures.

Just a hint.

+2
source

Even if an arbitrary texture size is required by OpenGL X, some graphics cards are still not fully compatible with OpenGL. I had a friend with an IntelCard having problems with NPOT2 textures (I assume that Intel cards are now fully compatible).

Do you have a reason to use NPOT2 textures? how to do it, but remember that maybe some old hardware does not support them, and you probably need to back up software that can make your POT2 textures.

You have no reason to use NPOT2 textures? then just use POT2 Textures. (some compressed formats still require POT2 textures)

0
source

All Articles