mirror of https://github.com/mgba-emu/mgba.git
GBA Video: Disable sentinel code in release builds
This commit is contained in:
parent
ed70ab9f05
commit
942ae92c4e
|
@ -3,6 +3,12 @@
|
||||||
#include "gba.h"
|
#include "gba.h"
|
||||||
#include "gba-io.h"
|
#include "gba-io.h"
|
||||||
|
|
||||||
|
#ifdef NDEBUG
|
||||||
|
#define VIDEO_CHECKS false
|
||||||
|
#else
|
||||||
|
#define VIDEO_CHECKS true
|
||||||
|
#endif
|
||||||
|
|
||||||
static const int _objSizes[32] = {
|
static const int _objSizes[32] = {
|
||||||
8, 8,
|
8, 8,
|
||||||
16, 16,
|
16, 16,
|
||||||
|
@ -867,8 +873,10 @@ static inline void _compositeNoBlendNoObjwin(struct GBAVideoSoftwareRenderer* re
|
||||||
BACKGROUND_DRAW_PIXEL_16(BLEND, OBJWIN); \
|
BACKGROUND_DRAW_PIXEL_16(BLEND, OBJWIN); \
|
||||||
} \
|
} \
|
||||||
/* Needed for consistency checks */ \
|
/* Needed for consistency checks */ \
|
||||||
outX = renderer->end; \
|
if (VIDEO_CHECKS) { \
|
||||||
pixel = &renderer->row[outX]; \
|
outX = renderer->end; \
|
||||||
|
pixel = &renderer->row[outX]; \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DRAW_BACKGROUND_MODE_0_MOSAIC_16(BLEND, OBJWIN) \
|
#define DRAW_BACKGROUND_MODE_0_MOSAIC_16(BLEND, OBJWIN) \
|
||||||
|
@ -1028,8 +1036,10 @@ static inline void _compositeNoBlendNoObjwin(struct GBAVideoSoftwareRenderer* re
|
||||||
BACKGROUND_DRAW_PIXEL_256(BLEND, OBJWIN); \
|
BACKGROUND_DRAW_PIXEL_256(BLEND, OBJWIN); \
|
||||||
} \
|
} \
|
||||||
/* Needed for consistency checks */ \
|
/* Needed for consistency checks */ \
|
||||||
outX = renderer->end; \
|
if (VIDEO_CHECKS) { \
|
||||||
pixel = &renderer->row[outX]; \
|
outX = renderer->end; \
|
||||||
|
pixel = &renderer->row[outX]; \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DRAW_BACKGROUND_MODE_0_TILES_256(BLEND, OBJWIN) \
|
#define DRAW_BACKGROUND_MODE_0_TILES_256(BLEND, OBJWIN) \
|
||||||
|
@ -1157,8 +1167,8 @@ static inline void _compositeNoBlendNoObjwin(struct GBAVideoSoftwareRenderer* re
|
||||||
outX = end; \
|
outX = end; \
|
||||||
if (tileX < tileEnd) { \
|
if (tileX < tileEnd) { \
|
||||||
++tileX; \
|
++tileX; \
|
||||||
} else if (UNLIKELY(tileX > tileEnd)) { \
|
} else if (VIDEO_CHECKS && UNLIKELY(tileX > tileEnd)) { \
|
||||||
GBALog(0, GBA_LOG_DANGER, "Invariant doesn't hold in background draw! tileX (%u) > tileEnd (%u)", tileX, tileEnd); \
|
GBALog(0, GBA_LOG_FATAL, "Invariant doesn't hold in background draw! tileX (%u) > tileEnd (%u)", tileX, tileEnd); \
|
||||||
return; \
|
return; \
|
||||||
} \
|
} \
|
||||||
length -= end - renderer->start; \
|
length -= end - renderer->start; \
|
||||||
|
@ -1166,8 +1176,8 @@ static inline void _compositeNoBlendNoObjwin(struct GBAVideoSoftwareRenderer* re
|
||||||
/*! TODO: Make sure these lines can be removed */ \
|
/*! TODO: Make sure these lines can be removed */ \
|
||||||
/*!*/ pixel = &renderer->row[outX]; \
|
/*!*/ pixel = &renderer->row[outX]; \
|
||||||
outX += (tileEnd - tileX) * 8; \
|
outX += (tileEnd - tileX) * 8; \
|
||||||
/*!*/ if (UNLIKELY(outX > VIDEO_HORIZONTAL_PIXELS)) { \
|
/*!*/ if (VIDEO_CHECKS && UNLIKELY(outX > VIDEO_HORIZONTAL_PIXELS)) { \
|
||||||
/*!*/ GBALog(0, GBA_LOG_DANGER, "Out of bounds background draw would occur!"); \
|
/*!*/ GBALog(0, GBA_LOG_FATAL, "Out of bounds background draw would occur!"); \
|
||||||
/*!*/ return; \
|
/*!*/ return; \
|
||||||
/*!*/ } \
|
/*!*/ } \
|
||||||
DRAW_BACKGROUND_MODE_0_TILES_ ## BPP (BLEND, OBJWIN) \
|
DRAW_BACKGROUND_MODE_0_TILES_ ## BPP (BLEND, OBJWIN) \
|
||||||
|
@ -1175,16 +1185,16 @@ static inline void _compositeNoBlendNoObjwin(struct GBAVideoSoftwareRenderer* re
|
||||||
BACKGROUND_TEXT_SELECT_CHARACTER; \
|
BACKGROUND_TEXT_SELECT_CHARACTER; \
|
||||||
\
|
\
|
||||||
int mod8 = length & 0x7; \
|
int mod8 = length & 0x7; \
|
||||||
if (UNLIKELY(outX + mod8 != renderer->end)) { \
|
if (VIDEO_CHECKS && UNLIKELY(outX + mod8 != renderer->end)) { \
|
||||||
GBALog(0, GBA_LOG_DANGER, "Invariant doesn't hold in background draw!"); \
|
GBALog(0, GBA_LOG_FATAL, "Invariant doesn't hold in background draw!"); \
|
||||||
return; \
|
return; \
|
||||||
} \
|
} \
|
||||||
DRAW_BACKGROUND_MODE_0_TILE_PREFIX_ ## BPP (BLEND, OBJWIN) \
|
DRAW_BACKGROUND_MODE_0_TILE_PREFIX_ ## BPP (BLEND, OBJWIN) \
|
||||||
} \
|
} \
|
||||||
if (UNLIKELY(&renderer->row[outX] != pixel)) { \
|
if (VIDEO_CHECKS && UNLIKELY(&renderer->row[outX] != pixel)) { \
|
||||||
GBALog(0, GBA_LOG_DANGER, "Background draw ended in the wrong place! Diff: %lx", &renderer->row[outX] - pixel); \
|
GBALog(0, GBA_LOG_FATAL, "Background draw ended in the wrong place! Diff: %lx", &renderer->row[outX] - pixel); \
|
||||||
} \
|
} \
|
||||||
if (UNLIKELY(outX > VIDEO_HORIZONTAL_PIXELS)) { \
|
if (VIDEO_CHECKS && UNLIKELY(outX > VIDEO_HORIZONTAL_PIXELS)) { \
|
||||||
GBALog(0, GBA_LOG_FATAL, "Out of bounds background draw occurred!"); \
|
GBALog(0, GBA_LOG_FATAL, "Out of bounds background draw occurred!"); \
|
||||||
return; \
|
return; \
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue