How do you get the size of an image unit (eg. image2D) in GLSL just like textureSize

3.1k Views Asked by At

textureSize is a handy function to get texture dimensions in a shader without having to pass them in by hand as uniforms.

Is there a similar API for image units?

1

There are 1 best solutions below

0
On

Yes, it's in OpenGL 4.3:

Example:

layout(rgba32f) uniform image2D myImage;
...
ivec2 size = imageSize(myImage);