diff --git a/src/main/java/me/cortex/voxy/client/core/rendering/Viewport.java b/src/main/java/me/cortex/voxy/client/core/rendering/Viewport.java index 42c140cc..35f1b4bf 100644 --- a/src/main/java/me/cortex/voxy/client/core/rendering/Viewport.java +++ b/src/main/java/me/cortex/voxy/client/core/rendering/Viewport.java @@ -111,7 +111,9 @@ public abstract class Viewport > { (float) (this.cameraY-(sy<<5)), (float) (this.cameraZ-(sz<<5))); - this.depthBoundingBuffer.resize(this.width, this.height); + if (this.depthBoundingBuffer.resize(this.width, this.height)) { + this.depthBoundingBuffer.clear(0.0f); + } return (A) this; } diff --git a/src/main/java/me/cortex/voxy/client/core/rendering/section/geometry/BasicSectionGeometryData.java b/src/main/java/me/cortex/voxy/client/core/rendering/section/geometry/BasicSectionGeometryData.java index 457ca77a..d427d7b5 100644 --- a/src/main/java/me/cortex/voxy/client/core/rendering/section/geometry/BasicSectionGeometryData.java +++ b/src/main/java/me/cortex/voxy/client/core/rendering/section/geometry/BasicSectionGeometryData.java @@ -34,12 +34,12 @@ public class BasicSectionGeometryData implements IGeometryData { Logger.info("if your game crashes/exits here without any other log message, try manually decreasing the geometry capacity"); glGetError();//Clear any errors GlBuffer buffer = null; - if (!(Capabilities.INSTANCE.isNvidia && ThreadUtils.isWindows)) { + if (!(Capabilities.INSTANCE.isNvidia)) {// && ThreadUtils.isWindows buffer = new GlBuffer(geometryCapacity, false);//Only do this if we are not on nvidia //TODO: FIXME: TEST, see if the issue is that we are trying to zero the entire buffer, try only zeroing increments // or dont zero it at all } else { - Logger.info("Running on windows nvidia, using workaround sparse buffer allocation"); + Logger.info("Running on nvidia, using workaround sparse buffer allocation"); } int error = glGetError(); if (error != GL_NO_ERROR || buffer == null) { @@ -116,6 +116,9 @@ public class BasicSectionGeometryData implements IGeometryData { glFinish(); if (Capabilities.INSTANCE.canQueryGpuMemory) { long releaseSize = (long) (this.geometryBuffer.size()*0.75);//if gpu memory usage drops by 75% of the expected value assume we freed it + if (this.geometryBuffer.isSparse()) {//If we are using sparse buffers, use the commited size instead + releaseSize = (long)(this.sparseCommitment*0.75); + } if (Capabilities.INSTANCE.getFreeDedicatedGpuMemory()-gpuMemory<=releaseSize) { Logger.info("Attempting to wait for gpu memory to release"); long start = System.currentTimeMillis(); diff --git a/src/main/java/me/cortex/voxy/client/core/rendering/util/DepthFramebuffer.java b/src/main/java/me/cortex/voxy/client/core/rendering/util/DepthFramebuffer.java index bfba4b98..6e189d66 100644 --- a/src/main/java/me/cortex/voxy/client/core/rendering/util/DepthFramebuffer.java +++ b/src/main/java/me/cortex/voxy/client/core/rendering/util/DepthFramebuffer.java @@ -22,14 +22,16 @@ public class DepthFramebuffer { this.depthType = depthType; } - public void resize(int width, int height) { + public boolean resize(int width, int height) { if (this.depthBuffer == null || this.depthBuffer.getWidth() != width || this.depthBuffer.getHeight() != height) { if (this.depthBuffer != null) { this.depthBuffer.free(); } this.depthBuffer = new GlTexture().store(this.depthType, 1, width, height); this.framebuffer.bind(this.depthType == GL_DEPTH24_STENCIL8?GL_DEPTH_STENCIL_ATTACHMENT: GL_DEPTH_ATTACHMENT, this.depthBuffer).verify(); + return true; } + return false; } public void clear() {