What is the cache page size? The reason I ask is that someone said it was 32 bytes (i.e. when you read from 0x1234, 0x1220 to 0x123f are cached) so I decided to test this out.
I am blitting 32x32 tiles to a back buffer:
It takes about 0.10 ms to blit one tile (memory to memory).
But then I tried fliping the tile diagonally
pd+=2; ps+=64; etc...
i.e. reading from Tile+0 then Tile+64 etc - you get the idea. Should have taken a massive performance hit, but it took none: still 0.10 ms and I've tested this in full flow (tiles diagonally flipped fine) with no performance hit at all. It works...
So what's going on, how big is the page size? I wasn't expecting this?
(This will make a big difference to me, because I'll store the back buffer in the same orientation as the screen if I can rotate tiles without a performance hit. Even though it's hassle to handle all the different orientations...!)
I am blitting 32x32 tiles to a back buffer:
- Code:
static void OneTile(unsigned int x,unsigned int y,unsigned int t)
{
unsigned char *ps=NULL,*pd=NULL;
unsigned char *WholeEnd=NULL;
ps=Gdata+(t<<11);
pd=DrawBuf+(x<<1)+(y<<9);
WholeEnd=ps+2048;
do
{
unsigned char *End=ps+64;
do
{
*(unsigned short *)pd=*(unsigned short *)ps;
pd+=2; ps+=2;
}
while (ps<End);
pd+=512-64;
}
while (ps<WholeEnd);
}
It takes about 0.10 ms to blit one tile (memory to memory).
But then I tried fliping the tile diagonally
pd+=2; ps+=64; etc...
i.e. reading from Tile+0 then Tile+64 etc - you get the idea. Should have taken a massive performance hit, but it took none: still 0.10 ms and I've tested this in full flow (tiles diagonally flipped fine) with no performance hit at all. It works...
So what's going on, how big is the page size? I wasn't expecting this?
(This will make a big difference to me, because I'll store the back buffer in the same orientation as the screen if I can rotate tiles without a performance hit. Even though it's hassle to handle all the different orientations...!)