From cfc2c6f510e1842dd4c0ea223f97a392a0895772 Mon Sep 17 00:00:00 2001 From: Safixo <131321214+Safixoo@users.noreply.github.com> Date: Sat, 4 Jan 2025 18:10:24 -0300 Subject: [PATCH] Fix multidraw --- .../client/gl/device/GLRenderDevice.java | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/common/src/main/java/net/caffeinemc/mods/sodium/client/gl/device/GLRenderDevice.java b/common/src/main/java/net/caffeinemc/mods/sodium/client/gl/device/GLRenderDevice.java index b43e7091..a66b0114 100644 --- a/common/src/main/java/net/caffeinemc/mods/sodium/client/gl/device/GLRenderDevice.java +++ b/common/src/main/java/net/caffeinemc/mods/sodium/client/gl/device/GLRenderDevice.java @@ -278,19 +278,12 @@ public ImmediateDrawCommandList() { public void multiDrawElementsBaseVertex(MultiDrawBatch batch, GlIndexType indexType) { GlPrimitiveType primitiveType = GLRenderDevice.this.activeTessellation.getPrimitiveType(); - for (int i = 0; i < batch.size(); i++) { - int elementCount = MemoryUtil.memGetInt(batch.pElementCount + i * Integer.BYTES); - long elementPointer = MemoryUtil.memGetAddress(batch.pElementPointer + i * Long.BYTES); - int baseVertex = MemoryUtil.memGetInt(batch.pBaseVertex + i * Integer.BYTES); - - GL32.glDrawElementsBaseVertex( - primitiveType.getId(), - elementCount, - indexType.getFormatId(), - elementPointer, - baseVertex - ); - } + GL32C.nglMultiDrawElementsBaseVertex(primitiveType.getId(), + batch.pElementCount, + indexType.getFormatId(), + batch.pElementPointer, + batch.size(), + batch.pBaseVertex); } @Override