diff --git a/src/main/java/com/seibel/lod/core/api/ClientApi.java b/src/main/java/com/seibel/lod/core/api/ClientApi.java index 7709bb1c6..e7fc80294 100644 --- a/src/main/java/com/seibel/lod/core/api/ClientApi.java +++ b/src/main/java/com/seibel/lod/core/api/ClientApi.java @@ -145,6 +145,9 @@ public class ClientApi // CONFIG.client().worldGenerator().setDistanceGenerationMode(DistanceGenerationMode.SURFACE); +// CONFIG.client().graphics().advancedGraphics().setGpuUploadMethod(GpuUploadMethod.BUFFER_STORAGE); + + CONFIG.client().advanced().debugging().setDebugKeybindingsEnabled(true); } diff --git a/src/main/java/com/seibel/lod/core/builders/bufferBuilding/LodBufferBuilderFactory.java b/src/main/java/com/seibel/lod/core/builders/bufferBuilding/LodBufferBuilderFactory.java index 72080596d..a019b9dc6 100644 --- a/src/main/java/com/seibel/lod/core/builders/bufferBuilding/LodBufferBuilderFactory.java +++ b/src/main/java/com/seibel/lod/core/builders/bufferBuilding/LodBufferBuilderFactory.java @@ -68,7 +68,7 @@ import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftWrapper; * rendered by the LodRenderer. * * @author James Seibel - * @version 11-13-2021 + * @version 11-21-2021 */ public class LodBufferBuilderFactory { @@ -868,6 +868,11 @@ public class LodBufferBuilderFactory // (uploading into GPU memory directly can only be done // through the glCopyBufferSubData/glCopyNamed... methods) GL45.glCopyNamedBufferSubData(vbo.id, storageBufferId, 0, 0, uploadBuffer.capacity()); + + // alternative way that doesn't require GL45 +// GL15.glBindBuffer(GL45.GL_COPY_WRITE_BUFFER, storageBufferId); +// GL45.glCopyBufferSubData(GL15.GL_ARRAY_BUFFER, GL45.GL_COPY_WRITE_BUFFER, 0, 0, uploadBuffer.capacity()); +// GL15.glBindBuffer(GL45.GL_COPY_WRITE_BUFFER, 0); } } else if (uploadMethod == GpuUploadMethod.BUFFER_MAPPING) @@ -898,6 +903,14 @@ public class LodBufferBuilderFactory vboBuffer.put(uploadBuffer); } } + else if (uploadMethod == GpuUploadMethod.DATA) + { + // hybrid bufferData // + // high stutter, low GPU usage + // But simplest/most compatible + + GL15.glBufferData(GL15.GL_ARRAY_BUFFER, uploadBuffer, GL15.GL_DYNAMIC_DRAW); + } else { // hybrid subData/bufferData // diff --git a/src/main/java/com/seibel/lod/core/enums/config/GpuUploadMethod.java b/src/main/java/com/seibel/lod/core/enums/config/GpuUploadMethod.java index ac103aef1..44e21c1fa 100644 --- a/src/main/java/com/seibel/lod/core/enums/config/GpuUploadMethod.java +++ b/src/main/java/com/seibel/lod/core/enums/config/GpuUploadMethod.java @@ -23,7 +23,7 @@ package com.seibel.lod.core.enums.config; * Buffer_Storage, Sub_Data, Buffer_Mapping * * @author James Seibel - * @version 10-23-2021 + * @version 11-21-2021 */ public enum GpuUploadMethod { @@ -32,6 +32,9 @@ public enum GpuUploadMethod /** Default if OpenGL 4.5 is NOT supported. Fast rendering but may stutter when uploading. */ SUB_DATA, + + /** Fast rendering but will stutter when uploading. */ + DATA, /** May end up storing buffers in System memory. Slower rendering but won't stutter when uploading. */ BUFFER_MAPPING, diff --git a/src/main/java/com/seibel/lod/core/render/GLProxy.java b/src/main/java/com/seibel/lod/core/render/GLProxy.java index f3ef64c8b..0bf20ac1c 100644 --- a/src/main/java/com/seibel/lod/core/render/GLProxy.java +++ b/src/main/java/com/seibel/lod/core/render/GLProxy.java @@ -50,7 +50,7 @@ import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftWrapper; * https://gamedev.stackexchange.com/questions/91995/edit-vbo-data-or-create-a-new-one

* * @author James Seibel - * @version 11-20-2021 + * @version 11-21-2021 */ public class GLProxy { @@ -160,7 +160,7 @@ public class GLProxy // get specific capabilities // TODO re-add buffer storage support - bufferStorageSupported = false; //lodBuilderGlCapabilities.glBufferStorage != 0; + bufferStorageSupported = lodBuilderGlCapabilities.glBufferStorage != 0; mapBufferRangeSupported = lodBuilderGlCapabilities.glMapBufferRange != 0; diff --git a/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/ILodConfigWrapperSingleton.java b/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/ILodConfigWrapperSingleton.java index 1757e5dbb..f2610852f 100644 --- a/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/ILodConfigWrapperSingleton.java +++ b/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/ILodConfigWrapperSingleton.java @@ -42,7 +42,7 @@ import com.seibel.lod.core.util.LodUtil; * the options that should be implemented in a configWrapperSingleton. * * @author James Seibel - * @version 11-16-2021 + * @version 11-21-2021 */ public interface ILodConfigWrapperSingleton { @@ -212,10 +212,12 @@ public interface ILodConfigWrapperSingleton GpuUploadMethod GPU_UPLOAD_METHOD_DEFAULT = GpuUploadMethod.BUFFER_STORAGE; String GPU_UPLOAD_METHOD_DESC = "" - + " What method should be used to upload geometry to the GPU? \n\n" + + " What method should be used to upload geometry to the GPU? \n" + + " Listed in the suggested order of best to worst. \n\n" + "" + " " + GpuUploadMethod.BUFFER_STORAGE + ": Default if OpenGL 4.5 is supported. Fast rendering, no stuttering. \n" + " " + GpuUploadMethod.SUB_DATA + ": Default if OpenGL 4.5 is NOT supported. Fast rendering but may stutter when uploading. \n" + + " " + GpuUploadMethod.DATA + ": Fast rendering but will stutter when uploading. \n" + " " + GpuUploadMethod.BUFFER_MAPPING + ": Slow rendering but won't stutter when uploading. Possibly better than " + GpuUploadMethod.SUB_DATA + " if using a integrated GPU. \n"; public GpuUploadMethod getGpuUploadMethod(); public void setGpuUploadMethod(GpuUploadMethod newDisableVanillaFog);