Optimize stencil uploading

This tries to avoid it in the normal case (e.g. when the memory is all zeroes.)  It also scans to determine which bits are set, so as to avoid the expensive fills (some areas, not many, in Star Ocean have not all the bits set, for example.)

Also, it's quite clear that 1x is way faster than 2x (possibly because of the fragment shader, the mask, the discard, or all of the above.)  Where glBlitFramebuffer is available, this makes it upload the stencil at 1x and then blit the stencil across.  This takes Star Ocean (while panning) from 600% to 1000% at 5x on my desktop.  It may also help Tegra and GLES3 devices, but performance there is untested.

-[Unknown]