mirror of https://github.com/mgba-emu/mgba.git
GBA Video: Fix sprite layer priority updating in GL
This commit is contained in:
parent
2969a8bf7a
commit
1bf1a97023
1
CHANGES
1
CHANGES
|
@ -47,6 +47,7 @@ Emulation fixes:
|
||||||
- GBA Video: Fix sprites with mid-frame palette changes in GL (fixes mgba.io/i/2476)
|
- GBA Video: Fix sprites with mid-frame palette changes in GL (fixes mgba.io/i/2476)
|
||||||
- GBA Video: Fix OBJ tile wrapping with 2D char mapping (fixes mgba.io/i/2443)
|
- GBA Video: Fix OBJ tile wrapping with 2D char mapping (fixes mgba.io/i/2443)
|
||||||
- GBA Video: Fix horizontal lines in GL when charbase is changed (fixes mgba.io/i/1631)
|
- GBA Video: Fix horizontal lines in GL when charbase is changed (fixes mgba.io/i/1631)
|
||||||
|
- GBA Video: Fix sprite layer priority updating in GL
|
||||||
Other fixes:
|
Other fixes:
|
||||||
- ARM: Disassemble Thumb mov pseudo-instruction properly
|
- ARM: Disassemble Thumb mov pseudo-instruction properly
|
||||||
- Core: Don't attempt to restore rewind diffs past start of rewind
|
- Core: Don't attempt to restore rewind diffs past start of rewind
|
||||||
|
|
|
@ -1802,9 +1802,9 @@ void GBAVideoGLRendererDrawSprite(struct GBAVideoGLRenderer* renderer, struct GB
|
||||||
glUniformMatrix2fv(uniforms[GBA_GL_OBJ_TRANSFORM], 1, GL_FALSE, (GLfloat[]) { flipX, 0, 0, flipY });
|
glUniformMatrix2fv(uniforms[GBA_GL_OBJ_TRANSFORM], 1, GL_FALSE, (GLfloat[]) { flipX, 0, 0, flipY });
|
||||||
}
|
}
|
||||||
glUniform4i(uniforms[GBA_GL_OBJ_DIMS], width, height, totalWidth, totalHeight);
|
glUniform4i(uniforms[GBA_GL_OBJ_DIMS], width, height, totalWidth, totalHeight);
|
||||||
glDisable(GL_STENCIL_TEST);
|
|
||||||
if (GBAObjAttributesAGetMode(sprite->a) == OBJ_MODE_OBJWIN) {
|
if (GBAObjAttributesAGetMode(sprite->a) == OBJ_MODE_OBJWIN) {
|
||||||
// OBJWIN writes do not affect pixel priority
|
// OBJWIN writes do not affect pixel priority
|
||||||
|
glDisable(GL_STENCIL_TEST);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glDepthMask(GL_FALSE);
|
glDepthMask(GL_FALSE);
|
||||||
glStencilMask(0);
|
glStencilMask(0);
|
||||||
|
@ -1812,6 +1812,7 @@ void GBAVideoGLRendererDrawSprite(struct GBAVideoGLRenderer* renderer, struct GB
|
||||||
glUniform3i(uniforms[GBA_GL_OBJ_OBJWIN], window, renderer->bldb, renderer->bldy);
|
glUniform3i(uniforms[GBA_GL_OBJ_OBJWIN], window, renderer->bldb, renderer->bldy);
|
||||||
glDrawBuffers(3, (GLenum[]) { GL_NONE, GL_NONE, GL_COLOR_ATTACHMENT2 });
|
glDrawBuffers(3, (GLenum[]) { GL_NONE, GL_NONE, GL_COLOR_ATTACHMENT2 });
|
||||||
} else {
|
} else {
|
||||||
|
glEnable(GL_STENCIL_TEST);
|
||||||
glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_TRUE);
|
||||||
glStencilMask(1);
|
glStencilMask(1);
|
||||||
|
@ -1836,7 +1837,6 @@ void GBAVideoGLRendererDrawSprite(struct GBAVideoGLRenderer* renderer, struct GB
|
||||||
// Update the pixel priority for already-written pixels
|
// Update the pixel priority for already-written pixels
|
||||||
shader = &renderer->objShader[2];
|
shader = &renderer->objShader[2];
|
||||||
uniforms = shader->uniforms;
|
uniforms = shader->uniforms;
|
||||||
glEnable(GL_STENCIL_TEST);
|
|
||||||
glStencilFunc(GL_EQUAL, 1, 1);
|
glStencilFunc(GL_EQUAL, 1, 1);
|
||||||
glUseProgram(shader->program);
|
glUseProgram(shader->program);
|
||||||
glDrawBuffers(2, (GLenum[]) { GL_NONE, GL_COLOR_ATTACHMENT1 });
|
glDrawBuffers(2, (GLenum[]) { GL_NONE, GL_COLOR_ATTACHMENT1 });
|
||||||
|
|
Loading…
Reference in New Issue