Skip to content

fix(agc): fast-clear the viewed mip of a 2D mipmapped DCC colour target - #26046

Merged
oneandonlydean merged 7 commits into
boykopovar:mainfrom
klosixgaming-arch:fix/dcc-mipmapped-color-target-fast-clear
Nov 24, 2026
Merged

oneandonlydean merged 7 commits into
boykopovar:mainfrom
klosixgaming-arch:fix/dcc-mipmapped-color-target-fast-clear

Conversation

@klosixgaming-arch

Copy link
Copy Markdown
Contributor

What

On main, a 2D mipmapped DCC colour target never gets its viewed mip fast-cleared. DecodeColorBuffer keeps the chain's key base only in chainDccAddress and logs "DCC keys of mipmapped array and 3D color targets are ignored", so the target's image starts from whatever guest memory holds. When the game fast-clears such a target and then blends into it, the draw starts from stale bytes.

Cyberpunk 2077 (PPSA03974) hits this on "Set V's appearance" in the character creator: magenta and green noise over the bottom third of the screen. The 3200x1800 RGBA16F character preview (5 mips) shares its memory with 2400x1800 R32U and B10G11R11 targets drawn earlier in the frame. The preview's draws blend with ONE / ONE_MINUS_SRC_COLOR, so the 32-bit bytes left by those targets show through, and read as half floats they hold NaNs, which the composite turns into magenta.

This PR gives the viewed mip its own key range and serves its fast clear:

  • The viewed mip's keys are read at its offset in the chain's metadata, per AMD Addrlib Gfx10Lib::HwlComputeDccInfo: a 4096-key metadata block covers 1 MiB of texels (512x512 at 4 bytes, 512x256 at 8 bytes); with a mip tail, the tail levels share one block at offset 0; the levels above the tail follow from the smallest to mip 0.
  • When that slice holds one clear code, the mip is cleared on the GPU on the resident chain image: no CPU store of the mip, no re-upload. The slice's keys are marked uncompressed after the draw, and the write-back stores the mip whole, because its undrawn part is the clear, not the stored bytes.
  • When the game's key fill is still a recorded GPU write at bind (Cyberpunk re-issues its key fills every frame), the keys are answered from the recorded writes without a sync: a fill leaving one fillable clear code takes the GPU clear, recorded after the fill in the same queue; a fill of 0xff clears nothing; mixed, partial or unknown writers fall back to the current keys.
  • A viewed mip inside the mip tail reads the shared tail block and is not fast-cleared. Arrays and 3D targets keep the current behaviour and log line.
  • APS5_NO_DCC_MIP_FAST_CLEAR (a runtime switch, so APS5_AB can toggle it) turns this off.

#21479 imports a uniform DCC clear for single-level targets and leaves mips out; this PR covers the mipmapped colour-target chain. They don't overlap.

How it was found

A frame capture of "Set V's appearance" (#21931) replayed the band exactly. Zeroing the 3200x1800 preview at bind removed it, with every other pass running. The colour buffer registers set DCC_ENABLE with a key base that the driver parked, and in that key array the keys change from 0xff to the clear code at key 90112, which is mip 0's offset in the Addrlib layout for this chain (mips 4 to 1 take 1 + 1 + 4 + 16 blocks).

Tested

Setup: Ubuntu 26.04.1 (Linux 7.0.0-43), NVIDIA GeForce RTX 4080 (595.99.02), Xeon E5-2699 v3, GCC 15.2.0 Release. Based on main db397a73fe.

Unit tests:

  • agc_driver_dcc_keys_first_write gains the key offsets as a pure function (the 3200x1800 8-byte chain, a 1024x1024 4-byte chain and a 2048x1024 8-byte chain with tails, a tail level), a blended draw over a mipmapped target whose mip-0 keys hold a clear code over stale bytes, and three pending-fill cases (clear code, 0xff, partial). The pending clear-code case fails without the pending-fill change: the bind syncs the fill and stores the clear on the CPU.
  • DCC, mixed-key and runtime-switch tests: 10 of 10.
  • Full agc_ suite at 6d2124e4f4: 2033 of 2035 with -j8. The two failures, agc_driver_draw_cache_capacity and agc_driver_draw_shader_failure, pass when run on their own.

Cyberpunk 2077 PPSA03974, arms alternated, off = APS5_NO_DCC_MIP_FAST_CLEAR=1. Noise = magenta share of the bottom third, last 4 frames on "Set V's appearance".

boot fix "Set V's appearance" noise
on-1 on 0.00 / 0.00 / 0.00 / 0.00
off-1 off 25.21 / 17.00 / 17.30 / 17.20
on-2 on 0.00 / 0.00 / 0.00 / 0.00
off-2 off 17.24 / 17.08 / 17.36 / 17.29

Body Type is drawn in both arms. Intro, one warm-up per arm, then 3 boots per arm, presents per 10 s: on 56.4 / 58.4 / 56.0, off 57.8 / 56.5 / 56.1. No measurable cost.

Not verified: the layout is checked against one title's chain without a tail; the tail case rests on Addrlib alone. V is still a black silhouette on this screen with the fix on and off; that is a separate bug.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: PPSA03974 Cyberpunk 2077 (PPSA03974 / PPSA04029) #8045
  • GPUs tested: NVIDIA GeForce RTX 4080, driver 595.99.02, Ubuntu 26.04.1
  • AI-assisted: yes

@github-actions github-actions Bot added the unblocks title Names a title ID on the Unblocks line label Nov 23, 2026
@github-actions github-actions Bot added docs agc libSceAgc* labels Nov 23, 2026

@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 — no blocking findings

Nothing blocks this change; the reported full-suite failures are described as passing when run individually, and the tail-layout limitation is documented.

What I ran

Reviewed head 6d2124e4f4aaf4467850cffb2b58c04cca00044f against the prepared diff; I did not run commands or tests.

Results

Check Result Note
Diff and source review passed Targeted paths and changed lines inspected
Programmatic checks not run No commands run

Findings

Blocking

None.

Non-blocking

None.

Not verified

No test suite or precheck was run. Reviewed changed-line content for DccMetadata.hpp, DccMetadata.cpp, Draw.cpp, RuntimeSwitches.cpp, State.cpp, Texture.cpp (targeted ranges via repo_read.py), DccKeysFirstWrite.cpp, ENVIRONMENT.md, and libSceAgcDriver.md. Texture.hpp and RuntimeSwitches.hpp were present in the review bundle but their changed lines were not read; Texture.cpp was excluded from the bundle for size and read through the repository reader. No changed file was excluded by the manifest other than Texture.cpp from the bundle.

To get this to a good state

Nothing is required.

@tablefrogpillow

Copy link
Copy Markdown
Contributor

Verified on real AMD RADV (Linux) across all three gens — the PR lists NVIDIA (RTX 4080) only. Built the PR head (fix/dcc-mipmapped-color-target-fast-clear) and ran agc_driver_dcc_keys_first_write under ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 with Khronos validation 1.4.363 inserted (confirmed Insert instance layer, no was not found):

GPU Arch Result VUID-
RX Vega 56 (RADV VEGA10, gfx900) GCN5 pass 0
RX 7900 GRE (RADV NAVI31, gfx1100) RDNA3 pass 0
Ryzen 7800X3D iGPU (RADV RAPHAEL, gfx1036) RDNA2 pass 0

All three print DCC keys first write tests passed with zero VUID-. The mipmapped-target DCC fast-clear / first-write key handling holds on real AMD across GCN5 and both RDNA gens, complementing the NVIDIA coverage in the PR.

Evidence: VERIFIED (reproduced on each GPU under the above conditions).
AI-assisted: yes

@Helldiverr

Copy link
Copy Markdown
Contributor

Head 6d2124e4f4 merged onto upstream/main 90b6de9c18: the focused tests pass 3/3 on gfx1201 with the Khronos validation layer loaded, and they log no VUID-. Three things need changing before merge: the code comments, the direct debt edit, and the mipmapped GPU cases, which are compiled out on Windows.

Code.

  • Comments. The change adds 88 // comment lines to driver code:

    File Lines Example
    Draw.cpp 30 :469, :2206-2217
    Texture.cpp 23 :5242, :7202
    DccMetadata.hpp 13
    Texture.hpp 10
    State.cpp 8 :2430, :2722-2727
    DccMetadata.cpp 4

    It adds 58 more to DccKeysFirstWrite.cpp. CONVENTIONS.md says comments may only mark technical debt (added by a human), #endif, namespace ends and upstream licence notices. These comments explain the code instead. tools/check_conventions.py does not flag them, because it accepts comments whenever the PR also touches a debt file.

  • Debt edit. docs/dev/debt/libSceAgcDriver.md:180 is edited directly, and there is no fragment in docs/dev/debt/changes/. TechnicalDebt.md#fragments says a PR does not edit the debt files and adds a fragment instead. check_conventions.py --base upstream/main --head gpu-pr-26046 reports only a debt-length warning: the entry is 2289 characters, over the 1000 limit.

  • holdsClearFill. StorageTexture::ClearMip sets it to true (Texture.cpp:7319), and nothing ever sets it back. After an image's first mip clear, storesWhole() returns true whenever any of its units is pending (Texture.cpp:5245), not only for the write-back that carries the clear. So later write-backs of that image store whole units. I did not measure a wrong result or a cost from this.

  • The key-offset arithmetic (DccMipKeySlice/DccMipKeyOffset) matches the Addrlib layout the debt entry cites, for the cases the test checks. The refusal paths fall back to the old CPU store rather than reporting success.

Windows coverage. As committed, every mipmapped GPU case in DccKeysFirstWrite.cpp is inside #ifndef _WIN32 and is a no-op on Windows:

  • RunMipmappedClearDraw (:1083)
  • RunMipmappedClearPendingClearFill (:1155)
  • RunMipmappedClearPendingUncompressedFill (:1234)
  • RunMipmappedClearPendingPartialFill (:1288)
  • RunMipmappedTarget (:1340, already guarded on main)

The VulkanDeviceTestAccess helper they need is guarded too (:42-50). Only the pure RunMipKeyOffsets runs. Consequences:

  • On this head, with APS5_NO_DCC_MIP_FAST_CLEAR=1, the test still passes (0.40 s), so on Windows it does not cover the change.
  • I made a local change, which I did not commit, that removes those six guards. With it, the test builds with GCC 15.2 and passes in 0.50 s on gfx1201, with 0 VUID-.
  • With the same local change and APS5_NO_DCC_MIP_FAST_CLEAR=1, it fails in 0.36 s: the viewed mip of a mipmapped DCC color target takes its own key range and the resident surface keeps its keys.

So the guards do not appear to be needed on Windows with an AMD GPU. Dropping them would let the test cover the change on Windows.

Negative control. On main the six focused tests pass. I copied the PR's DccKeysFirstWrite.cpp onto main, and it does not build: 'DccMipKeyOffset' has not been declared in 'AgcDriver::Graphics' (:1382). On Windows the mip GPU cases would be compiled out anyway, so the switch runs above are the better control there.

GPU.

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer ctest --test-dir build -R "^(agc_driver_dcc_keys_first_write|agc_driver_dcc_keys_rewrite_to_register_clear|agc_driver_dcc_key_presync|agc_storage_dcc_mip_writeback|agc_runtime_switches|agc_driver_packed_mip_tail_target)$" -V
run dcc_keys_first_write dcc_keys_rewrite_to_register_clear dcc_key_presync agc_storage_dcc_mip_writeback agc_runtime_switches packed_mip_tail_target
main Passed 1.16 s Passed 0.23 s Passed 1.00 s Passed 0.22 s Passed 0.02 s Passed 1.07 s
main + PR test does not build
head 1 Passed 0.37 s Passed 0.20 s Passed 0.26 s Passed 0.17 s Passed 0.02 s Passed 0.33 s
head 2 Passed 0.35 s Passed 0.19 s Passed 0.25 s Passed 0.16 s Passed 0.01 s Passed 0.28 s
head 3 Passed 0.34 s Passed 0.19 s Passed 0.25 s Passed 0.16 s Passed 0.01 s Passed 0.28 s
head, APS5_NO_DCC_MIP_FAST_CLEAR=1 Passed 0.40 s
head, guards removed Passed 0.50 s
head, guards removed, APS5_NO_DCC_MIP_FAST_CLEAR=1 Failed 0.36 s

The main times include the first start after the build. Every log shows the AMD Radeon AI PRO R9700 as the device.

dcc_key_presync prints two skipped ... outside the write watch lines for some of its cases on both main and head.

Validation.

  • Insert instance layer "VK_LAYER_KHRONOS_validation" count: 5 on main and 5 on each head run. Each single-test run has 1.
  • was not found but was requested by env var VK_INSTANCE_LAYERS appears in none of them.
  • VUID- lines: 0 on main, 0 on each head run and 0 in the three extra runs.

Host:

  • GPU: AMD Radeon AI PRO R9700 (gfx1201, 1002:7551), driver 32.0.31044.16, Vulkan 1.4.349
  • Validation layer: Khronos 1.4.363 (LunarG SDK)
  • CPU: Ryzen 9 9950X3D
  • OS: Windows 11 Pro 26300
  • Toolchain: WinLibs GCC 15.2, Release
  • Commits measured: main 90b6de9c18; head 4b629c0806 (6d2124e4f4 merged onto 90b6de9c18)

AI-assisted: yes

@4le22io

4le22io commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

A Windows + NVIDIA run of the current head 6d2124e. No regressions, and the DCC tests, including the new mipmapped fast-clear cases, pass.

System: Windows 11 Pro 10.0.26200, NVIDIA GeForce RTX 4060 (10de:2882, Ada), driver 621.01, Intel Core i5-12400F, WinLibs GCC 15.2.0 r7 (UCRT), Release, BUILD_TESTING=ON.

Trees, each a full build:

  • main f5b7e1d;
  • main + 6d2124e, merged with git merge --no-ff (clean merge, 11 files).

Run: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer (Vulkan SDK 1.4.363.1), ctest -R '^(agc_driver_dcc_keys.*|agc_dcc.*|agc_display_buffer_dcc.*)$' -V. That covers every test that agc_driver_dcc_keys_first_write_tests registers, plus agc_dcc_key_sharing and agc_display_buffer_dcc. 3 runs per tree:

tree tests result VUID Insert instance layer
main 9 9 pass, every run 0 7
this PR 9 9 pass, every run 0 7

With this PR, agc_driver_dcc_keys_first_write (0.9 s) runs the new RunMipmappedClearDraw and RunMipmappedClearPendingClearFill cases and ends with DCC keys first write tests passed.

I also built a control: this PR's tree with main's Draw.cpp, State.cpp, Texture.cpp, Texture.hpp, DccMetadata.hpp, DccMetadata.cpp and RuntimeSwitches.*. It does not build, because DccKeysFirstWrite.cpp uses AgcDriver::Graphics::DccMipKeyOffset, which this PR adds. So there is no control result.

ctest -R '^agc' -j 8 with the layer: 2093 tests on both trees. Both trees have the same single failure, agc_driver_store_over_untracked (#22670, fix in #22764), already tracked on this GPU. The layer was inserted 1901 times on both trees. There are 0 was not found but was requested lines and 0 VUID- lines.

Not tested: Linux, a title, and the new runtime switch in a non-default setting.

AI-assisted: yes (Claude Code). It merged the PR, ran the builds and the test sets, and drafted and posted this comment.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 23, 2026
@github-actions

github-actions Bot commented Nov 23, 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 16831 core/libs/prx/libSceAgcDriver/Graphics/include/RuntimeSwitches.hpp L33
core/libs/prx/libSceAgcDriver/Graphics/src/RuntimeSwitches.cpp L39, L65
PR 22018 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp L4849
PR 23243 core/libs/prx/libSceAgcDriver/Graphics/include/RuntimeSwitches.hpp L33
core/libs/prx/libSceAgcDriver/Graphics/src/RuntimeSwitches.cpp L39, L65
PR 23244 core/libs/prx/libSceAgcDriver/Graphics/include/RuntimeSwitches.hpp L33
core/libs/prx/libSceAgcDriver/Graphics/src/RuntimeSwitches.cpp L39, L65
PR 24445 core/libs/prx/libSceAgcDriver/tests/execution/DccKeysFirstWrite.cpp L99, L102-103, L146-147
PR 25443 core/libs/prx/libSceAgcDriver/Graphics/include/RuntimeSwitches.hpp L33
core/libs/prx/libSceAgcDriver/Graphics/src/RuntimeSwitches.cpp L39, L65
PR 26268 core/libs/prx/libSceAgcDriver/Graphics/include/RuntimeSwitches.hpp L33
core/libs/prx/libSceAgcDriver/Graphics/src/RuntimeSwitches.cpp L39, L65
PR 26582 core/libs/prx/libSceAgcDriver/Graphics/include/RuntimeSwitches.hpp L33
core/libs/prx/libSceAgcDriver/Graphics/src/RuntimeSwitches.cpp L39, L65

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/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 1395 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 1896 docs/dev/ENVIRONMENT.md
PR 4448 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 4472 docs/dev/ENVIRONMENT.md
PR 5609 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 5925 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6186 core/libs/prx/libSceAgcDriver/Graphics/src/DccMetadata.cpp
docs/dev/ENVIRONMENT.md
PR 6188 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6192 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6197 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6209 core/libs/prx/libSceAgcDriver/Graphics/include/DccMetadata.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DccMetadata.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6235 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 6280 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6481 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6924 docs/dev/ENVIRONMENT.md
PR 6995 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 7002 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 7085 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 7256 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 7275 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/ENVIRONMENT.md
PR 7642 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/ENVIRONMENT.md
PR 7643 docs/dev/ENVIRONMENT.md
PR 9345 docs/dev/ENVIRONMENT.md
PR 9356 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/ENVIRONMENT.md
PR 9387 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/ENVIRONMENT.md
PR 9508 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/ENVIRONMENT.md
PR 9712 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/ENVIRONMENT.md
PR 9852 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/ENVIRONMENT.md
PR 9895 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 9897 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 9915 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 10193 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/ENVIRONMENT.md
PR 10497 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 10743 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 10894 docs/dev/ENVIRONMENT.md
PR 11435 docs/dev/ENVIRONMENT.md
PR 11436 docs/dev/ENVIRONMENT.md
PR 11444 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 11452 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 11551 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 11825 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 12324 docs/dev/ENVIRONMENT.md
PR 12746 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/ENVIRONMENT.md
PR 12792 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 12840 docs/dev/ENVIRONMENT.md
PR 12849 docs/dev/ENVIRONMENT.md
PR 13148 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 13251 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 13796 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 13863 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/RuntimeSwitches.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/ENVIRONMENT.md
PR 13920 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/RuntimeSwitches.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/ENVIRONMENT.md
PR 13928 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/ENVIRONMENT.md
PR 13929 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/ENVIRONMENT.md
PR 14032 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 14262 docs/dev/ENVIRONMENT.md
PR 14944 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 15136 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 15570 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/ENVIRONMENT.md
PR 15621 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 16217 docs/dev/ENVIRONMENT.md
PR 16793 docs/dev/ENVIRONMENT.md
PR 17056 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 17557 docs/dev/ENVIRONMENT.md
PR 17719 docs/dev/ENVIRONMENT.md
PR 17729 docs/dev/ENVIRONMENT.md
PR 18173 core/libs/prx/libSceAgcDriver/Graphics/include/RuntimeSwitches.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/RuntimeSwitches.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/ENVIRONMENT.md
PR 18185 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 18226 core/libs/prx/libSceAgcDriver/Graphics/include/RuntimeSwitches.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/RuntimeSwitches.cpp
docs/dev/ENVIRONMENT.md
PR 19697 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/ENVIRONMENT.md
PR 20041 core/libs/prx/libSceAgcDriver/Graphics/include/RuntimeSwitches.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/RuntimeSwitches.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/execution/DccKeysFirstWrite.cpp
docs/dev/ENVIRONMENT.md
PR 20172 docs/dev/ENVIRONMENT.md
PR 20183 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 20248 docs/dev/ENVIRONMENT.md
PR 20315 core/libs/prx/libSceAgcDriver/Graphics/include/DccMetadata.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/DccMetadata.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/ENVIRONMENT.md
PR 20519 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/ENVIRONMENT.md
PR 20580 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 20845 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 21225 docs/dev/ENVIRONMENT.md
PR 21649 docs/dev/ENVIRONMENT.md
PR 22071 docs/dev/ENVIRONMENT.md
PR 22190 core/libs/prx/libSceAgcDriver/Graphics/include/RuntimeSwitches.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/RuntimeSwitches.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/ENVIRONMENT.md
PR 22424 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
docs/dev/ENVIRONMENT.md
PR 22434 core/libs/prx/libSceAgcDriver/Graphics/include/RuntimeSwitches.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/RuntimeSwitches.cpp
docs/dev/ENVIRONMENT.md
PR 22531 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 22546 core/libs/prx/libSceAgcDriver/Graphics/include/RuntimeSwitches.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/RuntimeSwitches.cpp
docs/dev/ENVIRONMENT.md
PR 22647 core/libs/prx/libSceAgcDriver/Graphics/include/RuntimeSwitches.hpp
core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/RuntimeSwitches.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/ENVIRONMENT.md
PR 23242 docs/dev/ENVIRONMENT.md
PR 23252 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 23258 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 23281 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 23886 docs/dev/ENVIRONMENT.md
PR 23975 docs/dev/ENVIRONMENT.md
PR 24049 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 24083 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 24327 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
docs/dev/ENVIRONMENT.md
PR 24661 core/libs/prx/libSceAgcDriver/Graphics/include/RuntimeSwitches.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/RuntimeSwitches.cpp
docs/dev/ENVIRONMENT.md
PR 25610 core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 26197 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 26340 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp

…mip's key slice

A 2D mipmapped pipe-aligned DCC color target carries the whole chain's
metadata, but only the viewed mip is written; the driver parked the key
address in chainDccAddress and ignored the keys, so the target uploaded
the stored texels (an alias's bytes) instead of starting from the fast
clear. Give the viewed mip its own key range -- the AMD addrlib
HwlComputeDccInfo layout, small mips first, each a whole number of
4096-key blocks, the viewed mip's slice last -- and settle its range to
the clear colour before the resident lookup when that slice is one clear
code, so the draw starts from the clear like a single-level target.
Arrays and 3D keep the chain address and the existing log line.

The key reads keep the historical per-256-bytes count; the viewed mip's
padded extent sizes the marks and overlap checks, as the padded console
extent already did for single-level targets. APS5_NO_DCC_MIP_FAST_CLEAR
turns the fix off.

Adds RunMipmappedClearDraw: a 128x128 8-mip R64KBX chain with a 0000
clear over stale texels in the viewed mip's slice; a 0.5 premultiplied
draw must see 128 inside the scissor and the clear outside, and the
viewed mip's keys must end uncompressed. It fails with
APS5_NO_DCC_MIP_FAST_CLEAR=1.
Replace the per-draw CPU settle (store the clear over the whole mip and
re-upload it) with a GPU clear of the viewed mip's subresource: the image
holds the clear, the guest bytes follow through the write-back, which now
stores the filled mip whole (holdsClearFill). The single-level DCC path
already serves a uniform clear from the image; this extends it to the
mipmapped target whose chain image otherwise starts from the stored texels.

The test for the draw reads the guest buffer directly: the GuestMemory
access hook would store the pending clear (the very write-back under test)
before a hooked read could observe the pre-write-back state.
…ding

When the game's DCC key fill is still a recorded GPU write at bind, the
old path synced it (CurrentDccKeys) and ClearMip's pending-write refusal
still fired over the surface's key extent, so the bind fell back to the
CPU store (a full memset of the viewed mip plus a re-upload, every frame
the game re-clears the target). Answer the keys from the recorded writes
instead (LandedDccKeys, no sync): every pending writer a fill leaving one
fillable clear code takes the GPU clear with the clear recorded after the
fill in the same queue; a fill of 0xff clears nothing; mixed, partial or
an unknown writer falls back to the current keys, as before. ClearMip now
skips its pending-write checks when the caller passed a verified code
clear. Remove the temporary MIPCLEAR-PROF profiling counter.

Tests: three pending-fill scenarios next to the existing mipmapped clear
test -- a pending clear-code fill must take the GPU clear with no sync and
no guest write at bind (it fails without the change: ClearMip refuses, the
CPU fallback writes the guest at bind), a pending 0xff fill must not
materialize a clear, and a pending partial fill takes the fallback path
and stays correct.
…ip-tail block, register APS5_NO_DCC_MIP_FAST_CLEAR as a runtime switch
@klosixgaming-arch
klosixgaming-arch force-pushed the fix/dcc-mipmapped-color-target-fast-clear branch from 6d2124e to d76afb0 Compare November 24, 2026 04:46
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Nov 24, 2026
@oneandonlydean
oneandonlydean merged commit b5601c2 into boykopovar:main Nov 24, 2026
14 checks passed
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.

6 participants