forge170-shaders #13
No files matched your search
+17
@@ -0,0 +1,17 @@
|
||||
package net.irisshaders.iris.pathways;
|
||||
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
public interface FullScreenQuadRenderer {
|
||||
|
||||
FullScreenQuadRenderer INSTANCE = ServiceLoader.load(FullScreenQuadRenderer.class).findFirst().orElseThrow();
|
||||
|
||||
void render();
|
||||
|
||||
void begin();
|
||||
|
||||
void renderQuad();
|
||||
|
||||
void end();
|
||||
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
+15
@@ -0,0 +1,15 @@
|
||||
package net.irisshaders.iris.pipeline;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
|
||||
import net.irisshaders.iris.gl.texture.TextureAccess;
|
||||
import net.irisshaders.iris.shaderpack.texture.TextureStage;
|
||||
|
||||
import java.util.EnumMap;
|
||||
|
||||
public abstract class CommonCustomTextureManager {
|
||||
public abstract TextureAccess getNoiseTexture();
|
||||
public abstract EnumMap<TextureStage, Object2ObjectMap<String, TextureAccess>> getCustomTextureIdMap();
|
||||
public abstract Object2ObjectMap<String, TextureAccess> getCustomTextureIdMap(TextureStage stage);
|
||||
public abstract Object2ObjectMap<String, TextureAccess> getIrisCustomTextures();
|
||||
public abstract void destroy();
|
||||
}
|
||||
+196
@@ -0,0 +1,196 @@
|
||||
package net.irisshaders.iris.pipeline;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
|
||||
import net.irisshaders.iris.gl.buffer.ShaderStorageBufferHolder;
|
||||
import net.irisshaders.iris.gl.framebuffer.GlFramebuffer;
|
||||
import net.irisshaders.iris.gl.image.GlImage;
|
||||
import net.irisshaders.iris.gl.texture.TextureType;
|
||||
import net.irisshaders.iris.gui.option.IrisVideoSettings;
|
||||
import net.irisshaders.iris.helpers.Tri;
|
||||
import net.irisshaders.iris.pathways.colorspace.ColorSpace;
|
||||
import net.irisshaders.iris.shaderpack.ShaderPack;
|
||||
import net.irisshaders.iris.shaderpack.programs.ProgramSet;
|
||||
import net.irisshaders.iris.shaderpack.properties.CloudSetting;
|
||||
import net.irisshaders.iris.shaderpack.properties.PackDirectives;
|
||||
import net.irisshaders.iris.shaderpack.properties.PackShadowDirectives;
|
||||
import net.irisshaders.iris.shaderpack.texture.TextureStage;
|
||||
import net.irisshaders.iris.shadows.ShadowRenderTargets;
|
||||
import net.irisshaders.iris.shadows.ShadowRenderingState;
|
||||
import net.irisshaders.iris.targets.ClearPass;
|
||||
import net.irisshaders.iris.uniforms.CommonUniforms;
|
||||
import net.irisshaders.iris.uniforms.FrameUpdateNotifier;
|
||||
import net.irisshaders.iris.uniforms.custom.CustomUniforms;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.embeddedt.embeddium.impl.gl.debug.GLDebug;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.OptionalInt;
|
||||
import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public abstract class CommonIrisRenderingPipeline implements WorldRenderingPipeline {
|
||||
public boolean isBeforeTranslucent;
|
||||
protected final Supplier<ShadowRenderTargets> shadowTargetsSupplier;
|
||||
protected final int shadowMapResolution;
|
||||
protected final PackShadowDirectives shadowDirectives;
|
||||
protected final PackDirectives packDirectives;
|
||||
protected final Set<GlImage> customImages;
|
||||
protected final GlImage[] clearImages;
|
||||
protected final ShaderPack pack;
|
||||
protected final FrameUpdateNotifier updateNotifier;
|
||||
protected final CustomUniforms customUniforms;
|
||||
protected final float sunPathRotation;
|
||||
protected final boolean shouldRenderUnderwaterOverlay;
|
||||
protected final boolean shouldRenderVignette;
|
||||
protected final boolean shouldWriteRainAndSnowToDepthBuffer;
|
||||
protected final boolean oldLighting;
|
||||
protected final OptionalInt forcedShadowRenderDistanceChunks;
|
||||
protected final boolean frustumCulling;
|
||||
protected final boolean occlusionCulling;
|
||||
protected final boolean shouldRenderSun;
|
||||
protected final boolean shouldRenderMoon;
|
||||
protected final boolean allowConcurrentCompute;
|
||||
protected final CloudSetting cloudSetting;
|
||||
protected final Object2ObjectMap<Tri<String, TextureType, TextureStage>, String> customTextureMap;
|
||||
protected ShadowRenderTargets shadowRenderTargets;
|
||||
protected ImmutableList<ClearPass> clearPassesFull;
|
||||
protected ImmutableList<ClearPass> clearPasses;
|
||||
protected ImmutableList<ClearPass> shadowClearPasses;
|
||||
protected ImmutableList<ClearPass> shadowClearPassesFull;
|
||||
protected GlFramebuffer defaultFB;
|
||||
protected GlFramebuffer defaultFBAlt;
|
||||
protected GlFramebuffer defaultFBShadow;
|
||||
protected boolean shouldRemovePhase = false;
|
||||
protected ShaderStorageBufferHolder shaderStorageBufferHolder;
|
||||
protected WorldRenderingPhase overridePhase = null;
|
||||
protected WorldRenderingPhase phase = WorldRenderingPhase.NONE;
|
||||
protected boolean destroyed = false;
|
||||
protected boolean isRenderingWorld;
|
||||
protected boolean isMainBound;
|
||||
protected boolean shouldBindPBR;
|
||||
protected int currentNormalTexture;
|
||||
protected int currentSpecularTexture;
|
||||
protected ColorSpace currentColorSpace;
|
||||
|
||||
public CommonIrisRenderingPipeline(ProgramSet programSet) {
|
||||
PackShadowDirectives shadowDirectives = programSet.getPackDirectives().getShadowDirectives();
|
||||
|
||||
if (shadowDirectives.isDistanceRenderMulExplicit()) {
|
||||
if (shadowDirectives.getDistanceRenderMul() >= 0.0) {
|
||||
// add 15 and then divide by 16 to ensure we're rounding up
|
||||
forcedShadowRenderDistanceChunks =
|
||||
OptionalInt.of(((int) (shadowDirectives.getDistance() * shadowDirectives.getDistanceRenderMul()) + 15) / 16);
|
||||
} else {
|
||||
forcedShadowRenderDistanceChunks = OptionalInt.of(-1);
|
||||
}
|
||||
} else {
|
||||
forcedShadowRenderDistanceChunks = OptionalInt.empty();
|
||||
}
|
||||
|
||||
|
||||
this.shadowMapResolution = programSet.getPackDirectives().getShadowDirectives().getResolution();
|
||||
this.packDirectives = programSet.getPackDirectives();
|
||||
this.shadowDirectives = packDirectives.getShadowDirectives();
|
||||
|
||||
this.shadowTargetsSupplier = () -> {
|
||||
if (shadowRenderTargets == null) {
|
||||
// TODO: Support more than two shadowcolor render targets
|
||||
this.shadowRenderTargets = new ShadowRenderTargets(this, shadowMapResolution, shadowDirectives);
|
||||
}
|
||||
|
||||
return shadowRenderTargets;
|
||||
};
|
||||
|
||||
this.customImages = new HashSet<>();
|
||||
this.clearImages = customImages.stream().filter(GlImage::shouldClear).toArray(GlImage[]::new);
|
||||
this.pack = programSet.getPack();
|
||||
this.updateNotifier = new FrameUpdateNotifier();
|
||||
|
||||
this.customUniforms = programSet.getPack().customUniforms.build(
|
||||
holder -> CommonUniforms.addNonDynamicUniforms(holder, programSet.getPack().getIdMap(), programSet.getPackDirectives(), this.updateNotifier)
|
||||
);
|
||||
|
||||
this.sunPathRotation = programSet.getPackDirectives().getSunPathRotation();
|
||||
this.shouldRenderUnderwaterOverlay = programSet.getPackDirectives().underwaterOverlay();
|
||||
this.shouldRenderVignette = programSet.getPackDirectives().vignette();
|
||||
this.shouldWriteRainAndSnowToDepthBuffer = programSet.getPackDirectives().rainDepth();
|
||||
this.oldLighting = programSet.getPackDirectives().isOldLighting();
|
||||
this.frustumCulling = programSet.getPackDirectives().shouldUseFrustumCulling();
|
||||
this.occlusionCulling = programSet.getPackDirectives().shouldUseOcclusionCulling();
|
||||
this.shouldRenderSun = programSet.getPackDirectives().shouldRenderSun();
|
||||
this.shouldRenderMoon = programSet.getPackDirectives().shouldRenderMoon();
|
||||
this.allowConcurrentCompute = programSet.getPackDirectives().getConcurrentCompute();
|
||||
this.cloudSetting = programSet.getPackDirectives().getCloudSetting();
|
||||
currentColorSpace = IrisVideoSettings.colorSpace;
|
||||
this.customTextureMap = programSet.getPackDirectives().getTextureMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object2ObjectMap<Tri<String, TextureType, TextureStage>, String> getTextureMap() {
|
||||
return customTextureMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorldRenderingPhase getPhase() {
|
||||
if (shouldRemovePhase) {
|
||||
phase = WorldRenderingPhase.NONE;
|
||||
shouldRemovePhase = false;
|
||||
GLDebug.popGroup();
|
||||
}
|
||||
|
||||
if (overridePhase != null) {
|
||||
return overridePhase;
|
||||
}
|
||||
|
||||
return phase;
|
||||
}
|
||||
|
||||
public void removePhaseIfNeeded() {
|
||||
if (shouldRemovePhase) {
|
||||
phase = WorldRenderingPhase.NONE;
|
||||
shouldRemovePhase = false;
|
||||
GLDebug.popGroup();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPhase(WorldRenderingPhase phase) {
|
||||
if (phase == WorldRenderingPhase.NONE) {
|
||||
if (shouldRemovePhase) GLDebug.popGroup();
|
||||
shouldRemovePhase = true;
|
||||
return;
|
||||
} else {
|
||||
shouldRemovePhase = false;
|
||||
if (phase == this.phase) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
GLDebug.popGroup();
|
||||
if (phase != WorldRenderingPhase.NONE && phase != WorldRenderingPhase.TERRAIN_CUTOUT && phase != WorldRenderingPhase.TERRAIN_CUTOUT_MIPPED && phase != WorldRenderingPhase.TRIPWIRE) {
|
||||
if (ShadowRenderingState.areShadowsCurrentlyBeingRendered()) {
|
||||
GLDebug.pushGroup(phase.ordinal(), "Shadow " + StringUtils.capitalize(phase.name().toLowerCase(Locale.ROOT).replace("_", " ")));
|
||||
} else {
|
||||
GLDebug.pushGroup(phase.ordinal(), StringUtils.capitalize(phase.name().toLowerCase(Locale.ROOT).replace("_", " ")));
|
||||
}
|
||||
}
|
||||
this.phase = phase;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOverridePhase(WorldRenderingPhase phase) {
|
||||
this.overridePhase = phase;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCurrentNormalTexture() {
|
||||
return currentNormalTexture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCurrentSpecularTexture() {
|
||||
return currentSpecularTexture;
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package net.irisshaders.iris.shadows;
|
||||
|
||||
public abstract class CommonShadowCompositeRenderer {
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package net.irisshaders.iris.shadows;
|
||||
|
||||
import net.irisshaders.iris.shaderpack.programs.ProgramSource;
|
||||
import net.irisshaders.iris.shaderpack.properties.PackDirectives;
|
||||
import net.irisshaders.iris.shaderpack.properties.PackShadowDirectives;
|
||||
import net.irisshaders.iris.shaderpack.properties.ShadowCullState;
|
||||
import org.joml.Matrix4f;
|
||||
|
||||
public abstract class CommonShadowRenderer {
|
||||
public static boolean ACTIVE = false;
|
||||
public static int renderDistance;
|
||||
public static Matrix4f MODELVIEW;
|
||||
public static Matrix4f PROJECTION;
|
||||
protected final String debugStringOverall;
|
||||
protected final float halfPlaneLength;
|
||||
protected final int resolution;
|
||||
protected final float nearPlane;
|
||||
protected final float farPlane;
|
||||
protected final float voxelDistance;
|
||||
protected final float renderDistanceMultiplier;
|
||||
protected final float entityShadowDistanceMultiplier;
|
||||
protected final float intervalSize;
|
||||
protected final Float fov;
|
||||
protected final boolean shouldRenderTerrain;
|
||||
protected final boolean shouldRenderTranslucent;
|
||||
protected final boolean shouldRenderEntities;
|
||||
protected final boolean shouldRenderPlayer;
|
||||
protected final boolean shouldRenderBlockEntities;
|
||||
protected final boolean shouldRenderDH;
|
||||
protected final float sunPathRotation;
|
||||
protected final boolean separateHardwareSamplers;
|
||||
protected final boolean shouldRenderLightBlockEntities;
|
||||
protected final ShadowCullState packCullingState;
|
||||
protected final ShadowRenderTargets targets;
|
||||
protected boolean packHasVoxelization;
|
||||
protected String debugStringTerrain = "(unavailable)";
|
||||
protected int renderedShadowEntities = 0;
|
||||
protected int renderedShadowBlockEntities = 0;
|
||||
|
||||
public CommonShadowRenderer(ProgramSource shadow, PackDirectives directives, ShadowRenderTargets shadowRenderTargets, boolean separateHardwareSamplers) {
|
||||
|
||||
this.separateHardwareSamplers = separateHardwareSamplers;
|
||||
final PackShadowDirectives shadowDirectives = directives.getShadowDirectives();
|
||||
this.halfPlaneLength = shadowDirectives.getDistance();
|
||||
this.nearPlane = shadowDirectives.getNearPlane();
|
||||
this.farPlane = shadowDirectives.getFarPlane();
|
||||
|
||||
this.voxelDistance = shadowDirectives.getVoxelDistance();
|
||||
this.renderDistanceMultiplier = shadowDirectives.getDistanceRenderMul();
|
||||
this.entityShadowDistanceMultiplier = shadowDirectives.getEntityShadowDistanceMul();
|
||||
|
||||
this.resolution = shadowDirectives.getResolution();
|
||||
this.intervalSize = shadowDirectives.getIntervalSize();
|
||||
this.shouldRenderTerrain = shadowDirectives.shouldRenderTerrain();
|
||||
this.shouldRenderTranslucent = shadowDirectives.shouldRenderTranslucent();
|
||||
this.shouldRenderEntities = shadowDirectives.shouldRenderEntities();
|
||||
this.shouldRenderPlayer = shadowDirectives.shouldRenderPlayer();
|
||||
this.shouldRenderBlockEntities = shadowDirectives.shouldRenderBlockEntities();
|
||||
this.shouldRenderLightBlockEntities = shadowDirectives.shouldRenderLightBlockEntities();
|
||||
this.shouldRenderDH = shadowDirectives.isDhShadowEnabled().orElse(false);
|
||||
|
||||
this.fov = shadowDirectives.getFov();
|
||||
|
||||
if (shadow != null) {
|
||||
// Assume that the shader pack is doing voxelization if a geometry shader is detected.
|
||||
// Also assume voxelization if image load / store is detected.
|
||||
this.packHasVoxelization = shadow.getGeometrySource().isPresent();
|
||||
this.packCullingState = shadowDirectives.getCullingState();
|
||||
} else {
|
||||
this.packHasVoxelization = false;
|
||||
this.packCullingState = ShadowCullState.DEFAULT;
|
||||
}
|
||||
|
||||
debugStringOverall = "half plane = " + halfPlaneLength + " meters @ " + resolution + "x" + resolution;
|
||||
|
||||
|
||||
this.sunPathRotation = directives.getSunPathRotation();
|
||||
this.targets = shadowRenderTargets;
|
||||
}
|
||||
|
||||
|
||||
protected abstract String getEntitiesDebugString();
|
||||
protected abstract String getBlockEntitiesDebugString();
|
||||
}
|
||||
File renamed without changes.
+2
-2
@@ -2,10 +2,10 @@ package net.irisshaders.iris.shadows;
|
||||
|
||||
public class ShadowRenderingState {
|
||||
public static boolean areShadowsCurrentlyBeingRendered() {
|
||||
return ShadowRenderer.ACTIVE;
|
||||
return CommonShadowRenderer.ACTIVE;
|
||||
}
|
||||
|
||||
public static int getRenderDistance() {
|
||||
return ShadowRenderer.renderDistance;
|
||||
return CommonShadowRenderer.renderDistance;
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package net.irisshaders.iris.shadows.frustum;
|
||||
|
||||
public abstract class CommonFrustumHolder {
|
||||
protected String distanceInfo = "(unavailable)";
|
||||
protected String cullingInfo = "(unavailable)";
|
||||
|
||||
public String getDistanceInfo() {
|
||||
return distanceInfo;
|
||||
}
|
||||
|
||||
public String getCullingInfo() {
|
||||
return cullingInfo;
|
||||
}
|
||||
|
||||
protected void setInfo(String distanceInfo, String cullingInfo) {
|
||||
this.distanceInfo = distanceInfo;
|
||||
this.cullingInfo = cullingInfo;
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
@@ -30,7 +30,7 @@ import com.seibel.distanthorizons.coreapi.DependencyInjection.OverrideInjector;
|
||||
import net.irisshaders.iris.Iris;
|
||||
import net.irisshaders.iris.IrisCommon;
|
||||
import net.irisshaders.iris.pipeline.WorldRenderingPipeline;
|
||||
import net.irisshaders.iris.shadows.ShadowRenderer;
|
||||
import net.irisshaders.iris.shadows.ModernShadowRenderer;
|
||||
import net.irisshaders.iris.shadows.ShadowRenderingState;
|
||||
import net.irisshaders.iris.uniforms.CapturedRenderingState;
|
||||
import org.joml.Matrix4f;
|
||||
@@ -240,7 +240,7 @@ public class LodRendererEvents {
|
||||
public void beforeSetup(DhApiEventParam<DhApiRenderParam> event) {
|
||||
DHCompatInternal instance = getInstance();
|
||||
|
||||
OverrideInjector.INSTANCE.unbind(IDhApiShadowCullingFrustum.class, (IDhApiOverrideable) ShadowRenderer.FRUSTUM);
|
||||
OverrideInjector.INSTANCE.unbind(IDhApiShadowCullingFrustum.class, (IDhApiOverrideable) ModernShadowRenderer.FRUSTUM);
|
||||
OverrideInjector.INSTANCE.unbind(IDhApiFramebuffer.class, instance.getShadowFBWrapper());
|
||||
OverrideInjector.INSTANCE.unbind(IDhApiFramebuffer.class, instance.getSolidFBWrapper());
|
||||
OverrideInjector.INSTANCE.unbind(IDhApiGenericObjectShaderProgram.class, instance.getGenericShader());
|
||||
@@ -252,7 +252,7 @@ public class LodRendererEvents {
|
||||
|
||||
if (ShadowRenderingState.areShadowsCurrentlyBeingRendered() && instance.shouldOverrideShadow) {
|
||||
OverrideInjector.INSTANCE.bind(IDhApiFramebuffer.class, instance.getShadowFBWrapper());
|
||||
OverrideInjector.INSTANCE.bind(IDhApiShadowCullingFrustum.class, (IDhApiOverrideable) ShadowRenderer.FRUSTUM);
|
||||
OverrideInjector.INSTANCE.bind(IDhApiShadowCullingFrustum.class, (IDhApiOverrideable) ModernShadowRenderer.FRUSTUM);
|
||||
} else {
|
||||
OverrideInjector.INSTANCE.bind(IDhApiFramebuffer.class, instance.getSolidFBWrapper());
|
||||
}
|
||||
@@ -303,7 +303,7 @@ public class LodRendererEvents {
|
||||
if (instance.shouldOverride) {
|
||||
if (ShadowRenderingState.areShadowsCurrentlyBeingRendered()) {
|
||||
instance.getShadowShader().fillUniformData(
|
||||
ShadowRenderer.PROJECTION, ShadowRenderer.MODELVIEW,
|
||||
ModernShadowRenderer.PROJECTION, ModernShadowRenderer.MODELVIEW,
|
||||
-1000, //MC.getWrappedClientLevel().getMinHeight(),
|
||||
partialTicks);
|
||||
} else {
|
||||
@@ -372,7 +372,7 @@ public class LodRendererEvents {
|
||||
if (Iris.isPackInUseQuick()) {
|
||||
DHCompatInternal instance = getInstance();
|
||||
|
||||
OverrideInjector.INSTANCE.unbind(IDhApiShadowCullingFrustum.class, (IDhApiOverrideable) ShadowRenderer.FRUSTUM);
|
||||
OverrideInjector.INSTANCE.unbind(IDhApiShadowCullingFrustum.class, (IDhApiOverrideable) ModernShadowRenderer.FRUSTUM);
|
||||
OverrideInjector.INSTANCE.unbind(IDhApiFramebuffer.class, instance.getShadowFBWrapper());
|
||||
OverrideInjector.INSTANCE.unbind(IDhApiFramebuffer.class, instance.getSolidFBWrapper());
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import net.irisshaders.iris.pipeline.WorldRenderingPipeline;
|
||||
import net.irisshaders.iris.pipeline.programs.ExtendedShader;
|
||||
import net.irisshaders.iris.pipeline.programs.FallbackShader;
|
||||
import net.irisshaders.iris.pipeline.programs.ShaderInstanceInterface;
|
||||
import net.irisshaders.iris.shadows.ShadowRenderer;
|
||||
import net.irisshaders.iris.shadows.ModernShadowRenderer;
|
||||
import net.minecraft.client.Minecraft;
|
||||
//? if >=1.21.2
|
||||
/*import net.minecraft.client.renderer.CompiledShaderProgram;*/
|
||||
@@ -133,7 +133,7 @@ public abstract class MixinShaderInstance implements ShaderInstanceInterface {
|
||||
public boolean iris$shouldSkipThis() {
|
||||
// Celeritas always allows unknown shaders
|
||||
if (!IrisCommon.getIrisConfig().isBlockUnknownShaders()) {
|
||||
if (ShadowRenderer.ACTIVE) return true;
|
||||
if (ModernShadowRenderer.ACTIVE) return true;
|
||||
if (!shouldOverrideShaders()) return false;
|
||||
if (shouldSkip == NONE) return false;
|
||||
if (shouldSkip == ALWAYS) return true;
|
||||
@@ -153,7 +153,7 @@ public abstract class MixinShaderInstance implements ShaderInstanceInterface {
|
||||
if (!isKnownShader() && shouldOverrideShaders()) {
|
||||
WorldRenderingPipeline pipeline = Iris.getPipelineManager().getPipelineNullable();
|
||||
if (pipeline instanceof ModernIrisRenderingPipeline) {
|
||||
if (ShadowRenderer.ACTIVE) {
|
||||
if (ModernShadowRenderer.ACTIVE) {
|
||||
// Fallback shadow rendering is disabled by Iris rn
|
||||
//((IrisRenderingPipeline) pipeline).bindDefaultShadow();
|
||||
} else {
|
||||
|
||||
+19
-16
@@ -14,12 +14,11 @@ import org.lwjgl.system.MemoryStack;
|
||||
/**
|
||||
* Renders a full-screen textured quad to the screen. Used in composite / deferred rendering.
|
||||
*/
|
||||
public class FullScreenQuadRenderer {
|
||||
public static final FullScreenQuadRenderer INSTANCE = new FullScreenQuadRenderer();
|
||||
public class ModernFullScreenQuadRenderer implements FullScreenQuadRenderer {
|
||||
|
||||
private final VertexBuffer quad;
|
||||
private final VertexBuffer quad;
|
||||
|
||||
private FullScreenQuadRenderer() {
|
||||
public ModernFullScreenQuadRenderer() {
|
||||
quad = BufferHelper.makeStaticBuffer(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX, consumer -> {
|
||||
try (MemoryStack stack = MemoryStack.stackPush()) {
|
||||
long ptr = stack.nmalloc(TexturedVertex.STRIDE * 4);
|
||||
@@ -32,7 +31,8 @@ public class FullScreenQuadRenderer {
|
||||
});
|
||||
}
|
||||
|
||||
public void render() {
|
||||
@Override
|
||||
public void render() {
|
||||
begin();
|
||||
|
||||
renderQuad();
|
||||
@@ -40,27 +40,30 @@ public class FullScreenQuadRenderer {
|
||||
end();
|
||||
}
|
||||
|
||||
public void begin() {
|
||||
@Override
|
||||
public void begin() {
|
||||
((VertexBufferHelper) quad).saveBinding();
|
||||
RENDER_SYSTEM.disableDepthTest();
|
||||
BufferUploader.reset();
|
||||
quad.bind();
|
||||
}
|
||||
|
||||
public void renderQuad() {
|
||||
@Override
|
||||
public void renderQuad() {
|
||||
IrisRenderSystem.overridePolygonMode();
|
||||
quad.draw();
|
||||
IrisRenderSystem.restorePolygonMode();
|
||||
}
|
||||
|
||||
public void end() {
|
||||
// NB: No need to clear the buffer state by calling glDisableVertexAttribArray - this VAO will always
|
||||
// have the same format, and buffer state is only associated with a given VAO, so we can keep it bound.
|
||||
//
|
||||
// Using quad.getFormat().clearBufferState() causes some Intel drivers to freak out:
|
||||
// https://github.com/IrisShaders/Iris/issues/1214
|
||||
@Override
|
||||
public void end() {
|
||||
// NB: No need to clear the buffer state by calling glDisableVertexAttribArray - this VAO will always
|
||||
// have the same format, and buffer state is only associated with a given VAO, so we can keep it bound.
|
||||
//
|
||||
// Using quad.getFormat().clearBufferState() causes some Intel drivers to freak out:
|
||||
// https://github.com/IrisShaders/Iris/issues/1214
|
||||
|
||||
RENDER_SYSTEM.enableDepthTest();
|
||||
((VertexBufferHelper) quad).restoreBinding();
|
||||
}
|
||||
RENDER_SYSTEM.enableDepthTest();
|
||||
((VertexBufferHelper) quad).restoreBinding();
|
||||
}
|
||||
}
|
||||
+7
-1
@@ -39,7 +39,7 @@ import org.apache.commons.io.FilenameUtils;
|
||||
import org.embeddedt.embeddium.compat.mc.MCAbstractTexture;
|
||||
import org.embeddedt.embeddium.impl.util.ResourceLocationUtil;
|
||||
|
||||
public class CustomTextureManager {
|
||||
public class CustomTextureManager extends CommonCustomTextureManager {
|
||||
private final EnumMap<TextureStage, Object2ObjectMap<String, TextureAccess>> customTextureIdMap = new EnumMap<>(TextureStage.class);
|
||||
private final Object2ObjectMap<String, TextureAccess> irisCustomTextures = new Object2ObjectOpenHashMap<>();
|
||||
private final TextureAccess noise;
|
||||
@@ -188,22 +188,28 @@ public class CustomTextureManager {
|
||||
throw new IllegalArgumentException("Don't know texture type!");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EnumMap<TextureStage, Object2ObjectMap<String, TextureAccess>> getCustomTextureIdMap() {
|
||||
return customTextureIdMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object2ObjectMap<String, TextureAccess> getCustomTextureIdMap(TextureStage stage) {
|
||||
return customTextureIdMap.getOrDefault(stage, Object2ObjectMaps.emptyMap());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object2ObjectMap<String, TextureAccess> getIrisCustomTextures() {
|
||||
return irisCustomTextures;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureAccess getNoiseTexture() {
|
||||
return noise;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
ownedTextures.forEach(AbstractTexture::close);
|
||||
ownedRawTextures.forEach(GlTexture::destroy);
|
||||
|
||||
+31
-191
@@ -17,7 +17,6 @@ import com.google.common.collect.ImmutableSet;
|
||||
import com.mojang.blaze3d.pipeline.RenderTarget;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.VertexFormat;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectMaps;
|
||||
import net.irisshaders.iris.IrisCommon;
|
||||
import net.irisshaders.iris.compat.dh.DHCompat;
|
||||
@@ -40,11 +39,9 @@ import net.irisshaders.iris.gl.state.FogMode;
|
||||
import net.irisshaders.iris.gl.state.ShaderAttributeInputs;
|
||||
import net.irisshaders.iris.gl.state.ShaderAttributeInputsBuilder;
|
||||
import net.irisshaders.iris.gl.texture.DepthBufferFormat;
|
||||
import net.irisshaders.iris.gl.texture.TextureType;
|
||||
import net.irisshaders.iris.gui.option.IrisVideoSettings;
|
||||
import net.irisshaders.iris.helpers.FakeChainedJsonException;
|
||||
import net.irisshaders.iris.helpers.OptionalBoolean;
|
||||
import net.irisshaders.iris.helpers.Tri;
|
||||
import net.irisshaders.iris.mixin.GlStateManagerAccessor;
|
||||
import net.irisshaders.iris.pathways.CenterDepthSampler;
|
||||
import net.irisshaders.iris.pathways.HorizonRenderer;
|
||||
@@ -59,7 +56,6 @@ import net.irisshaders.iris.samplers.IrisImages;
|
||||
import net.irisshaders.iris.samplers.IrisSamplers;
|
||||
import net.irisshaders.iris.shaderpack.FilledIndirectPointer;
|
||||
import net.irisshaders.iris.shaderpack.ImageInformation;
|
||||
import net.irisshaders.iris.shaderpack.ShaderPack;
|
||||
import net.irisshaders.iris.shaderpack.loading.ProgramId;
|
||||
import net.irisshaders.iris.shaderpack.materialmap.BlockMaterialMapping;
|
||||
import net.irisshaders.iris.shaderpack.materialmap.ModelTextureAnalyzer;
|
||||
@@ -70,14 +66,12 @@ import net.irisshaders.iris.shaderpack.programs.ProgramFallbackResolver;
|
||||
import net.irisshaders.iris.shaderpack.programs.ProgramSet;
|
||||
import net.irisshaders.iris.shaderpack.programs.ProgramSource;
|
||||
import net.irisshaders.iris.shaderpack.properties.CloudSetting;
|
||||
import net.irisshaders.iris.shaderpack.properties.PackDirectives;
|
||||
import net.irisshaders.iris.shaderpack.properties.PackShadowDirectives;
|
||||
import net.irisshaders.iris.shaderpack.properties.ParticleRenderingSettings;
|
||||
import net.irisshaders.iris.shaderpack.texture.TextureStage;
|
||||
import net.irisshaders.iris.shadows.ShadowCompositeRenderer;
|
||||
import net.irisshaders.iris.shadows.ShadowRenderTargets;
|
||||
import net.irisshaders.iris.shadows.ShadowRenderer;
|
||||
import net.irisshaders.iris.shadows.ShadowRenderingState;
|
||||
import net.irisshaders.iris.shadows.ModernShadowRenderer;
|
||||
import net.irisshaders.iris.targets.*;
|
||||
import net.irisshaders.iris.targets.backed.NativeImageBackedSingleColorTexture;
|
||||
import net.irisshaders.iris.texture.TextureInfoCache;
|
||||
@@ -96,7 +90,6 @@ import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.client.renderer.ShaderInstance;
|
||||
import net.minecraft.client.renderer.texture.AbstractTexture;
|
||||
import net.minecraft.client.renderer.texture.DynamicTexture;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.embeddedt.embeddium.compat.mc.ICamera;
|
||||
import org.embeddedt.embeddium.compat.mc.ILevelRenderer;
|
||||
import org.embeddedt.embeddium.impl.gl.debug.GLDebug;
|
||||
@@ -105,27 +98,23 @@ import org.joml.Vector3d;
|
||||
import org.joml.Vector4f;
|
||||
import org.lwjgl.opengl.*;
|
||||
|
||||
public class ModernIrisRenderingPipeline implements IrisRenderingPipeline, WorldRenderingPipeline, ShaderRenderingPipeline, RenderTargetStateListener {
|
||||
public class ModernIrisRenderingPipeline extends CommonIrisRenderingPipeline implements IrisRenderingPipeline, WorldRenderingPipeline, ShaderRenderingPipeline, RenderTargetStateListener {
|
||||
private final RenderTargets renderTargets;
|
||||
private final ShaderMap shaderMap;
|
||||
private final CustomUniforms customUniforms;
|
||||
private final ShadowCompositeRenderer shadowCompositeRenderer;
|
||||
private final Object2ObjectMap<Tri<String, TextureType, TextureStage>, String> customTextureMap;
|
||||
private final ComputeProgram[] setup;
|
||||
private final ShadowCompositeRenderer shadowCompositeRenderer;
|
||||
private final ComputeProgram[] setup;
|
||||
private final boolean separateHardwareSamplers;
|
||||
private final ProgramFallbackResolver resolver;
|
||||
private final Supplier<ShadowRenderTargets> shadowTargetsSupplier;
|
||||
private final Set<ShaderInstance> loadedShaders;
|
||||
private final Set<ShaderInstance> loadedShaders;
|
||||
private final CompositeRenderer beginRenderer;
|
||||
private final CompositeRenderer prepareRenderer;
|
||||
private final CompositeRenderer deferredRenderer;
|
||||
private final CompositeRenderer compositeRenderer;
|
||||
private final FinalPassRenderer finalPassRenderer;
|
||||
private final CustomTextureManager customTextureManager;
|
||||
private final DynamicTexture whitePixel;
|
||||
private final FrameUpdateNotifier updateNotifier;
|
||||
private final CenterDepthSampler centerDepthSampler;
|
||||
private final SodiumTerrainPipeline sodiumTerrainPipeline;
|
||||
private final DynamicTexture whitePixel;
|
||||
private final CenterDepthSampler centerDepthSampler;
|
||||
private final CustomTextureManager customTextureManager;
|
||||
private final SodiumTerrainPipeline sodiumTerrainPipeline;
|
||||
private final ColorSpaceConverter colorSpaceConverter;
|
||||
private final ImmutableSet<Integer> flippedBeforeShadow;
|
||||
private final ImmutableSet<Integer> flippedAfterPrepare;
|
||||
@@ -133,75 +122,24 @@ public class ModernIrisRenderingPipeline implements IrisRenderingPipeline, World
|
||||
private final HorizonRenderer horizonRenderer = new HorizonRenderer();
|
||||
@Nullable
|
||||
private final ComputeProgram[] shadowComputes;
|
||||
private final float sunPathRotation;
|
||||
private final boolean shouldRenderUnderwaterOverlay;
|
||||
private final boolean shouldRenderVignette;
|
||||
private final boolean shouldWriteRainAndSnowToDepthBuffer;
|
||||
private final boolean oldLighting;
|
||||
private final OptionalInt forcedShadowRenderDistanceChunks;
|
||||
private final boolean frustumCulling;
|
||||
private final boolean occlusionCulling;
|
||||
private final CloudSetting cloudSetting;
|
||||
private final boolean shouldRenderSun;
|
||||
private final boolean shouldRenderMoon;
|
||||
private final boolean allowConcurrentCompute;
|
||||
@Nullable
|
||||
private final ShadowRenderer shadowRenderer;
|
||||
private final int shadowMapResolution;
|
||||
private final ParticleRenderingSettings particleRenderingSettings;
|
||||
private final PackDirectives packDirectives;
|
||||
private final Set<GlImage> customImages;
|
||||
private final GlImage[] clearImages;
|
||||
private final ShaderPack pack;
|
||||
private final PackShadowDirectives shadowDirectives;
|
||||
private final DHCompat dhCompat;
|
||||
@Nullable
|
||||
private final ModernShadowRenderer shadowRenderer;
|
||||
private final ParticleRenderingSettings particleRenderingSettings;
|
||||
private final DHCompat dhCompat;
|
||||
private final int stackSize = 0;
|
||||
public boolean isBeforeTranslucent;
|
||||
private ShaderStorageBufferHolder shaderStorageBufferHolder;
|
||||
private ShadowRenderTargets shadowRenderTargets;
|
||||
private WorldRenderingPhase overridePhase = null;
|
||||
private WorldRenderingPhase phase = WorldRenderingPhase.NONE;
|
||||
private ImmutableList<ClearPass> clearPassesFull;
|
||||
private ImmutableList<ClearPass> clearPasses;
|
||||
private ImmutableList<ClearPass> shadowClearPasses;
|
||||
private ImmutableList<ClearPass> shadowClearPassesFull;
|
||||
private boolean destroyed = false;
|
||||
private boolean isRenderingWorld;
|
||||
private boolean isMainBound;
|
||||
private boolean shouldBindPBR;
|
||||
private int currentNormalTexture;
|
||||
private int currentSpecularTexture;
|
||||
private ColorSpace currentColorSpace;
|
||||
private CloudSetting dhCloudSetting;
|
||||
private CloudSetting dhCloudSetting;
|
||||
private boolean blockIdsNeedPopulation;
|
||||
private GlFramebuffer defaultFB;
|
||||
private GlFramebuffer defaultFBAlt;
|
||||
private GlFramebuffer defaultFBShadow;
|
||||
|
||||
|
||||
public ModernIrisRenderingPipeline(ProgramSet programSet) {
|
||||
super(programSet);
|
||||
ShaderPrinter.resetPrintState();
|
||||
|
||||
this.shouldRenderUnderwaterOverlay = programSet.getPackDirectives().underwaterOverlay();
|
||||
this.shouldRenderVignette = programSet.getPackDirectives().vignette();
|
||||
this.shouldWriteRainAndSnowToDepthBuffer = programSet.getPackDirectives().rainDepth();
|
||||
this.oldLighting = programSet.getPackDirectives().isOldLighting();
|
||||
this.updateNotifier = new FrameUpdateNotifier();
|
||||
this.packDirectives = programSet.getPackDirectives();
|
||||
this.customTextureMap = programSet.getPackDirectives().getTextureMap();
|
||||
this.separateHardwareSamplers = programSet.getPack().hasFeature(FeatureFlags.SEPARATE_HARDWARE_SAMPLERS);
|
||||
this.shadowDirectives = packDirectives.getShadowDirectives();
|
||||
this.cloudSetting = programSet.getPackDirectives().getCloudSetting();
|
||||
this.dhCloudSetting = programSet.getPackDirectives().getDHCloudSetting();
|
||||
this.shouldRenderSun = programSet.getPackDirectives().shouldRenderSun();
|
||||
this.shouldRenderMoon = programSet.getPackDirectives().shouldRenderMoon();
|
||||
this.allowConcurrentCompute = programSet.getPackDirectives().getConcurrentCompute();
|
||||
this.frustumCulling = programSet.getPackDirectives().shouldUseFrustumCulling();
|
||||
this.occlusionCulling = programSet.getPackDirectives().shouldUseOcclusionCulling();
|
||||
this.resolver = new ProgramFallbackResolver(programSet);
|
||||
this.pack = programSet.getPack();
|
||||
this.separateHardwareSamplers = programSet.getPack().hasFeature(FeatureFlags.SEPARATE_HARDWARE_SAMPLERS);
|
||||
this.dhCloudSetting = programSet.getPackDirectives().getDHCloudSetting();
|
||||
this.resolver = new ProgramFallbackResolver(programSet);
|
||||
|
||||
RenderTarget main = Minecraft.getInstance().getMainRenderTarget();
|
||||
RenderTarget main = Minecraft.getInstance().getMainRenderTarget();
|
||||
int depthTextureId = main.getDepthTextureId();
|
||||
int internalFormat = TextureInfoCache.INSTANCE.getInfo(depthTextureId).getInternalFormat();
|
||||
DepthBufferFormat depthBufferFormat = DepthBufferFormat.fromGlEnumOrDefault(internalFormat);
|
||||
@@ -220,8 +158,7 @@ public class ModernIrisRenderingPipeline implements IrisRenderingPipeline, World
|
||||
}
|
||||
}
|
||||
|
||||
this.customImages = new HashSet<>();
|
||||
for (ImageInformation information : programSet.getPack().getIrisCustomImages()) {
|
||||
for (ImageInformation information : programSet.getPack().getIrisCustomImages()) {
|
||||
if (information.isRelative()) {
|
||||
customImages.add(new GlImage.Relative(information.name(), information.samplerName(), information.format(), information.internalTextureFormat(), information.type(), information.clear(), information.relativeWidth(), information.relativeHeight(), main.width, main.height));
|
||||
} else {
|
||||
@@ -229,9 +166,7 @@ public class ModernIrisRenderingPipeline implements IrisRenderingPipeline, World
|
||||
}
|
||||
}
|
||||
|
||||
this.clearImages = customImages.stream().filter(GlImage::shouldClear).toArray(GlImage[]::new);
|
||||
|
||||
this.particleRenderingSettings = programSet.getPackDirectives().getParticleRenderingSettings().orElseGet(() -> {
|
||||
this.particleRenderingSettings = programSet.getPackDirectives().getParticleRenderingSettings().orElseGet(() -> {
|
||||
if (programSet.getDeferred().length > 0 && !programSet.getPackDirectives().shouldUseSeparateEntityDraws()) {
|
||||
return ParticleRenderingSettings.AFTER;
|
||||
} else {
|
||||
@@ -240,31 +175,16 @@ public class ModernIrisRenderingPipeline implements IrisRenderingPipeline, World
|
||||
});
|
||||
|
||||
this.renderTargets = new RenderTargets(main.width, main.height, depthTextureId, ((Blaze3dRenderTargetExt) main).iris$getDepthBufferVersion(), depthBufferFormat, programSet.getPackDirectives().getRenderTargetDirectives().getRenderTargetSettings(), programSet.getPackDirectives());
|
||||
this.sunPathRotation = programSet.getPackDirectives().getSunPathRotation();
|
||||
|
||||
PackShadowDirectives shadowDirectives = programSet.getPackDirectives().getShadowDirectives();
|
||||
PackShadowDirectives shadowDirectives = programSet.getPackDirectives().getShadowDirectives();
|
||||
|
||||
if (shadowDirectives.isDistanceRenderMulExplicit()) {
|
||||
if (shadowDirectives.getDistanceRenderMul() >= 0.0) {
|
||||
// add 15 and then divide by 16 to ensure we're rounding up
|
||||
forcedShadowRenderDistanceChunks =
|
||||
OptionalInt.of(((int) (shadowDirectives.getDistance() * shadowDirectives.getDistanceRenderMul()) + 15) / 16);
|
||||
} else {
|
||||
forcedShadowRenderDistanceChunks = OptionalInt.of(-1);
|
||||
}
|
||||
} else {
|
||||
forcedShadowRenderDistanceChunks = OptionalInt.empty();
|
||||
}
|
||||
|
||||
this.customUniforms = programSet.getPack().customUniforms.build(
|
||||
holder -> CommonUniforms.addNonDynamicUniforms(holder, programSet.getPack().getIdMap(), programSet.getPackDirectives(), this.updateNotifier)
|
||||
);
|
||||
|
||||
// Don't clobber anything in texture unit 0. It probably won't cause issues, but we're just being cautious here.
|
||||
GL_STATE_MANAGER.glActiveTexture(GL20C.GL_TEXTURE2);
|
||||
customTextureManager = new CustomTextureManager(programSet.getPackDirectives(), programSet.getPack().getCustomTextureDataMap(), programSet.getPack().getIrisCustomTextureDataMap(), programSet.getPack().getCustomNoiseTexture());
|
||||
|
||||
customTextureManager = new CustomTextureManager(programSet.getPackDirectives(), programSet.getPack().getCustomTextureDataMap(), programSet.getPack().getIrisCustomTextureDataMap(), programSet.getPack().getCustomNoiseTexture());
|
||||
whitePixel = new NativeImageBackedSingleColorTexture(255, 255, 255, 255);
|
||||
whitePixel = new NativeImageBackedSingleColorTexture(255, 255, 255, 255);
|
||||
|
||||
GL_STATE_MANAGER.glActiveTexture(GL20C.GL_TEXTURE0);
|
||||
|
||||
@@ -272,18 +192,8 @@ public class ModernIrisRenderingPipeline implements IrisRenderingPipeline, World
|
||||
|
||||
this.centerDepthSampler = new CenterDepthSampler(() -> renderTargets.getDepthTexture(), programSet.getPackDirectives().getCenterDepthHalfLife());
|
||||
|
||||
this.shadowMapResolution = programSet.getPackDirectives().getShadowDirectives().getResolution();
|
||||
|
||||
this.shadowTargetsSupplier = () -> {
|
||||
if (shadowRenderTargets == null) {
|
||||
// TODO: Support more than two shadowcolor render targets
|
||||
this.shadowRenderTargets = new ShadowRenderTargets(this, shadowMapResolution, shadowDirectives);
|
||||
}
|
||||
|
||||
return shadowRenderTargets;
|
||||
};
|
||||
|
||||
this.shadowComputes = createShadowComputes(programSet.getShadowCompute(), programSet);
|
||||
this.shadowComputes = createShadowComputes(programSet.getShadowCompute(), programSet);
|
||||
|
||||
this.beginRenderer = new CompositeRenderer(this, programSet.getPackDirectives(), programSet.getBegin(), programSet.getBeginCompute(), renderTargets, shaderStorageBufferHolder,
|
||||
customTextureManager.getNoiseTexture(), updateNotifier, centerDepthSampler, flipper, shadowTargetsSupplier, TextureStage.BEGIN,
|
||||
@@ -465,7 +375,7 @@ public class ModernIrisRenderingPipeline implements IrisRenderingPipeline, World
|
||||
customTextureManager.getCustomTextureIdMap(TextureStage.SHADOWCOMP), customImages, programSet.getPackDirectives().getExplicitFlips("shadowcomp_pre"), customTextureManager.getIrisCustomTextures(), customUniforms);
|
||||
|
||||
if (programSet.getPackDirectives().getShadowDirectives().isShadowEnabled().orElse(true)) {
|
||||
this.shadowRenderer = new ShadowRenderer(this, programSet.getShadow().orElse(null),
|
||||
this.shadowRenderer = new ModernShadowRenderer(this, programSet.getShadow().orElse(null),
|
||||
programSet.getPackDirectives(), shadowRenderTargets, shadowCompositeRenderer, customUniforms, programSet.getPack().hasFeature(FeatureFlags.SEPARATE_HARDWARE_SAMPLERS));
|
||||
} else {
|
||||
shadowRenderer = null;
|
||||
@@ -540,7 +450,6 @@ public class ModernIrisRenderingPipeline implements IrisRenderingPipeline, World
|
||||
//}
|
||||
}
|
||||
|
||||
currentColorSpace = IrisVideoSettings.colorSpace;
|
||||
int defaultTex = packDirectives.getFallbackTex();
|
||||
defaultFB = flippedAfterPrepare.contains(defaultTex) ? renderTargets.createFramebufferWritingToAlt(new int[] { defaultTex }) : renderTargets.createFramebufferWritingToMain(new int[] { defaultTex });
|
||||
defaultFBAlt = flippedAfterTranslucent.contains(defaultTex) ? renderTargets.createFramebufferWritingToAlt(new int[] { defaultTex }) : renderTargets.createFramebufferWritingToMain(new int[] { defaultTex });
|
||||
@@ -556,7 +465,7 @@ public class ModernIrisRenderingPipeline implements IrisRenderingPipeline, World
|
||||
ProgramBuilder builder;
|
||||
|
||||
try {
|
||||
String transformed = TransformPatcherBridge.patchCompute(source.getName(), source.getSource().orElse(null), TextureStage.GBUFFERS_AND_SHADOW, customTextureMap);
|
||||
String transformed = TransformPatcherBridge.patchCompute(source.getName(), source.getSource().orElse(null), TextureStage.GBUFFERS_AND_SHADOW, getTextureMap());
|
||||
|
||||
ShaderPrinter.printProgram(source.getName()).addSource(PatchShaderType.COMPUTE, transformed).print();
|
||||
|
||||
@@ -620,7 +529,7 @@ public class ModernIrisRenderingPipeline implements IrisRenderingPipeline, World
|
||||
ProgramBuilder builder;
|
||||
|
||||
try {
|
||||
String transformed = TransformPatcherBridge.patchCompute(source.getName(), source.getSource().orElse(null), stage, customTextureMap);
|
||||
String transformed = TransformPatcherBridge.patchCompute(source.getName(), source.getSource().orElse(null), stage, getTextureMap());
|
||||
|
||||
ShaderPrinter.printProgram(source.getName()).addSource(PatchShaderType.COMPUTE, transformed).print();
|
||||
|
||||
@@ -682,12 +591,7 @@ public class ModernIrisRenderingPipeline implements IrisRenderingPipeline, World
|
||||
key.isIntensity(), key.shouldIgnoreLightmap(), key.isGlint(), key.isText());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object2ObjectMap<Tri<String, TextureType, TextureStage>, String> getTextureMap() {
|
||||
return customTextureMap;
|
||||
}
|
||||
|
||||
private CompletableFuture<ShaderInstance> createShader(String name, Executor syncExecutor, ProgramSource source, ProgramId programId, AlphaTest fallbackAlpha,
|
||||
private CompletableFuture<ShaderInstance> createShader(String name, Executor syncExecutor, ProgramSource source, ProgramId programId, AlphaTest fallbackAlpha,
|
||||
VertexFormat vertexFormat, FogMode fogMode,
|
||||
boolean isIntensity, boolean isFullbright, boolean isGlint, boolean isText) throws IOException {
|
||||
GlFramebuffer beforeTranslucent = renderTargets.createGbufferFramebuffer(flippedAfterPrepare, source.getDirectives().getDrawBuffers());
|
||||
@@ -793,76 +697,12 @@ public class ModernIrisRenderingPipeline implements IrisRenderingPipeline, World
|
||||
}
|
||||
}
|
||||
|
||||
private boolean shouldRemovePhase = false;
|
||||
|
||||
@Override
|
||||
public WorldRenderingPhase getPhase() {
|
||||
if (shouldRemovePhase) {
|
||||
phase = WorldRenderingPhase.NONE;
|
||||
shouldRemovePhase = false;
|
||||
GLDebug.popGroup();
|
||||
}
|
||||
|
||||
if (overridePhase != null) {
|
||||
return overridePhase;
|
||||
}
|
||||
|
||||
return phase;
|
||||
}
|
||||
|
||||
public void removePhaseIfNeeded() {
|
||||
if (shouldRemovePhase) {
|
||||
phase = WorldRenderingPhase.NONE;
|
||||
shouldRemovePhase = false;
|
||||
GLDebug.popGroup();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPhase(WorldRenderingPhase phase) {
|
||||
if (phase == WorldRenderingPhase.NONE) {
|
||||
if (shouldRemovePhase) GLDebug.popGroup();
|
||||
shouldRemovePhase = true;
|
||||
return;
|
||||
} else {
|
||||
shouldRemovePhase = false;
|
||||
if (phase == this.phase) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
GLDebug.popGroup();
|
||||
if (phase != WorldRenderingPhase.NONE && phase != WorldRenderingPhase.TERRAIN_CUTOUT && phase != WorldRenderingPhase.TERRAIN_CUTOUT_MIPPED && phase != WorldRenderingPhase.TRIPWIRE) {
|
||||
if (ShadowRenderingState.areShadowsCurrentlyBeingRendered()) {
|
||||
GLDebug.pushGroup(phase.ordinal(), "Shadow " + StringUtils.capitalize(phase.name().toLowerCase(Locale.ROOT).replace("_", " ")));
|
||||
} else {
|
||||
GLDebug.pushGroup(phase.ordinal(), StringUtils.capitalize(phase.name().toLowerCase(Locale.ROOT).replace("_", " ")));
|
||||
}
|
||||
}
|
||||
this.phase = phase;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOverridePhase(WorldRenderingPhase phase) {
|
||||
this.overridePhase = phase;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public RenderTargetStateListener getRenderTargetStateListener() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCurrentNormalTexture() {
|
||||
return currentNormalTexture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCurrentSpecularTexture() {
|
||||
return currentSpecularTexture;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void onSetShaderTexture(int id) {
|
||||
if (shouldBindPBR && isRenderingWorld) {
|
||||
PBRTextureHolder pbrHolder = PBRTextureManager.INSTANCE.getOrLoadHolder(id);
|
||||
|
||||
+14
-72
@@ -61,92 +61,32 @@ import org.lwjgl.opengl.ARBTextureSwizzle;
|
||||
import org.lwjgl.opengl.GL20C;
|
||||
import org.lwjgl.opengl.GL30C;
|
||||
|
||||
public class ShadowRenderer {
|
||||
public static boolean ACTIVE = false;
|
||||
public static List<BlockEntity> visibleBlockEntities;
|
||||
public static int renderDistance;
|
||||
public static Matrix4f MODELVIEW;
|
||||
public static Matrix4f PROJECTION;
|
||||
public static Frustum FRUSTUM;
|
||||
private final float halfPlaneLength;
|
||||
private final float nearPlane, farPlane;
|
||||
private final float voxelDistance;
|
||||
private final float renderDistanceMultiplier;
|
||||
private final float entityShadowDistanceMultiplier;
|
||||
private final int resolution;
|
||||
private final float intervalSize;
|
||||
private final Float fov;
|
||||
private final ShadowRenderTargets targets;
|
||||
private final ShadowCullState packCullingState;
|
||||
private final ShadowCompositeRenderer compositeRenderer;
|
||||
public class ModernShadowRenderer extends CommonShadowRenderer {
|
||||
public static List<BlockEntity> visibleBlockEntities;
|
||||
public static Frustum FRUSTUM;
|
||||
private final ShadowCompositeRenderer compositeRenderer;
|
||||
private final ModernIrisRenderingPipeline pipeline;
|
||||
private final boolean shouldRenderTerrain;
|
||||
private final boolean shouldRenderTranslucent;
|
||||
private final boolean shouldRenderEntities;
|
||||
private final boolean shouldRenderPlayer;
|
||||
private final boolean shouldRenderBlockEntities;
|
||||
private final boolean shouldRenderDH;
|
||||
private final float sunPathRotation;
|
||||
private final RenderBuffers buffers;
|
||||
private final RenderBuffers buffers;
|
||||
private final RenderBuffersExt renderBuffersExt;
|
||||
private final List<MipmapPass> mipmapPasses = new ArrayList<>();
|
||||
private final String debugStringOverall;
|
||||
private final boolean separateHardwareSamplers;
|
||||
private final boolean shouldRenderLightBlockEntities;
|
||||
private boolean packHasVoxelization;
|
||||
private FrustumHolder terrainFrustumHolder;
|
||||
private FrustumHolder entityFrustumHolder;
|
||||
private String debugStringTerrain = "(unavailable)";
|
||||
private int renderedShadowEntities = 0;
|
||||
private int renderedShadowBlockEntities = 0;
|
||||
|
||||
public ShadowRenderer(ModernIrisRenderingPipeline pipeline, ProgramSource shadow, PackDirectives directives,
|
||||
private FrustumHolder terrainFrustumHolder;
|
||||
private FrustumHolder entityFrustumHolder;
|
||||
|
||||
public ModernShadowRenderer(ModernIrisRenderingPipeline pipeline, ProgramSource shadow, PackDirectives directives,
|
||||
ShadowRenderTargets shadowRenderTargets, ShadowCompositeRenderer compositeRenderer, CustomUniforms customUniforms, boolean separateHardwareSamplers) {
|
||||
super(shadow, directives, shadowRenderTargets, separateHardwareSamplers);
|
||||
|
||||
this.pipeline = pipeline;
|
||||
this.separateHardwareSamplers = separateHardwareSamplers;
|
||||
|
||||
final PackShadowDirectives shadowDirectives = directives.getShadowDirectives();
|
||||
|
||||
this.halfPlaneLength = shadowDirectives.getDistance();
|
||||
this.nearPlane = shadowDirectives.getNearPlane();
|
||||
this.farPlane = shadowDirectives.getFarPlane();
|
||||
|
||||
this.voxelDistance = shadowDirectives.getVoxelDistance();
|
||||
this.renderDistanceMultiplier = shadowDirectives.getDistanceRenderMul();
|
||||
this.entityShadowDistanceMultiplier = shadowDirectives.getEntityShadowDistanceMul();
|
||||
this.resolution = shadowDirectives.getResolution();
|
||||
this.intervalSize = shadowDirectives.getIntervalSize();
|
||||
this.shouldRenderTerrain = shadowDirectives.shouldRenderTerrain();
|
||||
this.shouldRenderTranslucent = shadowDirectives.shouldRenderTranslucent();
|
||||
this.shouldRenderEntities = shadowDirectives.shouldRenderEntities();
|
||||
this.shouldRenderPlayer = shadowDirectives.shouldRenderPlayer();
|
||||
this.shouldRenderBlockEntities = shadowDirectives.shouldRenderBlockEntities();
|
||||
this.shouldRenderLightBlockEntities = shadowDirectives.shouldRenderLightBlockEntities();
|
||||
this.shouldRenderDH = shadowDirectives.isDhShadowEnabled().orElse(false);
|
||||
|
||||
this.compositeRenderer = compositeRenderer;
|
||||
|
||||
debugStringOverall = "half plane = " + halfPlaneLength + " meters @ " + resolution + "x" + resolution;
|
||||
|
||||
this.terrainFrustumHolder = new FrustumHolder();
|
||||
this.entityFrustumHolder = new FrustumHolder();
|
||||
|
||||
this.fov = shadowDirectives.getFov();
|
||||
this.targets = shadowRenderTargets;
|
||||
|
||||
if (shadow != null) {
|
||||
// Assume that the shader pack is doing voxelization if a geometry shader is detected.
|
||||
// Also assume voxelization if image load / store is detected.
|
||||
this.packHasVoxelization = shadow.getGeometrySource().isPresent();
|
||||
this.packCullingState = shadowDirectives.getCullingState();
|
||||
} else {
|
||||
this.packHasVoxelization = false;
|
||||
this.packCullingState = ShadowCullState.DEFAULT;
|
||||
}
|
||||
|
||||
this.sunPathRotation = directives.getSunPathRotation();
|
||||
|
||||
int processors = Runtime.getRuntime().availableProcessors();
|
||||
int threads = processors;
|
||||
this.buffers = new RenderBuffers(/*? if >=1.20.4 {*//*threads*//*?}*/);
|
||||
@@ -737,11 +677,13 @@ public class ShadowRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
private String getEntitiesDebugString() {
|
||||
@Override
|
||||
protected String getEntitiesDebugString() {
|
||||
return (shouldRenderEntities || shouldRenderPlayer) ? (renderedShadowEntities + "/" + Minecraft.getInstance().level.getEntityCount()) : "disabled by pack";
|
||||
}
|
||||
|
||||
private String getBlockEntitiesDebugString() {
|
||||
@Override
|
||||
protected String getBlockEntitiesDebugString() {
|
||||
return (shouldRenderBlockEntities || shouldRenderLightBlockEntities) ? renderedShadowBlockEntities + "" : "disabled by pack"; // TODO: + "/" + MinecraftClient.getInstance().world.blockEntities.size();
|
||||
}
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ import org.lwjgl.opengl.GL20C;
|
||||
import org.lwjgl.opengl.GL30C;
|
||||
import org.lwjgl.opengl.GL43C;
|
||||
|
||||
public class ShadowCompositeRenderer {
|
||||
public class ShadowCompositeRenderer extends CommonShadowCompositeRenderer {
|
||||
private final ShadowRenderTargets renderTargets;
|
||||
|
||||
private final ImmutableList<Pass> passes;
|
||||
|
||||
+3
-13
@@ -2,15 +2,12 @@ package net.irisshaders.iris.shadows.frustum;
|
||||
|
||||
import net.minecraft.client.renderer.culling.Frustum;
|
||||
|
||||
public class FrustumHolder {
|
||||
public class FrustumHolder extends CommonFrustumHolder {
|
||||
private Frustum frustum;
|
||||
private String distanceInfo = "(unavailable)";
|
||||
private String cullingInfo = "(unavailable)";
|
||||
|
||||
public FrustumHolder setInfo(Frustum frustum, String distanceInfo, String cullingInfo) {
|
||||
public FrustumHolder setInfo(Frustum frustum, String distanceInfo, String cullingInfo) {
|
||||
super.setInfo(distanceInfo, cullingInfo);
|
||||
this.frustum = frustum;
|
||||
this.distanceInfo = distanceInfo;
|
||||
this.cullingInfo = cullingInfo;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -18,11 +15,4 @@ public class FrustumHolder {
|
||||
return frustum;
|
||||
}
|
||||
|
||||
public String getDistanceInfo() {
|
||||
return distanceInfo;
|
||||
}
|
||||
|
||||
public String getCullingInfo() {
|
||||
return cullingInfo;
|
||||
}
|
||||
}
|
||||
+26
-26
@@ -8,7 +8,7 @@ import net.irisshaders.iris.pipeline.ShaderRenderingPipeline;
|
||||
import net.irisshaders.iris.pipeline.WorldRenderingPhase;
|
||||
import net.irisshaders.iris.pipeline.WorldRenderingPipeline;
|
||||
import net.irisshaders.iris.pipeline.programs.ShaderKey;
|
||||
import net.irisshaders.iris.shadows.ShadowRenderer;
|
||||
import net.irisshaders.iris.shadows.ModernShadowRenderer;
|
||||
import net.minecraft.client.renderer.ShaderInstance;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@@ -53,7 +53,7 @@ public class ShaderOverrideEngine {
|
||||
iris$overrides.put("position", () -> {
|
||||
if (isSky()) {
|
||||
return iris$findOverride(ShaderKey.SKY_BASIC);
|
||||
} else if (ShadowRenderer.ACTIVE) {
|
||||
} else if (ModernShadowRenderer.ACTIVE) {
|
||||
return iris$findOverride(ShaderKey.SHADOW_BASIC);
|
||||
} else if (shouldOverrideShaders()) {
|
||||
return iris$findOverride(ShaderKey.BASIC);
|
||||
@@ -64,7 +64,7 @@ public class ShaderOverrideEngine {
|
||||
iris$overrides.put("position_color", () -> {
|
||||
if (isSky()) {
|
||||
return iris$findOverride(ShaderKey.SKY_BASIC_COLOR);
|
||||
} else if (ShadowRenderer.ACTIVE) {
|
||||
} else if (ModernShadowRenderer.ACTIVE) {
|
||||
return iris$findOverride(ShaderKey.SHADOW_BASIC_COLOR);
|
||||
} else if (shouldOverrideShaders()) {
|
||||
return iris$findOverride(ShaderKey.BASIC_COLOR);
|
||||
@@ -75,7 +75,7 @@ public class ShaderOverrideEngine {
|
||||
iris$overrides.put("position_tex", () -> {
|
||||
if (isSky()) {
|
||||
return iris$findOverride(ShaderKey.SKY_TEXTURED);
|
||||
} else if (ShadowRenderer.ACTIVE) {
|
||||
} else if (ModernShadowRenderer.ACTIVE) {
|
||||
return iris$findOverride(ShaderKey.SHADOW_TEX);
|
||||
} else if (shouldOverrideShaders()) {
|
||||
return iris$findOverride(ShaderKey.TEXTURED);
|
||||
@@ -86,7 +86,7 @@ public class ShaderOverrideEngine {
|
||||
Supplier<ShaderInstance> positionTexColor = () -> {
|
||||
if (isSky()) {
|
||||
return iris$findOverride(ShaderKey.SKY_TEXTURED_COLOR);
|
||||
} else if (ShadowRenderer.ACTIVE) {
|
||||
} else if (ModernShadowRenderer.ACTIVE) {
|
||||
return iris$findOverride(ShaderKey.SHADOW_TEX_COLOR);
|
||||
} else if (shouldOverrideShaders()) {
|
||||
return iris$findOverride(ShaderKey.TEXTURED_COLOR);
|
||||
@@ -99,7 +99,7 @@ public class ShaderOverrideEngine {
|
||||
iris$overrides.put("particle", () -> {
|
||||
if (isPhase(WorldRenderingPhase.RAIN_SNOW)) {
|
||||
return iris$findOverride(ShaderKey.WEATHER);
|
||||
} else if (ShadowRenderer.ACTIVE) {
|
||||
} else if (ModernShadowRenderer.ACTIVE) {
|
||||
return iris$findOverride(ShaderKey.SHADOW_PARTICLES);
|
||||
} else if (shouldOverrideShaders()) {
|
||||
return iris$findOverride(ShaderKey.PARTICLES);
|
||||
@@ -108,7 +108,7 @@ public class ShaderOverrideEngine {
|
||||
}
|
||||
});
|
||||
Supplier<ShaderInstance> cloudsShader = () -> {
|
||||
if (ShadowRenderer.ACTIVE) {
|
||||
if (ModernShadowRenderer.ACTIVE) {
|
||||
return iris$findOverride(ShaderKey.SHADOW_CLOUDS);
|
||||
} else if (shouldOverrideShaders()) {
|
||||
return iris$findOverride(ShaderKey.CLOUDS);
|
||||
@@ -119,7 +119,7 @@ public class ShaderOverrideEngine {
|
||||
iris$overrides.put("rendertype_clouds", cloudsShader);
|
||||
iris$overrides.put("position_tex_color_normal", cloudsShader);
|
||||
iris$overrides.put("rendertype_solid", () -> {
|
||||
if (ShadowRenderer.ACTIVE) {
|
||||
if (ModernShadowRenderer.ACTIVE) {
|
||||
return iris$findOverride(ShaderKey.SHADOW_TERRAIN_CUTOUT);
|
||||
} else if (isBlockEntities() || isEntities()) {
|
||||
return iris$findOverride(ShaderKey.MOVING_BLOCK);
|
||||
@@ -130,7 +130,7 @@ public class ShaderOverrideEngine {
|
||||
}
|
||||
});
|
||||
Supplier<ShaderInstance> cutout = () -> {
|
||||
if (ShadowRenderer.ACTIVE) {
|
||||
if (ModernShadowRenderer.ACTIVE) {
|
||||
return iris$findOverride(ShaderKey.SHADOW_TERRAIN_CUTOUT);
|
||||
} else if (isBlockEntities() || isEntities()) {
|
||||
return iris$findOverride(ShaderKey.MOVING_BLOCK);
|
||||
@@ -143,7 +143,7 @@ public class ShaderOverrideEngine {
|
||||
iris$overrides.put("rendertype_cutout", cutout);
|
||||
iris$overrides.put("rendertype_cutout_mipped", cutout);
|
||||
Supplier<ShaderInstance> translucentShader = () -> {
|
||||
if (ShadowRenderer.ACTIVE) {
|
||||
if (ModernShadowRenderer.ACTIVE) {
|
||||
return iris$findOverride(ShaderKey.SHADOW_TERRAIN_CUTOUT);
|
||||
} else if (isBlockEntities() || isEntities()) {
|
||||
return iris$findOverride(ShaderKey.MOVING_BLOCK);
|
||||
@@ -158,7 +158,7 @@ public class ShaderOverrideEngine {
|
||||
iris$overrides.put("rendertype_translucent_moving_block", translucentShader);
|
||||
iris$overrides.put("rendertype_tripwire", translucentShader);
|
||||
Supplier<ShaderInstance> entityCutout = () -> {
|
||||
if (ShadowRenderer.ACTIVE) {
|
||||
if (ModernShadowRenderer.ACTIVE) {
|
||||
return iris$findOverride(ShaderKey.SHADOW_ENTITIES_CUTOUT);
|
||||
} else if (HandRenderer.INSTANCE.isActive()) {
|
||||
return iris$findOverride(HandRenderer.INSTANCE.isRenderingSolid() ? ShaderKey.HAND_CUTOUT_DIFFUSE : ShaderKey.HAND_WATER_DIFFUSE);
|
||||
@@ -177,7 +177,7 @@ public class ShaderOverrideEngine {
|
||||
iris$overrides.put("rendertype_entity_smooth_cutout", entityCutout);
|
||||
iris$overrides.put("rendertype_armor_cutout_no_cull", entityCutout);
|
||||
Supplier<ShaderInstance> entityTranslucent = () -> {
|
||||
if (ShadowRenderer.ACTIVE) {
|
||||
if (ModernShadowRenderer.ACTIVE) {
|
||||
return iris$findOverride(ShaderKey.SHADOW_ENTITIES_CUTOUT);
|
||||
} else if (HandRenderer.INSTANCE.isActive()) {
|
||||
return iris$findOverride(HandRenderer.INSTANCE.isRenderingSolid() ? ShaderKey.HAND_CUTOUT_DIFFUSE : ShaderKey.HAND_WATER_DIFFUSE);
|
||||
@@ -195,7 +195,7 @@ public class ShaderOverrideEngine {
|
||||
iris$overrides.put("rendertype_breeze_wind", entityTranslucent);
|
||||
iris$overrides.put("rendertype_entity_no_outline", entityTranslucent);
|
||||
Supplier<ShaderInstance> energySwirlAndShadow = () -> {
|
||||
if (ShadowRenderer.ACTIVE) {
|
||||
if (ModernShadowRenderer.ACTIVE) {
|
||||
return iris$findOverride(ShaderKey.SHADOW_ENTITIES_CUTOUT);
|
||||
} else if (HandRenderer.INSTANCE.isActive()) {
|
||||
return iris$findOverride(HandRenderer.INSTANCE.isRenderingSolid() ? ShaderKey.HAND_CUTOUT : ShaderKey.HAND_TRANSLUCENT);
|
||||
@@ -224,7 +224,7 @@ public class ShaderOverrideEngine {
|
||||
iris$overrides.put("rendertype_entity_glint", glint);
|
||||
iris$overrides.put("rendertype_armor_entity_glint", glint);
|
||||
Supplier<ShaderInstance> entitySolid = () -> {
|
||||
if (ShadowRenderer.ACTIVE) {
|
||||
if (ModernShadowRenderer.ACTIVE) {
|
||||
return iris$findOverride(ShaderKey.SHADOW_ENTITIES_CUTOUT);
|
||||
} else if (HandRenderer.INSTANCE.isActive()) {
|
||||
return iris$findOverride(HandRenderer.INSTANCE.isRenderingSolid() ? ShaderKey.HAND_CUTOUT_DIFFUSE : ShaderKey.HAND_WATER_DIFFUSE);
|
||||
@@ -238,7 +238,7 @@ public class ShaderOverrideEngine {
|
||||
};
|
||||
iris$overrides.put("rendertype_entity_solid", entitySolid);
|
||||
Supplier<ShaderInstance> waterMask = () -> {
|
||||
if (ShadowRenderer.ACTIVE) {
|
||||
if (ModernShadowRenderer.ACTIVE) {
|
||||
return iris$findOverride(ShaderKey.SHADOW_ENTITIES_CUTOUT);
|
||||
} else if (HandRenderer.INSTANCE.isActive()) {
|
||||
return iris$findOverride(HandRenderer.INSTANCE.isRenderingSolid() ? ShaderKey.HAND_CUTOUT : ShaderKey.HAND_TRANSLUCENT);
|
||||
@@ -252,7 +252,7 @@ public class ShaderOverrideEngine {
|
||||
};
|
||||
iris$overrides.put("rendertype_water_mask", waterMask);
|
||||
iris$overrides.put("rendertype_beacon_beam", () -> {
|
||||
if (ShadowRenderer.ACTIVE) {
|
||||
if (ModernShadowRenderer.ACTIVE) {
|
||||
return iris$findOverride(ShaderKey.SHADOW_BEACON_BEAM);
|
||||
} else if (shouldOverrideShaders()) {
|
||||
return iris$findOverride(ShaderKey.BEACON);
|
||||
@@ -261,14 +261,14 @@ public class ShaderOverrideEngine {
|
||||
}
|
||||
});
|
||||
iris$overrides.put("rendertype_entity_alpha", () -> {
|
||||
if (!ShadowRenderer.ACTIVE) {
|
||||
if (!ModernShadowRenderer.ACTIVE) {
|
||||
return iris$findOverride(ShaderKey.ENTITIES_ALPHA);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
iris$overrides.put("rendertype_eyes", () -> {
|
||||
if (ShadowRenderer.ACTIVE) {
|
||||
if (ModernShadowRenderer.ACTIVE) {
|
||||
return iris$findOverride(ShaderKey.SHADOW_ENTITIES_CUTOUT);
|
||||
} else if (isBlockEntities()) {
|
||||
return iris$findOverride(ShaderKey.BLOCK_ENTITY);
|
||||
@@ -279,7 +279,7 @@ public class ShaderOverrideEngine {
|
||||
}
|
||||
});
|
||||
iris$overrides.put("rendertype_entity_translucent_emissive", () -> {
|
||||
if (ShadowRenderer.ACTIVE) {
|
||||
if (ModernShadowRenderer.ACTIVE) {
|
||||
// TODO: Wrong program
|
||||
return iris$findOverride(ShaderKey.SHADOW_ENTITIES_CUTOUT);
|
||||
} else if (isBlockEntities()) {
|
||||
@@ -291,7 +291,7 @@ public class ShaderOverrideEngine {
|
||||
}
|
||||
});
|
||||
iris$overrides.put("rendertype_leash", () -> {
|
||||
if (ShadowRenderer.ACTIVE) {
|
||||
if (ModernShadowRenderer.ACTIVE) {
|
||||
return iris$findOverride(ShaderKey.SHADOW_LEASH);
|
||||
} else if (shouldOverrideShaders()) {
|
||||
return iris$findOverride(ShaderKey.LEASH);
|
||||
@@ -300,7 +300,7 @@ public class ShaderOverrideEngine {
|
||||
}
|
||||
});
|
||||
iris$overrides.put("rendertype_lightning", () -> {
|
||||
if (ShadowRenderer.ACTIVE) {
|
||||
if (ModernShadowRenderer.ACTIVE) {
|
||||
return iris$findOverride(ShaderKey.SHADOW_LIGHTNING);
|
||||
} else if (shouldOverrideShaders()) {
|
||||
return iris$findOverride(ShaderKey.LIGHTNING);
|
||||
@@ -309,14 +309,14 @@ public class ShaderOverrideEngine {
|
||||
}
|
||||
});
|
||||
iris$overrides.put("rendertype_crumbling", () -> {
|
||||
if (shouldOverrideShaders() && !ShadowRenderer.ACTIVE) {
|
||||
if (shouldOverrideShaders() && !ModernShadowRenderer.ACTIVE) {
|
||||
return iris$findOverride(ShaderKey.CRUMBLING);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
Supplier<ShaderInstance> textShader = () -> {
|
||||
if (ShadowRenderer.ACTIVE) {
|
||||
if (ModernShadowRenderer.ACTIVE) {
|
||||
return iris$findOverride(ShaderKey.SHADOW_TEXT);
|
||||
} else if (HandRenderer.INSTANCE.isActive()) {
|
||||
return iris$findOverride(ShaderKey.HAND_TEXT);
|
||||
@@ -332,7 +332,7 @@ public class ShaderOverrideEngine {
|
||||
iris$overrides.put("rendertype_text_see_through", textShader);
|
||||
iris$overrides.put("position_color_tex_lightmap", textShader);
|
||||
Supplier<ShaderInstance> textBgShader = () -> {
|
||||
if (ShadowRenderer.ACTIVE) {
|
||||
if (ModernShadowRenderer.ACTIVE) {
|
||||
return iris$findOverride(ShaderKey.SHADOW_TEXT_BG);
|
||||
} else {
|
||||
return iris$findOverride(ShaderKey.TEXT_BG);
|
||||
@@ -341,7 +341,7 @@ public class ShaderOverrideEngine {
|
||||
iris$overrides.put("rendertype_text_background", textBgShader);
|
||||
iris$overrides.put("rendertype_text_background_see_through", textBgShader);
|
||||
Supplier<ShaderInstance> textIntensityShader = () -> {
|
||||
if (ShadowRenderer.ACTIVE) {
|
||||
if (ModernShadowRenderer.ACTIVE) {
|
||||
return iris$findOverride(ShaderKey.SHADOW_TEXT_INTENSITY);
|
||||
} else if (HandRenderer.INSTANCE.isActive()) {
|
||||
return iris$findOverride(ShaderKey.HAND_TEXT_INTENSITY);
|
||||
@@ -356,7 +356,7 @@ public class ShaderOverrideEngine {
|
||||
iris$overrides.put("rendertype_text_intensity", textIntensityShader);
|
||||
iris$overrides.put("rendertype_text_intensity_see_through", textIntensityShader);
|
||||
Supplier<ShaderInstance> linesShader = () -> {
|
||||
if (ShadowRenderer.ACTIVE) {
|
||||
if (ModernShadowRenderer.ACTIVE) {
|
||||
return iris$findOverride(ShaderKey.SHADOW_LINES);
|
||||
} else if (shouldOverrideShaders()) {
|
||||
return iris$findOverride(ShaderKey.LINES);
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@ import net.irisshaders.iris.mixin.GlStateManagerAccessor;
|
||||
import net.irisshaders.iris.mixin.texture.TextureAtlasAccessor;
|
||||
import net.irisshaders.iris.shaderpack.DimensionId;
|
||||
import net.irisshaders.iris.shadows.ShadowMatrices;
|
||||
import net.irisshaders.iris.shadows.ShadowRenderer;
|
||||
import net.irisshaders.iris.shadows.ModernShadowRenderer;
|
||||
import net.irisshaders.iris.texture.TextureInfoCache;
|
||||
import net.irisshaders.iris.texture.TextureTracker;
|
||||
import net.irisshaders.iris.uniforms.CameraUniforms;
|
||||
@@ -644,7 +644,7 @@ public class MinecraftModernVersionShimImpl implements MinecraftVersionShimServi
|
||||
|
||||
@Override
|
||||
public Matrix4f getShadowModelView(float sunPathRotation, float intervalSize) {
|
||||
return new Matrix4f(ShadowRenderer.createShadowModelView(sunPathRotation, intervalSize).last().pose());
|
||||
return new Matrix4f(ModernShadowRenderer.createShadowModelView(sunPathRotation, intervalSize).last().pose());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
net.irisshaders.iris.pathways.ModernFullScreenQuadRenderer
|
||||
Reference in new issue
Block a user