fix(main): round 8_24_UNORM depth repack once without fma #16807

Merged
adriadam10 merged 1 commit from upstream-pr/16807 into main 2026-11-07 16:56:32 +00:00
adriadam10 commented 2026-11-07 16:56:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-11-07T16:56:24Z.


What

Fixes main's linux:agc_driver_image_depth24 (run 42379298429), broken by #16294. On lavapipe (no sampled D24S8) the 8_24_UNORM texture is repacked to R32_SFLOAT; fma(scaled, 2^-24, scaled) came out one ulp high there (0x3effe004 instead of 0x3effe003 for texel 0x007ff001), so the test read depth+1. The scale and the excess are now precise separate steps: the scale is exact and the add is the only rounding. #16294's feature is kept.

Tested

Not reproduced locally (build tree unavailable here); main's push build is the proof. Expected value checked by hand: float(d/(2^24-1)) for d=0x7ff001 is 0x3effe003, which the test maps back to d.

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; silent stubs listed
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a (CI lavapipe)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5203898282 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16807). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-11-07T16:56:24Z. --- ### What Fixes main's `linux:agc_driver_image_depth24` (run 42379298429), broken by #16294. On lavapipe (no sampled D24S8) the 8_24_UNORM texture is repacked to R32_SFLOAT; `fma(scaled, 2^-24, scaled)` came out one ulp high there (0x3effe004 instead of 0x3effe003 for texel 0x007ff001), so the test read depth+1. The scale and the excess are now `precise` separate steps: the scale is exact and the add is the only rounding. #16294's feature is kept. ### Tested Not reproduced locally (build tree unavailable here); main's push build is the proof. Expected value checked by hand: float(d/(2^24-1)) for d=0x7ff001 is 0x3effe003, which the test maps back to d. ### 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 - [x] Unimplemented paths throw; silent stubs listed - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a (CI lavapipe) - [x] AI-assisted: yes
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!16807
No description provided.