all repos — mgba @ dbdbcd13859e5c169a4eb7dbc6656fcd6819c222

mGBA Game Boy Advance Emulator

GBA Video: Fix GL renderer
Vicki Pfau vi@endrift.com
Sat, 28 Sep 2019 16:09:52 -0700
commit

dbdbcd13859e5c169a4eb7dbc6656fcd6819c222

parent

e654c188f9669de13c9f36049b1c8f579d84c666

1 files changed, 7 insertions(+), 1 deletions(-)

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

@@ -1356,7 +1356,13 @@ glBindTexture(GL_TEXTURE_2D, glRenderer->vramTex);

for (i = 0; i < 25; ++i) { if (!(glRenderer->vramDirty & (1 << i))) { 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.vramBG[2048 * first]); + uint16_t* vram; + if (first < 16) { + vram = &glRenderer->d.vramBG[first >> 2][2048 * (first & 3)]; + } else { + vram = &glRenderer->d.vramOBJ[(first - 16) >> 2][2048 * (first & 3)]; + } + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 8 * first, 256, 8 * (i - first), GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, vram); first = -1; } } else if (first < 0) {