This is functionally identical to
GL_MESA_pack_invert, but for GLES. Neat.
On the way to doing this I noticed that
GL_MESA_pack_invert can probably be enabled unconditionally now, so I went ahead and did that first. I don't have an r100 or a vieux card handy to test with (the only drivers where it wasn't already enabled), but from code inspection it looks like this should just work.