diff --git a/build.gradle b/build.gradle index 5f1a9129..ff07cc7b 100644 --- a/build.gradle +++ b/build.gradle @@ -57,7 +57,7 @@ dependencies { modImplementation("maven.modrinth:cloth-config:13.0.121+fabric") modImplementation("maven.modrinth:modmenu:11.0.1") - modCompileOnly("maven.modrinth:iris:1.7.1+1.21") + modCompileOnly("maven.modrinth:iris:1.7.3+1.21") //modRuntimeOnly("maven.modrinth:iris:1.6.17+1.20.4") modCompileOnly("maven.modrinth:starlight:1.1.3+1.20.4") //modCompileOnly("maven.modrinth:immersiveportals:v5.1.7-mc1.20.4") diff --git a/src/main/java/me/cortex/voxy/client/core/VoxelCore.java b/src/main/java/me/cortex/voxy/client/core/VoxelCore.java index 00a9d051..1dcbe934 100644 --- a/src/main/java/me/cortex/voxy/client/core/VoxelCore.java +++ b/src/main/java/me/cortex/voxy/client/core/VoxelCore.java @@ -116,7 +116,7 @@ public class VoxelCore { } private AbstractFarWorldRenderer createRenderBackend() { - if (false) { + if (true) { System.out.println("Using Gl46MeshletFarWorldRendering"); return new Gl46MeshletsFarWorldRenderer(VoxyConfig.CONFIG.geometryBufferSize, VoxyConfig.CONFIG.maxSections); } else { diff --git a/src/main/java/me/cortex/voxy/client/core/gl/GlTexture.java b/src/main/java/me/cortex/voxy/client/core/gl/GlTexture.java index 5c1b4cd9..3186c2b0 100644 --- a/src/main/java/me/cortex/voxy/client/core/gl/GlTexture.java +++ b/src/main/java/me/cortex/voxy/client/core/gl/GlTexture.java @@ -4,10 +4,9 @@ import me.cortex.voxy.common.util.TrackedObject; import static org.lwjgl.opengl.ARBFramebufferObject.glDeleteFramebuffers; import static org.lwjgl.opengl.ARBFramebufferObject.glGenFramebuffers; -import static org.lwjgl.opengl.GL11C.GL_TEXTURE_2D; -import static org.lwjgl.opengl.GL11C.glDeleteTextures; -import static org.lwjgl.opengl.GL45C.glCreateTextures; -import static org.lwjgl.opengl.GL45C.glTextureStorage2D; +import static org.lwjgl.opengl.GL11C.*; +import static org.lwjgl.opengl.GL30C.glGetIntegeri; +import static org.lwjgl.opengl.GL45C.*; public class GlTexture extends TrackedObject { public final int id; @@ -35,4 +34,16 @@ public class GlTexture extends TrackedObject { super.free0(); glDeleteTextures(this.id); } + + //TODO: FIXME, glGetTextureParameteri doesnt work + public static int getRawTextureType(int texture) { + if (!glIsTexture(texture)) { + throw new IllegalStateException("Not texture"); + } + int immFormat = glGetTextureParameteri(texture, GL_TEXTURE_IMMUTABLE_FORMAT); + if (immFormat == 0) { + throw new IllegalStateException("Texture: " + texture + " is not immutable"); + } + return immFormat; + } } diff --git a/src/main/java/me/cortex/voxy/client/core/rendering/HiZBuffer.java b/src/main/java/me/cortex/voxy/client/core/rendering/HiZBuffer.java index 48869a92..a73bebfc 100644 --- a/src/main/java/me/cortex/voxy/client/core/rendering/HiZBuffer.java +++ b/src/main/java/me/cortex/voxy/client/core/rendering/HiZBuffer.java @@ -7,6 +7,7 @@ import me.cortex.voxy.client.core.gl.shader.ShaderType; import org.lwjgl.opengl.GL11; import static org.lwjgl.opengl.ARBDirectStateAccess.*; +import static org.lwjgl.opengl.GL11.glScaled; import static org.lwjgl.opengl.GL11C.*; import static org.lwjgl.opengl.GL30C.*; import static org.lwjgl.opengl.GL33.glBindSampler; @@ -41,7 +42,8 @@ public class HiZBuffer { this.levels -= 3;//Arbitrary size, shinks the max level by alot and saves a significant amount of processing time // (could probably increase it to be defined by a max meshlet coverage computation thing) - this.texture = new GlTexture().store(GL_DEPTH_COMPONENT32, this.levels, width, height); + //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); 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); @@ -75,7 +77,7 @@ public class HiZBuffer { glDepthFunc(GL_ALWAYS); - + //System.err.println("SRC: " + GlTexture.getRawTextureType(srcDepthTex) + " DST: " + this.texture.id); glCopyImageSubData(srcDepthTex, GL_TEXTURE_2D, 0,0,0,0, this.texture.id, GL_TEXTURE_2D, 0,0,0,0, width, height, 1);