fix(agc): accept DB_EQAA INTERPOLATE_COMP_Z for a one-sample depth target without MSAA_ENABLE #9721

Merged
frankea merged 3 commits from upstream-pr/9721 into main 2026-10-24 01:25:47 +00:00
frankea commented 2026-10-22 09:54:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by frankea on 2026-10-22T09:54:39Z.


What

A one-sample depth target under a multisampled rasterizer with PA_SC_MODE_CNTL_0.MSAA_ENABLE clear is drawn as one sample at the pixel center (debt entry "A one-sample target under a multisampled rasterizer without MSAA_ENABLE"). With DB_EQAA.INTERPOLATE_COMP_Z set it threw instead: 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 or coverage input, a sample-mask export, or DB_EQAA Z interpolation or overrasterization.

  • INTERPOLATE_COMP_Z (bit 18) is now accepted on this path. INTERPOLATE_SRC_Z (bit 19), OVERRASTERIZATION_AMOUNT (bits 24-26) and ENABLE_POSTZ_OVERRASTERIZATION (bit 27) still throw, and the message now says "DB_EQAA source Z interpolation or overrasterization".
  • The other paths that refuse these bits (a multisampled depth target without MSAA_ENABLE, a single-sample scan into a multisampled depth target) are unchanged.
  • The debt entry says the bit is accepted, why, and that it rests on the entry's existing inference.

GPU semantics, with sources:

  • The field positions are from Mesa's gfx10.json. No public source describes INTERPOLATE_COMP_Z, and neither AMD driver sets it: PAL writes 0 with the comment "INTERPOLATE_COMP_Z should always be set to 0", and radeonsi leaves it 0. radeonsi's comment on Z/S samples below the coverage count (L3324-L3329) says the DB derives the missing samples' Z from the Z planes when Z is compressed, which is the kind of choice the bit's name suggests.
  • Whatever positions the bit interpolates Z to, on this path every sample is at the pixel center. That is the inference the two MSAA_ENABLE debt entries already make, from RADV 061bc615 and the GL multisample rules they cite. So the interpolated Z is the center's Z, which the one-sample draw already tests and writes. This is not measured on hardware, and the debt entry says so.

Why: Gran Turismo 7 (PPSA01317) draws its 3840x2160 main pass this way right after its EQAA pass (#9700): PA_SC_AA_CONFIG 0x0020c002 (4 samples), PA_SC_MODE_CNTL_0 0x2, DB_EQAA 0x00050000 (HIGH_QUALITY_INTERSECTIONS and INTERPOLATE_COMP_Z), DB_Z_INFO 0xa2900983 (one-sample Z_32_FLOAT with HTILE), an 8-bit stencil and a one-sample color target or none. It stops on this refusal when it loads the World Map.

Tested

  • Refreshed onto main 0db47b263 (head 594f57aef; no conflicts), RTX 4090 (NVIDIA 616.92, Windows 11): the 63 ctest entries of the focused set below pass 63/63, each test run three times, and 63/63 under the validation layer (VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1, ctest -V), with no VUID- line; its only messages are main's three Undefined-Value-ShaderOutputNotConsumed-DynamicRendering warnings from agc_driver_alpha_to_coverage. main 0db47b263 passes the union of the refreshed sets, 115/115, under the same layer settings with no VUID- line.
    Gran Turismo 7 (PPSA01317) on a local stack of main with the open PRs it needs before this stop (#7243, #7256, #7550, #7978, #8564, #9020, #9335, #9068, #9700), with its diagnostic switches that skip refused compute dispatches. The stack predates c2764f31f, so this commit went onto it as the same one-mask change.
  • Without this commit, the World Map load stops on this refusal after the car loading screens.
  • With it (1 run), no draw is refused on this path. The main pass draws, the loading screens continue, and the run stops on the next refusal, which is a separate topic: shader 0x1280659800 stage 2: ShaderRecompiler::Recompile: tessellation lowering: unsupported tessellation ring access at pc 0x28c.
  • A diagnostic run that accepted the bit through an environment switch logged the draws it accepted: SPI_PS_INPUT_ENA 0x2 and 0xb01, both with DB_EQAA 0x00050000 and PA_SC_MODE_CNTL_1 0. It stopped on the same tessellation refusal in another shader (0x1280dcce00 at pc 0xd0c). Six other draws of this pass also read ANCILLARY, which still throws here; the runs stopped before reaching them.

Windows 11 (build 26200), NVIDIA GeForce RTX 4090 (driver 616.92), MinGW GCC Release build with BUILD_TESTING=ON, all on one machine.

  • Focused set: the 62 ctest entries of 18 targets (61 before the main merge). These are agc_driver_graphics_tests (the CPU decode tests, with the new cases) and the MSAA, CMASK, FMASK and journal tests: alpha_to_coverage, cached_image_multisample_guard, cmask_fast_clear, color565_target, fmask_image_reads, image_msaa_address_on_plane, msaa_enable_single_sample, multisample_fill_host_only, multisample_readback, multisample_retirement, multisampled_pass_order, native_multisample_depth, pipeline_journal, pixel_sample_coverage, sample_mask_multisample, sample_multisample_target, staged_clear_sampled_read.
  • This PR (f1a969f80, which merges main 7e69be679): 62/62 passed, each test run three times (ctest --repeat until-fail:3).
  • Validation layer: VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (Vulkan SDK 1.4.363.0), ANYPS5_NO_SHADER_CACHE=1 and ANYPS5_REQUIRE_VULKAN=1 with ctest -V, on main 83462cc57 (7e69be679 plus eight commits to tools/ only) (62/62) and on this PR (62/62). Neither log has was not found but was requested by env var VK_INSTANCE_LAYERS. Neither log has a VUID- line. Both have the same three Undefined-Value-ShaderOutputNotConsumed-DynamicRendering warnings, from main's agc_driver_alpha_to_coverage.
  • Before the main merge (e0c67af31 on main 7e2ba73e4): 61/61 three times, and 61/61 under the layer. main control there: main 7e2ba73e4 with only this PR's tests/Graphics.cpp. agc_driver_graphics fails with unexpected failure: AGC graphics: a one-sample depth target under a multisampled rasterizer without MSAA_ENABLE is unsupported ....
  • The new CPU cases, with and without a one-sample color target:
    • DB_EQAA 0x00040000 (INTERPOLATE_COMP_Z alone) and GT7's 0x00050000 decode as a one-sample draw with no sample locations or per-sample shading, and the draw precheck accepts them.
    • 0x00090002 and 0x000d0000 (INTERPOLATE_SRC_Z, the second with INTERPOLATE_COMP_Z), 0x01010002 (OVERRASTERIZATION_AMOUNT) and 0x08010002 (ENABLE_POSTZ_OVERRASTERIZATION) still throw.
  • Not run on Linux. tools/check_conventions.py --base origin/main reports no errors; its one warning is the length of the existing debt entry this PR edits.

Checklist

  • Based on current main; no other open PR implements the same functions. #8121 (PS_ITER_SAMPLE into a one-sample color target) and #9450 change neighbouring rules, not this bit. #8121's diff shows this Require only because its base predates c2764f31f, which main has. #8871 (lines with MSAA_ENABLE clear), now merged, refuses line and point lists on this path; the main merge keeps its debt sentence and test loop next to this PR's.
  • 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: PPSA01317 #4697 (with #9700, moves it past the main-pass depth refusal to its next stop under Tested)
  • GPUs tested: NVIDIA GeForce RTX 4090, driver 616.92, Windows 11 build 26200
  • AI-assisted: yes (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4965479402 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9721). Originally posted by [frankea](https://github.com/frankea) on 2026-10-22T09:54:39Z. --- ### What A one-sample depth target under a multisampled rasterizer with `PA_SC_MODE_CNTL_0.MSAA_ENABLE` clear is drawn as one sample at the pixel center (debt entry "A one-sample target under a multisampled rasterizer without MSAA_ENABLE"). With `DB_EQAA.INTERPOLATE_COMP_Z` set it threw instead: `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 or coverage input, a sample-mask export, or DB_EQAA Z interpolation or overrasterization`. - `INTERPOLATE_COMP_Z` (bit 18) is now accepted on this path. `INTERPOLATE_SRC_Z` (bit 19), `OVERRASTERIZATION_AMOUNT` (bits 24-26) and `ENABLE_POSTZ_OVERRASTERIZATION` (bit 27) still throw, and the message now says "DB_EQAA source Z interpolation or overrasterization". - The other paths that refuse these bits (a multisampled depth target without `MSAA_ENABLE`, a single-sample scan into a multisampled depth target) are unchanged. - The debt entry says the bit is accepted, why, and that it rests on the entry's existing inference. GPU semantics, with sources: - The field positions are from Mesa's [gfx10.json](https://gitlab.freedesktop.org/mesa/mesa/-/blob/761d5c8a54f93b3d43608f718910ed742983dd0b/src/amd/registers/gfx10.json#L12746-L12751). No public source describes `INTERPOLATE_COMP_Z`, and neither AMD driver sets it: [PAL](https://github.com/GPUOpen-Drivers/pal/blob/c5e800072a32f68b6ccc4422936d96167c6e0728/src/core/hw/gfxip/gfx9/gfx9MsaaState.cpp#L117-L118) writes 0 with the comment "INTERPOLATE_COMP_Z should always be set to 0", and [radeonsi](https://gitlab.freedesktop.org/mesa/mesa/-/blob/761d5c8a54f93b3d43608f718910ed742983dd0b/src/gallium/drivers/radeonsi/si_state.c#L3314-L3316) leaves it 0. radeonsi's comment on Z/S samples below the coverage count ([L3324-L3329](https://gitlab.freedesktop.org/mesa/mesa/-/blob/761d5c8a54f93b3d43608f718910ed742983dd0b/src/gallium/drivers/radeonsi/si_state.c#L3324-L3329)) says the DB derives the missing samples' Z from the Z planes when Z is compressed, which is the kind of choice the bit's name suggests. - Whatever positions the bit interpolates Z to, on this path every sample is at the pixel center. That is the inference the two `MSAA_ENABLE` debt entries already make, from RADV 061bc615 and the GL multisample rules they cite. So the interpolated Z is the center's Z, which the one-sample draw already tests and writes. This is not measured on hardware, and the debt entry says so. Why: Gran Turismo 7 (PPSA01317) draws its 3840x2160 main pass this way right after its EQAA pass (#9700): `PA_SC_AA_CONFIG` 0x0020c002 (4 samples), `PA_SC_MODE_CNTL_0` 0x2, `DB_EQAA` 0x00050000 (`HIGH_QUALITY_INTERSECTIONS` and `INTERPOLATE_COMP_Z`), `DB_Z_INFO` 0xa2900983 (one-sample Z_32_FLOAT with HTILE), an 8-bit stencil and a one-sample color target or none. It stops on this refusal when it loads the World Map. ### Tested - Refreshed onto `main` 0db47b263 (head 594f57aef; no conflicts), RTX 4090 (NVIDIA 616.92, Windows 11): the 63 ctest entries of the focused set below pass 63/63, each test run three times, and 63/63 under the validation layer (`VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1`, `ctest -V`), with no `VUID-` line; its only messages are `main`'s three `Undefined-Value-ShaderOutputNotConsumed-DynamicRendering` warnings from `agc_driver_alpha_to_coverage`. `main` 0db47b263 passes the union of the refreshed sets, 115/115, under the same layer settings with no `VUID-` line. Gran Turismo 7 (PPSA01317) on a local stack of `main` with the open PRs it needs before this stop (#7243, #7256, #7550, #7978, #8564, #9020, #9335, #9068, #9700), with its diagnostic switches that skip refused compute dispatches. The stack predates c2764f31f, so this commit went onto it as the same one-mask change. - Without this commit, the World Map load stops on this refusal after the car loading screens. - With it (1 run), no draw is refused on this path. The main pass draws, the loading screens continue, and the run stops on the next refusal, which is a separate topic: `shader 0x1280659800 stage 2: ShaderRecompiler::Recompile: tessellation lowering: unsupported tessellation ring access at pc 0x28c`. - A diagnostic run that accepted the bit through an environment switch logged the draws it accepted: `SPI_PS_INPUT_ENA` 0x2 and 0xb01, both with `DB_EQAA` 0x00050000 and `PA_SC_MODE_CNTL_1` 0. It stopped on the same tessellation refusal in another shader (0x1280dcce00 at pc 0xd0c). Six other draws of this pass also read `ANCILLARY`, which still throws here; the runs stopped before reaching them. Windows 11 (build 26200), NVIDIA GeForce RTX 4090 (driver 616.92), MinGW GCC Release build with `BUILD_TESTING=ON`, all on one machine. - Focused set: the 62 ctest entries of 18 targets (61 before the `main` merge). These are `agc_driver_graphics_tests` (the CPU decode tests, with the new cases) and the MSAA, CMASK, FMASK and journal tests: alpha_to_coverage, cached_image_multisample_guard, cmask_fast_clear, color565_target, fmask_image_reads, image_msaa_address_on_plane, msaa_enable_single_sample, multisample_fill_host_only, multisample_readback, multisample_retirement, multisampled_pass_order, native_multisample_depth, pipeline_journal, pixel_sample_coverage, sample_mask_multisample, sample_multisample_target, staged_clear_sampled_read. - This PR (f1a969f80, which merges `main` 7e69be679): 62/62 passed, each test run three times (`ctest --repeat until-fail:3`). - Validation layer: `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (Vulkan SDK 1.4.363.0), `ANYPS5_NO_SHADER_CACHE=1` and `ANYPS5_REQUIRE_VULKAN=1` with `ctest -V`, on `main` 83462cc57 (7e69be679 plus eight commits to `tools/` only) (62/62) and on this PR (62/62). Neither log has `was not found but was requested by env var VK_INSTANCE_LAYERS`. Neither log has a `VUID-` line. Both have the same three `Undefined-Value-ShaderOutputNotConsumed-DynamicRendering` warnings, from `main`'s `agc_driver_alpha_to_coverage`. - Before the `main` merge (e0c67af31 on `main` 7e2ba73e4): 61/61 three times, and 61/61 under the layer. `main` control there: `main` 7e2ba73e4 with only this PR's `tests/Graphics.cpp`. `agc_driver_graphics` fails with `unexpected failure: AGC graphics: a one-sample depth target under a multisampled rasterizer without MSAA_ENABLE is unsupported ...`. - The new CPU cases, with and without a one-sample color target: - `DB_EQAA` 0x00040000 (`INTERPOLATE_COMP_Z` alone) and GT7's 0x00050000 decode as a one-sample draw with no sample locations or per-sample shading, and the draw precheck accepts them. - 0x00090002 and 0x000d0000 (`INTERPOLATE_SRC_Z`, the second with `INTERPOLATE_COMP_Z`), 0x01010002 (`OVERRASTERIZATION_AMOUNT`) and 0x08010002 (`ENABLE_POSTZ_OVERRASTERIZATION`) still throw. - Not run on Linux. `tools/check_conventions.py --base origin/main` reports no errors; its one warning is the length of the existing debt entry this PR edits. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions. #8121 (`PS_ITER_SAMPLE` into a one-sample color target) and #9450 change neighbouring rules, not this bit. #8121's diff shows this `Require` only because its base predates c2764f31f, which `main` has. #8871 (lines with `MSAA_ENABLE` clear), now merged, refuses line and point lists on this path; the `main` merge keeps its debt sentence and test loop next to this PR's. - [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: PPSA01317 #4697 (with #9700, moves it past the main-pass depth refusal to its next stop under Tested) - [x] GPUs tested: NVIDIA GeForce RTX 4090, driver 616.92, Windows 11 build 26200 - [x] AI-assisted: yes (Claude Code)
MarcZX10 commented 2026-10-22 12:01:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T12:01:37Z.

Review: APPROVED


Reviewed the exact PR head e0c67af31f against current upstream/main. The mask change accepts INTERPOLATE_COMP_Z while continuing to reject INTERPOLATE_SRC_Z and both overrasterization fields; the regression cases cover the bit alone and GT7’s 0x00050000 value, with and without a one-sample color target. The changed code/tests/debt entry merge cleanly with current main, diff-check passes, and the current conventions checker reports 0 errors (one existing debt-length warning). I could not rerun the focused C++/Vulkan tests locally: there is no build tree here and the filesystem is full, so I am relying on the clearly described author-reported Windows RTX 4090 results (61 focused tests, repeated three times, with a baseline control and validation-layer run) rather than claiming an independent test run. No blocking code issue found.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5613801331 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9721#pullrequestreview-5613801331). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T12:01:37Z. **Review:** APPROVED --- Reviewed the exact PR head e0c67af31f40c1117d779f6c5cb96aeda31453c8 against current upstream/main. The mask change accepts INTERPOLATE_COMP_Z while continuing to reject INTERPOLATE_SRC_Z and both overrasterization fields; the regression cases cover the bit alone and GT7’s 0x00050000 value, with and without a one-sample color target. The changed code/tests/debt entry merge cleanly with current main, diff-check passes, and the current conventions checker reports 0 errors (one existing debt-length warning). I could not rerun the focused C++/Vulkan tests locally: there is no build tree here and the filesystem is full, so I am relying on the clearly described author-reported Windows RTX 4090 results (61 focused tests, repeated three times, with a baseline control and validation-layer run) rather than claiming an independent test run. No blocking code issue found.
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!9721
No description provided.