View Single Post
Old 14 August 2018, 15:06   #45
Registered User

Join Date: Dec 2014
Location: germany
Posts: 116
@roondar: Nice find with Alpha Waves, thanks.

I'd also say that C just does not give you enough control for optimizing the time critical inner loops. If portability is not important for you, I'd do at least the most critical stuff (3d math, line drawing, filling) in asm.

Regarding filling: I honestly do not think the blitter is very helpful here. It has a theoretical speed advantage, because it has twice the raw memory transfer speed compared to the CPU, but this is hard to realize:
  • In fillmode, the blitter needs to read a word for every word written, plus there is an idle cycle (which can be used by the cpu), so 6 clock cycles and 2 memory cycles per word. A movem is 4 cycles per word, and one memory cycle. A movem is 32 bit per register, so 10 registers are sufficient to fill a 320 pix wide span in one bitplane. You can pre-generate again code for every span length and position (modulo 16).
  • Blitter fill is not well suited for overlapping polygons - you'd need to draw them in an extra buffer, then do a fill, then a two-source copy, then erase the buffer. A cpu filler has to care for the background only in the first and last word, and can just overwrite the rest of the words.
  • Blitter fill works on rectangular areas, so if your poly fills only a rather small part of the rectangle, a lot of memory accesses is just wasted. You can subdivide of course, but this increases complexity.
  • Blitter fill will not take much advantage of faster cpus and fastmem.
  • Setup time: It might be easier just to draw lines and fill with the blitter than calculating span length for every polygon row and calling the fill code, but blitter needs either cpu polling, interrupts or copper lists to control the blits.
I'd say apart from some simple things like clearing it is not really worth the hassle to use the blitter in a general 3D routine with overlapping polys. Situation is different if you only have one simple convex object like your sphere without background, but that's probably no what you are aiming for.
If you have some memory cycles left, e.g. when you're using cpu multiplication or in the border, using it may give a nice litte speed up.
Anecdotal evidence, Need for Speed No Second Prize :-D, one of the fastest 3D vector games on the amiga, with rather large screen and large polygons, does not use the blitter at all.

Last edited by chb; 14 August 2018 at 16:03. Reason: got the name wrong :)
chb is offline  
Page generated in 0.04048 seconds with 11 queries