Exploit cache locality for slightly faster drawing
Jeffrey Pfau jeffrey@endrift.com
Sat, 03 Aug 2013 01:15:08 -0700
2 files changed,
3 insertions(+),
3 deletions(-)
M
src/gba/renderers/video-software.c
→
src/gba/renderers/video-software.c
@@ -378,11 +378,10 @@ } else {
backdrop |= softwareRenderer->variantPalette[0]; } for (int x = 0; x < VIDEO_HORIZONTAL_PIXELS; ++x) { - row[x] = backdrop; + softwareRenderer->row[x] = backdrop; } } - softwareRenderer->row = row; memset(softwareRenderer->spriteLayer, 0, sizeof(softwareRenderer->spriteLayer)); softwareRenderer->windows[0].endX = VIDEO_HORIZONTAL_PIXELS;@@ -400,6 +399,7 @@ softwareRenderer->windows[0].control.packed = 0xFF;
} _drawScanline(softwareRenderer, y); + memcpy(row, softwareRenderer->row, VIDEO_HORIZONTAL_PIXELS * sizeof(*row)); } static void GBAVideoSoftwareRendererFinishFrame(struct GBAVideoRenderer* renderer) {
M
src/gba/renderers/video-software.h
→
src/gba/renderers/video-software.h
@@ -86,6 +86,7 @@ unsigned outputBufferStride;
union GBARegisterDISPCNT dispcnt; + uint32_t row[VIDEO_HORIZONTAL_PIXELS]; uint32_t spriteLayer[VIDEO_HORIZONTAL_PIXELS]; // BLDCNT@@ -118,7 +119,6 @@ struct Window windows[MAX_WINDOW];
struct GBAVideoSoftwareBackground bg[4]; - uint32_t* row; int start; int end;