Advertisement

OpenGL Managment of textures in VRAM

Started by February 03, 2025 04:48 PM
2 comments, last by Ed Welch 3 weeks ago

Supposing you have a huge amount of textures to send to the GPU, but you only use some them rarely. What's the best strategy?

a) Load everything at game start up and let OpenGL just manage the memory itself

b) Handle the assignment discretely. Load each texture when needed, and remove textures from memory that haven't been used for a long time

(a) is certainly NEVER a good idea. The specification requires an ‘out of memory’ error for APIs that allocate memory, so given a ‘pure’ implementation, this would never work as the driver would only be able to allocate memory up to the limit. The driver may be merciful and utilize the OS virtual memory subsystem to provide backing for memory over-allocation. This will involve disk-page which will most certainly kill performance, so yet another reason not to even consider this approach.

(b) Is the only logical and safe choice imo, and it the approach most widely used from experience. Its a more involved solution, but worth its weight in goal, especially on memory limited platforms.

Advertisement

Got it. Thanks for the answer 😉

Advertisement