mirror of https://github.com/mgba-emu/mgba.git
DS Video: Basic preparatory work for porting scanline caching
This commit is contained in:
parent
3ccffdc29e
commit
14e8b12307
|
@ -15,6 +15,9 @@ CXX_GUARD_START
|
|||
#include <mgba/internal/gba/io.h>
|
||||
#include <mgba/internal/gba/renderers/common.h>
|
||||
#include <mgba/internal/gba/video.h>
|
||||
#ifdef M_CORE_DS
|
||||
#include <mgba/internal/ds/video.h>
|
||||
#endif
|
||||
|
||||
struct GBAVideoSoftwareBackground {
|
||||
unsigned index;
|
||||
|
@ -158,7 +161,11 @@ struct GBAVideoSoftwareRenderer {
|
|||
struct ScanlineCache {
|
||||
uint16_t io[REG_SOUND1CNT_LO >> 1];
|
||||
int32_t scale[2][2];
|
||||
#ifdef M_CORE_DS
|
||||
} cache[DS_VIDEO_VERTICAL_PIXELS];
|
||||
#else
|
||||
} cache[GBA_VIDEO_VERTICAL_PIXELS];
|
||||
#endif
|
||||
int nextY;
|
||||
|
||||
int start;
|
||||
|
|
|
@ -378,6 +378,18 @@ static void DSVideoSoftwareRendererInvalidateExtPal(struct DSVideoRenderer* rend
|
|||
static void DSVideoSoftwareRendererDrawGBAScanline(struct GBAVideoRenderer* renderer, struct DSGX* gx, int y) {
|
||||
struct GBAVideoSoftwareRenderer* softwareRenderer = (struct GBAVideoSoftwareRenderer*) renderer;
|
||||
|
||||
if (y == DS_VIDEO_VERTICAL_PIXELS - 1) {
|
||||
softwareRenderer->nextY = 0;
|
||||
} else {
|
||||
softwareRenderer->nextY = y + 1;
|
||||
}
|
||||
|
||||
bool dirty = softwareRenderer->scanlineDirty[y >> 5] & (1 << (y & 0x1F));
|
||||
if (memcmp(softwareRenderer->nextIo, softwareRenderer->cache[y].io, sizeof(softwareRenderer->nextIo))) {
|
||||
memcpy(softwareRenderer->cache[y].io, softwareRenderer->nextIo, sizeof(softwareRenderer->nextIo));
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
int x;
|
||||
color_t* row = &softwareRenderer->outputBuffer[softwareRenderer->outputBufferStride * y];
|
||||
if (GBARegisterDISPCNTIsForcedBlank(softwareRenderer->dispcnt)) {
|
||||
|
|
Loading…
Reference in New Issue