Can I pack 4 grayscale textures into one channel by converting the textures into uints and packing them?
uint b1 = (t1.r * 255 & mask1) << 0; uint b2 = (t2.r * 255 & mask2) << 8; uint b3 = (t3.r * 255 & mask3) << 16; uint b4 = (t4.r * 255 & mask4) << 24; t.r = b1 | b2 | b3 | b4;
"mask#" is a uint with 1s for #th byte and 0s for all other bytes. "t#" is a grayscale texture. "t" is the texture we are packing into.
My main concern is that t.r is a float, and I'm not allowed to access the bits.