feat(agc): export stencil operation values through an attachment #10351

Open
Ondra97 wants to merge 15 commits from upstream-pr/10351 into main
Ondra97 commented 2026-10-23 18:51:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-10-23T18:51:01Z.


What

The November 20 sync merges main ee764ca7fd02d39182777f1abbaac3b9388efaa4. Shader cache format 106 preserves main's dispatchThreadLimit and splitStateLanes fields together with this PR's stencilAttachmentExport. Format 105 is already in use by #7085. The round-trip fixture uses non-default values for the split-dispatch fields and the attachment flag and checks that entries from main's format 95 and the branch's previous format 104 are rejected.

On a host without native stencil export, a pixel shader's operation value may be unsafe to replay. The bounded full-byte replace fallback copies stencil into an R8_UINT attachment at unused color location 7, draws once after late tests, then copies it back while retaining the depth owner. Native export and bounded reference replay remain supported; unsupported masks, tests, stages, layers, samples, attachment collisions and non-COPY color ROPs throw.

The branch retains main's expanded Draw signature and DrawResourceContentKey, its recording interface and resource-content keys, and the fallback's expanded stencil/blend state and exclusions from recipe, shape and pass-attachment memoization.

The latest review fix, 5cf6fcc26bd19bf5360cfaa47fe4e12be4cc8c93, addresses review 5936706796. A color logic operation is enabled for the whole pipeline, so it would also transform the temporary R8_UINT stencil output before copy-back. ValidateStencilAttachment now refuses every operation except COPY, using the existing LogicOpFromRop conversion. Both supported COPY encodings remain accepted. The debt fragment lists the non-COPY refusal.

The November 17 shader-cache layout retained main's format-88 fields, including DescriptorBinding::imageUintStorage, and this PR's stencilAttachmentExport. It used format 103. The pinned inventory covers 1,652 open PR heads with no missing cache header, finds versions through 102 and no other format-103 user. The round-trip regression rejects formats 69, 85, 88 and 91. Future compositions need a distinct version after preserving both layouts.

Main requires and enables independentBlend; #6782 and #10940 are merged. There is no open implementation prerequisite. #11551 still declares the agreed #10351 -> #11551 order. Merged #18530 changes the replay lane-set proof and replay-only late store; #19966 changes the native stencil output type. Neither implements this attachment fallback. A later composition must retain SelectStencilExportMode, consistently gate replay-only stores and preserve the native/replay/attachment output types and cache fields. Those peer compositions are not tested here.

The November 19 sync integrates main b68affac18ca39391a3800d5cb51735d085c014d. The shared export selector keeps #18530's fixed-lane replay eligibility, and the emitter allocates the late store only on the replay path when the original lane-set proof requires it. The attachment fixture now includes an s_ttracedata instruction. The replay proof rejects that trace side effect without changing the deterministic stencil value, so all four attachment cases exercise the attachment path on devices that support the new replay mode.

The November 19 merge used shader cache format 104. It keeps the current main layout and stencilAttachmentExport. The snapshot of 2,017 open PR heads contains no format 104 and no missing cache header. The cache regression round-trips the attachment field and rejects main format 90 and the previous branch format 103, along with the existing historical versions.

Tested

November 20 Windows Release validation used main ee764ca7fd02d39182777f1abbaac3b9388efaa4 and PR head 2921b4482e8754dc05e57d7580b1ed4f871a3de1. The PR built the production relinker and libs targets. Both revisions built and ran the focused AGC and shader disk cache tests on Windows 11 Pro 10.0.26300 with WinLibs GCC 15.2, a Ryzen 9 7900X, 31.66 GiB RAM, and an NVIDIA GeForce RTX 4070 Ti SUPER (driver 621.24).

Main passed 21 CTests and skipped one. The PR passed 25, including all four stencil attachment cases, and skipped two. The updated selection also covers agc_driver_split_table_call_run and agc_driver_stencil_replay_unsuppressed on both revisions. The static-color-mask and pass-attachment-memo runs each passed five and skipped one. Native stencil export skipped on this GPU, and the device-level refusal for disabled independentBlend skipped because the feature is enabled. The synthetic refusal ran in the graphics tests. Each device creation selected the same GPU and inserted Khronos validation 1.4.335. No VUID, missing validation layer, or synchronization hazard was logged. Conventions, whitespace, and the main-sync check passed.

November 19 Windows Release validation used main b68affac18ca39391a3800d5cb51735d085c014d and PR head 3d9e208f9ca0a2819b574bd79b6c4dd8830c4795. Both full runtime builds passed with the same WinLibs 15.2 toolchain and RTX 4070 Ti SUPER, driver 621.24, on Windows 11 Pro 10.0.26300. Main passed 19 CTests and skipped one. The PR passed 23 and skipped two. The static-color-mask and pass-attachment-memo controls each passed five and skipped one.

All four attachment cases executed. The native stencil-export case skipped on both revisions because this GPU lacks the native extension. The missing-independentBlend control skipped on the PR GPU run because the feature is enabled. The host-only push-budget case still exercised the synthetic refusal. Each device-creating test confirmed the GPU and inserted Khronos validation 1.4.335. No VUID, validation error, missing-layer or synchronization hazard was logged. The only validation notices concerned the deprecated environment setting for enabling synchronization validation.

At the publication check, main 907fe8fd315c5bdc001a043541be52675e2de9fb merged cleanly with this head. Its intervening changes concern libSceJsc and an export-gap tool test. The validation above covers the exact built revisions. Earlier reports below retain their original revisions.

November 17, 2026 (Europe/Prague): the production runtime and all candidate test configurations below were rebuilt and rerun on exact head 5cf6fcc26bd19bf5360cfaa47fe4e12be4cc8c93.

The unchanged main baseline 0e925c3970dfef049da3cf75be171c4bb5e4a1f6 was built and tested earlier today in this same environment; its results are reused below. No AGC or shader-recompiler source changes landed between that baseline and the refreshed main cb28e72762dad4d5b5448f30c5a7ebad3d0af56c used for the clean merge preview.

Windows 11 Pro 10.0.26300; AMD Ryzen 9 7900X, 31.66 GiB RAM; NVIDIA GeForce RTX 4070 Ti SUPER, driver 621.24. WinLibs GCC 15.2.0 r7 UCRT, CMake 4.3.1, Python 3.14.7. Both arms use separate full-runtime build directories, rebuilt incrementally on their exact revisions, Release, BUILD_TESTING=ON, ANYPS5_ENABLE_SPIRV_TOOLS=ON. Production relinker, all libraries and eleven focused fixture targets build, with at most three compiler jobs. Tests run serially after compilation finishes.

Arm Passed Skipped Failed Longest test
Main, reused unchanged baseline 19 1 0 11.97 s
Review fix 23 2 0 11.24 s
Review fix, static color masks 5 1 0 1.94 s
Review fix, pass-attachment memo verification 5 1 0 1.85 s

The new state-validator regression was first built with only the test change on parent f4eef7d472252b447265cac236676d0a6b041f58. agc_driver_stencil_ref_export_push_budget failed with expected graphics rejection: refuses a color logic operation, because XOR was admitted. It passes with the guard in this head, both in the focused stencil selection and in agc_driver_graphics. This is a CPU state-validation regression. It checks XOR encodings 0x5a and 0x66, CLEAR and SET refusals, and COPY encodings 0xcc and 0xf0 acceptance, with the device logicOp flag enabled and disabled.

Metric Before (base) After (fix)
Focused stencil state-validator regression Failed: XOR admitted Passed: COPY forms accepted, non-COPY operations refused

All four attachment cases execute in each candidate configuration: varying values, scissor preservation, depth-fail preservation and partial-mask refusal. Native stencil export skips on this GPU. The device-level missing-independentBlend control skips because the feature is enabled; the synthetic disabled-feature refusal and acceptance execute in agc_driver_graphics and its focused stencil selection. Recording, submit-progress, pending-store, layered-vertex, stencil replay and the selected cache round-trip/persistence/pack/long-path/host-stderr checks pass. Every selected test finishes below 30 seconds.

Both arms require Vulkan, disable ordinary application shader caches and load the same explicit Khronos validation 1.4.335, matching the pinned Vulkan headers. The verbose logs show the loader inserting VK_LAYER_KHRONOS_validation and using the RTX 4070 Ti SUPER; there are no missing-layer messages or VUID, SYNC-HAZARD or UNASSIGNED validation IDs. Cache fixtures use isolated caches. The memo-verification control reports no attachment mismatch. Driver caches are uncontrolled; these are correctness checks. No new title, console, other-vendor or Linux-runtime result is claimed.

Conventions and whitespace checks pass. The current-main merge preview is clean: this head is 9 commits ahead and 104 behind the fetched main cb28e72762dad4d5b5448f30c5a7ebad3d0af56c, with merge base 0e925c3970dfef049da3cf75be171c4bb5e4a1f6.

The earlier overlap scan for parent f4eef7d472252b447265cac236676d0a6b041f58 checked 1,652 open heads and exited 2: 31 confirmed peer overlap rows and 97 incomplete comparisons against conflicting branches, excluding this PR's own previous head. The review fix changes only the existing validator, its existing test block and its debt fragment, and adds no exports. The declared #10351 -> #11551 order is retained. No complete clean overlap result or tested peer stack is claimed.

Reproduction with the supported toolchain on PATH, from separate checkouts/build directories for each revision:

cmake -S $source -B $build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DPython3_EXECUTABLE=C:/Python314/python.exe
cmake --build $build --target relinker libs agc_driver_graphics_tests agc_shader_disk_cache_tests agc_driver_color_write_mask_dynamic_tests agc_driver_stencil_ref_export_unused_tests agc_driver_stencil_replay_tests agc_driver_stencil_known_replace_tests agc_driver_stencil_null_feedback_tests agc_driver_stencil_ref_export_tests agc_driver_layered_volume_draw_tests agc_driver_two_device_pending_store_tests agc_driver_submit_progress_tests --parallel 3
$env:ANYPS5_REQUIRE_VULKAN='1'
$env:ANYPS5_NO_SHADER_CACHE='1'
$env:ANYPS5_GPU='NVIDIA GeForce RTX 4070 Ti SUPER'
$env:VK_INSTANCE_LAYERS='VK_LAYER_KHRONOS_validation'
$env:VK_LAYER_PATH='D:/Github/AnyPS5/build_tools/c012-refresh/vulkan-sdk/Bin'
$env:VK_LOADER_DEBUG='layer'
$env:APS5_VERIFY_SHAPE_MEMO='1'
$pattern='^(agc_driver_(graphics|color_write_mask_dynamic|stencil_(known_replace|null_feedback|ref_export(_unused|_push_budget)?|replay(_no_gpl)?|attachment_.*)|two_device_pending_store(_label)?|layered_volume_vertex(_no_gpl)?|submit_progress)|agc_shader_disk_cache(_host_stderr|_long_paths|_pack_ownership)?|agc_submit_progress(_no_timeline)?)$'
ctest --test-dir $build -R $pattern -j 1 -V --no-tests=error
$env:APS5_NO_DYNAMIC_COLOR_WRITE_MASK='1'
ctest --test-dir $build -R '^agc_driver_(color_write_mask_dynamic|stencil_attachment_.*)$' -j 1 -V --no-tests=error
Remove-Item Env:APS5_NO_DYNAMIC_COLOR_WRITE_MASK
$env:APS5_VERIFY_PASS_ATTACHMENTS='1'
ctest --test-dir $build -R '^agc_driver_(color_write_mask_dynamic|stencil_attachment_.*)$' -j 1 -V --no-tests=error

From the candidate checkout: C:/Python314/python.exe tools/check_conventions.py --base origin/main, C:/Python314/python.exe tools/check_main_sync.py --base origin/main, and git diff --check origin/main...HEAD. The earlier overlap report is retained with its pinned scope and limitations above. New hosted full-build CI requires a maintainer to dispatch build.yml with pr=10351; local results are separate from hosted CI.

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: none
  • GPUs tested: NVIDIA GeForce RTX 4070 Ti SUPER, driver 621.24, Windows 11 Pro 10.0.26300; November 20 paired main/candidate GPU runs, static-mask and memo-verification controls
  • AI-assisted: yes

Summary by CodeRabbit

  • New Features
    • Added support for stencil operation-value exports on devices without native stencil export, using a color-attachment fallback when the required graphics features and draw conditions are met.
    • Native stencil export continues to be used when available.
  • Limitations
    • The fallback is unavailable for draws with incompatible stencil, depth, scissor, or attachment settings.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4987748113 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10351). Originally posted by [Ondra97](https://github.com/Ondra97) on 2026-10-23T18:51:01Z. --- ### What The November 20 sync merges main `ee764ca7fd02d39182777f1abbaac3b9388efaa4`. Shader cache format **106** preserves main's `dispatchThreadLimit` and `splitStateLanes` fields together with this PR's `stencilAttachmentExport`. Format 105 is already in use by #7085. The round-trip fixture uses non-default values for the split-dispatch fields and the attachment flag and checks that entries from main's format 95 and the branch's previous format 104 are rejected. On a host without native stencil export, a pixel shader's operation value may be unsafe to replay. The bounded full-byte replace fallback copies stencil into an R8_UINT attachment at unused color location 7, draws once after late tests, then copies it back while retaining the depth owner. Native export and bounded reference replay remain supported; unsupported masks, tests, stages, layers, samples, attachment collisions and non-COPY color ROPs throw. The branch retains main's expanded `Draw` signature and `DrawResourceContentKey`, its recording interface and resource-content keys, and the fallback's expanded stencil/blend state and exclusions from recipe, shape and pass-attachment memoization. The latest review fix, `5cf6fcc26bd19bf5360cfaa47fe4e12be4cc8c93`, addresses [review 5936706796](https://github.com/boykopovar/AnyPS5/pull/10351#pullrequestreview-5936706796). A color logic operation is enabled for the whole pipeline, so it would also transform the temporary R8_UINT stencil output before copy-back. `ValidateStencilAttachment` now refuses every operation except COPY, using the existing `LogicOpFromRop` conversion. Both supported COPY encodings remain accepted. The debt fragment lists the non-COPY refusal. The November 17 shader-cache layout retained main's format-88 fields, including `DescriptorBinding::imageUintStorage`, and this PR's `stencilAttachmentExport`. It used format **103**. The pinned inventory covers 1,652 open PR heads with no missing cache header, finds versions through 102 and no other format-103 user. The round-trip regression rejects formats 69, 85, 88 and 91. Future compositions need a distinct version after preserving both layouts. Main requires and enables `independentBlend`; #6782 and #10940 are merged. There is no open implementation prerequisite. #11551 still declares the agreed #10351 -> #11551 order. Merged #18530 changes the replay lane-set proof and replay-only late store; #19966 changes the native stencil output type. Neither implements this attachment fallback. A later composition must retain `SelectStencilExportMode`, consistently gate replay-only stores and preserve the native/replay/attachment output types and cache fields. Those peer compositions are not tested here. The November 19 sync integrates main `b68affac18ca39391a3800d5cb51735d085c014d`. The shared export selector keeps #18530's fixed-lane replay eligibility, and the emitter allocates the late store only on the replay path when the original lane-set proof requires it. The attachment fixture now includes an `s_ttracedata` instruction. The replay proof rejects that trace side effect without changing the deterministic stencil value, so all four attachment cases exercise the attachment path on devices that support the new replay mode. The November 19 merge used shader cache format 104. It keeps the current main layout and `stencilAttachmentExport`. The snapshot of 2,017 open PR heads contains no format 104 and no missing cache header. The cache regression round-trips the attachment field and rejects main format 90 and the previous branch format 103, along with the existing historical versions. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> November 20 Windows Release validation used main `ee764ca7fd02d39182777f1abbaac3b9388efaa4` and PR head `2921b4482e8754dc05e57d7580b1ed4f871a3de1`. The PR built the production `relinker` and `libs` targets. Both revisions built and ran the focused AGC and shader disk cache tests on Windows 11 Pro 10.0.26300 with WinLibs GCC 15.2, a Ryzen 9 7900X, 31.66 GiB RAM, and an NVIDIA GeForce RTX 4070 Ti SUPER (driver 621.24). Main passed 21 CTests and skipped one. The PR passed 25, including all four stencil attachment cases, and skipped two. The updated selection also covers `agc_driver_split_table_call_run` and `agc_driver_stencil_replay_unsuppressed` on both revisions. The static-color-mask and pass-attachment-memo runs each passed five and skipped one. Native stencil export skipped on this GPU, and the device-level refusal for disabled `independentBlend` skipped because the feature is enabled. The synthetic refusal ran in the graphics tests. Each device creation selected the same GPU and inserted Khronos validation 1.4.335. No VUID, missing validation layer, or synchronization hazard was logged. Conventions, whitespace, and the main-sync check passed. November 19 Windows Release validation used main `b68affac18ca39391a3800d5cb51735d085c014d` and PR head `3d9e208f9ca0a2819b574bd79b6c4dd8830c4795`. Both full runtime builds passed with the same WinLibs 15.2 toolchain and RTX 4070 Ti SUPER, driver 621.24, on Windows 11 Pro 10.0.26300. Main passed 19 CTests and skipped one. The PR passed 23 and skipped two. The static-color-mask and pass-attachment-memo controls each passed five and skipped one. All four attachment cases executed. The native stencil-export case skipped on both revisions because this GPU lacks the native extension. The missing-independentBlend control skipped on the PR GPU run because the feature is enabled. The host-only push-budget case still exercised the synthetic refusal. Each device-creating test confirmed the GPU and inserted Khronos validation 1.4.335. No VUID, validation error, missing-layer or synchronization hazard was logged. The only validation notices concerned the deprecated environment setting for enabling synchronization validation. At the publication check, main `907fe8fd315c5bdc001a043541be52675e2de9fb` merged cleanly with this head. Its intervening changes concern libSceJsc and an export-gap tool test. The validation above covers the exact built revisions. Earlier reports below retain their original revisions. November 17, 2026 (Europe/Prague): the production runtime and all candidate test configurations below were rebuilt and rerun on exact head `5cf6fcc26bd19bf5360cfaa47fe4e12be4cc8c93`. The unchanged main baseline `0e925c3970dfef049da3cf75be171c4bb5e4a1f6` was built and tested earlier today in this same environment; its results are reused below. No AGC or shader-recompiler source changes landed between that baseline and the refreshed main `cb28e72762dad4d5b5448f30c5a7ebad3d0af56c` used for the clean merge preview. Windows 11 Pro 10.0.26300; AMD Ryzen 9 7900X, 31.66 GiB RAM; NVIDIA GeForce RTX 4070 Ti SUPER, driver **621.24**. WinLibs GCC 15.2.0 r7 UCRT, CMake 4.3.1, Python 3.14.7. Both arms use separate full-runtime build directories, rebuilt incrementally on their exact revisions, Release, `BUILD_TESTING=ON`, `ANYPS5_ENABLE_SPIRV_TOOLS=ON`. Production relinker, all libraries and eleven focused fixture targets build, with at most three compiler jobs. Tests run serially after compilation finishes. | Arm | Passed | Skipped | Failed | Longest test | | --- | ---: | ---: | ---: | ---: | | Main, reused unchanged baseline | 19 | 1 | 0 | 11.97 s | | Review fix | 23 | 2 | 0 | 11.24 s | | Review fix, static color masks | 5 | 1 | 0 | 1.94 s | | Review fix, pass-attachment memo verification | 5 | 1 | 0 | 1.85 s | The new state-validator regression was first built with only the test change on parent `f4eef7d472252b447265cac236676d0a6b041f58`. `agc_driver_stencil_ref_export_push_budget` failed with `expected graphics rejection: refuses a color logic operation`, because XOR was admitted. It passes with the guard in this head, both in the focused stencil selection and in `agc_driver_graphics`. This is a CPU state-validation regression. It checks XOR encodings `0x5a` and `0x66`, CLEAR and SET refusals, and COPY encodings `0xcc` and `0xf0` acceptance, with the device logicOp flag enabled and disabled. | Metric | Before (base) | After (fix) | | --- | --- | --- | | Focused stencil state-validator regression | Failed: XOR admitted | Passed: COPY forms accepted, non-COPY operations refused | All four attachment cases execute in each candidate configuration: varying values, scissor preservation, depth-fail preservation and partial-mask refusal. Native stencil export skips on this GPU. The device-level missing-independentBlend control skips because the feature is enabled; the synthetic disabled-feature refusal and acceptance execute in `agc_driver_graphics` and its focused stencil selection. Recording, submit-progress, pending-store, layered-vertex, stencil replay and the selected cache round-trip/persistence/pack/long-path/host-stderr checks pass. Every selected test finishes below 30 seconds. Both arms require Vulkan, disable ordinary application shader caches and load the same explicit Khronos validation **1.4.335**, matching the pinned Vulkan headers. The verbose logs show the loader inserting `VK_LAYER_KHRONOS_validation` and using the RTX 4070 Ti SUPER; there are no missing-layer messages or VUID, SYNC-HAZARD or UNASSIGNED validation IDs. Cache fixtures use isolated caches. The memo-verification control reports no attachment mismatch. Driver caches are uncontrolled; these are correctness checks. No new title, console, other-vendor or Linux-runtime result is claimed. Conventions and whitespace checks pass. The current-main merge preview is clean: this head is 9 commits ahead and 104 behind the fetched main `cb28e72762dad4d5b5448f30c5a7ebad3d0af56c`, with merge base `0e925c3970dfef049da3cf75be171c4bb5e4a1f6`. The earlier overlap scan for parent `f4eef7d472252b447265cac236676d0a6b041f58` checked 1,652 open heads and exited 2: 31 confirmed peer overlap rows and 97 incomplete comparisons against conflicting branches, excluding this PR's own previous head. The review fix changes only the existing validator, its existing test block and its debt fragment, and adds no exports. The declared #10351 -> #11551 order is retained. No complete clean overlap result or tested peer stack is claimed. Reproduction with the supported toolchain on `PATH`, from separate checkouts/build directories for each revision: ```powershell cmake -S $source -B $build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DPython3_EXECUTABLE=C:/Python314/python.exe cmake --build $build --target relinker libs agc_driver_graphics_tests agc_shader_disk_cache_tests agc_driver_color_write_mask_dynamic_tests agc_driver_stencil_ref_export_unused_tests agc_driver_stencil_replay_tests agc_driver_stencil_known_replace_tests agc_driver_stencil_null_feedback_tests agc_driver_stencil_ref_export_tests agc_driver_layered_volume_draw_tests agc_driver_two_device_pending_store_tests agc_driver_submit_progress_tests --parallel 3 $env:ANYPS5_REQUIRE_VULKAN='1' $env:ANYPS5_NO_SHADER_CACHE='1' $env:ANYPS5_GPU='NVIDIA GeForce RTX 4070 Ti SUPER' $env:VK_INSTANCE_LAYERS='VK_LAYER_KHRONOS_validation' $env:VK_LAYER_PATH='D:/Github/AnyPS5/build_tools/c012-refresh/vulkan-sdk/Bin' $env:VK_LOADER_DEBUG='layer' $env:APS5_VERIFY_SHAPE_MEMO='1' $pattern='^(agc_driver_(graphics|color_write_mask_dynamic|stencil_(known_replace|null_feedback|ref_export(_unused|_push_budget)?|replay(_no_gpl)?|attachment_.*)|two_device_pending_store(_label)?|layered_volume_vertex(_no_gpl)?|submit_progress)|agc_shader_disk_cache(_host_stderr|_long_paths|_pack_ownership)?|agc_submit_progress(_no_timeline)?)$' ctest --test-dir $build -R $pattern -j 1 -V --no-tests=error $env:APS5_NO_DYNAMIC_COLOR_WRITE_MASK='1' ctest --test-dir $build -R '^agc_driver_(color_write_mask_dynamic|stencil_attachment_.*)$' -j 1 -V --no-tests=error Remove-Item Env:APS5_NO_DYNAMIC_COLOR_WRITE_MASK $env:APS5_VERIFY_PASS_ATTACHMENTS='1' ctest --test-dir $build -R '^agc_driver_(color_write_mask_dynamic|stencil_attachment_.*)$' -j 1 -V --no-tests=error ``` From the candidate checkout: `C:/Python314/python.exe tools/check_conventions.py --base origin/main`, `C:/Python314/python.exe tools/check_main_sync.py --base origin/main`, and `git diff --check origin/main...HEAD`. The earlier overlap report is retained with its pinned scope and limitations above. New hosted full-build CI requires a maintainer to dispatch `build.yml` with `pr=10351`; local results are separate from hosted CI. ### 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) and the licence notice of code adapted from upstream (see AGENTS.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: <!-- #PR, or none --> none - [x] Fixes: <!-- issue it closes as Fixes #N, or none --> none - [x] Unblocks: <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> none - [x] GPUs tested: <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> NVIDIA GeForce RTX 4070 Ti SUPER, driver 621.24, Windows 11 Pro 10.0.26300; November 20 paired main/candidate GPU runs, static-mask and memo-verification controls - [x] AI-assisted: <!-- yes / no --> yes <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Added support for stencil operation-value exports on devices without native stencil export, using a color-attachment fallback when the required graphics features and draw conditions are met. * Native stencil export continues to be used when available. * **Limitations** * The fallback is unavailable for draws with incompatible stencil, depth, scissor, or attachment settings. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
MarcZX10 commented 2026-10-23 19:31:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T19:31:07Z.

Review: APPROVED


Reviewed head 5fb1167da35542c96ed61faa6e1c971c5691798b. The fallback is narrowly gated to the supported full-byte replace case, preserves the pre-draw stencil for uncovered/depth-failed pixels, and rejects partial masks and the documented unsupported state combinations. The added runtime fixtures exercise varying output values, scissor preservation, depth failure, and explicit refusal; reported Windows validation is detailed and includes the dependent independent-blend PR. I did not run the GPU tests locally. I found no blocking issue in the reviewed diff.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5633481334 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10351#pullrequestreview-5633481334). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T19:31:07Z. **Review:** APPROVED --- Reviewed head 5fb1167da35542c96ed61faa6e1c971c5691798b. The fallback is narrowly gated to the supported full-byte replace case, preserves the pre-draw stencil for uncovered/depth-failed pixels, and rejects partial masks and the documented unsupported state combinations. The added runtime fixtures exercise varying output values, scissor preservation, depth failure, and explicit refusal; reported Windows validation is detailed and includes the dependent independent-blend PR. I did not run the GPU tests locally. I found no blocking issue in the reviewed diff.
MarcZX10 commented 2026-10-24 16:47:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T16:47:56Z.

Review: CHANGES_REQUESTED


Blocking Vulkan feature omission in the new attachment fallback: ValidateStencilAttachment accepts the path without checking independentBlend, while VulkanDevice.cpp leaves enabled.independentBlend false. The fallback then sets masked->blends[7].colorWriteMask to VK_COLOR_COMPONENT_R_BIT and submits the full attachment-state array through Pipeline.cpp. This differs from the other attachment states in ordinary draws, so pipeline creation violates Vulkan VUID VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605 when independentBlend is not enabled. The Khronos spec says all pAttachments elements must be identical without that feature: https://registry.khronos.org/VulkanSC/specs/1.0-extensions/man/html/VkPipelineColorBlendStateCreateInfo.html

Please either query and enable independentBlend when supported and reject this fallback on devices where it is unavailable, or restructure the fallback so the color blend attachment states remain identical. Add a validation or regression test for the unsupported-feature case; this path currently has no feature guard. The existing hosted checks are policy/convention checks; graphics build and device execution are skipped for this path, so they do not exercise pipeline creation.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5639020664 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10351#pullrequestreview-5639020664). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T16:47:56Z. **Review:** CHANGES_REQUESTED --- Blocking Vulkan feature omission in the new attachment fallback: `ValidateStencilAttachment` accepts the path without checking `independentBlend`, while `VulkanDevice.cpp` leaves `enabled.independentBlend` false. The fallback then sets `masked->blends[7].colorWriteMask` to `VK_COLOR_COMPONENT_R_BIT` and submits the full attachment-state array through `Pipeline.cpp`. This differs from the other attachment states in ordinary draws, so pipeline creation violates Vulkan VUID `VUID-VkPipelineColorBlendStateCreateInfo-pAttachments-00605` when `independentBlend` is not enabled. The Khronos spec says all `pAttachments` elements must be identical without that feature: https://registry.khronos.org/VulkanSC/specs/1.0-extensions/man/html/VkPipelineColorBlendStateCreateInfo.html Please either query and enable `independentBlend` when supported and reject this fallback on devices where it is unavailable, or restructure the fallback so the color blend attachment states remain identical. Add a validation or regression test for the unsupported-feature case; this path currently has no feature guard. The existing hosted checks are policy/convention checks; graphics build and device execution are skipped for this path, so they do not exercise pipeline creation.
MarcZX10 commented 2026-10-24 22:18:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T22:18:25Z.

Review: APPROVED


Reviewed updated head be104dae9cd53deed979cffe1699c2e111f136e3. The new independentBlend check is wired from the enabled Vulkan device feature into Context and rejects the attachment fallback before pipeline creation when the feature is disabled; the graphics regression covers both rejection and acceptance cases. This addresses the VUID blocking issue from my prior review. The PR reports the focused Windows/Vulkan test set and dependency-composed fallback cases passing with validation enabled and no VUID- lines. I verified conventions against current main, git diff --check, and a strict main-sync preview: the PR is 5 commits behind and 2 ahead, and the merge-tree is clean. The feature-enabling dependency #6782 is still open and current main does not enable independentBlend, so merge this after #6782 and refresh the base as needed. The Demon's Souls run on this head proceeds past stencil export and later reaches a write fault; that is separate evidence and does not change this review.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5640274487 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10351#pullrequestreview-5640274487). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T22:18:25Z. **Review:** APPROVED --- Reviewed updated head `be104dae9cd53deed979cffe1699c2e111f136e3`. The new `independentBlend` check is wired from the enabled Vulkan device feature into `Context` and rejects the attachment fallback before pipeline creation when the feature is disabled; the graphics regression covers both rejection and acceptance cases. This addresses the VUID blocking issue from my prior review. The PR reports the focused Windows/Vulkan test set and dependency-composed fallback cases passing with validation enabled and no `VUID-` lines. I verified conventions against current `main`, `git diff --check`, and a strict main-sync preview: the PR is 5 commits behind and 2 ahead, and the merge-tree is clean. The feature-enabling dependency #6782 is still open and current `main` does not enable `independentBlend`, so merge this after #6782 and refresh the base as needed. The Demon's Souls run on this head proceeds past stencil export and later reaches a write fault; that is separate evidence and does not change this review.
MarcZX10 commented 2026-10-29 09:17:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T09:17:43Z.

Review: CHANGES_REQUESTED


Re-check — changes requested\n\nI read the new Linux NVIDIA report and compared it with the PR's declared dependency and validation record. This run tested on without #6782, while this PR explicitly requires #6782 to enable . All four new tests stop at with the expected refusal; the report therefore does not show the fallback succeeding, but it also does not demonstrate a regression in the declared #6782 → #10351 composition. The PR description's separate RTX 4070 Ti SUPER composition with #6782 reports all four cases passing with validation enabled.\n\nThe PR is still based on , while current upstream main is . Please restack onto current main, preserve the declared #6782 dependency/order, and rerun the focused suite on the exact current-main + #6782 + this-PR composition. Keep the no-#6782 refusal as a negative control, but make the automated run skip/partition that dependency-only case so the branch's required integration test does not report four misleading failures when the prerequisite is absent. The existing integrated test report is author-provided; I did not run the GPU suite locally.\n\nI am not treating the no-dependency run as proof that the fallback is broken. The current-main refresh and exact prerequisite composition are still needed before merge.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5695360539 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10351#pullrequestreview-5695360539). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T09:17:43Z. **Review:** CHANGES_REQUESTED --- ## Re-check — changes requested\n\nI read the new Linux NVIDIA report and compared it with the PR's declared dependency and validation record. This run tested on without #6782, while this PR explicitly requires #6782 to enable . All four new tests stop at with the expected refusal; the report therefore does not show the fallback succeeding, but it also does not demonstrate a regression in the declared #6782 → #10351 composition. The PR description's separate RTX 4070 Ti SUPER composition with #6782 reports all four cases passing with validation enabled.\n\nThe PR is still based on , while current upstream main is . Please restack onto current main, preserve the declared #6782 dependency/order, and rerun the focused suite on the exact current-main + #6782 + this-PR composition. Keep the no-#6782 refusal as a negative control, but make the automated run skip/partition that dependency-only case so the branch's required integration test does not report four misleading failures when the prerequisite is absent. The existing integrated test report is author-provided; I did not run the GPU suite locally.\n\nI am not treating the no-dependency run as proof that the fallback is broken. The current-main refresh and exact prerequisite composition are still needed before merge.
MarcZX10 commented 2026-10-29 09:18:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T09:18:01Z.

Review: CHANGES_REQUESTED


Correction and re-check — changes requested

Formatting in my preceding review stripped several inline identifiers. The intended assessment is:

I read the new Linux NVIDIA report and compared it with the PR's declared dependency and validation record. This run tested head f77e95e on base 52c09d5 without #6782, while this PR explicitly requires #6782 to enable independentBlend. All four new tests stop at ValidateStencilAttachment with the expected “enabled independentBlend” refusal. The report therefore does not show the fallback succeeding, but it also does not demonstrate a regression in the declared #6782 → #10351 composition. The PR description's separate RTX 4070 Ti SUPER composition with #6782 reports all four cases passing with validation enabled.

The PR is still based on 17f8dfad, while current upstream main is aaccd0ba. Please restack onto current main, preserve the declared #6782 dependency/order, and rerun the focused suite on the exact current-main + #6782 + this-PR composition. Keep the no-#6782 refusal as a negative control, but make the automated run skip or partition that dependency-only case so the branch's required integration test does not report four misleading failures when the prerequisite is absent. The existing integrated test report is author-provided; I did not run the GPU suite locally.

I am not treating the no-dependency run as proof that the fallback is broken. The current-main refresh and exact prerequisite composition are still needed before merge.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5695364112 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10351#pullrequestreview-5695364112). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T09:18:01Z. **Review:** CHANGES_REQUESTED --- ## Correction and re-check — changes requested Formatting in my preceding review stripped several inline identifiers. The intended assessment is: I read the new Linux NVIDIA report and compared it with the PR's declared dependency and validation record. This run tested head f77e95e on base 52c09d5 without #6782, while this PR explicitly requires #6782 to enable independentBlend. All four new tests stop at ValidateStencilAttachment with the expected “enabled independentBlend” refusal. The report therefore does not show the fallback succeeding, but it also does not demonstrate a regression in the declared #6782 → #10351 composition. The PR description's separate RTX 4070 Ti SUPER composition with #6782 reports all four cases passing with validation enabled. The PR is still based on 17f8dfad, while current upstream main is aaccd0ba. Please restack onto current main, preserve the declared #6782 dependency/order, and rerun the focused suite on the exact current-main + #6782 + this-PR composition. Keep the no-#6782 refusal as a negative control, but make the automated run skip or partition that dependency-only case so the branch's required integration test does not report four misleading failures when the prerequisite is absent. The existing integrated test report is author-provided; I did not run the GPU suite locally. I am not treating the no-dependency run as proof that the fallback is broken. The current-main refresh and exact prerequisite composition are still needed before merge.
MarcZX10 commented 2026-11-14 08:41:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T08:41:53Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the reviewed implementation and supplied validation support merging.

What I ran

  • Reviewed head 14dc7f17e7156dac19c67033952ea23605c30314 using the prepared review/diff.patch and the pinned repo_read.py reader.
  • No commands or tests were run in this review session; the build and test results below were reported by the author.

Results

Check Result Note
Author reported build passed Both compared revisions built
Author reported selected tests passed No reported failures or validation errors
Independent review checks not run Source and diff inspected

Findings

Blocking

None.

Non-blocking

None.

Not verified

  • I read all changed files listed as included: true in review/manifest.json: Context.hpp, Draw.hpp, Draw.cpp, Pipeline.cpp, ShaderValidation.cpp, Graphics.cpp, ShaderDiskCache.cpp, agc_driver_stencil_ref_export_unused_tests.cmake, StencilRefExportUnused.cpp, Recompiler.cpp, Recompiler.hpp, ShaderDiskCache.hpp, SpirvEmitterState.hpp, SpirvEmitterHelpers.cpp, SpirvModuleEmitter.cpp, StencilReplay.cpp, StencilReplay.hpp, and libSceAgcDriver.md.
  • VulkanDevice.cpp and Graphics.cpp were excluded from the review folder because they were too large; I read the relevant ranges through the reader. No other changed files were excluded.
  • I did not independently run the reported tests, verify the reported CI results, or check console and Linux behavior.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5903227727 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10351#pullrequestreview-5903227727). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-14T08:41:53Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the reviewed implementation and supplied validation support merging. ## What I ran - Reviewed head `14dc7f17e7156dac19c67033952ea23605c30314` using the prepared `review/diff.patch` and the pinned `repo_read.py` reader. - No commands or tests were run in this review session; the build and test results below were reported by the author. ## Results | Check | Result | Note | |---|---|---| | Author reported build | passed | Both compared revisions built | | Author reported selected tests | passed | No reported failures or validation errors | | Independent review checks | not run | Source and diff inspected | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified - I read all changed files listed as `included: true` in `review/manifest.json`: `Context.hpp`, `Draw.hpp`, `Draw.cpp`, `Pipeline.cpp`, `ShaderValidation.cpp`, `Graphics.cpp`, `ShaderDiskCache.cpp`, `agc_driver_stencil_ref_export_unused_tests.cmake`, `StencilRefExportUnused.cpp`, `Recompiler.cpp`, `Recompiler.hpp`, `ShaderDiskCache.hpp`, `SpirvEmitterState.hpp`, `SpirvEmitterHelpers.cpp`, `SpirvModuleEmitter.cpp`, `StencilReplay.cpp`, `StencilReplay.hpp`, and `libSceAgcDriver.md`. - `VulkanDevice.cpp` and `Graphics.cpp` were excluded from the review folder because they were too large; I read the relevant ranges through the reader. No other changed files were excluded. - I did not independently run the reported tests, verify the reported CI results, or check console and Linux behavior. ## To get this to a good state Nothing is required.
MarcZX10 commented 2026-11-15 20:42:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-15T20:42:14Z.

Review: COMMENTED


Reviewed — comments

The focused review found no verified blocking defect, but two changed files were only inspected at their relevant hunks, so the evidence does not support a formal approval.

What I ran

Reviewed head 8842165642129a27681929e6f7ac59dbd9049fa1. No build or tests were run; the checks described in the PR body are author-reported. Inspected the prepared description, commits, manifest, diff, and relevant changed code and callers.

Results

Check Result Note
Focused code review passed Reviewed changed behavior and targeted callers
Build and tests not run Results in the PR description are author-reported
Full-file review not run Two changed files were read only at relevant ranges

Findings

Blocking

None verified in the code inspected.

Non-blocking

None.

Not verified

The full text of core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp and core/libs/prx/libSceAgcDriver/tests/Graphics.cpp was excluded from the review folder; only relevant ranges were read through repo_read.py. No independent build, tests, or CI results were run or confirmed. Other changed-file contents were inspected through the prepared diff and targeted ranges, not read in full.

To get this to a good state

Nothing is required. Optional: complete a full-file review of the two files listed above before making a formal approval decision.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5912838359 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10351#pullrequestreview-5912838359). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-15T20:42:14Z. **Review:** COMMENTED --- # Reviewed — comments The focused review found no verified blocking defect, but two changed files were only inspected at their relevant hunks, so the evidence does not support a formal approval. ## What I ran Reviewed head `8842165642129a27681929e6f7ac59dbd9049fa1`. No build or tests were run; the checks described in the PR body are author-reported. Inspected the prepared description, commits, manifest, diff, and relevant changed code and callers. ## Results | Check | Result | Note | |---|---|---| | Focused code review | passed | Reviewed changed behavior and targeted callers | | Build and tests | not run | Results in the PR description are author-reported | | Full-file review | not run | Two changed files were read only at relevant ranges | ## Findings ### Blocking None verified in the code inspected. ### Non-blocking None. ## Not verified The full text of `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp` and `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` was excluded from the review folder; only relevant ranges were read through `repo_read.py`. No independent build, tests, or CI results were run or confirmed. Other changed-file contents were inspected through the prepared diff and targeted ranges, not read in full. ## To get this to a good state Nothing is required. Optional: complete a full-file review of the two files listed above before making a formal approval decision.
MarcZX10 commented 2026-11-17 10:24:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T10:24:09Z.

Review: CHANGES_REQUESTED


feat(agc): export stencil operation values through an attachment — changes requested

Changes are required before merge: refuse non-COPY color logic operations in the stencil attachment fallback, because they corrupt the exported stencil value.

What I ran

  • Head reviewed: f4eef7d472252b447265cac236676d0a6b041f58, base main.
  • Read description.md, commits.md, manifest.json and all hunks of diff.patch.
  • Read the house-rule sections "Readable reviews", "Accuracy and evidence" and "Standard PR response format".
  • Head lookups with the reader (no builds, no tests):
python3 repo_read.py search targetViews core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
python3 repo_read.py search framebufferOwners core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
python3 repo_read.py search independentBlend core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp
python3 repo_read.py search stencilAttachmentExport core/shader/recompiler/ShaderDiskCache.cpp
python3 repo_read.py search AcquireFramebuffer core/libs/prx/libSceAgcDriver/Graphics
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp 895 940
python3 repo_read.py search logicOp core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp 762 782
python3 repo_read.py search firstChannels core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp

Results

Check Result Note
Diff and manifest read passed All hunks of the diff
Stencil fallback framebuffer owners passed A null owner skips the framebuffer cache
Independent blend enabled on main passed Checked in the head source
Logic operation on the fallback attachment failed Not refused; see Blocking
Build and GPU tests not run Author-reported only
Convention and main-sync scripts not run Not run in this review

Findings

Blocking

  • core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp:3185: ValidateStencilAttachment accepts a non-COPY color ROP, so a guest draw with, for example, an XOR color ROP writes the wrong stencil value.
    • Why it fails: Pipeline.cpp sets logicOpEnable on the one blend state for the whole pipeline when the color ROP is not COPY (core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp:773). The fallback resizes the blend list to eight entries (core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp:4359), and the attachment count follows that list (Pipeline.cpp:749, Pipeline.cpp:777). So location 7 receives op(value, loaded stencil) instead of value. Store then copies that combined value back into stencil.
    • Scenario: a device with logicOp, a draw with an XOR color ROP, and an exported operation value. The copied-in stencil is combined with the exported value, and the copy-back stores the wrong result.
    • Fix: add a refusal next to the independentBlend check, for example Require(LogicOpFromRop(state.colorRop) == VK_LOGIC_OP_COPY, "stencil attachment export refuses a color logic operation");, if LogicOpFromRop is visible in Draw.cpp. Add a refusal case to the test that already covers independentBlend in core/libs/prx/libSceAgcDriver/tests/Graphics.cpp.

Non-blocking

  • docs/dev/debt/changes/pr10351-stencil-attachment.md:5: the debt note lists the refusals (rect lists, mesh and tessellation, face and channel splits, partial masks). Add the color logic-operation refusal when the fix lands.

Not verified

  • Build, the ctest selection, and the GPU results in the description are author-reported. This review did not run them.
  • The format-103 inventory (1,652 open heads) and the overlap scan are not in the repository, so they are not checked here.
  • The copies in Load and Store (core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp:3159) read and write the depth image in VK_IMAGE_LAYOUT_GENERAL. I did not confirm that layout against the render pass.
  • VulkanDevice.cpp and tests/Graphics.cpp are too large for the review folder. I read only their changed hunks from diff.patch, plus the reader lookup above.
  • Hosted CI, other GPU vendors, Linux, and console behaviour are not checked.

Sources

To get this to a good state

  • Refuse color logic operations in the stencil attachment fallback, and add a test case that the refusal fires.
  • Update the debt note to list the new refusal.
  • The author reruns the listed ctest selection on the new head, including the new refusal case.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5936706796 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10351#pullrequestreview-5936706796). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-17T10:24:09Z. **Review:** CHANGES_REQUESTED --- # feat(agc): export stencil operation values through an attachment — changes requested Changes are required before merge: refuse non-COPY color logic operations in the stencil attachment fallback, because they corrupt the exported stencil value. ## What I ran - Head reviewed: `f4eef7d472252b447265cac236676d0a6b041f58`, base `main`. - Read `description.md`, `commits.md`, `manifest.json` and all hunks of `diff.patch`. - Read the house-rule sections "Readable reviews", "Accuracy and evidence" and "Standard PR response format". - Head lookups with the reader (no builds, no tests): ``` python3 repo_read.py search targetViews core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp python3 repo_read.py search framebufferOwners core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp python3 repo_read.py search independentBlend core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp python3 repo_read.py search stencilAttachmentExport core/shader/recompiler/ShaderDiskCache.cpp python3 repo_read.py search AcquireFramebuffer core/libs/prx/libSceAgcDriver/Graphics python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp 895 940 python3 repo_read.py search logicOp core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp python3 repo_read.py cat core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp 762 782 python3 repo_read.py search firstChannels core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp ``` ## Results | Check | Result | Note | | --- | --- | --- | | Diff and manifest read | passed | All hunks of the diff | | Stencil fallback framebuffer owners | passed | A null owner skips the framebuffer cache | | Independent blend enabled on main | passed | Checked in the head source | | Logic operation on the fallback attachment | failed | Not refused; see Blocking | | Build and GPU tests | not run | Author-reported only | | Convention and main-sync scripts | not run | Not run in this review | ## Findings ### Blocking - `core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp:3185`: `ValidateStencilAttachment` accepts a non-COPY color ROP, so a guest draw with, for example, an XOR color ROP writes the wrong stencil value. - Why it fails: `Pipeline.cpp` sets `logicOpEnable` on the one blend state for the whole pipeline when the color ROP is not COPY (`core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp:773`). The fallback resizes the blend list to eight entries (`core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp:4359`), and the attachment count follows that list (`Pipeline.cpp:749`, `Pipeline.cpp:777`). So location 7 receives `op(value, loaded stencil)` instead of `value`. `Store` then copies that combined value back into stencil. - Scenario: a device with `logicOp`, a draw with an XOR color ROP, and an exported operation value. The copied-in stencil is combined with the exported value, and the copy-back stores the wrong result. - Fix: add a refusal next to the independentBlend check, for example `Require(LogicOpFromRop(state.colorRop) == VK_LOGIC_OP_COPY, "stencil attachment export refuses a color logic operation");`, if `LogicOpFromRop` is visible in `Draw.cpp`. Add a refusal case to the test that already covers independentBlend in `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`. ### Non-blocking - `docs/dev/debt/changes/pr10351-stencil-attachment.md:5`: the debt note lists the refusals (rect lists, mesh and tessellation, face and channel splits, partial masks). Add the color logic-operation refusal when the fix lands. ## Not verified - Build, the ctest selection, and the GPU results in the description are author-reported. This review did not run them. - The format-103 inventory (1,652 open heads) and the overlap scan are not in the repository, so they are not checked here. - The copies in `Load` and `Store` (`core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp:3159`) read and write the depth image in `VK_IMAGE_LAYOUT_GENERAL`. I did not confirm that layout against the render pass. - `VulkanDevice.cpp` and `tests/Graphics.cpp` are too large for the review folder. I read only their changed hunks from `diff.patch`, plus the reader lookup above. - Hosted CI, other GPU vendors, Linux, and console behaviour are not checked. ## Sources - [Pipeline.cpp, blend state and logic op](https://github.com/boykopovar/AnyPS5/blob/f4eef7d472252b447265cac236676d0a6b041f58/core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp#L749-L777) - [Draw.cpp, fallback validation](https://github.com/boykopovar/AnyPS5/blob/f4eef7d472252b447265cac236676d0a6b041f58/core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp#L3184-L3194) - [Draw.cpp, blend resize for location 7](https://github.com/boykopovar/AnyPS5/blob/f4eef7d472252b447265cac236676d0a6b041f58/core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp#L4355-L4364) ## To get this to a good state - Refuse color logic operations in the stencil attachment fallback, and add a test case that the refusal fires. - Update the debt note to list the new refusal. - The author reruns the listed ctest selection on the new head, including the new refusal case.
MarcZX10 commented 2026-11-17 15:19:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T15:19:11Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this; the points below are optional. I found no verified blocking defect in the diff, but I did not read the full text of the changed files, so this is a comment rather than an approval.

What I ran

  • Head: 5cf6fcc26bd19bf5360cfaa47fe4e12be4cc8c93. Base: main. I did not run the merge preview.
  • Read the review folder: description.md, commits.md, manifest.json, diff.patch.
  • Read the house-rule sections "Readable reviews", "Standard PR response format" and "Accuracy and evidence".
  • Searched the head with repo_read.py search in Graphics/src/Draw.cpp (masked, targetViews) and in Graphics/ (DepthSampleLocations).
  • I did not build, run tests, or run conventions checks.

Results

Check Result Note
Diff read, all changed files passed Diff hunks only
Full text of included files not run Not read
Head search, Draw.cpp passed Two names located
Build and tests not run Author reports on Windows, not re-run here
Conventions and whitespace not run Author reports a pass, not re-run

Findings

Blocking

None.

Non-blocking

  • core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp:3880: shaders.back().program->stencilAttachmentExport is dereferenced after only a stage check. If a fragment-stage entry with a null program ever reached this point, it would crash. The same unchecked pattern is used in Pipeline.cpp:841, so this may be acceptable; a null guard would make it explicit.

Not verified

  • Excluded from the review folder: core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp and core/libs/prx/libSceAgcDriver/tests/Graphics.cpp were read only as diff hunks.
  • Included but not read in full: the other 18 changed files, including Draw.cpp (about 5,258 lines), Pipeline.cpp, ShaderValidation.cpp, StencilReplay.cpp, Recompiler.cpp, SpirvModuleEmitter.cpp, and the test files.
  • Load and Store copies (Draw.cpp:3134–3199): I did not confirm that the depth image is in VK_IMAGE_LAYOUT_GENERAL at both copies, or that the R8_UINT target has the transfer usage flags it needs.
  • Attachment mapping: Draw.cpp:4358 appends the stencil color with exportIndex 7. I did not confirm how the pipeline maps render-pass attachment indices to blend state when fewer than seven color targets exist.
  • Lifetime: I did not confirm that prepared.stencilTarget (Draw.cpp:4157) outlives the recorded and submitted commands.
  • Shader cache: the format bump from 88 to 103 and the inventory of 1,652 open heads are the author's claims. I did not verify them.
  • Test results: the results table in the description is the author's report from an RTX 4070 Ti SUPER on Windows. I did not re-run it.
  • Large PR: the diff exceeds the large-PR threshold. I did not split the review into parts because this run does not start subagents, so the review is incomplete.

To get this to a good state

Nothing is required.

Optional: add a null guard at Draw.cpp:3880, or state why program cannot be null there.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5941201899 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10351#pullrequestreview-5941201899). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-17T15:19:11Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this; the points below are optional. I found no verified blocking defect in the diff, but I did not read the full text of the changed files, so this is a comment rather than an approval. ## What I ran - Head: `5cf6fcc26bd19bf5360cfaa47fe4e12be4cc8c93`. Base: `main`. I did not run the merge preview. - Read the review folder: `description.md`, `commits.md`, `manifest.json`, `diff.patch`. - Read the house-rule sections "Readable reviews", "Standard PR response format" and "Accuracy and evidence". - Searched the head with `repo_read.py search` in `Graphics/src/Draw.cpp` (`masked`, `targetViews`) and in `Graphics/` (`DepthSampleLocations`). - I did not build, run tests, or run conventions checks. ## Results | Check | Result | Note | | --- | --- | --- | | Diff read, all changed files | passed | Diff hunks only | | Full text of included files | not run | Not read | | Head search, Draw.cpp | passed | Two names located | | Build and tests | not run | Author reports on Windows, not re-run here | | Conventions and whitespace | not run | Author reports a pass, not re-run | ## Findings ### Blocking None. ### Non-blocking - `core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp:3880`: `shaders.back().program->stencilAttachmentExport` is dereferenced after only a stage check. If a fragment-stage entry with a null `program` ever reached this point, it would crash. The same unchecked pattern is used in `Pipeline.cpp:841`, so this may be acceptable; a null guard would make it explicit. ## Not verified - **Excluded from the review folder:** `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp` and `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` were read only as diff hunks. - **Included but not read in full:** the other 18 changed files, including `Draw.cpp` (about 5,258 lines), `Pipeline.cpp`, `ShaderValidation.cpp`, `StencilReplay.cpp`, `Recompiler.cpp`, `SpirvModuleEmitter.cpp`, and the test files. - **Load and Store copies (`Draw.cpp:3134`–`3199`):** I did not confirm that the depth image is in `VK_IMAGE_LAYOUT_GENERAL` at both copies, or that the R8_UINT target has the transfer usage flags it needs. - **Attachment mapping:** `Draw.cpp:4358` appends the stencil color with `exportIndex` 7. I did not confirm how the pipeline maps render-pass attachment indices to blend state when fewer than seven color targets exist. - **Lifetime:** I did not confirm that `prepared.stencilTarget` (`Draw.cpp:4157`) outlives the recorded and submitted commands. - **Shader cache:** the format bump from 88 to 103 and the inventory of 1,652 open heads are the author's claims. I did not verify them. - **Test results:** the results table in the description is the author's report from an RTX 4070 Ti SUPER on Windows. I did not re-run it. - **Large PR:** the diff exceeds the large-PR threshold. I did not split the review into parts because this run does not start subagents, so the review is incomplete. ## To get this to a good state Nothing is required. Optional: add a null guard at `Draw.cpp:3880`, or state why `program` cannot be null there.
MarcZX10 commented 2026-11-19 12:00:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T12:00:49Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the points below are optional.

What I ran

Reviewed head 3d9e208f9ca0a2819b574bd79b6c4dd8830c4795. I read the prepared description, commits, manifest, and diff, then inspected the attachment validation and recording path, shader mode selection and emission, cache format, and the focused attachment fixture. I did not run commands or tests; the description reports Windows Release validation on this head.

Results

Check Result Note
Source review passed Key changed paths inspected
Build and tests not run Author reports passing Windows validation
Full changed-file review not run Two large files not fully inspected

Findings

Blocking

None found in the inspected code.

Non-blocking

  • StencilAttachment::Color sizes the temporary image and transfer buffer from the full depth extent, while the draw area is validated only to fit within that extent (Draw.cpp:3223, Draw.cpp:3272). The current fixture covers a smaller scissor area and confirms preservation; an explicit test for a render extent smaller than the depth target would strengthen coverage of untouched pixels outside the render area.

Not verified

  • I did not read the full contents of VulkanDevice.cpp or Graphics.cpp; these were excluded from the review folder because they are too large. I inspected only targeted ranges of VulkanDevice.cpp and Graphics.cpp, plus their relevant changed hunks in diff.patch.
  • Other changed files listed in the manifest were not individually read in full; relevant changed hunks were inspected in diff.patch. Tests, builds, other operating systems, other GPUs, and console behavior were not run or independently confirmed.
  • The reported validation results are author-supplied, not runs performed for this review.

To get this to a good state

Nothing is required. Optional: add an attachment test that draws into a render area smaller than the depth target and checks stencil preservation outside that area.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5974588503 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10351#pullrequestreview-5974588503). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-19T12:00:49Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the points below are optional. ## What I ran Reviewed head `3d9e208f9ca0a2819b574bd79b6c4dd8830c4795`. I read the prepared description, commits, manifest, and diff, then inspected the attachment validation and recording path, shader mode selection and emission, cache format, and the focused attachment fixture. I did not run commands or tests; the description reports Windows Release validation on this head. ## Results | Check | Result | Note | | --- | --- | --- | | Source review | passed | Key changed paths inspected | | Build and tests | not run | Author reports passing Windows validation | | Full changed-file review | not run | Two large files not fully inspected | ## Findings ### Blocking None found in the inspected code. ### Non-blocking - `StencilAttachment::Color` sizes the temporary image and transfer buffer from the full depth extent, while the draw area is validated only to fit within that extent (`Draw.cpp:3223`, `Draw.cpp:3272`). The current fixture covers a smaller scissor area and confirms preservation; an explicit test for a render extent smaller than the depth target would strengthen coverage of untouched pixels outside the render area. ## Not verified - I did not read the full contents of `VulkanDevice.cpp` or `Graphics.cpp`; these were excluded from the review folder because they are too large. I inspected only targeted ranges of `VulkanDevice.cpp` and `Graphics.cpp`, plus their relevant changed hunks in `diff.patch`. - Other changed files listed in the manifest were not individually read in full; relevant changed hunks were inspected in `diff.patch`. Tests, builds, other operating systems, other GPUs, and console behavior were not run or independently confirmed. - The reported validation results are author-supplied, not runs performed for this review. ## To get this to a good state Nothing is required. Optional: add an attachment test that draws into a render area smaller than the depth target and checks stencil preservation outside that area.
MarcZX10 commented 2026-11-21 00:19:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T00:19:02Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

Reviewed head 2921b4482e8754dc05e57d7580b1ed4f871a3de1. I did not run commands or tests; repo_read.py was used to inspect the prepared diff and targeted source ranges. The description reports Windows 11 build and test results, which I did not independently run.

Results

Check Result Note
Diff and targeted source review passed Core paths inspected
Tests in this review not run Author-reported results only

Findings

Blocking

None.

Non-blocking

  • The added CMake fragment defines five attachment CTest cases, but I found no reference to that fragment in the test tree. Confirm it is included by the test configuration so those cases are discoverable. core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_stencil_ref_export_unused_tests.cmake:2

Not verified

Full text was read for all changed files marked included: true in the manifest except core/libs/prx/libSceAgcDriver/tests/Graphics.cpp, which is excluded as too large; the relevant test hunks were inspected in diff.patch. The changed files excluded from the review folder were core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp and core/libs/prx/libSceAgcDriver/tests/Graphics.cpp; the Vulkan setup hunks in the former were read through repo_read.py. No repository tests, build, or physical console behavior were independently verified.

To get this to a good state

Nothing is required. Optionally confirm the new CMake fragment is wired into the test configuration.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6001169638 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10351#pullrequestreview-6001169638). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T00:19:02Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this; the points below are optional. ## What I ran Reviewed head `2921b4482e8754dc05e57d7580b1ed4f871a3de1`. I did not run commands or tests; `repo_read.py` was used to inspect the prepared diff and targeted source ranges. The description reports Windows 11 build and test results, which I did not independently run. ## Results | Check | Result | Note | | --- | --- | --- | | Diff and targeted source review | passed | Core paths inspected | | Tests in this review | not run | Author-reported results only | ## Findings ### Blocking None. ### Non-blocking - The added CMake fragment defines five attachment CTest cases, but I found no reference to that fragment in the test tree. Confirm it is included by the test configuration so those cases are discoverable. `core/libs/prx/libSceAgcDriver/tests/cmake/agc_driver_stencil_ref_export_unused_tests.cmake:2` ## Not verified Full text was read for all changed files marked `included: true` in the manifest except `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`, which is excluded as too large; the relevant test hunks were inspected in `diff.patch`. The changed files excluded from the review folder were `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp` and `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`; the Vulkan setup hunks in the former were read through `repo_read.py`. No repository tests, build, or physical console behavior were independently verified. ## To get this to a good state Nothing is required. Optionally confirm the new CMake fragment is wired into the test configuration.
MarcZX10 commented 2026-11-22 07:57:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T07:57:25Z.

Review: COMMENTED


Reviewed — comments

The review covers the prepared diff at head 23fad661a575a700e456e604ab6a14a58f168e8d; no blocking defect was verified, but the review is incomplete, so a formal approval is not justified.

What I ran

Read the prepared description, commits, manifest, complete diff, and targeted source excerpts using the review reader. No build or tests were run in this review; validation results in the description are author-reported.

Results

Check Result Note
Prepared artifacts passed Description, commits, manifest, diff read
Targeted source review passed Render/copy-back, validation, export selection
Build and tests not run Author-reported runs are not independently verified

Negative control

Not run in this review. The description reports a prior test that failed before the logic-operation guard and passed with it; that report was not independently verified.

Findings

Blocking

None verified in the code inspected.

Non-blocking

None.

Not verified

Full source text was not read for every changed file. The two changed files excluded from the review folder were core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp and core/libs/prx/libSceAgcDriver/tests/Graphics.cpp; targeted excerpts from the first were read through the reader, but the second was not read. For included files, review was limited to changed hunks and targeted surrounding excerpts rather than each full file. No tests or build were run.

To get this to a good state

Nothing is required. Optional: complete the source review of the unread changed test file and run the focused checks on this exact head before treating the review as complete.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6011134123 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10351#pullrequestreview-6011134123). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T07:57:25Z. **Review:** COMMENTED --- # Reviewed — comments The review covers the prepared diff at head `23fad661a575a700e456e604ab6a14a58f168e8d`; no blocking defect was verified, but the review is incomplete, so a formal approval is not justified. ## What I ran Read the prepared description, commits, manifest, complete diff, and targeted source excerpts using the review reader. No build or tests were run in this review; validation results in the description are author-reported. ## Results | Check | Result | Note | |---|---|---| | Prepared artifacts | passed | Description, commits, manifest, diff read | | Targeted source review | passed | Render/copy-back, validation, export selection | | Build and tests | not run | Author-reported runs are not independently verified | ## Negative control Not run in this review. The description reports a prior test that failed before the logic-operation guard and passed with it; that report was not independently verified. ## Findings ### Blocking None verified in the code inspected. ### Non-blocking None. ## Not verified Full source text was not read for every changed file. The two changed files excluded from the review folder were `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp` and `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`; targeted excerpts from the first were read through the reader, but the second was not read. For included files, review was limited to changed hunks and targeted surrounding excerpts rather than each full file. No tests or build were run. ## To get this to a good state Nothing is required. Optional: complete the source review of the unread changed test file and run the focused checks on this exact head before treating the review as complete.
MarcZX10 commented 2026-11-22 09:26:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T09:26:26Z.

Review: DISMISSED


Reviewed — changes requested

Changes are required before merge: reject depth/stencil feedback reads on the stencil attachment path before copying the stencil plane into its temporary color attachment.

What I ran

Reviewed head 01a4c901196f3a3e6422f75671cd3e62c6d90cde. No commands or tests were run; author-reported validation is not a run performed in this review.

Results

Check Result Note
Changed-code review failed Feedback-read guard omits attachment mode
Tests not run Author-reported runs not independently verified

Findings

Blocking

  • core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp:4014 selects the attachment fallback, but the post-resolve feedback guard at Draw.cpp:4323 runs only when stencilReferences is non-empty. In attachment mode that vector is empty, even though StencilAttachment::Load copies stencil into an R8_UINT target and Store writes it back to the same depth/stencil surface. A shader that samples that surface can therefore have its stencil input overwritten by the final copy-back, changing guest-visible memory and potentially conflicting with shader access. Apply the existing depth/stencil overlap checks to stencilAttachment as well, or reject such overlap before recording the draw.

Non-blocking

None.

Not verified

  • No tests or build checks were run. The Windows GPU and CTest results in the description are author-reported.
  • The full changed-file text was available for all changed files except core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp and core/libs/prx/libSceAgcDriver/tests/Graphics.cpp; their diffs and targeted reader ranges were inspected. Other changed files’ added lines and relevant code were reviewed.
  • Console behavior and the excluded files’ uninspected code were not verified.

To get this to a good state

Reject depth/stencil feedback reads in attachment mode before recording the draw, then rerun the focused stencil attachment tests and graphics suite on the updated head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6011490154 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10351#pullrequestreview-6011490154). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T09:26:26Z. **Review:** DISMISSED --- # Reviewed — changes requested Changes are required before merge: reject depth/stencil feedback reads on the stencil attachment path before copying the stencil plane into its temporary color attachment. ## What I ran Reviewed head `01a4c901196f3a3e6422f75671cd3e62c6d90cde`. No commands or tests were run; author-reported validation is not a run performed in this review. ## Results | Check | Result | Note | | --- | --- | --- | | Changed-code review | failed | Feedback-read guard omits attachment mode | | Tests | not run | Author-reported runs not independently verified | ## Findings ### Blocking - `core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp:4014` selects the attachment fallback, but the post-resolve feedback guard at `Draw.cpp:4323` runs only when `stencilReferences` is non-empty. In attachment mode that vector is empty, even though `StencilAttachment::Load` copies stencil into an R8_UINT target and `Store` writes it back to the same depth/stencil surface. A shader that samples that surface can therefore have its stencil input overwritten by the final copy-back, changing guest-visible memory and potentially conflicting with shader access. Apply the existing depth/stencil overlap checks to `stencilAttachment` as well, or reject such overlap before recording the draw. ### Non-blocking None. ## Not verified - No tests or build checks were run. The Windows GPU and CTest results in the description are author-reported. - The full changed-file text was available for all changed files except `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp` and `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`; their diffs and targeted reader ranges were inspected. Other changed files’ added lines and relevant code were reviewed. - Console behavior and the excluded files’ uninspected code were not verified. ## To get this to a good state Reject depth/stencil feedback reads in attachment mode before recording the draw, then rerun the focused stencil attachment tests and graphics suite on the updated head.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/10351:upstream-pr/10351'
git switch 'upstream-pr/10351'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/10351'
git switch 'upstream-pr/10351'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/10351'
git switch 'upstream-pr/10351'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/10351'
git switch 'main'
git merge --squash 'upstream-pr/10351'
git switch 'main'
git merge --ff-only 'upstream-pr/10351'
git switch 'main'
git merge 'upstream-pr/10351'
git push origin 'main'
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!10351
No description provided.