mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-21 21:02:15 +00:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1dd98978ad | ||
|
|
dae986eb0b | ||
|
|
5fdf84edd0 | ||
|
|
b19d023c11 | ||
|
|
41eafbd151 | ||
|
|
dd970b4c6a |
No files matched your search
+1
-1
@@ -110,7 +110,7 @@ dependencies {
|
||||
compileOnly("com.github.GTNewHorizons:NotEnoughIds:2.1.10:dev") // Mixin Version
|
||||
compileOnly("com.github.GTNewHorizons:NotEnoughIds-Legacy:1.4.7:dev") // ASM Version
|
||||
|
||||
compileOnly(rfg.deobf("curse.maven:ntm-space-1121235:6974420"))
|
||||
compileOnly(rfg.deobf("maven.modrinth:ntmspace:X5593_H261"))
|
||||
|
||||
compileOnly(rfg.deobf("curse.maven:campfirebackport-387444:4611675"))
|
||||
compileOnly(rfg.deobf("curse.maven:xaeros-minimap-263420:5060684"))
|
||||
|
||||
+1
-1
@@ -16,5 +16,5 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("com.gtnewhorizons.gtnhsettingsconvention") version("2.0.18")
|
||||
id("com.gtnewhorizons.gtnhsettingsconvention") version("2.0.19")
|
||||
}
|
||||
@@ -1,19 +1,21 @@
|
||||
package com.gtnewhorizons.angelica;
|
||||
|
||||
import static com.gtnewhorizons.angelica.AngelicaMod.MOD_ID;
|
||||
|
||||
import com.gtnewhorizons.angelica.common.BlockError;
|
||||
import com.gtnewhorizons.angelica.compat.ModStatus;
|
||||
import com.gtnewhorizons.angelica.config.ConfigMigrator;
|
||||
import com.gtnewhorizons.angelica.proxy.CommonProxy;
|
||||
import com.gtnewhorizons.angelica.utils.AnimationMode;
|
||||
import com.gtnewhorizons.angelica.utils.ManagedEnum;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import me.jellysquid.mods.sodium.client.gui.SodiumGameOptions;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import static com.gtnewhorizons.angelica.AngelicaMod.MOD_ID;
|
||||
|
||||
@Mod(
|
||||
modid = MOD_ID,
|
||||
@@ -33,6 +35,15 @@ public class AngelicaMod {
|
||||
public static final String MOD_ID = "angelica";
|
||||
public static final Logger LOGGER = LogManager.getLogger("Angelica");
|
||||
|
||||
private static SodiumGameOptions CONFIG;
|
||||
|
||||
public static SodiumGameOptions options() {
|
||||
if (CONFIG == null) {
|
||||
CONFIG = SodiumGameOptions.load(ConfigMigrator.handleConfigMigration("angelica-options.json"));
|
||||
}
|
||||
return CONFIG;
|
||||
}
|
||||
|
||||
@SidedProxy(clientSide = "com.gtnewhorizons.angelica.proxy.ClientProxy", serverSide = "com.gtnewhorizons.angelica.proxy.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.gtnewhorizons.angelica.compat.toremove;
|
||||
|
||||
import com.gtnewhorizons.angelica.AngelicaMod;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import me.jellysquid.mods.sodium.client.SodiumClientMod;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
@@ -147,7 +147,7 @@ public abstract class RenderPhase {
|
||||
FOG = new Fog("fog", () -> {
|
||||
// Unclear what this should do
|
||||
// BackgroundRenderer.setFogBlack(), also levelFogColor()
|
||||
SodiumClientMod.LOGGER.debug("Fog - Not setting level fog color");
|
||||
AngelicaMod.LOGGER.debug("Fog - Not setting level fog color");
|
||||
GLStateManager.enableFog();
|
||||
}, GLStateManager::disableFog);
|
||||
BLACK_FOG = new Fog("black_fog", () -> {
|
||||
@@ -156,7 +156,7 @@ public abstract class RenderPhase {
|
||||
}, () -> {
|
||||
// Unclear what this should do
|
||||
// BackgroundRenderer.setFogBlack(), also levelFogColor()
|
||||
SodiumClientMod.LOGGER.debug("Fog - Not setting level fog color");
|
||||
AngelicaMod.LOGGER.debug("Fog - Not setting level fog color");
|
||||
GLStateManager.disableFog();
|
||||
});
|
||||
MAIN_TARGET = new Target("main_target", () -> {
|
||||
@@ -164,7 +164,7 @@ public abstract class RenderPhase {
|
||||
});
|
||||
OUTLINE_TARGET = new Target("outline_target", () -> {
|
||||
// TODO: Sodium
|
||||
SodiumClientMod.LOGGER.debug("NOT enabling the entity outline framebuffer");
|
||||
AngelicaMod.LOGGER.debug("NOT enabling the entity outline framebuffer");
|
||||
//MinecraftClient.getInstance().worldRenderer.getEntityOutlinesFramebuffer().beginWrite(false);
|
||||
}, () -> {
|
||||
Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(false);
|
||||
@@ -172,7 +172,7 @@ public abstract class RenderPhase {
|
||||
TRANSLUCENT_TARGET = new Target("translucent_target", () -> {
|
||||
if (Minecraft.isFancyGraphicsEnabled()) {
|
||||
// TODO: Sodium
|
||||
SodiumClientMod.LOGGER.debug("NOT enabling the translucent framebuffer");
|
||||
AngelicaMod.LOGGER.debug("NOT enabling the translucent framebuffer");
|
||||
// MinecraftClient.getInstance().worldRenderer.getTranslucentFramebuffer().beginWrite(false);
|
||||
}
|
||||
|
||||
@@ -345,7 +345,7 @@ public abstract class RenderPhase {
|
||||
super("lightmap", () -> {
|
||||
if (lightmap) {
|
||||
// TODO: Sodium - LightmapTextureManager
|
||||
SodiumClientMod.LOGGER.debug("Lightmap - enable (not implemented)");
|
||||
AngelicaMod.LOGGER.debug("Lightmap - enable (not implemented)");
|
||||
// throw new RuntimeException("Not Implemented Yet");
|
||||
// MinecraftClient.getInstance().gameRenderer.getLightmapTextureManager().enable();
|
||||
|
||||
@@ -354,7 +354,7 @@ public abstract class RenderPhase {
|
||||
}, () -> {
|
||||
if (lightmap) {
|
||||
// TODO: Sodium - LightmapTextureManager
|
||||
SodiumClientMod.LOGGER.debug("Lightmap - disable (not implemented)");
|
||||
AngelicaMod.LOGGER.debug("Lightmap - disable (not implemented)");
|
||||
// throw new RuntimeException("Not Implemented Yet");
|
||||
// MinecraftClient.getInstance().gameRenderer.getLightmapTextureManager().disable();
|
||||
}
|
||||
|
||||
@@ -1019,11 +1019,22 @@ public class DisplayListManager {
|
||||
if (currentRecorder != null) {
|
||||
recordCallList(list);
|
||||
|
||||
if (glListMode == GL11.GL_COMPILE) {
|
||||
return;
|
||||
if (getListMode() != GL11.GL_COMPILE) {
|
||||
// Don't record the GL calls, we already recorded glCallList
|
||||
final CommandRecorder recorder = currentRecorder;
|
||||
currentRecorder = null;
|
||||
|
||||
executeDisplayList(list);
|
||||
|
||||
currentRecorder = recorder;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
executeDisplayList(list);
|
||||
}
|
||||
|
||||
private static void executeDisplayList(int list) {
|
||||
final CompiledDisplayList compiled = displayListCache.get(list);
|
||||
if (compiled != null) {
|
||||
final int prevList = currentRenderingList;
|
||||
|
||||
@@ -553,6 +553,57 @@ public final class GLDebug {
|
||||
};
|
||||
}
|
||||
|
||||
public static String getFramebufferStatusName(int status) {
|
||||
return switch (status) {
|
||||
case GL30.GL_FRAMEBUFFER_COMPLETE -> "COMPLETE";
|
||||
case GL30.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT -> "INCOMPLETE_ATTACHMENT";
|
||||
case GL30.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT -> "INCOMPLETE_MISSING_ATTACHMENT";
|
||||
case GL30.GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER -> "INCOMPLETE_DRAW_BUFFER";
|
||||
case GL30.GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER -> "INCOMPLETE_READ_BUFFER";
|
||||
case GL30.GL_FRAMEBUFFER_UNSUPPORTED -> "UNSUPPORTED";
|
||||
case GL30.GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE -> "INCOMPLETE_MULTISAMPLE";
|
||||
case 0 -> "NO_FRAMEBUFFER_BOUND";
|
||||
default -> String.format("UNKNOWN(0x%X)", status);
|
||||
};
|
||||
}
|
||||
|
||||
public static String getInternalFormatName(int format) {
|
||||
return switch (format) {
|
||||
// Basic
|
||||
case GL11.GL_RGBA -> "RGBA";
|
||||
case GL11.GL_RGB -> "RGB";
|
||||
// 8-bit normalized
|
||||
case GL30.GL_R8 -> "R8";
|
||||
case GL30.GL_RG8 -> "RG8";
|
||||
case GL11.GL_RGB8 -> "RGB8";
|
||||
case GL11.GL_RGBA8 -> "RGBA8";
|
||||
// 8-bit signed normalized
|
||||
case 0x8F94 -> "R8_SNORM";
|
||||
case 0x8F95 -> "RG8_SNORM";
|
||||
case 0x8F96 -> "RGB8_SNORM";
|
||||
case 0x8F97 -> "RGBA8_SNORM";
|
||||
// 16-bit normalized
|
||||
case GL30.GL_R16 -> "R16";
|
||||
case GL30.GL_RG16 -> "RG16";
|
||||
case GL11.GL_RGB16 -> "RGB16";
|
||||
case GL11.GL_RGBA16 -> "RGBA16";
|
||||
// 16-bit float
|
||||
case GL30.GL_R16F -> "R16F";
|
||||
case GL30.GL_RG16F -> "RG16F";
|
||||
case GL30.GL_RGB16F -> "RGB16F";
|
||||
case GL30.GL_RGBA16F -> "RGBA16F";
|
||||
// 32-bit float
|
||||
case GL30.GL_R32F -> "R32F";
|
||||
case GL30.GL_RG32F -> "RG32F";
|
||||
case GL30.GL_RGB32F -> "RGB32F";
|
||||
case GL30.GL_RGBA32F -> "RGBA32F";
|
||||
// Packed
|
||||
case GL30.GL_R11F_G11F_B10F -> "R11F_G11F_B10F";
|
||||
case GL11.GL_RGB10_A2 -> "RGB10_A2";
|
||||
default -> String.format("0x%X", format);
|
||||
};
|
||||
}
|
||||
|
||||
private static DebugState debugState;
|
||||
|
||||
private interface DebugState {
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.gtnewhorizons.angelica.glsm.dsa.DSAARB;
|
||||
import com.gtnewhorizons.angelica.glsm.dsa.DSAAccess;
|
||||
import com.gtnewhorizons.angelica.glsm.dsa.DSACore;
|
||||
import com.gtnewhorizons.angelica.glsm.dsa.DSAUnsupported;
|
||||
import com.gtnewhorizons.angelica.glsm.texture.TextureInfoCache;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -28,6 +29,8 @@ import org.lwjgl.opengl.GL43;
|
||||
import org.lwjgl.opengl.GL44;
|
||||
import org.lwjgl.opengl.NVXGpuMemoryInfo;
|
||||
|
||||
import net.coderbot.iris.gl.shader.StandardMacros;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
@@ -48,6 +51,8 @@ public class RenderSystem {
|
||||
private static boolean supportsSamplerObjects;
|
||||
private static int maxImageUnits;
|
||||
private static int maxSSBOBindings;
|
||||
private static int maxGlslVersion;
|
||||
private static boolean supportsGpuShader4;
|
||||
|
||||
// Sampler object state tracking (null if unsupported)
|
||||
private static int[] samplers;
|
||||
@@ -112,6 +117,10 @@ public class RenderSystem {
|
||||
samplers = new int[GL11.glGetInteger(GL20.GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS)];
|
||||
}
|
||||
|
||||
maxGlslVersion = Integer.parseInt(StandardMacros.getGlVersion(GL20.GL_SHADING_LANGUAGE_VERSION));
|
||||
supportsGpuShader4 = GLStateManager.capabilities.GL_EXT_gpu_shader4;
|
||||
|
||||
LOGGER.info("Max GLSL version: {}, GPU Shader4: {}", maxGlslVersion, supportsGpuShader4);
|
||||
LOGGER.info("Image Load/Store: {}, Max Image Units: {}", supportsImageLoadStore, maxImageUnits);
|
||||
LOGGER.info("SSBO: {}, Max SSBO Bindings: {}", supportsSSBO, maxSSBOBindings);
|
||||
LOGGER.info("Buffer Storage: {}, Clear Texture: {}, Sampler Objects: {}", supportsBufferStorage, supportsClearTexture, supportsSamplerObjects);
|
||||
@@ -126,8 +135,11 @@ public class RenderSystem {
|
||||
}
|
||||
|
||||
public static void texImage2D(int texture, int target, int level, int internalformat, int width, int height, int border, int format, int type, @Nullable ByteBuffer pixels) {
|
||||
GL11.glBindTexture(target, texture);
|
||||
GLStateManager.glBindTexture(target, texture);
|
||||
GL11.glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
|
||||
if (target == GL11.GL_TEXTURE_2D && level == 0) {
|
||||
TextureInfoCache.INSTANCE.onTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
|
||||
}
|
||||
}
|
||||
|
||||
public static void uniformMatrix4fv(int location, boolean transpose, FloatBuffer matrix) {
|
||||
@@ -409,10 +421,12 @@ public class RenderSystem {
|
||||
}
|
||||
|
||||
public static void clearBufferSubData(int target, int internalFormat, long offset, long size, int format, int type, int[] data) {
|
||||
final ByteBuffer buf = BufferUtils.createByteBuffer(data.length * 4);
|
||||
buf.asIntBuffer().put(data);
|
||||
if (GLStateManager.capabilities.OpenGL43) {
|
||||
GL43.glClearBufferSubData(target, internalFormat, offset, size, format, type, (ByteBuffer) null);
|
||||
GL43.glClearBufferSubData(target, internalFormat, offset, size, format, type, buf);
|
||||
} else if (GLStateManager.capabilities.GL_ARB_clear_buffer_object) {
|
||||
ARBClearBufferObject.glClearBufferSubData(target, internalFormat, offset, size, format, type, (ByteBuffer) null);
|
||||
ARBClearBufferObject.glClearBufferSubData(target, internalFormat, offset, size, format, type, buf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,6 +463,22 @@ public class RenderSystem {
|
||||
dsaState.textureStorage3D(texture, target, levels, internalFormat, width, height, depth);
|
||||
}
|
||||
|
||||
public static int getMaxGlslVersion() {
|
||||
return maxGlslVersion;
|
||||
}
|
||||
|
||||
public static boolean supportsGpuShader4() {
|
||||
return supportsGpuShader4;
|
||||
}
|
||||
|
||||
public static boolean supportsSnormFormats() {
|
||||
return GLStateManager.capabilities.OpenGL31;
|
||||
}
|
||||
|
||||
public static boolean supportsPackedFloatRenderable() {
|
||||
return GLStateManager.capabilities.OpenGL30 && maxGlslVersion >= 130;
|
||||
}
|
||||
|
||||
public static boolean supportsTesselation() {
|
||||
return supportsTesselation;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package com.gtnewhorizons.angelica.proxy;
|
||||
|
||||
import static com.gtnewhorizons.angelica.AngelicaMod.MOD_ID;
|
||||
import static com.gtnewhorizons.angelica.loading.AngelicaTweaker.LOGGER;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.gtnewhorizon.gtnhlib.client.model.loading.ModelRegistry;
|
||||
import com.gtnewhorizon.gtnhlib.client.renderer.vao.VAOManager;
|
||||
import com.gtnewhorizons.angelica.commands.AngelicaCommand;
|
||||
import com.gtnewhorizons.angelica.compat.ModStatus;
|
||||
import com.gtnewhorizons.angelica.compat.bettercrashes.BetterCrashesCompat;
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
@@ -18,6 +16,7 @@ import com.gtnewhorizons.angelica.dynamiclights.config.EntityLightConfig;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.gtnewhorizons.angelica.glsm.debug.OpenGLDebugging;
|
||||
import com.gtnewhorizons.angelica.hudcaching.HUDCaching;
|
||||
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
|
||||
import com.gtnewhorizons.angelica.mixins.interfaces.IGameSettingsExt;
|
||||
import com.gtnewhorizons.angelica.render.CloudRenderer;
|
||||
import com.gtnewhorizons.angelica.rendering.AngelicaBlockSafetyRegistry;
|
||||
@@ -27,10 +26,7 @@ import com.gtnewhorizons.angelica.rendering.celeritas.threading.ChunkTaskRegistr
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.threading.DefaultChunkTaskProvider;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.threading.ThreadedChunkTaskProvider;
|
||||
import com.gtnewhorizons.angelica.zoom.Zoom;
|
||||
import com.gtnewhorizons.angelica.commands.AngelicaCommand;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
|
||||
import net.minecraftforge.client.ClientCommandHandler;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
@@ -40,10 +36,11 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import jss.notfine.core.Settings;
|
||||
import jss.notfine.gui.GuiCustomMenu;
|
||||
import jss.notfine.gui.NotFineGameOptionPages;
|
||||
import me.flashyreese.mods.reeses_sodium_options.client.gui.ReeseSodiumVideoOptionsScreen;
|
||||
import me.jellysquid.mods.sodium.client.gui.SodiumOptionsGUI;
|
||||
import net.coderbot.iris.Iris;
|
||||
import net.coderbot.iris.client.IrisDebugScreenHandler;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -51,6 +48,8 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.GuiMainMenu;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiVideoSettings;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.network.NetHandlerPlayClient;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
@@ -61,14 +60,23 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.client.ClientCommandHandler;
|
||||
import net.minecraftforge.client.event.EntityViewRenderEvent;
|
||||
import net.minecraftforge.client.event.FOVUpdateEvent;
|
||||
import net.minecraftforge.client.event.GuiOpenEvent;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static com.gtnewhorizons.angelica.AngelicaMod.MOD_ID;
|
||||
import static com.gtnewhorizons.angelica.loading.AngelicaTweaker.LOGGER;
|
||||
|
||||
public class ClientProxy extends CommonProxy {
|
||||
|
||||
final Minecraft mc = Minecraft.getMinecraft();
|
||||
@@ -323,6 +331,20 @@ public class ClientProxy extends CommonProxy {
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onGuiInit(GuiScreenEvent.InitGuiEvent.Pre event) {
|
||||
if(event.gui instanceof GuiVideoSettings eventGui) {
|
||||
event.setCanceled(true);
|
||||
if(AngelicaConfig.enableNotFineOptions || GuiScreen.isShiftKeyDown()) {
|
||||
Minecraft.getMinecraft().displayGuiScreen(new GuiCustomMenu(eventGui.parentGuiScreen, NotFineGameOptionPages.general(), NotFineGameOptionPages.detail(), NotFineGameOptionPages.atmosphere(), NotFineGameOptionPages.particles(), NotFineGameOptionPages.other()));
|
||||
} else if(!AngelicaConfig.enableReesesSodiumOptions || GuiScreen.isCtrlKeyDown()) {
|
||||
Minecraft.getMinecraft().displayGuiScreen(new SodiumOptionsGUI(eventGui.parentGuiScreen));
|
||||
} else {
|
||||
Minecraft.getMinecraft().displayGuiScreen(new ReeseSodiumVideoOptionsScreen(eventGui.parentGuiScreen));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* coerce NaN fog values back to 0 (https://bugs.mojang.com/browse/MC-10480) - from ArchaicFix */
|
||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
public void onFogColor(EntityViewRenderEvent.FogColors event) {
|
||||
|
||||
+11
-11
@@ -1,32 +1,29 @@
|
||||
package com.gtnewhorizons.angelica.rendering.celeritas;
|
||||
|
||||
import com.gtnewhorizons.angelica.AngelicaMod;
|
||||
import com.gtnewhorizons.angelica.dynamiclights.DynamicLights;
|
||||
import com.gtnewhorizons.angelica.dynamiclights.IDynamicLightSource;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.iris.BlockRenderContext;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.iris.IrisExtendedChunkVertexEncoder;
|
||||
import org.embeddedt.embeddium.impl.model.light.LightPipeline;
|
||||
import org.embeddedt.embeddium.impl.model.light.flat.FlatLightPipeline;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.ChunkColorWriter;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.light.LightDataCache;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.light.QuadLightingHelper;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.light.VanillaDiffuseProvider;
|
||||
import org.embeddedt.embeddium.impl.model.light.smooth.SmoothLightPipeline;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.world.WorldSlice;
|
||||
import lombok.Getter;
|
||||
import me.jellysquid.mods.sodium.client.SodiumClientMod;
|
||||
import net.coderbot.iris.block_rendering.BlockRenderingSettings;
|
||||
import net.irisshaders.iris.api.v0.IrisApi;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import org.embeddedt.embeddium.impl.model.light.LightPipeline;
|
||||
import org.embeddedt.embeddium.impl.model.light.data.LightDataAccess;
|
||||
import org.embeddedt.embeddium.impl.model.light.data.QuadLightData;
|
||||
import org.embeddedt.embeddium.impl.model.light.flat.FlatLightPipeline;
|
||||
import org.embeddedt.embeddium.impl.model.light.smooth.SmoothLightPipeline;
|
||||
import org.embeddedt.embeddium.impl.model.quad.properties.ModelQuadFacing;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.ChunkColorWriter;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.RenderPassConfiguration;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.compile.ChunkBuildBuffers;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.compile.ChunkBuildContext;
|
||||
@@ -36,6 +33,9 @@ import org.embeddedt.embeddium.impl.render.chunk.terrain.material.Material;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.vertex.format.ChunkVertexEncoder;
|
||||
import org.embeddedt.embeddium.impl.util.QuadUtil;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class AngelicaChunkBuildContext extends ChunkBuildContext {
|
||||
public static final int NUM_PASSES = 2;
|
||||
|
||||
@@ -95,7 +95,7 @@ public class AngelicaChunkBuildContext extends ChunkBuildContext {
|
||||
|
||||
private Material selectMaterial(Material material, TextureAtlasSprite sprite, boolean isShaderPackOverride) {
|
||||
// Don't apply transparency-based optimization when shader pack explicitly overrides the material
|
||||
if (isShaderPackOverride) {
|
||||
if (!AngelicaMod.options().performance.useRenderPassOptimization || isShaderPackOverride) {
|
||||
return material;
|
||||
}
|
||||
if (sprite != null && sprite.getClass() == TextureAtlasSprite.class && !sprite.hasAnimationMetadata()) {
|
||||
@@ -124,7 +124,7 @@ public class AngelicaChunkBuildContext extends ChunkBuildContext {
|
||||
|
||||
final boolean hasDynamicLights = chunkLightSources != null && !chunkLightSources.isEmpty();
|
||||
final boolean separateAo = BlockRenderingSettings.INSTANCE.shouldUseSeparateAo();
|
||||
final boolean celeritasSmoothLighting = SodiumClientMod.options().quality.useCeleritasSmoothLighting;
|
||||
final boolean celeritasSmoothLighting = AngelicaMod.options().quality.useCeleritasSmoothLighting;
|
||||
final boolean shaderActive = IrisApi.getInstance().isShaderPackInUse();
|
||||
final boolean useAoCalculation = lightPipelineReady && (separateAo || celeritasSmoothLighting || shaderActive);
|
||||
final boolean stripDiffuse = shaderActive && BlockRenderingSettings.INSTANCE.shouldDisableDirectionalShading();
|
||||
|
||||
+13
-11
@@ -1,11 +1,12 @@
|
||||
package com.gtnewhorizons.angelica.rendering.celeritas;
|
||||
|
||||
import com.gtnewhorizons.angelica.AngelicaMod;
|
||||
import com.gtnewhorizons.angelica.mixins.interfaces.RenderSectionManagerAccessor;
|
||||
import com.gtnewhorizons.angelica.rendering.AngelicaRenderQueue;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.api.IrisShaderProviderHolder;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.threading.ChunkTaskProvider;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.threading.ChunkTaskRegistry;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.world.cloned.ClonedChunkSectionCache;
|
||||
import me.jellysquid.mods.sodium.client.SodiumClientMod;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
@@ -15,7 +16,6 @@ import org.embeddedt.embeddium.impl.render.chunk.ChunkRenderMatrices;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.RenderPassConfiguration;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.RenderSection;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.RenderSectionManager;
|
||||
import org.embeddedt.embeddium.impl.render.viewport.CameraTransform;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.compile.ChunkBuildOutput;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.compile.tasks.ChunkBuilderTask;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.lists.SectionTicker;
|
||||
@@ -23,12 +23,11 @@ import org.embeddedt.embeddium.impl.render.chunk.occlusion.AsyncOcclusionMode;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.sprite.GenericSectionSpriteTicker;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.terrain.TerrainRenderPass;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.vertex.format.ChunkVertexType;
|
||||
import org.embeddedt.embeddium.impl.render.viewport.CameraTransform;
|
||||
import org.embeddedt.embeddium.impl.render.viewport.Viewport;
|
||||
import org.embeddedt.embeddium.impl.util.PositionUtil;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.gtnewhorizons.angelica.mixins.interfaces.RenderSectionManagerAccessor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -88,7 +87,7 @@ public class AngelicaRenderSectionManager extends RenderSectionManager {
|
||||
|
||||
@Override
|
||||
protected AsyncOcclusionMode getAsyncOcclusionMode() {
|
||||
return AsyncOcclusionMode.EVERYTHING;
|
||||
return AngelicaMod.options().performance.asyncOcclusionMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -98,7 +97,7 @@ public class AngelicaRenderSectionManager extends RenderSectionManager {
|
||||
|
||||
@Override
|
||||
protected boolean useFogOcclusion() {
|
||||
return true;
|
||||
return AngelicaMod.options().performance.useFogOcclusion && !IrisShaderProviderHolder.isActive();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -108,10 +107,13 @@ public class AngelicaRenderSectionManager extends RenderSectionManager {
|
||||
|
||||
@Override
|
||||
protected boolean shouldUseOcclusionCulling(Viewport positionedViewport, boolean spectator) {
|
||||
if (!spectator) return true;
|
||||
|
||||
final var camBlockPos = positionedViewport.getBlockCoord();
|
||||
return !this.world.getBlock(camBlockPos.x(), camBlockPos.y(), camBlockPos.z()).isOpaqueCube();
|
||||
if (spectator) {
|
||||
final var camBlockPos = positionedViewport.getBlockCoord();
|
||||
if (this.world.getBlock(camBlockPos.x(), camBlockPos.y(), camBlockPos.z()).isOpaqueCube()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return AngelicaMod.options().performance.useOcclusionCulling;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -150,7 +152,7 @@ public class AngelicaRenderSectionManager extends RenderSectionManager {
|
||||
|
||||
@Override
|
||||
protected boolean allowImportantRebuilds() {
|
||||
return !SodiumClientMod.options().performance.alwaysDeferChunkUpdates;
|
||||
return !AngelicaMod.options().performance.alwaysDeferChunkUpdates;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+5
-5
@@ -1,11 +1,14 @@
|
||||
package com.gtnewhorizons.angelica.rendering.celeritas;
|
||||
|
||||
import com.gtnewhorizons.angelica.AngelicaMod;
|
||||
import com.gtnewhorizons.angelica.dynamiclights.DynamicLights;
|
||||
import com.gtnewhorizons.angelica.dynamiclights.IDynamicLightWorldRenderer;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.gtnewhorizons.angelica.mixins.interfaces.ITileEntityBoundingBoxCache;
|
||||
import com.gtnewhorizons.angelica.rendering.RenderingState;
|
||||
import com.gtnewhorizons.angelica.rendering.TileEntityRenderBoundsRegistry;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.api.IrisShaderProvider;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.api.IrisShaderProviderHolder;
|
||||
import net.coderbot.iris.pipeline.ShadowRenderer;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
@@ -23,9 +26,6 @@ import org.embeddedt.embeddium.impl.render.chunk.lists.ChunkRenderList;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.lists.SortedRenderLists;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.vertex.format.ChunkMeshFormats;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.vertex.format.ChunkVertexType;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.api.IrisShaderProvider;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.api.IrisShaderProviderHolder;
|
||||
import me.jellysquid.mods.sodium.client.SodiumClientMod;
|
||||
import org.embeddedt.embeddium.impl.render.terrain.SimpleWorldRenderer;
|
||||
import org.embeddedt.embeddium.impl.render.viewport.Viewport;
|
||||
import org.joml.Matrix4f;
|
||||
@@ -118,7 +118,7 @@ public class CeleritasWorldRenderer extends SimpleWorldRenderer<WorldClient, Ang
|
||||
}
|
||||
}
|
||||
|
||||
if (SodiumClientMod.options().advanced.useCompactVertexFormat) {
|
||||
if (AngelicaMod.options().performance.useCompactVertexFormat) {
|
||||
return ChunkMeshFormats.COMPACT;
|
||||
}
|
||||
return ChunkMeshFormats.VANILLA_LIKE;
|
||||
@@ -146,7 +146,7 @@ public class CeleritasWorldRenderer extends SimpleWorldRenderer<WorldClient, Ang
|
||||
|
||||
renderSectionManager.setCameraPosition(transform.x, transform.y, transform.z);
|
||||
|
||||
this.useEntityCulling = true;
|
||||
this.useEntityCulling = AngelicaMod.options().performance.useEntityCulling;
|
||||
|
||||
super.setupTerrain(viewport, cameraState, frame, spectator, updateChunksImmediately);
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package jss.notfine.gui;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.gtnewhorizons.angelica.dynamiclights.DynamicLights;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import jss.notfine.config.NotFineConfig;
|
||||
import jss.notfine.core.Settings;
|
||||
@@ -297,7 +296,7 @@ public class NotFineGameOptionPages {
|
||||
.setTooltip(I18n.format("sodium.options.use_block_face_culling.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setImpact(OptionImpact.MEDIUM)
|
||||
.setBinding((opts, value) -> opts.advanced.useBlockFaceCulling = value, opts -> opts.advanced.useBlockFaceCulling)
|
||||
.setBinding((opts, value) -> opts.performance.useBlockFaceCulling = value, opts -> opts.performance.useBlockFaceCulling)
|
||||
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
|
||||
.build())
|
||||
.add(OptionImpl.createBuilder(boolean.class, sodiumOpts)
|
||||
@@ -305,14 +304,14 @@ public class NotFineGameOptionPages {
|
||||
.setTooltip(I18n.format("sodium.options.use_compact_vertex_format.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setImpact(OptionImpact.MEDIUM)
|
||||
.setBinding((opts, value) -> opts.advanced.useCompactVertexFormat = value, opts -> opts.advanced.useCompactVertexFormat)
|
||||
.setBinding((opts, value) -> opts.performance.useCompactVertexFormat = value, opts -> opts.performance.useCompactVertexFormat)
|
||||
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
|
||||
.build())
|
||||
.add(OptionImpl.createBuilder(boolean.class, sodiumOpts)
|
||||
.setName(I18n.format("sodium.options.use_fog_occlusion.name"))
|
||||
.setTooltip(I18n.format("sodium.options.use_fog_occlusion.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setBinding((opts, value) -> opts.advanced.useFogOcclusion = value, opts -> opts.advanced.useFogOcclusion)
|
||||
.setBinding((opts, value) -> opts.performance.useFogOcclusion = value, opts -> opts.performance.useFogOcclusion)
|
||||
.setImpact(OptionImpact.MEDIUM)
|
||||
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
|
||||
.build())
|
||||
@@ -320,7 +319,7 @@ public class NotFineGameOptionPages {
|
||||
.setName(I18n.format("sodium.options.translucency_sorting.name"))
|
||||
.setTooltip(I18n.format("sodium.options.translucency_sorting.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setBinding((opts, value) -> opts.advanced.translucencySorting = value, opts -> opts.advanced.translucencySorting)
|
||||
.setBinding((opts, value) -> opts.performance.translucencySorting = value, opts -> opts.performance.translucencySorting)
|
||||
.setImpact(OptionImpact.MEDIUM)
|
||||
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
|
||||
.build())
|
||||
@@ -329,7 +328,7 @@ public class NotFineGameOptionPages {
|
||||
.setTooltip(I18n.format("sodium.options.use_entity_culling.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setImpact(OptionImpact.MEDIUM)
|
||||
.setBinding((opts, value) -> opts.advanced.useEntityCulling = value, opts -> opts.advanced.useEntityCulling)
|
||||
.setBinding((opts, value) -> opts.performance.useEntityCulling = value, opts -> opts.performance.useEntityCulling)
|
||||
.build())
|
||||
.add(OptionImpl.createBuilder(boolean.class, sodiumOpts)
|
||||
.setName(I18n.format("sodium.options.use_particle_culling.name"))
|
||||
@@ -345,7 +344,7 @@ public class NotFineGameOptionPages {
|
||||
.setTooltip(I18n.format("sodium.options.animate_only_visible_textures.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setImpact(OptionImpact.MEDIUM)
|
||||
.setBinding((opts, value) -> opts.advanced.animateOnlyVisibleTextures = value, opts -> opts.advanced.animateOnlyVisibleTextures)
|
||||
.setBinding((opts, value) -> opts.performance.animateOnlyVisibleTextures = value, opts -> opts.performance.animateOnlyVisibleTextures)
|
||||
.build())
|
||||
.build());
|
||||
groups.add(OptionGroup.createBuilder()
|
||||
|
||||
+2
-2
@@ -4,7 +4,6 @@ import com.gtnewhorizons.angelica.client.gui.FontConfigScreen;
|
||||
import com.gtnewhorizons.angelica.compat.mojang.Element;
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import jss.notfine.gui.GuiCustomMenu;
|
||||
import net.coderbot.iris.Iris;
|
||||
import me.flashyreese.mods.reeses_sodium_options.client.gui.frame.AbstractFrame;
|
||||
import me.flashyreese.mods.reeses_sodium_options.client.gui.frame.BasicFrame;
|
||||
import me.flashyreese.mods.reeses_sodium_options.client.gui.frame.components.SearchTextFieldComponent;
|
||||
@@ -19,6 +18,7 @@ import me.jellysquid.mods.sodium.client.gui.options.OptionPage;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.storage.OptionStorage;
|
||||
import me.jellysquid.mods.sodium.client.gui.widgets.FlatButtonWidget;
|
||||
import me.jellysquid.mods.sodium.client.util.Dim2i;
|
||||
import net.coderbot.iris.Iris;
|
||||
import net.coderbot.iris.gui.screen.ShaderPackScreen;
|
||||
import net.irisshaders.iris.api.v0.IrisApi;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
@@ -283,7 +283,7 @@ public class ReeseSodiumVideoOptionsScreen extends SodiumOptionsGUI {
|
||||
}
|
||||
if (keyCode == Keyboard.KEY_P) {
|
||||
if(isShiftKeyDown()){
|
||||
this.mc.displayGuiScreen(new GuiCustomMenu(this.prevScreen, SodiumGameOptionPages.general(), SodiumGameOptionPages.quality(), SodiumGameOptionPages.advanced(), SodiumGameOptionPages.performance()));
|
||||
this.mc.displayGuiScreen(new GuiCustomMenu(this.prevScreen, SodiumGameOptionPages.general(), SodiumGameOptionPages.quality(), SodiumGameOptionPages.advanced(), SodiumGameOptionPages.performance(), SodiumGameOptionPages.appearance(), SodiumGameOptionPages.debug()));
|
||||
} else if (isCtrlKeyDown()) {
|
||||
this.mc.displayGuiScreen(new SodiumOptionsGUI(this.prevScreen));
|
||||
}
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
package me.jellysquid.mods.sodium.client;
|
||||
|
||||
import com.gtnewhorizons.angelica.Tags;
|
||||
import com.gtnewhorizons.angelica.config.ConfigMigrator;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import lombok.Getter;
|
||||
import me.jellysquid.mods.sodium.client.gui.SodiumGameOptions;
|
||||
import me.jellysquid.mods.sodium.proxy.CommonProxy;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@Mod(modid = SodiumClientMod.MODID,
|
||||
name = SodiumClientMod.NAME,
|
||||
version = Tags.VERSION,
|
||||
acceptedMinecraftVersions = "[1.7.10]",
|
||||
acceptableRemoteVersions = "*")
|
||||
public class SodiumClientMod {
|
||||
@SidedProxy(clientSide = "me.jellysquid.mods.sodium.proxy.ClientProxy", serverSide = "me.jellysquid.mods.sodium.proxy.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
private static SodiumGameOptions CONFIG;
|
||||
public static Logger LOGGER = LogManager.getLogger("Embeddium");
|
||||
|
||||
private static String MOD_VERSION = Tags.VERSION;
|
||||
|
||||
public static final String MODID = "embeddium";
|
||||
public static final String NAME = "Embeddium";
|
||||
|
||||
@Getter
|
||||
private static Thread MainThread;
|
||||
|
||||
public SodiumClientMod() {
|
||||
MainThread = Thread.currentThread();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static SodiumGameOptions options() {
|
||||
if (CONFIG == null) {
|
||||
CONFIG = loadConfig();
|
||||
}
|
||||
|
||||
return CONFIG;
|
||||
}
|
||||
|
||||
public static Logger logger() {
|
||||
if (LOGGER == null) {
|
||||
LOGGER = LogManager.getLogger("Embeddium");
|
||||
}
|
||||
|
||||
return LOGGER;
|
||||
}
|
||||
|
||||
private static SodiumGameOptions loadConfig() {
|
||||
return SodiumGameOptions.load(ConfigMigrator.handleConfigMigration("angelica-options.json"));
|
||||
}
|
||||
|
||||
public static String getVersion() {
|
||||
if (MOD_VERSION == null) {
|
||||
throw new NullPointerException("Mod version hasn't been populated yet");
|
||||
}
|
||||
|
||||
return MOD_VERSION;
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
proxy.preInit(event);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
proxy.init(event);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
proxy.postInit(event);
|
||||
}
|
||||
|
||||
public static boolean isDirectMemoryAccessEnabled() {
|
||||
return options().advanced.allowDirectMemoryAccess;
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package me.jellysquid.mods.sodium.client.gui;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import com.gtnewhorizons.angelica.dynamiclights.DynamicLights;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import jss.notfine.core.Settings;
|
||||
import jss.notfine.core.SettingsManager;
|
||||
@@ -28,6 +27,7 @@ import net.coderbot.iris.gui.option.IrisVideoSettings;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.occlusion.AsyncOcclusionMode;
|
||||
import org.lwjgl.opengl.Display;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -80,19 +80,6 @@ public class SodiumGameOptionPages {
|
||||
.setControl(opt -> new SliderControl(opt, 0, 100, 1, ControlValueFormatter.brightness()))
|
||||
.setBinding((opts, value) -> opts.gammaSetting = value * 0.01F, (opts) -> (int) (opts.gammaSetting / 0.01F))
|
||||
.build());
|
||||
firstGroupBuilder.add(Settings.MODE_LIGHT_FLICKER.option)
|
||||
.add(Settings.MODE_SKY.option)
|
||||
.add(Settings.MODE_SUN_MOON.option)
|
||||
.add(Settings.RENDER_DISTANCE_CLOUDS.option)
|
||||
.add(Settings.CLOUD_HEIGHT.option)
|
||||
.add(Settings.CLOUD_SCALE.option)
|
||||
.add(Settings.MODE_CLOUD_TRANSLUCENCY.option)
|
||||
.add(Settings.MODE_STARS.option)
|
||||
.add(Settings.TOTAL_STARS.option)
|
||||
.add(Settings.HORIZON_DISABLE.option)
|
||||
.add(Settings.FOG_DISABLE.option)
|
||||
.add(Settings.FOG_NEAR_DISTANCE.option)
|
||||
.add(Settings.VOID_FOG.option);
|
||||
groups.add(firstGroupBuilder.build());
|
||||
|
||||
int maxGuiScale = Math.max(3, Math.min(Minecraft.getMinecraft().displayWidth / 320, Minecraft.getMinecraft().displayHeight / 240));
|
||||
@@ -166,24 +153,6 @@ public class SodiumGameOptionPages {
|
||||
.add(Settings.DYNAMIC_FOV.option)
|
||||
.add(Settings.MODE_WATER.option)
|
||||
.add(Settings.MODE_DROPPED_ITEMS.option)
|
||||
.add(
|
||||
OptionImpl.createBuilder(int.class, angelicaOpts)
|
||||
.setName(I18n.format("options.angelica.droppedItemLimit"))
|
||||
.setTooltip(I18n.format("options.angelica.droppedItemLimit.tooltip"))
|
||||
.setControl(option -> new SliderControl(option, 32, 2048, 32, ControlValueFormatter.droppedItemLimitLimit()))
|
||||
.setBinding((options, value) -> AngelicaConfig.droppedItemLimit = value, options -> AngelicaConfig.droppedItemLimit)
|
||||
.setImpact(OptionImpact.MEDIUM)
|
||||
.build()
|
||||
)
|
||||
.add(
|
||||
OptionImpl.createBuilder(int.class, angelicaOpts)
|
||||
.setName(I18n.format("options.angelica.mobSpawnerRenderDistance"))
|
||||
.setTooltip(I18n.format("options.angelica.mobSpawnerRenderDistance.tooltip"))
|
||||
.setControl(option -> new SliderControl(option, 16, 64, 1, ControlValueFormatter.number()))
|
||||
.setBinding((options, value) -> AngelicaConfig.mobSpawnerRenderDistance = value, options -> (int) AngelicaConfig.mobSpawnerRenderDistance)
|
||||
.setImpact(OptionImpact.MEDIUM)
|
||||
.build()
|
||||
)
|
||||
.build());
|
||||
|
||||
return new OptionPage(I18n.format("stat.generalButton"), ImmutableList.copyOf(groups));
|
||||
@@ -305,7 +274,7 @@ public class SodiumGameOptionPages {
|
||||
.setTooltip(I18n.format("sodium.options.use_block_face_culling.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setImpact(OptionImpact.MEDIUM)
|
||||
.setBinding((opts, value) -> opts.advanced.useBlockFaceCulling = value, opts -> opts.advanced.useBlockFaceCulling)
|
||||
.setBinding((opts, value) -> opts.performance.useBlockFaceCulling = value, opts -> opts.performance.useBlockFaceCulling)
|
||||
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
|
||||
.build()
|
||||
)
|
||||
@@ -314,7 +283,7 @@ public class SodiumGameOptionPages {
|
||||
.setTooltip(I18n.format("sodium.options.use_compact_vertex_format.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setImpact(OptionImpact.MEDIUM)
|
||||
.setBinding((opts, value) -> opts.advanced.useCompactVertexFormat = value, opts -> opts.advanced.useCompactVertexFormat)
|
||||
.setBinding((opts, value) -> opts.performance.useCompactVertexFormat = value, opts -> opts.performance.useCompactVertexFormat)
|
||||
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
|
||||
.build()
|
||||
)
|
||||
@@ -322,7 +291,7 @@ public class SodiumGameOptionPages {
|
||||
.setName(I18n.format("sodium.options.use_fog_occlusion.name"))
|
||||
.setTooltip(I18n.format("sodium.options.use_fog_occlusion.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setBinding((opts, value) -> opts.advanced.useFogOcclusion = value, opts -> opts.advanced.useFogOcclusion)
|
||||
.setBinding((opts, value) -> opts.performance.useFogOcclusion = value, opts -> opts.performance.useFogOcclusion)
|
||||
.setImpact(OptionImpact.MEDIUM)
|
||||
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
|
||||
.build()
|
||||
@@ -331,7 +300,7 @@ public class SodiumGameOptionPages {
|
||||
.setName(I18n.format("sodium.options.translucency_sorting.name"))
|
||||
.setTooltip(I18n.format("sodium.options.translucency_sorting.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setBinding((opts, value) -> opts.advanced.translucencySorting = value, opts -> opts.advanced.translucencySorting)
|
||||
.setBinding((opts, value) -> opts.performance.translucencySorting = value, opts -> opts.performance.translucencySorting)
|
||||
.setImpact(OptionImpact.MEDIUM)
|
||||
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
|
||||
.build()
|
||||
@@ -341,7 +310,7 @@ public class SodiumGameOptionPages {
|
||||
.setTooltip(I18n.format("sodium.options.use_entity_culling.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setImpact(OptionImpact.MEDIUM)
|
||||
.setBinding((opts, value) -> opts.advanced.useEntityCulling = value, opts -> opts.advanced.useEntityCulling)
|
||||
.setBinding((opts, value) -> opts.performance.useEntityCulling = value, opts -> opts.performance.useEntityCulling)
|
||||
.build()
|
||||
)
|
||||
.add(OptionImpl.createBuilder(boolean.class, sodiumOpts)
|
||||
@@ -357,7 +326,34 @@ public class SodiumGameOptionPages {
|
||||
.setTooltip(I18n.format("sodium.options.animate_only_visible_textures.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setImpact(OptionImpact.MEDIUM)
|
||||
.setBinding((opts, value) -> opts.advanced.animateOnlyVisibleTextures = value, opts -> opts.advanced.animateOnlyVisibleTextures)
|
||||
.setBinding((opts, value) -> opts.performance.animateOnlyVisibleTextures = value, opts -> opts.performance.animateOnlyVisibleTextures)
|
||||
.build()
|
||||
)
|
||||
.add(OptionImpl.createBuilder(boolean.class, sodiumOpts)
|
||||
.setName(I18n.format("sodium.options.use_render_pass_optimization.name"))
|
||||
.setTooltip(I18n.format("sodium.options.use_render_pass_optimization.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setImpact(OptionImpact.MEDIUM)
|
||||
.setBinding((opts, value) -> opts.performance.useRenderPassOptimization = value, opts -> opts.performance.useRenderPassOptimization)
|
||||
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
|
||||
.build()
|
||||
)
|
||||
.add(OptionImpl.createBuilder(boolean.class, sodiumOpts)
|
||||
.setName(I18n.format("sodium.options.use_occlusion_culling.name"))
|
||||
.setTooltip(I18n.format("sodium.options.use_occlusion_culling.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setImpact(OptionImpact.EXTREME)
|
||||
.setBinding((opts, value) -> opts.performance.useOcclusionCulling = value, opts -> opts.performance.useOcclusionCulling)
|
||||
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
|
||||
.build()
|
||||
)
|
||||
.add(OptionImpl.createBuilder(AsyncOcclusionMode.class, sodiumOpts)
|
||||
.setName(I18n.format("sodium.options.async_occlusion_mode.name"))
|
||||
.setTooltip(I18n.format("sodium.options.async_occlusion_mode.tooltip"))
|
||||
.setControl(o -> new CyclingControl<>(o, AsyncOcclusionMode.class, new String[]{"None", "Only Shadow", "Everything"}))
|
||||
.setImpact(OptionImpact.MEDIUM)
|
||||
.setBinding((opts, value) -> opts.performance.asyncOcclusionMode = value, opts -> opts.performance.asyncOcclusionMode)
|
||||
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
|
||||
.build()
|
||||
)
|
||||
.build());
|
||||
@@ -383,28 +379,6 @@ public class SodiumGameOptionPages {
|
||||
)
|
||||
.build());
|
||||
|
||||
groups.add(OptionGroup.createBuilder()
|
||||
.add(OptionImpl.createBuilder(int.class, angelicaOpts)
|
||||
.setName(I18n.format("options.angelica.itemdisplaylistcount"))
|
||||
.setTooltip(I18n.format("options.angelica.itemdisplaylistcount.tooltip"))
|
||||
.setControl(o -> new SliderControl(o, 256, 1024, 16, ControlValueFormatter.number()))
|
||||
.setImpact(OptionImpact.MEDIUM)
|
||||
.setBinding((opts, value) -> AngelicaConfig.itemRendererCacheSize = value, options -> AngelicaConfig.itemRendererCacheSize)
|
||||
.build()
|
||||
)
|
||||
.build());
|
||||
|
||||
groups.add(OptionGroup.createBuilder()
|
||||
.add(Settings.MODE_GUI_BACKGROUND.option)
|
||||
.add(Settings.GUI_BACKGROUND.option)
|
||||
.add(OptionImpl.createBuilder(boolean.class, angelicaOpts)
|
||||
.setName(I18n.format("options.angelica.disablef3"))
|
||||
.setTooltip(I18n.format("options.angelica.disablef3.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setBinding((opts, value) -> AngelicaConfig.disableF3Additions = value, opts -> AngelicaConfig.disableF3Additions)
|
||||
.build())
|
||||
.build());
|
||||
|
||||
return new OptionPage(I18n.format("sodium.options.pages.advanced"), ImmutableList.copyOf(groups));
|
||||
}
|
||||
|
||||
@@ -446,14 +420,6 @@ public class SodiumGameOptionPages {
|
||||
.setBinding((opts, value) -> opts.performance.useNoErrorGLContext = value, opts -> opts.performance.useNoErrorGLContext)
|
||||
.setFlags(OptionFlag.REQUIRES_GAME_RESTART)
|
||||
.build())
|
||||
.add(OptionImpl.createBuilder(boolean.class, sodiumOpts)
|
||||
.setName(I18n.format("sodium.options.use_gl_state_cache.name"))
|
||||
.setTooltip(I18n.format("sodium.options.use_gl_state_cache.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setImpact(OptionImpact.EXTREME)
|
||||
.setBinding((opts, value) -> GLStateManager.BYPASS_CACHE = !value, opts -> !GLStateManager.BYPASS_CACHE)
|
||||
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
|
||||
.build())
|
||||
.add(OptionImpl.createBuilder(boolean.class, angelicaOpts)
|
||||
.setName(I18n.format("options.angelica.aggressiveChunkLoading"))
|
||||
.setTooltip(I18n.format("options.angelica.aggressiveChunkLoading.tooltip"))
|
||||
@@ -462,9 +428,94 @@ public class SodiumGameOptionPages {
|
||||
.setBinding((opts, value) -> AngelicaConfig.useVanillaChunkTracking = value, opts -> AngelicaConfig.useVanillaChunkTracking)
|
||||
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
|
||||
.build())
|
||||
.add(OptionImpl.createBuilder(int.class, sodiumOpts)
|
||||
.setName(I18n.format("sodium.options.cpu_render_ahead_limit.name"))
|
||||
.setTooltip(I18n.format("sodium.options.cpu_render_ahead_limit.tooltip"))
|
||||
.setControl(o -> new SliderControl(o, 0, 9, 1, ControlValueFormatter.quantity("sodium.options.cpu_render_ahead_limit.value")))
|
||||
.setImpact(OptionImpact.MEDIUM)
|
||||
.setBinding((opts, value) -> opts.performance.cpuRenderAheadLimit = value, opts -> opts.performance.cpuRenderAheadLimit)
|
||||
.setEnabled(GLStateManager.capabilities != null && GLStateManager.capabilities.OpenGL32)
|
||||
.build())
|
||||
|
||||
.build());
|
||||
|
||||
groups.add(OptionGroup.createBuilder()
|
||||
.add(OptionImpl.createBuilder(int.class, angelicaOpts)
|
||||
.setName(I18n.format("options.angelica.droppedItemLimit"))
|
||||
.setTooltip(I18n.format("options.angelica.droppedItemLimit.tooltip"))
|
||||
.setControl(option -> new SliderControl(option, 32, 2048, 32, ControlValueFormatter.droppedItemLimitLimit()))
|
||||
.setBinding((options, value) -> AngelicaConfig.droppedItemLimit = value, options -> AngelicaConfig.droppedItemLimit)
|
||||
.setImpact(OptionImpact.MEDIUM)
|
||||
.build())
|
||||
.add(OptionImpl.createBuilder(int.class, angelicaOpts)
|
||||
.setName(I18n.format("options.angelica.mobSpawnerRenderDistance"))
|
||||
.setTooltip(I18n.format("options.angelica.mobSpawnerRenderDistance.tooltip"))
|
||||
.setControl(option -> new SliderControl(option, 16, 64, 1, ControlValueFormatter.number()))
|
||||
.setBinding((options, value) -> AngelicaConfig.mobSpawnerRenderDistance = value, options -> (int) AngelicaConfig.mobSpawnerRenderDistance)
|
||||
.setImpact(OptionImpact.MEDIUM)
|
||||
.build())
|
||||
.add(OptionImpl.createBuilder(int.class, angelicaOpts)
|
||||
.setName(I18n.format("options.angelica.itemdisplaylistcount"))
|
||||
.setTooltip(I18n.format("options.angelica.itemdisplaylistcount.tooltip"))
|
||||
.setControl(o -> new SliderControl(o, 256, 1024, 16, ControlValueFormatter.number()))
|
||||
.setImpact(OptionImpact.MEDIUM)
|
||||
.setBinding((opts, value) -> AngelicaConfig.itemRendererCacheSize = value, options -> AngelicaConfig.itemRendererCacheSize)
|
||||
.build())
|
||||
.build());
|
||||
|
||||
return new OptionPage(I18n.format("sodium.options.pages.performance"), ImmutableList.copyOf(groups));
|
||||
}
|
||||
|
||||
public static OptionPage appearance() {
|
||||
final List<OptionGroup> groups = new ArrayList<>();
|
||||
|
||||
groups.add(OptionGroup.createBuilder()
|
||||
.add(Settings.MODE_SKY.option)
|
||||
.add(Settings.MODE_SUN_MOON.option)
|
||||
.add(Settings.RENDER_DISTANCE_CLOUDS.option)
|
||||
.add(Settings.CLOUD_HEIGHT.option)
|
||||
.add(Settings.CLOUD_SCALE.option)
|
||||
.add(Settings.MODE_CLOUD_TRANSLUCENCY.option)
|
||||
.add(Settings.MODE_STARS.option)
|
||||
.add(Settings.TOTAL_STARS.option)
|
||||
.add(Settings.HORIZON_DISABLE.option)
|
||||
.add(Settings.MODE_LIGHT_FLICKER.option)
|
||||
.build());
|
||||
|
||||
groups.add(OptionGroup.createBuilder()
|
||||
.add(Settings.FOG_DISABLE.option)
|
||||
.add(Settings.FOG_NEAR_DISTANCE.option)
|
||||
.add(Settings.VOID_FOG.option)
|
||||
.build());
|
||||
|
||||
groups.add(OptionGroup.createBuilder()
|
||||
.add(Settings.MODE_GUI_BACKGROUND.option)
|
||||
.add(Settings.GUI_BACKGROUND.option)
|
||||
.add(OptionImpl.createBuilder(boolean.class, angelicaOpts)
|
||||
.setName(I18n.format("options.angelica.disablef3"))
|
||||
.setTooltip(I18n.format("options.angelica.disablef3.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setBinding((opts, value) -> AngelicaConfig.disableF3Additions = value, opts -> AngelicaConfig.disableF3Additions)
|
||||
.build())
|
||||
.build());
|
||||
|
||||
return new OptionPage(I18n.format("sodium.options.pages.appearance"), ImmutableList.copyOf(groups));
|
||||
}
|
||||
|
||||
public static OptionPage debug() {
|
||||
final List<OptionGroup> groups = new ArrayList<>();
|
||||
|
||||
groups.add(OptionGroup.createBuilder()
|
||||
.add(OptionImpl.createBuilder(boolean.class, sodiumOpts)
|
||||
.setName(I18n.format("sodium.options.use_gl_state_cache.name"))
|
||||
.setTooltip(I18n.format("sodium.options.use_gl_state_cache.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setImpact(OptionImpact.EXTREME)
|
||||
.setBinding((opts, value) -> GLStateManager.BYPASS_CACHE = !value, opts -> !GLStateManager.BYPASS_CACHE)
|
||||
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
|
||||
.build())
|
||||
.build());
|
||||
|
||||
return new OptionPage(I18n.format("sodium.options.pages.debug"), ImmutableList.copyOf(groups));
|
||||
}
|
||||
}
|
||||
@@ -4,9 +4,11 @@ import com.google.gson.FieldNamingPolicy;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import me.jellysquid.mods.sodium.client.SodiumClientMod;
|
||||
import com.gtnewhorizons.angelica.AngelicaMod;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.named.GraphicsQuality;
|
||||
import net.coderbot.iris.Iris;
|
||||
import org.embeddedt.embeddium.impl.render.chunk.occlusion.AsyncOcclusionMode;
|
||||
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
@@ -26,21 +28,26 @@ public class SodiumGameOptions {
|
||||
public boolean useVertexArrayObjects = true;
|
||||
public boolean useChunkMultidraw = true;
|
||||
|
||||
public boolean animateOnlyVisibleTextures = true;
|
||||
public boolean useEntityCulling = true;
|
||||
public boolean useParticleCulling = true;
|
||||
public boolean useFogOcclusion = true;
|
||||
public boolean useCompactVertexFormat = true;
|
||||
public boolean useBlockFaceCulling = true;
|
||||
public boolean allowDirectMemoryAccess = true;
|
||||
public boolean ignoreDriverBlacklist = false;
|
||||
public boolean translucencySorting = true;
|
||||
}
|
||||
|
||||
public static class PerformanceSettings {
|
||||
public int chunkBuilderThreads = 0;
|
||||
public boolean alwaysDeferChunkUpdates = true;
|
||||
public boolean useNoErrorGLContext = true;
|
||||
public AsyncOcclusionMode asyncOcclusionMode = AsyncOcclusionMode.EVERYTHING;
|
||||
public boolean useOcclusionCulling = true;
|
||||
|
||||
public boolean animateOnlyVisibleTextures = true;
|
||||
public boolean useEntityCulling = true;
|
||||
public boolean useFogOcclusion = true;
|
||||
public boolean useBlockFaceCulling = true;
|
||||
public boolean useCompactVertexFormat = true;
|
||||
public boolean translucencySorting = true;
|
||||
public boolean useRenderPassOptimization = true;
|
||||
public int cpuRenderAheadLimit = 3;
|
||||
}
|
||||
|
||||
public static class EntityRenderDistance {
|
||||
@@ -74,7 +81,7 @@ public class SodiumGameOptions {
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Could not parse config", e);
|
||||
} catch (JsonSyntaxException e) {
|
||||
SodiumClientMod.logger().error("Could not parse config, will fallback to default settings", e);
|
||||
AngelicaMod.LOGGER.error("Could not parse config, will fallback to default settings", e);
|
||||
config = new SodiumGameOptions();
|
||||
resaveConfig = false;
|
||||
}
|
||||
@@ -84,6 +91,11 @@ public class SodiumGameOptions {
|
||||
|
||||
config.configPath = path;
|
||||
|
||||
// Clamp render-ahead to 0 if GL 3.2 fences aren't available
|
||||
if (GLStateManager.capabilities == null || !GLStateManager.capabilities.OpenGL32) {
|
||||
config.performance.cpuRenderAheadLimit = 0;
|
||||
}
|
||||
|
||||
try {
|
||||
if(resaveConfig)
|
||||
config.writeChanges();
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.gtnewhorizons.angelica.compat.mojang.Drawable;
|
||||
import com.gtnewhorizons.angelica.compat.mojang.Element;
|
||||
import com.gtnewhorizons.angelica.dynamiclights.DynamicLights;
|
||||
import jss.notfine.gui.GuiCustomMenu;
|
||||
import net.coderbot.iris.Iris;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.Option;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.OptionFlag;
|
||||
import me.jellysquid.mods.sodium.client.gui.options.OptionGroup;
|
||||
@@ -19,6 +18,7 @@ import me.jellysquid.mods.sodium.client.gui.options.control.element.SodiumContro
|
||||
import me.jellysquid.mods.sodium.client.gui.options.storage.OptionStorage;
|
||||
import me.jellysquid.mods.sodium.client.gui.widgets.FlatButtonWidget;
|
||||
import me.jellysquid.mods.sodium.client.util.Dim2i;
|
||||
import net.coderbot.iris.Iris;
|
||||
import net.coderbot.iris.gui.screen.ShaderPackScreen;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
@@ -62,6 +62,7 @@ public class SodiumOptionsGUI extends ScrollableGuiScreen {
|
||||
this.pages.add(SodiumGameOptionPages.quality());
|
||||
this.pages.add(SodiumGameOptionPages.advanced());
|
||||
this.pages.add(SodiumGameOptionPages.performance());
|
||||
this.pages.add(SodiumGameOptionPages.appearance());
|
||||
|
||||
// Add Dynamic Lights page if enabled
|
||||
if (DynamicLights.configEnabled) {
|
||||
@@ -75,6 +76,8 @@ public class SodiumOptionsGUI extends ScrollableGuiScreen {
|
||||
shaderPacks = new OptionPage(I18n.format("options.iris.shaderPackSelection"), ImmutableList.of());
|
||||
this.pages.add(shaderPacks);
|
||||
}
|
||||
|
||||
this.pages.add(SodiumGameOptionPages.debug());
|
||||
}
|
||||
|
||||
public void setPage(OptionPage page) {
|
||||
@@ -298,7 +301,8 @@ public class SodiumOptionsGUI extends ScrollableGuiScreen {
|
||||
|
||||
if (keyCode == Keyboard.KEY_P && isShiftKeyDown()) {
|
||||
this.mc.displayGuiScreen(new GuiCustomMenu(this.prevScreen, SodiumGameOptionPages.general(),
|
||||
SodiumGameOptionPages.quality(), SodiumGameOptionPages.advanced(), SodiumGameOptionPages.performance()));
|
||||
SodiumGameOptionPages.quality(), SodiumGameOptionPages.advanced(), SodiumGameOptionPages.performance(),
|
||||
SodiumGameOptionPages.appearance(), SodiumGameOptionPages.debug()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package me.jellysquid.mods.sodium.client.gui.options.storage;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.config.ConfigurationManager;
|
||||
import com.gtnewhorizons.angelica.AngelicaMod;
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import me.jellysquid.mods.sodium.client.SodiumClientMod;
|
||||
|
||||
public class AngelicaOptionsStorage implements OptionStorage<AngelicaConfig> {
|
||||
|
||||
@@ -18,6 +18,6 @@ public class AngelicaOptionsStorage implements OptionStorage<AngelicaConfig> {
|
||||
@Override
|
||||
public void save() {
|
||||
ConfigurationManager.save(AngelicaConfig.class);
|
||||
SodiumClientMod.logger().info("Flushed changes to Angelica configuration");
|
||||
AngelicaMod.LOGGER.info("Flushed changes to Angelica configuration");
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package me.jellysquid.mods.sodium.client.gui.options.storage;
|
||||
|
||||
import me.jellysquid.mods.sodium.client.SodiumClientMod;
|
||||
import com.gtnewhorizons.angelica.AngelicaMod;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
|
||||
@@ -20,6 +20,6 @@ public class MinecraftOptionsStorage implements OptionStorage<GameSettings> {
|
||||
public void save() {
|
||||
this.getData().saveOptions();
|
||||
|
||||
SodiumClientMod.logger().info("Flushed changes to Minecraft configuration");
|
||||
AngelicaMod.LOGGER.info("Flushed changes to Minecraft configuration");
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
package me.jellysquid.mods.sodium.client.gui.options.storage;
|
||||
|
||||
import me.jellysquid.mods.sodium.client.SodiumClientMod;
|
||||
import com.gtnewhorizons.angelica.AngelicaMod;
|
||||
import me.jellysquid.mods.sodium.client.gui.SodiumGameOptions;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -9,7 +9,7 @@ public class SodiumOptionsStorage implements OptionStorage<SodiumGameOptions> {
|
||||
private final SodiumGameOptions options;
|
||||
|
||||
public SodiumOptionsStorage() {
|
||||
this.options = SodiumClientMod.options();
|
||||
this.options = AngelicaMod.options();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -25,6 +25,6 @@ public class SodiumOptionsStorage implements OptionStorage<SodiumGameOptions> {
|
||||
throw new RuntimeException("Couldn't save configuration changes", e);
|
||||
}
|
||||
|
||||
SodiumClientMod.logger().info("Flushed changes to Angelica configuration");
|
||||
AngelicaMod.LOGGER.info("Flushed changes to Angelica configuration");
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package me.jellysquid.mods.sodium.client.gui.utils;
|
||||
|
||||
import me.jellysquid.mods.sodium.client.SodiumClientMod;
|
||||
import com.gtnewhorizons.angelica.AngelicaMod;
|
||||
import net.minecraft.util.Util;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -19,7 +19,7 @@ public class URLUtils {
|
||||
try {
|
||||
Runtime.getRuntime().exec(getURLOpenCommand(url));
|
||||
} catch (IOException exception) {
|
||||
SodiumClientMod.logger().error("Couldn't open url '{}'", url, exception);
|
||||
AngelicaMod.LOGGER.error("Couldn't open url '{}'", url, exception);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
package me.jellysquid.mods.sodium.proxy;
|
||||
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import jss.notfine.gui.GuiCustomMenu;
|
||||
import jss.notfine.gui.NotFineGameOptionPages;
|
||||
import me.flashyreese.mods.reeses_sodium_options.client.gui.ReeseSodiumVideoOptionsScreen;
|
||||
import me.jellysquid.mods.sodium.client.SodiumClientMod;
|
||||
import me.jellysquid.mods.sodium.client.gui.SodiumOptionsGUI;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiVideoSettings;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
public class ClientProxy extends CommonProxy {
|
||||
|
||||
@Override
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
// FMLCommonHandler.instance().bus().register(this);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
SodiumClientMod.options();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onGui(GuiScreenEvent.InitGuiEvent.Pre event) {
|
||||
if(event.gui instanceof GuiVideoSettings eventGui) {
|
||||
event.setCanceled(true);
|
||||
if(AngelicaConfig.enableNotFineOptions || GuiScreen.isShiftKeyDown()) {
|
||||
Minecraft.getMinecraft().displayGuiScreen(new GuiCustomMenu(eventGui.parentGuiScreen,
|
||||
NotFineGameOptionPages.general(),
|
||||
NotFineGameOptionPages.detail(), NotFineGameOptionPages.atmosphere(),
|
||||
NotFineGameOptionPages.particles(), NotFineGameOptionPages.other()
|
||||
));
|
||||
} else if(!AngelicaConfig.enableReesesSodiumOptions || GuiScreen.isCtrlKeyDown()) {
|
||||
Minecraft.getMinecraft().displayGuiScreen(new SodiumOptionsGUI(eventGui.parentGuiScreen));
|
||||
} else {
|
||||
Minecraft.getMinecraft().displayGuiScreen(new ReeseSodiumVideoOptionsScreen(eventGui.parentGuiScreen));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FMLInitializationEvent event) {
|
||||
// Nothing to do here (yet)
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
// Nothing to do here (yet)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package me.jellysquid.mods.sodium.proxy;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
|
||||
public class CommonProxy {
|
||||
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
|
||||
}
|
||||
|
||||
public void init(FMLInitializationEvent event) {}
|
||||
|
||||
public void postInit(FMLPostInitializationEvent event) {}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.coderbot.iris.gl.texture;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.RenderSystem;
|
||||
import net.coderbot.iris.gl.GlVersion;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL30;
|
||||
@@ -105,4 +106,29 @@ public enum InternalTextureFormat {
|
||||
public GlVersion getMinimumGlVersion() {
|
||||
return minimumGlVersion;
|
||||
}
|
||||
|
||||
public InternalTextureFormat getColorRenderableFallback() {
|
||||
if (!RenderSystem.supportsSnormFormats()) {
|
||||
return switch (this) {
|
||||
case R8_SNORM, RG8_SNORM, RGB8_SNORM, RGBA8_SNORM -> RGBA16F;
|
||||
case R16_SNORM, RG16_SNORM, RGB16_SNORM, RGBA16_SNORM -> RGBA16F;
|
||||
default -> this.getPackedFloatFallback();
|
||||
};
|
||||
}
|
||||
return this.getPackedFloatFallback();
|
||||
}
|
||||
|
||||
private InternalTextureFormat getPackedFloatFallback() {
|
||||
if (!RenderSystem.supportsPackedFloatRenderable()) {
|
||||
return switch (this) {
|
||||
case R11F_G11F_B10F, RGB9_E5 -> RGBA16F;
|
||||
case RGB8 -> RGBA8;
|
||||
case RGB16 -> RGBA16;
|
||||
case RGB16F -> RGBA16F;
|
||||
case RGB32F -> RGBA32F;
|
||||
default -> this;
|
||||
};
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -54,6 +54,10 @@ public class CommonTransformer {
|
||||
root.rename("texture", "gtexture");
|
||||
}
|
||||
|
||||
if (root.hasVariable("iris_renamed_texture")) {
|
||||
root.rename("iris_renamed_texture", "gtexture");
|
||||
}
|
||||
|
||||
if (root.containsCall("gcolor") && root.hasVariable("gcolor")) {
|
||||
root.rename("gcolor", "gtexture");
|
||||
}
|
||||
|
||||
@@ -26,9 +26,11 @@ import com.gtnewhorizons.angelica.glsm.RenderSystem;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.function.BooleanSupplier;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -38,33 +40,40 @@ public class ShaderTransformer {
|
||||
private static final Pattern inOutVaryingPattern = Pattern.compile("(?m)^(\\s*(?:(?:flat|smooth|noperspective)\\s+)?)(in|out)(\\s+)");
|
||||
private static final Pattern inPattern = Pattern.compile("(?m)^(\\s*(?:(?:flat|smooth|noperspective)\\s+)?)(in)(\\s+)");
|
||||
private static final Pattern outPattern = Pattern.compile("(?m)^(\\s*(?:(?:flat|smooth|noperspective)\\s+)?)(out)(\\s+)");
|
||||
private static final Pattern texturePattern = Pattern.compile("\\btexture\\s*\\(|(\\btexture\\b)");
|
||||
private static final Pattern unsignedSuffixPattern = Pattern.compile("(\\b(?:\\d+|0[xX][0-9a-fA-F]+))[uU]\\b");
|
||||
|
||||
private static final int CACHE_SIZE = 100;
|
||||
private static final Object2ObjectLinkedOpenHashMap<TransformKey<?>, Map<PatchShaderType, String>> shaderTransformationCache = new Object2ObjectLinkedOpenHashMap<>();
|
||||
private static final boolean useCache = true;
|
||||
|
||||
// Track logged negotiations to avoid spam - cleared on shader pack reload
|
||||
private static final Set<String> loggedNegotiations = new HashSet<>();
|
||||
|
||||
public static void clearCache() {
|
||||
synchronized (shaderTransformationCache) {
|
||||
shaderTransformationCache.clear();
|
||||
}
|
||||
loggedNegotiations.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* These are words which need to be renamed by iris if a shader uses them, regardless o the GLSL version.
|
||||
* The words will get caught and renamed to iris_renamed_$WORD
|
||||
*/
|
||||
private static final List<String> fullReservedWords = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* This does the same thing as fullReservedWords, but based on a maximum GLSL version. As an example
|
||||
* if something was register to 400 here, it would get applied on any version below 400.
|
||||
*/
|
||||
private static final Map<Integer, List<String>> versionedReservedWords = new HashMap<>();
|
||||
|
||||
static {
|
||||
// texture seems to be reserved by some drivers but not others, however this is not actually reserved by the GLSL spec
|
||||
fullReservedWords.add("texture");
|
||||
private static String replaceTexture(String input) {
|
||||
final var matcher = texturePattern.matcher(input);
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
while (matcher.find()) {
|
||||
if (matcher.group(1) != null) {
|
||||
matcher.appendReplacement(builder, "iris_renamed_texture");
|
||||
} else {
|
||||
matcher.appendReplacement(builder, Matcher.quoteReplacement(matcher.group(0)));
|
||||
}
|
||||
}
|
||||
matcher.appendTail(builder);
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
static {
|
||||
// sample was added as a keyword in GLSL 400, many shaders use it
|
||||
versionedReservedWords.put(400, List.of("sample"));
|
||||
}
|
||||
@@ -72,14 +81,160 @@ public class ShaderTransformer {
|
||||
private record VersionRequirement(String keyword, int minVersion, BooleanSupplier supported) {}
|
||||
|
||||
// Sorted descending by minVersion for early exit in getRequiredVersion
|
||||
|
||||
private static final VersionRequirement[] VERSION_REQUIREMENTS = {
|
||||
new VersionRequirement("std430", 430, RenderSystem::supportsSSBO),
|
||||
new VersionRequirement("iimage", 420, RenderSystem::supportsImageLoadStore),
|
||||
new VersionRequirement("uimage", 420, RenderSystem::supportsImageLoadStore),
|
||||
new VersionRequirement("imageLoad", 420, RenderSystem::supportsImageLoadStore),
|
||||
new VersionRequirement("imageStore", 420, RenderSystem::supportsImageLoadStore)
|
||||
new VersionRequirement("imageStore", 420, RenderSystem::supportsImageLoadStore),
|
||||
|
||||
new VersionRequirement("uint", 130, () -> RenderSystem.getMaxGlslVersion() >= 130),
|
||||
new VersionRequirement("uvec2", 130, () -> RenderSystem.getMaxGlslVersion() >= 130),
|
||||
new VersionRequirement("uvec3", 130, () -> RenderSystem.getMaxGlslVersion() >= 130),
|
||||
new VersionRequirement("uvec4", 130, () -> RenderSystem.getMaxGlslVersion() >= 130),
|
||||
new VersionRequirement("flat", 130, () -> RenderSystem.getMaxGlslVersion() >= 130),
|
||||
};
|
||||
|
||||
|
||||
private record DowngradeRule(
|
||||
int fromVersion,
|
||||
int toVersion,
|
||||
BooleanSupplier supported,
|
||||
List<String> extensions,
|
||||
Map<String, String> defines,
|
||||
List<String> preprocessorDefines,
|
||||
boolean convertStorageQualifiers
|
||||
) {}
|
||||
|
||||
private static final DowngradeRule[] DOWNGRADE_RULES = {
|
||||
new DowngradeRule(130, 120,
|
||||
RenderSystem::supportsGpuShader4,
|
||||
List.of("GL_EXT_gpu_shader4"),
|
||||
Map.of("texture", "texture2D"),
|
||||
List.of(
|
||||
// Preprocessor defines
|
||||
"#define uint int",
|
||||
"#define uvec2 ivec2",
|
||||
"#define uvec3 ivec3",
|
||||
"#define uvec4 ivec4",
|
||||
"#define isnan(x) ((x) != (x))",
|
||||
"#define isinf(x) ((x) == (1.0/0.0) || (x) == (-1.0/0.0))",
|
||||
"#define trunc(x) (sign(x) * floor(abs(x)))",
|
||||
"#define round(x) (floor((x) + 0.5))",
|
||||
"#define texelFetch texelFetch2D",
|
||||
"#define textureSize textureSize2D",
|
||||
"#define modf iris_modf",
|
||||
// Function definitions
|
||||
"GLSL_FUNC:float iris_modf(float x, out float i) { i = sign(x) * floor(abs(x)); return x - i; }",
|
||||
"GLSL_FUNC:vec2 iris_modf(vec2 x, out vec2 i) { i = sign(x) * floor(abs(x)); return x - i; }",
|
||||
"GLSL_FUNC:vec3 iris_modf(vec3 x, out vec3 i) { i = sign(x) * floor(abs(x)); return x - i; }",
|
||||
"GLSL_FUNC:vec4 iris_modf(vec4 x, out vec4 i) { i = sign(x) * floor(abs(x)); return x - i; }",
|
||||
"GLSL_FUNC:vec2 mix(vec2 a, vec2 b, bvec2 sel) { return vec2(sel.x ? b.x : a.x, sel.y ? b.y : a.y); }",
|
||||
"GLSL_FUNC:vec3 mix(vec3 a, vec3 b, bvec3 sel) { return vec3(sel.x ? b.x : a.x, sel.y ? b.y : a.y, sel.z ? b.z : a.z); }",
|
||||
"GLSL_FUNC:vec4 mix(vec4 a, vec4 b, bvec4 sel) { return vec4(sel.x ? b.x : a.x, sel.y ? b.y : a.y, sel.z ? b.z : a.z, sel.w ? b.w : a.w); }",
|
||||
"GLSL_FUNC:bool any(bool b) { return b; }",
|
||||
"GLSL_FUNC:bool all(bool b) { return b; }"
|
||||
),
|
||||
true
|
||||
)
|
||||
};
|
||||
|
||||
record NegotiationResult(
|
||||
int targetVersion,
|
||||
String profile,
|
||||
List<String> extensions,
|
||||
Map<String, String> defines,
|
||||
List<String> preprocessorDefines,
|
||||
boolean convertStorageQualifiers,
|
||||
String error
|
||||
) {
|
||||
static NegotiationResult success(int targetVersion, String profile, List<String> extensions, Map<String, String> defines, List<String> preprocessorDefines, boolean convertStorageQualifiers) {
|
||||
return new NegotiationResult(targetVersion, profile, extensions, defines, preprocessorDefines, convertStorageQualifiers, null);
|
||||
}
|
||||
|
||||
static NegotiationResult error(String message) {
|
||||
return new NegotiationResult(-1, "", List.of(), Map.of(), List.of(), false, message);
|
||||
}
|
||||
|
||||
static NegotiationResult noop(int version, String profile) {
|
||||
return new NegotiationResult(version, profile, List.of(), Map.of(), List.of(), false, null);
|
||||
}
|
||||
|
||||
boolean isError() { return error != null; }
|
||||
}
|
||||
|
||||
private static int getStageMinimumVersion(PatchShaderType stage) {
|
||||
return switch (stage) {
|
||||
case COMPUTE -> 330;
|
||||
case TESS_CONTROL, TESS_EVAL -> 400;
|
||||
case GEOMETRY -> 150;
|
||||
default -> 110;
|
||||
};
|
||||
}
|
||||
|
||||
static NegotiationResult negotiateVersion(int effectiveVersion, PatchShaderType stage) {
|
||||
final int maxGlsl = RenderSystem.getMaxGlslVersion();
|
||||
|
||||
if (effectiveVersion <= maxGlsl) {
|
||||
if (effectiveVersion <= 120 && RenderSystem.supportsGpuShader4()) {
|
||||
final String profile = "";
|
||||
for (DowngradeRule rule : DOWNGRADE_RULES) {
|
||||
if (rule.fromVersion == 130 && rule.toVersion == 120) {
|
||||
final List<String> definesOnly = rule.preprocessorDefines.stream().filter(d -> !d.startsWith("GLSL_FUNC:")).toList();
|
||||
return NegotiationResult.success(effectiveVersion, profile, rule.extensions, rule.defines, definesOnly, true);
|
||||
}
|
||||
}
|
||||
return NegotiationResult.success(effectiveVersion, profile, List.of("GL_EXT_gpu_shader4"), Map.of(), List.of(), true);
|
||||
}
|
||||
return NegotiationResult.noop(effectiveVersion, effectiveVersion >= 150 ? "compatibility" : "");
|
||||
}
|
||||
|
||||
final int stageMin = getStageMinimumVersion(stage);
|
||||
if (maxGlsl < stageMin) {
|
||||
return NegotiationResult.error("Hardware GLSL " + maxGlsl + " below stage minimum " + stageMin + " for " + stage.name());
|
||||
}
|
||||
|
||||
// Walk downgrade rules from effectiveVersion toward maxGlsl
|
||||
final List<String> accExtensions = new ArrayList<>();
|
||||
final Map<String, String> accDefines = new HashMap<>();
|
||||
final List<String> accPreprocessorDefines = new ArrayList<>();
|
||||
boolean accConvertQualifiers = false;
|
||||
int currentVersion = effectiveVersion;
|
||||
|
||||
while (currentVersion > maxGlsl) {
|
||||
DowngradeRule matched = null;
|
||||
for (DowngradeRule rule : DOWNGRADE_RULES) {
|
||||
if (rule.fromVersion == currentVersion) {
|
||||
matched = rule;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (matched == null) {
|
||||
return NegotiationResult.error("No downgrade rule from GLSL " + currentVersion + " (hardware max: " + maxGlsl + ", shader requires: " + effectiveVersion + ")");
|
||||
}
|
||||
|
||||
// Verify rule's required extensions are supported
|
||||
if (!matched.supported.getAsBoolean()) {
|
||||
return NegotiationResult.error("Downgrade from " + matched.fromVersion + " to " + matched.toVersion + " requires extensions " + matched.extensions + " which are not supported");
|
||||
}
|
||||
|
||||
accExtensions.addAll(matched.extensions);
|
||||
accDefines.putAll(matched.defines);
|
||||
accPreprocessorDefines.addAll(matched.preprocessorDefines);
|
||||
accConvertQualifiers |= matched.convertStorageQualifiers;
|
||||
currentVersion = matched.toVersion;
|
||||
}
|
||||
|
||||
if (currentVersion < stageMin) {
|
||||
return NegotiationResult.error("Downgrade reached GLSL " + currentVersion + " which is below stage minimum " + stageMin + " for " + stage.name());
|
||||
}
|
||||
|
||||
final String profile = currentVersion >= 150 ? "compatibility" : "";
|
||||
return NegotiationResult.success(currentVersion, profile, accExtensions, accDefines, accPreprocessorDefines, accConvertQualifiers);
|
||||
}
|
||||
|
||||
private static Pattern hoistPattern;
|
||||
private static Object2IntMap<String> keywordToVersion;
|
||||
private static int maxSupportedHoistVersion;
|
||||
@@ -93,7 +248,7 @@ public class ShaderTransformer {
|
||||
if (req.supported.getAsBoolean()) {
|
||||
if (!patternBuilder.isEmpty()) patternBuilder.append('|');
|
||||
|
||||
patternBuilder.append(Pattern.quote(req.keyword));
|
||||
patternBuilder.append("\\b").append(Pattern.quote(req.keyword)).append("\\b");
|
||||
versionMap.put(req.keyword, req.minVersion);
|
||||
maxVersion = Math.max(maxVersion, req.minVersion);
|
||||
}
|
||||
@@ -207,12 +362,12 @@ public class ShaderTransformer {
|
||||
} else {
|
||||
Map<PatchShaderType, String> result;
|
||||
|
||||
var patchType = parameters.patch;
|
||||
final var patchType = parameters.patch;
|
||||
|
||||
EnumMap<PatchShaderType, String> inputs = new EnumMap<>(PatchShaderType.class);
|
||||
inputs.put(PatchShaderType.COMPUTE, compute);
|
||||
|
||||
var key = new TransformKey<>(patchType, inputs, parameters);
|
||||
final var key = new TransformKey<>(patchType, inputs, parameters);
|
||||
|
||||
synchronized (shaderTransformationCache) {
|
||||
result = shaderTransformationCache.getAndMoveToLast(key);
|
||||
@@ -223,7 +378,7 @@ public class ShaderTransformer {
|
||||
parameters.type = null;
|
||||
synchronized (shaderTransformationCache) {
|
||||
// Double-check in case another thread added it while we were transforming
|
||||
Map<PatchShaderType, String> existing = shaderTransformationCache.getAndMoveToLast(key);
|
||||
final Map<PatchShaderType, String> existing = shaderTransformationCache.getAndMoveToLast(key);
|
||||
if (existing != null) {
|
||||
return existing;
|
||||
}
|
||||
@@ -239,13 +394,13 @@ public class ShaderTransformer {
|
||||
}
|
||||
|
||||
private static <P extends Parameters> Map<PatchShaderType, String> transformComputeInternal(String compute, Patch patchType, P parameters) {
|
||||
EnumMap<PatchShaderType, String> result = new EnumMap<>(PatchShaderType.class);
|
||||
final EnumMap<PatchShaderType, String> result = new EnumMap<>(PatchShaderType.class);
|
||||
|
||||
Stopwatch watch = Stopwatch.createStarted();
|
||||
final Stopwatch watch = Stopwatch.createStarted();
|
||||
|
||||
parameters.type = ShaderType.COMPUTE;
|
||||
|
||||
Matcher matcher = versionPattern.matcher(compute);
|
||||
final Matcher matcher = versionPattern.matcher(compute);
|
||||
if (!matcher.find()) {
|
||||
throw new IllegalArgumentException("No #version directive found in compute shader source code!");
|
||||
}
|
||||
@@ -254,7 +409,7 @@ public class ShaderTransformer {
|
||||
int versionInt = Integer.parseInt(versionString);
|
||||
|
||||
// Check if shader uses features requiring a higher GLSL version
|
||||
int requiredVersion = getRequiredVersion(compute, versionInt);
|
||||
final int requiredVersion = getRequiredVersion(compute, versionInt);
|
||||
if (requiredVersion > versionInt) {
|
||||
Iris.logger.debug("Compute shader requires GLSL {} for detected features, hoisting from {}", requiredVersion, versionInt);
|
||||
versionInt = requiredVersion;
|
||||
@@ -266,33 +421,40 @@ public class ShaderTransformer {
|
||||
versionString = "330";
|
||||
versionInt = 330;
|
||||
}
|
||||
|
||||
// Negotiate version downgrade if needed
|
||||
final NegotiationResult negotiation = negotiateVersion(versionInt, PatchShaderType.COMPUTE);
|
||||
if (negotiation.isError()) {
|
||||
throw new RuntimeException("Compute shader version negotiation failed: " + negotiation.error());
|
||||
}
|
||||
if (negotiation.targetVersion() != versionInt) {
|
||||
Iris.logger.debug("Negotiated compute shader from GLSL {} to {}", versionInt, negotiation.targetVersion());
|
||||
versionInt = negotiation.targetVersion();
|
||||
versionString = String.valueOf(versionInt);
|
||||
}
|
||||
|
||||
String profileString = "#version " + versionString + " core\n";
|
||||
|
||||
// Rename reserved words
|
||||
String input = compute;
|
||||
for (String reservedWord : fullReservedWords) {
|
||||
String newName = "iris_renamed_" + reservedWord;
|
||||
input = input.replaceAll("\\b" + reservedWord + "\\b", newName);
|
||||
}
|
||||
String input = replaceTexture(compute);
|
||||
for (int version : versionedReservedWords.keySet()) {
|
||||
if (versionInt < version) {
|
||||
for (String reservedWord : versionedReservedWords.get(version)) {
|
||||
String newName = "iris_renamed_" + reservedWord;
|
||||
final String newName = "iris_renamed_" + reservedWord;
|
||||
input = input.replaceAll("\\b" + reservedWord + "\\b", newName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var parsedShader = ShaderParser.parseShader(input);
|
||||
var transformer = new Transformer(parsedShader.full());
|
||||
final var parsedShader = ShaderParser.parseShader(input);
|
||||
final var transformer = new Transformer(parsedShader.full());
|
||||
|
||||
doTransform(transformer, patchType, parameters, "core", versionInt);
|
||||
|
||||
// Extract extensions
|
||||
var extensions = versionPattern.matcher(getFormattedShader(parsedShader.pre(), "")).replaceFirst("").trim();
|
||||
String header = profileString + (extensions.isEmpty() ? "" : "\n" + extensions);
|
||||
final var extensions = versionPattern.matcher(getFormattedShader(parsedShader.pre(), "")).replaceFirst("").trim();
|
||||
|
||||
final String finalHeader = header;
|
||||
final String finalHeader = profileString + (extensions.isEmpty() ? "" : "\n" + extensions);
|
||||
final StringBuilder formattedShaderBuilder = new StringBuilder();
|
||||
|
||||
transformer.mutateTree(tree -> {
|
||||
@@ -313,13 +475,13 @@ public class ShaderTransformer {
|
||||
}
|
||||
|
||||
private static <P extends Parameters> Map<PatchShaderType, String> transformInternal(EnumMap<PatchShaderType, String> inputs, Patch patchType, P parameters) {
|
||||
EnumMap<PatchShaderType, String> result = new EnumMap<>(PatchShaderType.class);
|
||||
EnumMap<PatchShaderType, Transformer> types = new EnumMap<>(PatchShaderType.class);
|
||||
EnumMap<PatchShaderType, String> prepatched = new EnumMap<>(PatchShaderType.class);
|
||||
List<Transformer> textureLodExtensionPatches = new ArrayList<>();
|
||||
List<Transformer> hacky120Patches = new ArrayList<>();
|
||||
final EnumMap<PatchShaderType, String> result = new EnumMap<>(PatchShaderType.class);
|
||||
final EnumMap<PatchShaderType, Transformer> types = new EnumMap<>(PatchShaderType.class);
|
||||
final EnumMap<PatchShaderType, String> prepatched = new EnumMap<>(PatchShaderType.class);
|
||||
final EnumMap<PatchShaderType, NegotiationResult> negotiations = new EnumMap<>(PatchShaderType.class);
|
||||
final EnumMap<PatchShaderType, Boolean> needsTextureLodExtension = new EnumMap<>(PatchShaderType.class);
|
||||
|
||||
Stopwatch watch = Stopwatch.createStarted();
|
||||
final Stopwatch watch = Stopwatch.createStarted();
|
||||
|
||||
for (PatchShaderType type : PatchShaderType.VALUES) {
|
||||
parameters.type = type.glShaderType;
|
||||
@@ -329,7 +491,7 @@ public class ShaderTransformer {
|
||||
|
||||
String input = inputs.get(type);
|
||||
|
||||
Matcher matcher = versionPattern.matcher(input);
|
||||
final Matcher matcher = versionPattern.matcher(input);
|
||||
if (!matcher.find()) {
|
||||
throw new IllegalArgumentException("No #version directive found in source code!");
|
||||
}
|
||||
@@ -342,41 +504,56 @@ public class ShaderTransformer {
|
||||
String profile = "";
|
||||
int versionInt = Integer.parseInt(versionString);
|
||||
|
||||
// Check if shader uses features requiring a higher GLSL version
|
||||
int requiredVersion = getRequiredVersion(input, versionInt);
|
||||
// Include celeritas header in scan — it's injected post-negotiation but contains uint/uvec3
|
||||
final String scanSource = (patchType == Patch.CELERITAS_TERRAIN && type == PatchShaderType.VERTEX) ? input + computeCeleritasHeader() : input;
|
||||
final int requiredVersion = getRequiredVersion(scanSource, versionInt);
|
||||
if (requiredVersion > versionInt) {
|
||||
Iris.logger.debug("Shader requires GLSL {} for detected features, hoisting from {}", requiredVersion, versionInt);
|
||||
versionInt = requiredVersion;
|
||||
versionString = String.valueOf(versionInt);
|
||||
}
|
||||
|
||||
if (versionInt >= 150) {
|
||||
profile = matcher.group(2);
|
||||
if (profile == null) {
|
||||
profile = "compatibility";
|
||||
}
|
||||
// Negotiate version downgrade if needed
|
||||
final NegotiationResult negotiation = negotiateVersion(versionInt, type);
|
||||
if (negotiation.isError()) {
|
||||
throw new RuntimeException("Shader version negotiation failed for " + type.name() + ": " + negotiation.error());
|
||||
}
|
||||
|
||||
String profileString = "#version " + versionString + " " + profile + "\n";
|
||||
if (negotiation.targetVersion() != versionInt) {
|
||||
String negotiationKey = type.name() + "_" + versionInt + "_" + negotiation.targetVersion();
|
||||
if (loggedNegotiations.add(negotiationKey)) {
|
||||
Iris.logger.info("Negotiated {} shader from GLSL {} to {} (extensions: {}, polyfills: {})", type.name(), versionInt, negotiation.targetVersion(), negotiation.extensions(), negotiation.preprocessorDefines().size());
|
||||
}
|
||||
versionInt = negotiation.targetVersion();
|
||||
versionString = String.valueOf(versionInt);
|
||||
profile = negotiation.profile();
|
||||
} else {
|
||||
if (versionInt >= 150) {
|
||||
profile = matcher.group(2);
|
||||
if (profile == null) {
|
||||
profile = "compatibility";
|
||||
}
|
||||
}
|
||||
}
|
||||
negotiations.put(type, negotiation);
|
||||
|
||||
final String profileString = "#version " + versionString + (profile.isEmpty() ? "" : " " + profile) + "\n";
|
||||
|
||||
input = replaceTexture(input);
|
||||
// The primary reason we rename words here using regex, is because if the words cause invalid
|
||||
// GLSL, regardless of the version being used, it will cause glsl-transformation-lib to fail
|
||||
// so we need to rename them prior to passing the shader input to glsl-transformation-lib.
|
||||
for (String reservedWord : fullReservedWords) {
|
||||
String newName = "iris_renamed_" + reservedWord;
|
||||
input = input.replaceAll("\\b" + reservedWord + "\\b", newName);
|
||||
}
|
||||
for (int version : versionedReservedWords.keySet()) {
|
||||
if (versionInt < version) {
|
||||
for (String reservedWord : versionedReservedWords.get(version)) {
|
||||
String newName = "iris_renamed_" + reservedWord;
|
||||
final String newName = "iris_renamed_" + reservedWord;
|
||||
input = input.replaceAll("\\b" + reservedWord + "\\b", newName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var parsedShader = ShaderParser.parseShader(input);
|
||||
var transformer = new Transformer(parsedShader.full());
|
||||
final var parsedShader = ShaderParser.parseShader(input);
|
||||
final var transformer = new Transformer(parsedShader.full());
|
||||
|
||||
if (parameters.type == ShaderType.VERTEX || parameters.type == ShaderType.FRAGMENT) {
|
||||
upgradeStorageQualifiers(transformer, parameters);
|
||||
@@ -386,28 +563,25 @@ public class ShaderTransformer {
|
||||
|
||||
// Check if we need to patch in texture LOD extension enabling
|
||||
if (versionInt <= 120 && (transformer.containsCall("texture2DLod") || transformer.containsCall("texture3DLod") || transformer.containsCall("texture2DGradARB"))) {
|
||||
textureLodExtensionPatches.add(transformer);
|
||||
}
|
||||
|
||||
// Check if we need to patch in some hacky GLSL 120 compat
|
||||
if (versionInt <= 120) {
|
||||
hacky120Patches.add(transformer);
|
||||
needsTextureLodExtension.put(type, true);
|
||||
}
|
||||
|
||||
// Extract extensions from the pre-parsed content (version + extensions before main code)
|
||||
// This preserves #extension directives that the shader pack declares
|
||||
var extensions = versionPattern.matcher(getFormattedShader(parsedShader.pre(), "")).replaceFirst("").trim();
|
||||
final var extensions = versionPattern.matcher(getFormattedShader(parsedShader.pre(), "")).replaceFirst("").trim();
|
||||
|
||||
types.put(type, transformer);
|
||||
prepatched.put(type, profileString + (extensions.isEmpty() ? "" : "\n" + extensions));
|
||||
}
|
||||
CompatibilityTransformer.transformGrouped(types, parameters);
|
||||
for (var entry : types.entrySet()) {
|
||||
final PatchShaderType shaderType = entry.getKey();
|
||||
final Transformer transformer = entry.getValue();
|
||||
String header = prepatched.get(entry.getKey());
|
||||
String header = prepatched.get(shaderType);
|
||||
final NegotiationResult negotiation = negotiations.get(shaderType);
|
||||
|
||||
// For Celeritas terrain vertex shaders, inject chunk_vertex.glsl header
|
||||
if (patchType == Patch.CELERITAS_TERRAIN && entry.getKey() == PatchShaderType.VERTEX) {
|
||||
if (patchType == Patch.CELERITAS_TERRAIN && shaderType == PatchShaderType.VERTEX) {
|
||||
header += computeCeleritasHeader();
|
||||
}
|
||||
|
||||
@@ -424,39 +598,38 @@ public class ShaderTransformer {
|
||||
formattedShader = formattedShader.replace("iris_renamed_texture", "texture");
|
||||
formattedShader = formattedShader.replace("iris_renamed_sample", "sample");
|
||||
|
||||
// Please don't mind the entire rest of this loop basically, we're doing awful fragile regex on the transformed
|
||||
// shader output to do things that I can't figure out with AST because I'm bad at it
|
||||
|
||||
if (textureLodExtensionPatches.contains(transformer)) {
|
||||
String[] parts = formattedShader.split("\n", 2);
|
||||
// Inject texture LOD extension if needed
|
||||
if (needsTextureLodExtension.containsKey(shaderType)) {
|
||||
final String[] parts = formattedShader.split("\n", 2);
|
||||
parts[1] = "#extension GL_ARB_shader_texture_lod : require\n" + parts[1];
|
||||
formattedShader = parts[0] + "\n" + parts[1];
|
||||
}
|
||||
|
||||
if (hacky120Patches.contains(transformer)) {
|
||||
// Forcibly enable GL_EXT_gpu_shader4, it has a lot of compatibility backports with GLSL 130+
|
||||
// and seems more or less universally supported by hardware/drivers
|
||||
String[] parts = formattedShader.split("\n", 2);
|
||||
parts[1] = "#extension GL_EXT_gpu_shader4 : require\n" + parts[1];
|
||||
formattedShader = parts[0] + "\n" + parts[1];
|
||||
if (negotiation != null && (!negotiation.extensions().isEmpty() || !negotiation.preprocessorDefines().isEmpty())) {
|
||||
formattedShader = injectGlslPreamble(formattedShader, negotiation.extensions(), negotiation.preprocessorDefines());
|
||||
}
|
||||
|
||||
// GLSL 120 compatibility for in/out specifiers:
|
||||
// - Vertex shaders: "in" = vertex attribute input -> "attribute", "out" = to fragment -> "varying"
|
||||
// - Fragment shaders: "in" = from vertex -> "varying", "out" = color output -> handled elsewhere
|
||||
if (entry.getKey() == PatchShaderType.VERTEX) {
|
||||
// In vertex shaders, "in" declarations are vertex attributes, not varyings
|
||||
Matcher inMatcher = inPattern.matcher(formattedShader);
|
||||
formattedShader = inMatcher.replaceAll("$1attribute$3");
|
||||
Matcher outMatcher = outPattern.matcher(formattedShader);
|
||||
formattedShader = outMatcher.replaceAll("$1varying$3");
|
||||
} else {
|
||||
// In fragment (and geometry) shaders, both in/out become varying
|
||||
Matcher inOutVaryingMatcher = inOutVaryingPattern.matcher(formattedShader);
|
||||
formattedShader = inOutVaryingMatcher.replaceAll("$1varying$3");
|
||||
if (negotiation != null && !negotiation.defines().isEmpty()) {
|
||||
for (var defineEntry : negotiation.defines().entrySet()) {
|
||||
formattedShader = formattedShader.replaceAll("\\b" + Pattern.quote(defineEntry.getKey()) + "\\b", Matcher.quoteReplacement(defineEntry.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
result.put(entry.getKey(), formattedShader);
|
||||
// Convert storage qualifiers for downgraded shaders or native 120 shaders
|
||||
if (negotiation != null && (negotiation.convertStorageQualifiers() || negotiation.targetVersion() <= 120)) {
|
||||
if (shaderType == PatchShaderType.VERTEX) {
|
||||
final Matcher inMatcher = inPattern.matcher(formattedShader);
|
||||
formattedShader = inMatcher.replaceAll("$1attribute$3");
|
||||
final Matcher outMatcher = outPattern.matcher(formattedShader);
|
||||
formattedShader = outMatcher.replaceAll("$1varying$3");
|
||||
} else {
|
||||
final Matcher inOutVaryingMatcher = inOutVaryingPattern.matcher(formattedShader);
|
||||
formattedShader = inOutVaryingMatcher.replaceAll("$1varying$3");
|
||||
}
|
||||
formattedShader = unsignedSuffixPattern.matcher(formattedShader).replaceAll("$1");
|
||||
}
|
||||
|
||||
result.put(shaderType, formattedShader);
|
||||
}
|
||||
watch.stop();
|
||||
Iris.logger.info("[Load #{}] Transformed shader for {} in {}", Iris.getShaderPackLoadId(), patchType.name(), watch);
|
||||
@@ -491,13 +664,6 @@ public class ShaderTransformer {
|
||||
transformer.renameFunctionCall("ftransform", "iris_ftransform");
|
||||
}
|
||||
|
||||
|
||||
public static void replaceGlMultiTexCoordBounded(Transformer transformer, int min, int max) {
|
||||
for (int i = min; i <= max; i++) {
|
||||
transformer.replaceExpression("gl_MultiTexCoord" + i, "vec4(0.0, 0.0, 0.0, 1.0)");
|
||||
}
|
||||
}
|
||||
|
||||
public static void patchMultiTexCoord3(Transformer transformer, Parameters parameters) {
|
||||
if (parameters.type == ShaderType.VERTEX && transformer.hasVariable("gl_MultiTexCoord3") && !transformer.hasVariable("mc_midTexCoord")) {
|
||||
transformer.rename("gl_MultiTexCoord3", "mc_midTexCoord");
|
||||
@@ -506,7 +672,7 @@ public class ShaderTransformer {
|
||||
}
|
||||
|
||||
public static void replaceMidTexCoord(Transformer transformer, float textureScale) {
|
||||
int type = transformer.findType("mc_midTexCoord");
|
||||
final int type = transformer.findType("mc_midTexCoord");
|
||||
if (type != 0) {
|
||||
transformer.removeVariable("mc_midTexCoord");
|
||||
}
|
||||
@@ -590,6 +756,62 @@ public class ShaderTransformer {
|
||||
}
|
||||
}
|
||||
|
||||
private static String injectGlslPreamble(String shader, List<String> extensions, List<String> preprocessorDefines) {
|
||||
final StringBuilder extensionBlock = new StringBuilder();
|
||||
final StringBuilder defineBlock = new StringBuilder();
|
||||
final StringBuilder functionBlock = new StringBuilder();
|
||||
|
||||
for (String ext : extensions) {
|
||||
extensionBlock.append("#extension ").append(ext).append(" : require\n");
|
||||
}
|
||||
for (String define : preprocessorDefines) {
|
||||
if (define.startsWith("GLSL_FUNC:")) {
|
||||
functionBlock.append(define.substring(10)).append("\n");
|
||||
} else {
|
||||
defineBlock.append(define).append("\n");
|
||||
}
|
||||
}
|
||||
|
||||
// Find where preprocessor section ends and code begins
|
||||
final String[] lines = shader.split("\n");
|
||||
final StringBuilder shaderResult = new StringBuilder();
|
||||
boolean extensionsInjected = false, definesInjected = false, functionsInjected = false;
|
||||
|
||||
for (String line : lines) {
|
||||
final String trimmed = line.trim();
|
||||
final boolean isPreprocessor = trimmed.startsWith("#");
|
||||
final boolean isExtension = trimmed.startsWith("#extension");
|
||||
final boolean isVersion = trimmed.startsWith("#version");
|
||||
|
||||
// Inject our extensions right after #version
|
||||
if (isVersion) {
|
||||
shaderResult.append(line).append("\n");
|
||||
shaderResult.append(extensionBlock);
|
||||
extensionsInjected = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Inject our defines after the last #extension line (before other preprocessor or code)
|
||||
if (!definesInjected && extensionsInjected && !isExtension && !trimmed.isEmpty()) {
|
||||
shaderResult.append(defineBlock);
|
||||
definesInjected = true;
|
||||
}
|
||||
|
||||
// Inject our functions after all preprocessor lines
|
||||
if (!functionsInjected && definesInjected && !isPreprocessor && !trimmed.isEmpty()) {
|
||||
shaderResult.append(functionBlock);
|
||||
functionsInjected = true;
|
||||
}
|
||||
|
||||
shaderResult.append(line).append("\n");
|
||||
}
|
||||
|
||||
if (!definesInjected) shaderResult.append(defineBlock);
|
||||
if (!functionsInjected) shaderResult.append(functionBlock);
|
||||
|
||||
return shaderResult.toString();
|
||||
}
|
||||
|
||||
public static String getFormattedShader(ParseTree tree, String string) {
|
||||
final StringBuilder sb = new StringBuilder(string + "\n");
|
||||
final String[] tabHolder = {""};
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableSet;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.gtnewhorizons.angelica.glsm.RenderSystem;
|
||||
import lombok.Getter;
|
||||
import net.coderbot.iris.Iris;
|
||||
import net.coderbot.iris.gl.framebuffer.GlFramebuffer;
|
||||
import net.coderbot.iris.gl.texture.DepthBufferFormat;
|
||||
import net.coderbot.iris.gl.texture.DepthCopyStrategy;
|
||||
@@ -46,9 +47,15 @@ public class RenderTargets {
|
||||
renderTargets.forEach((index, settings) -> {
|
||||
// TODO: Handle mipmapping?
|
||||
Vector2i dimensions = packDirectives.getTextureScaleOverride(index, width, height);
|
||||
// Apply format fallback for opengl versions with limited color-renderable format support (e.g., macOS GL 2.1)
|
||||
var requestedFormat = settings.getInternalFormat();
|
||||
var actualFormat = requestedFormat.getColorRenderableFallback();
|
||||
if (actualFormat != requestedFormat) {
|
||||
Iris.logger.info("Render target {} using fallback format {} (requested {})", index, actualFormat, requestedFormat);
|
||||
}
|
||||
targets[index] = RenderTarget.builder().setDimensions(dimensions.x, dimensions.y)
|
||||
.setInternalFormat(settings.getInternalFormat())
|
||||
.setPixelFormat(settings.getInternalFormat().getPixelFormat()).build();
|
||||
.setInternalFormat(actualFormat)
|
||||
.setPixelFormat(actualFormat.getPixelFormat()).build();
|
||||
});
|
||||
this.currentDepthTexture = depthTexture;
|
||||
this.currentDepthFormat = depthFormat;
|
||||
|
||||
@@ -315,6 +315,10 @@ public class ShaderPack {
|
||||
// directly. This removes one obstacle to accurate reporting of line numbers for errors,
|
||||
// though there exist many more (such as relocating all #extension directives and similar things)
|
||||
String source = builder.toString();
|
||||
|
||||
// Apply shader pack workarounds for version compatibility (before preprocessing)
|
||||
source = ShaderPackWorkarounds.apply(source);
|
||||
|
||||
source = JcppProcessor.glslPreprocessSource(source, finalEnvironmentDefines1);
|
||||
|
||||
return source;
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package net.coderbot.iris.shaderpack;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.RenderSystem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Shader pack workarounds for specific GLSL versions. These are applied before preprocessing.
|
||||
*/
|
||||
public class ShaderPackWorkarounds {
|
||||
|
||||
private record Workaround(int maxVersion, String find, String replace) {
|
||||
boolean appliesTo(int glslVersion) {
|
||||
return glslVersion <= maxVersion;
|
||||
}
|
||||
}
|
||||
|
||||
private static final List<Workaround> WORKAROUNDS = List.of(
|
||||
// Complementary: Catmull-Rom TAA filter causes "creeping black fog" on OGL 2.1
|
||||
new Workaround(120,
|
||||
"#define TAA_MOVEMENT_IMPROVEMENT_FILTER",
|
||||
"// #define TAA_MOVEMENT_IMPROVEMENT_FILTER // disabled: OGL 2.1 workaround"
|
||||
)
|
||||
);
|
||||
|
||||
public static String apply(String source) {
|
||||
int glslVersion = RenderSystem.getMaxGlslVersion();
|
||||
|
||||
for (Workaround w : WORKAROUNDS) {
|
||||
if (w.appliesTo(glslVersion)) {
|
||||
source = source.replace(w.find, w.replace);
|
||||
}
|
||||
}
|
||||
|
||||
return source;
|
||||
}
|
||||
}
|
||||
@@ -321,7 +321,8 @@ public class ShaderProperties {
|
||||
if (pass.contains(".")) {
|
||||
|
||||
if (!RenderSystem.supportsBufferBlending()) {
|
||||
throw new RuntimeException("Buffer blending is not supported on this platform, however it was attempted to be used!");
|
||||
Iris.logger.warn("Per-buffer blending directive '{}' ignored - buffer blending requires OpenGL 4.0 or GL_ARB_draw_buffers_blend", key);
|
||||
return;
|
||||
}
|
||||
|
||||
final String[] parts = pass.split("\\.");
|
||||
|
||||
@@ -13,6 +13,8 @@ sodium.option_impact.varies=Varies
|
||||
sodium.options.pages.quality=Quality
|
||||
sodium.options.pages.performance=Performance
|
||||
sodium.options.pages.advanced=Advanced
|
||||
sodium.options.pages.appearance=Appearance
|
||||
sodium.options.pages.debug=Debug
|
||||
sodium.options.view_distance.tooltip=The render distance controls how far away terrain will be rendered. Shorter distances mean that less terrain will be rendered, improving frame rates.
|
||||
sodium.options.simulation_distance.tooltip=The simulation distance controls how far away terrain and entities will be loaded and ticked. Shorter distances can reduce the internal server's load and may improve frame rates.
|
||||
sodium.options.brightness.tooltip=Controls the brightness (gamma) of the game.
|
||||
@@ -86,6 +88,10 @@ sodium.options.use_no_error_context.name=No Error Context
|
||||
sodium.options.use_no_error_context.tooltip=If enabled, the OpenGL context will be created with error checking disabled. This may slightly improve performance, but it also increases the risk that the game will crash instead of gracefully handling OpenGL errors. You should disable this option if you are experiencing sudden unexplained crashes.
|
||||
sodium.options.use_gl_state_cache.name=GL State Cache
|
||||
sodium.options.use_gl_state_cache.tooltip=If enabled, the OpenGL state cache will be used to reduce the number of redundant state changes. This can improve performance, but it may also cause issues with some mods. Does not persist across game restarts.
|
||||
sodium.options.async_occlusion_mode.name=Async Occlusion
|
||||
sodium.options.async_occlusion_mode.tooltip=Controls which render passes use asynchronous occlusion culling. ONLY_SHADOW (default) runs async occlusion only for the shadow pass, keeping the main render list synchronous. EVERYTHING runs all passes async, which may cause 1-frame visibility lag during fast camera movement. NONE disables async occlusion entirely.
|
||||
sodium.options.use_occlusion_culling.name=Occlusion Culling
|
||||
sodium.options.use_occlusion_culling.tooltip=If enabled, chunks that are hidden behind other chunks will not be rendered. Disabling this will significantly reduce performance but can be useful for debugging.
|
||||
sodium.options.threads.value=%s thread(s)
|
||||
sodium.options.default=Default
|
||||
sodium.options.buttons.undo=Undo
|
||||
@@ -211,6 +217,9 @@ pack.iris.configure.title=Configure
|
||||
label.iris.true=On
|
||||
label.iris.false=Off
|
||||
|
||||
sodium.options.use_render_pass_optimization.name=Render Pass Optimization
|
||||
sodium.options.use_render_pass_optimization.tooltip=Analyzes sprite transparency to automatically downgrade render passes (e.g. translucent to cutout, cutout to solid) when the sprite doesn't need the more expensive pass. Reduces draw calls and overdraw.
|
||||
|
||||
options.angelica.aggressiveChunkLoading=Aggressive Chunk Loading
|
||||
options.angelica.aggressiveChunkLoading.tooltip=Renders chunks immediately when loaded, even if neighbors aren't ready yet. Improves perceived loading speed at render distance edges. Chunks rebuild automatically when neighbors load. Useful for low render distance servers.
|
||||
options.angelica.disablef3=Disable F3 Additions
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import org.embeddedt.embeddium.impl.render.frame.RenderAheadManager;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -34,6 +35,9 @@ public abstract class MixinMinecraft {
|
||||
@Unique
|
||||
private long angelica$lastFrameTime = 0;
|
||||
|
||||
@Unique
|
||||
private final RenderAheadManager celeritas$renderAheadManager = new RenderAheadManager();
|
||||
|
||||
/**
|
||||
* @author mitchej123
|
||||
* @reason Avoid GL_PROXY_TEXTURE_2D which doesn't work with GLSM's texture binding.
|
||||
@@ -91,4 +95,19 @@ public abstract class MixinMinecraft {
|
||||
private void angelica$setShowFpsGraph(CallbackInfo ci) {
|
||||
((IGameSettingsExt) gameSettings).angelica$setShowFpsGraph(Keyboard.isKeyDown(Keyboard.KEY_LMENU) || Keyboard.isKeyDown(Keyboard.KEY_RMENU));
|
||||
}
|
||||
|
||||
@Inject(method = "runTick", at = @At("HEAD"))
|
||||
private void celeritas$renderAheadStartFrame(CallbackInfo ci) {
|
||||
final int limit = AngelicaMod.options().performance.cpuRenderAheadLimit;
|
||||
if (limit > 0) {
|
||||
celeritas$renderAheadManager.startFrame(limit);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "runTick", at = @At("RETURN"))
|
||||
private void celeritas$renderAheadEndFrame(CallbackInfo ci) {
|
||||
if (AngelicaMod.options().performance.cpuRenderAheadLimit > 0) {
|
||||
celeritas$renderAheadManager.endFrame();
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
package com.gtnewhorizons.angelica.mixins.early.celeritas.features.culling;
|
||||
|
||||
import com.gtnewhorizons.angelica.AngelicaMod;
|
||||
import com.gtnewhorizons.angelica.rendering.celeritas.CeleritasWorldRenderer;
|
||||
import net.minecraft.client.particle.EffectRenderer;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
@@ -26,7 +27,7 @@ public class MixinEffectRenderer {
|
||||
|
||||
@Unique
|
||||
private void setupCullingViewport() {
|
||||
final boolean useCulling = true;// TODO: boolean useCulling = SodiumClientMod.options().advanced.useParticleCulling;
|
||||
final boolean useCulling = AngelicaMod.options().advanced.useParticleCulling;
|
||||
if(useCulling) {
|
||||
this.cullingViewport = CeleritasWorldRenderer.getInstance().getLastViewport();
|
||||
} else {
|
||||
|
||||
+10
-3
@@ -58,6 +58,7 @@ public class MixinRenderGlobal implements IRenderGlobalExt {
|
||||
@Unique private CeleritasWorldRenderer celeritas$renderer;
|
||||
@Unique private int celeritas$frame;
|
||||
@Unique private float celeritas$lastFov;
|
||||
@Unique private int celeritas$lastThirdPersonView = -1;
|
||||
|
||||
@Unique
|
||||
private boolean angelica$isSpectatorMode() {
|
||||
@@ -190,9 +191,9 @@ public class MixinRenderGlobal implements IRenderGlobalExt {
|
||||
final Entity viewEntity = this.mc.renderViewEntity;
|
||||
final float fogDistance = ChunkShaderFogComponent.FOG_SERVICE.getFogCutoff();
|
||||
|
||||
final double camX = viewEntity.posX;
|
||||
final double camY = viewEntity.posY + viewEntity.getEyeHeight();
|
||||
final double camZ = viewEntity.posZ;
|
||||
final double camX = lerp(viewEntity.lastTickPosX, viewEntity.posX, partialTicks);
|
||||
final double camY = lerp(viewEntity.lastTickPosY, viewEntity.posY, partialTicks) + viewEntity.getEyeHeight();
|
||||
final double camZ = lerp(viewEntity.lastTickPosZ, viewEntity.posZ, partialTicks);
|
||||
|
||||
final float currentFov = RenderingState.INSTANCE.getFov();
|
||||
if (currentFov != this.celeritas$lastFov) {
|
||||
@@ -200,6 +201,12 @@ public class MixinRenderGlobal implements IRenderGlobalExt {
|
||||
this.celeritas$lastFov = currentFov;
|
||||
}
|
||||
|
||||
final int currentThirdPerson = this.mc.gameSettings.thirdPersonView;
|
||||
if (currentThirdPerson != this.celeritas$lastThirdPersonView) {
|
||||
this.celeritas$renderer.scheduleTerrainUpdate();
|
||||
this.celeritas$lastThirdPersonView = currentThirdPerson;
|
||||
}
|
||||
|
||||
final SimpleWorldRenderer.CameraState cameraState = new SimpleWorldRenderer.CameraState(
|
||||
camX, camY, camZ,
|
||||
viewEntity.rotationPitch, viewEntity.rotationYaw, fogDistance
|
||||
|
||||
+2
-3
@@ -3,11 +3,10 @@ package com.gtnewhorizons.angelica.mixins.early.rendering;
|
||||
import com.gtnewhorizons.angelica.AngelicaMod;
|
||||
import com.gtnewhorizons.angelica.common.BlockError;
|
||||
import com.gtnewhorizons.angelica.loading.AngelicaTweaker;
|
||||
import net.coderbot.iris.Iris;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
||||
import me.jellysquid.mods.sodium.client.SodiumClientMod;
|
||||
import net.coderbot.iris.Iris;
|
||||
import net.coderbot.iris.block_rendering.BlockRenderingSettings;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -87,7 +86,7 @@ public abstract class MixinRenderBlocks {
|
||||
|
||||
@Redirect(method = "renderStandardBlock", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;isAmbientOcclusionEnabled()Z"))
|
||||
private boolean checkAOEnabled() {
|
||||
if ((this.isRenderingByType && Minecraft.isAmbientOcclusionEnabled() && SodiumClientMod.options().quality.useCeleritasSmoothLighting) ||
|
||||
if ((this.isRenderingByType && Minecraft.isAmbientOcclusionEnabled() && AngelicaMod.options().quality.useCeleritasSmoothLighting) ||
|
||||
(Iris.enabled && BlockRenderingSettings.INSTANCE.shouldUseSeparateAo())) {
|
||||
return false; // Force sodium pipeline with Iris or for standard blocks rendered from renderBlockByRenderType when using AO
|
||||
}
|
||||
|
||||
+3
-3
@@ -59,7 +59,7 @@ public class MixinSkyProviderCelestial_ShaderCompat {
|
||||
* <p>
|
||||
* Fixes sunset not rendering at all with shaders enabled
|
||||
*/
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lcom/hbm/dim/SkyProviderCelestial;renderSunset(FLnet/minecraft/client/multiplayer/WorldClient;Lnet/minecraft/client/Minecraft;)V"), remap = false)
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lcom/hbm/dim/SkyProviderCelestial;renderSunset(FLnet/minecraft/client/multiplayer/WorldClient;Lnet/minecraft/client/Minecraft;FFLnet/minecraft/util/ResourceLocation;)V"), remap = false)
|
||||
public void iris$sunset$renderInDefaultProgram(CallbackInfo ci, @Local(argsOnly = true) Minecraft mc, @Share("sunset$previousProgram") LocalIntRef sunset$previousProgram) {
|
||||
sunset$previousProgram.set(GLStateManager.getActiveProgram());
|
||||
GLStateManager.glUseProgram(0);
|
||||
@@ -69,7 +69,7 @@ public class MixinSkyProviderCelestial_ShaderCompat {
|
||||
/**
|
||||
* Sets the program back before {@link #iris$sunset$renderInDefaultProgram(CallbackInfo, Minecraft, LocalIntRef)} call
|
||||
*/
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lcom/hbm/dim/SkyProviderCelestial;renderSunset(FLnet/minecraft/client/multiplayer/WorldClient;Lnet/minecraft/client/Minecraft;)V", shift = At.Shift.AFTER), remap = false)
|
||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lcom/hbm/dim/SkyProviderCelestial;renderSunset(FLnet/minecraft/client/multiplayer/WorldClient;Lnet/minecraft/client/Minecraft;FFLnet/minecraft/util/ResourceLocation;)V", shift = At.Shift.AFTER), remap = false)
|
||||
public void iris$sunset$restorePreviousProgram(CallbackInfo ci, @Share("sunset$previousProgram") LocalIntRef sunset$previousProgram) {
|
||||
GLStateManager.glUseProgram(sunset$previousProgram.get());
|
||||
}
|
||||
@@ -246,7 +246,7 @@ public class MixinSkyProviderCelestial_ShaderCompat {
|
||||
Iris.getPipelineManager().getPipeline().ifPresent(p -> p.setPhase(WorldRenderingPhase.SUN));
|
||||
}
|
||||
|
||||
@Inject(method = "renderSunset", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/WorldProvider;calcSunriseSunsetColors(FF)[F"))
|
||||
@Inject(method = "renderSunset", at = @At(value = "INVOKE", target = "Lcom/hbm/dim/SkyProviderCelestial;calcSunriseSunsetColors(FLnet/minecraft/client/multiplayer/WorldClient;Lnet/minecraft/client/Minecraft;FF)[F"), remap = false)
|
||||
private void iris$setSunsetRenderStage(CallbackInfo ci) {
|
||||
Iris.getPipelineManager().getPipeline().ifPresent(p -> p.setPhase(WorldRenderingPhase.SUNSET));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user