fix(agc): rasterize into one-sample targets as one sample when MSAA_ENABLE is clear #6196

Merged
SandstromPL merged 3 commits from upstream-pr/6196 into main 2026-10-18 18:49:56 +00:00
SandstromPL commented 2026-10-15 01:54:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SandstromPL on 2026-10-15T01:54:17Z.


What

Rebased onto main f474fb776, which contains #5882 and #5907. The PR has three commits: the change for draw C, a one-line update of a #5907 test case (see #5907 below), and the same rule for a one-sample depth target, which mrfelek hit next (see "Third commit" below). It does not need #6014.

main refuses three draws of METAL GEAR SOLID: Peace Walker's (PPSA18216) first presentation one after the other. mrfelek listed them and posted their registers. #5915 handles draw A, and #6014 (on #5882) handles draw B. This PR handles draw C, the third.

With #5915, #5882 and #6014, mrfelek's run gets past draws A and B and stops at draw C with this message:

AGC graphics: a color target's sample count differs from the rasterizer's

His local print at that draw gave a 1-sample color target, a 4-sample rasterizer and no depth target.

Draw C's registers:

Register Value
PA_SC_AA_CONFIG 0x0020c002 (4 samples)
PA_SC_MODE_CNTL_0 0x2 (MSAA_ENABLE clear)
DB_Z_INFO 0x80000183 (1 sample)
DB_EQAA 0x00010002
DB_DEPTH_CONTROL 0x710 (no depth or stencil test, so no depth target)
CB_COLOR0_INFO 0x00008028
CB_COLOR0_ATTRIB 0 (1 sample)

#5882 rasterizes a draw without MSAA_ENABLE with every sample at the pixel center. Draw C's only target has one sample, which is taken to keep the coverage of sample 0:

With both, draw C covers exactly the pixels whose center it covers, so it is now drawn as a one-sample draw.

shadPS4 gives the same result. It rasterizes with the largest sample count of the bound depth and color targets (L416-L417, L477-L480). It reads PA_SC_AA_CONFIG only for a SAMPLE_COVERAGE input (L174-L177), which this PR refuses. mrfelek's local change, which ignores PA_SC_AA_CONFIG while MSAA_ENABLE is clear, also let draw C through.

Neither RADV nor radeonsi programs a multisampled PA_SC_AA_CONFIG with MSAA_ENABLE clear:

So, as for #5882, what the console does is inferred, not measured.

These throw on this path:

  • PS_ITER_SAMPLE. The console could run the pixel program once for each of the 4 samples.
  • an ANCILLARY or SAMPLE_COVERAGE pixel input. Under a 4x configuration the console may give a different sample index or coverage than a one-sample draw does.
  • a sample-mask export.
  • points, lines and alpha-to-coverage, as in #5882.
  • a one-sample color target next to a 4x one, in either order (the existing check).
  • a 4x depth target next to a one-sample color target. It fails #5882's refusal, or with #6014 the color check. A one-sample depth target is handled by the third commit.

Sample- and centroid-interpolated inputs are accepted, unlike in #5907: with every sample at the pixel center they read the center value, as in a one-sample draw.

The new debt entry records the rule, the analogy and that it is not measured on hardware.

Third commit: a one-sample depth target. With main c9e6c45de, this PR's previous head a3cbea1ff, #6014, #6842, #6237 and #7072, mrfelek's run draws the title and the Kant quote, and the first draw of the opening movie stops with:

AGC graphics: the depth target's sample count differs from the rasterizer's

His probe in DecodeState logged:

Rasterizer samples 4
PA_SC_MODE_CNTL_0.MSAA_ENABLE clear
Depth target 1 sample, 1440x810
Color targets none

This is draw C's case with a one-sample depth target instead of a one-sample color target. #5907's sample-0 path (rasterizesSampleZeroOnly) needs MSAA_ENABLE, so it throws there. On main without #6014 the same state throws earlier, at #5882's multisampled targets rasterized without MSAA_ENABLE are unsupported for points, lines, a depth target or alpha-to-coverage.

The third commit draws a one-sample depth target under a multisampled PA_SC_AA_CONFIG with MSAA_ENABLE clear, with no color target or only one-sample color targets, as a one-sample draw at the pixel center:

  • The rule is draw C's: every sample is at the pixel center and a one-sample target keeps the coverage of sample 0, so the depth target is tested and written once per pixel with the depth at the pixel center. The mixed-attachment rule above is stated for color targets, so for a depth target this extends the analogy. It is not measured on hardware either. shadPS4's rule (the largest sample count of the bound targets) also gives one sample here.
  • The new block runs before #5882's multisampled-target block, so it works on main alone, and with #6014 that block sees one sample and is skipped. #5907's sample-0 path now runs only while the rasterizer still has more than one sample.
  • mrfelek's local change collapses the draw the same way, without the refusals below, and with it the draw renders on his machine. It also cleared perSampleShading; here that flag is computed after the block from the collapsed sample count, so it is already false.

These throw on this path, with a new message (a one-sample depth target under a multisampled rasterizer without MSAA_ENABLE is unsupported ...):

  • points, lines and alpha-to-coverage, as for draw C.
  • a sample-mask export.
  • DB_EQAA Z interpolation or overrasterization (INTERPOLATE_COMP_Z, INTERPOLATE_SRC_Z, OVERRASTERIZATION_AMOUNT, ENABLE_POSTZ_OVERRASTERIZATION, mask 0x0f0c0000), the bits #6014 refuses with a multisampled depth target.
  • PS_ITER_SAMPLE and an ANCILLARY or SAMPLE_COVERAGE pixel input, when the pixel program runs, for the reasons given for draw C. A depth-only draw that skips its pixel program is drawn with the null program, which uses neither, so leftover bits in PA_SC_MODE_CNTL_1 and SPI_PS_INPUT_ENA/SPI_PS_INPUT_ADDR don't refuse it.
  • a 4x color target next to the one-sample depth target: the existing color check (a color target's sample count differs from the rasterizer's).

The debt entry now covers the depth target and these refusals. The first commit's test case that required a one-sample depth target to throw is replaced by the depth cases under Tested.

This is the depth counterpart of draw C, so it is in this PR rather than a new one: the title already covers one-sample targets, and the commit replaces this PR's own test case and rewrites its debt entry, so a separate PR would depend on this one and change the same lines.

Tested

Ubuntu 24.04, GCC 13.3, Release with BUILD_TESTING=ON. Locally, the libusb lines were removed from CMakeLists.txt, because the libusb submodule isn't checked out here. The first commit was tested on #5882's head e10ec3904 (base main fa539dd9b); the runs after the rebase and for the third commit are listed under Other checks.

agc_driver_graphics (tests/Graphics.cpp) gains msaaEnableClearOneSampleTargetTests. It uses draw C's posted registers. Draw C's sample locations weren't posted, so the test uses draw B's, the standard 4x pattern of the same frame. The depth cases build mrfelek's reported state from draw C's registers, which already have a one-sample DB_Z_INFO: depth test and write on (DB_DEPTH_CONTROL 0x16) and, for the depth-only cases, CB_TARGET_MASK 0. His draw's registers weren't posted, so these cases are not a dump of that draw.

Case Result
Draw C decodes as one sample with its one-sample color target, no custom sample locations and no sample shading, and passes the draw precheck. Its sample state matches the same draw with PA_SC_AA_CONFIG 0.
2x and 8x PA_SC_AA_CONFIG the same
a 4x pattern that varies between pixels the same, with no sample-location grid
sample- or centroid-interpolated inputs, and an enabled but unaddressed ANCILLARY input the same
two one-sample color targets one sample
PS_ITER_SAMPLE, ANCILLARY, SAMPLE_COVERAGE, a sample-mask export throws (new message)
alpha-to-coverage, a line list throws (#5882's message)
a one-sample and a 4x color target, either order throws (the existing check)
Third commit: a one-sample depth target and no color target (mrfelek's state) decodes as one sample with the depth target, no custom sample locations, no sample-location grid and no sample shading, and passes the draw precheck. Its extent, depth format and sample locations match the same draw with PA_SC_AA_CONFIG 0.
the same with a one-sample color target one sample, with both targets
a 4x pattern that varies between pixels one sample, with no custom sample locations and no grid
2x and 8x, with and without a one-sample color target one sample
sample- or centroid-interpolated inputs, pixel program running one sample
PS_ITER_SAMPLE with ANCILLARY and SAMPLE_COVERAGE inputs, pixel program skipped one sample (the test first checks that the program is skipped)
with and without a one-sample color target: ANCILLARY, SAMPLE_COVERAGE or PS_ITER_SAMPLE with the pixel program running, a sample-mask export, alpha-to-coverage, a line list, DB_EQAA 0x00050002, 0x00090002, 0x01010002 or 0x08010002 throws (new depth message)
a 4x color target next to a one-sample depth target throws (the existing color check)

With #5882 alone, the new test fails at draw C with the message above. With the first commit it passes, 5 runs out of 5. Removing any one of its refusals, or either of its two assignments, makes it fail.

For the third commit: with the second commit's State.cpp and the new tests, the test fails at the first depth case with #5882's multisampled targets rasterized without MSAA_ENABLE are unsupported for points, lines, a depth target or alpha-to-coverage, the stop on main alone. Each of 13 single changes to the new code makes it fail: removing one of the six refusal terms, removing the skipped-program exception or making it always true, removing one of the four assignments, or removing the result.samples > 1 guard on #5907's sample-0 path (which then throws the depth target's sample count differs from the rasterizer's).

Other checks:

  • Full ctest on the RTX 3050 Ti, first commit: 1,199 of 1,203 pass, 12 of them skipping themselves: agc_driver_stencil_ref_export on this GPU, and the VideoOut flip tests, which need a display. patched_libraries and guest_usbd are Not Run because the libusb submodule isn't checked out. Two more failed in that run; both are intermittent here:
    • agc_driver_preparation_scope_settle ("the link did not wait for the vertex shader's registration preparation") fails 7 runs out of 30 with this commit, and 9 out of 30 with #5882 alone.
    • guest_host_standard_error timed out under ctest -j10 and passed 10 runs out of 10 on its own.
  • Combined, on main with #5915, #5882, #6014 and the first commit: full ctest gives 1,214 of 1,216, with the same 12 skips and the same 2 Not Run, and agc_driver_graphics runs all three new test functions.
  • After the rebase, on main f474fb776, agc_driver_graphics passes 3 runs out of 3 on the RTX 3050 Ti and on lavapipe. It also passes with #5915 and #6014 merged in. With main's State.cpp it fails with a color target's sample count differs from the rasterizer's.
  • Third commit (3dadf7712, same base): agc_driver_graphics passes 3 runs out of 3 on the RTX 3050 Ti and 1 out of 1 on lavapipe (Mesa 25.2.8). Full ctest on the RTX 3050 Ti: 1,288 of 1,291 pass, 12 of them skipping themselves as above, and patched_libraries and guest_usbd are Not Run. The one failure, agc_driver_store_over_untracked ("the result did not reach a block the CPU left alone"), is #6383, whose test fix #6385 landed on main after this branch's base: it fails the same way with the second commit's State.cpp (14 runs out of 15), and with #6385 applied it passes 15 out of 15.
  • Third commit with #6014: current main 66702f1cf (which now has #5915), this branch and #6014 (4ef2af62e) merge cleanly, and agc_driver_graphics passes on the RTX 3050 Ti. In the merged State.cpp the depth block runs before #6014's relaxed block, which then sees one sample and is skipped. mrfelek's stack (current main, this branch, #6014, #6842, #6237 and #7072) also merges cleanly; that is a textual check only.
  • Sample-location grid: #5882's e10ec3904 clears sampleLocationGrid in its block, which runs first. So a draw C whose 4x pattern varies between pixels ends with no grid, and its one-sample pipeline needs no sample locations. The depth block clears the grid itself, because #5882's block is skipped once the draw is one-sample; the varying-pattern depth case checks that.
  • #5907 (simonbronk, merged as 24528f4e5) handles one-sample targets, including a one-sample depth target, under a multisampled rasterizer with MSAA_ENABLE set, at sample 0's location. The two rules don't overlap.
    • Its singleScan case in multisampleTests clears MSAA_ENABLE on its 2x rasterizer over a one-sample color target, and expected the color sample-count refusal.
    • With this PR that draw decodes, so the second commit makes the case require a one-sample draw with the standard location: samples 1, one one-sample color target, and no custom sample locations.
    • The third commit adds result.samples > 1 to #5907's if (depthKeepsSampleZero). With MSAA_ENABLE set the sample count is unchanged at that point, so #5907's path runs as before.
  • Merges: rebased onto main f474fb776. The branch merges cleanly into current main 66702f1cf, and together with #6014. #5915 has since merged.
    • #6563 changes the debt entry right below the one this PR adds, so whichever lands second resolves a one-line conflict in docs/dev/debt/libSceAgcDriver.md. The State.cpp and tests/Graphics.cpp changes of the two merge cleanly.
    • The third commit adds a one-line conflict in State.cpp with #6530 (milescoviello, 6972f7a38). #6530 adds a sampleCoverageSupported Require directly above if (depthKeepsSampleZero) {, the line this PR turns into if (depthKeepsSampleZero && result.samples > 1) {. The resolution keeps #6530's Require followed by the guarded if. The first two commits merge cleanly with #6530.
  • tools/check_conventions.py from main passes with this title and body.

@mrfelek, thanks for the runs. With #5915, #5882, #6014 and this PR, the first presentation gets past draw C. Your next run reached the opening movie and stopped on the depth case the third commit handles, and your in-game run uses this commit.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none (#5882 is merged)
  • Fixes: none
  • Unblocks: PPSA18216 #5268 (draw C of the first presentation, with #5915 for draw A and #6014 for draw B; mrfelek's run gets past all three. The third commit handles the first draw of the opening movie. mrfelek's in-game run on Linux and Windows uses this head, 3dadf7712, with #6014, #6237, #6842, #7072 and #7200, plus three local workarounds outside this PR's code)
  • GPUs tested: NVIDIA GeForce RTX 3050 Ti Laptop GPU, driver 580.178.04, Ubuntu 24.04 (full ctest for the first and third commits, agc_driver_graphics after the rebase); lavapipe, Mesa 25.2.8 (agc_driver_graphics). The new checks are host-side decode tests
  • AI-assisted: yes (Claude Code); I reviewed and tested every line

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4867046161 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6196). Originally posted by [SandstromPL](https://github.com/SandstromPL) on 2026-10-15T01:54:17Z. --- ### What **Rebased onto `main` f474fb776**, which contains #5882 and #5907. The PR has three commits: the change for draw C, a one-line update of a #5907 test case (see #5907 below), and the same rule for a one-sample depth target, which mrfelek hit next (see "Third commit" below). It does not need #6014. `main` refuses three draws of METAL GEAR SOLID: Peace Walker's (PPSA18216) first presentation one after the other. mrfelek [listed them](https://github.com/boykopovar/AnyPS5/discussions/5268#discussioncomment-18926311) and [posted their registers](https://github.com/boykopovar/AnyPS5/discussions/5268#discussioncomment-18926400). #5915 handles draw A, and #6014 (on #5882) handles draw B. This PR handles draw C, the third. With #5915, #5882 and #6014, mrfelek's run [gets past draws A and B](https://github.com/boykopovar/AnyPS5/pull/6014#issuecomment-6179355332) and stops at draw C with this message: ``` AGC graphics: a color target's sample count differs from the rasterizer's ``` His local print at that draw gave a 1-sample color target, a 4-sample rasterizer and no depth target. Draw C's registers: | Register | Value | |---|---| | `PA_SC_AA_CONFIG` | 0x0020c002 (4 samples) | | `PA_SC_MODE_CNTL_0` | 0x2 (`MSAA_ENABLE` clear) | | `DB_Z_INFO` | 0x80000183 (1 sample) | | `DB_EQAA` | 0x00010002 | | `DB_DEPTH_CONTROL` | 0x710 (no depth or stencil test, so no depth target) | | `CB_COLOR0_INFO` | 0x00008028 | | `CB_COLOR0_ATTRIB` | 0 (1 sample) | #5882 rasterizes a draw without `MSAA_ENABLE` with every sample at the pixel center. Draw C's only target has one sample, which is taken to keep the coverage of sample 0: - That is the rule [`VK_AMD_mixed_attachment_samples`](https://github.com/KhronosGroup/Vulkan-Docs/blob/193ebe195f47ffc5004683d1659e71c725658c4d/chapters/fragops.adoc#L2510-L2516) gives a color target with fewer samples than the rasterizer. RADV [exposes it](https://github.com/openbsd/xenocara/blob/1b39033df8d928ec247ca64448c4a63c72302db7/lib/mesa/src/amd/vulkan/radv_physical_device.c#L699) on AMD GPUs, and #5907 uses the same rule with `MSAA_ENABLE` set. - Vulkan reaches that rule only beside a depth or stencil target with the rasterizer's sample count ([VUID-VkGraphicsPipelineCreateInfo-subpass-01505](https://github.com/KhronosGroup/Vulkan-Docs/blob/193ebe195f47ffc5004683d1659e71c725658c4d/chapters/pipelines.adoc#L3033-L3041)). Draw C has no such target, so for draw C the rule is an analogy. With both, draw C covers exactly the pixels whose center it covers, so it is now drawn as a one-sample draw. [shadPS4](https://github.com/shadps4-emu/shadPS4/blob/15abf68c9b52c4b04d094f2837719fdb871021f3/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp#L127-L128) gives the same result. It rasterizes with the largest sample count of the bound depth and color targets ([L416-L417](https://github.com/shadps4-emu/shadPS4/blob/15abf68c9b52c4b04d094f2837719fdb871021f3/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp#L416-L417), [L477-L480](https://github.com/shadps4-emu/shadPS4/blob/15abf68c9b52c4b04d094f2837719fdb871021f3/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp#L477-L480)). It reads `PA_SC_AA_CONFIG` only for a `SAMPLE_COVERAGE` input ([L174-L177](https://github.com/shadps4-emu/shadPS4/blob/15abf68c9b52c4b04d094f2837719fdb871021f3/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp#L174-L177)), which this PR refuses. mrfelek's local change, which ignores `PA_SC_AA_CONFIG` while `MSAA_ENABLE` is clear, also let draw C through. Neither RADV nor radeonsi programs a multisampled `PA_SC_AA_CONFIG` with `MSAA_ENABLE` clear: - RADV derives both from the same rasterization sample count ([radv_cmd_buffer.c L5465-L5508](https://github.com/openbsd/xenocara/blob/1b39033df8d928ec247ca64448c4a63c72302db7/lib/mesa/src/amd/vulkan/radv_cmd_buffer.c#L5465-L5508)). - radeonsi programs the sample count only with multisampling or smoothing on ([si_state.c L3488-L3504](https://github.com/openbsd/xenocara/blob/1b39033df8d928ec247ca64448c4a63c72302db7/lib/mesa/src/gallium/drivers/radeonsi/si_state.c#L3488-L3504)), and these also set `MSAA_ENABLE` ([L1065-L1067](https://github.com/openbsd/xenocara/blob/1b39033df8d928ec247ca64448c4a63c72302db7/lib/mesa/src/gallium/drivers/radeonsi/si_state.c#L1065-L1067)). So, as for #5882, what the console does is inferred, not measured. These throw on this path: - **`PS_ITER_SAMPLE`.** The console could run the pixel program once for each of the 4 samples. - **an `ANCILLARY` or `SAMPLE_COVERAGE` pixel input.** Under a 4x configuration the console may give a different sample index or coverage than a one-sample draw does. - **a sample-mask export**. - **points, lines and alpha-to-coverage**, as in #5882. - **a one-sample color target next to a 4x one**, in either order (the existing check). - **a 4x depth target next to a one-sample color target.** It fails #5882's refusal, or with #6014 the color check. A one-sample depth target is handled by the third commit. Sample- and centroid-interpolated inputs are accepted, unlike in #5907: with every sample at the pixel center they read the center value, as in a one-sample draw. The new debt entry records the rule, the analogy and that it is not measured on hardware. **Third commit: a one-sample depth target.** With `main` c9e6c45de, this PR's previous head `a3cbea1ff`, #6014, #6842, #6237 and #7072, mrfelek's run draws the title and the Kant quote, and [the first draw of the opening movie stops](https://github.com/boykopovar/AnyPS5/pull/6196#issuecomment-6235018485) with: ``` AGC graphics: the depth target's sample count differs from the rasterizer's ``` His probe in `DecodeState` logged: | | | |---|---| | Rasterizer samples | 4 | | `PA_SC_MODE_CNTL_0.MSAA_ENABLE` | clear | | Depth target | 1 sample, 1440x810 | | Color targets | none | This is draw C's case with a one-sample depth target instead of a one-sample color target. #5907's sample-0 path (`rasterizesSampleZeroOnly`) needs `MSAA_ENABLE`, so it throws there. On `main` without #6014 the same state throws earlier, at #5882's `multisampled targets rasterized without MSAA_ENABLE are unsupported for points, lines, a depth target or alpha-to-coverage`. The third commit draws a one-sample depth target under a multisampled `PA_SC_AA_CONFIG` with `MSAA_ENABLE` clear, with no color target or only one-sample color targets, as a one-sample draw at the pixel center: - The rule is draw C's: every sample is at the pixel center and a one-sample target keeps the coverage of sample 0, so the depth target is tested and written once per pixel with the depth at the pixel center. The mixed-attachment rule above is stated for color targets, so for a depth target this extends the analogy. It is not measured on hardware either. shadPS4's rule (the largest sample count of the bound targets) also gives one sample here. - The new block runs before #5882's multisampled-target block, so it works on `main` alone, and with #6014 that block sees one sample and is skipped. #5907's sample-0 path now runs only while the rasterizer still has more than one sample. - mrfelek's local change collapses the draw the same way, without the refusals below, and with it the draw renders on his machine. It also cleared `perSampleShading`; here that flag is computed after the block from the collapsed sample count, so it is already false. These throw on this path, with a new message (`a one-sample depth target under a multisampled rasterizer without MSAA_ENABLE is unsupported ...`): - **points, lines and alpha-to-coverage**, as for draw C. - **a sample-mask export.** - **`DB_EQAA` Z interpolation or overrasterization** (`INTERPOLATE_COMP_Z`, `INTERPOLATE_SRC_Z`, `OVERRASTERIZATION_AMOUNT`, `ENABLE_POSTZ_OVERRASTERIZATION`, mask 0x0f0c0000), the bits #6014 refuses with a multisampled depth target. - **`PS_ITER_SAMPLE` and an `ANCILLARY` or `SAMPLE_COVERAGE` pixel input, when the pixel program runs**, for the reasons given for draw C. A depth-only draw that skips its pixel program is drawn with the null program, which uses neither, so leftover bits in `PA_SC_MODE_CNTL_1` and `SPI_PS_INPUT_ENA`/`SPI_PS_INPUT_ADDR` don't refuse it. - **a 4x color target next to the one-sample depth target**: the existing color check (`a color target's sample count differs from the rasterizer's`). The debt entry now covers the depth target and these refusals. The first commit's test case that required a one-sample depth target to throw is replaced by the depth cases under Tested. This is the depth counterpart of draw C, so it is in this PR rather than a new one: the title already covers one-sample targets, and the commit replaces this PR's own test case and rewrites its debt entry, so a separate PR would depend on this one and change the same lines. ### Tested Ubuntu 24.04, GCC 13.3, Release with `BUILD_TESTING=ON`. Locally, the libusb lines were removed from `CMakeLists.txt`, because the libusb submodule isn't checked out here. The first commit was tested on #5882's head `e10ec3904` (base `main` fa539dd9b); the runs after the rebase and for the third commit are listed under Other checks. `agc_driver_graphics` (`tests/Graphics.cpp`) gains `msaaEnableClearOneSampleTargetTests`. It uses draw C's posted registers. Draw C's sample locations weren't posted, so the test uses [draw B's](https://github.com/boykopovar/AnyPS5/pull/6014#issuecomment-6179436561), the standard 4x pattern of the same frame. The depth cases build mrfelek's reported state from draw C's registers, which already have a one-sample `DB_Z_INFO`: depth test and write on (`DB_DEPTH_CONTROL` 0x16) and, for the depth-only cases, `CB_TARGET_MASK` 0. His draw's registers weren't posted, so these cases are not a dump of that draw. | Case | Result | |---|---| | Draw C | decodes as one sample with its one-sample color target, no custom sample locations and no sample shading, and passes the draw precheck. Its sample state matches the same draw with `PA_SC_AA_CONFIG` 0. | | 2x and 8x `PA_SC_AA_CONFIG` | the same | | a 4x pattern that varies between pixels | the same, with no sample-location grid | | sample- or centroid-interpolated inputs, and an enabled but unaddressed `ANCILLARY` input | the same | | two one-sample color targets | one sample | | `PS_ITER_SAMPLE`, `ANCILLARY`, `SAMPLE_COVERAGE`, a sample-mask export | throws (new message) | | alpha-to-coverage, a line list | throws (#5882's message) | | a one-sample and a 4x color target, either order | throws (the existing check) | | **Third commit:** a one-sample depth target and no color target (mrfelek's state) | decodes as one sample with the depth target, no custom sample locations, no sample-location grid and no sample shading, and passes the draw precheck. Its extent, depth format and sample locations match the same draw with `PA_SC_AA_CONFIG` 0. | | the same with a one-sample color target | one sample, with both targets | | a 4x pattern that varies between pixels | one sample, with no custom sample locations and no grid | | 2x and 8x, with and without a one-sample color target | one sample | | sample- or centroid-interpolated inputs, pixel program running | one sample | | `PS_ITER_SAMPLE` with `ANCILLARY` and `SAMPLE_COVERAGE` inputs, pixel program skipped | one sample (the test first checks that the program is skipped) | | with and without a one-sample color target: `ANCILLARY`, `SAMPLE_COVERAGE` or `PS_ITER_SAMPLE` with the pixel program running, a sample-mask export, alpha-to-coverage, a line list, `DB_EQAA` 0x00050002, 0x00090002, 0x01010002 or 0x08010002 | throws (new depth message) | | a 4x color target next to a one-sample depth target | throws (the existing color check) | With #5882 alone, the new test fails at draw C with the message above. With the first commit it passes, 5 runs out of 5. Removing any one of its refusals, or either of its two assignments, makes it fail. For the third commit: with the second commit's `State.cpp` and the new tests, the test fails at the first depth case with #5882's `multisampled targets rasterized without MSAA_ENABLE are unsupported for points, lines, a depth target or alpha-to-coverage`, the stop on `main` alone. Each of 13 single changes to the new code makes it fail: removing one of the six refusal terms, removing the skipped-program exception or making it always true, removing one of the four assignments, or removing the `result.samples > 1` guard on #5907's sample-0 path (which then throws `the depth target's sample count differs from the rasterizer's`). Other checks: - Full `ctest` on the RTX 3050 Ti, first commit: 1,199 of 1,203 pass, 12 of them skipping themselves: `agc_driver_stencil_ref_export` on this GPU, and the VideoOut flip tests, which need a display. `patched_libraries` and `guest_usbd` are Not Run because the libusb submodule isn't checked out. Two more failed in that run; both are intermittent here: - `agc_driver_preparation_scope_settle` ("the link did not wait for the vertex shader's registration preparation") fails 7 runs out of 30 with this commit, and 9 out of 30 with #5882 alone. - `guest_host_standard_error` timed out under `ctest -j10` and passed 10 runs out of 10 on its own. - **Combined, on `main` with #5915, #5882, #6014 and the first commit:** full `ctest` gives 1,214 of 1,216, with the same 12 skips and the same 2 Not Run, and `agc_driver_graphics` runs all three new test functions. - **After the rebase,** on `main` f474fb776, `agc_driver_graphics` passes 3 runs out of 3 on the RTX 3050 Ti and on lavapipe. It also passes with #5915 and #6014 merged in. With `main`'s `State.cpp` it fails with `a color target's sample count differs from the rasterizer's`. - **Third commit** (`3dadf7712`, same base): `agc_driver_graphics` passes 3 runs out of 3 on the RTX 3050 Ti and 1 out of 1 on lavapipe (Mesa 25.2.8). Full `ctest` on the RTX 3050 Ti: 1,288 of 1,291 pass, 12 of them skipping themselves as above, and `patched_libraries` and `guest_usbd` are Not Run. The one failure, `agc_driver_store_over_untracked` ("the result did not reach a block the CPU left alone"), is #6383, whose test fix #6385 landed on `main` after this branch's base: it fails the same way with the second commit's `State.cpp` (14 runs out of 15), and with #6385 applied it passes 15 out of 15. - **Third commit with #6014:** current `main` 66702f1cf (which now has #5915), this branch and #6014 (`4ef2af62e`) merge cleanly, and `agc_driver_graphics` passes on the RTX 3050 Ti. In the merged `State.cpp` the depth block runs before #6014's relaxed block, which then sees one sample and is skipped. mrfelek's stack (current `main`, this branch, #6014, #6842, #6237 and #7072) also merges cleanly; that is a textual check only. - **Sample-location grid:** #5882's `e10ec3904` clears `sampleLocationGrid` in its block, which runs first. So a draw C whose 4x pattern varies between pixels ends with no grid, and its one-sample pipeline needs no sample locations. The depth block clears the grid itself, because #5882's block is skipped once the draw is one-sample; the varying-pattern depth case checks that. - **#5907** (simonbronk, merged as 24528f4e5) handles one-sample targets, including a one-sample depth target, under a multisampled rasterizer with `MSAA_ENABLE` set, at sample 0's location. The two rules don't overlap. - Its `singleScan` case in `multisampleTests` clears `MSAA_ENABLE` on its 2x rasterizer over a one-sample color target, and expected the color sample-count refusal. - With this PR that draw decodes, so the second commit makes the case require a one-sample draw with the standard location: `samples` 1, one one-sample color target, and no custom sample locations. - The third commit adds `result.samples > 1` to #5907's `if (depthKeepsSampleZero)`. With `MSAA_ENABLE` set the sample count is unchanged at that point, so #5907's path runs as before. - **Merges:** rebased onto `main` f474fb776. The branch merges cleanly into current `main` 66702f1cf, and together with #6014. #5915 has since merged. - #6563 changes the debt entry right below the one this PR adds, so whichever lands second resolves a one-line conflict in `docs/dev/debt/libSceAgcDriver.md`. The `State.cpp` and `tests/Graphics.cpp` changes of the two merge cleanly. - The third commit adds a one-line conflict in `State.cpp` with #6530 (milescoviello, `6972f7a38`). #6530 adds a `sampleCoverageSupported` `Require` directly above `if (depthKeepsSampleZero) {`, the line this PR turns into `if (depthKeepsSampleZero && result.samples > 1) {`. The resolution keeps #6530's `Require` followed by the guarded `if`. The first two commits merge cleanly with #6530. - `tools/check_conventions.py` from `main` passes with this title and body. @mrfelek, thanks for the runs. With #5915, #5882, #6014 and this PR, the first presentation [gets past draw C](https://github.com/boykopovar/AnyPS5/pull/6196#issuecomment-6187793360). Your [next run](https://github.com/boykopovar/AnyPS5/pull/6196#issuecomment-6235018485) reached the opening movie and stopped on the depth case the third commit handles, and your [in-game run](https://github.com/boykopovar/AnyPS5/discussions/5268#discussioncomment-19002746) uses this commit. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none (#5882 is merged) - [x] Fixes: none - [x] Unblocks: PPSA18216 #5268 (draw C of the first presentation, with #5915 for draw A and #6014 for draw B; [mrfelek's run](https://github.com/boykopovar/AnyPS5/pull/6196#issuecomment-6187793360) gets past all three. The third commit handles [the first draw of the opening movie](https://github.com/boykopovar/AnyPS5/pull/6196#issuecomment-6235018485). mrfelek's [in-game run on Linux and Windows](https://github.com/boykopovar/AnyPS5/discussions/5268#discussioncomment-19002746) uses this head, `3dadf7712`, with #6014, #6237, #6842, #7072 and #7200, plus three local workarounds outside this PR's code) - [x] GPUs tested: NVIDIA GeForce RTX 3050 Ti Laptop GPU, driver 580.178.04, Ubuntu 24.04 (full `ctest` for the first and third commits, `agc_driver_graphics` after the rebase); lavapipe, Mesa 25.2.8 (`agc_driver_graphics`). The new checks are host-side decode tests - [x] AI-assisted: yes (Claude Code); I reviewed and tested every line 🤖 Generated with [Claude Code](https://claude.com/claude-code)
mrfelek commented 2026-10-15 08:24:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mrfelek on 2026-10-15T08:24:45Z.


Peace Walker (PPSA18216): draw C passes; the next stop is a 2D read of a 2D MSAA T#, and a plain 2D read gives strips

System: Linux, RTX 3080 Ti (NVIDIA 615.71.09)
Build: main d92a8dad3 plus #5915, #5882, #6014 and this PR (cfa1a78ec), plus a local probe (see below). All four PRs merge cleanly. Started through the launcher hand-over from #5268.

Draws A, B and C pass

Draw C no longer throws a color target's sample count differs from the rasterizer's. The first presentation then stops in a pixel shader:

shader 0x26d4de700 stage 5: image descriptor is incompatible with the static runtime image interface: descriptor format 56 decodes to {class 1, dim 6, ...}
T# 02754d00 c3800000 00cbc167 e1b20fac 00000000 00700020 00000000 00000000

The T# type nibble is 0xe (Color2DMsaa, type 14). The shader does a plain 2D image_sample on it.

A plain 2D read gives strips (local probe)

A local probe reads a 2D MSAA T# as 2D. With the probe on, the first layer passes and the logo comes up:

  • The text and colours are right. Compared with a PS5 stream of the same logo, the layout is the same, but the picture is cut into horizontal strips.
  • The picture is cut into horizontal strips, and the strips are in the wrong order. Strip 2 should sit to the right of strip 1, and strip 4 to the right of strip 3. In the probe output, strips 1 and 3 stack on top of each other, and so do 2 and 4.
  • The title screen comes out clean.

Both images are below. The reference is a PS5 stream, cropped to the game area.

Probe output, opening logo

PS5 reference, same logo

This is a probe, not a fix. It shows that a plain 2D read is the wrong target, but not which sample or layout the hardware returns, which is the question SandstromPL raised.

On the measurement question

Agreed, that's the open part. We looked at tools/hw-oracle for it: it runs single-lane RDNA arithmetic and checks float behaviour, so it can't render an MSAA target or read its memory layout. It also needs ROCm and an AMD GPU, and this machine has an NVIDIA card. So we don't have a way to measure this here.

Launcher hand-over (#6000)

With #6000 (e7219e4bc) on main, the hand-over stopped with ProcessShutdown. Reverting it made the launcher start the game again. That's still the only change that fixed it here.

AI-assisted; the runs are from my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6187793360 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6196#issuecomment-6187793360). Originally posted by [mrfelek](https://github.com/mrfelek) on 2026-10-15T08:24:45Z. --- ## Peace Walker (PPSA18216): draw C passes; the next stop is a 2D read of a 2D MSAA T#, and a plain 2D read gives strips **System:** Linux, RTX 3080 Ti (NVIDIA 615.71.09) **Build:** `main` d92a8dad3 plus #5915, #5882, #6014 and this PR (cfa1a78ec), plus a local probe (see below). All four PRs merge cleanly. Started through the launcher hand-over from #5268. ### Draws A, B and C pass Draw C no longer throws `a color target's sample count differs from the rasterizer's`. The first presentation then stops in a pixel shader: ``` shader 0x26d4de700 stage 5: image descriptor is incompatible with the static runtime image interface: descriptor format 56 decodes to {class 1, dim 6, ...} T# 02754d00 c3800000 00cbc167 e1b20fac 00000000 00700020 00000000 00000000 ``` The T# type nibble is `0xe` (`Color2DMsaa`, type 14). The shader does a plain 2D `image_sample` on it. ### A plain 2D read gives strips (local probe) A local probe reads a 2D MSAA T# as 2D. With the probe on, the first layer passes and the logo comes up: - The text and colours are right. Compared with a PS5 stream of the same logo, the layout is the same, but the picture is cut into horizontal strips. - The picture is cut into horizontal strips, and the strips are in the wrong order. Strip 2 should sit to the right of strip 1, and strip 4 to the right of strip 3. In the probe output, strips 1 and 3 stack on top of each other, and so do 2 and 4. - The title screen comes out clean. Both images are below. The reference is a PS5 stream, cropped to the game area. ![Probe output, opening logo](https://gist.githubusercontent.com/mrfelek/393d5a2ecdf5163f9e0fd1c1257124f4/raw/probe-intro-strips.png) ![PS5 reference, same logo](https://gist.githubusercontent.com/mrfelek/393d5a2ecdf5163f9e0fd1c1257124f4/raw/ps5-reference-intro.png) This is a probe, not a fix. It shows that a plain 2D read is the wrong target, but not which sample or layout the hardware returns, which is the question SandstromPL raised. ### On the measurement question Agreed, that's the open part. We looked at `tools/hw-oracle` for it: it runs single-lane RDNA arithmetic and checks float behaviour, so it can't render an MSAA target or read its memory layout. It also needs ROCm and an AMD GPU, and this machine has an NVIDIA card. So we don't have a way to measure this here. ### Launcher hand-over (#6000) With #6000 (`e7219e4bc`) on `main`, the hand-over stopped with `ProcessShutdown`. Reverting it made the launcher start the game again. That's still the only change that fixed it here. AI-assisted; the runs are from my machine.
SandstromPL commented 2026-10-15 08:32:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SandstromPL on 2026-10-15T08:32:25Z.


@mrfelek Thanks for the run! Good to see draws A, B and C all through, and that the four PRs merge onto main together.

Agreed, the next stop is separate. It is a 2D MSAA T# (dim 6) read through a pixel shader whose static interface accepts only Dim2D and Dim1D. No open PR handles it. To implement it, someone would need to measure what RDNA returns when a non-MSAA image instruction reads an MSAA resource: sample 0, fragment 0, or something else. That takes tools/hw-oracle on an AMD GPU, which I don't have, so I've left it for now.

AI-assisted.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6187922862 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6196#issuecomment-6187922862). Originally posted by [SandstromPL](https://github.com/SandstromPL) on 2026-10-15T08:32:25Z. --- @mrfelek Thanks for the run! Good to see draws A, B and C all through, and that the four PRs merge onto `main` together. Agreed, the next stop is separate. It is a 2D MSAA T# (dim 6) read through a pixel shader whose static interface accepts only `Dim2D` and `Dim1D`. No open PR handles it. To implement it, someone would need to measure what RDNA returns when a non-MSAA image instruction reads an MSAA resource: sample 0, fragment 0, or something else. That takes `tools/hw-oracle` on an AMD GPU, which I don't have, so I've left it for now. AI-assisted.
github-actions[bot] commented 2026-10-15 12:16:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:16:31Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 6530 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp L1132-1133

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1191 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
PR 1395 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 2434 docs/dev/debt/libSceAgcDriver.md
PR 4040 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 4448 docs/dev/debt/libSceAgcDriver.md
PR 4650 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 5058 docs/dev/debt/libSceAgcDriver.md
PR 5441 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5499 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 5500 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5925 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6188 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6194 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6223 docs/dev/debt/libSceAgcDriver.md
PR 6235 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6273 docs/dev/debt/libSceAgcDriver.md
PR 6280 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6297 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6300 docs/dev/debt/libSceAgcDriver.md
PR 6312 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6320 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6412 docs/dev/debt/libSceAgcDriver.md
PR 6454 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6457 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6470 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6472 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6479 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6481 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6529 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6535 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6548 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6549 docs/dev/debt/libSceAgcDriver.md
PR 6563 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6646 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6683 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6730 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6741 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6786 docs/dev/debt/libSceAgcDriver.md
PR 6808 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6867 docs/dev/debt/libSceAgcDriver.md
PR 6868 docs/dev/debt/libSceAgcDriver.md
PR 6941 docs/dev/debt/libSceAgcDriver.md
PR 6946 docs/dev/debt/libSceAgcDriver.md
PR 6947 docs/dev/debt/libSceAgcDriver.md
PR 6970 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6972 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6977 core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7008 docs/dev/debt/libSceAgcDriver.md
PR 7390 docs/dev/debt/libSceAgcDriver.md
PR 7426 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/debt/libSceAgcDriver.md
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6191829374 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6196#issuecomment-6191829374). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-15T12:16:31Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | [PR 6530](https://www.github.com/boykopovar/AnyPS5/pull/6530) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` [L1132-1133](https://github.com/boykopovar/AnyPS5/blob/376c040294370ce7de355485947d5d00a9417e29/core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp#L1132-L1133) | | | Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 1191](https://www.github.com/boykopovar/AnyPS5/pull/1191) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp` | | [PR 1395](https://www.github.com/boykopovar/AnyPS5/pull/1395) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 2434](https://www.github.com/boykopovar/AnyPS5/pull/2434) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 4040](https://www.github.com/boykopovar/AnyPS5/pull/4040) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 4448](https://www.github.com/boykopovar/AnyPS5/pull/4448) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 4650](https://www.github.com/boykopovar/AnyPS5/pull/4650) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 5058](https://www.github.com/boykopovar/AnyPS5/pull/5058) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 5441](https://www.github.com/boykopovar/AnyPS5/pull/5441) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 5499](https://www.github.com/boykopovar/AnyPS5/pull/5499) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 5500](https://www.github.com/boykopovar/AnyPS5/pull/5500) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 5925](https://www.github.com/boykopovar/AnyPS5/pull/5925) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 6188](https://www.github.com/boykopovar/AnyPS5/pull/6188) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6194](https://www.github.com/boykopovar/AnyPS5/pull/6194) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 6223](https://www.github.com/boykopovar/AnyPS5/pull/6223) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 6235](https://www.github.com/boykopovar/AnyPS5/pull/6235) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6273](https://www.github.com/boykopovar/AnyPS5/pull/6273) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 6280](https://www.github.com/boykopovar/AnyPS5/pull/6280) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 6297](https://www.github.com/boykopovar/AnyPS5/pull/6297) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6300](https://www.github.com/boykopovar/AnyPS5/pull/6300) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 6312](https://www.github.com/boykopovar/AnyPS5/pull/6312) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6320](https://www.github.com/boykopovar/AnyPS5/pull/6320) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6412](https://www.github.com/boykopovar/AnyPS5/pull/6412) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 6454](https://www.github.com/boykopovar/AnyPS5/pull/6454) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6457](https://www.github.com/boykopovar/AnyPS5/pull/6457) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 6470](https://www.github.com/boykopovar/AnyPS5/pull/6470) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 6472](https://www.github.com/boykopovar/AnyPS5/pull/6472) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 6479](https://www.github.com/boykopovar/AnyPS5/pull/6479) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 6481](https://www.github.com/boykopovar/AnyPS5/pull/6481) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 6529](https://www.github.com/boykopovar/AnyPS5/pull/6529) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 6535](https://www.github.com/boykopovar/AnyPS5/pull/6535) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6548](https://www.github.com/boykopovar/AnyPS5/pull/6548) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 6549](https://www.github.com/boykopovar/AnyPS5/pull/6549) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 6563](https://www.github.com/boykopovar/AnyPS5/pull/6563) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 6646](https://www.github.com/boykopovar/AnyPS5/pull/6646) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 6683](https://www.github.com/boykopovar/AnyPS5/pull/6683) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 6730](https://www.github.com/boykopovar/AnyPS5/pull/6730) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 6741](https://www.github.com/boykopovar/AnyPS5/pull/6741) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 6786](https://www.github.com/boykopovar/AnyPS5/pull/6786) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 6808](https://www.github.com/boykopovar/AnyPS5/pull/6808) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 6867](https://www.github.com/boykopovar/AnyPS5/pull/6867) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 6868](https://www.github.com/boykopovar/AnyPS5/pull/6868) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 6941](https://www.github.com/boykopovar/AnyPS5/pull/6941) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 6946](https://www.github.com/boykopovar/AnyPS5/pull/6946) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 6947](https://www.github.com/boykopovar/AnyPS5/pull/6947) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 6970](https://www.github.com/boykopovar/AnyPS5/pull/6970) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6972](https://www.github.com/boykopovar/AnyPS5/pull/6972) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp` | | [PR 6977](https://www.github.com/boykopovar/AnyPS5/pull/6977) | `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` | | [PR 7008](https://www.github.com/boykopovar/AnyPS5/pull/7008) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 7390](https://www.github.com/boykopovar/AnyPS5/pull/7390) | `docs/dev/debt/libSceAgcDriver.md` | | [PR 7426](https://www.github.com/boykopovar/AnyPS5/pull/7426) | `core/libs/prx/libSceAgcDriver/tests/Graphics.cpp`<br>`docs/dev/debt/libSceAgcDriver.md` |
SandstromPL commented 2026-10-16 19:24:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SandstromPL on 2026-10-16T19:24:09Z.


Rebased onto main f474fb776, which now has #5882 and #5907. #5907 added a singleScan case to multisampleTests that clears MSAA_ENABLE on its 2x rasterizer over a one-sample color target, and expected the color sample-count refusal. That's draw C's state, so with this PR it decodes. The second commit makes the case require a one-sample draw with the standard location instead. @simonbronk, it's your test, so please say if you'd rather pin it differently.

agc_driver_graphics passes 3 of 3 on an RTX 3050 Ti and on lavapipe. It also passes with #5915 and #6014 merged in, and fails with main's State.cpp.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6223033825 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6196#issuecomment-6223033825). Originally posted by [SandstromPL](https://github.com/SandstromPL) on 2026-10-16T19:24:09Z. --- Rebased onto `main` f474fb776, which now has #5882 and #5907. #5907 added a `singleScan` case to `multisampleTests` that clears `MSAA_ENABLE` on its 2x rasterizer over a one-sample color target, and expected the color sample-count refusal. That's draw C's state, so with this PR it decodes. The second commit makes the case require a one-sample draw with the standard location instead. @simonbronk, it's your test, so please say if you'd rather pin it differently. `agc_driver_graphics` passes 3 of 3 on an RTX 3050 Ti and on lavapipe. It also passes with #5915 and #6014 merged in, and fails with `main`'s `State.cpp`.
simonbronk commented 2026-10-17 07:44:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-17T07:44:50Z.


@SandstromPL fine with me. The singleScan case only pinned that the draw was refused, and with this PR it is draw C's state, so requiring a one-sample draw at the standard location is the right expectation.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6231350659 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6196#issuecomment-6231350659). Originally posted by [simonbronk](https://github.com/simonbronk) on 2026-10-17T07:44:50Z. --- @SandstromPL fine with me. The `singleScan` case only pinned that the draw was refused, and with this PR it is draw C's state, so requiring a one-sample draw at the standard location is the right expectation.
mrfelek commented 2026-10-17 14:21:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mrfelek on 2026-10-17T14:21:37Z.


Peace Walker (PPSA18216): with a3cbea1ff the next stop is a depth-only draw, MSAA_ENABLE clear, 4-sample rasterizer, one-sample depth target

System: Linux, RTX 3080 Ti (NVIDIA 615.71.09)
Build: main c9e6c45de plus this PR (a3cbea1ff), #6014, #6842, #6237 and #7072. Local changes: an AvPlayer change the game's movies need, and the change below.

The launcher hands over to mgspw.elf, the title and the Kant quote draw, and the opening movie's first draw stops on the depth refusal:

[gpu] driver failure: AGC graphics: the depth target's sample count differs from the rasterizer's

A probe in DecodeState logs the state of that draw:

Rasterizer samples 4
PA_SC_MODE_CNTL_0.MSAA_ENABLE (0x292 bit 0) 0
Depth target 1 sample, 1440x810 (0x2654f0000)
Color targets none

depthKeepsSampleZero is true, but rasterizesSampleZeroOnly returns false straight away because MSAA_ENABLE is clear, so the Require throws. That's the depth-target counterpart of draw C's color case. The color loop already handles a one-sample color target under a multisampled rasterizer with MSAA_ENABLE clear: one sample at the pixel center.

Locally I made the depth case do the same, before the rasterizesSampleZeroOnly branch:

if (depthKeepsSampleZero && (read(cx, 0x292) & 1u) == 0) {
    result.samples = 1;
    result.perSampleShading = false;
    result.customSampleLocations = false;
    result.sampleLocations.fill(0);
    result.sampleLocationGrid = false;
} else if (depthKeepsSampleZero) {
    Require(rasterizesSampleZeroOnly(cx, result), "the depth target's sample count differs from the rasterizer's");
    rasterizeSampleZero(result);
}

With it the refusal is gone and the draw renders.

I didn't add the color path's refusals here: PS_ITER_SAMPLE, a sample-index or coverage input, and a sample-mask export. They probably belong on the depth case too. I'll leave whether and how to cover it to you, since it's your PR's area.

AI-assisted; the runs are from my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6235018485 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6196#issuecomment-6235018485). Originally posted by [mrfelek](https://github.com/mrfelek) on 2026-10-17T14:21:37Z. --- ## Peace Walker (PPSA18216): with a3cbea1ff the next stop is a depth-only draw, MSAA_ENABLE clear, 4-sample rasterizer, one-sample depth target **System:** Linux, RTX 3080 Ti (NVIDIA 615.71.09) **Build:** `main` c9e6c45de plus this PR (a3cbea1ff), #6014, #6842, #6237 and #7072. Local changes: an AvPlayer change the game's movies need, and the change below. The launcher hands over to `mgspw.elf`, the title and the Kant quote draw, and the opening movie's first draw stops on the depth refusal: ``` [gpu] driver failure: AGC graphics: the depth target's sample count differs from the rasterizer's ``` A probe in `DecodeState` logs the state of that draw: | | | |---|---| | Rasterizer samples | 4 | | `PA_SC_MODE_CNTL_0.MSAA_ENABLE` (0x292 bit 0) | 0 | | Depth target | 1 sample, 1440x810 (0x2654f0000) | | Color targets | none | `depthKeepsSampleZero` is true, but `rasterizesSampleZeroOnly` returns false straight away because MSAA_ENABLE is clear, so the `Require` throws. That's the depth-target counterpart of draw C's color case. The color loop already handles a one-sample color target under a multisampled rasterizer with MSAA_ENABLE clear: one sample at the pixel center. Locally I made the depth case do the same, before the `rasterizesSampleZeroOnly` branch: ```cpp if (depthKeepsSampleZero && (read(cx, 0x292) & 1u) == 0) { result.samples = 1; result.perSampleShading = false; result.customSampleLocations = false; result.sampleLocations.fill(0); result.sampleLocationGrid = false; } else if (depthKeepsSampleZero) { Require(rasterizesSampleZeroOnly(cx, result), "the depth target's sample count differs from the rasterizer's"); rasterizeSampleZero(result); } ``` With it the refusal is gone and the draw renders. I didn't add the color path's refusals here: `PS_ITER_SAMPLE`, a sample-index or coverage input, and a sample-mask export. They probably belong on the depth case too. I'll leave whether and how to cover it to you, since it's your PR's area. AI-assisted; the runs are from my machine.
SandstromPL commented 2026-10-17 16:58:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SandstromPL on 2026-10-17T16:58:58Z.


@mrfelek, thanks for the run and for tracing it to rasterizesSampleZeroOnly. The depth case is now in this PR as a third commit, 3dadf7712. A one-sample depth target under a multisampled PA_SC_AA_CONFIG with MSAA_ENABLE clear is now drawn as one sample at the pixel center, by the same rule as draw C. This covers a draw with no color target or with only one-sample color targets.

It no longer relies on #6014's relaxation. The new block runs before #5882's multisampled-target block, so on main alone your state is drawn instead of stopping at ... a depth target .... With #6014, that block sees one sample and is skipped. perSampleShading is computed after the new block from the collapsed sample count, so it doesn't need clearing.

The color path's refusals are mirrored. These still throw, with a one-sample depth target under a multisampled rasterizer without MSAA_ENABLE is unsupported ...:

  • points or lines, and alpha-to-coverage
  • a sample-mask export
  • DB_EQAA Z interpolation or overrasterization (0x0f0c0000, the bits #6014 refuses with a depth target)
  • PS_ITER_SAMPLE, or an ANCILLARY or SAMPLE_COVERAGE input, when the pixel program runs. A depth-only draw that skips its pixel program gets the null program, so leftover bits there don't refuse it.

A 4x color target next to the one-sample depth target still fails the color sample-count check.

Could you rerun Peace Walker with this head instead of your local change, keeping the rest of your stack, and post the next stop? This head, #6014, #6842, #6237 and #7072 merge cleanly on current main. If the movie draw stops on the new message, please post that draw's 0x293, 0x1b3, 0x1b4, 0x203, 0x201 and 0x2dc values and its primitive type. They would show which refusal fired.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6237148817 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6196#issuecomment-6237148817). Originally posted by [SandstromPL](https://github.com/SandstromPL) on 2026-10-17T16:58:58Z. --- @mrfelek, thanks for the run and for tracing it to `rasterizesSampleZeroOnly`. The depth case is now in this PR as a third commit, `3dadf7712`. A one-sample depth target under a multisampled `PA_SC_AA_CONFIG` with `MSAA_ENABLE` clear is now drawn as one sample at the pixel center, by the same rule as draw C. This covers a draw with no color target or with only one-sample color targets. It no longer relies on #6014's relaxation. The new block runs before #5882's multisampled-target block, so on `main` alone your state is drawn instead of stopping at `... a depth target ...`. With #6014, that block sees one sample and is skipped. `perSampleShading` is computed after the new block from the collapsed sample count, so it doesn't need clearing. The color path's refusals are mirrored. These still throw, with `a one-sample depth target under a multisampled rasterizer without MSAA_ENABLE is unsupported ...`: - points or lines, and alpha-to-coverage - a sample-mask export - `DB_EQAA` Z interpolation or overrasterization (0x0f0c0000, the bits #6014 refuses with a depth target) - `PS_ITER_SAMPLE`, or an `ANCILLARY` or `SAMPLE_COVERAGE` input, when the pixel program runs. A depth-only draw that skips its pixel program gets the null program, so leftover bits there don't refuse it. A 4x color target next to the one-sample depth target still fails the color sample-count check. Could you rerun Peace Walker with this head instead of your local change, keeping the rest of your stack, and post the next stop? This head, #6014, #6842, #6237 and #7072 merge cleanly on current `main`. If the movie draw stops on the new message, please post that draw's `0x293`, `0x1b3`, `0x1b4`, `0x203`, `0x201` and `0x2dc` values and its primitive type. They would show which refusal fired. AI-assisted: yes (Claude Code)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!6196
No description provided.