2.0.0 Alpha1 Fixes (#1240)

This commit is contained in:
Jason Mitchell authored and GitHub committed 2026-01-08 19:26:56 -08:00
1 parent 9a4f0f9b99
commit 42d7ed58aa
5 files changed
+38 -9

No files matched your search

@@ -10,6 +10,7 @@ import net.coderbot.iris.shaderpack.StringPair;
import net.coderbot.iris.texture.format.TextureFormat;
import net.coderbot.iris.texture.format.TextureFormatLoader;
import net.coderbot.iris.uniforms.VanillaBiomeList;
import net.minecraft.world.biome.BiomeGenBase;
import org.lwjgl.LWJGLUtil;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL20;
@@ -318,6 +319,10 @@ public class StandardMacros {
}
}
// Modern biome name aliases - map modern names to 1.7.10 equivalents(ish)
addModernBiomeAlias(defines, "SWAMP", BiomeGenBase.swampland);
addModernBiomeAlias(defines, "SWAMP_HILLS", BiomeGenBase.swampland); // No hills variant in 1.7.10
// Modern biomes that don't exist in 1.7.10 - add dummy IDs that will never match
// This allows shader expressions to parse without errors while always evaluating to false/0
// Using negative IDs to avoid conflicts with actual biome IDs
@@ -331,4 +336,10 @@ public class StandardMacros {
return defines;
}
private static void addModernBiomeAlias(Map<String, String> defines, String modernName, BiomeGenBase biome) {
if (biome != null) {
defines.put("BIOME_" + modernName, String.valueOf(biome.biomeID));
}
}
}
@@ -19,6 +19,7 @@ public class PipelineManager {
private final Function<DimensionId, WorldRenderingPipeline> pipelineFactory;
private final Map<DimensionId, WorldRenderingPipeline> pipelinesPerDimension = new HashMap<>();
private WorldRenderingPipeline pipeline = new FixedFunctionWorldRenderingPipeline();
private DimensionId lastPreparedDimension = null;
@Getter
private int versionCounterForSodiumShaderReload = 0;
@@ -27,6 +28,13 @@ public class PipelineManager {
}
public WorldRenderingPipeline preparePipeline(DimensionId currentDimension) {
// Detect dimension change and do full teardown/recreation
if (lastPreparedDimension != null && lastPreparedDimension != currentDimension) {
Iris.logger.info("Dimension changed from {} to {}, reloading pipeline", lastPreparedDimension, currentDimension);
destroyPipeline();
}
lastPreparedDimension = currentDimension;
if (!pipelinesPerDimension.containsKey(currentDimension)) {
SystemTimeUniforms.COUNTER.reset();
SystemTimeUniforms.TIMER.reset();
@@ -71,6 +79,7 @@ public class PipelineManager {
pipelinesPerDimension.clear();
pipeline = null;
lastPreparedDimension = null;
versionCounterForSodiumShaderReload++;
}
@@ -348,16 +348,16 @@ public class ShaderTransformer {
.build();
final String chunkVertexHeader = org.embeddedt.embeddium.impl.gl.shader.ShaderParser.parseShader(
ShaderLoader.getShaderSource("sodium:include/chunk_vertex.glsl"),
ShaderLoader::getShaderSource,
constants);
ShaderLoader.getShaderSource("sodium:include/chunk_vertex.glsl"), ShaderLoader::getShaderSource, constants)
.replace("_get_relative_chunk_coord(pos) * vec3(16.0)", "vec3(_get_relative_chunk_coord(pos)) * 16.0");
return "\n\n" + chunkVertexHeader + "\n\n";
}
public static String getFormattedShader(ParseTree tree, String string) {
StringBuilder sb = new StringBuilder(string + "\n");
String[] tabHolder = {""};
final StringBuilder sb = new StringBuilder(string + "\n");
final String[] tabHolder = {""};
getFormattedShader(tree, sb, tabHolder);
return sb.toString();
}