Repository navigation
feat(agc): draw PS4 color targets with CB_COLOR_INFO LINEAR_GENERAL - #25684
puridanish284 wants to merge 1 commit into
Conversation
A GCN color target with LINEAR_GENERAL set threw. It is now a linear surface with the pitch CB_COLOR_PITCH gives, unpadded, at CB_COLOR_BASE plus the low byte of CB_COLOR_VIEW SLICE_START, whatever its tile mode index, as shadPS4 reads these registers. The post-draw range check takes the target's own alignment, at most the 256 bytes it required. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
The change at head 2afe985b20e745e3bde5416d7d6c7e13eb623682 correctly adds single-sample linear-general GCN color-target decoding and coverage for unpadded pitch and byte-offset addressing; no blocking defect was found in the reviewed code.
What I ran
No commands or tests were run. I read the prepared diff and all six changed files at the pinned head. The author reports 30 focused tests passed on WSL2 Ubuntu with lavapipe; this was not independently run.
Results
| Check | Result | Note |
|---|---|---|
| Diff and changed code review | passed | Six changed files read |
| Focused tests | not run | Author reports 30 passed |
| Console behavior | not run | Debt note says not checked |
Findings
Blocking
None.
Non-blocking
None.
Sources
Reviewed changed lines in ColorTargetLayout.hpp, ColorTargetLayout.cpp, Draw.cpp, State.cpp, GcnColorTarget.cpp, execution/GcnLinearGeneralColorTarget.cpp, and the debt fragment. The prepared bundle also included description.md, commits.md, manifest.json, and diff.patch.
Not verified
The reported test run and physical-console behavior were not independently verified. files.json was not available in the provided bundle, so I could not independently compare its reviewed/excluded classifications.
To get this to a good state
Nothing is required.
|
Verified on real AMD hardware (RADV, Linux), which complements the lavapipe + WSL2 run in the PR. Built this branch at
Each prints the success line — the triangle lands in 1860/1860 row-major texels at both So the linear-general GCN color-target decode + draw path holds on real AMD silicon across GCN5 and both RDNA generations, not just lavapipe. Vega (GCN5) is the only pre-RDNA GCN part in my set — the nearest to the PS4's GCN lineage. Evidence: VERIFIED (reproduced under the above conditions on each GPU; deterministic pixel-exact functional test). |
|
NVIDIA run on Linux: the new Setup: RTX 3070 8 GB, NVIDIA 610.57.04, Ryzen 5 5600X, Debian 13 (kernel 6.12.115), GCC 13.3.0 Release, validation layer 1.4.335. Base is the merge-base 526b7b1, head is 2afe985.
Every Vulkan test's log selects the RTX 3070 and shows the layer inserted, none reports it missing, and no log has a AI-assisted: yes |
|
Windows AMD run of head Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release, AMD Radeon RX 6700 XT, driver 32.0.21045.29003.
AI-assisted: yes. |
|
A Windows + NVIDIA run of the current head 2afe985, next to the earlier NVIDIA Linux, AMD Linux and AMD Windows runs. No regressions, and the new execution test passes. System: Windows 11 Pro 10.0.26200, NVIDIA GeForce RTX 4060 (10de:2882, Ada), driver 621.01, Intel Core i5-12400F, WinLibs GCC 15.2.0 r7 (UCRT), Release, Trees, each a full build:
Run:
With this PR, The control does not build:
Not tested: a PS4 title. AI-assisted: yes (Claude Code). It merged the PR, ran the builds and the test sets, and drafted and posted this comment. |
GPU test run: ✅ no new failures or validation errors on Windows / NVIDIABasis: built and ran · this PR's head Checked
Findings: none from this run; this is a correctness run on a GPU, not a code review or a speed measurement. AI-assisted test run (Claude Code) · head |
|
GPU run on RDNA4 (gfx1201) with the AMD Windows driver and the validation layer: the change looks correct. The new test passes 3/3 and fails with main's What this run adds.
Code. I found no defect.
Overlap.
Evidence.
Negative control. Head with main's GPU. Head
Each GPU test selected Validation.
Host:
AI-assisted: yes |
|
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.
|
ligmaSec
left a comment
There was a problem hiding this comment.
The current head conflicts with main f3c2cd73ab in tests/GcnColorTarget.cpp. Please preserve the independent pitch and later-slice checks while rebasing. The posted before/after runs each report 84 VUID-VkDeviceCreateInfo-pNext-pNext messages. A same-machine rerun with Khronos validation 1.4.335 or newer would establish the baseline with the repository's required layer version and confirm the new linear-general draw test is clean under it.
AI-assisted: yes.
What
A PS4 (GCN) color target with
CB_COLOR_INFO.LINEAR_GENERAL(bit 7) set threwendian-swapped or linear-general GCN color targets are not implemented, although the texture path already reads GCN tile index 31 (linear general) as an unpadded linear surface.DecodeGcnColorBuffernow decodes such a target the way shadPS4 reads these registers (GetTileMode,Address,BaseSlice):CB_COLOR_ATTRIBis ignored and the target is linear, as a newColorTileMode::GcnLinearGeneral(0x109, clear of feat(agc): draw PS4 color targets in the PRT tile modes #22514's 0x105 to 0x108);CB_COLOR_PITCHtexels apart with no further padding (GcnLinear, the linear-aligned mode, still pads to max(8, 64 / bytes per texel));CB_COLOR_BASEplusCB_COLOR_VIEW.SLICE_START[7:0]bytes, and no slice offset is added.ColorTileModeBlockBytesgives the new mode a 1-byte alignment. The post-draw range check inDraw.cpp, which required 256-byte alignment for every target, now takes the smaller of 256 and the target'sColorTileModeBlockBytes; that is still 256 for every other mode. Linear-general targets take the same CPU staging path asGcnLinearones.Still refused:
SLICE_START[10:8]set on a linear-general view, multisampled linear-general targets, endian-swapped targets (ENDIAN!= 0), and aTILE_MODE_INDEXof 31 withoutLINEAR_GENERAL. A single-sampleFAST_CLEARkeepsmain's refusal. A debt fragment adds aPS4 (GCN) linear-general color targetsentry (not checked on a console).Tests:
GcnLinearGeneralColorTarget(agc_driver_gcn_linear_general_color_target): an unpadded 72x64 RGBA8 target (72 is not a multiple of the 16 texels linear-aligned would pad to) with tile mode index 14 inCB_COLOR_ATTRIB, atCB_COLOR_BASEand atCB_COLOR_BASE + 0x44. A triangle is drawn into each; every texel must hold its background or the drawn color at its row-major place, and the 256 guard bytes around the target (plus the 0x44 skipped bytes) must stay unchanged.GcnColorTarget.cppLinearGeneralTargetsDecode: the byte offset and tile-index override, an 8-bit target with a 24-texel pitch (accepted as linear-general, refused as linear-aligned), and the refusals listed above.SLICE_STARTbyte fails both tests; padding the pitch asGcnLineardoes fails both (PS4 color target pitch or slice is not padded the way its tile mode pads them). Without theDraw.cppchange the execution test fails at the0x44target withnull or misaligned address.Tested
WSL2 Ubuntu on Windows 11, Release build with GCC, lavapipe (Mesa 25.2.8). Same 29 focused tests (
agc_driver_gcn_*,agc_gcn_*,agc_driver_linear_target_*,agc_driver_cmask_fast_clear,agc_driver_eqaa_color_target) withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,VK_LOADER_DEBUG=layer:main526b7b1: 29/29 passed, 28Insert instance layer "VK_LAYER_KHRONOS_validation"lines, nowas not foundline, 84VUID-VkDeviceCreateInfo-pNext-pNext.agc_driver_gcn_linear_general_color_target), 29 insert lines, nowas not foundline, 87VUID-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
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)tools/pr_overlap.pyfailed closed. #18177, #22140 and #22514 conflict only on adjacent lines:GcnColorTarget.cpp'smain()call list and, for #22514, the end of theColorTileModeenum andColorTileModeIsGcn; whichever merges second keeps both sides. The 41 PRs it could not compare were each merged by hand against this branch and againstmain: none gains a conflicting file or hunk from this branch.🤖 Generated with Claude Code