Fix incorrect blend state for blur effects, followup to #10115 and fix for 10541 (#10678)

This commit is contained in:
Matt authored and GitHub committed 2025-10-20 17:39:13 -07:00
1 parent 86a00f6122
commit 444d4a94da
2 files changed
+16 -3

No files matched your search

@@ -1,5 +1,17 @@
--- a/com/mojang/blaze3d/platform/GlStateManager.java
+++ b/com/mojang/blaze3d/platform/GlStateManager.java
@@ -96,6 +_,11 @@
BLEND.mode.enable();
}
+ public static boolean _getBlendState() {
+ RenderSystem.assertOnRenderThread();
+ return BLEND.mode.enabled;
+ }
+
public static void _blendFunc(int p_84329_, int p_84330_) {
RenderSystem.assertOnRenderThread();
if (p_84329_ != BLEND.srcRgb || p_84330_ != BLEND.dstRgb) {
@@ -493,9 +_,17 @@
}
}
@@ -9,15 +9,16 @@
}
}
@@ -350,8 +_,11 @@
@@ -350,8 +_,12 @@
public void processBlurEffect(float p_333718_) {
float f = (float)this.minecraft.options.getMenuBackgroundBlurriness();
if (this.blurEffect != null && f >= 1.0F) {
+ boolean previousBlendState = GlStateManager._getBlendState();
+ // FORGE: Blending the blur was removed in 1.21. This is necessary for screen layering to work properly. https://github.com/MinecraftForge/MinecraftForge/issues/10114
+ RenderSystem.enableBlend();
+ RenderSystem.disableBlend();
this.blurEffect.setUniform("Radius", f);
this.blurEffect.process(p_333718_);
+ RenderSystem.disableBlend();
+ if (previousBlendState) RenderSystem.enableBlend();
}
}