From 6f3f65fd5dc7b6bfa13fbdb841548aaaee90b228 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Sun, 6 Jun 2021 12:14:47 +0200 Subject: Add compiler option to disable boundchecks --- src/renderer.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/renderer.c b/src/renderer.c index 773d50b..2cc5758 100644 --- a/src/renderer.c +++ b/src/renderer.c @@ -12,7 +12,7 @@ // the remaining two available for other background layers. There are 14KB of // sprite memory available, since the backbuffer is located at the end of the // VRAM, but if more space is needed it can be moved to the end of the BG -// charblocks instead as described below. +// charblocks instead. // #include "renderer.h" @@ -21,8 +21,14 @@ // Keep track of which tiles need to be copied to the frontbuffer. static u32 dirty_tiles[21] = {0}; -// TODO: Allow disable bound checking at compile time. +// Boundchecks can be disable at compile time but this will not always improve +// the performance and can in fact make it worse. It is possible that this is +// due to some aliasing optimiztions but not sure at this moment. +#ifdef DISABLE_BOUNDCHECK_SCREEN +#define BOUNDCHECK_SCREEN(X,Y) +#else #define BOUNDCHECK_SCREEN(X,Y) if ((X) >= SCREEN_WIDTH || (Y) >= SCREEN_HEIGHT) return; +#endif IWRAM_CODE void -- cgit v1.2.1