From 4036136fe54e1b66ded88869d2eade20fc3a3cd5 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Wed, 29 Jan 2020 18:04:14 -0800 Subject: [PATCH] GBA Video: Fix OpenGL sprite flag priority --- CHANGES | 1 + src/gba/renderers/gl.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 4af421662..ba58c3907 100644 --- a/CHANGES +++ b/CHANGES @@ -12,6 +12,7 @@ Emulation fixes: - GBA Video: Latch scanline at end of Hblank (fixes mgba.io/i/1319) - GBA Video: Fix Hblank timing - GBA Video: Fix backdrop blending on lines without sprites (fixes mgba.io/i/1647) + - GBA Video: Fix OpenGL sprite flag priority Other fixes: - Qt: Only dynamically reset video scale if a game is running - Qt: Fix race condition with proxied video events diff --git a/src/gba/renderers/gl.c b/src/gba/renderers/gl.c index 501dcaee5..e09e5e08d 100644 --- a/src/gba/renderers/gl.c +++ b/src/gba/renderers/gl.c @@ -1711,13 +1711,13 @@ void GBAVideoGLRendererDrawSprite(struct GBAVideoGLRenderer* renderer, struct GB glStencilFunc(GL_EQUAL, 1, 1); glUseProgram(shader->program); glDrawBuffers(2, (GLenum[]) { GL_NONE, GL_COLOR_ATTACHMENT1 }); - glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE); glBindVertexArray(shader->vao); glUniform2i(uniforms[GBA_GL_VS_LOC], totalHeight, 0); glUniform2i(uniforms[GBA_GL_VS_MAXPOS], totalWidth, totalHeight); - glUniform4i(uniforms[GBA_GL_OBJ_INFLAGS], GBAObjAttributesCGetPriority(sprite->c), 0, 0, 0); + glUniform4i(uniforms[GBA_GL_OBJ_INFLAGS], GBAObjAttributesCGetPriority(sprite->c), + (renderer->target1Obj || GBAObjAttributesAGetMode(sprite->a) == OBJ_MODE_SEMITRANSPARENT) | (renderer->target2Obj * 2) | (renderer->blendEffect * 4), + renderer->blda, GBAObjAttributesAGetMode(sprite->a) == OBJ_MODE_SEMITRANSPARENT); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); glDrawBuffers(1, (GLenum[]) { GL_COLOR_ATTACHMENT0 }); }