Skip to content

GS/HW: Add two pass and three pass primid AA1.#14429

Draft
TJnotJT wants to merge 1 commit into
PCSX2:masterfrom
TJnotJT:gs-two-pass-aa1
Draft

GS/HW: Add two pass and three pass primid AA1.#14429
TJnotJT wants to merge 1 commit into
PCSX2:masterfrom
TJnotJT:gs-two-pass-aa1

Conversation

@TJnotJT
Copy link
Copy Markdown
Contributor

@TJnotJT TJnotJT commented May 10, 2026

Status: Draft until dump runs completed. Hold merge label until #13754 is merged, as there may be significant conflicts. Needs to be tested on Metal.

Description of Changes

Adds lower accuracy/cost AA1 alternatives to depth feedback:

  • Two pass: first draw interiors, then draw edges on top (with depth masked).
  • Three pass primid: first get interior primids; then draws interiors; then draw edges on top (with depth masked and discard edge pixels overlapped by interior pixels in primid order).

The AA1 setting is changed to an oridinal setting with the following values:

  • Off.
  • Lines Only (default): Enabled for lines only (default since it's expected to have low performance impact).
  • Low: Do triangles with either two pass or one pass (the latter when depth is masked).
  • Medium: Prefer three pass primid triangles.
  • High: Prefer depth feedback triangles.

In some cases, two or three pass will be promoted to depth feedback (e.g. if depth feedback, barriers, or DATE is already used in the same draw).

Thanks to @refractionpcsx2 for discussions and feedback on these methods.

Rationale behind Changes

AA1 with depth feedback is heavy, especially for its often small visual impact. This gives lighter alternatives where accurate AA1 is not required.

So far I haven't found any examples where three pass primid looks significantly different from depth feedback. Two pass can look significantly worse (example below).

Suggested Testing Steps

Use the 'AA1 Accuracy' drop down in Settings>Graphics>Rendering. Recommended to use basic blend and turn off accurate alpha test so that AA1 with depth feedback is not forced on.

Performance comparison would be helpful to make sure the assumed performance ordering actually holds (e.g. three pass is more performant than depth feedback). Three pass may increase render passes significantly, while depth feedback may increase barriers significantly.

Comparison

Example where two pass has significant inaccuracies.

Booting PS2 BIOS... _20220901235528.gs.xz.zip

Low AA1 + basic blend + 2x (edges of boxes look bad)
00716_f00002_fr1_00000_C_32

Medium AA1 + basic blend + 2x
00716_f00002_fr1_00000_C_32

High AA1 + basic blend + 2x
00716_f00002_fr1_00000_C_32

Low AA1 stats (6 frames)

Draw Calls: 1794 (avg 299)
Render Passes: 566 (avg 95)
Barriers: 0 (avg 0)
Copies: 15 (avg 3)

Medium AA1 stats (6 frames)

Draw Calls: 2532 (avg 422)
Render Passes: 998 (avg 167)
Barriers: 0 (avg 0)
Copies: 15 (avg 3)

High AA1 stats (6 frames)

Draw Calls: 4782 (avg 797)
Render Passes: 566 (avg 95)
Barriers: 7452 (avg 1242)
Copies: 15 (avg 3)

Sources of inaccuracy

The two methods seem to have opposite sources of inaccuracy:

  • Two pass: can incorrectly draw edge fragments on top of interior fragments.
  • Three pass: can incorrectly reject fragments that should be drawn on top interior fragments. This can happen because the primid setup pass does not write to the depth buffer, so the written primids may reflect interior fragments that should have failed the depth test.

Did you use AI to help find, test, or implement this issue or feature?

I use AI as a reference, so may have asked relevant questions while developing this.

@GitHub-Khi
Copy link
Copy Markdown

This could revive part of #12391.

Comment thread pcsx2/GS/Renderers/Metal/GSDeviceMTL.mm Outdated
@TJnotJT TJnotJT force-pushed the gs-two-pass-aa1 branch from cfcab5b to f599856 Compare May 11, 2026 23:04
@TJnotJT
Copy link
Copy Markdown
Contributor Author

TJnotJT commented May 11, 2026

This could revive part of #12391.

The BIOS screen happened to be a convenient example for this PR, though it may not be directly related to that issue, since this is primarily focused on graphics performance.

@TJnotJT TJnotJT force-pushed the gs-two-pass-aa1 branch 2 times, most recently from d683086 to 83d43b7 Compare May 12, 2026 01:21
@TJnotJT TJnotJT force-pushed the gs-two-pass-aa1 branch from 83d43b7 to d269e41 Compare May 12, 2026 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants