fix(agc): draw line lists and strips into a multisampled target with MSAA_ENABLE clear #8871

Merged
thuanquang merged 1 commit from upstream-pr/8871 into main 2026-10-22 16:20:49 +00:00
thuanquang commented 2026-10-21 03:49:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by thuanquang on 2026-10-21T03:49:50Z.


What

Before: a line list or strip (VGT_PRIMITIVE_TYPE 2 or 3) drawn with PA_SC_AA_CONFIG.MSAA_NUM_SAMPLES > 0 and PA_SC_MODE_CNTL_0.MSAA_ENABLE clear threw AGC graphics: multisampled targets rasterized without MSAA_ENABLE are unsupported for points, lines or alpha-to-coverage. METAL GEAR SOLID: Peace Walker (PPSA18216) draws line lists and strips into its 4x target this way: mrfelek's in-game run (#5268 comment, row "local: lines") needed a local change that drops this refusal (8e5e1682, the State.cpp hunk, which keeps only the alpha-to-coverage condition). The title reaches these draws only past the opening movie's 2D read of the 4x target (#7803, or mrfelek's local resolve).

After: such lines take the path triangles and rectangles already take in this state (#5882, #6014, #6196): the target's sample count with every sample at the pixel center. Under a one-sample color target (PPSA18216's draw C) the line is drawn as a one-sample line, as with a 1x PA_SC_AA_CONFIG. The refusal now reads the primitive the draw rasterizes (RasterPrimitiveOf) instead of VGT_PRIMITIVE_TYPE: a point list that a geometry program turns into triangles or lines decodes as those triangles or lines with every sample at the pixel center, and rasterized points and alpha-to-coverage still throw. A one-sample depth target under this configuration, and a single-sample scan into a multisampled depth target, still refuse line and point lists (VGT_PRIMITIVE_TYPE 1-3).

One draw class goes from drawn to refused (found by @oneandonlydean). Since #8856 (ee81c5112d, in this base) a geometry program's point output is drawable (State.cpp L1094 accepts VGT_GS_OUT_PRIM_TYPE 0), and main's refusal here reads VGT_PRIMITIVE_TYPE, so a geometry program that makes points from a triangle list into a multisampled target with MSAA_ENABLE clear is drawn on main and refused by this change, which reads the rasterized primitive. Rasterized points stay refused in this state on purpose: the evidence below covers lines only, and what the console rasterizes for a point under a multisampled configuration without MSAA_ENABLE is not measured. A point or line list into such a geometry program was already refused on main, and a vertex-path point list still throws earlier (L1221, point-list vertex rendering requires point-size output support).

Why every sample of a covered pixel (not measured on a PS5)

  • AMD's Evergreen 3D register reference (PA_SC_MODE_CNTL_0) describes MSAA_ENABLE as "Enable MultiSample AA in DX10 and below. Used for lines in DX10.1 and above" (also quoted in #5882), i.e. the bit is D3D's MultisampleEnable for lines.
  • D3D11.3 §15.14.1 (DirectX-Specs f37b0d60, L13705-L13706): "Regardless of what the MSAA sample count is, when the MultisampleEnable state is false, the Pixel Shader executes based on non-MSAA rasterization rules for aliased or alpha-based AA lines. This means that when the line covers a pixel, ... all of the MSAA samples in the pixel are hit."
  • GL with MULTISAMPLE disabled rasterizes every primitive as single-sample with full coverage (ARB_multisample L185-L190). radeonsi programmed exactly this register state for it, PA_SC_AA_CONFIG at the framebuffer's sample count with MSAA_ENABLE = 0 (si_state.c at 7bb3d6ac, L926-L933, L3482-L3525), until ea5b7de1 (2019) zeroed PA_SC_AA_CONFIG there so that gl_SampleMaskIn reads 1.
  • On the host every sample point is at the pixel center, so each pixel is covered whole or not at all whatever line rule the host uses: Vulkan sets the coverage bit of each sample point inside a line's rectangle or parallelogram (primsrast.adoc at 193ebe19, L2911-L2912, L3010-L3011), and Bresenham lines "cover all samples in those pixels" (L3200-L3202).

On #5882's reason for keeping lines refused ("an aliased line on the hardware is not a Vulkan rectangular line"): main already draws every one-sample line list and strip with the host's line rule (debt entry "Line-strip geometry output": 1 pixel wide, PA_SU_LINE_CNTL not read, the console's line rules not measured), and already draws lines into a multisampled color target with every sample at the pixel center when PA_SC_AA_CONFIG is 1x (the "draw raised to a multisampled target" branch, State.cpp L1314, has no topology check). With every sample at the center, a 4x line list and a 4x line strip cover the pixels the host's one-sample lines cover (measured below), so this adds no difference that one-sample lines do not already have.

How

  • State.cpp: the refusal in the MSAA_NUM_SAMPLES > 0 / MSAA_ENABLE clear block tests RasterPrimitiveOf(result) (a rectangle for a rect list, the output primitive of a geometry or mesh program, triangles for tessellation, else the topology) instead of the topology, and keeps points and alpha-to-coverage. DecodeState decodes the shader stages (L1140) and the topology (L1143-L1166) before this check (L1222), so the check sees a geometry program's output and did not have to move. Line lists and strips reach the existing pixel-center code.
  • tests/Graphics.cpp: draw B with VGT_PRIMITIVE_TYPE 2 and 3 decodes as lines into the 4x depth and color pair with every sample at the pixel center and passes the precheck; draw C with 2 and 3 decodes as one sample; a point list into a geometry program that outputs triangle strips (VGT_GS_OUT_PRIM_TYPE 2) now decodes as triangles (RasterPrimitiveOf = triangle) into the same 4x pair with every sample at the pixel center, where main threw; the three alpha-to-coverage rows take the new message; a triangle, line and point list (VGT_PRIMITIVE_TYPE 4, 2 and 1) into a geometry program that outputs points (VGT_GS_OUT_PRIM_TYPE 0) into the same 4x pair are refused with this check's message (the triangle-list row decodes on main); the one-sample depth target rows (msaaEnableClearOneSampleTargetTests) refuse a line strip (VGT_PRIMITIVE_TYPE 3) as well as a line list, without and with a one-sample color target.
  • tests/execution/MultisampleCenteredLines.cpp (new GPU test, agc_driver_multisample_centered_lines): builds the registers of a line list and of a line strip (VGT_PRIMITIVE_TYPE 2 and 3, PA_SC_AA_CONFIG 0x0020c002, PA_SC_MODE_CNTL_0 2, a 16x16 4x RGBA16F CB_COLOR0, no depth target), decodes them with DecodeState, checks that the decoded state has 4 samples all at the pixel center, and draws exactly that state; it then draws the same decoded state into a one-sample RGBA8 target. It loads every sample and requires every pixel to be covered in all 4 samples or none, every pixel the one-sample lines draw away from the endpoints to be covered in the 4x target, and the 4x target to cover at least 20 pixels and at most twice as many as the one-sample lines. It prints how many pixels away from the endpoints differ: Vulkan lets a non-strict host use another line rule at one sample than at four, so equality is reported, not required. It skips without shaderStorageImageMultisample or VK_EXT_sample_locations at 4 samples. On main, DecodeState throws the refusal quoted above, so the test fails there (RED below).
  • Debt: the entry "A multisampled target rasterized without MSAA_ENABLE" is rewritten gap-first (2025 -> 998 characters) and keeps what each title draws (PPSA06888 a 2x target, PPSA18216 a 4x depth and color pair and 4x lines); it now says rasterized points throw. In the entry "A one-sample target under a multisampled rasterizer without MSAA_ENABLE" only the points and lines statement changes (line and point lists, VGT_PRIMITIVE_TYPE 1-3, move to what a one-sample depth target refuses). That statement now also says a one-sample depth target's line and point lists throw even when a geometry program turns them into triangles: that block still reads the topology, while the 4x pair decodes such a draw. That entry has 3275 characters on main since #7729 rewrote its PS_ITER_SAMPLE sentences, and 3371 with this change. Changing only these two statements keeps the rebase small for #8121, which rewrites the same entry, where cutting the entry here would turn it into a rewrite.

Not changed: rasterized points stay refused (mrfelek's title run below hit no point refusal), except that a geometry program's points from a triangle list, drawn on main since #8856, are now refused as well (above); PA_SC_LINE_CNTL and PA_SU_LINE_CNTL stay unread, as for one-sample lines.

Tested

Windows 11 26200, MinGW-w64 GCC 15.2.0 (WinLibs), Release build, AMD Radeon RX 6700 XT (gfx1031, driver 32.0.21045.16010, installed 2026-10-21 22:00; runs before that used 32.0.21045.5002). This branch is one commit (0efe28a839) on main 2c4b116da9. It is 593f4ab868 (rebased after #7729 merged) with oneandonlydean's review applied: the three geometry point rows and the debt clause, no source change. On 0efe28a839 the six focused tests pass 3 of 3; with the point term dropped, agc_driver_graphics fails at the first new row (controls below); with main 2c4b116da9's State.cpp, the triangle-list row decodes, so agc_driver_graphics fails with expected graphics rejection: multisampled targets rasterized without MSAA_ENABLE are unsupported for points or alpha-to-coverage (run with that row moved first in its function, so that main's line refusal does not stop the test before it). The validation layer run below is on 593f4ab868: State.cpp is the same, and the new rows only decode state in agc_driver_graphics, which creates no Vulkan instance. 593f4ab868 was rebased after #7729 merged. The one conflict was the debt entry "A one-sample target under a multisampled rasterizer without MSAA_ENABLE", where #7729 rewrote the PS_ITER_SAMPLE sentences; this change still edits only its two points-and-lines statements. On 593f4ab868 the six focused tests below pass 3 of 3, and the validation layer run (A: main 2c4b116da9, the five that exist there; B: this head, all six) has no VUID- line and no was not found but was requested; the centered-lines test prints the same 27 and 35 pixels as below. Before that, the branch was one commit (5fa781bbc) on main 7ab4b2e56. RED and the controls below ran on the same change on main b85d972f4. After rebasing, GREEN and the validation run were repeated on 5ac77fd50, which is 0f8e9be7d without its last debt-sentence edit. 5fa781bbc is 0f8e9be7d with the line-strip rows of the one-sample depth target refusal added after review (no source change); agc_driver_graphics passes 3 of 3 with them. The focused tests are agc_driver_graphics, agc_driver_multisample_centered_lines, agc_driver_sample_multisample_target, agc_driver_native_msaa_vertex_input, agc_driver_msaa_enable_single_sample and agc_driver_covered_centroid_state.

  • RED, main b85d972f4's State.cpp with this PR's tests, ctest -V on the six tests: 3 of 6 fail. agc_driver_graphics and agc_driver_multisample_centered_lines fail with AGC graphics: multisampled targets rasterized without MSAA_ENABLE are unsupported for points, lines or alpha-to-coverage; agc_driver_covered_centroid_state fails with AGC graphics: unexpected failure: AGC graphics: multisampled targets rasterized without MSAA_ENABLE are unsupported for points, lines or alpha-to-coverage (its alpha-to-coverage row expects this PR's message). The other three pass.

  • GREEN, this branch, ctest --test-dir build -R '^(agc_driver_graphics|agc_driver_multisample_centered_lines|agc_driver_sample_multisample_target|agc_driver_native_msaa_vertex_input|agc_driver_msaa_enable_single_sample|agc_driver_covered_centroid_state)$' -V: 6/6 pass in each of three runs, and the new test prints in every run:

    VGT_PRIMITIVE_TYPE 2: 4x lines with every sample at the pixel center covered 27 pixels in full and none in part; the one-sample lines drew 27; 0 of the 229 pixels away from the endpoints differ
    VGT_PRIMITIVE_TYPE 3: 4x lines with every sample at the pixel center covered 35 pixels in full and none in part; the one-sample lines drew 35; 0 of the 229 pixels away from the endpoints differ
    
  • Controls on this branch, each reverted after its run (agc_driver_graphics, agc_driver_covered_centroid_state and agc_driver_multisample_centered_lines for the first three):

    • The refusal reduced to !result.alphaToCoverage, the condition 8e5e1682 keeps (the point term dropped, this PR's message kept): agc_driver_graphics fails at the first new geometry point row (triangle-list input) with expected graphics rejection: multisampled targets rasterized without MSAA_ENABLE are unsupported for points or alpha-to-coverage (on 0efe28a839; before that row existed, all three passed, so the point term had no test that could fail).
    • The alpha-to-coverage term dropped, the point term kept: agc_driver_graphics fails at draw B with DB_ALPHA_TO_MASK 0xaa01 with expected graphics rejection: multisampled targets rasterized without MSAA_ENABLE are unsupported for points or alpha-to-coverage, and agc_driver_covered_centroid_state at its 2x row with expected graphics rejection: without MSAA_ENABLE are unsupported for points or alpha-to-coverage.
    • The whole refusal removed, alpha-to-coverage included: the same two failures with the same messages.
    • The new test's decoded 4x state drawn with the standard 4x sample positions (customSampleLocations cleared): it fails with AGC graphics: VGT_PRIMITIVE_TYPE 2: pixel (5, 1) has 1 of its 4 samples covered by a line with every sample at the pixel center.
  • A row added for one run and not committed: the geometry draw of tests/Graphics.cpp with VGT_GS_OUT_PRIM_TYPE 1 (a line strip) instead of 2 decodes as lines (RasterPrimitiveOf = line) with every sample at the pixel center; agc_driver_graphics passes with it.

  • Khronos validation layer A/B (VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1, ctest --test-dir build -R <the six tests> -V), same machine and GPU:

    Tree Tests Result VUID- lines
    main b85d972f4 the five that exist on main 5/5 pass 0
    main b85d972f4's State.cpp with this PR's tests the six 3 fail as in RED, 3 pass 0
    this branch 779846528 (on b85d972f4) the six 6/6 pass 0
    main 7ab4b2e56 the five that exist on main 5/5 pass 0
    this branch 5ac77fd50 (on 7ab4b2e56) the six 6/6 pass 0

    No log contains was not found but was requested. Runs with VK_LOADER_DEBUG=layer show Insert instance layer "VK_LAYER_KHRONOS_validation" for agc_driver_native_msaa_vertex_input, agc_driver_msaa_enable_single_sample (twice) and agc_driver_sample_multisample_target on main and on this branch, and for agc_driver_multisample_centered_lines on this branch; agc_driver_graphics and agc_driver_covered_centroid_state create no Vulkan instance.

  • python tools/check_conventions.py --base origin/main, also with this title and body: docs/dev/debt/libSceAgcDriver.md:34: warning: [debt-length] ... 3371 characters; that entry already has 3275 on main, and this PR changes two statements of it (see How); no other finding.

  • python tools/pr_overlap.py --branch fix/msaa-enable-clear-lines: conflicts only in docs/dev/debt/libSceAgcDriver.md, with #7729 (L27), #8121 (L27), #8424 (L26-27) and #7978 (L29-30); none in State.cpp or tests/Graphics.cpp. It could not compare 45 open PRs that conflict with main; none of their changed lines in these three files mention MSAA_ENABLE, RasterPrimitiveOf, the msaaEnableClear tests or this refusal.

  • Linux, by @simonbbby on 0f8e9be7d (Ubuntu 24.04.3, GCC 13.3, Release, ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, three serial rounds per ICD): the six tests pass on an RTX 3090 (595.99.02) and on gfx1036 with RADV (Mesa 25.2.8); lavapipe passes five and skips agc_driver_multisample_centered_lines (no VK_EXT_sample_locations at 4 samples). Centered lines cover 27/36 pixels (list/strip) on the RTX 3090 and 27/35 on RADV, each in all four samples, and match the one-sample references at all 229 compared pixels. With main 7ab4b2e56's State.cpp, the centered-lines test fails 3/3 on both GPUs with the refusal quoted above. The line-strip rows above came from that run.

  • In the title (@mrfelek, Linux, RTX 3080 Ti, NVIDIA 615.71.09, main cecb540a6 + #7803 9ac1a20ce + this PR 593f4ab86, without local changes): Peace Walker plays through the logos, intro, title screen and New Game into the beach tutorial at about 60 FPS. The log has no points, lines or alpha-to-coverage refusal and no other driver error, and with neither #6801 nor #7869 in that build no point draw was refused either.

  • Linux, RTX 4090 (NVIDIA 610.57.04), by @oneandonlydean on 593f4ab868: the six focused tests pass 3 of 3, centered lines cover 27 and 36 pixels with 0 of 229 differing, and with main 2c4b116da9's State.cpp the same three tests fail as in the red run above.

  • Not tested: NVIDIA and other drivers on Windows, and the console. 8e5e1682 also drops the point refusal; points rasterized in this state are refused here (a geometry program's point output since #8856, and #6801's vertex-path points), while #7869's point polygon mode passes this check (see Overlaps).

Overlaps:

  • #6801 (feat(agc): rasterize geometry points with their point size) makes a vertex-path point list drawable; a geometry program's point output already is on main since #8856, and RasterPrimitiveOf returns a point for both. This check refuses both in this state: on main the vertex-path list throws earlier and the geometry output from a triangle list is drawn.
  • #7869 (feat(agc): draw point and line polygon modes) decodes the polygon mode after this check, and RasterPrimitiveOf does not read it, so a triangle draw with a point polygon mode passes this check and is drawn as one-pixel points with every sample at the pixel center. It would be refused only if the polygon mode were decoded before this check and RasterPrimitiveOf read it. main's refusal, which reads VGT_PRIMITIVE_TYPE, lets it through as well. A line polygon mode is drawn as lines are after this PR.
  • #8395 (fix(agc): decode a fast-launch draw as one point per subgroup whatever its input type) lets a fast-launch draw carry any VGT_PRIMITIVE_TYPE. This check judges such a draw by the primitive its program outputs (triangles and lines are drawn, points refused), so its input type does not change the outcome; with main's refusal, a point-list type would be refused and a triangle-strip type drawn for the same program.
  • #7729 has landed and this head is rebased over it (above). #8121 rewrites the PS_ITER_SAMPLE sentence of the one-sample target entry this PR edits, #8424 changes the entry right before it and #7978 the entry right after the rewritten one; whichever lands second needs a one-line rebase. pr_overlap.py finds no textual overlap with #6801, #7869 or #8395.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: PPSA18216 #5268
  • GPUs tested: AMD Radeon RX 6700 XT (gfx1031), driver 32.0.21045.16010 (earlier runs 32.0.21045.5002), Windows 11 26200
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4946105288 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8871). Originally posted by [thuanquang](https://github.com/thuanquang) on 2026-10-21T03:49:50Z. --- ### What Before: a line list or strip (`VGT_PRIMITIVE_TYPE` 2 or 3) drawn with `PA_SC_AA_CONFIG.MSAA_NUM_SAMPLES` > 0 and `PA_SC_MODE_CNTL_0.MSAA_ENABLE` clear threw `AGC graphics: multisampled targets rasterized without MSAA_ENABLE are unsupported for points, lines or alpha-to-coverage`. METAL GEAR SOLID: Peace Walker (PPSA18216) draws line lists and strips into its 4x target this way: mrfelek's in-game run ([#5268 comment](https://github.com/boykopovar/AnyPS5/discussions/5268#discussioncomment-19002746), row "local: lines") needed a local change that drops this refusal ([8e5e1682](https://github.com/mrfelek/AnyPS5/commit/8e5e1682027e935912c17a7a4e9363c0a4a8390e), the `State.cpp` hunk, which keeps only the alpha-to-coverage condition). The title reaches these draws only past the opening movie's 2D read of the 4x target (#7803, or mrfelek's local resolve). After: such lines take the path triangles and rectangles already take in this state (#5882, #6014, #6196): the target's sample count with every sample at the pixel center. Under a one-sample color target (PPSA18216's draw C) the line is drawn as a one-sample line, as with a 1x `PA_SC_AA_CONFIG`. The refusal now reads the primitive the draw rasterizes (`RasterPrimitiveOf`) instead of `VGT_PRIMITIVE_TYPE`: a point list that a geometry program turns into triangles or lines decodes as those triangles or lines with every sample at the pixel center, and rasterized points and alpha-to-coverage still throw. A one-sample depth target under this configuration, and a single-sample scan into a multisampled depth target, still refuse line and point lists (`VGT_PRIMITIVE_TYPE` 1-3). One draw class goes from drawn to refused ([found by @oneandonlydean](https://github.com/boykopovar/AnyPS5/pull/8871#issuecomment-6325978746)). Since #8856 (ee81c5112d, in this base) a geometry program's point output is drawable ([`State.cpp` L1094](https://github.com/boykopovar/AnyPS5/blob/2c4b116da9759fd8950493d2da2126ec891a22a6/core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp#L1094) accepts `VGT_GS_OUT_PRIM_TYPE` 0), and `main`'s refusal here reads `VGT_PRIMITIVE_TYPE`, so a geometry program that makes points from a triangle list into a multisampled target with `MSAA_ENABLE` clear is drawn on `main` and refused by this change, which reads the rasterized primitive. Rasterized points stay refused in this state on purpose: the evidence below covers lines only, and what the console rasterizes for a point under a multisampled configuration without `MSAA_ENABLE` is not measured. A point or line list into such a geometry program was already refused on `main`, and a vertex-path point list still throws earlier ([L1221](https://github.com/boykopovar/AnyPS5/blob/2c4b116da9759fd8950493d2da2126ec891a22a6/core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp#L1221), `point-list vertex rendering requires point-size output support`). ### Why every sample of a covered pixel (not measured on a PS5) - AMD's [Evergreen 3D register reference](https://www.x.org/docs/AMD/old/evergreen_3D_registers_v2.pdf) (`PA_SC_MODE_CNTL_0`) describes `MSAA_ENABLE` as "Enable MultiSample AA in DX10 and below. Used for lines in DX10.1 and above" (also quoted in #5882), i.e. the bit is D3D's `MultisampleEnable` for lines. - D3D11.3 §15.14.1 ([DirectX-Specs f37b0d60, L13705-L13706](https://github.com/microsoft/DirectX-Specs/blob/f37b0d6033a184bd716e4483e9a8fb192f1e63c7/d3d/archive/D3D11_3_FunctionalSpec.htm#L13705-L13706)): "Regardless of what the MSAA sample count is, when the MultisampleEnable state is false, the Pixel Shader executes based on non-MSAA rasterization rules for aliased or alpha-based AA lines. This means that when the line covers a pixel, ... all of the MSAA samples in the pixel are hit." - GL with `MULTISAMPLE` disabled rasterizes every primitive as single-sample with full coverage ([ARB_multisample L185-L190](https://github.com/KhronosGroup/OpenGL-Registry/blob/6af574a14089ccfee87efe230ebcdd8742859813/extensions/ARB/ARB_multisample.txt#L185-L190)). radeonsi programmed exactly this register state for it, `PA_SC_AA_CONFIG` at the framebuffer's sample count with `MSAA_ENABLE` = 0 ([si_state.c at 7bb3d6ac, L926-L933](https://gitlab.freedesktop.org/mesa/mesa/-/blob/7bb3d6acec6c3829a01c0302ea970bd158b9c7f3/src/gallium/drivers/radeonsi/si_state.c#L926-L933), [L3482-L3525](https://gitlab.freedesktop.org/mesa/mesa/-/blob/7bb3d6acec6c3829a01c0302ea970bd158b9c7f3/src/gallium/drivers/radeonsi/si_state.c#L3482-L3525)), until [ea5b7de1](https://gitlab.freedesktop.org/mesa/mesa/-/commit/ea5b7de138bb7e9a4e7e4f0c39c4ceb16acae923) (2019) zeroed `PA_SC_AA_CONFIG` there so that `gl_SampleMaskIn` reads 1. - On the host every sample point is at the pixel center, so each pixel is covered whole or not at all whatever line rule the host uses: Vulkan sets the coverage bit of each sample point inside a line's rectangle or parallelogram ([primsrast.adoc at 193ebe19, L2911-L2912](https://github.com/KhronosGroup/Vulkan-Docs/blob/193ebe195f47ffc5004683d1659e71c725658c4d/chapters/primsrast.adoc#L2911-L2912), [L3010-L3011](https://github.com/KhronosGroup/Vulkan-Docs/blob/193ebe195f47ffc5004683d1659e71c725658c4d/chapters/primsrast.adoc#L3010-L3011)), and Bresenham lines "cover all samples in those pixels" ([L3200-L3202](https://github.com/KhronosGroup/Vulkan-Docs/blob/193ebe195f47ffc5004683d1659e71c725658c4d/chapters/primsrast.adoc#L3200-L3202)). On #5882's reason for keeping lines refused ("an aliased line on the hardware is not a Vulkan rectangular line"): `main` already draws every one-sample line list and strip with the host's line rule (debt entry "Line-strip geometry output": 1 pixel wide, `PA_SU_LINE_CNTL` not read, the console's line rules not measured), and already draws lines into a multisampled color target with every sample at the pixel center when `PA_SC_AA_CONFIG` is 1x (the "draw raised to a multisampled target" branch, [`State.cpp` L1314](https://github.com/boykopovar/AnyPS5/blob/b85d972f4208d4821a994c8d94eb3d7b78561ecd/core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp#L1314), has no topology check). With every sample at the center, a 4x line list and a 4x line strip cover the pixels the host's one-sample lines cover (measured below), so this adds no difference that one-sample lines do not already have. ### How - `State.cpp`: the refusal in the `MSAA_NUM_SAMPLES > 0` / `MSAA_ENABLE` clear block tests `RasterPrimitiveOf(result)` (a rectangle for a rect list, the output primitive of a geometry or mesh program, triangles for tessellation, else the topology) instead of the topology, and keeps points and alpha-to-coverage. `DecodeState` decodes the shader stages (L1140) and the topology (L1143-L1166) before this check (L1222), so the check sees a geometry program's output and did not have to move. Line lists and strips reach the existing pixel-center code. - `tests/Graphics.cpp`: draw B with `VGT_PRIMITIVE_TYPE` 2 and 3 decodes as lines into the 4x depth and color pair with every sample at the pixel center and passes the precheck; draw C with 2 and 3 decodes as one sample; a point list into a geometry program that outputs triangle strips (`VGT_GS_OUT_PRIM_TYPE` 2) now decodes as triangles (`RasterPrimitiveOf` = triangle) into the same 4x pair with every sample at the pixel center, where `main` threw; the three alpha-to-coverage rows take the new message; a triangle, line and point list (`VGT_PRIMITIVE_TYPE` 4, 2 and 1) into a geometry program that outputs points (`VGT_GS_OUT_PRIM_TYPE` 0) into the same 4x pair are refused with this check's message (the triangle-list row decodes on `main`); the one-sample depth target rows (`msaaEnableClearOneSampleTargetTests`) refuse a line strip (`VGT_PRIMITIVE_TYPE` 3) as well as a line list, without and with a one-sample color target. - `tests/execution/MultisampleCenteredLines.cpp` (new GPU test, `agc_driver_multisample_centered_lines`): builds the registers of a line list and of a line strip (`VGT_PRIMITIVE_TYPE` 2 and 3, `PA_SC_AA_CONFIG` 0x0020c002, `PA_SC_MODE_CNTL_0` 2, a 16x16 4x RGBA16F `CB_COLOR0`, no depth target), decodes them with `DecodeState`, checks that the decoded state has 4 samples all at the pixel center, and draws exactly that state; it then draws the same decoded state into a one-sample RGBA8 target. It loads every sample and requires every pixel to be covered in all 4 samples or none, every pixel the one-sample lines draw away from the endpoints to be covered in the 4x target, and the 4x target to cover at least 20 pixels and at most twice as many as the one-sample lines. It prints how many pixels away from the endpoints differ: Vulkan lets a non-strict host use another line rule at one sample than at four, so equality is reported, not required. It skips without `shaderStorageImageMultisample` or `VK_EXT_sample_locations` at 4 samples. On `main`, `DecodeState` throws the refusal quoted above, so the test fails there (RED below). - Debt: the entry "A multisampled target rasterized without MSAA_ENABLE" is rewritten gap-first (2025 -> 998 characters) and keeps what each title draws (PPSA06888 a 2x target, PPSA18216 a 4x depth and color pair and 4x lines); it now says rasterized points throw. In the entry "A one-sample target under a multisampled rasterizer without MSAA_ENABLE" only the points and lines statement changes (line and point lists, `VGT_PRIMITIVE_TYPE` 1-3, move to what a one-sample depth target refuses). That statement now also says a one-sample depth target's line and point lists throw even when a geometry program turns them into triangles: that block still reads the topology, while the 4x pair decodes such a draw. That entry has 3275 characters on `main` since #7729 rewrote its `PS_ITER_SAMPLE` sentences, and 3371 with this change. Changing only these two statements keeps the rebase small for #8121, which rewrites the same entry, where cutting the entry here would turn it into a rewrite. Not changed: rasterized points stay refused (mrfelek's title run below hit no point refusal), except that a geometry program's points from a triangle list, drawn on `main` since #8856, are now refused as well (above); `PA_SC_LINE_CNTL` and `PA_SU_LINE_CNTL` stay unread, as for one-sample lines. ### Tested Windows 11 26200, MinGW-w64 GCC 15.2.0 (WinLibs), Release build, AMD Radeon RX 6700 XT (gfx1031, driver 32.0.21045.16010, installed 2026-10-21 22:00; runs before that used 32.0.21045.5002). This branch is one commit (`0efe28a839`) on `main` `2c4b116da9`. It is `593f4ab868` (rebased after #7729 merged) with oneandonlydean's review applied: the three geometry point rows and the debt clause, no source change. On `0efe28a839` the six focused tests pass 3 of 3; with the point term dropped, `agc_driver_graphics` fails at the first new row (controls below); with `main` `2c4b116da9`'s `State.cpp`, the triangle-list row decodes, so `agc_driver_graphics` fails with `expected graphics rejection: multisampled targets rasterized without MSAA_ENABLE are unsupported for points or alpha-to-coverage` (run with that row moved first in its function, so that `main`'s line refusal does not stop the test before it). The validation layer run below is on `593f4ab868`: `State.cpp` is the same, and the new rows only decode state in `agc_driver_graphics`, which creates no Vulkan instance. `593f4ab868` was rebased after #7729 merged. The one conflict was the debt entry "A one-sample target under a multisampled rasterizer without MSAA_ENABLE", where #7729 rewrote the `PS_ITER_SAMPLE` sentences; this change still edits only its two points-and-lines statements. On `593f4ab868` the six focused tests below pass 3 of 3, and the validation layer run (A: `main` `2c4b116da9`, the five that exist there; B: this head, all six) has no `VUID-` line and no `was not found but was requested`; the centered-lines test prints the same 27 and 35 pixels as below. Before that, the branch was one commit (5fa781bbc) on `main` 7ab4b2e56. RED and the controls below ran on the same change on `main` b85d972f4. After rebasing, GREEN and the validation run were repeated on 5ac77fd50, which is 0f8e9be7d without its last debt-sentence edit. 5fa781bbc is 0f8e9be7d with the line-strip rows of the one-sample depth target refusal added after review (no source change); `agc_driver_graphics` passes 3 of 3 with them. The focused tests are `agc_driver_graphics`, `agc_driver_multisample_centered_lines`, `agc_driver_sample_multisample_target`, `agc_driver_native_msaa_vertex_input`, `agc_driver_msaa_enable_single_sample` and `agc_driver_covered_centroid_state`. - RED, `main` b85d972f4's `State.cpp` with this PR's tests, `ctest -V` on the six tests: 3 of 6 fail. `agc_driver_graphics` and `agc_driver_multisample_centered_lines` fail with `AGC graphics: multisampled targets rasterized without MSAA_ENABLE are unsupported for points, lines or alpha-to-coverage`; `agc_driver_covered_centroid_state` fails with `AGC graphics: unexpected failure: AGC graphics: multisampled targets rasterized without MSAA_ENABLE are unsupported for points, lines or alpha-to-coverage` (its alpha-to-coverage row expects this PR's message). The other three pass. - GREEN, this branch, `ctest --test-dir build -R '^(agc_driver_graphics|agc_driver_multisample_centered_lines|agc_driver_sample_multisample_target|agc_driver_native_msaa_vertex_input|agc_driver_msaa_enable_single_sample|agc_driver_covered_centroid_state)$' -V`: 6/6 pass in each of three runs, and the new test prints in every run: ``` VGT_PRIMITIVE_TYPE 2: 4x lines with every sample at the pixel center covered 27 pixels in full and none in part; the one-sample lines drew 27; 0 of the 229 pixels away from the endpoints differ VGT_PRIMITIVE_TYPE 3: 4x lines with every sample at the pixel center covered 35 pixels in full and none in part; the one-sample lines drew 35; 0 of the 229 pixels away from the endpoints differ ``` - Controls on this branch, each reverted after its run (`agc_driver_graphics`, `agc_driver_covered_centroid_state` and `agc_driver_multisample_centered_lines` for the first three): - The refusal reduced to `!result.alphaToCoverage`, the condition 8e5e1682 keeps (the point term dropped, this PR's message kept): `agc_driver_graphics` fails at the first new geometry point row (triangle-list input) with `expected graphics rejection: multisampled targets rasterized without MSAA_ENABLE are unsupported for points or alpha-to-coverage` (on 0efe28a839; before that row existed, all three passed, so the point term had no test that could fail). - The alpha-to-coverage term dropped, the point term kept: `agc_driver_graphics` fails at draw B with `DB_ALPHA_TO_MASK` 0xaa01 with `expected graphics rejection: multisampled targets rasterized without MSAA_ENABLE are unsupported for points or alpha-to-coverage`, and `agc_driver_covered_centroid_state` at its 2x row with `expected graphics rejection: without MSAA_ENABLE are unsupported for points or alpha-to-coverage`. - The whole refusal removed, alpha-to-coverage included: the same two failures with the same messages. - The new test's decoded 4x state drawn with the standard 4x sample positions (`customSampleLocations` cleared): it fails with `AGC graphics: VGT_PRIMITIVE_TYPE 2: pixel (5, 1) has 1 of its 4 samples covered by a line with every sample at the pixel center`. - A row added for one run and not committed: the geometry draw of `tests/Graphics.cpp` with `VGT_GS_OUT_PRIM_TYPE` 1 (a line strip) instead of 2 decodes as lines (`RasterPrimitiveOf` = line) with every sample at the pixel center; `agc_driver_graphics` passes with it. - Khronos validation layer A/B (`VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1`, `ctest --test-dir build -R <the six tests> -V`), same machine and GPU: | Tree | Tests | Result | `VUID-` lines | |---|---|---|---| | `main` b85d972f4 | the five that exist on `main` | 5/5 pass | 0 | | `main` b85d972f4's `State.cpp` with this PR's tests | the six | 3 fail as in RED, 3 pass | 0 | | this branch 779846528 (on b85d972f4) | the six | 6/6 pass | 0 | | `main` 7ab4b2e56 | the five that exist on `main` | 5/5 pass | 0 | | this branch 5ac77fd50 (on 7ab4b2e56) | the six | 6/6 pass | 0 | No log contains `was not found but was requested`. Runs with `VK_LOADER_DEBUG=layer` show `Insert instance layer "VK_LAYER_KHRONOS_validation"` for `agc_driver_native_msaa_vertex_input`, `agc_driver_msaa_enable_single_sample` (twice) and `agc_driver_sample_multisample_target` on `main` and on this branch, and for `agc_driver_multisample_centered_lines` on this branch; `agc_driver_graphics` and `agc_driver_covered_centroid_state` create no Vulkan instance. - `python tools/check_conventions.py --base origin/main`, also with this title and body: `docs/dev/debt/libSceAgcDriver.md:34: warning: [debt-length] ... 3371 characters`; that entry already has 3275 on `main`, and this PR changes two statements of it (see How); no other finding. - `python tools/pr_overlap.py --branch fix/msaa-enable-clear-lines`: conflicts only in `docs/dev/debt/libSceAgcDriver.md`, with #7729 (L27), #8121 (L27), #8424 (L26-27) and #7978 (L29-30); none in `State.cpp` or `tests/Graphics.cpp`. It could not compare 45 open PRs that conflict with `main`; none of their changed lines in these three files mention `MSAA_ENABLE`, `RasterPrimitiveOf`, the `msaaEnableClear` tests or this refusal. - Linux, by [@simonbbby](https://github.com/boykopovar/AnyPS5/pull/8871#issuecomment-6308027342) on 0f8e9be7d (Ubuntu 24.04.3, GCC 13.3, Release, `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`, three serial rounds per ICD): the six tests pass on an RTX 3090 (595.99.02) and on gfx1036 with RADV (Mesa 25.2.8); lavapipe passes five and skips `agc_driver_multisample_centered_lines` (no `VK_EXT_sample_locations` at 4 samples). Centered lines cover 27/36 pixels (list/strip) on the RTX 3090 and 27/35 on RADV, each in all four samples, and match the one-sample references at all 229 compared pixels. With `main` 7ab4b2e56's `State.cpp`, the centered-lines test fails 3/3 on both GPUs with the refusal quoted above. The line-strip rows above came from that run. - In the title ([@mrfelek](https://github.com/boykopovar/AnyPS5/pull/8871#issuecomment-6321558359), Linux, RTX 3080 Ti, NVIDIA 615.71.09, `main` `cecb540a6` + #7803 `9ac1a20ce` + this PR `593f4ab86`, without local changes): Peace Walker plays through the logos, intro, title screen and New Game into the beach tutorial at about 60 FPS. The log has no `points, lines or alpha-to-coverage` refusal and no other driver error, and with neither #6801 nor #7869 in that build no point draw was refused either. - Linux, RTX 4090 (NVIDIA 610.57.04), by [@oneandonlydean](https://github.com/boykopovar/AnyPS5/pull/8871#issuecomment-6325978746) on 593f4ab868: the six focused tests pass 3 of 3, centered lines cover 27 and 36 pixels with 0 of 229 differing, and with `main` 2c4b116da9's `State.cpp` the same three tests fail as in the red run above. - Not tested: NVIDIA and other drivers on Windows, and the console. 8e5e1682 also drops the point refusal; points rasterized in this state are refused here (a geometry program's point output since #8856, and #6801's vertex-path points), while #7869's point polygon mode passes this check (see Overlaps). Overlaps: - #6801 (feat(agc): rasterize geometry points with their point size) makes a vertex-path point list drawable; a geometry program's point output already is on `main` since #8856, and `RasterPrimitiveOf` returns a point for both. This check refuses both in this state: on `main` the vertex-path list throws earlier and the geometry output from a triangle list is drawn. - #7869 (feat(agc): draw point and line polygon modes) decodes the polygon mode after this check, and `RasterPrimitiveOf` does not read it, so a triangle draw with a point polygon mode passes this check and is drawn as one-pixel points with every sample at the pixel center. It would be refused only if the polygon mode were decoded before this check and `RasterPrimitiveOf` read it. `main`'s refusal, which reads `VGT_PRIMITIVE_TYPE`, lets it through as well. A line polygon mode is drawn as lines are after this PR. - #8395 (fix(agc): decode a fast-launch draw as one point per subgroup whatever its input type) lets a fast-launch draw carry any `VGT_PRIMITIVE_TYPE`. This check judges such a draw by the primitive its program outputs (triangles and lines are drawn, points refused), so its input type does not change the outcome; with `main`'s refusal, a point-list type would be refused and a triangle-strip type drawn for the same program. - #7729 has landed and this head is rebased over it (above). #8121 rewrites the `PS_ITER_SAMPLE` sentence of the one-sample target entry this PR edits, #8424 changes the entry right before it and #7978 the entry right after the rewritten one; whichever lands second needs a one-line rebase. pr_overlap.py finds no textual overlap with #6801, #7869 or #8395. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: PPSA18216 #5268 - [x] GPUs tested: AMD Radeon RX 6700 XT (gfx1031), driver 32.0.21045.16010 (earlier runs 32.0.21045.5002), Windows 11 26200 - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-21 04:13:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T04:13:07Z.

Code review location: core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp; line 1223

@@ -1219,8 +1219,7 @@ State DecodeState(const QueueState& queue, bool vertexWorkgroup) {
         result.sampleLocationGrid = false;
     }
     if (result.samples > 1 && (read(cx, 0x292) & 1u) == 0) {
-        const bool filled = result.topology != VK_PRIMITIVE_TOPOLOGY_POINT_LIST && result.topology != VK_PRIMITIVE_TOPOLOGY_LINE_LIST && result.topology != VK_PRIMITIVE_TOPOLOGY_LINE_STRIP;
-        Require(filled && !result.alphaToCoverage, "multisampled targets rasterized without MSAA_ENABLE are unsupported for points, lines or alpha-to-coverage");

The new line coverage tests exercise a one-sample color target and a four-sample depth/color pair. This guard now permits line primitives for every multisampled-rasterizer state with MSAA_ENABLE clear, including the one-sample depth target case; the debt entry still says line lists/strips with a one-sample depth target throw, and there is no corresponding execution case here. Is extending the line rule to that depth-target combination intentional and supported by evidence? If so, could the test and debt entry cover/update it; otherwise the guard needs to preserve the refusal for that case.

<!-- greyfinch-sync:boykopovar/AnyPS5:review-comment:4332962180 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8871#discussion_r4332962180). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-21T04:13:07Z. **Code review location:** `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`; line 1223 ~~~~diff @@ -1219,8 +1219,7 @@ State DecodeState(const QueueState& queue, bool vertexWorkgroup) { result.sampleLocationGrid = false; } if (result.samples > 1 && (read(cx, 0x292) & 1u) == 0) { - const bool filled = result.topology != VK_PRIMITIVE_TOPOLOGY_POINT_LIST && result.topology != VK_PRIMITIVE_TOPOLOGY_LINE_LIST && result.topology != VK_PRIMITIVE_TOPOLOGY_LINE_STRIP; - Require(filled && !result.alphaToCoverage, "multisampled targets rasterized without MSAA_ENABLE are unsupported for points, lines or alpha-to-coverage"); ~~~~ --- The new line coverage tests exercise a one-sample color target and a four-sample depth/color pair. This guard now permits line primitives for every multisampled-rasterizer state with MSAA_ENABLE clear, including the one-sample depth target case; the debt entry still says line lists/strips with a one-sample depth target throw, and there is no corresponding execution case here. Is extending the line rule to that depth-target combination intentional and supported by evidence? If so, could the test and debt entry cover/update it; otherwise the guard needs to preserve the refusal for that case.
simonbbby commented 2026-10-21 04:26:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by simonbbby on 2026-10-21T04:26:21Z.


Linux check of exact head 0f8e9be7d30ed7e5e289f5c0e9a750306dea6a65, including the one-sample-depth boundary raised in review:

  • The existing msaaEnableClearOneSampleTargetTests still rejects a line list into a one-sample depth target, both depth-only and with a color target. I temporarily expanded that case from primitive 2 to {2u, 3u}: agc_driver_graphics_tests passes 3/3, confirming the line-strip refusal too. This is decoder/refusal coverage; no unsupported one-sample-depth line was executed.
  • Six focused CTest entries, three serial rounds per ICD: agc_driver_graphics, agc_driver_covered_centroid_state, agc_driver_native_msaa_vertex_input, agc_driver_msaa_enable_single_sample, agc_driver_sample_multisample_target, and agc_driver_multisample_centered_lines. RTX 3090 and gfx1036/RADV each pass all six in every round. Lavapipe passes five and skips centered lines in every round because it has no VK_EXT_sample_locations at four samples.
  • Centered lines: RTX 3090 covers 27/36 pixels for list/strip; RADV covers 27/35. Every covered pixel has all four samples covered, none partially covered; both match their one-sample references at all 229 compared pixels away from endpoints.
  • Keeping the PR's tests and restoring only State.cpp from parent main 7ab4b2e5610c3d4328c83566cba488eb82972c9c makes centered lines fail 3/3 on each physical GPU with multisampled targets rasterized without MSAA_ENABLE are unsupported for points, lines or alpha-to-coverage. Restoring the exact PR source, rebuilding and rerunning makes both pass again. The temporary test extension was removed; checkout is clean.

Ubuntu 24.04.3, GCC 13.3, Release; NVIDIA RTX 3090 / 595.99.02; AMD gfx1036 (1002:13c0) / RADV Mesa 25.2.8; lavapipe LLVM 20.1.2 / Mesa 25.2.8. ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1. Khronos validation is unavailable on this host, so this does not supply the validation-layer A/B. No title execution or PS5 line-rule measurement is claimed.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6308027342 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8871#issuecomment-6308027342). Originally posted by [simonbbby](https://github.com/simonbbby) on 2026-10-21T04:26:21Z. --- Linux check of exact head `0f8e9be7d30ed7e5e289f5c0e9a750306dea6a65`, including the one-sample-depth boundary raised in review: - The existing `msaaEnableClearOneSampleTargetTests` still rejects a line list into a one-sample depth target, both depth-only and with a color target. I temporarily expanded that case from primitive `2` to `{2u, 3u}`: `agc_driver_graphics_tests` passes 3/3, confirming the line-strip refusal too. This is decoder/refusal coverage; no unsupported one-sample-depth line was executed. - Six focused CTest entries, three serial rounds per ICD: `agc_driver_graphics`, `agc_driver_covered_centroid_state`, `agc_driver_native_msaa_vertex_input`, `agc_driver_msaa_enable_single_sample`, `agc_driver_sample_multisample_target`, and `agc_driver_multisample_centered_lines`. RTX 3090 and gfx1036/RADV each pass all six in every round. Lavapipe passes five and skips centered lines in every round because it has no `VK_EXT_sample_locations` at four samples. - Centered lines: RTX 3090 covers 27/36 pixels for list/strip; RADV covers 27/35. Every covered pixel has all four samples covered, none partially covered; both match their one-sample references at all 229 compared pixels away from endpoints. - Keeping the PR's tests and restoring only `State.cpp` from parent main `7ab4b2e5610c3d4328c83566cba488eb82972c9c` makes centered lines fail 3/3 on each physical GPU with `multisampled targets rasterized without MSAA_ENABLE are unsupported for points, lines or alpha-to-coverage`. Restoring the exact PR source, rebuilding and rerunning makes both pass again. The temporary test extension was removed; checkout is clean. Ubuntu 24.04.3, GCC 13.3, Release; NVIDIA RTX 3090 / 595.99.02; AMD gfx1036 (`1002:13c0`) / RADV Mesa 25.2.8; lavapipe LLVM 20.1.2 / Mesa 25.2.8. `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`. Khronos validation is unavailable on this host, so this does not supply the validation-layer A/B. No title execution or PS5 line-rule measurement is claimed.
thuanquang commented 2026-10-21 05:50:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by thuanquang on 2026-10-21T05:50:51Z.

Code review location: core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp; line 1223

@@ -1219,8 +1219,7 @@ State DecodeState(const QueueState& queue, bool vertexWorkgroup) {
         result.sampleLocationGrid = false;
     }
     if (result.samples > 1 && (read(cx, 0x292) & 1u) == 0) {
-        const bool filled = result.topology != VK_PRIMITIVE_TOPOLOGY_POINT_LIST && result.topology != VK_PRIMITIVE_TOPOLOGY_LINE_LIST && result.topology != VK_PRIMITIVE_TOPOLOGY_LINE_STRIP;
-        Require(filled && !result.alphaToCoverage, "multisampled targets rasterized without MSAA_ENABLE are unsupported for points, lines or alpha-to-coverage");

It isn't extended to that case. A one-sample depth target is handled before this guard, in the depthKeepsSampleZero block (State.cpp L1210-L1220), and this PR doesn't change that block. Its filled term rejects POINT_LIST, LINE_LIST and LINE_STRIP with a one-sample depth target under a multisampled rasterizer without MSAA_ENABLE is unsupported for points or lines .... Otherwise it sets result.samples = 1. Either way a one-sample-depth draw never reaches this guard, which only runs for result.samples > 1. The guard only changes the case where the target and the rasterizer have the same sample count.

msaaEnableClearOneSampleTargetTests already covered the line list, both depth-only and with a one-sample color target. 5fa781bbc adds the line strip (VGT_PRIMITIVE_TYPE 3) to the same rows. That's the extension @simonbbby ran on Linux (3/3), and agc_driver_graphics passes 3/3 with it here too (RX 6700 XT). The debt entry still says line and point lists (VGT_PRIMITIVE_TYPE 1-3) into a one-sample depth target throw, and that is still the behavior, so the entry is unchanged. There's no execution case because these draws throw before anything is drawn. The PR body now says the same.

<!-- greyfinch-sync:boykopovar/AnyPS5:review-comment:4333468189 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8871#discussion_r4333468189). Originally posted by [thuanquang](https://github.com/thuanquang) on 2026-10-21T05:50:51Z. **Code review location:** `core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp`; line 1223 ~~~~diff @@ -1219,8 +1219,7 @@ State DecodeState(const QueueState& queue, bool vertexWorkgroup) { result.sampleLocationGrid = false; } if (result.samples > 1 && (read(cx, 0x292) & 1u) == 0) { - const bool filled = result.topology != VK_PRIMITIVE_TOPOLOGY_POINT_LIST && result.topology != VK_PRIMITIVE_TOPOLOGY_LINE_LIST && result.topology != VK_PRIMITIVE_TOPOLOGY_LINE_STRIP; - Require(filled && !result.alphaToCoverage, "multisampled targets rasterized without MSAA_ENABLE are unsupported for points, lines or alpha-to-coverage"); ~~~~ --- It isn't extended to that case. A one-sample depth target is handled before this guard, in the `depthKeepsSampleZero` block ([State.cpp L1210-L1220](https://github.com/thuanquang/AnyPS5/blob/5fa781bbcb533ae2d9f703c5cd6c6fd9561036c5/core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp#L1210-L1220)), and this PR doesn't change that block. Its `filled` term rejects `POINT_LIST`, `LINE_LIST` and `LINE_STRIP` with `a one-sample depth target under a multisampled rasterizer without MSAA_ENABLE is unsupported for points or lines ...`. Otherwise it sets `result.samples = 1`. Either way a one-sample-depth draw never reaches this guard, which only runs for `result.samples > 1`. The guard only changes the case where the target and the rasterizer have the same sample count. `msaaEnableClearOneSampleTargetTests` already covered the line list, both depth-only and with a one-sample color target. 5fa781bbc adds the line strip (`VGT_PRIMITIVE_TYPE` 3) to the same rows. That's the extension @simonbbby ran on Linux (3/3), and `agc_driver_graphics` passes 3/3 with it here too (RX 6700 XT). The debt entry still says line and point lists (`VGT_PRIMITIVE_TYPE` 1-3) into a one-sample depth target throw, and that is still the behavior, so the entry is unchanged. There's no execution case because these draws throw before anything is drawn. The PR body now says the same.
mrfelek commented 2026-10-21 16:52:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mrfelek on 2026-10-21T16:52:42Z.


Peace Walker reaches the beach tutorial with main + #7803 + this PR, without my local changes.

Linux (Ubuntu 26.10, kernel 7.3), Ryzen 9 5950X, RTX 3080 Ti 12 GB (NVIDIA 615.71.09), Release
main cecb540a6 + #7803 9ac1a20ce + #8871 593f4ab86, merged locally without conflicts
PPSA18216 relinked with --executable mgspw/mgspw.elf --module-dir Media/Modules --module-dir Media/Plugins
Game settings untouched; APS5_HOST_IMPORT_MIB=16384
  • Played by hand: logos, intro, title screen, New Game, then into the beach tutorial ("To move your line of sight, use R").
  • The log has no "points, lines or alpha-to-coverage" refusal and no other driver error. Without #6801 or #7869 in the build, no point draw was refused either.
  • The frame counter in the window title shows about 60 FPS in the tutorial.

AI-assisted; the runs are from my machine(s).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6321558359 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8871#issuecomment-6321558359). Originally posted by [mrfelek](https://github.com/mrfelek) on 2026-10-21T16:52:42Z. --- **Peace Walker reaches the beach tutorial with `main` + #7803 + this PR, without my local changes.** ``` Linux (Ubuntu 26.10, kernel 7.3), Ryzen 9 5950X, RTX 3080 Ti 12 GB (NVIDIA 615.71.09), Release main cecb540a6 + #7803 9ac1a20ce + #8871 593f4ab86, merged locally without conflicts PPSA18216 relinked with --executable mgspw/mgspw.elf --module-dir Media/Modules --module-dir Media/Plugins Game settings untouched; APS5_HOST_IMPORT_MIB=16384 ``` - Played by hand: logos, intro, title screen, New Game, then into the beach tutorial ("To move your line of sight, use R"). - The log has no "points, lines or alpha-to-coverage" refusal and no other driver error. Without #6801 or #7869 in the build, no point draw was refused either. - The frame counter in the window title shows about 60 FPS in the tutorial. AI-assisted; the runs are from my machine(s).
oneandonlydean commented 2026-10-21 20:36:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T20:36:07Z.


@thuanquang I checked 593f4ab868 locally on an RTX 4090 (NVIDIA 610.57.04, Linux, Release). The six focused tests pass 3 of 3, and centered lines cover 27 and 36 pixels with 0 of 229 differing. With main 2c4b116da9's State.cpp, the same three tests fail as in your RED. The line change itself looks right to me. Tessellation can't reach this check with points or lines: decode only accepts triangle and quad domains with triangle output.

There's one behaviour change the description doesn't cover. #8856 (merged 20 Oct, ee81c5112d) made point-list geometry output drawable: at this base, State.cpp L1094 accepts VGT_GS_OUT_PRIM_TYPE 0 from a geometry program. So the "No draw on main rasterizes points in this state" paragraph and the #6801 overlap point both rest on the b85d972f4 line (L1016), which no longer refuses this.

That makes one draw class go from drawn to refused. I took your geometry row in msaaEnableClearDepthTests (draw B, 4x depth and color pair, MSAA_ENABLE clear) and set VGT_GS_OUT_PRIM_TYPE (0x29b) to 0, with VGT_PRIMITIVE_TYPE 4, 2 and 1:

State.cpp input 4 (triangle list) input 2 (line list) input 1 (point list)
main 2c4b116da9 decodes: point raster, 4 samples refused refused
this head refused (points or alpha-to-coverage) refused refused

A geometry program that makes points from triangles into such a target is drawn on main today and throws with this PR. Refusing it may be what you want, since rasterized points stay unsupported here. Could you either:

  • say in the description that this case is now refused, and add the input-4 row as a refusal; or
  • keep main's result for it, if you think the pixel-center argument covers points too?

The row also gives the point term a test that can fail. Right now, with the term dropped (Require(!result.alphaToCoverage, ...)), all six tests still pass on this head.

A smaller point, and optional: the one-sample depth block (L1290) still judges points and lines by result.topology. So there, a point list that a geometry program turns into triangles is refused, while the same draw into the 4x pair now decodes. If you'd rather keep this PR to the 4x check, a line in the debt entry would do.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6325978746 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8871#issuecomment-6325978746). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-21T20:36:07Z. --- @thuanquang I checked 593f4ab868 locally on an RTX 4090 (NVIDIA 610.57.04, Linux, Release). The six focused tests pass 3 of 3, and centered lines cover 27 and 36 pixels with 0 of 229 differing. With `main` 2c4b116da9's `State.cpp`, the same three tests fail as in your RED. The line change itself looks right to me. Tessellation can't reach this check with points or lines: decode only accepts triangle and quad domains with triangle output. There's one behaviour change the description doesn't cover. #8856 (merged 20 Oct, ee81c5112d) made point-list geometry output drawable: at this base, `State.cpp` L1094 accepts `VGT_GS_OUT_PRIM_TYPE` 0 from a geometry program. So the "No draw on `main` rasterizes points in this state" paragraph and the `#6801` overlap point both rest on the b85d972f4 line (L1016), which no longer refuses this. That makes one draw class go from drawn to refused. I took your geometry row in `msaaEnableClearDepthTests` (draw B, 4x depth and color pair, MSAA_ENABLE clear) and set `VGT_GS_OUT_PRIM_TYPE` (0x29b) to 0, with `VGT_PRIMITIVE_TYPE` 4, 2 and 1: | `State.cpp` | input 4 (triangle list) | input 2 (line list) | input 1 (point list) | |---|---|---|---| | `main` 2c4b116da9 | decodes: point raster, 4 samples | refused | refused | | this head | refused (`points or alpha-to-coverage`) | refused | refused | A geometry program that makes points from triangles into such a target is drawn on `main` today and throws with this PR. Refusing it may be what you want, since rasterized points stay unsupported here. Could you either: - say in the description that this case is now refused, and add the input-4 row as a refusal; or - keep `main`'s result for it, if you think the pixel-center argument covers points too? The row also gives the point term a test that can fail. Right now, with the term dropped (`Require(!result.alphaToCoverage, ...)`), all six tests still pass on this head. A smaller point, and optional: the one-sample depth block (L1290) still judges points and lines by `result.topology`. So there, a point list that a geometry program turns into triangles is refused, while the same draw into the 4x pair now decodes. If you'd rather keep this PR to the 4x check, a line in the debt entry would do.
thuanquang commented 2026-10-22 03:49:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by thuanquang on 2026-10-22T03:49:54Z.


@oneandonlydean thanks, and thanks for the RTX 4090 run. I took the first option: rasterized points stay refused in this state, now including a geometry program's points from a triangle list, because nothing measures what the console rasterizes for a point there (the line evidence covers lines only). Pushed 0efe28a839, with no source change:

  • msaaEnableClearDepthTests has your rows: a triangle, line and point list (VGT_PRIMITIVE_TYPE 4, 2 and 1) into a geometry program with VGT_GS_OUT_PRIM_TYPE 0 into draw B's 4x pair, all refused with this check's message. With the point term dropped, agc_driver_graphics now fails at the triangle-list row. With main 2c4b116da9's State.cpp that row decodes, as in your table (I moved it first in the function so main's line refusal doesn't stop the test before it).
  • The description now says this draw class goes from drawn to refused. The stale "no draw on main rasterizes points in this state" paragraph and the #6801 overlap now account for #8856, and your run is in Tested.
  • For the one-sample depth block I kept this PR to the 4x check. The debt entry now says a one-sample depth target's line and point lists throw even when a geometry program turns them into triangles.

The six focused tests pass 3 of 3 on 0efe28a839 (RX 6700 XT, Windows).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6332223620 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8871#issuecomment-6332223620). Originally posted by [thuanquang](https://github.com/thuanquang) on 2026-10-22T03:49:54Z. --- @oneandonlydean thanks, and thanks for the RTX 4090 run. I took the first option: rasterized points stay refused in this state, now including a geometry program's points from a triangle list, because nothing measures what the console rasterizes for a point there (the line evidence covers lines only). Pushed 0efe28a839, with no source change: - `msaaEnableClearDepthTests` has your rows: a triangle, line and point list (`VGT_PRIMITIVE_TYPE` 4, 2 and 1) into a geometry program with `VGT_GS_OUT_PRIM_TYPE` 0 into draw B's 4x pair, all refused with this check's message. With the point term dropped, `agc_driver_graphics` now fails at the triangle-list row. With `main` 2c4b116da9's `State.cpp` that row decodes, as in your table (I moved it first in the function so `main`'s line refusal doesn't stop the test before it). - The description now says this draw class goes from drawn to refused. The stale "no draw on `main` rasterizes points in this state" paragraph and the #6801 overlap now account for #8856, and your run is in Tested. - For the one-sample depth block I kept this PR to the 4x check. The debt entry now says a one-sample depth target's line and point lists throw even when a geometry program turns them into triangles. The six focused tests pass 3 of 3 on 0efe28a839 (RX 6700 XT, Windows).
oneandonlydean commented 2026-10-22 04:34:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-22T04:34:22Z.


@thuanquang thanks, that's the answer I was hoping for. I checked 0efe28a839 against the head I tested: the source is unchanged, and the three new rows are what now pin the point term. With only RasterPrimitiveOf(result) != Point dropped from that check, agc_driver_graphics fails with "expected graphics rejection" at the new rows, where on 593f4ab868 the same change passed. The PR passes 3 of 3 merged with current main. The description and the debt line read right to me too.

One small thing, no change needed: the new loop sits after the line-list decode rows, so with main's State.cpp the test stops at a line row before it gets there. The point-term check above covers what the rows are for.

Next I'll run the full workflow on this head, then a no-worse run in the two titles we check every draw change against.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6332785441 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8871#issuecomment-6332785441). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-22T04:34:22Z. --- @thuanquang thanks, that's the answer I was hoping for. I checked 0efe28a839 against the head I tested: the source is unchanged, and the three new rows are what now pin the point term. With only `RasterPrimitiveOf(result) != Point` dropped from that check, `agc_driver_graphics` fails with "expected graphics rejection" at the new rows, where on 593f4ab868 the same change passed. The PR passes 3 of 3 merged with current main. The description and the debt line read right to me too. One small thing, no change needed: the new loop sits after the line-list decode rows, so with `main`'s `State.cpp` the test stops at a line row before it gets there. The point-term check above covers what the rows are for. Next I'll run the full workflow on this head, then a no-worse run in the two titles we check every draw change against.
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!8871
No description provided.