mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-20 04:19:40 +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
@@ -4,10 +4,10 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.gtnewhorizons.angelica.compat.mojang.Camera;
|
||||
import com.gtnewhorizons.angelica.compat.toremove.MatrixStack;
|
||||
import com.gtnewhorizons.angelica.glsm.GLStateManager;
|
||||
import com.gtnewhorizons.angelica.glsm.RenderSystem;
|
||||
import com.gtnewhorizons.angelica.rendering.RenderingState;
|
||||
import me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer;
|
||||
import net.coderbot.iris.Iris;
|
||||
import net.coderbot.iris.gl.IrisRenderSystem;
|
||||
import net.coderbot.iris.shaderpack.OptionalBoolean;
|
||||
import net.coderbot.iris.shaderpack.PackDirectives;
|
||||
import net.coderbot.iris.shaderpack.PackShadowDirectives;
|
||||
@@ -205,7 +205,7 @@ public class ShadowRenderer {
|
||||
private void configureDepthSampler(int glTextureId, PackShadowDirectives.DepthSamplingSettings settings) {
|
||||
if (settings.getHardwareFiltering()) {
|
||||
// We have to do this or else shadow hardware filtering breaks entirely!
|
||||
IrisRenderSystem.texParameteri(glTextureId, GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_COMPARE_MODE, GL30.GL_COMPARE_REF_TO_TEXTURE);
|
||||
RenderSystem.texParameteri(glTextureId, GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_COMPARE_MODE, GL30.GL_COMPARE_REF_TO_TEXTURE);
|
||||
}
|
||||
|
||||
// Workaround for issues with old shader packs like Chocapic v4.
|
||||
@@ -213,7 +213,7 @@ public class ShadowRenderer {
|
||||
// be available in r. So we set up the swizzle to fix that.
|
||||
swizzleBuf.rewind();
|
||||
swizzleBuf.put(new int[] { GL11.GL_RED, GL11.GL_RED, GL11.GL_RED, GL11.GL_ONE }).rewind();
|
||||
IrisRenderSystem.texParameteriv(glTextureId, GL11.GL_TEXTURE_2D, ARBTextureSwizzle.GL_TEXTURE_SWIZZLE_RGBA, swizzleBuf);
|
||||
RenderSystem.texParameteriv(glTextureId, GL11.GL_TEXTURE_2D, ARBTextureSwizzle.GL_TEXTURE_SWIZZLE_RGBA, swizzleBuf);
|
||||
|
||||
configureSampler(glTextureId, settings);
|
||||
}
|
||||
@@ -226,11 +226,11 @@ public class ShadowRenderer {
|
||||
|
||||
if (!settings.getNearest()) {
|
||||
// Make sure that things are smoothed
|
||||
IrisRenderSystem.texParameteri(glTextureId, GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
|
||||
IrisRenderSystem.texParameteri(glTextureId, GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
|
||||
RenderSystem.texParameteri(glTextureId, GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
|
||||
RenderSystem.texParameteri(glTextureId, GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
|
||||
} else {
|
||||
IrisRenderSystem.texParameteri(glTextureId, GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
|
||||
IrisRenderSystem.texParameteri(glTextureId, GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
|
||||
RenderSystem.texParameteri(glTextureId, GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
|
||||
RenderSystem.texParameteri(glTextureId, GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,8 +245,8 @@ public class ShadowRenderer {
|
||||
}
|
||||
|
||||
private void setupMipmappingForTexture(int texture, int filteringMode) {
|
||||
IrisRenderSystem.generateMipmaps(texture, GL11.GL_TEXTURE_2D);
|
||||
IrisRenderSystem.texParameteri(texture, GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, filteringMode);
|
||||
RenderSystem.generateMipmaps(texture, GL11.GL_TEXTURE_2D);
|
||||
RenderSystem.texParameteri(texture, GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, filteringMode);
|
||||
}
|
||||
|
||||
private FrustumHolder createShadowFrustum(float renderMultiplier, FrustumHolder holder) {
|
||||
@@ -322,7 +322,7 @@ public class ShadowRenderer {
|
||||
|
||||
private void setupGlState(Matrix4f projMatrix) {
|
||||
// Set up our projection matrix and load it into the legacy matrix stack
|
||||
IrisRenderSystem.setupProjectionMatrix(projMatrix);
|
||||
RenderSystem.setupProjectionMatrix(projMatrix);
|
||||
|
||||
// Disable backface culling
|
||||
// This partially works around an issue where if the front face of a mountain isn't visible, it casts no
|
||||
@@ -339,7 +339,7 @@ public class ShadowRenderer {
|
||||
GLStateManager.enableCull();
|
||||
|
||||
// Make sure to unload the projection matrix
|
||||
IrisRenderSystem.restoreProjectionMatrix();
|
||||
RenderSystem.restoreProjectionMatrix();
|
||||
}
|
||||
|
||||
private void copyPreTranslucentDepth() {
|
||||
|
||||
Reference in new issue
Block a user