aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Weissflog <floooh@gmail.com>2025-12-07 15:16:58 +0100
committerAndre Weissflog <floooh@gmail.com>2025-12-07 15:16:58 +0100
commit4677f4050e5fa5044e8e06928675a3e3d3bf763f (patch)
tree0f56cb0ef2d2dadb53a32c254bac57daeb4fa661
parentcdec67435de7357268b2c1d4cbaf61cff0e9757e (diff)
sokol_gfx.h: protect sg_setup and sg_shutdown from being called twice (fixes #1378)
-rw-r--r--sokol_gfx.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/sokol_gfx.h b/sokol_gfx.h
index 18d0692c..b78e6999 100644
--- a/sokol_gfx.h
+++ b/sokol_gfx.h
@@ -24553,6 +24553,7 @@ _SOKOL_PRIVATE void _sg_override_portable_limits(void) {
//
// >>public
SOKOL_API_IMPL void sg_setup(const sg_desc* desc) {
+ SOKOL_ASSERT(!_sg.valid);
SOKOL_ASSERT(desc);
SOKOL_ASSERT((desc->_start_canary == 0) && (desc->_end_canary == 0));
SOKOL_ASSERT((desc->allocator.alloc_fn && desc->allocator.free_fn) || (!desc->allocator.alloc_fn && !desc->allocator.free_fn));
@@ -24568,6 +24569,7 @@ SOKOL_API_IMPL void sg_setup(const sg_desc* desc) {
}
SOKOL_API_IMPL void sg_shutdown(void) {
+ SOKOL_ASSERT(_sg.valid);
_sg_discard_all_resources();
_sg_discard_backend();
_sg_discard_commit_listeners();