The OpenGL wiki entry for layout qualifiers says:
Image uniform variables have qualifiers that define the format that all reading operations will convert the data into...
When is it a good idea to declare the image format in a shader?
layout (binding = 0, r32f) readonly uniform image2D input_image
Wouldn't this shader work just as well if I did not specify the