-
Notifications
You must be signed in to change notification settings - Fork 527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[sokol_imgui] Manage ImDrawCallback_ResetRenderState #1000
Comments
Hmm, even after reading the description I'm not quite sure what's the purpose of the special PS: or maybe it's better to call |
On minor issue: that define isn't exposed in the cimgui.h header, so with a straightforward fix sokol_imgui.h doesn't build in C mode. I'll put a workaround in by using the hardwired constant I wrote a ticket for cimgui, but not sure if this is actually going to be fixed: cimgui/cimgui#261 |
...443c0cb should fix the crash. However: I'm not sure if that makes your use case work, because in general I reset some render state after every user callback, which seems to clash with Dear ImGui's documentation for The other option would be to change the code like this: if (pcmd->UserCallback != ImDrawCallback_ResetRenderState) {
pcmd->UserCallback(cl, pcmd);
} else {
sg_reset_state_cache();
sg_apply_viewport(0, 0, fb_width, fb_height, true);
sg_apply_pipeline(_simgui.def_pip);
sg_apply_uniforms(SG_SHADERSTAGE_VS, 0, SG_RANGE_REF(vs_params));
sg_apply_bindings(&bind);
} ...which I guess is more inline with Dear ImGui's intentions, but would require to change the imgui-usercallback-sapp.c sample to issue an additional If the fix doesn't work for you, please open this issue again, or if you feel like it provide a PR. |
I am trying to use https://github.com/andyborrell/imgui_tex_inspect using sokol as backend.
internally it makes a call of the type:
ImGui::GetWindowDrawList()->AddCallback(ImDrawCallback_ResetRenderState, nullptr);
which is defined in "imgui.h" as:
This causes an access violation in sokol_imgui.
The backends delivered with imgui use this type of construction:
The text was updated successfully, but these errors were encountered: