all repos — mgba @ 3abee66ae6fd1b572448d2ad241f2f531e1fe4fc

mGBA Game Boy Advance Emulator

GBA Video: Mode 2 tweaks
Vicki Pfau vi@endrift.com
Sat, 18 May 2019 13:53:13 -0700
commit

3abee66ae6fd1b572448d2ad241f2f531e1fe4fc

parent

91cd47ee0e6c710d6f59ac3a7a5639fcd48f23e2

1 files changed, 27 insertions(+), 24 deletions(-)

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

@@ -221,7 +221,7 @@ " float y = texCoord.y - range.x;\n"

" float lin = 0.5 - y / range.y * 0.25;\n" " vec2 mixedTransform = interpolate(transform, lin);\n" " vec2 mixedOffset = interpolate(offset, lin);\n" - " color = fetchTile(ivec2(mixedTransform * texCoord.x + mixedOffset));\n" + " color = fetchTile(ivec2(mixedTransform * (texCoord.x - 1) + mixedOffset));\n" " flags = inflags / flagCoeff;\n" "}";

@@ -1202,29 +1202,32 @@ glDrawBuffers(1, (GLenum[]) { GL_COLOR_ATTACHMENT0 });

} void GBAVideoGLRendererDrawBackgroundMode2(struct GBAVideoGLRenderer* renderer, struct GBAVideoGLBackground* background, int y) { - int reverse; - int forward; - switch (y - renderer->firstAffine) { - case 0: - case 1: - case 2: - case 3: - return; - case 4: - forward = 2; - reverse = 4; - break; - case 5: - forward = 2; - reverse = 3; - break; - case 6: - forward = 2; - reverse = 2; - break; - default: - forward = 1; - reverse = 1; + int reverse = 0; + int forward = 1; + if (renderer->scale > 1) { + switch (y - renderer->firstAffine) { + case 0: + case 1: + case 2: + case 3: + return; + case 4: + forward = 2; + reverse = 4; + break; + case 5: + forward = 2; + reverse = 3; + break; + case 6: + forward = 2; + reverse = 2; + break; + case 7: + forward = 2; + reverse = 1; + break; + } } const struct GBAVideoGLShader* shader = &renderer->bgShader[background->overflow ? 2 : 3];