Repository navigation
Bind the overlay texture for pipelines that don't declare Sampler1 - #3440
Open
tmy7533018 wants to merge 1 commit into
Open
tmy7533018 wants to merge 1 commit into
tmy7533018 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On 26.3 with a shader pack, some entity equipment layers render solid black: happy ghast harnesses, trader llama carpets, and horse armor (seen on a zombie horse). Which layers are affected changes from launch to launch, but stays the same for the whole session. Disabling shaders fixes it. It happens with Complementary Unbound and with Bliss, and reproduces with only Fabric API, Sodium and Iris installed.
This may be what some reports in #3376 describe as "blacked out armors".
Cause
ARMOR_CUTOUT_NO_CULLandARMOR_CUTOUT_NO_CULL_GLINTset theNO_OVERLAYdefine and don't declareSampler1, unlikeENTITY_CUTOUT. Iris still treats these programs as having an overlay, because the vertex format containsUV1, soiris_overlayis an external sampler on unit 1 andEntityPatchercomputesentityColorwithtexelFetch(iris_overlay, iris_UV1, 0).Vanilla never binds unit 1 for these pipelines, so the shader reads whatever an earlier draw left there. If that happens to be the overlay texture,
(0, 10)(NO_OVERLAY) is opaque andentityColoris zero. If it is any other texture, the fetch returns transparent black,entityColorbecomes(0, 0, 0, 1), and packs that domix(color.rgb, entityColor.rgb, entityColor.a)output black. The draw order depends on hashing, which is why the result differs per launch.Fix
In
ExtendedShader.iris$setupState, when the program expects an overlay but the vanilla pipeline's uniforms don't includeSampler1, bind the vanilla overlay texture to unit 1. Armor is submitted withOverlayTexture.NO_OVERLAY, soentityColorstays zero and armor looks the same as without shaders. Pipelines that declareSampler1are untouched, and vanilla marks every uniform dirty on a pipeline change, so the binding doesn't leak into later entity draws.Binding the white pixel instead doesn't work: it is 1x1, so
(0, 10)is out of range and every armor layer turns black.Testing
26.3at 671a5c8 with this changelight_gray_harness), a zombie horse and horses with diamond horse armor, and a llama with a carpet, viewed from fixed camera positions over repeated launchesentityColor.a > 0.02: before the change, 3 of 4 launches showed it on armor or harnesses; after, 0 of 8The investigation and this patch were done with Claude Code (an AI assistant) on my machine. I tested the result in my own world.