diff --git a/buildscript/src/main/java/Buildscript.java b/buildscript/src/main/java/Buildscript.java index c540e5da0b..632268d443 100644 --- a/buildscript/src/main/java/Buildscript.java +++ b/buildscript/src/main/java/Buildscript.java @@ -44,7 +44,7 @@ public class Buildscript extends SimpleFabricProject { static final boolean SODIUM = true; - static final boolean CUSTOM_SODIUM = true; + static final boolean CUSTOM_SODIUM = false; static final String MC_VERSION = "1.20.4"; static final String customSodiumName = "sodium-fabric-mc1.20.3-0.5.6git.7a62284.jar"; @@ -114,10 +114,10 @@ public void getModDependencies(ModDependencyCollector d) { if (CUSTOM_SODIUM) { d.add(new JavaJarDependency(getProjectDir().resolve("custom_sodium").resolve(customSodiumName).toAbsolutePath(), null, new MavenId("me.jellysquid.mods", "sodium-fabric", customSodiumName.replace("sodium-fabric-", ""))), ModDependencyFlag.COMPILE, ModDependencyFlag.RUNTIME); } else { - d.addMaven("https://api.modrinth.com/maven", new MavenId("maven.modrinth", "sodium", "mc1.20.3-0.5.5"), ModDependencyFlag.COMPILE, ModDependencyFlag.RUNTIME); + d.addMaven("https://api.modrinth.com/maven", new MavenId("maven.modrinth", "sodium", "mc1.20.4-0.5.8"), ModDependencyFlag.COMPILE, ModDependencyFlag.RUNTIME); } } else { - d.addMaven("https://api.modrinth.com/maven", new MavenId("maven.modrinth", "sodium", "mc1.20.3-0.5.5"), ModDependencyFlag.COMPILE); + d.addMaven("https://api.modrinth.com/maven", new MavenId("maven.modrinth", "sodium", "mc1.20.4-0.5.8"), ModDependencyFlag.COMPILE); } } diff --git a/src/main/java/net/coderbot/batchedentityrendering/impl/FullyBufferedMultiBufferSource.java b/src/main/java/net/coderbot/batchedentityrendering/impl/FullyBufferedMultiBufferSource.java index 32c59cad25..fe66f0bce5 100644 --- a/src/main/java/net/coderbot/batchedentityrendering/impl/FullyBufferedMultiBufferSource.java +++ b/src/main/java/net/coderbot/batchedentityrendering/impl/FullyBufferedMultiBufferSource.java @@ -2,6 +2,8 @@ import com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.VertexConsumer; +import me.jellysquid.mods.sodium.client.render.vertex.buffer.ExtendedBufferBuilder; +import me.jellysquid.mods.sodium.client.render.vertex.buffer.SodiumBufferBuilder; import net.coderbot.batchedentityrendering.impl.ordering.GraphTranslucencyRenderOrderManager; import net.coderbot.batchedentityrendering.impl.ordering.RenderOrderManager; import net.coderbot.iris.fantastic.WrappingMultiBufferSource; @@ -90,7 +92,16 @@ public VertexConsumer getBuffer(RenderType renderType) { affinities.put(renderType, affinity); } - return builders[affinity].getBuffer(renderType); + VertexConsumer consumer = builders[affinity].getBuffer(renderType); + + if (consumer instanceof ExtendedBufferBuilder extendedBufferBuilder) { + SodiumBufferBuilder replacement = extendedBufferBuilder.sodium$getDelegate(); + if (replacement != null) { + consumer = replacement; + } + } + + return consumer; } private void removeReady() { diff --git a/src/main/java/net/coderbot/iris/mixin/vertices/MixinBufferBuilder.java b/src/main/java/net/coderbot/iris/mixin/vertices/MixinBufferBuilder.java index 5b8ae15471..371b6b7e1a 100644 --- a/src/main/java/net/coderbot/iris/mixin/vertices/MixinBufferBuilder.java +++ b/src/main/java/net/coderbot/iris/mixin/vertices/MixinBufferBuilder.java @@ -308,6 +308,21 @@ public void endBlock() { this.currentLocalPosZ = 0; } + @Override + public short getCurrentBlock() { + return currentBlock; + } + + @Override + public VertexFormat.Mode getMode() { + return mode; + } + + @Override + public int getStride() { + return format.getVertexSize(); + } + @Unique private void putInt(int i, int value) { this.buffer.putInt(this.nextElementByte + i, value); diff --git a/src/main/java/net/coderbot/iris/vertices/BlockSensitiveBufferBuilder.java b/src/main/java/net/coderbot/iris/vertices/BlockSensitiveBufferBuilder.java index 4a8d123c7e..9bc55efd5f 100644 --- a/src/main/java/net/coderbot/iris/vertices/BlockSensitiveBufferBuilder.java +++ b/src/main/java/net/coderbot/iris/vertices/BlockSensitiveBufferBuilder.java @@ -1,7 +1,14 @@ package net.coderbot.iris.vertices; +import com.mojang.blaze3d.vertex.VertexFormat; + public interface BlockSensitiveBufferBuilder { void beginBlock(short block, short renderType, int localPosX, int localPosY, int localPosZ); void endBlock(); + short getCurrentBlock(); + + VertexFormat.Mode getMode(); + + int getStride(); } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 7d05651d15..6005cc885a 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "id": "iris", - "version": "1.6.14-development-environment", + "version": "1.6.15-development-environment", "name": "Iris", "description": "A modern shaders mod for Minecraft intended to be compatible with existing OptiFine shader packs", @@ -46,7 +46,7 @@ "depends": { "fabricloader": ">=0.12.3", "minecraft": ["1.20.3", "1.20.4"], - "sodium": "0.5.6" + "sodium": "0.5.8" }, "breaks": { diff --git a/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/impl/vertex_format/EntityToTerrainVertexSerializer.java b/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/impl/vertex_format/EntityToTerrainVertexSerializer.java index 4983d77eca..a9b98e589b 100644 --- a/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/impl/vertex_format/EntityToTerrainVertexSerializer.java +++ b/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/impl/vertex_format/EntityToTerrainVertexSerializer.java @@ -1,5 +1,6 @@ package net.coderbot.iris.compat.sodium.impl.vertex_format; +import net.caffeinemc.mods.sodium.api.memory.MemoryIntrinsics; import net.caffeinemc.mods.sodium.api.util.NormI8; import net.caffeinemc.mods.sodium.api.vertex.format.common.ModelVertex; import net.caffeinemc.mods.sodium.api.vertex.serializer.VertexSerializer; @@ -29,7 +30,7 @@ public void serialize(long src, long dst, int vertexCount) { midV /= 4; for (int j = 0; j < 4; j++) { - MemoryUtil.memCopy(src, dst, 24); + MemoryIntrinsics.copyMemory(src, dst, 24); MemoryUtil.memPutInt(dst + 24, MemoryUtil.memGetInt(src + 28L)); MemoryUtil.memPutInt(dst + 28, normal); MemoryUtil.memPutShort(dst + 32, (short) CapturedRenderingState.INSTANCE.getCurrentRenderedEntity()); diff --git a/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/impl/vertex_format/GlyphExtVertexSerializer.java b/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/impl/vertex_format/GlyphExtVertexSerializer.java index 85566684ae..3b325c16f2 100644 --- a/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/impl/vertex_format/GlyphExtVertexSerializer.java +++ b/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/impl/vertex_format/GlyphExtVertexSerializer.java @@ -1,6 +1,7 @@ package net.coderbot.iris.compat.sodium.impl.vertex_format; import com.mojang.blaze3d.vertex.DefaultVertexFormat; +import net.caffeinemc.mods.sodium.api.memory.MemoryIntrinsics; import net.caffeinemc.mods.sodium.api.vertex.serializer.VertexSerializer; import net.coderbot.iris.compat.sodium.impl.vertex_format.entity_xhfp.QuadViewEntity; import net.coderbot.iris.uniforms.CapturedRenderingState; @@ -33,7 +34,7 @@ public void serialize(long src, long dst, int vertexCount) { uSum += u; vSum += v; - MemoryUtil.memCopy(src, dst, 28); + MemoryIntrinsics.copyMemory(src, dst, 28); MemoryUtil.memPutShort(dst + 32, (short) CapturedRenderingState.INSTANCE.getCurrentRenderedEntity()); MemoryUtil.memPutShort(dst + 34, (short) CapturedRenderingState.INSTANCE.getCurrentRenderedBlockEntity()); diff --git a/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/impl/vertex_format/IrisCommonVertexAttributes.java b/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/impl/vertex_format/IrisCommonVertexAttributes.java index 020ca51936..bdf5498593 100644 --- a/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/impl/vertex_format/IrisCommonVertexAttributes.java +++ b/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/impl/vertex_format/IrisCommonVertexAttributes.java @@ -11,4 +11,5 @@ public class IrisCommonVertexAttributes { public static CommonVertexAttribute BLOCK_ID; public static CommonVertexAttribute ENTITY_ID; public static CommonVertexAttribute MID_BLOCK; + public static CommonVertexAttribute PADDING2; } diff --git a/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/impl/vertex_format/ModelToEntityVertexSerializer.java b/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/impl/vertex_format/ModelToEntityVertexSerializer.java index b833dcd0ba..467c18ea0a 100644 --- a/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/impl/vertex_format/ModelToEntityVertexSerializer.java +++ b/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/impl/vertex_format/ModelToEntityVertexSerializer.java @@ -1,5 +1,6 @@ package net.coderbot.iris.compat.sodium.impl.vertex_format; +import net.caffeinemc.mods.sodium.api.memory.MemoryIntrinsics; import net.caffeinemc.mods.sodium.api.util.NormI8; import net.caffeinemc.mods.sodium.api.vertex.format.common.ModelVertex; import net.caffeinemc.mods.sodium.api.vertex.serializer.VertexSerializer; @@ -30,7 +31,7 @@ public void serialize(long src, long dst, int vertexCount) { midV /= 4; for (int j = 0; j < 4; j++) { - MemoryUtil.memCopy(src, dst, 36); + MemoryIntrinsics.copyMemory(src, dst, 36); MemoryUtil.memPutShort(dst + 36, (short) CapturedRenderingState.INSTANCE.getCurrentRenderedEntity()); MemoryUtil.memPutShort(dst + 38, (short) CapturedRenderingState.INSTANCE.getCurrentRenderedBlockEntity()); MemoryUtil.memPutShort(dst + 40, (short) CapturedRenderingState.INSTANCE.getCurrentRenderedItem()); diff --git a/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/impl/vertex_format/SodiumTriView.java b/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/impl/vertex_format/SodiumTriView.java new file mode 100644 index 0000000000..2a8fc5f80c --- /dev/null +++ b/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/impl/vertex_format/SodiumTriView.java @@ -0,0 +1,42 @@ +package net.coderbot.iris.compat.sodium.impl.vertex_format; + +import net.coderbot.iris.vertices.QuadView; +import net.coderbot.iris.vertices.TriView; + +public class SodiumTriView implements QuadView { + private long address; + private int stride; + private int textureOffset; + + public void setInfo(long address, int stride, int textureOffset) { + this.address = address; + this.stride = stride; + this.textureOffset = textureOffset; + } + + @Override + public float x(int index) { + return address - stride * (3L - index); + } + + @Override + public float y(int index) { + return address + 4 - stride * (3L - index); + } + + @Override + public float z(int index) { + return address + 8 - stride * (3L - index); + } + + @Override + public float u(int index) { + return address + textureOffset - stride * (3L - index); + } + + @Override + public float v(int index) { + return address + (textureOffset + 4 + ) - stride * (3L - index); + } +} diff --git a/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/mixin/vertex_format/MixinCommonVertexAttributes.java b/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/mixin/vertex_format/MixinCommonVertexAttributes.java index 4742e86d88..aeb528bc61 100644 --- a/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/mixin/vertex_format/MixinCommonVertexAttributes.java +++ b/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/mixin/vertex_format/MixinCommonVertexAttributes.java @@ -44,13 +44,16 @@ public class MixinCommonVertexAttributes { = CommonVertexAttributeAccessor.createCommonVertexElement("ENTITY_ID", baseOrdinal + 3, IrisVertexFormats.ENTITY_ID_ELEMENT); IrisCommonVertexAttributes.MID_BLOCK = CommonVertexAttributeAccessor.createCommonVertexElement("MID_BLOCK", baseOrdinal + 4, IrisVertexFormats.MID_BLOCK_ELEMENT); + IrisCommonVertexAttributes.PADDING2 + = CommonVertexAttributeAccessor.createCommonVertexElement("PADDING2", baseOrdinal + 5, IrisVertexFormats.PADDING_SHORT); $VALUES = ArrayUtils.addAll($VALUES, IrisCommonVertexAttributes.TANGENT, IrisCommonVertexAttributes.MID_TEX_COORD, IrisCommonVertexAttributes.BLOCK_ID, IrisCommonVertexAttributes.ENTITY_ID, - IrisCommonVertexAttributes.MID_BLOCK); + IrisCommonVertexAttributes.MID_BLOCK, + IrisCommonVertexAttributes.PADDING2); COUNT = $VALUES.length; } diff --git a/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/mixin/vertex_format/MixinSodiumBufferBuilder.java b/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/mixin/vertex_format/MixinSodiumBufferBuilder.java new file mode 100644 index 0000000000..0c5fff0df4 --- /dev/null +++ b/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/mixin/vertex_format/MixinSodiumBufferBuilder.java @@ -0,0 +1,185 @@ +package net.coderbot.iris.compat.sodium.mixin.vertex_format; + +import com.mojang.blaze3d.vertex.BufferBuilder; +import com.mojang.blaze3d.vertex.VertexFormat; +import me.jellysquid.mods.sodium.client.render.vertex.buffer.ExtendedBufferBuilder; +import me.jellysquid.mods.sodium.client.render.vertex.buffer.SodiumBufferBuilder; +import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatDescription; +import net.coderbot.iris.compat.sodium.impl.vertex_format.IrisCommonVertexAttributes; +import net.coderbot.iris.compat.sodium.impl.vertex_format.SodiumTriView; +import net.coderbot.iris.uniforms.CapturedRenderingState; +import net.coderbot.iris.vertices.BlockSensitiveBufferBuilder; +import net.coderbot.iris.vertices.NormI8; +import net.coderbot.iris.vertices.NormalHelper; +import net.coderbot.iris.vertices.TriView; +import org.joml.Vector3f; +import org.lwjgl.system.MemoryUtil; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(SodiumBufferBuilder.class) +public class MixinSodiumBufferBuilder { + @Shadow + @Final + private static int ATTRIBUTE_NOT_PRESENT; + @Shadow + private int requiredAttributes; + @Shadow + @Final + private ExtendedBufferBuilder builder; + @Shadow + private int attributeOffsetTexture; + @Shadow + private int attributeOffsetNormal; + @Shadow + @Final + private static int ATTRIBUTE_NORMAL_BIT; + private static int ATTRIBUTE_BLOCK_ID_BIT = 1 << IrisCommonVertexAttributes.BLOCK_ID.ordinal(); + private static int ATTRIBUTE_ENTITY_ID_BIT = 1 << IrisCommonVertexAttributes.ENTITY_ID.ordinal(); + private static int ATTRIBUTE_MID_BLOCK_BIT = 1 << IrisCommonVertexAttributes.MID_BLOCK.ordinal(); + private static int ATTRIBUTE_TANGENT_BIT = 1 << IrisCommonVertexAttributes.TANGENT.ordinal(); + private static int ATTRIBUTE_MID_TEX_COORD_BIT = 1 << IrisCommonVertexAttributes.MID_TEX_COORD.ordinal(); + + private int + attributeOffsetBlockId, + attributeOffsetEntityId, + attributeOffsetMidBlock, + attributeOffsetTangent, + attributeOffsetMidTexCoord; + + @Unique + private int vertexAmount; + + @Unique + private int vertexCount; + + @Unique + private float midU, midV; + + @Unique + private SodiumTriView triView = new SodiumTriView(); + + @Inject(method = "resetAttributeBindings", at = @At("HEAD"), remap = false) + private void resetAttributes(CallbackInfo ci) { + this.attributeOffsetBlockId = ATTRIBUTE_NOT_PRESENT; + this.attributeOffsetEntityId = ATTRIBUTE_NOT_PRESENT; + this.attributeOffsetMidBlock = ATTRIBUTE_NOT_PRESENT; + this.attributeOffsetTangent = ATTRIBUTE_NOT_PRESENT; + this.attributeOffsetMidTexCoord = ATTRIBUTE_NOT_PRESENT; + } + + @Inject(method = "updateAttributeBindings", at = @At("HEAD"), remap = false) + private void updateAttributes(VertexFormatDescription desc, CallbackInfo ci) { + this.attributeOffsetBlockId = ATTRIBUTE_NOT_PRESENT; + this.attributeOffsetEntityId = ATTRIBUTE_NOT_PRESENT; + this.attributeOffsetMidBlock = ATTRIBUTE_NOT_PRESENT; + this.attributeOffsetTangent = ATTRIBUTE_NOT_PRESENT; + this.attributeOffsetMidTexCoord = ATTRIBUTE_NOT_PRESENT; + this.vertexAmount = ((BlockSensitiveBufferBuilder) builder).getMode().primitiveLength; + + if (desc.containsElement(IrisCommonVertexAttributes.BLOCK_ID)) { + this.requiredAttributes |= ATTRIBUTE_BLOCK_ID_BIT; + this.attributeOffsetBlockId = desc.getElementOffset(IrisCommonVertexAttributes.BLOCK_ID); + } + + if (desc.containsElement(IrisCommonVertexAttributes.ENTITY_ID)) { + this.requiredAttributes |= ATTRIBUTE_ENTITY_ID_BIT; + this.attributeOffsetEntityId = desc.getElementOffset(IrisCommonVertexAttributes.ENTITY_ID); + } + + if (desc.containsElement(IrisCommonVertexAttributes.TANGENT)) { + this.requiredAttributes |= ATTRIBUTE_TANGENT_BIT; + this.attributeOffsetTangent = desc.getElementOffset(IrisCommonVertexAttributes.TANGENT); + } + + if (desc.containsElement(IrisCommonVertexAttributes.MID_BLOCK)) { + this.requiredAttributes |= ATTRIBUTE_MID_BLOCK_BIT; + this.attributeOffsetMidBlock = desc.getElementOffset(IrisCommonVertexAttributes.MID_BLOCK); + } + + if (desc.containsElement(IrisCommonVertexAttributes.MID_TEX_COORD)) { + this.requiredAttributes |= ATTRIBUTE_MID_TEX_COORD_BIT; + this.attributeOffsetMidTexCoord = desc.getElementOffset(IrisCommonVertexAttributes.MID_TEX_COORD); + } + + } + + @Unique + private Vector3f normal = new Vector3f(); + + @Inject(method = "endVertex", at = @At("HEAD"), remap = false) + private void endIrisVertex(CallbackInfo ci) { + vertexCount += 1; + int stride = ((BlockSensitiveBufferBuilder) builder).getStride(); + triView.setInfo(MemoryUtil.memAddress(this.builder.sodium$getBuffer(), this.builder.sodium$getElementOffset()), stride, this.attributeOffsetTexture); + + if (this.attributeOffsetEntityId != -1) { + long offset = MemoryUtil.memAddress(this.builder.sodium$getBuffer(), this.builder.sodium$getElementOffset() + this.attributeOffsetEntityId); + + MemoryUtil.memPutShort(offset, (short) CapturedRenderingState.INSTANCE.getCurrentRenderedEntity()); + MemoryUtil.memPutShort(offset + 2, (short) CapturedRenderingState.INSTANCE.getCurrentRenderedBlockEntity()); + MemoryUtil.memPutShort(offset + 4, (short) CapturedRenderingState.INSTANCE.getCurrentRenderedItem()); + this.requiredAttributes |= ATTRIBUTE_ENTITY_ID_BIT; + } + + if (this.attributeOffsetBlockId != -1) { + long offset = MemoryUtil.memAddress(this.builder.sodium$getBuffer(), this.builder.sodium$getElementOffset() + this.attributeOffsetBlockId); + + MemoryUtil.memPutShort(offset, (short) ((BlockSensitiveBufferBuilder) builder).getCurrentBlock()); + //MemoryUtil.memPutShort(offset + 2, (short) CapturedRenderingState.INSTANCE.getCurrentRenderedBlockEntity()); + this.requiredAttributes |= ATTRIBUTE_BLOCK_ID_BIT; + } + + if (vertexCount == vertexAmount) { + vertexCount = 0; + + if (this.attributeOffsetNormal != -1) { + NormalHelper.computeFaceNormal(normal, triView); + int packedNormal = NormI8.pack(normal.x, normal.y, normal.z, 0.0f); + + for (int vertex = 0; vertex < vertexAmount; vertex++) { + long offset = MemoryUtil.memAddress(this.builder.sodium$getBuffer(), this.builder.sodium$getElementOffset() - attributeOffsetNormal - stride * vertex); + + MemoryUtil.memPutInt(offset, packedNormal); + } + this.requiredAttributes |= ATTRIBUTE_NORMAL_BIT; + } + + if (this.attributeOffsetTangent != -1) { + int tangent = NormalHelper.computeTangent(normal.x, normal.y, normal.z, triView); + for (int vertex = 0; vertex < vertexAmount; vertex++) { + long offset = MemoryUtil.memAddress(this.builder.sodium$getBuffer(), this.builder.sodium$getElementOffset() - attributeOffsetTangent - stride * vertex); + + MemoryUtil.memPutInt(offset, tangent); + } + this.requiredAttributes |= ATTRIBUTE_TANGENT_BIT; + } + + if (this.attributeOffsetMidTexCoord != -1) { + float midU = 0, midV = 0; + + for (int vertex = 0; vertex < vertexAmount; vertex++) { + midU += MemoryUtil.memGetFloat(MemoryUtil.memAddress(this.builder.sodium$getBuffer(), this.builder.sodium$getElementOffset() - attributeOffsetTexture - stride * vertex)); + midV += MemoryUtil.memGetFloat(MemoryUtil.memAddress(this.builder.sodium$getBuffer(), this.builder.sodium$getElementOffset() - (attributeOffsetTexture + 4) - stride * vertex)); + } + + midU *= 0.25f; + midV *= 0.25f; + + for (int vertex = 0; vertex < vertexAmount; vertex++) { + long offset = MemoryUtil.memAddress(this.builder.sodium$getBuffer(), this.builder.sodium$getElementOffset() - attributeOffsetMidTexCoord - stride * vertex); + + MemoryUtil.memPutFloat(offset, midU); + MemoryUtil.memPutFloat(offset + 4, midV); + } + this.requiredAttributes |= ATTRIBUTE_MID_TEX_COORD_BIT; + + } + } + } +} diff --git a/src/sodiumCompatibility/resources/mixins.iris.compat.sodium.json b/src/sodiumCompatibility/resources/mixins.iris.compat.sodium.json index 85dd77b9c2..c4d0e88bee 100644 --- a/src/sodiumCompatibility/resources/mixins.iris.compat.sodium.json +++ b/src/sodiumCompatibility/resources/mixins.iris.compat.sodium.json @@ -54,6 +54,7 @@ "vertex_format.MixinRegionChunkRenderer", "vertex_format.MixinRenderRegionArenas", "vertex_format.MixinRenderSectionManager", + "vertex_format.MixinSodiumBufferBuilder", "vertex_format.MixinCommonVertexAttributes", "vertex_format.CommonVertexAttributeAccessor", "vertex_format.MixinVertexSerializerCache",