Repository navigation
fix(shader): read the ancillary render target index as 0 - #4842
Merged
oneandonlydean merged 1 commit intoOct 13, 2026
Merged
oneandonlydean merged 1 commit into
oneandonlydean merged 1 commit into
Conversation
9 tasks done
No pre-rasterization stage writes Layer: vertex layer exports are ignored, so the first layer is used and the render target index field of the packed ancillary word is 0. The lowering read the Layer builtin for it instead. AMD's Windows driver drops the color writes of a fragment shader that consumes an unwritten Layer, which made agc_driver_relative_ancillary fail on AMD hardware (boykopovar#4800); lavapipe returns 0 there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
oneandonlydean
force-pushed
the
fix/agc-ancillary-layer-unwritten
branch
from
October 13, 2026 00:59
6f3f3fa to
3334e41
Compare
Collaborator
|
#4031 is merged, so I rebased this onto it and pushed (3334e41, your commit and message kept). The |
Contributor
Author
Merged
10 tasks done
10 tasks done
Merged
9 tasks done
Open
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.
What
Fixes #4800.
The packed pixel ancillary lowering now uses the constant 0 for the render target index field (bits 16+) instead of reading the
Layerbuiltin.Why 0 is right. No pre-rasterization stage writes
Layertoday:State.cppignores the vertex layer and viewport exports ofPA_CL_VS_OUT_CNTL.paClVsOutCntlis never set, so noLayeroutput is emitted.When the last pre-rasterization stage has no
Layeroutput, Vulkan uses the first layer (Layer). So the value the field stood for is 0.Why reading
Layeris wrong here. On AMD's Windows driver, a fragment shader that consumes the unwrittenLayerloses its colour writes, even when the value never reaches the output. lavapipe returns 0, so CI didn't see it.#4800 has the module dumps and the edited-module runs that isolate this:
gl_SampleIDreplaced by 0: still loses the writes.gl_Layerreplaced by 0: writes land.gl_Layerloaded but unused: writes land.The
shader.mddebt entry for the packed ancillary word now says where the 0 comes from. #423 and #1077 (@alfalfa-star) make layered draws exportLayerthroughPA_CL_VS_OUT_CNTL. Once they land, those draws need the real value: readLayerwhen the draw exports it, and 0 otherwise, which is the case this change covers. Nothing onmainexports it yet, so I left that condition out.Tested
Windows 11 (26300), AMD Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), WinLibs GCC 15.2.0, Release,
BUILD_TESTING=ON, onmain43e3a70f8:agc_driver_relative_ancillary: failed onmainon this GPU; passes 3/3 with this change.pixel_ancillary: 3/3. It now requires the render target index field to be 0 for rows whose layer is not 0.ctest -R '^agc_' -j 1(shader cache emptied): 445/445.ctest -E '^agc_' -j 4: 574/574.main'sConstantFolder.cpp,pixel_ancillaryandagc_driver_relative_ancillaryboth fail.main: Stremio Plus, Capy Mobile, DriftCheck, EVO Player, DOOM and OpenRCT2.conventions_ci_gate, because my fork runs the oldbuild.ymlwithout file filters, whichmain's checker rejects. It is not this change.tools/check_conventions.py --base origin/mainandgit diff --checkpass.Not run on Linux locally. No title on hand reads the ancillary layer field; that is #2548's set: Stray, Kena, Lies of P and others.
Overlap. #4031 (@AlxcBTW) also changes
lowerPackedAncillaryandPixelAncillary.cpp: it adds the primitive class field. The two don't depend on each other. Whichever merges second has to take this into account:Layerread: the whole-word composition,insertBuiltin(..., StageInputKind::Layer)shifted by 16. With this change that read becomes the same constant 0.pixel_ancillarycases need to agree on the field.I merged #4031's head
dd8403112onto this branch locally and applied the same 0 at that read. Its newagc_driver_pixel_ancillary_wordthen passes on this AMD GPU, 3/3, where it failed on #4031 alone, and so doesagc_driver_relative_ancillary.pixel_ancillaryneeds that merge reconciled. If #4031 goes in first, I'll rebase this one and do it.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)