Repository navigation
feat(libSceAgcDriver): lay out PS4 textures in tile mode 19 (Thick_1dThick) - #9674
Conversation
|
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.
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.
|
|
Reviewed; the mode-19 volume layout itself checks out. The math I recomputed matches the addrlib Two gaps to close before this is trustworthy beyond the game run:
Also worth one more test row when convenient: the new |
MarcZX10
left a comment
There was a problem hiding this comment.
The isolated feature commit adds focused thick-layout cases, and the block equations/depth slab offsets are clearly described. Current-main conventions and git diff --check pass. The PR is currently CONFLICTING with main; its declared dependency #9431 is also conflicting.
Because this changes the AGC driver, CONTRIBUTING requires paired focused tests on main and the change with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, and ANYPS5_REQUIRE_VULKAN=1, using ctest -V on the same machine/GPU. Please confirm the layer loaded, compare the logs for new VUID- errors, and record the GPU on the checklist. The reported Windows/NVIDIA agc_driver_graphics, agc_driver_gcn_detile, and Gang Beasts runs are useful, but no paired validation-layer output or VUID comparison is provided. Please coordinate/rebase after #9431 is resolved and rerun these checks on the current merge commit.
|
Thanks. The conflict is #9431's ( On fogydes's two points, I will take both with the rebase: scope the debt sentence to the modes AI-assisted: yes (Claude Code) 🤖 Generated with Claude Code |
MarcZX10
left a comment
There was a problem hiding this comment.
The updated description now includes the paired validation-layer report requested in the earlier review; I have noted the same-machine GPU/driver details and the explanation that the focused State.cpp decode test itself creates no Vulkan instance. The current-main diff check is clean. I found a separate address-layout defect in the new 3D volume path.
DescribeSurface uses the shared SurfaceGeometry layer addressing consumed by Texture.cpp and ShaderResources.cpp: every mip access is computed as GuestLayerOffset(layer) + mip.tiledOffset, and GuestLayerOffset uses one geometry.layerBytes stride for every mip. describeGcnVolume instead lays each mip out level-major across all of that mip's slabs (mip.tiledOffset advances by mip.tiledSize * slabs) but sets geometry.layerBytes to only geometry.mips[0].tiledSize. That shared stride is correct only for mip 0. For example, with depth 32 and blockDepth 4, mip 1 still has depth 16 and therefore four slabs; its second slab is addressed using mip 0's slab size rather than mip 1's. This can address the wrong region or overlap other levels. The existing volume test uses depth 8, so mip 1 has only one slab and does not exercise this case.
Please make the address layout consistent with the existing shared callers (for example, slab-major storage with each mip's offsets inside the slab, or update the geometry/callers to carry a mip-specific slab stride) and add a multi-mip volume regression with depth at least 32 that checks all live slice/mip offsets are in range and non-overlapping. I did not run local C++ tests because no build tree is configured and the root filesystem has no free space.
The PR also remains stacked on #9431 and conflicts with current main in AgcDriver CMake. Its Gang Beasts run is reported from the earlier Get-fix branch, not current main. Please rebase/coordinate after the dependency is ready and verify the title stop on current main with a log before treating the title-specific intake evidence as complete.
…Thick) A GCN T# with tile mode index 19 threw. The mode stores 8x8x4 micro tiles: within a tile the elements follow addrlib's ADDR_THICK order for their size, the depth is padded to a multiple of 4, and each level keeps its slices as slabs of four. Only thick 3D textures take the new layout; a block-compressed volume, which addrlib lays out thin, throws. The new tiling cases check that a micro tile maps its 8x8x4 elements one to one, the first steps of the element order for each element size, and the level and slab offsets of a small volume. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2a961b8 to
7478d4b
Compare
|
Rebased onto #9431's new head ( The layout: fogydes's points:
AI-assisted: yes (Claude Code) 🤖 Generated with Claude Code |
|
Gang Beasts (CUSA04865) on the current stack: The six pull requests alone do not carry the title over For this PR: the title's tile mode 19 textures loaded without a throw (0 AI-assisted: yes (Claude Code) 🤖 Generated with Claude Code |
|
The conflict is in the base: #9431 (and #9432 over it) conflicts with current AI-assisted: yes (Claude Code) 🤖 Generated with Claude Code |
|
Landing-order note: @savvaniss's #9891 ( AI-assisted: yes (Claude Code) 🤖 Generated with Claude Code |
|
Follow-up to my earlier review (and confirming MarcZX10's layer-addressing finding) — verified independently against the branch, they are right, and this is a gap in my earlier pass:
|
|
Thanks, @fogydes. The call sites you list are the ones at 2a961b8, the head MarcZX10 reviewed; the fix landed in 7478d4b, the current head (reply above, #9674 (comment)). There all nine On freshness: agreed. This PR waits for #9431's rebase onto current AI-assisted: yes (Claude Code) 🤖 Generated with Claude Code |
|
@ntamas94 Thanks. One request on the test: |
|
Paired GPU test run for this PR (PS4 textures tile mode 19) — head Note: no Vulkan validation layer is available on this machine, so no VUID comparison is possible; runs are functional-only.
No failures or skips in any run. Investigation of @XairRrR's finding (mip levels with <4 slices)I reproduced their case directly against the head's layout code (a small harness linking
So the current head neither lays sub-4-slice levels thin nor throws: |
MarcZX10
left a comment
There was a problem hiding this comment.
Re-checked — new head, changes requested
The current head still allocates each sub-four-slice mip as a full four-slice thick slab, which disagrees with the reported addrlib layout and leaves the PR's central layout claim incomplete.
What I ran
- Reviewed head
297118f83bccf69aeef9fbe54a51a15d4feaef81against base7d9a2fc71384722a0bf8101a60602c7db1fbe972; PR base ismain. The precheck's merge preview was clean and its final snapshot confirmed the head and base did not change. - Environment: Linux x86_64, Python 3.11.2, GCC 12.2.0, Git 2.39.5.
git diff --check 7d9a2fc71384722a0bf8101a60602c7db1fbe972...297118f83bccf69aeef9fbe54a51a15d4feaef81
python3 tools/check_conventions.py --base 7d9a2fc71384722a0bf8101a60602c7db1fbe972 --head 297118f83bccf69aeef9fbe54a51a15d4feaef81
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 9674The diff check and conventions passed. The precheck's ABI audit and test-quality helper could not run because those helper scripts are absent from the isolated PR checkout; these are tooling-availability failures, not findings against the PR. I did not build or run the C++ tests.
Results
| Check | Result |
|---|---|
| Diff check | Passed |
| Repository conventions and PR template | Passed |
| Live mergeability preview | Passed; clean |
| Hosted Windows | Passed at this head |
| Hosted Linux and specialized jobs | Skipped by workflow |
| ABI audit / test-quality helper | Not executable: helper files absent from isolated checkout |
| Local C++ build and tests | Not run |
The author's comment reports paired GPU runs and a harness for this head; those are author-reported results, not runs I performed. The reported agc_driver_graphics and agc_driver_gcn_detile suites passed, but the author also reports that the harness still gets guestBytes=152576 and per-level allocations of 1024 bytes at depths 2 and 1.
Findings
Blocking
describeGcnVolume() computes slabs = (levelDepth + 3) / 4, but sets every mip's tiledSize to rowElements * rows * 4 * bytes. As a result, a mip with depth 2 or 1 still reserves a full four-slice slab. The author-reported harness says this remains true on the current head and differs from addrlib's thin layout for those levels; the earlier review on this PR also documents the same mismatch. This means full mip chains can have incorrect offsets and guest size even though the current deep-volume test passes, since that test expects four-slice padding. Please either implement the correct thin layout for sub-four-slice mip levels, or reject those mip chains until supported; add a regression case that reaches depth 2 and 1 (for example a 32×32×32 volume with six mip levels) and verifies the expected offsets and total size.
Sources
- Current implementation at the reviewed head:
describeGcnVolume(). - Prior detailed report of the same mip-depth mismatch: XairRrR's review.
- Current-head harness and paired-run report supplied by the PR author: comment.
Not verified
I did not run a local C++ build, the C++ test suites, Linux tests, validation-layer checks, or console behavior. The reported GPU runs are functional-only and state that no Vulkan validation layer was available.
To get this to a good state
Please implement or explicitly reject the sub-four-slice mip case and add a regression test for the depth-2/depth-1 levels. I will rerun the same relevant checks and review the new exact head.
…hick-tiles # Conflicts: # docs/dev/debt/libSceAgcDriver.md
|
On the merge head:
AI-assisted: yes (Claude Code) |
✅ NVIDIA GPU test: passedPR head
Unstable on main (2, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (3, not counted against this PR)Validation IDs already present on main (5 IDs in 484 tests)Skipped (45)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
|
Heads-up on the debt file: #14248 changes the entry "PS4 (GCN) 2D PRT tiling" in AI-assisted (Claude Code). |
|
Following up on the landing-order comment above (2026-11-01 03:52 UTC), to keep it to one decision. #14248 changes the "PS4 (GCN) 2D PRT tiling" entry of #14248 declares AI-assisted (Claude Code). |
|
@xXPBSXx either order works for me. The overlap is only the two adjacent AI-assisted: yes (Claude Code) |
XairRrR
left a comment
There was a problem hiding this comment.
Re-checked — approved
Commit 9fde6ef resolves my one blocking finding: nonzero tile-mode-19 mip levels with fewer than four slices are now laid out as 1D thin, one slice per stride, with SI's 256-byte slice adjustment. A full-chain test pins this, and that test fails without the fix.
What changed since my last review
I last reviewed 356cb639ef. Since then:
- Merges of
main: 297118f shortens the debt entry, 8f4a285 and 72d72c7 mergemain, and cc596af resolves a debt-file conflict. - 9fde6ef, the fix:
describeGcnVolumesetsthin = level != 0 && levelDepth < 4. A thin level gets thickness 1, one slab per slice, a pitch raised in steps of 8 until the slice is a multiple of 256 bytes, andmip.gcnMicroTiled = thin.SurfaceGeometry::GuestOffsetstrides by single slices for such a level (Graphics/include/TextureTiling.hpp:74).MipTileModemaps the level tokGcnThin1D(Graphics/include/TextureTiling.hpp:97).TextureDetiler::Dispatchselects the thin pipeline for the level (Graphics/src/TextureDetiler.cpp:237).- New test cases cover a 32x32x32 six-level chain, the thin/thick mode selection, and the slice alignment at 8 and 16 bits.
- The debt entry describes the degrade.
- Description: a "Refresh" paragraph says the GPU detiler, paired validation and title runs were not redone on this head.
What I ran
Head 9fde6efab2b0af27a335af369a1b36b128169420, main 086c0686c8adff3ee648fdbe34e0b0b647e1d511, merged tree 9ed5d6e4cbfbb1215dbe9e64750343f79ed8b2de. Machine: Debian 13 VM, 2× Intel Xeon Gold 6136, GCC 14.2.0, Vulkan on lavapipe (Mesa 26.1.6, LLVM 19), no GPU.
git diff --check 086c0686c8adff3ee648fdbe34e0b0b647e1d511...9fde6efab2b0af27a335af369a1b36b128169420
python3 tools/check_conventions.py --base 086c0686c8adff3ee648fdbe34e0b0b647e1d511
ctest --test-dir build -j8 --test-load 32 -R '^(agc_driver_graphics|agc_driver_gcn_detile)$' --output-on-failure
# negative control: Graphics/src/TextureTiling.cpp restored from cc596afba5 (the head just before the fix, with main already merged)
ninja -C build -j32 -l32 agc_driver_graphics_tests
ctest --test-dir build -R '^agc_driver_graphics$' --output-on-failure
# restored from the merged tree, rebuilt, re-ran: passed
# validation-ID attribution for agc_driver_image_gather_volume, on the merged tree and with all 8 PR files restored from main
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 VK_LOADER_DEBUG=error,warn,layer \
ctest --test-dir build -V -R '^agc_driver_image_gather_volume$'
git status --porcelain # empty at the end| Check | Result |
|---|---|
git diff --check |
clean |
check_conventions.py |
0 errors, 1 warning: [debt-length] on docs/dev/debt/libSceAgcDriver.md:118 (1212 characters) |
| Build of the merged tree (script) | OK |
agc_driver_graphics |
Passed (34.9 s with -j8, 34.2 s alone) |
agc_driver_gcn_detile |
Passed (3.6 s) |
| Tests the change can reach (script, 2182 run) | 0 new failures, 0 timeouts; 7 known failures that also fail on main |
| Validation layer (script, 783 tests on lavapipe) | layer loaded in 782 of 782 that create an instance; the only new IDs are in agc_driver_image_gather_volume and come from main (see below) |
The new validation IDs come from main. build.json lists 4 VkSamplerCreateInfo IDs in agc_driver_image_gather_volume, a test the baseline did not run. The test uses no GCN tile mode. I ran it with the layer in two states:
| Tree | VUID lines |
|---|---|
| Merged tree | 8 |
All 8 PR files restored from main |
8, the same IDs |
VUIDs, identical in both runs
2 VUID-VkSamplerCreateInfo-addressModeU-01079
2 VUID-VkSamplerCreateInfo-addressModeU-parameter
2 VUID-VkSamplerCreateInfo-addressModeV-parameter
2 VUID-VkSamplerCreateInfo-addressModeW-parameter
Negative control
I reverted only the layout part of the fix: Graphics/src/TextureTiling.cpp as it was at cc596af, keeping the new header, detiler and tests. agc_driver_graphics then fails with:
AGC graphics: PS4 full volume mip chain differs from addrlib
With the merged file restored it passes again. This confirms the author's harness result from the Refresh note. The test also checks GuestOffset(1, mips[4]) == 150784 and the MipTileMode selection, so it covers the header changes too.
I recomputed the pinned numbers by hand for a 32-bit 32³ chain:
| Level | Size | Layout | Bytes | Ends at |
|---|---|---|---|---|
| 0 | 32³ | thick | 131072 | 131072 |
| 1 | 16³ | thick | 16384 | 147456 |
| 2 | 8³ | thick | 2048 | 149504 |
| 3 | 4³ | one thick 8x8x4 slab | 1024 | 150528 |
| 4 | 2³ | two thin 256-byte slices | 512 | 151040 |
| 5 | 1³ | one thin 256-byte slice | 256 | 151296 |
151296 is the total I gave in my last review. The 8- and 16-bit cases need pitches of 32 and 16 elements to reach a 256-byte slice, both 32 bytes. That matches the test.
Previous findings
- Blocking 1, shallow mip levels laid out thick: Resolved. Levels with
level > 0 && levelDepth < 4are 1D thin with single-slice strides and the SI pitch adjustment. The uploads and write-backs that go throughDispatchchoose the thin pipeline for them.DispatchImagealways asks for a non-thick pipeline, so it is unaffected. The new six-level test pins the layout, and it fails without the fix. - Non-blocking 1, "checked against addrlib" wording: Resolved. The description and the debt entry now say how levels under four slices are handled and name
ComputeSurfaceInfoMicroTiledandHwlGetSizeAdjustmentMicroTiled. - Non-blocking 2, no GPU detile case for mode 19: Still open, non-blocking.
GcnDetile.cppstill has no tile-mode-19 case, and the debt entry says so ("mode 19 has layout tests only"). Nothing on a device has run the thick shader path or the new thin-level pipeline choice.
New findings
Blocking
None.
Non-blocking
- The debt entry is over the length limit again.
check_conventions.pywarns that the entry has 1212 characters; the limit is 1000. 297118f had brought it under the limit, and 9fde6ef adds the degrade sentence. CONTRIBUTING asks entries to state the gap first. Suggested fix: cut the description of implemented behaviour, for example the 8x8x4 order and the degrade mechanics, down to the source names. Keep what is unchecked and what throws. - The required validation and GPU evidence is from older heads. The Refresh note says
agc_driver_graphics, the GPU detiler and the paired validation run were not rerun on this head. TheGPUs testedline still refers to the earlier RTX 2080 runs. On lavapipe I found nothing new from this PR, but CONTRIBUTING asks the author to run the paired check for AGC driver changes. Please rerun it on the RTX 2080 and update the Tested section. agc_driver_graphicsruns over 30 s here (34.2 s alone). The PR adds only small CPU cases, and TechLevelZero's NVIDIA runs already showed this test at about 30 s, so I don't count this against the PR. I did not measuremainalone on this machine.
Not verified
- No GPU run of the mode-19 thick or degraded-thin detile shader; no fixture exercises it.
- Paired validation on a hardware GPU. Only lavapipe was run here.
- Console behaviour, and whether Sony's GpuAddress library applies the same degrade as addrlib.
- I checked addrlib's behaviour from my previous review's reading of the source. I did not re-read the addrlib source in this pass (no network).
- Gang Beasts (CUSA04865). I launch no titles.
- Windows.
✅ NVIDIA GPU test: passedPR head
Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (3, not counted against this PR)Validation IDs already present on main (8 IDs in 531 tests)Skipped (50)ReproduceAutomated build and test on a contributor's NVIDIA machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs. |
What
A PS4 T# with tile mode index 19 (
Thick_1dThick) threw. Gang Beasts (CUSA04865, Unity) hits it.The mode stores 8x8x4 micro tiles. Within a tile the elements follow addrlib's
ADDR_THICKorder for their size:Level 0 and levels at least four slices deep keep their slices as slabs of four. Nonzero levels below four slices degrade to 1D thin, one slice per stride, with SI pitch adjustment to a 256-byte slice alignment. Only thick 3D textures take this layout; a block-compressed volume, which addrlib lays out thin, throws. I checked the layout against addrlib, Mesa, GPCS4, shadPS4 and fpPS4. New
TextureTilingcases check that a micro tile maps its 8x8x4 elements one to one, the first steps of the element order for each size, and the level and slab offsets of a small volume. The debt entry for PS4 thick and layered surfaces now says which thick mode is laid out, that tile mode 19 is checked against the layout tests only and not byGcnDetile.cpp's GPU run, and that a thick mode on a 1D-array, 2D, 2D-array or cube T# throws:describeGcnSurfacerefuses those instead of taking the thin layout, since addrlib groups their slices in fours too and the thin path would read them from wrong offsets. A newTextureTilingcase checks the refusal.MarcZX10 found that a volume with several mip levels is stored level by level here (each level with all of its slabs, as addrlib lays a thick 3D mip chain out), while
StorageTextureand the write evidence computedGuestLayerOffset(layer) + mip.tiledOffset, onelayerBytesstride for every level, which is right only for level 0. Those nine call sites now useSurfaceGeometry::GuestOffset(layer, mip), which already carries the level-major rule and is what the sampled upload used; for every other geometry the two expressions are equal. A storage image of a level-major surface still throws at creation (Texture.cpp, the rule #9431 added for layered surfaces), so the wrong stride was not reachable for a volume with mips, and the debt entry says so. A newTextureTilingcase lays out a 32x32x32 volume with four levels (8, 4, 2 and 1 slabs) and checks that every slice's slab offset is inside the surface, that the slabs do not overlap, that they fill the surface exactly, and that level 1's second slab sits one level-1 slab after its first.This moves the tile-mode commit of Get-fix#4 (opened against
ps4/limbo-gpu) tomain, as Get-fix asked there. It was stacked on #9431, which is merged; the branch now has currentmainmerged in. The other commit of that PR drew quad lists through the rect-list tessellation stages;mainalready draws quad lists by generating a triangle-list index buffer with the first or last provoking vertex, so it is not carried over.Landing order: #9891 lays out thin-tiled 3D textures in the same function; the two fit together (thick 3D here, thin 3D there, a non-3D thick T# throws) and merge as two adjacent lines plus one debt entry. Suggested: #9891 first, then this PR rebased onto it.
Tested
Windows 11 Pro (10.0.26200), WinLibs GCC, NVIDIA GeForce RTX 2080 (driver 617.14), Release build with
BUILD_TESTING=ON, on this branch with currentmain(e30f385) merged in; #9431 is merged, so the branch's diff againstmainis this PR's own change:agc_driver_graphicspasses, with the new thickTextureTilingcases, including the 32x32x32 four-level volume; three runs. A 2D-array T# in tile mode 19 still throws, but the test no longer pins that, since the console accepts layered thick surfaces.agc_driver_gcn_detilepasses.tools/check_conventions.py --base main(e30f385) with this title and description: no findings.maine30f385 (100% tests passed out of 25, the depth, display-buffer and graphics tests of this stack) and this branch with thatmainmerged in (100% tests passed out of 2:agc_driver_graphics,agc_driver_gcn_detile) withVK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,ANYPS5_NO_SHADER_CACHE=1,ANYPS5_REQUIRE_VULKAN=1andVK_LOADER_DEBUG=warn,error,ctest -V, on the NVIDIA GeForce RTX 2080, driver 617.14, Windows 11 (10.0.26200), Vulkan SDK 1.4.363.0: both logs carry the loader'sadding layers "VK_LAYER_KHRONOS_validation"line (62 and 2 times) and neither reportswas not found but was requested by env var VK_INSTANCE_LAYERS;VUID-ids onmain: 0, on this branch: 0, new on this branch: 0.Linux was not run locally.
Refresh — 2026-11-03 (Codex, AI-assisted): Merged main 086c068. Fixed the shallow-mip finding: nonzero mip levels with fewer than four slices use 1D thin tiles, one-slice guest strides, and SI pitch adjustment until the slice size is 256-byte aligned. The detiler selects the thin pipeline for these levels. Added full 32x32x32/6-level regression (151296 bytes; level-4 slice 1 at 150784), thin/thick mode selection and 8/16-bit slice-alignment checks. Ran the actual gcnThickTilingTests function in an isolated statically linked CPU harness with the current TextureTiling.cpp and TextureFormat.cpp: passes. Replacing only TextureTiling.cpp with the pre-fix version fails with 'PS4 full volume mip chain differs from addrlib'. Generated all four current TextureDetile shader variants with glslang. Syntax-only compilation passes for TextureDetiler.cpp and ShaderResources.cpp; conventions and whitespace checks pass. Full agc_driver_graphics, GPU detiler, paired Vulkan validation and title runs have not been rerun on this merged head; the harness is CPU layout evidence only.
Checklist
main; no other open PR implements the same functions (currentmaine30f385 merged in; feat(libSceAgcDriver): draw PS4 (GCN) command buffers #9431 is merged; searched open boykopovar/AnyPS5 PRs forThick_1dThick, thick tile mode and tile mode 19 on 2026-10-22)NotImplemented_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)