feat(agc): average the samples of a 4_4_4_4 unorm CB resolve #24049
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/24049"
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 Colewiz7 on 2026-11-20T02:15:33Z.
What
A CB resolve of a multisampled 4_4_4_4 unorm color target was refused (
CB resolves of 4_4_4_4 unorm color targets are unsupported). It now runs through the fragment pass #23225 added for 11_11_10 float, with two new variants ofFirstSample.frag. Each averages the four 4-bit fields over the samples:CB_COLOR_INFO.ROUND_MODE(sum + n / 2) / n, halves round upsum / n, truncatedThat is the rule measured on a 7800X3D iGPU (gfx1036) with Mesa 26.0.6 RADV's hardware resolve (
method=HW), RB+ off,VK_FORMAT_R4G4B4A4_UNORM_PACK16, 256x256. Per-sample codes were rendered and read back through 1-sample draws, and the rule matched every one of the 262,144 fields for 2, 4 and 8 samples in each mode. Rounding halves to even fails, and so does averaging the normalized floats.The probe set
ROUND_MODEon both targets at once, so a resolve between 4_4_4_4 targets whoseROUND_MODEor layout differ is still refused.FirstSampleCopy'saveragePackedflag becomesPackedAverage(None,Float11_11_10,Unorm4_4_4_4,Unorm4_4_4_4Truncated), andMultisampleTargetkeeps one resolve pass per kind. The debt fragment changes the "4_4_4_4 CB resolves" entry.Tested
Linux 7.3.4, GCC 16.2.1 Release, Mesa 26.2.6 RADV,
maind50640e264with #23258's commits first.agc_driver_packed_unorm4444_color_targetnow resolves 2-, 4- and 8-sample tiled targets in both modes and compares every pixel with the rule above. The expected words come from the codes each sample was drawn with.agc_graphics_profile_drawchecks that the resolve decodes, and that a mismatchedROUND_MODEis refused.a CB resolve of a two-sample 4_4_4_4 unorm target with ROUND_MODE 0: pixel (0, 0) inside the scissor holds 0x774e, expected 0x884f.agc_driver_packed_unorm4444_color_targetsolo: 3/3 on each GPU.agc_driver_packed_unorm4444_color_target,agc_driver_packed_unorm_color_target,agc_driver_packed_float_color_targetandagc_graphics_profile_drawwithANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layerandctest -V: 4/4 on both GPUs, 0VUID-lines.ctest -R '^agc'(1965 tests): the only failure isagc_driver_image_table_packed_guards, which fails onmaintoo (#22512).Not tested: gfx1013, Windows, NVIDIA, and which target's
ROUND_MODEthe hardware applies when the two differ.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-11-20T10:14:06Z.
Review: COMMENTED
Reviewed — comments
The shader and state changes look consistent with the stated behavior, but review coverage is incomplete because one changed file was excluded and not all included changed files were inspected.
What I ran
Reviewed head
43cba43a37853d35c3f0f3238a948d1d37da76afusing the prepared diff andrepo_read.py; no tests or build commands were run.Results
Findings
Blocking
None identified in the inspected code.
Non-blocking
The PR changes float 11_11_10 NaN packing and rounding behavior alongside the 4_4_4_4 work. Its description and tests give a separate measurement basis for that change, but this review did not inspect every related implementation and test path.
Not verified
core/libs/prx/libSceAgcDriver/tests/Graphics.cppwas excluded from the review bundle because it was too large; only its changed resolve-test hunk was read. Other included changed files not listed as inspected were not fully reviewed. The author-reported test results were not independently run. The review did not verify behavior on gfx1013, Windows, NVIDIA, or a physical console.Files read:
review/description.md,review/commits.md,review/manifest.json,review/diff.patch; selected ranges fromcore/libs/prx/libSceAgcDriver/Graphics/src/State.cpp,core/libs/prx/libSceAgcDriver/Graphics/src/MultisampleTarget.cpp,core/libs/prx/libSceAgcDriver/Graphics/shaders/FirstSample.frag,core/libs/prx/libSceAgcDriver/Graphics/src/FirstSampleCopy.cpp,core/libs/prx/libSceAgcDriver/tests/Graphics.cpp,core/shader/recompiler/Recompiler.hpp,core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp, andcore/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvFormatConvert.cpp.To get this to a good state
Nothing is required. Optional: complete review of the remaining changed files and independently run the reported checks before making a formal approval decision.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T21:56:54Z.
Review: COMMENTED
Trial merging this head with
main63db72fb61conflicts in the resolve implementation, graphics fixture and three shader format/serialization files. Please reconcile the packed mode through both the color export and resolve paths in the same rebase. Keep coverage for integer tie-up and truncation at 2x, 4x and 8x, plus the refusal when the source and destination modes differ. The paired Vulkan run is pending the merge resolution.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.