d3dx9: CloneMesh test and improvements

Michael Mc Donnell michael at mcdonnell.dk
Thu Aug 11 09:07:24 CDT 2011


On Thu, Aug 11, 2011 at 3:01 PM, Matteo Bruni <matteo.mystral at gmail.com> wrote:
> 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
> say).

Ok I'll look into that. I also noticed that I had a bug in the UBYTE4
conversion. I'll modify the tests to catch those cases.

> 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.

That's a good idea. I had started doing the other conversions, but
noticed that it was a lot of code. I'll try your idea.

Thanks!



More information about the wine-devel mailing list