Repository navigation
fix(libSceAgcDriver): pad level 0 rows of a POW2_PAD PS4 mip chain - #9842
Conversation
PS4 color and depth targets, PS4 graphics EOP events, and the PS4 tile modes (1D/2D thin and display, depth with tile split, PRT, linear general) on the AGC executor, with a GPU detiler for every mode. Textures sampled over the padded corner of a render target are GPU block copies, and the PS4 SDK pattern-fill compute kernel runs as a GPU fill when it repeats one dword, so render targets and HTILE are cleared without a CPU drain. Two-dword patterns keep running the kernel: as fills, Limbo's clears of its 64-bit target made its gameplay advance about half as far per frame. Tests cover the tiling equations against addrlib formulas, the GPU detiler for every mode and element size, and the fill ranges.
…p test The 4 KiB display buffer alignment check now names linear and PS4 buffers, because PS4 tiled display buffers may be 4 KiB aligned too. video_out_flip_ps4 still looked for the old text when a PS4 buffer set is changed to the PS5 tiled layout, so it failed although the change is still refused.
A GCN T# with POW2_PAD and more than one level has every level padded to power-of-two dimensions, level 0 included: its pitch already is one, and its rows are too. Only the width and height of levels 1 and up were padded, so level 1 started after the micro-tile-aligned height of level 0 instead of its padded one. For the 68x68, seven-level notification icon of Knowledge is Power: Decades (CUSA12435, Unity) the title's CPU tiler puts level 1 at 128 * 128 texels, the driver read it at 128 * 72, and the downscaled icon showed the stale texture data left in level 0's padding rows. Level 0's rows are now padded too when the chain has more than one level; its width stays the T# pitch. A single POW2_PAD level keeps its micro-tile-aligned rows. A new tiling case checks the level offsets of the 68x68 chain and the size of a single level. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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.
|
…s4-pow2pad-level0 # Conflicts: # core/libs/prx/libSceAgcDriver/Graphics/include/GuestTextureResource.hpp
|
The mip-layout evidence is unusually concrete: the level offsets match the title’s DMA writes, and the focused Windows GPU tests compare the old and changed expectations. One inherited build blocker needs resolution before this stacked PR can be validated: the current #9431 dependency has a reported Linux x86-64/libstdc++ compile failure because |
|
Follow-up to my earlier dependency note: the exact #9842 head still has stale Linux journal layout guards (State == 800, ShaderStages == 112), while current main (9a030c2) has State == 824, ShaderStages == 112 and journal format 8 (this head has format 6). This head therefore still needs a current-main rebase and a Linux compile of the rebased stack; the existing green checks do not include product builds. I also checked the legacyVertex path: it changes the selected vertex program in DrawDecode.cpp, but is not copied by CanonicalPipelineState or encoded/decoded by the journal. That may be safe if the selected shader identity already distinguishes both recipes, but please confirm that with a cache-key test or a short explanation while resolving the size/codec assertions. |
|
A note on merge order. Our upcoming fix for Ghost of Tsushima Director's Cut (PPSA02225), fix/agc-3d-view-committed-slices-v2, touches lines next to this PR's in the sampled upload in Ours will go second and adapt to this one when it merges, with this PR in its |
|
@MarcZX10 Thanks for checking this closely. The stale layout guards (State == 800, ShaderStages == 112, journal format 6) come from #9431, which this PR is stacked on. They will move to main's State == 824 and format 8 with #9431's rebase onto current On
If you'd still like it pinned by a test, the natural place is #9431, where the field lives. #9431's head (26d651d) has not moved since yesterday. Once it is rebased onto current 🤖 Generated with Claude Code |
|
@EagleBearerYS Thanks for the heads-up, and for taking the second slot. The two changes don't affect each other.
Once #9431 is brought up to current 🤖 Generated with Claude Code |
|
@ntamas94 this branch no longer builds once merged with current The guard asks for more than new numbers:
We'll re-run CI on the new head. |
|
@ntamas94 This PR now conflicts with main in |
…s4-pow2pad-level0 boykopovar#9431 is merged into main in its final form. The branch carried that PR's earlier head (9437229, 26d651d); those files now follow main, which also removes the extra ShaderStages and draw-key fields the journal size guards flagged. Only this PR's own change (POW2_PAD level 0 rows) is on top. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s4-pow2pad-level0 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MarcZX10
left a comment
There was a problem hiding this comment.
Review — changes requested
The title/texture report and the old-base GPU results are useful, but the integration point this PR was stacked on has moved: dependency #9431 merged into current main at eefa50841267. Head efeba42f30665ae59c29ab1eeae36f0a5ff77e95 does not contain that merge and conflicts with current main in State.hpp, DepthSurface.cpp, State.cpp, TextureTiling.cpp, and TextureTiling.cpp's test.
The latest main change to DepthSurface.cpp removed the layered-depth pitch restriction that this PR modifies. The resulting combined PS4 mip-layout path and its tests need a deliberate resolution; preserving the old patch mechanically could restore a restriction that main removed. The PR’s reported runs are on the older #9431 stack (26d651d3e), so they do not validate the post-merge integration.
Please merge the current #9431 result/current main, retain the intended POW2_PAD level-0 row layout without reintroducing the removed layered-depth restriction, reconcile the overlapping layout tests, and rerun the focused GPU/tiling tests with validation on the resulting head. I checked the current merge preview and git diff --check; the preview has those five conflicts and the whitespace check passes. I did not run the GPU tests locally.
|
@oneandonlydean thanks, both points are addressed by merging current
On the new head: the focused tests pass three times, the paired validation-layer run against |
MarcZX10
left a comment
There was a problem hiding this comment.
Re-checked — changes requested
The update explains that the extra depth fields and DepthSurface.cpp pitch line came from the old #9431 stack, not this PR, and reports three focused runs plus a paired validation-layer comparison. The branch remains based on f7e84c4cf1; current main is ba5b5330b3. Please update the branch to current main and provide a clean merge preview plus conventions on the resulting tree before merge. The current-main diff does not touch the PR's two implementation/test files, so the reported focused runs remain relevant if the refreshed diff confirms they are unchanged.
✅ NVIDIA GPU test: passedPR head
Unstable on main (3, these also failed in recent main runs on this machine; not counted against this PR)Failing on main too (2, not counted against this PR)Validation IDs already present on main (3 IDs in 384 tests)Skipped (41)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 GCN T# with
POW2_PADset and more than one level has every level padded to power-of-two dimensions, level 0 included. Level 0's pitch already is a power of two; its rows are padded too.ComputeGcnMipLayoutpadded only levels 1 and up, so level 1 started after the micro-tile-aligned height of level 0 instead of its padded height.Knowledge is Power: Decades (CUSA12435, Unity) hits it with the 68x68, seven-level,
Thin_1dThinicon of its PlayLink notifications ("a player joined / left") and of the AWAY badge. The title's CPU tiler writes the chain the way its DMA copies place it: level 0 is 128x128 texels (0x10000 bytes), level 1 starts at +0x10000, level 2 at +0x14000. The driver read level 1 at +0x9000 (128 * 72 texels), which is in level 0's padding rows. The notification shows the icon downscaled, so it sampled level 1 and showed the stale texture data left there as coloured noise. shadPS4 pads every level, level 0 included, and shows the icon clean.Level 0's rows are now padded too when the chain has more than one level. Level 0's width stays the T# pitch. A single
POW2_PADlevel keeps its micro-tile-aligned rows.#9674 (tile mode 19,
Thick_1dThick) adds a volume layout that pads its levels the same way; once both are in, its level 0 rows and depth need the same change, which I will make there.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 (mainf7e84c4cfplus this commit, merge340e579a3):TextureTilingcase lays out the 68x68 chain (pitch 128, seven levels): level 0 is 0x10000 bytes, level 1 starts at 0x10000 and level 2 at 0x14000; a single level of the same texture stays 128 * 72 texels.agc_driver_graphicspasses; withTextureTiling.cppreverted to the base it fails (a POW2_PAD PS4 mip chain pads the rows of level 0).agc_driver_graphics,agc_driver_gcn_detile,agc_driver_ds_swizzle,agc_driver_image_volume_address_planar_texture,agc_driver_image_xor_swizzle_volume,agc_driver_packed_mip_tail_target,agc_driver_view_past_last_mip,agc_driver_resource_cache_replaced_texture,texture_format_lookup.main; the change itself is unchanged):tools/check_conventions.pyfrommain,--base f7e84c4cfwith this title and description: no findings.main(f7e84c4cf) and this branch (all nine), 100% passed on both, 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): both logs carry the loader'sadding layers "VK_LAYER_KHRONOS_validation"line (14 times each) 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.Checklist
main; no other open PR implements the same functions (searched open and closed boykopovar/AnyPS5 PRs for pow2,POW2_PAD, pow2pad, mip padding andTextureTilingon 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)