Fix other dynamic uniforms not updating properly (#1610)

This commit is contained in:
Kotmatross authored and GitHub committed 2026-03-29 12:53:09 -07:00
1 parent 83fdd57534
commit 117ff0cacf
5 files changed
+62 -31

No files matched your search

@@ -1,9 +1,15 @@
package net.coderbot.iris.gl.state;
/**
* Holds update notifiers for PBR texture changes.
* Holds some standard update notifiers for various elements of GL state.
*/
public class StateUpdateNotifiers {
public static ValueUpdateNotifier fogModeNotifier;
public static ValueUpdateNotifier fogStartNotifier;
public static ValueUpdateNotifier fogEndNotifier;
public static ValueUpdateNotifier fogDensityNotifier;
public static ValueUpdateNotifier blendFuncNotifier;
public static ValueUpdateNotifier bindTextureNotifier;
public static ValueUpdateNotifier normalTextureChangeNotifier;
public static ValueUpdateNotifier specularTextureChangeNotifier;
public static ValueUpdateNotifier phaseChangeNotifier;
@@ -83,7 +83,7 @@ public final class CommonUniforms {
}
return ZERO_VECTOR_2i;
}, ValueUpdateNotifier.NONE);
}, StateUpdateNotifiers.bindTextureNotifier);
uniforms.uniform2i("gtextureSize", () -> {
final int glId = GLStateManager.getBoundTextureForServerState(0);
@@ -91,7 +91,7 @@ public final class CommonUniforms {
final TextureInfo info = TextureInfoCache.INSTANCE.getInfo(glId);
return new Vector2i(info.getWidth(), info.getHeight());
}, ValueUpdateNotifier.NONE);
}, StateUpdateNotifiers.bindTextureNotifier);
uniforms.uniform4i("blendFunc", () -> {
if(GLStateManager.getBlendMode().isEnabled()) {
@@ -99,7 +99,7 @@ public final class CommonUniforms {
return new Vector4i(blend.getSrcRgb(), blend.getDstRgb(), blend.getSrcAlpha(), blend.getDstAlpha());
}
return ZERO_VECTOR_4i;
}, ValueUpdateNotifier.NONE);
}, StateUpdateNotifiers.blendFuncNotifier);
uniforms.uniform1i("renderStage", () -> GbufferPrograms.getCurrentPhase().ordinal(), StateUpdateNotifiers.phaseChangeNotifier);
@@ -2,6 +2,7 @@ package net.coderbot.iris.uniforms;
import com.gtnewhorizons.angelica.glsm.GLStateManager;
import net.coderbot.iris.gl.state.FogMode;
import net.coderbot.iris.gl.state.StateUpdateNotifiers;
import net.coderbot.iris.gl.state.ValueUpdateNotifier;
import net.coderbot.iris.gl.uniform.DynamicUniformHolder;
import net.coderbot.iris.gl.uniform.UniformUpdateFrequency;
@@ -19,12 +20,12 @@ public class FogUniforms {
uniforms.uniform1i("fogMode", () -> {
if (!GLStateManager.getFogMode().isEnabled()) return 0;
return GLStateManager.getFogState().getFogMode();
}, ValueUpdateNotifier.NONE);
}, StateUpdateNotifiers.fogModeNotifier);
uniforms.uniform1i("fogShape", () -> 0, ValueUpdateNotifier.NONE);
}
uniforms.uniform1f("fogDensity", () -> GLStateManager.getFogState().getDensity(), ValueUpdateNotifier.NONE);
uniforms.uniform1f("fogStart", () -> GLStateManager.getFogState().getStart(), ValueUpdateNotifier.NONE);
uniforms.uniform1f("fogEnd", () -> GLStateManager.getFogState().getEnd(), ValueUpdateNotifier.NONE);
uniforms.uniform1f("fogDensity", () -> GLStateManager.getFogState().getDensity(), StateUpdateNotifiers.fogDensityNotifier);
uniforms.uniform1f("fogStart", () -> GLStateManager.getFogState().getStart(), StateUpdateNotifiers.fogStartNotifier);
uniforms.uniform1f("fogEnd", () -> GLStateManager.getFogState().getEnd(), StateUpdateNotifiers.fogEndNotifier);
}
}