diff options
author | Bad Diode <bd@badd10de.dev> | 2021-06-06 12:14:47 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2021-06-06 12:14:47 +0200 |
commit | 6f3f65fd5dc7b6bfa13fbdb841548aaaee90b228 (patch) | |
tree | 173fb3bbee853d6a18b4f9787ad606289cceb435 | |
parent | 3a62d618693d34fc807824698e8a64ba9a8d804c (diff) | |
download | stepper-6f3f65fd5dc7b6bfa13fbdb841548aaaee90b228.tar.gz stepper-6f3f65fd5dc7b6bfa13fbdb841548aaaee90b228.zip |
Add compiler option to disable boundchecks
-rw-r--r-- | src/renderer.c | 10 |
1 files changed, 8 insertions, 2 deletions
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 @@ | |||
12 | // the remaining two available for other background layers. There are 14KB of | 12 | // the remaining two available for other background layers. There are 14KB of |
13 | // sprite memory available, since the backbuffer is located at the end of the | 13 | // sprite memory available, since the backbuffer is located at the end of the |
14 | // VRAM, but if more space is needed it can be moved to the end of the BG | 14 | // VRAM, but if more space is needed it can be moved to the end of the BG |
15 | // charblocks instead as described below. | 15 | // charblocks instead. |
16 | // | 16 | // |
17 | 17 | ||
18 | #include "renderer.h" | 18 | #include "renderer.h" |
@@ -21,8 +21,14 @@ | |||
21 | // Keep track of which tiles need to be copied to the frontbuffer. | 21 | // Keep track of which tiles need to be copied to the frontbuffer. |
22 | static u32 dirty_tiles[21] = {0}; | 22 | static u32 dirty_tiles[21] = {0}; |
23 | 23 | ||
24 | // TODO: Allow disable bound checking at compile time. | 24 | // Boundchecks can be disable at compile time but this will not always improve |
25 | // the performance and can in fact make it worse. It is possible that this is | ||
26 | // due to some aliasing optimiztions but not sure at this moment. | ||
27 | #ifdef DISABLE_BOUNDCHECK_SCREEN | ||
28 | #define BOUNDCHECK_SCREEN(X,Y) | ||
29 | #else | ||
25 | #define BOUNDCHECK_SCREEN(X,Y) if ((X) >= SCREEN_WIDTH || (Y) >= SCREEN_HEIGHT) return; | 30 | #define BOUNDCHECK_SCREEN(X,Y) if ((X) >= SCREEN_WIDTH || (Y) >= SCREEN_HEIGHT) return; |
31 | #endif | ||
26 | 32 | ||
27 | IWRAM_CODE | 33 | IWRAM_CODE |
28 | void | 34 | void |