Keith Whitwell wrote:
> Jos� Fonseca wrote:
>
>> While I was debugging a new vertex buffer template for Mach64 I've
>> discovered that this piece of code doesn't work:
>>
>> INTERP_F( t, (*dst++).f, (*out++).f * qout, (*in++).f * qin );
>> INTERP_F( t, (*dst++).f, (*out++).f * qout, (*in++).f * qin );
>>
>> The problem is that INTERP_F is defined in src/mmath.h as:
>>
>> #define INTERP_F( t, dstf, outf, inf ) \
>> dstf = LINTERP( t, outf, inf )
>>
>> while in turn LINTERP is defined as
>> #define LINTERP(T, OUT, IN) \
>> ((OUT) + (T) * ((IN) - (OUT)))
>>
>> so the OUT argument is being used twice and the pointer incremented
>> twice as well.
>>
>> I think this is a bug in Mesa. First because a macro should generally
>> behave as an
>> ordinary function, unless there is a very special reason not to do so.
I suggest two things:
1. Put a comment where INTERP_F is defined, noting that some parameters
are evaluated twice. I'll do this.
2. Change this:
INTERP_F( t, (*dst++).f, (*out++).f * qout, (*in++).f * qin );
into:
INTERP_F( t, (*dst).f, (*out).f * qout, (*in).f * qin );
dst++;
out++;
in++;
Don't leave this sort of thing to chance. This is the kind of thing
that a person could waste many hours debugging.
-Brian
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Dri-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dri-devel