From 67a58fc28ee8513e453b37616f672ef1cec2f8a6 Mon Sep 17 00:00:00 2001 From: MCRcortex <18544518+MCRcortex@users.noreply.github.com> Date: Thu, 25 Jul 2024 00:30:04 +1000 Subject: [PATCH 1/2] Include the perspective matrix when marking graph as dirty (#2617) Co-authored-by: mcrcortex <18544518+MCRcortex@users.noreply.github.com> --- .../sodium/client/render/SodiumWorldRenderer.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/caffeinemc/mods/sodium/client/render/SodiumWorldRenderer.java b/src/main/java/net/caffeinemc/mods/sodium/client/render/SodiumWorldRenderer.java index 41f4204265..fe022ca6ed 100644 --- a/src/main/java/net/caffeinemc/mods/sodium/client/render/SodiumWorldRenderer.java +++ b/src/main/java/net/caffeinemc/mods/sodium/client/render/SodiumWorldRenderer.java @@ -39,6 +39,7 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; +import org.joml.Matrix4f; import org.joml.Vector3d; import java.util.Collection; @@ -57,6 +58,7 @@ public class SodiumWorldRenderer { private Vector3d lastCameraPos; private double lastCameraPitch, lastCameraYaw; private float lastFogDistance; + private Matrix4f lastProjectionMatrix; private boolean useEntityCulling; @@ -179,6 +181,7 @@ public void setupTerrain(Camera camera, Vec3 posRaw = camera.getPosition(); Vector3d pos = new Vector3d(posRaw.x(), posRaw.y(), posRaw.z()); + Matrix4f projectionMatrix = new Matrix4f(RenderSystem.getProjectionMatrix()); float pitch = camera.getXRot(); float yaw = camera.getYRot(); float fogDistance = RenderSystem.getShaderFogEnd(); @@ -186,13 +189,19 @@ public void setupTerrain(Camera camera, if (this.lastCameraPos == null) { this.lastCameraPos = new Vector3d(pos); } + if (this.lastProjectionMatrix == null) { + this.lastProjectionMatrix = new Matrix4f(projectionMatrix); + } boolean cameraLocationChanged = !pos.equals(this.lastCameraPos); boolean cameraAngleChanged = pitch != this.lastCameraPitch || yaw != this.lastCameraYaw || fogDistance != this.lastFogDistance; + boolean cameraProjectionChanged = !projectionMatrix.equals(this.lastProjectionMatrix); + + this.lastProjectionMatrix = projectionMatrix; this.lastCameraPitch = pitch; this.lastCameraYaw = yaw; - if (cameraLocationChanged || cameraAngleChanged) { + if (cameraLocationChanged || cameraAngleChanged || cameraProjectionChanged) { this.renderSectionManager.markGraphDirty(); } From fa787d00e4668de9e76d9730129579edaba11369 Mon Sep 17 00:00:00 2001 From: IMS212 Date: Wed, 24 Jul 2024 07:37:02 -0700 Subject: [PATCH 2/2] Fix incorrect driver parsing code Fixes #2614 --- .../sodium/client/compatibility/checks/PreLaunchChecks.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/caffeinemc/mods/sodium/client/compatibility/checks/PreLaunchChecks.java b/src/main/java/net/caffeinemc/mods/sodium/client/compatibility/checks/PreLaunchChecks.java index 3ffc0026e4..eb2912bb04 100644 --- a/src/main/java/net/caffeinemc/mods/sodium/client/compatibility/checks/PreLaunchChecks.java +++ b/src/main/java/net/caffeinemc/mods/sodium/client/compatibility/checks/PreLaunchChecks.java @@ -69,7 +69,7 @@ public static void onGameInit() { Required version: 10.18.10.5161 (or newer) You must update your graphics card driver in order to continue.""" - .replace("###CURRENT_DRIVER###", NvidiaDriverVersion.parse(installedVersion).toString()), + .replace("###CURRENT_DRIVER###", installedVersion.toString()), "https://github.com/CaffeineMC/sodium-fabric/wiki/Driver-Compatibility#windows-intel-gen7"); } } @@ -87,7 +87,7 @@ public static void onGameInit() { Required version: 536.23 (or newer) You must update your graphics card driver in order to continue.""" - .replace("###CURRENT_DRIVER###", installedVersion.toString()), + .replace("###CURRENT_DRIVER###", NvidiaDriverVersion.parse(installedVersion).toString()), "https://github.com/CaffeineMC/sodium-fabric/wiki/Driver-Compatibility#nvidia-gpus"); }