GBA Video: Skip attempting to render offscreen sprites in OpenGL
Vicki Pfau vi@endrift.com
Fri, 27 Nov 2020 13:53:33 -0800
2 files changed,
6 insertions(+),
0 deletions(-)
M
CHANGES
→
CHANGES
@@ -89,6 +89,7 @@ - GB I/O: Implement preliminary support for PCM12/PCM34 (closes mgba.io/i/1468)
- GBA: Allow pausing event loop while CPU is blocked - GBA BIOS: Division by zero should emit a FATAL error - GBA Video: Convert OpenGL VRAM texture to integer + - GBA Video: Skip attempting to render offscreen sprites in OpenGL - Debugger: Keep track of global cycle count - FFmpeg: Add looping option for GIF/APNG - mGUI: Show battery percentage
M
src/gba/renderers/gl.c
→
src/gba/renderers/gl.c
@@ -1669,6 +1669,11 @@ if (spriteY + totalHeight >= 256) {
spriteY -= 256; } + if (x + totalWidth <= 0 || x >= GBA_VIDEO_HORIZONTAL_PIXELS) { + // These sprites aren't displayed but affect cycle counting + return; + } + const struct GBAVideoGLShader* shader = &renderer->objShader[GBAObjAttributesAGet256Color(sprite->a)]; const GLuint* uniforms = shader->uniforms; glBindFramebuffer(GL_FRAMEBUFFER, renderer->fbo[GBA_GL_FBO_OBJ]);