test(agc): run the multisampled single clear case on Windows and macOS #25331

Merged
rafaconvaitis merged 2 commits from upstream-pr/25331 into main 2026-11-27 17:32:51 +00:00
rafaconvaitis commented 2026-11-21 23:05:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by rafaconvaitis on 2026-11-21T23:05:15Z.


What

On Windows and macOS, the multisampled comp-to-single clear case in agc_driver_pipelined_flush_read_order (from #18809) returned before it did anything, so it never checked the DrawPipeline drain it was added for. With that drain removed from Driver::dispatch, all three pipelined_flush_read_order tests still pass on Windows.

  • VirtualAlloc cannot reserve 0x20f7f0000 on Windows: it returns null with ERROR_INVALID_ADDRESS, because the guest arena already reserves every free region of the application area there (on 8763aeffdc, VirtualQuery showed the address inside a MEM_RESERVE, MEM_PRIVATE allocation that starts at 0x200020000). The case then took its if (mapped == nullptr) return;. The block now comes from GuestArenaAllocateFromHint_nid_postfix at that address and is committed like the test's other arena surface. If the arena places it elsewhere, the case fails instead of returning.
  • The block also holds a valid descriptor now. The clear shader loads its image descriptor from s[2:3], which the user data makes 0x2_0f7f_0008, inside the block, and TakeMultisampledSingleClear decodes it there. The block held zeros, so once the case ran, the decode threw guest texture descriptor has a null base address and the test aborted. The block now holds a four-sample 8x8 2D descriptor (type 14, LAST_LEVEL and MAX_MIP 2) at that address. The clear is recorded, and the case's drain check is the only thing that decides the result.
  • macOS has no MAP_FIXED_NOREPLACE, so on main the case returned there before it allocated anything, and the guest arena covers 0x20f7f0000 on macOS too. The second commit, suggested and tested on macOS by @Gonic0, gives every host without that flag the same arena block, committed with the protection value 0x04 that GuestArenaCommit takes on every host (PAGE_READWRITE on Windows). Linux keeps its mmap path. The descriptor is written on every platform, because the case reads it wherever it runs.

This replaces #25227's guard, which made the case build on macOS by leaving its body empty there. Its author offered to close it if this PR takes the macOS path (comment).

Tested

Windows 11 25H2 (26200), WinLibs GCC 15.2.0 r7, Release. main d3a7b0bcd8 and this branch on it. NVIDIA GeForce RTX 3050 (driver 610.88) and AMD Radeon 760M (1002:15bf, AMD Software 26.11.2, driver 32.0.32029.2010), selected with ANYPS5_GPU. Environment: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1. Layer runs add VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (1.4.363.1) and VK_LOADER_DEBUG=layer; the loader inserted the layer in every one of them. ctest -R pipelined_flush_read_order -V: agc_driver_pipelined_flush_read_order, _draw_pipeline and _plan_verify.

RTX 3050, no layer RTX 3050, layer Radeon 760M, no layer Radeon 760M, layer
main, 1 run 3 of 3 pass same same same
main without #18809's drain, 1 run 3 of 3 pass same same same
this PR, 3 runs 3 of 3 pass same same same
this PR without #18809's drain, 1 run 3 of 3 fail: pipelined flush read order: multisampled comp-to-single clear bypassed DrawPipeline::Queue0().Drain same same same
  • "Without #18809's drain" removes the if (DrawPipeline::Active()) DrawPipeline::Queue0().Drain(DrawPipeline::DrainReason::Packet, 0x15); line in the MatchMultisampledSingleClear block of Dispatch.cpp. Before this change, the test can't see that line go.
  • No VUID-, SYNC-HAZARD- or UNASSIGNED- line in any run. Every log's Selected GPU line names the intended device.
  • On 8763aeffdc, taking the block from the arena while keeping the zeroed block made every test abort on both GPUs, with and without the layer, with guest texture descriptor has a null base address. #25227 describes the same message from the same arena attempt on macOS.
  • Second commit (d11282a3bc) on the same base, same setup: this PR 3 runs, 3 of 3 pass on both GPUs with and without the layer; without #18809's drain, 3 of 3 fail with the same message. On Windows it compiles to the same code as the first commit.
  • Other testers: macOS on an Apple M5 Pro with MoltenVK (@Gonic0: passes with and without the layer, fails without the drain), and Windows on Intel Raptor Lake-S and an RTX 4070 Laptop (@mihiii1337).
  • tools/check_conventions.py passes.
  • Not run on Linux. Linux CI passes the three tests on main. If the case reached TakeMultisampledSingleClear there, it would have thrown on the zeroed descriptor, so the new descriptor shouldn't change a Linux run that passes today.

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 3050 (driver 610.88) and AMD Radeon 760M (driver 32.0.32029.2010), Windows 11 25H2
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5433386600 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25331). Originally posted by [rafaconvaitis](https://github.com/rafaconvaitis) on 2026-11-21T23:05:15Z. --- ### What On Windows and macOS, the multisampled comp-to-single clear case in `agc_driver_pipelined_flush_read_order` (from #18809) returned before it did anything, so it never checked the `DrawPipeline` drain it was added for. With that drain removed from `Driver::dispatch`, all three `pipelined_flush_read_order` tests still pass on Windows. - `VirtualAlloc` cannot reserve `0x20f7f0000` on Windows: it returns null with `ERROR_INVALID_ADDRESS`, because the guest arena already reserves every free region of the application area there (on `8763aeffdc`, `VirtualQuery` showed the address inside a `MEM_RESERVE`, `MEM_PRIVATE` allocation that starts at `0x200020000`). The case then took its `if (mapped == nullptr) return;`. The block now comes from `GuestArenaAllocateFromHint_nid_postfix` at that address and is committed like the test's other arena surface. If the arena places it elsewhere, the case fails instead of returning. - The block also holds a valid descriptor now. The clear shader loads its image descriptor from `s[2:3]`, which the user data makes `0x2_0f7f_0008`, inside the block, and `TakeMultisampledSingleClear` decodes it there. The block held zeros, so once the case ran, the decode threw `guest texture descriptor has a null base address` and the test aborted. The block now holds a four-sample 8x8 2D descriptor (type 14, `LAST_LEVEL` and `MAX_MIP` 2) at that address. The clear is recorded, and the case's drain check is the only thing that decides the result. - macOS has no `MAP_FIXED_NOREPLACE`, so on `main` the case returned there before it allocated anything, and the guest arena covers `0x20f7f0000` on macOS too. The second commit, suggested and tested on macOS by @Gonic0, gives every host without that flag the same arena block, committed with the protection value `0x04` that `GuestArenaCommit` takes on every host (`PAGE_READWRITE` on Windows). Linux keeps its `mmap` path. The descriptor is written on every platform, because the case reads it wherever it runs. This replaces #25227's guard, which made the case build on macOS by leaving its body empty there. Its author offered to close it if this PR takes the macOS path ([comment](https://github.com/boykopovar/AnyPS5/pull/25331#issuecomment-7071111349)). ### Tested Windows 11 25H2 (26200), WinLibs GCC 15.2.0 r7, Release. `main` `d3a7b0bcd8` and this branch on it. NVIDIA GeForce RTX 3050 (driver 610.88) and AMD Radeon 760M (`1002:15bf`, AMD Software 26.11.2, driver 32.0.32029.2010), selected with `ANYPS5_GPU`. Environment: `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1`. Layer runs add `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (1.4.363.1) and `VK_LOADER_DEBUG=layer`; the loader inserted the layer in every one of them. `ctest -R pipelined_flush_read_order -V`: `agc_driver_pipelined_flush_read_order`, `_draw_pipeline` and `_plan_verify`. | | RTX 3050, no layer | RTX 3050, layer | Radeon 760M, no layer | Radeon 760M, layer | |---|---|---|---|---| | `main`, 1 run | 3 of 3 pass | same | same | same | | `main` without #18809's drain, 1 run | 3 of 3 pass | same | same | same | | this PR, 3 runs | 3 of 3 pass | same | same | same | | this PR without #18809's drain, 1 run | 3 of 3 fail: `pipelined flush read order: multisampled comp-to-single clear bypassed DrawPipeline::Queue0().Drain` | same | same | same | - "Without #18809's drain" removes the `if (DrawPipeline::Active()) DrawPipeline::Queue0().Drain(DrawPipeline::DrainReason::Packet, 0x15);` line in the `MatchMultisampledSingleClear` block of `Dispatch.cpp`. Before this change, the test can't see that line go. - No `VUID-`, `SYNC-HAZARD-` or `UNASSIGNED-` line in any run. Every log's `Selected GPU` line names the intended device. - On `8763aeffdc`, taking the block from the arena while keeping the zeroed block made every test abort on both GPUs, with and without the layer, with `guest texture descriptor has a null base address`. #25227 describes the same message from the same arena attempt on macOS. - Second commit (`d11282a3bc`) on the same base, same setup: this PR 3 runs, 3 of 3 pass on both GPUs with and without the layer; without #18809's drain, 3 of 3 fail with the same message. On Windows it compiles to the same code as the first commit. - Other testers: macOS on an Apple M5 Pro with MoltenVK ([@Gonic0](https://github.com/boykopovar/AnyPS5/pull/25331#issuecomment-7071111349): passes with and without the layer, fails without the drain), and Windows on Intel Raptor Lake-S and an RTX 4070 Laptop ([@mihiii1337](https://github.com/boykopovar/AnyPS5/pull/25331#issuecomment-7070825766)). - `tools/check_conventions.py` passes. - Not run on Linux. Linux CI passes the three tests on `main`. If the case reached `TakeMultisampledSingleClear` there, it would have thrown on the zeroed descriptor, so the new descriptor shouldn't change a Linux run that passes today. ### Checklist - [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: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 3050 (driver 610.88) and AMD Radeon 760M (driver 32.0.32029.2010), Windows 11 25H2 - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-11-22 11:18:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T11:18:53Z.

Review: APPROVED


Reviewed — looks good

The single changed execution test now allocates and commits its fixed descriptor block through the guest arena on Windows and hosts without MAP_FIXED_NOREPLACE, and initializes the descriptor; I found no verified defect in the reviewed code.

What I ran

Reviewed head d11282a3bc2605f306829406e0410a87c7744809. No commands or tests were run in this review; the author-reported platform runs are not independently verified here.

Read description.md, commits.md, manifest.json, diff.patch, and the complete changed file core/libs/prx/libSceAgcDriver/tests/execution/PipelinedFlushReadOrder.cpp. Also read targeted allocator, commit/reset, and allocation-cleanup code in core/libs/prx/libc/src/GuestArena.cpp. The attempted review/files.json read did not resolve; the manifest lists one changed file, marked included. No repository files were excluded according to the supplied manifest.

Results

Check Result Note
Patch review passed One changed test file reviewed
Automated checks not run No local test execution
Author-reported runs not run Windows and macOS results in description only

Findings

Blocking

None.

Non-blocking

None.

Not verified

I did not run the tests or independently verify the reported Windows and macOS runs, Linux behavior, or the test's GPU and console behavior. files.json was not available through the reader, so excluded-file details beyond the manifest were not verified.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6011952320 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25331#pullrequestreview-6011952320). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-22T11:18:53Z. **Review:** APPROVED --- # Reviewed — looks good The single changed execution test now allocates and commits its fixed descriptor block through the guest arena on Windows and hosts without `MAP_FIXED_NOREPLACE`, and initializes the descriptor; I found no verified defect in the reviewed code. ## What I ran Reviewed head `d11282a3bc2605f306829406e0410a87c7744809`. No commands or tests were run in this review; the author-reported platform runs are not independently verified here. Read `description.md`, `commits.md`, `manifest.json`, `diff.patch`, and the complete changed file `core/libs/prx/libSceAgcDriver/tests/execution/PipelinedFlushReadOrder.cpp`. Also read targeted allocator, commit/reset, and allocation-cleanup code in `core/libs/prx/libc/src/GuestArena.cpp`. The attempted `review/files.json` read did not resolve; the manifest lists one changed file, marked included. No repository files were excluded according to the supplied manifest. ## Results | Check | Result | Note | |---|---|---| | Patch review | passed | One changed test file reviewed | | Automated checks | not run | No local test execution | | Author-reported runs | not run | Windows and macOS results in description only | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified I did not run the tests or independently verify the reported Windows and macOS runs, Linux behavior, or the test's GPU and console behavior. `files.json` was not available through the reader, so excluded-file details beyond the manifest were not verified. ## To get this to a good state Nothing is required.
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!25331
No description provided.