Skip to content

fix(agc): rasterize a single-sample scan into a multisampled target at the pixel center - #4414

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
AchrafReyani:fix/agc-single-sample-scan-into-msaa-target
Oct 12, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
AchrafReyani:fix/agc-single-sample-scan-into-msaa-target

Conversation

@AchrafReyani

@AchrafReyani AchrafReyani commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What

A draw whose rasterizer is single-sample (PA_SC_AA_CONFIG.MSAA_NUM_SAMPLES = 0) with MSAA_ENABLE off, into a multisampled color target, throws a color target's sample count differs from the rasterizer's.

The hardware supports this combination. radeonsi programs exactly this when GL multisampling is disabled on a multisampled framebuffer: in si_emit_msaa_config (si_state.c, mesa-25.2.0), sc_aa_config stays 0 unless rs->multisample_enable, and MSAA_ENABLE follows state->multisample, while CB_COLORi_ATTRIB keeps the framebuffer's samples. GL defines the result: with MULTISAMPLE disabled, rasterization is single-sample at the fragment center "except that the fragment coverage value is set to full coverage", so every sample gets the pixel's color.

Such a draw now rasterizes the color target's sample count with every sample location at the pixel center (the custom sample locations from #2169), so all samples are covered exactly when the center is. It applies only with no depth target, no alpha-to-coverage and MSAA_ENABLE off, and only when the first written color target is multisampled. Any other mix still throws, and MSAA_ENABLE on keeps #4309's checks.

Title: ProsperoPuzzles (PPSA99006) stops here on main 9bc3623 at its first draw into its 4x target:

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

Register values at that draw (posted on #419): CB_COLOR0_ATTRIB 0x00012000 (4 samples, 4 fragments), PA_SC_AA_CONFIG 0x00000000, PA_SC_MODE_CNTL_0 0x00000022 (MSAA_ENABLE off), no depth. The title renders through blackbearreloaded/ps5-opengl (Mesa gallium on AGC), the same driver family as radeonsi. With this change it gets past that draw and stops at the next one, which samples that 4x image: DescriptorBindingBuilder::Populate multisampled image resources have no descriptor image shape (#3036).

Tested

Windows 11 (26200), RTX 4070, WinLibs GCC 15.2.0 r7, Release, main 9bc3623:

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 in TechnicalDebt
  • 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
  • Unblocks: PPSA99006 ProsperoPuzzles (PPSA99006) on Windows / NVIDIA: MSAA blockers #4427
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

…t the pixel center

With PA_SC_AA_CONFIG at one sample and MSAA_ENABLE off, the hardware scans
each pixel once and gives every sample of a multisampled color target its
result: radeonsi programs exactly this when GL multisampling is disabled on
a multisampled framebuffer (si_emit_msaa_config leaves sc_aa_config 0), and
GL defines it as single-sample rasterization with full coverage. Such a draw
without depth or alpha-to-coverage now rasterizes the target's sample count
with every sample location at the pixel center, which covers all samples
exactly when the center is covered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@xXPBSXx

xXPBSXx commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Windows test (MinGW, local build): PR head merged onto main c567576 without conflicts; agc_driver_graphics (ctest) passes, including the new test from this PR. Not tested: no game run, no other test suites.

AI-assisted (Claude Code).

@xXPBSXx

xXPBSXx commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Correction to my test comment: the base I actually built and tested was main 0ef9dc9, not c567576 (my local upstream/main ref had moved). Result unchanged: clean merge, agc_driver_graphics passes.

AI-assisted (Claude Code).

@oneandonlydean oneandonlydean self-assigned this Oct 12, 2026
@oneandonlydean
oneandonlydean merged commit 3ede42a into boykopovar:main Oct 12, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants