Repository navigation
fix(agc): accept ANCILLARY under PS_ITER_SAMPLE for a one-sample depth target without MSAA_ENABLE - #26182
Conversation
…h target without MSAA_ENABLE With more than one sample in PA_SC_AA_CONFIG and MSAA_ENABLE clear, a one-sample depth target is drawn as a one-sample draw, which gives a pixel program sample index 0 from ANCILLARY whether or not PS_ITER_SAMPLE is set. Under the debt entry's model, where a one-sample target keeps the coverage of sample 0, the console's invocation for sample 0 is the one the target keeps, as for a one-sample color target beside a multisampled depth target. Stop refusing ANCILLARY under PS_ITER_SAMPLE on this depth path; SAMPLE_COVERAGE inputs and sample-mask exports still throw, and the color path is unchanged. inFAMOUS Second Son (CUSA00223) stops at this check: a depth-only draw under a 2x configuration whose pixel program reads bit 8 of ANCILLARY. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mihiii1337
left a comment
There was a problem hiding this comment.
Reviewed exact head 531c3c540f51fa6625c1854b21fe39ee8c723a68.
I ran a focused native Windows A/B with GCC 15.2, compiling each revision's exact State.cpp and the one-sample section of the PR's Graphics.cpp test against the same cached supporting libraries. The base failed at its ANCILLARY refusal and the PR passed DecodeState and DrawRejection. In additional runs with and without a color attachment, an active SAMPLE_COVERAGE input and a sample-mask export were still rejected.
A separate 768-case check of the exact guard across 2×, 4× and 8× configurations found only the three expected acceptance changes. The three changed C++ files also passed syntax checks with the pinned Vulkan and SPIR-V headers.
My tests exercise CPU state decoding. The console sample-zero behavior remains the documented inference, and the GPU runs in the PR description are the author's results.
AI-assisted: yes
|
Verified on real AMD RADV (Linux) across all three gens — the PR lists NVIDIA RTX 5080 only. Built the PR head
All three pass No regression in the related family either — on NAVI31 these all still pass on this head: Sample-index / Evidence: VERIFIED (reproduced on each GPU under the above conditions). |
|
Looks good on AMD RDNA4 on Windows with the Khronos validation layer. The new test and the neighbouring ANCILLARY and sample-mask tests pass 3/3 on the head, with 0 What this run adds.
Code.
Negative control.
GPU. Head
The new test selected Validation.
Host:
AI-assisted: yes |
|
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.
|
Independent Windows 11 / RTX 5070 Ti (Blackwell) validation of
|
| OS | Windows 11 (x86-64) |
| Compiler | WinLibs GCC 16.2.0 (MinGW-w64 x86_64-ucrt-posix-seh, built by Brecht Sanders, r3) |
| CMake / Ninja | 4.4.4 / 1.13.2, CMAKE_BUILD_TYPE=Release, BUILD_TESTING=ON |
| GPU | NVIDIA GeForce RTX 5070 Ti 16 GB, vendor=0x10de device=0x2c05, driver 621.24 |
| Validation layer | VK_LAYER_KHRONOS_validation 1.4.363 from Vulkan SDK 1.4.363 (headers at 335) |
| Environment | ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, APS5_NO_PIPELINE_JOURNAL=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, VK_LOADER_DEBUG=layer |
| Head | 531c3c540f51fa6625c1854b21fe39ee8c723a68 |
| Base for the control | 709342e209 (merge base with main) |
Build
cmake -S . -B build # exit 0, the new tests/execution/OneSampleDepthSampleIndex.cpp is picked up by the glob
ninja -C build agc_driver_one_sample_depth_sample_index_tests
Exit 0, plus the usual MinGW .rsrc merge failure: multiple non-default manifests link warning.
Results on head
ctest --test-dir build -R '^agc_driver_one_sample_depth_sample_index$' -V, 3 consecutive runs:
| Run | Result | Device line | Instance layer | Device layer | was not found… |
VUID- |
|---|---|---|---|---|---|---|
| 1 | Passed, 1.74 s | vendor=0x10de device=0x2c05 |
2 | 2 | 0 | 0 |
| 2 | Passed, 0.91 s | vendor=0x10de device=0x2c05 |
2 | 2 | 0 | 0 |
| 3 | Passed, 0.99 s | vendor=0x10de device=0x2c05 |
2 | 2 | 0 | 0 |
Two insertions per run because the suite creates and tears down the device twice (once for the capability probe in main, once for the actual render). The verdict line is the suite's own, not a skip:
a PS_ITER_SAMPLE pixel program that kills unless the ANCILLARY sample index is 0 wrote a one-sample depth target
without MSAA_ENABLE wherever its draw rasterized, under one-sample, 2x, 4x and 8x configurations
So the one-sample, 2x, 4x and 8x paths all ran on this device; OpenVulkanTestDevice() returning nothing would have produced return code 77 and a skipped line instead.
Negative control (implementation reverted, new test kept)
The test file is new in this PR, so the ctest name does not exist at 709342e209. With the PR's test and registration kept and only core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp checked out at the base commit, the build is clean and the test fails at the configuration the change exists for:
[gpu] driver failure: AGC graphics: a one-sample depth target under a multisampled rasterizer without MSAA_ENABLE
is unsupported for points or lines and with alpha-to-coverage, a sample index input under PS_ITER_SAMPLE, ...
what(): AGC graphics: a one-sample depth target under a multisampled rasterizer without MSAA_ENABLE is unsupported ...
1/1 test failed, exit code 0xc0000409
The base rejects the configuration outright, so the test distinguishes base from head rather than passing on both.
What this does and does not establish
Establishes, on native Windows 11 with GCC 16.2.0/UCRT in Release on an RTX 5070 Ti:
agc_driver_one_sample_depth_sample_indexconfigures, builds and passes on Windows, 3/3 runs (1.74 s, then 0.91 s and 0.99 s), deterministically;- it creates a real Vulkan device on this GPU (
device=0x2c05), withVK_LAYER_KHRONOS_validationinserted for every instance and device, no loader complaint (was not found) and zeroVUID-lines; - the assertions bind to
State.cpp: reverting only that file makes the same test abort with the "one-sample depth target … unsupported" driver failure.
Does not establish:
- console behaviour: this shows the recompiled pipeline and the AGC state accept the configuration on an NVIDIA driver; it does not show a PS5 produces the same depth values;
- the depth value comparison itself against hardware: the check is the test's own
DrawnDepth/Untouchedexpectation, not a console capture; - other GPUs and drivers: one Blackwell card, driver 621.24. The
ANCILLARY/PS_ITER_SAMPLEinteraction is driver-specific enough that RADV or MoltenVK could differ, and the PR's own Windows 10 run used a different card; - no title or homebrew run, and no console sink.
Workspace cleaned up afterwards: temporary branch deleted, main back at origin/main (110d1fcd39), no local changes.
|
NVIDIA Ampere run of the Tested selection: no regression. Setup: NVIDIA GeForce RTX 3070, driver 616.56, Windows 11 Pro 10.0.26100, WinLibs GCC 15.2.0 r7, Release, Vulkan validation layer 1.4.363. Base
AI-assisted (Claude Code). |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
Nothing blocks this change; the behavior is supported by the code and test evidence described in the PR, with console behavior still unverified.
What I ran
Reviewed head 531c3c540f51fa6625c1854b21fe39ee8c723a68 using the prepared diff and repo_read.py. No tests were run during this review.
Results
| Check | Result | Note |
|---|---|---|
| Changed code review | passed | State check and execution test inspected |
| Tests during review | not run | PR description reports author runs |
| Console behavior | not run | Description says behavior is inferred, not measured |
Findings
Blocking
None.
Non-blocking
None.
Not verified
The full Graphics.cpp file was inspected only at the changed lines; its remaining contents were not read. The PR description, commits, manifest, diff, State.cpp, new execution test, and debt fragment were read. The author reports tests and title launches, but those were not run by this review. No precheck or negative control was run. Console behavior and the other modified-file context were not independently confirmed.
To get this to a good state
Nothing is required.
…r target without MSAA_ENABLE With more than one sample in PA_SC_AA_CONFIG and MSAA_ENABLE clear, a one-sample color target and no depth target is drawn as a one-sample draw, which gives a pixel program sample index 0 from ANCILLARY whether or not PS_ITER_SAMPLE is set. Under the debt entry's model, where a one-sample target keeps the coverage of sample 0, the console's invocation for sample 0 is the one the target keeps. This is not measured on hardware. This is the color half of the depth-path change in #26182. Stop refusing ANCILLARY under PS_ITER_SAMPLE on the color path; SAMPLE_COVERAGE inputs and sample-mask exports still throw. A GPU test draws such a program under 2x, 4x and 8x configurations and checks that it wrote sample index 0, as under a one-sample configuration. inFAMOUS Second Son (CUSA00223) stops at this check: a one-sample color target under a 2x configuration whose pixel program reads ANCILLARY under PS_ITER_SAMPLE. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
With more than one sample in
PA_SC_AA_CONFIGandPA_SC_MODE_CNTL_0.MSAA_ENABLEclear,DecodeStatedraws a one-sample depth target as a one-sample draw at the pixel center (debt entryA one-sample target under a multisampled rasterizer without MSAA_ENABLE). Since #9988 a running pixel program there may readANCILLARY, but not underPA_SC_MODE_CNTL_1.PS_ITER_SAMPLE:a one-sample depth target under a multisampled rasterizer without MSAA_ENABLE is unsupported for points or lines and with alpha-to-coverage, a sample index input under PS_ITER_SAMPLE, a coverage input, a sample-mask export, or DB_EQAA source Z interpolation or overrasterization.#9988, which accepted
ANCILLARYon this depth path withoutPS_ITER_SAMPLE, kept this case: "WithPS_ITER_SAMPLE, #7729 draws the program once per pixel on this path, but the console runs one invocation per sample, and each would read its own sample index. That case still throws." (#13991 kept the same case on the color path.) Under the entry's model a one-sample target keeps the coverage of sample 0, so of those invocations the depth target keeps the one for sample 0, and index 0 is what the one-sample draw already gives: its state has one sample, soperSampleShadingis false, the recompiler'spixelIteratesSamplesis false, and the sample field of the packed ancillary word is the constant 0 (sampleNumberinConstantFolder.cpp). Like the entry's model, this is not measured on a console.mainalready uses this rule in two neighbouring cases:MSAA_ENABLEset, the sample-0 rule (rasterizesSampleZeroOnlyinState.cpp) refuses onlySAMPLE_COVERAGEunderPS_ITER_SAMPLE, so a program that readsANCILLARYis drawn as one sample and reads index 0;One-sample color targets beside a multisampled depth target: "WithPS_ITER_SAMPLEthe color is the output of sample 0's invocation."This PR:
ANCILLARYunderPS_ITER_SAMPLEfrom the one-sample depth check inState.cpp.SAMPLE_COVERAGEand a sample-mask export still throw. The one-sample color check is not changed: no title I know of reaches it withANCILLARYunderPS_ITER_SAMPLE.ANCILLARYthrows only underPS_ITER_SAMPLEwithout a depth target; with one, the program reads sample index 0, and if the console keeps another sample, a program that kills or writes by the index draws differently; a store whose address or value depends on the index is made only as sample 0 would make it; inFAMOUS joins the titles listed.inFAMOUS Second Son (CUSA00223) stops at this check: a depth-only draw into a one-sample 3328x1920 depth target under a 2x
PA_SC_AA_CONFIG(0x00108001), withPS_ITER_SAMPLEset andKILL_ENABLEset inDB_SHADER_CONTROL(0x60). Its pixel program readsPERSP_SAMPLEandANCILLARY(SPI_PS_INPUT_ENA0x2001) and takes bit 8 ofANCILLARY, the low bit of the sample index. It puts that bit into the lowest bit of the first coordinate of each of its 7 image sample addresses, and decides the kill by comparing differences between the sampled values with 0.1.Tested
Windows 10 Pro 22H2 (19045), NVIDIA GeForce RTX 5080 (driver 621.14), WinLibs GCC 15.2.0 (r7), Release. The tests, the breaks and the inFAMOUS starts ran on this change on
mainfe540db950; it is now on709342e209. None of themaincommits in between change a file this PR changes, and its changed lines are the same.agc_driver_one_sample_depth_sample_index(new, PM4 throughsceAgcDriverSubmitDcb, modeled onDepthCopyDraw.cpp): a depth-only draw into a one-sample 64x4 depth target withMSAA_ENABLEclear andPS_ITER_SAMPLEset, whose pixel program readsPERSP_CENTERandANCILLARY(0x2002), kills (KILL_ENABLE) unless bits 8-11 ofANCILLARYare 0 and exports only to the null target; a DB depth copy then reads the depth target into a color target, and a reference draw marks the covered texels. Under one-sample, 2x, 4x and 8x configurations, the copy holds the drawn depth exactly where the reference draw covers and nothing elsewhere.agc_driver_graphics: a one-sample depth target under a 4x configuration whose running pixel program readsPERSP_SAMPLEandANCILLARY(0x2001, inFAMOUS's inputs) underPS_ITER_SAMPLEdecodes as one sample without sample shading, with no color target and with a one-sample one; the precheck accepts it.main's refusal put back (both fail, the GPU test with this check's refusal), the depth path left at the rasterizer's sample count (both fail), and the non-iterated sample index read as 1 instead of 0 (the GPU test fails in all four rounds: the copy holds 0 instead of 0.25 at the first covered texel).ANYPS5_ENABLE_SPIRV_TOOLS=ON, Release), of this branch onmain709342e209: both pass.tools/select_tests.pyselects for the 4 changed files (ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1), on this branch and onmainfe540db950(3,441, without the new test):agc_driver_bda_deviceandagc_storage_write_back_host_retilefail on both,agc_driver_store_over_untrackedfailed only onmain, and the same 24 tests are skipped on both.VK_LAYER_KHRONOS_validation1.4.367 (VK_ADD_LAYER_PATH=<the layer's folder> VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer VK_LOADER_LAYERS_DISABLE=~implicit~ ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1), the tests matchingmultisample|msaa|one_sample|sample_iteration|sample_coverage|sample_mask|sample_order|ancillary|depth_copy|agc_driver_graphics$|alpha_to_coverage,ctest -V: 71 on the branch and 70 onmain; 67 and 66 pass, and the same 4 are skipped on both (agc_driver_msaa_dcc_compared_import_2,_4and_8,agc_driver_sample_order_grid_reference); the logs have 72 and 70Insert instance layerlines, nowas not foundand no VUID. In that run the new test's kill program still exported color target 0, and the layer warnedUndefined-Value-ShaderOutputNotConsumed-DynamicRenderingonce per kill draw (the depth-only draw has no color attachment;mainlogs the same warning inagc_driver_alpha_to_coverage). With the null export, rerun alone with the layer, the test passes with no validation message.libc.prxandlibSceFios2.prxunwrapped with our local PS4 variant oftools/unwrap_self.py, converted with each build's relinker (--windows --registry --trace-imports), two starts of up to 60 s per build, no input. Both builds aremainfe540db950with fix(libSceSysmodule): accept four PS4-only module ids in a PS4 process #18184, feat(shader): offer a 2D MSAA mode to GCN image loads #21961, feat(agc): sample and publish PS4 multisampled depth targets #25557 and feat(agc): model the color memory of PS4 multisampled 2D surfaces #25802 (which carries feat(agc): lay out PS4 multisampled color textures in 2D tile modes #23672) merged locally (feat(agc): lay out PS4 multisampled color textures in 2D tile modes #23672 and feat(agc): sample and publish PS4 multisampled depth targets #25557 conflict inTextureTiling.cpp; resolved by keeping feat(agc): sample and publish PS4 multisampled depth targets #25557's depth tile split and feat(agc): lay out PS4 multisampled color textures in 2D tile modes #23672's color tile split) and two local relinker changes in no PR, so the Neo-mode GNM exports it imports resolve (see libSceGnmDriver: inFAMOUS Second Son (CUSA00223) stops at load on 47 imports that only libSceGnmDriverForNeoMode exports #17581): a title that needslibSceGnmDriver.prxalso loadslibSceGnmDriverForNeoMode.prx, and an import oflibSceGnmDriver.prxis also looked up in it. The build without this change merged feat(agc): sample and publish PS4 multisampled depth targets #25557 ataeae68c7f0and the one with it at96c16c16d8; they differ only in a debt fragment.indirect draw on a non-vertex path must be resolved by the driver, which is outside this PR. The logs count no frames; both builds' starts log[videoout] presentation failedat their stop, and the starts with this change prepare 8 more graphics shaders at first use (57 against 49), among them the refused draw's pixel program0x2f2f95f00. The time to the stop is about the same; what changes is where they stop.python tools/check_conventions.py --base origin/mainwith this title and description: no errors, one warning,debt-length, for the changed entry (5,001 characters; it was 4,335 before this change).python tools/pr_overlap.py --branch fix/agc-one-sample-target-sample-index(2,538 open pull requests probed): none of those that merge withmainconflicts with this branch. Of the 33 that conflict withmainand were not compared, none changes a line inside this branch's hunks.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)AI-assisted: Claude Code found the cause, wrote the change and its tests, ran the tests and the inFAMOUS starts, and drafted this description; separate review agents checked it.
🤖 Generated with Claude Code