Repository navigation
fix(agc): route compacted color exports to the slots CB_SHADER_MASK enables - #505
Merged
oneandonlydean merged 1 commit intoOct 5, 2026
Conversation
This was referenced Oct 4, 2026
…nables Pixel shader color exports are compacted: export MRTi goes to the i-th MRT slot with a non-zero CB_SHADER_MASK nibble and takes the i-th SPI_SHADER_COL_FORMAT field. Draws still mapped export i to slot i and read slot i's format field, so a shader with CB_SHADER_MASK 0xf000f and SPI_SHADER_COL_FORMAT 0x44 (export 1 to slot 4) was refused with "color export format 0". Each color target now carries its export index next to its slot. Attachment references, blend states, export mappings and the pipeline and pass keys follow the export index; the color buffer, blend control and target mask come from the slot. An unwritten export below the highest written one stays an unused attachment.
oneandonlydean
force-pushed
the
fix/agc-compacted-color-exports
branch
from
October 5, 2026 05:08
3775b56 to
1c4aadb
Compare
oneandonlydean
added a commit
to oneandonlydean/AnyPS5
that referenced
this pull request
Oct 5, 2026
Takes upstream's merged versions of our boykopovar#586 boykopovar#611 boykopovar#612 boykopovar#505 boykopovar#490 boykopovar#619 boykopovar#503 boykopovar#627 boykopovar#628 boykopovar#618 and drops astrobot's local copies, plus gate-batch-3 (boykopovar#469 boykopovar#500 boykopovar#504 boykopovar#509 boykopovar#510 boykopovar#514 boykopovar#525 boykopovar#526 boykopovar#528), round o/p (boykopovar#617 boykopovar#620 boykopovar#621 boykopovar#622 boykopovar#623 boykopovar#624 boykopovar#501 boykopovar#508 boykopovar#629 boykopovar#630 boykopovar#631). Conflicts: - SpirvAnalysis.hpp/.cpp, SpirvBufferAccess.cpp: upstream's boykopovar#586/boykopovar#612. The 64-bit LDS atomics keep the full array (f27d6e5 no longer needed). - SpirvMemoryInstructions.cpp: upstream's constant slot plus offset; astrobot's split-wave append/consume kept. - GuestTextureResource.cpp, TextureTiling.cpp and their tests: upstream's boykopovar#490/boykopovar#503 (astrobot had no other change there). - MaskedSelect.cpp test, ShaderMemory.cpp LDS test: upstream's. - State.cpp: upstream's boykopovar#505 export count and boykopovar#469 null pixel program; astrobot's depth export rejection and depth target model kept. - Pipeline.cpp: upstream's pipeline key; astrobot's depth attachment and blend check (a trailing unused attachment stays valid, as colorGapPipelineTests expects). - Draw.cpp, Recorder.cpp, ShaderResources.cpp: astrobot's (renderPassKey with depth, moved sample functions, residency maintenance), which already hold the merged boykopovar#505/boykopovar#628/boykopovar#490 changes. - ShaderInputState.cpp: both register sets. - State.hpp: the duplicate exportIndex member from the auto-merge removed. - CMakeLists.txt: astrobot's test list (a superset of upstream's). - tests/Graphics.cpp: upstream's CompactedExportTests replaces astrobot's inline copy; tests/Recorder.cpp: upstream's viewPastLastMipTests added.
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.
Title: fix(agc): route compacted color exports to the slots CB_SHADER_MASK enables
What
The follow-up to #294 that Michon asked for (comment). #294 is merged; this is one commit on current
main.Pixel shader color exports are compacted: export MRTi goes to the i-th MRT slot with a non-zero
CB_SHADER_MASKnibble, and field i ofSPI_SHADER_COL_FORMATis the format of export i.mainstill maps export i to slot i and reads slot i's format field. A shader withCB_SHADER_MASK0xf000f andSPI_SHADER_COL_FORMAT0x44 (color to slot 0, velocity to slot 4) is therefore refused with "color export format 0": slot 4's field is 0. That is PPSA21564's glass material (60 shader variants); with those draws skipped, the glass floor and windows show the interior behind them.ColorTargetgetsexportIndexnext to fix(agc): color targets with gaps between written MRT slots, depth array slices #294'sslot. The attachment references, blend states, export mappings,ValidateShaderslocations (throughblends.size()), and the pipeline and pass keys now use the export index. The color buffer,CB_BLENDcontrol and target mask still come from the slot.VK_ATTACHMENT_UNUSEDreference with a disabled blend, as fix(agc): color targets with gaps between written MRT slots, depth array slices #294 does for gaps.SPI_SHADER_COL_FORMATas the format of export MRTi (DecodePixelStageInfo,targetOutputMode[exp.index]). The decode now checks that same field.CB_SHADER_MASK, export i is slot i and nothing changes. With holes it does: forCB_SHADER_MASK0xf0f, export 1 now goes to slot 2, not slot 1.AMD's RDNA2 ISA guide lists the export targets (MRT0 to MRT7) but not how they map to CB slots. The mapping comes from Mesa (e5f06878):
CB_SHADER_MASKuncompacted, built from the per-attachment formats (ac_shader_util.c:43, radv_shader_info.c:898).SPI_SHADER_COL_FORMATwith the holes removed (radv_cmd_buffer.c:13202, written at 13229 to 13247).Tested
BUILD_TESTING=ONandcmake --build build --target libs;ctestpasses (183/183).CompactedExportTestsinagc_driver_graphics_tests:CB_SHADER_MASK0xf000f,CB_TARGET_MASK0x3000f,SPI_SHADER_COL_FORMAT0x44) decodes to two attachments: export 1 is slot 4's color buffer, with slot 4's blend control, target mask (R and G) and component mapping inExportMappings()[1];SPI_SHADER_COL_FORMAT0x90009 (field 1 zero, slot 4's field set) is refused with "color export format 0";CB_SHADER_MASK0xf0f0f with slot 2 write-masked gives three blend states: export 1 is unused, and export 2 is slot 4.main(with only the new field added, so the test compiles), the test fails with "AGC graphics: color export format 0 is unsupported".Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)