d3dx9: Implement D3DXFloat32To16Array and D3DXFloat16To32Array. (try 2)
misha680 at gmail.com
Mon Feb 21 13:19:21 CST 2011
2011/2/20 Rico Schüller <kgbricola at web.de>:
> I have a small hint to the D3DXFloat32To16Array function. It seems that some
> values are handled in some other way.
> A small test:
> D3DXFLOAT16 res;
> union p
> float f;
> DWORD d;
> } x;
> x.d = 0x33000800;
> D3DXFloat32To16Array(&res, &x.f, 1);
> ok(res.value == 1, "Failed %f %x\n", x.f, res.value);
> This fails with the current implementation. It's not the only value, there
> are a couple of them which are of by one. This could be easily seen by
> loading both d3dx36.dll (wine and native) and comparing the values directly.
Still trying to investigate this further.
Perhaps, if you have any more hints as to how you arrived at this
magical value, much appreciated.
Namely, at first my hunch was that this value (2.9806e-08 with the
following bitwise representation):
0 01100110 00000000000010000000000
was simply being truncated to the smallest denormalized value
representable by a half precision float:
0 000.00 00.0000.0001 6×10-8 (Smallest denormalized value)
but this is clearly not true for other values that are too small (they
are returned as 0.0f).
More information about the wine-devel