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?
Yes, it's in OpenGL 4.3:
imageSize() docsimageSize() wikiARB_shader_image_size specsExample:
layout(rgba32f) uniform image2D myImage;
...
ivec2 size = imageSize(myImage);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With