Fragment shader - determine min/max values for the entire (monochrome) image and use them for further pixel manipulations
<p>I'd like to normalize <strong>monochrome</strong> image pixels in that way the minimum value is black, the maximum is white and values in between are spread proportionally.
Currently I do it in canvas in two steps, but I believe it should be faster in WebGL.</p>

<p>I can imagine manipulating colors via fragment shader, but I couldn't find any efficient way for (1) determining the actual range of the image, nor (2) approach for passing this info to another fragment shader, which could then perform that grey level normalization.</p>