-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Metal assertion when opening modal window while running in debug mode - "indexCount(0) must be non-zero" #4857
Comments
Thank you for the detailed report. I don't have access to OSX/Metal but I could easily "reproduce" that issue by adding an assert I'm going to investigate this because we shouldn't be emitting zero-elem draw commands... |
Of course you are right. Adding some test code I can confirm the same happening in the OpenGL3 backend adding the assertion. One interesting point to note I forgot in the initial post: When for debugging I commented out every call inside the Modal, I did not run into this but of course was then stuck in the Modal. Maybe this is also an interesting information. |
…e creation of ImDrawCmd with zero triangles, (#4857)
Pushed a fix 9ad9bd7 on master. |
…e creation of ImDrawCmd with zero triangles, (#4857) (amended)
Reworked as 9aa764c which is simpler and more general and will also merge without conflict. |
So just adding this one line in |
…e creation of ImDrawCmd with zero triangles, (#4857) (2nd amend)
Ok, thank you. This second call now fixed it! Closing and looking forward to the next merge into docking, but for now it is fine with the local change. Thank you very much for this quick reaction! |
Right, thanks! I was writing fuller tests and found this at the same time as you did (docking has other paths). It's quite annoying that I run our full test suite with the check and it works now, but there is the possibility that user manipulation of ImDrawList:: operations can lead to it, so I'm also going to add a test at the backend level too. |
…so RenderDimmedBackgrounds()/RenderMouseCursor() don't need to deal with the side-effects (ocornut#4857, ocornut#4317)
Hello,
I've run into an issue with the Metal backend that I found while trying to debug something completely unrelated in a hobby project of mine. Hope the following information is of enough detail to reproduce, otherwise I'm happy to dig deeper but I so far have no actual experience with Metal UI development experience so have no idea where to start searching the problem myself.
Version/Branch of Dear ImGui:
Version: 1.87 WIP (Git Hash 9c8f288)
Branch: docking
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_metal.mm + imgui_impl_osx.mm (Also occurs with imgui_impl_metal.mm + imgui_impl_glfw.cpp)
Compiler: Xcode 13.2.1 / Apple clang version 13.0.0 (clang-1300.0.29.30)
Operating System: macOS Monterey 12.1 (M1 / arm64)
My Issue:
When opening a modal window while running an imgui app in Debug mode (through Xcode), an assertion in the Metal framework stops the app. This can be simply provoked/reproduced by just opening the example project
examples/example_apple_metal/example_apple_metal.xcodeproj
and running it from Xcode (Product/Run). Then click in the "Dear ImGui Demo" window the following sequence: Popups & Modal windows / Modals / [Delete..] or Stacked Modals... After less than a second the program stops with the following debug output.This comes from
imgui_impl_metal.mm
line 573 wheredrawIndexedPrimitives
is called.I get the same problem in an App of mine that uses the glfw and metal backends. Everything else works good. And if I change
imgui_impl_metal.mm
to skip the loop ifpcmd->ElemCount == 0
the app runs as expected and the modal shows. Updated imgui just the past days (before I was also on docking branch with Git commit 1ad1429, there I was not running into this issue).Can't reproduce this in the master branch. Also no issue on OpenGL3 + glfw which is my main development platform for this hobby project (on Linux).
Standalone, minimal, complete and verifiable example:
As described above, no code change needed after checking out the docking branch:
This can be simply provoked/reproduced by just opening the example project
examples/example_apple_metal/example_apple_metal.xcodeproj
and running it from Xcode (Product/Run). Then click in the "Dear ImGui Demo" window the following sequence: Popups & Modal windows / Modals / [Delete..] or Stacked Modals... After less than a second the program stops with the assertion output listed above.Cheers and thank you for all the hard work on ImGui!
The text was updated successfully, but these errors were encountered: