random things (tinker with barriers :ohno:)
This commit is contained in:
@@ -71,7 +71,7 @@ public class ChunkBoundRenderer {
|
||||
public void render(Viewport<?> viewport) {
|
||||
if (!this.remQueue.isEmpty()) {
|
||||
boolean wasEmpty = this.chunk2idx.isEmpty();
|
||||
this.remQueue.forEach(this::_remPos);
|
||||
this.remQueue.forEach(this::_remPos);//TODO: REPLACE WITH SCATTER COMPUTE
|
||||
this.remQueue.clear();
|
||||
if (this.chunk2idx.isEmpty()&&!wasEmpty) {//When going from stuff to nothing need to clear the depth buffer
|
||||
glClearNamedFramebufferfv(this.frameBuffer.id, GL_DEPTH, 0, new float[]{0});
|
||||
@@ -148,7 +148,7 @@ public class ChunkBoundRenderer {
|
||||
|
||||
|
||||
if (!this.addQueue.isEmpty()) {
|
||||
this.addQueue.forEach(this::_addPos);
|
||||
this.addQueue.forEach(this::_addPos);//TODO: REPLACE WITH SCATTER COMPUTE
|
||||
this.addQueue.clear();
|
||||
UploadStream.INSTANCE.commit();
|
||||
}
|
||||
|
||||
@@ -14,13 +14,12 @@ import java.util.Deque;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static me.cortex.voxy.common.util.AllocationArena.SIZE_LIMIT;
|
||||
import static org.lwjgl.opengl.ARBDirectStateAccess.glCopyNamedBufferSubData;
|
||||
import static org.lwjgl.opengl.ARBMapBufferRange.*;
|
||||
import static org.lwjgl.opengl.GL11.glFinish;
|
||||
import static org.lwjgl.opengl.GL30C.GL_MAP_READ_BIT;
|
||||
import static org.lwjgl.opengl.GL42.GL_BUFFER_UPDATE_BARRIER_BIT;
|
||||
import static org.lwjgl.opengl.GL42.glMemoryBarrier;
|
||||
import static org.lwjgl.opengl.GL42C.GL_BUFFER_UPDATE_BARRIER_BIT;
|
||||
import static org.lwjgl.opengl.GL44.GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT;
|
||||
import static org.lwjgl.opengl.GL44.GL_MAP_COHERENT_BIT;
|
||||
import static org.lwjgl.opengl.GL44.*;
|
||||
import static org.lwjgl.opengl.GL45.glCopyNamedBufferSubData;
|
||||
|
||||
public class DownloadStream {
|
||||
public interface DownloadResultConsumer {
|
||||
@@ -36,7 +35,7 @@ public class DownloadStream {
|
||||
private final ArrayList<DownloadData> thisFrameDownloadList = new ArrayList<>();
|
||||
|
||||
public DownloadStream(long size) {
|
||||
this.downloadBuffer = new GlPersistentMappedBuffer(size, GL_MAP_READ_BIT|GL_MAP_COHERENT_BIT);
|
||||
this.downloadBuffer = new GlPersistentMappedBuffer(size, GL_MAP_READ_BIT);//|GL_MAP_COHERENT_BIT
|
||||
this.allocationArena.setLimit(size);
|
||||
}
|
||||
|
||||
@@ -108,7 +107,7 @@ public class DownloadStream {
|
||||
if (this.downloadList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
glMemoryBarrier(GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT | GL_BUFFER_UPDATE_BARRIER_BIT);
|
||||
glMemoryBarrier(GL_BUFFER_UPDATE_BARRIER_BIT);
|
||||
//Copies all the data from target buffers into the download stream
|
||||
for (var entry : this.downloadList) {
|
||||
glCopyNamedBufferSubData(entry.target.id, this.downloadBuffer.id, entry.targetOffset, entry.downloadStreamOffset, entry.size);
|
||||
|
||||
@@ -30,8 +30,10 @@ public class UploadStream {
|
||||
private final LongArrayList thisFrameAllocations = new LongArrayList();
|
||||
private final Deque<UploadData> uploadList = new ArrayDeque<>();
|
||||
|
||||
private static final boolean USE_COHERENT = true;
|
||||
|
||||
public UploadStream(long size) {
|
||||
this.uploadBuffer = new GlPersistentMappedBuffer(size,GL_MAP_WRITE_BIT|GL_MAP_UNSYNCHRONIZED_BIT|GL_MAP_COHERENT_BIT).name("UploadStream");
|
||||
this.uploadBuffer = new GlPersistentMappedBuffer(size,GL_MAP_WRITE_BIT|GL_MAP_UNSYNCHRONIZED_BIT|(USE_COHERENT?GL_MAP_COHERENT_BIT:0)).name("UploadStream");
|
||||
this.allocationArena.setLimit(size);
|
||||
}
|
||||
|
||||
@@ -102,7 +104,7 @@ public class UploadStream {
|
||||
if (this.uploadList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT|GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT|GL_BUFFER_UPDATE_BARRIER_BIT);
|
||||
glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT|GL_BUFFER_UPDATE_BARRIER_BIT|(USE_COHERENT?0:GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT));
|
||||
//Execute all the copies
|
||||
for (var entry : this.uploadList) {
|
||||
glCopyNamedBufferSubData(this.uploadBuffer.id, entry.target.id, entry.uploadOffset, entry.targetOffset, entry.size);
|
||||
|
||||
Reference in New Issue
Block a user