GLSL Downgrading (#1348)

This commit is contained in:
Jason Mitchell authored and GitHub committed 2026-01-31 13:23:02 -08:00
1 parent dd970b4c6a
commit 41eafbd151
9 files changed
+481 -101

No files matched your search

@@ -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;
}
}