Repository navigation
feat(agc): emulate default eight-sample dithered alpha coverage - #4451
Conversation
|
I ran PR #4451 (head 5a101c5) on Linux with real 8x targets. I also compared its table with native alpha-to-coverage on the chip that the Windows table came from (PCI Setup: 5a101c5 on Native coverage on gfx1036For a plain 8x alpha-to-coverage draw, RADV programs offsets 3,1,0,2 with I turned on
The 34 rows that match everywhere are the all-
So on gfx1036 the DB produces this table at RADV default state: 2x2 coarse shadingOn gfx10.3, RADV turns on 2x2 coarse shading for pixel shaders that allow flat shading (
Emulation on Linux
llvmpipe skips with Undithered 8x#4451 throws
|
| alpha from | mask |
|---|---|
| 0 (and below 1/16) | 00 |
| 1/16 | 10 |
| 1/8 | 04 |
| 3/16 | 14 |
| 1/4 | 12 |
| 5/16 | 32 |
| 3/8 | 16 |
| 7/16 | 36 |
| 1/2 | 35 |
| 9/16 | 75 |
| 5/8 | 3d |
| 11/16 | 7d |
| 3/4 | 77 |
| 13/16 | f7 |
| 7/8 | 7f |
| 15/16 and above | ff |
Not tested
- gfx1013. gfx1036 is gfx10.3; the PS5 is gfx10.1.
- Other gfx10.3 chips. Only this gfx1036 was measured.
- A hardware read of
DB_ALPHA_TO_MASK.umrneeds root on this machine. - PPSA99902 itself.
- Driver shader caches were not controlled.
Native switch and commands
--- a/core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
+++ b/core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cpp
@@ bool libraryKeys(...)
appendKey(keys.fragmentOutput, state.samples);
+ appendKey(keys.fragmentShader, std::getenv("A2C_NATIVE") != nullptr && state.alphaToCoverage);
+ appendKey(keys.fragmentOutput, std::getenv("A2C_NATIVE") != nullptr && state.alphaToCoverage);
@@ Pipeline::Pipeline(...)
samples.rasterizationSamples = static_cast<VkSampleCountFlagBits>(state.samples);
+ samples.alphaToCoverageEnable = (std::getenv("A2C_NATIVE") != nullptr && state.alphaToCoverage) ? VK_TRUE : VK_FALSE;
--- a/core/libs/prx/libSceAgcDriver/tests/execution/AlphaToCoverage.cpp
+++ b/core/libs/prx/libSceAgcDriver/tests/execution/AlphaToCoverage.cpp
@@ void Draw(...)
prepared.ditheredAlphaToCoverage = dithered;
+ if (std::getenv("A2C_NATIVE") != nullptr) {
+ prepared.alphaToCoverage = false;
+ prepared.ditheredAlphaToCoverage = false;
+ }
@@ void Draw(...)
fragment.context.pixel->ditheredAlphaToCoverage = state.ditheredAlphaToCoverage;
+ if (std::getenv("A2C_NATIVE") != nullptr) {
+ fragment.context.pixel->alphaToCoverage = false;
+ fragment.context.pixel->ditheredAlphaToCoverage = false;
+ }cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON -DANYPS5_ENABLE_SPIRV_TOOLS=ON
cmake --build build --parallel 12
# unmodified head; ANYPS5_GPU=NVIDIA or llvmpipe for the other columns
ANYPS5_GPU=RADV ctest --test-dir build -R '^agc_driver_(dithered_alpha_to_coverage|alpha_to_coverage_state|alpha_to_coverage)$' --repeat until-fail:5
# with the patch: passes; without novrsflatshading, or with noatocdithering added, it fails
A2C_NATIVE=1 APS5_NO_GPL=1 ANYPS5_NO_SHADER_CACHE=1 ANYPS5_GPU=RADV RADV_DEBUG=novrsflatshading \
build/tests/agc_driver_alpha_to_coverage_tests --dithered8The 406-case sweep, the RGBA32F target and the sample-locations-off run need more env-gated switches on top of this patch: a --sweep mode and an A2C_RGBA32F target switch in the test, and an A2C_NO_SL gate in ValidateSampleLocations in Pipeline.cpp. They aren't needed to reproduce the pass and fail results above.
|
Current maintenance: published head365850f33, main872, dither25 after canonical24. Earlier review corrections are retained. The description and #4768 maintain fresh tests and the same-build current-main AMD controls, including remaining limits. Main2582 merge preview is clean but unbuilt. Historical evidence keeps its original pins. Historical main075 validation: 0bcf45842 on main Previous head before review correction: 4b8c2a9e3, based on main Serialization correction: merged #4031 establishes canonical19 with pixel GitHub status after push: head4b8c2a9e3 merges cleanly into preview main Rebase and fresh-build validation (2026-10-13): Correction to the earlier GPL matrix:
The other seven AMD groups pass five times. Repeating the three failing groups with GPL on plus the existing For reproduction on Windows AMD 1002:13c0 / driver 32.0.21036.18, Release WinLibs GCC 15.2.0 r7, set Stronger same-build control: main Executable placement control: copying byte-identical candidate executables to an empty directory, while keeping the original runtime libraries via PATH and the same current directory, reverses that AMD pattern for all three groups: GPL on passes 5/5 each; off fails 5/5 each. Copied libraries give the same result. The copied stock-main executables also invert the pattern in single-run controls. Executable and runtime SHA-256 identities were verified; GDB confirms intended library loading and different executable ASLR addresses, but the cause is unknown. The earlier different-runtime control cannot isolate the alpha change. Issue #4768 contains the matrix, reproduction and limits. A later unchanged-main The independent Linux measurements retain their original head |
4edc8d3 to
7894d81
Compare
7894d81 to
3040cd7
Compare
3040cd7 to
ffd987b
Compare
ffd987b to
4b8c2a9
Compare
adriadam10
left a comment
There was a problem hiding this comment.
Thanks for the work and for addressing the earlier review points. This can't land as it is:
- The head conflicts with
main(core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp), and the description says the current head is not the one you intend to push ("still needs adaptation and validation before its next push"). - It bumps the request serialization version to 22 (
RequestSerializer.cpp, reader gateversion >= 22u), which collides with #5097 (canonical format 22) and #5137 (version 21 layouts). Both are still open. As you noted, the dither field has to move to version 23 on top of them.
Please push the adapted head once #5097 and #5137 are merged: dither field at version 23, retained 16–22 compatibility fixtures regenerated from the then-current serializer, and the PR's tests rerun on the rebased tree. The semantics themselves (mask table matching gfx1036, covered by the independent RADV/RTX 3090 run) look fine; I haven't re-measured them.
|
@adriadam10 Rebased to 246d16a03, based on main4f. Merged #5521's undithered targetless32_AR handling is preserved; dithered32_AR remains explicitly refused and has a rejection control. Canonical24 tessellation fields remain intact; dither uses25. Full build/libs/checkers pass. Three compatibility/state controls pass20 repetitions; all13 NVIDIA groups pass five times in both GPL modes, no skips, maximum5.44858s. AMD still fails standard/dithered coverage GPL-on and the BDA/wave32 trio GPL-off. The earlier matched-main872 comparison retains its pin; no fresh unmodified-main4f exclusion is claimed. Exact matrix and limits are in the updated description and #4768. Later main23e merge preview is clean but unbuilt. No fresh title/full-suite/console claim. AI-assisted: Codex. |
e422e72 to
b551a73
Compare
|
Rebase handoff — rebased onto current Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
To pick it up: Head is |
b551a73 to
365850f
Compare
|
@blawesom I checked your handoff: all14 of our topic patches are range-equivalent in your rebase. Main has since introduced canonical request24 for tessellation, so the PR is now 365850f33 with dither25 and independent main24 compatibility fixtures. The earlier review corrections remain intact. Fresh Windows build/compatibility/NVIDIA checks pass; existing AMD failures reproduce with current main in the same build directory. Your Linux result remains scoped to42fbffd37. The updated description has the exact matrix and remaining limits. AI-assisted: Codex. |
365850f to
246d16a
Compare
|
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.
|
adriadam10
left a comment
There was a problem hiding this comment.
Checked on current main (merged locally): the new agc_driver_undithered_alpha_to_coverage_state, agc_driver_alpha_to_coverage_state and agc_driver_dithered_alpha_to_coverage (lavapipe), agc_driver_graphics, agc_shader_memory and request_serializer pass; they don't build without the change. The only failing test in libSceAgc/libSceAgcDriver is agc_driver_tessellation, which already fails on main. The mask table matches the independent gfx1036/RADV and RTX 3090 measurements by @simonbbby, the undithered path is unchanged, and the debt entry keeps its link. Dither on gfx1013 and on a real title is not measured; merging once the full Build is green.
What
Emulate default dithered alpha-to-coverage (
DB_ALPHA_TO_MASK=0x18701) for eight standard samples and FP16_ABGR/32_ABGR exports. Carry the mode through draw/shader keys and serialized requests. Unsupported sample counts, custom locations, EQAA combinations and dithered normalized exports throw.Sonic Unleashed Recompiled, PPSA99902/01.003.000, historically stopped after the opening movie in our conditional integration at:
The historical pinned-main state control fails and the candidate accepts this mode with the separate covered-centroid bit isolated. #4556 is now merged. This independently buildable change still needs the title's other startup/MSAA work to reach that draw; this rebased head has not been replayed on the title. Current bring-up: #4443; captured state and measurements: #4285.
Semantics: the 64-bin per-quad table was measured on Windows AMD1002:13c0/driver32.0.21036.18; independent gfx1036/RADV Mesa25.2.8 measurements and RTX3090 validation support the masks, accounting for coarse shading. The Windows campaign covered neighboring FP32/FP16 values, sample identity, quad parity, signed zeros, NaNs/infinities and scissor preservation. Native NVIDIA coverage differs, so the shader writes the measured mask and Vulkan alpha-to-coverage stays disabled. Pinned PAL and RADV associate the mode with offsets3/1/0/2 and OFFSET_ROUND. No PS5/gfx1013 measurement is claimed.
Review corrections retained: existing undithered handling, including the disable bit and single-sample MSAA guard, is preserved. The new disable override applies only to dithered coverage. The original debt paragraph/pinned
AlphaToCoverage.cpplink remains, with two dither sentences.Tested
Published head: 246d16a03, based on main
4f618898504e2d73fed5ff9fa414cdf32a8f60b7. The previous tested365 head is preserved on fork branchcodex/alpha-tested-before-main4f. This rebase preserves merged #5521's undithered targetless32_AR handling and its no-MRT0-export refusal. Dithered32_AR remains explicitly unsupported; its rejection fixture now covers that format as well as FP32_R/FP32_GR. Reviewed undithered behavior and debt wording remain intact.Main's canonical24 adds tessellation fields, so dither uses 25. Version21 dual layouts and mandatory22+ F16 tails remain unchanged. An independently compiled, unmodified main1209 serializer/headers emits12 sentinel requests; version24 compatibility preserves layer export, non-default primitiveGroupSize/breakAtInstance, draw fields and F16 tails, alongside the retained older-format fixtures.
Windows11 Enterprise26200, WinLibs GCC15.2.0r7/Ninja Release, bundled dependencies, SPIRV-Tools ON, ASAN OFF. Full build/libs, conventions, registration and branch diff whitespace check pass. Three compatibility/undithered controls pass20 repetitions (maximum0.850409s). 13 relevant groups pass five repetitions in both NVIDIA GPL modes, without skips (maximum5.44858s). Later main23e93c054 has a clean merge preview, which is unbuilt; contribution guidance is unchanged.
AMD1002:13c0/32.0.21036.18: failures stop on the first execution; passing groups complete five. No selected skips.
CPU/helper controls do not establish independent AMD hardware coverage. GPU-selection logs confirm AMD for the native failures, native coverage and prepared draws.
Earlier matched-main comparison (retained pin): unmodified main872 is rebuilt in the same checkout/build directory for five existing controls (full runtime libraries and those executables), then the candidate is restored/full rebuilt. On both main and restored candidate, NVIDIA passes all five ×5 in both modes; AMD standard-alpha fails GPL-on and the BDA/wave32 trio fail GPL-off with the same diagnostics. This establishes reproduction on main872; the new main4f-based candidate retains those failure groups, but this slice does not repeat a matched unmodified-main4f control. Main has no dithered fixture, so it does not independently exclude a dither-specific regression. #4768 maintains the matrix, pins and limits; #3291 retains the BDA validation.
GPL on means
APS5_NO_GPLabsent; off means1. Vulkan is required, the AnyPS5 shader cache is disabled, and each test has a30s bound. This slice does not repeat layered-volume, placement, LTO, PS5/native-console, driver-cache-coldness or full-suite campaigns. The independent Linux measurements above retain their original heads. Full upstream Linux/Windows PR jobs remain maintainer-triggered; local results are not a full CI pass.Checklist
mainat the frozen test start; later main merge preview clean; no other open PR implements this dithered mode (merged fix(agc): alpha-to-coverage from a 32_AR MRT0 export without a color target #5521 targetless32_AR behavior retained).mdfiles or images added to the repository