fix(agc): select the alpha clear value for single-channel Vulkan storage images #28198
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/28198"
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 lgqdaxia on 2026-11-29T04:16:43Z.
What
A single-channel storage image can represent alpha. On GFX10, the DCC keys
0001and1110give color and alpha opposite values. Vulkan clears the only component from the red slot, and the storage path always put the color value there. An R16 alpha image therefore received the opposite value. Use the descriptor's alpha value on upload and refill. When a new descriptor keeps the image and key addresses but changes alpha placement, rebuild the resident image. Repeated binds with unchanged placement still reuse it. AMD PAL's GFX10 rule.Found while reviewing #28192, which handles clear values decoded into guest bytes. This PR covers the command that clears the Vulkan storage image. #28118 proposes rejecting these mixed keys on single-channel surfaces. #24445 touches the same upload condition for uncompressed images.
Tested
Windows 11, NVIDIA RTX 3080 Laptop GPU (621.14). All seven existing DCC first-write and key-update tests passed on both main (
e0ef70639d7e) and this PR (335d7fc6a146). The PR's new regression also passed all 16 full-image pixel readbacks across upload, same-address rebind and refill. The logs show Khronos validation 1.4.368 loaded for every case, with zero skips, VUID errors or synchronization errors on either revision.On Arch Linux, all eight tests passed on the same PR revision with an RX 6650 XT (RADV Mesa 26.3.1), zero skips and no VUID or synchronization messages. Linux recheck
Earlier Windows regression results · 2026-11-29
On main
f61eb307c0, four alpha-selected R16 readbacks returned the opposite value. The initial fix at58a294887015passed all 12 upload and refill checks on separate images. Switching only alpha placement on the same image still gave the opposite value on all four rebinds and their following refills.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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-29T04:23:53Z.
Review: COMMENTED
Actionable comments posted: 1
0222edff-920a-4db7-abbd-4717ee94962dReviewing files that changed from the base of the PR and between
ea39f127f4and58a2948870.core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cppcore/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_dcc_keys_first_write_tests.cmakecore/libs/prx/libSceAgcDriver/tests/execution/DccKeysFirstWrite.cppIncluded 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 MarcZX10 on 2026-11-29T04:37:40Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this; the points below are optional.
What I ran
Reviewed head
58a294887015ac210a31c57ddc6e794935521b86. No commands or tests were run; the author reports NVIDIA RTX 3080 Laptop testing on Windows 11.Results
Findings
Blocking
None.
Non-blocking
None.
Sources
The changed helper uses the DCC alpha flag for the single-channel Vulkan clear, and is called in both the first-upload and metadata-refill paths (
Texture.cpp:3709-3714,Texture.cpp:3786,Texture.cpp:7590). Existing clear-format handling supplies zero/one in the red and alpha slots, andClearLayoutForidentifies single-channel formats (Texture.cpp:1951-1963,Texture.cpp:2272-2300). The added execution test checks R16 clear values for both alpha positions and keys, plus RGBA8 controls (DccKeysFirstWrite.cpp:219-231,DccKeysFirstWrite.cpp:261-283).Not verified
No build or runtime test was run. The author’s reported GPU results were not independently verified.
Texture.cppwas read only in the changed regions and the directly relevant clear helpers; the included execution test and CMake test registration were read in the relevant ranges. No other repository files were reviewed.files.jsonwas unavailable in the prepared review bundle, so the reviewed-versus-excluded manifest list could not be independently checked; the manifest identifiesTexture.cppas excluded from full-text files and lists the two test files as included.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-29T04:52:14Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the reported platform runs are author-reported, and no checks were run in this review.
What I ran
Reviewed head
335d7fc6a14643873c56fccdbe637b0b944cce9c. No commands or tests were run. Readdescription.md,commits.md,manifest.json, anddiff.patch; inspected all changed files, including targeted ranges of the full text for the files excluded from the review folder.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The reported Windows and Linux GPU runs were not independently reproduced. No build or automated test was run.
To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-12-03T14:02:44Z.
Review: APPROVED
I read the diff at
335d7fc6a1. Windows 11, GCC 15.2, merged intomainat6c6b29320fetogether 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_storage_dcc_single_component_clearand theagc_driver_dcc_keys_first_writetests: pass on both GPUs. The loader log shows the layer inserted and no "was not found" line, and neither run has aVUID-orSYNC-HAZARDline.agc_driver_storage_dcc_single_component_clearfails, for example "rebind format 7 alphaOnMsb 1 key 0x40 byte 0: expected ffffffff, read 00000000".Not checked: a title.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T19:21:43Z.
Review: COMMENTED
Source review at
335d7fc6a1. The storage upload and queued key-fill paths both select the alpha value for an alpha-only Vulkan clear. The cache and draw-reuse checks also require compatible DCC alpha placement. The new fixture covers opposite values of the alpha-placement bit for both mixed clear keys and preserves the four-channel controls.On Linux lavapipe, the scalar-buffer and DCC keys first-write controls passed on main
a9cbd48cb0and this head. The change-only storage DCC single-component clear case also passed. All three logs show Khronos validation 1.4.369 inserted with shader caching disabled and no missing-layer messages or VUIDs.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.