diff --git a/src/main/java/me/cortex/voxy/client/core/rendering/AbstractFarWorldRenderer.java b/src/main/java/me/cortex/voxy/client/core/rendering/AbstractFarWorldRenderer.java index 2416c227..44d327c4 100644 --- a/src/main/java/me/cortex/voxy/client/core/rendering/AbstractFarWorldRenderer.java +++ b/src/main/java/me/cortex/voxy/client/core/rendering/AbstractFarWorldRenderer.java @@ -11,17 +11,12 @@ import me.cortex.voxy.client.core.rendering.building.BuiltSection; import me.cortex.voxy.client.core.rendering.util.DownloadStream; import me.cortex.voxy.client.core.rendering.util.UploadStream; import me.cortex.voxy.common.world.other.Mapper; -import net.minecraft.block.Blocks; import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.Camera; import net.minecraft.client.render.Frustum; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.registry.RegistryKeys; import net.minecraft.util.Identifier; -import net.minecraft.world.biome.Biome; -import net.minecraft.world.biome.BiomeKeys; import org.joml.FrustumIntersection; -import org.joml.Matrix4f; import org.lwjgl.system.MemoryUtil; import java.util.ArrayList; diff --git a/src/main/java/me/cortex/voxy/client/core/rendering/HierarchicalOcclusionRenderer.java b/src/main/java/me/cortex/voxy/client/core/rendering/HierarchicalOcclusionRenderer.java index d42dc9be..a217894f 100644 --- a/src/main/java/me/cortex/voxy/client/core/rendering/HierarchicalOcclusionRenderer.java +++ b/src/main/java/me/cortex/voxy/client/core/rendering/HierarchicalOcclusionRenderer.java @@ -1,28 +1,24 @@ package me.cortex.voxy.client.core.rendering; -import me.cortex.voxy.client.core.gl.GlBuffer; import me.cortex.voxy.client.core.gl.shader.Shader; import me.cortex.voxy.client.core.gl.shader.ShaderType; -import me.cortex.voxy.client.core.rendering.hierarchical.NodeManager; -import me.cortex.voxy.common.util.HierarchicalBitSet; +import me.cortex.voxy.client.core.rendering.hierarchical.NodeManager2; +import me.cortex.voxy.client.core.rendering.hierarchical.NodeManagerOLD; import static org.lwjgl.opengl.GL42C.*; import static org.lwjgl.opengl.GL43C.GL_SHADER_STORAGE_BARRIER_BIT; -import static org.lwjgl.opengl.GL43C.glDispatchCompute; import static org.lwjgl.opengl.GL44.GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT; public class HierarchicalOcclusionRenderer { - private final int workgroup_dispatch_size_x;//The number of workgroups required to saturate the gpu efficiently - private final NodeManager nodeManager = new NodeManager(null); + private final NodeManager2 nodeManager = new NodeManager2(null, null); private final HiZBuffer hiz = new HiZBuffer(); private Shader hiercarchialShader = Shader.make() - .add(ShaderType.COMPUTE, "voxy:lod/hierarchical/selector.comp") + .add(ShaderType.COMPUTE, "voxy:lod/hierarchical/traversal.comp") .compile(); - public HierarchicalOcclusionRenderer(int workgroup_size) { - this.workgroup_dispatch_size_x = workgroup_size; + public HierarchicalOcclusionRenderer() { } @@ -34,9 +30,9 @@ public class HierarchicalOcclusionRenderer { //Make hiz this.hiz.buildMipChain(depthBuffer, width, height); //Node upload phase - this.nodeManager.uploadPhase(); + //this.nodeManager.uploadPhase(); //Node download phase (pulls from previous frame (should maybe result in lower latency)) also clears and resets the queues - this.nodeManager.downloadPhase(); + //this.nodeManager.downloadPhase(); //Bind all the resources this.bind(); //run hierachial selection shader @@ -44,7 +40,7 @@ public class HierarchicalOcclusionRenderer { //barrier glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT|GL_UNIFORM_BARRIER_BIT|GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT|GL_FRAMEBUFFER_BARRIER_BIT); //Emit enough work to fully populate the gpu - glDispatchCompute(this.workgroup_dispatch_size_x, 1, 1); + //glDispatchCompute(this.workgroup_dispatch_size_x, 1, 1); glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT|GL_COMMAND_BARRIER_BIT|GL_UNIFORM_BARRIER_BIT); } } diff --git a/src/main/java/me/cortex/voxy/client/core/rendering/hierarchical/NodeManager.java b/src/main/java/me/cortex/voxy/client/core/rendering/hierarchical/NodeManagerOLD.java similarity index 99% rename from src/main/java/me/cortex/voxy/client/core/rendering/hierarchical/NodeManager.java rename to src/main/java/me/cortex/voxy/client/core/rendering/hierarchical/NodeManagerOLD.java index 04ec929e..559e3c53 100644 --- a/src/main/java/me/cortex/voxy/client/core/rendering/hierarchical/NodeManager.java +++ b/src/main/java/me/cortex/voxy/client/core/rendering/hierarchical/NodeManagerOLD.java @@ -12,7 +12,7 @@ import static org.lwjgl.opengl.GL30.GL_R32UI; import static org.lwjgl.opengl.GL30C.GL_RED_INTEGER; import static org.lwjgl.opengl.GL45.nglClearNamedBufferSubData; -public class NodeManager { +public class NodeManagerOLD { public static final int MAX_NODE_COUNT = 1<<22; public static final int MAX_REQUESTS = 1024; private final HierarchicalBitSet bitSet = new HierarchicalBitSet(MAX_NODE_COUNT); @@ -36,7 +36,7 @@ public class NodeManager { private final INodeInteractor interactor; - public NodeManager(INodeInteractor interactor) { + public NodeManagerOLD(INodeInteractor interactor) { this.interactor = interactor; this.pos2meshId.defaultReturnValue(NO_NODE); } diff --git a/src/main/resources/assets/voxy/shaders/lod/hierarchical/Queue.glsl b/src/main/resources/assets/voxy/shaders/lod/hierarchical/Queue.glsl deleted file mode 100644 index 7ca87c07..00000000 --- a/src/main/resources/assets/voxy/shaders/lod/hierarchical/Queue.glsl +++ /dev/null @@ -1,20 +0,0 @@ -//Use defines and undefines to define the queue, allows for hacky reuse of imports -#ifndef QUEUE_NAME -#error QUEUE_NAME is not defined -#endif - - - - -void push(queue, item) { - -} - - - - - - - - -# \ No newline at end of file diff --git a/src/main/resources/assets/voxy/shaders/lod/hierarchical/selector.comp b/src/main/resources/assets/voxy/shaders/lod/hierarchical/selectorOLDDD.comp similarity index 100% rename from src/main/resources/assets/voxy/shaders/lod/hierarchical/selector.comp rename to src/main/resources/assets/voxy/shaders/lod/hierarchical/selectorOLDDD.comp