Skip to content

fix(agc): view cleared surfaces without flushing handed-over results - #9999

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
camezaro-intc:fix/agc-clear-hand-over
Nov 14, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
camezaro-intc:fix/agc-clear-hand-over

Conversation

@camezaro-intc

@camezaro-intc camezaro-intc commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

What

Preserve texture A's pending GPU results when texture B is sampled through matching DCC clear keys; sampling B does not overwrite A's backing memory. The regression test now reads A's backing memory after B is sampled but before B writes, and verifies that A's results remain visible. B's subsequent write is the point where its overlapping units may be superseded. Removed the untested unconditional refresh upload for every handed-over clear-key refresh.

Tested

Windows 11 (build 26300), AMD Radeon RX 5700 XT, driver 32.0.21045.16010. Baseline main (2960e9a6e7e1fc99c4ed180c71495b5eb83464c7) and PR head (d72cc8ca6a70205a4e1fe96eb1c107d540a73f95) were tested on the same machine and GPU.

For both baseline and PR:

  • cmake --build C:\a5-pr11727-full --target agc_driver_recorder_tests agc_driver_staged_clear_sampled_read_tests --parallel 8 — passed.
  • With ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation: ctest --test-dir C:\a5-pr11727-full --output-on-failure -V -R '^(agc_storage_clear_hand_over|agc_driver_staged_clear_sampled_read)$' — passed, 2/2.
  • Khronos validation layer was loaded; no missing-layer warning and no VUID- messages were present in either captured run.

Additional checks:

  • python tools/check_conventions.py --base upstream/main — passed.
  • git diff --check upstream/main...HEAD — passed.
  • python tools/check_conventions.py --base origin/main — reports an unrelated non-Conventional-Commit revert already in that stale fork base (97f1d41a2c) and existing debt-length warnings; checking against the actual upstream PR base passes.

No title run or AMD/Intel comparison beyond this RX 5700 XT was performed.

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: Fixes AGC: the clear-key hand-over from #7427 puts a white glare over Ghost of Yōtei's open world #9860
  • Unblocks: none
  • GPUs tested: AMD Radeon RX 5700 XT, driver 32.0.21045.16010, Windows 11 build 26300
  • AI-assisted: yes

@github-actions github-actions Bot added the unblocks title Names a title ID on the Unblocks line label Oct 23, 2026
@adriadam10 adriadam10 self-assigned this Oct 23, 2026
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

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.

Pull request Shared files not compared
PR 1368 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 1395 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 4448 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 5609 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 5925 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6186 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6188 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6192 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6197 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6209 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 6280 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6340 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6412 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6481 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6804 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 7449 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
PR 7514 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 7642 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 7689 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 8246 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 10049 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 10193 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 10249 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 10442 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 11444 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 11551 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 12746 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 13251 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 13928 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 13929 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 14944 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 15621 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 15659 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 17700 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 17796 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 18029 core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 18173 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 18390 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp
PR 18515 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Recorder.cpp

@github-actions github-actions Bot added the fix error Closes an issue (Fixes #N) label Oct 23, 2026
@MarcZX10

Copy link
Copy Markdown
Contributor

The reported Windows Vulkan tests are relevant, and current main (9a030c2) has not changed this PR's four touched files since its declared base 01f9930. I cannot run the GPU tests on this host. The overlap report also lists #9891, #9892, #9893 and #9895 on Texture.hpp/Texture.cpp, and those branches are stacked on #9431. Could you compare the exact touched hunks against that stack and record an agreed merge order or dependency if this change needs one? The reported test results should be rerun on the final integrated head if any shared hunks change.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the exact diff and manually compared the Texture.hpp/Texture.cpp hunks against the #9431 stack and its open follow-ups (#9891/#9892/#9893/#9895). Those PRs alter independent mip/layout/copy regions; they will need textual rebases where files overlap, but this change does not depend on their behavior. The candidate-source selection now rejects clear-key aliases at another DCC address, staged-clear flushes are limited to matching pending layers, and the refreshed cached storage image supersedes handed-over writes before it becomes the sampled source. The new SampledClear case exercises the supersession path. Current-main diff check is clean; CI conventions, eligibility, intake, labels and report pass while product jobs skip by path policy. I cannot run Vulkan on this host; the PR reports both focused Windows tests passing with the Khronos layer and no VUIDs. No blocking issue found in the reviewed scope.

@ps54all

ps54all commented Oct 23, 2026

Copy link
Copy Markdown

Tested on Palworld (PPSA23126), Windows 11, NVIDIA RTX 3080 (driver 610.74). It removes a performance regression we bisected to #7427.

Setup: our test tree is main a6fc8a4 plus a few open PRs, not plain main. #9999 had one conflict there, in StorageTexture::refresh, against another open PR we carry; the resolution keeps both changes. Every run sits on the same screen (the EOS "Could not login" dialog, no input) with APS5_PROFILE_DRAW=1. FPS is the median of the 10 s samples after 120 s. "Found changed" is the [texture-cache] count of cached sampled textures found changed, per 10 s. In our split of that count, the changed views are all ones stagedClear flushed.

Tree FPS found changed / 10 s
main 8c9a1f7 (three merges before #7427, none in AGC) 19.4 1
main 7e95bde (#7427 merge) 10.2 ~890
our tree, without #9999 9.2 ~890
our tree, without #9999, APS5_NO_CLEAR_HAND_OVER=1 10.3 ~240
our tree + #9999 12 ~280

The main bisect rows were run with APS5_NO_DISPATCH_MOVE=1, because #7044 causes a separate drop on the same screen. With that switch on our tree, #9999 gives the same result as turning the hand-over off:

Our tree, APS5_NO_DISPATCH_MOVE=1 FPS found changed / 10 s
without #9999 9.6 ~900
without #9999, APS5_NO_CLEAR_HAND_OVER=1 16.3 1
+ #9999 23.5 1

What was not checked: image correctness in-world (only the dialog screen was measured), and the ctest suite with #9999 applied. Each row is one run. Measured with AI assistance (Claude Code).


Generated by Claude Code

@BKlaasWerkman

Copy link
Copy Markdown
Contributor

Windows test run on NVIDIA and Intel (no title run).

Windows 11 Pro 10.0.26300, WinLibs GCC 15.2.0 r7, Release. NVIDIA GeForce RTX 3060 Ti (driver 617.42) and Intel Arc Graphics (Meteor Lake, driver 101.9150), selected with ANYPS5_GPU. Head 8097d34 merged into main 938812d (clean merge). ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (1.4.363); no was not found but was requested line.

Tests: the 1236 that tools/select_tests.py select picks for the PR's files, compared per test with a full run of the same main on the same GPU.

this PR compared with main
RTX 3060 Ti 1229 passed, 4 skipped, 3 failed same 3 failures (agc_driver_sample_order trio, #9056); no new or removed VUID-
Intel Arc 1208 passed, 26 skipped, 2 failed same 2 failures (#10126, #8604); no new or removed VUID-

No test changes result on either GPU. Intel Arc's agc_driver_alias_copy_label failed in the main run and passed here; it is intermittent on that device (#10199).

AI-assisted: yes (Claude Code)

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 23, 2026
@camezaro-intc
camezaro-intc force-pushed the fix/agc-clear-hand-over branch from 8097d34 to cc1d505 Compare October 23, 2026 19:32
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 23, 2026
@Amoenus

Amoenus commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

@camezaro-intc #9999 before #7085 remains agreed. Current #9999 head d72cc8ca6a70 removes the sample-time supersession and adds the read-after-sample preservation check. I checked the updated source and recorded the author's correction and independent revalidation in our dependency status. I have not run this exact peer head locally.

The old cc1d50526d three-declaration merge plan in this comment is superseded. Source-only merge of our 5b8dd734ff3a with your d72cc8ca6a70 has one Texture.hpp conflict; retain:

    VkDeviceSize AllocationBytes() const { return memoryBytes + extraMipMemoryBytes; }
    bool AnyLayerPending() const;

Do not restore the removed public SupersedeHandedOver() method. The implementation and tests merge automatically. This is ordering/source coordination, not approval or a combined build/runtime result. #7085's functional prerequisite remains #6280; its other agreed merge-order prerequisites remain. After dependencies land, the resulting integration still needs affected checks. AI-assisted: yes (Codex).

@camezaro-intc

Copy link
Copy Markdown
Contributor Author

Thanks @Amoenus! Yes, that ordering works completely for us.

Having #9999 land first with #7085 keeping the adjacent declarations (AllocationBytes(), AnyLayerPending(), SupersedeHandedOver()) sounds ideal. Appreciate the coordination!

@camezaro-intc

Copy link
Copy Markdown
Contributor Author

Status check:
This branch is clean and mergeable against latest main, with maintainer approval from @MarcZX10, passing CI checks, and verified hardware runs (Palworld performance uplift on RTX 3080; 0 VUID- validation errors on RTX 3060 Ti and Intel Arc). The merge ordering agreement with #7085 (#9999 first) is in place, and this PR is ready to land.

@babyhuey

Copy link
Copy Markdown
Contributor

Linux run of this head cc1d50526df, merged onto main 442c43a574d (clean merge, local only), with the selection CI's skipped Linux product job uses: anyps5-build CI image (Ubuntu 24.04, GCC 13, Release, BUILD_TESTING=ON), lavapipe with ANYPS5_REQUIRE_VULKAN=1 GALLIUM_OVERRIDE_CPU_CAPS=avx. The tree was configured fresh after the merge, then select_tests.py select / ninja -f select.ninja selected / --target libs / select_tests.py ctest --timeout 120.

  • Selected 1,465 tests: all pass. (main itself passes its full suite in this container.)

AI-assisted: yes (Claude Code)

@ps54all

ps54all commented Oct 26, 2026

Copy link
Copy Markdown

Follow-up on Windows, for the merge order with #7085. We carried #9999 (head cc1d505) through a merge of main 035ac96 into our test tree, which is main plus other open PRs, so not plain main. The only conflict in this PR's code was the stagedClear condition in ShaderResources::cachedTexture, where main now scans the keys lazily. The resolution is the same expression as this head.

Not re-measured: Palworld FPS. On main 035ac96 the title stops at about 40 s on #11425, before the screen we measured, so the numbers in our earlier comment stand only for main a6fc8a4.

Measured with AI assistance (Claude Code).

QRMOE added a commit to QRMOE/AnyPS5 that referenced this pull request Oct 27, 2026
@QRMOE

QRMOE commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

A second title this fixes: RESIDENT EVIL requiem (PPSA31246), Windows 11, RX 9070 XT (AMD 26.6.2).

On this title the clear-key hand-over does two things: it covers the menu in stale tiles and puts a white glare over the cutscenes, the same glare as #9860.

Main defaults on the left, this PR without the switch on the right:

Game mode menu: main defaults against this PR

FBI field office exterior: main defaults against this PR

Investigation report: main defaults against this PR

I compared the run's frames, one every 20 presents from boot to about present 1,900, with a run using APS5_NO_CLEAR_HAND_OVER=1 and no PR. They match everywhere except one close-up, where a few blocks remain over the hair:

Remaining blocks in one close-up with this PR

The same blocks appeared in that shot during the APS5_NO_CLEAR_HAND_OVER=1 run without this PR. That run's dumps skipped the shot, so I only saw them on screen. I don't think they come from the hand-over, and they look like a separate issue.

One more observation, not a measurement: over the same 618 s cutscene window, the run with this PR averaged 919 ms per present, against 1,195 and 1,226 ms in two runs without it. That is a single run in a scene whose timing varies a lot between runs.

Not tested: I haven't run this PR's ctests; I only tested the title.

AI-assisted: yes (Claude Code).

@camezaro-intc

Copy link
Copy Markdown
Contributor Author

@QRMOE Thank you for testing and sharing the detailed side-by-side frame comparisons and timing numbers! It is fantastic to see PR #9999 resolve both the menu tile corruption and the cutscene glare on Resident Evil Requiem (PPSA31246) without requiring fallback switches, alongside the ~23% frame pacing uplift. Please feel free to keep sharing any further findings or test results here as you continue testing!

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 3, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@camezaro-intc
camezaro-intc force-pushed the fix/agc-clear-hand-over branch from d72cc8c to 3d6aba6 Compare November 4, 2026 01:53
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 4, 2026
@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head 3d6aba6 merged onto main 1c8c0ef · tested 2026-11-04 02:42 UTC · 36 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,725 passed · 6 failed (0 new, 3 also fail on main, 3 unstable on main) · 50 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,781 of 3,842 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 (951 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 120.1 s
Unstable on main (3, these also failed in recent main runs on this machine; not counted against this PR)
agc_driver_pipeline_journal: failed in 4 of the last 10 main runs
agc_submit_progress: failed in 5 of the last 10 main runs
agc_submit_progress_no_timeline: failed in 4 of the last 10 main runs
Failing on main too (3, not counted against this PR)
agc_driver_image_table
guest_mmap_executable
guest_socket_options_multicast
Validation IDs already present on main (8 IDs in 531 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (531 tests): agc_driver, agc_driver_address_passes, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, agc_driver_bc_block_copy, agc_driver_bda_anchor_reads, agc_driver_bda_span_reads, and 523 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_srgb8_color_target
VUID-VkSamplerCreateInfo-addressModeU-01079 (1 test): agc_driver_image_gather_volume
VUID-VkSamplerCreateInfo-addressModeU-parameter (1 test): agc_driver_image_gather_volume
VUID-VkSamplerCreateInfo-addressModeV-parameter (1 test): agc_driver_image_gather_volume
VUID-VkSamplerCreateInfo-addressModeW-parameter (1 test): agc_driver_image_gather_volume
Skipped (50)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
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_sparse_dma_buf_import: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_stencil_ref_export: skipped, the device lacks VK_EXT_shader_stencil_export
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
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_net_ctl: 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_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_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 available in current SDL video driver (offscreen) or platform
video_out_flip_deferred: 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_eop: 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
vide
Reproduce
git fetch origin 3d6aba6f4b118eabd76c344f76ab2bef801d88d3 1c8c0efc8c41314402e6966da5bef6ea3d639d10
git checkout 1c8c0efc8c41314402e6966da5bef6ea3d639d10 && git merge --no-ff 3d6aba6f4b118eabd76c344f76ab2bef801d88d3
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.

@TechLevelZero

Copy link
Copy Markdown
Contributor

✅ AMD GPU test: passed

PR head 3d6aba6 merged onto main 1c8c0ef · tested 2026-11-04 02:53 UTC · 37 min

GPU AMD Radeon RX 6300 (RADV NAVI24), driver Mesa 25.2.8-0ubuntu0.24.04.4, Vulkan 1.4.318
Host Ubuntu 26.04.1 LTS, kernel 7.0.0-42-generic, container ubuntu:24.04
Logs build and test logs for this run
Build ✅ passed (Release, -DANYPS5_ENABLE_SPIRV_TOOLS=ON)
Tests ✅ 2,712 passed · 8 failed (0 new, 7 also fail on main, 1 unstable on main) · 61 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,781 of 3,842 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 (951 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_pipeline_journal 120.5 s, ⚠️ public_headers 88.6 s, ⚠️ agc_shader_sampler_limits 33.3 s, ⚠️ agc_driver_image_sample_unnormalized 32.0 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 8 of the last 10 main runs
Failing on main too (7, not counted against this PR)
agc_driver_image_table
agc_driver_native_depth_bda_clear
agc_driver_native_multisample_depth
agc_submit_progress
agc_submit_progress_no_timeline
guest_mmap_executable
guest_socket_options_multicast
Validation IDs already present on main (8 IDs in 531 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (531 tests): agc_driver, agc_driver_address_passes, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, agc_driver_bc_block_copy, agc_driver_bda_anchor_reads, agc_driver_bda_span_reads, and 523 more
VUID-vkCmdCopyImage-srcImage-01548 (4 tests): agc_driver_depth_clear_hle, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-vkCmdCopyImage-srcImage-01551 (4 tests): agc_driver_depth_clear_hle, agc_driver_depth_storage_dispatch, agc_driver_depth_surface_from_storage, agc_driver_dispatch_move_depth
VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 (1 test): agc_driver_srgb8_color_target
VUID-VkSamplerCreateInfo-addressModeU-01079 (1 test): agc_driver_image_gather_volume
VUID-VkSamplerCreateInfo-addressModeU-parameter (1 test): agc_driver_image_gather_volume
VUID-VkSamplerCreateInfo-addressModeV-parameter (1 test): agc_driver_image_gather_volume
VUID-VkSamplerCreateInfo-addressModeW-parameter (1 test): agc_driver_image_gather_volume
Skipped (61)
agc_driver_bda_reads_shadowed_results: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_bda_reads_shadowed_results_per_build: skipped, the device reports watched host memory written when it imports or reads it
agc_driver_copied_writer_label_order: skipped, the device reports a minStorageBufferOffsetAlignment of 4, so the dispatch binds its record at +0x1004 in place and nothing is written back; the test needs an alignment above 4
agc_driver_float16_unused_nan_payloads: skipped, the device has no native f16 conversions with RTE rounding and kept f16 denormals
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_image_table_vouched_lookups: skipped, the device reports 4 of 4 host-imported pages written after a GPU read, so a watched imported table cannot be vouched for
agc_driver_linear_target_direct_write_completion: skipped, the device does not keep host imports write-watched, so no completion stamp over the target is tracked
agc_driver_ngg_vertex_wave_reduction: skipped, s3 describes a 32-lane wave only on 32-lane subgroups, and the device has 64 lanes
agc_driver_scattered_runs: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_sparse_dma_buf_import: skipped, host imports are unavailable: /dev/udmabuf is not accessible
agc_driver_unit_shadow: skipped, the device does not import watched host memory for unit shadows
agc_driver_unit_shadow_budget: skipped, the device does not import watched host memory for unit shadows
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
agc_idle_publish_wait: skipped, the device reports 4 of 4 host-imported pages written after a GPU read, so a forced watch of the import reads its submissions as CPU stores
agc_import_settle_initial_dcc: skipped, the device has no deferred settle of host imports: imports under 1 MiB wait for one only on Windows
agc_shadowed_key_stores: skipped, the device imports no watched host memory under a unit shadow
agc_small_tiled_shadow_label: skipped, host imports are unavailable: the test block is not imported and watched
agc_storage_clear_hand_over: skipped, the device imports no watched host memory for the clear-key hand-over
agc_storage_pending_key_refresh: skipped, refreshes over a pending key store are not testable here
agc_unit_shadow: skipped, the device does not import watched host memory for unit shadows
agc_unit_shadow_completion_store: skipped, the device reports watched host memory written when it imports or reads it
guest_http_uri_locale: 
guest_net_ctl: 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_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_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 d
Reproduce
git fetch origin 3d6aba6f4b118eabd76c344f76ab2bef801d88d3 1c8c0efc8c41314402e6966da5bef6ea3d639d10
git checkout 1c8c0efc8c41314402e6966da5bef6ea3d639d10 && git merge --no-ff 3d6aba6f4b118eabd76c344f76ab2bef801d88d3
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 12 --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 16 --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 AMD machine; it does not replace upstream CI. A new comment is posted for each new push. Full logs.

@mrfelek

mrfelek commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Data from PPSA28416 (Star Wars Galactic Racer, UE5), title screen: about +13% on Linux, NVIDIA

The change also removes a 64 MiB CPU read per frame in this title. The read comes from the stagedClear flush this PR narrows.

What happens on main:

  • The sampled texture: a 3840x2160 format-71 texture with DCC whose keys read as a fast clear (Clear0001). The lookup builds the cleared view for it, but the texture has no pending results of its own.
  • The aliased image: Unreal's transient memory reuses the same range for another 3840x2160 format-71 image, without DCC, at a base 11 or 22 MiB higher. That image has storage results pending, and its range also covers the texture's DCC keys.
  • What the flush does: stagedClear is true, so the lookup flushes that other image to guest memory, sets the keys to Uncompressed, drops the view and reads all 64 MiB on the CPU. That's about 52 reads (3.3 GB) per 10 s, every frame.

With this PR, source->AnyLayerPending() is false for the cleared view, so there's no flush and the view is kept. The read goes away (0 per 10 s).

Setup: RTX 3080 Ti (NVIDIA 615.71.09), Ryzen 9 5950X, Ubuntu 26.10 (Linux 7.3), headless, no input, APS5_UNIT_SHADOW_MIB=2048.

Trees:

Presents per 10 s over the last eight 10-s windows of 240-s runs, alternating A and B:

run 1 run 2
A 51–53 50–52
B 57–60 57–60

Steady state is about 5.2 FPS for A and 5.9 FPS for B, about +13%. There are no exceptions or aborts in any of the logs.

Picture: a 600-s B run reaches the title screen at about 300 s, and the frame matches a title frame captured earlier without this PR (main + #15656 + #11346) pixel for pixel, apart from the pulsing "Press ✕ to continue" prompt, which was mid-fade. I didn't check a scene that's drawn into after the clear.

AI-assisted.

@slopezjur

Copy link
Copy Markdown
Contributor

NVIDIA/Windows run of the focused tests from the description, with this PR's commit on a newer main.

  • Host: Windows 11 Pro 10.0.26300, NVIDIA GeForce RTX 4080 SUPER, driver 621.14, AMD Ryzen 7 7800X3D. MinGW-w64 GCC 15.2.0 (WinLibs UCRT r7), Release. Khronos validation layer from Vulkan SDK 1.4.363.0.
  • main: c38d0772c062ed0e625478bbc44cc39bb3e266c4. Change: the same tree with 3d6aba6f4b118eabd76c344f76ab2bef801d88d3 cherry-picked; it applies cleanly.
  • ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer ctest -V -R '^(agc_storage_clear_hand_over|agc_driver_staged_clear_sampled_read)$', three runs on each build.
main this PR
passed / failed / skipped, each run 2 / 0 / 0 2 / 0 / 0
VUID- or SYNC-HAZARD lines 0 0
was not found but was requested by env var VK_INSTANCE_LAYERS 0 0

The layer is inserted in both tests in every run.

AI-assisted: yes

@JJenkx

JJenkx commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Matched Linux correctness validation on plain main 65351c2931ec, with PR head 3d6aba6f4b11 cherry-picked alone as candidate db2f08d44f2c. No HTTP2 prerequisite or other private patch is included in this pair.

RX 6650 XT, same machine Main This PR
Related groups, three executions each 15 passes 15 passes
Supported watched-memory clear-handoff fixture Intended sampled-clear assertion fails Three complete scenario runs pass
Skips / VUID messages 0 / 0 0 / 0

The baseline fails specifically at “B sampled under clear keys did not view B’s cleared storage image”, in the refresh / sampled-clear / handoff-enabled case. The candidate completes 18 passing executions in total. The five related groups cover staged-clear sampled reads, host-import proofs, label-ordered flush and raw-pointer pending stores with inline and pipelined execution.

The fixture adapts this PR’s complete clearHandOverTests to the production Vulkan test device with supported shared memfd/dma-buf backing. It requires a real dma-buf import, a backing-resolver hit and preserved write watching; it does not force the watch policy. All handoff on/off, refresh/creation/detached, CPU-store, read-first, rewritten, sampled-clear and chained-handoff scenarios are retained. The legacy Recorder device skipped its watched-import case on this Linux setup, so that skip was not counted as coverage. The standalone fixture’s recorder lifetime allows the baseline assertion to unwind without validation errors.

Both builds used identical fixture source, each compiled against its own pinned headers without a shared PCH. ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation; physical RX 6650 XT selection and 116 validation-layer insertions verified. No missing-layer message. Tested library/executable hashes unchanged. Conventions and whitespace checks pass.

Source fixture, exact compile/link commands, source and binary hashes, build/CTest logs, JUnit and reviewed results — SHA256 385b03705d062aaf4fbcdc5fc3374c05f424dbe8fe89416ec9dff3b078951161, download checked. Source/evidence only; no binaries or game assets.

The same regression/fix was also verified at plain main 85a48c99 (SHA256 d53a80fd180e0433eb2a819b7d07afe49aaf7faf20eb420cdfcca492072d7233) and main 706573b0 with a shared HTTP2 prerequisite (SHA256 998cb68b6d490c6b13db0fee58024ed1470f75b0b54c6b5c9b12cd6d9a1a284a); those results retain their original scope.

This is focused correctness evidence at the stated pins. No native-title fix, FPS gain or Windows result is claimed. The standalone shared-backing fixture may help avoid the Linux watched-import skip in future coverage.

AI-assisted: yes.

@JJenkx

JJenkx commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Native title validation: #9999 removes the severe corruption in the captured starting scene of Minecraft Dungeons II (PPSA16064) in a four-run matched check.

Linux 7.2.14, Ryzen 9 7950X, Radeon RX 6650 XT / RADV, Release. Pinned main 65351c2931ec; this PR at 3d6aba6f4b11. Both banks include the same #11630 HTTP2 prerequisite b17933dfd42d to reach gameplay. This is not a claim that plain main boots the title unaided.

Order Build Gameplay captures at 550 / 650 / 700 s
A1 main + shared HTTP2 prerequisite Severe magenta/white/green corruption at all three
B1 same + #9999 Normal-looking world, character, lighting and HUD at all three
B2 same + #9999, fresh runtime Normal-looking at all three
A2 main + shared HTTP2 prerequisite, fresh runtime Severe corruption returns at all three

Each checkpoint was reviewed in both XComposite and unfocused X11 drawable captures. A2 shows a small band of normal terrain at 700 s but remains severely corrupted. The black extent can differ between capture channels; the broad bad colors recur in both controls.

All four ran through the planned close at 720 s and exited 0, with no harness errors. Original inputs, private seed and frozen libraries verified unchanged; kernel setting restored, private module/asset mounts released and no remaining native process. Identical save/cache seed and five scripted inputs in every run. The 816-file banks differ only in the patched/unpatched AGC library pair. No eager-writeback or cache-bypass flags; both repeat process environments and actual AGC mappings verified. No compiler work during the four runs.

Exact native source integrations: control f0f929daba90, change 4d721753019a. The earlier paired focused Vulkan gate also reproduces the clear-view regression on this main pin and passes with the fix (0 skips/VUID messages).

Main control, 550 s With #9999, 550 s
Main control With this PR

All 24 reviewed captures, input timings, source pins, environment/cleanup receipts and hashes, SHA256 21d43d1aa408d8eb3b17530bfb847296d673de54a888691f73dc3113673a2289; remote download checked. No game assets, savedata, raw game logs or binaries are distributed.

Scope: this confirms removal of the captured starting-scene corruption on this machine. Further progression, audio and FPS still need testing; no full-title or speed claim. AI-assisted: yes.

@Pipodi

Pipodi commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Tested on Ghost of Yōtei, which shows the #9860 breakage: tiled 64 KiB-grid garbage in the tree cinematic around frames 1300-1460, unless APS5_NO_CLEAR_HAND_OVER=1 is set.

Setup: Windows 11, RTX 4090, driver 617.42. Our branch is main up to 3bb152e plus fork changes; the PR's commit (3d6aba6) was ported by names (the source.reset() context of main's cachedTexture differs on our side; the hunks and AnyLayerPending() are unchanged in meaning). agc_storage_clear_hand_over including Order::SampledClear passes; full ctest has no new failures.

Same env, clear hand-over ON, all-cold, top-third bright pixels in the tree scene:

run build hand-over f1300-1430 f1440 / f1450 / f1460
881 without #9999 on garbage 10 % at f1400, 16.4 % at f1450
885 without #9999 off 0 % 0.3-0.4 %
911 with #9999 on 0 % 0.5 / 0.5 / 0.3 %

Upload counters, frames 744-1427 (per frame):

hand-over off on, without #9999 on, with #9999
clear-path uploads 11.49 12.63 11.6
sampled texture write-backs 0 2.48 1.34

Without the PR, a traced run showed two receivers re-uploaded from their clear keys every frame before their sources were written back: 0x506e050000+0x1fe0000 (the one in #9860, three 960x540 sources) and a second one, 0x505ab20000+0x3fc0000 (four sources, 66 MiB, re-uploaded again after the flush about 0.93 times per frame). With the PR the extra clear-path uploads are gone and the cinematic renders correctly with the hand-over on.

One run with the PR so far; no FATAL, no device lost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* fix error Closes an issue (Fixes #N)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AGC: the clear-key hand-over from #7427 puts a white glare over Ghost of Yōtei's open world