feat(shader): carry the shader float mode into the recompile request #1816

Merged
adriadam10 merged 1 commit from upstream-pr/1816 into main 2026-10-08 21:16:05 +00:00
adriadam10 commented 2026-10-08 20:17:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T20:17:36Z.


What

Step 2 of #981: carry each shader's float mode into the RecompileRequest. No behaviour change.

  • ShaderFloatMode (floatMode, dx10Clamp, ieeeMode, fp16Overflow) as an optional last member of GuestContext, so the existing positional initializers keep compiling. Empty means unknown (tests, tools).
  • RegisteredFloatMode decodes it from RSRC1 of the registered shader header: COMPUTE_PGM_RSRC1 (0x212) for compute, SPI_SHADER_PGM_RSRC1_PS (0x00a), _GS (0x08a) for vertex/geometry and _HS (0x10a) for local/hull. Bit positions are from Mesa's src/amd/registers/gfx10.json and gfx103.json: FLOAT_MODE 12-19, DX10_CLAMP 21 and IEEE_MODE 23 in all four. FP16_OVFL is at a different bit in each: 26 (CS), 29 (PS), 31 (GS), 30 (HS).
  • The mode is read from the registered header's sh_registers, both at registration and at draw/dispatch, so the prepared-artifact keys match by construction. Reading the live queue registers at draw time could miss a prepared artifact whenever they differed. Run-time RSRC1 writes are not seen (TechnicalDebt).
  • The mode is part of appendInterface and ContextHash, which feed the in-memory, prepared and disk cache keys. The request serializer writes it as version 13 and still reads 12 without it.
  • TechnicalDebt: the mode is carried but no translation reads it yet.

Tested

Linux (CachyOS), full ctest 488/488 on the merge with main.

  • agc_driver decodes all seven shader types from RSRC1 (FLOAT_MODE 0xc0 + DX10_CLAMP as in Astro's Playroom, IEEE_MODE, FP16_OVFL from each stage's own bit and never from another stage's bit), and returns no mode without registered state or RSRC1. Negative check: reading the pixel FP16_OVFL from bit 26 fails at stage type 1: FP16_OVFL not read from bit 29.
  • agc_shader_disk_cache: each field of the mode, and its presence, changes both the disk key and ContextHash. The mode survives a serializer round trip, and an unknown mode comes back empty.
  • agc_shader_memory: new requests are version 13, 14 is rejected, and older versions still load.

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:4792301304 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1816). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-08T20:17:36Z. --- ### What Step 2 of #981: carry each shader's float mode into the `RecompileRequest`. No behaviour change. - `ShaderFloatMode` (`floatMode`, `dx10Clamp`, `ieeeMode`, `fp16Overflow`) as an optional last member of `GuestContext`, so the existing positional initializers keep compiling. Empty means unknown (tests, tools). - `RegisteredFloatMode` decodes it from `RSRC1` of the registered shader header: `COMPUTE_PGM_RSRC1` (0x212) for compute, `SPI_SHADER_PGM_RSRC1_PS` (0x00a), `_GS` (0x08a) for vertex/geometry and `_HS` (0x10a) for local/hull. Bit positions are from Mesa's `src/amd/registers/gfx10.json` and `gfx103.json`: `FLOAT_MODE` 12-19, `DX10_CLAMP` 21 and `IEEE_MODE` 23 in all four. `FP16_OVFL` is at a different bit in each: 26 (CS), 29 (PS), 31 (GS), 30 (HS). - The mode is read from the registered header's `sh_registers`, both at registration and at draw/dispatch, so the prepared-artifact keys match by construction. Reading the live queue registers at draw time could miss a prepared artifact whenever they differed. Run-time RSRC1 writes are not seen (TechnicalDebt). - The mode is part of `appendInterface` and `ContextHash`, which feed the in-memory, prepared and disk cache keys. The request serializer writes it as version 13 and still reads 12 without it. - TechnicalDebt: the mode is carried but no translation reads it yet. ### Tested Linux (CachyOS), full ctest 488/488 on the merge with `main`. - `agc_driver` decodes all seven shader types from RSRC1 (FLOAT_MODE 0xc0 + DX10_CLAMP as in Astro's Playroom, IEEE_MODE, FP16_OVFL from each stage's own bit and never from another stage's bit), and returns no mode without registered state or RSRC1. Negative check: reading the pixel FP16_OVFL from bit 26 fails at `stage type 1: FP16_OVFL not read from bit 29`. - `agc_shader_disk_cache`: each field of the mode, and its presence, changes both the disk key and `ContextHash`. The mode survives a serializer round trip, and an unknown mode comes back empty. - `agc_shader_memory`: new requests are version 13, 14 is rejected, and older versions still load. ### 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
github-actions[bot] commented 2026-10-08 20:42:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T20:42:38Z.


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
#1732 core/libs/prx/libSceAgcDriver/tests/Submit.cpp L482
#1825 core/libs/prx/libSceAgcDriver/tests/Submit.cpp L482
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6068679551 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1816#issuecomment-6068679551). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-08T20:42:38Z. --- <!-- 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 | |---|---|---|---| | #1732 | `core/libs/prx/libSceAgcDriver/tests/Submit.cpp` [L482](https://github.com/boykopovar/AnyPS5/blob/aa277b3818d8cf7bc900bdfee740f318469df349/core/libs/prx/libSceAgcDriver/tests/Submit.cpp#L482) | | | | #1825 | `core/libs/prx/libSceAgcDriver/tests/Submit.cpp` [L482](https://github.com/boykopovar/AnyPS5/blob/aa277b3818d8cf7bc900bdfee740f318469df349/core/libs/prx/libSceAgcDriver/tests/Submit.cpp#L482) | | |
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!1816
No description provided.