From d46ea2df416e5d6bdfe4dbdc07412a228853969e Mon Sep 17 00:00:00 2001 From: IMS212 Date: Thu, 1 Aug 2024 15:57:07 -0700 Subject: [PATCH] New Sodium + FMA! --- build.gradle.kts | 2 +- common/build.gradle.kts | 2 +- .../AdvancedShadowCullingFrustum.java | 26 +++---------------- .../shadow_map/MixinRenderSectionManager.java | 2 +- fabric/build.gradle.kts | 2 +- neoforge/build.gradle.kts | 11 ++++---- 6 files changed, 14 insertions(+), 31 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 98eb0e7d2d..47c8e2c55e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ val MINECRAFT_VERSION by extra { "1.21" } val NEOFORGE_VERSION by extra { "21.0.143" } val FABRIC_LOADER_VERSION by extra { "0.15.11" } val FABRIC_API_VERSION by extra { "0.100.4+1.21" } -val SODIUM_FILE by extra { "sodium-fabric-0.6.0-snapshot+mc1.21-local.jar" } +val SODIUM_FILE by extra { "sodium-LOADER-0.6.0-alpha.3+mc1.21.jar" } // https://semver.org/ val MOD_VERSION by extra { "1.8.0" } diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 23353cbab6..83b8aea3f4 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -46,7 +46,7 @@ dependencies { modCompileOnly("io.github.douira:glsl-transformer:2.0.1") modCompileOnly("org.anarres:jcpp:1.4.14") - modCompileOnly(files(rootDir.resolve("custom_sodium").resolve(SODIUM_FILE))) + modCompileOnly(files(rootDir.resolve("custom_sodium").resolve(SODIUM_FILE.replace("LOADER", "fabric")))) modCompileOnly(files(rootDir.resolve("DHApi.jar"))) } diff --git a/common/src/main/java/net/irisshaders/iris/shadows/frustum/advanced/AdvancedShadowCullingFrustum.java b/common/src/main/java/net/irisshaders/iris/shadows/frustum/advanced/AdvancedShadowCullingFrustum.java index cc1766b474..a8a4d3995a 100644 --- a/common/src/main/java/net/irisshaders/iris/shadows/frustum/advanced/AdvancedShadowCullingFrustum.java +++ b/common/src/main/java/net/irisshaders/iris/shadows/frustum/advanced/AdvancedShadowCullingFrustum.java @@ -4,7 +4,6 @@ import net.irisshaders.iris.shadows.frustum.BoxCuller; import net.minecraft.client.renderer.culling.Frustum; import net.minecraft.world.phys.AABB; -import org.joml.Math; import org.joml.Matrix4f; import org.joml.Matrix4fc; import org.joml.Vector3f; @@ -324,34 +323,17 @@ protected int isVisible(double minX, double minY, double minZ, double maxX, doub * @return 0 if nothing is visible, 1 if everything is visible, 2 if only some corners are visible. */ protected int checkCornerVisibility(float minX, float minY, float minZ, float maxX, float maxY, float maxZ) { - float outsideBoundX; - float outsideBoundY; - float outsideBoundZ; - for (int i = 0; i < planeCount; ++i) { Vector4f plane = this.planes[i]; // Check if plane is inside or intersecting. // This is ported from JOML's FrustumIntersection. - if (plane.x() < 0) { - outsideBoundX = minX; - } else { - outsideBoundX = maxX; - } - - if (plane.y() < 0) { - outsideBoundY = minY; - } else { - outsideBoundY = maxY; - } - - if (plane.z() < 0) { - outsideBoundZ = minZ; - } else { - outsideBoundZ = maxZ; - } + float outsideBoundX = (plane.x() < 0) ? minX : maxX; + float outsideBoundY = (plane.y() < 0) ? minY : maxY; + float outsideBoundZ = (plane.z() < 0) ? minZ : maxZ; + // Use Math.fma for the dot product calculation to get vectorization (sorry old Intel users) if (Math.fma(plane.x(), outsideBoundX, Math.fma(plane.y(), outsideBoundY, plane.z() * outsideBoundZ)) < -plane.w()) { return 0; } diff --git a/common/src/sodiumCompatibility/java/net/irisshaders/iris/compat/sodium/mixin/shadow_map/MixinRenderSectionManager.java b/common/src/sodiumCompatibility/java/net/irisshaders/iris/compat/sodium/mixin/shadow_map/MixinRenderSectionManager.java index 5151bee079..311c8f1044 100644 --- a/common/src/sodiumCompatibility/java/net/irisshaders/iris/compat/sodium/mixin/shadow_map/MixinRenderSectionManager.java +++ b/common/src/sodiumCompatibility/java/net/irisshaders/iris/compat/sodium/mixin/shadow_map/MixinRenderSectionManager.java @@ -59,7 +59,7 @@ private void useShadowTaskrList(RenderSectionManager instance, @NotNull Map