Possseidon / dang-lib

A C++ library, providing a variety of useful classes focused around game developement.
3 stars 1 forks source link

Allow for custom max_3d_texture_size_ in TextureAtlas to allow enforcing of smaller layers. #37

Closed Possseidon closed 3 years ago

Possseidon commented 3 years ago

Some graphics cards might have a very big max size for 3D textures. If this is the case and a lot of textures are added to reach this maximum, this is at first not a problem.

The problem comes, when additionally a lot of other textures that all need their own layer get added. Each of these layers must be as big as this other huge layer (since that is how array textures work). Limiting this size up front, causing the many initial, same-sized textures to be split up over multiple layers can greatly reduce this cost.

The maximum size of 3D textures seems to generally be a lot smaller than 2D textures though (2048x2048 for me, which is also the minimum that the OpenGL 4.3 spec enforces; for 2D textures 16384x16384), but there might be some graphics card out there, that has a very big max-size but not enough memory to handle a lot of layers.