aboutsummaryrefslogtreecommitdiff
path: root/util/sokol_debugtext.h
diff options
context:
space:
mode:
authorAndre Weissflog <floooh@gmail.com>2023-02-10 19:07:51 +0100
committerAndre Weissflog <floooh@gmail.com>2023-02-10 19:07:51 +0100
commitcf14e3c9126cb0b9dbc707622734defdb4794989 (patch)
tree12e21db0ea4e21a4165fc532510f51da2cc4b426 /util/sokol_debugtext.h
parent4ca250a777d1a6c09564c1e01d2f0b431e78ffc5 (diff)
sokol_debugtext.h: add human readable logging messages
Diffstat (limited to 'util/sokol_debugtext.h')
-rw-r--r--util/sokol_debugtext.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/util/sokol_debugtext.h b/util/sokol_debugtext.h
index 42964623..f6fc8d51 100644
--- a/util/sokol_debugtext.h
+++ b/util/sokol_debugtext.h
@@ -547,13 +547,14 @@ extern "C" {
Used as parameter in the logging callback.
*/
#define _SDTX_LOG_ITEMS \
- _SDTX_LOGITEM_XMACRO(OK) \
- _SDTX_LOGITEM_XMACRO(ADD_COMMIT_LISTENER_FAILED) \
- _SDTX_LOGITEM_XMACRO(COMMAND_BUFFER_FULL) \
- _SDTX_LOGITEM_XMACRO(CONTEXT_POOL_EXHAUSTED) \
- _SDTX_LOGITEM_XMACRO(CANNOT_DESTROY_DEFAULT_CONTEXT) \
-
-#define _SDTX_LOGITEM_XMACRO(item) SDTX_LOGITEM_##item,
+ _SDTX_LOGITEM_XMACRO(OK, "Ok") \
+ _SDTX_LOGITEM_XMACRO(MALLOC_FAILED, "memory allocation failed") \
+ _SDTX_LOGITEM_XMACRO(ADD_COMMIT_LISTENER_FAILED, "sg_add_commit_listener() failed") \
+ _SDTX_LOGITEM_XMACRO(COMMAND_BUFFER_FULL, "command buffer full (adjust via sdtx_context_desc_t.max_commands)") \
+ _SDTX_LOGITEM_XMACRO(CONTEXT_POOL_EXHAUSTED, "context pool exhausted (adjust via sdtx_desc_t.context_pool_size)") \
+ _SDTX_LOGITEM_XMACRO(CANNOT_DESTROY_DEFAULT_CONTEXT, "cannot destroy default context") \
+
+#define _SDTX_LOGITEM_XMACRO(item,msg) SDTX_LOGITEM_##item,
typedef enum sdtx_log_item_t {
_SDTX_LOG_ITEMS
} sdtx_log_item_t;
@@ -3641,7 +3642,7 @@ static _sdtx_t _sdtx;
//
// >>logging
#if defined(SOKOL_DEBUG)
-#define _SDTX_LOGITEM_XMACRO(item) #item,
+#define _SDTX_LOGITEM_XMACRO(item,msg) #item ": " msg,
static const char* _sdtx_log_messages[] = {
_SDTX_LOG_ITEMS
};
@@ -3694,7 +3695,9 @@ static void* _sdtx_malloc(size_t size) {
else {
ptr = malloc(size);
}
- SOKOL_ASSERT(ptr);
+ if (0 == ptr) {
+ _SDTX_PANIC(MALLOC_FAILED);
+ }
return ptr;
}