d3dx9: CloneMesh test and improvements

Matteo Bruni matteo.mystral at gmail.com
Thu Aug 11 08:01:50 CDT 2011

2011/8/11 Michael Mc Donnell <michael at mcdonnell.dk>:
> +            dst_ptr[0] = src->x < 0.0f ? (SHORT)ceilf(src->x * SHRT_MAX + 0.5f) :(SHORT)floorf(src->x * SHRT_MAX + 0.5f);

You can use roundf() instead. Actually, notice that maybe what you
actually need for correct rounding is rintf() (which essentially
matches what D3DXFloat32To16Array does). You should probably test this
(even on your own, not necessarily adding those to the testsuite, I'd

Still on the conversion: going on with this "strategy" is going to
require a ton of code to handle every src->dst format combination. You
may look into doing that in two steps: first converting src to float4,
then float4 into dst. I haven't looked into it, so there may be some
detail making this impractical, but still it's worth a try, I guess.

More information about the wine-devel mailing list