feat(shader): give reads the masked-select pass keeps the whole pixel ancillary word #4031

Merged
AlxcBTW merged 3 commits from upstream-pr/4031 into main 2026-10-13 00:59:11 +00:00
AlxcBTW commented 2026-10-11 21:36:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-11T21:36:32Z.


What

Refs #2548 and #3504. With this change a select that the masked-lane walk keeps no longer stops the recompile, because every read the walk keeps gets the whole word. That lets #3550's walk budget stay low without breaking titles that need the select gone for the ancillary lowering (Stray's 0x2013010000, see #3504).

A select the masked-lane walk can't drop still stops the recompile on #3279. Palworld's 0x1b40e5c000 is one (Rohan03x on #2548: the kept select is reached through a ReadFirstLane, which reads other lanes), and so are Minecraft Dungeons II's 0x190095e900 and 0x190095fc00. With this commit every read the walk keeps gets the whole word:

  • prim type at bits 0-1: 0 point, 1 line, 2 triangle, 3 rectangle, from the draw (RasterPrimitiveOf);
  • sample index at 8-11 (SampleId, always 0 here);
  • render target index at 16-28 (Layer);
  • every other bit 0.

The layout is from the RDNA 3/3.5 ISA guides. The GCN register guides agree for layers below 2048, Mesa reads sample and layer from those bits, and AMD's LLPC reads the prim type from bits 1:0 with the same encoding. Nobody has checked it on gfx1013; TechnicalDebt.md says so.

Where the primitive class comes from (owner's call)

  1. This PR: a pipeline specialization constant, the way dual-source blending does it (#1492). The class is a request field. It is folded into the specialized module and is part of the result memo, the draw key and the serialized request (version 17 → 18). The class costs nothing per pixel: it is a constant in the module. Only shaders that read it get a module per class: ShaderInfo records the read (disk cache format 27 → 28), and a shader that reads only the sample or layer field keeps one module. The draw sets the class only when the pixel shader loads the ancillary VGPR, so other draws keep their draw-cache entries.
  2. Run-time per-draw data: needs a layout change, so not done. Nothing the fragment shader receives today carries the class. Its push data is its own compact shader-data block (user SGPRs, buffer offsets, image metadata: IrBindingLayout in DescriptorBinding.hpp), and no fragment builtin can tell a rect list (drawn as tessellated triangles) from a triangle. The smallest run-time variant adds one dword to that block in shaders that read the class, and patches it per draw from Graphics::State the way ShaderResources patches guest buffer offsets (pushByte for push constants, dataByte for the ShaderData buffer). The module key, result memo, draw key and request format could then stay as on main. But the shader-data layout changes (IrBindingLayout, disk cache format), the block spills to the ShaderData buffer one dword sooner, and every pixel wave loads the class instead of using a constant.
  3. Specialization when the pipeline is created (not built). The driver could pass constant 8233 through VkSpecializationInfo from Graphics::State, whose pipeline key already holds the topology and rect-list state. The request format, module key, result memo and draw key would then stay as on main. Prepared modules would have to leave that one constant open (buildSpecializedModule requires every SpecId today), and the GPL fragment-library key would need the class for shaders that read it.

Tested

main d592d54e1 is merged into the branch (no rebase). The head is e24413c44. main writes request version 17 with stencilRefExportEnable as its last pixel field, so rasterPrimitive is written after it and read from version 18: a version 17 request from main still reads, and ShaderMemory.cpp checks the version 18 prefix, rejects 19 and truncates over all 20 trailing pixel bytes. The disk cache format is 28. The conflict resolutions match @blawesom's rebase (771c00783) except for that version.

#4150, merged since, added agc_driver_relative_ancillary. Its last case expected a whole-word read through v_movrels to be refused; #4150 notes that this PR composes that word. The one commit on top of the merge turns that case into a check of the composed word: the shader converts the word to float and exports it, and a triangle draw's word is 2, so the pixel is 255, with and without the implicit position inputs in front of the ancillary VGPR. In TechnicalDebt, the relative addressing entry no longer says that whole-word uses throw.

  • Windows 11, RTX 5070 Laptop (NVIDIA; the AMD iGPU is hidden from the Vulkan loader), with test binaries built on a second Windows 11 machine (MinGW GCC 15.2.0, Release): agc_driver_pixel_ancillary_word, agc_driver_relative_ancillary, agc_driver_graphics, agc_driver_dual_source_blend and agc_driver_alpha_to_coverage pass. relative_ancillary failed on the bare merge (77f0a568b), before the test update, with "an unsupported ancillary word was accepted".
  • Fork CI, run 38278984147, with e24413c44 merged into the fork's main: Linux passes 968 of 968 (lavapipe; 43 skipped for features lavapipe lacks), including agc_driver_pixel_ancillary_word, agc_driver_relative_ancillary, pixel_ancillary and agc_shader_memory. Windows passes 974 of 974, with the GPU tests skipped for lack of a device.
  • The same build machine, non-GPU ctest -E '^agc_driver|^video_out|^guest_video': 618 of 619 pass, including pixel_ancillary, agc_shader_memory and agc_shader_disk_cache. log_macros fails there on every branch and passes in CI.
  • tools/check_conventions.py --base origin/main passes.

Earlier, rebased onto main a11c8f7f7 as one commit (db92ece3c):

  • Windows 11, RTX 5070 Laptop: the agc_driver set passes 296 of 297. agc_driver_emulated_color_compare fails the same way on main (sRGB sampling refusal).
  • With #3550 (b58c0428) on main, tested by @ThatsLeo on Intel Arc (Mesa 26.2.3) and lavapipe (comment): all 43 Stray (PPSA02101) requests compile at a 32x budget and pass spirv-val --target-env vulkan1.3. The two slow shaders of #3504 take 1.0 and 2.2 s, and 0x2013010000 compiles at every budget.

Before the rebase (on main plus #3279):

Windows 11, RTX 5070 Laptop GPU (NVIDIA driver; the AMD iGPU is hidden from the Vulkan loader):

  • Full local ctest -j4: 764 of 766 pass. guest_filesystem fails the same way on a tree without this commit, and guest_sce_net timed out under load and passes on its own.
  • agc_driver_pixel_ancillary_word exports the word from a draw and reads back 2, 3 and 1 for the triangle, rectangle and line classes. The draw itself is a triangle and the request carries the class, as DrawDecode sets it; the test checks RasterPrimitiveOf on its own. It also compiles one whole-word shader and one that reads only the sample field (v_bfe_u32 v20, v0, 8, 4) for the three classes: the whole-word shader gets three modules of 629 SPIR-V words, and the sample-only shader shares one module of 616 words.
  • Negative checks: with the composition disabled, pixel_ancillary and agc_driver_pixel_ancillary_word fail with the old unsupported live use refusal. If the module key is keyed on ANCILLARY_ENA instead of on the read, the module check fails (sample field only: a line or rectangle draw built its own module).
  • tools/check_conventions.py passes.
  • Titles: the composition is the same as in AlxcBTW/AnyPS5#30/#37/#38, where Minecraft Dungeons II (MisterbALLIN) moved on to #425 and Palworld's 0x1b40e5c000 compiled in Rohan03x's offline replay.
  • Kena: Bridge of Spirits (PPSA01802), run by alfalfa-star on Arch Linux, RADV (RX 9070 XT): its pixel shader 0x20b8770000 is refused on main 1e8fff68 and with #3391 added, and compiles with this head (74,245 SPIR-V words). In game the per-frame skips of that draw are gone, with no GPU hang in two runs (2.5 and 4 min). Other draws on that frame are still skipped, so this shader's output is not checked yet.
  • CI, run 38115746038: Windows passes 766 of 766, with the GPU tests skipped for lack of a device. Linux passes 761 of 762 (lavapipe, SPIRV-Tools on), and agc_driver_pixel_ancillary_word passes there. The one failure is agc_unit_shadow, which fails on this base without the change too (#1429, fixed on main by #3226).

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 (pairs with #3550, see #3504)
  • Unblocks: none on its own; with #3550, Stray (PPSA02101) pixel shader 0x2013010000 (#3504; Game bring-up #2461 is PPSA02100)
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4822544734 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4031). Originally posted by [AlxcBTW](https://github.com/AlxcBTW) on 2026-10-11T21:36:32Z. --- ### What Refs #2548 and #3504. With this change a select that the masked-lane walk keeps no longer stops the recompile, because every read the walk keeps gets the whole word. That lets #3550's walk budget stay low without breaking titles that need the select gone for the ancillary lowering (Stray's `0x2013010000`, see #3504). A select the masked-lane walk can't drop still stops the recompile on #3279. Palworld's `0x1b40e5c000` is one (Rohan03x on #2548: the kept select is reached through a `ReadFirstLane`, which reads other lanes), and so are Minecraft Dungeons II's `0x190095e900` and `0x190095fc00`. With this commit every read the walk keeps gets the whole word: - prim type at bits 0-1: 0 point, 1 line, 2 triangle, 3 rectangle, from the draw (`RasterPrimitiveOf`); - sample index at 8-11 (SampleId, always 0 here); - render target index at 16-28 (Layer); - every other bit 0. The layout is from the RDNA 3/3.5 ISA guides. The GCN register guides agree for layers below 2048, Mesa reads sample and layer from those bits, and AMD's LLPC reads the prim type from bits 1:0 with the same encoding. Nobody has checked it on gfx1013; TechnicalDebt.md says so. #### Where the primitive class comes from (owner's call) 1. **This PR: a pipeline specialization constant, the way dual-source blending does it (#1492).** The class is a request field. It is folded into the specialized module and is part of the result memo, the draw key and the serialized request (version 17 → 18). The class costs nothing per pixel: it is a constant in the module. Only shaders that read it get a module per class: ShaderInfo records the read (disk cache format 27 → 28), and a shader that reads only the sample or layer field keeps one module. The draw sets the class only when the pixel shader loads the ancillary VGPR, so other draws keep their draw-cache entries. 2. **Run-time per-draw data: needs a layout change, so not done.** Nothing the fragment shader receives today carries the class. Its push data is its own compact shader-data block (user SGPRs, buffer offsets, image metadata: `IrBindingLayout` in `DescriptorBinding.hpp`), and no fragment builtin can tell a rect list (drawn as tessellated triangles) from a triangle. The smallest run-time variant adds one dword to that block in shaders that read the class, and patches it per draw from `Graphics::State` the way `ShaderResources` patches guest buffer offsets (`pushByte` for push constants, `dataByte` for the ShaderData buffer). The module key, result memo, draw key and request format could then stay as on `main`. But the shader-data layout changes (`IrBindingLayout`, disk cache format), the block spills to the ShaderData buffer one dword sooner, and every pixel wave loads the class instead of using a constant. 3. **Specialization when the pipeline is created (not built).** The driver could pass constant 8233 through `VkSpecializationInfo` from `Graphics::State`, whose pipeline key already holds the topology and rect-list state. The request format, module key, result memo and draw key would then stay as on `main`. Prepared modules would have to leave that one constant open (`buildSpecializedModule` requires every SpecId today), and the GPL fragment-library key would need the class for shaders that read it. ### Tested `main` `d592d54e1` is merged into the branch (no rebase). The head is `e24413c44`. `main` writes request version 17 with `stencilRefExportEnable` as its last pixel field, so `rasterPrimitive` is written after it and read from version 18: a version 17 request from `main` still reads, and `ShaderMemory.cpp` checks the version 18 prefix, rejects 19 and truncates over all 20 trailing pixel bytes. The disk cache format is 28. The conflict resolutions match @blawesom's rebase (`771c00783`) except for that version. #4150, merged since, added `agc_driver_relative_ancillary`. Its last case expected a whole-word read through `v_movrels` to be refused; #4150 notes that this PR composes that word. The one commit on top of the merge turns that case into a check of the composed word: the shader converts the word to float and exports it, and a triangle draw's word is 2, so the pixel is 255, with and without the implicit position inputs in front of the ancillary VGPR. In TechnicalDebt, the relative addressing entry no longer says that whole-word uses throw. - Windows 11, RTX 5070 Laptop (NVIDIA; the AMD iGPU is hidden from the Vulkan loader), with test binaries built on a second Windows 11 machine (MinGW GCC 15.2.0, Release): `agc_driver_pixel_ancillary_word`, `agc_driver_relative_ancillary`, `agc_driver_graphics`, `agc_driver_dual_source_blend` and `agc_driver_alpha_to_coverage` pass. `relative_ancillary` failed on the bare merge (`77f0a568b`), before the test update, with "an unsupported ancillary word was accepted". - Fork CI, [run 38278984147](https://github.com/AlxcBTW/AnyPS5/actions/runs/38278984147), with `e24413c44` merged into the fork's `main`: Linux passes 968 of 968 (lavapipe; 43 skipped for features lavapipe lacks), including `agc_driver_pixel_ancillary_word`, `agc_driver_relative_ancillary`, `pixel_ancillary` and `agc_shader_memory`. Windows passes 974 of 974, with the GPU tests skipped for lack of a device. - The same build machine, non-GPU `ctest -E '^agc_driver|^video_out|^guest_video'`: 618 of 619 pass, including `pixel_ancillary`, `agc_shader_memory` and `agc_shader_disk_cache`. `log_macros` fails there on every branch and passes in CI. - `tools/check_conventions.py --base origin/main` passes. Earlier, rebased onto `main` `a11c8f7f7` as one commit (`db92ece3c`): - Windows 11, RTX 5070 Laptop: the `agc_driver` set passes 296 of 297. `agc_driver_emulated_color_compare` fails the same way on `main` (sRGB sampling refusal). - With #3550 (`b58c0428`) on `main`, tested by @ThatsLeo on Intel Arc (Mesa 26.2.3) and lavapipe ([comment](https://github.com/boykopovar/AnyPS5/issues/3504#issuecomment-6114021265)): all 43 Stray (PPSA02101) requests compile at a 32x budget and pass `spirv-val --target-env vulkan1.3`. The two slow shaders of #3504 take 1.0 and 2.2 s, and `0x2013010000` compiles at every budget. Before the rebase (on `main` plus #3279): Windows 11, RTX 5070 Laptop GPU (NVIDIA driver; the AMD iGPU is hidden from the Vulkan loader): - Full local `ctest -j4`: 764 of 766 pass. `guest_filesystem` fails the same way on a tree without this commit, and `guest_sce_net` timed out under load and passes on its own. - `agc_driver_pixel_ancillary_word` exports the word from a draw and reads back 2, 3 and 1 for the triangle, rectangle and line classes. The draw itself is a triangle and the request carries the class, as `DrawDecode` sets it; the test checks `RasterPrimitiveOf` on its own. It also compiles one whole-word shader and one that reads only the sample field (`v_bfe_u32 v20, v0, 8, 4`) for the three classes: the whole-word shader gets three modules of 629 SPIR-V words, and the sample-only shader shares one module of 616 words. - Negative checks: with the composition disabled, `pixel_ancillary` and `agc_driver_pixel_ancillary_word` fail with the old `unsupported live use` refusal. If the module key is keyed on ANCILLARY_ENA instead of on the read, the module check fails (`sample field only: a line or rectangle draw built its own module`). - `tools/check_conventions.py` passes. - Titles: the composition is the same as in AlxcBTW/AnyPS5#30/#37/#38, where Minecraft Dungeons II (MisterbALLIN) moved on to #425 and Palworld's `0x1b40e5c000` compiled in Rohan03x's offline replay. - Kena: Bridge of Spirits (PPSA01802), run by alfalfa-star on Arch Linux, RADV (RX 9070 XT): its pixel shader `0x20b8770000` is refused on `main` 1e8fff68 and with #3391 added, and compiles with this head (74,245 SPIR-V words). In game the per-frame skips of that draw are gone, with no GPU hang in two runs (2.5 and 4 min). Other draws on that frame are still skipped, so this shader's output is not checked yet. - CI, [run 38115746038](https://github.com/AlxcBTW/AnyPS5/actions/runs/38115746038): Windows passes 766 of 766, with the GPU tests skipped for lack of a device. Linux passes 761 of 762 (lavapipe, SPIRV-Tools on), and `agc_driver_pixel_ancillary_word` passes there. The one failure is `agc_unit_shadow`, which fails on this base without the change too (#1429, fixed on `main` by #3226). ### 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 (pairs with #3550, see #3504) - [x] Unblocks: none on its own; with #3550, Stray (PPSA02101) pixel shader `0x2013010000` (#3504; Game bring-up #2461 is PPSA02100) - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
blawesom commented 2026-10-12 13:34:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-12T13:34:58Z.


Rebase handoff — rebased onto current main, authorship unchanged.

Four files conflicted, all the additive-field shape: main landed stencilRefExportEnable where this PR threads rasterPrimitive through the pixel-stage info, serializer and tests. The resolution keeps both — both fields, both serialization entries, both round-trip checks, and both test families (main's StartingQuad series and this PR's whole-word series).

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: 955/955 passed

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/4031
git checkout <your branch>
git merge --ff-only FETCH_HEAD

Head is 771c00783.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6125361547 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4031#issuecomment-6125361547). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-12T13:34:58Z. --- **Rebase handoff** — rebased onto current `main`, authorship unchanged. Four files conflicted, all the additive-field shape: `main` landed `stencilRefExportEnable` where this PR threads `rasterPrimitive` through the pixel-stage info, serializer and tests. The resolution keeps **both** — both fields, both serialization entries, both round-trip checks, and both test families (main's StartingQuad series and this PR's whole-word series). 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: 955/955 passed** **To pick it up:** ``` git fetch https://github.com/blawesom/AnyPS5 rebase/4031 git checkout <your branch> git merge --ff-only FETCH_HEAD ``` Head is `771c00783`.
AlxcBTW commented 2026-10-12 17:04:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-12T17:04:49Z.


@blawesom thanks for the rebase and for running the whole suite on RADV.

The branch now has main merged into it rather than rebased, so its history stays as it was. The conflicts are resolved the way you did it: both fields, both serializer entries, and both test families (the StartingQuad series and the whole-word series).

The one difference is the request serialization version. main already writes version 17 with stencilRefExportEnable as the last pixel field. If rasterPrimitive is also read from 17, a version 17 request written by main comes up one byte short: the reader expects the primitive class after the stencil flag and fails with "truncated data". This head writes version 18, reads the stencil flag from 17 and the primitive class from 18. The ShaderMemory.cpp checks follow: the NVNQQRIAAAA= prefix, rejection of version 19, and truncation over all 20 trailing pixel bytes, so the primitive class byte is covered too. The disk cache format stays 28.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6128902748 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4031#issuecomment-6128902748). Originally posted by [AlxcBTW](https://github.com/AlxcBTW) on 2026-10-12T17:04:49Z. --- @blawesom thanks for the rebase and for running the whole suite on RADV. The branch now has `main` merged into it rather than rebased, so its history stays as it was. The conflicts are resolved the way you did it: both fields, both serializer entries, and both test families (the StartingQuad series and the whole-word series). The one difference is the request serialization version. `main` already writes version 17 with `stencilRefExportEnable` as the last pixel field. If `rasterPrimitive` is also read from 17, a version 17 request written by `main` comes up one byte short: the reader expects the primitive class after the stencil flag and fails with "truncated data". This head writes version 18, reads the stencil flag from 17 and the primitive class from 18. The `ShaderMemory.cpp` checks follow: the `NVNQQRIAAAA=` prefix, rejection of version 19, and truncation over all 20 trailing pixel bytes, so the primitive class byte is covered too. The disk cache format stays 28. AI-assisted: yes (Claude Code)
blawesom commented 2026-10-12 17:49:49 +00:00 (Migrated from github.com)

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


Verified your merged head (e24413c44): builds, conventions pass, and the full suite is 958/958 on RADV — including the serializer round-trips and the new version-18 coverage.

And credit where due: the version bump is a catch my rebase missed. I merged both fields but kept the primitive class read at version 17 — which is exactly the one-byte-short truncation you describe for main-written version-17 requests. Writing 18 and splitting the reads (stencil from 17, primitive from 18) is the right wire behavior, and the NVNQQRIAAAA= + version-19 rejection + 20-byte truncation coverage settles it. From my side this is merge-ready.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6129590608 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4031#issuecomment-6129590608). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-12T17:49:49Z. --- Verified your merged head (`e24413c44`): builds, conventions pass, and the **full suite is 958/958 on RADV** — including the serializer round-trips and the new version-18 coverage. And credit where due: the version bump is a catch my rebase missed. I merged both fields but kept the primitive class read at version 17 — which is exactly the one-byte-short truncation you describe for main-written version-17 requests. Writing 18 and splitting the reads (stencil from 17, primitive from 18) is the right wire behavior, and the `NVNQQRIAAAA=` + version-19 rejection + 20-byte truncation coverage settles it. From my side this is merge-ready.
LeandroLP23 commented 2026-10-12 22:15:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-12T22:15:50Z.


Ran this on AMD hardware, since the GPU tests in CI run only on lavapipe: Windows 11 (26300), Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), WinLibs GCC 15.2.0, Release, BUILD_TESTING=ON. Head dd8403112 merged onto main 584cc4c57.

GPU tests (ctest -R '^agc_|pixel_ancillary' -j 1, test shader cache emptied first):

Build Result Failing
main 584cc4c57 445/446 agc_driver_relative_ancillary
main + this PR 445/447 agc_driver_relative_ancillary, agc_driver_pixel_ancillary_word

agc_driver_pixel_ancillary_word is this PR's new test, and it fails 5 runs of 5:

AGC graphics: ANCILLARY alone, triangle: pixel (0, 0) holds (nan, nan, nan, nan)

The target is filled with 0xff before the draw, so NaN means pixel (0, 0) was never written. The draw didn't land there, as opposed to writing a wrong word.

With APS5_NO_PIPELINE_LTO=1 it still fails 3 of 3, but not always on the same case: twice on "ANCILLARY alone, triangle" and once on "ANCILLARY after the perspective center, rectangle". Each time the pixel is unwritten. APS5_NO_GPL=1 and APS5_SPIRV_OPT=none give the triangle failure too.

agc_driver_relative_ancillary (from #4150) already fails on plain main on this GPU, 3 of 3: wave 32 packed read / relative ancillary draw produced an incorrect pixel: 64. That test fills its target with 0x40 (64) before drawing, so this is the same signature: the draw left the pixel unwritten. Both tests draw with a pixel shader that reads the ancillary VGPR, and on this GPU those draws leave pixels unwritten on main too. So it doesn't look specific to this PR. I'll report the main failure separately.

Other tests: ctest -E '^agc_|pixel_ancillary' -j 4: 572/572 with this PR.

Titles. Seven homebrew titles that render on main were run for 60 s each, with and without this PR: Stremio Plus, Capy Mobile, DriftCheck, EVO Player, Jelly5, Emby5 and OpenRCT2. All seven run the full 60 s either way, with no stop and no new error. None of them reaches the shaders this PR is for, so this only checks for regressions.

I haven't looked into why the draw leaves pixels unwritten on this GPU. I can run a diagnostic build or more cases if that helps.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6133606861 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4031#issuecomment-6133606861). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-12T22:15:50Z. --- Ran this on AMD hardware, since the GPU tests in CI run only on lavapipe: Windows 11 (26300), Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), WinLibs GCC 15.2.0, Release, `BUILD_TESTING=ON`. Head `dd8403112` merged onto `main` `584cc4c57`. **GPU tests** (`ctest -R '^agc_|pixel_ancillary' -j 1`, test shader cache emptied first): | Build | Result | Failing | |---|---|---| | `main` `584cc4c57` | 445/446 | `agc_driver_relative_ancillary` | | `main` + this PR | 445/447 | `agc_driver_relative_ancillary`, **`agc_driver_pixel_ancillary_word`** | `agc_driver_pixel_ancillary_word` is this PR's new test, and it fails 5 runs of 5: ``` AGC graphics: ANCILLARY alone, triangle: pixel (0, 0) holds (nan, nan, nan, nan) ``` The target is filled with `0xff` before the draw, so NaN means pixel (0, 0) was never written. The draw didn't land there, as opposed to writing a wrong word. With `APS5_NO_PIPELINE_LTO=1` it still fails 3 of 3, but not always on the same case: twice on "ANCILLARY alone, triangle" and once on "ANCILLARY after the perspective center, rectangle". Each time the pixel is unwritten. `APS5_NO_GPL=1` and `APS5_SPIRV_OPT=none` give the triangle failure too. `agc_driver_relative_ancillary` (from #4150) already fails on plain `main` on this GPU, 3 of 3: `wave 32 packed read` / `relative ancillary draw produced an incorrect pixel: 64`. That test fills its target with `0x40` (64) before drawing, so this is the same signature: the draw left the pixel unwritten. Both tests draw with a pixel shader that reads the ancillary VGPR, and on this GPU those draws leave pixels unwritten on `main` too. So it doesn't look specific to this PR. I'll report the `main` failure separately. **Other tests:** `ctest -E '^agc_|pixel_ancillary' -j 4`: 572/572 with this PR. **Titles.** Seven homebrew titles that render on `main` were run for 60 s each, with and without this PR: Stremio Plus, Capy Mobile, DriftCheck, EVO Player, Jelly5, Emby5 and OpenRCT2. All seven run the full 60 s either way, with no stop and no new error. None of them reaches the shaders this PR is for, so this only checks for regressions. I haven't looked into why the draw leaves pixels unwritten on this GPU. I can run a diagnostic build or more cases if that helps. AI-assisted: yes (Claude Code)
AlxcBTW commented 2026-10-12 22:51:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-12T22:51:54Z.


@LeandroLP23 thanks for running both tests on the 860M, and for noticing that the main failure has the same signature. That pointed straight at the cause.

It is not the sample index and not invalid SPIR-V from this PR. It is AMD's shader compiler (LLPC) programming the position exports inconsistently when a pixel shader reads gl_Layer and the vertex shader writes gl_ClipDistance but not gl_Layer.

Both failing draws read the reconstructed ancillary word, so their pixel shaders read SampleId and Layer. On main, the packed read in relative_ancillary also builds the whole word from both. Since #3878 (the all-zero position clip), every vertex shader AnyPS5 emits that exports a position also writes gl_ClipDistance[0]. With that pair, the 2025 LLPC:

  • adds a position export for the missing layer (exp pos1 off, off, v0, off, only z) and moves the clip distance to pos2;
  • but derives SPI_SHADER_POS_FORMAT and PA_CL_VS_OUT_CNTL from the vertex shader's own outputs: two position exports, no misc vector, the clip distance vector at pos1, and CLIP_DIST_ENA_0 and CULL_DIST_ENA_0 set.

So the rasterizer takes clip distance 0 from pos1.x, which the shader never writes. It holds whatever was left in the position buffer, and when that value is negative the triangle is clipped or culled. That is why the target keeps its fill value, and why the failing case changes between runs.

How I checked it, all on the CPU:

  • I dumped the SPIR-V of both tests from lavapipe (MESA_SPIRV_DUMP_PATH). spirv-val --target-env vulkan1.3 passes on every module, and the validation layers on lavapipe report nothing for either test.
  • The built-ins are within the spec. SampleId turns on sample shading. Layer reads 0 when the pre-rasterization stage doesn't write it. The geometryShader and sampleRateShading features are enabled. The interface has no user varyings.
  • I compiled the exact vertex and pixel modules for gfx1152 with the amdllpc that ships in Radeon GPU Analyzer:
amdllpc from Position exports Registers
RGA 2.12 (March 2025), 2.13 (June 2025) pos0, pos1 (layer, z only), pos2 (clip) 2 exports, no misc vector, clip vector at pos1
RGA 2.14 (November 2025), 2.14.2 pos0, pos1 (clip) 2 exports, clip vector at pos1

With 2.13, the same clip distance with a pixel shader that reads only gl_SampleID, or no built-in at all, compiles consistently. Only the gl_Layer read adds the extra export. In the public LLPC source (April 2025), LowerInOut.cpp forces useLayer for the pixel shader's sake, while RegisterMetadataBuilder.cpp only looks at builtInUsage.vs.layer. Going by the version numbers, your driver (32.0.13058) comes from the same 24.30 branch as Adrenalin 25.3 and 25.4, which is before the change.

A minimal repro outside AnyPS5: the vertex shader writes gl_Position and gl_ClipDistance[0] = 0.0 but not gl_Layer, the fragment shader writes vec4(float(gl_Layer), 0.0, 0.0, 1.0), and a full-screen triangle draws into a target pre-filled with a sentinel. On an affected driver some or all pixels keep the sentinel. Dropping either the clip distance or the gl_Layer read makes it correct.

One check would confirm it on your machine. In core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp, in DefineOutputs, change if (exportsPosition && (stage == IrShaderStage::Vertex || stage == IrShaderStage::TessellationEvaluation)) to if (false && exportsPosition && (stage == IrShaderStage::Vertex || stage == IrShaderStage::TessellationEvaluation)). That drops the zero-position clip distance. Rebuild and run ctest -R "relative_ancillary|pixel_ancillary_word" --output-on-failure a few times. If both pass on every run, this is the cause. agc_driver_zero_position_vertex will fail with that patch, which is expected. A current Adrenalin driver should pass without the patch, but I could only check the compiler from RGA, not the Windows driver itself.

If it confirms, AnyPS5 can keep clear of this on older drivers. When the pre-rasterization stage doesn't write Layer, the layer field is 0 by the spec, so the pixel shader doesn't need to read gl_Layer at all. That would be a separate PR.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6134146166 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4031#issuecomment-6134146166). Originally posted by [AlxcBTW](https://github.com/AlxcBTW) on 2026-10-12T22:51:54Z. --- @LeandroLP23 thanks for running both tests on the 860M, and for noticing that the `main` failure has the same signature. That pointed straight at the cause. It is not the sample index and not invalid SPIR-V from this PR. It is AMD's shader compiler (LLPC) programming the position exports inconsistently when a pixel shader reads `gl_Layer` and the vertex shader writes `gl_ClipDistance` but not `gl_Layer`. Both failing draws read the reconstructed ancillary word, so their pixel shaders read `SampleId` and `Layer`. On `main`, the packed read in `relative_ancillary` also builds the whole word from both. Since #3878 (the all-zero position clip), every vertex shader AnyPS5 emits that exports a position also writes `gl_ClipDistance[0]`. With that pair, the 2025 LLPC: - adds a position export for the missing layer (`exp pos1 off, off, v0, off`, only z) and moves the clip distance to `pos2`; - but derives `SPI_SHADER_POS_FORMAT` and `PA_CL_VS_OUT_CNTL` from the vertex shader's own outputs: two position exports, no misc vector, the clip distance vector at `pos1`, and `CLIP_DIST_ENA_0` and `CULL_DIST_ENA_0` set. So the rasterizer takes clip distance 0 from `pos1.x`, which the shader never writes. It holds whatever was left in the position buffer, and when that value is negative the triangle is clipped or culled. That is why the target keeps its fill value, and why the failing case changes between runs. How I checked it, all on the CPU: - I dumped the SPIR-V of both tests from lavapipe (`MESA_SPIRV_DUMP_PATH`). `spirv-val --target-env vulkan1.3` passes on every module, and the validation layers on lavapipe report nothing for either test. - The built-ins are within the spec. `SampleId` turns on sample shading. `Layer` reads 0 when the pre-rasterization stage doesn't write it. The `geometryShader` and `sampleRateShading` features are enabled. The interface has no user varyings. - I compiled the exact vertex and pixel modules for gfx1152 with the `amdllpc` that ships in Radeon GPU Analyzer: | `amdllpc` from | Position exports | Registers | |---|---|---| | RGA 2.12 (March 2025), 2.13 (June 2025) | `pos0`, `pos1` (layer, z only), `pos2` (clip) | 2 exports, no misc vector, clip vector at `pos1` | | RGA 2.14 (November 2025), 2.14.2 | `pos0`, `pos1` (clip) | 2 exports, clip vector at `pos1` | With 2.13, the same clip distance with a pixel shader that reads only `gl_SampleID`, or no built-in at all, compiles consistently. Only the `gl_Layer` read adds the extra export. In the public LLPC source (April 2025), `LowerInOut.cpp` forces `useLayer` for the pixel shader's sake, while `RegisterMetadataBuilder.cpp` only looks at `builtInUsage.vs.layer`. Going by the version numbers, your driver (32.0.13058) comes from the same 24.30 branch as Adrenalin 25.3 and 25.4, which is before the change. A minimal repro outside AnyPS5: the vertex shader writes `gl_Position` and `gl_ClipDistance[0] = 0.0` but not `gl_Layer`, the fragment shader writes `vec4(float(gl_Layer), 0.0, 0.0, 1.0)`, and a full-screen triangle draws into a target pre-filled with a sentinel. On an affected driver some or all pixels keep the sentinel. Dropping either the clip distance or the `gl_Layer` read makes it correct. One check would confirm it on your machine. In `core/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cpp`, in `DefineOutputs`, change `if (exportsPosition && (stage == IrShaderStage::Vertex || stage == IrShaderStage::TessellationEvaluation))` to `if (false && exportsPosition && (stage == IrShaderStage::Vertex || stage == IrShaderStage::TessellationEvaluation))`. That drops the zero-position clip distance. Rebuild and run `ctest -R "relative_ancillary|pixel_ancillary_word" --output-on-failure` a few times. If both pass on every run, this is the cause. `agc_driver_zero_position_vertex` will fail with that patch, which is expected. A current Adrenalin driver should pass without the patch, but I could only check the compiler from RGA, not the Windows driver itself. If it confirms, AnyPS5 can keep clear of this on older drivers. When the pre-rasterization stage doesn't write `Layer`, the layer field is 0 by the spec, so the pixel shader doesn't need to read `gl_Layer` at all. That would be a separate PR. AI-assisted: yes (Claude Code)
LeandroLP23 commented 2026-10-12 23:27:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-12T23:27:59Z.


@AlxcBTW the AMD failure above comes from reading the unwritten Layer builtin (#4800). #4842 replaces the render target index field with 0 in lowerPackedAncillary. With #4842 merged under this branch and the same 0 at your whole-word read (insertBuiltin(..., StageInputKind::Layer) shifted by 16), agc_driver_pixel_ancillary_word passes 3/3 on the Radeon 860M. Whichever of the two merges second needs that line and the pixel_ancillary cases reconciled; happy to do it on my side if this one goes first.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6134580119 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4031#issuecomment-6134580119). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-12T23:27:59Z. --- @AlxcBTW the AMD failure above comes from reading the unwritten `Layer` builtin (#4800). #4842 replaces the render target index field with 0 in `lowerPackedAncillary`. With #4842 merged under this branch and the same 0 at your whole-word read (`insertBuiltin(..., StageInputKind::Layer)` shifted by 16), `agc_driver_pixel_ancillary_word` passes 3/3 on the Radeon 860M. Whichever of the two merges second needs that line and the `pixel_ancillary` cases reconciled; happy to do it on my side if this one goes first.
oneandonlydean commented 2026-10-12 23:52:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T23:52:42Z.


Three things on dd840311 before the question of the unknown bits:

  • Request version. main reads target.vertexSubgroups at version 18 since #4470 (RequestSerializer.cpp:793). This head reads rasterPrimitive at 18 as well (:387), so a version-18 request written by main is read one byte short. It needs 19, with the prefix and reject-version checks in ShaderMemory.cpp moved; it is the same collision you caught at 17.
  • Layer. ComposePackedAncillary still inserts GetBuiltin Layer << 16, so agc_driver_pixel_ancillary_word fails on the 860M as LeandroLP23 showed. #4842 makes that field 0 on main; it should go in first and this take the same 0.
  • It conflicts with main in docs/dev/debt/shader.md.

On the word itself nothing has changed since #1179: bits 2-7, 12-15 and 29-31 are zero by argument, not by measurement, and that is the rule adriadam10 set there, so it is his or the owner's call and not mine.

Kena's remaining shader may not need the word at all. (used by SelectU32 1065353216 ?) is a select between 1.0f and the register, which reads like the VGPR reused for a float with the word left on the other arm, and that is a case for one more rule in the masked-select pass. @fma-rc could you attach the .req for 0x20b6440000, or the IR around that select? If a rule covers it, Kena compiles exactly and this PR is left with the shaders that really export the word, if there are any.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6134856415 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4031#issuecomment-6134856415). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-12T23:52:42Z. --- Three things on dd840311 before the question of the unknown bits: - **Request version.** `main` reads `target.vertexSubgroups` at version 18 since #4470 (`RequestSerializer.cpp:793`). This head reads `rasterPrimitive` at 18 as well (`:387`), so a version-18 request written by `main` is read one byte short. It needs 19, with the prefix and reject-version checks in `ShaderMemory.cpp` moved; it is the same collision you caught at 17. - **Layer.** `ComposePackedAncillary` still inserts `GetBuiltin Layer << 16`, so `agc_driver_pixel_ancillary_word` fails on the 860M as LeandroLP23 showed. #4842 makes that field 0 on `main`; it should go in first and this take the same 0. - It conflicts with `main` in `docs/dev/debt/shader.md`. On the word itself nothing has changed since #1179: bits 2-7, 12-15 and 29-31 are zero by argument, not by measurement, and that is the rule adriadam10 set there, so it is his or the owner's call and not mine. Kena's remaining shader may not need the word at all. `(used by SelectU32 1065353216 ?)` is a select between `1.0f` and the register, which reads like the VGPR reused for a float with the word left on the other arm, and that is a case for one more rule in the masked-select pass. @fma-rc could you attach the `.req` for `0x20b6440000`, or the IR around that select? If a rule covers it, Kena compiles exactly and this PR is left with the shaders that really export the word, if there are any.
fma-rc commented 2026-10-13 00:14:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-13T00:14:57Z.


@oneandonlydean here is the request for 0x20b6440000: https://github.com/fma-rc/AnyPS5/raw/evidence/kena-shader-20b6440000/shader_20b6440000.req

It is the file APS5_DUMP_SHADERS wrote, unchanged: 936 code words, 30 user data words, 2 memory regions, wave64. agc_shader_replay built from main d38d98bc8 (with one unrelated local change in the driver's texture code) still stops on it with packed pixel ancillary input has an unsupported live use (used by SelectU32 1065353216 ?).

I have no IR dump at the failing point, the tool only prints the instruction listing for it. I can post that listing, or the other 16 Kena requests, if either helps with the select rule.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6135116744 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4031#issuecomment-6135116744). Originally posted by [fma-rc](https://github.com/fma-rc) on 2026-10-13T00:14:57Z. --- @oneandonlydean here is the request for `0x20b6440000`: https://github.com/fma-rc/AnyPS5/raw/evidence/kena-shader-20b6440000/shader_20b6440000.req It is the file `APS5_DUMP_SHADERS` wrote, unchanged: 936 code words, 30 user data words, 2 memory regions, wave64. `agc_shader_replay` built from `main` d38d98bc8 (with one unrelated local change in the driver's texture code) still stops on it with `packed pixel ancillary input has an unsupported live use (used by SelectU32 1065353216 ?)`. I have no IR dump at the failing point, the tool only prints the instruction listing for it. I can post that listing, or the other 16 Kena requests, if either helps with the select rule.
github-actions[bot] commented 2026-10-13 00:40:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T00:40:08Z.


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.

Pull request Conflicting files (lines on main) Same exports Same new files
#3763 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L1811, L1816
#4451 core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp L117
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cpp L72
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cpp L108
core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L1811, L1813-1814, L1816, L1905-1906
core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp L328, L377, L739, L770
core/shader/recompiler/Recompiler.hpp L144
#4706 docs/dev/debt/shader.md L100-102
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6135424177 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4031#issuecomment-6135424177). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-13T00:40:08Z. --- <!-- pr-overlap --> 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**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #3763 | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp` [L1811](https://github.com/boykopovar/AnyPS5/blob/4430780bdd8875fda79b96540c5f46739f4f8687/core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp#L1811), [L1816](https://github.com/boykopovar/AnyPS5/blob/4430780bdd8875fda79b96540c5f46739f4f8687/core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp#L1816) | | | | #4451 | `core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp` [L117](https://github.com/boykopovar/AnyPS5/blob/4430780bdd8875fda79b96540c5f46739f4f8687/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp#L117)<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cpp` [L72](https://github.com/boykopovar/AnyPS5/blob/4430780bdd8875fda79b96540c5f46739f4f8687/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cpp#L72)<br>`core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cpp` [L108](https://github.com/boykopovar/AnyPS5/blob/4430780bdd8875fda79b96540c5f46739f4f8687/core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cpp#L108)<br>`core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp` [L1811](https://github.com/boykopovar/AnyPS5/blob/4430780bdd8875fda79b96540c5f46739f4f8687/core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp#L1811), [L1813-1814](https://github.com/boykopovar/AnyPS5/blob/4430780bdd8875fda79b96540c5f46739f4f8687/core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp#L1813-L1814), [L1816](https://github.com/boykopovar/AnyPS5/blob/4430780bdd8875fda79b96540c5f46739f4f8687/core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp#L1816), [L1905-1906](https://github.com/boykopovar/AnyPS5/blob/4430780bdd8875fda79b96540c5f46739f4f8687/core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp#L1905-L1906)<br>`core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp` [L328](https://github.com/boykopovar/AnyPS5/blob/4430780bdd8875fda79b96540c5f46739f4f8687/core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp#L328), [L377](https://github.com/boykopovar/AnyPS5/blob/4430780bdd8875fda79b96540c5f46739f4f8687/core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp#L377), [L739](https://github.com/boykopovar/AnyPS5/blob/4430780bdd8875fda79b96540c5f46739f4f8687/core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp#L739), [L770](https://github.com/boykopovar/AnyPS5/blob/4430780bdd8875fda79b96540c5f46739f4f8687/core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp#L770)<br>`core/shader/recompiler/Recompiler.hpp` [L144](https://github.com/boykopovar/AnyPS5/blob/4430780bdd8875fda79b96540c5f46739f4f8687/core/shader/recompiler/Recompiler.hpp#L144) | | | | #4706 | `docs/dev/debt/shader.md` [L100-102](https://github.com/boykopovar/AnyPS5/blob/4430780bdd8875fda79b96540c5f46739f4f8687/docs/dev/debt/shader.md#L100-L102) | | |
oneandonlydean commented 2026-10-13 00:58:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T00:58:15Z.


Pushed the rebase and one commit on top (c52321fab5), your two commits kept as they are:

  • Rebased onto main; the debt entry is now in docs/dev/debt/shader.md.
  • The primitive class is read at request version 19. Main already reads vertexSubgroups at 18, so a version-18 request from main was misread (RequestSerializer: truncated data); there is a test with one.
  • The whole word is composed as primitive | (SampleId << 8), without the Layer read, since draws render to one layer. The field-extract path still reads it; that is #4842, which goes on top of this.
  • The debt entry now says which bits have a source (0-1, 8-11) and that the rest are assumed zero, not measured.

ctest -R "agc|shader" is 462/462 on Linux/NVIDIA, and @fma-rc's request for 0x20b6440000 fails on main with the SelectU32 refusal and recompiles with this (71528 words). Not run on AMD or Windows here; full build is running.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6135726813 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4031#issuecomment-6135726813). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T00:58:15Z. --- Pushed the rebase and one commit on top (c52321fab5), your two commits kept as they are: - Rebased onto main; the debt entry is now in `docs/dev/debt/shader.md`. - The primitive class is read at request version 19. Main already reads `vertexSubgroups` at 18, so a version-18 request from main was misread (`RequestSerializer: truncated data`); there is a test with one. - The whole word is composed as `primitive | (SampleId << 8)`, without the `Layer` read, since draws render to one layer. The field-extract path still reads it; that is #4842, which goes on top of this. - The debt entry now says which bits have a source (0-1, 8-11) and that the rest are assumed zero, not measured. `ctest -R "agc|shader"` is 462/462 on Linux/NVIDIA, and @fma-rc's request for `0x20b6440000` fails on main with the `SelectU32` refusal and recompiles with this (71528 words). Not run on AMD or Windows here; full build is running.
AlxcBTW commented 2026-10-13 02:23:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-13T02:23:14Z.


@LeandroLP23 thanks for #4842, and for confirming agc_driver_pixel_ancillary_word 3/3 on the Radeon 860M with it merged under this branch. @oneandonlydean thanks for c52321fab.

With that commit, #4031 reads the render target index field (bits 16+) of the whole composed word as the constant 0, with the same reasoning as #4842: no pre-rasterization stage writes Layer today, and reading it breaks the position exports on AMD's Windows driver (#4800). The pixel_ancillary whole-word cases expect 0 for the field.

The extract path in lowerPackedAncillary still reads Layer on this branch; that's the part #4842 changes. Whichever of the two merges second only has to reconcile that one line in ConstantFolder.cpp and the matching test cases. If #4842 goes first, we're happy to do that on our side.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6136820711 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4031#issuecomment-6136820711). Originally posted by [AlxcBTW](https://github.com/AlxcBTW) on 2026-10-13T02:23:14Z. --- @LeandroLP23 thanks for #4842, and for confirming `agc_driver_pixel_ancillary_word` 3/3 on the Radeon 860M with it merged under this branch. @oneandonlydean thanks for c52321fab. With that commit, #4031 reads the render target index field (bits 16+) of the whole composed word as the constant 0, with the same reasoning as #4842: no pre-rasterization stage writes Layer today, and reading it breaks the position exports on AMD's Windows driver (#4800). The `pixel_ancillary` whole-word cases expect 0 for the field. The extract path in `lowerPackedAncillary` still reads Layer on this branch; that's the part #4842 changes. Whichever of the two merges second only has to reconcile that one line in `ConstantFolder.cpp` and the matching test cases. If #4842 goes first, we're happy to do that on our side. AI-assisted: yes (Claude Code)
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!4031
No description provided.