Skip to content

Commit 082152c

Browse files
authored
Merge pull request #1515 from floooh/issue1514/imgui_deprecated_resetrenderstate
sokol_imgui.h: workaround ImDrawCallback_ResetRenderState deprecation
2 parents 2ef8487 + 0e647ff commit 082152c

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
## Updates
22

3+
### 21-May-2026
4+
5+
- sokol_imgui.h: fix for removal of the deprecated `ImDrawCallback_ResetRenderState`
6+
magic value (only an issue when building with `IMGUI_DISABLE_OBSOLETE_FUNCTIONS`).
7+
8+
Original issue which introduced the magic value check: https://github.com/floooh/sokol/issues/1000
9+
New issue with the breakage report: https://github.com/floooh/sokol/issues/1514
10+
Fix PR: https://github.com/floooh/sokol/pull/1515
11+
312
### 11-May-2026
413

514
- A new header `sokol_framebuffer.h` has been added which provides a 'CPU framebuffer'

util/sokol_imgui.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2812,8 +2812,10 @@ SOKOL_API_IMPL void simgui_render(void) {
28122812
ImDrawCmd* pcmd = &cl->CmdBuffer.Data[cmd_index];
28132813
if (pcmd->UserCallback != 0) {
28142814
// User callback, registered via ImDrawList::AddCallback()
2815-
// (ImDrawCallback_ResetRenderState is a special callback value used by the user to request the renderer to reset render state.)
2816-
if (pcmd->UserCallback != ImDrawCallback_ResetRenderState) {
2815+
// NOTE: once the deprecated ImDrawCallback_ResetRenderState define has
2816+
// been completely removed from Dear ImGui the below magic value can be removed too
2817+
const intptr_t deprecated_ImDrawCallback_ResetRenderState_magic_value = (-8);
2818+
if ((intptr_t)pcmd->UserCallback != deprecated_ImDrawCallback_ResetRenderState_magic_value) {
28172819
pcmd->UserCallback(cl, pcmd);
28182820
// need to re-apply all state after calling a user callback
28192821
sg_reset_state_cache();

0 commit comments

Comments
 (0)