Skip to content

fix(agc): publish native multisample depth over a colour alias its owner took in - #16301

Open
dantdmdarealguy wants to merge 1 commit into
boykopovar:mainfrom
dantdmdarealguy:agent/recheck_ghost3
Open

dantdmdarealguy wants to merge 1 commit into
boykopovar:mainfrom
dantdmdarealguy:agent/recheck_ghost3

Conversation

@dantdmdarealguy

Copy link
Copy Markdown
Contributor

What

fix(agc): publish native multisample depth over a colour alias its owner took in

A native D32S8 owner can take in a multisampled colour target that lies over one of its planes. There are two such cases:

The guest publication from #13021 refused whenever any colour target was resident over a plane. Ghost of Tsushima has both kinds of alias over its 2-sample D32S8 target.

Why the owner's bytes are newer. If the colour target has not cleared, drawn or taken a fill since the owner took its content in, every depth or stencil write of the owner came after the target's last change. The published bytes are then what the memory holds. A fill over a plane is also noted to the depth owner, and publication already refuses while such a fill has not been applied. So a stencil-plane alias's latest fill is always one the owner has absorbed.

The change:

  • The owner records the colour target it took in:
    • the depth-plane alias at import, as before;
    • the stencil-plane alias at import, and again each time it applies that target's fill as its stencil clear.
  • Publication goes ahead over a recorded target that is the only colour target over its plane and whose content counter, fill count, newest content and value are unchanged. It checks this again before the planes commit, and retires the target after they commit.
  • Any other colour target over a plane still refuses with the same message.
  • The retired target's host samples are not rewritten with the published bytes, so a later colour use of that memory starts a new target. The new debt entry says this, and that the ordering argument is inferred, not measured on the console. The publication entry now says "other resident colour aliases".

Test: agc_driver_native_depth_publication gets five cases, each for 2, 4 and 8 samples:

case expected
R32F depth-plane alias accepted at import, then a depth draw publishes the drawn samples, keeps the owner, retires the alias
R8 stencil-plane fill alias at import same as above
the same alias refilled after import, as Ghost does every frame same as above
either alias drawn after import refuses, leaves guest bytes unchanged, keeps both resident

On main the test fails with AGC graphics: native multisample depth publication over a resident colour target is not implemented. With the change it passes.

Tested

Windows 11 Pro, Intel Core i9-14900K, 128 GB RAM, NVIDIA GeForce RTX 5080 (driver 32.0.16.1742), WinLibs GCC 15.2.0, Release.

  • Title: Ghost of Tsushima Director's Cut PPSA02225 02.024.000, relinked with relinker --windows --registry --module-dir prospero.
    • On main e322066 it stops as quoted above, at +270 s with a cold cache and +60 s with a warm one.
    • With this change, two 900 s runs end at the time limit with no refusal and reach the in-engine opening cinematic.
  • New test: ctest -R '^agc_driver_native_depth_publication$' fails on main with the message above and passes with the change.
  • Other tests: ctest -R "agc_driver.*(depth|multisample|msaa|stencil|alias|fmask|dcc|cmask|htile)" passes 114 of 114, and patched_libraries passes.
  • Validation layer: ctest -V -R agc_driver_native_depth (17 tests) on main and on this change, with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation.
    • Neither log contains was not found but was requested by env var VK_INSTANCE_LAYERS.
    • Both logs show Insert instance layer "VK_LAYER_KHRONOS_validation" 32 times (VK_LOADER_DEBUG=layer).
    • Neither log has a VUID- line.
    • On main only agc_driver_native_depth_publication fails, with the title's message. agc_driver_native_depth_driver_queued_fill skips in both.

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
  • 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: PPSA02225 Ghost of Tsushima Director's Cut (PPSA02225, Windows): black frames despite continuing draw and presentation activity #5166 (Ghost of Tsushima Director's Cut gets past compute shader 0x20001f3500: AGC graphics: native multisample depth publication over a resident colour target is not implemented)
  • GPUs tested: NVIDIA GeForce RTX 5080, driver 32.0.16.1742, Windows 11 Pro
  • AI-assisted: yes, some AI assistance was used

…ner took in

A native D32S8 owner can take in a multisampled colour target over one
of its planes: the R32F target over the depth plane that the import
accepts when HTILE proves its clear, or the R8 target over the stencil
plane whose fill the owner applies as its stencil clear. Publishing a
written owner to the guest refused whenever any colour target was
resident over a plane.

If that target has not cleared, drawn or taken a fill since the owner
took its content in, every depth or stencil write of the owner is newer
than the target's samples. Publication now goes ahead over such a
target, re-checks it before the planes commit and retires it after
them. Any other colour target over a plane still refuses.

Ghost of Tsushima Director's Cut (PPSA02225) stopped on main at
"compute shader 0x20001f3500: AGC graphics: native multisample depth
publication over a resident colour target is not implemented".
@github-actions github-actions Bot added docs agc libSceAgc* unblocks title Names a title ID on the Unblocks line labels Nov 6, 2026
@adriadam10 adriadam10 self-assigned this Nov 6, 2026
@JJenkx

JJenkx commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Correction (rerun): my first run rebuilt only the main test target, but the test pattern also matched agc_driver_native_depth_bda_clear (from agc_driver_native_depth_bda_clear_tests), which was left from an earlier build and so didn't include this PR. I reran with every matching executable rebuilt from a fresh merge onto main d60ebec0c2 (6f29367d0e): same result, same counts, same single skip, no VUID- errors.

Windows check of head af10404d23, merged onto main ea443a1546 (229dd907ae, clean merge).

Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release, Radeon RX 6700 XT, AMD driver 26.10.1. Run with ANYPS5_REQUIRE_VULKAN=1 and Vulkan validation layers 1.4.363, through the Windows test queue. The hosted Windows check does not run these GPU tests on pull requests.

  • 16 of the 17 agc_driver_native_depth_* tests pass in 3 of 3 runs on the real device. They're built from NativeMultisampleDepth.cpp, which this PR changes. The Vulkan device was created in each run, and there were no VUID- errors.
  • agc_driver_native_depth_driver_queued_fill skips on every run: "host imports are compared here, not write-watched, and a queued fill's HTILE proof needs a write-watched import". That's the existing Windows condition, unrelated to this change; the same skip, with the same message, also appeared in my run of test(agc): split the native depth fetch dispatches at the device workgroup count limit #16251.

AI-assisted: yes.

@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head af10404 merged onto main 5299939 · tested 2026-11-06 13:26 UTC · 32 min

GPU NVIDIA RTX 2000 Ada Generation, driver 595.99.02, Vulkan 1.4.329
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-38-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 2,916 passed · 5 failed (0 new, 4 also fail on main, 1 unstable on main) · 52 skipped (ANYPS5_REQUIRE_VULKAN=1)
Test setup CPU-only tests without a GPU; GPU tests (and any CPU-only test that failed or skipped without one) once on the GPU with VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1; main ran the same way
Test selection 2,973 of 4,210 tests run: the ones this change can reach, chosen by tools/select_tests.py from main's build graph
Vulkan validation ✅ no new validation IDs vs main (979 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 120.1 s, ⚠️ public_headers 31.7 s
Unstable on main (1, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_pipeline_journal: failed in 1 of the last 10 main runs
Failing on main too (4, not counted against this PR)
agc_driver_image_table
guest_mmap_executable
guest_socket_options_multicast
web_library_assets
Validation IDs already present on main (9 IDs in 587 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (587 tests): agc_driver, agc_driver_address_draw_space_reuse, agc_driver_address_passes, agc_driver_address_passes_targets_split, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, agc_driver_bc_block_copy, and 579 more
VUID-VkShaderModuleCreateInfo-pCode-08737 (14 tests): agc_driver_dpp16_operands, agc_driver_dpp8_pk_fmac, agc_driver_dx10_clamp, agc_driver_f16_fma_denormal_modes, agc_driver_f16_fma_invalid_nan, agc_driver_float16_fma_rounding, agc_driver_float16_modifiers, agc_driver_float16_native, and 6 more
VUID-VkShaderModuleCreateInfo-pCode-08739 (14 tests): agc_driver_dpp16_operands, agc_driver_dpp8_pk_fmac, agc_driver_dx10_clamp, agc_driver_f16_fma_denormal_modes, agc_driver_f16_fma_invalid_nan, agc_driver_float16_fma_rounding, agc_driver_float16_modifiers, agc_driver_float16_native, and 6 more
VUID-VkShaderModuleCreateInfo-pCode-08741 (14 tests): agc_driver_dpp16_operands, agc_driver_dpp8_pk_fmac, agc_driver_dx10_clamp, agc_driver_f16_fma_denormal_modes, agc_driver_f16_fma_invalid_nan, agc_driver_float16_fma_rounding, agc_driver_float16_modifiers, agc_driver_float16_native, and 6 more
VUID-vkCmdCopyImage-srcImage-01548 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-vkCmdCopyImage-srcImage-01551 (7 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_sampling, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (1 test): agc_driver_prepared_exports
VUID-VkPipelineShaderStageCreateInfo-module-parameter (1 test): agc_driver_float16_unused_nan_payloads
VUID-VkPipelineShaderStageCreateInfo-pSpecializationInfo-06849 (1 test): agc_driver_float16_unused_nan_payloads
Skipped (52)
agc_driver_gcn_display_present: skipped, no display: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
agc_driver_sample_order_grid_reference: skipped, the device does not keep depth drawn at custom sample locations at those locations, even after a transition that names them: the composite of uniform renders holds the guest's depth in 0 of 3005 sloped samples, so no path can be compared with it bit for bit
agc_driver_scattered_runs: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_vertex_elected_atomic_max: skipped, the device runs vertex programs in subgroups, so they keep their cross-lane reductions
agc_host_import_sparse: skipped, host imports are unavailable: /dev/udmabuf is not accessible
guest_http_uri_locale: 
guest_net_ctl: skipped, the host has no IPv4 address
guest_net_ctl_disconnected: skipped, the host has no IPv4 address
guest_video_out_color_space: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_device_capability: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_hdr: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_high_frame_rate: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_host_resolution_disabled: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_host_resolution_four_k: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_host_resolution_height_only: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_host_resolution_limit: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_host_resolution_malformed: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_host_resolution_width_only: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_output_mode: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_resolution_status: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
guest_video_out_wqhd_detection: skipped, no display or Vulkan device: SDL_InitSubSystem(VIDEO | GAMECONTROLLER) failed: wayland,x11 not available
video_out_flip_aftergpu: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_backtoback: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_controls: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_cpuflip_in_order: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen) or platform
video_out_flip_dcc: skipped, no display or Vulkan device: DisplayWindow: Vulkan support is either not configured in SDL or not a
Reproduce
git fetch origin af10404d235e67e92f78f1aff5a4ca946bd86302 5299939ecfa9e186e1eb457c6f4bd133bdb087c7
git checkout 5299939ecfa9e186e1eb457c6f4bd133bdb087c7 && git merge --no-ff af10404d235e67e92f78f1aff5a4ca946bd86302
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build && cmake --build build --target libs
VK_DRIVER_FILES=/nonexistent/icd.json ctest --test-dir build -E '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 32 --output-on-failure
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
  ctest --test-dir build -R '^(agc|shader|recompiler|videoout|video_out|guest_video_out|vulkan)|gpu' --timeout 120 --parallel 4 --output-on-failure
# failures are then re-run alone: --timeout 360 --parallel 2; new validation IDs: the test alone, twice, --parallel 1

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

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 unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants