-
-
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
Examples: Metal: Restore state after UserCallback #2452
Conversation
In other backends it is possible for the UserCallback to read the current state, do whatever state changes it needs, and then restore the imgui state. In Metal there doesn't seem to be a way for a UserCallback to save the existing state before changing it so we should restore our state after the UserCallback is complete.
Hello, This is not desirable. See #2037 to see why. It won't be merged as-is, we can keep this PR open as a reminder that a solution is needed for that problem. |
Okay, after reading those threads it makes sense not to blindly reset the state. I really like the idea of being able to AddCallback(ImDrawCallback_ResetState). |
Hello @bear24rw, See the work done in the branch mentioned here: Would you be able to provide a commit to do the same in the Metal back-end, following the overall structure, comments and naming convention used by the other back-ends? (You can push the commit in a fork of that new branch or an isolated patch and I'll cherry-pick it from there) Thank you! |
@ocornut , I have pushed a branch here: https://github.com/bear24rw/imgui/tree/features/drawcallback_reset_render_state_metal Specific commit: |
Thank you Max! I have merged this commit in the feature branch. I'll wait for some extra feedback about this feedback and want to see if the other discussion (override the texture binding) would have any effect that is best bundled with the same update, but overall this is looking good to me. |
Closing this as the discussion is moved to #2037, thanks again! |
Branch has been merged in now. |
In other backends it is possible for the UserCallback to read the current state, do whatever state changes it needs, and then restore the imgui state before returning. In Metal there doesn't seem to be a way for a UserCallback to save the existing state before changing it so we should restore our state after the UserCallback is complete.