Micro improvements
This commit is contained in:
@@ -215,7 +215,7 @@ public class VoxyRenderSystem {
|
|||||||
this.renderDistanceTracker.setCenterAndProcess(cameraX, cameraZ);
|
this.renderDistanceTracker.setCenterAndProcess(cameraX, cameraZ);
|
||||||
|
|
||||||
//Done here as is allows less gl state resetup
|
//Done here as is allows less gl state resetup
|
||||||
this.renderer.tickModelService(Math.max(3_000_000-(System.nanoTime()-startTime), 75_000));
|
this.renderer.tickModelService(Math.max(3_000_000-(System.nanoTime()-startTime), 500_000));
|
||||||
}
|
}
|
||||||
TimingStatistics.postDynamic.stop();
|
TimingStatistics.postDynamic.stop();
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public class ModelBakerySubsystem {
|
|||||||
do {
|
do {
|
||||||
this.factory.addEntry(i);
|
this.factory.addEntry(i);
|
||||||
j++;
|
j++;
|
||||||
if (25<j)//budget<(System.nanoTime() - start)+1000
|
if (24<j)//budget<(System.nanoTime() - start)+1000
|
||||||
break;
|
break;
|
||||||
i = this.blockIdQueue.poll();
|
i = this.blockIdQueue.poll();
|
||||||
} while (i != null);
|
} while (i != null);
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ public class ChunkBoundRenderer {
|
|||||||
if (!this.addQueue.isEmpty()) {
|
if (!this.addQueue.isEmpty()) {
|
||||||
this.addQueue.forEach(this::_addPos);
|
this.addQueue.forEach(this::_addPos);
|
||||||
this.addQueue.clear();
|
this.addQueue.clear();
|
||||||
|
UploadStream.INSTANCE.commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,7 +214,6 @@ public class ChunkBoundRenderer {
|
|||||||
//Need to do it in 2 parts because ivec2 is 2 parts
|
//Need to do it in 2 parts because ivec2 is 2 parts
|
||||||
MemoryUtil.memPutInt(ptr2, (int)(pos&0xFFFFFFFFL)); ptr2 += 4;
|
MemoryUtil.memPutInt(ptr2, (int)(pos&0xFFFFFFFFL)); ptr2 += 4;
|
||||||
MemoryUtil.memPutInt(ptr2, (int)((pos>>>32)&0xFFFFFFFFL));
|
MemoryUtil.memPutInt(ptr2, (int)((pos>>>32)&0xFFFFFFFFL));
|
||||||
UploadStream.INSTANCE.commit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset() {
|
public void reset() {
|
||||||
|
|||||||
@@ -69,6 +69,8 @@ public class AsyncNodeManager {
|
|||||||
private volatile SyncResults resultCache1 = new SyncResults();
|
private volatile SyncResults resultCache1 = new SyncResults();
|
||||||
private volatile SyncResults resultCache2 = new SyncResults();
|
private volatile SyncResults resultCache2 = new SyncResults();
|
||||||
|
|
||||||
|
//Yes. this is stupid. yes. it is a large amount of runtime. Is it profiler bias, probably
|
||||||
|
private ConcurrentLinkedDeque<MemoryBuffer> buffersToFreeQueue = new ConcurrentLinkedDeque<>();
|
||||||
|
|
||||||
|
|
||||||
//locals for during iteration
|
//locals for during iteration
|
||||||
@@ -148,6 +150,14 @@ public class AsyncNodeManager {
|
|||||||
.compile();
|
.compile();
|
||||||
|
|
||||||
private void run() {
|
private void run() {
|
||||||
|
while (true) {
|
||||||
|
var buffer = this.buffersToFreeQueue.poll();
|
||||||
|
if (buffer == null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
buffer.free();
|
||||||
|
}
|
||||||
|
|
||||||
if (this.workCounter.get() == 0) {
|
if (this.workCounter.get() == 0) {
|
||||||
LockSupport.park();
|
LockSupport.park();
|
||||||
if (this.workCounter.get() == 0 || !this.running) {//No work
|
if (this.workCounter.get() == 0 || !this.running) {//No work
|
||||||
@@ -264,7 +274,7 @@ public class AsyncNodeManager {
|
|||||||
|
|
||||||
if (this.workCounter.addAndGet(-workDone) < 0) {
|
if (this.workCounter.addAndGet(-workDone) < 0) {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1);
|
Thread.sleep(500);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
@@ -461,7 +471,8 @@ public class AsyncNodeManager {
|
|||||||
var val = iter.next();
|
var val = iter.next();
|
||||||
var buffer = val.getValue();
|
var buffer = val.getValue();
|
||||||
UploadStream.INSTANCE.upload(store.getGeometryBuffer(), Integer.toUnsignedLong(val.getIntKey()) * 8L, buffer);
|
UploadStream.INSTANCE.upload(store.getGeometryBuffer(), Integer.toUnsignedLong(val.getIntKey()) * 8L, buffer);
|
||||||
buffer.free();//Free the buffer was uploading
|
//Put the queue into the buffer queue to free... yes this is stupid that need todo this...
|
||||||
|
this.buffersToFreeQueue.add(buffer);//buffer.free();//Free the buffer was uploading
|
||||||
}
|
}
|
||||||
UploadStream.INSTANCE.commit();
|
UploadStream.INSTANCE.commit();
|
||||||
}
|
}
|
||||||
@@ -633,6 +644,15 @@ public class AsyncNodeManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.scatterWrite.free();
|
this.scatterWrite.free();
|
||||||
|
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
var buffer = this.buffersToFreeQueue.poll();
|
||||||
|
if (buffer == null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
buffer.free();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Results object, which is to be synced between the render thread and worker thread
|
//Results object, which is to be synced between the render thread and worker thread
|
||||||
|
|||||||
@@ -64,6 +64,8 @@ public class HiZBuffer {
|
|||||||
|
|
||||||
this.width = width;
|
this.width = width;
|
||||||
this.height = height;
|
this.height = height;
|
||||||
|
|
||||||
|
this.fb.bind(GL_DEPTH_ATTACHMENT, this.texture, 0).verify();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buildMipChain(int srcDepthTex, int width, int height) {
|
public void buildMipChain(int srcDepthTex, int width, int height) {
|
||||||
@@ -77,7 +79,6 @@ public class HiZBuffer {
|
|||||||
glBindVertexArray(RenderService.STATIC_VAO);
|
glBindVertexArray(RenderService.STATIC_VAO);
|
||||||
int boundFB = GL11.glGetInteger(GL_DRAW_FRAMEBUFFER_BINDING);
|
int boundFB = GL11.glGetInteger(GL_DRAW_FRAMEBUFFER_BINDING);
|
||||||
this.hiz.bind();
|
this.hiz.bind();
|
||||||
this.fb.bind(GL_DEPTH_ATTACHMENT, this.texture, 0);//.verify();
|
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, this.fb.id);
|
glBindFramebuffer(GL_FRAMEBUFFER, this.fb.id);
|
||||||
|
|
||||||
glDepthFunc(GL_ALWAYS);
|
glDepthFunc(GL_ALWAYS);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ public class MixinWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Force the current thread priority to be realtime
|
//Force the current thread priority to be realtime
|
||||||
|
Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
|
||||||
ThreadUtils.SetSelfThreadPriorityWin32(ThreadUtils.WIN32_THREAD_PRIORITY_TIME_CRITICAL);
|
ThreadUtils.SetSelfThreadPriorityWin32(ThreadUtils.WIN32_THREAD_PRIORITY_TIME_CRITICAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -254,6 +254,9 @@ public class ServiceThreadPool {
|
|||||||
if (this.totalJobWeight.addAndGet(-service.weightPerJob)<0) {
|
if (this.totalJobWeight.addAndGet(-service.weightPerJob)<0) {
|
||||||
throw new IllegalStateException("Total job weight is negative");
|
throw new IllegalStateException("Total job weight is negative");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Sleep for a bit after running a job, yeild the thread
|
||||||
|
Thread.yield();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user