GBA Video: Fix OpenGL sprite flag priority

This commit is contained in:
Vicki Pfau 2020-01-29 18:04:14 -08:00
parent e9cab735cd
commit 4036136fe5
2 changed files with 4 additions and 3 deletions

View File

@ -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

View File

@ -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 });
}