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,8 +1,8 @@
package net.coderbot.iris.gl.program;
import com.gtnewhorizons.angelica.glsm.RenderSystem;
import net.coderbot.iris.Iris;
import net.coderbot.iris.gl.GlResource;
import net.coderbot.iris.gl.IrisRenderSystem;
import net.coderbot.iris.pipeline.WorldRenderingPipeline;
import org.joml.Vector2f;
import org.joml.Vector3i;
@@ -28,8 +28,7 @@ public final class ComputeProgram extends GlResource {
super(program);
localSizeBuffer = BufferUtils.createIntBuffer(3);
// localSize = new int[3];
IrisRenderSystem.getProgramiv(program, GL43.GL_COMPUTE_WORK_GROUP_SIZE, localSizeBuffer);
RenderSystem.getProgramiv(program, GL43.GL_COMPUTE_WORK_GROUP_SIZE, localSizeBuffer);
this.uniforms = uniforms;
this.samplers = samplers;
this.images = images;
@@ -65,10 +64,10 @@ public final class ComputeProgram extends GlResource {
images.update();
if (!Iris.getPipelineManager().getPipeline().map(WorldRenderingPipeline::allowConcurrentCompute).orElse(false)) {
IrisRenderSystem.memoryBarrier(40);
RenderSystem.memoryBarrier(40);
}
IrisRenderSystem.dispatchCompute(getWorkGroups(width, height));
RenderSystem.dispatchCompute(getWorkGroups(width, height));
}
public static void unbind() {
@@ -1,7 +1,7 @@
package net.coderbot.iris.gl.program;
import com.google.common.collect.ImmutableSet;
import net.coderbot.iris.gl.IrisRenderSystem;
import com.gtnewhorizons.angelica.glsm.RenderSystem;
import net.coderbot.iris.gl.image.ImageHolder;
import net.coderbot.iris.gl.sampler.SamplerHolder;
import net.coderbot.iris.gl.shader.GlShader;
@@ -27,7 +27,7 @@ public class ProgramBuilder extends ProgramUniforms.Builder implements SamplerHo
}
public void bindAttributeLocation(int index, String name) {
IrisRenderSystem.bindAttributeLocation(program, index, name);
RenderSystem.bindAttributeLocation(program, index, name);
}
public static ProgramBuilder begin(String name, @Nullable String vertexSource, @Nullable String geometrySource,
@@ -66,7 +66,7 @@ public class ProgramBuilder extends ProgramUniforms.Builder implements SamplerHo
}
public static ProgramBuilder beginCompute(String name, @Nullable String source, ImmutableSet<Integer> reservedTextureUnits) {
if (!IrisRenderSystem.supportsCompute()) {
if (!RenderSystem.supportsCompute()) {
throw new IllegalStateException("This PC does not support compute shaders, but it's attempting to be used???");
}
@@ -1,7 +1,7 @@
package net.coderbot.iris.gl.program;
import com.google.common.collect.ImmutableList;
import net.coderbot.iris.gl.IrisRenderSystem;
import com.gtnewhorizons.angelica.glsm.RenderSystem;
import net.coderbot.iris.gl.image.ImageBinding;
import net.coderbot.iris.gl.image.ImageHolder;
import net.coderbot.iris.gl.image.ImageLimits;
@@ -24,7 +24,7 @@ public class ProgramImages {
public void update() {
if (initializer != null) {
for (GlUniform1iCall call : initializer) {
IrisRenderSystem.uniform1i(call.getLocation(), call.getValue());
RenderSystem.uniform1i(call.getLocation(), call.getValue());
}
initializer = null;
@@ -3,8 +3,8 @@ package net.coderbot.iris.gl.program;
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.objects.Object2ObjectMap;
import net.coderbot.iris.gl.IrisRenderSystem;
import net.coderbot.iris.gl.sampler.SamplerBinding;
import net.coderbot.iris.gl.sampler.SamplerHolder;
import net.coderbot.iris.gl.sampler.SamplerLimits;
@@ -38,7 +38,7 @@ public class ProgramSamplers {
if (initializer != null) {
for (GlUniform1iCall call : initializer) {
IrisRenderSystem.uniform1i(call.getLocation(), call.getValue());
RenderSystem.uniform1i(call.getLocation(), call.getValue());
}
initializer = null;
@@ -126,7 +126,7 @@ public class ProgramSamplers {
}
for (String name : names) {
int location = IrisRenderSystem.getUniformLocation(program, name);
int location = RenderSystem.getUniformLocation(program, name);
if (location == -1) {
// There's no active sampler with this particular name in the program.
@@ -141,7 +141,7 @@ public class ProgramSamplers {
@Override
public boolean hasSampler(String name) {
return IrisRenderSystem.getUniformLocation(program, name) != -1;
return RenderSystem.getUniformLocation(program, name) != -1;
}
@Override
@@ -175,7 +175,7 @@ public class ProgramSamplers {
private boolean addDynamicSampler(IntSupplier sampler, boolean used, ValueUpdateNotifier notifier, String... names) {
for (String name : names) {
int location = IrisRenderSystem.getUniformLocation(program, name);
int location = RenderSystem.getUniformLocation(program, name);
if (location == -1) {
// There's no active sampler with this particular name in the program.
@@ -1,8 +1,8 @@
package net.coderbot.iris.gl.program;
import com.google.common.collect.ImmutableList;
import com.gtnewhorizons.angelica.glsm.RenderSystem;
import net.coderbot.iris.Iris;
import net.coderbot.iris.gl.IrisRenderSystem;
import net.coderbot.iris.gl.state.ValueUpdateNotifier;
import net.coderbot.iris.gl.uniform.DynamicLocationalUniformHolder;
import net.coderbot.iris.gl.uniform.Uniform;
@@ -165,7 +165,7 @@ public class ProgramUniforms {
@Override
public OptionalInt location(String name, UniformType type) {
int id = IrisRenderSystem.getUniformLocation(program, name);
int id = RenderSystem.getUniformLocation(program, name);
if (id == -1) {
return OptionalInt.empty();
@@ -190,7 +190,7 @@ public class ProgramUniforms {
IntBuffer sizeType = BufferUtils.createIntBuffer(2);
for (int index = 0; index < activeUniforms; index++) {
final String name = IrisRenderSystem.getActiveUniform(program, index, 128, sizeType);
final String name = RenderSystem.getActiveUniform(program, index, 128, sizeType);
if (name.isEmpty()) {
// No further information available.