Potentially fix memory leaks when rendering is disabled

This commit is contained in:
James Seibel
2024-05-27 17:37:52 -05:00
parent 8c91a84795
commit 3cf385c2a2
2 changed files with 11 additions and 8 deletions
@@ -609,6 +609,17 @@ public class ClientApi
}
finally
{
try
{
// these tasks always need to be called, regardless of whether the renderer is enabled or not to prevent memory leaks
GLProxy.getInstance().runRenderThreadTasks();
}
catch (Exception e)
{
LOGGER.error("Unexpected issue running render thread tasks.", e);
}
profiler.pop(); // end LOD
profiler.push("terrain"); // go back into "terrain"
}
@@ -477,14 +477,6 @@ public class LodRenderer
LagSpikeCatcher drawCleanup = new LagSpikeCatcher();
ApiEventInjector.INSTANCE.fireAllEvents(DhApiBeforeRenderCleanupEvent.class, renderEventParam);
// GLProxy tasks should be run after all rendering has been done
boolean afterEnabledDeferredPass = deferTransparentRendering && !renderingFirstPass;
boolean afterOnlyRenderingPass = !deferTransparentRendering && renderingFirstPass;
if (afterEnabledDeferredPass || afterOnlyRenderingPass)
{
GLProxy.getInstance().runRenderThreadTasks();
}
lightmap.unbind();
if (ENABLE_IBO)
{