-
Notifications
You must be signed in to change notification settings - Fork 5
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
ImGui Support #10
Comments
First attempt: 92c4f73 edithttps://github.com/kassane/sokol-d/actions/runs/7546991889 |
Imgui support in the bindings is currently a bit messy. sokol_imgui.h currently isn't included in the "original" bindings (Zig, Nim, Odin), but was only added by the contributed Rust bindings (but went stale there). One reason (which tbh doesn't make a lot of sense) was that I didn't want to have any sort of external dependency in the bindings, e.g. there couldn't be an imgui example (such an example would need to live in a separate repo). But this also means that any problems in the sokol_imgui.h bindings wouldn't be caught by running the tests (since those just compile the included samples). I guess it does make sense to include sokol_imgui.h in all bindings, even without an integrated sample. Just some sort of braindump from my side ;) |
After rebasing the ImGui branch with wasm support and some fixes. I also tried to use install
+- emcc
+- mrt
+- zig build-lib sokol ReleaseSmall wasm32-emscripten
+- zig build-lib cimgui ReleaseSmall wasm32-emscripten 6 errors
/home/runner/.cache/zig/p/12202af0db41b79a4c7904950269b5e33b7d48f50aae042e334cb8d717a5a2caf48d/imgui.h:84:10: error: 'assert.h' file not found
/home/runner/.cache/zig/p/1220e6183fb9559dbfafe58d7fab20f1c330bee32342205815aa10553134ff9f9302/cimgui.cpp:13:10: note: in file included from /home/runner/.cache/zig/p/1220e6183fb9559dbfafe58d7fab20f1c330bee32342205815aa10553134ff9f9302/cimgui.cpp:13:
/home/runner/.cache/zig/p/12202af0db41b79a4c7904950269b5e33b7d48f50aae042e334cb8d717a5a2caf48d/imgui.h:84:10: error: 'assert.h' file not found
/home/runner/.cache/zig/p/12202af0db41b79a4c7904950269b5e33b7d48f50aae042e334cb8d717a5a2caf48d/imgui_demo.cpp:96:10: note: in file included from /home/runner/.cache/zig/p/12202af0db41b79a4c7904950269b5e33b7d48f50aae042e334cb8d717a5a2caf48d/imgui_demo.cpp:96:
/home/runner/.cache/zig/p/12202af0db41b79a4c7904950269b5e33b7d48f50aae042e334cb8d717a5a2caf48d/imgui.h:84:10: error: 'assert.h' file not found
/home/runner/.cache/zig/p/12202af0db41b79a4c7904950269b5e33b7d48f50aae042e334cb8d717a5a2caf48d/imgui_draw.cpp:33:10: note: in file included from /home/runner/.cache/zig/p/12202af0db41b79a4c7904950269b5e33b7d48f50aae042e334cb8d717a5a2caf48d/imgui_draw.cpp:33:
[...] Edit It may be necessary, try build ImGui using |
updated branch e new issue detected on imgui: zig build run-imgui
/home/kassane/sokol-d/src/examples/imgui.d(25,14): `state` is thread local
imgui: /home/kassane/.cache/zig/p/12202af0db41b79a4c7904950269b5e33b7d48f50aae042e334cb8d717a5a2caf48d/imgui.cpp:9526: void ImGui::ErrorCheckNewFrameSanityChecks(): Assertion `(g.FrameCount == 0 || g.FrameCountEnded == g.FrameCount) && "Forgot to call Render() or EndFrame() at the end of the previous frame?"' failed.
run-imgui
└─ run /home/kassane/sokol-d/zig-out/bin/imgui failure |
Btw, I tinkered a bit with imgui-support in the Rust bindings: Note how I'm adding the sokol_imgui.h header only to the Rust bindings generation. I ignored the I also had to remove the sokol_gfx_imgui.h bindings, because this has a union in the public API, which isn't supported either. Ultimately I didn't get it working, because the Rust imgui bindings ( I'm now also slowly seeing the light at the end of the rabbit hole I'm currently in (floooh/sokol#985) after that hopefully have a bit of time for looking into the bindings before the next 'big thing' (storage buffers). |
Btw 2: I have removed the imgui-stuff in the Rust bindings for now. There was a cimgui git submodule in the examples which caused trouble in the GH Actions jobs (artifacts with git submodules included fail to download in a Windows job). I didn't feel like investigating this and delay the render-pass-cleanup merge. If we add sokol_imgui.h bindings and examples we should do it in a way that works for all bindings. |
WiP - some fixes e0ab669 |
Just the first build gives an error with Lines 74 to 77 in 1d1fc58
|
new commit: 9198de3 broken S3, SOKOL_D3D11, SOKOL_METAL, SOKOL_WGPU or SOKOL_DUMMY_BACKEND!"
#error "Please define one of SOKOL_GLCORE33, SOKOL_GLES3, SOKOL_D3D11, SOKOL_METAL, SOKOL_WGPU or SOKOL_DUMMY_BACKEND!"
^
/home/kassane/sokol-d/src/sokol/c/sokol_imgui.c:9:10: note: in file included from /home/kassane/sokol-d/src/sokol/c/sokol_imgui.c:9:
#include "sokol_imgui.h"
^
/home/kassane/sokol-d/src/sokol/c/sokol_imgui.h:2270:30: error: use of undeclared identifier '_simgui_vs_source_dummy'
shd_desc.vs.source = _simgui_vs_source_dummy; |
Btw the tricky part is to inject a cimgui header search path into the sokol C libary build without adding a dependency to cimgui/Dear ImGui to the sokol-zig package. So the other important half is here in the example project: https://github.com/floooh/sokol-zig-imgui-sample/blob/main/build.zig |
I see. However, the writefiles stepwait breaks my build. |
How to skip IMGUI assert on wasm target? /home/kassane/.cache/zig/p/122072b125179c7cbdbbee8fa81d22a1050a950ad61cfeefee8dc0dca5423b5d05b9/imgui.h:88:10: error: 'assert.h' file not found
#include <assert.h>
^~~~~~~~~~~
/home/kassane/.cache/zig/p/122072b125179c7cbdbbee8fa81d22a1050a950ad61cfeefee8dc0dca5423b5d05b9/imgui_tables.cpp:198:10: note: in file included from /home/kassane/.cache/zig/p/122072b125179c7cbdbbee8fa81d22a1050a950ad61cfeefee8dc0dca5423b5d05b9/imgui_tables.cpp:198:
#include "imgui.h" Add How add
|
There are some Sokol examples to be ported that use ImGui.
Since only
build.zig
is available, zig-pkg will be used to download D packages.sokol-d/build.zig.zon
Lines 4 to 10 in 43d371b
D binding
References
sokol-zig
withsokol_imgui.h
? floooh/sokol-zig#29The text was updated successfully, but these errors were encountered: