Skip to content

Commit

Permalink
Merge branch '1.21.2' into 1.21.2-new
Browse files Browse the repository at this point in the history
  • Loading branch information
IMS212 authored Oct 18, 2024
2 parents 8408aae + 9b36b1a commit 6aac523
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 deletions.
15 changes: 15 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 @@ -7,6 +7,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 @@ -469,8 +471,21 @@ public static String getStringi(int glEnum, int index) {

public static void copyImageSubData(int sourceTexture, int target, int mip, int srcX, int srcY, int srcZ, int destTexture, int dstTarget, int dstMip, int dstX, int dstY, int dstZ, int width, int height, int depth) {
GL46C.glCopyImageSubData(sourceTexture, target, mip, srcX, srcY, srcZ, destTexture, dstTarget, dstMip, dstX, dstY, dstZ, width, height, depth);
}


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 @@ -106,9 +106,10 @@ public class MixinLevelRenderer {
this.cullingFrustum = new NonCullingFrustum();
this.cullingFrustum.prepare(camera.getPosition().x(), camera.getPosition().y(), camera.getPosition().z());
}
pipeline.beginLevelRendering();

pipeline.beginLevelRendering();
pipeline.setPhase(WorldRenderingPhase.NONE);
Minecraft.getInstance().smartCull = !pipeline.shouldDisableOcclusionCulling();
IrisRenderSystem.backupAndDisableCullingState(pipeline.shouldDisableOcclusionCulling());

if (Iris.shouldActivateWireframe() && this.minecraft.isLocalServer()) {
IrisRenderSystem.setPolygonMode(GL43C.GL_LINE);
Expand Down Expand Up @@ -148,6 +149,8 @@ public class MixinLevelRenderer {
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,20 @@ public class IrisVertexFormats {
public static final VertexFormat CLOUDS;

static {
ENTITY_ELEMENT = VertexFormatElement.register(10, 10, VertexFormatElement.Type.SHORT, VertexFormatElement.Usage.GENERIC, 2);
ENTITY_ID_ELEMENT = VertexFormatElement.register(11, 11, VertexFormatElement.Type.USHORT, VertexFormatElement.Usage.UV, 3);
MID_TEXTURE_ELEMENT = VertexFormatElement.register(12, 12, VertexFormatElement.Type.FLOAT, VertexFormatElement.Usage.GENERIC, 2);
TANGENT_ELEMENT = VertexFormatElement.register(13, 13, VertexFormatElement.Type.BYTE, VertexFormatElement.Usage.GENERIC, 4);
MID_BLOCK_ELEMENT = VertexFormatElement.register(14, 14, VertexFormatElement.Type.BYTE, VertexFormatElement.Usage.GENERIC, 3);
int LAST_UV = 0;

for (int i = 0; i < VertexFormatElement.MAX_COUNT; i++) {
VertexFormatElement element = VertexFormatElement.byId(i);
if (element != null && element.usage() == VertexFormatElement.Usage.UV) {
LAST_UV = Math.max(LAST_UV, element.index());
}
}

ENTITY_ELEMENT = VertexFormatElement.register(10, 0, VertexFormatElement.Type.SHORT, VertexFormatElement.Usage.GENERIC, 2);
ENTITY_ID_ELEMENT = VertexFormatElement.register(11, LAST_UV + 1, VertexFormatElement.Type.USHORT, VertexFormatElement.Usage.UV, 3);
MID_TEXTURE_ELEMENT = VertexFormatElement.register(12, 0, VertexFormatElement.Type.FLOAT, VertexFormatElement.Usage.GENERIC, 2);
TANGENT_ELEMENT = VertexFormatElement.register(13, 0, VertexFormatElement.Type.BYTE, VertexFormatElement.Usage.GENERIC, 4);
MID_BLOCK_ELEMENT = VertexFormatElement.register(14, 0, VertexFormatElement.Type.BYTE, VertexFormatElement.Usage.GENERIC, 3);

TERRAIN = VertexFormat.builder()
.add("Position", VertexFormatElement.POSITION)
Expand Down
1 change: 0 additions & 1 deletion neoforge/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ repositories {
}

tasks.jar {

from(rootDir.resolve("LICENSE.md"))

filesMatching("neoforge.mods.toml") {
Expand Down

0 comments on commit 6aac523

Please sign in to comment.