View Single Post
Old 30 November 2015, 00:43   #100
Codetapper
2 contact me: email only!

Codetapper's Avatar
 
Join Date: May 2001
Location: Auckland / New Zealand
Posts: 3,135
Quote:
Originally Posted by Mrs Beanbag View Post
"Horrendous", as in, it could easily take more time than the blit itself, but the efficiency of every individual bob is really not important. Only the frame rate is important. The golden rule is "make the common case fast". If the majority of your drawing can be sped up by ~30%, it's worth taking a hit on the edge cases.
Apart from a few games like Rick Dangerous that use 24 pixel wide bobs (so the graphics are standard across all platforms), I would say you'd hardly find any games that don't have the majority of their graphics very close to a 16 pixel wide boundary. I don't believe this 30% speedup at all, you'd be lucky to save 10% total and you probably lose that when you add up all the extra checks you have to do on every object to detect them, thus wiping out any saving.

Quote:
I haven't actually tried it yet, but i don't know what makes you say that. I think it would be hardly any extra complexity at all. The reason i didn't do it is because i'm using AMOS to grab the sprites, and the AMOS image bank format only specifies the width of a bob in words.
For a 16 pixel wide object, you have 1 case where you adjust the mask to be $ffff, and can draw the object with 1 word if it's being plotted with 0 pixel indentation to a word boundary.
For a 15 pixel wide object, you have 2 cases where you adjust the mask to be $fffe, and can draw the object with 1 word if it's being plotted with 0-1 pixel indentation to a word boundary.
For a 14 pixel wide object, you have 3 cases where you adjust the mask to be $fffc, and can draw the object with 1 word if it's being plotted with 0-2 pixel indentation to a word boundary.
etc...

For the "majority" case you don't need to store the exact pixel width (knowing the number of words wide to blit is enough), no need to recalculate/lookup/adjust/set the masks, you don't need to calculate if it's going to need one word less to blit, don't need to adjust those modulos when the edge case is found, can use the blit-one-extra-word-with-last-word-mask-set-to-$0000 trick for shifting etc. Not to mention your restoring-from-tiles idea, adding that onto a complicated blitter routine when the screen could be using a copper-split to begin with seems inefficient. If you go ahead and disassemble some games you will see that most have quite a compact blitter drawing routine. They do not tend to have loads of extra cases to speed up blitting in the rare event that it happens. If it was worthwhile, I would imagine most of the big name games would have extremely complicated blitter routines, but the simple fact is that they don't. Check out the Lotus series for a great example of how simple the blitter routines are.
Codetapper is offline  
 
Page generated in 0.08617 seconds with 9 queries