mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-26 23:23:01 +00:00
More Caching (#242)
* More Caching * Pull TextureTracker & TextureInfoCache out of Iris and into GLSM * Cache more TextureInfo state * GLSM: glTexParameter, glGetTexParameter(i|f), glGetTexLevelParameteri * Move IrisRenderSystem -> GLSM.RenderSystem * Ensure DSA works properly with GLSM * Further updates to DSA for texParameter/getTexParameter * A few more cached fields for TextureInfo * Properly handle deleteTextures * Ensure anyone crazy enough to use an Int/FloatBuffer for single value params get redirected * Add optional runtime disabling of GLSM * Switch checkGLError from an inject to a redirect, hopefully fewer allocations * Fewer allocations for clearBufferState * Microoptimization for (setup|clear)BufferState
This commit is contained in:
1 parent
b956a44857
commit
6691511e17
68 files changed
+935
-890
No files matched your search
@@ -2,7 +2,7 @@ package net.coderbot.iris.postprocess;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import net.coderbot.iris.gl.IrisRenderSystem;
|
||||
import com.gtnewhorizons.angelica.glsm.RenderSystem;
|
||||
import net.coderbot.iris.gl.framebuffer.GlFramebuffer;
|
||||
import net.coderbot.iris.gl.program.Program;
|
||||
import net.coderbot.iris.gl.program.ProgramBuilder;
|
||||
@@ -97,12 +97,12 @@ public class CenterDepthSampler {
|
||||
}
|
||||
|
||||
public void setupColorTexture(int texture, InternalTextureFormat format) {
|
||||
IrisRenderSystem.texImage2D(texture, GL11.GL_TEXTURE_2D, 0, format.getGlFormat(), 1, 1, 0, format.getPixelFormat().getGlFormat(), PixelType.FLOAT.getGlFormat(), null);
|
||||
RenderSystem.texImage2D(texture, GL11.GL_TEXTURE_2D, 0, format.getGlFormat(), 1, 1, 0, format.getPixelFormat().getGlFormat(), PixelType.FLOAT.getGlFormat(), null);
|
||||
|
||||
IrisRenderSystem.texParameteri(texture, GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
|
||||
IrisRenderSystem.texParameteri(texture, GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
|
||||
IrisRenderSystem.texParameteri(texture, GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
|
||||
IrisRenderSystem.texParameteri(texture, GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
|
||||
RenderSystem.texParameteri(texture, GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
|
||||
RenderSystem.texParameteri(texture, GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
|
||||
RenderSystem.texParameteri(texture, GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
|
||||
RenderSystem.texParameteri(texture, GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
|
||||
}
|
||||
|
||||
public int getCenterDepthTexture() {
|
||||
|
||||
@@ -4,9 +4,9 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.gtnewhorizons.angelica.glsm.RenderSystem;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
|
||||
import lombok.Getter;
|
||||
import net.coderbot.iris.gl.IrisRenderSystem;
|
||||
import net.coderbot.iris.gl.framebuffer.GlFramebuffer;
|
||||
import net.coderbot.iris.gl.program.ComputeProgram;
|
||||
import net.coderbot.iris.gl.program.Program;
|
||||
@@ -218,7 +218,7 @@ public class CompositeRenderer {
|
||||
}
|
||||
|
||||
if (ranCompute) {
|
||||
IrisRenderSystem.memoryBarrier(40);
|
||||
RenderSystem.memoryBarrier(40);
|
||||
}
|
||||
|
||||
Program.unbind();
|
||||
@@ -279,14 +279,14 @@ public class CompositeRenderer {
|
||||
//
|
||||
// Also note that this only applies to one of the two buffers in a render target buffer pair - making it
|
||||
// unlikely that this issue occurs in practice with most shader packs.
|
||||
IrisRenderSystem.generateMipmaps(texture, GL11.GL_TEXTURE_2D);
|
||||
RenderSystem.generateMipmaps(texture, GL11.GL_TEXTURE_2D);
|
||||
|
||||
int filter = GL11.GL_LINEAR_MIPMAP_LINEAR;
|
||||
if (target.getInternalFormat().getPixelFormat().isInteger()) {
|
||||
filter = GL11.GL_NEAREST_MIPMAP_NEAREST;
|
||||
}
|
||||
|
||||
IrisRenderSystem.texParameteri(texture, GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, filter);
|
||||
RenderSystem.texParameteri(texture, GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, filter);
|
||||
}
|
||||
|
||||
// TODO: Don't just copy this from DeferredWorldRenderingPipeline
|
||||
|
||||
@@ -3,9 +3,9 @@ package net.coderbot.iris.postprocess;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.gtnewhorizons.angelica.glsm.RenderSystem;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
|
||||
import net.coderbot.iris.gl.IrisRenderSystem;
|
||||
import net.coderbot.iris.gl.framebuffer.GlFramebuffer;
|
||||
import net.coderbot.iris.gl.program.ComputeProgram;
|
||||
import net.coderbot.iris.gl.program.Program;
|
||||
@@ -189,7 +189,7 @@ public class FinalPassRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
IrisRenderSystem.memoryBarrier(40);
|
||||
RenderSystem.memoryBarrier(40);
|
||||
|
||||
if (!finalPass.mipmappedBuffers.isEmpty()) {
|
||||
GLStateManager.glActiveTexture(GL13.GL_TEXTURE0);
|
||||
@@ -216,7 +216,7 @@ public class FinalPassRenderer {
|
||||
// https://stackoverflow.com/a/23994979/18166885
|
||||
this.baseline.bindAsReadBuffer();
|
||||
|
||||
IrisRenderSystem.copyTexSubImage2D(main.framebufferTexture, GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, baseWidth, baseHeight);
|
||||
RenderSystem.copyTexSubImage2D(main.framebufferTexture, GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, baseWidth, baseHeight);
|
||||
}
|
||||
|
||||
GLStateManager.glActiveTexture(GL13.GL_TEXTURE0);
|
||||
@@ -283,14 +283,14 @@ public class FinalPassRenderer {
|
||||
//
|
||||
// Also note that this only applies to one of the two buffers in a render target buffer pair - making it
|
||||
// unlikely that this issue occurs in practice with most shader packs.
|
||||
IrisRenderSystem.generateMipmaps(texture, GL11.GL_TEXTURE_2D);
|
||||
RenderSystem.generateMipmaps(texture, GL11.GL_TEXTURE_2D);
|
||||
|
||||
int filter = GL11.GL_LINEAR_MIPMAP_LINEAR;
|
||||
if (target.getInternalFormat().getPixelFormat().isInteger()) {
|
||||
filter = GL11.GL_NEAREST_MIPMAP_NEAREST;
|
||||
}
|
||||
|
||||
IrisRenderSystem.texParameteri(texture, GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, filter);
|
||||
RenderSystem.texParameteri(texture, GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, filter);
|
||||
}
|
||||
|
||||
private static void resetRenderTarget(RenderTarget target) {
|
||||
@@ -301,8 +301,8 @@ public class FinalPassRenderer {
|
||||
filter = GL11.GL_NEAREST;
|
||||
}
|
||||
|
||||
IrisRenderSystem.texParameteri(target.getMainTexture(), GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, filter);
|
||||
IrisRenderSystem.texParameteri(target.getAltTexture(), GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, filter);
|
||||
RenderSystem.texParameteri(target.getMainTexture(), GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, filter);
|
||||
RenderSystem.texParameteri(target.getAltTexture(), GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, filter);
|
||||
|
||||
GLStateManager.glBindTexture(GL11.GL_TEXTURE_2D, 0);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package net.coderbot.iris.postprocess;
|
||||
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import net.coderbot.iris.gl.IrisRenderSystem;
|
||||
import com.gtnewhorizons.angelica.compat.mojang.DefaultVertexFormat;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.gtnewhorizons.angelica.glsm.RenderSystem;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL15;
|
||||
@@ -82,6 +82,6 @@ public class FullScreenQuadRenderer {
|
||||
// Vertex 3: Bottom left corner
|
||||
0.0F, 0.0F, 0.0F, 0.0F, 0.0F }).rewind();
|
||||
|
||||
return IrisRenderSystem.bufferStorage(GL15.GL_ARRAY_BUFFER, vertices, GL15.GL_STATIC_DRAW);
|
||||
return RenderSystem.bufferStorage(GL15.GL_ARRAY_BUFFER, vertices, GL15.GL_STATIC_DRAW);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user