Redraw the viewer only once when 2 inputs are drawn at the same time.
Also moved the redraw() call after the call to updateViewer() so the
GPU part would run concurrently in the main-thread while the render
thread can continue to the next frame.
Also fixed a bug where the histogram would be updated twice per frame
rendered.