summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Weissflog <floooh@gmail.com>2023-02-11 14:40:27 +0100
committerAndre Weissflog <floooh@gmail.com>2023-02-11 14:40:27 +0100
commitdecda688139988f9832a2393cb03582d67162fcb (patch)
tree6f632d07b165a64ae90de7b382e1ab511a189c0e
parent412eca55ae999a359d0ccccdcd12d5b2178d1caf (diff)
sokol_spine.h: add MALLOC_FAILED panic, replace figlet font
-rw-r--r--util/sokol_spine.h159
1 files changed, 74 insertions, 85 deletions
diff --git a/util/sokol_spine.h b/util/sokol_spine.h
index be436ccf..6fe406aa 100644
--- a/util/sokol_spine.h
+++ b/util/sokol_spine.h
@@ -1012,6 +1012,7 @@ typedef enum sspine_resource_state {
// log item codes via x-macro magic
#define _SSPINE_LOG_ITEMS \
_SSPINE_LOGITEM_XMACRO(OK)\
+ _SSPINE_LOGITEM_XMACRO(MALLOC_FAILED)\
_SSPINE_LOGITEM_XMACRO(CONTEXT_POOL_EXHAUSTED)\
_SSPINE_LOGITEM_XMACRO(ATLAS_POOL_EXHAUSTED)\
_SSPINE_LOGITEM_XMACRO(SKELETON_POOL_EXHAUSTED)\
@@ -1378,12 +1379,11 @@ SOKOL_SPINE_API_DECL void sspine_set_skin(sspine_instance instance, sspine_skin
} // extern "C"
#endif
-// ██╗███╗ ███╗██████╗ ██╗ ███████╗███╗ ███╗███████╗███╗ ██╗████████╗ █████╗ ████████╗██╗ ██████╗ ███╗ ██╗
-// ██║████╗ ████║██╔══██╗██║ ██╔════╝████╗ ████║██╔════╝████╗ ██║╚══██╔══╝██╔══██╗╚══██╔══╝██║██╔═══██╗████╗ ██║
-// ██║██╔████╔██║██████╔╝██║ █████╗ ██╔████╔██║█████╗ ██╔██╗ ██║ ██║ ███████║ ██║ ██║██║ ██║██╔██╗ ██║
-// ██║██║╚██╔╝██║██╔═══╝ ██║ ██╔══╝ ██║╚██╔╝██║██╔══╝ ██║╚██╗██║ ██║ ██╔══██║ ██║ ██║██║ ██║██║╚██╗██║
-// ██║██║ ╚═╝ ██║██║ ███████╗███████╗██║ ╚═╝ ██║███████╗██║ ╚████║ ██║ ██║ ██║ ██║ ██║╚██████╔╝██║ ╚████║
-// ╚═╝╚═╝ ╚═╝╚═╝ ╚══════╝╚══════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝
+// ██ ███ ███ ██████ ██ ███████ ███ ███ ███████ ███ ██ ████████ █████ ████████ ██ ██████ ███ ██
+// ██ ████ ████ ██ ██ ██ ██ ████ ████ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██
+// ██ ██ ████ ██ ██████ ██ █████ ██ ████ ██ █████ ██ ██ ██ ██ ███████ ██ ██ ██ ██ ██ ██ ██
+// ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
+// ██ ██ ██ ██ ███████ ███████ ██ ██ ███████ ██ ████ ██ ██ ██ ██ ██ ██████ ██ ████
//
// >>implementation
#ifdef SOKOL_SPINE_IMPL
@@ -2573,12 +2573,11 @@ static const char* _sspine_fs_source_dummy = "";
#error "Please define one of SOKOL_GLCORE33, SOKOL_GLES2, SOKOL_GLES3, SOKOL_D3D11, SOKOL_METAL, SOKOL_WGPU or SOKOL_DUMMY_BACKEND!"
#endif
-// ███████╗████████╗██████╗ ██╗ ██╗ ██████╗████████╗███████╗
-// ██╔════╝╚══██╔══╝██╔══██╗██║ ██║██╔════╝╚══██╔══╝██╔════╝
-// ███████╗ ██║ ██████╔╝██║ ██║██║ ██║ ███████╗
-// ╚════██║ ██║ ██╔══██╗██║ ██║██║ ██║ ╚════██║
-// ███████║ ██║ ██║ ██║╚██████╔╝╚██████╗ ██║ ███████║
-// ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚══════╝
+// ███████ ████████ ██████ ██ ██ ██████ ████████ ███████
+// ██ ██ ██ ██ ██ ██ ██ ██ ██
+// ███████ ██ ██████ ██ ██ ██ ██ ███████
+// ██ ██ ██ ██ ██ ██ ██ ██ ██
+// ███████ ██ ██ ██ ██████ ██████ ██ ███████
//
// >>structs
@@ -2791,12 +2790,11 @@ char* _spUtil_readFile(const char* path, int* length) {
} // extern "C"
#endif
-// ██╗ ██████╗ ██████╗ ██████╗ ██╗███╗ ██╗ ██████╗
-// ██║ ██╔═══██╗██╔════╝ ██╔════╝ ██║████╗ ██║██╔════╝
-// ██║ ██║ ██║██║ ███╗██║ ███╗██║██╔██╗ ██║██║ ███╗
-// ██║ ██║ ██║██║ ██║██║ ██║██║██║╚██╗██║██║ ██║
-// ███████╗╚██████╔╝╚██████╔╝╚██████╔╝██║██║ ╚████║╚██████╔╝
-// ╚══════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝
+// ██ ██████ ██████ ██████ ██ ███ ██ ██████
+// ██ ██ ██ ██ ██ ██ ████ ██ ██
+// ██ ██ ██ ██ ███ ██ ███ ██ ██ ██ ██ ██ ███
+// ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
+// ███████ ██████ ██████ ██████ ██ ██ ████ ██████
//
// >>logging
#if defined(SOKOL_DEBUG)
@@ -2831,12 +2829,11 @@ static void _sspine_log(sspine_log_item log_item, uint32_t log_level, uint32_t l
}
}
-// ███╗ ███╗███████╗███╗ ███╗ ██████╗ ██████╗ ██╗ ██╗
-// ████╗ ████║██╔════╝████╗ ████║██╔═══██╗██╔══██╗╚██╗ ██╔╝
-// ██╔████╔██║█████╗ ██╔████╔██║██║ ██║██████╔╝ ╚████╔╝
-// ██║╚██╔╝██║██╔══╝ ██║╚██╔╝██║██║ ██║██╔══██╗ ╚██╔╝
-// ██║ ╚═╝ ██║███████╗██║ ╚═╝ ██║╚██████╔╝██║ ██║ ██║
-// ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝
+// ███ ███ ███████ ███ ███ ██████ ██████ ██ ██
+// ████ ████ ██ ████ ████ ██ ██ ██ ██ ██ ██
+// ██ ████ ██ █████ ██ ████ ██ ██ ██ ██████ ████
+// ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
+// ██ ██ ███████ ██ ██ ██████ ██ ██ ██
//
// >>memory
static void _sspine_clear(void* ptr, size_t size) {
@@ -2894,7 +2891,9 @@ static void* _sspine_malloc(size_t size) {
else {
ptr = malloc(size);
}
- SOKOL_ASSERT(ptr);
+ if (0 == ptr) {
+ _SSPINE_PANIC(MALLOC_FAILED);
+ }
return ptr;
}
@@ -2913,12 +2912,11 @@ static void _sspine_free(void* ptr) {
}
}
-// ██████╗ ███████╗███████╗███████╗
-// ██╔══██╗██╔════╝██╔════╝██╔════╝
-// ██████╔╝█████╗ █████╗ ███████╗
-// ██╔══██╗██╔══╝ ██╔══╝ ╚════██║
-// ██║ ██║███████╗██║ ███████║
-// ╚═╝ ╚═╝╚══════╝╚═╝ ╚══════╝
+// ██████ ███████ ███████ ███████
+// ██ ██ ██ ██ ██
+// ██████ █████ █████ ███████
+// ██ ██ ██ ██ ██
+// ██ ██ ███████ ██ ███████
//
// >>refs
static bool _sspine_atlas_ref_valid(const _sspine_atlas_ref_t* ref) {
@@ -2988,12 +2986,11 @@ static sspine_skin _sspine_skin(uint32_t skeleton_id, int index) {
return skin;
}
-// ██████╗ ██████╗ ██████╗ ██╗
-// ██╔══██╗██╔═══██╗██╔═══██╗██║
-// ██████╔╝██║ ██║██║ ██║██║
-// ██╔═══╝ ██║ ██║██║ ██║██║
-// ██║ ╚██████╔╝╚██████╔╝███████╗
-// ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝
+// ██████ ██████ ██████ ██
+// ██ ██ ██ ██ ██ ██ ██
+// ██████ ██ ██ ██ ██ ██
+// ██ ██ ██ ██ ██ ██
+// ██ ██████ ██████ ███████
//
// >>pool
static void _sspine_init_pool(_sspine_pool_t* pool, int num) {
@@ -3099,12 +3096,11 @@ static void _sspine_discard_item_pool(_sspine_pool_t* pool, void** items_ptr) {
_sspine_discard_pool(pool);
}
-// ██████╗ ██████╗ ███╗ ██╗████████╗███████╗██╗ ██╗████████╗
-// ██╔════╝██╔═══██╗████╗ ██║╚══██╔══╝██╔════╝╚██╗██╔╝╚══██╔══╝
-// ██║ ██║ ██║██╔██╗ ██║ ██║ █████╗ ╚███╔╝ ██║
-// ██║ ██║ ██║██║╚██╗██║ ██║ ██╔══╝ ██╔██╗ ██║
-// ╚██████╗╚██████╔╝██║ ╚████║ ██║ ███████╗██╔╝ ██╗ ██║
-// ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝ ╚══════╝╚═╝ ╚═╝ ╚═╝
+// ██████ ██████ ███ ██ ████████ ███████ ██ ██ ████████
+// ██ ██ ██ ████ ██ ██ ██ ██ ██ ██
+// ██ ██ ██ ██ ██ ██ ██ █████ ███ ██
+// ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
+// ██████ ██████ ██ ████ ██ ███████ ██ ██ ██
//
// >>context
static void _sspine_setup_context_pool(int pool_size) {
@@ -3272,12 +3268,11 @@ static bool _sspine_is_default_context(sspine_context ctx_id) {
return ctx_id.id == 0x00010001;
}
-// █████╗ ████████╗██╗ █████╗ ███████╗
-// ██╔══██╗╚══██╔══╝██║ ██╔══██╗██╔════╝
-// ███████║ ██║ ██║ ███████║███████╗
-// ██╔══██║ ██║ ██║ ██╔══██║╚════██║
-// ██║ ██║ ██║ ███████╗██║ ██║███████║
-// ╚═╝ ╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚══════╝
+// █████ ████████ ██ █████ ███████
+// ██ ██ ██ ██ ██ ██ ██
+// ███████ ██ ██ ███████ ███████
+// ██ ██ ██ ██ ██ ██ ██
+// ██ ██ ██ ███████ ██ ██ ███████
//
// >>atlas
static void _sspine_setup_atlas_pool(int pool_size) {
@@ -3411,12 +3406,11 @@ static spAtlasPage* _sspine_lookup_atlas_page(uint32_t atlas_id, int page_index)
return 0;
}
-// ███████╗██╗ ██╗███████╗██╗ ███████╗████████╗ ██████╗ ███╗ ██╗
-// ██╔════╝██║ ██╔╝██╔════╝██║ ██╔════╝╚══██╔══╝██╔═══██╗████╗ ██║
-// ███████╗█████╔╝ █████╗ ██║ █████╗ ██║ ██║ ██║██╔██╗ ██║
-// ╚════██║██╔═██╗ ██╔══╝ ██║ ██╔══╝ ██║ ██║ ██║██║╚██╗██║
-// ███████║██║ ██╗███████╗███████╗███████╗ ██║ ╚██████╔╝██║ ╚████║
-// ╚══════╝╚═╝ ╚═╝╚══════╝╚══════╝╚══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝
+// ███████ ██ ██ ███████ ██ ███████ ████████ ██████ ███ ██
+// ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██
+// ███████ █████ █████ ██ █████ ██ ██ ██ ██ ██ ██
+// ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
+// ███████ ██ ██ ███████ ███████ ███████ ██ ██████ ██ ████
//
// >>skeleton
static void _sspine_setup_skeleton_pool(int pool_size) {
@@ -3642,12 +3636,11 @@ static spSkin* _sspine_lookup_skin(uint32_t skeleton_id, int skin_index) {
return 0;
}
-// ███████╗██╗ ██╗██╗███╗ ██╗███████╗███████╗████████╗
-// ██╔════╝██║ ██╔╝██║████╗ ██║██╔════╝██╔════╝╚══██╔══╝
-// ███████╗█████╔╝ ██║██╔██╗ ██║███████╗█████╗ ██║
-// ╚════██║██╔═██╗ ██║██║╚██╗██║╚════██║██╔══╝ ██║
-// ███████║██║ ██╗██║██║ ╚████║███████║███████╗ ██║
-// ╚══════╝╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚══════╝╚══════╝ ╚═╝
+// ███████ ██ ██ ██ ███ ██ ███████ ███████ ████████
+// ██ ██ ██ ██ ████ ██ ██ ██ ██
+// ███████ █████ ██ ██ ██ ██ ███████ █████ ██
+// ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
+// ███████ ██ ██ ██ ██ ████ ███████ ███████ ██
//
// >>skinset
static void _sspine_setup_skinset_pool(int pool_size) {
@@ -3761,12 +3754,11 @@ static sspine_skinset_desc _sspine_skinset_desc_defaults(const sspine_skinset_de
return res;
}
-// ██╗███╗ ██╗███████╗████████╗ █████╗ ███╗ ██╗ ██████╗███████╗
-// ██║████╗ ██║██╔════╝╚══██╔══╝██╔══██╗████╗ ██║██╔════╝██╔════╝
-// ██║██╔██╗ ██║███████╗ ██║ ███████║██╔██╗ ██║██║ █████╗
-// ██║██║╚██╗██║╚════██║ ██║ ██╔══██║██║╚██╗██║██║ ██╔══╝
-// ██║██║ ╚████║███████║ ██║ ██║ ██║██║ ╚████║╚██████╗███████╗
-// ╚═╝╚═╝ ╚═══╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝╚══════╝
+// ██ ███ ██ ███████ ████████ █████ ███ ██ ██████ ███████
+// ██ ████ ██ ██ ██ ██ ██ ████ ██ ██ ██
+// ██ ██ ██ ██ ███████ ██ ███████ ██ ██ ██ ██ █████
+// ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
+// ██ ██ ████ ███████ ██ ██ ██ ██ ████ ██████ ███████
//
// >>instance
static void _sspine_setup_instance_pool(int pool_size) {
@@ -4016,12 +4008,11 @@ static sspine_instance_desc _sspine_instance_desc_defaults(const sspine_instance
return res;
}
-// ██████╗ ██████╗ █████╗ ██╗ ██╗
-// ██╔══██╗██╔══██╗██╔══██╗██║ ██║
-// ██║ ██║██████╔╝███████║██║ █╗ ██║
-// ██║ ██║██╔══██╗██╔══██║██║███╗██║
-// ██████╔╝██║ ██║██║ ██║╚███╔███╔╝
-// ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚══╝╚══╝
+// ██████ ██████ █████ ██ ██
+// ██ ██ ██ ██ ██ ██ ██ ██
+// ██ ██ ██████ ███████ ██ █ ██
+// ██ ██ ██ ██ ██ ██ ██ ███ ██
+// ██████ ██ ██ ██ ██ ███ ███
//
// >>draw
static void _sspine_check_rewind_commands(_sspine_context_t* ctx) {
@@ -4350,12 +4341,11 @@ static void _sspine_draw_layer(_sspine_context_t* ctx, int layer, const sspine_l
}
}
-// ███╗ ███╗██╗███████╗ ██████╗
-// ████╗ ████║██║██╔════╝██╔════╝
-// ██╔████╔██║██║███████╗██║
-// ██║╚██╔╝██║██║╚════██║██║
-// ██║ ╚═╝ ██║██║███████║╚██████╗
-// ╚═╝ ╚═╝╚═╝╚══════╝ ╚═════╝
+// ███ ███ ██ ███████ ██████
+// ████ ████ ██ ██ ██
+// ██ ████ ██ ██ ███████ ██
+// ██ ██ ██ ██ ██ ██
+// ██ ██ ██ ███████ ██████
//
// >>misc
@@ -4526,12 +4516,11 @@ static sg_commit_listener _sspine_make_commit_listener(void) {
return commit_listener;
}
-// ██████╗ ██╗ ██╗██████╗ ██╗ ██╗ ██████╗
-// ██╔══██╗██║ ██║██╔══██╗██║ ██║██╔════╝
-// ██████╔╝██║ ██║██████╔╝██║ ██║██║
-// ██╔═══╝ ██║ ██║██╔══██╗██║ ██║██║
-// ██║ ╚██████╔╝██████╔╝███████╗██║╚██████╗
-// ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝
+// ██████ ██ ██ ██████ ██ ██ ██████
+// ██ ██ ██ ██ ██ ██ ██ ██ ██
+// ██████ ██ ██ ██████ ██ ██ ██
+// ██ ██ ██ ██ ██ ██ ██ ██
+// ██ ██████ ██████ ███████ ██ ██████
//
// >>public
SOKOL_API_IMPL void sspine_setup(const sspine_desc* desc) {