On 2002.03.06 13:17 Keith Whitwell wrote: > José Fonseca wrote: > > > > ... > > > > In the end I come up to the conclusion that this is neither one is the > way > > to do it: > > > > - Premultipling in the _emit function is not enough because clipping is > > made after. Even if we premultiply the interpolation result during > > clipping this doesn't give the correct results since we are > interpolating > > with the w values in there. To give the right results we would have to > > divide by w, make the interpolation, and multiply again... which > obviously > > is not efficient. > > This is what the tdfx driver does. (see tdfx_vbtmp.h...) I think it's > the > lesser of two evils. >
You'll probably right. Generally there are more unclipped vertexes than clipped, and the extra multiplications required aren't that many comparing to those required to do the interpolation of a pair of vertexes. I noticed in tdfx_vbtmp.h that the division is avoided in favor of the multiplication. What's the ratio verified between the time taken to make a division and a multiplication? > > - Doing this on the primitive drawing functions also leads to > unnecessary > > work duplication as for each reused vertex we make the same exact > > calculation. > > And it makes it hard to do the '_render.c' optimizations. (Although they > probably won't apply to mach64 anyway) > Why do you say that? I looked to some _render.c files but I couldn't understand what kind of optimizations are usually made in there. > > One way would be make a premultiplication pass between the vertex > buffer > > emition/clipping and the primitive drawing. > > The temporary clipped vertices don't hang around for long. This won't > work > unless you change that. > hmm.. didn't knew that. Why are they temporary? > > Nevertheless, care must be > > taken with the hybrid callbacks (mach64_callback_point/line/tri), since > > they wouldn't expect the vertexes with the tex coords premultiplied. I > > think that since the software callbacks would be so slow compared with > the > > hw ones, the best would be simply undo the multiplication before > feeding > > the vertexes to these functions, which would be barely noticed. > > > > Any ideas? > > I think the best approach is the one in tdfx_vbtmp.h -- multiply in > emit(), do > extra work in interpolate(). > > Keith > I'm starting to agree with you too. This way we guarantee the most direct path to the most frequent case (non-clipped hardware accellerated primitives) while avoiding the complications of the other solutions. José Fonseca _______________________________________________ Dri-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dri-devel