On Mar 11, 09 09:22:17 -0700, Yang Zhao wrote:
I think what we want is shifted two's complement, since the expected range is [-8, 8), which, with just 1 bit to the right of decimal point, gives [-8.0, 7.5] in 0.5 increments.
So,
#define OFFSET_X(x) ((int)((x) * 2) & 0x1f) /* S3.1 fixed point, two's complement*/
The small test code I wrote seems to be behaving sanely for the values that are exactly representable, and rounding towards 0 for those that aren't.
I'll verify that this behaves as expected on the shader hardware sometime later today.
Yes, please, because in that case the description S3.1 would IMHO be
wrong. Because it means 1 sign bit, and 3.1 value bits.
CU
Matthias
--
Matthias Hopf