fix(agc): draw a stencil replacement against a known stencil value as an inversion #7725

Merged
milescoviello merged 1 commit from upstream-pr/7725 into main 2026-10-21 16:49:30 +00:00
milescoviello commented 2026-10-19 03:11:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-19T03:11:06Z.


What

DB_STENCILREFMASK holds a test value (STENCILTESTVAL) and a separate operation value (STENCILOPVAL). REPLACE_OP, ONES and REPLACE_TEST write a value that can differ from the test value on bits the compare reads, while Vulkan has one reference for both. Such a face threw stencil replacement ... is unsupported. Ghost of Tsushima (PPSA02225) stops on one at its splash screen: an EQUAL test against 0xff whose pass operation is REPLACE_OP with 0x40, both masks 0xff.

Some compares fix the stencil value wherever an operation runs:

  • on pass and depth fail: EQUAL, LEQUAL against the largest masked value, GEQUAL against 0;
  • on fail: NOTEQUAL, LESS against 0, GREATER against the largest masked value.

There, if every written bit is also compared, the written bits hold the test value, so writing value is the same as inverting the bits where it differs from the test value. The face becomes an INVERT whose write mask is (test ^ value) & writeMask, and its reference stays the test value for the compare.

  • The operations of a face share its write mask, so this only applies when every operation that isn't KEEP becomes the same inversion (for example REPLACE_OP on both pass and depth fail). Any other combination still throws, now with its own message.
  • A replacement that agrees with the test value on the compared bits takes the existing path (one reference) as before. A pixel shader that exports the stencil test value is unchanged.

Tested

Ubuntu 24.04, GCC 13.3, NVIDIA RTX 4070 Ti (595.99.02), on main 8a526d4495.

  • New agc_driver_stencil_known_replace fills the stencil with a value, draws with one of the cases below, and then probes the stencil with an EQUAL draw that must cover exactly the filled pixels:
    • EQUAL 0xff, REPLACE_OP 0x40 on pass, then on pass and depth fail → 0x40;
    • EQUAL 0x25, ONES → 0xff;
    • EQUAL 0xff, REPLACE_OP 0x40 through write mask 0xf0 → 0x4f;
    • NOTEQUAL 0xff and GREATER 0xff, REPLACE_OP 0x40 on fail → 0x40, with no color written;
    • LEQUAL 0xff, REPLACE_OP 0x40 → 0x40.
    • On main with the new and changed tests, both fail: agc_driver_stencil_known_replace on stencil replacement 0x40 against test value 0xff, agc_driver_graphics on 0x05 against test value 0x02.
    • With the fix, both pass 3 of 3 on NVIDIA and once on lavapipe (llvmpipe, LLVM 20.1.2).
  • agc_driver_graphics: the decode case that expected the stencil replacement failure (EQUAL 2, REPLACE_OP 5) now expects INVERT with write mask 7 and reference 2. New decode cases cover depth fail, NOTEQUAL, LEQUAL and GREATER. The refusals that remain are checked: NOTEQUAL on pass, LESS on pass, a write mask wider than the compare mask, LEQUAL against 0x7f, and a ZERO beside the inversion.
  • The 29 tests matching stencil|depth|^agc_driver_graphics$|htile pass.
  • macOS: @jotitadev ran it on an Apple M2 Max under MoltenVK 1.4.2 and MoltenVK main + SPIRV-Cross #2704 (x86-64 build under Rosetta, on their macOS build stack). agc_driver_stencil_known_replace runs there (no skip) and, like agc_driver_graphics, passes 3 of 3 on both drivers. With this PR's State.cpp hunks reverted, both fail with the refusals above. The rest of their ^agc suite is unchanged.
  • Windows: @xXPBSXx ran it merged onto main 676d42396 with #7726 (MinGW-w64, WinLibs): agc_driver_stencil_known_replace passes 3 of 3, and fails 3 of 3 with main's State.cpp.
  • AMD, Windows: @thuanquang ran it on an RX 6700 XT (RDNA 2), with this head merged onto main 7f596df48. Without this PR, agc_driver_stencil_known_replace fails 3 of 3 on the 0x40 against test value 0xff refusal. With it, the test passes 3 of 3, and so does agc_driver_graphics. The other stencil tests pass except agc_driver_stencil_replay_no_gpl, which fails the same way without this PR (the GPL cache-order effect #6436 targets).
  • Intel and AMD, Windows: @savvaniss ran it on an Intel UHD 770 and an AMD RX 9070 XT, merged into main 6b8228b2b. The 22 tests built from the two test files pass 3 of 3. With only this PR's test changes, agc_driver_graphics and agc_driver_stencil_known_replace fail with the two refusals above.
  • Ghost of Tsushima (PPSA02225), together with #7726, the PlayGo fix it needs to get that far: without this PR it stops at the splash screen on stencil replacement 0x40 against test value 0xff (masks 0xff/0xff), in 2 of 2 runs (23 s and 47 s in). A logging build showed the face: compare 2 (EQUAL), operations 0x040 (REPLACE_OP on pass). With this PR it draws past it and stops 41 s in at an unrelated check: a one-sample depth target under a 2x rasterizer with PS_ITER_SAMPLE.
    • Windows: @xXPBSXx ran the title on an RTX 4080 SUPER (Windows 10, WinLibs GCC 15.2.0), one 300 s run each, with this head merged into main 50efb5c405. On main it aborts on the same stencil replacement 0x40 against test value 0xff refusal. With this PR it gets past it and stops on the one-sample-depth refusal that #7729 handles.
  • Khronos validation, as CONTRIBUTING.md asks: Ubuntu's 1.3.275 layer loaded with VK_LAYER_PATH, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest -V, RTX 4070 Ti, Linux. Neither log reports was not found but was requested by env var VK_INSTANCE_LAYERS. ^agc_driver_graphics$|stencil_known_replace on main 8a526d4495 and this PR: agc_driver_graphics gives no validation messages on either. The new agc_driver_stencil_known_replace reports only VUID-VkDeviceCreateInfo-pNext-pNext (newer device extensions) and VUID-VkGraphicsPipelineCreateInfo-pLibraries-06681. This older layer reports both for every device-creating test on main too: 15 and 141 times over main's tessellation and journal tests, for example.
  • The same comparison under the LunarG SDK's 1.4.363 layer, the version Windows reviewers run: no validation messages on main 8a526d4495 or with this PR. The 1.4.363 layer doesn't report the old layer's pNext-pNext and pLibraries-06681.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: PPSA02225 (Ghost of Tsushima, together with #7726), #5166
  • GPUs tested: NVIDIA RTX 4070 Ti (Linux); Apple M2 Max, MoltenVK (@jotitadev); AMD RX 6700 XT, Windows 11 (@thuanquang); Intel UHD 770 and AMD RX 9070 XT, Windows 11 (@savvaniss)
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4915257492 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7725). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-19T03:11:06Z. --- ### What `DB_STENCILREFMASK` holds a test value (`STENCILTESTVAL`) and a separate operation value (`STENCILOPVAL`). `REPLACE_OP`, `ONES` and `REPLACE_TEST` write a value that can differ from the test value on bits the compare reads, while Vulkan has one reference for both. Such a face threw `stencil replacement ... is unsupported`. Ghost of Tsushima (PPSA02225) stops on one at its splash screen: an `EQUAL` test against 0xff whose pass operation is `REPLACE_OP` with 0x40, both masks 0xff. Some compares fix the stencil value wherever an operation runs: - on pass and depth fail: `EQUAL`, `LEQUAL` against the largest masked value, `GEQUAL` against 0; - on fail: `NOTEQUAL`, `LESS` against 0, `GREATER` against the largest masked value. There, if every written bit is also compared, the written bits hold the test value, so writing `value` is the same as inverting the bits where it differs from the test value. The face becomes an `INVERT` whose write mask is `(test ^ value) & writeMask`, and its reference stays the test value for the compare. - The operations of a face share its write mask, so this only applies when every operation that isn't `KEEP` becomes the same inversion (for example `REPLACE_OP` on both pass and depth fail). Any other combination still throws, now with its own message. - A replacement that agrees with the test value on the compared bits takes the existing path (one reference) as before. A pixel shader that exports the stencil test value is unchanged. ### Tested Ubuntu 24.04, GCC 13.3, NVIDIA RTX 4070 Ti (595.99.02), on `main` 8a526d4495. - **New `agc_driver_stencil_known_replace`** fills the stencil with a value, draws with one of the cases below, and then probes the stencil with an `EQUAL` draw that must cover exactly the filled pixels: - `EQUAL` 0xff, `REPLACE_OP` 0x40 on pass, then on pass and depth fail → 0x40; - `EQUAL` 0x25, `ONES` → 0xff; - `EQUAL` 0xff, `REPLACE_OP` 0x40 through write mask 0xf0 → 0x4f; - `NOTEQUAL` 0xff and `GREATER` 0xff, `REPLACE_OP` 0x40 on fail → 0x40, with no color written; - `LEQUAL` 0xff, `REPLACE_OP` 0x40 → 0x40. - On `main` with the new and changed tests, both fail: `agc_driver_stencil_known_replace` on `stencil replacement 0x40 against test value 0xff`, `agc_driver_graphics` on `0x05 against test value 0x02`. - With the fix, both pass 3 of 3 on NVIDIA and once on lavapipe (llvmpipe, LLVM 20.1.2). - **`agc_driver_graphics`**: the decode case that expected the `stencil replacement` failure (`EQUAL` 2, `REPLACE_OP` 5) now expects `INVERT` with write mask 7 and reference 2. New decode cases cover depth fail, `NOTEQUAL`, `LEQUAL` and `GREATER`. The refusals that remain are checked: `NOTEQUAL` on pass, `LESS` on pass, a write mask wider than the compare mask, `LEQUAL` against 0x7f, and a `ZERO` beside the inversion. - The 29 tests matching `stencil|depth|^agc_driver_graphics$|htile` pass. - macOS: @jotitadev [ran it on an Apple M2 Max](https://github.com/boykopovar/AnyPS5/pull/7725#pullrequestreview-5566919046) under MoltenVK 1.4.2 and MoltenVK main + SPIRV-Cross #2704 (x86-64 build under Rosetta, on their macOS build stack). `agc_driver_stencil_known_replace` runs there (no skip) and, like `agc_driver_graphics`, passes 3 of 3 on both drivers. With this PR's `State.cpp` hunks reverted, both fail with the refusals above. The rest of their `^agc` suite is unchanged. - Windows: @xXPBSXx [ran it](https://github.com/boykopovar/AnyPS5/pull/7725#issuecomment-6260352033) merged onto `main` 676d42396 with #7726 (MinGW-w64, WinLibs): `agc_driver_stencil_known_replace` passes 3 of 3, and fails 3 of 3 with `main`'s `State.cpp`. - AMD, Windows: @thuanquang [ran it](https://github.com/boykopovar/AnyPS5/pull/7725#issuecomment-6262651404) on an RX 6700 XT (RDNA 2), with this head merged onto `main` 7f596df48. Without this PR, `agc_driver_stencil_known_replace` fails 3 of 3 on the `0x40 against test value 0xff` refusal. With it, the test passes 3 of 3, and so does `agc_driver_graphics`. The other stencil tests pass except `agc_driver_stencil_replay_no_gpl`, which fails the same way without this PR (the GPL cache-order effect #6436 targets). - Intel and AMD, Windows: @savvaniss [ran it](https://github.com/boykopovar/AnyPS5/pull/7725#issuecomment-6264147023) on an Intel UHD 770 and an AMD RX 9070 XT, merged into `main` 6b8228b2b. The 22 tests built from the two test files pass 3 of 3. With only this PR's test changes, `agc_driver_graphics` and `agc_driver_stencil_known_replace` fail with the two refusals above. - **Ghost of Tsushima (PPSA02225)**, together with #7726, the PlayGo fix it needs to get that far: without this PR it stops at the splash screen on `stencil replacement 0x40 against test value 0xff (masks 0xff/0xff)`, in 2 of 2 runs (23 s and 47 s in). A logging build showed the face: compare 2 (`EQUAL`), operations 0x040 (`REPLACE_OP` on pass). With this PR it draws past it and stops 41 s in at an unrelated check: a one-sample depth target under a 2x rasterizer with `PS_ITER_SAMPLE`. - Windows: @xXPBSXx [ran the title](https://github.com/boykopovar/AnyPS5/pull/7725#issuecomment-6313499489) on an RTX 4080 SUPER (Windows 10, WinLibs GCC 15.2.0), one 300 s run each, with this head merged into `main` 50efb5c405. On `main` it aborts on the same `stencil replacement 0x40 against test value 0xff` refusal. With this PR it gets past it and stops on the one-sample-depth refusal that #7729 handles. - Khronos validation, as CONTRIBUTING.md asks: Ubuntu's 1.3.275 layer loaded with `VK_LAYER_PATH`, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ANYPS5_NO_SHADER_CACHE=1 ANYPS5_REQUIRE_VULKAN=1 ctest -V`, RTX 4070 Ti, Linux. Neither log reports `was not found but was requested by env var VK_INSTANCE_LAYERS`. `^agc_driver_graphics$|stencil_known_replace` on `main` 8a526d4495 and this PR: `agc_driver_graphics` gives no validation messages on either. The new `agc_driver_stencil_known_replace` reports only `VUID-VkDeviceCreateInfo-pNext-pNext` (newer device extensions) and `VUID-VkGraphicsPipelineCreateInfo-pLibraries-06681`. This older layer reports both for every device-creating test on `main` too: 15 and 141 times over `main`'s tessellation and journal tests, for example. - The same comparison under the LunarG SDK's 1.4.363 layer, the version Windows reviewers run: no validation messages on `main` 8a526d4495 or with this PR. The 1.4.363 layer doesn't report the old layer's `pNext-pNext` and `pLibraries-06681`. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: PPSA02225 (Ghost of Tsushima, together with #7726), #5166 - [x] GPUs tested: NVIDIA RTX 4070 Ti (Linux); Apple M2 Max, MoltenVK (@jotitadev); AMD RX 6700 XT, Windows 11 (@thuanquang); Intel UHD 770 and AMD RX 9070 XT, Windows 11 (@savvaniss) - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-19 03:28:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T03:28:47Z.


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 1191 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 1395 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 4040 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5441 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5499 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5925 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6188 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 6194 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6235 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6280 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6481 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6548 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6808 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6977 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 7256 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 8105 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 8395 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 8564 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 9020 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6259013559 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7725#issuecomment-6259013559). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-19T03:28:47Z. --- <!-- pr-overlap --> 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 1191](https://www.github.com/boykopovar/AnyPS5/pull/1191) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` | | [PR 1395](https://www.github.com/boykopovar/AnyPS5/pull/1395) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 4040](https://www.github.com/boykopovar/AnyPS5/pull/4040) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 5441](https://www.github.com/boykopovar/AnyPS5/pull/5441) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 5499](https://www.github.com/boykopovar/AnyPS5/pull/5499) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 5925](https://www.github.com/boykopovar/AnyPS5/pull/5925) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6188](https://www.github.com/boykopovar/AnyPS5/pull/6188) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` | | [PR 6194](https://www.github.com/boykopovar/AnyPS5/pull/6194) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6235](https://www.github.com/boykopovar/AnyPS5/pull/6235) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6280](https://www.github.com/boykopovar/AnyPS5/pull/6280) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6481](https://www.github.com/boykopovar/AnyPS5/pull/6481) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6548](https://www.github.com/boykopovar/AnyPS5/pull/6548) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6808](https://www.github.com/boykopovar/AnyPS5/pull/6808) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6977](https://www.github.com/boykopovar/AnyPS5/pull/6977) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` | | [PR 7256](https://www.github.com/boykopovar/AnyPS5/pull/7256) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 8105](https://www.github.com/boykopovar/AnyPS5/pull/8105) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 8395](https://www.github.com/boykopovar/AnyPS5/pull/8395) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 8564](https://www.github.com/boykopovar/AnyPS5/pull/8564) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 9020](https://www.github.com/boykopovar/AnyPS5/pull/9020) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` |
jotitadev commented 2026-10-19 04:28:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-19T04:28:29Z.

Review: COMMENTED


Apple GPU / MoltenVK run. agc_driver_stencil_known_replace runs on Metal (no skip) and passes. It fails without the fix with the refusal from the description. The full ^agc suite is unchanged.

Machine: Apple M2 Max, macOS 27.2, x86-64 build under Rosetta. Head c9fe9292d, PR diff applied cleanly. Drivers: MoltenVK 1.4.2 (Vulkan SDK 1.4.363.0) and MoltenVK main + SPIRV-Cross #2704.

Tested: the tree is main a373e85e5 + mugurc's macOS series (ci/macos-series-2) + the PRs needed to build on macOS (#6667, #6668, #7524, #6969, and two files of #7332), not plain main (it doesn't build on macOS yet). Also in the same build: #7725, #7729, #7717, #7694, #7682, #7731 and #6815 (they applied cleanly together), plus a test-only patch that lets nine AGC fixtures load the Vulkan loader on macOS (branch jotitadev:fix/agc-tests-vulkan-loader-macos). Base on that tree: 40 ^agc failures with MoltenVK 1.4.2 and 26 with MoltenVK main + #2704.

  • agc_driver_stencil_known_replace (stencil replacements with a known stencil value passed) and agc_driver_graphics pass 3 of 3 on both drivers, as do the other stencil, depth and htile tests in the tree. Two multisample tests fail the same way as on the base.
  • With this PR's hunks of State.cpp reverted, both tests fail on both drivers. agc_driver_stencil_known_replace fails with stencil replacement 0x40 against test value 0xff (masks 0xff/0xff) is unsupported, and agc_driver_graphics with 0x05 against test value 0x02.
  • Full ^agc suite with the stack: the base failures on each driver, plus agc_driver_pooled_buffer_range and agc_performance_overlay, which only run because of the loader patch. Nothing from this PR.

GPUs tested: Apple M2 Max (MoltenVK 1.4.2; MoltenVK main + SPIRV-Cross #2704)

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5566919046 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7725#pullrequestreview-5566919046). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-19T04:28:29Z. **Review:** COMMENTED --- <!-- head: c9fe9292d --> Apple GPU / MoltenVK run. `agc_driver_stencil_known_replace` runs on Metal (no skip) and passes. It fails without the fix with the refusal from the description. The full `^agc` suite is unchanged. Machine: Apple M2 Max, macOS 27.2, x86-64 build under Rosetta. Head c9fe9292d, PR diff applied cleanly. Drivers: MoltenVK 1.4.2 (Vulkan SDK 1.4.363.0) and MoltenVK main + SPIRV-Cross #2704. **Tested:** the tree is `main` a373e85e5 + mugurc's macOS series (`ci/macos-series-2`) + the PRs needed to build on macOS (#6667, #6668, #7524, #6969, and two files of #7332), not plain `main` (it doesn't build on macOS yet). Also in the same build: #7725, #7729, #7717, #7694, #7682, #7731 and #6815 (they applied cleanly together), plus a test-only patch that lets nine AGC fixtures load the Vulkan loader on macOS (branch `jotitadev:fix/agc-tests-vulkan-loader-macos`). Base on that tree: 40 `^agc` failures with MoltenVK 1.4.2 and 26 with MoltenVK main + #2704. - `agc_driver_stencil_known_replace` (`stencil replacements with a known stencil value passed`) and `agc_driver_graphics` pass 3 of 3 on both drivers, as do the other `stencil`, `depth` and `htile` tests in the tree. Two `multisample` tests fail the same way as on the base. - With this PR's hunks of `State.cpp` reverted, both tests fail on both drivers. `agc_driver_stencil_known_replace` fails with `stencil replacement 0x40 against test value 0xff (masks 0xff/0xff) is unsupported`, and `agc_driver_graphics` with `0x05 against test value 0x02`. - Full `^agc` suite with the stack: the base failures on each driver, plus `agc_driver_pooled_buffer_range` and `agc_performance_overlay`, which only run because of the loader patch. Nothing from this PR. GPUs tested: Apple M2 Max (MoltenVK 1.4.2; MoltenVK main + SPIRV-Cross #2704) Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
xXPBSXx commented 2026-10-19 05:27:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-19T05:27:13Z.


Windows data point for c9fe9292d (this PR) merged onto main 676d42396 together with #7726 (42f4382bc) in one tree (f58459c78, both merges clean, git status empty): Windows 10 (10.0.19045), MinGW-w64 (WinLibs) toolchain, ctest -R '^agc_driver_stencil_known_replace$', one fresh process per run.

  • With the PR: passes 3 of 3.
  • Same tree with Graphics/src/State.cpp restored to main (git checkout upstream/main -- core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp, the new test kept; #7729 is not in this tree): fails 3 of 3 (exit code 8) with AGC graphics: stencil replacement 0x40 against test value 0xff (masks 0xff/0xff) is unsupported.

Not tested: a title run, other GPUs, Linux.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6260352033 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7725#issuecomment-6260352033). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-19T05:27:13Z. --- Windows data point for `c9fe9292d` (this PR) merged onto `main` `676d42396` together with #7726 (`42f4382bc`) in one tree (`f58459c78`, both merges clean, `git status` empty): Windows 10 (10.0.19045), MinGW-w64 (WinLibs) toolchain, `ctest -R '^agc_driver_stencil_known_replace$'`, one fresh process per run. - With the PR: passes 3 of 3. - Same tree with `Graphics/src/State.cpp` restored to `main` (`git checkout upstream/main -- core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`, the new test kept; #7729 is not in this tree): fails 3 of 3 (exit code 8) with `AGC graphics: stencil replacement 0x40 against test value 0xff (masks 0xff/0xff) is unsupported`. Not tested: a title run, other GPUs, Linux. AI-assisted (Claude Code).
milescoviello commented 2026-10-19 06:05:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-19T06:05:29Z.


@jotitadev @xXPBSXx thank you both. jotitadev's MoltenVK runs on two drivers show the new test runs on Metal and catches the change there. xXPBSXx's Windows run, with the reverted State.cpp control, covers the MinGW build. Both are in the description now.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6260812292 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7725#issuecomment-6260812292). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-19T06:05:29Z. --- @jotitadev @xXPBSXx thank you both. jotitadev's MoltenVK runs on two drivers show the new test runs on Metal and catches the change there. xXPBSXx's Windows run, with the reverted `State.cpp` control, covers the MinGW build. Both are in the description now. AI-assisted: yes (Claude Code)
thuanquang commented 2026-10-19 08:08:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by thuanquang on 2026-10-19T08:08:14Z.


An AMD run: RX 6700 XT (gfx1031, RDNA 2), AMD driver 32.0.21045.5002, Windows 11 26200, WinLibs GCC 15.2.0 r7, Release. Base main 7f596df48 (with #7074 merged, which touches only f16 fma translation), then this PR's head c9fe9292d merged on top (clean).

  • Without this PR, the new agc_driver_stencil_known_replace fails 3 of 3: stencil replacement 0x40 against test value 0xff (masks 0xff/0xff) is unsupported.
  • With it, it passes 3 of 3 run directly and 3 of 3 under ctest, and agc_driver_graphics passes 3 of 3.
  • The other stencil tests pass (agc_driver_sample_mask_depth_stencil, agc_driver_stencil_null_feedback, agc_driver_stencil_ref_export, agc_driver_stencil_ref_export_unused, agc_driver_stencil_replay), except agc_driver_stencil_replay_no_gpl. That one isn't this PR: it is the GPL cache-order effect of #4768 on AMD's Windows driver. From a fresh driver cache (a renamed copy of the executable), whichever GPL mode runs first passes and the other mode then fails with vkQueueSubmit recorder: Vulkan result -4, and it does exactly the same without this PR (on main 7f596df48 with only #7769, a storage-flush fix, merged). #6436 targets that.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6262651404 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7725#issuecomment-6262651404). Originally posted by [thuanquang](https://github.com/thuanquang) on 2026-10-19T08:08:14Z. --- An AMD run: RX 6700 XT (gfx1031, RDNA 2), AMD driver 32.0.21045.5002, Windows 11 26200, WinLibs GCC 15.2.0 r7, Release. Base `main` `7f596df48` (with #7074 merged, which touches only f16 fma translation), then this PR's head `c9fe9292d` merged on top (clean). - **Without this PR**, the new `agc_driver_stencil_known_replace` fails 3 of 3: `stencil replacement 0x40 against test value 0xff (masks 0xff/0xff) is unsupported`. - **With it**, it passes 3 of 3 run directly and 3 of 3 under ctest, and `agc_driver_graphics` passes 3 of 3. - The other stencil tests pass (`agc_driver_sample_mask_depth_stencil`, `agc_driver_stencil_null_feedback`, `agc_driver_stencil_ref_export`, `agc_driver_stencil_ref_export_unused`, `agc_driver_stencil_replay`), except `agc_driver_stencil_replay_no_gpl`. That one isn't this PR: it is the GPL cache-order effect of #4768 on AMD's Windows driver. From a fresh driver cache (a renamed copy of the executable), whichever GPL mode runs first passes and the other mode then fails with `vkQueueSubmit recorder: Vulkan result -4`, and it does exactly the same without this PR (on `main` `7f596df48` with only #7769, a storage-flush fix, merged). #6436 targets that.
savvaniss commented 2026-10-19 09:33:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by savvaniss on 2026-10-19T09:33:54Z.


Intel and AMD Windows data: with this PR's test changes, agc_driver_graphics and the new agc_driver_stencil_known_replace fail on main and pass with the PR, on an Intel UHD 770 and an AMD RX 9070 XT.

Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built, ANYPS5_NO_SHADER_CACHE=1, serial CTest. Intel UHD Graphics 770 (8086:a780), driver 32.0.101.7088. AMD Radeon RX 9070 XT (1002:7550), driver 32.0.31041.1004, with VkCache emptied first. This head c9fe9292d merged into main 6b8228b2b. "Without" means only this PR's diff to tests/Graphics.cpp and the new tests/execution/StencilKnownReplace.cpp, applied to main 6b8228b2b.

Tests, ×3 UHD 770 RX 9070 XT
This head: the 22 tests built from those two files 22 of 22 pass 22 of 22 pass
Without agc_driver_graphics fails: stencil replacement 0x05 against test value 0x02 (masks 0xff/0xff) is unsupported; agc_driver_stencil_known_replace fails: stencil replacement 0x40 against test value 0xff (masks 0xff/0xff) is unsupported; the other 20 pass same

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6264147023 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7725#issuecomment-6264147023). Originally posted by [savvaniss](https://github.com/savvaniss) on 2026-10-19T09:33:54Z. --- Intel and AMD Windows data: with this PR's test changes, `agc_driver_graphics` and the new `agc_driver_stencil_known_replace` fail on `main` and pass with the PR, on an Intel UHD 770 and an AMD RX 9070 XT. Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built, `ANYPS5_NO_SHADER_CACHE=1`, serial CTest. Intel UHD Graphics 770 (`8086:a780`), driver 32.0.101.7088. AMD Radeon RX 9070 XT (`1002:7550`), driver 32.0.31041.1004, with `VkCache` emptied first. This head `c9fe9292d` merged into `main` `6b8228b2b`. "Without" means only this PR's diff to `tests/Graphics.cpp` and the new `tests/execution/StencilKnownReplace.cpp`, applied to `main` `6b8228b2b`. | Tests, ×3 | UHD 770 | RX 9070 XT | |---|---|---| | This head: the 22 tests built from those two files | 22 of 22 pass | 22 of 22 pass | | Without | `agc_driver_graphics` fails: `stencil replacement 0x05 against test value 0x02 (masks 0xff/0xff) is unsupported`; `agc_driver_stencil_known_replace` fails: `stencil replacement 0x40 against test value 0xff (masks 0xff/0xff) is unsupported`; the other 20 pass | same | AI-assisted: yes (Claude Code)
milescoviello commented 2026-10-19 11:27:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-19T11:27:11Z.


@thuanquang @savvaniss thank you both, the runs are in the description now. They cover RDNA 2, RDNA 4 and Intel on Windows, each failing without the fix and passing with it. Thanks also, thuanquang, for checking agc_driver_stencil_replay_no_gpl separately: it fails the same way without this PR, so that's #6436's cache-order issue and not this change.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6266120454 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7725#issuecomment-6266120454). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-19T11:27:11Z. --- @thuanquang @savvaniss thank you both, the runs are in the description now. They cover RDNA 2, RDNA 4 and Intel on Windows, each failing without the fix and passing with it. Thanks also, thuanquang, for checking `agc_driver_stencil_replay_no_gpl` separately: it fails the same way without this PR, so that's #6436's cache-order issue and not this change. AI-assisted: yes (Claude Code)
oneandonlydean commented 2026-10-20 18:49:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T18:49:51Z.


Picking this up for our testing: it addresses the stop we see in PPSA03208 on current main, one of the titles we're bringing up, and we'd like to move it into main. We'll review, test and merge it under the normal process. Your comments and review are still very welcome, @adriadam10.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6298602711 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7725#issuecomment-6298602711). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-20T18:49:51Z. --- Picking this up for our testing: it addresses the stop we see in PPSA03208 on current main, one of the titles we're bringing up, and we'd like to move it into main. We'll review, test and merge it under the normal process. Your comments and review are still very welcome, @adriadam10.
milescoviello commented 2026-10-20 19:02:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-20T19:02:35Z.


Thanks @oneandonlydean. It merges cleanly with current main, so I'll leave the branch alone while you test it, unless you'd like a rebase or a change.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6298861726 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7725#issuecomment-6298861726). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-20T19:02:35Z. --- Thanks @oneandonlydean. It merges cleanly with current `main`, so I'll leave the branch alone while you test it, unless you'd like a rebase or a change. AI-assisted: yes (Claude Code)
xXPBSXx commented 2026-10-21 10:13:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-21T10:13:49Z.


Title data point for this PR (data only).

Title: PPSA02225, 300 s per run through the runner, ANYPS5_GPU=4080; both .out logs show Selected GPU name=NVIDIA GeForce RTX 4080 SUPER vendor=0x10de device=0x2702 subgroup=32. Windows 10 Pro 10.0.19045, WinLibs GCC 15.2.0, Release, the relinker and all libs built from the same tree.

Baseline, main 50efb5c405 (run_120636.err):

[gpu] driver failure: AGC graphics: stencil replacement 0x40 against test value 0xff (masks 0xff/0xff) is unsupported

then FATAL: abort() (SIGABRT) (lines 234-238).

This PR (c9fe9292d8) merged into the same main (run_115819.err): the stencil stop does not occur. The run stops about the same place in the log on a different refusal:

what():  AGC graphics: a one-sample depth target under a multisampled rasterizer without MSAA_ENABLE is unsupported for points or lines and with alpha-to-coverage, PS_ITER_SAMPLE, a sample index or coverage input, a sample-mask export, or DB_EQAA Z interpolation or overrasterization

(lines 240-242). That is the area of #7729, #8115 and #8121, not of this PR.

One run each, so this shows that the draw gets past the stencil check with the PR, not that the title is fixed. I did not look at the picture, and I did not run the PR's tests on this machine.

Not run: other GPUs for this title, the PR's tests, other titles, the console.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6313499489 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7725#issuecomment-6313499489). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-21T10:13:49Z. --- Title data point for this PR (data only). **Title:** PPSA02225, 300 s per run through the runner, `ANYPS5_GPU=4080`; both `.out` logs show `Selected GPU name=NVIDIA GeForce RTX 4080 SUPER vendor=0x10de device=0x2702 subgroup=32`. Windows 10 Pro 10.0.19045, WinLibs GCC 15.2.0, Release, the relinker and all libs built from the same tree. **Baseline, `main` `50efb5c405`** (run_120636.err): ``` [gpu] driver failure: AGC graphics: stencil replacement 0x40 against test value 0xff (masks 0xff/0xff) is unsupported ``` then `FATAL: abort() (SIGABRT)` (lines 234-238). **This PR (`c9fe9292d8`) merged into the same `main`** (run_115819.err): the stencil stop does not occur. The run stops about the same place in the log on a different refusal: ``` what(): AGC graphics: a one-sample depth target under a multisampled rasterizer without MSAA_ENABLE is unsupported for points or lines and with alpha-to-coverage, PS_ITER_SAMPLE, a sample index or coverage input, a sample-mask export, or DB_EQAA Z interpolation or overrasterization ``` (lines 240-242). That is the area of #7729, #8115 and #8121, not of this PR. One run each, so this shows that the draw gets past the stencil check with the PR, not that the title is fixed. I did not look at the picture, and I did not run the PR's tests on this machine. **Not run:** other GPUs for this title, the PR's tests, other titles, the console. AI-assisted (Claude Code).
milescoviello commented 2026-10-21 10:21:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-21T10:21:04Z.


Thanks @xXPBSXx, that's the first Windows run of the title with this PR. It matches what I see on Linux. On main it aborts on the 0x40 against test value 0xff stencil refusal. With this PR it gets past it and stops on the one-sample depth target under a multisampled rasterizer, which in Ghost of Tsushima is a PS_ITER_SAMPLE depth-only pass.

That next stop is what #7729 handles. On Linux, with #7726, this PR and #7729, the title draws past both of those draws and stops later, at an unrelated check (it's in #7729's description). I added your run to the Tested section.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6313628738 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7725#issuecomment-6313628738). Originally posted by [milescoviello](https://github.com/milescoviello) on 2026-10-21T10:21:04Z. --- Thanks @xXPBSXx, that's the first Windows run of the title with this PR. It matches what I see on Linux. On `main` it aborts on the `0x40 against test value 0xff` stencil refusal. With this PR it gets past it and stops on the one-sample depth target under a multisampled rasterizer, which in Ghost of Tsushima is a `PS_ITER_SAMPLE` depth-only pass. That next stop is what #7729 handles. On Linux, with #7726, this PR and #7729, the title draws past both of those draws and stops later, at an unrelated check (it's in #7729's description). I added your run to the Tested section. AI-assisted: yes (Claude Code)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!7725
No description provided.