When Vtuning my app I noticed a spike in CPU time in the
routine responsible for calculating the color values for
clipped triangles. This was caused by the float to int
conversions.
I did the following change (output from WinCVS diff) to
clip.c
39a40
> #include "mmath.h"
64a66,73
>
> #define INTERP_SZ_4I( t, vec, to, a, b) \
> do { \
> vec[to][3] = FloatToInt(LINTERP( t, vec[a][3], vec[b][3] )); \
> vec[to][2] = FloatToInt(LINTERP( t, vec[a][2], vec[b][2] )); \
> vec[to][1] = FloatToInt(LINTERP( t, vec[a][1], vec[b][1] )); \
> vec[to][0] = FloatToInt(LINTERP( t, vec[a][0], vec[b][0] )); \
> } while(0)
128c137
< INTERP_SZ( t, VB->ColorPtr->data, dst, in, out, 4 );
---
> INTERP_SZ_4I( t, VB->ColorPtr->data, dst, in, out);
158c167
< INTERP_SZ( t, VB->ColorPtr->data, dst, in, out, 4 );
---
> INTERP_SZ_4I( t, VB->ColorPtr->data, dst, in, out);
This has worked for me (on Win95, VC++ 5.0), but I am not
certain about the FAST_MATH etc issues on other compiles.
My own reasoning is that changing the conversion from
truncation to rounding might actually produce "better"
results.
Eero
_______________________________________________
Mesa-dev maillist - [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-dev