Proposal: Optional zero-cost ImDrawList hooks for vector / alternative backends #9556

Open
opened 2026-09-24 21:05:00 +00:00 by hotredman · 2 comments
hotredman commented 2026-09-24 21:05:00 +00:00 (Migrated from github.com)

Hi,
I built a vector backend for Dear ImGui using ThorVG:
https://github.com/hotredman/imthorgui
To render true vector shapes, I need to intercept primitives (AddRectFilled, AddText, etc.) at the ImDrawList level.
I added minimal hook macros in imgui_draw.cpp (zero runtime overhead when disabled, following the IMGUI_ENABLE_TEST_ENGINE pattern).
Only 2 small commits in my fork:
https://github.com/hotredman/imgui/commits/drawlist-hooks
Would you be open to a clean PR adding these optional hooks upstream?

Hi, I built a vector backend for Dear ImGui using ThorVG: https://github.com/hotredman/imthorgui To render true vector shapes, I need to intercept primitives (`AddRectFilled`, `AddText`, etc.) at the `ImDrawList` level. I added minimal hook macros in `imgui_draw.cpp` (zero runtime overhead when disabled, following the `IMGUI_ENABLE_TEST_ENGINE` pattern). Only 2 small commits in my fork: https://github.com/hotredman/imgui/commits/drawlist-hooks Would you be open to a clean PR adding these optional hooks upstream?
ocornut commented 2026-09-25 09:55:10 +00:00 (Migrated from github.com)

I'm generally supportive of those efforts but I feel the hooks could be added on your side for a while.
If there's a proven lasting interest in the feature and your solution we can consider adding the hooks but for now they seem pretty simple to add on your side?

May I ask - wouldn't it simpler to add a define to remove the ImDrawList implementation, and let you compile with your own?

I'm generally supportive of those efforts but I feel the hooks could be added on your side for a while. If there's a proven lasting interest in the feature and your solution we can consider adding the hooks but for now they seem pretty simple to add on your side? May I ask - wouldn't it simpler to add a define to remove the `ImDrawList` implementation, and let you compile with your own?
ocornut commented 2026-09-25 09:55:10 +00:00 (Migrated from github.com)

I'm generally supportive of those efforts but I feel the hooks could be added on your side for a while.
If there's a proven lasting interest in the feature and your solution we can consider adding the hooks but for now they seem pretty simple to add on your side?

May I ask - wouldn't it simpler to add a define to remove the ImDrawList implementation, and let you compile with your own?

I'm generally supportive of those efforts but I feel the hooks could be added on your side for a while. If there's a proven lasting interest in the feature and your solution we can consider adding the hooks but for now they seem pretty simple to add on your side? May I ask - wouldn't it simpler to add a define to remove the `ImDrawList` implementation, and let you compile with your own?
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#9556
No description provided.