fix: dxDrawModel3D flickering issue#4784
Open
naouh wants to merge 7 commits intomultitheftauto:release/1.6.0from
Open
fix: dxDrawModel3D flickering issue#4784naouh wants to merge 7 commits intomultitheftauto:release/1.6.0from
naouh wants to merge 7 commits intomultitheftauto:release/1.6.0from
Conversation
1 task
FileEX
requested changes
Apr 9, 2026
…fRefs manipulation
FileEX
requested changes
Apr 10, 2026
…of local function pointers
FileEX
approved these changes
Apr 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix
dxDrawModel3Dflickering when rendering a modelMotivation
Commit
e5e308de1("GTA streamer bug-fix round #1") addedModelAddRef/RemoveRefinsideRenderModel()to protect theRwObjectfrom being GC'd during rendering. The problem is thatRemoveRefdoes more than just decrement a counter, when MTA'sm_dwReferenceshits 0, it callsRemove(), which decrements GTA'susNumberOfRefsand if that also reaches 0, firesRemoveModel()and unloads the model.With
dxDrawModel3D, no persistent MTA-side reference is held, so every single frame:ModelAddRefbumps refs 0 → 1RemoveRefdrops refs 1 → 0 →Remove()→ model unloadedEnqueueModelfails, nothing rendersengineStreamingRequestModelre-requests it, model reloadsHence the flickering every other frame.
The fix replaces
ModelAddRef/RemoveRefwith a direct increment/decrement of GTA'susNumberOfRefs, which still blocks the streaming GC from freeing the model mid-render without triggering MTA's unload logic on release.Test plan
Test with the Maybe v4 resource, objects that were flickering should now render stable.
[DM]Maybe_v4-_Saints_Boulevard.zip
Checklist