From 6380fedb60a0e51574cfb9df32e283ec33d5e5fa Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Thu, 20 Dec 2018 22:46:48 +0100 Subject: [PATCH] st/nine: Enable debug info if NDEBUG is not set We want to have debug info as well if using meson's debugoptimized when ndebug is off. v2: use u_debug functions that do something even if DEBUG is not set. Signed-off-by: Axel Davy --- src/gallium/state_trackers/nine/basetexture9.c | 6 +++--- src/gallium/state_trackers/nine/basetexture9.h | 2 +- src/gallium/state_trackers/nine/nine_debug.c | 12 ++++++------ src/gallium/state_trackers/nine/nine_debug.h | 10 +++++----- src/gallium/state_trackers/nine/nine_dump.c | 4 ++-- src/gallium/state_trackers/nine/nine_dump.h | 6 +++--- src/gallium/state_trackers/nine/nine_ff.c | 2 +- src/gallium/state_trackers/nine/nine_state.c | 2 +- src/gallium/state_trackers/nine/surface9.c | 4 ++-- src/gallium/state_trackers/nine/surface9.h | 2 +- src/gallium/state_trackers/nine/volume9.c | 2 +- 11 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/gallium/state_trackers/nine/basetexture9.c b/src/gallium/state_trackers/nine/basetexture9.c index 911eee6da20..441a0817461 100644 --- a/src/gallium/state_trackers/nine/basetexture9.c +++ b/src/gallium/state_trackers/nine/basetexture9.c @@ -28,7 +28,7 @@ #include "cubetexture9.h" #include "volumetexture9.h" -#ifdef DEBUG +#if defined(DEBUG) || !defined(NDEBUG) #include "nine_pipe.h" #include "nine_dump.h" #endif @@ -605,7 +605,7 @@ NineBaseTexture9_UnLoad( struct NineBaseTexture9 *This ) BASETEX_REGISTER_UPDATE(This); } -#ifdef DEBUG +#if defined(DEBUG) || !defined(NDEBUG) void NineBaseTexture9_Dump( struct NineBaseTexture9 *This ) { @@ -620,4 +620,4 @@ NineBaseTexture9_Dump( struct NineBaseTexture9 *This ) This->base.info.array_size, This->base.info.last_level, This->managed.lod, This->managed.lod_resident); } -#endif /* DEBUG */ +#endif /* DEBUG || !NDEBUG */ diff --git a/src/gallium/state_trackers/nine/basetexture9.h b/src/gallium/state_trackers/nine/basetexture9.h index 10a7cea46da..19899c65825 100644 --- a/src/gallium/state_trackers/nine/basetexture9.h +++ b/src/gallium/state_trackers/nine/basetexture9.h @@ -150,7 +150,7 @@ NineBindTextureToDevice( struct NineDevice9 *device, nine_bind(slot, tex); } -#ifdef DEBUG +#if defined(DEBUG) || !defined(NDEBUG) void NineBaseTexture9_Dump( struct NineBaseTexture9 *This ); #else diff --git a/src/gallium/state_trackers/nine/nine_debug.c b/src/gallium/state_trackers/nine/nine_debug.c index 1dcbca45854..904a40fde83 100644 --- a/src/gallium/state_trackers/nine/nine_debug.c +++ b/src/gallium/state_trackers/nine/nine_debug.c @@ -93,18 +93,18 @@ _nine_debug_printf( unsigned long flag, for (func += 4; func != f; ++func) { *ptr++ = tolower(*func); } *ptr = '\0'; if (tid) - debug_printf("nine:0x%08lx:%s:%s: ", tid, klass, ++f); + _debug_printf("nine:0x%08lx:%s:%s: ", tid, klass, ++f); else - debug_printf("nine:%s:%s: ", klass, ++f); + _debug_printf("nine:%s:%s: ", klass, ++f); } else if (func) { if (tid) - debug_printf("nine:0x%08lx:%s ", tid, func); + _debug_printf("nine:0x%08lx:%s ", tid, func); else - debug_printf("nine:%s ", func); + _debug_printf("nine:%s ", func); } va_start(ap, fmt); - debug_vprintf(fmt, ap); + _debug_vprintf(fmt, ap); va_end(ap); } } @@ -116,5 +116,5 @@ _nine_stub( const char *file, { const char *r = strrchr(file, '/'); if (r == NULL) { r = strrchr(file, '\\'); } - debug_printf("nine:%s:%d: %s STUB!\n", r ? ++r : file, line, func); + _debug_printf("nine:%s:%d: %s STUB!\n", r ? ++r : file, line, func); } diff --git a/src/gallium/state_trackers/nine/nine_debug.h b/src/gallium/state_trackers/nine/nine_debug.h index 841438a66f8..2bbb73ef96a 100644 --- a/src/gallium/state_trackers/nine/nine_debug.h +++ b/src/gallium/state_trackers/nine/nine_debug.h @@ -33,7 +33,7 @@ _nine_debug_printf( unsigned long flag, #define ERR(fmt, ...) _nine_debug_printf(DBG_ERROR, __FUNCTION__, fmt, ## __VA_ARGS__) -#ifdef DEBUG +#if defined(DEBUG) || !defined(NDEBUG) #define WARN(fmt, ...) _nine_debug_printf(DBG_WARN, __FUNCTION__, fmt, ## __VA_ARGS__) #define WARN_ONCE(fmt, ...) \ do { \ @@ -48,7 +48,7 @@ _nine_debug_printf( unsigned long flag, #define WARN_ONCE(fmt, ...) #endif -#ifdef DEBUG +#if defined(DEBUG) || !defined(NDEBUG) #define DBG_FLAG(flag, fmt, ...) \ _nine_debug_printf(flag, __FUNCTION__, fmt, ## __VA_ARGS__) #else @@ -90,7 +90,7 @@ _nine_stub( const char *file, const char *func, unsigned line ); -#ifdef DEBUG +#if defined(DEBUG) || !defined(NDEBUG) #define STUB(ret) \ do { \ _nine_stub(__FILE__, __FUNCTION__, __LINE__); \ @@ -104,7 +104,7 @@ _nine_stub( const char *file, * macro is designed to be used in conditionals ala * if (user_error(required condition)) { assertion failed } * It also prints debug message if the assertion fails. */ -#ifdef DEBUG +#if defined(DEBUG) || !defined(NDEBUG) #define user_error(x) \ (!(x) ? (DBG_FLAG(DBG_USER, "User assertion failed: `%s'\n", #x), TRUE) \ : FALSE) @@ -112,7 +112,7 @@ _nine_stub( const char *file, #define user_error(x) (!(x) ? TRUE : FALSE) #endif -#ifdef DEBUG +#if defined(DEBUG) || !defined(NDEBUG) #define user_warn(x) \ if ((x)) { DBG_FLAG(DBG_USER, "User warning: `%s'\n", #x); } #else diff --git a/src/gallium/state_trackers/nine/nine_dump.c b/src/gallium/state_trackers/nine/nine_dump.c index 1ca550586e4..85ee266defb 100644 --- a/src/gallium/state_trackers/nine/nine_dump.c +++ b/src/gallium/state_trackers/nine/nine_dump.c @@ -8,7 +8,7 @@ #include "nine_dump.h" -#ifdef DEBUG +#if defined(DEBUG) || !defined(NDEBUG) static char __thread tls[128]; @@ -810,4 +810,4 @@ nine_dump_D3DCAPS9(unsigned ch, const D3DCAPS9 *caps) FREE(s); } -#endif /* DEBUG */ +#endif /* DEBUG || !NDEBUG */ diff --git a/src/gallium/state_trackers/nine/nine_dump.h b/src/gallium/state_trackers/nine/nine_dump.h index a0ffe7bf6ab..72342557d77 100644 --- a/src/gallium/state_trackers/nine/nine_dump.h +++ b/src/gallium/state_trackers/nine/nine_dump.h @@ -16,7 +16,7 @@ const char *nine_D3DPRESENTFLAG_to_str(DWORD); const char *nine_D3DLOCK_to_str(DWORD); const char *nine_D3DSAMP_to_str(DWORD); -#ifdef DEBUG +#if defined(DEBUG) || !defined(NDEBUG) void nine_dump_D3DADAPTER_IDENTIFIER9(unsigned, const D3DADAPTER_IDENTIFIER9 *); @@ -29,7 +29,7 @@ nine_dump_D3DMATERIAL9(unsigned, const D3DMATERIAL9 *); void nine_dump_D3DTSS_value(unsigned, D3DTEXTURESTAGESTATETYPE, DWORD); -#else /* !DEBUG */ +#else /* !DEBUG && NDEBUG */ static inline void nine_dump_D3DADAPTER_IDENTIFIER9(unsigned ch, const D3DADAPTER_IDENTIFIER9 *id) @@ -47,6 +47,6 @@ static inline void nine_dump_D3DTSS_value(unsigned ch, D3DTEXTURESTAGESTATETYPE tss, DWORD value) { } -#endif /* DEBUG */ +#endif /* DEBUG || !NDEBUG */ #endif /* _NINE_DUMP_H_H_ */ diff --git a/src/gallium/state_trackers/nine/nine_ff.c b/src/gallium/state_trackers/nine/nine_ff.c index cb77d6915b9..85d75d6b2ec 100644 --- a/src/gallium/state_trackers/nine/nine_ff.c +++ b/src/gallium/state_trackers/nine/nine_ff.c @@ -2491,7 +2491,7 @@ nine_d3d_matrix_inverse(D3DMATRIX *D, const D3DMATRIX *M) for (k = 0; k < 4; k++) D->m[i][k] *= det; -#ifdef DEBUG +#if defined(DEBUG) || !defined(NDEBUG) { D3DMATRIX I; diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c index 02673c1f6ed..939acb77cb3 100644 --- a/src/gallium/state_trackers/nine/nine_state.c +++ b/src/gallium/state_trackers/nine/nine_state.c @@ -157,7 +157,7 @@ nine_csmt_create( struct NineDevice9 *This ) (void) mtx_init(&ctx->thread_running, mtx_plain); (void) mtx_init(&ctx->thread_resume, mtx_plain); -#if DEBUG +#if defined(DEBUG) || !defined(NDEBUG) u_thread_setname("Main thread"); #endif diff --git a/src/gallium/state_trackers/nine/surface9.c b/src/gallium/state_trackers/nine/surface9.c index ebb2f9d0c46..7f4ecf559e8 100644 --- a/src/gallium/state_trackers/nine/surface9.c +++ b/src/gallium/state_trackers/nine/surface9.c @@ -272,7 +272,7 @@ NineSurface9_CreatePipeSurfaces( struct NineSurface9 *This ) assert(This->surface[1]); } -#ifdef DEBUG +#if defined(DEBUG) || !defined(NDEBUG) void NineSurface9_Dump( struct NineSurface9 *This ) { @@ -300,7 +300,7 @@ NineSurface9_Dump( struct NineSurface9 *This ) NineUnknown_Release(NineUnknown(tex)); } } -#endif /* DEBUG */ +#endif /* DEBUG || !NDEBUG */ HRESULT NINE_WINAPI NineSurface9_GetContainer( struct NineSurface9 *This, diff --git a/src/gallium/state_trackers/nine/surface9.h b/src/gallium/state_trackers/nine/surface9.h index 7badde4e172..8b8708e29e2 100644 --- a/src/gallium/state_trackers/nine/surface9.h +++ b/src/gallium/state_trackers/nine/surface9.h @@ -139,7 +139,7 @@ NineSurface9_IsOffscreenPlain (struct NineSurface9 *This ) return This->base.usage == 0 && !This->texture; } -#ifdef DEBUG +#if defined(DEBUG) || !defined(NDEBUG) void NineSurface9_Dump( struct NineSurface9 *This ); #else diff --git a/src/gallium/state_trackers/nine/volume9.c b/src/gallium/state_trackers/nine/volume9.c index 840f01dae10..d6d80611f3c 100644 --- a/src/gallium/state_trackers/nine/volume9.c +++ b/src/gallium/state_trackers/nine/volume9.c @@ -186,7 +186,7 @@ static inline void NineVolume9_MarkContainerDirty( struct NineVolume9 *This ) { struct NineBaseTexture9 *tex; -#ifdef DEBUG +#if defined(DEBUG) || !defined(NDEBUG) /* This is always contained by a NineVolumeTexture9. */ GUID id = IID_IDirect3DVolumeTexture9; REFIID ref = &id; -- 2.30.2