tweek flush and replace exception with error log
This commit is contained in:
@@ -253,6 +253,8 @@ public class VoxyRenderSystem {
|
||||
try {this.renderer.shutdown();this.chunkBoundRenderer.free();} catch (Exception e) {Logger.error("Error shutting down renderer", e);}
|
||||
Logger.info("Shutting down post processor");
|
||||
if (this.postProcessing!=null){try {this.postProcessing.shutdown();} catch (Exception e) {Logger.error("Error shutting down post processor", e);}}
|
||||
Logger.info("Flushing download stream");
|
||||
DownloadStream.INSTANCE.flushWaitClear();
|
||||
|
||||
//Release hold on the world
|
||||
this.worldIn.releaseRef();
|
||||
|
||||
@@ -12,6 +12,7 @@ import me.cortex.voxy.client.core.rendering.building.RenderGenerationService;
|
||||
import me.cortex.voxy.client.core.rendering.util.DownloadStream;
|
||||
import me.cortex.voxy.client.core.rendering.util.PrintfDebugUtil;
|
||||
import me.cortex.voxy.client.core.rendering.util.UploadStream;
|
||||
import me.cortex.voxy.common.Logger;
|
||||
import me.cortex.voxy.common.util.MemoryBuffer;
|
||||
import me.cortex.voxy.common.world.WorldEngine;
|
||||
import org.lwjgl.system.MemoryUtil;
|
||||
@@ -320,7 +321,8 @@ public class HierarchicalOcclusionTraverser {
|
||||
private void forwardDownloadResult(long ptr, long size) {
|
||||
int count = MemoryUtil.memGetInt(ptr);ptr += 8;//its 8 since we need to skip the second value (which is empty)
|
||||
if (count < 0 || count > 50000) {
|
||||
throw new IllegalStateException("Count unexpected extreme value: " + count);
|
||||
Logger.error(new IllegalStateException("Count unexpected extreme value: " + count));
|
||||
return;
|
||||
}
|
||||
if (count > (this.requestBuffer.size()>>3)-1) {
|
||||
//This should not break the synchonization between gpu and cpu as in the traversal shader is
|
||||
|
||||
@@ -149,6 +149,21 @@ public class DownloadStream {
|
||||
}
|
||||
|
||||
//Synchonize force flushes everything
|
||||
public void waitDiscard() {
|
||||
glFinish();
|
||||
var fence = new GlFence();
|
||||
glFinish();
|
||||
while (!fence.signaled())
|
||||
Thread.onSpinWait();
|
||||
fence.free();
|
||||
while (!this.frames.isEmpty()) {
|
||||
var frame = this.frames.pop();
|
||||
while (!frame.fence.signaled()) Thread.onSpinWait();
|
||||
frame.allocations.forEach(this.allocationArena::free);
|
||||
frame.fence.free();
|
||||
}
|
||||
}
|
||||
|
||||
public void flushWaitClear() {
|
||||
glFinish();
|
||||
this.tick();
|
||||
|
||||
Reference in New Issue
Block a user