Backends: Allegro: Brough back al_draw_indexed_prim.#5937
Backends: Allegro: Brough back al_draw_indexed_prim.#5937Espyo wants to merge 3 commits intoocornut:masterfrom
Conversation
This reverts commit 51123e3.
- That function got fixed in Allegro 5.2. - However, it crashes if it receives 0 as the num_vtx argument. Since in those cases there seems to be nothing to draw anyway, I just made it skip. - A lot of this code came from working back what commit 185b4dd did.
|
Hello, cheers, |
|
Why did you add the |
|
Regarding the check Using ImGui::OpenPopup("some dialog");
if(ImGui::BeginPopupModal("some dialog", &is_open)) {
node_is_open = ImGui::TreeNode("asda");
if(node_is_open) {
ImGui::TreePop();
}
ImGui::EndPopup();
}So right now, with Dear ImGui >= a5f3596 and Allegro >= 5.2.5, the program will crash whenever the user creates a modal with a TreeNode inside, because Dear ImGui is sending Allegro a Would it make sense to continue investigating this |
|
Very interesting! I’ll investigate that, from my pov it seems like a bug in core dear imgui but it is interesting that no other backends got affected by that. Will fix one way or another soon :) |
|
Awesome! I've tested a bunch and I can't get any crash at all. Looks like everything is fine now. Thanks! |
Context:
Some time back, Allegro's DirectX implementation of al_draw_indexed_prim broke. This originated commit 185b4dd in Dear ImGui. Some time later though, version 5.2.5 (February 2019) of Allegro ended up fixing this problem.
My changes:
I brought back the indexed primitive logic from that Dear ImGui commit, and updated it to today's code. Not only is this more optimized since it makes use of indexing, but it also removes an annoying compilation warning
("variable ‘indices’ set but not used [-Wunused-but-set-variable]")consideringindicesis no longer unused. One thing to note: al_draw_indexed_prim doesn't seem to like it when the num_vtx argument is 0, which Dear ImGui sometimes does. I figured if'ing that case and skipping was the best solution.I admit I'm not 100% familiar with how that code works, but I'm confident enough to submit this PR. Basically, only the latest commit matters. But if this PR ends up being an unwanted change for some reason, then I instead propose using the first commit of the branch, which just removes the unused bit of code with the
indicesvariable. Functionally, it's the same as before my PR, but with fewer compilation warnings. (That commit was made some hours ago before I realized Allegro had fixed the problem, and that I should probably try my hand at updating the backend. Oops.)Testing:
I've tried running the Dear ImGui demo with my PR's branch and found absolutely no problems. Tested on my Lubuntu machine, tested DirectX on a dinky Windows 7 virtual machine, and tested OpenGL and DirectX on a Windows 10 64-bit machine.