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:
Jason Mitchell authored and GitHub committed 2024-01-27 15:52:57 -08:00
1 parent b956a44857
commit 6691511e17
68 files changed
+935 -890

No files matched your search

@@ -1,6 +1,6 @@
package net.coderbot.iris.texture.format;
import net.coderbot.iris.gl.IrisRenderSystem;
import com.gtnewhorizons.angelica.glsm.RenderSystem;
import net.coderbot.iris.texture.mipmap.CustomMipmapGenerator;
import net.coderbot.iris.texture.pbr.PBRType;
import net.minecraft.client.renderer.texture.AbstractTexture;
@@ -46,12 +46,12 @@ public interface TextureFormat {
default void setupTextureParameters(PBRType pbrType, AbstractTexture texture) {
if (!canInterpolateValues(pbrType)) {
int minFilter = IrisRenderSystem.getTexParameteri(texture.getGlTextureId(), GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER);
int minFilter = RenderSystem.getTexParameteri(texture.getGlTextureId(), GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER);
// Non-mipped filters begin at 0x2600 whereas mipped filters begin at 0x2700,
// so this bit mask can be used to check if the filter is mipped or not
boolean mipmap = (minFilter & 1 << 8) == 1;
IrisRenderSystem.texParameteri(texture.getGlTextureId(), GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, mipmap ? GL11.GL_NEAREST_MIPMAP_NEAREST : GL11.GL_NEAREST);
IrisRenderSystem.texParameteri(texture.getGlTextureId(), GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
RenderSystem.texParameteri(texture.getGlTextureId(), GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, mipmap ? GL11.GL_NEAREST_MIPMAP_NEAREST : GL11.GL_NEAREST);
RenderSystem.texParameteri(texture.getGlTextureId(), GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
}
}