libs/vkd3d-common: Provide access to current debug level.

This commit is contained in:
Józef Kucia 2017-06-19 18:05:53 +02:00
parent 5808c280f7
commit 97c7bc0a18
2 changed files with 5 additions and 1 deletions

View File

@ -30,6 +30,8 @@ enum vkd3d_dbg_level
VKD3D_DBG_LEVEL_TRACE, VKD3D_DBG_LEVEL_TRACE,
}; };
enum vkd3d_dbg_level vkd3d_dbg_get_level(void) DECLSPEC_HIDDEN;
void vkd3d_dbg_printf(enum vkd3d_dbg_level level, const char *function, void vkd3d_dbg_printf(enum vkd3d_dbg_level level, const char *function,
const char *fmt, ...) VKD3D_PRINTF_FUNC(3, 4) DECLSPEC_HIDDEN; const char *fmt, ...) VKD3D_PRINTF_FUNC(3, 4) DECLSPEC_HIDDEN;
@ -50,6 +52,8 @@ const char *debugstr_w(const WCHAR *wstr) DECLSPEC_HIDDEN;
#define FIXME VKD3D_DBG_LOG(FIXME) #define FIXME VKD3D_DBG_LOG(FIXME)
#define ERR VKD3D_DBG_LOG(ERR) #define ERR VKD3D_DBG_LOG(ERR)
#define TRACE_ON() (vkd3d_dbg_get_level() == VKD3D_DBG_LEVEL_TRACE)
static inline const char *debugstr_guid(const GUID *guid) static inline const char *debugstr_guid(const GUID *guid)
{ {
if (!guid) if (!guid)

View File

@ -37,7 +37,7 @@ static const char *debug_level_names[] =
/* VKD3D_DBG_LEVEL_TRACE */ "trace", /* VKD3D_DBG_LEVEL_TRACE */ "trace",
}; };
static enum vkd3d_dbg_level vkd3d_dbg_get_level(void) enum vkd3d_dbg_level vkd3d_dbg_get_level(void)
{ {
static unsigned int level = ~0u; static unsigned int level = ~0u;
const char *vkd3d_debug; const char *vkd3d_debug;