mirror of https://github.com/mgba-emu/mgba.git
GBA Video: Add sprite cycle counting to GL (fixes #1635)
This commit is contained in:
parent
031049cd06
commit
318a96bcb7
1
CHANGES
1
CHANGES
|
@ -28,6 +28,7 @@ Emulation fixes:
|
|||
- GBA Video: Add missing parts of 256-color mode 0 mosaic (fixes mgba.io/i/1701)
|
||||
- GBA Video: Fix double-size OBJ wrapping in GL renderer (fixes mgba.io/i/1712)
|
||||
- GBA Video: Simplify sprite cycle counting (fixes mgba.io/i/1279)
|
||||
- GBA Video: Add sprite cycle counting to GL (fixes mgba.io/i/1635)
|
||||
- SM83: Emulate HALT bug
|
||||
Other fixes:
|
||||
- 3DS: Fix framelimiter on newer citro3d (fixes mgba.io/i/1771)
|
||||
|
|
|
@ -1418,6 +1418,7 @@ void _drawScanlines(struct GBAVideoGLRenderer* glRenderer, int y) {
|
|||
|
||||
GBAVideoGLRendererDrawWindow(glRenderer, y);
|
||||
if (GBARegisterDISPCNTIsObjEnable(glRenderer->dispcnt) && !glRenderer->d.disableOBJ) {
|
||||
int spriteCyclesRemaining = GBARegisterDISPCNTIsHblankIntervalFree(glRenderer->dispcnt) ? OBJ_HBLANK_FREE_LENGTH : OBJ_LENGTH;
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
glDepthFunc(GL_LESS);
|
||||
|
@ -1428,6 +1429,10 @@ void _drawScanlines(struct GBAVideoGLRenderer* glRenderer, int y) {
|
|||
}
|
||||
|
||||
GBAVideoGLRendererDrawSprite(glRenderer, &sprite->obj, y, sprite->y);
|
||||
spriteCyclesRemaining -= sprite->cycles;
|
||||
if (spriteCyclesRemaining <= 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
|
|
Loading…
Reference in New Issue