fix(agc): a zero color export format is not a color export #10779
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10779"
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 stuart-russell on 2026-10-25T00:04:34Z.
What
SPI_SHADER_COL_FORMAT(0x1c5) entry 0 isSPI_SHADER_ZERO: the pixel shader exports nothing to that slot. The decode treated it as an unsupported export format and threw, so a draw whoseCB_SHADER_MASK/CB_TARGET_MASKenabled a slot the shader does not write was rejected instead of drawing its other exports.Skip format-0 slots when counting exports and when building attachments, and make an unwritten
SPI_SHADER_COL_FORMATread as no exports rather than as a missing register.Split from #10420. Resubmitted after the open-pull-request limit closed the first copy. The remaining pieces follow one at a time as each lands.
References
An entry of 0 is
SPI_SHADER_ZEROin the gfx10 export-format encoding; the existingDecodePixelStageInfopath already treats an unset register as no exports for every slot.Tested
agc_driver_pm4(18 tests) andagc_driver_graphicspass, andtools/check_conventions.py --base origin/mainpasses, onf26434afa.Real-GPU runs from the thread, all with
ANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1andVK_LAYER_KHRONOS_validation:agc_driver_stencil_ref_export(device lacks stencil export). Withmain'sState.cpponlyagc_driver_graphicsfails,color export format 0 is unsupported; deleting just the attachment-loop skip fails the new hole test.agc_driver_pm4andagc_driver_graphicspass onmainand on this PR.main.The branch's own runs on the Linux machine used for development have no Vulkan device, so they cover the decode path only.
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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T00:08:01Z.
Review: APPROVED
The change handles
SPI_SHADER_ZEROconsistently in both export counting and attachment creation. The new tests cover the single zero-format export and a zero-format slot between written exports, while preserving the later export index and blend mapping. I inspected the full diff and verifiedgit diff --check; I could not run the graphics test locally because this checkout has no initialized build tree and its submodule setup is unavailable. Hosted checks are green for the current head.Imported from boykopovar/AnyPS5. Originally posted by ahmadmuj on 2026-10-25T11:13:34Z.
Review: COMMENTED
Checked head
3cf9b957ccbb, merged onto main66e6772ca209(clean merge). Linux, GCC 13.agc_driver_graphicsis CPU-only, so no GPU needed.What I ran:
ctest -R '^agc_driver_graphics$' --repeat until-fail:3on the merge: pass 3/3.State.cpp: fails withcolor export format 0 is unsupported, as expected.SPI_SHADER_ZEROchecks out against Mesa'ssrc/amd/registers/gfx10.json(SPI_SHADER_EX_FORMAT, used by theCOLn_EXPORT_FORMATfields ofSPI_SHADER_COL_FORMAT).The hole shape matches the existing COLOR_INVALID case: blends are sized by
exportCount, attachments are placed byexportIndex, andDecodePixelStageInfocopies the format nibble per export index, so a 0 just writes a location with no attachment. Looks right to me.Two things:
if (slotExport == 0) continue;in the attachment loop isn't covered. Both edited tests put the 0 at the last export index, so the first loop already stopsexportCountbefore it. I deleted that line andagc_driver_graphicsstill passed. A zero before a written export does hit it, e.g. inCompactedExportTestsright after the0x90009ucase:That passes on this PR and fails with the line removed.
DrawRejectionis now out of step withDecodeState(the comment aboveLayerExportssays the precheck must reject exactly what DecodeState would).DecodeStatepasseshasColorTargettocolorControlSupported, and that is now false when every written export has format 0.DrawRejectionstill passesColorWriteMask(cx) != 0. Example:makeState()with0x1c5 = 0and0x202 = 0xcc0030(mode resolve).DecodeStateaccepts it,DrawRejectionreturns the CB_COLOR_CONTROL message. With0x1c5 = 9both reject. It only refuses a draw, nothing renders wrong, but the precheck should probably apply the same zero-format rule.Not checked: what real hardware does with a zero format between enabled
CB_SHADER_MASKslots (no PS5 here). The PR keeps later export indices, same as the COLOR_INVALID model.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T08:55:52Z.
Review: CHANGES_REQUESTED
Re-reviewed exact head
88aff2226ac84b672c98c2c646267fbb4018a6df. The topic patch is still the reviewed zero-export change, but this head remainsDIRTYagainst currentmainand the merge preview conflicts incore/libs/prx/libSceAgcDriver/Graphics/src/State.cpp. Main’sSignedNormalizedFormat/NormalizedChannelMaskhelpers and this PR’sColorExportSlots/ColorExportCountadditions need to coexist with the intended namespace boundaries. Please merge/rebase current main and rerunagc_driver_graphics/agc_driver_pm4, retaining the zero-format hole and resolve regressions. The earlier approval is stale for this integration state; I have not run local GPU tests.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T09:43:58Z.
Review: APPROVED
Re-checked — approved
The updated head resolves the
State.cppintegration conflict by preservingmain'sSignedNormalizedFormatandNormalizedChannelMaskhelpers before the zero-export helpers. The regression now treats format 0 as an unwritten color slot, preserves later MRT export indices, and accepts a resolve draw only when no color export is present.The author reports the current-main head
c3bc24355building cleanly,agc_driver_pm4andagc_driver_graphicspassing 18/18, conventions passing, and the validation layer reporting zero VUIDs. Hosted conventions and labels are pending. I did not run a local C++/GPU test or independently inspect a title capture. No blocking issue remains in this diff; approval covers this head.Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-11-01T19:47:42Z.
Review: COMMENTED
The Tested section reports the
VK_LAYER_KHRONOS_validationrun as clean, butGPUs testedsays the AGC tests ran on Linux without a Vulkan device, so that run had nothing to validate. The runs on real GPUs later in the thread (brummilab on an RX 6600 XT, wachi35676 on NVIDIA and AMD) are the evidence for this; please move them, or your own run on a GPU againstmain, into Tested and drop the no-device line.One question on
ColorExportCount: a missing 0x1c5 now reads as 0, so a draw with a colour target mask and noSPI_SHADER_COL_FORMATwrite exports nothing instead of failing. The description saysDecodePixelStageInfoalready does this; is that the only basis, or is there anything showing the console treats an unwritten register as zero here?