GBA Video: Batch VRAM upload

This commit is contained in:
Vicki Pfau 2019-05-20 13:15:17 -07:00
parent f781c793f5
commit 53d9e6b432
1 changed files with 9 additions and 5 deletions

View File

@ -994,13 +994,17 @@ void GBAVideoGLRendererDrawScanline(struct GBAVideoRenderer* renderer, int y) {
glRenderer->paletteDirty = false;
}
int i;
for (i = 0; i < 24; ++i) {
int first = -1;
glBindTexture(GL_TEXTURE_2D, glRenderer->vramTex);
for (i = 0; i < 25; ++i) {
if (!(glRenderer->vramDirty & (1 << i))) {
continue;
if (first >= 0) {
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 8 * first, 256, 8 * (i - first), GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, &glRenderer->d.vram[2048 * first]);
first = -1;
}
} else if (first < 0) {
first = i;
}
// TODO: PBOs
glBindTexture(GL_TEXTURE_2D, glRenderer->vramTex);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 8 * i, 256, 8, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, &glRenderer->d.vram[2048 * i]);
}
glRenderer->vramDirty = 0;