fix(agc): render DCC-compressed 4_4_4_4 unorm color targets #28311
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/28311"
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 zeezey on 2026-11-29T23:37:01Z.
What
A one-sample, one-mip 4_4_4_4 unorm color target with DCC enabled renders instead of throwing
DCC-compressed 4_4_4_4 unorm color targets are unsupported. Built on #27966 (heade2e97886ee), which accepts 4_4_4_4 targets under every component order (they render into an R16_UINT attachment;mainaccepts STD_REV only); lgqdaxia suggested this follow #27966 as its own PR. Two commits:fix(agc): render DCC-compressed 4_4_4_4 unorm color targets, the change.ColorTargetDccClearFormatgivesR4G4B4A4_UNORM_PACK16for a 4_4_4_4 target (the target's own format for every other one), with a DCC layout entry for it, and the clear texel, the non-resident fill and the alpha-position rule (DccAlphaOnMsb) use it: 0000, 0001, 1110 and 1111 fill four 4-bit channels, with alpha in bits 12-15 under STD and ALT and in bits 0-3 under STD_REV and ALT_REV.[gpu] first DCC 4_4_4_4 unorm color targetline with its registers.B4G4R4A4_UNORM_PACK16, which has no DCC layout entry) under 0001, 1110 or 1111 keys reads the stored texels instead of the clear.lgqdaxia tested this commit as
c58e1457c183(see Tested). Since then it was rebased onto #27966 without conflicts, and three changes came from review: the refusal of mipmapped targets; in the new branch ofmaterializeRegisterClear, the register clear texel (rather than the 0001 or 1110 one) passed tostoreClearTexels, which uses it only for keys that read as a register clear, with the key byte count computed once for both branches; and a rewritten debt entry.test(agc): cover more DCC 4_4_4_4 target clears and the mip refusal, tests only:agc_driver_packed_unorm4444_dcc_target(and its run withAPS5_NO_RESIDENT_TARGETS=1) runs a CB fast-clear eliminate and a DCC decompress over a target after a draw into it, under 0001 and 1110 keys and each component swap. It checks the stored four-nibble texels, the uncompressed keys, and that a following draw keeps the clear outside its scissor.VulkanDevice::FillBufferrecords no fill skips these cases and prints so; on the RTX 4090 and on lavapipe they ran.agc_driver_graphicschecks that a mipmapped DCC 4_4_4_4 target (four mips, SW_64KB_R_X, pipe-aligned) is refused under each component swap, and that the same target without DCC decodes.No new switch.
Tested
lgqdaxia tested the first commit as
c58e1457c183on #28197's head, on an NVIDIA GeForce RTX 3080 Laptop GPU (driver 621.14, Windows 11): the fast-clear pixels matched for all four component orders with resident targets on and off, both Vulkan tests passed with no skips or validation errors, and the patch applied cleanly to #27966 ate2e97886ee. That run predates the review changes and the second commit.Here: Windows 11 Pro 10.0.26300, WinLibs MinGW-w64 GCC 15.2.0, Ninja, Release,
-DBUILD_TESTING=ON -DANYPS5_RELINKER_CLI=ON -DANYPS5_VIDEO_OUT_TEST_DRIVER=windows, NVIDIA GeForce RTX 4090 (driver 621.24), Khronos validation layer from Vulkan SDK 1.4.363. Every run below except thebuild.ymlsteps hadANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validationandVK_LOADER_DEBUG=layer. #27966's head and this branch were built in separate build directories with the same toolchain and options.The complete
ctest(no-R,-j 8,--timeout 300) on #27966's head and on this PR: 7354 and 7356 tests (the two more are the new test's runs), 7315 and 7318 passed, 36 skipped on both. No line reports the layer missing; it is inserted 2137 and 2139 times. Both logs have the same 89Validation Warninglines (Undefined-Value-ShaderOutputNotConsumed-DynamicRendering84,Undefined-Value-OutputNotWritten-DynamicRendering3,Undefined-Value-ShaderOutputNotConsumed1,VALIDATION-SETTINGS1) and noVUID-,SYNC-HAZARDorValidation Errorline.agc_driver_linear_target_import_creation, which then failed 5 of 5 times alone on each.frame_capture_minimizeandguest_pthread_mutex_contention.windows_write_watch("cannot restore full resident run protection").frame_capture_minimizeandguest_pthread_mutex_contentionpassed 5 of 5 on both;windows_write_watchpassed 5 of 5 on this PR and 4 of 5 on #27966's head, where it failed once.Every test matching
dcc|4444|clear|fast_clear|blend|interlock|sample, 20 times withctest -j 8, alternating between #27966's head (201 tests) and this PR (203; the two more are the new test's runs): every run passed, with the same 5 skipped on both (agc_driver_msaa_dcc_compared_import_2,_4and_8,agc_driver_partially_committed_volume_page_samples,agc_driver_sample_order_grid_reference). Each run's log shows the layer inserted (182 times per run on #27966's head, 184 on this PR) and nowas not found,VUID-,SYNC-HAZARDorValidation Errorline; both have the same 31Validation Warninglines per run (30Undefined-Value-ShaderOutputNotConsumed-DynamicRendering, 1VALIDATION-SETTINGS).The same set plus the 61 tests of the two changed test executables (
agc_driver_graphics_testsandagc_driver_packed_unorm4444_dcc_target_tests), once on each side under each of ten switches read on these paths:APS5_NO_RESIDENT_TARGETS,APS5_NO_KEY_FAST_PATH,APS5_NO_TARGET_MEMO,APS5_NO_DCC_MIP_FAST_CLEAR(read after the mip refusal, so no accepted 4_4_4_4 target reaches it),APS5_KEYS_FILL_CLEAR=1,APS5_CPU_DCC_KEYS,APS5_NO_KEYS_FILL_MEMO,APS5_NO_DCC_WORD_SCAN,APS5_NO_RECORDED_CLEAR, andAPS5_NO_PASS_ATTACHMENT_MEMOwithAPS5_DRAW_PIPELINE=1. The tests that do not pass are the same on both sides under every switch (12, 5, 0, 1, 0, 1, 0, 0, 0 and 0), the new test's two runs pass under each, and no log has aVUID-,SYNC-HAZARDorValidation Errorline.The 61 tests of the two changed test executables, 20 times in a row, one at a time: every run passed, no
VUID-orValidationline. The longest wereagc_graphics_profile_draw(21.98 s) andagc_driver_graphics(20.13 s), measured while the validation gate below was building; the new test's runs took at most 2.26 s.The first commit alone (its own test sources, with the second commit's tests left out): the new test's two runs and
agc_driver_graphicspass, and of the 203 tests matching the pattern above, 198 pass and 5 skip, with noVUID-line.Each part of the change was disabled in turn to see which test catches it (the first two and the two lines below on the code before the review changes, whose disabled lines are the same; the mip refusal on this code):
0xffffoutside the scissor where0xf000belongs;Two lines are not shown to be needed by these tests. The cases also pass with the refresh after the metadata pass's store removed, and with the explicit key sync in
materializeRegisterClearremoved. In the second case the lookup already knows the pending fill's keys, and the store reads the clear code without that sync, so the pending-fill case checks the result, not that sync.tools/vulkan_validation_gate.py(main's copy), #27966's head against this PR,--gpu NVIDIA --repeat 20 --timeout 3600with the default 30 s test timeout:dcc|4444|clearand create a Vulkan instance on both sides: exit 1, from three tests only.agc_driver_msaa_dcc_compared_import_2,_4and_8skip on Windows ("Linux comparison mode only: Windows host imports settle on a second queue or keep their write watch") in every iteration on both sides, and the gate counts a skipped selected test as a problem. No new diagnostic.Undefined-Value-ShaderOutputNotConsumed-DynamicRenderinginagc_driver_packed_unorm4444_partial_write, 200 times on each side.Linux: Ubuntu 24.04.5 (a Docker container), GCC 13.3.0, Ninja, Release, lavapipe from Mesa 25.2.8 (llvmpipe, LLVM 20.1.2), Khronos validation layer 1.4.335, the same four variables. The complete
ctest(-j 6) on #27966's head and on this PR: 7243 and 7245 tests, 6739 and 6741 passed, 312 skipped on both, and the same 192 do not pass on both (186 of them print that the write watch is unavailable because the container does not permit userfaultfd; the other six are five Python tool tests and one replay test that timed out). NoVUID-,SYNC-HAZARDorValidation Errorline, and the same 78Validation Warninglines on both. The new test's two runs andagc_driver_graphics, 20 times one at a time: all passed (the pending-fill cases ran), the longestagc_driver_graphicsat 17.31 s and the new test's runs at 0.84 s; the 61 tests of the changed executables once: all pass; the same three under each switch above: all pass.The pull-request steps of the
build.ymlwindows job, run here withmain's copies of the tools over the ten files this PR changes againstmain(which include #27966's), without the four validation variables as in CI:check_test_registration.py buildpasses,build_mingw_host_only_tests.pybuilds its 83 host-only test executables, andbuild_changed_guest_tests.pyran 6137 tests, all passing butagc_driver_linear_target_import_creation, which fails on #27966's head too.python3 -I tools/check_conventions.py --base e2e97886ee(and with--base origin/main, which covers #27966's commits too), withmain's checker, with this title and body: all checks passed.tools/debt_fold.py --checkandtools/check_test_registration.py buildpass. The branch merges into currentmain(1f27e2abfa) without conflicts.tools/pr_overlap.py --branch, frommain, with a local change that skips the nine open PRs whose heads it cannot fetch (among them #7642), reports two line overlaps:State.cppthat #27966 already changes (#9748 conflicts with #27966 alone too);A1R5G5B5_UNORM_PACK16entry goes on the same line of the DCC layout table (LayoutForinDccMetadata.cpp) as this PR'sR4G4B4A4_UNORM_PACK16entry. Whichever merges second keeps both entries.It ends with "overlap check failed closed", because older open PRs that conflict with
maintouch the same files and could not be compared.Three open PRs from today touch the same files with no textual conflict (
git merge-treeof each head with this branch is clean), each for a different case:FillDccClearinDccMetadata.cppso that a one-channel format whose alpha is not on the MSB fills its channel as colour on GFX10. This PR's clears of 4_4_4_4 targets use the four-channelR4G4B4A4_UNORM_PACK16layout, which that change does not reach. With it, the one-channel value that the resident R16_UINT image shows before the first draw flips for STD_REV and ALT_REV (0 for 0001, 0xffff for 1110), so whichever of the two merges second should update the "0xffff and 0" of this PR's debt entry. With #28192's commit picked onto this branch, the area set above, the 61 tests of the changed executables (agc_driver_graphicsruns #28192's new single-component clear checks inTextureFormat.cpp),agc_driver_dcc_key_presync(its new case) andtexture_format_lookuppass: 257 tests, the same 5 skipped, noVUID-line.Draw.cpp, andquadPixelMaskTestsandsampleOrderTestsintests/Graphics.cpp. #28229 adds one line toprepareDraw, away from this PR's line there; neither touches the other functions this PR changes.PPSA38500: our boots of a longer local stack that includes the first commit (before the review changes) got past this stop. The first DCC 4_4_4_4 target they logged (
CB_COLOR_INFO 0x1000884c,CB_COLOR_ATTRIB 0x00000000, 2560x1440, 1 mip) is not one that the mip refusal affects. This exact branch was not booted.Not tested: a console, other GPUs.
Checklist
e2e97886ee, not on currentmain(see Depends on); 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)c58e1457c183, before the review changes, tested by lgqdaxia)🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Documentation
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-29T23:43:27Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the remaining resident image and texture-read limitations are documented as technical debt.
What I ran
Reviewed head
9f73b6670c29e37ddccba41a29ac3fd1040c463eusing the prepared diff and the pinnedrepo_read.pyreader. No tests were run by me; test results in the description are author-reported.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
I read all 10 changed files listed as reviewed in the manifest, including the full
Graphics.cppchange via the reader. I did not independently reproduce the reported test runs, build, or verify behavior on a console or other GPUs. The manifest lists no excluded changed files.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-29T23:46:25Z.
Review: COMMENTED
Architecture findings (2)
Advisory architecture findings (2)
2a479d71-04bb-44fb-be3f-a03f6ba680a2Reviewing files that changed from the base of the PR and between
1f27e2abfaand9f73b6670c.core/libs/prx/libSceAgcDriver/Graphics/include/State.hppcore/libs/prx/libSceAgcDriver/Graphics/src/DccMetadata.cppcore/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_packed_unorm4444_dcc_target_tests.cmakecore/libs/prx/libSceAgcDriver/tests/execution/PackedUnorm4444ColorTarget.cppcore/libs/prx/libSceAgcDriver/tests/execution/PackedUnorm4444DccTarget.cppcore/libs/prx/libSceAgcDriver/tests/execution/PackedUnorm4444PartialWrite.cppdocs/dev/debt/changes/agc-dcc-4444-color-targets.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-12-03T06:05:16Z.
Review: APPROVED
I read the diff at
9f73b6670c. Windows 11, GCC 15.2, merged intomainatcf556db18c3together with other open PRs (so not an isolated build), withANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1andVK_LAYER_KHRONOS_validationon an RTX 5080 (621.24) and a Radeon iGPU (26.11.2).agc_driver_packed_unorm4444_dcc_target, the other twopacked_unorm4444tests and the 60 tests ofagc_driver_graphics_tests: pass on both GPUs. The loader log shows the layer inserted and no "was not found" line, and neither run has aVUID-orSYNC-HAZARDline.main's):packed_unorm4444_color_targetand_partial_writefail on both GPUs ("unsupported color format 19 number type 0 component swap 1"); the DCC test doesn't compile withoutColorTargetDccClearFormat.The tree also had #28350, which builds on this.
Not checked: a title.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T20:11:55Z.
Review: COMMENTED
PendingKeyFillTestsreports success when the device cannot record the fill, and the second component-order set is skipped as well after the first such case. Could the pending-key case have its own CTest status or report the number of GPU-fill cases that executed? The current result proves ordinary clears and metadata passes, while a device without the fill path can show the same passing CTest status for the new ordering case.Source review at
9f73b6670c. The head trial-merges ontod2e04ef9b3. Paired Vulkan execution is queued.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.