diff --git a/common/src/disabledTest/resources/shaderpacks/options/shaders/gbuffers_basic.fsh b/common/src/disabledTest/resources/shaderpacks/options/shaders/gbuffers_basic.fsh index 7bd725fc81..df6aeb69bc 100644 --- a/common/src/disabledTest/resources/shaderpacks/options/shaders/gbuffers_basic.fsh +++ b/common/src/disabledTest/resources/shaderpacks/options/shaders/gbuffers_basic.fsh @@ -10,9 +10,9 @@ #ifdef VSH #endif -const int shadowDistance = 128; // How far away should shadows be rendered in blocks [16 32 48 64 128 256 512] -const int shadowDistanceRenderMul = 1; // [-1 0 1] Controls shadow culling modes -const float ambientOcclusionLevel = 1.0; // [0.0] Allows disabling vanilla ambient occlusion +const int shadowDistance = 128;// How far away should shadows be rendered in blocks [16 32 48 64 128 256 512] +const int shadowDistanceRenderMul = 1;// [-1 0 1] Controls shadow culling modes +const float ambientOcclusionLevel = 1.0;// [0.0] Allows disabling vanilla ambient occlusion void main() { // we're not really doing anything in particular diff --git a/common/src/disabledTest/resources/shaderpacks/options/shaders/gbuffers_basic.vsh b/common/src/disabledTest/resources/shaderpacks/options/shaders/gbuffers_basic.vsh index f639083f0b..7639bc152b 100644 --- a/common/src/disabledTest/resources/shaderpacks/options/shaders/gbuffers_basic.vsh +++ b/common/src/disabledTest/resources/shaderpacks/options/shaders/gbuffers_basic.vsh @@ -1,15 +1,15 @@ #version 120 -#define GODRAYS 32 // [16 32 64 128] Number of godrays - #define SHADOWS +#define GODRAYS 32// [16 32 64 128] Number of godrays +#define SHADOWS -#define GRASS_SHADOWS // whether tallgrass casts shadows +#define GRASS_SHADOWS// whether tallgrass casts shadows //#define // not really a valid define //#define GALAXIES -const int shadowDistance = 128; // How far away should shadows be rendered in blocks [16 32 48 64 128 256 512] -const int shadowDistanceRenderMul = 1; // [-1 0 1] Controls shadow culling modes -const float ambientOcclusionLevel = 1.0; // [0.0] Allows disabling vanilla ambient occlusion +const int shadowDistance = 128;// How far away should shadows be rendered in blocks [16 32 48 64 128 256 512] +const int shadowDistanceRenderMul = 1;// [-1 0 1] Controls shadow culling modes +const float ambientOcclusionLevel = 1.0;// [0.0] Allows disabling vanilla ambient occlusion // #define volumetricLighting //#define ANNOYING_STUFF diff --git a/common/src/headers/java/com/terraformersmc/modmenu/api/ConfigScreenFactory.java b/common/src/headers/java/com/terraformersmc/modmenu/api/ConfigScreenFactory.java index 80208a7116..3d5f479b21 100644 --- a/common/src/headers/java/com/terraformersmc/modmenu/api/ConfigScreenFactory.java +++ b/common/src/headers/java/com/terraformersmc/modmenu/api/ConfigScreenFactory.java @@ -27,7 +27,6 @@ import net.minecraft.client.gui.screens.Screen; @FunctionalInterface -@SuppressWarnings("deprecation") public interface ConfigScreenFactory { S create(Screen parent); } diff --git a/common/src/main/java/net/irisshaders/batchedentityrendering/mixin/MixinLevelRenderer.java b/common/src/main/java/net/irisshaders/batchedentityrendering/mixin/MixinLevelRenderer.java index 4143559a79..432e773804 100644 --- a/common/src/main/java/net/irisshaders/batchedentityrendering/mixin/MixinLevelRenderer.java +++ b/common/src/main/java/net/irisshaders/batchedentityrendering/mixin/MixinLevelRenderer.java @@ -21,7 +21,6 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; /** * Tracks whether or not the world is being rendered, and manages grouping diff --git a/common/src/main/java/net/irisshaders/iris/Iris.java b/common/src/main/java/net/irisshaders/iris/Iris.java index 15f4e0c5e4..c0bbee4219 100644 --- a/common/src/main/java/net/irisshaders/iris/Iris.java +++ b/common/src/main/java/net/irisshaders/iris/Iris.java @@ -4,7 +4,6 @@ import com.mojang.blaze3d.platform.GlDebug; import com.mojang.blaze3d.platform.InputConstants; import com.mojang.blaze3d.vertex.DefaultVertexFormat; -import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatRegistry; import net.caffeinemc.mods.sodium.api.vertex.serializer.VertexSerializerRegistry; import net.irisshaders.iris.compat.dh.DHCompat; import net.irisshaders.iris.config.IrisConfig; @@ -15,6 +14,7 @@ import net.irisshaders.iris.gui.debug.DebugLoadFailedGridScreen; import net.irisshaders.iris.gui.screen.ShaderPackScreen; import net.irisshaders.iris.helpers.OptionalBoolean; +import net.irisshaders.iris.pbr.texture.PBRTextureManager; import net.irisshaders.iris.pipeline.IrisRenderingPipeline; import net.irisshaders.iris.pipeline.PipelineManager; import net.irisshaders.iris.pipeline.VanillaRenderingPipeline; @@ -29,7 +29,6 @@ import net.irisshaders.iris.shaderpack.option.values.MutableOptionValues; import net.irisshaders.iris.shaderpack.option.values.OptionValues; import net.irisshaders.iris.shaderpack.programs.ProgramSet; -import net.irisshaders.iris.pbr.texture.PBRTextureManager; import net.irisshaders.iris.vertices.IrisVertexFormats; import net.irisshaders.iris.vertices.sodium.EntityToTerrainVertexSerializer; import net.irisshaders.iris.vertices.sodium.GlyphExtVertexSerializer; @@ -46,7 +45,6 @@ import net.minecraft.network.chat.HoverEvent; import org.jetbrains.annotations.NotNull; import org.lwjgl.glfw.GLFW; -import org.lwjgl.system.Configuration; import java.io.IOException; import java.io.InputStream; diff --git a/common/src/main/java/net/irisshaders/iris/UpdateChecker.java b/common/src/main/java/net/irisshaders/iris/UpdateChecker.java index b409d40bf7..8e78f4b3b1 100644 --- a/common/src/main/java/net/irisshaders/iris/UpdateChecker.java +++ b/common/src/main/java/net/irisshaders/iris/UpdateChecker.java @@ -203,7 +203,7 @@ public Optional getUpdateLink() { } } - static class UpdateInfo { + public static class UpdateInfo { public String semanticVersion; public Map updateInfo; public String modHost; diff --git a/common/src/main/java/net/irisshaders/iris/compat/dh/DHCompatInternal.java b/common/src/main/java/net/irisshaders/iris/compat/dh/DHCompatInternal.java index 0481e99e44..66418d0099 100644 --- a/common/src/main/java/net/irisshaders/iris/compat/dh/DHCompatInternal.java +++ b/common/src/main/java/net/irisshaders/iris/compat/dh/DHCompatInternal.java @@ -7,7 +7,6 @@ import com.seibel.distanthorizons.api.objects.math.DhApiVec3f; import com.seibel.distanthorizons.coreapi.DependencyInjection.OverrideInjector; import net.irisshaders.iris.Iris; -import net.irisshaders.iris.api.v0.IrisApi; import net.irisshaders.iris.gl.IrisRenderSystem; import net.irisshaders.iris.gl.framebuffer.GlFramebuffer; import net.irisshaders.iris.gl.texture.DepthBufferFormat; diff --git a/common/src/main/java/net/irisshaders/iris/compat/dh/IrisGenericRenderProgram.java b/common/src/main/java/net/irisshaders/iris/compat/dh/IrisGenericRenderProgram.java index bf5dc8b525..2197af50f2 100644 --- a/common/src/main/java/net/irisshaders/iris/compat/dh/IrisGenericRenderProgram.java +++ b/common/src/main/java/net/irisshaders/iris/compat/dh/IrisGenericRenderProgram.java @@ -13,7 +13,6 @@ import com.seibel.distanthorizons.api.objects.render.DhApiRenderableBox; import com.seibel.distanthorizons.api.objects.render.DhApiRenderableBoxGroupShading; import net.irisshaders.iris.Iris; -import net.irisshaders.iris.api.v0.IrisApi; import net.irisshaders.iris.gl.IrisRenderSystem; import net.irisshaders.iris.gl.blending.BlendModeOverride; import net.irisshaders.iris.gl.blending.BufferBlendOverride; diff --git a/common/src/main/java/net/irisshaders/iris/compat/dh/LodRendererEvents.java b/common/src/main/java/net/irisshaders/iris/compat/dh/LodRendererEvents.java index fe4479796d..541262e153 100644 --- a/common/src/main/java/net/irisshaders/iris/compat/dh/LodRendererEvents.java +++ b/common/src/main/java/net/irisshaders/iris/compat/dh/LodRendererEvents.java @@ -25,7 +25,6 @@ import com.seibel.distanthorizons.api.objects.math.DhApiVec3f; import com.seibel.distanthorizons.coreapi.DependencyInjection.OverrideInjector; import net.irisshaders.iris.Iris; -import net.irisshaders.iris.api.v0.IrisApi; import net.irisshaders.iris.pipeline.WorldRenderingPipeline; import net.irisshaders.iris.shadows.ShadowRenderer; import net.irisshaders.iris.shadows.ShadowRenderingState; diff --git a/common/src/main/java/net/irisshaders/iris/compat/dh/mixin/MixinAdvancedShadowCullingFrustum.java b/common/src/main/java/net/irisshaders/iris/compat/dh/mixin/MixinAdvancedShadowCullingFrustum.java index 590b262886..8d612f839b 100644 --- a/common/src/main/java/net/irisshaders/iris/compat/dh/mixin/MixinAdvancedShadowCullingFrustum.java +++ b/common/src/main/java/net/irisshaders/iris/compat/dh/mixin/MixinAdvancedShadowCullingFrustum.java @@ -15,6 +15,7 @@ public class MixinAdvancedShadowCullingFrustum extends Frustum implements IDhApi private int worldMinYDH; @Unique private int worldMaxYDH; + public MixinAdvancedShadowCullingFrustum(Matrix4f matrix4f, Matrix4f matrix4f2) { super(matrix4f, matrix4f2); } diff --git a/common/src/main/java/net/irisshaders/iris/compat/sodium/mixin/MixinBlockRenderer.java b/common/src/main/java/net/irisshaders/iris/compat/sodium/mixin/MixinBlockRenderer.java index 9b871ddea2..0729c9837a 100644 --- a/common/src/main/java/net/irisshaders/iris/compat/sodium/mixin/MixinBlockRenderer.java +++ b/common/src/main/java/net/irisshaders/iris/compat/sodium/mixin/MixinBlockRenderer.java @@ -4,7 +4,6 @@ import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import net.caffeinemc.mods.sodium.client.render.chunk.compile.pipeline.BlockRenderer; import net.caffeinemc.mods.sodium.client.render.chunk.terrain.TerrainRenderPass; -import net.caffeinemc.mods.sodium.client.render.frapi.mesh.MutableQuadViewImpl; import net.irisshaders.iris.shaderpack.materialmap.WorldRenderingSettings; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.model.BakedModel; diff --git a/common/src/main/java/net/irisshaders/iris/compat/sodium/mixin/MixinRenderRegionArenas.java b/common/src/main/java/net/irisshaders/iris/compat/sodium/mixin/MixinRenderRegionArenas.java index 2b105b80d7..855c9a550e 100644 --- a/common/src/main/java/net/irisshaders/iris/compat/sodium/mixin/MixinRenderRegionArenas.java +++ b/common/src/main/java/net/irisshaders/iris/compat/sodium/mixin/MixinRenderRegionArenas.java @@ -1,10 +1,8 @@ package net.irisshaders.iris.compat.sodium.mixin; import net.caffeinemc.mods.sodium.client.render.chunk.region.RenderRegion; -import net.caffeinemc.mods.sodium.client.render.chunk.vertex.format.ChunkMeshFormats; import net.caffeinemc.mods.sodium.client.render.chunk.vertex.format.ChunkVertexType; import net.irisshaders.iris.shaderpack.materialmap.WorldRenderingSettings; -import net.irisshaders.iris.vertices.sodium.terrain.IrisModelVertexFormats; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; diff --git a/common/src/main/java/net/irisshaders/iris/compat/sodium/mixin/MixinRenderSectionManager.java b/common/src/main/java/net/irisshaders/iris/compat/sodium/mixin/MixinRenderSectionManager.java index 0fb85ecbbd..4cde323888 100644 --- a/common/src/main/java/net/irisshaders/iris/compat/sodium/mixin/MixinRenderSectionManager.java +++ b/common/src/main/java/net/irisshaders/iris/compat/sodium/mixin/MixinRenderSectionManager.java @@ -5,7 +5,6 @@ import net.caffeinemc.mods.sodium.client.render.chunk.vertex.format.ChunkVertexType; import net.irisshaders.iris.Iris; import net.irisshaders.iris.shaderpack.materialmap.WorldRenderingSettings; -import net.irisshaders.iris.vertices.sodium.terrain.IrisModelVertexFormats; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyArg; diff --git a/common/src/main/java/net/irisshaders/iris/compat/sodium/mixin/MixinSodiumWorldRenderer.java b/common/src/main/java/net/irisshaders/iris/compat/sodium/mixin/MixinSodiumWorldRenderer.java index 734dec167e..6cf49595c2 100644 --- a/common/src/main/java/net/irisshaders/iris/compat/sodium/mixin/MixinSodiumWorldRenderer.java +++ b/common/src/main/java/net/irisshaders/iris/compat/sodium/mixin/MixinSodiumWorldRenderer.java @@ -26,9 +26,38 @@ @Mixin(SodiumWorldRenderer.class) public class MixinSodiumWorldRenderer { + @Unique + private static boolean renderLightsOnly = false; + @Unique + private static int beList = 0; + + static { + ShadowRenderingState.setBlockEntityRenderFunction((shadowRenderer, bufferSource, modelView, camera, cameraX, cameraY, cameraZ, tickDelta, hasEntityFrustum, lightsOnly) -> { + renderLightsOnly = lightsOnly; + + SodiumWorldRenderer.instance().renderBlockEntities(modelView, bufferSource, ((LevelRendererAccessor) Minecraft.getInstance().levelRenderer).getDestructionProgress(), camera, tickDelta, null); + + int finalBeList = beList; + + beList = 0; + + return finalBeList; + }); + } + @Unique private float lastSunAngle; + @Inject(method = "renderBlockEntity", at = @At("HEAD"), cancellable = true) + private static void checkRenderShadow(PoseStack matrices, RenderBuffers bufferBuilders, Long2ObjectMap> blockBreakingProgressions, float tickDelta, MultiBufferSource.BufferSource immediate, double x, double y, double z, BlockEntityRenderDispatcher dispatcher, BlockEntity entity, LocalPlayer player, LocalBooleanRef isGlowing, CallbackInfo ci) { + if (ShadowRenderingState.areShadowsCurrentlyBeingRendered()) { + if (renderLightsOnly && entity.getBlockState().getLightEmission() == 0) { + ci.cancel(); + } + beList++; + } + } + @Redirect(method = "setupTerrain", remap = false, at = @At(value = "INVOKE", target = "Lnet/caffeinemc/mods/sodium/client/render/chunk/RenderSectionManager;needsUpdate()Z", ordinal = 0, @@ -40,11 +69,9 @@ public class MixinSodiumWorldRenderer { lastSunAngle = sunAngle; return true; } - - return instance.needsUpdate(); - } else { - return instance.needsUpdate(); } + + return instance.needsUpdate(); } @Redirect(method = "setupTerrain", remap = false, @@ -59,33 +86,4 @@ public class MixinSodiumWorldRenderer { return instance.needsUpdate(); } } - - @Unique - private static boolean renderLightsOnly = false; - @Unique - private static int beList = 0; - - static { - ShadowRenderingState.setBlockEntityRenderFunction((shadowRenderer, bufferSource, modelView, camera, cameraX, cameraY, cameraZ, tickDelta, hasEntityFrustum, lightsOnly) -> { - renderLightsOnly = lightsOnly; - - SodiumWorldRenderer.instance().renderBlockEntities(modelView, bufferSource, ((LevelRendererAccessor) Minecraft.getInstance().levelRenderer).getDestructionProgress(), camera, tickDelta, null); - - int finalBeList = beList; - - beList = 0; - - return finalBeList; - }); - } - - @Inject(method = "renderBlockEntity", at = @At("HEAD"), cancellable = true) - private static void checkRenderShadow(PoseStack matrices, RenderBuffers bufferBuilders, Long2ObjectMap> blockBreakingProgressions, float tickDelta, MultiBufferSource.BufferSource immediate, double x, double y, double z, BlockEntityRenderDispatcher dispatcher, BlockEntity entity, LocalPlayer player, LocalBooleanRef isGlowing, CallbackInfo ci) { - if (ShadowRenderingState.areShadowsCurrentlyBeingRendered()) { - if (renderLightsOnly && entity.getBlockState().getLightEmission() == 0) { - ci.cancel(); - } - beList++; - } - } } diff --git a/common/src/main/java/net/irisshaders/iris/gl/IrisRenderSystem.java b/common/src/main/java/net/irisshaders/iris/gl/IrisRenderSystem.java index 65c48fbb7b..1d692a94fc 100644 --- a/common/src/main/java/net/irisshaders/iris/gl/IrisRenderSystem.java +++ b/common/src/main/java/net/irisshaders/iris/gl/IrisRenderSystem.java @@ -675,7 +675,7 @@ public int createTexture(int target) { @Override public int createBuffers() { - return GlStateManager._glGenBuffers(); + return GlStateManager._glGenBuffers(); } } diff --git a/common/src/main/java/net/irisshaders/iris/gl/buffer/BuiltShaderStorageInfo.java b/common/src/main/java/net/irisshaders/iris/gl/buffer/BuiltShaderStorageInfo.java new file mode 100644 index 0000000000..311ec5808b --- /dev/null +++ b/common/src/main/java/net/irisshaders/iris/gl/buffer/BuiltShaderStorageInfo.java @@ -0,0 +1,4 @@ +package net.irisshaders.iris.gl.buffer; + +public record BuiltShaderStorageInfo(long size, boolean relative, float scaleX, float scaleY, byte[] content) { +} diff --git a/common/src/main/java/net/irisshaders/iris/gl/buffer/ShaderStorageBuffer.java b/common/src/main/java/net/irisshaders/iris/gl/buffer/ShaderStorageBuffer.java index f3bbd2ccf3..f26c8b68ca 100644 --- a/common/src/main/java/net/irisshaders/iris/gl/buffer/ShaderStorageBuffer.java +++ b/common/src/main/java/net/irisshaders/iris/gl/buffer/ShaderStorageBuffer.java @@ -13,8 +13,8 @@ public class ShaderStorageBuffer { protected final int index; protected final BuiltShaderStorageInfo info; - protected int id; protected final ByteBuffer content; + protected int id; public ShaderStorageBuffer(int index, BuiltShaderStorageInfo info) { this.id = IrisRenderSystem.createBuffers(); diff --git a/common/src/main/java/net/irisshaders/iris/gui/NavigationController.java b/common/src/main/java/net/irisshaders/iris/gui/NavigationController.java index 8a62e09943..6d0869ac7f 100644 --- a/common/src/main/java/net/irisshaders/iris/gui/NavigationController.java +++ b/common/src/main/java/net/irisshaders/iris/gui/NavigationController.java @@ -7,12 +7,12 @@ import java.util.Deque; public class NavigationController { - private final Deque history = new ArrayDeque<>(); + private final Deque history = new ArrayDeque<>(); private ShaderPackOptionList optionList; private String currentScreen = null; public NavigationController(OptionMenuContainer container) { - } + } public void back() { if (!history.isEmpty()) { diff --git a/common/src/main/java/net/irisshaders/iris/gui/element/ShaderPackOptionList.java b/common/src/main/java/net/irisshaders/iris/gui/element/ShaderPackOptionList.java index 2ec3d7e8cc..5271023258 100644 --- a/common/src/main/java/net/irisshaders/iris/gui/element/ShaderPackOptionList.java +++ b/common/src/main/java/net/irisshaders/iris/gui/element/ShaderPackOptionList.java @@ -149,6 +149,71 @@ protected BaseEntry(NavigationController navigation) { } } + public static class ElementRowEntry extends BaseEntry { + private final List> widgets; + private final ShaderPackScreen screen; + + private int cachedWidth; + private int cachedPosX; + + public ElementRowEntry(ShaderPackScreen screen, NavigationController navigation, List> widgets) { + super(navigation); + + this.screen = screen; + this.widgets = widgets; + } + + @Override + public void render(GuiGraphics guiGraphics, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) { + this.cachedWidth = entryWidth; + this.cachedPosX = x; + + // The amount of space widgets will occupy, excluding margins. Will be divided up between widgets. + int totalWidthWithoutMargins = entryWidth - (2 * (widgets.size() - 1)); + + totalWidthWithoutMargins -= 3; // Centers it for some reason + + // Width of a single widget + float singleWidgetWidth = (float) totalWidthWithoutMargins / widgets.size(); + + for (int i = 0; i < widgets.size(); i++) { + AbstractElementWidget widget = widgets.get(i); + boolean widgetHovered = (hovered && (getHoveredWidget(mouseX) == i)) || getFocused() == widget; + + widget.bounds = new ScreenRectangle(x + (int) ((singleWidgetWidth + 2) * i), y, (int) singleWidgetWidth, entryHeight + 2); + widget.render(guiGraphics, mouseX, mouseY, tickDelta, widgetHovered); + + screen.setElementHoveredStatus(widget, widgetHovered); + } + } + + public int getHoveredWidget(int mouseX) { + float positionAcrossWidget = ((float) Mth.clamp(mouseX - cachedPosX, 0, cachedWidth)) / cachedWidth; + + return Mth.clamp((int) Math.floor(widgets.size() * positionAcrossWidget), 0, widgets.size() - 1); + } + + @Override + public boolean mouseClicked(double mouseX, double mouseY, int button) { + return this.widgets.get(getHoveredWidget((int) mouseX)).mouseClicked(mouseX, mouseY, button); + } + + @Override + public boolean mouseReleased(double mouseX, double mouseY, int button) { + return this.widgets.get(getHoveredWidget((int) mouseX)).mouseReleased(mouseX, mouseY, button); + } + + @Override + public @NotNull List children() { + return ImmutableList.copyOf(widgets); + } + + @Override + public @NotNull List narratables() { + return ImmutableList.copyOf(widgets); + } + } + public class HeaderEntry extends BaseEntry { public static final Component BACK_BUTTON_TEXT = Component.literal("< ").append(Component.translatable("options.iris.back").withStyle(ChatFormatting.ITALIC)); public static final MutableComponent RESET_BUTTON_TEXT_INACTIVE = Component.translatable("options.iris.reset").withStyle(ChatFormatting.GRAY); @@ -386,69 +451,4 @@ private boolean exportSettingsButtonClicked(IrisElementRow.IconButtonElement but return true; } } - - public static class ElementRowEntry extends BaseEntry { - private final List> widgets; - private final ShaderPackScreen screen; - - private int cachedWidth; - private int cachedPosX; - - public ElementRowEntry(ShaderPackScreen screen, NavigationController navigation, List> widgets) { - super(navigation); - - this.screen = screen; - this.widgets = widgets; - } - - @Override - public void render(GuiGraphics guiGraphics, int index, int y, int x, int entryWidth, int entryHeight, int mouseX, int mouseY, boolean hovered, float tickDelta) { - this.cachedWidth = entryWidth; - this.cachedPosX = x; - - // The amount of space widgets will occupy, excluding margins. Will be divided up between widgets. - int totalWidthWithoutMargins = entryWidth - (2 * (widgets.size() - 1)); - - totalWidthWithoutMargins -= 3; // Centers it for some reason - - // Width of a single widget - float singleWidgetWidth = (float) totalWidthWithoutMargins / widgets.size(); - - for (int i = 0; i < widgets.size(); i++) { - AbstractElementWidget widget = widgets.get(i); - boolean widgetHovered = (hovered && (getHoveredWidget(mouseX) == i)) || getFocused() == widget; - - widget.bounds = new ScreenRectangle(x + (int) ((singleWidgetWidth + 2) * i), y, (int) singleWidgetWidth, entryHeight + 2); - widget.render(guiGraphics, mouseX, mouseY, tickDelta, widgetHovered); - - screen.setElementHoveredStatus(widget, widgetHovered); - } - } - - public int getHoveredWidget(int mouseX) { - float positionAcrossWidget = ((float) Mth.clamp(mouseX - cachedPosX, 0, cachedWidth)) / cachedWidth; - - return Mth.clamp((int) Math.floor(widgets.size() * positionAcrossWidget), 0, widgets.size() - 1); - } - - @Override - public boolean mouseClicked(double mouseX, double mouseY, int button) { - return this.widgets.get(getHoveredWidget((int) mouseX)).mouseClicked(mouseX, mouseY, button); - } - - @Override - public boolean mouseReleased(double mouseX, double mouseY, int button) { - return this.widgets.get(getHoveredWidget((int) mouseX)).mouseReleased(mouseX, mouseY, button); - } - - @Override - public @NotNull List children() { - return ImmutableList.copyOf(widgets); - } - - @Override - public @NotNull List narratables() { - return ImmutableList.copyOf(widgets); - } - } } diff --git a/common/src/main/java/net/irisshaders/iris/gui/element/ShaderPackSelectionList.java b/common/src/main/java/net/irisshaders/iris/gui/element/ShaderPackSelectionList.java index 153d55ec7b..6d2d5f35bb 100644 --- a/common/src/main/java/net/irisshaders/iris/gui/element/ShaderPackSelectionList.java +++ b/common/src/main/java/net/irisshaders/iris/gui/element/ShaderPackSelectionList.java @@ -49,11 +49,11 @@ public ShaderPackSelectionList(ShaderPackScreen screen, Minecraft client, int wi this.screen = screen; this.topButtonRow = new TopButtonRowEntry(this, Iris.getIrisConfig().areShadersEnabled()); this.downloadButton = new PinnedEntry(Component.literal("Download Shaders"), () -> this.minecraft.setScreen(new ConfirmLinkScreen(bl -> { - if (bl) { - Util.getPlatform().openUri("https://modrinth.com/shaders"); - } - this.minecraft.setScreen(this.screen); - }, "https://modrinth.com/shaders", true)), this); + if (bl) { + Util.getPlatform().openUri("https://modrinth.com/shaders"); + } + this.minecraft.setScreen(this.screen); + }, "https://modrinth.com/shaders", true)), this); try { watcher1 = FileSystems.getDefault().newWatchService(); key1 = Iris.getShaderpacksDirectory().register(watcher1, @@ -346,10 +346,9 @@ public void renderLabel(GuiGraphics guiGraphics, int x, int y, int width, int he } private static class PinnedEntry extends BaseEntry { - private final Component label; - private final Runnable onClick; - public final boolean allowPressButton = true; + private final Component label; + private final Runnable onClick; public PinnedEntry(Component label, Runnable onClick, ShaderPackSelectionList list) { this.label = label; diff --git a/common/src/main/java/net/irisshaders/iris/gui/element/screen/IrisButton.java b/common/src/main/java/net/irisshaders/iris/gui/element/screen/IrisButton.java index 56cbf7a7a7..2fe82235e7 100644 --- a/common/src/main/java/net/irisshaders/iris/gui/element/screen/IrisButton.java +++ b/common/src/main/java/net/irisshaders/iris/gui/element/screen/IrisButton.java @@ -41,6 +41,7 @@ protected void renderWidget(GuiGraphics guiGraphics, int pInt1, int pInt2, float public static class Builder { private final Component message; private final Button.OnPress onPress; + private final FloatSupplier alpha; @Nullable private Tooltip tooltip; private int x; @@ -48,7 +49,6 @@ public static class Builder { private int width = 150; private int height = 20; private Button.CreateNarration createNarration = Button.DEFAULT_NARRATION; - private final FloatSupplier alpha; public Builder(Component pButton$Builder0, Button.OnPress pButton$OnPress1, FloatSupplier alpha) { this.message = pButton$Builder0; diff --git a/common/src/main/java/net/irisshaders/iris/gui/option/ShadowDistanceOption.java b/common/src/main/java/net/irisshaders/iris/gui/option/ShadowDistanceOption.java index bf4747bba2..0aeb7d873b 100644 --- a/common/src/main/java/net/irisshaders/iris/gui/option/ShadowDistanceOption.java +++ b/common/src/main/java/net/irisshaders/iris/gui/option/ShadowDistanceOption.java @@ -8,10 +8,10 @@ public class ShadowDistanceOption extends OptionInstance { - public ShadowDistanceOption(String string, TooltipSupplier arg, CaptionBasedToString arg2, OptionInstance.ValueSet arg3, T object, Consumer consumer) { + public ShadowDistanceOption(String string, TooltipSupplier arg, CaptionBasedToString arg2, OptionInstance.ValueSet arg3, T object, Consumer consumer) { super(string, arg, arg2, arg3, object, consumer); - } + } @Override public AbstractWidget createButton(Options options, int x, int y, int width) { diff --git a/common/src/main/java/net/irisshaders/iris/gui/screen/ShaderPackScreen.java b/common/src/main/java/net/irisshaders/iris/gui/screen/ShaderPackScreen.java index a99c0bf585..0fe62e1b1f 100644 --- a/common/src/main/java/net/irisshaders/iris/gui/screen/ShaderPackScreen.java +++ b/common/src/main/java/net/irisshaders/iris/gui/screen/ShaderPackScreen.java @@ -60,6 +60,7 @@ public class ShaderPackScreen extends Screen implements HudHideable { private static final String development = "Development Environment"; private final Screen parent; private final MutableComponent irisTextComponent; + private final FrameUpdateNotifier notifier = new FrameUpdateNotifier(); private ShaderPackSelectionList shaderPackList; private @Nullable ShaderPackOptionList shaderOptionList = null; private @Nullable NavigationController navigation = null; @@ -74,12 +75,7 @@ public class ShaderPackScreen extends Screen implements HudHideable { private boolean dropChanges = false; private MutableComponent developmentComponent; private MutableComponent updateComponent; - private boolean guiHidden = false; - private float guiButtonHoverTimer = 0.0f; - private Button openFolderButton; - - private final FrameUpdateNotifier notifier = new FrameUpdateNotifier(); public final SmoothedFloat blurTransition = new SmoothedFloat(2, 2, () -> { if (guiHidden) { return 0.0f; @@ -89,6 +85,8 @@ public class ShaderPackScreen extends Screen implements HudHideable { return (float) this.minecraft.options.getMenuBackgroundBlurriness(); } }, notifier); + private float guiButtonHoverTimer = 0.0f; + private Button openFolderButton; private float backgroundInit = 0.0f; public final SmoothedFloat listTransition = new SmoothedFloat(1, 1, () -> { if (guiHidden || this.optionMenuOpen) { diff --git a/common/src/main/java/net/irisshaders/iris/helpers/StringPair.java b/common/src/main/java/net/irisshaders/iris/helpers/StringPair.java index d173f12563..5bdcc3dc2a 100644 --- a/common/src/main/java/net/irisshaders/iris/helpers/StringPair.java +++ b/common/src/main/java/net/irisshaders/iris/helpers/StringPair.java @@ -1,9 +1,5 @@ package net.irisshaders.iris.helpers; -import org.jetbrains.annotations.NotNull; - -import java.util.Objects; - /** * An absurdly simple class for storing pairs of strings because Java lacks pair / tuple types. */ diff --git a/common/src/main/java/net/irisshaders/iris/mixin/MixinBlockStateBehavior.java b/common/src/main/java/net/irisshaders/iris/mixin/MixinBlockStateBehavior.java index 23ad597bee..9fbf634881 100644 --- a/common/src/main/java/net/irisshaders/iris/mixin/MixinBlockStateBehavior.java +++ b/common/src/main/java/net/irisshaders/iris/mixin/MixinBlockStateBehavior.java @@ -42,7 +42,6 @@ public abstract class MixinBlockStateBehavior { * @reason ambientOcclusionLevel support. Semantically, we're completely changing the meaning of the method. */ @Inject(method = "getShadeBrightness", at = @At("RETURN"), cancellable = true) - @SuppressWarnings("deprecation") public void getShadeBrightness(BlockGetter pBlockBehaviour$BlockStateBase0, BlockPos pBlockPos1, CallbackInfoReturnable cir) { float originalValue = cir.getReturnValue(); float aoLightValue = WorldRenderingSettings.INSTANCE.getAmbientOcclusionLevel(); diff --git a/common/src/main/java/net/irisshaders/iris/mixin/MixinClientLanguage.java b/common/src/main/java/net/irisshaders/iris/mixin/MixinClientLanguage.java index b77694f1a1..83df0cc948 100644 --- a/common/src/main/java/net/irisshaders/iris/mixin/MixinClientLanguage.java +++ b/common/src/main/java/net/irisshaders/iris/mixin/MixinClientLanguage.java @@ -15,7 +15,6 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import java.util.ArrayList; import java.util.LinkedList; diff --git a/common/src/main/java/net/irisshaders/iris/mixin/MixinGameRenderer.java b/common/src/main/java/net/irisshaders/iris/mixin/MixinGameRenderer.java index e815862174..cea92087d9 100644 --- a/common/src/main/java/net/irisshaders/iris/mixin/MixinGameRenderer.java +++ b/common/src/main/java/net/irisshaders/iris/mixin/MixinGameRenderer.java @@ -5,7 +5,6 @@ import com.mojang.blaze3d.shaders.Program; import com.mojang.blaze3d.vertex.PoseStack; import net.irisshaders.iris.Iris; -import net.irisshaders.iris.api.v0.IrisApi; import net.irisshaders.iris.gl.program.IrisProgramTypes; import net.irisshaders.iris.pathways.HandRenderer; import net.irisshaders.iris.pipeline.ShaderRenderingPipeline; diff --git a/common/src/main/java/net/irisshaders/iris/mixin/MixinGlStateManager_FramebufferBinding.java b/common/src/main/java/net/irisshaders/iris/mixin/MixinGlStateManager_FramebufferBinding.java index 8afe5e482f..972e74b2cb 100644 --- a/common/src/main/java/net/irisshaders/iris/mixin/MixinGlStateManager_FramebufferBinding.java +++ b/common/src/main/java/net/irisshaders/iris/mixin/MixinGlStateManager_FramebufferBinding.java @@ -3,7 +3,6 @@ import com.mojang.blaze3d.platform.GlConst; import com.mojang.blaze3d.platform.GlStateManager; import org.lwjgl.opengl.GL30C; -import org.lwjgl.opengl.GL46C; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; diff --git a/common/src/main/java/net/irisshaders/iris/mixin/MixinItemBlockRenderTypes.java b/common/src/main/java/net/irisshaders/iris/mixin/MixinItemBlockRenderTypes.java index 080056bd2c..18aa54513e 100644 --- a/common/src/main/java/net/irisshaders/iris/mixin/MixinItemBlockRenderTypes.java +++ b/common/src/main/java/net/irisshaders/iris/mixin/MixinItemBlockRenderTypes.java @@ -5,7 +5,6 @@ import net.irisshaders.iris.shaderpack.materialmap.WorldRenderingSettings; import net.minecraft.client.renderer.ItemBlockRenderTypes; import net.minecraft.client.renderer.RenderType; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; @@ -13,8 +12,6 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.util.Map; - @Mixin(ItemBlockRenderTypes.class) public class MixinItemBlockRenderTypes { @Unique diff --git a/common/src/main/java/net/irisshaders/iris/mixin/MixinItemInHandRenderer.java b/common/src/main/java/net/irisshaders/iris/mixin/MixinItemInHandRenderer.java index 9ef29ec59f..cb572dfa00 100644 --- a/common/src/main/java/net/irisshaders/iris/mixin/MixinItemInHandRenderer.java +++ b/common/src/main/java/net/irisshaders/iris/mixin/MixinItemInHandRenderer.java @@ -2,7 +2,6 @@ import com.mojang.blaze3d.vertex.PoseStack; import net.irisshaders.iris.Iris; -import net.irisshaders.iris.api.v0.IrisApi; import net.irisshaders.iris.pathways.HandRenderer; import net.minecraft.client.player.AbstractClientPlayer; import net.minecraft.client.renderer.ItemInHandRenderer; diff --git a/common/src/main/java/net/irisshaders/iris/mixin/MixinModelViewBobbing.java b/common/src/main/java/net/irisshaders/iris/mixin/MixinModelViewBobbing.java index 6833bd3320..f0342a186f 100644 --- a/common/src/main/java/net/irisshaders/iris/mixin/MixinModelViewBobbing.java +++ b/common/src/main/java/net/irisshaders/iris/mixin/MixinModelViewBobbing.java @@ -2,7 +2,6 @@ import com.mojang.blaze3d.vertex.PoseStack; import net.irisshaders.iris.Iris; -import net.irisshaders.iris.api.v0.IrisApi; import net.minecraft.client.Camera; import net.minecraft.client.DeltaTracker; import net.minecraft.client.Minecraft; diff --git a/common/src/main/java/net/irisshaders/iris/mixin/MixinRenderSystem.java b/common/src/main/java/net/irisshaders/iris/mixin/MixinRenderSystem.java index 4f81048849..d69ca7149f 100644 --- a/common/src/main/java/net/irisshaders/iris/mixin/MixinRenderSystem.java +++ b/common/src/main/java/net/irisshaders/iris/mixin/MixinRenderSystem.java @@ -8,13 +8,11 @@ import net.irisshaders.iris.pbr.TextureTracker; import net.irisshaders.iris.samplers.IrisSamplers; import net.minecraft.client.renderer.texture.AbstractTexture; -import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.resources.ResourceLocation; 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 org.spongepowered.asm.mixin.injection.callback.LocalCapture; @Mixin(RenderSystem.class) public class MixinRenderSystem { diff --git a/common/src/main/java/net/irisshaders/iris/mixin/devenvironment/DevEnvPlugin.java b/common/src/main/java/net/irisshaders/iris/mixin/devenvironment/DevEnvPlugin.java deleted file mode 100644 index 47ccff8888..0000000000 --- a/common/src/main/java/net/irisshaders/iris/mixin/devenvironment/DevEnvPlugin.java +++ /dev/null @@ -1,46 +0,0 @@ -package net.irisshaders.iris.mixin.devenvironment; - -import net.irisshaders.iris.platform.IrisPlatformHelpers; -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; - -public class DevEnvPlugin implements IMixinConfigPlugin { - @Override - public void onLoad(String mixinPackage) { - - } - - @Override - public String getRefMapperConfig() { - return ""; - } - - @Override - public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { - return IrisPlatformHelpers.getInstance().isDevelopmentEnvironment(); - } - - @Override - public void acceptTargets(Set myTargets, Set otherTargets) { - - } - - @Override - public List getMixins() { - return List.of(); - } - - @Override - public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { - - } - - @Override - public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { - - } -} diff --git a/common/src/main/java/net/irisshaders/iris/mixin/devenvironment/MixinMinecraft_NoAuthInDev.java b/common/src/main/java/net/irisshaders/iris/mixin/devenvironment/MixinMinecraft_NoAuthInDev.java deleted file mode 100644 index 2a5f83892a..0000000000 --- a/common/src/main/java/net/irisshaders/iris/mixin/devenvironment/MixinMinecraft_NoAuthInDev.java +++ /dev/null @@ -1,32 +0,0 @@ -package net.irisshaders.iris.mixin.devenvironment; - -import com.mojang.authlib.minecraft.UserApiService; -import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; -import net.minecraft.client.Minecraft; -import net.minecraft.client.main.GameConfig; -import org.slf4j.Logger; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -/** - * Suppresses Minecraft's authentication check in development environments. It's unnecessary log spam, and there's no - * need to send off a network request to Microsoft telling them that we're using Fabric/Quilt every time we launch the - * game in the development environment. - * - *

This also disables telemetry as a side-effect.

- */ -@Mixin(Minecraft.class) -public class MixinMinecraft_NoAuthInDev { - @Shadow - @Final - private static Logger LOGGER; - - @Inject(method = "createUserApiService", at = @At("HEAD"), cancellable = true) - private void iris$noSocialInteractionsInDevelopment(YggdrasilAuthenticationService yggdrasilAuthenticationService, GameConfig arg, CallbackInfoReturnable cir) { - cir.setReturnValue(UserApiService.OFFLINE); - } -} diff --git a/common/src/main/java/net/irisshaders/iris/mixin/devenvironment/MixinProfileKeyPairManager.java b/common/src/main/java/net/irisshaders/iris/mixin/devenvironment/MixinProfileKeyPairManager.java deleted file mode 100644 index c6d6b3a676..0000000000 --- a/common/src/main/java/net/irisshaders/iris/mixin/devenvironment/MixinProfileKeyPairManager.java +++ /dev/null @@ -1,8 +0,0 @@ -package net.irisshaders.iris.mixin.devenvironment; - -import net.minecraft.client.multiplayer.ProfileKeyPairManager; -import org.spongepowered.asm.mixin.Mixin; - -@Mixin(ProfileKeyPairManager.class) -public interface MixinProfileKeyPairManager { -} diff --git a/common/src/main/java/net/irisshaders/iris/mixin/devenvironment/MixinSharedConstants_LazyDfu.java b/common/src/main/java/net/irisshaders/iris/mixin/devenvironment/MixinSharedConstants_LazyDfu.java deleted file mode 100644 index 8cc4da9a91..0000000000 --- a/common/src/main/java/net/irisshaders/iris/mixin/devenvironment/MixinSharedConstants_LazyDfu.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.irisshaders.iris.mixin.devenvironment; - -import net.minecraft.SharedConstants; -import org.spongepowered.asm.mixin.Mixin; - -// use a higher priority to apply after LazyDFU, to avoid a conflict. -@Mixin(value = SharedConstants.class, priority = 1010) -public class MixinSharedConstants_LazyDfu { -} diff --git a/common/src/main/java/net/irisshaders/iris/mixin/devenvironment/MixinSodiumSpriteCache.java b/common/src/main/java/net/irisshaders/iris/mixin/devenvironment/MixinSodiumSpriteCache.java deleted file mode 100644 index a72d6a054b..0000000000 --- a/common/src/main/java/net/irisshaders/iris/mixin/devenvironment/MixinSodiumSpriteCache.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.irisshaders.iris.mixin.devenvironment; - -import net.minecraft.server.packs.resources.ResourceManager; -import net.minecraft.server.packs.resources.ResourceManagerReloadListener; -import org.spongepowered.asm.mixin.Mixin; - -@Mixin(ResourceManager.class) -public abstract class MixinSodiumSpriteCache implements ResourceManagerReloadListener { -} diff --git a/common/src/main/java/net/irisshaders/iris/mixin/entity_render_context/MixinCapeLayer.java b/common/src/main/java/net/irisshaders/iris/mixin/entity_render_context/MixinCapeLayer.java index 5d2f064b67..1d01a0d6ed 100644 --- a/common/src/main/java/net/irisshaders/iris/mixin/entity_render_context/MixinCapeLayer.java +++ b/common/src/main/java/net/irisshaders/iris/mixin/entity_render_context/MixinCapeLayer.java @@ -7,14 +7,11 @@ import net.minecraft.client.player.AbstractClientPlayer; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.entity.layers.CapeLayer; -import net.minecraft.client.resources.PlayerSkin; -import net.minecraft.world.item.ItemStack; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; @Mixin(CapeLayer.class) public class MixinCapeLayer { diff --git a/common/src/main/java/net/irisshaders/iris/mixin/entity_render_context/MixinElytraLayer.java b/common/src/main/java/net/irisshaders/iris/mixin/entity_render_context/MixinElytraLayer.java index 90550ef180..6b15f3af79 100644 --- a/common/src/main/java/net/irisshaders/iris/mixin/entity_render_context/MixinElytraLayer.java +++ b/common/src/main/java/net/irisshaders/iris/mixin/entity_render_context/MixinElytraLayer.java @@ -14,14 +14,12 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.PlayerModelPart; -import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; @Mixin(ElytraLayer.class) public abstract class MixinElytraLayer> extends RenderLayer { diff --git a/common/src/main/java/net/irisshaders/iris/mixin/entity_render_context/MixinHumanoidArmorLayer.java b/common/src/main/java/net/irisshaders/iris/mixin/entity_render_context/MixinHumanoidArmorLayer.java index c9072dc8d2..9e85dc4f6b 100644 --- a/common/src/main/java/net/irisshaders/iris/mixin/entity_render_context/MixinHumanoidArmorLayer.java +++ b/common/src/main/java/net/irisshaders/iris/mixin/entity_render_context/MixinHumanoidArmorLayer.java @@ -18,13 +18,11 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.ArmorItem; import net.minecraft.world.item.ArmorMaterial; -import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.armortrim.ArmorTrim; 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 org.spongepowered.asm.mixin.injection.callback.LocalCapture; @Mixin(HumanoidArmorLayer.class) public abstract class MixinHumanoidArmorLayer, A extends HumanoidModel> diff --git a/common/src/main/java/net/irisshaders/iris/mixin/sky/MixinLevelRenderer_SunMoonToggle.java b/common/src/main/java/net/irisshaders/iris/mixin/sky/MixinLevelRenderer_SunMoonToggle.java index 45626bb573..483e95520d 100644 --- a/common/src/main/java/net/irisshaders/iris/mixin/sky/MixinLevelRenderer_SunMoonToggle.java +++ b/common/src/main/java/net/irisshaders/iris/mixin/sky/MixinLevelRenderer_SunMoonToggle.java @@ -1,6 +1,7 @@ package net.irisshaders.iris.mixin.sky; -import com.mojang.blaze3d.vertex.BufferUploader; +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import com.mojang.blaze3d.vertex.MeshData; import com.mojang.blaze3d.vertex.VertexBuffer; import net.irisshaders.iris.Iris; @@ -13,7 +14,6 @@ import org.joml.Matrix4f; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.Slice; /** @@ -21,69 +21,69 @@ */ @Mixin(LevelRenderer.class) public class MixinLevelRenderer_SunMoonToggle { - @Redirect(method = "renderSky", + @WrapOperation(method = "renderSky", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/BufferUploader;drawWithShader(Lcom/mojang/blaze3d/vertex/MeshData;)V"), slice = @Slice( from = @At(value = "FIELD", target = "net/minecraft/client/renderer/LevelRenderer.SUN_LOCATION : Lnet/minecraft/resources/ResourceLocation;"), to = @At(value = "FIELD", target = "net/minecraft/client/renderer/LevelRenderer.MOON_LOCATION : Lnet/minecraft/resources/ResourceLocation;")), allow = 1) - private void iris$beforeDrawSun(MeshData meshData) { + private void iris$beforeDrawSun(MeshData meshData, Operation original) { if (Iris.getPipelineManager().getPipeline().map(WorldRenderingPipeline::shouldRenderSun).orElse(true)) { - BufferUploader.drawWithShader(meshData); + original.call(meshData); } else { meshData.close(); } } - @Redirect(method = "renderSky", + @WrapOperation(method = "renderSky", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/BufferUploader;drawWithShader(Lcom/mojang/blaze3d/vertex/MeshData;)V"), slice = @Slice( from = @At(value = "FIELD", target = "net/minecraft/client/renderer/LevelRenderer.MOON_LOCATION : Lnet/minecraft/resources/ResourceLocation;"), to = @At(value = "INVOKE", target = "net/minecraft/client/multiplayer/ClientLevel.getStarBrightness (F)F")), allow = 1) - private void iris$beforeDrawMoon(MeshData meshData) { + private void iris$beforeDrawMoon(MeshData meshData, Operation original) { if (Iris.getPipelineManager().getPipeline().map(WorldRenderingPipeline::shouldRenderMoon).orElse(true)) { - BufferUploader.drawWithShader(meshData); + original.call(meshData); } else { meshData.close(); } } - @Redirect(method = "renderSky", + @WrapOperation(method = "renderSky", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/VertexBuffer;drawWithShader(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;Lnet/minecraft/client/renderer/ShaderInstance;)V"), slice = @Slice( from = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/FogRenderer;levelFogColor()V"), to = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/VertexBuffer;unbind()V", ordinal = 0)), allow = 1) - private void iris$beforeDrawSkyDisc(VertexBuffer instance, Matrix4f modelViewMatrix, Matrix4f projectionMatrix, ShaderInstance shader) { + private void iris$beforeDrawSkyDisc(VertexBuffer instance, Matrix4f modelViewMatrix, Matrix4f projectionMatrix, ShaderInstance shader, Operation original) { if (Iris.getPipelineManager().getPipeline().map(WorldRenderingPipeline::shouldRenderSkyDisc).orElse(true)) { - instance.drawWithShader(modelViewMatrix, projectionMatrix, shader); + original.call(instance, modelViewMatrix, projectionMatrix, shader); } } - @Redirect(method = "renderSky", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/DimensionSpecialEffects;getSunriseColor(FF)[F")) - private float[] iris$beforeDrawHorizon(DimensionSpecialEffects instance, float timeOfDay, float partialTicks) { + @WrapOperation(method = "renderSky", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/DimensionSpecialEffects;getSunriseColor(FF)[F")) + private float[] iris$beforeDrawHorizon(DimensionSpecialEffects instance, float timeOfDay, float partialTicks, Operation original) { if (Iris.getPipelineManager().getPipeline().map(WorldRenderingPipeline::shouldRenderSkyDisc).orElse(true)) { - return instance.getSunriseColor(timeOfDay, partialTicks); + return original.call(instance, timeOfDay, partialTicks); } else { return null; } } - @Redirect(method = "renderSky", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/ClientLevel$ClientLevelData;getHorizonHeight(Lnet/minecraft/world/level/LevelHeightAccessor;)D")) - private double iris$beforeDrawHorizon(ClientLevel.ClientLevelData instance, LevelHeightAccessor level) { + @WrapOperation(method = "renderSky", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/ClientLevel$ClientLevelData;getHorizonHeight(Lnet/minecraft/world/level/LevelHeightAccessor;)D")) + private double iris$beforeDrawHorizon(ClientLevel.ClientLevelData instance, LevelHeightAccessor level, Operation original) { if (Iris.getPipelineManager().getPipeline().map(WorldRenderingPipeline::shouldRenderSkyDisc).orElse(true)) { - return instance.getHorizonHeight(level); + return original.call(instance, level); } else { return Double.NEGATIVE_INFINITY; } } - @Redirect(method = "renderSky", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/ClientLevel;getStarBrightness(F)F")) - private float iris$beforeDrawStars(ClientLevel instance, float partialTick) { + @WrapOperation(method = "renderSky", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/ClientLevel;getStarBrightness(F)F")) + private float iris$beforeDrawStars(ClientLevel instance, float partialTick, Operation original) { if (Iris.getPipelineManager().getPipeline().map(WorldRenderingPipeline::shouldRenderStars).orElse(true)) { - return instance.getStarBrightness(partialTick); + return original.call(instance, partialTick); } else { return -0.1f; } diff --git a/common/src/main/java/net/irisshaders/iris/mixin/state_tracking/MixinRenderTarget.java b/common/src/main/java/net/irisshaders/iris/mixin/state_tracking/MixinRenderTarget.java index 419b9b74ae..f20efde33f 100644 --- a/common/src/main/java/net/irisshaders/iris/mixin/state_tracking/MixinRenderTarget.java +++ b/common/src/main/java/net/irisshaders/iris/mixin/state_tracking/MixinRenderTarget.java @@ -38,6 +38,7 @@ */ @Mixin(RenderTarget.class) public class MixinRenderTarget { + @SuppressWarnings("ConstantValue") @Inject(method = "bindWrite(Z)V", at = @At("RETURN")) private void iris$onBindFramebuffer(boolean bl, CallbackInfo ci) { // IntelliJ is wrong here. It doesn't understand how Mixin works. diff --git a/common/src/main/java/net/irisshaders/iris/mixin/texture/MixinAbstractTexture.java b/common/src/main/java/net/irisshaders/iris/mixin/texture/MixinAbstractTexture.java index 74450437e3..b78e7db542 100644 --- a/common/src/main/java/net/irisshaders/iris/mixin/texture/MixinAbstractTexture.java +++ b/common/src/main/java/net/irisshaders/iris/mixin/texture/MixinAbstractTexture.java @@ -1,22 +1,22 @@ package net.irisshaders.iris.mixin.texture; +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import net.irisshaders.iris.pbr.TextureTracker; import net.minecraft.client.renderer.texture.AbstractTexture; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.At.Shift; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(AbstractTexture.class) public class MixinAbstractTexture { @Shadow protected int id; - // Inject after the newly-generated texture ID has been stored into the id field - @Inject(method = "getId()I", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/TextureUtil;generateTextureId()I", remap = false, shift = Shift.BY, by = 2)) - private void iris$afterGenerateId(CallbackInfoReturnable cir) { + @WrapOperation(method = "getId()I", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/TextureUtil;generateTextureId()I", remap = false)) + private int iris$afterGenerateId(Operation original) { + int id = original.call(); TextureTracker.INSTANCE.trackTexture(id, (AbstractTexture) (Object) this); + return id; } } diff --git a/common/src/main/java/net/irisshaders/iris/mixin/vertices/MixinBufferBuilder.java b/common/src/main/java/net/irisshaders/iris/mixin/vertices/MixinBufferBuilder.java index fa64376e04..0ad4b56394 100644 --- a/common/src/main/java/net/irisshaders/iris/mixin/vertices/MixinBufferBuilder.java +++ b/common/src/main/java/net/irisshaders/iris/mixin/vertices/MixinBufferBuilder.java @@ -7,8 +7,6 @@ import com.mojang.blaze3d.vertex.VertexFormat; import com.mojang.blaze3d.vertex.VertexFormatElement; import net.irisshaders.iris.Iris; -import net.irisshaders.iris.api.v0.IrisApi; -import net.irisshaders.iris.shaderpack.materialmap.WorldRenderingSettings; import net.irisshaders.iris.uniforms.CapturedRenderingState; import net.irisshaders.iris.vertices.BlockSensitiveBufferBuilder; import net.irisshaders.iris.vertices.BufferBuilderPolygonView; @@ -43,6 +41,8 @@ public abstract class MixinBufferBuilder implements VertexConsumer, BlockSensiti private final BufferBuilderPolygonView polygon = new BufferBuilderPolygonView(); @Unique private final Vector3f normal = new Vector3f(); + @Unique + private final long[] vertexOffsets = new long[4]; @Shadow private int elementsToFill; @Unique @@ -65,7 +65,7 @@ public abstract class MixinBufferBuilder implements VertexConsumer, BlockSensiti private int vertices; @Unique private boolean extending; - @Unique + @Unique private boolean injectNormalAndUV1; @Unique private int iris$vertexCount; @@ -73,14 +73,15 @@ public abstract class MixinBufferBuilder implements VertexConsumer, BlockSensiti private int currentBlock = -1; @Unique private byte currentRenderType = -1; - @Unique + @Unique private int currentLocalPosX; @Unique private int currentLocalPosY; @Unique private int currentLocalPosZ; - @Unique - private final long[] vertexOffsets = new long[4]; + @Shadow + @Final + private ByteBufferBuilder buffer; @Shadow public abstract VertexConsumer setNormal(float f, float g, float h); @@ -88,13 +89,9 @@ public abstract class MixinBufferBuilder implements VertexConsumer, BlockSensiti @Shadow protected abstract long beginElement(VertexFormatElement vertexFormatElement); - @Shadow - @Final - private ByteBufferBuilder buffer; - @ModifyVariable(method = "", at = @At(value = "FIELD", target = "Lcom/mojang/blaze3d/vertex/VertexFormatElement;POSITION:Lcom/mojang/blaze3d/vertex/VertexFormatElement;", ordinal = 0), argsOnly = true) private VertexFormat iris$extendFormat(VertexFormat format) { - boolean iris$isTerrain = false; + boolean iris$isTerrain = false; injectNormalAndUV1 = false; if (ImmediateState.skipExtension.get() || !Iris.isPackInUseQuick()) { @@ -131,8 +128,8 @@ private void injectMidBlock(float x, float y, float z, CallbackInfoReturnable extends Type.ObjectType { + public static final MatrixType MAT4 = new MatrixType<>("mat4", Matrix4f::new); public static MatrixType MAT2 = new MatrixType<>("mat2", Matrix2f::new); public static MatrixType MAT3 = new MatrixType<>("mat3", Matrix3f::new); - public static final MatrixType MAT4 = new MatrixType<>("mat4", Matrix4f::new); final String name; public MatrixType(String name, Supplier supplier) { diff --git a/common/src/main/java/net/irisshaders/iris/pathways/HandRenderer.java b/common/src/main/java/net/irisshaders/iris/pathways/HandRenderer.java index 73f0f9c317..c14f41d648 100644 --- a/common/src/main/java/net/irisshaders/iris/pathways/HandRenderer.java +++ b/common/src/main/java/net/irisshaders/iris/pathways/HandRenderer.java @@ -4,7 +4,6 @@ import com.mojang.blaze3d.vertex.PoseStack; import net.irisshaders.batchedentityrendering.impl.FullyBufferedMultiBufferSource; import net.irisshaders.iris.Iris; -import net.irisshaders.iris.api.v0.IrisApi; import net.irisshaders.iris.mixin.GameRendererAccessor; import net.irisshaders.iris.pipeline.WorldRenderingPhase; import net.irisshaders.iris.pipeline.WorldRenderingPipeline; diff --git a/common/src/main/java/net/irisshaders/iris/pbr/format/TextureFormat.java b/common/src/main/java/net/irisshaders/iris/pbr/format/TextureFormat.java index a6e37ed51f..8f66fe58c4 100644 --- a/common/src/main/java/net/irisshaders/iris/pbr/format/TextureFormat.java +++ b/common/src/main/java/net/irisshaders/iris/pbr/format/TextureFormat.java @@ -49,7 +49,7 @@ default void setupTextureParameters(PBRType pbrType, AbstractTexture texture) { int minFilter = IrisRenderSystem.getTexParameteri(texture.getId(), GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER); // Non-mipped filters begin at 0x2600 whereas mipped filters begin at 0x2700, // so this bit mask can be used to check if the filter is mipped or not - boolean mipmap = (minFilter & 1 << 8) == 1; + boolean mipmap = minFilter >= 0x2700; IrisRenderSystem.texParameteri(texture.getId(), GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, mipmap ? GL11.GL_NEAREST_MIPMAP_NEAREST : GL11.GL_NEAREST); IrisRenderSystem.texParameteri(texture.getId(), GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); } diff --git a/common/src/main/java/net/irisshaders/iris/pipeline/CompositeRenderer.java b/common/src/main/java/net/irisshaders/iris/pipeline/CompositeRenderer.java index 074f3f748b..671c64d317 100644 --- a/common/src/main/java/net/irisshaders/iris/pipeline/CompositeRenderer.java +++ b/common/src/main/java/net/irisshaders/iris/pipeline/CompositeRenderer.java @@ -61,7 +61,7 @@ public class CompositeRenderer { private final ImmutableList passes; private final TextureAccess noiseTexture; - private final CenterDepthSampler centerDepthSampler; + private final CenterDepthSampler centerDepthSampler; private final Object2ObjectMap customTextureIds; private final ImmutableSet flippedAtLeastOnceFinal; private final CustomUniforms customUniforms; @@ -368,7 +368,6 @@ private ComputeProgram[] createComputes(ComputeSource[] compute, ImmutableSet> customTextureIdMap = new EnumMap<>(TextureStage.class); @@ -50,7 +49,7 @@ public class CustomTextureManager { public CustomTextureManager(PackDirectives packDirectives, EnumMap> customTextureDataMap, - Object2ObjectMap irisCustomTextureDataMap, Optional customNoiseTextureData) { + Object2ObjectMap irisCustomTextureDataMap, CustomTextureData customNoiseTextureData) { customTextureDataMap.forEach((textureStage, customTextureStageDataMap) -> { Object2ObjectMap customTextureIds = new Object2ObjectOpenHashMap<>(); @@ -74,22 +73,20 @@ public CustomTextureManager(PackDirectives packDirectives, } }); - noise = customNoiseTextureData.flatMap(textureData -> { - try { - return Optional.of(createCustomTexture(textureData)); - } catch (IOException | ResourceLocationException e) { - Iris.logger.error("Unable to parse the image data for the custom noise texture", e); - - return Optional.empty(); - } - }).orElseGet(() -> { + if (customNoiseTextureData == null) { final int noiseTextureResolution = packDirectives.getNoiseTextureResolution(); NativeImageBackedNoiseTexture texture = new NativeImageBackedNoiseTexture(noiseTextureResolution); ownedTextures.add(texture); - return texture; - }); + noise = texture; + } else { + try { + noise = createCustomTexture(customNoiseTextureData); + } catch (IOException e) { + throw new RuntimeException(e); + } + } } private TextureAccess createCustomTexture(CustomTextureData textureData) throws IOException, ResourceLocationException { @@ -163,7 +160,6 @@ private TextureAccess createCustomTexture(CustomTextureData textureData) throws AbstractTexture pbrTexture = switch (pbrType) { case NORMAL -> pbrHolder.normalTexture(); case SPECULAR -> pbrHolder.specularTexture(); - default -> throw new IllegalArgumentException("Unknown PBRType '" + pbrType + "'"); }; TextureFormat textureFormat = TextureFormatLoader.getFormat(); diff --git a/common/src/main/java/net/irisshaders/iris/pipeline/FinalPassRenderer.java b/common/src/main/java/net/irisshaders/iris/pipeline/FinalPassRenderer.java index 7e18436e8e..6ffa39d9bb 100644 --- a/common/src/main/java/net/irisshaders/iris/pipeline/FinalPassRenderer.java +++ b/common/src/main/java/net/irisshaders/iris/pipeline/FinalPassRenderer.java @@ -67,7 +67,7 @@ public class FinalPassRenderer { private final Object2ObjectMap irisCustomTextures; private final Set customImages; private final TextureAccess noiseTexture; - private final CenterDepthSampler centerDepthSampler; + private final CenterDepthSampler centerDepthSampler; private final Object2ObjectMap customTextureIds; private final CustomUniforms customUniforms; private final WorldRenderingPipeline pipeline; @@ -83,7 +83,7 @@ public FinalPassRenderer(WorldRenderingPipeline pipeline, ProgramSet pack, Rende Object2ObjectMap irisCustomTextures, Set customImages, ImmutableSet flippedAtLeastOnce , CustomUniforms customUniforms) { this.pipeline = pipeline; - this.centerDepthSampler = centerDepthSampler; + this.centerDepthSampler = centerDepthSampler; this.customTextureIds = customTextureIds; this.irisCustomTextures = irisCustomTextures; this.customImages = customImages; @@ -384,7 +384,6 @@ private ComputeProgram[] createComputes(ComputeSource[] compute, ImmutableSet { - if (programSet.getComposite(ProgramArrayId.Deferred).length > 0 && !programSet.getPackDirectives().shouldUseSeparateEntityDraws()) { - return ParticleRenderingSettings.AFTER; - } else { - return ParticleRenderingSettings.MIXED; - } - }); + if (programSet.getPackDirectives().getParticleRenderingSettings() != ParticleRenderingSettings.UNSET) { + this.particleRenderingSettings = programSet.getPackDirectives().getParticleRenderingSettings(); + } else if (programSet.getComposite(ProgramArrayId.Deferred).length > 0 && !programSet.getPackDirectives().shouldUseSeparateEntityDraws()) { + this.particleRenderingSettings = ParticleRenderingSettings.AFTER; + } else { + this.particleRenderingSettings = ParticleRenderingSettings.MIXED; + } + this.renderTargets = new RenderTargets(main.width, main.height, depthTextureId, ((Blaze3dRenderTargetExt) main).iris$getDepthBufferVersion(), depthBufferFormat, programSet.getPackDirectives().getRenderTargetDirectives().getRenderTargetSettings(), programSet.getPackDirectives()); this.sunPathRotation = programSet.getPackDirectives().getSunPathRotation(); @@ -506,7 +507,6 @@ private ComputeProgram[] createShadowComputes(ComputeSource[] compute, ProgramSe for (int i = 0; i < programs.length; i++) { ComputeSource source = compute[i]; if (source == null || source.getSource().isEmpty()) { - continue; } else { ProgramBuilder builder; @@ -570,7 +570,6 @@ private ComputeProgram[] createSetupComputes(ComputeSource[] compute, ProgramSet for (int i = 0; i < programs.length; i++) { ComputeSource source = compute[i]; if (source == null || source.getSource().isEmpty()) { - continue; } else { ProgramBuilder builder; diff --git a/common/src/main/java/net/irisshaders/iris/pipeline/programs/ExtendedShader.java b/common/src/main/java/net/irisshaders/iris/pipeline/programs/ExtendedShader.java index bf9cbe7d7f..4900409ccf 100644 --- a/common/src/main/java/net/irisshaders/iris/pipeline/programs/ExtendedShader.java +++ b/common/src/main/java/net/irisshaders/iris/pipeline/programs/ExtendedShader.java @@ -47,7 +47,6 @@ public class ExtendedShader extends ShaderInstance implements ShaderInstanceInterface { private static final Matrix4f IDENTITY = new Matrix4f().identity(); private static final Uniform FAKE_UNIFORM = new Uniform("", 1, 2, null); - private static ExtendedShader lastApplied; private final boolean intensitySwizzle; private final List bufferBlendOverrides; @@ -120,7 +119,6 @@ private void setupDebugNames(String name) { public void clear() { ProgramUniforms.clearActiveUniforms(); ProgramSamplers.clearActiveSamplers(); - lastApplied = null; if (this.blendModeOverride != null || hasOverrides) { BlendModeOverride.restore(); diff --git a/common/src/main/java/net/irisshaders/iris/pipeline/programs/SodiumPrograms.java b/common/src/main/java/net/irisshaders/iris/pipeline/programs/SodiumPrograms.java index 1e34241e62..144dbd37cb 100644 --- a/common/src/main/java/net/irisshaders/iris/pipeline/programs/SodiumPrograms.java +++ b/common/src/main/java/net/irisshaders/iris/pipeline/programs/SodiumPrograms.java @@ -29,12 +29,9 @@ import net.irisshaders.iris.targets.RenderTargets; import net.irisshaders.iris.uniforms.custom.CustomUniforms; import net.irisshaders.iris.vertices.sodium.terrain.FormatAnalyzer; -import net.irisshaders.iris.vertices.sodium.terrain.IrisModelVertexFormats; import net.minecraft.resources.ResourceLocation; import org.lwjgl.opengl.GL43C; -import org.lwjgl.system.MemoryStack; -import java.nio.IntBuffer; import java.util.ArrayList; import java.util.EnumMap; import java.util.List; @@ -178,7 +175,7 @@ private GlProgram buildProgram(GlProgram.Builder builder, if (!hasMidUv) hasMidUv = GL43C.glGetAttribLocation(handle, "mc_midTexCoord") != -1; if (!hasTangent) hasTangent = GL43C.glGetAttribLocation(handle, "at_tangent") != -1; - return new SodiumShader(pipeline, pass, shader, handle, source.getDirectives().getBlendModeOverride(), + return new SodiumShader(pipeline, pass, shader, handle, source.getDirectives().getBlendModeOverride().orElse(null), createBufferBlendOverrides(source), customUniforms, flipState, alphaTest.reference(), containsTessellation); }); diff --git a/common/src/main/java/net/irisshaders/iris/pipeline/programs/SodiumShader.java b/common/src/main/java/net/irisshaders/iris/pipeline/programs/SodiumShader.java index 78328f3627..43835850d3 100644 --- a/common/src/main/java/net/irisshaders/iris/pipeline/programs/SodiumShader.java +++ b/common/src/main/java/net/irisshaders/iris/pipeline/programs/SodiumShader.java @@ -29,7 +29,6 @@ import java.util.List; import java.util.Locale; -import java.util.Optional; import java.util.function.Supplier; public class SodiumShader implements ChunkShaderInterface { @@ -49,7 +48,7 @@ public class SodiumShader implements ChunkShaderInterface { private final boolean containsTessellation; public SodiumShader(IrisRenderingPipeline pipeline, SodiumPrograms.Pass pass, ShaderBindingContext context, - int handle, Optional blendModeOverride, + int handle, BlendModeOverride blendModeOverride, List bufferBlendOverrides, CustomUniforms customUniforms, Supplier> flipState, float alphaTest, boolean containsTessellation) { @@ -70,7 +69,7 @@ public SodiumShader(IrisRenderingPipeline pipeline, SodiumPrograms.Pass pass, Sh this.samplers = buildSamplers(pipeline, pass, handle, isShadowPass, flipState); this.images = buildImages(pipeline, pass, handle, isShadowPass, flipState); - this.blendModeOverride = blendModeOverride.orElse(null); + this.blendModeOverride = blendModeOverride; this.bufferBlendOverrides = bufferBlendOverrides; } diff --git a/common/src/main/java/net/irisshaders/iris/pipeline/transform/TransformPatcher.java b/common/src/main/java/net/irisshaders/iris/pipeline/transform/TransformPatcher.java index d40dbdcf6c..63dc2be224 100644 --- a/common/src/main/java/net/irisshaders/iris/pipeline/transform/TransformPatcher.java +++ b/common/src/main/java/net/irisshaders/iris/pipeline/transform/TransformPatcher.java @@ -15,7 +15,6 @@ import io.github.douira.glsl_transformer.token_filter.TokenFilter; import io.github.douira.glsl_transformer.util.LRUCache; import it.unimi.dsi.fastutil.objects.Object2ObjectMap; -import net.caffeinemc.mods.sodium.client.render.chunk.vertex.format.ChunkVertexType; import net.irisshaders.iris.Iris; import net.irisshaders.iris.gl.IrisLimits; import net.irisshaders.iris.gl.blending.AlphaTest; @@ -69,12 +68,6 @@ * the string, it will throw. */ public class TransformPatcher { - private static final boolean useCache = true; - private static final Map> cache = new LRUCache<>(400); - private static final List internalPrefixes = List.of("iris_", "irisMain", "moj_import"); - private static final Pattern versionPattern = Pattern.compile("^.*#version\\s+(\\d+)", Pattern.DOTALL); - private static final EnumASTTransformer transformer; - static Logger LOGGER = LogManager.getLogger(TransformPatcher.class); // TODO: Only do the NewLines patches if the source code isn't from // gbuffers_lines (what does this mean?) static final TokenFilter parseTokenFilter = new ChannelFilter<>(TokenChannel.PREPROCESSOR) { @@ -87,6 +80,12 @@ public boolean isTokenAllowed(Token token) { return true; } }; + private static final boolean useCache = true; + private static final Map> cache = new LRUCache<>(400); + private static final List internalPrefixes = List.of("iris_", "irisMain", "moj_import"); + private static final Pattern versionPattern = Pattern.compile("^.*#version\\s+(\\d+)", Pattern.DOTALL); + private static final EnumASTTransformer transformer; + static Logger LOGGER = LogManager.getLogger(TransformPatcher.class); static { transformer = new EnumASTTransformer<>(PatchShaderType.class) { diff --git a/common/src/main/java/net/irisshaders/iris/pipeline/transform/parameter/SodiumParameters.java b/common/src/main/java/net/irisshaders/iris/pipeline/transform/parameter/SodiumParameters.java index cecd59351d..cefc8f12d4 100644 --- a/common/src/main/java/net/irisshaders/iris/pipeline/transform/parameter/SodiumParameters.java +++ b/common/src/main/java/net/irisshaders/iris/pipeline/transform/parameter/SodiumParameters.java @@ -1,7 +1,6 @@ package net.irisshaders.iris.pipeline.transform.parameter; import it.unimi.dsi.fastutil.objects.Object2ObjectMap; -import net.caffeinemc.mods.sodium.client.render.chunk.vertex.format.ChunkVertexType; import net.irisshaders.iris.gl.blending.AlphaTest; import net.irisshaders.iris.gl.texture.TextureType; import net.irisshaders.iris.helpers.Tri; diff --git a/common/src/main/java/net/irisshaders/iris/pipeline/transform/transformer/SodiumCoreTransformer.java b/common/src/main/java/net/irisshaders/iris/pipeline/transform/transformer/SodiumCoreTransformer.java index 9f5492d1ff..262471f3ce 100644 --- a/common/src/main/java/net/irisshaders/iris/pipeline/transform/transformer/SodiumCoreTransformer.java +++ b/common/src/main/java/net/irisshaders/iris/pipeline/transform/transformer/SodiumCoreTransformer.java @@ -2,7 +2,6 @@ import io.github.douira.glsl_transformer.ast.node.TranslationUnit; import io.github.douira.glsl_transformer.ast.query.Root; -import io.github.douira.glsl_transformer.ast.transform.ASTInjectionPoint; import io.github.douira.glsl_transformer.ast.transform.ASTParser; import net.irisshaders.iris.pipeline.transform.PatchShaderType; import net.irisshaders.iris.pipeline.transform.parameter.SodiumParameters; diff --git a/common/src/main/java/net/irisshaders/iris/pipeline/transform/transformer/SodiumTransformer.java b/common/src/main/java/net/irisshaders/iris/pipeline/transform/transformer/SodiumTransformer.java index 99af18605f..c625e5e973 100644 --- a/common/src/main/java/net/irisshaders/iris/pipeline/transform/transformer/SodiumTransformer.java +++ b/common/src/main/java/net/irisshaders/iris/pipeline/transform/transformer/SodiumTransformer.java @@ -176,7 +176,7 @@ vec2 _get_texcoord_bias() { public static void replaceMCEntity(ASTParser t, - TranslationUnit tree, Root root) { + TranslationUnit tree, Root root) { Type dimension = Type.BOOL; for (Identifier id : root.identifierIndex.get("mc_Entity")) { TypeAndInitDeclaration initDeclaration = (TypeAndInitDeclaration) id.getAncestor( diff --git a/common/src/main/java/net/irisshaders/iris/pipeline/transform/transformer/TextureTransformer.java b/common/src/main/java/net/irisshaders/iris/pipeline/transform/transformer/TextureTransformer.java index 56cf48d4df..5c1ada9433 100644 --- a/common/src/main/java/net/irisshaders/iris/pipeline/transform/transformer/TextureTransformer.java +++ b/common/src/main/java/net/irisshaders/iris/pipeline/transform/transformer/TextureTransformer.java @@ -60,7 +60,6 @@ private static boolean isTypeValid(TextureType expectedType, BuiltinFixedTypeSpe case TEXTURE_3D -> extractedType == BuiltinFixedTypeSpecifier.BuiltinType.SAMPLER3D || extractedType == BuiltinFixedTypeSpecifier.BuiltinType.ISAMPLER3D || extractedType == BuiltinFixedTypeSpecifier.BuiltinType.USAMPLER3D; - default -> throw new IllegalStateException("Unexpected enum! " + expectedType); }; } } diff --git a/common/src/main/java/net/irisshaders/iris/samplers/IrisSamplers.java b/common/src/main/java/net/irisshaders/iris/samplers/IrisSamplers.java index 44d2407f03..cb6cb8f592 100644 --- a/common/src/main/java/net/irisshaders/iris/samplers/IrisSamplers.java +++ b/common/src/main/java/net/irisshaders/iris/samplers/IrisSamplers.java @@ -35,15 +35,15 @@ public class IrisSamplers { private static GlSampler SHADOW_SAMPLER_NEAREST; private static GlSampler SHADOW_SAMPLER_LINEAR; - private IrisSamplers() { + private IrisSamplers() { // no construction allowed } public static void initRenderer() { SHADOW_SAMPLER_NEAREST = new GlSampler(false, false, true, true); SHADOW_SAMPLER_LINEAR = new GlSampler(true, false, true, true); - GlSampler LINEAR_MIPMAP = new GlSampler(true, true, false, false); - GlSampler NEAREST_MIPMAP = new GlSampler(false, true, false, false); + GlSampler LINEAR_MIPMAP = new GlSampler(true, true, false, false); + GlSampler NEAREST_MIPMAP = new GlSampler(false, true, false, false); } public static void addRenderTargetSamplers(SamplerHolder samplers, Supplier> flipped, diff --git a/common/src/main/java/net/irisshaders/iris/shaderpack/IdMap.java b/common/src/main/java/net/irisshaders/iris/shaderpack/IdMap.java index 34daf6f045..c3e90246b5 100644 --- a/common/src/main/java/net/irisshaders/iris/shaderpack/IdMap.java +++ b/common/src/main/java/net/irisshaders/iris/shaderpack/IdMap.java @@ -6,10 +6,10 @@ import it.unimi.dsi.fastutil.objects.Object2IntMaps; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap; -import net.irisshaders.iris.platform.IrisPlatformHelpers; import net.irisshaders.iris.Iris; import net.irisshaders.iris.helpers.StringPair; import net.irisshaders.iris.pipeline.transform.ShaderPrinter; +import net.irisshaders.iris.platform.IrisPlatformHelpers; import net.irisshaders.iris.shaderpack.materialmap.BlockEntry; import net.irisshaders.iris.shaderpack.materialmap.BlockRenderType; import net.irisshaders.iris.shaderpack.materialmap.Entry; @@ -51,17 +51,14 @@ public class IdMap { * Maps a given entity ID to an integer ID */ private final Object2IntMap entityIdMap; - - /** - * Maps block states to block ids defined in block.properties - */ - private Int2ObjectLinkedOpenHashMap> blockPropertiesMap; - /** * Maps tags to block ids defined in block.properties */ private final Int2ObjectLinkedOpenHashMap> blockTagMap; - + /** + * Maps block states to block ids defined in block.properties + */ + private Int2ObjectLinkedOpenHashMap> blockPropertiesMap; /** * A set of render type overrides for specific blocks. Allows shader packs to move blocks to different render types. */ diff --git a/common/src/main/java/net/irisshaders/iris/shaderpack/LanguageMap.java b/common/src/main/java/net/irisshaders/iris/shaderpack/LanguageMap.java index 2edac525e8..9b04f12319 100644 --- a/common/src/main/java/net/irisshaders/iris/shaderpack/LanguageMap.java +++ b/common/src/main/java/net/irisshaders/iris/shaderpack/LanguageMap.java @@ -8,7 +8,12 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; -import java.util.*; +import java.util.Collections; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; +import java.util.Properties; +import java.util.Set; import java.util.stream.Stream; public class LanguageMap { diff --git a/common/src/main/java/net/irisshaders/iris/shaderpack/ShaderPack.java b/common/src/main/java/net/irisshaders/iris/shaderpack/ShaderPack.java index 340d419850..5e6e002356 100644 --- a/common/src/main/java/net/irisshaders/iris/shaderpack/ShaderPack.java +++ b/common/src/main/java/net/irisshaders/iris/shaderpack/ShaderPack.java @@ -89,8 +89,8 @@ public class ShaderPack { private final Function sourceProvider; private final ShaderProperties shaderProperties; private final List dimensionIds; + private final Int2ObjectArrayMap bufferObjects; private Map dimensionMap; - private Int2ObjectArrayMap bufferObjects; public ShaderPack(Path root, ImmutableList environmentDefines, boolean isZip) throws IOException, IllegalStateException { this(root, Collections.emptyMap(), environmentDefines, isZip); @@ -182,7 +182,6 @@ public ShaderPack(Path root, Map changedConfigs, ImmutableList new CustomTextureData.RawDataRect(content, new TextureFilteringData(blur, clamp), rawDefinition.getInternalFormat(), rawDefinition.getFormat(), rawDefinition.getPixelType(), rawDefinition.getSizeX(), rawDefinition.getSizeY()); - default -> throw new IllegalStateException("Unknown texture type: " + rawDefinition.getTarget()); }; } else { customTextureData = null; @@ -603,8 +601,8 @@ public Object2ObjectMap getIrisCustomTextureDataMap() return irisCustomTextureDataMap; } - public Optional getCustomNoiseTexture() { - return Optional.ofNullable(customNoiseTexture); + public CustomTextureData getCustomNoiseTexture() { + return customNoiseTexture; } public LanguageMap getLanguageMap() { diff --git a/common/src/main/java/net/irisshaders/iris/shaderpack/option/OptionTests.java b/common/src/main/java/net/irisshaders/iris/shaderpack/option/OptionTests.java index ddeea297fc..0c574f4852 100644 --- a/common/src/main/java/net/irisshaders/iris/shaderpack/option/OptionTests.java +++ b/common/src/main/java/net/irisshaders/iris/shaderpack/option/OptionTests.java @@ -56,8 +56,8 @@ public static void main(String[] args) throws IOException { System.out.println("Diagnostics:"); source.getDiagnostics().forEach((index, diagnostic) -> System.out.println( - "[" + StringUtils.leftPad(Integer.toString(index + 1), 4, ' ') + "] " + - diagnostic)); + "[" + StringUtils.leftPad(Integer.toString(index + 1), 4, ' ') + "] " + + diagnostic)); if (source.getDiagnostics().isEmpty()) { System.out.println("(none)"); diff --git a/common/src/main/java/net/irisshaders/iris/shaderpack/option/menu/OptionMenuContainer.java b/common/src/main/java/net/irisshaders/iris/shaderpack/option/menu/OptionMenuContainer.java index b5a77c9231..d8820f8ec2 100644 --- a/common/src/main/java/net/irisshaders/iris/shaderpack/option/menu/OptionMenuContainer.java +++ b/common/src/main/java/net/irisshaders/iris/shaderpack/option/menu/OptionMenuContainer.java @@ -38,7 +38,7 @@ public OptionMenuContainer(ShaderProperties shaderProperties, ShaderPackOptions Map subScreenColumnCounts = shaderProperties.getSubScreenColumnCount(); shaderProperties.getSubScreenOptions().forEach((screenKey, options) -> subScreens.put(screenKey, new OptionMenuSubElementScreen( - screenKey, this, shaderProperties, shaderPackOptions, options, Optional.ofNullable(subScreenColumnCounts.get(screenKey))))); + screenKey, this, shaderProperties, shaderPackOptions, options, Optional.ofNullable(subScreenColumnCounts.get(screenKey))))); // Dump all unused options into screens containing "*" for (Map.Entry, Integer> entry : unusedOptionDumpQueue.entrySet()) { diff --git a/common/src/main/java/net/irisshaders/iris/shaderpack/properties/PackDirectives.java b/common/src/main/java/net/irisshaders/iris/shaderpack/properties/PackDirectives.java index 7976d3a5db..c5d40b5c61 100644 --- a/common/src/main/java/net/irisshaders/iris/shaderpack/properties/PackDirectives.java +++ b/common/src/main/java/net/irisshaders/iris/shaderpack/properties/PackDirectives.java @@ -1,13 +1,11 @@ package net.irisshaders.iris.shaderpack.properties; import com.google.common.collect.ImmutableMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap; import it.unimi.dsi.fastutil.objects.Object2BooleanMap; import it.unimi.dsi.fastutil.objects.Object2BooleanMaps; import it.unimi.dsi.fastutil.objects.Object2ObjectMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import net.irisshaders.iris.Iris; -import net.irisshaders.iris.gl.buffer.ShaderStorageInfo; import net.irisshaders.iris.gl.texture.TextureScaleOverride; import net.irisshaders.iris.gl.texture.TextureType; import net.irisshaders.iris.helpers.Tri; @@ -15,7 +13,6 @@ import net.irisshaders.iris.shaderpack.texture.TextureStage; import org.joml.Vector2i; -import java.util.Optional; import java.util.Set; public class PackDirectives { @@ -51,7 +48,7 @@ public class PackDirectives { private Object2ObjectMap> explicitFlips = new Object2ObjectOpenHashMap<>(); private Object2ObjectMap scaleOverrides = new Object2ObjectOpenHashMap<>(); private Object2ObjectMap, String> textureMap; - private Optional particleRenderingSettings; + private ParticleRenderingSettings particleRenderingSettings; private PackDirectives(Set supportedRenderTargets, PackShadowDirectives packShadowDirectives) { noiseTextureResolution = 256; @@ -175,7 +172,7 @@ public boolean shouldRenderSkyDisc() { return sky; } - public Optional getParticleRenderingSettings() { + public ParticleRenderingSettings getParticleRenderingSettings() { return particleRenderingSettings; } diff --git a/common/src/main/java/net/irisshaders/iris/shaderpack/properties/PackRenderTargetDirectives.java b/common/src/main/java/net/irisshaders/iris/shaderpack/properties/PackRenderTargetDirectives.java index 3d19e4d4d2..59874c6041 100644 --- a/common/src/main/java/net/irisshaders/iris/shaderpack/properties/PackRenderTargetDirectives.java +++ b/common/src/main/java/net/irisshaders/iris/shaderpack/properties/PackRenderTargetDirectives.java @@ -87,10 +87,10 @@ public void acceptDirectives(DirectiveHolder directives) { // If a shaderpack declares a gdepth uniform (even if it is not actually sampled or even of the correct type), // we upgrade the format of gdepth / colortex1 to RGBA32F if it is currently RGBA. Optional.ofNullable(renderTargetSettings.get(1)).ifPresent(gdepth -> directives.acceptUniformDirective("gdepth", () -> { - if (gdepth.requestedFormat == InternalTextureFormat.RGBA) { - gdepth.requestedFormat = InternalTextureFormat.RGBA32F; - } - })); + if (gdepth.requestedFormat == InternalTextureFormat.RGBA) { + gdepth.requestedFormat = InternalTextureFormat.RGBA32F; + } + })); renderTargetSettings.forEach((index, settings) -> { acceptBufferDirectives(directives, settings, "colortex" + index); diff --git a/common/src/main/java/net/irisshaders/iris/shaderpack/properties/ParticleRenderingSettings.java b/common/src/main/java/net/irisshaders/iris/shaderpack/properties/ParticleRenderingSettings.java index 3d19c98739..b96e36ead3 100644 --- a/common/src/main/java/net/irisshaders/iris/shaderpack/properties/ParticleRenderingSettings.java +++ b/common/src/main/java/net/irisshaders/iris/shaderpack/properties/ParticleRenderingSettings.java @@ -2,19 +2,18 @@ import net.irisshaders.iris.Iris; -import java.util.Optional; - public enum ParticleRenderingSettings { + UNSET, BEFORE, MIXED, AFTER; - public static Optional fromString(String name) { + public static ParticleRenderingSettings fromString(String name) { try { - return Optional.of(ParticleRenderingSettings.valueOf(name)); + return ParticleRenderingSettings.valueOf(name); } catch (IllegalArgumentException e) { - Iris.logger.warn("Invalid particle rendering settings! " + name); - return Optional.empty(); + Iris.logger.error("Invalid particle rendering settings! " + name); + return ParticleRenderingSettings.UNSET; } } } diff --git a/common/src/main/java/net/irisshaders/iris/shaderpack/properties/ShaderProperties.java b/common/src/main/java/net/irisshaders/iris/shaderpack/properties/ShaderProperties.java index e8d0b58a6b..8961ed4505 100644 --- a/common/src/main/java/net/irisshaders/iris/shaderpack/properties/ShaderProperties.java +++ b/common/src/main/java/net/irisshaders/iris/shaderpack/properties/ShaderProperties.java @@ -6,7 +6,6 @@ import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import net.irisshaders.iris.platform.IrisPlatformHelpers; import net.irisshaders.iris.Iris; import net.irisshaders.iris.gl.IrisRenderSystem; import net.irisshaders.iris.gl.blending.AlphaTest; @@ -26,6 +25,7 @@ import net.irisshaders.iris.helpers.OptionalBoolean; import net.irisshaders.iris.helpers.StringPair; import net.irisshaders.iris.helpers.Tri; +import net.irisshaders.iris.platform.IrisPlatformHelpers; import net.irisshaders.iris.shaderpack.ImageInformation; import net.irisshaders.iris.shaderpack.option.OrderBackedProperties; import net.irisshaders.iris.shaderpack.option.ShaderPackOptions; @@ -55,6 +55,7 @@ * values in here & the values parsed from shader source code. */ public class ShaderProperties { + final CustomUniforms.Builder customUniforms = new CustomUniforms.Builder(); private final Map> profiles = new LinkedHashMap<>(); private final Map> subScreenOptions = new HashMap<>(); private final Map subScreenColumnCount = new HashMap<>(); @@ -73,7 +74,6 @@ public class ShaderProperties { private final Int2ObjectArrayMap bufferObjects = new Int2ObjectArrayMap<>(); private final Object2ObjectMap> explicitFlips = new Object2ObjectOpenHashMap<>(); private final Object2ObjectMap conditionallyEnabledPrograms = new Object2ObjectOpenHashMap<>(); - final CustomUniforms.Builder customUniforms = new CustomUniforms.Builder(); private int customTexAmount; private CloudSetting cloudSetting = CloudSetting.DEFAULT; private CloudSetting dhCloudSetting = CloudSetting.DEFAULT; @@ -109,7 +109,7 @@ public class ShaderProperties { private ShadowCullState shadowCulling = ShadowCullState.DEFAULT; private OptionalBoolean shadowEnabled = OptionalBoolean.DEFAULT; private OptionalBoolean dhShadowEnabled = OptionalBoolean.DEFAULT; - private Optional particleRenderingSettings = Optional.empty(); + private ParticleRenderingSettings particleRenderingSettings = ParticleRenderingSettings.UNSET; private OptionalBoolean prepareBeforeShadow = OptionalBoolean.DEFAULT; private List sliderOptions = new ArrayList<>(); private List mainScreenOptions = null; @@ -205,27 +205,25 @@ public ShaderProperties(String contents, ShaderPackOptions shaderPackOptions, It handleBooleanDirective(key, value, "beacon.beam.depth", bool -> beaconBeamDepth = bool); handleBooleanDirective(key, value, "separateAo", bool -> separateAo = bool); handleBooleanDirective(key, value, "voxelizeLightBlocks", bool -> voxelizeLightBlocks = bool); - handleBooleanDirective(key, value, "separateEntityDraws", bool -> separateEntityDraws = bool); + handleBooleanDirective(key, value, "separateEntityDraws", bool -> { + separateEntityDraws = bool; + particleRenderingSettings = ParticleRenderingSettings.MIXED; + }); handleBooleanDirective(key, value, "frustum.culling", bool -> frustumCulling = bool); handleBooleanDirective(key, value, "occlusion.culling", bool -> occlusionCulling = bool); handleBooleanDirective(key, value, "shadow.enabled", bool -> shadowEnabled = bool); handleBooleanDirective(key, value, "skipAllRendering", bool -> skipAllRendering = bool); handleBooleanDirective(key, value, "dhShadow.enabled", bool -> dhShadowEnabled = bool); handleBooleanDirective(key, value, "particles.before.deferred", bool -> { - if (bool.orElse(false) && particleRenderingSettings.isEmpty()) { - particleRenderingSettings = Optional.of(ParticleRenderingSettings.BEFORE); + if (bool.orElse(false) && particleRenderingSettings == ParticleRenderingSettings.UNSET) { + particleRenderingSettings = ParticleRenderingSettings.BEFORE; } }); handleBooleanDirective(key, value, "prepareBeforeShadow", bool -> prepareBeforeShadow = bool); handleBooleanDirective(key, value, "supportsColorCorrection", bool -> supportsColorCorrection = bool); if (key.startsWith("particles.ordering")) { - Optional settings = ParticleRenderingSettings.fromString(value.trim().toUpperCase(Locale.US)); - if (settings.isPresent()) { - particleRenderingSettings = settings; - } else { - throw new RuntimeException("Failed to parse particle rendering order! " + value); - } + particleRenderingSettings = ParticleRenderingSettings.fromString(value.trim().toUpperCase(Locale.US)); } // TODO: Min optifine versions, shader options layout / appearance / profiles @@ -853,9 +851,8 @@ public OptionalBoolean getShadowEnabled() { return shadowEnabled; } - public Optional getParticleRenderingSettings() { - // Before is implied if separateEntityDraws is true. - if (separateEntityDraws == OptionalBoolean.TRUE) return Optional.of(ParticleRenderingSettings.MIXED); + public ParticleRenderingSettings getParticleRenderingSettings() { + // Mixed is implied if separateEntityDraws is true. return particleRenderingSettings; } diff --git a/common/src/main/java/net/irisshaders/iris/shadows/ShadowCompositeRenderer.java b/common/src/main/java/net/irisshaders/iris/shadows/ShadowCompositeRenderer.java index 88ede9881d..6f9f90b247 100644 --- a/common/src/main/java/net/irisshaders/iris/shadows/ShadowCompositeRenderer.java +++ b/common/src/main/java/net/irisshaders/iris/shadows/ShadowCompositeRenderer.java @@ -52,7 +52,7 @@ public class ShadowCompositeRenderer { private final ImmutableList passes; private final TextureAccess noiseTexture; - private final Object2ObjectMap customTextureIds; + private final Object2ObjectMap customTextureIds; private final ImmutableSet flippedAtLeastOnceFinal; private final CustomUniforms customUniforms; private final Object2ObjectMap irisCustomTextures; @@ -64,7 +64,7 @@ public ShadowCompositeRenderer(WorldRenderingPipeline pipeline, PackDirectives p Object2ObjectMap customTextureIds, Set customImages, ImmutableMap explicitPreFlips, Object2ObjectMap irisCustomTextures, CustomUniforms customUniforms) { this.pipeline = pipeline; this.noiseTexture = noiseTexture; - this.renderTargets = renderTargets; + this.renderTargets = renderTargets; this.customTextureIds = customTextureIds; this.irisCustomTextures = irisCustomTextures; this.irisCustomImages = customImages; @@ -292,7 +292,6 @@ private ComputeProgram[] createComputes(ComputeSource[] sources, ImmutableSet skipExtension = ThreadLocal.withInitial(() -> false); public static boolean isRenderingLevel = false; public static boolean usingTessellation = false; public static boolean renderWithExtendedVertexFormat = true; - public static final ThreadLocal skipExtension = ThreadLocal.withInitial(() -> false); } diff --git a/common/src/main/java/net/irisshaders/iris/vertices/IrisTextVertexSinkImpl.java b/common/src/main/java/net/irisshaders/iris/vertices/IrisTextVertexSinkImpl.java index fce5a6b824..443ade34c4 100644 --- a/common/src/main/java/net/irisshaders/iris/vertices/IrisTextVertexSinkImpl.java +++ b/common/src/main/java/net/irisshaders/iris/vertices/IrisTextVertexSinkImpl.java @@ -11,6 +11,7 @@ import java.util.function.IntFunction; public class IrisTextVertexSinkImpl implements IrisTextVertexSink { + static final VertexFormat format = IrisVertexFormats.GLYPH; private static final int STRIDE = IrisVertexFormats.GLYPH.getVertexSize(); private static final int OFFSET_POSITION = 0; private static final int OFFSET_COLOR = 12; @@ -19,7 +20,6 @@ public class IrisTextVertexSinkImpl implements IrisTextVertexSink { private static final int OFFSET_LIGHT = 24; private static final int OFFSET_NORMAL = 28; private static final int OFFSET_TANGENT = 46; - static final VertexFormat format = IrisVertexFormats.GLYPH; private final ByteBuffer buffer; private final TextQuadView quad = new TextQuadView(); private final Vector3f saveNormal = new Vector3f(); diff --git a/common/src/main/java/net/irisshaders/iris/vertices/sodium/GlyphExtVertexSerializer.java b/common/src/main/java/net/irisshaders/iris/vertices/sodium/GlyphExtVertexSerializer.java index 7fc241d8e9..068c0aecda 100644 --- a/common/src/main/java/net/irisshaders/iris/vertices/sodium/GlyphExtVertexSerializer.java +++ b/common/src/main/java/net/irisshaders/iris/vertices/sodium/GlyphExtVertexSerializer.java @@ -21,7 +21,7 @@ public class GlyphExtVertexSerializer implements VertexSerializer { private static final int OFFSET_TANGENT = IrisVertexFormats.GLYPH.getOffset(IrisVertexFormats.TANGENT_ELEMENT); private static final QuadViewEntity quad = new QuadViewEntity(); private static final Vector3f saveNormal = new Vector3f(); - private static final int STRIDE = IrisVertexFormats.GLYPH.getVertexSize(); + private static final int STRIDE = IrisVertexFormats.GLYPH.getVertexSize(); private static void endQuad(float uSum, float vSum, long src, long dst) { uSum *= 0.25f; diff --git a/common/src/main/java/net/irisshaders/iris/vertices/sodium/terrain/IrisModelVertexFormats.java b/common/src/main/java/net/irisshaders/iris/vertices/sodium/terrain/IrisModelVertexFormats.java index c77e88e336..872c47516b 100644 --- a/common/src/main/java/net/irisshaders/iris/vertices/sodium/terrain/IrisModelVertexFormats.java +++ b/common/src/main/java/net/irisshaders/iris/vertices/sodium/terrain/IrisModelVertexFormats.java @@ -1,6 +1,4 @@ package net.irisshaders.iris.vertices.sodium.terrain; -import net.caffeinemc.mods.sodium.client.render.chunk.vertex.format.ChunkVertexType; - public class IrisModelVertexFormats { } diff --git a/common/src/main/java/net/irisshaders/iris/vertices/sodium/terrain/XHFPModelVertexType.java b/common/src/main/java/net/irisshaders/iris/vertices/sodium/terrain/XHFPModelVertexType.java index 1b8b51f4bb..f2ba69ceea 100644 --- a/common/src/main/java/net/irisshaders/iris/vertices/sodium/terrain/XHFPModelVertexType.java +++ b/common/src/main/java/net/irisshaders/iris/vertices/sodium/terrain/XHFPModelVertexType.java @@ -1,19 +1,20 @@ package net.irisshaders.iris.vertices.sodium.terrain; import net.caffeinemc.mods.sodium.client.gl.attribute.GlVertexFormat; -import net.caffeinemc.mods.sodium.client.render.chunk.shader.ChunkShaderBindingPoints; import net.caffeinemc.mods.sodium.client.render.chunk.vertex.format.ChunkVertexEncoder; import net.caffeinemc.mods.sodium.client.render.chunk.vertex.format.ChunkVertexType; -import net.caffeinemc.mods.sodium.client.render.chunk.vertex.format.impl.DefaultChunkMeshAttributes; -import net.irisshaders.iris.vertices.NormI8; -import net.irisshaders.iris.vertices.NormalHelper; -import net.minecraft.util.Mth; -import org.joml.Vector3f; /** * Like HFPModelVertexType, but extended to support Iris. The extensions aren't particularly efficient right now. */ public class XHFPModelVertexType implements ChunkVertexType { + private static final int POSITION_MAX_VALUE = 65536; + private static final int TEXTURE_MAX_VALUE = 32768; + private static final float MODEL_ORIGIN = 8.0f; + private static final float MODEL_RANGE = 32.0f; + private static final float MODEL_SCALE = MODEL_RANGE / POSITION_MAX_VALUE; + private static final float MODEL_SCALE_INV = POSITION_MAX_VALUE / MODEL_RANGE; + private static final float TEXTURE_SCALE = (1.0f / TEXTURE_MAX_VALUE); private final GlVertexFormat format; private final int normalOffset; private final int blockIdOffset; @@ -30,17 +31,6 @@ public XHFPModelVertexType(GlVertexFormat format, int blockIdOffset, int normalO this.midBlockOffset = midBlockOffset; } - private static final int POSITION_MAX_VALUE = 65536; - private static final int TEXTURE_MAX_VALUE = 32768; - - private static final float MODEL_ORIGIN = 8.0f; - private static final float MODEL_RANGE = 32.0f; - private static final float MODEL_SCALE = MODEL_RANGE / POSITION_MAX_VALUE; - - private static final float MODEL_SCALE_INV = POSITION_MAX_VALUE / MODEL_RANGE; - - private static final float TEXTURE_SCALE = (1.0f / TEXTURE_MAX_VALUE); - public static int encodeOld(float u, float v) { return ((Math.round(u * TEXTURE_MAX_VALUE) & 0xFFFF) << 0) | ((Math.round(v * TEXTURE_MAX_VALUE) & 0xFFFF) << 16); diff --git a/common/src/main/java/net/irisshaders/iris/vertices/sodium/terrain/XHFPTerrainVertex.java b/common/src/main/java/net/irisshaders/iris/vertices/sodium/terrain/XHFPTerrainVertex.java index c8d5fe8469..3c7797d7c0 100644 --- a/common/src/main/java/net/irisshaders/iris/vertices/sodium/terrain/XHFPTerrainVertex.java +++ b/common/src/main/java/net/irisshaders/iris/vertices/sodium/terrain/XHFPTerrainVertex.java @@ -1,7 +1,6 @@ package net.irisshaders.iris.vertices.sodium.terrain; import net.caffeinemc.mods.sodium.api.util.ColorABGR; -import net.caffeinemc.mods.sodium.client.render.chunk.terrain.material.Material; import net.caffeinemc.mods.sodium.client.render.chunk.vertex.format.ChunkVertexEncoder; import net.caffeinemc.mods.sodium.client.render.frapi.helper.ColorHelper; import net.irisshaders.iris.shaderpack.materialmap.WorldRenderingSettings; diff --git a/common/src/main/resources/centerDepth.fsh b/common/src/main/resources/centerDepth.fsh index 7ecfeaaa44..33427a501d 100644 --- a/common/src/main/resources/centerDepth.fsh +++ b/common/src/main/resources/centerDepth.fsh @@ -13,7 +13,7 @@ void main() { float oldDepth = texture(altDepth, vec2(0.5)).r; if (isnan(oldDepth)) { - oldDepth = currentDepth; + oldDepth = currentDepth; } iris_fragColor = mix(oldDepth, currentDepth, decay2); diff --git a/common/src/main/resources/mixins.iris.compat.sodium.json b/common/src/main/resources/mixins.iris.compat.sodium.json index 66fc7ad1a8..27ffdb1688 100644 --- a/common/src/main/resources/mixins.iris.compat.sodium.json +++ b/common/src/main/resources/mixins.iris.compat.sodium.json @@ -7,9 +7,9 @@ "client": [ "MixinBlockRenderer", "MixinChunkBuildBuffers", + "MixinChunkMeshBufferBuilder", "MixinChunkMeshBuildTask", "MixinCloudRenderer", - "MixinChunkMeshBufferBuilder", "MixinDefaultChunkRenderer", "MixinGlRenderDevice", "MixinRenderRegionArenas", diff --git a/common/src/vendored/java/de/odysseus/ithaka/digraph/util/fas/SimpleFeedbackArcSetProvider.java b/common/src/vendored/java/de/odysseus/ithaka/digraph/util/fas/SimpleFeedbackArcSetProvider.java index 3463779c95..471b2f39df 100644 --- a/common/src/vendored/java/de/odysseus/ithaka/digraph/util/fas/SimpleFeedbackArcSetProvider.java +++ b/common/src/vendored/java/de/odysseus/ithaka/digraph/util/fas/SimpleFeedbackArcSetProvider.java @@ -23,7 +23,6 @@ import java.util.ArrayList; import java.util.Collections; -import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.List; diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts index 9c53520c7c..26044ef602 100644 --- a/fabric/build.gradle.kts +++ b/fabric/build.gradle.kts @@ -81,6 +81,7 @@ loom { client() configName = "Fabric Client" ideConfigGenerated(true) + vmArgs("-Dmixin.debug.export=true") runDir("run") } named("server") {