2

For texture sizes greater than GL_MAX_ARRAY_TEXTURE_LAYERS, I have to use an array of single textures instead of one texture array. No problem for me. I'm just wondering whats the reason behind making GL_MAX_ARRAY_TEXTURE_LAYERS so much smaller than GL_MAX_TEXTURE_SIZE?

edit: this can be deleted

Meldryt
  • 99
  • 1
  • 9
  • 1
    I'm not sure if I understand you correctly, but GL_MAX_ARRAY_TEXTURE_LAYERS basically describes how many 2D texture you can have, while GL_MAX_TEXTURE_SIZE describes how large each of the 2D texture can be. It doesn't really make sense to compare them against each other. – BDL Sep 22 '20 at 15:24
  • 1
    Regarding *For texture sizes greather than GL_MAX_ARRAY_TEXTURE_LAYERS i have to use an array of single textures*: Given that GL_MAX_ARRAY_TEXTURE_LAYERS >= 256 in OpenGL 4, I highly doubt that you can even bind 256 single textures at the same time (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS >= 48). – BDL Sep 22 '20 at 15:27
  • @BDL: "*Given that GL_MAX_ARRAY_TEXTURE_LAYERS >= 256 in OpenGL 4*" It's 2048 in GL 4.6. And combined image units is 80. – Nicol Bolas Sep 22 '20 at 16:01
  • Thanks for reply. i mis understood the two GL params. there are no different size limitations between single texture2D and texture2DArray – Meldryt Sep 22 '20 at 16:46

1 Answers1

4

For texture sizes greater than GL_MAX_ARRAY_TEXTURE_LAYERS

I believe you have mis-understood what this limitation means. This is not like GL_MAX_3D_TEXTURE_SIZE, which is a limitation on all axes of a 3D texture. It is a limitation on the number of array elements in a 2D array texture. When you call glTexImage3D/TexStorage3D, the limitation applies to the depth parameter only, not the "size".

The width/height limit is still governed by GL_MAX_TEXTURE_SIZE.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
  • you are right. i mis understood the two GL params. there are no different size limitations between single texture2D and texture2DArray – Meldryt Sep 22 '20 at 16:46
  • does this mean if the max texture size limit is 2048x2048, and if the `GL_MAX_ARRAY_TEXTURE_LAYERS ` is 2048, you can have a 2048x2048 texture , and 2048 of them, 2048 textures with 2048x2048 size? – May Jul 18 '21 at 13:32
  • @MaYue: So long as it has sufficient memory for such a texture, yes. – Nicol Bolas Jul 18 '21 at 13:57