all repos — mgba @ 53d9e6b43213d9eed2c7bc5b38d16f4fdad37bc3

mGBA Game Boy Advance Emulator

GBA Video: Batch VRAM upload
Vicki Pfau vi@endrift.com
Mon, 20 May 2019 13:15:17 -0700
commit

53d9e6b43213d9eed2c7bc5b38d16f4fdad37bc3

parent

f781c793f508cb4d84ececcb697f4e2bfe3abc4e

1 files changed, 9 insertions(+), 5 deletions(-)

jump to
M src/gba/renderers/gl.csrc/gba/renderers/gl.c

@@ -994,13 +994,17 @@ #endif

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;