On 21 May 2017 at 18:23, Dmitry Timoshkov dmitry@baikal.ru wrote:
Henri Verbeet hverbeet@codeweavers.com wrote:
+static void d2d_point_lerp(D2D1_POINT_2F *out,
const D2D1_POINT_2F *a, const D2D1_POINT_2F *b, float t)
+{
- out->x = a->x * (1.0f - t) + b->x * t;
- out->y = a->y * (1.0f - t) + b->y * t;
+}
According to my investigation of a better bilinear blending (lerp) implementation the above formula is better to explicitely simplify to
out->x = a->x + (b->x - a->x) * t; out->y = a->y + (b->y - a->y) * t;
For performance, quite possibly. This isn't particularly performance sensitive code though, and I'd be surprised if that variant had better accuracy.
or even better to avoid floating point operations at all by replacing them either by fixed point math or a mmx/sse helper, which is able to considerably (x10) improve performance.
Yes, for performance sensitive code we'd want to use SSE intrinsics. There are places in d3dx9 where that would certainly be worthwhile.