Use GLSM instead of relying on the redirector

This commit is contained in:
Jason Mitchell authored and Jason Mitchell committed 2026-03-21 10:56:19 -07:00
1 parent 70cfa2ae90
commit 5f61e387fb
84 files changed
+628 -1140

No files matched your search

@@ -31,8 +31,8 @@ public class CenterDepthSampler {
private boolean destroyed;
public CenterDepthSampler(IntSupplier depthSupplier, float halfLife) {
this.texture = GL11.glGenTextures();
this.altTexture = GL11.glGenTextures();
this.texture = GLStateManager.glGenTextures();
this.altTexture = GLStateManager.glGenTextures();
this.framebuffer = new GlFramebuffer();
// Fall back to a less precise format if the system doesn't support OpenGL 3
@@ -36,7 +36,6 @@ import net.coderbot.iris.uniforms.CommonUniforms;
import net.coderbot.iris.uniforms.FrameUpdateNotifier;
import net.coderbot.iris.uniforms.custom.CustomUniforms;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.shader.Framebuffer;
import org.jetbrains.annotations.Nullable;
import org.lwjgl.opengl.GL11;
@@ -144,7 +143,7 @@ public class FinalPassRenderer {
this.swapPasses = swapPasses.build();
OpenGlHelper.func_153171_g/*glBindFramebuffer*/(GL30.GL_READ_FRAMEBUFFER, 0);
GLStateManager.glBindFramebuffer(GL30.GL_READ_FRAMEBUFFER, 0);
}
private static Map<PatchShaderType, String> getTransformed(ProgramSource source, CompletableFuture<Map<PatchShaderType, String>> precomputedTransformFuture, String stageName) {
@@ -276,7 +275,7 @@ public class FinalPassRenderer {
swapPass.from.bind();
GLStateManager.glBindTexture(GL11.GL_TEXTURE_2D, swapPass.targetTexture);
GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, swapPass.width, swapPass.height);
GLStateManager.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, swapPass.width, swapPass.height);
}
// Make sure to reset the viewport to how it was before... Otherwise weird issues could occur.
@@ -22,12 +22,12 @@ public class FullScreenQuadRenderer {
public static final FullScreenQuadRenderer INSTANCE = new FullScreenQuadRenderer();
private FullScreenQuadRenderer() {
this.vao = org.lwjgl.opengl.GL30.glGenVertexArrays();
this.vao = GLStateManager.glGenVertexArrays();
GLStateManager.glBindVertexArray(vao);
this.quadBuffer = createQuad();
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, quadBuffer);
GLStateManager.glBindBuffer(GL15.GL_ARRAY_BUFFER, quadBuffer);
DefaultVertexFormat.POSITION_TEXTURE.setupBufferState(0L);
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
GLStateManager.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
GLStateManager.glBindVertexArray(0);
}
@@ -79,14 +79,14 @@ public class FullScreenQuadRenderer {
private static final Int2ObjectOpenHashMap<int[]> compositeLocCache = new Int2ObjectOpenHashMap<>();
public static void uploadCompositeMatrices() {
final int program = GL11.glGetInteger(GL20.GL_CURRENT_PROGRAM);
final int program = GLStateManager.glGetInteger(GL20.GL_CURRENT_PROGRAM);
if (program == 0) return;
int[] locs = compositeLocCache.get(program);
if (locs == null) {
locs = new int[] {
GL20.glGetUniformLocation(program, "iris_ModelViewMatrix"),
GL20.glGetUniformLocation(program, "iris_ProjectionMatrix")
GLStateManager.glGetUniformLocation(program, "iris_ModelViewMatrix"),
GLStateManager.glGetUniformLocation(program, "iris_ProjectionMatrix")
};
compositeLocCache.put(program, locs);
}
@@ -94,13 +94,13 @@ public class FullScreenQuadRenderer {
if (locs[0] != -1) {
GLStateManager.getModelViewMatrix().get(matBuf);
matBuf.rewind();
GL20.glUniformMatrix4(locs[0], false, matBuf);
GLStateManager.glUniformMatrix4(locs[0], false, matBuf);
}
if (locs[1] != -1) {
GLStateManager.getProjectionMatrix().get(matBuf);
matBuf.rewind();
GL20.glUniformMatrix4(locs[1], false, matBuf);
GLStateManager.glUniformMatrix4(locs[1], false, matBuf);
}
}