-
Matt Turner authored
The unpack builtins are implemented using floating-point division, which is implemented by reciprocal+multiply. As it so happens, 1.0/255.0 falls almost exactly between two representable 32-bit floats and leads to bad rounding. None of the other divisors (127, 32767, 65535) have this property. Paul was uncomfortable with allowing inexact results in only unpackUnorm4x8, so allow the results of the builtins (except unpackHalf2x16) to be within some small epsilon (0.00001) of the actual value. Some values like 0.0 and 1.0 should be calculated exactly, so handle them specially.
78435fef