I store terrain texture data in RGBA textures that define the alpha level of each layer, packing one texture layer into each channel. I’ve implemented a virtual texturing system that allows me any number of texture layers at good speed. With so many texture layers possible, the bottleneck becomes the memory usage of these alpha textures. If the terrain is 2048x2048 points, every four texture layers consumes 16 mb video memory.
If I could perform bitwise operations in GLSL and just store a boolean for each texture layer, I could pack 32 texture layers into a single RGBA texture, greatly reducing the memory requirements of large terrains with many layers.