feat(agc): implement 11_11_10 float color targets through 32-bit uint attachments #7207
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7207"
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 gjonn on 2026-10-17T16:38:11Z.
What
Color format 7 (
COLOR_11_11_10, float) packs its 10-bit component in bits 0-9 and its two 11-bit components in bits 10-20 and 21-31. COMP_SWAP 2 (reversed order) puts blue in the low 10 bits and red in the high 11. Vulkan has no format with that layout (B10G11R11_UFLOATkeeps red in the low 11 bits), so such a target was refused withunsupported color format 7 number type 7 component swap 2.This takes the path that 10_11_11 unorm targets already use (#1485):
DecodeColorFormatmaps format 7, float, swap 2 to anR32_UINTattachment with the reversed export mapping0xc6and the newColorExportPacking::Float11_11_10.Format10_11_11Float(the layout of image format 43) with the float-to-small-float conversion that format-43 image stores already use: toward zero, overflow to the largest finite value, negatives to zero, NaN kept. The registered artifact is shared; only the pipeline specialization differs.Tested
agc_driver_graphics_tests: newfloat11_11_10TargetTestscovers decode (R32_UINT, mapping 0xc6, packing), the refused swaps, number types, blending, partial writes, int16 exports and DCC, and that ROUND_MODE (CB_COLOR_INFO bit 18) = 1 (truncate) is accepted while bit 18 = 0 (round) is refused. It also checks that serialization keeps the packing, that the specialization differs from the unorm one on the same artifact, shader validation, and that an out-of-range packing value is refused.agc_driver_graphics_testsmultisampleTests: a CB resolve whose source is a packed 10_11_11 unorm or 11_11_10 float target is refused at decode.agc_driver_packed_float_color_target_tests(new): draws 32_ABGR and FP16_ABGR exports into tiled and linear format-7 targets. It compares every pixel with an independent reference packing, including truncation, overflow, Inf, NaN, negatives, small-float subnormals and f32 denormals. It also checks that pixels outside the scissor keep their contents.agc_driver_packed_unorm_color_target_tests,agc_shader_memory_testsand the recorder resolve tests (agc_tiled_resolve,agc_multisample_guest_access,agc_metadata_pass) still pass.request_serializer_testsand the dual-source, reversed-order, SWAP_ALT blend, prepared export/publication and 1_5_5_5 target tests still pass.tools/check_conventions.pypasses.unsupported color format 7 number type 7 component swap 2at its first presented frame. With this change it renders past that format and stops later on an unrelated unimplemented sample of a converted float image (#5958).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 oneandonlydean on 2026-10-17T16:48:14Z.
Thanks, this looks good. The layout, swap, 0xc6 handling, RTZ conversion and cache keys all check out, and the test's CPU reference covers the awkward inputs (NaN, ±Inf, -0, negatives, denormals, overflow). Two small asks before merge:
ROUND_MODE for float targets.
DecodeColorBuffernow applies the ROUND_MODE guard only toUnorm10_11_11. A format-7 target with CB_COLOR_INFO bit 18 = 0 (round rather than truncate) is accepted and still packed toward zero. Mesa programs ROUND_MODE=1 (truncate) for every non-UNORM/SNORM/SRGB target (ac_descriptors.c), and the test fixture also sets bit 18, so RTZ is right for that case. We just don't know what the CB does with bit 18 = 0. Could you add the mirror of the unorm guard, e.g.Require(packing != Float11_11_10 || (info & 0x40000) != 0, "rounding (ROUND_MODE 0) 11_11_10 float color targets are unsupported"), or a debt note saying ROUND_MODE is ignored? Also, which bit 18 value does PPSA01317 set?MSAA resolve of a packed target. Nothing refuses a CB resolve whose source is packed. The resolve only checks that the formats match (both R32_UINT here), so it resolves the raw packed words, and an integer resolve can't average those, so the result is wrong with no error. This gap already exists on main for 10_11_11 unorm; this PR extends it to format 7. One
Require(source.packing == None, ...)in the resolve branch in Draw.cpp would cover both packings. If you'd rather do that separately, a follow-up issue is fine.Imported from boykopovar/AnyPS5. Originally posted by TheSovietWaffle on 2026-10-17T17:07:36Z.
AMD data point, since the description lists an RTX 5090: head
ec28b6be8as-is, Release, Windows 10 Pro 22H2 (19045), WinLibs GCC 15.2.0 r7, AMD Radeon RDNA 2 iGPU (1002:164e, driver 32.0.21045.5002) chosen withANYPS5_GPU.agc_driver_packed_float_color_target: 5 of 5 pass (not skipped).agc_driver_packed_unorm_color_target: 5 of 5 pass.agc_driver_graphics_testswith no arguments (the path withfloat11_11_10TargetTests): 3 of 3 pass.Not checked: other tests, titles.
AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T17:07:40Z.
Heads-up on ordering: #7213 (5_6_5 UNORM colour targets) edits the same swap > 1 allow-list line in
State.cppas this PR, so the two conflict on one line. We plan to merge #7213 first. When you push the ROUND_MODE/resolve changes, could you rebase onto main after #7213 lands? The resolution is just the union of both conditions (format != 7 and format != 16).Imported from boykopovar/AnyPS5. Originally posted by gjonn on 2026-10-17T17:24:44Z.
Thanks for the review. Both are done in ec28b6be8.
ROUND_MODE:
DecodeColorBuffernow refuses an 11_11_10 float target with CB_COLOR_INFO bit 18 = 0 ("rounding (ROUND_MODE 0) 11_11_10 float color targets are unsupported"), mirroring the unorm guard.float11_11_10TargetTestschecks that bit 18 = 1 is accepted and bit 18 = 0 is refused.On PPSA01317: I don't have a capture of CB_COLOR_INFO for its format-7 targets. Our logs only record the format/number/swap error, not the raw register, so which bit 18 value it sets is unverified. The fixture's bit 18 = 1 follows Mesa, not a capture. With this guard, if the title does use bit 18 = 0, it will now stop at the new message instead of being packed toward zero. I'll report back once I've booted it with this guard.
Packed resolve: I put the guard next to the existing format/extent check in
DecodeColorMetadataPass(State.cpp) rather than in Draw.cpp. A CB resolve whose source is a packed 10_11_11 unorm or 11_11_10 float target now throws at decode ("CB resolves of color targets are unsupported"). This covers both packings and fails before any GPU work.multisampleTestscovers both. The mutation checks (guard removed, or limited to 10_11_11 unorm) are caught.I'll rebase onto main once #7213 lands, keeping both formats in the swap allow-list.
@TheSovietWaffle thanks for the AMD run.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-17T17:36:20Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cppL678Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/ControlFlow/src/RequestSerializer.cppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/ControlFlow/src/RequestSerializer.cppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cppcore/shader/recompiler/Recompiler.hppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/Recompiler.hppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/shader/recompiler/Recompiler.hppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/shader/recompiler/ControlFlow/src/RequestSerializer.cppcore/shader/recompiler/Recompiler.hppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/Recompiler.hppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/ControlFlow/src/RequestSerializer.cppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/ControlFlow/src/RequestSerializer.cppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/shader/recompiler/Recompiler.hppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/shader/recompiler/Recompiler.hppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/Recompiler.hppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/shader/recompiler/Recompiler.hppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/Recompiler.hppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/Recompiler.hppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/Recompiler.hppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/Recompiler.hppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/shader/recompiler/Recompiler.hppdocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppdocs/dev/debt/libSceAgcDriver.mddocs/dev/debt/libSceAgcDriver.mdcore/libs/prx/libSceAgcDriver/CMakeLists.txtcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cppcore/libs/prx/libSceAgcDriver/CMakeLists.txtdocs/dev/debt/libSceAgcDriver.mdImported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-17T17:58:39Z.
Second NVIDIA generation + first Intel, head
ec28b6be8, Windows 11, MinGW (WinLibs GCC 15.2.0), Release, serial fresh processes:agc_driver_packed_float_color_targetandagc_driver_graphics(incl.float11_11_10TargetTests) pass.ANYPS5_GPU=UHD, igvk64): both pass.Imported from boykopovar/AnyPS5. Originally posted by gjonn on 2026-10-17T18:12:45Z.
Follow-up on the ROUND_MODE question: I booted PPSA01317 on current main with ec28b6be8 applied and temporarily logged the register. Its format-7 target has CB_COLOR_INFO = 0x0004171c, so bit 18 (ROUND_MODE) is 1, truncation. Neither new refusal fires, and the title renders past this format.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by gjonn on 2026-10-17T21:07:27Z.
Rebased onto main after #7213 (force-push; head d0a9943d8). The only conflict was the swap > 1 allow-list line in
State.cpp, resolved as the union of both conditions (format != 7 and format != 16).agc_driver_graphics,agc_driver_packed_float_color_target,agc_driver_packed_unorm_color_targetandcheck_conventions.pypass on the rebased branch.AI-assisted: yes