Skip to content

feat(agc): draw PS4 color targets in the PRT tile modes - #22514

Open
puridanish284 wants to merge 1 commit into
boykopovar:mainfrom
puridanish284:claude/ps4-prt-color-targets
Open

puridanish284 wants to merge 1 commit into
boykopovar:mainfrom
puridanish284:claude/ps4-prt-color-targets

Conversation

@puridanish284

Copy link
Copy Markdown
Contributor

What

A PS4 (GCN) color target in GB_TILE_MODE 11, 12, 16 or 17 (the display and thin PRT modes, 1D and 2D) threw PS4 color target tile mode index N is not implemented, although textures in the same modes already decode. DecodeGcnColorBuffer now accepts them as four new ColorTileMode values that map to the existing kGcnDisplayPrt, kGcnDisplay2DPrt, kGcnThinPrt and kGcnThin2DPrt texture modes, so ColorTargetLayout and the resident image use GcnTiling's PRT geometry. Slices are one whole surface apart and, as for PRT texture layers (layerBankStep 0), take no per-slice bank rotation. macroTiled now comes from IsGcnMacroTiled, so the existing refusal of multisampled later slices covers the PRT modes too. GB_TILE_MODE 15 and 18 to 30 still throw. A debt fragment adds a PS4 (GCN) PRT color targets entry (not checked on a console; partly resident PRT surfaces are not modeled).

Tests:

  • New execution test GcnPrtColorTarget (agc_driver_gcn_prt_color_target): fills three-slice 128x128 RGBA8 arrays in each of the four modes through the texture path's placement, draws a triangle into slices 0 and 2 and checks every texel is either its background or the drawn color at the place the texture path gives it. Mutation check: mapping GcnThinPrt to kGcnThin2DPrt fails it (ThinPrt slice 0: the texel the texture path places at (16, 27) holds 08 1b 10 ff, neither its background nor the color drawn for it).
  • GcnColorTarget.cpp PrtTargetsDecode: each mode decodes as its PRT tile mode over one 128x128 macro tile, slice 1 lands one macro tile further on without a bank XOR, a target half a macro tile tall is refused, and mode 15 still throws.

Tested

WSL2 Ubuntu on Windows 11, Release build with GCC, lavapipe (Mesa 25.2.8). Same 20 focused tests (ctest -R '^(agc_driver_gcn_|agc_gcn_|agc_driver_graphics$|agc_driver_[a-z0-9_]*color_target$)', agc_gcn_vop3_compare_true not built) with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, VK_LOADER_DEBUG=layer:

  • main 5adb7d2: 20/20 passed, 17 Insert instance layer "VK_LAYER_KHRONOS_validation" lines, no was not found line, 51 VUID-VkDeviceCreateInfo-pNext-pNext.
  • This PR: 21/21 passed (the 20 plus agc_driver_gcn_prt_color_target), 18 insert lines, no was not found line, 54 VUID-VkDeviceCreateInfo-pNext-pNext.

The only validation ID on both is the device-creation one from Ubuntu's older 1.3.275 layer (#17693), three per test; the change adds no new VUID-. No title was run.

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
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: lavapipe (Mesa 25.2.8 llvmpipe, Vulkan 1.4.318), WSL2 Ubuntu on Windows 11
  • AI-assisted: yes

tools/pr_overlap.py failed closed. #18177 and #22140 conflict only where GcnColorTarget.cpp's main() lists its test calls. #22140 materializes partial CMASK fast clears of GcnThin2D and GcnDisplay2D targets only, so a fast-cleared 2D PRT target keeps its current path whichever merges first. The other PRs it could not compare (#1395, #6188, #6235, #6804, #7256, #9895, #10249, #11825, #20845) do not touch the GCN color tile-mode switch or ColorTextureTileMode.

🤖 Generated with Claude Code

A GCN color target in GB_TILE_MODE 11, 12, 16 or 17 threw. It now uses
the tiling the texture path gives the same mode, with slices one whole
surface apart and no per-slice bank rotation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added docs agc libSceAgc* labels Nov 17, 2026
@tablefrogpillow

Copy link
Copy Markdown
Contributor

Real-AMD coverage — the PRT tile-mode color targets land correctly across GCN5, RDNA2 and RDNA3. agc_driver_gcn_prt_color_target, head 0122daa3, Khronos validation 1.4.363, ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1:

GPU arch result
RX Vega 56 (RADV VEGA10, gfx900, Wave64) GCN5 Pass, 0 VUID
Ryzen 7000 iGPU (RADV RAPHAEL, gfx1036) RDNA2 Pass
RX 7900 GRE (RADV NAVI31, gfx1100) RDNA3 Pass, 0 VUID
lavapipe SW Pass

On all four: "triangles drawn into slices 0 and 2 of three-slice arrays in GB_TILE_MODE 11, 12, 16 and 17 land where the texture path places those layers (13234 DisplayPrt / Display2DPrt / ThinPrt / Thin2DPrt texels each), and every other texel keeps its background." GCN5 is the native arch GB_TILE_MODE comes from, so good to have the PRT tiling confirmed on real GCN hardware alongside RDNA, beyond the lavapipe run.

AI-assisted: yes

@domx4q

domx4q commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Ran the Tested section's pattern with the Khronos validation layer on NVIDIA's proprietary driver and a real display, since the PR was tested on lavapipe only.

Setup: Arch Linux (kernel 7.3.4), GCC 16.2.1, Release, NVIDIA GeForce RTX 4090 (vendor 0x10de, device 0x2684, Ada), proprietary driver 620.70.06, Vulkan 1.4.357, Khronos validation layer 1.4.363.1. Head 0122daa352 merged onto main 89b0eef7ab with --no-ff, clean merge. Main baseline is a Release build of 89b0eef7ab on the same machine. Both sides ran under a Wayland session (Hyprland) with ANYPS5_REQUIRE_DISPLAY=1, so agc_driver_gcn_display_present and agc_driver_gcn_display_present_trigger run instead of skipping.

WAYLAND_DISPLAY=wayland-1 XDG_RUNTIME_DIR=/run/user/1000 DISPLAY=:0 ANYPS5_REQUIRE_DISPLAY=1 \
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer \
ctest --test-dir build -R '^(agc_driver_gcn_|agc_gcn_|agc_driver_graphics$|agc_driver_[a-z0-9_]*color_target$)' -V
main 89b0eef7ab this PR
Result 21 passed (21) 22 passed (22)
Insert instance layer "VK_LAYER_KHRONOS_validation" 17 18
was not found but was requested by env var VK_INSTANCE_LAYERS 0 0
VUID- none none

New on the PR side and absent on main: agc_driver_gcn_prt_color_target; it passes. agc_gcn_vop3_compare_true, not built in the Tested section's run, is built here and passes on both sides. Every device selection picked the RTX 4090.

No new VUID- errors; all focused tests pass on Ada.

AI-assisted: yes (Claude Code)

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Some 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.

Pull request Shared files not compared
PR 1395 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 6188 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 7256 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 7668 core/libs/prx/libSceAgcDriver/Graphics/include/ColorTargetLayout.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ColorTargetLayout.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 9748 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 9895 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 11551 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 11825 core/libs/prx/libSceAgcDriver/Graphics/include/ColorTargetLayout.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ColorTargetLayout.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 17056 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 19821 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 20010 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 20518 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 21948 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 22140 core/libs/prx/libSceAgcDriver/Graphics/include/ColorTargetLayout.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ColorTargetLayout.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/GcnColorTarget.cpp
PR 22251 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 22328 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 22439 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 23252 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 23258 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 23281 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 23811 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 23818 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 24049 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 24083 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 24327 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 25489 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 25557 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 26630 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 26691 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 27672 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 27698 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 27966 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 28118 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 28197 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 28209 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 28250 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 28311 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 28350 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 28400 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 28411 core/libs/prx/libSceAgcDriver/Graphics/src/ColorTargetLayout.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 28564 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 28586 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 28590 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 28605 core/libs/prx/libSceAgcDriver/Graphics/include/ColorTargetLayout.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ColorTargetLayout.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 28668 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 28808 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 28870 core/libs/prx/libSceAgcDriver/Graphics/include/ColorTargetLayout.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ColorTargetLayout.cpp
PR 28945 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 29042 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 29066 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 29067 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 29076 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 29084 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 29087 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 29089 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 29095 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 29118 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 29119 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 29120 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 29123 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 29200 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 29280 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp

@Lyrnc

Lyrnc commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Windows run, since the runs so far are on Linux (lavapipe, RADV and NVIDIA). Head 0122daa352 merged onto main 6286d36449 (clean merge).

Setup: Windows 11 Pro 10.0.26200, WinLibs GCC 15.2.0 r7 UCRT, Ninja, Release, ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, GPU picked with ANYPS5_GPU. No validation layer on this machine.

test NVIDIA GeForce RTX 5080 (610.88) AMD Radeon Graphics, Ryzen 7 9800X3D iGPU (2026.04.17)
agc_driver_gcn_prt_color_target 3 of 3 pass 3 of 3 pass
agc_gcn_color_target 3 of 3 pass 3 of 3 pass
agc_gcn_vop3_compare_true 3 of 3 pass 3 of 3 pass

^agc_|^shader on the RTX 5080 with this PR (2003 tests, -j 4): two failures, both failing on main on this card too and tracked elsewhere: agc_driver_stencil_plane_memory (#22427, fix in #22508) and agc_driver_msaa_dcc_unwatch (#22931, fix in #22950). The build is otherwise clean on Windows; only agc_driver_upload_cache_read_only_flush does not build, as on main (#22358).

AI-assisted: yes

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — no blocking findings

The changed code and all added lines support the stated PRT color target behavior; I could not run the reported checks in this review environment.

What I ran

Reviewed head 0122daa352b8cc2975f03a0490aec9967e99d752. I inspected the prepared diff and traced the changed layout and decode logic with the pinned repo_read.py reader. No test or build commands were run.

Results

Check Result Note
Diff and changed lines passed All six changed files inspected
Build and tests not run Author reports 21 focused tests passed
Console behavior not run Author states this was not checked

Findings

Blocking

None.

Non-blocking

None.

Not verified

I did not run the build or tests, so the reported test results are author-provided. Physical console behavior and partly resident PRT surfaces were not verified. The six changed files listed in review/manifest.json were read, including all added lines; files.json lists no excluded changed files.

To get this to a good state

Nothing is required.

@ligmaSec ligmaSec left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trial merging onto main a1b75b0947 conflicts in GcnColorTarget.cpp. The new modes reuse the texture path's PRT geometry, so the nonzero slice case matters as much as the register decode. Please preserve the tests for whole-surface slice spacing and no per-slice bank rotation while retaining the refusal of multisampled later macro-tiled slices. The paired Vulkan run is pending the merge resolution.

AI-assisted: yes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs needs rebase Conflicts with main, rebase needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants