* Beta, maybe
* Fixes for entityColor uniform in Iris
* Handle Iris Texture input hook properly in GLSM
* Iris Entity Fixes
* Gbuffer progress
* Wire up BlockEntity gbuffer
* Move Entity gbuffer to a more appropriate place to avoid reentrancy
* Wire up ENTITY_EYES and BEACOM_BEAM
* Clean up unused RenderStateShard files
* This seems marginally more correct?
* Fix shadows from showing on sides of blocks
* Remove overlay
* yeet
* More gl debugging
* Grr, fix water textures
* Add missed enable checks
* Workaround for unset depth texture when using apitrace...
   Use a WrapOperation instead of an Inject with local capture - it wasn't working in dev w/ mixin debug set
* update bs
* Fix crosshair rendering with shaders
* more final
* Disable dynamic lights if shaders are in use
* No light when in water
* Add Void Particle Option + Mixin cleanup
* update bs
* less false

---------

Co-authored-by: Darren Eberly <[email protected]>
Co-authored-by: Caedis <[email protected]>
This commit is contained in:
authored and GitHub committed 2024-07-14 23:09:03 -07:00
1 parent 7e4292bdba
commit 2274bfabfd
51 files changed
+330 -400

No files matched your search

@@ -145,7 +145,7 @@ public class DeferredWorldRenderingPipeline implements WorldRenderingPipeline, R
private WorldRenderingPhase phase = WorldRenderingPhase.NONE;
private boolean isBeforeTranslucent;
private boolean isRenderingShadow = false;
private InputAvailability inputs = new InputAvailability(false, false, false);
private InputAvailability inputs = new InputAvailability(false, false);
private SpecialCondition special = null;
private boolean shouldBindPBR;
@@ -344,7 +344,7 @@ public class DeferredWorldRenderingPipeline implements WorldRenderingPipeline, R
if (programs.getPackDirectives().getShadowDirectives().isShadowEnabled().orElse(true)) {
this.shadowRenderer = new ShadowRenderer(programs.getShadow().orElse(null),
programs.getPackDirectives(), shadowRenderTargets);
Program shadowProgram = table.match(RenderCondition.SHADOW, new InputAvailability(true, true, true)).getProgram();
Program shadowProgram = table.match(RenderCondition.SHADOW, new InputAvailability(true, true)).getProgram();
shadowRenderer.setUsesImages(shadowProgram != null && shadowProgram.getActiveImages() > 0);
} else {
shadowRenderer = null;
@@ -367,7 +367,7 @@ public class DeferredWorldRenderingPipeline implements WorldRenderingPipeline, R
ProgramSamplers.CustomTextureSamplerInterceptor customTextureSamplerInterceptor = ProgramSamplers.customTextureSamplerInterceptor(builder, customTextureManager.getCustomTextureIdMap(TextureStage.GBUFFERS_AND_SHADOW));
IrisSamplers.addRenderTargetSamplers(customTextureSamplerInterceptor, flipped, renderTargets, false);
IrisSamplers.addLevelSamplers(customTextureSamplerInterceptor, this, whitePixel, new InputAvailability(true, true, false));
IrisSamplers.addLevelSamplers(customTextureSamplerInterceptor, this, whitePixel, new InputAvailability(true, true));
IrisSamplers.addWorldDepthSamplers(customTextureSamplerInterceptor, renderTargets);
IrisSamplers.addNoiseSampler(customTextureSamplerInterceptor, customTextureManager.getNoiseTexture());
@@ -395,7 +395,7 @@ public class DeferredWorldRenderingPipeline implements WorldRenderingPipeline, R
ProgramSamplers.CustomTextureSamplerInterceptor customTextureSamplerInterceptor = ProgramSamplers.customTextureSamplerInterceptor(builder, customTextureManager.getCustomTextureIdMap(TextureStage.GBUFFERS_AND_SHADOW));
IrisSamplers.addRenderTargetSamplers(customTextureSamplerInterceptor, () -> flippedAfterPrepare, renderTargets, false);
IrisSamplers.addLevelSamplers(customTextureSamplerInterceptor, this, whitePixel, new InputAvailability(true, true, false));
IrisSamplers.addLevelSamplers(customTextureSamplerInterceptor, this, whitePixel, new InputAvailability(true, true));
IrisSamplers.addNoiseSampler(customTextureSamplerInterceptor, customTextureManager.getNoiseTexture());
// Only initialize these samplers if the shadow map renderer exists. Otherwise, this program shouldn't be used at all?
@@ -548,7 +548,7 @@ public class DeferredWorldRenderingPipeline implements WorldRenderingPipeline, R
}
if (sodiumTerrainRendering) {
beginPass(table.match(getCondition(getPhase()), new InputAvailability(true, true, false)));
beginPass(table.match(getCondition(getPhase()), new InputAvailability(true, true)));
return;
}
@@ -967,7 +967,7 @@ public class DeferredWorldRenderingPipeline implements WorldRenderingPipeline, R
IrisSamplers.addRenderTargetSamplers(customTextureSamplerInterceptor, flipped, renderTargets, false);
IrisImages.addRenderTargetImages(builder, flipped, renderTargets);
IrisSamplers.addLevelSamplers(customTextureSamplerInterceptor, this, whitePixel, new InputAvailability(true, true, false));
IrisSamplers.addLevelSamplers(customTextureSamplerInterceptor, this, whitePixel, new InputAvailability(true, true));
IrisSamplers.addNoiseSampler(customTextureSamplerInterceptor, customTextureManager.getNoiseTexture());
@@ -36,7 +36,7 @@ class AttributeTransformer {
// lightmap texture coordinate.
// See https://github.com/IrisShaders/Iris/issues/1149
if (parameters.inputs.lightmap) {
root.rename("gl_MultiTexCoord1", "gl_MultiTexCoord2");
root.rename("gl_MultiTexCoord2", "gl_MultiTexCoord1");
}
Stream<Identifier> stream = Stream.empty();
@@ -59,10 +59,6 @@ class AttributeTransformer {
patchTextureMatrices(t, tree, root, parameters.inputs.lightmap);
if (parameters.inputs.overlay) {
patchOverlayColor(t, tree, root, parameters);
}
if (parameters.type.glShaderType == ShaderType.VERTEX
&& root.identifierIndex.has("gl_MultiTexCoord3")
&& !root.identifierIndex.has("mc_midTexCoord")) {
@@ -91,7 +87,7 @@ class AttributeTransformer {
"const float iris_ONE_OVER_32 = iris_ONE_OVER_256 * 8;");
if (hasLightmap) {
tree.parseAndInjectNode(t, ASTInjectionPoint.BEFORE_FUNCTIONS,
"mat4 iris_LightmapTextureMatrix = gl_TextureMatrix[2];");
"mat4 iris_LightmapTextureMatrix = gl_TextureMatrix[1];");
} else {
tree.parseAndInjectNode(t, ASTInjectionPoint.BEFORE_FUNCTIONS, "mat4 iris_LightmapTextureMatrix =" +
"mat4(iris_ONE_OVER_256, 0.0, 0.0, 0.0," +
@@ -112,56 +108,4 @@ class AttributeTransformer {
"mat4(1.0)" +
");");
}
private static final AutoHintedMatcher<ExternalDeclaration> uniformVec4EntityColor = new AutoHintedMatcher<>(
"uniform vec4 entityColor;", Matcher.externalDeclarationPattern);
// Add entity color -> overlay color attribute support.
private static void patchOverlayColor(
ASTParser t,
TranslationUnit tree,
Root root,
AttributeParameters parameters) {
// delete original declaration
root.processMatches(t, uniformVec4EntityColor, ASTNode::detachAndDelete);
if (parameters.type.glShaderType == ShaderType.VERTEX) {
// add our own declarations
// TODO: We're exposing entityColor to this stage even if it isn't declared in
// this stage. But this is needed for the pass-through behavior.
tree.parseAndInjectNodes(t, ASTInjectionPoint.BEFORE_FUNCTIONS,
"uniform sampler2D iris_overlay;",
"varying vec4 entityColor;");
// this is so we can pass through the overlay color at the end to the geometry
// or fragment stage.
tree.prependMain(t,
"vec4 overlayColor = texture2D(iris_overlay, (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy);",
"entityColor = vec4(overlayColor.rgb, 1.0 - overlayColor.a);",
// Workaround for a shader pack bug:
// https://github.com/IrisShaders/Iris/issues/1549
// Some shader packs incorrectly ignore the alpha value, and assume that rgb
// will be
// zero if there is no hit flash, we try to emulate that here
"entityColor.rgb *= float(entityColor.a != 0.0);");
} else if (parameters.type.glShaderType == ShaderType.GEOMETRY) {
// replace read references to grab the color from the first vertex.
root.replaceReferenceExpressions(t, "entityColor", "entityColor[0]");
// TODO: this is passthrough behavior
tree.parseAndInjectNode(t, ASTInjectionPoint.BEFORE_FUNCTIONS,
"out vec4 entityColorGS;");
tree.parseAndInjectNode(t, ASTInjectionPoint.BEFORE_FUNCTIONS,
"in vec4 entityColor[];");
tree.prependMain(t, "entityColorGS = entityColor[0];");
} else if (parameters.type.glShaderType == ShaderType.FRAGMENT) {
tree.parseAndInjectNode(t, ASTInjectionPoint.BEFORE_DECLARATIONS,
"varying vec4 entityColor;");
// Different output name to avoid a name collision in the geometry shader.
if (parameters.hasGeometry) {
root.rename("entityColor", "entityColorGS");
}
}
}
}