Skip to content

feat(agc): expand a CMASK fast clear that matches the DCC clear of its target - #13147

Open
Prophet069 wants to merge 1 commit into
boykopovar:mainfrom
Prophet069:pr/agc-cmask-dcc-clear
Open

Prophet069 wants to merge 1 commit into
boykopovar:mainfrom
Prophet069:pr/agc-cmask-dcc-clear

Conversation

@Prophet069

@Prophet069 Prophet069 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

What

A CMASK fast clear of a color target that also has DCC keys threw CMASK fast clear of a DCC color target, whose clear belongs in its DCC keys. When the target's current DCC keys are one clear whose texel equals the texel CB_COLOR_CLEAR_WORD encodes, both readings give the same texels, so the CMASK is now stored as expanded (0xF) without writing texels. Every other CMASK fast clear of a DCC target still throws, and the message now names the target address, size, element bytes, tile mode, samples, the number of cleared tiles, the DCC keys and the clear words. Whether the console's CB reads CMASK under DCC remains unknown (Mesa uses single-sample CMASK only without DCC on GFX10); the debt entry says so.

Tested

  • With ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (VVL vulkan-sdk-1.4.321.0; neither log contains was not found but was requested by env var VK_INSTANCE_LAYERS), ctest --test-dir build -R <the 63 tests of agc_shader_memory_tests, agc_driver_cmask_fast_clear_tests, agc_driver_graphics_tests and agc_driver_sample_multisample_target_tests> -V on main 8c8b998620 and on this branch, same machine and GPU: main 63/63 passed, 0 VUID-; this branch 63/63 passed, 0 VUID-. CmaskFastClear.cpp covers the matching DCC clear (expanded, texels unchanged) and a mismatching one (throws with the details).
  • PPSA02015 (Death Stranding 2), Windows, integration branch: without the change the title stopped after 139-167 s at this throw; the detailed message showed target 0xc2de370000, 1920x1080, 4-byte elements, tile mode 27, 4 samples, 32400 of 32400 tiles cleared, DCC keys 0x00, clear words 0. With the change it reached 14800 dispatches (previously at most 1800) with no CMASK stop and 0 VUID-, until an unrelated device loss after 1051 s.
  • tools/check_conventions.py reports one debt-length warning on the CMASK fast clear entry, which was already over 1000 characters on main.
  • The commit changes only the files listed in the diff; it no longer carries the pre-feat(agc): merge a draw into more than one unclamped normalized color target #12916/fix(agc): don't release a label wait on a store its queue already took and reset #12923 tree of the first push.

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: PPSA02015 Death Stranding 2: On the Beach (PPSA02015) #5424
  • GPUs tested: NVIDIA GeForce RTX 3080 Laptop GPU (8 GB), driver 616.64, Windows 10 Pro 19045
  • AI-assisted: yes

🤖 Generated with Claude Code

@github-actions github-actions Bot added the unblocks title Names a title ID on the Unblocks line label Oct 30, 2026
@github-actions

github-actions Bot commented Oct 30, 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 7668 core/libs/prx/libSceAgcDriver/tests/CmaskFastClear.cpp L204

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 1395 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 4448 docs/dev/debt/libSceAgcDriver.md
PR 5372 docs/dev/debt/libSceAgcDriver.md
PR 5609 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 5925 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6186 docs/dev/debt/libSceAgcDriver.md
PR 6188 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6280 docs/dev/debt/libSceAgcDriver.md
PR 6412 docs/dev/debt/libSceAgcDriver.md
PR 6808 docs/dev/debt/libSceAgcDriver.md
PR 7085 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 7256 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7275 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 7642 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 8246 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9289 docs/dev/debt/libSceAgcDriver.md
PR 9356 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9387 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9508 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9712 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9852 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9895 docs/dev/debt/libSceAgcDriver.md
PR 9897 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9915 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 10193 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 10359 docs/dev/debt/libSceAgcDriver.md
PR 10497 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 10743 docs/dev/debt/libSceAgcDriver.md
PR 11452 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 11551 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 11825 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/tests/CmaskFastClear.cpp
docs/dev/debt/libSceAgcDriver.md
PR 12792 docs/dev/debt/libSceAgcDriver.md
PR 13809 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 13863 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 13920 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 13928 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 13929 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 14032 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 14944 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 15136 docs/dev/debt/libSceAgcDriver.md
PR 15343 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 15456 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 15548 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 15570 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 16879 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 17022 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 17611 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 17943 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 18029 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 18082 docs/dev/debt/libSceAgcDriver.md
PR 19610 docs/dev/debt/libSceAgcDriver.md
PR 20041 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 20153 docs/dev/debt/libSceAgcDriver.md
PR 20518 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 21923 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 22062 docs/dev/debt/libSceAgcDriver.md
PR 22424 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 22434 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 22647 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 22697 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 23553 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 23811 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 24083 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 24572 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 24735 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 25684 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 26041 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 26084 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 27133 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/debt/libSceAgcDriver.md
PR 27807 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 28142 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 28150 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 28176 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 28193 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 28229 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 28250 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 28470 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 28487 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 28586 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 28590 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 28673 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 28808 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 28920 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 28948 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 29089 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 29106 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 29107 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 29110 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 29113 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 29115 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 29116 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 29117 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 29119 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 29120 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 29121 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 29123 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@Prophet069 thanks for these. One problem common to all five PRs (#13145, #13146, #13147, #13148, #13149): each commit sits on main 5ecef095b6, but its tree still has the older versions of the files that #12916 and #12923 changed (for example RequestSerializer.cpp, UnclampedNormalizedBlend.cpp, LabelHistory.cpp, WaitMemory.cpp). So each PR, as it stands, would undo both of those merges; that is where the ~465 deleted lines in every diff come from.

For this PR, git diff 08a10d2253 <head> (main just before #12916) shows only your own change. Could you rebase it onto current main keeping only that change (for example git rebase --onto origin/main 08a10d2253 on a branch whose tree is your change applied to 08a10d2253, or re-apply your change on a fresh branch from main), then force-push? We'll review the change itself as soon as the diff no longer touches the #12916/#12923 files.

…s target

A DCC color target whose CMASK marks tiles fast-cleared is expanded without storing texels when its DCC keys are one clear of the same texel as CB_COLOR_CLEAR_WORD, since both readings give that texel. Any other CMASK fast clear of a DCC target still throws, now naming the target, its tiles, its DCC keys and the clear words.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Prophet069
Prophet069 force-pushed the pr/agc-cmask-dcc-clear branch from 5440a1e to a29ca03 Compare October 30, 2026 05:19
@Prophet069

Copy link
Copy Markdown
Contributor Author

Thanks, you were right: I squashed onto a moving origin/main, so the commit kept the pre-#12916/#12923 tree. Re-applied only this change on a fresh branch from main 8c8b998620 and force-pushed (same patch-id as git diff 08a10d2253 <old head>); the diff now touches only this PR's files. Rebuilt and reran the focused tests on 8c8b998620 and on the new head with the validation layer; the description has the results.

@Tehshortbus

Copy link
Copy Markdown
Contributor

@Prophet069 a heads-up: this branch sets the files #12916 changed back to their contents before #12916 merged (3d2d264392), although its base already includes #12916. For example, core/libs/prx/libSceAgcDriver/tests/execution/UnclampedNormalizedBlend.cpp loses TwoTargetProgram and the two-target draws, and ShaderPixelStageInfo::targetMerges goes back to a single targetMerge. Merged as it is, this would undo #12916, and PPSA26344 would stop again on its two-target blend (#12796). The same happens in #13145, #13146, #13147, #13148 and #13149, so they may share a stale copy of those files.

AI-assisted: yes (Claude Code)

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@Prophet069 thanks. The matching-clear case is a sensible narrow acceptance, and the detailed refusal message will help. One part needs a word in the description and a test:

  • The GPU path now excludes DCC targets. materializeCmaskClear gains color.dccAddress == 0 && on the recordCmaskClear branch. On main, a DCC target with a resident image, an active recorder and the GPU mutex held (the usual in-game case) took that branch and was cleared on the GPU without reaching the Require(color.dccAddress == 0, ...). With this change every such clear goes to the CPU path, and anything other than a single matching DCC clear now throws. That brings the code in line with the debt entry, but a title that currently gets past these clears on the GPU path could start stopping here. Could you say this in the description (why the GPU branch is wrong for DCC targets), and add a case to CmaskFastClear.cpp that goes through the resident/recorder path with a DCC target, both matching and not matching, so the new behaviour on that path is pinned?

  • The DCC equality check reads too few keys for pipe-aligned targets. The new proof uses the two-argument CurrentDccKeys, which checks only color.bytes / 256 bytes. Pipe-aligned R64KBX 4-byte targets have a larger DCC extent, which the existing colorKeyCount / DccKeyCount helper accounts for and Draw already uses for metadata stores and dependency ranges: a 64 KiB target has a 256-byte prefix but a 4096-byte modelled metadata extent, so matching keys in the prefix don't show the rest is clear. Please use the three-argument read with colorKeyCount(color, color.bytes) (or explain why the shorter range proves the whole target), and add a pipe-aligned case with a matching prefix and mixed keys beyond it (expect refusal, CMASK preserved) next to a fully matching control; the uniformly filled Keys fixture can't catch this.

@oneandonlydean oneandonlydean self-assigned this Oct 30, 2026
@TechLevelZero

TechLevelZero commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

✅ NVIDIA GPU test: passed

PR head a29ca03 merged onto main 73f4f7e · tested 2026-10-31 20:29 UTC · 29 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,337 passed · 3 failed (0 new, 3 also fail on main) · 48 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,388 of 3,072 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 (878 tests run on the GPU)
Slow tests (>30 s, GPU tests timed with validation layers) ⚠️ agc_driver_bda_device 62.0 s, ⚠️ agc_driver_graphics_maps_fallback 30.9 s, ⚠️ agc_driver_graphics 30.5 s
Failing on main too (3, not counted against this PR)
agc_submit_progress_no_timeline
guest_mmap_executable
guest_socket_options_multicast
Validation IDs already present on main (3 IDs in 387 tests)
VUID-VkDeviceCreateInfo-pNext-pNext (387 tests): agc_compute_pipeline_replay, agc_driver, agc_driver_address_passes, agc_driver_address_passes_draw_transitions, agc_driver_address_passes_targets_split, agc_driver_alias_copy_label, agc_driver_alpha_to_coverage, agc_driver_array_layer_target, and 379 more
VUID-vkCmdCopyImage-srcImage-01548 (12 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_plane_sampling, and 4 more
VUID-vkCmdCopyImage-srcImage-01551 (12 tests): agc_driver_depth_clear_hle, agc_driver_depth_plane_buffer_memory, agc_driver_depth_plane_cpu_write_after_memo, agc_driver_depth_plane_cpu_write_after_page_unwatch, agc_driver_depth_plane_cpu_write_after_partial_unwatch, agc_driver_depth_plane_partial_store, agc_driver_depth_plane_partial_store_unimported, agc_driver_depth_plane_sampling, and 4 more
Skipped (48)
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_msaa_dcc_compared_import_2: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_msaa_dcc_compared_import_4: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
agc_driver_msaa_dcc_compared_import_8: skipped, the device reports host imports that keep write protection, so the write-watch probe compares none of them
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_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 plat
Reproduce
git fetch origin a29ca0375bd4d50d1cfab0a03e2229d17cc07814 73f4f7e06e4f210a8c6570e335fd654dc0a86134
git checkout 73f4f7e06e4f210a8c6570e335fd654dc0a86134 && git merge --no-ff a29ca0375bd4d50d1cfab0a03e2229d17cc07814
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.

@JJenkx

JJenkx commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Windows GPU run of head a29ca0375b, merged onto main 1c6b316cf7 (clean merge, local only).

Windows 11 Enterprise 10.0.22621, Ryzen 9 5950X, Radeon RX 6700 XT with AMD proprietary driver 26.10.1 (Vulkan 1.4.315), WinLibs GCC 15.2.0 UCRT r7, Ninja, Release, BUILD_TESTING=ON. Khronos validation layer 1.4.309 requested for every test (VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation).

  • agc_driver_cmask_fast_clear, built from the test files this PR changes: pass, 3 of 3 runs each (--repeat until-fail:3), no failures, no skips.
  • They create Vulkan instances on the RX 6700 XT: the validation layer was inserted 3 times across the runs and reported no VUIDs.

AI-assisted: yes (Claude Code).

@github-actions github-actions Bot added docs agc libSceAgc* labels Oct 30, 2026
@mrfelek

mrfelek commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Death Stranding 2 (PPSA02015) needs this too. Same machine and stack as on #13146, plus #13146 and this PR a29ca0375b, merged cleanly.

  • Before: a CMASK fast clear of a DCC color target, whose clear belongs in its DCC keys, was recorded, 2 of 2 runs (182 s, 99 s).
  • With this PR: no such stop in 2 of 2 runs. The title runs until device and host memory fill with sampled textures (cache at its ~5.7 GB budget, vkAllocateMemory recovering after reclaim, host use ~21 GB at 296 s and 110 s, where my memory guard stopped it). That's the image table cost of AGC: one draw resolves a 21,489-entry image table into 14.6 GiB of textures and runs the device out of memory #6890, not this change. So the DCC keys did hold the same clear as the CMASK clear word in this title.

AI-assisted; the runs are from my machine(s).

@RNK123

RNK123 commented Nov 1, 2026

Copy link
Copy Markdown

Independent Linux / AMD RDNA 4 (RADV) validation of head a29ca0375bd4d50d1cfab0a03e2229d17cc07814, merged onto main 5e936063e3a74b7f03ff06905be04c5a00be60a7 (tree bfd7704d8f1c48f4ed37ecf87382aa1cb5a6709e).

Default-path focused checks: agc_driver_cmask_fast_clear, agc_driver_graphics and agc_driver_sample_multisample_target each passed three serial runs on original main and three on the merge, without skips. The merged CMASK fixture includes the new matching/mismatching DCC-clear cases; that file differs from main's original fixture.

Separate identical-source negative control: a narrowed fixture runs just a single-sample RGBA8 render target with all-zero DCC keys, zero CB clear words and a fully fast-cleared CMASK. It calls the real ColorMetadataPass(EliminateFastClear), then checks every visible texel is zero and the CMASK bytes are expanded. This paired lane explicitly sets APS5_NO_HOST_IMPORT=1 on both trees to exercise the non-import fallback instead of allowing the resident/import shortcut to bypass the changed decision.

  • Main: failed 3/3 at the actual production refusal, not a diagnostic-text assertion:
    AGC graphics: CMASK fast clear of a DCC color target, whose clear belongs in its DCC keys
    
  • Merge: passed 3/3, printing matching DCC/CMASK zero-clear probe passed after the pixel and CMASK checks.

The isolated fixture SHA-256 was identical on both implementations: 5ff0deeb3f7e63e1e9480c53d08099c1e9249f547950545d00fc9fb9176dd11b. No production accessor or behavioral change was backported to main.

Both paired lanes use ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, serial ctest -V, the same host and GPU. 0 VUID-, 0 SYNC-HAZARD-, and 0 Khronos validation error/warning diagnostics in the recorded default checks and isolated negative/positive runs. Loader diagnostics confirm validation insertion in every GPU process; no log reports was not found but was requested by env var VK_INSTANCE_LAYERS. The loader also reports the same unrelated skipped liblsfg-vk-layer.so implicit layer and RADV testing warning in both trees.

Host: CachyOS Linux 7.3.1-1-cachyos, Intel i5-12400F, GCC 16.2.1, Release / BUILD_TESTING=ON; AMD Radeon RX 9060 XT (1002:7590, RADV GFX1200, subgroup 64), Mesa 26.2.5-1; Khronos validation 1.4.363.

Scope: the default focused tests and the isolated import-disabled control are distinct lanes. This does not claim the whole suite passes with host imports disabled, nor a console measurement, a title run, or a performance change. All temporary test changes were removed; clean pinned main was rebuilt and its original three focused tests passed again.

Commands and isolated-case construction
cmake --build build-main --target agc_driver_cmask_fast_clear_tests \
  agc_driver_graphics_tests agc_driver_sample_multisample_target_tests --parallel 4
ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 \
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer \
ctest --test-dir build-main \
  -R '^(agc_driver_cmask_fast_clear|agc_driver_graphics|agc_driver_sample_multisample_target)$' \
  -V --parallel 1 --repeat until-fail:3 --timeout 120

The local VK_LAYER_PATH names the installed Khronos layer directory. The separate isolated fixture starts from main's original tests/CmaskFastClear.cpp, adds/registers/removes a 4096-aligned std::array<std::uint8_t,4096> Keys, and replaces the four test calls in main with only this case, retaining the existing real prepare, eliminate and expect helpers:

void matchingDccClear(AgcDriver::VulkanDevice& device) {
    auto color = target(ColorTileMode::RenderTarget);
    color.dccAddress = reinterpret_cast<std::uintptr_t>(Keys.data());
    color.clearWords = {0, 0};
    Keys.fill(0x00u);
    prepare(color, [](std::uint32_t, std::uint32_t) { return true; });
    eliminate(device, color);
    expect(device, color, [](std::uint32_t, std::uint32_t) { return 0u; }, "matching DCC and CMASK zero clears");
}

Build the CMASK target against each implementation with that identical fixture, add APS5_NO_HOST_IMPORT=1 to the same validation environment, and run only ^agc_driver_cmask_fast_clear$. Three attempts on main consistently return CTest status 8 at the production refusal; three on the merge return 0. There are no skips or timeouts. The probe deliberately excludes unrelated existing CMASK test cases from this fallback-only control.

AI-assisted independent hardware test run (Codex).

@github-actions github-actions Bot added review queue Next in the maintainer review queue: checks pass, no open change request, no conflict and removed review queue Next in the maintainer review queue: checks pass, no open change request, no conflict labels Nov 2, 2026

@XairRrR XairRrR 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 — approved

The PR accepts a CMASK fast clear of a DCC target only when the DCC keys are one clear of the same texel as CB_COLOR_CLEAR_WORD, and it throws a detailed message in every other case. The build is clean, the focused tests pass, the new test fails with main's Draw.cpp, and the validation comparison shows no new VUIDs.

What I ran

Head a29ca0375bd4d50d1cfab0a03e2229d17cc07814, main 9090972b7e91fd266819cbd77a8b058e177b5682, merged tree 69cd5cee0ad9afcf41fd4bd047ebcef0075b4e1f (Debian 13 VM, GCC 14.2.0, lavapipe Mesa 26.1.6).

git diff --check 9090972b7e91fd266819cbd77a8b058e177b5682...a29ca0375bd4d50d1cfab0a03e2229d17cc07814
python3 tools/check_conventions.py --base 9090972b7e91fd266819cbd77a8b058e177b5682
ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build --output-on-failure -R "^(agc_driver_cmask_fast_clear|agc_recorder_cmask)$"
# negative control
git show 9090972b7e91fd266819cbd77a8b058e177b5682:core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp > core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
ninja -C build -j32 -l32 agc_driver_cmask_fast_clear_tests
ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build --output-on-failure -R "^agc_driver_cmask_fast_clear$"
git show 69cd5cee0ad9afcf41fd4bd047ebcef0075b4e1f:core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp > core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
ninja -C build -j32 -l32 agc_driver_cmask_fast_clear_tests libs
ANYPS5_REQUIRE_VULKAN=1 ctest --test-dir build --output-on-failure -R "^agc_driver_cmask_fast_clear$"
git status --porcelain

Results

Check Result
git diff --check clean
check_conventions.py 0 errors; 1 debt-length warning on the CMASK fast clears entry (1962 characters). The entry was already over the limit on main, as the description says.
Configure, build, libs (script) passed
Selected tests (script, 2031 run) 0 new failures, 0 timeouts. The 7 known failures (agc_driver_division, the denormal tests, unwrap_self, vector_constant_factor_tininess) also fail on main.
Validation layer (script, 757 tests, layer loaded in 756, missing in none) 0 tests with new VUID-
agc_driver_cmask_fast_clear, agc_recorder_cmask passed (0.16 s, 0.12 s)
Negative control failed as expected
Worktree after restore git status --porcelain empty

Negative control

I restored core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp from main and rebuilt. agc_driver_cmask_fast_clear then failed on the first new case:

output with main's Draw.cpp
[gpu] storage image 0x55da74470000 destroyed with GPU results pending
a DCC target with a fast-cleared CMASK tile: was not refused
0% tests passed, 1 tests failed out of 1

After I restored the merged file and rebuilt, the test passed again.

This failure also answers the first point in oneandonlydean's comment (that excluding DCC targets from the GPU path could make titles stop that get through today). On main, the test's eliminate took the resident/recorder GPU path for the DCC target, and nothing was thrown in that call. That path never accepted a cleared tile of a DCC target, though. It called DispatchCmaskClear with write = color.dccAddress == 0 (Draw.cpp:590). With write false, CmaskClear.comp:33-37 sets errors.codes |= 1 for each cleared tile, and the next materializeCmaskClear throws through requireCmaskCodes (Draw.cpp:510). The message is "a CMASK fast clear of a DCC color target, whose clear belongs in its DCC keys, was recorded", which is the stop mrfelek reported for PPSA02015 on main.

So on main, the GPU branch only delayed the throw. Moving DCC targets to the CPU path (Draw.cpp:607) loses no case that worked before. The one difference is cost: a DCC target whose CMASK is already expanded now goes through readCmask, which may wait for a pending write to the CMASK. That happens once per target, because cmaskProved skips later calls.

Findings

Blocking

None.

Non-blocking

  1. Dead GPU error path. DispatchCmaskClear is now always called with write == true, because its only caller needs color.dccAddress == 0 (Draw.cpp:590, Draw.cpp:607). As a result, the errors branch of CmaskClear.comp:37, TextureDetiler::CmaskErrors and requireCmaskCodes (Draw.cpp:510, with its DCC message) can no longer be reached. Suggestion: remove the write parameter, the error buffer and requireCmaskCodes in a follow-up. Otherwise a reader may think a DCC target can still take the GPU path.
  2. The DCC key range covers only one key per 256 bytes (Draw.cpp:623), the second point in oneandonlydean's comment. I confirm that CurrentDccKeys(addr, bytes) reads DccKeyBytes(bytes), while colorKeyCount returns the larger console extent for pipe-aligned 4-byte R64KBX targets. However, the same metadata pass then picks the target's texels from the same short read (Draw.cpp:3976, also materializeRegisterClear at Draw.cpp:457). The new acceptance therefore agrees with what the pass already does, and the gap is not new. Reading CurrentDccKeys(color.dccAddress, color.bytes, colorKeyCount(color, color.bytes)) here would still be cheap and stricter, and it would be needed before the rest of the pass is extended to the full extent.
  3. The debt entry now partly contradicts itself. docs/dev/debt/libSceAgcDriver.md:239 still says "a cleared tile of a DCC target … throw", while the new sentence at the end of the same entry says a matching one is expanded. Suggestion: cut the earlier clause to "a cleared tile of a DCC target whose keys are not a matching clear". The CONTRIBUTING rules also ask entries to be cut rather than grown, and this entry is already flagged at 1962 characters.
  4. The description does not mention the GPU-path exclusion. oneandonlydean asked for it to be explained. The evidence above can serve as that explanation: the GPU path for DCC targets only recorded an error that threw later.

Not verified

  • Console behaviour (whether the CB reads CMASK under DCC). The debt entry already records this as unknown.
  • Pipe-aligned targets with keys that match over the short range but differ beyond it. This PR adds no such case, and I did not write one (see non-blocking 2).
  • The PPSA02015 run and runs on non-lavapipe GPUs. I am relying on the author, TechLevelZero (NVIDIA), JJenkx (RX 6700 XT) and RNK123 (RADV) for those.
  • No title was launched.

@github-actions github-actions Bot added review queue Next in the maintainer review queue: checks pass, no open change request, no conflict and removed review queue Next in the maintainer review queue: checks pass, no open change request, no conflict labels Nov 3, 2026
@adam25136

adam25136 commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Windows and NVIDIA Blackwell run, for head a29ca0375b merged into main 1e658521a0 (git merge --no-ff, clean merge).

GPU NVIDIA GeForce RTX 5080 (10de:2c02), driver 617.42 (32.0.16.1742), Vulkan 1.4.351
Host Windows 10 Pro 22H2 (19045), i9-12900KF, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON
Selection 2,171 of 3,924 tests, chosen by tools/select_tests.py select from main's build graph for the 3 changed files
Run select_tests.py ctest build --parallel 4 --timeout 120 with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1; main ran the full suite the same way on this machine
Result 2,157 passed, 12 skipped (the same 12 as on main), 2 failed, 0 new

Both failures fail on main here too: agc_driver_store_over_untracked (#15559, since b6c6549) and agc_driver_direct_write_completion, which fails on main on this machine as well, also when run on its own (33 of 34 runs). No selected test took over 30 s.

Not run: the Khronos validation layer is not installed on this machine, so this says nothing about VUIDs. No title was run.

AI-assisted: yes. Claude Code ran the builds and tests and drafted this comment; the numbers are from the runs on this machine.

@DonRyuzaki

Copy link
Copy Markdown
Contributor

Windows/RX 7800 XT paired CMASK/DCC check (AI-assisted test/report).

I built agc_driver_cmask_fast_clear_tests from PR head a29ca03 merged cleanly onto pinned upstream main a992b80 (local merge b66eaf3ef3cc127c955a3920d66ec496f8301308). The focused agc_driver_cmask_fast_clear CTest passed 3/3 separate runs on the actual AMD Radeon RX 7800 XT (1002:747e, subgroup 64); no run skipped. Each log ended with 'CMASK fast clear draw and eliminate tests passed'.

For a paired negative control, I applied only this PR's 26-line CmaskFastClear.cpp test additions to the pinned main source in test-only commit 7093a7033b, preserving all main production code. The same target built, selected the same RX 7800 XT, and the focused CTest failed at 'a DCC target with a fast-cleared CMASK tile: was not refused'. The matching PR run passed. This directly checks the added refusal case against the production change, rather than inferring its effect from a passing PR-side test alone.

The DCC part of the fixture first requires refusal of a one-of-16 CMASK fast-clear tile while DCC keys are uncompressed, including a diagnostic naming the tile count. It requires refusal when a fully cleared CMASK encodes 0x11223344 but DCC keys encode zero. When the clear words are changed to zero, elimination must leave all visible texels zero; a partially fast-cleared CMASK under matching DCC register-clear keys must also eliminate and yield the expected clear color. The fixture reads every visible 61×13 texel and requires its CMASK buffer to be expanded afterward.

The Khronos validation layer reported VUID-VkDeviceCreateInfo-pNext-pNext at device creation in all three PR runs and in the main control; the logs say its installed Vulkan header version 284 does not recognize two pNext structure types. I therefore do not call these validation-clean runs or attribute that VUID to this PR.

This adds a current-head, pinned-main RX 7800 XT Windows comparison alongside the already reported RX 6700 XT Windows and other GPU evidence. It is a synthetic CMASK/DCC fixture, not a console measurement, a game outcome, or a performance result.

@kiwe147

kiwe147 commented Nov 21, 2026

Copy link
Copy Markdown

Tested head a29ca0375b, applied with git apply on main fd4aeed483 together with the other 26 PRs of one batch (#24498, #24665, #17297, #21499, #21726, #22534, #12900, #17843, #22051, #22075, #23087, #23206, #23222, #23227, #17482, #21935, #17477, #18272, #22858, #22929, #23028, #23295, #23916, #24179, #24706, #12619). All applied without conflicts and the whole tree built.

Setup: Windows 11 Pro 10.0.26200, Ryzen 7 9800X3D, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON. GPUs: NVIDIA GeForce RTX 3080 (driver 621.24) and the AMD Radeon iGPU of the CPU (gfx1036, driver 32.0.21036.18). No validation layer. iGPU run: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ANYPS5_GPU="AMD Radeon", agc_/video tests only.

tests RTX 3080 iGPU
agc_driver_cmask_fast_clear, agc_driver_depth_fast_clear, agc_driver_depth_fast_clear_submit (3 tests, matched by name to the test file this PR changes) all pass all pass

Whole batch: the full ctest -j 12 (6525 tests) on the RTX 3080 has 8 failing tests; the 4 that also fail on main fd4aeed483 are agc_driver_stencil_plane_memory, agc_driver_msaa_dcc_unwatch, agc_storage_write_back_host_retile, and pr_overlap_names, which needs a newer Python than my 3.10. Intermittent in this run (pass when rerun alone, or known flaky): agc_driver_store_over_untracked. Traced to other PRs of the batch, each by reverting it and testing again: #18272 (guest_audio_out), #12900 (guest_user_service_initial_user_bounds); none is in this PR's area. Failing tests I could not trace to a single PR (reverting the likely candidates did not clear them): guest_content_search. The 2125 agc_/video tests on the iGPU have 2 failing: agc_driver_stencil_plane_memory, agc_driver_store_over_untracked (agc_driver_stencil_plane_memory also fails on main).

This is one combined tree, not a run of this PR alone.

AI-assisted: yes (Claude Code)

@Plyxen Plyxen 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.

I read the diff at a29ca0375b. Windows 11, GCC 15.2, merged into main at cf556db18c3 together with other open PRs (so not an isolated build), with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 and VK_LAYER_KHRONOS_validation on an RTX 5080 (621.24) and a Radeon iGPU (26.11.2).

  • agc_driver_cmask_fast_clear: pass on both GPUs. The loader log shows the layer inserted and no "was not found" line, and neither run has a VUID- or SYNC-HAZARD line.
  • Control (same tree and tests, the changed files of those PRs put back to main's): fails on both GPUs: "a DCC target with a fast-cleared CMASK tile: was not refused".

Not checked: a title.

AI-assisted: yes (Claude Code)

@ligmaSec ligmaSec left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The DCC clear comparison preserves the existing refusal for a different clear color. The fixture checks that refusal and also covers both a whole CMASK clear and a partial clear when the colors match. Could the refusal check also snapshot and compare both metadata regions across the failed eliminate? That would catch moving the CMASK write ahead of the DCC equality check. The trial merge is clean. Please put the debt update in a fragment in docs/dev/debt/changes/. I have no paired Vulkan result for this head yet.

AI-assisted: yes.

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 review queue Next in the maintainer review queue: checks pass, no open change request, no conflict unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.