Skip to content

fix(agc): publish native depth before cached buffer recording - #139

Open
Thimo188 wants to merge 8 commits into
mainfrom
upstream-pr/10492
Open

Thimo188 wants to merge 8 commits into
mainfrom
upstream-pr/10492

Conversation

@Thimo188

@Thimo188 Thimo188 commented Dec 2, 2026

Copy link
Copy Markdown
Owner

Imported from boykopovar/AnyPS5#10492, originally opened by Ondra97.

Source commit: b320672fb37241f90b7d54865627b8c388d3587b. 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

A writable buffer can become backed by a newly created native depth owner after its resource set was cached. If publication first occurs in Bind, it may synchronize and end a command buffer the cached dispatch already acquired. Run requireGuestBuffers() in Revalidate after registered-image identity validation and before every resource proof, including the epoch shortcut, so publication/refusal completes before cached recording.

The November 11 integration used main bc94a8e423ea026aadbb29165fed1ad2db471154. The carried boykopovar#9950 publisher retains Ethan Barr's authorship and matches boykopovar#10469's refreshed production implementation, including main's snapshot/readback helpers, overwritten-plane proofs and colour-alias retirement. boykopovar#10469 and boykopovar#10492 remain independent after boykopovar#9950. The three cached-publication fixture functions remain byte-identical to the previous submission, retaining import-watch skips and explicit driver shutdown. All new main test registrations are preserved alongside this PR's three modes.

The confirmed order remains boykopovar#9950, then boykopovar#10469/boykopovar#10492, then boykopovar#10497, then boykopovar#7002. The #7002 author confirmation retains the early transition before epoch proof and the deferred feedback scan before either colour/depth publication pass. boykopovar#7002 remains draft; its combined colour stack is not qualified here.

The November 19 main sync carries the shared D32 publication update from boykopovar#10469. Main's reuse policy remains in place. The cached resource guard still runs before the epoch proof, and repeated staging uploads retain the transfer-write dependency.

Tested

The November 19 Windows Release retest used main b68affac18ca39391a3800d5cb51735d085c014d and PR head 804659939aebb28904cbc3e64146b33c4d6b364e. Both full runtime builds passed with WinLibs GCC 15.2.0. The same 31 focused Vulkan CTests passed on both revisions. All three PR-specific publication CTests passed, including cached draw recording and its buffer store. The RTX 4070 Ti SUPER on driver 621.24 and Khronos validation 1.4.335 were confirmed in every log. The runs logged no VUID or synchronization hazards. Two internal HTILE write-coverage assertions skipped on each revision.

The separate boykopovar#10469 plus boykopovar#10492 merge preview conflicts in NativeMultisampleDepth.cpp. The November 19 runs cover each PR's main-based revision independently. Earlier reports below apply to the revisions they list.

November 11, 2026 (Europe/Prague): submitted head ec6f18ac80329de04ed7e50a56c1bc76b87ceac8, based on main bc94a8e423ea026aadbb29165fed1ad2db471154.

Windows 11 Pro 10.0.26300; AMD Ryzen 9 7900X; 31.66 GiB RAM; NVIDIA GeForce RTX 4070 Ti SUPER, driver 621.01. WinLibs GCC 15.2.0 r7 UCRT, CMake 4.1.2, Ninja 1.13.2, Python 3.14.7. Release full-runtime configuration with BUILD_TESTING=ON and ANYPS5_ENABLE_SPIRV_TOOLS=ON. Production relinker, all libraries and the four focused fixture targets build successfully.

Source Passed Skipped Failed
Main comparison 29 1 0
Submitted head 32 1 0

The main comparison ran at 60ec4a7bcd05d6700c987adaabad19c2acd2142e; the only subsequent base change is in the unrelated GuestNpCommonRuntime.cpp fixture. Repository blobs for production code, dependencies, build scripts and the focused tests are identical between that baseline and the submitted base, so that baseline is reused. The submitted head was rebuilt and the entire selection rerun after the final rebase.

Both arms require Vulkan, disable normal shader caches, enable APS5_VERIFY_SHAPE_MEMO=1 and use the same explicit Khronos validation 1.4.335 path and layer logging. The logs confirm the selected RTX 4070 Ti SUPER and matching inserted Khronos/OBS/Overwolf/NVIDIA layers. Neither log contains a missing requested layer, VUID, validation error or synchronization hazard. The single skip in each arm is agc_driver_native_depth_driver_queued_fill.

All three added modes execute and pass: cached writable-buffer publication, the dispatch-items variant and cached draw publication with APS5_DRAW_PIPELINE=1. The full selection also covers current D32S8 publication, overwritten-plane, single-sample-view and pending-unit cases. A source-order check confirms registered-image identity validation precedes publication, which precedes both epoch/full proofs. Conventions (one debt-length warning, zero errors), whitespace and strict main-sync checks pass.

The 2,007-head depth overlap snapshot used for boykopovar#10469 exited 2 because conflicting branches prevented complete comparisons. Its shared depth/debt diffs were manually inspected and reused for the byte-identical publisher. The added Revalidate transition was checked against current main and boykopovar#7002's confirmed order; no clean full overlap result or combined colour/fault-slot stack is claimed. Existing contributor reports retain their original revision/platform scope. No full CTest or new title/console run is claimed.

cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build --target relinker libs agc_driver_native_multisample_depth_tests agc_driver_sample_multisample_target_tests agc_driver_graphics_tests agc_driver_native_depth_bda_clear_tests --parallel 16
$env:ANYPS5_REQUIRE_VULKAN='1'
$env:ANYPS5_NO_SHADER_CACHE='1'
$env:ANYPS5_GPU='NVIDIA GeForce RTX 4070 Ti SUPER'
$env:VK_INSTANCE_LAYERS='VK_LAYER_KHRONOS_validation'
$env:VK_LAYER_PATH='D:/Github/AnyPS5/build_tools/c012-refresh/vulkan-sdk/Bin'
$env:VK_LOADER_DEBUG='layer'
$env:VK_LOADER_LAYERS_DISABLE='*implicit*'
$env:APS5_VERIFY_SHAPE_MEMO='1'
ctest --test-dir build -R '^(agc_driver_(native_multisample_depth|native_depth_.*|sample_multisample_target|graphics))$' -j 1 -V --no-tests=error
python tools/check_conventions.py --base origin/main
python tools/check_main_sync.py --base origin/main --strict
git diff --check origin/main...HEAD

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: feat(agc): publish a written native multisample D32 depth surface to its guest planes on access boykopovar/AnyPS5#9950
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 4070 Ti SUPER, drivers 621.01 and 621.24, Windows 11 Pro 10.0.26300; November 11 and 19 paired runs
  • AI-assisted: yes

ebarr24 and others added 8 commits November 11, 2026 00:52
…its guest planes on access

A guest read, DMA copy source or texture, storage, index or vertex read over a native multisample depth surface that a draw had written threw sample-preserving guest publication of native multisample depth is not implemented (Sonic Superstars PPSA06888 boykopovar#5382, Monster Hunter Wilds PPSA24191 boykopovar#7972, Onimusha PPSA27836 boykopovar#6570). The access now completes the pending fast clear and recorder work, reads the samples back in the guest layer, row, column, fragment order with the merged multisample readback, retiles them into the Z_X plane with the descriptor pipe-bank XOR through MultisampleTextureLayout, and rewrites every HTILE word to the expanded clear word (Mesa radv_get_htile_initial_value: 0xfffc000f without stencil, ZMask 0xf with the full Z range otherwise) before retiring the surface like an unwritten one. Written D16 surfaces, surfaces the device stores in another format and surfaces it cannot sample still throw with their own messages. The console HTILE after a DB decompress and its compressed plane bytes are not measured.
# Conflicts:
#	core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_native_multisample_depth_tests.cmake
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown

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.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 138 docs/dev/debt/changes/fix-published-native-depth-retirement.md
PR 140 docs/dev/debt/changes/fix-cached-native-depth-publication.md
docs/dev/debt/changes/fix-published-native-depth-retirement.md

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs rebase Conflicts with main, rebase needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants