by InexorableTash » Feb 19, 2005 @ 5:30am
Note that storing frames in one large surface can negatively impact performance. Modern processors (like ARM) cache data in blocks - if you read byte 5, bytes 0 ... 255 are probably cached as well.
If you think about this, it means that when you're drawing one frame from a horizontal strip you're probably using only a fraction of each cached block per row of the surface. I.e. if you were using the frame made up of 'x' pixels in this strip:
ooooooooxxxxxxxxoooooooooooooooooooooooooooooooo
ooooooooxxxxxxxxoooooooooooooooooooooooooooooooo
ooooooooxxxxxxxxoooooooooooooooooooooooooooooooo
ooooooooxxxxxxxxoooooooooooooooooooooooooooooooo
... then odds are all of the 'o' pixels will get cached as well. So you might have to hit memory 4 times (once per row) rather than just once if you had a single frame with 'x' in it.
If you stack the frames vertically, on the other hand, you'll will have cache coherency of the data. (I'm kinda sleepy, but I think this holds true even when GapiDraw loads and rotates the images, but someone should confirm.)
You might want to write a routine that slices up your frames into different surfaces on load.