Skip to content

Conversation

CrushedPixel
Copy link

@CrushedPixel CrushedPixel commented Jun 26, 2025

Checklist

  • cargo clippy reports no issues
  • cargo doc reports no issues
  • cargo deny issues have been fixed or added to deny.toml
  • human-readable change descriptions added to the changelog under the "Unreleased" heading.
    • If the change does not affect the user (or is a process change), preface the change with "Internal:"
    • Add credit to yourself for each change: Added new functionality @githubname.

Description

Previously, render_draw_list assumed all draw commands were contiguous in the index buffer and manually tracked a running index offset. This worked for older ImGui versions but breaks in version 1.86+, which relies on explicit idx_offset and vtx_offset values for correct layering, for example for modals and overlays.

@ocornut explains here why this breaks in 1.86+:
ocornut/imgui#4863 (comment)

This PR updates render_draw_list to use the provided offsets from ImDrawCmdParams, ensuring draw calls reference the correct index range regardless of command order.

This fixes a bug where fullscreen overlays (e.g. the ImGuiFileDialog modal overlay) were drawn in front of modal windows due to incorrect command ordering.

Old:
Screenshot 2025-06-26 at 22 55 40
New:
Screenshot 2025-06-26 at 22 50 52

In case you are interested in trying this, I have updated bindings to ImGuiFileDialog in my fork: https://github.com/CrushedPixel/imgui-filedialog-rs

Previously, render_draw_list assumed all draw commands were contiguous in the index buffer
and manually tracked a running index offset. This worked for older ImGui versions but breaks
in version 1.86+, which relies on explicit idx_offset and vtx_offset values for correct
layering, especially for modals and overlays.

This patch updates render_draw_list to use the provided offsets from ImDrawCmdParams,
ensuring draw calls reference the correct index range regardless of command order.

This fixes a bug where fullscreen overlays (e.g. the ImGuiFileDialog modal overlay) were drawn in front
of modal windows due to incorrect command ordering.
@ocornut
Copy link

ocornut commented Jun 26, 2025

Change looks correct to me, but Changelog says “internal” but it does affect the user (in a positive way), maybe should be marked as a bug fix instead.

@jbrd
Copy link
Contributor

jbrd commented Jul 22, 2025

Would it be possible to merge this please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants