From 1a3ad7d701eb6dffb7bc7c581e8c229658214ba1 Mon Sep 17 00:00:00 2001 From: mcrcortex <18544518+MCRcortex@users.noreply.github.com> Date: Wed, 25 Dec 2024 11:59:00 +1000 Subject: [PATCH] Support other depth types --- .../cortex/voxy/client/core/rendering/util/HiZBuffer.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/cortex/voxy/client/core/rendering/util/HiZBuffer.java b/src/main/java/me/cortex/voxy/client/core/rendering/util/HiZBuffer.java index 43774425..5c2897f1 100644 --- a/src/main/java/me/cortex/voxy/client/core/rendering/util/HiZBuffer.java +++ b/src/main/java/me/cortex/voxy/client/core/rendering/util/HiZBuffer.java @@ -27,13 +27,18 @@ public class HiZBuffer { .name("HiZ Builder"); private final GlFramebuffer fb = new GlFramebuffer().name("HiZ"); private final int sampler = glGenSamplers(); + private final int type; private GlTexture texture; private int levels; private int width; private int height; public HiZBuffer() { + this(GL_DEPTH24_STENCIL8); + } + public HiZBuffer(int type) { glNamedFramebufferDrawBuffer(this.fb.id, GL_NONE); + this.type = type; } private void alloc(int width, int height) { @@ -43,7 +48,7 @@ public class HiZBuffer { // (could probably increase it to be defined by a max meshlet coverage computation thing) //GL_DEPTH_COMPONENT32F //Cant use this as it does not match the depth format of the provided depth buffer - this.texture = new GlTexture().store(GL_DEPTH24_STENCIL8, this.levels, width, height).name("HiZ"); + this.texture = new GlTexture().store(this.type, this.levels, width, height).name("HiZ"); glTextureParameteri(this.texture.id, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTextureParameteri(this.texture.id, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTextureParameteri(this.texture.id, GL_TEXTURE_COMPARE_MODE, GL_NONE);