I’m trying to use bitfieldInsert() and bitfieldExtract() to pack/unpack binary flags into a color component in my G-Buffer. Although the second modification of the bitfield doesn’t seem to have any affect on the data. I’ve tried hard coding the input values multiple ways, but the color value only changes with respect to the first input.
What is the format of the colour buffer? If it’s unsigned normalised, then assigning a value outside of the range [0,1] will result in the value being clamped to that range.
The buffer format is GL_RGB10_A2. I thought about that too. I tried to use uintBitsToFloat() function, in case I needed it to match the rest of the vector components as floats. But that removed both the flags entirely.