fix(agc): test depth before pixel shaders that ask for it #4210

Merged
karanvora2599 merged 2 commits from upstream-pr/4210 into main 2026-10-13 13:44:25 +00:00
karanvora2599 commented 2026-10-12 01:25:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by karanvora2599 on 2026-10-12T01:25:10Z.


What

A pixel shader whose DB_SHADER_CONTROL sets DEPTH_BEFORE_SHADER (bit 12) now gets EarlyFragmentTests, and Z_ORDER EARLY_Z_THEN_RE_Z (3) counts as early depth like EARLY_Z_THEN_LATE_Z (1).

Background.

  • DEPTH_BEFORE_SHADER is what a pixel shader compiled for early depth/stencil sets: the depth and stencil tests, and their writes, happen before the shader runs, even when the shader kills pixels or writes memory. The precheck accepts the bit (State.cpp, ShaderControlMask), but DecodePixelStageInfo never read it.
  • Such shaders got EarlyFragmentTests only when Z_ORDER was 1 and they had no kill or exports. That leaves two differences from the hardware:
    • Pixels a shader killed did not write depth.
    • Occluded pixels still ran the shader and wrote memory.
  • A Vulkan driver can't reject occluded pixels before a shader that writes memory unless the shader declares EarlyFragmentTests, because the writes of pixels that later fail the depth test must still happen. So on every host GPU, NVIDIA included, these shaders ran for every pixel of the draw before their depth test.

Source.

  • src/amd/registers/gfx10.json in Mesa: DB_SHADER_CONTROL bit 12 is DEPTH_BEFORE_SHADER, and Z_ORDER 3 is EARLY_Z_THEN_RE_Z.
  • RADV (src/amd/vulkan/radv_shader.c, radv_precompute_registers_hw_fs) sets DEPTH_BEFORE_SHADER from the shader's early_fragment_test.
  • RADV also switches EARLY_Z_THEN_LATE_Z to EARLY_Z_THEN_RE_Z for its GFX12 HiZ workaround (radv_cmd_buffer.c). Both run depth before the shader.

How.

  • earlyZ is set for DEPTH_BEFORE_SHADER, and for Z_ORDER 1 or 3 under the existing no-kill and no-export conditions (Z export, mask export, and the stencil reference export main added since).
  • The backend no longer repeats those conditions. It keeps only the alpha-to-coverage one, so a shader with alpha-to-coverage still tests late, as before.
  • earlyZ keeps its place in the request, so the serialization version doesn't change.

Tested

Windows 11, MinGW-w64 GCC 15.2.0, Release. Devices:

  • RTX 4060 Laptop (Ada, driver 591.86)
  • Intel UHD Graphics (Raptor Lake, driver 101.6790)
  • lavapipe from Mesa 25.2.8 (llvmpipe, LLVM 21.1.7): the version CI installs; Windows build with GALLIUM_OVERRIDE_CPU_CAPS=avx.

The branch is rebased onto main at 33ae282e4, which added the stencil reference export in the same lines. The resolution is the one @blawesom proposed: main's !stencilRefExportEnable joins the Z_ORDER conditions, and the backend keeps only its alpha-to-coverage guard. Everything below ran on that base.

  • earlyFragmentTestsTests in agc_driver_graphics:
    • It compiles a pixel shader for nine DB_SHADER_CONTROL values: Z_ORDER 0 to 3 with and without kill or Z export, and DEPTH_BEFORE_SHADER with kill, with Z export and with Z_ORDER 0 and 3.
    • For each, it checks whether EarlyFragmentTests is declared, on the request itself and after a serialization round trip.
    • With the change reverted it fails: DB_SHADER_CONTROL 48 did not declare early fragment tests (48 is Z_ORDER 3).
    • It also sets the request's alphaToCoverage for Z_ORDER 1 (0x10) and DEPTH_BEFORE_SHADER (0x1000), and checks that neither declares EarlyFragmentTests, directly and after a round trip. With the backend's alpha-to-coverage guard removed it fails: DB_SHADER_CONTROL 16 with alpha-to-coverage declared early fragment tests.
  • stencilRefExportTests in agc_driver_graphics already checks that Z_ORDER 1 with a stencil reference export stays late. It now also checks that DEPTH_BEFORE_SHADER with a stencil reference export decodes as early. With the stencil export made to block DEPTH_BEFORE_SHADER as well, it fails: DEPTH_BEFORE_SHADER with a stencil reference export did not get early tests.
  • The conservative Z export, Z export and alpha-to-coverage tests in agc_driver_graphics, and agc_driver_alpha_to_coverage, pass on all three devices.
  • Shader and driver tests (agc_driver_*, agc_shader_*, agc_spirv_*, vector_*, agc_masked_select, agc_validate_program, agc_denormal*, agc_float16_*; 348 tests):
    • RTX 4060: everything passes; agc_driver_stencil_ref_export is skipped, as driver 591.86 has no VK_EXT_shader_stencil_export. I left out the BDA tests that lose the device on driver 591.86 (#3291): agc_driver_flat_loads*, agc_driver_global_loads*, agc_driver_flat_apertures*, agc_driver_pixel_interlock.
    • Intel UHD: everything passes or is skipped for missing features, including agc_driver_stencil_ref_export, except agc_driver_ds_swizzle and agc_driver_f32_dot2_rounding, which fail the same way on main.
    • lavapipe 25.2.8: everything passes or is skipped for missing features. agc_driver_stencil_ref_export segfaults within 0.4 s in some runs: 2 of 5 runs with main's code and 2 of 5 with this branch, passing otherwise.

Limits.

  • I haven't measured it on console hardware. TechnicalDebt.md records that the bit follows Mesa, and that its combination with a Z export, a mask export, a stencil export or alpha-to-coverage was not measured.
  • I haven't measured the fill-rate effect on a title.

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
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4823839027 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4210). Originally posted by [karanvora2599](https://github.com/karanvora2599) on 2026-10-12T01:25:10Z. --- ### What A pixel shader whose `DB_SHADER_CONTROL` sets `DEPTH_BEFORE_SHADER` (bit 12) now gets `EarlyFragmentTests`, and `Z_ORDER` `EARLY_Z_THEN_RE_Z` (3) counts as early depth like `EARLY_Z_THEN_LATE_Z` (1). **Background.** - `DEPTH_BEFORE_SHADER` is what a pixel shader compiled for early depth/stencil sets: the depth and stencil tests, and their writes, happen before the shader runs, even when the shader kills pixels or writes memory. The precheck accepts the bit (`State.cpp`, `ShaderControlMask`), but `DecodePixelStageInfo` never read it. - Such shaders got `EarlyFragmentTests` only when `Z_ORDER` was 1 and they had no kill or exports. That leaves two differences from the hardware: - Pixels a shader killed did not write depth. - Occluded pixels still ran the shader and wrote memory. - A Vulkan driver can't reject occluded pixels before a shader that writes memory unless the shader declares `EarlyFragmentTests`, because the writes of pixels that later fail the depth test must still happen. So on every host GPU, NVIDIA included, these shaders ran for every pixel of the draw before their depth test. **Source.** - `src/amd/registers/gfx10.json` in Mesa: `DB_SHADER_CONTROL` bit 12 is `DEPTH_BEFORE_SHADER`, and `Z_ORDER` 3 is `EARLY_Z_THEN_RE_Z`. - RADV (`src/amd/vulkan/radv_shader.c`, `radv_precompute_registers_hw_fs`) sets `DEPTH_BEFORE_SHADER` from the shader's `early_fragment_test`. - RADV also switches `EARLY_Z_THEN_LATE_Z` to `EARLY_Z_THEN_RE_Z` for its GFX12 HiZ workaround (`radv_cmd_buffer.c`). Both run depth before the shader. **How.** - `earlyZ` is set for `DEPTH_BEFORE_SHADER`, and for `Z_ORDER` 1 or 3 under the existing no-kill and no-export conditions (Z export, mask export, and the stencil reference export `main` added since). - The backend no longer repeats those conditions. It keeps only the alpha-to-coverage one, so a shader with alpha-to-coverage still tests late, as before. - `earlyZ` keeps its place in the request, so the serialization version doesn't change. ### Tested Windows 11, MinGW-w64 GCC 15.2.0, Release. Devices: - RTX 4060 Laptop (Ada, driver 591.86) - Intel UHD Graphics (Raptor Lake, driver 101.6790) - lavapipe from Mesa 25.2.8 (llvmpipe, LLVM 21.1.7): the version CI installs; Windows build with `GALLIUM_OVERRIDE_CPU_CAPS=avx`. The branch is rebased onto `main` at 33ae282e4, which added the stencil reference export in the same lines. The resolution is the one @blawesom proposed: `main`'s `!stencilRefExportEnable` joins the `Z_ORDER` conditions, and the backend keeps only its alpha-to-coverage guard. Everything below ran on that base. - `earlyFragmentTestsTests` in `agc_driver_graphics`: - It compiles a pixel shader for nine `DB_SHADER_CONTROL` values: Z_ORDER 0 to 3 with and without kill or Z export, and `DEPTH_BEFORE_SHADER` with kill, with Z export and with Z_ORDER 0 and 3. - For each, it checks whether `EarlyFragmentTests` is declared, on the request itself and after a serialization round trip. - With the change reverted it fails: `DB_SHADER_CONTROL 48 did not declare early fragment tests` (48 is Z_ORDER 3). - It also sets the request's `alphaToCoverage` for Z_ORDER 1 (0x10) and `DEPTH_BEFORE_SHADER` (0x1000), and checks that neither declares `EarlyFragmentTests`, directly and after a round trip. With the backend's alpha-to-coverage guard removed it fails: `DB_SHADER_CONTROL 16 with alpha-to-coverage declared early fragment tests`. - `stencilRefExportTests` in `agc_driver_graphics` already checks that `Z_ORDER` 1 with a stencil reference export stays late. It now also checks that `DEPTH_BEFORE_SHADER` with a stencil reference export decodes as early. With the stencil export made to block `DEPTH_BEFORE_SHADER` as well, it fails: `DEPTH_BEFORE_SHADER with a stencil reference export did not get early tests`. - The conservative Z export, Z export and alpha-to-coverage tests in `agc_driver_graphics`, and `agc_driver_alpha_to_coverage`, pass on all three devices. - Shader and driver tests (`agc_driver_*`, `agc_shader_*`, `agc_spirv_*`, `vector_*`, `agc_masked_select`, `agc_validate_program`, `agc_denormal*`, `agc_float16_*`; 348 tests): - RTX 4060: everything passes; `agc_driver_stencil_ref_export` is skipped, as driver 591.86 has no `VK_EXT_shader_stencil_export`. I left out the BDA tests that lose the device on driver 591.86 (#3291): `agc_driver_flat_loads*`, `agc_driver_global_loads*`, `agc_driver_flat_apertures*`, `agc_driver_pixel_interlock`. - Intel UHD: everything passes or is skipped for missing features, including `agc_driver_stencil_ref_export`, except `agc_driver_ds_swizzle` and `agc_driver_f32_dot2_rounding`, which fail the same way on `main`. - lavapipe 25.2.8: everything passes or is skipped for missing features. `agc_driver_stencil_ref_export` segfaults within 0.4 s in some runs: 2 of 5 runs with `main`'s code and 2 of 5 with this branch, passing otherwise. **Limits.** - I haven't measured it on console hardware. `TechnicalDebt.md` records that the bit follows Mesa, and that its combination with a Z export, a mask export, a stencil export or alpha-to-coverage was not measured. - I haven't measured the fill-rate effect on a title. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes
Dextroid17 commented 2026-10-12 01:37:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-12T01:37:42Z.


Three small, well-scoped perf/correctness fixes from the same author — reviewed individually since one of them is a real correctness bug, not just an optimization.

#4212 (LDS atomic double-fence): Confirmed exactly as described. AtomicUpdateTyped's compare-and-swap loop already ends its LDS path with a workgroup-scoped acquire-release barrier, and SharedAtomicUpdate emitted a byte-for-byte identical second one right after — same scope, same semantics, same state, truly redundant. The GDS path keeps its second barrier correctly, because GDS's loop barrier is device-scoped, not workgroup-scoped, so there it isn't a duplicate. The LDS/GDS split is driven by the same enum the loop itself already branches on, not a separate heuristic that could misclassify. One cosmetic nit: the body's instruction list omits EmitSharedAtomicCmpstF32, which also routes through this same function and gets the same fix.

#4211 (bindless table double-search): Also confirmed clean. The key question was whether the two searches are provably identical, not just usually identical — and they are: the runtime image-mode variants are copies of the base image that only ever mutate format/numeric-class/dimension/cube-type fields, never the four fields the search actually reads (indirectRoot, source, indirectSearchIterations, indirectMappingOffset). Since those are untouched across every mode, the second search could never have produced a different slot. Minor nuance worth noting, not a defect: the search is now also evaluated on two arms (FMASK, and the depth-bits-fail case) that previously skipped it entirely — practically inert for non-bindless images, but worth a mention in case a future bindless+FMASK combination surfaces a different failure-message path than before.

#4210 (early depth decode) — this one is a genuine correctness bug, not a perf nit, and the fix is right. The pixel-stage decoder's precheck already accepted the DEPTH_BEFORE_SHADER bit but never actually read it, and Z_ORDER==3 (EARLY_Z_THEN_RE_Z) was never treated as early depth at all — only Z_ORDER==1 was. Without EarlyFragmentTests declared, a Vulkan driver can't discard an occluded pixel before a shader that writes memory, so on every host GPU those shaders were running — and writing memory — for pixels the real hardware would never have reached. That's silent output corruption, not just wasted work. The fix is correct and the alpha-to-coverage exception is properly preserved. One gap worth flagging: the fix deliberately lets DEPTH_BEFORE_SHADER set early-Z even when combined with a Z-export or mask-export, which the accompanying TechnicalDebt entry only partially covers — it notes the bit-plus-Z-export combination as unmeasured but doesn't mention the mask-export case. Also, the new test can't actually exercise the alpha-to-coverage clause end-to-end, since that flag is only ever set by the driver, not by anything the decode test constructs — the "still tests late" claim rests on reading the code, not on a test proving it.

Written with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6116214017 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4210#issuecomment-6116214017). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-12T01:37:42Z. --- Three small, well-scoped perf/correctness fixes from the same author — reviewed individually since one of them is a real correctness bug, not just an optimization. **#4212 (LDS atomic double-fence):** Confirmed exactly as described. `AtomicUpdateTyped`'s compare-and-swap loop already ends its LDS path with a workgroup-scoped acquire-release barrier, and `SharedAtomicUpdate` emitted a byte-for-byte identical second one right after — same scope, same semantics, same state, truly redundant. The GDS path keeps its second barrier correctly, because GDS's loop barrier is device-scoped, not workgroup-scoped, so there it isn't a duplicate. The LDS/GDS split is driven by the same enum the loop itself already branches on, not a separate heuristic that could misclassify. One cosmetic nit: the body's instruction list omits `EmitSharedAtomicCmpstF32`, which also routes through this same function and gets the same fix. **#4211 (bindless table double-search):** Also confirmed clean. The key question was whether the two searches are *provably* identical, not just usually identical — and they are: the runtime image-mode variants are copies of the base image that only ever mutate format/numeric-class/dimension/cube-type fields, never the four fields the search actually reads (`indirectRoot`, `source`, `indirectSearchIterations`, `indirectMappingOffset`). Since those are untouched across every mode, the second search could never have produced a different slot. Minor nuance worth noting, not a defect: the search is now also evaluated on two arms (FMASK, and the depth-bits-fail case) that previously skipped it entirely — practically inert for non-bindless images, but worth a mention in case a future bindless+FMASK combination surfaces a different failure-message path than before. **#4210 (early depth decode) — this one is a genuine correctness bug, not a perf nit, and the fix is right.** The pixel-stage decoder's precheck already *accepted* the `DEPTH_BEFORE_SHADER` bit but never actually read it, and `Z_ORDER==3` (`EARLY_Z_THEN_RE_Z`) was never treated as early depth at all — only `Z_ORDER==1` was. Without `EarlyFragmentTests` declared, a Vulkan driver can't discard an occluded pixel before a shader that writes memory, so on every host GPU those shaders were running — and writing memory — for pixels the real hardware would never have reached. That's silent output corruption, not just wasted work. The fix is correct and the alpha-to-coverage exception is properly preserved. One gap worth flagging: the fix deliberately lets `DEPTH_BEFORE_SHADER` set early-Z even when combined with a Z-export or mask-export, which the accompanying TechnicalDebt entry only partially covers — it notes the bit-plus-Z-export combination as unmeasured but doesn't mention the mask-export case. Also, the new test can't actually exercise the alpha-to-coverage clause end-to-end, since that flag is only ever set by the driver, not by anything the decode test constructs — the "still tests late" claim rests on reading the code, not on a test proving it. Written with AI assistance.
karanvora2599 commented 2026-10-12 02:31:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by karanvora2599 on 2026-10-12T02:31:12Z.


Thanks @Dextroid17. Both points are fair, and both are fixed in b4860abf3, which is also rebased onto current main:

  • The TechnicalDebt.md entry now also names DEPTH_BEFORE_SHADER with a mask export as unmeasured.
  • earlyFragmentTestsTests now sets the request's alphaToCoverage for Z_ORDER 1 and for DEPTH_BEFORE_SHADER, and checks that neither declares EarlyFragmentTests, directly and after a serialization round trip. With the backend's alpha-to-coverage guard removed it fails: DB_SHADER_CONTROL 16 with alpha-to-coverage declared early fragment tests. It passes on the RTX 4060, the Intel UHD and lavapipe 25.2.8.

I've updated the description to match.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6116690315 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4210#issuecomment-6116690315). Originally posted by [karanvora2599](https://github.com/karanvora2599) on 2026-10-12T02:31:12Z. --- Thanks @Dextroid17. Both points are fair, and both are fixed in b4860abf3, which is also rebased onto current `main`: - The `TechnicalDebt.md` entry now also names `DEPTH_BEFORE_SHADER` with a mask export as unmeasured. - `earlyFragmentTestsTests` now sets the request's `alphaToCoverage` for Z_ORDER 1 and for `DEPTH_BEFORE_SHADER`, and checks that neither declares `EarlyFragmentTests`, directly and after a serialization round trip. With the backend's alpha-to-coverage guard removed it fails: `DB_SHADER_CONTROL 16 with alpha-to-coverage declared early fragment tests`. It passes on the RTX 4060, the Intel UHD and lavapipe 25.2.8. I've updated the description to match.
blawesom commented 2026-10-12 12:26:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-12T12:26:05Z.


Rebase handoff — this branch was ~335 commits behind main and conflicting. I rebased it onto current main and verified the result; your commit's authorship is unchanged.

The conflicts were semantic — main landed the stencil-reference export work in the same regions this PR touches. The rebased merge keeps both:

  • ShaderInputState.cpp: main's stencilRefExportEnable decode plus this PR's depthBeforeShader decode; the earlyZ computation now takes the PR's depthBeforeShader || trigger and relaxed Z_ORDER check with main's !stencilRefExportEnable blocker added (the PR's guard set didn't know about stencil export yet)
  • SpirvModuleSetup.cpp: main's StencilExportEXT capability block is kept; the EarlyFragmentTests emission uses the PR's simplified guard, since the blockers now live in the decoder-side earlyZ (including the stencil one above)
  • TechnicalDebt.md: both entries kept (main's STENCIL_TEST_VAL_EXPORT_ENABLE, this PR's DEPTH_BEFORE_SHADER)

Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, AMD RX 9070 XT / RADV):

  • builds; tools/check_conventions.py --base origin/main passes
  • full suite: 949/949 passed

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/4210
git checkout <your branch>
git merge --ff-only FETCH_HEAD   # or reset to it

Head is 923ed60ae. Happy to adjust the resolution if you'd merge the guard sets differently.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6124230347 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4210#issuecomment-6124230347). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-12T12:26:05Z. --- **Rebase handoff** — this branch was ~335 commits behind `main` and conflicting. I rebased it onto current `main` and verified the result; your commit's authorship is unchanged. The conflicts were semantic — `main` landed the stencil-reference export work in the same regions this PR touches. The rebased merge keeps both: - `ShaderInputState.cpp`: main's `stencilRefExportEnable` decode plus this PR's `depthBeforeShader` decode; the `earlyZ` computation now takes the PR's `depthBeforeShader ||` trigger and relaxed `Z_ORDER` check **with main's `!stencilRefExportEnable` blocker added** (the PR's guard set didn't know about stencil export yet) - `SpirvModuleSetup.cpp`: main's `StencilExportEXT` capability block is kept; the `EarlyFragmentTests` emission uses the PR's simplified guard, since the blockers now live in the decoder-side `earlyZ` (including the stencil one above) - `TechnicalDebt.md`: both entries kept (main's `STENCIL_TEST_VAL_EXPORT_ENABLE`, this PR's `DEPTH_BEFORE_SHADER`) Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`, AMD RX 9070 XT / RADV): - builds; `tools/check_conventions.py --base origin/main` passes - **full suite: 949/949 passed** **To pick it up:** ``` git fetch https://github.com/blawesom/AnyPS5 rebase/4210 git checkout <your branch> git merge --ff-only FETCH_HEAD # or reset to it ``` Head is `923ed60ae`. Happy to adjust the resolution if you'd merge the guard sets differently.
karanvora2599 commented 2026-10-12 14:12:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by karanvora2599 on 2026-10-12T14:12:28Z.


Thanks @blawesom for the rebase and the RX 9070 XT run. Your resolution is right: main's !stencilRefExportEnable belongs with the other blockers in earlyZ, and the backend keeps only the alpha-to-coverage guard.

I pushed an equivalent rebase onto main at 33ae282e4 (04f97e12a) rather than fast-forwarding to yours, because main had moved again. It adds two things:

  • The TechnicalDebt line now names the stencil export among the conditions that block Z_ORDER early tests and among the unmeasured DEPTH_BEFORE_SHADER combinations.
  • stencilRefExportTests checks that DEPTH_BEFORE_SHADER with a stencil reference export still decodes as early. Making the stencil export block it as well fails that check.

I retested on the RTX 4060, Intel UHD and lavapipe 25.2.8; the description has the results.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6126022091 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4210#issuecomment-6126022091). Originally posted by [karanvora2599](https://github.com/karanvora2599) on 2026-10-12T14:12:28Z. --- Thanks @blawesom for the rebase and the RX 9070 XT run. Your resolution is right: `main`'s `!stencilRefExportEnable` belongs with the other blockers in `earlyZ`, and the backend keeps only the alpha-to-coverage guard. I pushed an equivalent rebase onto `main` at 33ae282e4 (04f97e12a) rather than fast-forwarding to yours, because `main` had moved again. It adds two things: - The TechnicalDebt line now names the stencil export among the conditions that block `Z_ORDER` early tests and among the unmeasured `DEPTH_BEFORE_SHADER` combinations. - `stencilRefExportTests` checks that `DEPTH_BEFORE_SHADER` with a stencil reference export still decodes as early. Making the stencil export block it as well fails that check. I retested on the RTX 4060, Intel UHD and lavapipe 25.2.8; the description has the results.
blawesom commented 2026-10-12 17:15:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-12T17:15:30Z.


Independent verification of your rebase — the new head builds and passes the full local suite on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, AMD RX 9070 XT / RADV): 952/952, conventions green. From my side this is merge-ready.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6129060884 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4210#issuecomment-6129060884). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-12T17:15:30Z. --- **Independent verification of your rebase** — the new head builds and passes the full local suite on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`, AMD RX 9070 XT / RADV): **952/952**, conventions green. From my side this is merge-ready.
Dextroid17 commented 2026-10-12 17:46:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-12T17:46:10Z.


Both points read as closed on this head. Read at 04f97e12a (body and diff) — read, not rebuilt here.

  • Mask export. The body now names it with the other guards, and docs/dev/TechnicalDebt.md:580 says the unmeasured combination is "a Z export, a mask export, a stencil export or alpha-to-coverage together". The gap I flagged was that it said Z-export only, which is what made the fix's scope read narrower than it is.
  • Alpha-to-coverage. The test now sets alphaToCoverage on the request itself for Z_ORDER 1 (0x10) and for DEPTH_BEFORE_SHADER (0x1000), checks that neither declares EarlyFragmentTests directly and after a serialization round trip, and the run with the guard removed fails with the message you quote. That was the half I said rested on reading the code rather than on a test.
  • The stencilRefExportTests addition — DEPTH_BEFORE_SHADER with a stencil reference export decodes as early — matches the rebase resolution @blawesom described, and it is the pairing that makes the conservative conditions readable.

Nothing further from me on this one. @blawesom's 952/952 on the rebased head is the independent run; the three device results in the body are the author's and I have not repeated them.

Written with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6129536658 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4210#issuecomment-6129536658). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-12T17:46:10Z. --- **Both points read as closed on this head.** Read at `04f97e12a` (body and diff) — read, not rebuilt here. - **Mask export.** The body now names it with the other guards, and `docs/dev/TechnicalDebt.md:580` says the unmeasured combination is *"a Z export, a mask export, a stencil export or alpha-to-coverage together"*. The gap I flagged was that it said Z-export only, which is what made the fix's scope read narrower than it is. - **Alpha-to-coverage.** The test now sets `alphaToCoverage` on the request itself for `Z_ORDER` 1 (`0x10`) and for `DEPTH_BEFORE_SHADER` (`0x1000`), checks that neither declares `EarlyFragmentTests` directly *and* after a serialization round trip, and the run with the guard removed fails with the message you quote. That was the half I said rested on reading the code rather than on a test. - The `stencilRefExportTests` addition — `DEPTH_BEFORE_SHADER` with a stencil reference export decodes as early — matches the rebase resolution @blawesom described, and it is the pairing that makes the conservative conditions readable. Nothing further from me on this one. @blawesom's 952/952 on the rebased head is the independent run; the three device results in the body are the author's and I have not repeated them. Written with AI assistance.
adriadam10 commented 2026-10-13 13:30:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T13:30:52Z.


Checked on current main: the only conflict was the TechnicalDebt entry, since the page was split into docs/dev/debt/. I moved the DEPTH_BEFORE_SHADER line to docs/dev/debt/libSceAgcDriver.md in a separate commit on your branch; the code is unchanged.

  • agc_driver_graphics (the new earlyFragmentTestsTests) fails with the code change reverted and passes with it.
  • The AgcDriver/Agc tests pass, except agc_driver_tessellation, which segfaults inside RADV on the PR and on main alike.
  • Matches @blawesom's Linux run (RX 9070 XT) and your RTX 4060 / UHD / lavapipe runs.

Merging once the full Build is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6146697302 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4210#issuecomment-6146697302). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-13T13:30:52Z. --- Checked on current `main`: the only conflict was the TechnicalDebt entry, since the page was split into `docs/dev/debt/`. I moved the `DEPTH_BEFORE_SHADER` line to `docs/dev/debt/libSceAgcDriver.md` in a separate commit on your branch; the code is unchanged. - `agc_driver_graphics` (the new `earlyFragmentTestsTests`) fails with the code change reverted and passes with it. - The AgcDriver/Agc tests pass, except `agc_driver_tessellation`, which segfaults inside RADV on the PR and on `main` alike. - Matches @blawesom's Linux run (RX 9070 XT) and your RTX 4060 / UHD / lavapipe runs. Merging once the full Build is green.
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!4210
No description provided.