GBA Video: Skip attempting to render offscreen sprites in OpenGL

This commit is contained in:
Vicki Pfau 2020-11-27 13:53:33 -08:00
parent 7640c38684
commit 99e622eb43
2 changed files with 6 additions and 0 deletions

View File

@ -89,6 +89,7 @@ Misc:
- GBA: Allow pausing event loop while CPU is blocked - GBA: Allow pausing event loop while CPU is blocked
- GBA BIOS: Division by zero should emit a FATAL error - GBA BIOS: Division by zero should emit a FATAL error
- GBA Video: Convert OpenGL VRAM texture to integer - 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 - Debugger: Keep track of global cycle count
- FFmpeg: Add looping option for GIF/APNG - FFmpeg: Add looping option for GIF/APNG
- mGUI: Show battery percentage - mGUI: Show battery percentage

View File

@ -1669,6 +1669,11 @@ void GBAVideoGLRendererDrawSprite(struct GBAVideoGLRenderer* renderer, struct GB
spriteY -= 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 struct GBAVideoGLShader* shader = &renderer->objShader[GBAObjAttributesAGet256Color(sprite->a)];
const GLuint* uniforms = shader->uniforms; const GLuint* uniforms = shader->uniforms;
glBindFramebuffer(GL_FRAMEBUFFER, renderer->fbo[GBA_GL_FBO_OBJ]); glBindFramebuffer(GL_FRAMEBUFFER, renderer->fbo[GBA_GL_FBO_OBJ]);