Skip to content

Commit

Permalink
Merge branch '1.19.4' into 1.20.1
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
#	src/main/java/net/coderbot/iris/Iris.java
#	src/main/java/net/coderbot/iris/mixin/MixinTitleScreen.java
#	src/main/java/net/coderbot/iris/mixin/gui/MixinGui.java
  • Loading branch information
IMS212 committed Dec 5, 2023
2 parents 35b1bde + 26dc6e5 commit a528475
Show file tree
Hide file tree
Showing 24 changed files with 230 additions and 184 deletions.
3 changes: 2 additions & 1 deletion buildscript/src/main/java/Buildscript.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public MappingTree createMappings() {

@Override
public FabricLoader getLoader() {
return new FabricLoader(FabricMaven.URL, FabricMaven.loader("0.14.22"));
return new FabricLoader(FabricMaven.URL, FabricMaven.loader("0.14.24"));
}

@Override
Expand Down Expand Up @@ -101,6 +101,7 @@ public void getModDependencies(ModDependencyCollector d) {

jij(d.addMaven(Maven.MAVEN_CENTRAL, new MavenId("io.github.douira:glsl-transformer:2.0.0-pre13"), ModDependencyFlag.COMPILE, ModDependencyFlag.RUNTIME));
jij(d.addMaven(Maven.MAVEN_CENTRAL, new MavenId("org.antlr:antlr4-runtime:4.11.1"), ModDependencyFlag.COMPILE, ModDependencyFlag.RUNTIME));
d.addMaven("https://api.modrinth.com/maven", new MavenId("maven.modrinth", "distanthorizons", "2.0.0-a-1.19.4"), ModDependencyFlag.COMPILE);

if (SODIUM) {
d.addMaven(FabricMaven.URL, new MavenId(FabricMaven.GROUP_ID + ".fabric-api", "fabric-api-base", "0.4.17+93d8cb8253"), ModDependencyFlag.COMPILE, ModDependencyFlag.RUNTIME);
Expand Down
21 changes: 0 additions & 21 deletions src/main/java/net/coderbot/iris/Iris.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ public class Iris {
private static ShaderPack currentPack;
private static String currentPackName;
private static Optional<Exception> storedError = Optional.empty();
private static boolean sodiumInvalid;
private static boolean hasNEC;
private static boolean sodiumInstalled;
private static boolean initialized;

private static PipelineManager pipelineManager;
Expand Down Expand Up @@ -114,12 +111,6 @@ public class Iris {
* <p>This is called right before options are loaded, so we can add key bindings here.</p>
*/
public void onEarlyInitialize() {
FabricLoader.getInstance().getModContainer("sodium").ifPresent(
modContainer -> sodiumInstalled = true
);

hasNEC = FabricLoader.getInstance().isModLoaded("notenoughcrashes");

ModContainer iris = FabricLoader.getInstance().getModContainer(MODID)
.orElseThrow(() -> new IllegalStateException("Couldn't find the mod container for Iris"));

Expand Down Expand Up @@ -753,18 +744,6 @@ public static String getBackupVersionNumber() {
return backupVersionNumber;
}

public static boolean isSodiumInvalid() {
return sodiumInvalid;
}

public static boolean isSodiumInstalled() {
return sodiumInstalled;
}

public static boolean hasNotEnoughCrashes() {
return hasNEC;
}

public static Path getShaderpacksDirectory() {
if (shaderpacksDirectory == null) {
shaderpacksDirectory = FabricLoader.getInstance().getGameDir().resolve("shaderpacks");
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/net/coderbot/iris/compat/dh/DHCompat.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package net.coderbot.iris.compat.dh;

import net.coderbot.iris.gl.framebuffer.GlFramebuffer;

public class DHCompat {
private GlFramebuffer fb;

public int getFramebuffer() {
return fb.getId();
}

public void setFramebuffer(GlFramebuffer fb) {
this.fb = fb;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package net.coderbot.iris.compat.dh.mixin;

import net.fabricmc.loader.api.FabricLoader;
import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;

import java.util.List;
import java.util.Set;

/**
* Non-critical mixin config plugin, just disables mixins if Distant Horizons isn't present,
* since otherwise the log gets spammed with warnings.
*/
public class IrisDHCompatMixinPlugin implements IMixinConfigPlugin {
@Override
public void onLoad(String mixinPackage) {

}

@Override
public String getRefMapperConfig() {
return null;
}

@Override
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
return FabricLoader.getInstance().isModLoaded("distanthorizons");
}

@Override
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {

}

@Override
public List<String> getMixins() {
return null;
}

@Override
public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {

}

@Override
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package net.coderbot.iris.compat.dh.mixin;

import com.seibel.distanthorizons.core.render.renderer.shaders.DhApplyShader;
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
import net.coderbot.iris.Iris;
import net.coderbot.iris.compat.dh.DHCompat;
import net.coderbot.iris.pipeline.WorldRenderingPipeline;
import net.coderbot.iris.pipeline.newshader.NewWorldRenderingPipeline;
import net.irisshaders.iris.api.v0.IrisApi;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(value = DhApplyShader.class, remap = false)
public class MixinDHApplyShader {
@Redirect(method = "onRender", at = @At(value = "INVOKE", target = "Lcom/seibel/distanthorizons/core/wrapperInterfaces/minecraft/IMinecraftRenderWrapper;getTargetFrameBuffer()I"))
private int changeFB(IMinecraftRenderWrapper instance) {
if (Iris.getPipelineManager().getPipelineNullable() instanceof NewWorldRenderingPipeline pipeline) {
return pipeline.getDHCompat().getFramebuffer();
} else {
return instance.getTargetFrameBuffer();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,19 @@ public abstract class MixinDebugScreenOverlay {

messages.add(3, "Direct Buffers: +" + iris$humanReadableByteCountBin(iris$directPool.getMemoryUsed()));

if (!Iris.isSodiumInstalled()) {
messages.add(3, "Native Memory: +" + iris$humanReadableByteCountBin(iris$getNativeMemoryUsage()));
}
//if (!Iris.isSodiumInstalled()) {
// messages.add(3, "Native Memory: +" + iris$humanReadableByteCountBin(iris$getNativeMemoryUsage()));
//}
}

@Inject(method = "getGameInformation", at = @At("RETURN"))
private void iris$appendShadowDebugText(CallbackInfoReturnable<List<String>> cir) {
List<String> messages = cir.getReturnValue();

if (!Iris.isSodiumInstalled() && Iris.getCurrentPack().isPresent()) {
messages.add(1, ChatFormatting.YELLOW + "[" + Iris.MODNAME + "] Sodium isn't installed; you will have poor performance.");
messages.add(2, ChatFormatting.YELLOW + "[" + Iris.MODNAME + "] Install Sodium if you want to run benchmarks or get higher FPS!");
}
//if (!Iris.isSodiumInstalled() && Iris.getCurrentPack().isPresent()) {
// messages.add(1, ChatFormatting.YELLOW + "[" + Iris.MODNAME + "] Sodium isn't installed; you will have poor performance.");
// messages.add(2, ChatFormatting.YELLOW + "[" + Iris.MODNAME + "] Install Sodium if you want to run benchmarks or get higher FPS!");
//}

Iris.getPipelineManager().getPipeline().ifPresent(pipeline -> pipeline.addDebugText(messages));
}
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/net/coderbot/iris/mixin/MixinGameRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ public class MixinGameRenderer {
itemInHandRenderer.renderHandsWithItems(tickDelta, poseStack, bufferSource, localPlayer, light);
}

@Inject(method = "renderLevel", at = @At("TAIL"))
private void iris$runColorSpace(float pGameRenderer0, long pLong1, PoseStack pPoseStack2, CallbackInfo ci) {
Iris.getPipelineManager().getPipeline().ifPresent(WorldRenderingPipeline::finalizeGameRendering);
}

@Redirect(method = "reloadShaders", at = @At(value = "INVOKE", target = "Lcom/google/common/collect/Lists;newArrayList()Ljava/util/ArrayList;"))
private ArrayList<Program> iris$reloadGeometryShaders() {
ArrayList<Program> programs = Lists.newArrayList();
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/net/coderbot/iris/mixin/MixinLevelRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ public class MixinLevelRenderer {
private void iris$setupPipeline(PoseStack poseStack, float tickDelta, long startTime, boolean renderBlockOutline,
Camera camera, GameRenderer gameRenderer, LightTexture lightTexture,
Matrix4f projection, CallbackInfo callback) {
if (Iris.isSodiumInvalid() && !FabricLoader.getInstance().isDevelopmentEnvironment()) {
throw new IllegalStateException("An invalid version of Sodium is installed, and the warning screen somehow" +
" didn't work. This is a bug! Please report it to the Iris developers.");
}

IrisTimeUniforms.updateTime();
CapturedRenderingState.INSTANCE.setGbufferModelView(poseStack.last().pose());
CapturedRenderingState.INSTANCE.setGbufferProjection(projection);
Expand Down
8 changes: 0 additions & 8 deletions src/main/java/net/coderbot/iris/mixin/MixinSystemReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,5 @@ private void fillSystemDetails(CallbackInfo ci) {
});
return sb.toString();
});

this.setDetail("NEC status", () -> {
if (Iris.hasNotEnoughCrashes()) {
return "Has NEC: INVALID";
} else {
return "No NEC detected";
}
});
}
}
75 changes: 4 additions & 71 deletions src/main/java/net/coderbot/iris/mixin/MixinTitleScreen.java
Original file line number Diff line number Diff line change
@@ -1,28 +1,14 @@
package net.coderbot.iris.mixin;

import com.google.common.collect.ImmutableList;
import net.coderbot.iris.Iris;
import net.coderbot.iris.gui.debug.DebugLoadFailedGridScreen;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.ChatFormatting;
import net.minecraft.Util;
import net.minecraft.client.GraphicsStatus;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.AlertScreen;
import net.minecraft.client.gui.screens.ConfirmScreen;
import net.minecraft.client.gui.screens.PopupScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.TitleScreen;

import net.minecraft.network.chat.Component;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.net.URI;
import java.net.URISyntaxException;

@Mixin(TitleScreen.class)
public class MixinTitleScreen extends Screen {
private static boolean iris$hasFirstInit;
Expand All @@ -32,65 +18,12 @@ protected MixinTitleScreen(Component arg) {
}

@Inject(method = "init", at = @At("RETURN"))
public void iris$showSodiumIncompatScreen(CallbackInfo ci) {
if (iris$hasFirstInit) return;

String reason;

if (!Iris.isSodiumInstalled() && !FabricLoader.getInstance().isDevelopmentEnvironment()) {
reason = "iris.sodium.failure.reason.notFound";
} else if (Iris.isSodiumInvalid()) {
reason = "iris.sodium.failure.reason.incompatible";
} else if (Iris.hasNotEnoughCrashes()) {
Minecraft.getInstance().setScreen(new ConfirmScreen(
bool -> {
if (bool) {
if (!iris$hasFirstInit) {
Iris.onLoadingComplete();
}

iris$hasFirstInit = true;

Minecraft.getInstance().setScreen(this);
} else {
Minecraft.getInstance().stop();
}
},
Component.translatable("iris.nec.failure.title", Iris.MODNAME).withStyle(ChatFormatting.BOLD, ChatFormatting.RED),
Component.translatable("iris.nec.failure.description"),
Component.translatable("options.graphics.warning.accept").withStyle(ChatFormatting.RED),
Component.translatable("menu.quit").withStyle(ChatFormatting.BOLD)));
return;
} else {
if (!iris$hasFirstInit) {
Iris.onLoadingComplete();
}

iris$hasFirstInit = true;

return;
public void iris$firstInit(CallbackInfo ci) {
if (!iris$hasFirstInit) {
Iris.onLoadingComplete();
}

iris$hasFirstInit = true;

/*Minecraft.getInstance().setScreen(new ConfirmScreen(
(boolean accepted) -> {
if (accepted) {
try {
Util.getPlatform().openUri(new URI(SodiumVersionCheck.getDownloadLink()));
} catch (URISyntaxException e) {
throw new IllegalStateException(e);
}
} else {
if (FabricLoader.getInstance().isDevelopmentEnvironment()) {
Minecraft.getInstance().setScreen(this);
} else {
Minecraft.getInstance().stop();
}
}
},
Component.translatable("iris.sodium.failure.title").withStyle(ChatFormatting.RED),
Component.translatable(reason),
Component.translatable("iris.sodium.failure.download"),
FabricLoader.getInstance().isDevelopmentEnvironment() ? Component.literal("Continue (Development)") : Component.translatable("menu.quit")));*/
}
}
26 changes: 0 additions & 26 deletions src/main/java/net/coderbot/iris/mixin/gui/MixinGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,6 @@ public class MixinGui {
}
}

@Inject(method = "render", at = @At("RETURN"))
public void iris$displayBigSodiumWarning(GuiGraphics guiGraphics, float pFloat1, CallbackInfo ci) {
if (Iris.isSodiumInstalled()
|| Minecraft.getInstance().options.renderDebug
|| !Iris.getCurrentPack().isPresent()) {
return;
}

Font font = Minecraft.getInstance().font;

List<String> warningLines = new ArrayList<>();
warningLines.add("[" + Iris.MODNAME + "] Sodium isn't installed; you will have poor performance.");
warningLines.add("[" + Iris.MODNAME + "] Install Sodium if you want to run benchmarks or get higher FPS!");

for (int i = 0; i < warningLines.size(); ++i) {
String string = warningLines.get(i);

final int lineHeight = 9;
final int lineWidth = font.width(string);
final int y = 2 + lineHeight * i;

guiGraphics.fill(1, y - 1, 2 + lineWidth + 1, y + lineHeight - 1, 0x9050504E);
guiGraphics.drawString(font, string, 2, y, 0xFFFF55);
}
}

@Inject(method = "renderVignette", at = @At("HEAD"), cancellable = true)
private void iris$disableVignetteRendering(GuiGraphics pGui0, Entity pEntity1, CallbackInfo ci) {
WorldRenderingPipeline pipeline = Iris.getPipelineManager().getPipelineNullable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import net.coderbot.iris.Iris;
import net.coderbot.iris.block_rendering.BlockMaterialMapping;
import net.coderbot.iris.block_rendering.BlockRenderingSettings;
import net.coderbot.iris.compat.dh.DHCompat;
import net.coderbot.iris.features.FeatureFlags;
import net.coderbot.iris.gbuffer_overrides.matching.InputAvailability;
import net.coderbot.iris.gbuffer_overrides.matching.ProgramTable;
Expand Down Expand Up @@ -82,8 +83,6 @@
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.renderer.texture.AbstractTexture;
import org.jetbrains.annotations.Nullable;
import org.lwjgl.opengl.GL;
import org.lwjgl.opengl.GL11C;
import org.lwjgl.opengl.GL15C;
import org.lwjgl.opengl.GL20C;
import org.lwjgl.opengl.GL21C;
Expand Down Expand Up @@ -573,6 +572,11 @@ public float getSunPathRotation() {
return sunPathRotation;
}

@Override
public DHCompat getDHCompat() {
return null;
}

private RenderCondition getCondition(WorldRenderingPhase phase) {
if (isRenderingShadow) {
return RenderCondition.SHADOW;
Expand Down Expand Up @@ -1281,6 +1285,11 @@ public void finalizeLevelRendering() {
isRenderingFullScreenPass = false;
}

@Override
public void finalizeGameRendering() {

}

@Override
public SodiumTerrainPipeline getSodiumTerrainPipeline() {
return sodiumTerrainPipeline;
Expand Down
Loading

0 comments on commit a528475

Please sign in to comment.