diff --git a/common/src/backend/java/dev/engine_room/flywheel/backend/engine/indirect/IndirectBuffers.java b/common/src/backend/java/dev/engine_room/flywheel/backend/engine/indirect/IndirectBuffers.java index 866150347..6280dfc6e 100644 --- a/common/src/backend/java/dev/engine_room/flywheel/backend/engine/indirect/IndirectBuffers.java +++ b/common/src/backend/java/dev/engine_room/flywheel/backend/engine/indirect/IndirectBuffers.java @@ -109,11 +109,9 @@ public class IndirectBuffers { GlBufferType.DRAW_INDIRECT_BUFFER.bind(draw.handle()); } - /** - * Bind all buffers except the draw command buffer. - */ public void bindForCrumbling() { - multiBind(1, 4); + // All we need is the instance buffer. Crumbling uses its own draw buffer. + multiBind(BufferBindings.INSTANCE, 1); } private void multiBind(int base, int count) { diff --git a/common/src/backend/java/dev/engine_room/flywheel/backend/engine/indirect/IndirectCullingGroup.java b/common/src/backend/java/dev/engine_room/flywheel/backend/engine/indirect/IndirectCullingGroup.java index 0f6e8ef57..9b56968d2 100644 --- a/common/src/backend/java/dev/engine_room/flywheel/backend/engine/indirect/IndirectCullingGroup.java +++ b/common/src/backend/java/dev/engine_room/flywheel/backend/engine/indirect/IndirectCullingGroup.java @@ -2,7 +2,6 @@ package dev.engine_room.flywheel.backend.engine.indirect; import static org.lwjgl.opengl.GL11.GL_TRIANGLES; import static org.lwjgl.opengl.GL11.GL_UNSIGNED_INT; -import static org.lwjgl.opengl.GL30.glUniform1ui; import static org.lwjgl.opengl.GL42.GL_COMMAND_BARRIER_BIT; import static org.lwjgl.opengl.GL42.glMemoryBarrier; import static org.lwjgl.opengl.GL43.glDispatchCompute; @@ -215,8 +214,8 @@ public class IndirectCullingGroup { } } - public void bindWithContextShader(ContextShader override, Material material) { - var program = programs.getIndirectProgram(instanceType, override, material); + public void bindForCrumbling(Material material) { + var program = programs.getIndirectProgram(instanceType, ContextShader.CRUMBLING, material); program.bind(); @@ -224,8 +223,7 @@ public class IndirectCullingGroup { drawBarrier(); - var flwBaseDraw = program.getUniformLocation("_flw_baseDraw"); - glUniform1ui(flwBaseDraw, 0); + program.setUInt("_flw_baseDraw", 0); } private void drawBarrier() { diff --git a/common/src/backend/java/dev/engine_room/flywheel/backend/engine/indirect/IndirectDrawManager.java b/common/src/backend/java/dev/engine_room/flywheel/backend/engine/indirect/IndirectDrawManager.java index 65c0d4aba..7fab5d55e 100644 --- a/common/src/backend/java/dev/engine_room/flywheel/backend/engine/indirect/IndirectDrawManager.java +++ b/common/src/backend/java/dev/engine_room/flywheel/backend/engine/indirect/IndirectDrawManager.java @@ -17,7 +17,6 @@ import dev.engine_room.flywheel.api.instance.Instance; import dev.engine_room.flywheel.api.instance.InstanceType; import dev.engine_room.flywheel.api.visualization.VisualType; import dev.engine_room.flywheel.backend.Samplers; -import dev.engine_room.flywheel.backend.compile.ContextShader; import dev.engine_room.flywheel.backend.compile.IndirectPrograms; import dev.engine_room.flywheel.backend.engine.AbstractInstancer; import dev.engine_room.flywheel.backend.engine.CommonCrumbling; @@ -235,7 +234,7 @@ public class IndirectDrawManager extends DrawManager> { // Transform the material to be suited for crumbling. CommonCrumbling.applyCrumblingProperties(crumblingMaterial, draw.material()); - cullingGroup.bindWithContextShader(ContextShader.CRUMBLING, crumblingMaterial); + cullingGroup.bindForCrumbling(crumblingMaterial); MaterialRenderState.setup(crumblingMaterial);