all repos — mgba @ a64c38d3140d8a4015650096c0f61b7d4a9ee38f

mGBA Game Boy Advance Emulator

GBA Video: Fix GL OBJWIN
Vicki Pfau vi@endrift.com
Sun, 26 May 2019 19:41:54 -0700
commit

a64c38d3140d8a4015650096c0f61b7d4a9ee38f

parent

b2450bac5e881de3ba64cf3c9718793ce6ef9873

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

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

@@ -486,9 +486,6 @@ " if ((coord & ~(dims.xy - 1)) != ivec2(0, 0)) {\n"

" discard;\n" " }\n" " vec4 pix = renderTile((coord.x >> 3) + (coord.y >> 3) * stride, 16 + localPalette, coord & 7);\n" - " if (objwin.x > 0) {\n" - " pix.a = 0.;\n" - " }\n" " color = pix;\n" " flags = inflags;\n" " gl_FragDepth = float(flags.x) / 16.;\n"

@@ -1353,7 +1350,6 @@

GBAVideoGLRendererDrawWindow(glRenderer, y); if (GBARegisterDISPCNTIsObjEnable(glRenderer->dispcnt) && !glRenderer->d.disableOBJ) { int i; - glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LESS); for (i = 0; i < glRenderer->oamMax; ++i) { struct GBAVideoRendererSprite* sprite = &glRenderer->sprites[i];

@@ -1625,10 +1621,12 @@ glUniformMatrix2fv(uniforms[GBA_GL_OBJ_TRANSFORM], 1, GL_FALSE, (GLfloat[]) { flipX, 0, 0, flipY });

} glUniform4i(uniforms[GBA_GL_OBJ_DIMS], width, height, totalWidth, totalHeight); if (GBAObjAttributesAGetMode(sprite->a) == OBJ_MODE_OBJWIN) { + glDisable(GL_DEPTH_TEST); int window = renderer->objwin & 0x3F; glUniform4i(uniforms[GBA_GL_OBJ_OBJWIN], 1, window, renderer->bldb, renderer->bldy); - glDrawBuffers(3, (GLenum[]) { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2 }); + glDrawBuffers(3, (GLenum[]) { GL_NONE, GL_NONE, GL_COLOR_ATTACHMENT2 }); } else { + glEnable(GL_DEPTH_TEST); glUniform4i(uniforms[GBA_GL_OBJ_OBJWIN], 0, 0, 0, 0); glDrawBuffers(2, (GLenum[]) { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 }); }