all repos — mgba @ 85e1c2d573ff98e688331b4f1218511c623fe218

mGBA Game Boy Advance Emulator

Exploit cache locality for slightly faster drawing
Jeffrey Pfau jeffrey@endrift.com
Sat, 03 Aug 2013 01:15:08 -0700
commit

85e1c2d573ff98e688331b4f1218511c623fe218

parent

6b86cdf9ef5369884c33a44ee7941698a6feeec4

2 files changed, 3 insertions(+), 3 deletions(-)

jump to
M src/gba/renderers/video-software.csrc/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.hsrc/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;