1
votes

I've been thinking this a lot, does it make rendering slower if i switch huge textures, instead of switching many slightly smaller textures with glBindTexture() ? I've had the idea in my mind that the GPU copies the texture data to faster memory place every time glBindTexture() is used, so i thought that big textures would take longer to copy too.

But, I remember using many small textures for creating animation before, and it was horribly slow on some gfx card, but when i put the animation frames on a single texture, the performance went sky high. Still, i had no performance problems on some other gfx card in both cases.

That said, should i always use the biggest possible texture surface size? (if i dont waste much empty texture space there ofc.)

1

1 Answers

6
votes

Switching textures is expensive. The usual bottleneck is cache pressure, but occasionally also textures get swapped out from GPU memory.

However as long as the textures in question are resident, i.e. located on fast GPU memory, chaning the texture binding is O(1), i.e. independent of texture size. So one should always use the largest possible texture possible. The keywords is texture atlases, and those are usually a method for improving performance.