You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(agc): support 4_4_4_4 component orders during PPSA38500 loading - #1832
Source commit: e2e97886eee135e83ea9a55e8cdb769768eba6ff. The import branch preserves this fetched upstream PR snapshot. The description and validation below are copied from upstream; no new code changes or test runs were made for this import. Original reviews, discussions, and attachments remain at the linked upstream PR.
What
PPSA38500 stopped presenting during story loading on Windows. Its draw requested a packed 4_4_4_4 UNORM color target with COMP_SWAP=1, which the color decoder rejected.
Use the four-channel mapping already used for RGBA16 to select the source of each nibble in the R16_UINT attachment. Full writes and masked writes now honor STD, ALT, STD_REV and ALT_REV. The packing and rounding logic comes from the existing packed export path. AMD PAL four-component swap definitions
For packed 4_4_4_4, check the blend equation only for channels selected by the guest write mask. Source replacement bypasses blending before component-order translation, including STD_REV and ALT_REV. Equations that blend any written channel retain the existing unsupported checks.
Tested
agc_driver_graphics passed on Ubuntu 26.04.1 LTS, GCC 15.2.0, at e2e97886ee. The test covers alpha-only replacement with RGB writes masked, replacement in both reversed component orders, and rejection when a written channel needs blending. It also checks masked alpha and opaque-destination replacement. Linux validation
The Vulkan comparisons confirmed the component-order fix on Windows with NVIDIA and Linux with AMD.
Vulkan comparisons by GPU and tested revision
Using Windows 11 Pro and NVIDIA driver 621.14, the two Vulkan tests reproduced the format 19, UNORM, swap 1 rejection on main b19e5a8a96 and both passed on 399d893d4b. The color-mapping patch was identical on the initial PR head ab696034d9.
agc_driver_packed_unorm4444_color_target read back RGBA nibbles 1, 2, 7 and E as 0xe721, 0xe127, 0x127e and 0x721e for swap modes 0–3. Pixels outside the scissor kept their initial values.
agc_driver_packed_unorm4444_partial_write checked red-only writes on a tiled target and preserved the other nibbles. Both Vulkan runs loaded validation layer 1.4.368 and reported zero VUID or synchronization errors. The partial-write test emitted the same ten unused fragment-output warnings on each build.
agc_driver_graphics passed on 399d893d4b, including the four red-channel masks and unsupported numeric types.
tablefrogpillow independently ran agc_driver_packed_unorm4444_color_target on a Radeon RX Vega 56 with Linux and RADV. Initial PR head ab696034 passed three runs with zero validation errors. Restoring State.cpp from base 073e0313 reproduced the COMP_SWAP=1 rejection. Independent AMD result
gmankab ran both packed-color fixtures on Fedora Linux 45 Toolbox with a Radeon RX 6800 (RDNA2) and Mesa RADV 26.2.7. The existing decoder on the same startup stack refused COMP_SWAP=1 in both fixtures. Both fixtures and agc_driver_graphics passed with PR revision fc78d6bb, including its alpha-blend case. Khronos validation 1.4.350 loaded on both builds and the logs contained zero VUID entries. Independent RDNA2 result
Checklist
Based on current main; no other open PR implements the same functions
One topic per PR; follow-ups go in a new PR
No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
No notes, investigation .md files or images added to the repository (attach them to this PR)
New third-party code is a submodule built from source
No actionable comments were generated in the recent review.
Walkthrough
Changes: 4_4_4_4 UNORM target handling
Layer / File(s)
Summary
Decode component swaps and validate packed writes core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp, core/libs/prx/libSceAgcDriver/tests/execution/PackedUnorm4444*
Color-format decoding uses a shared component mapping, and format 19 accepts UNORM swap values 0–3. Execution tests check packed values and partial-write masks for the component swaps.
Handle replacement blending and exported channels core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp, core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
Blend decoding handles replacement equations for exported channels on 4_4_4_4 UNORM targets. Tests cover blend rejection, alpha preservation, opaque destinations, and reversed component orders.
Suggested reviewers:jab-dev, frankea
Change: Bug fix
Merge Risk: Minimal · up to e2e97
This change lets 4_4_4_4 render targets use all four component orders and skips blending when every written channel is replaced. The supplied evidence shows no concrete defect, and tests cover the new behavior, so merge risk is minimal.
Security architecture risk: Minimal · up to e2e97
AGC Graphics accepts more component orders for packed 4_4_4_4 color targets without changing the host attachment format or who controls the target. Writes that actually require blending remain unsupported, and partial writes use the existing merge path.
Security review details
Security Blast Radius
inferred — The widened reachability is to more guest-selected component orders on the existing packed render-target path. The changed decode still selects the same host attachment representation and does not grant access to a new class of host resource.
Trust Boundaries and Controls
observed — Guest color and blend fields pass through the existing decoder. The unsigned-integer blend check runs before the replacement shortcut, and the packed-target check still rejects blending when a written channel needs a non-replacement equation.
Rollout and rollback
inferred — Admission is controlled by the AGC Graphics decoder, not by a new operator setting. Reverting to the compared base would restore live rejection of swaps 0, 1, and 3. The journal still stores the decoded mapping and mask in the existing fields; the source comparison identifies no journal schema migration or new operator action.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning
Some tools did not complete. Review the errors below.
Cppcheck (2.22.0)
Cppcheck (2.22.0) exceeded its 180-second time budget. Findings from completed work are retained; remaining checks are incomplete.
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
Cppcheck interrupted; analysis of this file is incomplete
This review exceeded your plan’s limits and used usage-based reviews—free during trial, billed after paid activation unless disabled. Manage usage-based reviews.
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: 9fb8d4da-da02-4255-9194-f7cae625c2c6
Commits
Reviewing files that changed from the base of the PR and between 4131f51 and e2e9788.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
PPSA38500 stopped presenting during story loading on Windows. Its draw requested a packed 4_4_4_4 UNORM color target with
COMP_SWAP=1, which the color decoder rejected.Use the four-channel mapping already used for RGBA16 to select the source of each nibble in the R16_UINT attachment. Full writes and masked writes now honor STD, ALT, STD_REV and ALT_REV. The packing and rounding logic comes from the existing packed export path. AMD PAL four-component swap definitions
For packed 4_4_4_4, check the blend equation only for channels selected by the guest write mask. Source replacement bypasses blending before component-order translation, including STD_REV and ALT_REV. Equations that blend any written channel retain the existing unsupported checks.
Tested
agc_driver_graphicspassed on Ubuntu 26.04.1 LTS, GCC 15.2.0, ate2e97886ee. The test covers alpha-only replacement with RGB writes masked, replacement in both reversed component orders, and rejection when a written channel needs blending. It also checks masked alpha and opaque-destination replacement. Linux validationThe Vulkan comparisons confirmed the component-order fix on Windows with NVIDIA and Linux with AMD.
Vulkan comparisons by GPU and tested revision
Using Windows 11 Pro and NVIDIA driver 621.14, the two Vulkan tests reproduced the format 19, UNORM, swap 1 rejection on main
b19e5a8a96and both passed on399d893d4b. The color-mapping patch was identical on the initial PR headab696034d9.agc_driver_packed_unorm4444_color_targetread back RGBA nibbles 1, 2, 7 and E as0xe721,0xe127,0x127eand0x721efor swap modes 0–3. Pixels outside the scissor kept their initial values.agc_driver_packed_unorm4444_partial_writechecked red-only writes on a tiled target and preserved the other nibbles. Both Vulkan runs loaded validation layer 1.4.368 and reported zero VUID or synchronization errors. The partial-write test emitted the same ten unused fragment-output warnings on each build.agc_driver_graphicspassed on399d893d4b, including the four red-channel masks and unsupported numeric types.tablefrogpillow independently ran
agc_driver_packed_unorm4444_color_targeton a Radeon RX Vega 56 with Linux and RADV. Initial PR headab696034passed three runs with zero validation errors. RestoringState.cppfrom base073e0313reproduced theCOMP_SWAP=1rejection. Independent AMD resultgmankab ran both packed-color fixtures on Fedora Linux 45 Toolbox with a Radeon RX 6800 (RDNA2) and Mesa RADV 26.2.7. The existing decoder on the same startup stack refused
COMP_SWAP=1in both fixtures. Both fixtures andagc_driver_graphicspassed with PR revisionfc78d6bb, including its alpha-blend case. Khronos validation 1.4.350 loaded on both builds and the logs contained zero VUID entries. Independent RDNA2 resultChecklist
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)ab696034and Radeon RX 6800 atfc78d6bb.Summary by CodeRabbit