Skip to content

Commit

Permalink
Merge branch '1.20.3' into patch-8
Browse files Browse the repository at this point in the history
  • Loading branch information
Madis0 authored Oct 22, 2024
2 parents 8485b0a + a640a8a commit e6a1e2a
Show file tree
Hide file tree
Showing 71 changed files with 1,571 additions and 533 deletions.
7 changes: 1 addition & 6 deletions LICENSE-DEPENDENCIES
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
Incompatible licenses:

glsl-transformer is licensed under the glsl-transformer Noncommercial License 1.0.0. Details on this can be found in https://github.com/IrisShaders/glsl-transformer/blob/main/LICENSE.
The license text is short and easy to understand, but the gist is that you may distribute unmodified editions of this library and them in new works, under the condition that you qualify as a noncommercial entity. If you need to modify it, you may only do so in private or by contributing the changes back to the IrisShaders/glsl-transformer repository under the Contributor License Agreement. Using and distributing this library as part of a noncommercial, meaning access to it is not conditioned on payment or other compensation, Minecraft mod or related software falls under the allowed purposes. You are required to obtain a commercial license for using this library for any purpose other than a noncommercial one.

This license is not applicable if linking with a program (Iris) containing glsl-transformer, unless the linker interacts with the library's API directly.

tl;dr: If you intend to just depend on Iris and need to depend on the transformer due to that, you're fine. If you intend to use the transformer in any way, you must follow the license as followed above.
glsl-transformer is licensed under the GNU Affero General Public License version 3. This may affect your ability to distribute Iris.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ So, if you want to distribute a Forge port of Iris, we'd prefer if you let us kn

All code in this (Iris) repository is completely free and open source, and you are free to read, distribute, and modify the code as long as you abide by the (fairly reasonable) terms of the [GNU LGPLv3 license](https://github.com/IrisShaders/Iris/blob/master/LICENSE).

Dependencies may not be under an applicable license: See the [Incompatible Dependencies](https://github.com/IrisShaders/Iris/blob/master/LICENSE-DEPENDENCIES) page for more information.

You are not allowed to redistribute Iris commerically or behind a paywall, unless you get a commercial license for GLSL Transformer. See above for more information.
glsl-transformer is licensed under the GNU Affero General Public License version 3. This may affect your ability to distribute Iris.

Though it's not legally required, I'd appreciate it if you could ask before hosting your own public downloads for compiled versions of Iris. Though if you want to add the mod to a site like MCBBS, that's fine, no need to ask me.
28 changes: 23 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ object Constants {
const val FABRIC_API_VERSION: String = "0.96.0+1.20.4"

// https://semver.org/
const val MOD_VERSION: String = "1.7.0"
const val MOD_VERSION: String = "1.7.2"

const val CUSTOM_SODIUM: Boolean = false
const val CUSTOM_SODIUM_NAME: String = ""
Expand All @@ -33,6 +33,7 @@ repositories {
includeGroup("maven.modrinth")
}
}
maven("https://maven.covers1624.net/")
}

plugins {
Expand All @@ -53,6 +54,21 @@ base {
}

loom {
runs {
create("clientWithQuickplay") {
client()
isIdeConfigGenerated = true
programArgs("--launch_target", "net.fabricmc.loader.impl.launch.knot.KnotClient")
mainClass.set("net.covers1624.devlogin.DevLogin")
projectDir.resolve("run").resolve("mods").resolve(Constants.MINECRAFT_VERSION).mkdirs()
vmArgs("-Dfabric.modsFolder=" + projectDir.resolve("run").resolve("mods").resolve(Constants.MINECRAFT_VERSION).absolutePath)
programArgs("--quickPlaySingleplayer", "World For " + Constants.MINECRAFT_VERSION)
if (Constants.ACTIVATE_RENDERDOC && DefaultNativePlatform.getCurrentOperatingSystem().isLinux) {
environmentVariable("LD_PRELOAD", "/usr/lib/librenderdoc.so")
}
}
}

mixin {
useLegacyMixinAp = false
}
Expand Down Expand Up @@ -134,11 +150,12 @@ dependencies {
minecraft(group = "com.mojang", name = "minecraft", version = Constants.MINECRAFT_VERSION)
mappings(loom.officialMojangMappings())
modImplementation(group = "net.fabricmc", name = "fabric-loader", version = Constants.FABRIC_LOADER_VERSION)
localRuntime("net.covers1624:DevLogin:0.1.0.5")

include("org.antlr:antlr4-runtime:4.11.1")
modImplementation("org.antlr:antlr4-runtime:4.11.1")
include("io.github.douira:glsl-transformer:2.0.0-pre13")
modImplementation("io.github.douira:glsl-transformer:2.0.0-pre13")
include("org.antlr:antlr4-runtime:4.13.1")
modImplementation("org.antlr:antlr4-runtime:4.13.1")
include("io.github.douira:glsl-transformer:2.0.1")
modImplementation("io.github.douira:glsl-transformer:2.0.1")
include("org.anarres:jcpp:1.4.14")
modImplementation("org.anarres:jcpp:1.4.14")

Expand Down Expand Up @@ -173,6 +190,7 @@ tasks {
environment("LD_PRELOAD", "/usr/lib/librenderdoc.so")
}
}

getByName<JavaCompile>("compileDesktopJava") {
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
targetCompatibility = JavaVersion.VERSION_1_8.toString()
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/kroppeb/stareval/function/AbstractTypedFunction.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package kroppeb.stareval.function;

import java.util.Arrays;
import java.util.Objects;

public abstract class AbstractTypedFunction implements TypedFunction {
private final Type returnType;
Expand Down Expand Up @@ -41,4 +42,26 @@ public boolean isPure() {
public int priority() {
return this.priority;
}

@Override
public boolean equals(Object obj) {
if (obj instanceof AbstractTypedFunction func) {
return Objects.equals(returnType, func.returnType) &&
Arrays.equals(parameters, func.parameters) &&
priority == func.priority &&
isPure == func.isPure;
}

return false;
}

@Override
public int hashCode() {
return Objects.hash(returnType, Arrays.hashCode(parameters), priority, isPure);
}

@Override
public String toString() {
return TypedFunction.format(this, "unknown");
}
}
14 changes: 14 additions & 0 deletions src/main/java/kroppeb/stareval/function/TypedFunction.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import kroppeb.stareval.expression.Expression;

import java.util.Arrays;
import java.util.Objects;
import java.util.stream.Collectors;

public interface TypedFunction {
Expand Down Expand Up @@ -53,6 +54,19 @@ public Type type() {
public boolean constant() {
return this.isConstant;
}

@Override
public boolean equals(Object obj) {
if (obj instanceof Parameter p) {
return Objects.equals(type, p.type) && Objects.equals(isConstant, p.isConstant);
}
return false;
}

@Override
public int hashCode() {
return Objects.hashCode(type) + 3192 + Objects.hashCode(isConstant);
}
}
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package net.irisshaders.batchedentityrendering.impl.wrappers;

import net.irisshaders.batchedentityrendering.impl.BlendingStateHolder;
import net.irisshaders.batchedentityrendering.impl.TransparencyType;
import net.irisshaders.batchedentityrendering.impl.WrappableRenderType;
import net.irisshaders.batchedentityrendering.mixin.RenderTypeAccessor;
import net.minecraft.client.renderer.RenderType;
Expand All @@ -8,7 +10,7 @@
import java.util.Objects;
import java.util.Optional;

public class TaggingRenderTypeWrapper extends RenderType implements WrappableRenderType {
public class TaggingRenderTypeWrapper extends RenderType implements WrappableRenderType, BlendingStateHolder {
private final int tag;
private final RenderType wrapped;

Expand Down Expand Up @@ -58,11 +60,21 @@ public boolean equals(@Nullable Object object) {
public int hashCode() {
// Add one so that we don't have the exact same hash as the wrapped object.
// This means that we won't have a guaranteed collision if we're inserted to a map alongside the unwrapped object.
return this.wrapped.hashCode() + 1;
return this.wrapped.hashCode() + this.tag + 1;
}

@Override
public String toString() {
return "tagged(" + tag + "):" + this.wrapped.toString();
}

@Override
public TransparencyType getTransparencyType() {
return ((BlendingStateHolder) wrapped).getTransparencyType();
}

@Override
public void setTransparencyType(TransparencyType transparencyType) {
((BlendingStateHolder) wrapped).setTransparencyType(transparencyType);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package net.irisshaders.batchedentityrendering.mixin;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.renderer.LevelRenderer;
import net.minecraft.world.entity.Entity;
Expand Down Expand Up @@ -40,17 +42,15 @@ public class MixinLevelRenderer_EntityListSorting {
@Shadow
private ClientLevel level;

@ModifyVariable(method = "renderLevel", at = @At(value = "INVOKE_ASSIGN", target = "Ljava/lang/Iterable;iterator()Ljava/util/Iterator;"),
slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/RenderBuffers;bufferSource()Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;"),
to = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/EntityRenderDispatcher;shouldRender(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/client/renderer/culling/Frustum;DDD)Z")), allow = 1)
private Iterator<Entity> batchedentityrendering$sortEntityList(Iterator<Entity> iterator) {
@WrapOperation(method = "renderLevel", at = @At(value = "INVOKE", target = "Ljava/lang/Iterable;iterator()Ljava/util/Iterator;"))
private Iterator<Entity> batchedentityrendering$sortEntityList(Iterable<Entity> instance, Operation<Iterator<Entity>> original) {
// Sort the entity list first in order to allow vanilla's entity batching code to work better.
this.level.getProfiler().push("sortEntityList");

Map<EntityType<?>, List<Entity>> sortedEntities = new HashMap<>();

List<Entity> entities = new ArrayList<>();
iterator.forEachRemaining(entity -> {
original.call(instance).forEachRemaining(entity -> {
sortedEntities.computeIfAbsent(entity.getType(), entityType -> new ArrayList<>(32)).add(entity);
});

Expand Down
30 changes: 18 additions & 12 deletions src/main/java/net/irisshaders/iris/Iris.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.irisshaders.iris.compat.dh.DHCompat;
import net.irisshaders.iris.config.IrisConfig;
import net.irisshaders.iris.gl.GLDebug;
import net.irisshaders.iris.gl.buffer.ShaderStorageBufferHolder;
import net.irisshaders.iris.gl.shader.ShaderCompileException;
import net.irisshaders.iris.gl.shader.StandardMacros;
import net.irisshaders.iris.gui.debug.DebugLoadFailedGridScreen;
Expand Down Expand Up @@ -97,7 +98,6 @@ public class Iris {

static {
if (!BuildConfig.ACTIVATE_RENDERDOC && FabricLoader.getInstance().isDevelopmentEnvironment() && System.getProperty("user.name").contains("ims") && Util.getPlatform() == Util.OS.LINUX) {
Configuration.GLFW_LIBRARY_NAME.set("/usr/lib/libglfw.so");
}
}

Expand Down Expand Up @@ -313,6 +313,7 @@ private static boolean loadExternalShaderpack(String name) {
} catch (Exception e) {
logger.error("Failed to load the shaderpack \"{}\"!", name);
logger.error("", e);
handleException(e);

return false;
}
Expand All @@ -325,6 +326,19 @@ private static boolean loadExternalShaderpack(String name) {
return true;
}

private static void handleException(Exception e) {
if (lastDimension != null && irisConfig.areDebugOptionsEnabled()) {
Minecraft.getInstance().setScreen(new DebugLoadFailedGridScreen(Minecraft.getInstance().screen, Component.literal(e instanceof ShaderCompileException ? "Failed to compile shaders" : "Exception"), e));
} else {
if (Minecraft.getInstance().player != null) {
Minecraft.getInstance().player.displayClientMessage(Component.translatable(e instanceof ShaderCompileException ? "iris.load.failure.shader" : "iris.load.failure.generic").append(Component.literal("Copy Info").withStyle(arg -> arg.withUnderlined(true).withColor(
ChatFormatting.BLUE).withClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, e.getMessage())))), false);
} else {
storedError = Optional.of(e);
}
}
}

private static Optional<Path> loadExternalZipShaderpack(Path shaderpackPath) throws IOException {
FileSystem zipSystem = FileSystems.newFileSystem(shaderpackPath, Iris.class.getClassLoader());
zipFileSystem = zipSystem;
Expand Down Expand Up @@ -356,8 +370,6 @@ private static void setShadersDisabled() {
currentPack = null;
fallback = false;
currentPackName = "(off)";

logger.info("Shaders are disabled");
}

public static void setDebug(boolean enable) {
Expand Down Expand Up @@ -579,15 +591,9 @@ private static WorldRenderingPipeline createPipeline(NamespacedId dimensionId) {
try {
return new IrisRenderingPipeline(programs);
} catch (Exception e) {
if (irisConfig.areDebugOptionsEnabled()) {
Minecraft.getInstance().setScreen(new DebugLoadFailedGridScreen(Minecraft.getInstance().screen, Component.literal(e instanceof ShaderCompileException ? "Failed to compile shaders" : "Exception"), e));
} else {
if (Minecraft.getInstance().player != null) {
Minecraft.getInstance().player.displayClientMessage(Component.translatable(e instanceof ShaderCompileException ? "iris.load.failure.shader" : "iris.load.failure.generic").append(Component.literal("Copy Info").withStyle(arg -> arg.withUnderlined(true).withColor(ChatFormatting.BLUE).withClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, e.getMessage())))), false);
} else {
storedError = Optional.of(e);
}
}
handleException(e);

ShaderStorageBufferHolder.forceDeleteBuffers();
logger.error("Failed to create shader rendering pipeline, disabling shaders!", e);
// TODO: This should be reverted if a dimension change causes shaders to compile again
fallback = true;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/irisshaders/iris/compat/dh/DHCompat.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static void run() {
if (e instanceof ExceptionInInitializerError eiie) {
throw new RuntimeException("Failure loading DH compat.", eiie.getCause());
} else {
throw new RuntimeException("DH 2.0 not found, yet Fabric claims it's there. Curious.", e);
throw new RuntimeException("DH found, but one or more API methods are missing. Iris requires DH [2.0.4] or DH API version [1.1.0] or newer. Please make sure you are on the latest version of DH and Iris.", e);
}
} else {
Iris.logger.info("DH not found, and classes not found.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public enum FeatureFlags {
CUSTOM_IMAGES(() -> true, IrisRenderSystem::supportsImageLoadStore),
PER_BUFFER_BLENDING(() -> true, IrisRenderSystem::supportsBufferBlending),
COMPUTE_SHADERS(() -> true, IrisRenderSystem::supportsCompute),
TESSELATION_SHADERS(() -> true, IrisRenderSystem::supportsTesselation),
TESSELLATION_SHADERS(() -> true, IrisRenderSystem::supportsTesselation),
ENTITY_TRANSLUCENT(() -> true, () -> true),
REVERSED_CULLING(() -> true, () -> true),
BLOCK_EMISSION_ATTRIBUTE(() -> true, () -> true),
Expand Down Expand Up @@ -59,6 +59,11 @@ public static boolean isInvalid(String name) {
}

public static FeatureFlags getValue(String value) {
if (value.equalsIgnoreCase("TESSELATION_SHADERS")) {
// fix the sins of the past
value = "TESSELLATION_SHADERS";
}

try {
return FeatureFlags.valueOf(value.toUpperCase(Locale.US));
} catch (IllegalArgumentException e) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/irisshaders/iris/gl/GLDebug.java
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,11 @@ public static void nameObject(int id, int object, String name) {
}

public static void pushGroup(int id, String name) {
debugState.pushGroup(id, name);
//debugState.pushGroup(id, name);
}

public static void popGroup() {
debugState.popGroup();
//debugState.popGroup();
}

private interface DebugState {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/net/irisshaders/iris/gl/IrisLimits.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ public class IrisLimits {
* is implemented.
*/
public static final int MAX_COLOR_BUFFERS = 16;
public static final boolean VK_CONFORMANCE = false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ public void resizeIfRelative(int width, int height) {
GlStateManager._glBindBuffer(GL43C.GL_SHADER_STORAGE_BUFFER, newId);

// Calculation time
int newWidth = (int) (width * info.scaleX());
int newHeight = (int) (height * info.scaleY());
int finalSize = (newHeight * newWidth) * info.size();
long newWidth = (long) (width * info.scaleX());
long newHeight = (long) (height * info.scaleY());
long finalSize = (newHeight * newWidth) * info.size();
IrisRenderSystem.bufferStorage(GL43C.GL_SHADER_STORAGE_BUFFER, finalSize, 0);
IrisRenderSystem.clearBufferSubData(GL43C.GL_SHADER_STORAGE_BUFFER, GL43C.GL_R8, 0, finalSize, GL43C.GL_RED, GL43C.GL_BYTE, new int[]{0});
IrisRenderSystem.bindBufferBase(GL43C.GL_SHADER_STORAGE_BUFFER, index, newId);
Expand Down
Loading

0 comments on commit e6a1e2a

Please sign in to comment.