mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-31 12:13:16 +00:00
Flush 2D on level memory purge
This commit is contained in:
parent
23b4b83c7c
commit
b7aa8c2464
1 changed files with 8 additions and 0 deletions
|
|
@ -8434,6 +8434,14 @@ void P_FreeLevelState(void)
|
|||
HWR_ClearAllTextures();
|
||||
#endif
|
||||
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
// Queued draws might reference patches or colormaps about to be freed.
|
||||
// Flush 2D to make sure no read-after-free occurs.
|
||||
srb2::rhi::Rhi* rhi = srb2::sys::get_rhi(srb2::sys::g_current_rhi);
|
||||
srb2::sys::main_hardware_state()->twodee_renderer->flush(*rhi, srb2::g_2d);
|
||||
}
|
||||
|
||||
G_FreeGhosts(); // ghosts are allocated with PU_LEVEL
|
||||
Patch_FreeTag(PU_PATCH_LOWPRIORITY);
|
||||
Patch_FreeTag(PU_PATCH_ROTATED);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue