This commit is contained in:
mcrcortex
2025-04-14 14:46:14 +10:00
parent 1121b5e6dd
commit 523cb55889
2 changed files with 4 additions and 0 deletions

View File

@@ -105,10 +105,12 @@ public class DownloadStream {
public void commit() { public void commit() {
glMemoryBarrier(GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT | GL_BUFFER_UPDATE_BARRIER_BIT);
//Copies all the data from target buffers into the download stream //Copies all the data from target buffers into the download stream
for (var entry : this.downloadList) { for (var entry : this.downloadList) {
glCopyNamedBufferSubData(entry.target.id, this.downloadBuffer.id, entry.targetOffset, entry.downloadStreamOffset, entry.size); glCopyNamedBufferSubData(entry.target.id, this.downloadBuffer.id, entry.targetOffset, entry.downloadStreamOffset, entry.size);
} }
glMemoryBarrier(GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT | GL_BUFFER_UPDATE_BARRIER_BIT);
this.thisFrameDownloadList.addAll(this.downloadList); this.thisFrameDownloadList.addAll(this.downloadList);
this.downloadList.clear(); this.downloadList.clear();

View File

@@ -17,6 +17,7 @@ import static org.lwjgl.opengl.GL11.glFinish;
import static org.lwjgl.opengl.GL42.glMemoryBarrier; import static org.lwjgl.opengl.GL42.glMemoryBarrier;
import static org.lwjgl.opengl.GL42C.GL_BUFFER_UPDATE_BARRIER_BIT; import static org.lwjgl.opengl.GL42C.GL_BUFFER_UPDATE_BARRIER_BIT;
import static org.lwjgl.opengl.GL43.GL_SHADER_STORAGE_BARRIER_BIT; import static org.lwjgl.opengl.GL43.GL_SHADER_STORAGE_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.GL_MAP_COHERENT_BIT;
public class UploadStream { public class UploadStream {
@@ -79,6 +80,7 @@ public class UploadStream {
public void commit() { public void commit() {
glMemoryBarrier(GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT);
//Execute all the copies //Execute all the copies
for (var entry : this.uploadList) { for (var entry : this.uploadList) {
glCopyNamedBufferSubData(this.uploadBuffer.id, entry.target.id, entry.uploadOffset, entry.targetOffset, entry.size); glCopyNamedBufferSubData(this.uploadBuffer.id, entry.target.id, entry.uploadOffset, entry.targetOffset, entry.size);