Common and version specific shader packages #10

Merged
embeddedt merged 24 commits from mitchej123/celeritas:common-shaders-and-enhancements into stonecutter 2025-03-31 19:52:28 -04:00
12 changed files with 21 additions and 11 deletions
Showing only changes of commit e958a5206a - Show all commits

No files matched your search

@@ -76,6 +76,7 @@ public interface GLStateManagerService {
void bindTexture(int texture); // Non-standard signature
int getActiveTexture(); // Mojang Addition
int getActiveTextureAccessor(); // Mojang Addition
int getBoundTexture(int internalUnit); // Mojang Addition
int getActiveBoundTexture(); // Mojang Addition
@@ -1,11 +1,10 @@
package net.irisshaders.iris.gl.program;
import static com.mitchej123.glsm.GLStateManagerService.GL_STATE_MANAGER;
import static org.embeddedt.embeddium.compat.mc.MinecraftVersionShimService.MINECRAFT_SHIM;
import net.irisshaders.iris.Iris;
import net.irisshaders.iris.gl.GlResource;
import net.irisshaders.iris.gl.IrisRenderSystem;
import net.irisshaders.iris.pipeline.WorldRenderingPipeline;
import net.irisshaders.iris.shaderpack.FilledIndirectPointer;
import org.joml.Vector2f;
import org.joml.Vector3i;
@@ -73,7 +72,7 @@ public final class ComputeProgram extends GlResource {
}
public void dispatch(float width, float height) {
if (!Iris.getPipelineManager().getPipeline().map(WorldRenderingPipeline::allowConcurrentCompute).orElse(false)) {
if (!MINECRAFT_SHIM.irisAllowConcurrentUpdate()) {
embeddedt marked this conversation as resolved
Review

Weird... making a note to look at later.

Weird... making a note to look at later.
IrisRenderSystem.memoryBarrier(GL43C.GL_SHADER_IMAGE_ACCESS_BARRIER_BIT | GL43C.GL_TEXTURE_FETCH_BARRIER_BIT | GL43C.GL_SHADER_STORAGE_BARRIER_BIT);
}
@@ -19,7 +19,6 @@ import net.irisshaders.iris.gl.sampler.SamplerLimits;
import net.irisshaders.iris.gl.state.ValueUpdateNotifier;
import net.irisshaders.iris.gl.texture.TextureAccess;
import net.irisshaders.iris.gl.texture.TextureType;
import net.irisshaders.iris.mixin.GlStateManagerAccessor;
import net.irisshaders.iris.shaderpack.properties.PackRenderTargetDirectives;
import org.lwjgl.opengl.GL20C;
@@ -72,7 +71,7 @@ public class ProgramSamplers {
// We need to keep the active texture intact, since if we mess it up
// in the middle of RenderType setup, bad things will happen.
int activeTexture = GlStateManagerAccessor.getActiveTexture();
int activeTexture = GL_STATE_MANAGER.getActiveTextureAccessor();
for (SamplerBinding samplerBinding : samplerBindings) {
samplerBinding.update();
@@ -4,10 +4,10 @@ import java.nio.IntBuffer;
import java.util.*;
import static com.mitchej123.glsm.GLStateManagerService.GL_STATE_MANAGER;
import static net.irisshaders.iris.IrisLogging.IRIS_LOGGER;
import static org.embeddedt.embeddium.compat.mc.MinecraftVersionShimService.MINECRAFT_SHIM;
import com.google.common.collect.ImmutableList;
import net.irisshaders.iris.Iris;
import net.irisshaders.iris.gl.IrisRenderSystem;
import net.irisshaders.iris.gl.state.ValueUpdateNotifier;
import net.irisshaders.iris.gl.uniform.DynamicLocationalUniformHolder;
@@ -293,7 +293,7 @@ public class ProgramUniforms {
locations.put(id, name);
uniformNames.put(name, type);
} else {
Iris.logger.warn("[" + this.name + "] Duplicate uniform: " + type.toString().toLowerCase() + " " + name);
IRIS_LOGGER.warn("[" + this.name + "] Duplicate uniform: " + type.toString().toLowerCase() + " " + name);
return OptionalInt.empty();
}
@@ -331,7 +331,7 @@ public class ProgramUniforms {
expectedName = "(unsupported type: " + getTypeName(type) + ")";
}
Iris.logger.error("[" + this.name + "] Wrong uniform type for " + name + ": Iris is providing " + provided + " but the program expects " + expectedName + ". Disabling that uniform.");
IRIS_LOGGER.error("[" + this.name + "] Wrong uniform type for " + name + ": Iris is providing " + provided + " but the program expects " + expectedName + ". Disabling that uniform.");
once.remove(name);
perTick.remove(name);
@@ -1,7 +1,6 @@
package net.irisshaders.iris.helpers;
import net.minecraft.util.FastColor;
import static org.embeddedt.embeddium.compat.mc.ABGR32Service.ABGR32;
/**
* This is a port of the fast-srgb8 library from thomcc on <a href="https://github.com/thomcc/fast-srgb8">GitHub</a>.
@@ -85,7 +84,7 @@ public class ColorSRGB {
* @param a The alpha-component in linear RGB space (0 to 255)
*/
public static int linearToSrgb(float r, float g, float b, int a) {
return FastColor.ABGR32.color(a, linearToSrgb(b), linearToSrgb(g), linearToSrgb(r));
return ABGR32.color(a, linearToSrgb(b), linearToSrgb(g), linearToSrgb(r));
}
/**
@@ -83,4 +83,5 @@ public interface MinecraftVersionShimService {
// TODO(mitchej123): Does this belong here?
void reloadIris() throws IOException;
boolean irisAllowConcurrentUpdate();
}
@@ -5,6 +5,7 @@ import com.mojang.blaze3d.platform.NativeImage;
import com.mojang.math.Axis;
import net.irisshaders.iris.Iris;
import net.irisshaders.iris.helpers.JomlConversions;
import net.irisshaders.iris.pipeline.WorldRenderingPipeline;
import net.irisshaders.iris.shaderpack.DimensionId;
import net.irisshaders.iris.uniforms.CameraUniforms;
import net.irisshaders.iris.uniforms.CapturedRenderingState;
@@ -333,5 +334,10 @@ public class MinecraftModernVersionShimImpl implements MinecraftVersionShimServi
Iris.reload();
}
@Override
public boolean irisAllowConcurrentUpdate() {
return Iris.getPipelineManager().getPipeline().map(WorldRenderingPipeline::allowConcurrentCompute).orElse(false);
}
}
@@ -218,6 +218,11 @@ public class GLStateManagerImpl implements GLStateManagerService {
return GlStateManager._getActiveTexture();
}
@Override
public int getActiveTextureAccessor() {
return GlStateManagerAccessor.getActiveTexture();
}
@Override
public int getBoundTexture(int internalUnit) {
return GlStateManagerAccessor.getTEXTURES()[internalUnit].binding;