Add a try/catch and disable Renderer on error
Rendering exceptions usually happens every frame, which cause a lot of spam. So I added a try/catch and a bool to check if Renderer has encountered an error, in which the Renderer will be disabled until the game restarts. (This could probibly be changed)
This commit is contained in:
@@ -61,6 +61,7 @@ public class ClientApi
|
||||
private boolean firstTimeSetupComplete = false;
|
||||
private boolean configOverrideReminderPrinted = false;
|
||||
|
||||
private boolean rendererDisabledBecauseOfExceptions = false;
|
||||
|
||||
|
||||
private ClientApi()
|
||||
@@ -112,9 +113,17 @@ public class ClientApi
|
||||
profiler.pop(); // get out of "terrain"
|
||||
profiler.push("LOD");
|
||||
|
||||
|
||||
ClientApi.renderer.drawLODs(lodDim, mcModelViewMatrix, mcProjectionMatrix, partialTicks, MC.getProfiler());
|
||||
|
||||
if (!rendererDisabledBecauseOfExceptions) {
|
||||
try {
|
||||
ClientApi.renderer.drawLODs(lodDim, mcModelViewMatrix, mcProjectionMatrix, partialTicks, MC.getProfiler());
|
||||
} catch (RuntimeException e) {
|
||||
rendererDisabledBecauseOfExceptions = true;
|
||||
try {
|
||||
//ClientApi.renderer.ma ();
|
||||
} catch (RuntimeException welpLookLikeWeWillLeakResource) {}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
profiler.pop(); // end LOD
|
||||
profiler.push("terrain"); // go back into "terrain"
|
||||
}
|
||||
@@ -173,6 +182,8 @@ public class ClientApi
|
||||
// Lod maintenance //
|
||||
//=================//
|
||||
|
||||
// FIXME: I need a onLastFrameCleanup() callback in Render Thread... Which calls renderer.cleanup()
|
||||
|
||||
/** This event is called once during the first frame Minecraft renders in the world. */
|
||||
public void firstFrameSetup()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user