Skip to content

LatteBufferCache: fix interval lookups after range splits#1871

Open
oltolm wants to merge 1 commit intocemu-project:mainfrom
oltolm:devils_third_coruption_fix
Open

LatteBufferCache: fix interval lookups after range splits#1871
oltolm wants to merge 1 commit intocemu-project:mainfrom
oltolm:devils_third_coruption_fix

Conversation

@oltolm
Copy link
Copy Markdown
Contributor

@oltolm oltolm commented Apr 12, 2026

In Devil's Third I had image corruption. I fixed it with the help of Copilot. I don't know why other people haven't reported it. Maybe because I am using latest version from main and I have a Radeon RX 580. The corruption was a heavy flicker that occurred with both OpenGL and Vulkan.

Screenshot 2026-04-12 125316

IntervalTree2 used std::map::find() for overlap-based queries, which can miss a valid covering node after range splits or resizes. Switch these lookups to a lower_bound-based first-overlap search so reserve and retrieve paths always find the correct cache range.

Also keep the original heap allocation offset separate from the visible cache offset and update page metadata correctly when shrinking a node. That keeps frees and deferred releases aligned with the underlying allocation and avoids stale page state after front trims.

IntervalTree2 used std::map::find() for overlap-based queries, which can miss a valid covering node after range splits or resizes. Switch these lookups to a lower_bound-based first-overlap search so reserve and retrieve paths always find the correct cache range.

Also keep the original heap allocation offset separate from the visible cache offset and update page metadata correctly when shrinking a node. That keeps frees and deferred releases aligned with the underlying allocation and avoids stale page state after front trims.
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.

1 participant