Skip to content

Commit

Permalink
Potentially fix #2321
Browse files Browse the repository at this point in the history
  • Loading branch information
IMS212 committed Oct 12, 2024
1 parent d6bf750 commit 23394df
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
14 changes: 14 additions & 0 deletions common/src/main/java/net/irisshaders/iris/gl/IrisRenderSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import net.irisshaders.iris.Iris;
import net.irisshaders.iris.gl.sampler.SamplerLimits;
import net.irisshaders.iris.mixin.GlStateManagerAccessor;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen;
import org.jetbrains.annotations.Nullable;
import org.joml.Matrix4f;
import org.joml.Vector3i;
Expand Down Expand Up @@ -454,6 +456,18 @@ public static int createBuffers() {
return dsaState.createBuffers();
}

private static boolean cullingState;

public static void backupAndDisableCullingState(boolean b) {
cullingState = Minecraft.getInstance().smartCull;
Minecraft.getInstance().smartCull = Minecraft.getInstance().smartCull && !b;
}

public static void restoreCullingState() {
Minecraft.getInstance().smartCull = cullingState;
cullingState = true;
}

public interface DSAAccess {
void generateMipmaps(int texture, int target);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public class MixinLevelRenderer {
this.overrideFrustum = null;
}

Minecraft.getInstance().smartCull = !pipeline.shouldDisableOcclusionCulling();
IrisRenderSystem.backupAndDisableCullingState(pipeline.shouldDisableOcclusionCulling());

if (Iris.shouldActivateWireframe() && this.minecraft.isLocalServer()) {
IrisRenderSystem.setPolygonMode(GL43C.GL_LINE);
Expand Down Expand Up @@ -141,6 +141,8 @@ private Frustum changeFrustum(Frustum frustum) {
Minecraft.getInstance().gui.getChat().addMessage(Component.literal("A new beta is out for Iris " + info.betaTag + ". Please redownload it.").withStyle(ChatFormatting.BOLD, ChatFormatting.RED)));
}

IrisRenderSystem.restoreCullingState();

if (Iris.shouldActivateWireframe() && this.minecraft.isLocalServer()) {
IrisRenderSystem.setPolygonMode(GL43C.GL_FILL);
}
Expand Down

0 comments on commit 23394df

Please sign in to comment.