From 3375bce927f2f69041524b481ee396750c5f3269 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sat, 25 Jul 2015 17:23:21 +0000 Subject: [PATCH] baselayer: add DEBUG_FRAME_LOCKING functionality. git-svn-id: https://svn.eduke32.com/eduke32@5311 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/baselayer.h | 19 ++++++++++++++++++- polymer/eduke32/build/src/sdlayer.c | 8 +++++++- polymer/eduke32/build/src/winlayer.c | 6 ++++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/polymer/eduke32/build/include/baselayer.h b/polymer/eduke32/build/include/baselayer.h index ba1cb84ba..173c5538e 100644 --- a/polymer/eduke32/build/include/baselayer.h +++ b/polymer/eduke32/build/include/baselayer.h @@ -199,9 +199,26 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs); void getvalidmodes(void); void resetvideomode(void); -void begindrawing(void); +//#define DEBUG_FRAME_LOCKING + void enddrawing(void); void showframe(int32_t); +#if !defined DEBUG_FRAME_LOCKING +void begindrawing(void); +#else +void begindrawing_real(void); +# define BEGINDRAWING_SIZE 256 +extern uint32_t begindrawing_line[BEGINDRAWING_SIZE]; +extern const char *begindrawing_file[BEGINDRAWING_SIZE]; +extern int32_t lockcount; +# define begindrawing() do { \ + if (lockcount < BEGINDRAWING_SIZE) { \ + begindrawing_line[lockcount] = __LINE__; \ + begindrawing_file[lockcount] = __FILE__; \ + } \ + begindrawing_real(); \ +} while(0) +#endif int32_t setpalette(int32_t start, int32_t num); //int32_t getpalette(int32_t start, int32_t num, char *dapal); diff --git a/polymer/eduke32/build/src/sdlayer.c b/polymer/eduke32/build/src/sdlayer.c index 2ff9fd549..f14a4b01a 100644 --- a/polymer/eduke32/build/src/sdlayer.c +++ b/polymer/eduke32/build/src/sdlayer.c @@ -1583,11 +1583,17 @@ void resetvideomode(void) modeschecked = 0; } - // // begindrawing() -- locks the framebuffer for drawing // + +#ifdef DEBUG_FRAME_LOCKING +uint32_t begindrawing_line[BEGINDRAWING_SIZE]; +const char *begindrawing_file[BEGINDRAWING_SIZE]; +void begindrawing_real(void) +#else void begindrawing(void) +#endif { if (bpp > 8) { diff --git a/polymer/eduke32/build/src/winlayer.c b/polymer/eduke32/build/src/winlayer.c index d60ce6ec5..c7f8d35af 100644 --- a/polymer/eduke32/build/src/winlayer.c +++ b/polymer/eduke32/build/src/winlayer.c @@ -1905,7 +1905,13 @@ void resetvideomode(void) // // begindrawing() -- locks the framebuffer for drawing // +#ifdef DEBUG_FRAME_LOCKING +uint32_t begindrawing_line[BEGINDRAWING_SIZE]; +const char *begindrawing_file[BEGINDRAWING_SIZE]; +void begindrawing_real(void) +#else void begindrawing(void) +#endif { if (bpp > 8) {