Why would I specify image format in a shader layout qualifier? 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?

i.e. layout (binding = 0, r32f) readonly uniform image2D input_image

Wouldn't this shader work just as well if I did not specify the r32f?
From the same wiki


  Image variables can be declared with a format qualifier; this
  specifies the format for any read operations done on the image.
  Therefore, a format qualifier is required if you do not declare the
  variable with the writeonly memory qualifier. Write-only variables
  cannot be used as in any reading operations; this includes calling
  load and atomic (read/modify/write) functions. So if you want to read
  from an image, you must declare the format.
  
  The format defines how the shader interprets the bits of data that it
  reads from the image. It also defines how it converts the data passed
  for write operations when it writes it into the image. This allows the
  actual Image Format of the image to differ between what the shader
  sees and what is stored in the image, sometimes substantially.