openglglsltexturescompute-shaderglteximage2d

TextureArray with image2D/Computeshader


I am currently trying to bind multiple Textures to a Computeshader. Because there is only a small limited amount of image unites available, I thought of binding a TextureArray with the advantage of doing less bindings with more Textures. As far as I know TextureArrays can only be typed by Sampler with sampler2DArrays. I however am useing images so i can use imageLoad()/imageStore(). Is there a workaround to use TextureArrays with image2D or am I forced to use other methodes like Texture Atlases?


Solution

  • There is a specialised image type for 2d array textures: gimage2DArray. imageLoad and imageStore have overloads that allow to access array images with a 3-dimensional index where the third dimension specifies the array level.

    Source