Fix missing LODs (especially when world gen is active)
This commit is contained in:
@@ -437,13 +437,11 @@ public class LodQuadTree extends QuadTree<LodRenderSection> implements IDebugRen
|
||||
|
||||
if (renderSection.canRender())
|
||||
{
|
||||
if (!renderSection.gpuUploadInProgress())
|
||||
if (renderSection.gpuUploadInProgress()
|
||||
|| !renderSection.uploadRenderDataToGpuAsync())
|
||||
{
|
||||
renderSection.uploadRenderDataToGpuAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
// if a section is already loading we need to wait to trigger it again
|
||||
// if a section is already loading or failed to start upload
|
||||
// we need to wait to trigger it again
|
||||
// if we don't trigger it again the LOD will be out of date
|
||||
// and may be invisible/missing
|
||||
positionsToRequeue.add(pos);
|
||||
|
||||
@@ -118,32 +118,33 @@ public class LodRenderSection implements IDebugRenderable, AutoCloseable
|
||||
// render data generation and uploading //
|
||||
//======================================//
|
||||
|
||||
public synchronized void uploadRenderDataToGpuAsync()
|
||||
/** @return true if the upload started, false if it wasn't able to for any reason */
|
||||
public synchronized boolean uploadRenderDataToGpuAsync()
|
||||
{
|
||||
if (!GLProxy.hasInstance())
|
||||
{
|
||||
// it's possible to try uploading buffers before the GLProxy has been initialized
|
||||
// which would cause the system to crash
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.getAndBuildRenderDataFuture != null)
|
||||
{
|
||||
// don't accidentally queue multiple uploads at the same time
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
PriorityTaskPicker.Executor executor = ThreadPoolUtil.getFileHandlerExecutor();
|
||||
if (executor == null || executor.isTerminated())
|
||||
{
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// don't queue up an infinite number of tasks
|
||||
// doing so will cause memory use to balloon when swapping between dimensions
|
||||
if (executor.getQueueSize() > executor.getPoolSize())
|
||||
{
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
@@ -206,9 +207,14 @@ public class LodRenderSection implements IDebugRenderable, AutoCloseable
|
||||
this.getAndBuildRenderDataFuture = null;
|
||||
}
|
||||
}, executor);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (RejectedExecutionException ignore)
|
||||
{ /* the thread pool was probably shut down because it's size is being changed, just wait a sec and it should be back */ }
|
||||
{
|
||||
/* the thread pool was probably shut down because it's size is being changed, just wait a sec and it should be back */
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@Nullable
|
||||
@MustBeClosed
|
||||
|
||||
Reference in New Issue
Block a user