Fixes #543.

Only the last layer was being used to determine whether the fragment
shader should apply gamma correction, hue adjustment, etc.  In reality, if
any layer needs it, the fragment shader must do it.