xycaleth / OpenJK

Community effort to maintain and improve Jedi Academy + Jedi Outcast released by Raven Software
GNU General Public License v2.0
16 stars 3 forks source link

AZDO: Array textures / sparse textures (for HW that supports it) #45

Open xycaleth opened 8 years ago

xycaleth commented 8 years ago

To reduce driver overhead, we can eliminate texture binding calls. All textures are uploaded into slices of an array texture. Each array texture will essentially be a bucket for {texture format, size, samples}. Each GLSL shader will contain an array of array textures, e.g.: uniform sampler2DArray u_DiffuseTextures[30]; and the texture to use can be identified by passing uniform integers to dynamically select the texture.

For HW that supports it, this can be taken even further by using either sparse textures, where all texture virtual memory is preallocated ahead of time, and then backed with physical memory as/when necessary.

Bindless textures are also an option where the texture handles are passed directly to the shader through a uniform, rather than binding each individual texture.