HLSL: Pack 4 values into 32 bit float.
- by TheBigO
I can't find any useful information on packing 4 values into a 32 bit float in HLSL.
Ideally, what I want to be able to do in HLSL is:
float4 values = ... // Some values where each component is between 0 and 1.
float packedValues = pack32R(values);
float4 values2 = unpack32R(packedValues);
I realize that there will be precision limitations, and performance tradeoffs between different precisions in different methods. I'm just wondering what ideas are out there.