feat(agc): truncate exports into 4_4_4_4 unorm targets with ROUND_MODE set #23258
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/23258"
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-18T21:13:26Z.
What
A 4_4_4_4 UNORM color target with
CB_COLOR_INFO.ROUND_MODEset is drawn with truncated exports instead of refused (truncating (ROUND_MODE) 4_4_4_4 unorm color targets are unsupported).State.cppgives such a target the new packingUnorm4_4_4_4Truncated. Its exports and partial-write merges pack each component asfloor(clamp(v, 0, 1) * 15), with NaN to 0. That isNormStoreBitswithout its rounding step. WithoutROUND_MODE, packing still rounds to nearest even, as before.Measured on a 7800X3D iGPU (gfx1036) with a local Mesa 26.0.6 RADV patched for RB+ off (gfx1013 has none) and 32_ABGR exports, into
VK_FORMAT_R4G4B4A4_UNORM_PACK16:ROUND_MODE0ROUND_MODE10x3d888888/0x3d888889(either side of 1/15)0x3f7fffff(0.99999994)The same runs on 11_11_10 float show the bit has no effect there (#23206).
Tested
Linux 7.3.4, GCC 16.2.1 Release, Mesa 26.2.6 RADV,
main67d3465feb. The branch carries #23206's commit first, since both changePackExport.agc_driver_packed_unorm4444_color_targetruns its goldens again on a target withROUND_MODEset, plus a case of0x3d888888,0x3d888889,0x3f088888and0x3f088889(0x1188rounded,0x0178truncated).agc_driver_packed_unorm4444_partial_writereplays its nine merges on a truncating target.agc_graphics_profile_drawdecodes the target asUnorm4_4_4_4Truncated, and its invalid-packing check now uses the value after the last one.main'sState.cpp, emitter and converter, both new passes fail on both GPUs withtruncating (ROUND_MODE) 4_4_4_4 unorm color targets are unsupported. With only the truncation step removed, they fail withholds 0xf804, expected 0xf703(export) andholds 0x3f84, expected 0x3f73(partial write).agc_driver_packed_unorm4444_*tests,agc_driver_packed_float_color_target,agc_driver_packed_float_blendandagc_graphics_profile_draw, run withANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layerandctest -V: 6/6 on both GPUs, layer 1.4.363.1 inserted, 0VUID-lines.ctest -R '^agc'(1936 tests): the failures matchmain's on each GPU.Not tested: gfx1013, Windows, NVIDIA. PS4 (GCN) targets don't read
ROUND_MODE, which the debt entry records.Overlap: #22609 also appends
ColorExportPackingvalues, so whichever merges second renumbers the range checks.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-19T05:42:52Z.
Review: APPROVED
Reviewed — looks good
The inspected implementation supports truncating 4_4_4_4 UNORM exports and partial writes when
ROUND_MODEis set; no blocking defect was verified at head4636f218a153a2d470ae2c5dc8fd7edbbb6b1b5d.What I ran
No commands or tests were run. I read the prepared diff and manifest, then inspected targeted source ranges through
repo_read.pyat the pinned head.Results
Findings
Blocking
None verified in the inspected code.
Non-blocking
None.
Not verified
I read all changed files marked
included: truein the manifest.core/libs/prx/libSceAgcDriver/tests/Graphics.cppwas excluded fromreview/files/because it was too large for the review folder; I inspected its changed lines at the pinned head. Its full text was not read. Tests were not run; the reported GPU andctestresults were not independently verified. Graphics behavior on gfx1013, Windows, NVIDIA, and PS4 hardware was not verified.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T04:53:49Z.
Review: APPROVED
Reviewed — looks good
The changed packing path and its serialization and merge handling look consistent in the inspected code; hardware test results are author-reported and were not run in this review.
What I ran
Reviewed head
ba9b82437dff18c5720b2e624d3e970858a142b1using the prepared diff andrepo_read.pyat the pinned head. No commands or tests were run.Read:
description.md,commits.md,manifest.json,diff.patch; changed repository filesState.cpp,Graphics.cpp(lines 12500–12600),PackedFloatColorTarget.cpp,PackedUnorm4444ColorTarget.cpp,PackedUnorm4444PartialWrite.cpp,RequestSerializer.cpp,FragmentOutputSpecialization.hpp,Recompiler.hpp,SpirvEmitterHelpers.hpp,SpirvFormatConvert.cpp,SpirvModuleEmitter.cpp,ShaderInputInfoBuilder.cpp, and both added debt notes. The fullGraphics.cppwas excluded from the review folder; I read only the relevant region through the reader. No other changed files were excluded.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The reported GPU test runs and their environments were not independently verified. The full
Graphics.cppwas not read; only the modified target test region was inspected. The implementation was not built or tested here, and behavior on gfx1013, Windows, and NVIDIA was not confirmed.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T21:59:19Z.
Review: COMMENTED
The current head conflicts with
main63db72fb61in the graphics tests and shader-format declarations and serializer. Please preserve both the full-write and masked merge routes to 4_4_4_4 truncation when reconciling #23206. The paired cases should keep ties-to-even as the clear ROUND_MODE control, since the partial-write path can otherwise mask a regression in the packing choice.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.