fix(agc): route compacted color exports to the slots CB_SHADER_MASK enables #505
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/505"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-04T10:45:26Z.
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 #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 #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)